function _getAllTables($data = false)
 {
     $Query = "SHOW TABLES";
     $Result = db_res($Query);
     while ($Row = $Result->fetch(PDO::FETCH_NUM)) {
         $this->_getTableStruct($Row[0], $data);
     }
 }
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $prof;
    $query = "\n\t\tSELECT\n\t\t\t`id_poll`,\n\t\t\t`id_profile`,\n\t\t\t`poll_question`,\n\t\t\t`Profiles`.*\n\t\tFROM `ProfilesPolls`\n\t\tLEFT JOIN `Profiles` ON\n\t\t\t`id_profile` = `Profiles`.`ID`\n\t\tWHERE\n\t\t\t`poll_status` = 'active'\n\t\t\tAND `poll_approval`\n\t\tORDER BY `id_poll` DESC\n\t\t";
    //$query = "SELECT `ID`, `Question` FROM `polls_q` WHERE `Active` = 'on' ORDER BY `Question`";
    $res = db_res($query);
    if ($res and mysql_num_rows($res)) {
        $ret = '<div class="clear_both"></div>';
        while ($arr = mysql_fetch_array($res)) {
            $age_str = _t("_y/o", age($arr['DateOfBirth']));
            $y_o_sex = $age_str . '&nbsp;' . _t("_" . $arr['Sex']);
            $poll_coutry = _t("__" . $prof['countries'][$arr['Country']]);
            $ret .= '<div class="pollBody">';
            $ret .= '<div class="clear_both"></div>';
            $ret .= '<div class="pollInfo">';
            $ret .= get_member_icon($arr['id_profile'], 'left');
            $ret .= '<div class="pollInfo_nickname">';
            $ret .= _t('_Submitted by', $arr['NickName']);
            $ret .= '</div>';
            $ret .= '<div class="pollInfo_info">';
            $ret .= $y_o_sex . '<br />' . $poll_coutry;
            $ret .= '</div>';
            $ret .= '</div>';
            $ret .= '<div class="clear_both"></div>';
            $ret .= ShowPoll($arr['id_poll']);
            $ret .= '<div class="clear_both"></div>';
            $ret .= '</div>';
        }
        $ret .= '<div class="clear_both"></div>';
    } else {
        $ret = "<div align=center>" . _t("_No polls available") . "</div>\n";
    }
    return $ret;
}
Exemplo n.º 3
0
 function compile()
 {
     $sEval = "return array(\n";
     $aFields = array('Caption', 'Name', 'Icon', 'Link', 'Script', 'Target', 'Order', 'Visible');
     $sQuery = "SELECT `ID`, `" . implode('`, `', $aFields) . "` FROM `" . $this->sDbTable . "` WHERE `Active`='1' ORDER BY `Order`";
     $rMenu = db_res($sQuery);
     while ($aItem = $rMenu->fetch()) {
         $sEval .= "  " . str_pad($aItem['ID'], 2) . " => array(\n";
         foreach ($aFields as $sKey => $sField) {
             $sCont = $aItem[$sField];
             $sCont = str_replace('\\', '\\\\', $sCont);
             $sCont = str_replace('"', '\\"', $sCont);
             $sCont = str_replace('$', '\\$', $sCont);
             $sCont = str_replace("\n", '', $sCont);
             $sCont = str_replace("\r", '', $sCont);
             $sCont = str_replace("\t", '', $sCont);
             $sEval .= "    " . str_pad("'{$sField}'", 11) . " => \"{$sCont}\",\n";
         }
         $sEval .= "  ),\n";
     }
     $sEval .= ");\n";
     $aResult = eval($sEval);
     $oCache = $GLOBALS['MySQL']->getDbCacheObject();
     return $oCache->setData($GLOBALS['MySQL']->genDbCacheKey($this->sCacheKey), $aResult);
 }
