HomeHelpTrac

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

albums for media

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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'); 
Note: See TracChangeset for help on using the changeset viewer.