本文整理汇总了PHP中db_arr函数的典型用法代码示例。如果您正苦于以下问题:PHP db_arr函数的具体用法?PHP db_arr怎么用?PHP db_arr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_arr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MlClonetwoPageEditProcessor
function MlClonetwoPageEditProcessor($iId)
{
global $logged;
$this->aPages = array(0 => array(), 1 => array());
// double arrays (for couples)
$this->aValues = array(0 => array(), 1 => array());
$this->aErrors = array(0 => array(), 1 => array());
//$iId = bx_get('ID');
$this->iPageID = (int) $iId;
$iPageInfo = db_arr("SELECT `uri`, `author_id` FROM `ml_clonetwo_main` WHERE `id` = {$this->iPageID} LIMIT 1");
$this->sUri = $iPageInfo['uri'];
//$this -> sSubCategory = $iPageInfo['SubCategory'];
//$this -> sMainCategory = $iPageInfo['MainCategory'];
// basic checks
$iMemberID = getLoggedId();
// check if this member is owner
if ($iPageInfo['author_id'] == $iMemberID) {
$this->iArea = 2;
}
$this->bAjaxMode = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest');
$this->bForceAjaxSave = bx_get('force_ajax_save');
$this->aFormPrivacy['form_attrs']['action'] = BX_DOL_URL_ROOT . 'modules/modloaded/clonetwo/edit.php?page_id=' . $this->iPageID;
$this->aFormPrivacy['inputs']['profile_id']['value'] = $this->iPageID;
$this->aFormPrivacy['inputs']['save_privacy']['value'] = _t('_edit_profile_privacy_save');
//parent::BxDolPageView('page_edit');
}
示例2: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
global $site;
global $short_date_format;
$messageID = (int) $_GET['message'];
$memberID = (int) $_COOKIE['memberID'];
$sender_sql = "SELECT `Sender` FROM `Messages` WHERE `Recipient` = '{$memberID}' AND `ID` = '{$messageID}'";
$sender_arr = db_arr($sender_sql);
$senderID = (int) $sender_arr['Sender'];
$message_sql = "SELECT m.`Text`, m.`Subject`, DATE_FORMAT( m.`Date`, '{$short_date_format}' ) AS `Date`, p.Status FROM `Messages` AS m LEFT JOIN Profiles AS p ON m.Sender = p.ID WHERE m.`ID` = '{$messageID}' AND `Recipient` = '{$memberID}'";
// Did you find me, Smoge? I see you...
$message_arr = db_arr($message_sql);
$ret = '';
$ret .= '<div class="profile_ditails_block">';
$ret .= ProfileDetails($senderID);
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
$ret .= '<div class="m_block">';
$ret .= '<div class="m_subject_date">';
$ret .= '<div class="name">';
$ret .= _t('_Date') . ':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= $message_arr['Date'];
$ret .= '</div>';
$ret .= '<div class="name">';
$ret .= _t('_Subject') . ':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= process_smiles(process_line_output($message_arr['Subject']));
$ret .= '</div>';
$ret .= '</div>';
$ret .= '<div class="m_text">';
$ret .= process_html_output($message_arr['Text'], 150);
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
if ($message_arr['Status'] == 'Active') {
$ret .= '<div class="reply">';
$ret .= '<a href="' . $site['url'] . 'compose.php?ID=' . $senderID . '&messageID=' . $messageID . '&subject=' . process_smiles(process_line_output($message_arr['Subject'])) . '">Reply</a>';
$ret .= '</div>';
$ret .= '<div class="reply">';
$ret .= "<a onClick=\"javascript:window.open( 'list_pop.php?action=spam&ID=" . $senderID . "', '', 'width=500,height=200,menubar=no,status=no,resizeable=no,scrollbars=no,toolbar=no,location=no' );\" href=\"javascript:void(0)\">" . _t('_Spam report') . "</a>";
$ret .= '</div>';
$ret .= '<div class="reply">';
$ret .= '<a href="messages_inbox.php?action=delete&message=' . $messageID . '">' . _t('_Delete') . '</a>';
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
} else {
$ret .= '';
}
//$ret .= '</div>';
//####################################################
$ret .= '<div style="position:relative; height:20px;"></div>';
$ret .= PageCorespondence($memberID, $senderID);
$ret .= '<div class="clear_both"></div>';
return $ret;
}
示例3: ThisPageMainCode
/**
* page code function
*/
function ThisPageMainCode()
{
global $logged;
global $member;
// create poll section -------------------------------------------------------------------
$ret .= '<div class="createPollSection">';
$query = "SELECT COUNT(id_poll) FROM ProfilesPolls WHERE id_profile = '{$member['ID']}'";
$ras_arr = db_arr($query);
$polls_num = db_arr($query);
$profile_poll_num = getParam("profile_poll_num");
if ($profile_poll_num && $polls_num[0] < $profile_poll_num) {
// limit number of polls
$ret .= ShowPollCreationForm();
} else {
$ret .= _t('_max_poll_reached');
}
$ret .= '</div>';
// show polls section --------------------------------------------------------------------
$ret .= '<div class="pollContainer" id="pol_container">';
$ret .= '<div class="clear_both"></div>';
$query = "SELECT id_poll, poll_status FROM ProfilesPolls WHERE id_profile = '{$member['ID']}'";
$polls_num = db_res($query);
while ($poll_arr = mysql_fetch_array($polls_num)) {
$uID = $poll_arr['id_poll'];
$ret .= '<div id="pol_container_pol_' . $uID . '" class="controlsDiv">';
$ret .= ShowPoll($uID);
$ret .= '<div class="innerControlBlock">';
//$ret .= '<div class="controlsHeader">' . _t('_controls') . ':</div>';
$sCurStatus = '';
$sCTStatus = '';
$status_change_to = '';
if ('active' == $poll_arr['poll_status']) {
$sCurStatus = _t('_Active');
$sCTStatus = _t('_Disabled');
$status_change_to = 'disabled';
} else {
$sCurStatus = _t('_Disabled');
$sCTStatus = _t('_Active');
$status_change_to = 'active';
}
$ret .= "<span id=\"poll_status_{$uID}\" style=\"padding: 0px 2px;\"></span>";
$ret .= '<span class="deleteDiv"><a href="#" onclick=" if ( window.confirm(\'' . _t('_are you sure?') . '\') ) { send_data( \'\', \'delete\', \'\', \'' . $uID . '\' ); del_question_bar( document.getElementById(\'pol_container\'), document.getElementById(\'pol_container_pol_' . $uID . '\') ); } return false;">' . _t('_delete') . '</a></span>';
$ret .= '<script language="javascript">
poll_status_show( \'' . $uID . '\', \'poll_status_' . $uID . '\', \'' . $poll_arr['poll_status'] . '\', \'' . $status_change_to . '\', \'' . $sCurStatus . '\', \'' . $sCTStatus . '\' );
</script>';
$ret .= '</div>';
$ret .= '</div>';
}
// if no polls
if (!$uID) {
$ret .= _t_err('_no poll');
}
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
return $ret;
}
示例4: quote_get
/**
* get a quote from the database
* returns HTML text that represents quote - text and author
*/
function quote_get()
{
global $quote_table;
global $quote_html;
$arr = db_arr("SELECT `Text`, `Author` FROM {$quote_table} ORDER BY RAND() LIMIT 1");
$ret = $quote_html;
$ret = str_replace('%Text%', process_text_output($arr['Text']), $ret);
$ret = str_replace('%Author%', process_line_output($arr['Author']), $ret);
return $ret;
}
示例5: genProfileCSS
function genProfileCSS($ID)
{
global $site;
$ret = '';
$query = "SELECT * FROM `ProfilesSettings` WHERE `IDMember` = '{$ID}'";
$arr = db_arr($query);
if ($arr['IDMember']) {
$ret = "<style type=\"text/css\">\r\n\t\t\t body\r\n\t\t\t {\r\n\t\t\t \tbackground-image: url( {$site['profileBackground']}{$arr['BackgroundFilename']});\r\n\t\t\t \tbackground-color: {$arr['BackgroundColor']};\r\n\t\t\t \tbackground-repeat:repeat;\r\n\t\t\t }\r\n\t\t\t div#right_column_content\r\n\t\t\t {\r\n\t\t\t \tcolor: {$arr['FontColor']};\r\n\t\t\t \tfont-size: {$arr['FontSize']}px;\r\n\t\t\t \tfont-family: {$arr['FontFamily']};\r\n\t\t\t }\r\n\t\t\t div#divUnderCustomization\r\n\t\t\t {\r\n\t\t\t \tcolor: {$arr['FontColor']};\r\n\t\t\t \tfont-size: {$arr['FontSize']}px;\r\n\t\t\t \tfont-family: {$arr['FontFamily']};\r\n\t\t\t }\r\n\t\t\t\t</style>";
}
return $ret;
}
示例6: getHomepageInfo
function getHomepageInfo($sUser, $sPwd)
{
if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
$aRet = BxDolXMLRPCUtil::getUserInfo($iId);
$aRet['unreadLetters'] = new xmlrpcval(getNewLettersNum($iId));
$aFriendReq = db_arr("SELECT count(*) AS `num` FROM `sys_friend_list` WHERE `Profile` = {$iId} AND `Check` = '0'");
$aRet['friendRequests'] = new xmlrpcval($aFriendReq['num']);
return new xmlrpcval($aRet, "struct");
}
示例7: serviceGetVideoArray
function serviceGetVideoArray($iPicId, $sImgType = 'browse')
{
$iPicId = (int) $iPicId;
$sqlQuery = "SELECT a.`ID` as `id`,\r\n\t\t\t\t\t\t\ta.`Title` as `title`,\r\n\t\t\t\t\t\t\ta.`Description` as `description`,\r\n\t\t\t\t\t\t\ta.`Uri` as `uri`,\r\n\t\t\t\t\t\t\ta.`Owner` as `owner`,\r\n\t\t\t\t\t\t\ta.`Date` as `date`,\r\n\t\t\t\t\t\t\ta.`Video`,\r\n\t\t\t\t\t\t\ta.`Source`,\r\n\t\t\t\t\t\t\tb.`id_album` as `album_id`\r\n\t\t\t\t\t\tFROM `RayVideoFiles` as a\r\n\t\t\t\t\t\tLEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID`\r\n\t\t\t\t\t\tLEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album`\r\n\t\t\t\t\t\tWHERE a.`ID`='{$iPicId}' AND c.`Type`='bx_videos'";
$aImageInfo = db_arr($sqlQuery);
if (empty($aImageInfo) || !is_array($aImageInfo)) {
return array();
}
$sImg = $aImageInfo['id'] . $this->aConstants['picPostfix'][$sImgType];
$sFileName = $sImg != '' && extFileExists($this->aConstants['filesDir'] . $sImg) ? $this->aConstants['filesUrl'] . $sImg : '';
return array('file' => $sFileName, 'title' => $aImageInfo['title'], 'owner' => $aImageInfo['owner'], 'description' => $aImageInfo['description'], 'width' => (int) $this->oModule->_oConfig->getGlParam('browse_width') + 2 * 2, 'height' => (int) (int) $this->oModule->_oConfig->getGlParam('browse_height') + 2 * 2, 'url' => $this->getCurrentUrl('file', $iPicId, $aImageInfo['uri']), 'video' => $aImageInfo['Video'], 'source' => $aImageInfo['Source'], 'album_id' => $aImageInfo['album_id']);
}
示例8: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
global $_page;
global $site;
$show_form = true;
$action_result = _t("_FORGOT", $site['title']);
ob_start();
if ($_POST['Email']) {
// Test if eneterd email is not valid
if (!eregi("^[_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}\$", $_POST['Email'])) {
$_page['header'] = _t("_Error");
$_page['header_text'] = _t("_Incorrect Email");
$action_result = _t("_INCORRECT_EMAIL");
} else {
// Check if entered email is in the base
$sEmail = htmlspecialchars_adv($_POST['Email']);
$memb_arr = db_arr("SELECT `ID` FROM `Profiles` WHERE `Email` = '{$sEmail}'");
if ($memb_arr['ID']) {
$recipient = $sEmail;
$message = getParam("t_Forgot");
$subject = getParam('t_Forgot_subject');
generateNewPwd($memb_arr['ID']);
$mail_ret = sendMail($recipient, $subject, $message, $memb_arr['ID']);
$sQuery = "UPDATE `Profiles` SET `Password` = md5(`Password`) WHERE `ID`='{$memb_arr['ID']}'";
db_res($sQuery);
createUserDataFile($memb_arr['ID']);
if (!$mail_ret) {
$_page['header'] = _t("_Recognized");
$_page['header_text'] = _t("_RECOGNIZED", $site['title']);
$action_result = _t("_MEMBER_RECOGNIZED_MAIL_NOT_SENT", $site['title']);
$show_form = false;
}
$_page['header'] = _t("_Recognized");
$_page['header_text'] = _t("_RECOGNIZED", $site['title']);
$action_result = _t("_MEMBER_RECOGNIZED_MAIL_SENT", $site['url'], $site['title']);
$show_form = false;
} else {
$_page['header'] = _t("_Not Recognized");
$_page['header_text'] = _t("_NOT_RECOGNIZED", $site['title']);
$action_result = _t("_MEMBER_NOT_RECOGNIZED", $site['title']);
}
}
}
echo "<table width=\"100%\" cellpadding=4 cellspacing=4>\r\n\t\t\t<td align=center class=text2>\n";
echo $action_result;
if ($show_form) {
send_form();
}
echo "\r\n\t\t\t</td></table>\n";
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
示例9: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
global $site;
$messageID = (int) $_GET['message'];
$memberID = (int) $_COOKIE['memberID'];
$sender_sql = "SELECT `Recipient` FROM `Messages` WHERE `Sender` = '{$memberID}' AND `ID` = '{$messageID}'";
$sender_arr = db_arr($sender_sql);
$senderID = $sender_arr['Recipient'];
$message_sql = "SELECT m.`Text`, m.`Subject`, DATE_FORMAT( m.`Date`, '%Y-%m-%d' ) AS `Date`, p.Status FROM `Messages` AS m LEFT JOIN Profiles AS p ON m.Recipient = p.ID WHERE m.`ID` = '{$messageID}'";
// AND`Sender` = '$senderID'";
$message_arr = db_arr($message_sql);
$ret = '';
$ret .= '<div class="profile_ditails_block">';
$ret .= ProfileDetails($senderID);
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
$ret .= '<div class="m_block">';
$ret .= '<div class="m_subject_date">';
$ret .= '<div class="name">';
$ret .= _t('_Date') . ':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= $message_arr['Date'];
$ret .= '</div>';
$ret .= '<div class="name">';
$ret .= _t('_Subject') . ':';
$ret .= '</div>';
$ret .= '<div class="value">';
$ret .= process_smiles(process_line_output($message_arr['Subject']));
$ret .= '</div>';
$ret .= '</div>';
$ret .= '<div class="m_text">';
$ret .= process_html_output($message_arr['Text'], 80);
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
$ret .= '</div>';
//$ret .= '<div class="reply_block">';
if ($message_arr['Status'] == 'Active') {
$ret .= '<div class="reply">';
$ret .= '<a href="' . $site['url'] . 'compose.php?ID=' . $senderID . '">Write new Message</a>';
$ret .= '</div>';
$ret .= '<div class="clear_both"></div>';
} else {
$ret .= '';
}
//####################################################
$ret .= '<div style="position:relative; height:20px;"></div>';
$ret .= PageCorespondence($memberID, $senderID);
$ret .= '<div class="clear_both"></div>';
return $ret;
}
示例10: contr_panel_members_total
/**
* Prints total members statisric
*/
function contr_panel_members_total($w = "")
{
global $site;
global $prof;
global $PageCompMemberStat_db_num;
$free_mode = getParam("free_mode") == "on" ? 1 : 0;
// members statistics
$total_c2 = strlen($_POST['total_c2']) ? $_POST['total_c2'] : getParam("default_country");
$total_arr = db_arr("SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active'");
$total_arr_week = db_arr("SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND (TO_DAYS(NOW()) - TO_DAYS(LastReg)) <= 7");
if (!$free_mode) {
$total_arr_gold = getMembersCount(MEMBERSHIP_ID_STANDARD, '', true);
}
$total_c_arr = db_arr("SELECT COUNT(ID) FROM `Profiles` WHERE Status = 'Active' AND `Country` = '" . process_db_input($total_c2) . "'");
$total_members = $total_arr[0];
$total_c_members = $total_c_arr[0];
$c_arr = $prof['countries'];
$ret = '';
$ret .= '<div class="totalRegBlock">';
$ret .= '<div class="clear_both"></div>';
$ret .= '<div style="position:relative; float:left;"><img src="' . $site['icons'] . 'group.gif" alt="" /></div>';
$ret .= '<div style="position:relative; float:left; white-space:nowrap; left:5px; font-weight:bold; color:#000;">' . _t("_Total Registered") . '</div>';
$ret .= '<div class="clear_both"></div>';
$ret .= '<div style="position:relative; margin:0px 0px;"></div>';
$ret .= '<div class="member_stat_block">';
$ret .= '<div><img src="' . $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' . _t("_Total") . ' - ' . $total_arr[0] . '</span></div>';
if (!$free_mode) {
$ret .= '<div><img src="' . $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' . _t("_Gold Members") . ' - ' . $total_arr_gold . '</span></div>';
}
$ret .= '<div><img src="' . $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' . _t("_New this week") . ' - ' . $total_arr_week[0] . '</span></div>';
$ret .= '<div><img src="' . $site['icons'] . 'us.gif" alt="" /><span style="margin-left:5px;">' . $total_c_members . ' ' . _t("_members") . ' ' . _t("_from") . '</span></div>';
$ret .= '<div class="mem_stat_country">';
$ret .= '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="cForm2">';
$ret .= '<input type="hidden" name="total_c2" value="' . $total_c2 . '" />';
$ret .= '<select class="mem_stat_country_select" name="total_c2" onChange="javascript:this.form.submit();">';
foreach ($c_arr as $key => $value) {
$ret .= '<option value="' . $key . '"';
if ($key == $total_c2) {
$ret .= ' selected="selected"';
}
$ret .= '>' . _t('__' . $value) . '</option>';
}
$ret .= '</select>';
$ret .= '</form>';
$ret .= '</div>';
$ret .= '</div>';
$ret .= '</div>';
return $ret;
}
示例11: PageCompPageMainCode
/**
* page code function
*/
function PageCompPageMainCode()
{
global $short_date_format;
$story_id = (int) $_GET['ID'];
$out = "";
$query = "SELECT `Profiles`.`ID`, DATE_FORMAT(`Stories`.`Date`, '{$short_date_format}' ) AS 'Date', `Stories`.`Header`, `Stories`.`Text`, `Profiles`.`NickName` FROM `Stories` LEFT JOIN `Profiles` ON (`Stories`.`Sender` = `Profiles`.`ID`) WHERE `Stories`.`ID` = {$story_id} ORDER BY `Stories`.`Date` DESC";
$arr = db_arr($query);
if (!$arr) {
return "<center>" . _t("_No success story available.") . "</center>";
}
$story_header = process_text_output($arr['Header']);
$story_text = process_html_output($arr['Text']);
$out .= "\r\n\t\t<table width=\"100%\" cellpadding=4 cellspacing=4><td align=center class=text2>\r\n\t\t\t<td>\r\n\t\t\t\t<table cellspacing=1 cellpadding=2 class=small width=100%>\r\n\t\t\t\t\t<tr class=panel>\r\n\t\t\t\t\t\t<td align=center width=15%>{$arr['Date']}</td>\r\n\t\t\t\t\t\t<td align=center width=15%><a href='" . getProfileLink($arr['ID']) . "'>{$arr['NickName']}</td>\r\n\t\t\t\t\t\t<td aling=left> <b>{$story_header}</b></td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t\t<table cellspacing=1 cellpadding=2 class=small width=100%>\r\n\t\t\t\t\t<tr class=panel>\r\n\t\t\t\t\t\t<td aling=left>{$story_text}</td>\r\n\t\t\t\t\t</tr>\r\n\t\t\t\t</table>\r\n\t\t\t</td>\r\n\t\t</table>\n";
return $out;
}
示例12: serviceGetEntry
function serviceGetEntry($iId, $sType = 'browse')
{
$iId = (int) $iId;
$sqlQuery = "SELECT a.`ID` as `id`,\n a.`Title` as `title`,\n a.`Description` as `description`,\n a.`Uri` as `uri`,\n a.`Owner` as `owner`,\n a.`Date` as `date`,\n a.`Video`,\n a.`Source`,\n a.`Rate` AS `rate`,\n a.`RateCount` AS `rate_count`,\n a.`CommentsCount` AS `comments_count`,\n a.`Views` AS `views_count`,\n a.`Status` AS `status`,\n b.`id_album` as `album_id`\n FROM `RayVideoFiles` as a\n LEFT JOIN `sys_albums_objects` as b ON b.`id_object` = a.`ID`\n LEFT JOIN `sys_albums` as c ON c.`ID`=b.`id_album`\n WHERE a.`ID`='{$iId}' AND c.`Type`='bx_videos'";
$aImageInfo = db_arr($sqlQuery);
if (empty($aImageInfo) || !is_array($aImageInfo)) {
return array();
}
$sFileName = $sFilePath = '';
$sImg = $aImageInfo['id'] . $this->aConstants['picPostfix'][$sType];
if ($sImg != '' && extFileExists($this->aConstants['filesDir'] . $sImg)) {
$sFileName = $this->aConstants['filesUrl'] . $sImg;
$sFilePath = $this->aConstants['filesDir'] . $sImg;
}
return array('id' => $aImageInfo['id'], 'file' => $sFileName, 'file_path' => $sFilePath, 'title' => $aImageInfo['title'], 'owner' => $aImageInfo['owner'], 'description' => $aImageInfo['description'], 'width' => (int) $this->oModule->_oConfig->getGlParam('browse_width') + 2 * 2, 'height' => (int) (int) $this->oModule->_oConfig->getGlParam('browse_height') + 2 * 2, 'url' => $this->getCurrentUrl('file', $iId, $aImageInfo['uri']), 'video' => $aImageInfo['Video'], 'source' => $aImageInfo['Source'], 'rate' => $aImageInfo['rate'], 'rate_count' => $aImageInfo['rate_count'], 'comments_count' => $aImageInfo['comments_count'], 'views_count' => $aImageInfo['views_count'], 'status' => $aImageInfo['status'], 'album_id' => $aImageInfo['album_id']);
}
示例13: banner_put
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>";
}
示例14: getInstance
/**
* Static method to get an instance of a module's class.
*
* NOTE. The prefered usage is to get an instance of [ClassPrefix]Module class.
* But if it's needed an instance of class which has constructor without parameters
* or with one parameter(an array with module's info) it can be retrieved.
*
* @param $sClassName module's class name.
*/
function getInstance($sClassName)
{
if (empty($sClassName)) {
return null;
}
if (isset($GLOBALS['bxDolClasses'][$sClassName])) {
return $GLOBALS['bxDolClasses'][$sClassName];
} else {
$aModule = db_arr("SELECT * FROM `sys_modules` WHERE INSTR('" . $sClassName . "', `class_prefix`)=1 LIMIT 1");
if (empty($aModule) || !is_array($aModule)) {
return null;
}
$sClassPath = BX_DIRECTORY_PATH_MODULES . $aModule['path'] . '/classes/' . $sClassName . '.php';
if (!file_exists($sClassPath)) {
return null;
}
require_once $sClassPath;
$GLOBALS['bxDolClasses'][$sClassName] = new $sClassName($aModule);
return $GLOBALS['bxDolClasses'][$sClassName];
}
}
示例15: _getMessage
function _getMessage($sUser, $sPwd, $iMsgId, $isInbox)
{
$aRet = array();
if (!($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
$aMsgs = array();
$iMsgId = (int) $iMsgId;
$sJoinOn = $isInbox ? " `m`.`Sender` = `p`.`ID` " : " `m`.`Recipient` = `p`.`ID` ";
$aRow = db_arr("SELECT \r\n `m`.`ID`, `m`.`Date`, `m`.`Sender`, `m`.`Recipient`, `m`.`Subject`, `m`.`Text`, `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 `m`.`ID` = '{$iMsgId}'");
if ($aRow) {
$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']), 'Text' => new xmlrpcval($aRow['Text']), 'New' => new xmlrpcval($aRow['New']), 'Nick' => new xmlrpcval($aRow['Nick']), 'Thumb' => new xmlrpcval($sIcon));
if ($isInbox && $aRow['New']) {
db_res("UPDATE `sys_messages` SET `New` = 0 WHERE `ID` = '{$iMsgId}'");
}
} else {
return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
}
return new xmlrpcval($aMsg, "struct");
}