function getVideoInAlbum($sUser, $sPwd, $sNick, $iAlbumId)
 {
     $iIdProfile = BxDolXMLRPCUtil::getIdByNickname($sNick);
     if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     return BxDolXMLRPCMedia::_getFilesInAlbum('videos', $iIdProfile, $iId, $iAlbumId, 'video', 'getToken', 'flash/modules/video/get_mobile.php?id=');
 }
 function getImagesInAlbum($sUser, $sPwd, $sNick, $iAlbumId)
 {
     $iIdProfile = BxDolXMLRPCUtil::getIdByNickname($sNick);
     if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     return BxDolXMLRPCMedia::_getFilesInAlbum('photos', $iIdProfile, $iId, (int) $iAlbumId);
 }
示例#3
0
 function fillProfileArray($a, $sImage = 'icon', $iIdViewer = 0)
 {
     if (!$iIdViewer) {
         $iIdViewer = $_COOKIE['memberID'];
     }
     $sImageKey = ucfirst($sImage);
     $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage);
     bx_import('BxDolAlbums');
     return array('ID' => new xmlrpcval($a['ID']), 'Title' => new xmlrpcval($a['Headline']), 'Nick' => new xmlrpcval($a['NickName']), 'Sex' => new xmlrpcval($a['Sex']), 'Age' => new xmlrpcval(age($a['DateOfBirth'])), 'Country' => new xmlrpcval(_t($GLOBALS['aPreValues']['Country'][$a['Country']]['LKey'])), 'City' => new xmlrpcval($a['City']), 'CountPhotos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('photo', $iId, $iIdViewer)), 'CountVideos' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('video', $iId, $iIdViewer)), 'CountSounds' => new xmlrpcval(BxDolXMLRPCMedia::_getMediaCount('music', $iId, $iIdViewer)), 'CountFriends' => new xmlrpcval(getFriendNumber($a['ID'])), $sImageKey => new xmlrpcval($sImage));
 }
示例#4
0
 function _uploadFile($sType, $sUser, $sPwd, $sAlbum, $binData, $iDataLength, $sTitle, $sTags, $sDesc, $sExt)
 {
     $sFieldTitle = 'title';
     $sFieldDesc = 'desc';
     $sFieldTags = 'tags';
     $sFieldCats = 'categories';
     $sFieldAlbum = 'album';
     switch ($sType) {
         case 'photo':
             $sModuleName = 'photos';
             $sService = 'perform_photo_upload';
             $sMemAction = 'BX_PHOTOS_ADD';
             $sFieldTitle = 'medTitle';
             $sFieldDesc = 'medDesc';
             $sFieldTags = 'medTags';
             $sFieldCats = 'Categories';
             $sFieldAlbum = 'album';
             $sModuleUnit = 'bx_photos';
             break;
         case 'video':
             $sModuleName = 'videos';
             $sService = 'perform_video_upload';
             $sMemAction = 'BX_VIDEOS_ADD';
             $sModuleUnit = 'bx_videos';
             break;
         case 'music':
             $sModuleName = 'sounds';
             $sService = 'perform_sound_upload';
             $sMemAction = 'BX_SOUNDS_ADD';
             $sModuleUnit = 'bx_sounds';
             break;
         default:
             return array();
     }
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     if (!BxDolXMLRPCMedia::_isMembershipEnabledFor($iId, $sMemAction, true)) {
         return new xmlrpcval("fail access");
     }
     if (!BxDolService::call($sModuleName, 'is_ext_allowed', array($sExt), 'Uploader')) {
         return new xmlrpcval("fail wrong extension - " . $sExt);
     }
     // write tmp file
     $sTmpFilename = BX_DIRECTORY_PATH_ROOT . "tmp/" . time() . $sType . $iId . '.' . $sExt;
     $f = fopen($sTmpFilename, "wb");
     if (!$f) {
         return new xmlrpcval("fail fopen");
     }
     if (!fwrite($f, $binData, (int) $iDataLength)) {
         fclose($f);
         return new xmlrpcval("fail write");
     }
     fclose($f);
     // upload
     $aFileInfo = array();
     $aFileInfo[$sFieldTitle] = $sTitle;
     $aFileInfo[$sFieldDesc] = $sDesc;
     $aFileInfo[$sFieldTags] = $sTags;
     $aFileInfo[$sFieldCats] = 'photo' == $sType ? array($sAlbum) : $sAlbum;
     $aFileInfo[$sFieldAlbum] = $sAlbum;
     if ('photo' == $sType && BxDolService::call($sModuleName, $sService, array($sTmpFilename, $aFileInfo, 0, $iId), 'Uploader')) {
         return new xmlrpcval("ok");
     } elseif ('photo' != $sType && ($iFileId = BxDolService::call($sModuleName, $sService, array($sTmpFilename, $aFileInfo, true), 'Uploader'))) {
         $oZ = new BxDolAlerts($sModuleUnit, 'add', $iFileId, $iId);
         $oZ->alert();
         return new xmlrpcval("ok");
     } else {
         return new xmlrpcval("fail upload");
     }
 }
示例#5
0
 public static function fillProfileArray($a, $sImage = 'icon', $iIdViewer = 0)
 {
     if (!$iIdViewer) {
         $iIdViewer = (int) $_COOKIE['memberID'];
     }
     $sImageKey = ucfirst($sImage);
     $sImage = BxDolXMLRPCUtil::getThumbLink($a['ID'], $sImage);
     bx_import('BxDolAlbums');
     $oBxDolXMLRPCMedia = new BxDolXMLRPCMedia();
     $aRet = array('user_title' => new xmlrpcval($GLOBALS['oFunctions']->getUserTitle($a['ID'])), 'user_info' => new xmlrpcval($GLOBALS['oFunctions']->getUserInfo($a['ID']) . ' '), 'user_location' => new xmlrpcval(BxDolXMLRPCUtil::getUserLocation($a) . ' '), 'user_friend' => new xmlrpcval(is_friends($a['ID'], (int) $iIdViewer) ? 1 : 0), 'ID' => new xmlrpcval($a['ID']), 'Title' => new xmlrpcval($GLOBALS['oFunctions']->getUserTitle($a['ID'])), 'Nick' => new xmlrpcval($a['NickName']), 'Sex' => new xmlrpcval($a['Sex']), 'Age' => new xmlrpcval(age($a['DateOfBirth'])), 'Country' => new xmlrpcval(_t($GLOBALS['aPreValues']['Country'][$a['Country']]['LKey'])), 'City' => new xmlrpcval($a['City']), 'CountPhotos' => new xmlrpcval($oBxDolXMLRPCMedia->_getMediaCount('photo', $iId, $iIdViewer)), 'CountVideos' => new xmlrpcval($oBxDolXMLRPCMedia->_getMediaCount('video', $iId, $iIdViewer)), 'CountSounds' => new xmlrpcval($oBxDolXMLRPCMedia->_getMediaCount('music', $iId, $iIdViewer)), 'CountFriends' => new xmlrpcval(getFriendNumber($a['ID'])), $sImageKey => new xmlrpcval($sImage));
     bx_import('BxDolAlerts');
     $oZ = new BxDolAlerts('mobile', 'user_info2', $a['ID'], $iIdViewer, array('profile' => &$a, 'return_data' => &$aRet));
     $oZ->alert();
     return $aRet;
 }