function getNewsList($iLimit = 0)
{
    $sqlQuery = "SELECT `News`.`ID` AS `newsID`,\r\n\t\t\t\t\t\t`Header`,\r\n\t\t\t\t\t\t`NewsUri`,\r\n\t\t\t\t\t\t`Snippet`,\r\n\t\t\t\t\t\tUNIX_TIMESTAMP( `Date` ) AS 'Date'\r\n\t\t\t\t FROM `News`\r\n\t\t\t\t ORDER BY `Date`DESC";
    $sqlLimit = $iLimit > 0 ? " LIMIT {$iLimit}" : "";
    $rNews = db_res($sqlQuery . $sqlLimit);
    return $rNews;
}
Exemplo n.º 5
0
function PageCompSearchResults()
{
    global $dir;
    global $tmpl;
    $keyword = process_db_input($_REQUEST['keyword']);
    $sMembersQuery = "\n\t\tSELECT *\n\t\tFROM `Profiles`\n\t\tWHERE\n\t\t" . (is_numeric($keyword) ? "`ID` = '{$keyword}'" : "`NickName` LIKE '%{$keyword}%'") . "";
    $rMembers = db_res($sMembersQuery);
    if (!mysql_num_rows($rMembers)) {
        return '<div class="qsearch_notfound">' . _t('_Sorry, no members found') . '</div>';
    }
    $sRowTmpl = file_get_contents("{$dir['root']}templates/tmpl_{$tmpl}/qsearch_row.html");
    $ret = '';
    while ($aMember = mysql_fetch_assoc($rMembers)) {
        $aRowTmpl = array();
        $aRowTmpl['thumbnail'] = get_member_thumbnail($aMember['ID'], 'none');
        $aRowTmpl['NickName'] = "<a href=\"" . getProfileLink($aMember['ID']) . "\" target=\"_blank\">" . htmlspecialchars_adv($aMember['NickName']) . "</a>";
        $aRowTmpl['actions'] = "<a href=\"javascript:void(0);\" onclick=\"hMemberAction({$aMember['ID']}, '{$aMember['NickName']}')\">" . _t('_Add member') . "</a>";
        $sRow = $sRowTmpl;
        foreach ($aRowTmpl as $what => $to) {
            $sRow = str_replace("__{$what}__", $to, $sRow);
        }
        $ret .= $sRow;
    }
    return $ret;
}
 function getProfileInfoExtra()
 {
     $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id');
     $aRet = array();
     $r = db_res("SELECT `pc`.`Caption`, `pc`.`Content`, `pc`.`Func`, `pc`.`ID` AS `BlockID`\n            FROM `sys_profile_fields` AS `pf` \n            INNER JOIN `sys_page_compose` AS `pc` \n            ON ((`pc`.`Func` = 'PFBlock' AND `pc`.`Content` = `pf`.`ID`) OR (`pc`.`Func` = 'GeneralInfo' AND " . BX_BLOCK_GENERALINFO . " = `pf`.`ID`) OR (`pc`.`Func` = 'AdditionalInfo' AND " . BX_BLOCK_ADDITIONALINFO . " = `pf`.`ID`))\n            WHERE `pc`.`Page` = 'profile_info' AND `pf`.`Type` = 'block' AND `pc`.`Column` != 0 \n            ORDER BY `pc`.`Column`, `pc`.`Order`");
     while ($a = $r->fetch()) {
         $iPrivacyId = (int) $GLOBALS['MySQL']->getOne("SELECT `id` FROM `sys_page_compose_privacy` WHERE `user_id`='" . $this->_iProfileID . "' AND `block_id`='" . $a['BlockID'] . "' LIMIT 1");
         if ($iPrivacyId != 0 && !$oPrivacy->check('view_block', $iPrivacyId, $this->_iViewerId)) {
             continue;
         }
         switch ($a['Func']) {
             case 'GeneralInfo':
                 $i = BX_BLOCK_GENERALINFO;
                 break;
             case 'AdditionalInfo':
                 $i = BX_BLOCK_ADDITIONALINFO;
                 break;
             default:
                 $i = $a['Content'];
         }
         $aBlock = $this->getProfileInfoBlock($a['Caption'], $i);
         if (false === $aBlock) {
             continue;
         }
         $aRet[] = $aBlock;
     }
     if ($this->_iViewerId == $this->_iProfileID) {
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_E-mail')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval($this->_aProfile['Email'])), "struct");
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Membership2')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(strip_tags(GetMembershipStatus($this->_iProfileID, false, false)))), "struct");
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Status')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(_t('__' . $this->_aProfile['Status']))), "struct");
         $aRet[] = new xmlrpcval(array('Info' => new xmlrpcval($aOwnInfo, "array"), 'Title' => new xmlrpcval(_t('_Account Info'))), "struct");
     }
     return new xmlrpcval($aRet, "array");
 }
Exemplo n.º 7
0
 function _getAllTables($data = false)
 {
     $Query = "SHOW TABLES";
     $Result = db_res($Query);
     while ($Row = mysql_fetch_row($Result)) {
         $this->_getTableStruct($Row[0], $data);
     }
 }
