function _getMessages($sUser, $sPwd, $isInbox) { $aRet = array(); if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) { return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct")); } $aMsgs = array(); $sWhere = $isInbox ? " `Recipient` = '{$iId}' " : " `Sender`= '{$iId}' "; $sJoinOn = $isInbox ? " `m`.`Sender` = `p`.`ID` " : " `m`.`Recipient` = `p`.`ID` "; $r = db_res("SELECT \r\n `m`.`ID`, `m`.`Date`, `m`.`Sender`, `m`.`Recipient`, `m`.`Subject`, `m`.`New`, \r\n `p`.`NickName` AS `Nick` \r\n FROM `sys_messages` AS `m`\r\n LEFT JOIN `Profiles` AS `p` ON ({$sJoinOn})\r\n WHERE {$sWhere} \r\n ORDER BY `Date` DESC"); while ($aRow = mysql_fetch_array($r)) { $sIcon = BxDolXMLRPCUtil::getThumbLink($isInbox ? $aRow['Sender'] : $aRow['Recipient'], 'thumb'); $aMsg = array('ID' => new xmlrpcval($aRow['ID']), 'Date' => new xmlrpcval($aRow['Date']), 'Sender' => new xmlrpcval($aRow['Sender']), 'Recipient' => new xmlrpcval($aRow['Recipient']), 'Subject' => new xmlrpcval($aRow['Subject']), 'New' => new xmlrpcval($aRow['New']), 'Nick' => new xmlrpcval($aRow['Nick']), 'Thumb' => new xmlrpcval($sIcon)); $aMsgs[] = new xmlrpcval($aMsg, 'struct'); } return new xmlrpcval($aMsgs, "array"); }
function _getMessages($sUser, $sPwd, $isInbox) { $aRet = array(); if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) { return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct")); } $aMsgs = array(); if ($isInbox) { $sWhere = "`Recipient` = '{$iId}' AND NOT FIND_IN_SET('recipient', `Trash`)"; } else { $sWhere = "`Sender` = '{$iId}' AND NOT FIND_IN_SET('sender', `Trash`)"; } $sFieldsAdd = $isInbox ? ", `m`.`Sender` AS `AuthorID`" : ", `m`.`Recipient` AS `AuthorID` "; $r = db_res("SELECT\n `m`.`ID`, UNIX_TIMESTAMP(`m`.`Date`) AS `Date`, `m`.`Sender`, `m`.`Recipient`, `m`.`Subject`, `m`.`New` {$sFieldsAdd}\n FROM `sys_messages` AS `m`\n INNER JOIN `Profiles` as `p` ON (`p`.`ID` = `m`.`Sender`)\n WHERE {$sWhere}\n ORDER BY `Date` DESC"); while ($aRow = $r->fetch()) { $sIcon = BxDolXMLRPCUtil::getThumbLink($isInbox ? $aRow['Sender'] : $aRow['Recipient'], 'thumb'); $aMsg = array('ID' => new xmlrpcval($aRow['ID']), 'Date' => new xmlrpcval(defineTimeInterval($aRow['Date'])), 'Sender' => new xmlrpcval($aRow['Sender']), 'Recipient' => new xmlrpcval($aRow['Recipient']), 'Subject' => new xmlrpcval($aRow['Subject']), 'New' => new xmlrpcval($aRow['New']), 'Nick' => new xmlrpcval(getUsername($aRow['AuthorID'])), 'UserTitleInterlocutor' => new xmlrpcval(getNickName($aRow['AuthorID'])), 'Thumb' => new xmlrpcval($sIcon)); $aMsgs[] = new xmlrpcval($aMsg, 'struct'); } return new xmlrpcval($aMsgs, "array"); }
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)); }
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; }