Changeset 13382 for trunk/xmlrpc/BxDolXMLRPCMedia.php
- Timestamp:
- 12/07/09 21:07:35 (2 years ago)
- File:
-
- 1 edited
-
trunk/xmlrpc/BxDolXMLRPCMedia.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc/BxDolXMLRPCMedia.php
r13378 r13382 135 135 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 136 136 137 return BxDolXMLRPCMedia::_getMediaAlbums ('music', $iIdProfile );137 return BxDolXMLRPCMedia::_getMediaAlbums ('music', $iIdProfile, $iId); 138 138 } 139 139 … … 144 144 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 145 145 146 return BxDolXMLRPCMedia::_getMediaAlbums ('video', $iIdProfile); 147 } 148 149 function _getMediaAlbums ($sType, $iIdProfile, $isShowEmptyAlbums = false) 146 return BxDolXMLRPCMedia::_getMediaAlbums ('video', $iIdProfile, $iId); 147 } 148 149 function _getMediaAlbums ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) 150 { 151 $aAlbums = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums); 152 153 $aXmlRpc = array (); 154 155 foreach ($aAlbums as $r) 156 { 157 $a = array ( 158 'Id' => new xmlrpcval($r['Id']), 159 'Title' => new xmlrpcval($r['Title']), 160 'Num' =>new xmlrpcval($r['Num']), 161 ); 162 $aXmlRpc[] = new xmlrpcval($a, 'struct'); 163 } 164 165 return new xmlrpcval ($aXmlRpc, "array"); 166 } 167 168 function _getMediaCount ($sType, $iIdProfile, $iIdProfileViewer) { 169 $a = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer); 170 $iNum = 0; 171 foreach ($a as $r) 172 $iNum += $r['Num']; 173 return $iNum; 174 } 175 176 function _getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) 150 177 { 151 178 switch ($sType) { 152 179 case 'photo': 180 $sModuleName = 'photos'; 153 181 $sType = 'bx_photos'; 154 182 break; 155 183 case 'video': 184 $sModuleName = 'videos'; 156 185 $sType = 'bx_videos'; 157 186 break; 158 187 case 'music': 188 $sModuleName = 'sounds'; 159 189 $sType = 'bx_sounds'; 160 190 break; 161 191 default: 162 return new xmlrpcval (array(), "array");192 return array(); 163 193 } 164 194 bx_import('BxDolAlbums'); 165 195 $o = new BxDolAlbums ($sType, (int)$iIdProfile); 166 196 $aList = $o->getAlbumList (array('owner' => (int)$iIdProfile, 'show_empty' => $isShowEmptyAlbums)); 167 $a XmlRpc= array ();197 $aRet = array (); 168 198 foreach ($aList as $r) 169 199 { 170 $a = array ( 171 'Id' => new xmlrpcval($r['ID']), 172 'Title' => new xmlrpcval($r['Caption']), 173 'Num' =>new xmlrpcval($r['ObjCount']), 174 ); 175 $aXmlRpc[] = new xmlrpcval($a, 'struct'); 176 } 177 return new xmlrpcval ($aXmlRpc, "array"); 178 } 200 if ($iIdProfile != $iIdProfileViewer && !BxDolService::call ($sModuleName, 'get_album_privacy', array((int)$r['ID'], $iIdProfileViewer), 'Search')) 201 continue; 202 203 $aRet[] = array ( 204 'Id' => $r['ID'], 205 'Title' => $r['Caption'], 206 'Num' => $r['ObjCount'], 207 ); 208 } 209 return $aRet; 210 } 179 211 180 212 // ----------------- file list in albums … … 186 218 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 187 219 188 return BxDolXMLRPCMedia::_getFilesInAlbum ('videos', $iIdProfile, $i AlbumId, 'video', 'getToken', 'flash/modules/video/files/get_mobile.php?id=');220 return BxDolXMLRPCMedia::_getFilesInAlbum ('videos', $iIdProfile, $iId, $iAlbumId, 'video', 'getToken', 'flash/modules/video/files/get_mobile.php?id='); 189 221 } 190 222 … … 195 227 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 196 228 197 return BxDolXMLRPCMedia::_getFilesInAlbum ('sounds', $iIdProfile, $i AlbumId, 'mp3', 'getMp3Token', 'flash/modules/mp3/files/get_file.php?id=');198 } 199 200 function _getFilesInAlbum ($sModuleName, $iIdProfile, $i AlbumId, $sWidget = '', $sFuncToken = '', $sTokenUrl = '')229 return BxDolXMLRPCMedia::_getFilesInAlbum ('sounds', $iIdProfile, $iId, $iAlbumId, 'mp3', 'getMp3Token', 'flash/modules/mp3/files/get_file.php?id='); 230 } 231 232 function _getFilesInAlbum ($sModuleName, $iIdProfile, $iIdProfileViewer, $iAlbumId, $sWidget = '', $sFuncToken = '', $sTokenUrl = '') 201 233 { 202 234 if ($sWidget && preg_match('/^[a-zA-Z0-9_]+$/', $sWidget)) { … … 207 239 } 208 240 209 $a = BxDolService::call ($sModuleName, 'get_files_in_album', array((int)$iAlbumId ), 'Search');241 $a = BxDolService::call ($sModuleName, 'get_files_in_album', array((int)$iAlbumId, $iIdProfileViewer != $iIdProfile, $iIdProfileViewer), 'Search'); 210 242 if (!$a) 211 243 return new xmlrpcval (array(), "array");
Note: See TracChangeset
for help on using the changeset viewer.