Exemplo n.º 8
0
function storeTags($iID, $sTags, $sType)
{
    $aTags = explodeTags($sTags);
    db_res("DELETE FROM `sys_tags` WHERE `ID` = ? AND `Type` = ?", [$iID, $sType]);
    //re-store if exist
    foreach ($aTags as $sTag) {
        $sTag = addslashes($sTag);
        db_res("INSERT INTO `sys_tags` VALUES ( ?, ?, ?, CURRENT_TIMESTAMP )", [$sTag, $iID, $sType]);
    }
}
Exemplo n.º 9
0
function storeTags($iID, $sTags, $sType)
{
    $aTags = explodeTags($sTags);
    db_res("DELETE FROM `sys_tags` WHERE `ID` = {$iID} AND `Type` = '{$sType}'");
    //re-store if exist
    foreach ($aTags as $sTag) {
        $sTag = addslashes($sTag);
        db_res("INSERT INTO `sys_tags` VALUES ( '{$sTag}', {$iID}, '{$sType}', CURRENT_TIMESTAMP )", 0);
    }
}
Exemplo n.º 10
0
function MemberEditNews()
{
    global $max_l;
    global $max_h;
    $news_id = (int) $_POST['edit_id'];
    $news_text = strlen($_POST['text']) > $max_l ? "LEFT ( '" . process_db_input($_POST['text']) . "', {$max_l} )" : "'" . process_db_input($_POST['text']) . "'";
    $news_header = strlen($_POST['header']) > $max_h ? "LEFT ( '" . process_db_input($_POST['header']) . "', {$max_h} )" : "'" . process_db_input($_POST['header']) . "'";
    $news_snippet = "'" . process_db_input($_POST['snippet']) . "'";
    $res = db_res("UPDATE `News` SET `Date` = NOW(), `Header` = {$news_header}, `Text` = {$news_text}, `Snippet`={$news_snippet} WHERE `ID` = {$news_id}");
    return $res;
}
Exemplo n.º 11
0
function generateUserNewPwd($ID)
{
    $sPwd = genRndPwd();
    $sSalt = genRndSalt();
    $sQuery = "\n        UPDATE `Profiles`\n        SET\n            `Password` = '" . encryptUserPwd($sPwd, $sSalt) . "',\n            `Salt` = '{$sSalt}'\n        WHERE\n            `ID`='{$ID}'\n    ";
    db_res($sQuery);
    createUserDataFile($ID);
    require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolAlerts.php';
    $oZ = new BxDolAlerts('profile', 'edit', $ID);
    $oZ->alert();
    return $sPwd;
}
Exemplo n.º 12
0
 /**
  * Update existing or create new template ;
  *
  * @param $sTemplateName (string)   - name of template ;
  * @param $sTemplateSubj (string)   - subject of template ;
  * @param $sTemplateBody (string)   - text of template ;
  * @param $iLangID (integer)        - needed language's ID; 
  * @return HTML presentation data ;
  */
 function setTemplate($sTemplateName, $sTemplateSubj, $sTemplateBody, $iLangID)
 {
     if (!db_value("SELECT `ID` FROM `sys_email_templates` WHERE `Name` = '" . process_db_input($sTemplateName) . "'  AND `LangID` = '{$iLangID}'")) {
         $sQuery = " \r\n\t\t\t\tINSERT INTO \r\n\t\t\t\t\t`sys_email_templates` (`Name`, `Subject`, `Body`, `LangID`)  \r\n\t\t\t\tVALUES\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\t'" . process_db_input($sTemplateName) . "', \r\n\t\t\t\t\t\t'" . process_db_input($sTemplateSubj) . "',\r\n\t\t\t\t\t\t'" . process_db_input($sTemplateBody) . "',\r\n\t\t\t\t\t\t'" . (int) $iLangID . "'\r\n\t\t\t\t\t)\r\n\t\t\t";
         $sMessage = 'Template was created';
     } else {
         $sQuery = " \r\n\t\t\t\tUPDATE \r\n\t\t\t\t\t`sys_email_templates` \r\n\t\t\t\tSET \r\n\t\t\t\t\t`Subject` = '" . process_db_input($sTemplateSubj) . "',\r\n\t\t\t\t\t`Body` = '" . process_db_input($sTemplateBody) . "'\r\n\t\t\t\tWHERE \r\n\t\t\t\t\t`Name`   = '" . process_db_input($sTemplateName) . "'\r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t`LangID` = '" . (int) $iLangID . "'\r\n\t\t\t\tLIMIT 1    \r\n\t\t\t";
         $sMessage = 'Template was updated';
     }
     db_res($sQuery);
     return $this->genTemplatesForm($sTemplateName, $iLangID, $sMessage);
 }
