HomeHelpTrac

Ignore:
Timestamp:
06/07/11 23:41:51 (12 months ago)
Author:
Alexander Trofimov
Message:

Code cleaning:

  • converting new lines to \n
  • deleting spaces at the end of every line
  • converting all tabs to 4 spaces
  • automated script for future cleaning was added
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xmlrpc/BxDolXMLRPCMedia.php

    r14550 r15211  
    2424 
    2525    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); 
    2828 
    2929        $aXmlRpc = array (); 
    3030 
    31         foreach ($aAlbums as $r) 
    32         { 
     31        foreach ($aAlbums as $r) 
     32        { 
    3333            $a = array ( 
    3434                'Id' => new xmlrpcval($r['Id']), 
     
    4040 
    4141        return new xmlrpcval ($aXmlRpc, "array"); 
    42     }     
     42    } 
    4343 
    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    } 
    5151 
    5252    function _getMediaAlbumsArray ($sType, $iIdProfile, $iIdProfileViewer, $isShowEmptyAlbums = false) 
    53     {         
     53    { 
    5454        switch ($sType) { 
    5555            case 'photo': 
    56                 $sModuleName = 'photos'; 
     56                $sModuleName = 'photos'; 
    5757                $sType = 'bx_photos'; 
    58                 $sMemAction = 'BX_PHOTOS_VIEW'; 
     58                $sMemAction = 'BX_PHOTOS_VIEW'; 
    5959                break; 
    6060            case 'video': 
    61                 $sModuleName = 'videos'; 
     61                $sModuleName = 'videos'; 
    6262                $sType = 'bx_videos'; 
    63                 $sMemAction = 'BX_VIDEOS_VIEW'; 
     63                $sMemAction = 'BX_VIDEOS_VIEW'; 
    6464                break; 
    6565            case 'music': 
    66                 $sModuleName = 'sounds'; 
     66                $sModuleName = 'sounds'; 
    6767                $sType = 'bx_sounds'; 
    68                 $sMemAction = 'BX_SOUNDS_VIEW'; 
    69                 break;           
     68                $sMemAction = 'BX_SOUNDS_VIEW'; 
     69                break; 
    7070            default: 
    7171                return array(); 
    7272        } 
    7373 
    74         if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) 
    75             return array (); 
     74        if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iIdProfileViewer, $sMemAction)) 
     75            return array (); 
    7676 
    7777        bx_import('BxDolAlbums'); 
     
    8181        foreach ($aList as $r) 
    8282        { 
    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 
    8686            $aRet[] = array ( 
    8787                'Id' => $r['ID'], 
     
    9393    } 
    9494 
    95     // ----------------- file list in albums  
     95    // ----------------- file list in albums 
    9696 
    9797    function getVideoInAlbum($sUser, $sPwd, $sNick, $iAlbumId) 
     
    114114 
    115115    function _getFilesInAlbum ($sModuleName, $iIdProfile, $iIdProfileViewer, $iAlbumId, $sWidget = '', $sFuncToken = '', $sTokenUrl = '') 
    116     {      
     116    { 
    117117        if ($sWidget && preg_match('/^[a-zA-Z0-9_]+$/', $sWidget)) { 
    118118            require_once (BX_DIRECTORY_PATH_ROOT . "flash/modules/global/inc/db.inc.php"); 
     
    127127        foreach ($a as $k => $aRow) 
    128128        { 
    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             } 
     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            } 
    141141 
    142142            $a = array ( 
     
    158158    function _isMembershipEnabledFor ($iProfileId, $sMembershipActionConstant, $isPerformAction = false) { 
    159159        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); 
    163163        return $aCheck[CHECK_ACTION_RESULT] == CHECK_ACTION_RESULT_ALLOWED; 
    164     }     
     164    } 
    165165} 
    166166 
Note: See TracChangeset for help on using the changeset viewer.