HomeHelpTrac

Changeset 11465 for trunk/xmlrpc


Ignore:
Timestamp:
07/17/09 06:28:35 (3 years ago)
Author:
Alexander Trofimov
Message:

albums for media

Location:
trunk/xmlrpc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/xmlrpc/BxDolXMLRPCImages.php

    r11418 r11465  
    9292            return new xmlrpcval ("fail upload"); 
    9393    } 
     94 
     95    function getImagesInAlbum($sUser, $sPwd, $sNick, $iAlbumId) 
     96    { 
     97        $iIdProfile = BxDolXMLRPCUtil::getIdByNickname ($sNick); 
     98        if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin ($sUser, $sPwd))) 
     99            return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 
     100 
     101        return BxDolXMLRPCMedia::_getFilesInAlbum ('photos', $iIdProfile, $iAlbumId); 
     102    } 
     103 
    94104} 
    95105 
  • trunk/xmlrpc/BxDolXMLRPCMedia.php

    r11418 r11465  
    1111            return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 
    1212 
    13         return BxDolXMLRPCMedia::_getFilesInCategory ('videos', $iIdProfile, $sCat); 
     13        return BxDolXMLRPCMedia::_getFilesInCategory ('videos', $iIdProfile, $sCat, 'video', 'getToken', 'flash/modules/video/files/get_mobile.php?id='); 
    1414    } 
    1515 
     
    2020            return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 
    2121 
    22         return BxDolXMLRPCMedia::_getFilesInCategory ('sounds', $iIdProfile, $sCat); 
    23     } 
    24  
    25     function _getFilesInCategory ($sModuleName, $iIdProfile, $sCat) 
     22        return BxDolXMLRPCMedia::_getFilesInCategory ('sounds', $iIdProfile, $sCat, 'mp3', 'getMp3Token', 'flash/modules/mp3/files/get_file.php?id='); 
     23    } 
     24 
     25    function _getFilesInCategory ($sModuleName, $iIdProfile, $sCat, $sWidget = '', $sFuncToken = '', $sTokenUrl = '') 
    2626    {      
     27        if ($sWidget) { 
     28            $GLOBALS['sModule'] = $sWidget; 
     29            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/{$sWidget}/inc/header.inc.php"); 
     30        } 
     31         
    2732        $a = BxDolService::call ($sModuleName, 'get_files_in_cat', array($iIdProfile, $sCat), 'Search'); 
    2833        if (!$a) 
     
    3035        foreach ($a as $k => $aRow) 
    3136        { 
     37            $sToken = ''; 
     38            if ($sFuncToken) 
     39                $sToken = $sFuncToken($aRow['id']); 
     40 
     41            $sUrl = $sTokenUrl && $sToken ? BX_DOL_URL_ROOT . $sTokenUrl . $aRow['id'] . '&token=' . $sToken : $aRow['file']; 
     42 
    3243            $a = array ( 
    3344                'id' => new xmlrpcval($aRow['id']), 
     
    3647                'icon' => new xmlrpcval($aRow['icon']), 
    3748                'thumb' => new xmlrpcval($aRow['thumb']), 
    38                 'file' => new xmlrpcval($aRow['file']), 
     49                'file' => new xmlrpcval($sUrl), 
    3950                'cat' => new xmlrpcval($sCat), 
    4051                'rate' => new xmlrpcval($aRow['voting_rate']), 
     
    150161        $aList = $o->getAlbumList (array('owner' => $iIdProfile)); 
    151162        $aXmlRpc = array (); 
    152         while ($aList = mysql_fetch_array ($r)) 
     163        foreach ($aList as $r) 
    153164        { 
    154165            $a = array ( 
    155                 'Id' => new xmlrpcval($a['ID']), 
    156                 'Title' => new xmlrpcval($a['Caption']), 
    157                 'Num' =>new xmlrpcval($a['ObjCount']), 
    158             ); 
    159             $aXmlRpc[] = new xmlrpcval($aFile, 'struct'); 
     166                'Id' => new xmlrpcval($r['ID']), 
     167                'Title' => new xmlrpcval($r['Caption']), 
     168                'Num' =>new xmlrpcval($r['ObjCount']), 
     169            ); 
     170            $aXmlRpc[] = new xmlrpcval($a, 'struct'); 
    160171        } 
    161172        return new xmlrpcval ($aXmlRpc, "array"); 
     
    170181            return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 
    171182 
    172         return BxDolXMLRPCMedia::_getFilesInAlbum ('videos', $iIdProfile, $iAlbumId); 
     183        return BxDolXMLRPCMedia::_getFilesInAlbum ('videos', $iIdProfile, $iAlbumId, 'video', 'getToken', 'flash/modules/video/files/get_mobile.php?id='); 
    173184    } 
    174185 
     
    179190            return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1,"int")), "struct")); 
    180191 
    181         return BxDolXMLRPCMedia::_getFilesInAlbum ('sounds', $iIdProfile, $iAlbumId); 
    182     } 
    183  
    184     function _getFilesInAlbum ($sModuleName, $iIdProfile, $iAlbumId) 
     192        return BxDolXMLRPCMedia::_getFilesInAlbum ('sounds', $iIdProfile, $iAlbumId, 'mp3', 'getMp3Token', 'flash/modules/mp3/files/get_file.php?id='); 
     193    } 
     194 
     195    function _getFilesInAlbum ($sModuleName, $iIdProfile, $iAlbumId, $sWidget = '', $sFuncToken = '', $sTokenUrl = '') 
    185196    {      
     197        if ($sWidget) { 
     198            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/global/inc/db.inc.php"); 
     199            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/{$sWidget}/inc/header.inc.php"); 
     200            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/{$sWidget}/inc/constants.inc.php"); 
     201            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/{$sWidget}/inc/functions.inc.php"); 
     202        } 
     203 
    186204        $a = BxDolService::call ($sModuleName, 'get_files_in_album', array($iAlbumId), 'Search'); 
    187205        if (!$a) 
     
    189207        foreach ($a as $k => $aRow) 
    190208        { 
     209            $sToken = ''; 
     210            if ($sFuncToken) 
     211                $sToken = $sFuncToken($aRow['id']); 
     212           
     213            $sUrl = $sTokenUrl && $sToken ? BX_DOL_URL_ROOT . $sTokenUrl . $aRow['id'] . '&token=' . $sToken : $aRow['file']; 
     214 
    191215            $a = array ( 
    192216                'id' => new xmlrpcval($aRow['id']), 
     
    195219                'icon' => new xmlrpcval($aRow['icon']), 
    196220                'thumb' => new xmlrpcval($aRow['thumb']), 
    197                 'file' => new xmlrpcval($aRow['file']), 
     221                'file' => new xmlrpcval($sUrl), 
    198222                'cat' => new xmlrpcval($sCat), 
    199                 'rate' => new xmlrpcval($aRow['voting_rate']), 
    200                 'rate_count' => new xmlrpcval((int)$aRow['voting_count']), 
     223                'rate' => new xmlrpcval($aRow['Rate']), 
     224                'rate_count' => new xmlrpcval((int)$aRow['RateCount']), 
    201225            ); 
    202226            $aFiles[] = new xmlrpcval($a, 'struct'); 
  • trunk/xmlrpc/BxDolXMLRPCUtil.php

    r11418 r11465  
    8282    function getThumbLink ($iId, $sType = 'thumb') 
    8383    { 
    84         global $oFunctions; 
    85         $aProfileInfo = getProfileInfo( $iId );          
    86         $aImageFile = BxDolService::call('bx_photos', 'get_image', array($aProfileInfo, $sType), 'Search'); 
    87         return $aImageFile ? $aImageFile['file'] : false; 
     84        $sType = $sType == 'thumb' ? 'medium' : 'small'; 
     85        return $GLOBALS['oFunctions']->getMemberAvatar ($iId, $sType); 
    8886    } 
    8987 
     
    9896        $aRet['country'] = new xmlrpcval($aSexSql['Country']); 
    9997        $aRet['city'] = new xmlrpcval($aSexSql['City']); 
     98        $aRet['countFriends'] = new xmlrpcval(getFriendNumber($iId)); 
    10099 
    101100        bx_import('BxDolAlbums'); 
    102101 
    103102        $o = new BxDolAlbums ('bx_photos', $iId); 
    104         $aRet['countPhotos'] = new xmlrpcval($o->getAlbumList (array('owner' => $iId, 'status' => ''))); 
     103        $aRet['countPhotos'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 
    105104 
    106105        $o = new BxDolAlbums ('bx_videos', $iId); 
    107         $aRet['countVideos'] = new xmlrpcval($o->getAlbumList (array('owner' => $iId, 'status' => ''))); 
     106        $aRet['countVideos'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 
    108107 
    109108        $o = new BxDolAlbums ('bx_sounds', $iId); 
    110         $aRet['countSounds'] = new xmlrpcval($o->getAlbumList (array('owner' => $iId, 'status' => ''))); 
     109        $aRet['countSounds'] = new xmlrpcval($o->getObjTotalCount (array('owner' => $iId))); 
    111110 
    112111        return $aRet; 
     
    116115    { 
    117116        $sImageKey = ucfirst ($sImage); 
    118         $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage);  
     117        $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage); 
     118 
     119        bx_import('BxDolAlbums'); 
     120 
     121        $oPhotos = new BxDolAlbums ('bx_photos', $iId); 
     122        $oVideos = new BxDolAlbums ('bx_videos', $iId); 
     123        $oSounds = new BxDolAlbums ('bx_sounds', $iId); 
     124 
    119125        return array ( 
    120126               'ID' => new xmlrpcval($a['ID']), 
     
    125131               'Country' => new xmlrpcval(_t($GLOBALS['aPreValues']['Country'][$a['Country']]['LKey'])), 
    126132               'City' => new xmlrpcval($a['City']), 
     133               'CountPhotos' => new xmlrpcval($oPhotos->getObjTotalCount (array('owner' => $a['ID']))), 
     134               'CountVideos' => new xmlrpcval($oVideos->getObjTotalCount (array('owner' => $a['ID']))), 
     135               'CountSounds' => new xmlrpcval($oSounds->getObjTotalCount (array('owner' => $a['ID']))), 
     136               'CountFriends' => new xmlrpcval(getFriendNumber($a['ID'])), 
    127137               $sImageKey => new xmlrpcval($sImage), 
    128138            ); 
  • trunk/xmlrpc/index.php

    r11418 r11465  
    211211                "docstring" => "get profile's video albums", 
    212212            ), 
     213            "dolphin.getImagesInAlbum" => array( 
     214                "function" => "BxDolXMLRPCImages::getImagesInAlbum", 
     215                "signature" => array (array ($xmlrpcArray, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString)), 
     216                "docstring" => "get profile's images in specified album", 
     217            ),             
     218            "dolphin.getVideoInAlbum" => array( 
     219                "function" => "BxDolXMLRPCMedia::getVideoInAlbum", 
     220                "signature" => array (array ($xmlrpcArray, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString)), 
     221                "docstring" => "get profile's video in specified album", 
     222            ),             
     223            "dolphin.getAudioInAlbum" => array( 
     224                "function" => "BxDolXMLRPCMedia::getAudioInAlbum", 
     225                "signature" => array (array ($xmlrpcArray, $xmlrpcString, $xmlrpcString, $xmlrpcString, $xmlrpcString)), 
     226                "docstring" => "get profile's sounds in specified album", 
     227            ),             
    213228        ), 
    214229        0 
Note: See TracChangeset for help on using the changeset viewer.