Exemplo n.º 13
0
 /**
  * Update existing or create new template ;
  *
  * @param $sTemplateName (string)   - name of template ;
  * @param $sTemplateSubj (string)   - subject of template ;
  * @param $sTemplateBody (string)   - text of template ;
  * @param $iLangID (integer)        - needed language's ID;
  * @return HTML presentation data ;
  */
 function setTemplate($sTemplateName, $sTemplateSubj, $sTemplateBody, $iLangID)
 {
     if (!db_value("SELECT `ID` FROM `sys_email_templates` WHERE `Name` = '" . process_db_input($sTemplateName) . "'  AND `LangID` = '{$iLangID}'")) {
         $sQuery = "\n                INSERT INTO\n                    `sys_email_templates` (`Name`, `Subject`, `Body`, `LangID`)\n                VALUES\n                    (\n                        '" . process_db_input($sTemplateName) . "',\n                        '" . process_db_input($sTemplateSubj) . "',\n                        '" . process_db_input($sTemplateBody) . "',\n                        '" . (int) $iLangID . "'\n                    )\n            ";
         $sMessage = 'Template was created';
     } else {
         $sQuery = "\n                UPDATE\n                    `sys_email_templates`\n                SET\n                    `Subject` = '" . process_db_input($sTemplateSubj) . "',\n                    `Body` = '" . process_db_input($sTemplateBody) . "'\n                WHERE\n                    `Name`   = '" . process_db_input($sTemplateName) . "'\n                        AND\n                    `LangID` = '" . (int) $iLangID . "'\n                LIMIT 1\n            ";
         $sMessage = 'Template was updated';
     }
     db_res($sQuery);
     return $this->genTemplatesForm($sTemplateName, $iLangID, $sMessage);
 }
Exemplo n.º 14
0
 function getFriendRequests($sUser, $sPwd, $sLang)
 {
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     BxDolXMLRPCUtil::setLanguage($sLang);
     $r = db_res("\n            SELECT `Profiles`.* FROM `sys_friend_list`\n            LEFT JOIN `Profiles` ON `Profiles`.`ID` = `sys_friend_list`.`ID`\n            WHERE `sys_friend_list`.`Profile` = {$iId} AND `Check` = 0\n            ORDER BY `Profiles`.`NickName` ASC");
     $aProfiles = array();
     while ($aRow = $r->fetch()) {
         $aProfiles[] = new xmlrpcval(BxDolXMLRPCUtil::fillProfileArray($aRow, 'thumb'), 'struct');
     }
     return new xmlrpcval($aProfiles, "array");
 }
Exemplo n.º 15
0
 function getProfileInfoExtra()
 {
     $aRet = array();
     $r = db_res("SELECT `pc`.`Caption`, `pc`.`Content` FROM `sys_profile_fields` AS `pf` INNER JOIN `sys_page_compose` AS `pc` ON (`pc`.`Func` = 'PFBlock' AND `pc`.`Content` = `pf`.`ID`) WHERE `pc`.`Page` = 'profile' AND `pf`.`Type` = 'block' AND `pc`.`Column` != 0 ORDER BY `pc`.`Column`, `pc`.`Order`");
     while ($a = mysql_fetch_array($r)) {
         $aBlock = $this->getProfileInfoBlock($a['Caption'], $a['Content']);
         if (false === $aBlock) {
             continue;
         }
         $aRet[] = $aBlock;
     }
     return new xmlrpcval($aRet, "array");
 }
Exemplo n.º 16
0
/**
 * page code function
 */
