Changeset 13382 for trunk/xmlrpc
- Timestamp:
- 12/07/09 21:07:35 (2 years ago)
- Location:
- trunk/xmlrpc
- Files:
-
- 3 edited
-
BxDolXMLRPCImages.php (modified) (2 diffs)
-
BxDolXMLRPCMedia.php (modified) (5 diffs)
-
BxDolXMLRPCUtil.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc/BxDolXMLRPCImages.php
r13378 r13382 53 53 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 54 54 55 return BxDolXMLRPCMedia::_getMediaAlbums ('photo', $iIdProfile, $iId Profile == $iId);55 return BxDolXMLRPCMedia::_getMediaAlbums ('photo', $iIdProfile, $iId, $iIdProfile == $iId); 56 56 } 57 57 … … 97 97 return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 98 98 99 return BxDolXMLRPCMedia::_getFilesInAlbum ('photos', $iIdProfile, (int)$iAlbumId);99 return BxDolXMLRPCMedia::_getFilesInAlbum ('photos', $iIdProfile, $iId, (int)$iAlbumId); 100 100 } 101 101 -
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"); -
trunk/xmlrpc/BxDolXMLRPCUtil.php
r13379 r13382 86 86 } 87 87 88 function getUserInfo($iId )88 function getUserInfo($iId, $iIdViewer = 0) 89 89 { 90 if (!$iIdViewer) 91 $iIdViewer = $_COOKIE['memberID']; 92 90 93 $aRet = array (); 91 94 $aSexSql = getProfileInfo((int)$iId); … … 99 102 $aRet['countFriends'] = new xmlrpcval(getFriendNumber($iId)); 100 103 101 bx_import('BxDolAlbums'); 102 103 $o = new BxDolAlbums ('bx_photos', $iId); 104 $aRet['countPhotos'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 105 106 $o = new BxDolAlbums ('bx_videos', $iId); 107 $aRet['countVideos'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 108 109 $o = new BxDolAlbums ('bx_sounds', $iId); 110 $aRet['countSounds'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 104 $aRet['countPhotos'] = new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('photo', $iId, $iIdViewer)); 105 $aRet['countVideos'] = new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('video', $iId, $iIdViewer)); 106 $aRet['countSounds'] = new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('music', $iId, $iIdViewer)); 111 107 112 108 return $aRet; 113 109 } 114 110 115 function fillProfileArray ($a, $sImage = 'icon' )111 function fillProfileArray ($a, $sImage = 'icon', $iIdViewer = 0) 116 112 { 113 if (!$iIdViewer) 114 $iIdViewer = $_COOKIE['memberID']; 115 117 116 $sImageKey = ucfirst ($sImage); 118 117 $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage); 119 118 120 119 bx_import('BxDolAlbums'); 121 122 $oPhotos = new BxDolAlbums ('bx_photos', $iId);123 $oVideos = new BxDolAlbums ('bx_videos', $iId);124 $oSounds = new BxDolAlbums ('bx_sounds', $iId);125 120 126 121 return array ( … … 132 127 'Country' => new xmlrpcval(_t($GLOBALS['aPreValues']['Country'][$a['Country']]['LKey'])), 133 128 'City' => new xmlrpcval($a['City']), 134 'CountPhotos' => new xmlrpcval( $oPhotos->getObjTotalCount (array('owner' => $a['ID']))),135 'CountVideos' => new xmlrpcval( $oVideos->getObjTotalCount (array('owner' => $a['ID']))),136 'CountSounds' => new xmlrpcval( $oSounds->getObjTotalCount (array('owner' => $a['ID']))),129 'CountPhotos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('photo', $iId, $iIdViewer)), 130 'CountVideos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('video', $iId, $iIdViewer)), 131 'CountSounds' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('music', $iId, $iIdViewer)), 137 132 'CountFriends' => new xmlrpcval(getFriendNumber($a['ID'])), 138 133 $sImageKey => new xmlrpcval($sImage),
Note: See TracChangeset
for help on using the changeset viewer.