Changeset 15211 for trunk/xmlrpc/BxDolXMLRPCMedia.php
- Timestamp:
- 06/07/11 23:41:51 (12 months ago)
- File:
-
- 1 edited
-
trunk/xmlrpc/BxDolXMLRPCMedia.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xmlrpc/BxDolXMLRPCMedia.php
r14550 r15211 24 24 25 25 function _getMediaAlbums ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) 26 { 27 $aAlbums = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums);26 { 27 $aAlbums = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums); 28 28 29 29 $aXmlRpc = array (); 30 30 31 foreach ($aAlbums as $r)32 {31 foreach ($aAlbums as $r) 32 { 33 33 $a = array ( 34 34 'Id' => new xmlrpcval($r['Id']), … … 40 40 41 41 return new xmlrpcval ($aXmlRpc, "array"); 42 } 42 } 43 43 44 function _getMediaCount ($sType, $iIdProfile, $iIdProfileViewer) {45 $a = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer);46 $iNum = 0;47 foreach ($a as $r) 48 $iNum += $r['Num'];49 return $iNum;50 }44 function _getMediaCount ($sType, $iIdProfile, $iIdProfileViewer) { 45 $a = BxDolXMLRPCMedia::_getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer); 46 $iNum = 0; 47 foreach ($a as $r) 48 $iNum += $r['Num']; 49 return $iNum; 50 } 51 51 52 52 function _getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) 53 { 53 { 54 54 switch ($sType) { 55 55 case 'photo': 56 $sModuleName = 'photos';56 $sModuleName = 'photos'; 57 57 $sType = 'bx_photos'; 58 $sMemAction = 'BX_PHOTOS_VIEW';58 $sMemAction = 'BX_PHOTOS_VIEW'; 59 59 break; 60 60 case 'video': 61 $sModuleName = 'videos';61 $sModuleName = 'videos'; 62 62 $sType = 'bx_videos'; 63 $sMemAction = 'BX_VIDEOS_VIEW';63 $sMemAction = 'BX_VIDEOS_VIEW'; 64 64 break; 65 65 case 'music': 66 $sModuleName = 'sounds';66 $sModuleName = 'sounds'; 67 67 $sType = 'bx_sounds'; 68 $sMemAction = 'BX_SOUNDS_VIEW';69 break; 68 $sMemAction = 'BX_SOUNDS_VIEW'; 69 break; 70 70 default: 71 71 return array(); 72 72 } 73 73 74 if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction))75 return array ();74 if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) 75 return array (); 76 76 77 77 bx_import('BxDolAlbums'); … … 81 81 foreach ($aList as $r) 82 82 { 83 if ($iIdProfile != $iIdProfileViewer && !BxDolService::call ($sModuleName, 'get_album_privacy', array((int)$r['ID'], $iIdProfileViewer), 'Search'))84 continue;85 83 if ($iIdProfile != $iIdProfileViewer && !BxDolService::call ($sModuleName, 'get_album_privacy', array((int)$r['ID'], $iIdProfileViewer), 'Search')) 84 continue; 85 86 86 $aRet[] = array ( 87 87 'Id' => $r['ID'], … … 93 93 } 94 94 95 // ----------------- file list in albums 95 // ----------------- file list in albums 96 96 97 97 function getVideoInAlbum($sUser, $sPwd, $sNick, $iAlbumId) … … 114 114 115 115 function _getFilesInAlbum ($sModuleName, $iIdProfile, $iIdProfileViewer, $iAlbumId, $sWidget = '', $sFuncToken = '', $sTokenUrl = '') 116 { 116 { 117 117 if ($sWidget && preg_match('/^[a-zA-Z0-9_]+$/', $sWidget)) { 118 118 require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/global/inc/db.inc.php"); … … 127 127 foreach ($a as $k => $aRow) 128 128 { 129 if ('youtube' == $aRow['Source'])130 {131 $sUrl = $aRow['Video'];132 } 133 else134 {135 $sToken = '';136 if ($sFuncToken)137 $sToken = $sFuncToken($aRow['id']);138 139 $sUrl = $sTokenUrl && $sToken ? BX_DOL_URL_ROOT . $sTokenUrl . $aRow['id'] . '&token=' . $sToken : $aRow['file'];140 }129 if ('youtube' == $aRow['Source']) 130 { 131 $sUrl = $aRow['Video']; 132 } 133 else 134 { 135 $sToken = ''; 136 if ($sFuncToken) 137 $sToken = $sFuncToken($aRow['id']); 138 139 $sUrl = $sTokenUrl && $sToken ? BX_DOL_URL_ROOT . $sTokenUrl . $aRow['id'] . '&token=' . $sToken : $aRow['file']; 140 } 141 141 142 142 $a = array ( … … 158 158 function _isMembershipEnabledFor ($iProfileId, $sMembershipActionConstant, $isPerformAction = false) { 159 159 defineMembershipActions (array('photos add', 'photos view', 'sounds view', 'videos view')); 160 if (!defined($sMembershipActionConstant))161 return false;162 $aCheck = checkAction($iProfileId ? $iProfileId : $_COOKIE['memberID'], constant($sMembershipActionConstant), $isPerformAction);160 if (!defined($sMembershipActionConstant)) 161 return false; 162 $aCheck = checkAction($iProfileId ? $iProfileId : $_COOKIE['memberID'], constant($sMembershipActionConstant), $isPerformAction); 163 163 return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; 164 } 164 } 165 165 } 166 166
Note: See TracChangeset
for help on using the changeset viewer.