function PageCompPageMainCode($iLoggedID)
{
    $member['ID'] = (int) $iLoggedID;
    $p_arr = getProfileInfo($member['ID']);
    if ($_POST['CHANGE_STATUS']) {
        $sStatus = "";
        switch ($_POST['CHANGE_STATUS']) {
            case 'SUSPEND':
                if ($p_arr['Status'] == 'Active') {
                    $sStatus = "Suspended";
                }
                break;
            case 'ACTIVATE':
                if ($p_arr['Status'] == 'Suspended') {
                    $sStatus = "Active";
                }
                break;
        }
        if (mb_strlen($sStatus) > 0) {
            db_res("UPDATE `Profiles` SET `Status` = '{$sStatus}' WHERE `ID` = {$member['ID']}");
        }
        createUserDataFile($p_arr['ID']);
        reparseObjTags('profile', $member['ID']);
        $p_arr = getProfileInfo($member['ID']);
    }
    $aData = array('profile_status_caption' => _t("_Profile status"), 'status' => $p_arr['Status'], 'status_lang_key' => _t('__' . $p_arr['Status']));
    $aForm = array('form_attrs' => array('action' => BX_DOL_URL_ROOT . 'change_status.php', 'method' => 'post', 'name' => 'form_change_status'), 'inputs' => array('status' => array('type' => 'hidden', 'name' => 'CHANGE_STATUS', 'value' => ''), 'subscribe' => array('type' => 'submit', 'name' => 'subscribe', 'value' => '')));
    switch ($p_arr['Status']) {
        case 'Active':
            $aForm['inputs']['status']['value'] = 'SUSPEND';
            $aForm['inputs']['subscribe']['value'] = _t('_Suspend account');
            $oForm = new BxTemplFormView($aForm);
            $aData['form'] = $oForm->getCode();
            $aData['message'] = _t("_PROFILE_CAN_SUSPEND");
            break;
        case 'Suspended':
            $aForm['inputs']['status']['value'] = 'ACTIVATE';
            $aForm['inputs']['subscribe']['value'] = _t('_Activate account');
            $oForm = new BxTemplFormView($aForm);
            $aData['form'] = $oForm->getCode();
            $aData['message'] = _t("_PROFILE_CAN_ACTIVATE");
            break;
        default:
            $aData['message'] = _t("_PROFILE_CANT_ACTIVATE/SUSPEND");
            $aData['form'] = '';
            break;
    }
    return $GLOBALS['oSysTemplate']->parseHtmlByName('change_status.html', $aData);
}
Exemplo n.º 17
0
 function getCountries($sUser, $sPwd, $sLang)
 {
     $aRet = array();
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     BxDolXMLRPCUtil::setLanguage($sLang);
     $aCountries = array();
     $r = db_res("SELECT `ISO2`, `Country` FROM `sys_countries` ORDER BY `Country` ASC");
     while ($aRow = mysql_fetch_array($r)) {
         $a = array('Name' => new xmlrpcval(_t('__' . $aRow['Country'])), 'Code' => new xmlrpcval($aRow['ISO2']));
         $aCountries[] = new xmlrpcval($a, 'struct');
     }
     return new xmlrpcval($aCountries, "array");
 }
Exemplo n.º 18
0
 function install($aParams)
 {
     $aResult = parent::install($aParams);
     $s = $this->_readFromUrl("http://ws.geonames.org/postalCodeCountryInfo?");
     $a = $this->_getCountriesArray($s);
     if (count($a)) {
         db_res("TRUNCATE TABLE `bx_zip_countries_geonames`");
         foreach ($a as $sCountry) {
             db_res("INSERT INTO `bx_zip_countries_geonames` VALUES ('{$sCountry}')");
         }
     } else {
         return array('code' => BX_DOL_INSTALLER_FAILED, 'content' => 'Network error - can not get list of countries');
     }
     return $aResult;
 }
function addToFavorites($iFile)
{
    global $member;
    if ($iFile) {
        $sQuery = "SELECT * FROM `shareMusicFavorites` WHERE `medID`='{$iFile}' AND `userID`='{$member['ID']}'";
        $rCheck = db_res($sQuery);
        if (mysql_num_rows($rCheck) > 0) {
            $sCode = '<div class="mediaInfo">' . _t('_File already is favorite') . '</div>';
        } else {
            $sQuery = "INSERT INTO `shareMusicFavorites` (`medID`,`userID`,`favDate`) VALUES('{$iFile}','{$member['ID']}',NOW())";
            db_res($sQuery);
            $sCode = '<div class="mediaInfo">' . _t("_File was added to favorite") . '</div>';
        }
    }
    return $sCode;
}
Exemplo n.º 20
0
/**
 * Print news
 */
