function displayItem($aParams, &$aEntry) { $sSampleType = $aParams['sample_type']; $iViewerType = $aParams['viewer_type']; $bAdminPanel = $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (isset($aParams['admin_panel']) && $aParams['admin_panel'] || $sSampleType == 'admin'); $sModuleUri = $this->_oConfig->getUri(); $sLKLinkEdit = _t('_' . $sModuleUri . '_lcaption_edit'); $aTmplVars = array('id' => $this->_oConfig->getSystemPrefix() . $aEntry['id'], 'caption' => str_replace("\$", "$", $aEntry['caption']), 'class' => !in_array($sSampleType, array('view')) ? ' ' . $this->sCssPrefix . '-text-snippet ' : '', 'date' => _format_when($aEntry['ago']), 'content' => str_replace("\$", "$", $aEntry['content']), 'link' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/' . $aEntry['uri'], 'bx_if:checkbox' => array('condition' => $bAdminPanel, 'content' => array('id' => $aEntry['id'])), 'bx_if:status' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('status' => _t('_' . $sModuleUri . '_status_' . $aEntry['status']))), 'bx_if:featured' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN && (int) $aEntry['featured'] == 1, 'content' => array()), 'bx_if:edit_link' => array('condition' => $iViewerType == BX_TD_VIEWER_TYPE_ADMIN, 'content' => array('edit_link_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'admin/' . $aEntry['uri'], 'edit_link_caption' => $sLKLinkEdit))); return $this->parseHtmlByName('item.html', $aTmplVars); }
function getComment($iId, $iCmtId, $iAuthorId = 0) { global $sHomeUrl; $sFields = "'' AS `cmt_rated`,"; $sJoin = ''; if ($iAuthorId) { $sFields = '`r`.`cmt_rate` AS `cmt_rated`,'; $sJoin = "LEFT JOIN {$this->_sTableTrack} AS `r` ON (`r`.`cmt_system_id` = " . $this->_aSystem['system_id'] . " AND `r`.`cmt_id` = `c`.`cmt_id` AND `r`.`cmt_rate_author_id` = {$iAuthorId})"; } $aComment = $this->getRow("SELECT \r\n\t\t\t\t{$sFields}\r\n\t\t\t\t`c`.`cmt_id`, \r\n\t\t\t\t`c`.`cmt_parent_id`, \r\n\t\t\t\t`c`.`cmt_object_id`, \r\n\t\t\t\t`c`.`cmt_author_id`, \r\n\t\t\t\t`c`.`cmt_text`, \r\n\t\t\t\t`c`.`cmt_mood`,\r\n\t\t\t\t`c`.`cmt_rate`, \r\n\t\t\t\t`c`.`cmt_rate_count`, \r\n\t\t\t\t`c`.`cmt_replies`, \r\n\t\t\t\t(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`,\r\n\t\t\t\t`p`.`NickName` AS `cmt_author_name`\t\t\t\t\r\n\t\t\tFROM {$this->_sTable} AS `c`\r\n\t\t\tLEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`)\r\n\t\t\t{$sJoin}\r\n\t\t\tWHERE `c`.`cmt_object_id` = '{$iId}' AND `c`.`cmt_id` = '{$iCmtId}' \r\n\t\t\tLIMIT 1"); $aComment['cmt_text'] = str_replace("[ray_url]", $sHomeUrl, $aComment['cmt_text']); $aComment['cmt_ago'] = _format_when($aComment['cmt_secs_ago']); return $aComment; }
function getComments($iId, $iCmtParentId = 0, $iAuthorId = 0) { $sFields = "'' AS `cmt_rated`,"; $sJoin = ''; if ($iAuthorId) { $sFields = '`r`.`cmt_rate` AS `cmt_rated`,'; $sJoin = "LEFT JOIN {$this->_sTableTrack} AS `r` ON (`r`.`cmt_system_id` = " . $this->_aSystem['system_id'] . " AND `r`.`cmt_id` = `c`.`cmt_id` AND `r`.`cmt_rate_author_id` = {$iAuthorId})"; } $a = $this->getAll("SELECT \r\n\t\t\t\t{$sFields}\r\n\t\t\t\t`c`.`cmt_id`, \r\n\t\t\t\t`c`.`cmt_parent_id`, \r\n\t\t\t\t`c`.`cmt_object_id`, \r\n\t\t\t\t`c`.`cmt_author_id`, \r\n\t\t\t\t`c`.`cmt_text`, \r\n\t\t\t\t`c`.`cmt_rate`, \r\n\t\t\t\t`c`.`cmt_rate_count`, \r\n\t\t\t\t`c`.`cmt_replies`, \r\n\t\t\t\t(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`c`.`cmt_time`)) AS `cmt_secs_ago`,\r\n\t\t\t\t`p`.`NickName` AS `cmt_author_name`,\r\n\t\t\t\t`m`.`med_file` AS `cmt_author_icon`\r\n\t\t\tFROM {$this->_sTable} AS `c`\r\n\t\t\tLEFT JOIN `Profiles` AS `p` ON (`p`.`ID` = `c`.`cmt_author_id`)\r\n\t\t\tLEFT JOIN `media` AS `m` ON (`m`.`med_id` = `p`.`PrimPhoto` AND `m`.`med_status` = 'active')\r\n\t\t\t{$sJoin}\r\n\t\t\tWHERE `c`.`cmt_object_id` = '{$iId}' AND `c`.`cmt_parent_id` = '{$iCmtParentId}'\r\n\t\t\tORDER BY `c`.`cmt_time` ASC"); for (reset($a); list($k) = each($a);) { $a[$k]['cmt_ago'] = _format_when($a[$k]['cmt_secs_ago']); } return $a; }
function video_getList($sId) { global $sModule; global $aXmlTemplates; global $sFilesPath; $sMode = getSettingValue($sModule, "listSource"); $iCount = (int) getSettingValue($sModule, "listCount"); if (!is_numeric($iCount) || $iCount <= 0) { $iCount = 10; } $oSource = new BxVideosSearch(); $oSource->aCurrent['sorting'] = 'top'; $oSource->aCurrent['paginate']['perPage'] = $iCount; $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>'); switch ($sMode) { case "Member": $sOwner = getValue("SELECT `Owner` FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'"); $oSource->aCurrent['restriction']['owner'] = array('value' => $sOwner, 'field' => 'Owner', 'operator' => '='); break; case "Related": $aFile = getArray("SELECT * FROM `" . MODULE_DB_PREFIX . "Files` WHERE `ID` = '" . $sId . "'"); $oSource->aCurrent['restriction']['keyword'] = array('value' => $aFile['Title'] . " " . $aFile['Tags'] . " " . $aFile['Description'], 'field' => '', 'operator' => 'against'); break; case "Top": default: $oSource->aCurrent['restriction']['id'] = array('value' => $sId, 'field' => 'ID', 'operator' => '<>'); break; } $aData = $oSource->getSearchData(); $iCurrentTime = time(); $sResult = ""; for ($i = 0; $i < count($aData); $i++) { $aData[$i]['uri'] = $oSource->getCurrentUrl('file', $aData[$i]['id'], $aData[$i]['uri']); $aData[$i]['date'] = _format_when($iCurrentTime - $aData[$i]['date']); $sImageFile = $aData[$i]['id'] . IMAGE_EXTENSION; $sThumbFile = $aData[$i]['id'] . THUMB_FILE_NAME . IMAGE_EXTENSION; if (!file_exists($sFilesPath . $sThumbFile)) { $sThumbFile = $sImageFile; } $sResult .= parseXml($aXmlTemplates['file'], $sThumbFile, $aData[$i]['size'], $aData[$i]['ownerName'], $aData[$i]['view'], $aData[$i]['voting_rate'], $aData[$i]['date'], $aData[$i]['title'], BX_DOL_URL_ROOT . $aData[$i]['uri']); } return $sResult; }
/** * Function will generate the messages rows ; * * @return : Html presentation data ; */ function genMessagesRows() { global $oSysTemplate; global $oFunctions; global $site; // init some needed variables ; $sOutputHtml = null; $sMessageBoxActions = null; $sMessagesTypesList = null; $sPerPageBlock = null; $aSortToglleElements = array('date_sort_toggle', 'subject_sort_toggle', 'type_sort_toggle', 'author_sort_toggle'); $aMessageRows = array(); // language keys ; $aLanguageKeys = array('author' => _t('_Author'), 'type' => _t('_Type'), 'subject' => _t('_Subject'), 'date' => _t('_Date'), 'new' => _t('_new'), 'contact' => _t('_Contact'), 'select' => _t('_Select'), 'all' => _t('_All'), 'none' => _t('_None'), 'read' => _t('_Read'), 'unread' => _t('_Unread'), 'delete' => _t('_Delete'), 'spam' => _t('_Report'), 'more' => _t('_More actions'), 'mark_read' => _t('_Mark as old'), 'mark_unread' => _t('_Mark as New'), 'restore' => _t('_Restore'), 'click_sort' => _t('_Click to sort'), 'recipient' => _t('_Recipient')); // get messages array ; $aMessages =& $this->getMessages(); // generate list of messages types if (is_array($this->aRegisteredMessageTypes) and !empty($this->aRegisteredMessageTypes)) { foreach ($this->aRegisteredMessageTypes as $iKey => $sRegisteredType) { $sChecked = null; if (!empty($this->aReceivedMessagesTypes) and in_array($sRegisteredType, $this->aReceivedMessagesTypes)) { $sChecked = ' checked="checked" '; } $aTemplateKeys = array('letters_type' => $sRegisteredType, 'letters_type_caption' => _t('_' . $sRegisteredType), 'checked' => $sChecked); $sMessagesTypesList .= $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_types_list'], $aTemplateKeys); } unset($aTemplateKeys); } // processing all messages ; if (is_array($aMessages) and !empty($aMessages)) { // need for row devide ; $iIndex = 1; foreach ($aMessages as $iKey => $aItems) { // generate image and keyword for type of message ; $sTypeIcon = getTemplateIcon($this->sMessageIconPrefix . $aItems['Type'] . $this->sMessageIconExtension); $sTypeLang = _t('_' . $aItems['Type']); // get message's subject ; $sSubject = mb_strlen($aItems['Subject']) > $this->iMessageSubjectLength ? mb_substr($aItems['Subject'], 0, $this->iMessageSubjectLength) . '...' : $aItems['Subject']; // get message's description ; $sDescription = strip_tags($aItems['Text']); mb_strlen($sDescription) > $this->iMessageDescrLength ? $sDescription = mb_substr($sDescription, 0, $this->iMessageDescrLength) . '...' : null; // generate the `new` message's icon ; $sNewMessageImg = $aItems['New'] ? getTemplateIcon('new_message.png') : getTemplateIcon(null); // color devider ; $sFiledCss = !($iIndex % 2) ? 'filled' : 'not_filled'; $aProfileInfo = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileInfo($aItems['Sender']) : getProfileInfo($aItems['Recipient']); $sMemberIcon = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? get_member_thumbnail($aItems['Sender'], 'left') : get_member_thumbnail($aItems['Recipient'], 'left'); $sMemberLocation = $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? getProfileLink($aItems['Sender']) : getProfileLink($aItems['Recipient']); $sMemberNickName = getNickName($aProfileInfo['ID']); $sMemberAge = $aProfileInfo['DateOfBirth'] != "0000-00-00" ? _t("_y/o", age($aProfileInfo['DateOfBirth'])) : null; $sMemberCountry = $aProfileInfo['Country']; $sMemberFlag = $site['flags'] . strtolower($sMemberCountry) . $this->sMembersFlagExtension; $sMemberSexImg = $oFunctions->genSexIcon($aProfileInfo['Sex']); if ($sMemberCountry) { $sMemberCountryFlag = '<img src="' . $sMemberFlag . '" alt="' . $sMemberCountry . '" />'; } // generate the message status ; $sMessageStatus = $aItems['New'] ? 'unread' : 'read'; $aMessageRows[] = array('message_id' => $aItems['ID'], 'message_status' => $sMessageStatus, 'message_owner' => $aItems['Sender'], 'message_link' => $aItems['ID'], 'message_page' => 'mail.php', 'member_icon' => $sMemberIcon, 'member_location' => $sMemberLocation, 'member_nickname' => $sMemberNickName, 'member_sex_img' => $sMemberSexImg, 'member_sex' => $aProfileInfo['Sex'], 'member_age' => $sMemberAge, 'member_flag' => $sMemberCountryFlag, 'member_country' => $sMemberCountry, 'message_type' => $sTypeLang, 'message_type_icon' => $sTypeIcon, 'message_subject' => $sSubject, 'bx_if:show_new' => array('condition' => $aItems['New'], 'content' => array()), 'message_descr' => $sDescription, 'message_new_img' => $sNewMessageImg, 'message_new' => $aLanguageKeys['new'], 'message_contact_url' => BX_DOL_URL_ROOT . "mail.php?mode=compose&recipient_id=" . $aProfileInfo['ID'], 'message_contact' => $aLanguageKeys['contact'], 'message_date' => $aItems['Date'], 'message_ago' => _format_when($aItems['DateUTS']), 'filled_class' => $sFiledCss); $iIndex++; } } // init sort toggle ellements ; switch ($this->aMailBoxSettings['sort_mode']) { case 'date': $aSortToglleElements['date_sort_toggle'] = 'toggle_up'; break; case 'date_desc': $aSortToglleElements['date_sort_toggle'] = 'toggle_down'; break; case 'subject': $aSortToglleElements['subject_sort_toggle'] = 'toggle_up'; break; case 'subject_desc': $aSortToglleElements['subject_sort_toggle'] = 'toggle_down'; break; case 'type': $aSortToglleElements['type_sort_toggle'] = 'toggle_up'; break; case 'type_desc': $aSortToglleElements['type_sort_toggle'] = 'toggle_down'; break; case 'author': $aSortToglleElements['author_sort_toggle'] = 'toggle_up'; break; case 'author_desc': $aSortToglleElements['author_sort_toggle'] = 'toggle_down'; break; } // generate the pagination ; $sRequest = BX_DOL_URL_ROOT . 'mail.php?'; // need for additional parameters ; $aGetParams = array('mode', 'sorting', 'messages_types'); if (is_array($aGetParams) and !empty($aGetParams)) { foreach ($aGetParams as $sValue) { if (isset($_GET[$sValue])) { $sRequest .= '&' . $sValue . '=' . $_GET[$sValue]; } } } $sCuttedUrl = $sRequest; $sRequest = $sRequest . '&page={page}&per_page={per_page}'; $oPaginate = new BxDolPaginate(array('page_url' => $sRequest, 'count' => $this->iTotalMessageCount, 'per_page' => $this->aMailBoxSettings['per_page'], 'sorting' => $this->aMailBoxSettings['sort_mode'], 'page' => $this->aMailBoxSettings['page'], 'per_page_changer' => false, 'page_reloader' => true, 'on_change_page' => "oMailBoxMessages.getPaginatePage('{$sRequest}')", 'on_change_per_page' => "oMailBoxMessages.getPage(this.value, '{$sCuttedUrl}')")); $sPagination = $oPaginate->getPaginate(); // generate messages section if (!empty($aMessageRows)) { $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_types_list' => $sMessagesTypesList, 'per_page_block' => $oPaginate->getPages(), 'author' => $this->aMailBoxSettings['mailbox_mode'] != 'outbox' ? $aLanguageKeys['author'] : $aLanguageKeys['recipient'], 'type' => $aLanguageKeys['type'], 'subject' => $aLanguageKeys['subject'], 'date' => $aLanguageKeys['date'], 'click_sort' => $aLanguageKeys['click_sort'], 'bx_repeat:messages' => $aMessageRows, 'sort_date' => $this->aMailBoxSettings['sort_mode'] == 'date' ? 'date_desc' : 'date', 'sort_subject' => $this->aMailBoxSettings['sort_mode'] == 'subject' ? 'subject_desc' : 'subject', 'sort_type' => $this->aMailBoxSettings['sort_mode'] == 'type' ? 'type_desc' : 'type', 'sort_author' => $this->aMailBoxSettings['sort_mode'] == 'author' ? 'author_desc' : 'author', 'date_sort_toggle_ellement' => $aSortToglleElements['date_sort_toggle'], 'subject_sort_toggle_ellement' => $aSortToglleElements['subject_sort_toggle'], 'type_sort_toggle_ellement' => $aSortToglleElements['type_sort_toggle'], 'author_sort_toggle_ellement' => $aSortToglleElements['author_sort_toggle'], 'current_page' => 'mail.php', 'select' => $aLanguageKeys['select'], 'all_messages' => $aLanguageKeys['all'], 'none_messages' => $aLanguageKeys['none'], 'read_messages' => $aLanguageKeys['read'], 'unread_messages' => $aLanguageKeys['unread'], 'pagination_block' => $sPagination); // generate extended mailbox actions switch ($this->aMailBoxSettings['mailbox_mode']) { case 'inbox': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')')), array('type' => 'button', 'value' => $aLanguageKeys['spam'], 'attrs' => array('onclick' => 'if (typeof oMailBoxMessages != \'undefined\') oMailBoxMessages.spamMessages(\'messages_container\')')), array('type' => 'button', 'value' => $aLanguageKeys['mark_read'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.markMessages(\'read\', \'genMessagesRows\')')), array('type' => 'button', 'value' => $aLanguageKeys['mark_unread'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.markMessages(\'unread\', \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'outbox': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.deleteMessages(\'messages_container\', \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; case 'trash': $aForm = array('form_attrs' => array('action' => null, 'method' => 'post'), 'params' => array('remove_form' => true, 'db' => array('submit_name' => 'do_submit')), 'inputs' => array('actions' => array('type' => 'input_set', 'colspan' => 'true', 0 => array('type' => 'button', 'value' => $aLanguageKeys['restore'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.restoreMessages(\'messages_container\', \'genMessagesRows\')')), 1 => array('type' => 'button', 'value' => $aLanguageKeys['delete'], 'attrs' => array('onclick' => 'if ( typeof oMailBoxMessages != \'undefined\' ) oMailBoxMessages.hideDeletedMessages(\'messages_container\', \'genMessagesRows\')'))))); $oForm = new BxTemplFormView($aForm); $sMessageBoxActions = $oForm->getCode(); break; } $aTemplateKeys['messages_actions_block'] = $sMessageBoxActions; //return builded rows ; $sMessagesSection = $oSysTemplate->parseHtmlByName($this->aUsedTemplates['messages_box'], $aTemplateKeys); $sPerPageBlock = $oPaginate->getPages(); } else { $sMessagesSection = MsgBox(_t('_Empty')); } // generate mailboxe's top section ; $sTopControls = $oSysTemplate->parseHtmlByName('mail_box_messages_list_top_controls.html', array('messages_types_list' => $sMessagesTypesList, 'per_page_block' => $sPerPageBlock)); $aTemplateKeys = array('per_page' => $this->aMailBoxSettings['per_page'], 'page_number' => $this->aMailBoxSettings['page'], 'page_mode' => $this->aMailBoxSettings['mailbox_mode'], 'messages_types' => $this->aMailBoxSettings['messages_types'], 'messages_sort' => $this->aMailBoxSettings['sort_mode'], 'top_controls' => $sTopControls, 'messages_section' => $sMessagesSection); $sOutputHtml = $oSysTemplate->parseHtmlByName('mail_box_messages_list.html', $aTemplateKeys); // return all builded data ; return $sOutputHtml; }
/** * Convert timestamp to "ago" date format * @param $iTime date/time stamp in seconds * @param $bAutoDateConvert automatically convert dates to full date format instead of "ago" format for old dates (older than 14 days) * @param $bShort use short format for relative time * @return formatted date string */ function defineTimeInterval($iTime, $bAutoDateConvert = true, $bShort = false) { $iTimeDiff = time() - (int) $iTime; if ($bAutoDateConvert && $iTimeDiff > 14 * 24 * 60 * 60) { // don't show "ago" dates for more than 14 days return getLocaleDate((int) $iTime); } return _format_when($iTimeDiff, $bShort); }
/** * Generate Comments Section * * @param $iElementID - Post ID * @param $iOwnerID - Owner ID * @return HTML presentation of data */ function PrintCommentSection($iElementID, $sCommentLbl = '') { global $prof; global $site; $sRetHtml = ''; $sCommentsC = $sCommentLbl == '' ? _t('_comments') : $sCommentLbl; $sSbjN = _t('_Subject'); $sPostedByC = _t('_Posted by'); $sDateC = _t('_Date'); $sLocationC = _t('_Location'); $sAdminLocalAreaC = _t('_AdminArea'); $sAdminC = _t('_Admin'); $sSureC = _t("_Are you sure"); $sPostCommentC = _t('_Post Comment'); $sLeaveCommentC = _t('_LeaveComment'); $sAddCommentC = _t('_Add comment'); $sEditC = _t('_Edit'); $sDeleteC = _t('_Delete'); $sCommentFriendsOnlyC = _t('_commenting_this_blog_allowed_only_for_friends'); $sReportC = _t('_Report'); $sPostDataSQL = $this->SelectionObjectSQL($iElementID); $aPostData = db_arr($sPostDataSQL); $iOwnerID = $aPostData['OwnerID']; //$bFriend = is_friends( $this->iVisitorID, $aPostData['OwnerID'] ); //$bOwner = ($this->iVisitorID==$aPostData['OwnerID']) ? true : false; $bCanPostComment = $this->GetPostNewCommentPermission($aPostData); $bCanPostCommentReport = $this->GetCommentReportPermission($aPostData); $sQuery = $this->SelectionCommentsObjectSQL($iElementID); $vSqlRes = db_res($sQuery); $sCommsHtml = ''; while ($aSqlResStr = mysql_fetch_assoc($vSqlRes)) { $aCommentData = $this->FillCommentsData($aSqlResStr); $aProfileInfo = getProfileInfo($aCommentData['ProfID']); $sPostedBy = $aCommentData['ProfID'] == 0 ? $sAdminC : '<a href="' . getProfileLink($aCommentData['ProfID']) . '">' . $aProfileInfo['NickName'] . '</a>'; $sCountryName = $aProfileInfo['Country'] == "" ? $sAdminLocalAreaC : _t('__' . $prof['countries'][$aProfileInfo['Country']]); $sCountryPic = $aProfileInfo['Country'] == '' ? '' : ' <img alt="' . $aProfileInfo['Country'] . '" src="' . ($site['flags'] . strtolower($aProfileInfo['Country'])) . '.gif"/>'; $sUserIcon = get_member_icon($aCommentData['ProfID'], 'left', true); $aCommentData['Text'] = $aCommentData['Text']; $sTimeAgo = _format_when($aCommentData['Time']); $sMessageBR = $this->ActionPrepareForEdit($aCommentData['Text']); $sFullPermissions = $this->GetElementFullPermission($aPostData, $aCommentData); $sAdminActions = ''; if ($sFullPermissions) { if ($this->iCType == 1) { $sAdminActions = <<<EOF <!-- <span class="comment_text_r"> --> <div class="comment_actions"> \t<a href="{$this->sCurrBrowsedFile}" onclick="javascript: UpdateField('EditCommentID',{$aCommentData['ID']});UpdateField('EAdvID',{$iElementID}); UpdateFieldStyle('answer_form_to_1','block');UpdateFieldTiny('commentText','{$sMessageBR}'); return false;">{$sEditC}</a>| \t<a href="{$_SERVER['PHP_SELF']}?ShowAdvertisementID={$aCommentData['ID']}" onclick="javascript: UpdateField('DeleteCommentID',{$aCommentData['ID']});UpdateField('DAdvID',{$iElementID});document.forms.command_delete_comment.submit(); return false;">{$sDeleteC}</a> <!-- </span> --> </div> EOF; } if ($this->iCType == 2) { $sAdminActions = <<<EOF <span class="comment_text_r"> \t<a href="{$this->sCurrBrowsedFile}" onclick="javascript: UpdateField('EditCommentID',{$aCommentData['ID']});UpdateField('EPostID',{$iElementID});UpdateFieldStyle('answer_form_to_1','block');UpdateFieldTiny('commentText','{$sMessageBR}'); return false;">{$sEditC}</a>| \t<a href="{$this->sCurrBrowsedFile}" onclick="javascript: UpdateField('DeleteCommentID',{$aCommentData['ID']});UpdateField('DPostID',{$iElementID});document.forms.command_delete_comment.submit(); return false;">{$sDeleteC}</a> </span> EOF; } } if ($bCanPostCommentReport) { if ($this->iCType == 1) { $sReport = <<<EOF <div class="comment_actions"> \t<a onclick="javascript: window.open( 'classifieds.php?commentID={$aCommentData['ID']}&clsID={$iElementID}&action=report', 'comment', 'width=500, height=380, menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no' );return false;" href="#{$aCommentData['ID']}">{$sReportC}</a> </div> EOF; } } $sCommsHtml .= <<<EOF <div class="comment_row"> \t{$sUserIcon} \t{$sPostedBy} ({$sTimeAgo})<br /> \t{$aCommentData['Text']}<br /> \t{$sReport}<br /> \t{$sAdminActions} \t<div class="clear_both"></div> </div> EOF; } $sPostNewComm = ''; if ($bCanPostComment == true) { if ($this->iCType == 1) { $sPostNewComm = <<<EOF <form action="{$this->sCurrBrowsedFile}" method="post" name="post_comment_adv_form"> \t<input type="hidden" name="CommAdvertisementID" value="{$iElementID}" /> \t<textarea name="message" id="postNewComm" rows="5" cols="30" class="classfiedsTextArea"></textarea> \t<input id="postCommentAdv" name="postCommentAdv" type="submit" value="{$sPostCommentC}"/> </form> EOF; } if ($this->iCType == 2) { $sPostNewComm = <<<EOF <form action="{$this->sCurrBrowsedFile}?action=show_member_post&ownerID={$iOwnerID}&post_id={$iElementID}" method="post" name="post_comment_adv_form"> \t<input type="hidden" name="action" value="addcomment" /> \t<input type="hidden" name="CommPostID" value="{$iElementID}" /> \t<input type="hidden" name="ownerID" value="{$this->aBlogConf['ownerID']}" /> \t<textarea name="message" id="postNewComm" rows="5" cols="30" class="classfiedsTextArea"></textarea> \t<input id="postCommentPost" name="postCommentPost" type="submit" value="{$sPostCommentC}"/> </form> EOF; } } if ($sFullPermissions == true) { if ($this->iCType == 1) { $sAdminFormActions = <<<EOF <form action="{$this->sCurrBrowsedFile}" method="post" name="command_edit_comment_adv_form"> \t<input type="hidden" name="EditCommentID" id="EditCommentID" value=""/> \t<input type="hidden" name="EAdvID" id="EAdvID" value=""/> \t<textarea name="commentText" id="commentText" rows="20" cols="60" class="classfiedsTextArea" style="width:{$this->iBigThumbSize}px;"></textarea> \t<input type="submit" value="{$sPostCommentC}"/> </form> EOF; } if ($this->iCType == 2) { $sAdminFormActions = <<<EOF <form action="{$this->sCurrBrowsedFile}?action=show_member_post&ownerID={$iOwnerID}&post_id={$iElementID}" method="post" name="command_edit_comment_post_form"> \t<input type="hidden" name="action" value="editcomment" /> \t<input type="hidden" name="EditCommentID" id="EditCommentID" value=""/> \t<input type="hidden" name="EPostID" id="EPostID" value=""/> \t<input type="hidden" name="ownerID" value="{$this->aBlogConf['ownerID']}" /> \t<textarea name="commentText" id="commentText" rows="10" cols="60" class="classfiedsTextArea" style="width:{$this->iBigThumbSize}px;"></textarea> \t<input type="submit" value="{$sPostCommentC}"/> </form> <form action="{$this->sCurrBrowsedFile}?action=show_member_post&ownerID={$iOwnerID}&post_id={$iElementID}" method="post" name="command_delete_comment"> \t<input type="hidden" name="DeleteCommentID" id="DeleteCommentID" value=""/> \t<input type="hidden" name="DPostID" id="DPostID" value=""/> \t<input type="hidden" name="action" id="action" value="delete_comment" /> \t<input type="hidden" name="ownerID" value="{$this->aBlogConf['ownerID']}" /> </form> EOF; } } $sCommentActions = ''; if ($bCanPostComment == false && $aPostData['PostCommentPermission'] == 'friends') { $sImgFriend = <<<EOF <img src="{$site['icons']}lock32.gif" alt="{$sCommentFriendsOnlyC}" title="{$sCommentFriendsOnlyC}" class="marg_icon" style="margin-top:10px;" /> EOF; $sCommentActions = $sImgFriend . MsgBox($sCommentFriendsOnlyC); } else { $sCommentActions = <<<EOF <div id="add_comment_label"> \t<img src="{$site['icons']}add_comment.gif" alt="{$sAddCommentC}" title="{$sAddCommentC}" class="marg_icon" /> \t<a class="actions" onclick="document.getElementById('answer_form_to_0').style.display = 'block'; document.getElementById('add_comment_label').style.display = 'none'; return false;" href="{$this->sCurrBrowsedFile}">{$sAddCommentC}</a> </div> EOF; } $sCommentsContent = <<<EOF <div id="comments_section"> \t<div id="answer_form_to_0" style="display: none;"> \t\t{$sPostNewComm} \t</div> \t<div id="answer_form_to_1" style="display: none;"> \t\t{$sAdminFormActions} \t</div> \t{$sCommsHtml} \t{$sCommentActions} </div> EOF; $show_hide = $this->genShowHideItem('comments_section'); $sRetHtml = DesignBoxContent($sCommentsC, $sCommentsContent, 1, $show_hide); return $sRetHtml; }
/** * Function will generate the pool block; * * @param : $aPollInfo (array) - contain some poll's information ; [ id_poll ] - (integer) poll's Id; [ id_profile ] - (integer) poll's owner Id; [ PollDate ] - (string) poll's date creation; [ sec ] - (integer) poll's date creation in seconds; * @param : $bAjaxQuery (boolean) - if isset this param that script will use different template; */ function getPollBlock(&$aPollInfo, $bAjaxQuery = false, $bViewMode = false, $bAdminMode = false) { if (!$this->oPrivacy->check('view', $aPollInfo['id_poll'], $this->aPollSettings['member_id'])) { return $this->getPrivatePollBlock($aPollInfo); } // ** init some needed variables ; $sPollActions = null; $aMemberInfo = array(); // language keys ; $aLanguageKeys = array('results' => _t('_bx_poll_result'), 'delete' => _t('_bx_poll_delete'), 'edit' => _t('_bx_poll_edit'), 'active' => _t('_bx_poll_active'), 'sure' => _t('_Are you sure?'), 'by' => _t('_bx_poll_by'), 'poll' => _t('_bx_poll'), 'featured' => _t('_bx_poll_featured'), 'unfeatured' => _t('_bx_poll_unfeatured'), 'poll_approved' => _t('_bx_poll_approved'), 'poll_unapproved' => _t('_bx_poll_unapproved')); // ** generate the some of poll's information ; $sDateAdd = _format_when($aPollInfo['poll_ago']); // need to modify (move the top member's info to bottom) $aTemplateKeys = array('bx_if:start_tag' => array('condition' => !$bAjaxQuery, 'content' => array('uid' => $aPollInfo['id_poll'])), 'bx_if:manage_page' => array('condition' => $bAdminMode || in_array($this->aPollSettings['mode'], array('manage', 'pending')) && $this->aPollSettings['member_id'] && $this->aPollSettings['member_id'] == $aPollInfo['id_profile'], 'content' => array()), 'bx_if:end_tag' => array('condition' => !$bAjaxQuery, 'content' => array()), 'uid' => $aPollInfo['id_poll'], 'poll_url' => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . '&action=show_poll_info&id=' . $aPollInfo['id_poll'], 'bx_if:show_link' => array('condition' => $aPollInfo['id_profile'], 'content' => array('link' => getProfileLink($aPollInfo['id_profile']), 'content' => getNickName($aPollInfo['id_profile']))), 'bx_if:show_text' => array('condition' => !$aPollInfo['id_profile'], 'content' => array('content' => _t('_Admin'))), 'date_add' => $sDateAdd, 'result' => $aLanguageKeys['results'], 'actions' => $sPollActions, 'by' => $aLanguageKeys['by'], 'bx_if:show_status' => array('condition' => $bAdminMode, 'content' => array('status' => $aPollInfo['poll_approval'] ? $aLanguageKeys['poll_approved'] : $aLanguageKeys['poll_unapproved'], 'featured' => $aPollInfo['poll_featured'] ? $aLanguageKeys['featured'] : $aLanguageKeys['unfeatured'])), 'bx_if:show_actions' => array('condition' => $bAdminMode, 'content' => array('url_edit' => $this->sPathToModule . '&action=my&mode=edit_poll&edit_poll_id=' . $aPollInfo['id_poll'])), 'pool_down_src' => $this->_oTemplate->getIconUrl('poll_down.png'), 'pool_up_src' => $this->_oTemplate->getIconUrl('poll_up.png'), 'spacer' => $this->_oTemplate->getIconUrl('spacer.gif'), 'back' => $aLanguageKeys['poll']); $sTemplateName = !$bViewMode ? $this->aUsedTemplates['poll_block'] : $this->aUsedTemplates['poll_view_block']; return $this->_oTemplate->parseHtmlByName($sTemplateName, $aTemplateKeys); }
function getEvents($aParams) { global $sHomeUrl; switch ($aParams['type']) { case 'id': $sWhereClause = "`id`='" . $aParams['object_id'] . "' "; $sLimitClause = 'LIMIT 1'; break; case 'owner': $sWhereClause = "`owner_id`='" . $aParams['owner_id'] . "' " . (isset($aParams['filter']) ? $this->_getFilterAddon($aParams['owner_id'], $aParams['filter']) : ''); $sOrderClause = isset($aParams['order']) ? ' ORDER BY `date` ' . strtoupper($aParams['order']) : ''; $sLimitClause = isset($aParams['count']) ? ' LIMIT ' . $aParams['start'] . ', ' . $aParams['count'] : ''; break; } $sSql = "SELECT \n `id` AS `id`, \n `owner_id` AS `owner_id`, \n `object_id` AS `object_id`, \n `type` AS `type`, \n `action` AS `action`, \n `content` AS `content`,\n `title` AS `title`,\n `description` AS `description`,\n `date` AS `date`,\n DATE_FORMAT(FROM_UNIXTIME(`date`), '" . $this->_oConfig->getDividerDateFormat() . "') AS `print_date`, \n DAYOFYEAR(FROM_UNIXTIME(`date`)) AS `days`, \n DAYOFYEAR(NOW()) AS `today`,\n (UNIX_TIMESTAMP() - `date`) AS `ago`\n FROM `" . $this->_sPrefix . "events`\n WHERE " . $sWhereClause . $sOrderClause . $sLimitClause; $aEvents = array(); $aEvent = $this->getFirstRow($sSql); while ($aEvent) { $aEvent['content'] = str_replace("[ray_url]", $sHomeUrl, $aEvent['content']); $aEvent['ago'] = _format_when($aEvent['ago']); $aEvents[] = $aEvent; $aEvent = $this->getNextRow(); } return $aEvents; }
/** * Generate composed table element of Advertisement * * @param $aSqlResStrA SQL result string of Advertisement * @return HTML presentation of data */ function ComposeResultStringAdv($aSqlResStrA, $bVeryShortView = FALSE) { global $aPreValues; global $site; $sActivateC = _t('_Activate'); $sDeleteC = _t('_Delete'); $sEditC = _t('_Edit'); $sSbjN = _t('_Subject'); $sPostedByC = _t('_Posted by'); $sDateC = _t('_Date'); $sLocationC = _t('_Location'); $sAdminLocalAreaC = _t('_AdminArea'); $sAdminC = _t('_Admin'); $sSureC = _t("_Are you sure"); $sTimeAgo = _format_when($aSqlResStrA['sec']); $iID = $aSqlResStrA['ID']; $iIDProfile = $aSqlResStrA['IDProfile']; $sImageCode = $this->getBigImageCode($aSqlResStrA['Media'], $iID); $sDelAbil = ' '; if ($this->bAdminMode == false) { //$iMemberID = (int)$_COOKIE['memberID']; $iMemberID = $logged['member'] ? (int) $_COOKIE['memberID'] : 0; if (($this->bAdminMode == true or $iMemberID != 0) and $iIDProfile == $iMemberID) { //ability to delete Adv for owner $sDelAbil .= <<<EOF <a href="{$this->sCurrBrowsedFile}" onclick="if (confirm('{$sSureC}')) { UpdateField('DeleteAdvertisementID',{$iID});document.forms.command_delete_advertisement.submit(); } return false;">{$sDeleteC}</a> <a href="{$this->sCurrBrowsedFile}" onclick="UpdateField('EditAdvertisementID',{$iID}); document.forms.command_edit_advertisement.submit(); return false;">{$sEditC}</a> EOF; } } elseif ($this->bAdminMode == true) { //ability to Activate/Delete/Edite adv $sActivateAbil = $aSqlResStrA['Status'] == 'active' ? '' : <<<EOF <a href="{$this->sCurrBrowsedFile}" onclick="UpdateField('ActivateAdvertisementID',{$iID});document.forms.command_activate_advertisement.submit(); return false;">{$sActivateC}</a> EOF; $sDelAbil = <<<EOF <div class="tar"> \t{$sActivateAbil} \t<a href="{$this->sCurrBrowsedFile}" onclick="if (confirm('{$sSureC}')) { UpdateField('DeleteAdvertisementID',{$iID});document.forms.command_delete_advertisement.submit(); } return false;">{$sDeleteC}</a> \t<a href="{$this->sCurrBrowsedFile}" onclick="UpdateField('EditAdvertisementID',{$iID}); document.forms.command_edit_advertisement.submit(); return false;">{$sEditC}</a> </div> EOF; } $aProfileRes = $this->GetProfileData($iIDProfile); $sPostedBy = $iIDProfile == 0 ? $sAdminC : "<a href=\"" . getProfileLink($iIDProfile) . "\">{$aProfileRes['NickName']}</a>\n"; $sCountryName = $aProfileRes['Country'] == "" ? $sAdminLocalAreaC : _t($aPreValues['Country'][$aProfileRes['Country']]['LKey']); $sCountryPic = $aProfileRes['Country'] == '' ? '' : ' <img alt="' . $aProfileRes['Country'] . '" src="' . ($site['flags'] . strtolower($aProfileRes['Country'])) . '.gif"/>'; $sCustDetails = ''; $sDetailsC = _t('_Details'); if ($aSqlResStrA['CustomFieldValue1'] or $aSqlResStrA['CustomFieldValue2']) { $sCustDetails .= "{$sDetailsC}:"; $sCustDetails .= $aSqlResStrA['CustomFieldValue1'] ? " <div class=\"clr3\">{$aSqlResStrA['Unit']} {$aSqlResStrA['CustomFieldValue1']}</div>" : ''; $sCustDetails .= $aSqlResStrA['CustomFieldValue1'] && $aSqlResStrA['CustomFieldValue2'] ? ' - ' : ''; $sCustDetails .= $aSqlResStrA['CustomFieldValue2'] ? " <div class=\"clr3\">{$aSqlResStrA['Unit']} {$aSqlResStrA['CustomFieldValue2']}</div>" : ''; } //$sDataStyle=($bVeryShortView)?'':' style="margin-bottom:10px;"'; $sDataStyleWidth = $bVeryShortView ? ' style="width:230px;"' : ''; $sSubjectBlock = $bVeryShortView ? '' : <<<EOF <div class="cls_res_info_p"> \t{$sPostedByC}: <div class="clr3">{$sPostedBy}</div> </div> EOF; $sPostedByBlock = $bVeryShortView ? '' : <<<EOF <div class="cls_res_info_p"> \t{$sPostedByC}: <div class="clr3">{$sPostedBy}</div> </div> EOF; $sSubjectBlockValue = $aSqlResStrA['Subject']; //($bVeryShortView) ? mb_substr($aSqlResStrA['Subject'], 0, 15)."..." : $aSqlResStrA['Subject']; $sActionsBlock = $bVeryShortView ? '' : <<<EOF <div class="cls_res_info_p"> \t{$sDelAbil} </div> EOF; $sDetailsBlock = $bVeryShortView ? '' : <<<EOF <div class="cls_res_info_p"> \t{$sCustDetails} </div> EOF; //{$sDataStyle} $sGenUrl = $this->genUrl($iID, $aSqlResStrA['EntryUri']); //{$this -> sCurrBrowsedFile}?ShowAdvertisementID={$iID} $sCBStyle = $this->bAdminMode == true ? 'float:left' : ''; $sRetHtml = <<<EOF <div class="cls_result_row" style="{$sCBStyle}"> \t<div class="clear_both"></div> \t<div class="thumbnail_block" style="float: left;"> \t\t{$sImageCode} \t</div> \t<div class="cls_res_info_nowidth" {$sDataStyleWidth}> \t\t<div class="cls_res_info_p"> \t\t\t<!-- {$sSbjN}: --> \t\t\t<a class="actions" href="{$sGenUrl}"> \t\t\t\t{$sSubjectBlockValue} \t\t\t</a> \t\t</div> \t\t{$sPostedByBlock} \t\t<div class="cls_res_info_p"> \t\t\t{$sDateC}: <div class="clr3">{$aSqlResStrA['DateTime']} ({$sTimeAgo})</div> \t\t</div> \t\t{$sLocationBlock} \t\t{$sDetailsBlock} \t\t{$sActionsBlock} \t</div> \t<div class="clear_both"></div> </div> EOF; return $sRetHtml; }
function getEvents($aParams) { global $sHomeUrl; $sWhereClause = $sOrderClause = $sLimitClause = ""; if (isset($aParams['timeline']) && strpos($aParams['timeline'], BX_WALL_DIVIDER_TIMELINE) !== false) { list($iTLStart, $iTLEnd) = explode(BX_WALL_DIVIDER_TIMELINE, $aParams['timeline']); $iNowMorning = mktime(0, 0, 0, date('m'), date('d'), date('Y')); $iNowEvening = mktime(23, 59, 59, date('m'), date('d'), date('Y')); $sWhereClause .= "AND `date`>='" . ($iNowMorning - 86400 * $iTLEnd) . "' AND `date`<='" . ($iNowEvening - 86400 * $iTLStart) . "'"; } switch ($aParams['type']) { case 'id': $sWhereClause = "AND `te`.`id`='" . $aParams['object_id'] . "' "; $sLimitClause = "LIMIT 1"; break; case 'owner': $aHidden = $this->_oConfig->getHandlersHidden(BX_WALL_VIEW_TIMELINE); $sWhereClause .= "AND `th`.`timeline`='1' AND `th`.`id` NOT IN ('" . implode("','", $aHidden) . "') "; if (!empty($aParams['owner_id'])) { if (!is_array($aParams['owner_id'])) { $sWhereClause .= "AND `te`.`owner_id`='" . $aParams['owner_id'] . "' "; } else { $sWhereClause .= "AND `te`.`owner_id` IN ('" . implode("','", $aParams['owner_id']) . "') "; } } $sWhereClause .= isset($aParams['filter']) ? $this->_getFilterAddon($aParams['owner_id'], $aParams['filter']) : ''; $sOrderClause = isset($aParams['order']) ? "ORDER BY `te`.`date` " . strtoupper($aParams['order']) : ""; $sLimitClause = isset($aParams['count']) ? "LIMIT " . $aParams['start'] . ", " . $aParams['count'] : ""; break; case 'last': $aHidden = $this->_oConfig->getHandlersHidden(BX_WALL_VIEW_TIMELINE); $sWhereClause .= "AND `th`.`timeline`='1' AND `th`.`id` NOT IN ('" . implode("','", $aHidden) . "') "; if (!empty($aParams['owner_id'])) { if (!is_array($aParams['owner_id'])) { $sWhereClause .= "AND `te`.`owner_id`='" . $aParams['owner_id'] . "' "; } else { $sWhereClause .= "AND `te`.`owner_id` IN ('" . implode("','", $aParams['owner_id']) . "') "; } } $sWhereClause .= isset($aParams['filter']) ? $this->_getFilterAddon($aParams['owner_id'], $aParams['filter']) : ''; $sOrderClause = "ORDER BY `te`.`date` ASC"; $sLimitClause = "LIMIT 1"; break; case BX_WALL_VIEW_OUTLINE: $aHidden = $this->_oConfig->getHandlersHidden(BX_WALL_VIEW_OUTLINE); $sWhereClause = "AND `th`.`outline`='1' AND `th`.`id` NOT IN ('" . implode("','", $aHidden) . "') "; $sWhereClause .= isset($aParams['filter']) ? $this->_getFilterAddon($aParams['owner_id'], $aParams['filter']) : ''; $sOrderClause = isset($aParams['order']) ? "ORDER BY `te`.`date` " . strtoupper($aParams['order']) : ""; $sLimitClause = isset($aParams['count']) ? "LIMIT " . $aParams['start'] . ", " . $aParams['count'] : ""; break; } $sSql = "SELECT\n `te`.`id` AS `id`,\n `te`.`owner_id` AS `owner_id`,\n `te`.`object_id` AS `object_id`,\n `te`.`type` AS `type`,\n `te`.`action` AS `action`,\n `te`.`content` AS `content`,\n `te`.`title` AS `title`,\n `te`.`description` AS `description`,\n `te`.`date` AS `date`,\n DATE_FORMAT(FROM_UNIXTIME(`te`.`date`), '" . $this->_oConfig->getDividerDateFormat() . "') AS `print_date`,\n DAYOFYEAR(FROM_UNIXTIME(`te`.`date`)) AS `days`,\n DAYOFYEAR(NOW()) AS `today`,\n (UNIX_TIMESTAMP() - `te`.`date`) AS `ago`,\n ROUND((UNIX_TIMESTAMP() - `te`.`date`)/86400) AS `ago_days`\n FROM `" . $this->_sPrefix . "events` AS `te`\n LEFT JOIN `" . $this->_sPrefix . "handlers` AS `th` ON `te`.`type`=`th`.`alert_unit` AND `te`.`action`=`th`.`alert_action`\n WHERE 1 " . $sWhereClause . " " . $sOrderClause . " " . $sLimitClause; $aEvents = array(); $aEvent = $this->getFirstRow($sSql); while ($aEvent) { $iAgo = $aEvent['ago']; $aEvent['content'] = str_replace("[ray_url]", $sHomeUrl, $aEvent['content']); $aEvent['ago'] = _format_when($iAgo); $aEvents[] = $aEvent; $aEvent = $this->getNextRow(); } return $aEvents; }
/** * Generate presentation Advertisement code with images and other * * @param $iID ID of Advertisement * @return HTML presentation of data */ function ActionPrintAdvertisement($iID) { global $site; global $aPreValues; $iAdvertisementID = (int) $iID; $sRetHtml = ''; $sSiteUrl = BX_DOL_URL_ROOT; if ($this->bAdminMode && $iAdvertisementID > 0) { $iFeaturedStatus = $this->_oDb->getFeaturedStatus($iAdvertisementID); $iNewStatus = $iFeaturedStatus == 1 ? 0 : 1; if (bx_get('do') == 'cfs') { $this->_oDb->UpdateFeatureStatus($iAdvertisementID, $iNewStatus); } } $aSqlResStr = $this->_oDb->getAdInfo($iAdvertisementID); if ($aSqlResStr) { $iOwnerID = (int) $aSqlResStr['IDProfile']; $bPossibleToView = $this->oPrivacy->check('view', $iAdvertisementID, $this->_iVisitorID); if ($this->isAllowedView($iOwnerID, true) == false || $bPossibleToView == false) { return $this->_oTemplate->displayAccessDenied(); } bx_import('BxDolViews'); new BxDolViews('ads', $iAdvertisementID); $aNameRet = getProfileInfo($aSqlResStr['IDProfile']); $sCountryName = $aSqlResStr['Country']; $sCountryPic = $sCountryName == '' ? '' : ' <img alt="' . $sCountryName . '" src="' . ($site['flags'] . strtolower($sCountryName)) . '.gif"/>'; $sCountryName = _t($aPreValues['Country'][$sCountryName]['LKey']); $sPostedByC = _t('_bx_ads_Posted_by'); $sPhoneC = _t('_Phone'); $sDetailsC = _t('_bx_ads_Details'); $sUserOtherListC = _t('_bx_ads_Users_other_listing'); $sActionsC = _t('_Actions'); $sSureC = _t('_Are you sure?'); $sMoreIcon = $this->_oTemplate->getIconUrl('more.png'); $sPostedBy .= '<div class="cls_res_info">'; $sPostedBy .= $sPostedByC . ': <span style="color:#333333;"><a href="' . getProfileLink($aNameRet['ID']) . '">' . $aNameRet['NickName'] . '</a></span>'; $sPostedBy .= '</div>'; if ($aNameRet['Phone'] != "") { $sPostedBy .= '<div class="cls_res_info">'; $sPostedBy .= $sPhoneC . ": <div class=\"clr3\">{$aNameRet['Phone']}</div>"; $sPostedBy .= '</div>'; } $sTimeAgo = _format_when($aSqlResStr['sec']); $aTags = array(); $aTagsLinks = array(); $aTags = preg_split("/[;,]/", $aSqlResStr['Tags']); foreach ($aTags as $sTag) { $sSubLink = $this->bUseFriendlyLinks ? "ads/tag/" : $this->sHomeUrl . "classifieds_tags.php?tag="; $sTagS = htmlspecialchars(title2uri($sTag)); $aTagsLinks[] = '<a href="' . "{$sSubLink}{$sTagS}" . '">' . $sTag . '</a>'; } $sTags .= implode(", ", $aTagsLinks); $sMemberActionForms = ''; if ($this->_iVisitorID > 0 && $this->_iVisitorID != $aNameRet['ID']) { //print Send PM button and other actions if (getParam('bx_ads_enable_paid') == 'on') { $sMemberActionForms .= <<<EOF <form action="{$this->sCurrBrowsedFile}" name="BuyNowForm" method="post"> \t<input type="hidden" name="BuyNow" value="BuyNow" /> \t<input type="hidden" name="IDAdv" value="{$iAdvertisementID}" /> \t<input type="hidden" name="IDSeller" value="{$aSqlResStr['IDProfile']}" /> </form> EOF; } $sMemberActionForms .= <<<EOF <form action="{$sSiteUrl}mail.php" name="post_pm" id="post_pm" method="get"> \t<input type="hidden" name="mode" value="compose" /> \t<input type="hidden" name="recipient_id" value="{$aSqlResStr['IDProfile']}" /> \t<input type="hidden" name="subject" value="{$aSqlResStr['Subject']}" /> </form> EOF; } $sEntryUrl = $this->genUrl($iAdvertisementID, $aSqlResStr['EntryUri'], 'entry'); $sMediaIDs = $this->_oDb->getMediaOfAd($iAdvertisementID); if ($sMediaIDs != '') { $aReadyMedia = explode(',', $sMediaIDs); $sPictureSectContent = $this->_blockPhoto($aReadyMedia, $iOwnerID); } $sPictureSect = $sPictureSectContent != '' ? DesignBoxContent(_t('_bx_ads_Ad_photos'), $sPictureSectContent, 1) : ''; $this->sTAPhotosContent = $sPictureSectContent; bx_import('BxDolSubscription'); $oSubscription = new BxDolSubscription(); $aButton = $oSubscription->getButton($this->_iVisitorID, 'bx_' . $this->_oConfig->getUri(), '', $iAdvertisementID); $aActionKeys = array('visitor_id' => $this->_iVisitorID, 'owner_id' => $aNameRet['ID'], 'admin_mode' => "'" . $this->bAdminMode . "'", 'ads_id' => $iAdvertisementID, 'ads_status' => $aSqlResStr['Status'], 'ads_featured' => (int) $aSqlResStr['Featured'], 'sure_label' => $sSureC, 'ads_entry_url' => $sEntryUrl, 'only_menu' => 0, 'sbs_ads_title' => $aButton['title'], 'sbs_ads_script' => $aButton['script']); $sActionsTable = $GLOBALS['oFunctions']->genObjectsActions($aActionKeys, 'bx_ads', false); $sSubsAddon = $oSubscription->getData(); $sActionsSectContent = $sSubsAddon . $sMemberActionForms . $sActionsTable; $sActionsSect = $this->_iVisitorID > 0 || $this->bAdminMode ? DesignBoxContent($sActionsC, $sActionsSectContent, 1) : ''; $this->sTAActionsContent = $this->_iVisitorID > 0 || $this->bAdminMode ? $sActionsSectContent : ''; require_once $this->_oConfig->getClassPath() . 'BxAdsCmts.php'; $this->oCmtsView = new BxAdsCmts($this->_oConfig->getCommentSystemName(), $iAdvertisementID); $sCommentsSectContent = $this->oCmtsView->getExtraCss(); $sCommentsSectContent .= $this->oCmtsView->getExtraJs(); $sCommentsSectContent .= !$this->oCmtsView->isEnabled() ? '' : $this->oCmtsView->getCommentsFirst(); $this->sTACommentsContent = $sCommentsSectContent; $sCommSect = DesignBoxContent($aCaptions['Comments'], $sCommentsSectContent, 1); $sUserOtherListing = $this->getMemberAds($aSqlResStr['IDProfile'], 2, $iAdvertisementID); $sDataTimeFormatted = getLocaleDate($aSqlResStr['DateTime_UTS']); $iViews = (int) $aSqlResStr['Views']; $sOwnerThumb = get_member_thumbnail($aSqlResStr['IDProfile'], 'none', true); $sAdsMessage = process_html_output($aSqlResStr['Message']); $sCategLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/cat/' . $aSqlResStr['CEntryUri'] : "{$this->sCurrBrowsedFile}?bClassifiedID={$aSqlResStr['CatID']}"; $sSCategLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/subcat/' . $aSqlResStr['SEntryUri'] : "{$this->sCurrBrowsedFile}?bSubClassifiedID={$aSqlResStr['SubID']}"; $aSubjVariables = array('sOwnerThumb' => $sOwnerThumb, 'sDataTimeFormatted' => $sDataTimeFormatted, 'sTimeAgo' => $sTimeAgo, 'categ_name' => $aSqlResStr['Name'], 'subcateg_name' => $aSqlResStr['NameSub'], 'sTags' => $sTags, 'iViews' => $iViews, 'sCategLink' => $sCategLink, 'sSCategLink' => $sSCategLink); $sSubjectSectContent = $this->_oTemplate->parseHtmlByTemplateName('unit_subject_block', $aSubjVariables); $sSubjectSect = DesignBoxContent(_t('_Info'), $sSubjectSectContent, 1); $this->sTAInfoContent = $sSubjectSectContent; $sDescriptionContent = '<div class="dbContent">' . $sAdsMessage . '</div>'; $sDescriptionSect = DesignBoxContent(_t('_Description'), $sDescriptionContent, 1); $this->sTADescription = $sDescriptionContent; //adding form $aForm = array('form_attrs' => array('name' => 'custom_values_form', 'action' => $oAds->sCurrBrowsedFile), 'inputs' => array('Country' => array('type' => 'value', 'name' => 'Country', 'caption' => _t('_Country'), 'value' => $sCountryName . $sCountryPic), 'City' => array('type' => 'value', 'name' => 'City', 'caption' => _t('_City'), 'value' => $aSqlResStr['City']))); if ($aSqlResStr['CustomFieldName1'] && $aSqlResStr['CustomFieldValue1']) { $aForm['inputs']['Custom1'] = array('type' => 'value', 'name' => 'Custom1', 'caption' => $aSqlResStr['CustomFieldName1'], 'value' => $aSqlResStr['Unit1'] . $aSqlResStr['CustomFieldValue1']); } if ($aSqlResStr['CustomFieldName2'] && $aSqlResStr['CustomFieldValue2']) { $aForm['inputs']['Custom2'] = array('type' => 'value', 'name' => 'Custom2', 'caption' => $aSqlResStr['CustomFieldName2'], 'value' => $aSqlResStr['Unit2'] . $aSqlResStr['CustomFieldValue2']); } $oForm = new BxTemplFormView($aForm); $sOtherInfoContent = $oForm->getCode(); $sOtherInfoSect = DesignBoxContent(_t('_bx_ads_Custom_Values'), $sOtherInfoContent, 1); $this->sTAOtherInfo = $sOtherInfoContent; $bPossibleToRate = $this->oPrivacy->check('rate', $iAdvertisementID, $this->_iVisitorID); $oVotingView = new BxTemplVotingView('ads', $iAdvertisementID); $iVote = $oVotingView && $oVotingView->isEnabled() && $bPossibleToRate ? 1 : 0; $sVotePostRating = $oVotingView->getBigVoting($iVote); $sRatingSect = DesignBoxContent(_t('_Rate'), $sVotePostRating, 1); $this->sTARateContent = $sVotePostRating; $sOtherListingContent = <<<EOF <div class="dbContent"> \t{$sUserOtherListing} </div> EOF; $sSPaginateActions = <<<EOF <div class="paginate"> \t<div class="view_all" style="background-image: url({$sMoreIcon});"> \t\t<a href="{$this->sCurrBrowsedFile}" onclick="document.forms['UsersOtherListingForm'].submit(); return false;">{$sUserOtherListC}</a> \t\t<form action="{$this->sCurrBrowsedFile}" name="UsersOtherListingForm" method="post"> \t\t\t<input type="hidden" name="UsersOtherListing" value="1" /> \t\t\t<input type="hidden" name="IDProfile" value="{$aSqlResStr['IDProfile']}" /> \t\t</form> \t</div> \t<div class="pages_section"></div> </div> EOF; $sOtherListingSect = DesignBoxContent($sUserOtherListC, $sOtherListingContent . $sSPaginateActions, 1); $this->sTAOtherListingContent = $sOtherListingContent . $sSPaginateActions; $sHomeLink = $this->bUseFriendlyLinks ? BX_DOL_URL_ROOT . 'ads/' : "{$this->sCurrBrowsedFile}?Browse=1"; $sBrowseAllAds = _t('_bx_ads_Browse_All_Ads'); $sBreadCrumbs = <<<EOF <div class="breadcrumbs"> <a href="{$sHomeLink}">{$sBrowseAllAds}</a> / <a href="{$sCategLink}">{$aSqlResStr['Name']}</a> / <a href="{$sSCategLink}">{$aSqlResStr['NameSub']}</a> </div> EOF; $aBlocks[1] .= $sActionsSect; $aBlocks[1] .= $sSubjectSect; $aBlocks[1] .= $sRatingSect; $aBlocks[1] .= $sOtherListingSect; $aBlocks[2] .= $sPictureSect; $aBlocks[2] .= $sCommSect; $sRetHtml = <<<EOF {$sBreadCrumbs} <div> \t<div class="clear_both"></div> \t<div class="cls_info_left"> \t\t{$aBlocks['1']} \t</div> \t<div class="cls_info"> \t\t{$sDescriptionSect} \t\t{$aBlocks['2']} \t</div> \t<div class="clear_both"></div> </div> <div class="clear_both"></div> EOF; bx_import('BxDolAlerts'); $oZ = new BxDolAlerts('ads', 'view', $iAdvertisementID, $this->_iVisitorID); $oZ->alert(); $sAdCover = $this->getAdCover($aSqlResStr['Media'], 'icon'); if ($sAdCover != '') { $GLOBALS['oTopMenu']->setCustomSubIconUrl($sAdCover); } else { $GLOBALS['oTopMenu']->setCustomSubIconUrl($this->_oTemplate->getIconUrl('bx_ads.png')); } $GLOBALS['oTopMenu']->setCustomSubHeader(htmlspecialchars($aSqlResStr['Subject'])); $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_bx_ads_Ads') => $sHomeLink, $aSqlResStr['Subject'] => '')); $this->_oTemplate->setPageDescription(htmlspecialchars($aSqlResStr['Subject'])); $this->_oTemplate->addPageKeywords(htmlspecialchars($aSqlResStr['Tags'])); } return $sRetHtml; }
/** * Function will generate information about the poll's onwer; * * @param : $iPollOwner (integer) - poll's owner id; * @param : $aPollInfo (array) - poll's information; * @return : (text) - Html presentation data; */ function getOwnerBlock($iPollOwner, $aPollInfo) { $aMemberInfo = getProfileInfo($iPollOwner); $sThumbImg = get_member_thumbnail($aMemberInfo['ID'], 'none'); $aTemplateKeys = array('author_thumb' => $sThumbImg, 'date' => getLocaleDate($aPollInfo['poll_date'], BX_DOL_LOCALE_DATE_SHORT), 'date_ago' => _format_when(time() - $aPollInfo['poll_date']), 'tags' => getLinkSet($aPollInfo['poll_tags'], $this->getModulePath() . '&action=tag&tag=', BX_DOL_TAGS_DIVIDER), 'fields' => null, 'author_username' => $aMemberInfo['NickName'], 'author_url' => getProfileLink($aMemberInfo['ID']), 'cats' => getLinkSet($aPollInfo['poll_categories'], $this->getModulePath() . '&action=category&category=', CATEGORIES_DIVIDER)); $sOutpuCode = $this->_oTemplate->parseHtmlByName($this->aUsedTemplates['poll_owner'], $aTemplateKeys); return $sOutpuCode; }
function PageCodeLog($sMode) { switch ($sMode) { case 'dnsbl': case 'dnsbluri': case 'akismet': case 'stopforumspam': break; default: $sMode = 'dnsbl'; } $iPage = isset($_GET['page']) && (int) $_GET['page'] > 0 ? (int) $_GET['page'] : 1; $iPerPage = 12; $iStart = ($iPage - 1) * $iPerPage; $aLog = $GLOBALS['MySQL']->getAll("SELECT SQL_CALC_FOUND_ROWS * FROM `sys_antispam_block_log` WHERE `type` = '{$sMode}' ORDER BY `added` DESC LIMIT {$iStart}, {$iPerPage}"); $iCount = $GLOBALS['MySQL']->getOne("SELECT FOUND_ROWS()"); foreach ($aLog as $k => $r) { $aLog[$k]['ip'] = long2ip($r['ip']); $aLog[$k]['member_url'] = $r['member_id'] ? getProfileLink($r['member_id']) : 'javascript:void(0);'; $aLog[$k]['member_nickname'] = $r['member_id'] ? getNickName($r['member_id']) : _t('_Guest'); $aLog[$k]['extra'] = bx_html_attribute($r['extra']); $aLog[$k]['ago'] = _format_when(time() - $r['added']); } $sPaginate = ''; if ($iCount > $iPerPage) { $sUrlStart = BX_DOL_URL_ADMIN . 'antispam.php?action=log&type=' . $sMode; $oPaginate = new BxDolPaginate(array('page_url' => 'javascript:void(0);', 'count' => $iCount, 'per_page' => $iPerPage, 'page' => $iPage, 'on_change_page' => "getHtmlData('sys-adm-antispam-log', '{$sUrlStart}&page={page}');")); $sPaginate = $oPaginate->getSimplePaginate(false, -1, -1, false); } if (is_array($aLog) && !empty($aLog)) { return $GLOBALS['oAdmTemplate']->parseHtmlByName('antispam_log.html', array('bx_repeat:items' => $aLog, 'paginate' => $sPaginate)); } else { return MsgBox(_t('_Empty')); } }
/** * page show information about specified event * @return HTML presentation of data */ function PageSDatingShowInfo() { global $site; global $tmpl; global $dir; global $aPreValues; global $doll; global $oTemplConfig; global $date_format; global $logged; // collect information about current member if ($logged['member']) { $aMember['ID'] = (int) $_COOKIE['memberID']; $aMemberData = getProfileInfo($aMember['ID']); } else { $aMember['ID'] = 0; } $sNoPhotoC = _t('_No photo'); $sChangeC = _t('_Change'); $sCanBuyTicketC = _t('_You can buy the ticket'); $sBuyTicketC = _t('_Buy ticket'); $sCountryC = _t('_Country'); $sCityC = _t('_City'); $sPlaceC = _t('_Place'); $sEventStartC = _t('_Event start'); $sDateC = _t('_Date'); $sEventEndC = _t('_Event end'); $sTicketSaleStartC = _t('_Ticket sale start'); $sTicketSaleEndC = _t('_Ticket sale end'); $sResponsiblePersonC = _t('_Responsible person'); $sPostedByC = _t('_Posted by'); $sTicketsLeftC = _t('_Tickets left'); $sTicketPriceC = _t('_Ticket price'); $sDescriptionC = _t('_Description'); $sSaleStatusC = _t('_Sale status'); $sEventC = _t('_Event'); $sEditC = _t('_Edit'); $sDeleteC = _t('_Delete'); $sSureC = _t("_Are you sure"); $sPictureC = _t('_Picture'); $sStatusC = _t('_Status'); $sPhoneC = _t('_Phone'); $sEmailC = _t('_E-mail'); $sActionsC = _t('_Actions'); $sJoinC = _t('_Join'); $sUnsubscribeC = _t('_Unsubscribe'); $sParticipantsC = _t('_Participants'); $sListOfParticipantsC = _t('_List') . ' ' . _t('_of') . ' ' . _t('_Participants'); $sTagsC = _t('_Tags'); $sYOC = _t('_y/o'); /*$iEventID = (int)$_REQUEST['event_id'];*/ $iEventID = $this->bUseFriendlyLinks ? (int) db_value("SELECT `ID` FROM `SDatingEvents` WHERE `EntryUri`='" . $this->process_html_db_input($_REQUEST['eventUri']) . "' LIMIT 1") : (int) $_REQUEST['event_id']; if ($this->iLastInsertedID > 0) { $iEventID = $this->iLastInsertedID; $this->iLastInsertedID = -1; } $sQuery = "\r\n\t\t\tSELECT\r\n\t\t\t\t`SDatingEvents`.`ID` AS `EventIDN`,\r\n\t\t\t\t`Title`,\r\n\t\t\t\t`EntryUri`,\r\n\t\t\t\t`Description`,\r\n\t\t\t\t`PhotoFilename`,\r\n\t\t\t\t`StatusMessage`,\r\n\t\t\t\t`Country`,\r\n\t\t\t\t`City`,\r\n\t\t\t\t`Place`,\r\n\t\t\t\t`Tags`,\r\n\t\t\t\t`EventStart`,\r\n\t\t\t\tUNIX_TIMESTAMP(`EventStart`) AS 'EventStart_UTS',\r\n\t\t\t\tDATE_FORMAT(`EventEnd`, '{$date_format}' ) AS EventEnd,\r\n\t\t\t\t(NOW() > `EventStart`) AS `EventBegan`,\r\n\t\t\t\t(NOW() < `EventEnd`) AS `EventNotFinished`,\r\n\t\t\t\tDATE_FORMAT(`TicketSaleStart`, '{$date_format}' ) AS 'TicketSaleStart',\r\n\t\t\t\tDATE_FORMAT(`TicketSaleEnd`, '{$date_format}' ) AS 'TicketSaleEnd',\r\n\t\t\t\t(NOW() > `TicketSaleStart`) AS `SaleBegan`,\r\n\t\t\t\t(NOW() < `TicketSaleEnd`) AS `SaleNotFinished`,\r\n\t\t\t\t(UNIX_TIMESTAMP() - UNIX_TIMESTAMP(`EventStart`)) AS `sec`,\r\n\t\t\t\t`ResponsibleID`,\r\n\t\t\t\t`ResponsibleName`,\r\n\t\t\t\t`ResponsibleEmail`,\r\n\t\t\t\t`ResponsiblePhone`,\r\n\t\t\t\t`TicketPriceFemale`,\r\n\t\t\t\t`TicketPriceMale`,\r\n\t\t\t\t`TicketCountFemale`,\r\n\t\t\t\t`TicketCountMale`,\r\n\t\t\t\t(NOW() > `EventEnd` AND NOW() < DATE_ADD(`EventEnd`, INTERVAL `ChoosePeriod` DAY)) AS `ChooseActive`,\r\n\t\t\t\t(`SDatingParticipants`.`ID` IS NOT NULL) AS `IsParticipant`\r\n\t\t\tFROM `SDatingEvents`\r\n\t\t\tLEFT JOIN `SDatingParticipants` ON\r\n\t\t\t\t`SDatingParticipants`.`IDEvent` = `SDatingEvents`.`ID`\r\n\t\t\t\tAND `SDatingParticipants`.`IDMember` = {$aMember['ID']}\r\n\t\t\tWHERE\r\n\t\t\t\t`SDatingEvents`.`ID` = {$iEventID}\r\n\t\t\t\tAND `SDatingEvents`.`Status` = 'Active'\r\n\t\t\t"; $aEventData = db_arr($sQuery); if (!is_array($aEventData) || count($aEventData) == 0) { return DesignBoxContent('', '<center>' . _t('_Event is unavailable') . '</center>', $oTemplConfig->PageSDatingShowInfo_db_num); } $sQuery = "\r\n\t\t\tSELECT COUNT(*)\r\n\t\t\tFROM `SDatingParticipants`\r\n\t\t\tLEFT JOIN `Profiles` ON\r\n\t\t\t\t`SDatingParticipants`.`IDMember` = `Profiles`.`ID`\r\n\t\t\tWHERE\r\n\t\t\t\t`SDatingParticipants`.`IDEvent` = {$iEventID}\r\n\t\t\t\tAND `Profiles`.`Sex` = '{$sMemberSex}'\r\n\t\t\t"; $aPartNum = db_arr($sQuery); $iPartNum = (int) $aPartNum[0]; $iTicketsLeft = $aMemberData['Sex'] == 'male' ? $aEventData['TicketCountMale'] - $iPartNum : $aEventData['TicketCountFemale'] - $iPartNum; $iTicketPrice = (double) ($aMemberData['Sex'] == 'male' ? $aEventData['TicketPriceMale'] : $aEventData['TicketPriceFemale']); // change participant UID $sErrorMessage = ''; if (isset($_POST['change_uid']) && $_POST['change_uid'] == 'on') { // check if this UID doesn't exist for this event $sNewUid = process_db_input($_POST['participant_uid']); $aExistUid = db_arr("SELECT `ID` FROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\tWHERE `IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\tAND `IDMember` <> {$aMember['ID']}\r\n\t\t\t\t\t\t\t\t\tAND LOWER(`ParticipantUID`) = LOWER('{$sNewUid}')"); if (!$aExistUid['ID']) { $vRes = db_res("UPDATE `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\tSET `ParticipantUID` = '{$sNewUid}'\r\n\t\t\t\t\t\t\t\t\tWHERE `IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\tAND `IDMember` = {$aMember['ID']}"); if (!$vRes) { $sErrorMessage = _t('_Cant change participant UID'); } } else { $sErrorMessage = _t('_UID already exists'); } } // if ticket is free then buy it here without any checkouts if (isset($_POST['purchase_ticket']) && $_POST['purchase_ticket'] == 'on' && !$aEventData['IsParticipant'] and $logged['member']) { if ($aEventData['SaleBegan'] && $aEventData['SaleNotFinished'] && $iTicketsLeft > 0 && $iTicketPrice <= 0.0) { // insert into participants table $iParticipantUID = $aMemberData['NickName'] . $iEventID . rand(100, 999); $vRes = db_res("INSERT INTO `SDatingParticipants` SET `IDEvent` = {$iEventID}, `IDMember` = {$aMember['ID']}, `ParticipantUID` = '{$iParticipantUID}'", 0); if (!$vRes) { $sErrorMessage = _t('Error: Participant subscription error'); } else { $sSubject = getParam('t_SDatingCongratulation_subject'); $sMessage = getParam('t_SDatingCongratulation'); $aPlus = array(); $aPlus['NameSDating'] = $aEventData['Title']; $aPlus['PlaceSDating'] = $aEventData['Place']; $aPlus['WhenStarSDating'] = $aEventData['EventStart']; $aPlus['PersonalUID'] = $iParticipantUID; $sGenUrl = $this->genUrl($iEventID, $aEventData['EntryUri']); $aPlus['LinkSDatingEvent'] = $sGenUrl; $vMailRes = sendMail($aMemberData['Email'], $sSubject, $sMessage, $aMember['ID'], $aPlus); if (!$vMailRes) { $_POST['result'] = 3; } else { $_POST['result'] = 1; } } } else { $_POST['result'] = -1; } } elseif (isset($_POST['join_event']) && $_POST['join_event'] == 'on' && $logged['member']) { // insert into participants table $iParticipantUID = $aMemberData['NickName'] . $iEventID . rand(100, 999); $vRes = db_res("INSERT INTO `SDatingParticipants` SET `IDEvent` = {$iEventID}, `IDMember` = {$aMember['ID']}, `ParticipantUID` = '{$iParticipantUID}'", 0); if (!$vRes) { $sErrorMessage = _t('Error: Participant subscription error'); $sRetHtml .= '<script type="text/javascript">alert("' . _t('_Sorry, you\'re already joined') . '");</script>'; } else { $sSubject = getParam('t_SDatingCongratulation_subject'); $sMessage = getParam('t_SDatingCongratulation'); $aPlus = array(); $aPlus['NameSDating'] = $aEventData['Title']; $aPlus['PlaceSDating'] = $aEventData['Place']; $aPlus['WhenStarSDating'] = $aEventData['EventStart']; $aPlus['PersonalUID'] = $iParticipantUID; $sGenUrl = $this->genUrl($iEventID, $aEventData['EntryUri']); $aPlus['LinkSDatingEvent'] = $sGenUrl; $vMailRes = sendMail($aMemberData['Email'], $sSubject, $sMessage, $aMember['ID'], $aPlus); $sRetHtml .= '<script type="text/javascript">alert("' . _t('_You have successfully joined this Event') . '");</script>'; if (!$vMailRes) { $_POST['result'] = 3; } else { $_POST['result'] = 1; } } } elseif (isset($_POST['unsubscribe_event']) && $_POST['unsubscribe_event'] == 'on' && $logged['member']) { // remove from participants table $vRes = db_res("DELETE FROM `SDatingParticipants` WHERE `IDEvent` = {$iEventID} AND `IDMember` = {$aMember['ID']} LIMIT 1"); if (mysql_affected_rows() == 0) { $sErrorMessage = _t('Error: Participant unsubscription error'); $sRetHtml .= '<script type="text/javascript">alert("' . _t('_Error Occured') . '");</script>'; } else { $sRetHtml .= '<script type="text/javascript">alert("' . _t('_You have successfully unsubscribe from Event') . '");</script>'; } } elseif (isset($_POST['join_event']) && $_POST['join_event'] == 'on' && $logged['member'] == false) { $this->CheckLogged(); } $aMemberPart = db_arr("SELECT `ID`, `ParticipantUID` FROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\t\tWHERE `IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\t\tAND `IDMember` = {$aMember['ID']}"); $sErrElems = ''; if (isset($_POST['result'])) { $sResult = ''; switch ($_POST['result']) { case '-1': $sResult = _t('_RESULT-1'); break; case '0': $sResult = _t('_RESULT0'); break; case '1': $sResult = _t('_RESULT1_THANK', $aEventData['Title'], $aEventData['EventStart']); break; case '3': $sResult = _t('_RESULT_SDATING_MAIL_NOT_SENT'); break; case '1000': $sResult = _t('_RESULT1000'); break; } $sErrElems .= '<div class="err">' . $sResult . '</div>'; } $sPicElement = ''; $sSpacerName = $this->sSpacerPath; if (strlen(trim($aEventData['PhotoFilename'])) && file_exists($dir['sdatingImage'] . $aEventData['PhotoFilename'])) { $sPicName = $site['sdatingImage'] . $aEventData['PhotoFilename']; $sPicElement .= "<img class=\"photo\" alt=\"\" style=\"width:{$this->iImgSize}px;height:{$this->iImgSize}px;background-image:url({$sPicName});\" src=\"{$sSpacerName}\" border=\"0\" />"; $sPicElement1 .= ' <img src="' . $site['sdatingImage'] . $aEventData['PhotoFilename'] . '" border="0" alt="' . _t('_SDating photo alt', $aEventData['Title']) . '" />'; } else { $sPicNaName = "{$site['url']}templates/tmpl_{$tmpl}/{$this->sPicNotAvail}"; $sPicElement .= "<img class=\"photo\" alt=\"\" style=\"width:{$this->iImgSize}px;height:{$this->iImgSize}px;background-image:url({$sPicNaName});\" src=\"{$sSpacerName}\" border=\"0\" />"; $sPicElement1 .= ' <div align="center" class="text" style="width: 200px; height: 150px; vertical-align: middle; line-height: 150px; border: 1px solid silver;">' . $sNoPhotoC . '</div>'; } /*$sInnerData = ''; if ( $aMemberPart['ID'] ) { if ( $aEventData['EventBegan'] && $aEventData['EventNotFinished'] ) { $sInnerData .= _t('_Event started'); } elseif ( $aEventData['ChooseActive'] ) { $sInnerData .= _t('_Event finished') .". <a href=\"{$_SERVER['PHP_SELF']}?action=select_match&event_id={$iEventID}\">". _t('_Choose participants you liked') ."</a>"; } else { if ( strlen($sErrorMessage) ) $sInnerData .= "<div align=\"center\" class=\"err\" style=\"width: 100%;\">{$sErrorMessage}</div>\n"; $sInnerData .= _t('_You are participant of event').'<br />'; $sParticipantUID = htmlspecialchars($aMemberPart['ParticipantUID']); $sInnerData .= <<<EOF <center> <form id="changeUIDForm" action="{$_SERVER['PHP_SELF']}?action=show_info&event_id={$iEventID}" method="post" style="margin: 2px;"> <input type="hidden" name="change_uid" value="on" /> <input type="text" class="no" name="participant_uid" value="{$sParticipantUID}" size="20" maxlength="30" style="vertical-align: middle;" /> <input type="submit" class="no" value="{$sChangeC}" style="width: 80px; vertical-align: middle" /> </form> </center> EOF; } } elseif ( $aEventData['SaleBegan'] and $aEventData['SaleNotFinished'] and $logged['member'] ) { if ( $iTicketsLeft > 0 ) { if ( $iTicketPrice > 0.0 ) { $sInnerData .= <<<EOF {$sCanBuyTicketC}<br /> <center> <form id="buyTicketForm" action="{$site['url']}checkout.php" method="post" style="margin: 2px;"> <input type="hidden" name="action" value="collect" /> <input type="hidden" name="checkout_action" value="speeddating" /> <input type="hidden" name="data" value="{$iEventID}" /> <input type="hidden" name="amount" value="{$iTicketPrice}" /> <input type="submit" class="no" value="{$sBuyTicketC}" style="width: 100px; vertical-align: middle;" /> </form> </center> EOF; } else { $sInnerData .= <<<EOF {$sCanBuyTicketC}<br /> <center> <form id="buyTicketForm" action="{$_SERVER['PHP_SELF']}?action=show_info&event_id={$iEventID}" method="post" style="margin: 2px;"> <input type="hidden" name="purchase_ticket" value="on" /> <input type="submit" class="no" value="{$sBuyTicketC}" style="width: 100px; vertical-align: middle;" /> </form> </center> EOF; } } else { $sInnerData .= _t('_No tickets left'); } } elseif ( $aEventData['SaleBegan'] ) { $sInnerData .= _t('_Sale finished'); } else { $sInnerData .= _t('_Sale not started yet'); }*/ $sStatusMessage = process_line_output($aEventData['StatusMessage']); $sCountryPic = _t($aPreValues['Country'][$aEventData['Country']]['LKey']); $sCity = process_line_output($aEventData['City']); $sPlace = process_line_output($aEventData['Place']); $sResponsiblePerson = process_line_output($aEventData['ResponsibleName']); if ($aEventData['ResponsibleID'] == 0) { $sPostedByHref = _t('_Admin'); } else { $aPostedBy = $this->GetProfileData($aEventData['ResponsibleID']); //$sPostedBy = $aPostedBy['NickName']; $sPostedByHref = getProfileLink($aEventData['ResponsibleID']); $sPostedByHref = '<a href="' . $sPostedByHref . '">' . $aPostedBy['NickName'] . '</a>'; } $sPhone = process_line_output($aEventData['ResponsiblePhone']); $sEmail = process_line_output($aEventData['ResponsibleEmail']); $sTicketPrice = $iTicketPrice > 0.0 ? $doll . $iTicketPrice : _t('_free'); $sDescription = $aEventData['Description']; $sTitle = process_line_output($aEventData['Title']); $sTagsVals = ''; $sTagsCommas = $aEventData['Tags']; $aTags = split(',', $sTagsCommas); foreach ($aTags as $sTagKey) { if ($sTagKey != '') { if (isset($aTagsPost[$sTagKey])) { $aTagsPost[$sTagKey]++; } else { $aTagsPost[$sTagKey] = 1; } } } if (count($aTagsPost)) { foreach ($aTagsPost as $varKey => $varValue) { $sTagHrefGen = $this->genUrl(0, $varKey, 'search'); $sTagsVals .= <<<EOF <span style="vertical-align:middle;"><img src="{$site['icons']}tag.png" class="marg_icon" alt="" /></span> <a class="actions" href="{$sTagHrefGen}" style="text-transform:capitalize;" >{$varKey}</a> ({$varValue}) <br /> EOF; } } $sActions = ''; if ($aEventData['ResponsibleID'] == (int) $_COOKIE['memberID']) { $sActions = <<<EOF <div class="padds"> \t<img src="{$site['icons']}categ_edit.png" alt="{$sEditC}" title="{$sEditC}" class="marg_icon" /> \t<a class="actions" href="{$_SERVER['PHP_SELF']}" onclick="UpdateField('EditEventID','{$aEventData['EventIDN']}');document.forms.command_edit_event.submit();return false;" style="text-transform:none;">{$sEditC}</a> </div> <div class="padds"> \t<img src="{$site['icons']}action_block.gif" alt="{$sEditC}" title="{$sEditC}" class="marg_icon" /> \t<a class="actions" href="{$_SERVER['PHP_SELF']}" onclick="if (confirm('{$sSureC}')) {UpdateField('DeleteEventID','{$aEventData['EventIDN']}');document.forms.command_delete_event.submit(); } return false;" style="text-transform:none;">{$sDeleteC}</a> </div> EOF; } $sUsersActions = ''; $sPartProfSQL = "SELECT * FROM `SDatingParticipants` WHERE `IDEvent`={$iEventID} AND `IDMember`={$aMember['ID']}"; $aPartProfSQL = db_arr($sPartProfSQL); if (mysql_affected_rows() == 0) { //no matches $sUsersActions = <<<EOF <div class="padds"> \t<img src="{$site['icons']}_membership.jpg" alt="{$sJoinC}" title="{$sJoinC}" class="marg_icon" /> \t<a class="actions" href="{$_SERVER['PHP_SELF']}" onclick="document.forms.JoinEventForm.submit(); return false;" > \t\t{$sJoinC} \t</a> </div> EOF; } else { $sUsersActions = <<<EOF <div class="padds"> \t<img src="{$site['icons']}action_block.gif" alt="{$sUnsubscribeC}" title="{$sUnsubscribeC}" class="marg_icon" /> \t<a class="actions" href="{$_SERVER['PHP_SELF']}" onclick="document.forms.UnsubscribeEventForm.submit(); return false;" > \t\t{$sUnsubscribeC} \t</a> </div> EOF; } $vPartProfilesRes = db_res("\r\n\t\t\tSELECT `Profiles`.*, `SDatingParticipants`.`ParticipantUID` AS `UID` FROM `SDatingParticipants`\r\n\t\t\tINNER JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID`\r\n\t\t\tWHERE `SDatingParticipants`.`IDEvent` = {$iEventID}\r\n\t\t\tORDER BY RAND() LIMIT 2"); $sParticipants = ''; while ($aPartProfiles = mysql_fetch_assoc($vPartProfilesRes)) { $iUserIsOnline = get_user_online_status($aPartProfiles[ID]); $sCont = get_member_thumbnail($aPartProfiles['ID'], 'none') . '<br /><center>' . getProfileOnlineStatus($iUserIsOnline) . '</center>'; $sThumb = get_member_thumbnail($aPartProfiles['ID'], 'none'); $sProfLink = getProfileLink($aPartProfiles['ID']); $sAge = age($aPartProfiles['DateOfBirth']) . $sYOC; $sParticipants .= <<<EOF <div style="float:left;text-align:center;margin-right:10px;position:relative;"> \t{$sThumb} \t<div class="browse_nick" style="width:{$this->iThumbSize}px;"> \t\t<a href="{$sProfLink}">{$aPartProfiles['NickName']}</a>: {$sAge} \t</div> </div> EOF; } $sAdminTicketsPart = ''; $sAdminTicketsPart2 = ''; $sStatusSect = ''; if ($aEventData['ResponsibleID'] == 0) { $sAdminTicketsPart = <<<EOF <div class="cls_res_info"> \t{$sEventEndC}: <div class="clr3">{$aEventData['EventEnd']}</div> </div> <div class="cls_res_info"> \t{$sTicketSaleStartC}: <div class="clr3">{$aEventData['TicketSaleStart']}</div> </div> <div class="cls_res_info"> \t{$sTicketSaleEndC}: <div class="clr3">{$aEventData['TicketSaleEnd']}</div> </div> EOF; $sAdminTicketsPart2 = <<<EOF <div class="cls_res_info"> \t{$sTicketsLeftC}: <div class="clr3">{$iTicketsLeft}</div> </div> <div class="cls_res_info"> \t{$sTicketPriceC}: <div class="clr3">{$sTicketPrice}</div> </div> <tr class="panel"> \t<td colspan="2" align="center" class="profile_header"><b>{$sSaleStatusC}</b></td> </tr> <!-- <tr> \t<td colspan="2" align="left" class="profile_td_2"> \t\t{$sInnerData} \t</td> </tr> --> EOF; $sStatusSectFDB = <<<EOF <div class="cls_res_info"> \t<div class="clr3">{$sStatusMessage}</div> </div> <div class="clear_both"></div> EOF; $sStatusSect = DesignBoxContent($sStatusC, $sStatusSectFDB, 1); /*$sStatusSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sStatusC} </div> <div class="boxContent"> <div class="cls_res_info"> <div class="clr3">{$sStatusMessage}</div> </div> <div class="clear_both"></div> </div> </div> EOF;*/ } $sImageSectFDB = <<<EOF <div class="photoBlock"> \t{$sPicElement} </div> <div class="clear_both"></div> EOF; $sImageSect = DesignBoxContent($sEventC . ' ' . $sPictureC, $sImageSectFDB, 1); /*$sImageSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sEventC} {$sPictureC} </div> <div class="boxContent"> <div class="photoBlock"> {$sPicElement} </div> <div class="clear_both"></div> </div> </div> EOF;*/ $sActionsSectFDB = <<<EOF {$sUsersActions} {$sActions} <div class="clear_both"></div> EOF; $sActionsSect = DesignBoxContent($sActionsC, $sActionsSectFDB, 1); /*$sActionsSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sActionsC} </div> <div class="boxContent"> {$sUsersActions} {$sActions} <div class="clear_both"></div> </div> </div> EOF;*/ $sEventsStart = _format_when($aEventData['sec']); $date_format_php = getParam('php_date_format'); //$sDateTime = date( $date_format_php, strtotime( $aEventData['EventStart'] ) ); $sDateTime = LocaledDataTime($aEventData['EventStart_UTS']); $sSubjectSectFDB = <<<EOF <div class="cls_res_info"> \t{$sCountryC}: <div class="clr3">{$sCountryPic}</div> </div> <div class="cls_res_info"> \t{$sCityC}: <div class="clr3">{$sCity}</div> </div> <div class="cls_res_info"> \t{$sPlaceC}: <div class="clr3">{$sPlace}</div> </div> <div class="cls_res_info"> \t{$sDateC}: <div class="clr3">{$sDateTime} ({$sEventsStart})</div> </div> {$sAdminTicketsPart} <div class="cls_res_info"> \t{$sPostedByC}: <div class="clr3">{$sPostedByHref}</div> </div> {$sAdminTicketsPart2} <div class="clear_both"></div> EOF; $sSubjectSect = DesignBoxContent($sTitle, $sSubjectSectFDB, 1); /*$sSubjectSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sTitle} </div> <div class="boxContent"> <div class="cls_res_info"> {$sCountryC}: <div class="clr3">{$sCountryPic}</div> </div> <div class="cls_res_info"> {$sCityC}: <div class="clr3">{$sCity}</div> </div> <div class="cls_res_info"> {$sPlaceC}: <div class="clr3">{$sPlace}</div> </div> <div class="cls_res_info"> {$sDateC}: <div class="clr3">{$sDateTime} ({$sEventsStart})</div> </div> {$sAdminTicketsPart} <div class="cls_res_info"> {$sPostedByC}: <div class="clr3">{$sPostedByHref}</div> </div> {$sAdminTicketsPart2} <div class="clear_both"></div> </div> </div> EOF;*/ $sDescriptionSectFDB = <<<EOF <div class="cls_res_info"> \t<div class="clr3">{$sDescription}</div> </div> <div class="clear_both"></div> EOF; $sDescriptionSect = DesignBoxContent($sDescriptionC, $sDescriptionSectFDB, 1); /*$sDescriptionSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sDescriptionC} </div> <div class="boxContent"> <div class="cls_res_info"> <div class="clr3">{$sDescription}</div> </div> <div class="clear_both"></div> </div> </div> EOF;*/ $sGenUrlP = $this->genUrl($iEventID, $aEventData['EntryUri'], 'part'); $sParticipantsSectFDB = <<<EOF {$sParticipants} <div class="clear_both"></div> <div class="padds" style="height:23px;vertical-align:middle;"> \t<span style="vertical-align: middle;"> \t\t<img src="{$site['icons']}grs.gif" alt="" title="" class="marg_icon" /> \t</span> \t<span> \t\t<a class="actions" href="{$sGenUrlP}"> \t\t\t{$sListOfParticipantsC} \t\t</a> \t</span> </div> EOF; $sParticipantsSect = DesignBoxContent($sParticipantsC, $sParticipantsSectFDB, 1); /*$sParticipantsSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> {$sParticipantsC} </div> <div class="boxContent"> {$sParticipants} <div class="clear_both"></div> <div class="padds" style="height:23px;vertical-align:middle;"> <span style="vertical-align: middle;"> <img src="{$site['icons']}grs.gif" alt="" title="" class="marg_icon" /> </span> <span> <a class="actions" href="{$sGenUrlP}"> {$sListOfParticipantsC} </a> </span> </div> </div> </div> EOF;*/ $sTagsSectFDB = <<<EOF {$sTagsVals} <div class="clear_both"></div> EOF; $sTagsSect = $sTagsVals == '' ? '' : DesignBoxContent("<div class=\"cls_res_thumb\">{$sTagsC}</div>", $sTagsSectFDB, 1); /*$sTagsSect = <<<EOF <div class="disignBoxFirst"> <div class="boxFirstHeader"> <div class="cls_res_thumb"> {$sTagsC} </div> </div> <div class="boxContent"> {$sTagsVals} <div class="clear_both"></div> </div> </div> EOF;*/ $sGenUrlJ = $this->genUrl($iEventID, $aEventData['EntryUri']); $sRetHtml .= <<<EOF <form id="JoinEventForm" action="{$sGenUrlJ}" method="post"> \t<input type="hidden" name="join_event" value="on" /> </form> <form id="UnsubscribeEventForm" action="{$sGenUrlJ}" method="post"> \t<input type="hidden" name="unsubscribe_event" value="on" /> </form> <!--{$sBreadCrumbs}--> {$sErrElems} <div> \t<div class="clear_both"></div> \t<div class="cls_info_left"> \t\t{$sImageSect} \t\t{$sActionsSect} \t</div> \t<div class="cls_info"> \t\t{$sSubjectSect} \t\t{$sDescriptionSect} \t\t{$sStatusSect} \t\t{$sParticipantsSect} \t\t{$sTagsSect} \t</div> \t<div class="clear_both"></div> </div> <div class="clear_both"></div> EOF; return $sRetHtml; }
function defineTimeInterval($iTime) { $iTime = time() - (int) $iTime; $sCode = _format_when($iTime); return $sCode; }
/** * Convert timestamp to "ago" date format * * @param $iTime date/time stamp in seconds * @param $bAutoDateConvert automatically convert dates to full date format instead of "ago" format for old dates (older than 14 days) * @param $bShort use short format for relative time * @return formatted date string */ function defineTimeInterval($iTime, $bAutoDateConvert = true, $bShort = false) { $iTimeDiff = time() - (int) $iTime; if ($bAutoDateConvert && $iTimeDiff > 14 * 24 * 60 * 60) { return getLocaleDate((int) $iTime); } return _format_when($iTimeDiff, $bShort); }