function MemberPrintNewsList()
{
    global $news_limit_chars;
    global $short_date_format;
    global $tmpl;
    $query = "\n\t\tSELECT\n\t\t\t`ID`,\n\t\t\t`Header`,\n\t\t\t`Snippet`,\n\t\t\tDATE_FORMAT(`Date`, '{$short_date_format}' ) AS 'Date'\n\t\tFROM `News`\n\t\tORDER BY `Date` DESC\n\t\t";
    $res = db_res($query);
    ob_start();
    if (!mysql_num_rows($res)) {
        ?>
			<div class="no_news">
				<?php 
        echo _t("_No news available");
        ?>
			</div>
		<?php 
    } else {
        while ($news_arr = mysql_fetch_array($res)) {
            ?>
			<div class="news_cont">
				<div class="clear_both"></div>
				<div class="news_header">
					<a href="<?php 
            echo "{$site['url']}news_view.php?ID={$news_arr['ID']}";
            ?>
">
						<?php 
            echo process_line_output($news_arr['Header']);
            ?>
					</a>
				</div>
				<div class="news_date"><?php 
            echo $news_arr['Date'];
            ?>
</div>
				<div class="news_snippet">
					<?php 
            echo process_text_output($news_arr['Snippet']);
            ?>
				</div>
				<div class="clear_both"></div>
			</div>
			<?php 
        }
    }
    return ob_get_clean();
}
Exemplo n.º 21
0
 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 banner_put($ID = 0, $Track = 1)
{
    global $bann_click_url;
    if (!$ID) {
        // Get only banners that are active and for which promotion period has not expired.
        $bann_arr = db_arr("SELECT `ID`, `Url`, `Text` FROM `Banners` WHERE `Active` <> 0 AND `campaign_start` <= NOW() AND `campaign_end` >= NOW() ORDER BY RAND() LIMIT 1");
    } else {
        $bann_arr = db_arr("SELECT `ID`, `Url`, `Text` FROM `Banners` WHERE `ID` = {$ID} LIMIT 1");
    }
    if (!$bann_arr) {
        return "";
    }
    if ($Track) {
        db_res("INSERT INTO `BannersShows` SET `ID` = {$bann_arr['ID']}, `Date` = NOW(), `IP` = '" . $_SERVER['REMOTE_ADDR'] . "'", 0);
    }
    return "<a target=\"_blank\" href=\"{$bann_click_url}?{$bann_arr['ID']}\" onmouseout=\"ce()\" onfocus=\"ss('{$bann_arr['Url']}')\" onmouseover=\"return ss('{$bann_arr['Url']}')\">{$bann_arr['Text']}</a>";
}
Exemplo n.º 23
0
 function getProfileInfoExtra()
 {
     $aRet = array();
     $r = db_res("SELECT `pc`.`Caption`, `pc`.`Content` FROM `sys_profile_fields` AS `pf` INNER JOIN `sys_page_compose` AS `pc` ON (`pc`.`Func` = 'PFBlock' AND `pc`.`Content` = `pf`.`ID`) WHERE `pc`.`Page` = 'profile' AND `pf`.`Type` = 'block' AND `pc`.`Column` != 0 ORDER BY `pc`.`Column`, `pc`.`Order`");
     while ($a = mysql_fetch_array($r)) {
         $aBlock = $this->getProfileInfoBlock($a['Caption'], $a['Content']);
         if (false === $aBlock) {
             continue;
         }
         $aRet[] = $aBlock;
     }
     if ($this->_iViewerId == $this->_iProfileID) {
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_E-mail')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval($this->_aProfile['Email'])), "struct");
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Membership2')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(strip_tags(GetMembershipStatus($this->_iProfileID, false, false)))), "struct");
         $aOwnInfo[] = new xmlrpcval(array('Caption' => new xmlrpcval(_t('_Status')), 'Type' => new xmlrpcval('text'), 'Value1' => new xmlrpcval(_t('__' . $this->_aProfile['Status']))), "struct");
         $aRet[] = new xmlrpcval(array('Info' => new xmlrpcval($aOwnInfo, "array"), 'Title' => new xmlrpcval(_t('_Account Info'))), "struct");
     }
     return new xmlrpcval($aRet, "array");
 }
Exemplo n.º 24
0
 function getContacts($sUser, $sPwd)
 {
     $aRet = array();
     if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     $aAll = array();
     $aContacts = array();
     // hot list
     $r = db_res("SELECT `p`.`ID` FROM `Profiles` AS `p`\n            INNER JOIN `sys_fave_list` AS `h` ON (`h`.`Profile` = `p`.`ID`)\n            WHERE `h`.`ID` = {$iId}");
     while ($aRow = $r->fetch()) {
         $aAll[$aRow['ID']] = $aRow;
     }
     // mail contacts received
     $r = db_res("SELECT `p`.`ID` FROM `Profiles` AS `p`\n            INNER JOIN `sys_messages` AS `m` ON (`m`.`Sender` = `p`.`ID`)\n            WHERE `p`.`ID` != {$iId} AND `m`.`Recipient` = {$iId}");
     while ($aRow = $r->fetch()) {
         $aAll[$aRow['ID']] = $aRow;
     }
     // mail contacts sent
     $r = db_res("SELECT `p`.`ID` FROM `Profiles` AS `p`\n            INNER JOIN `sys_messages` AS `m` ON (`m`.`Recipient` = `p`.`ID`)\n            WHERE `p`.`ID` != {$iId} AND `m`.`Sender` = {$iId}");
     while ($aRow = $r->fetch()) {
         $aAll[$aRow['ID']] = $aRow;
     }
     // friends 1
     $r = db_res("SELECT `p`.`ID` FROM `sys_friend_list` AS `fr`\n            LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `fr`.`Profile`)\n            WHERE `fr`.`ID` = '{$iId}' AND `fr`.`Profile` != {$iId} AND `fr`.`Check` = '1'");
     while ($aRow = $r->fetch()) {
         $aAll[$aRow['ID']] = $aRow;
     }
     // friends 2
     $r = db_res("SELECT `p`.`ID` FROM `sys_friend_list` AS `fr`\n            LEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `fr`.`ID`)\n            WHERE `fr`.`Profile` = '{$iId}' AND `fr`.`ID` != {$iId} AND `fr`.`Check` = '1'");
     while ($aRow = $r->fetch()) {
         $aAll[$aRow['ID']] = $aRow;
     }
     bx_import('BxDolAlerts');
     $oZ = new BxDolAlerts('mobile', 'contacts', $iId, 0, array('contacts_data' => $aAll));
     $oZ->alert();
     foreach ($aAll as $aRow) {
         $a = array('ID' => new xmlrpcval($aRow['ID']), 'Nick' => new xmlrpcval(getUsername($aRow['ID'])), 'UserTitle' => new xmlrpcval(getNickName($aRow['ID'])));
         $aContacts[] = new xmlrpcval($a, 'struct');
     }
     return new xmlrpcval($aContacts, "array");
 }
Exemplo n.º 25
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $tmpl;
    $links_res = db_res("SELECT * FROM `Links`");
    if (!mysql_num_rows($links_res)) {
        $out .= "<div class=\"no_links\">" . _t("_NO_LINKS") . "</div>\n";
    } else {
        while ($link_arr = mysql_fetch_array($links_res)) {
            $link_url = process_line_output($link_arr['URL'], 1000);
            $link_title = process_line_output($link_arr['Title']);
            $link_desc = process_text_output($link_arr['Description']);
            $out .= "<div class=\"links_cont\">\n";
            $out .= "<div class=\"clear_both\"></div>\n";
            $out .= "<div class=\"links_header\">";
            $out .= "<a href=\"{$link_url}\">{$link_title}</a></div>\n";
            $out .= "<div class=\"links_snippet\">{$link_desc}</div>\n";
            $out .= "<div class=\"clear_both\"></div></div>\n";
        }
    }
    return $out;
}
Exemplo n.º 26
0
 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 getFriendList($id)
{
    global $site;
    global $max_thumb_width;
    global $max_thumb_height;
    $id = (int) $id;
    $friend_list_query = "SELECT `Profiles`.* FROM `FriendList`\r\n\t\t\t\t\t\t\t\t LEFT JOIN `Profiles` ON (`Profiles`.`ID` = `FriendList`.`Profile` AND `FriendList`.`ID` = '{$id}' OR `Profiles`.`ID` = `FriendList`.`ID` AND `FriendList`.`Profile` = '{$id}')\r\n\t\t\t\t\t\t\t\t WHERE (`FriendList`.`Profile` = '{$id}' OR `FriendList`.`ID` = '{$id}') AND `FriendList`.`Check` = '1' ORDER BY `Profiles`.`Picture` DESC";
    $friend_list_res = db_res("{$friend_list_query}");
    $iCounter = 0;
    while ($friend_list_arr = mysql_fetch_assoc($friend_list_res)) {
        $iCounter++;
        $sKey = '1';
        if ($iCounter == 3) {
            $sKey = '1';
        }
        $ret .= '<div class="friends_thumb_' . $sKey . '">' . get_member_thumbnail($friend_list_arr['ID'], 'none') . '<div class="browse_nick"><a href="' . getProfileLink($friend_list_arr['ID']) . '">' . $friend_list_arr['NickName'] . '</a></div><div class="clear_both"></div></div>';
        if ($iCounter == 3) {
            $iCounter = 0;
        }
    }
    return $ret;
}
Exemplo n.º 28
0
/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $site;
    global $short_date_format;
    $out = "";
    $query = "SELECT `Stories`.`ID`, `Profiles`.`ID` as `MembID`, DATE_FORMAT(`Stories`.`Date`,  '{$short_date_format}' ) AS 'Date', `Stories`.`Header`, `Stories`.`Text`, `Profiles`.`ID` as `prID`, `Profiles`.`NickName` FROM `Stories` INNER JOIN `Profiles` ON (`Stories`.`Sender` = `Profiles`.`ID`) WHERE `Stories`.`active` = 'on' ORDER BY `Stories`.`Date` DESC";
    $res = db_res($query);
    if (!$res) {
        return 0;
    }
    $out .= "\n\t\t<br />\n\t\t<div align=left>&nbsp;&nbsp;<a href=\"" . $site['url'] . "story.php\">" . _t("_post my feedback") . "</a></div>\n\t\t<br />\n\t\t<table width=\"100%\" cellspacing=1 cellpadding=2 class=small width=100%>";
    $num = mysql_num_rows($res);
    if (!$num) {
        $out .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td><center>" . _t("_NO_STORIES") . "</center></td>\n\t\t\t\t</tr>";
    } else {
        while ($arr = mysql_fetch_array($res)) {
            $story_header = process_line_output($arr['Header']);
            $out .= "\n\t\t\t\t<tr class=panel>\n\t\t\t\t\t<td align=center width=15%>{$arr['Date']}</td>\n\t\t\t\t\t<td align=center width=15%><a href=\"" . getProfileLink($arr['prID']) . "\">{$arr['NickName']}</a></td>\n\t\t\t\t\t<td aling=left>&nbsp;<a href='story_view.php?ID={$arr['ID']}'>{$story_header}</a></td>\n\t\t\t\t</tr>";
        }
    }
    $out .= "\n\t\t</table>\n";
    return $out;
}
Exemplo n.º 29
0
function PageListFriend($sourceID, $targetID)
{
    $ret = '';
    $query = "SELECT * FROM `FriendList` WHERE (`ID` = '{$sourceID}' and `Profile` = '{$targetID}') or ( `ID` = '{$targetID}' and `Profile` = '{$sourceID}')";
    $temp = db_assoc_arr($query);
    if ($sourceID == $temp['ID'] || $temp['Check'] == 1) {
        $ret = _t_action('_already_in_friend_list');
    } elseif ($targetID == $temp['ID'] && 0 == $temp['Check']) {
        $query = "UPDATE `FriendList` SET `Check` = '1' WHERE `ID` = '{$targetID}' AND `Profile` = '{$sourceID}';";
        if (db_res($query)) {
            $ret = _t_action('_User was added to friend list');
        } else {
            $ret = _t_err('_Failed to apply changes');
        }
    } else {
        $query = "INSERT INTO `FriendList` SET `ID` = '{$sourceID}', `Profile` = '{$targetID}', `Check` = '0';";
        if (db_res($query)) {
            $ret = _t_action('_User was invited to friend list');
        } else {
            $ret = _t_err('_Failed to apply changes');
        }
    }
    return $ret;
}
Exemplo n.º 30
0
function getExistedBannersBlock()
{
    $sClicksC = _t('_adm_bann_clicks');
    $sImpressionsC = _t('_adm_bann_impressions');
    $sPreviewC = _t('_Preview');
    $sEditC = _t('_Edit');
    $sDeleteC = _t('_Delete');
    // Get banner info from database.
    $banners_res = db_res("SELECT * FROM `sys_banners` ORDER BY `ID` DESC");
    $sExistedBanners = MsgBox(_t('_Empty'));
    if (mysql_num_rows($banners_res)) {
        $sExistedBanners = "<table cellspacing=1 cellpadding=2 border=0 class=small1 width=100%>";
        while ($banns_arr = mysql_fetch_array($banners_res)) {
            $imp = db_arr("SELECT COUNT(*) FROM `sys_banners_shows` WHERE `ID` = '{$banns_arr['ID']}'");
            $clicks = db_arr("SELECT COUNT(*) FROM `sys_banners_clicks` WHERE `ID` = '{$banns_arr['ID']}'");
            $class = !$banns_arr['Active'] ? 'table_err' : 'panel';
            $sBannerTitle = process_line_output($banns_arr['Title']);
            $sExistedBanners .= <<<EOF
<tr class={$class}>
\t<td>
\t\t(<a href="banners.php?action=preview&banner_id={$banns_arr['ID']}">{$sPreviewC}</a> | 
\t\t\t<a href="banners.php?banner_id={$banns_arr['ID']}">{$sEditC}</a> | 
\t\t\t<a href="banners.php?banner_id={$banns_arr['ID']}&action=delete">{$sDeleteC}</a>)&nbsp;
\t\t\t{$sBannerTitle}
\t\t</a>
\t</td>
\t<td><b>{$clicks[0]}</b> {$sClicksC} </td>
\t<td><b>{$imp[0]}</b> {$sImpressionsC} </td>
</tr>
EOF;
        }
        $sExistedBanners .= "</table>";
    }
    $sResult = $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $sExistedBanners));
    return DesignBoxContent(_t('_adm_mmi_banners'), $sResult, 1);
}