function getLatestNews() { $iNewsOnHome = $this->oTemplConfig->iMaxNewsOnIndex; $query = "\r\n\t\t\tSELECT\r\n\t\t\t\t`ID`,\r\n\t\t\t\t`Text`,\r\n\t\t\t\t`Header`,\r\n\t\t\t\t`Date`\r\n\t\t\tFROM\r\n\t\t\t\t`News`\r\n\t\t\tORDER BY `Date` DESC\r\n\r\n\t\t\tLIMIT {$iNewsOnHome}\r\n\t\t;"; $rNews = $this->oDb->getAll($query); if (!is_array($rNews['0'])) { return _t_action('_No news available'); } $ret = ''; foreach ($rNews as $aNews) { $ret .= ' <div class="indexNewsBlock"> <div class="indexNewsHeader"> <a href="' . $this->aSite['url'] . 'news_view.php?ID=' . process_line_output($aNews['ID']) . '"> ' . strmaxtextlen(process_line_output($aNews['Header']), $this->oTemplConfig->iNewsHeader) . ' </a> </div> <div class="indexNewsText"> ' . strmaxtextlen(process_html_output($aNews['Text']), $this->oTemplConfig->iNewsPreview) . ' </div> <div class="indexNewsDate"> ' . process_line_output($aNews['Date']) . ' </div> </div> '; } $ret .= '<div class="indexNewsArchive"><a href="' . $this->aSite['url'] . 'news.php">' . _t("_Read news in archive") . '</a></div>'; return $ret; }
/** * @description : function will generate profile block (used the profile template ); * @return : Html presentation data ; */ function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null) { global $site; global $aPreValues; $iVisitorID = getLoggedId(); $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext'; $isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match'); $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor'); $sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : ''; $sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>'; $sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']); $sProfileDesc = strmaxtextlen($aProfileInfo['DescriptionMe'], 130); $sProfileZodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : ''; $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = ''; if ($aCoupleInfo) { $sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>'; $sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']); $sProfile2Desc = strmaxtextlen($aCoupleInfo['DescriptionMe'], 130); $sProfile2Zodiac = $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : ''; $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;'; $sProfile2ASc2 = 'float:left;width:31%;display:block;'; } else { $sProfile2ASc2 = 'display:none;'; } $aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2); if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) { foreach ($aExtendedKey as $sKey => $sValue) { $aKeys[$sKey] = $sValue; } } else { $aKeys['ext_css_class'] = ''; } return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys); }
/** * send "tell a friend" email */ function SendTellFriend($iSenderID = 0) { global $profileID; $sSenderEmail = clear_xss(bx_get('sender_email')); if (strlen(trim($sSenderEmail)) <= 0) { return 0; } $sSenderName = strmaxtextlen(bx_get('sender_name'), 16); $sSenderLink = $iSenderID != 0 ? getProfileLink($iSenderID) : BX_DOL_URL_ROOT; $sRecipientEmail = clear_xss(bx_get('recipient_email')); if (strlen(trim($sRecipientEmail)) <= 0) { return 0; } $sLinkAdd = $iSenderID > 0 ? 'idFriend=' . $iSenderID : ''; $rEmailTemplate = new BxDolEmailTemplates(); if ($profileID) { $aTemplate = $rEmailTemplate->getTemplate('t_TellFriendProfile', getLoggedId()); $Link = getProfileLink($profileID, $sLinkAdd); } else { $aTemplate = $rEmailTemplate->getTemplate('t_TellFriend', getLoggedId()); $Link = BX_DOL_URL_ROOT; if (strlen($sLinkAdd) > 0) { $Link .= '?' . $sLinkAdd; } } return sendMail($sRecipientEmail, $aTemplate['Subject'], $aTemplate['Body'], '', array('Link' => $Link, 'SenderName' => $sSenderName, 'SenderLink' => $sSenderLink)); }
function unit($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html') { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; if ($isCheckPrivateContent && CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $oModule->checkAllowedView($aData))) { $aVars = array('summary' => $sMsg); return $this->parseHtmlByName('unit_private.html', $aVars); } // get thumb url $sPhotoThumb = ''; if ($aData[$CNF['FIELD_THUMB']]) { bx_import('BxDolImageTranscoder'); $oImagesTranscoder = BxDolImageTranscoder::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']); if ($oImagesTranscoder) { $sPhotoThumb = $oImagesTranscoder->getImageUrl($aData[$CNF['FIELD_THUMB']]); } } // get entry url bx_import('BxDolPermalinks'); $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]); bx_import('BxDolProfile'); $oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]); if (!$oProfile) { bx_import('BxDolProfileUndefined'); $oProfile = BxDolProfileUndefined::getInstance(); } // get summary $sLinkMore = ' <a title="' . bx_html_attribute(_t('_sys_read_more', $aData[$CNF['FIELD_TITLE']])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-h"></i></a>'; $sSummary = strmaxtextlen($aData[$CNF['FIELD_TEXT']], (int) getParam($CNF['PARAM_CHARS_SUMMARY']), $sLinkMore); $sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int) getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN'])); // generate html $aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary' => $sSummary, 'author' => $oProfile->getDisplayName(), 'author_url' => $oProfile->getUrl(), 'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE), 'module_name' => _t($CNF['T']['txt_sample_single']), 'ts' => $aData[$CNF['FIELD_ADDED']], 'bx_if:thumb' => array('condition' => $sPhotoThumb, 'content' => array('title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary_attr' => bx_html_attribute($sSummaryPlain), 'content_url' => $sUrl, 'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '')), 'bx_if:no_thumb' => array('condition' => !$sPhotoThumb, 'content' => array('content_url' => $sUrl, 'summary_plain' => $sSummaryPlain))); return $this->parseHtmlByName($sTemplateName, $aVars); }
public function __construct($aObject, $oTemplate = false) { parent::__construct($aObject, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; // select view entry submenu $oMenuSumbemu = BxDolMenu::getObjectInstance('sys_site_submenu'); $oMenuSumbemu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], $CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION']); $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if ($iContentId) { $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId); } if ($this->_aContentInfo) { $this->addMarkers($this->_aContentInfo); // every field can be used as marker $this->addMarkers(array('title' => strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...'))); } }
function unit($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html', $aParams = array()) { $oModule = BxDolModule::getInstance($this->MODULE); $CNF =& $oModule->_oConfig->CNF; if ($s = $this->checkPrivacy($aData, $isCheckPrivateContent, $oModule)) { return $s; } // get thumb url $sPhotoThumb = ''; $sPhotoGallery = ''; if ($aData[$CNF['FIELD_THUMB']]) { $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_PREVIEW']); if ($oImagesTranscoder) { $sPhotoThumb = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]); } $oImagesTranscoder = BxDolTranscoderImage::getObjectInstance($CNF['OBJECT_IMAGES_TRANSCODER_GALLERY']); if ($oImagesTranscoder) { $sPhotoGallery = $oImagesTranscoder->getFileUrl($aData[$CNF['FIELD_THUMB']]); } else { $sPhotoGallery = $sPhotoThumb; } } // get entry url $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aData[$CNF['FIELD_ID']]); $oProfile = BxDolProfile::getInstance($aData[$CNF['FIELD_AUTHOR']]); if (!$oProfile) { $oProfile = BxDolProfileUndefined::getInstance(); } // get summary $sLinkMore = ' <a title="' . bx_html_attribute(_t('_sys_read_more', $aData[$CNF['FIELD_TITLE']])) . '" href="' . $sUrl . '"><i class="sys-icon ellipsis-h"></i></a>'; $sSummary = strmaxtextlen($aData[$CNF['FIELD_TEXT']], (int) getParam($CNF['PARAM_CHARS_SUMMARY']), $sLinkMore); $sSummaryPlain = BxTemplFunctions::getInstance()->getStringWithLimitedLength(strip_tags($sSummary), (int) getParam($CNF['PARAM_CHARS_SUMMARY_PLAIN'])); $sText = $aData[$CNF['FIELD_TEXT']]; if (!empty($CNF['OBJECT_METATAGS'])) { $oMetatags = BxDolMetatags::getObjectInstance($CNF['OBJECT_METATAGS']); // keywords if ($oMetatags->keywordsIsEnabled()) { $sText = $oMetatags->keywordsParse($aData[$CNF['FIELD_ID']], $sText); } } // generate html $aVars = array('id' => $aData[$CNF['FIELD_ID']], 'content_url' => $sUrl, 'title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary' => $sSummary, 'text' => $sText, 'author' => $oProfile->getDisplayName(), 'author_url' => $oProfile->getUrl(), 'entry_posting_date' => bx_time_js($aData[$CNF['FIELD_ADDED']], BX_FORMAT_DATE), 'module_name' => _t($CNF['T']['txt_sample_single']), 'ts' => $aData[$CNF['FIELD_ADDED']], 'bx_if:thumb' => array('condition' => $sPhotoThumb, 'content' => array('title' => bx_process_output($aData[$CNF['FIELD_TITLE']]), 'summary_attr' => bx_html_attribute($sSummaryPlain), 'content_url' => $sUrl, 'thumb_url' => $sPhotoThumb ? $sPhotoThumb : '', 'gallery_url' => $sPhotoGallery ? $sPhotoGallery : '', 'strecher' => str_repeat(' ', 40))), 'bx_if:no_thumb' => array('condition' => !$sPhotoThumb, 'content' => array('content_url' => $sUrl, 'summary_plain' => $sSummaryPlain, 'strecher' => mb_strlen($sSummaryPlain) > 240 ? '' : str_repeat(' ', round((240 - mb_strlen($sSummaryPlain)) / 6))))); return $this->parseHtmlByName($sTemplateName, $aVars); }
public function __construct($aObject, $oTemplate = false) { parent::__construct($aObject, $oTemplate); $CNF =& $this->_oModule->_oConfig->CNF; $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT); if ($iContentId) { $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId); } if ($this->_aContentInfo) { $sTitle = isset($this->_aContentInfo[$CNF['FIELD_TITLE']]) ? $this->_aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($this->_aContentInfo[$CNF['FIELD_TEXT']], 20, '...'); $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $this->_aContentInfo[$CNF['FIELD_ID']]); $this->addMarkers($this->_aContentInfo); // every field can be used as marker $this->addMarkers(array('title' => $sTitle, 'entry_link' => $sUrl)); // select view entry submenu $oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu'); $oMenuSubmenu->setObjectSubmenu($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY'], array('title' => $sTitle, 'link' => $sUrl, 'icon' => $CNF['ICON'])); } }
/** * @description : function will generate profile block (used the profile template ); * @return : Html presentation data ; */ function PrintSearhResult($aProfileInfo, $aCoupleInfo = '', $aExtendedKey = null, $sTemplateName = '', $oCustomTemplate = null) { global $site; global $aPreValues; $iVisitorID = getLoggedId(); $bExtMode = !empty($_GET['mode']) && $_GET['mode'] == 'extended' || !empty($_GET['search_result_mode']) && $_GET['search_result_mode'] == 'ext'; $isShowMatchPercent = $bExtMode && $iVisitorID && $iVisitorID != $aProfileInfo['ID'] && getParam('view_match_percent') && getParam('enable_match'); $bPublic = $bExtMode ? bx_check_profile_visibility($aProfileInfo['ID'], $iVisitorID, true) : true; if ($bPublic && $iVisitorID != $aProfileInfo['ID'] && !isAdmin()) { $oPrivacy = new BxDolPrivacy('sys_page_compose_privacy', 'id', 'user_id'); $iBlockID = $GLOBALS['MySQL']->getOne("SELECT `ID` FROM `sys_page_compose` WHERE `Page` = 'profile' AND `Func` = 'Description' AND `Column` != 0"); $iPrivacyId = (int) $GLOBALS['MySQL']->getOne("SELECT `id` FROM `sys_page_compose_privacy` WHERE `user_id`='{$aProfileInfo['ID']}' AND `block_id`='{$iBlockID}' LIMIT 1"); $bPublic = !$iBlockID || !$iPrivacyId || $oPrivacy->check('view_block', $iPrivacyId, $iVisitorID); } $sProfileThumb = get_member_thumbnail($aProfileInfo['ID'], 'none', !$bExtMode, 'visitor'); $sProfileMatch = $isShowMatchPercent ? $GLOBALS['oFunctions']->getProfileMatch($iVisitorID, $aProfileInfo['ID']) : ''; $sProfileNickname = '<a href="' . getProfileLink($aProfileInfo['ID']) . '">' . getNickName($aProfileInfo['ID']) . '</a>'; $sProfileInfo = $GLOBALS['oFunctions']->getUserInfo($aProfileInfo['ID']); $sProfileDesc = $bPublic ? strmaxtextlen($aProfileInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title'); $sProfileZodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aProfileInfo['DateOfBirth']) : ''; $sProfile2ASc1 = $sProfile2ASc2 = $sProfile2Nick = $sProfile2Desc = $sProfile2Info = $sProfile2Zodiac = ''; if ($aCoupleInfo) { $sProfile2Nick = '<a href="' . getProfileLink($aCoupleInfo['ID']) . '">' . getNickName($aCoupleInfo['ID']) . '</a>'; $sProfile2Info = $GLOBALS['oFunctions']->getUserInfo($aCoupleInfo['ID']); $sProfile2Desc = $bPublic ? strmaxtextlen($aCoupleInfo['DescriptionMe'], 130) : _t('_sys_profile_private_text_title'); $sProfile2Zodiac = $bPublic && $bExtMode && getParam('zodiac') ? $GLOBALS['oFunctions']->getProfileZodiac($aCoupleInfo['DateOfBirth']) : ''; $sProfile2ASc1 = 'float:left;width:31%;margin-right:10px;'; $sProfile2ASc2 = 'float:left;width:31%;display:block;'; } else { $sProfile2ASc2 = 'display:none;'; } $aKeys = array('thumbnail' => $sProfileThumb, 'match' => $sProfileMatch, 'nick' => $sProfileNickname, 'info' => $sProfileInfo, 'i_am_desc' => $sProfileDesc, 'zodiac_sign' => $sProfileZodiac, 'nick2' => $sProfile2Nick, 'info2' => $sProfile2Info, 'i_am_desc2' => $sProfile2Desc, 'zodiac_sign2' => $sProfile2Zodiac, 'add_style_c1' => $sProfile2ASc1, 'add_style_c2' => $sProfile2ASc2); if ($aExtendedKey and is_array($aExtendedKey) and !empty($aExtendedKey)) { foreach ($aExtendedKey as $sKey => $sValue) { $aKeys[$sKey] = $sValue; } } else { $aKeys['ext_css_class'] = ''; } return $oCustomTemplate ? $oCustomTemplate->parseHtmlByName($sTemplateName, $aKeys) : $GLOBALS['oSysTemplate']->parseHtmlByName($sTemplateName, $aKeys); }
function displaySearchUnit($aData) { $sFileLink = $this->getCurrentUrl('file', $aData['id'], $aData['uri']); $sCategoryLink = $this->getCurrentUrl('category', $aData['categoryId'], $aData['categoryUri'], array('ownerId' => $aData['ownerId'], 'ownerName' => $aData['ownerName'])); // ownerPic $aUnit['ownerPic'] = get_member_icon($aData['ownerId'], 'left'); // category $aUnit['category'] = isset($aData['categoryName']) ? _t('_In') . ' <a href="' . $sCategoryLink . '">' . $aData['categoryName'] . '</a>' : ''; // comment(s) $aUnit['comment'] = isset($aData['countComment']) ? '<a href="' . $sFileLink . '">' . $aData['countComment'] . ' ' . _t('_comments') . '</a>' : ''; // tag if (isset($aData['tag'])) { $aTags = explode(',', $aData['tag']); foreach ($aTags as $sValue) { $sLink = $this->getCurrentUrl('tag', 0, $sValue); $aUnit['tag'] .= '<a href="' . $sLink . '">' . $sValue . '</a>, '; } } $aUnit['tag'] .= trim($aUnit['tag'], ', '); // rate if (!is_null($this->oRate) && $this->oRate->isEnabled()) { $aUnit['rate'] = $this->oRate->getJustVotingElement(0, 0, $aData['voting_rate']); } else { $aUnit['rate'] = ''; } // title $aUnit['title'] = isset($aData['title']) ? '<a href="' . $sFileLink . '">' . $aData['title'] . '</a>' : ''; // when $aUnit['when'] = defineTimeInterval($aData['date']); // from $aUnit['from'] = $aData['ownerId'] != 0 ? _t('_By') . ': <a href="' . getProfileLink($aData['ownerId']) . '">' . $aData['ownerName'] . '</a>' : _t('_By') . ': ' . _t('_Admin'); // view $aUnit['view'] = isset($aData['view']) ? _t("_Views") . ': ' . $aData['view'] : ''; // body $aUnit['body'] = isset($aData['bodyText']) ? process_html_output(strmaxtextlen(strip_tags($aData['bodyText']), 200)) : ''; return $GLOBALS['oSysTemplate']->parseHtmlByName('browseTextUnit.html', $aUnit, array('{', '}')); }
function serviceGetWallPostOutline($aEvent) { $sPrefix = 'bx_' . $this->_oConfig->getUri(); $aProfile = getProfileInfo($aEvent['owner_id']); if (!$aProfile) { return ''; } $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']); rsort($aObjectIds); $iItems = count($aObjectIds); $iItemsLimit = 3; if ($iItems > $iItemsLimit) { $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit); } $bSave = false; $aContent = array(); if (!empty($aEvent['content'])) { $aContent = unserialize($aEvent['content']); } if (!isset($aContent['idims'])) { $aContent['idims'] = array(); } $iDeleted = 0; $aItems = $aTmplItems = array(); foreach ($aObjectIds as $iId) { $aItem = $this->_oDb->getPostInfo($iId); if (empty($aItem)) { $iDeleted++; } else { if ($aItem['PostStatus'] == 'approval' && $this->oPrivacy->check('view', $aItem['PostID'], $this->_iVisitorID)) { $aItem['thumb_file'] = ''; $aItem['thumb_dims'] = array(); if (!empty($aItem['PostPhoto'])) { $aItem['thumb_file'] = BX_BLOGS_IMAGES_URL . 'browse_' . $aItem['PostPhoto']; $aItem['thumb_file_path'] = BX_BLOGS_IMAGES_PATH . 'browse_' . $aItem['PostPhoto']; if (!file_exists($aItem['thumb_file_path'])) { $aItem['thumb_file'] = BX_BLOGS_IMAGES_URL . 'big_' . $aItem['PostPhoto']; $aItem['thumb_file_path'] = BX_BLOGS_IMAGES_PATH . 'big_' . $aItem['PostPhoto']; } if (!isset($aContent['idims'][$iId])) { $sPath = file_exists($aItem['thumb_file_path']) ? $aItem['thumb_file_path'] : $aItem['thumb_file']; $aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath); $bSave = true; } $aItem['thumb_dims'] = $aContent['idims'][$iId]; $aItem['thumb_file_2x'] = BX_BLOGS_IMAGES_URL . 'orig_' . $aItem['PostPhoto']; $aItem['thumb_file_2x_path'] = BX_BLOGS_IMAGES_PATH . 'orig_' . $aItem['PostPhoto']; } $aItem['PostUrl'] = $this->genUrl($aItem['PostID'], $aItem['PostUri'], 'entry'); $aItems[] = $aItem; $aTmplItems[] = array('mod_prefix' => $sPrefix, 'item_width' => isset($aItem['thumb_dims']['w']) ? $aItem['thumb_dims']['w'] : $this->iThumbSize, 'item_height' => isset($aItem['thumb_dims']['h']) ? $aItem['thumb_dims']['h'] : $this->iThumbSize, 'item_icon' => $aItem['thumb_file'], 'item_icon_2x' => $aItem['thumb_file_2x'], 'item_page' => $aItem['PostUrl'], 'item_title' => $aItem['PostCaption'], 'item_description' => strmaxtextlen($aItem['PostText'], 300)); } } } if ($iDeleted == count($aObjectIds)) { return array('perform_delete' => true); } if (empty($aItems)) { return ''; } $aResult = array(); if ($bSave) { $aResult['save']['content'] = serialize($aContent); } $sCss = ''; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss(array('wall_outline.css'), true); } else { $this->_oTemplate->addCss(array('wall_outline.css')); } $iItems = count($aItems); $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $sOwnerLink = getProfileLink($iOwner); //--- Grouped events $iItems = count($aItems); if ($iItems > 1) { $sTmplName = 'wall_outline_grouped.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => 'book', 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'item_comments' => 0 ? _t('_wall_n_comments', 0) : _t('_wall_no_comments'), 'item_comments_link' => '', 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])); return $aResult; } //--- Single public event $aItem = $aItems[0]; $aTmplItem = $aTmplItems[0]; $sTmplName = empty($aItem['thumb_file']) ? 'modules/boonex/wall/|outline_item_text.html' : 'modules/boonex/wall/|outline_item_image.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => 'book', 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_comments' => (int) $aItem['CommentsCount'] > 0 ? _t('_wall_n_comments', $aItem['CommentsCount']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['PostUrl'] . '#cmta-' . $sPrefix . '-' . $aItem['PostID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']))); return $aResult; }
function entryMessagePreviewInGrid($r) { $oModule = BxDolModule::getInstance($this->MODULE); $oProfileLast = BxDolProfile::getInstance($r['last_reply_profile_id']); if (!$oProfileLast) { $oProfileLast = BxDolProfileUndefined::getInstance(); } $sText = strmaxtextlen($r['text'], 100); $sTextCmt = strmaxtextlen($r['cmt_text'], 100); if (!isset($r['unread_messages'])) { $r['unread_messages'] = $r['comments'] - $r['read_comments']; } $aVars = array('url' => BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $oModule->_oConfig->CNF['URI_VIEW_ENTRY'] . '&id=' . $r['id']), 'text' => $sText, 'cmt_text' => $sTextCmt, 'last_reply_time_and_replier' => _t('_bx_cnv_x_date_by_x_replier', bx_time_js($r['last_reply_timestamp'], BX_FORMAT_DATE), $oProfileLast->getDisplayName()), 'bx_if:unread_messages' => array('condition' => $r['unread_messages'] > 0, 'content' => array())); $aVars['bx_if:unread_messages2'] = $aVars['bx_if:unread_messages']; return $this->parseHtmlByName('message_preview_in_grid.html', $aVars); }
function getWallPostOutline($aEvent, $sIcon = 'save', $aParams = array()) { $sPrefix = $this->_oConfig->getMainPrefix(); $sPrefixAlbum = $sPrefix . '_albums'; $aOwner = getProfileInfo((int) $aEvent['owner_id']); $aObjectIds = strpos($aEvent['object_id'], ',') !== false ? explode(',', $aEvent['object_id']) : array($aEvent['object_id']); rsort($aObjectIds); $iItems = count($aObjectIds); $iItemsLimit = isset($aParams['grouped']['items_limit']) ? (int) $aParams['grouped']['items_limit'] : 3; if ($iItems > $iItemsLimit) { $aObjectIds = array_slice($aObjectIds, 0, $iItemsLimit); } $bSave = false; $aContent = array(); if (!empty($aEvent['content'])) { $aContent = unserialize($aEvent['content']); } if (!isset($aContent['idims'])) { $aContent['idims'] = array(); } $sClassName = $this->_oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->_aModule); $oSearch = new $sClassName(); $sItemThumbnailType = isset($aParams['thumbnail_type']) ? $aParams['thumbnail_type'] : 'browse'; $iDeleted = 0; $aItems = $aTmplItems = array(); foreach ($aObjectIds as $iId) { $aItem = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType); if (empty($aItem)) { $iDeleted++; } else { if ($aItem['status'] == 'approved' && $this->oAlbumPrivacy->check('album_view', $aItem['album_id'], $this->oModule->_iProfileId)) { if (!isset($aContent['idims'][$iId])) { $sPath = isset($aItem['file_path']) && file_exists($aItem['file_path']) ? $aItem['file_path'] : $aItem['file']; $aContent['idims'][$iId] = BxDolImageResize::instance()->getImageSize($sPath); $bSave = true; } $aItem['dims'] = $aContent['idims'][$iId]; $aItems[] = $aItem; $aItem2x = $oSearch->serviceGetItemArray($iId, $sItemThumbnailType . '2x'); $aTmplItems[] = array_merge($aItem, array('mod_prefix' => $sPrefix, 'item_width' => $aItem['dims']['w'], 'item_height' => $aItem['dims']['h'], 'item_icon' => $aItem['file'], 'item_icon_2x' => !empty($aItem2x['file']) ? $aItem2x['file'] : $aItem['file'], 'item_page' => $aItem['url'], 'item_title' => $aItem['title'])); } } } if ($iDeleted == count($aObjectIds)) { return array('perform_delete' => true); } if (empty($aOwner) || empty($aItems)) { return ""; } $aResult = array(); if ($bSave) { $aResult['save']['content'] = serialize($aContent); } $sCss = ""; if ($aEvent['js_mode']) { $sCss = $this->_oTemplate->addCss('wall_outline.css', true); } else { $this->_oTemplate->addCss('wall_outline.css'); } $iOwner = (int) $aEvent['owner_id']; $sOwner = getNickName($iOwner); $sOwnerLink = getProfileLink($iOwner); //--- Grouped events $iItems = count($aItems); if ($iItems > 1) { $aExtra = unserialize($aEvent['content']); $sAlbumUri = $aExtra['album']; $oAlbum = new BxDolAlbums($sPrefix); $aAlbumInfo = $oAlbum->getAlbumInfo(array('fileUri' => $sAlbumUri, 'owner' => $iOwner)); $oAlbumCmts = new BxTemplCmtsView($sPrefixAlbum, $aAlbumInfo['ID']); $aAlbumInfo['comments_count'] = (int) $oAlbumCmts->getObjectCommentsCount(); $aAlbumInfo['Url'] = $oSearch->getCurrentUrl('album', $aAlbumInfo['ID'], $aAlbumInfo['Uri']) . '/owner/' . getUsername($iOwner); $sTmplName = isset($aParams['templates']['grouped']) ? $aParams['templates']['grouped'] : 'modules/boonex/wall/|outline_item_image_grouped.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'bx_repeat:items' => $aTmplItems, 'album_url' => $aAlbumInfo['Url'], 'album_title' => $aAlbumInfo['Caption'], 'album_description' => strmaxtextlen($aAlbumInfo['Description'], 200), 'album_comments' => (int) $aAlbumInfo['comments_count'] > 0 ? _t('_wall_n_comments', $aAlbumInfo['comments_count']) : _t('_wall_no_comments'), 'album_comments_link' => $aAlbumInfo['Url'] . '#cmta-' . $sPrefixAlbum . '-' . $aAlbumInfo['ID'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago'])); return $aResult; } //--- Single public event $aItem = $aItems[0]; $aTmplItem = $aTmplItems[0]; $sTmplName = isset($aParams['templates']['single']) ? $aParams['templates']['single'] : 'modules/boonex/wall/|outline_item_image.html'; $aResult['content'] = $sCss . $this->_oTemplate->parseHtmlByName($sTmplName, array_merge($aTmplItem, array('mod_prefix' => $sPrefix, 'mod_icon' => $sIcon, 'user_name' => $sOwner, 'user_link' => $sOwnerLink, 'item_page' => $aItem['url'], 'item_title' => $aItem['title'], 'item_description' => strmaxtextlen($aItem['description'], 200), 'item_comments' => (int) $aItem['comments_count'] > 0 ? _t('_wall_n_comments', $aItem['comments_count']) : _t('_wall_no_comments'), 'item_comments_link' => $aItem['url'] . '#cmta-' . $sPrefix . '-' . $aItem['id'], 'post_id' => $aEvent['id'], 'post_ago' => $aEvent['ago']))); return $aResult; }
function getMembersExtended($aProfiles, $sPaginate, $sControls) { $aItems = array(); foreach ($aProfiles as $aProfile) { $aItems[$aProfile['id']] = array('id' => $aProfile['id'], 'thumbnail' => get_member_thumbnail($aProfile['id'], 'none'), 'edit_link' => $GLOBALS['site']['url'] . 'pedit.php?ID=' . $aProfile['id'], 'edit_class' => (int) $aProfile['banned'] == 1 ? 'adm-mp-banned' : ($aProfile['status'] != 'Active' ? 'adm-mp-inactive' : 'adm-mp-active'), 'username' => getNickName($aProfile['id']), 'info' => $GLOBALS['oFunctions']->getUserInfo($aProfile['id']), 'description' => strmaxtextlen($aProfile['description'], 130)); } return $GLOBALS['oAdmTemplate']->parseHtmlByName('mp_members_extended.html', array('bx_repeat:items' => array_values($aItems), 'paginate' => $sPaginate, 'control' => $sControls)); }
/** * Entry post for Timeline */ public function serviceGetTimelinePost($aEvent) { $aContentInfo = $this->_oDb->getContentInfoById($aEvent['object_id']); if (empty($aContentInfo) || !is_array($aContentInfo)) { return ''; } $CNF =& $this->_oConfig->CNF; $sUrl = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]); //--- Image(s) $aImages = $this->_getImagesForTimelinePost($aEvent, $aContentInfo, $sUrl); //--- Votes $oVotes = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $aEvent['object_id']); $aVotes = array(); if ($oVotes && $oVotes->isEnabled()) { $aVotes = array('system' => $CNF['OBJECT_VOTES'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['votes']); } //--- Comments $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $aEvent['object_id']); $aComments = array(); if ($oCmts && $oCmts->isEnabled()) { $aComments = array('system' => $CNF['OBJECT_COMMENTS'], 'object_id' => $aContentInfo[$CNF['FIELD_ID']], 'count' => $aContentInfo['comments']); } return array('owner_id' => $aContentInfo[$CNF['FIELD_AUTHOR']], 'content' => array('sample' => _t($CNF['T']['txt_sample_single']), 'url' => $sUrl, 'title' => isset($aContentInfo[$CNF['FIELD_TITLE']]) ? $aContentInfo[$CNF['FIELD_TITLE']] : strmaxtextlen($aContentInfo[$CNF['FIELD_TEXT']], 20, '...'), 'text' => $aContentInfo[$CNF['FIELD_TEXT']], 'images' => $aImages), 'date' => $aContentInfo[$CNF['FIELD_ADDED']], 'votes' => $aVotes, 'comments' => $aComments, 'title' => '', 'description' => ''); }
function _formatSnippetText($aEntryData, $iMaxLen = 300) { return strmaxtextlen($aEntryData[$this->_oDb->_sFieldDescription], $iMaxLen); }
/** * page code function */ function PageCompPageMainCode() { global $site; global $dir; global $_page; global $p_arr; global $p_arr_new; global $db_vsbl; global $db_editbl; global $tab; global $autoApproval_ifProfile; global $ID; global $MEMBER; global $ADMIN; global $NEW_TO_ADD; global $Featured; global $pic; global $pics; global $pic_num; global $enable_audio_upload; global $enable_video_upload; global $sound_file_exist; global $video_file_exist; global $status_admin_ex; global $change_error_text; global $result_text; global $pictures_text; global $membership_message; global $max_thumb_height; global $max_thumb_width; global $enable_ray; global $enable_ray_pro; ob_start(); if ($NEW_TO_ADD) { $_page['header'] = _t("_New Member"); $_page['header_text'] = _t("_New Member Add Here"); } else { $_page['header'] = process_line_output($p_arr['NickName']) . ": " . process_line_output(strmaxtextlen($p_arr['DescriptionMe'], 45)); $_page['header_text'] = "<b>" . process_line_output($p_arr['NickName']) . "</b> - "; $_page['header_text'] .= _t('_' . $p_arr['Sex']); $_page['header_text'] .= ", " . _t("_y/o", age($p_arr['DateOfBirth'])) . " (ID: {$p_arr['ID']})"; } echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>'; if ($ADMIN && $status_admin_ex) { echo $status_admin_ex; } if ($change_error_text) { echo $change_error_text . '<br />'; } global $moderator; if ($ADMIN && !$moderator) { echo "<div align=right class=text2><a href=\"{$_SERVER['PHP_SELF']}\">" . _t("_Add New Profile") . "</a></div>"; } if ($result_text) { echo '<center>' . $result_text . '</center><br />'; } if ($ADMIN && !$NEW_TO_ADD && $enable_video_upload && $enable_ray && $enable_ray_pro && file_exists($dir['root'] . "ray/modules/video/admin.php")) { $sRayHeaderPath = $dir['root'] . "ray/inc/header.inc.php"; $iId = (int) $p_arr['ID']; $aAdmin = db_arr("SELECT `Name`, `Password` FROM `Admins` LIMIT 1"); $sNick = $aAdmin['Name']; $sPassword = $aAdmin['Password']; echo "<tr><td><div style=\"width:179px; padding-bottom:10px; margin-left:auto; margin-right:auto;\">"; require_once $dir['root'] . "ray/modules/video/admin.php"; echo "</div></td></tr>"; } if ($ADMIN && !$NEW_TO_ADD) { // Print membership information and controls $memberships_arr = getMemberships(); $membership_info = getMemberMembershipInfo($ID); ?> <!-- MEMBERSHIP [BEGIN] --> <tr><td> <center><?php echo $membership_message; ?> </center> <form name="MembershipForm" action="profile_edit.php?ID=<?php echo $p_arr['ID']; ?> " method=post> <input type="hidden" name="SetMembership" value="YES"> <table width=100% cellspacing=0 cellpadding=2 class="text2" border=0> <?php echo print_rows_set_membership(1, $memberships_arr, $membership_info, 3, "table", "panel", "25%"); ?> </table> <center> <input class=no type="submit" value="Set" style="width: 50px;"> </center> </form> <hr> </td></tr> <!-- MEMBERSHIP [ END ] --> <?php } ?> <form name="jform" method="post" action="profile_edit.php?ID=<?php echo $p_arr['ID']; ?> "> <?php if ($NEW_TO_ADD) { ?> <input type="hidden" name="NewProfile" value="YES" /> <?php } ?> <input type="hidden" name="SaveChanges" value="YES" /> <?php if ($ADMIN) { ?> <table cellspacing="0" cellpadding="0" class="small2" align="center"> <tr> <td align="right" width="75%"><?php echo _t("_Mark as Featured"); ?> </td> <td align="left" width="25%"> <input type="checkbox" name="Featured" <?php if ($Featured) { echo 'checked="checked"'; } ?> > </td> </tr> </table> <?php } ?> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td valign="top"> <table border="0" cellspacing="1" cellpadding="0" width="100%"> <tr><td align="center" valign="middle"> <?php if ($NEW_TO_ADD) { echo _t("_New Member") . '<br /><br />'; } else { ?> <table border="0" cellspacing="0" cellpadding="0" width="250"> <tr> <td align="center" valign="middle" style="position:relative; display:block;width:112px;"> <?php echo get_member_thumbnail($p_arr['ID'], 'none'); ?> </td> <td> <?php $yes_ph = 0; require_once BX_DIRECTORY_PATH_ROOT . 'profilePhotos.php'; $oPhoto = new ProfilePhotos($p_arr['ID']); $oPhoto->getMediaArray(); $yes_ph = $oPhoto->iMediaCount; if ($yes_ph) { ?> <a href="<?php echo $site['url']; ?> photos_gallery.php?ID=<?php echo $p_arr['ID']; ?> " ><?php echo _t("_More Photos"); ?> </a><br /> <?php } if (!$MEMBER) { echo "<div class=small2>" . _t("_Last logged in") . ": "; if (!$p_arr['LastLoggedIn'] || $p_arr['LastLoggedIn'] == "0000-00-00 00:00:00") { echo _t("_never"); } else { echo $p_arr['LastLoggedIn']; } echo "</div>"; } else { echo _t("_Profile status"); ?> : <b><font class=prof_stat_<?php echo $p_arr['Status']; ?> > <?php echo _t("_" . $p_arr['Status']); ?> </font></b><br /> <?php if ($MEMBER) { switch ($p_arr['Status']) { case 'Active': echo '<a href="change_status.php">' . _t("_Suspend account") . '</a><br />'; break; case 'Suspended': echo '<a href="change_status.php">' . _t("_Activate account") . '</a><br />'; break; } } } ?> </td></tr> </table> <?php } ?> </td> <td valign="top" align="center" width="100%"> <?php $free_mode = getParam("free_mode") == "on" ? 1 : 0; ?> </td> </table> </td></tr> <tr><td> <table class="profile_edit_table"><!-- Profile edit page --> <?php $first_row = 1; $rd = !($ADMIN || $MEMBER); $columns = 2; $respd = db_res("SELECT *, (`editable` & {$db_editbl}) AS `is_editable` FROM `ProfilesDesc` WHERE `visible` & {$db_vsbl} AND ( FIND_IN_SET('0', `show_on_page`) OR FIND_IN_SET('" . (int) $_page['name_index'] . "', show_on_page)) ORDER BY `order` ASC"); while ($arrpd = mysql_fetch_array($respd)) { $fname = get_input_name($arrpd); if ($arrpd['get_value'] && $arrpd['to_db'] == 0) { $funcbody = $arrpd['get_value']; $func = create_function('$arg0', $funcbody); $p_arr[$fname] = $func($p_arr_new); } if ($arrpd['is_editable'] && isset($p_arr_new[$fname])) { $p_arr[$fname] = $p_arr_new[$fname]; } $not_first_row = 0; $read_only = !$arrpd['is_editable']; switch ($arrpd['type']) { case 'set': // set of checkboxes echo print_row_set($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'rb': // radio buttons echo print_row_radio_button($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'r': // reference to array for combo box if ($fname == 'Country') { $onchange = "flagImage = document.getElementById('flagImageId'); flagImage.src = '{$site['flags']}' + this.value.toLowerCase() + '.gif';"; if (strlen($p_arr[$fname]) == 0) { $p_arr[$fname] = getParam('default_country'); } $imagecode = '<img id="flagImageId" src="' . ($site['flags'] . strtolower($p_arr[$fname])) . '.gif" alt="flag" />'; } else { $onchange = ''; $imagecode = ''; } echo print_row_ref($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only, $onchange, $imagecode); break; case '0': // divider echo print_row_delim($first_row, $arrpd, "panel", $columns); $not_first_row = 1; $first_row = 1; break; case 'e': // enum combo box. if field name is 'Sex', than this is simple text, user can not change it echo print_row_enum($first_row, $arrpd, $p_arr[$fname], "table", $javascript, $rd, $columns, "", $read_only); break; case 'en': // enum combo box with numbers echo print_row_enum_n($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'eny': // enum combo box with years echo print_row_enum_years($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'a': // text Area echo print_row_area($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'c': // input box echo print_row_edit($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'date': // date echo print_row_date($first_row, $arrpd, $p_arr[$fname], "table", $rd, $columns, "", $read_only); break; case 'p': // input box password echo print_row_pwd($first_row, $arrpd, '', "table", $rd, $columns, "", $read_only); break; default: $not_first_row = 1; } if (!$not_first_row && $first_row == 1) { $first_row = 0; } } ?> </table> </td></tr> </table> <br /> <?php if (!!($ADMIN || $MEMBER)) { ?> <center><input type="submit" value="<?php echo _t("_Save Changes"); ?> " /></center> </form> <br /> <?php if ($MEMBER && !$NEW_TO_ADD) { if (!$autoApproval_ifProfile) { attention(_t("_PROFILE_WARNING1", $site['title'])); } attention(_t("_PROFILE_WARNING2", $site['title'])); } } echo "</td></tr></table>"; $ret = ob_get_clean(); return $ret; }
public function serviceGetNotificationsVote($aEvent) { $CNF =& $this->_oConfig->CNF; $iContent = (int) $aEvent['object_id']; $aContent = $this->_oDb->getEvents(array('browse' => 'id', 'value' => $iContent)); if (empty($aContent) || !is_array($aContent)) { return array(); } $oVote = BxDolVote::getObjectInstance($CNF['OBJECT_VOTES'], $iContent); if (!$oVote || !$oVote->isEnabled()) { return array(); } $sEntryCaption = !empty($aContent['title']) ? $aContent['title'] : strmaxtextlen($aContent['description'], 20, '...'); return array('entry_sample' => _t($CNF['T']['txt_sample_single']), 'entry_url' => $this->_oConfig->getItemViewUrl($aContent), 'entry_caption' => $sEntryCaption, 'entry_author' => $aContent['owner_id'], 'subentry_sample' => _t($CNF['T']['txt_sample_vote_single']), 'lang_key' => ''); }
function genInputTranslatable(&$aInput, $sType = 'text') { $iValueLength = 20; $sInputIdPrefix = 'bx-form-input-'; $aInputMethod = array('text' => 'genInputStandard', 'textarea' => 'genInputTextarea'); $sInput = ''; $sInputName = $aInput['name']; $aInputAttrs = isset($aInput['attrs']) && is_array($aInput['attrs']) ? $aInput['attrs'] : array(); $oFunctions = BxTemplStudioFunctions::getInstance(); $oLanguage = BxDolStudioLanguagesUtils::getInstance(); $sLanguage = $oLanguage->getCurrentLangName(false); $aLanguages = $oLanguage->getLanguagesInfo(); $aStrings = $oLanguage->getLanguageString($aInput['value']); $aInput['type'] = 'hidden'; $aInput['attrs'] = array_merge($aInputAttrs, array('id' => $sInputIdPrefix . $aInput['name'])); $sInput .= $this->genInputStandard($aInput); $aTmplVars = array(); foreach ($aLanguages as $aLanguage) { $bLanguage = $aLanguage['name'] == $sLanguage; $sValue = ''; if (($bValue = key_exists($aLanguage['id'], $aStrings)) === true) { $sValue = $aStrings[$aLanguage['id']]['string']; } else { if (isset($aInput['values'][$aLanguage['name']])) { $sValue = $aInput['values'][$aLanguage['name']]; } } $aInput['type'] = $sType; $aInput['name'] = $sInputName . '-' . $aLanguage['name']; $aInput['value'] = $sValue; $aInput['attrs'] = array_merge($aInputAttrs, array('id' => $sInputIdPrefix . $aInput['name'], 'style' => !$bLanguage ? 'display:none;' : '')); $sInput .= $this->{$aInputMethod}[$sType]($aInput); $aTmplVarValue = array('condition' => $bValue, 'content' => array('value' => strmaxtextlen($sValue, $iValueLength))); $aTmplVarMissing = array('condition' => !$bValue || empty($sValue), 'content' => array()); $aTmplVars[] = array('name' => $sInputName, 'lang_name' => $aLanguage['name'], 'lang_flag' => $aLanguage['icon'], 'lang_title' => $aLanguage['title'], 'bx_if:hide_active' => array('condition' => !$bLanguage, 'content' => array()), 'bx_if:act_value' => $aTmplVarValue, 'bx_if:act_missing' => $aTmplVarMissing, 'bx_if:hide_passive' => array('condition' => $bLanguage, 'content' => array()), 'bx_if:pas_value' => $aTmplVarValue, 'bx_if:pas_missing' => $aTmplVarMissing); } $sPopup = $this->oTemplate->parseHtmlByName('form_view_translator.html', array('bx_repeat:languages' => $aTmplVars)); $sPopup = $oFunctions->transBox('bx-form-field-translator-popup-' . $sInputName, $sPopup, true); $aLanguage = $oLanguage->getLanguageInfo($sLanguage); $sControl = $this->oTemplate->parseHtmlByName('form_view_translatable.html', array('flag' => $aLanguage['icon'], 'title' => $aLanguage['title'], 'name' => $sInputName, 'popup' => $sPopup)); return $sInput . $sControl; }
function getArticleEditForm($iArticleID = '') { $sEditArticleC = _t('_Edit Article'); $sArticlesC = _t('_Articles'); $sArticleC = _t('_Article'); $sArticleTitleC = _t('_Article Title'); $sSelectCategoryC = _t('_Select Category'); $sPrintAsC = _t('_Print As'); $rCatories = $this->getArticlesCategoriesList(true); if ((int) $iArticleID) { $articleQuery = "\r\n\t\t\t\tSELECT `Articles`.`ArticlesID`, `Articles`.`CategoryID`, `Articles`.`Date`,\r\n\t\t\t\t\t\t`Articles`.`Title`, `Articles`.`Text`, `Articles`.`ArticleFlag`, `ArticlesCategory`.`CategoryName`\r\n\t\t\t\tFROM `Articles`\r\n\t\t\t\tINNER JOIN `ArticlesCategory` ON `ArticlesCategory`.`CategoryID` = `Articles`.`CategoryID`\r\n\t\t\t\tWHERE `Articles`.`ArticlesID` = '{$iArticleID}';\r\n\t\t\t"; $aArticle = db_arr($articleQuery); } $sCategoryNameAd = ''; if ($iArticleID && strlen($aArticle['CategoryName'])) { $sCategoryNameAd = <<<EOF <span>></span> <span><a href="{$this->sUrl}articles.php?catID={$aArticle['CategoryID']}&action=viewcategory">{$aArticle['CategoryName']}</a></span> <span>></span> <span>{$sEditArticleC}</span> EOF; } $sRetCateg = ''; while ($aCategory = mysql_fetch_assoc($rCatories)) { if ($aArticle['CategoryID'] == $aCategory['CategoryID']) { $sSelectedCategory = ' selected="selected"'; } else { $sSelectedCategory = ''; } $sRetCateg .= '<option value="' . $aCategory['CategoryID'] . '"' . $sSelectedCategory . '>' . process_line_output(strmaxtextlen($aCategory['CategoryName'], 50)) . '</option>' . "\n"; } $sArticleActions = ''; if ((int) $iArticleID) { $sArticleActions .= '<input type="hidden" name="edit_article" value="true" />' . "\n"; $sArticleActions .= '<input type="hidden" name="articleID" value="' . $iArticleID . '" />' . "\n"; } else { $sArticleActions .= '<input type="hidden" name="add_article" value="true" />' . "\n"; } $sTitle = process_line_output($aArticle['Title']); $textSelected = $aArticle['ArticleFlag'] == 'Text' ? ' selected="selected"' : ''; $htmlSelected = $aArticle['ArticleFlag'] == 'HTML' ? ' selected="selected"' : ''; $ret = <<<EOF <div class="navigationLinks"> \t<span><a href="{$this->sUrl}articles.php">{$sArticlesC}</a></span> \t{$sCategoryNameAd} </div> <script type="text/javascript"> function checkForm() { \tvar el; \tvar hasErr = false; \tvar fild = ""; \tel = document.getElementById("articleTitle"); \tif( el.value.length < 3 ) { \t\tel.style.backgroundColor = "pink"; \t\thasErr = true; \t\tfild += " Article Title"; \t} else { \t\tel.style.backgroundColor = "#fff"; \t} \tel = document.getElementById("articleBody"); \tif( el.value.length < 3 ) { \t\tif (typeof tinyMCE != 'undefined') {//here Tiny \t\t\tif( tinyMCE.selectedElement.innerHTML.length < 3 ) { \t\t\t\tel.style.backgroundColor = "pink"; \t\t\t\thasErr = true; \t\t\t\tfild += " Article text"; \t\t\t} else { \t\t\t\tel.style.backgroundColor = "#fff"; \t\t\t} \t\t} \t} else { \t\tel.style.backgroundColor = "#fff"; \t} \tel = document.getElementById("categoryID"); \tif( el.value.length < 1 ) { \t\tel.style.backgroundColor = "pink"; \t\thasErr = true; \t\tfild += " Category "; \t} else { \t\tel.style.backgroundColor = "#fff"; \t} \tel = document.getElementById("flag"); \tif( el.value.length < 1 ) { \t\tel.style.backgroundColor = "pink"; \t\thasErr = true; \t\tfild += " Text type "; \t} else { \t\tel.style.backgroundColor = "#fff"; \t} \tif (hasErr) { \t\talert( "Please fill next fields first!" + fild ) \t\treturn false; \t} else { \t\treturn true; \t} } </script> <div class="articlesFormBlock"> \t<form method="post" action="{$this->sUrl}articles.php" onsubmit="return checkForm();"> \t\t<div>{$sArticleTitleC}</div> \t\t<div> \t\t\t<input type="text" name="title" id="articleTitle" class="catCaption" value="{$sTitle}" /> \t\t</div> \t\t<div>{$sArticleC}</div> \t\t<div style="margin-bottom:7px;"> \t\t\t<textarea name="article" id="articleBody" class="classfiedsTextArea articl">{$aArticle['Text']}</textarea> \t\t</div> \t\t<div style="margin-bottom:7px;"> \t\t\t<select name="categoryID" id="categoryID"> \t\t\t\t<option value="">{$sSelectCategoryC}</option> \t\t\t\t{$sRetCateg} \t\t\t</select> \t\t</div> \t\t<div style="margin-bottom:7px;"> \t\t\t<input type="hidden" name="flag" value="HTML" /> \t\t\t<!-- <select name="flag" id="flag"> \t\t\t\t<option value="">{$sPrintAsC}</option> \t\t\t\t<option value="Text"{$textSelected}>Text</option> \t\t\t\t<option value="HTML"{$htmlSelected}>HTML</option> \t\t\t</select> --> \t\t</div> \t\t<div> \t\t\t<input type="submit" value="Submit"> \t\t\t{$sArticleActions} \t\t</div> \t</form> </div> EOF; return $ret; }
/** * page show participants function * @return HTML presentation of data */ function PageSDatingShowParticipants() { global $site; global $oTemplConfig; $sRetHtml = ''; $sEventParticipantsC = _t('_Event participants'); $sListOfParticipantsC = _t('_List') . ' ' . _t('_of') . ' ' . _t('_Participants'); // collect information about current member if ($logged['member']) { $aMember['ID'] = (int) $_COOKIE['memberID']; $aMemberData = getProfileInfo($aMember['ID']); } else { $aMember['ID'] = 0; } $aMembership = getMemberMembershipInfo($aMember['ID']); $iEventID = (int) $_REQUEST['event_id']; $sQuery = "\r\n\t\t\tSELECT `ID`, `Title`,\r\n\t\t\t\t(NOW() > `EventEnd` AND NOW() < DATE_ADD(`EventEnd`, INTERVAL `ChoosePeriod` DAY)) AS `ChooseActive`\r\n\t\t\tFROM `SDatingEvents`\r\n\t\t\tWHERE\r\n\t\t\t\t`ID` = {$iEventID} AND `Status` = 'Active' AND `AllowViewParticipants` = 1"; $aEventData = db_arr($sQuery); if (!$aEventData['ID']) { return DesignBoxContent('', '<center>' . _t('_Event is unavailable') . '</center>', $oTemplConfig->PageSDatingShowParticipants_db_num); } $sRetHtml .= '<div class="text">' . process_line_output($aEventData['Title']) . '</div>'; // list of participants $aSelfPart = 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']}"); $iPartPage = isset($_REQUEST['part_page']) ? (int) $_REQUEST['part_page'] : 1; $iPartPPerPage = isset($_REQUEST['part_p_per_page']) ? (int) $_REQUEST['part_p_per_page'] : 30; $iLimitFirst = (int) ($iPartPage - 1) * $iPartPPerPage; $vPartProfilesRes = db_res("SELECT `Profiles`.*, `SDatingParticipants`.`ParticipantUID` AS `UID`\r\n\t\t\t\t\t\t\t\t\t\tFROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\t\tINNER JOIN `Profiles` ON `SDatingParticipants`.`IDMember` = `Profiles`.`ID`\r\n\t\t\t\t\t\t\t\t\t\tWHERE `SDatingParticipants`.`IDEvent` = {$iEventID}\r\n\t\t\t\t\t\t\t\t\t\tORDER BY `Profiles`.`NickName`\r\n\t\t\t\t\t\t\t\t\t\tLIMIT {$iLimitFirst}, {$iPartPPerPage}"); $aTotal = db_arr("SELECT COUNT(*) FROM `SDatingParticipants`\r\n\t\t\t\t\t\t\t\t\tWHERE `SDatingParticipants`.`IDEvent` = {$iEventID}"); $iPartProfilesTotal = (int) $aTotal[0]; $iPagesNum = ceil($iPartProfilesTotal / $iPartPPerPage); $sPartGetUrl = "{$_SERVER['PHP_SELF']}?action=show_part&event_id={$iEventID}" . (isset($_REQUEST['part_p_per_page']) ? '&part_p_per_page=' . (int) $_REQUEST['part_p_per_page'] : ''); if ($iPartProfilesTotal == 0) { $sRetHtml .= _t('_There are no participants for this event'); } else { if ($iPagesNum > 1) { $sRetHtml .= '<div class="text">' . _t('_Pages') . ': '; for ($i = 1; $i <= $iPagesNum; $i++) { if ($i == $iPartPage) { $sRetHtml .= "[{$i}] "; } else { $sRetHtml .= "<a href=\"{$sPartGetUrl}&part_page={$i}\">{$i}</a> "; } } $sRetHtml .= '</div><br />'; } $sProfilesTrs = ''; while ($part_profiles_arr = mysql_fetch_assoc($vPartProfilesRes)) { $iUserIsOnline = get_user_online_status($part_profiles_arr[ID]); $sCont = get_member_thumbnail($part_profiles_arr['ID'], 'none') . '<br /><center>' . getProfileOnlineStatus($iUserIsOnline) . '</center>'; $sProfilesTrs .= DesignBoxContentBorder(process_line_output(strmaxtextlen($part_profiles_arr['NickName'], 11)) . ': ' . age($part_profiles_arr['DateOfBirth']) . ' ' . _t('_y/o'), $sCont); } $sNicknameC = _t('_Nickname'); $sDateOfBirthC = _t('_DateOfBirth'); $sSexC = _t('_Sex'); $sEventUIDC = _t('_Event UID'); $sChooseParts = ''; // show 'choose participants' link only during choose period and if member is participant of this event // if ( $this->bAdminMode==FALSE || ($aEventData['ChooseActive'] && $aSelfPart['ID'] )) { // $sChooseParts = '<div class="text" align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=select_match&event_id='.$iEventID.'">'._t('_Choose participants you liked').'</a></div><br />'; // } $sPagesHref = ''; if ($iPagesNum > 1) { $sPagesHref .= '<div class="text">' . _t('_Pages') . ': '; for ($i = 1; $i <= $iPagesNum; $i++) { if ($i == $iPartPage) { $sPagesHref .= "[{$i}] "; } else { $sPagesHref .= "<a href=\"{$sPartGetUrl}&part_page={$i}\">{$i}</a> "; } } $sPagesHref .= '</div><br />'; } $sRetHtml .= $sProfilesTrs . $sPagesHref; } return DesignBoxContent($sListOfParticipantsC, $sRetHtml, $oTemplConfig->PageSDatingShowParticipants_db_num); }
/** * Send message */ function MemberSendMessage($member, $recipient, $must_use_credits = false) { global $site; $en_dest_choice = getParam("enable_msg_dest_choice"); $max_message_size = getParam("max_inbox_message_size"); $max_messages = getParam("max_inbox_messages"); // Check if recipient is active if ('Active' != $recipient['Status']) { return 10; } // Check if member is blocked if (db_arr("SELECT `ID`, `Profile` FROM `BlockList` WHERE `Profile` = {$member['ID']} AND `ID` = '{$recipient['ID']}';")) { return 5; } // If must use credits then check for enough amount if ($must_use_credits && getProfileCredits($member['ID']) < (double) $msg_credits) { return 21; } // antispam )) if (db_arr("SELECT `ID` FROM `Messages` WHERE `Sender` = {$member[ID]} AND date_add(`Date`, INTERVAL 1 MINUTE) > Now()")) { return 3; } // Get sender info $sender = getProfileInfo($member['ID']); $aPlus = array(); $aPlus['ProfileReference'] = $sender ? '<a href="' . getProfileLink($member['ID']) . '">' . $sender['NickName'] . '</a> (' . getProfileLink($member['ID']) . ') ' : '<b>' . _t("_Visitor") . '</b>'; // Don't send notification if message is sending to email if ($_POST['notify'] && !($_POST['sendto'] == "email" || $_POST['sendto'] == "both")) { $message_text = getParam("t_Compose"); $subject = getParam('t_Compose_subject'); $aPlus['senderNickName'] = $sender ? $sender['NickName'] : _t("_Visitor"); $notify_res = sendMail($recipient['Email'], $subject, $message_text, $recipient['ID'], $aPlus); if (!$notify_res) { echo "<div class=\"err\">" . _t("_Notification send failed") . "</div><br />\n"; } } // Send message to email if ($en_dest_choice && ($_POST['sendto'] == "email" || $_POST['sendto'] == "both")) { $message_text = getParam("t_Message"); $subject = process_pass_data($_POST['mes_subject']); $aPlus['MessageText'] = strmaxtextlen(clear_xss(replace_full_uris(process_pass_data($_POST['text']))), $max_message_size); $result = sendMail($recipient['Email'], $subject, $message_text, $recipient['ID'], $aPlus); } // Send message to communicator if ($_POST['sendto'] == "lovemail" || $_POST['sendto'] == "both") { // Restrict with total messages count $messages_count = db_arr("SELECT COUNT(*) AS `mess_count` FROM `Messages` WHERE `Recipient` = '{$recipient['ID']}'"); $messages_count = $messages_count['mess_count']; if ($messages_count - 1 > $max_messages) { $del_res = db_res("SELECT `ID` FROM `Messages` WHERE `Recipient` = '{$recipient['ID']}' ORDER BY `Date` ASC LIMIT " . ($messages_count - $max_messages + 1)); while ($del_arr = mysql_fetch_array($del_res)) { db_res("DELETE FROM `Messages` WHERE `ID` = {$del_arr['ID']}"); } } // Insert message into database $message_text = strmaxtextlen(addslashes(clear_xss(process_pass_data($_POST['text']))), $max_message_size); $message_subject = strmaxwordlen(process_db_input($_POST['mes_subject']), 30); $result = db_res("INSERT INTO `Messages` ( `Date`, `Sender`, `Recipient`, `Text`, `Subject`, `New` ) VALUES ( NOW(), {$member['ID']}, {$recipient['ID']}, '{$message_text}', '{$message_subject}', '1' )"); } // If sending successful then mark as performed action if ($result) { checkAction($member['ID'], ACTION_ID_SEND_MESSAGE, true); if ($must_use_credits) { decProfileCredits($member['ID'], $msg_credits); } } else { return 1; } return 0; }
/** * Generate Form for NewPost/EditPost * * @param $iPostID - Post ID * @param $arrErr - Array for PHP validating * @return HTML presentation of data */ function AddNewPostForm($iPostID = 0, $arrErr = NULL) { global $site; $this->CheckLogged(); $iCheckedMemberID = $this->aBlogConf['visitorID']; $sRestrictRes = $this->CheckRestrictionToUse($iCheckedMemberID); if ($sRestrictRes != '') { return $sRestrictRes; } $sPostCaptionC = _t('_Post') . ' ' . _t('_Caption'); $sCharactersLeftC = _t('_characters_left'); $sPostTextC = _t('_Post') . ' ' . _t('_Text'); $sPleaseSelectC = _t('_please_select'); $sAssociatedImageC = _t('_associated_image'); $sPostCommentPerC = _t('_post_comment_per'); $sPublicC = _t('_public'); $sFriendsOnlyC = _t('_friends only'); $sPostReadPerC = _t('_post_read_per'); $sAddBlogC = _t('_Add Post'); $sCommitC = _t('_Apply Changes'); $sTagsC = _t('_Tags'); $sNewPostC = _t('_New Post'); $sDelImgC = _t('_Delete image'); if ($this->bAdminMode == false) { $sBlogsSQL = "\n\t\t\t\tSELECT `Blogs`. *\n\t\t\t\tFROM `Blogs` \n\t\t\t\tWHERE `Blogs`.`OwnerID` = {$this->aBlogConf['visitorID']}\n\t\t\t\tLIMIT 1\n\t\t\t"; $aBlogsRes = db_arr($sBlogsSQL); if (mysql_affected_rows() == 0) { return $this->GenCreateBlogForm(); } } $sRetHtml = ''; $sCATIDstyle = $arrErr['CategoryID'] ? 'block' : 'none'; $sCPTstyle = $arrErr['Caption'] ? 'block' : 'none'; $sPTstyle = $arrErr['PostText'] ? 'block' : 'none'; $sCPstyle = $arrErr['CommentPerm'] ? 'block' : 'none'; $sRPstyle = $arrErr['ReadPerm'] ? 'block' : 'none'; $sCATIDmsg = $arrErr['CategoryID'] ? _t('_' . $arrErr['CategoryID']) : ''; $sCPTmsg = $arrErr['Caption'] ? _t('_' . $arrErr['Caption']) : ''; $sPTmsg = $arrErr['PostText'] ? _t('_' . $arrErr['PostText']) : ''; $sCPmsg = $arrErr['CommentPerm'] ? _t('_' . $arrErr['CommentPerm']) : ''; $sRPmsg = $arrErr['ReadPerm'] ? _t('_' . $arrErr['ReadPerm']) : ''; $sPostCaption = ''; $sPostText = ''; $sPostImage = ''; $sPostTags = ''; $sCheckedCommPermP = 'checked '; $sCheckedReadPostPermP = 'checked '; $sCheckedCommPermF = ''; $sCheckedReadPostPermF = ''; $sPostPicture = ''; $sPostPictureTag = ''; $sPostAction = 'add_post'; $iSavedCategoryID = -1; if ($iPostID > 0) { $sBlogPostsSQL = "SELECT * FROM `BlogPosts` WHERE `PostID` = {$iPostID} LIMIT 1"; $aBlogPost = db_arr($sBlogPostsSQL); $sPostCaption = $aBlogPost['PostCaption']; $sPostText = $aBlogPost['PostText']; $sPostImage = $aBlogPost['PostPhoto']; $sPostTags = $aBlogPost['Tags']; $sPostPicture = $aBlogPost['PostPhoto']; $sSpacerName = $site['url'] . $this->sSpacerPath; if ($sPostImage != '') { $sPostPictureTag = '<div class="marg_both_left"><img alt="" style="width: 110px; height: 110px; background-image: url(' . $site['blogImage'] . 'big_' . $sPostImage . ');" src="' . $sSpacerName . '"/></div>'; $sPostPictureTag .= <<<EOF <a href="{$_SERVER['PHP_SELF']}?action=del_img&post_id={$iPostID}">{$sDelImgC}</a> EOF; } $sCheckedCommPerm = $aBlogPost['PostCommentPermission']; $sCheckedReadPostPerm = $aBlogPost['PostReadPermission']; if ($sCheckedCommPerm == 'public') { $sCheckedCommPermP = 'checked '; } else { $sCheckedCommPermF = 'checked '; } if ($sCheckedReadPostPerm == 'public') { $sCheckedReadPostPermP = 'checked '; } else { $sCheckedReadPostPermF = 'checked '; } $sAddBlogC = $sCommitC; $sPostAction = 'post_updated'; $sEditIdStr = '<input type="hidden" name="EditedPostID" value="' . $iPostID . '" />'; } else { $iSavedCategoryID = process_db_input((int) $_POST['categoryID']); $sPostCaption = process_db_input($_POST['caption']); $sPostText = process_db_input($_POST['blogText']); $sPostImage = ''; $sPostTags = process_db_input($_POST['tags']); if (isset($_POST['commentPerm']) && isset($_POST['readPerm'])) { if (process_db_input($_POST['commentPerm']) == 'public') { $sCheckedCommPermP = 'checked '; } else { $sCheckedCommPermF = 'checked '; } if (process_db_input($_POST['readPerm']) == 'public') { $sCheckedReadPostPermP = 'checked '; } else { $sCheckedReadPostPermF = 'checked '; } } } $iOwner = $this->aBlogConf['visitorID']; if ($iPostID > 0) { $iOwner = db_value("SELECT `OwnerID` FROM `BlogCategories`\n\t\t\t\t\t\t\t\tINNER JOIN `BlogPosts` ON `BlogPosts`.`CategoryID` = `BlogCategories`.`CategoryID` \n\t\t\t\t\t\t\t\tWHERE `BlogPosts`.`PostID` = {$iPostID}"); } //$sCategories = ''; $sCategoriesSQL = "\n\t\t\tSELECT * \n\t\t\tFROM `BlogCategories`\n\t\t\tWHERE `OwnerId` = {$iOwner}\n\t\t"; $vCategories = db_res($sCategoriesSQL); $sCategOptions = ''; while ($aCategories = mysql_fetch_assoc($vCategories)) { if ($iSavedCategoryID > 0 && $iSavedCategoryID == $aCategories['CategoryID']) { $sSelected = ' selected="selected"'; } else { $sSelected = ''; } $sCategOptions .= '<option value="' . $aCategories['CategoryID'] . '"' . $sSelected . '>' . process_line_output(strmaxtextlen($aCategories['CategoryName'])) . '</option>' . "\n"; } $sCategPicture = '<img src="' . $site['icons'] . 'folder.png" style="position:static;" alt="' . $sPleaseSelectC . '" />'; $sCategSelect = '<select name="categoryID" id="categoryID" >' . $sCategOptions . '</select>'; $sCategPictSpans = $this->GenCenteredActionsBlock($sCategPicture, $sCategSelect); //$sFormUrl = $_SERVER['PHP_SELF']; //$sFormUrl = $site['url'].'blogs/'; $sLink = $this->genBlogFormUrl(); $sRetHtml .= <<<EOF <div class="categoryBlock"> \t<form action="{$sLink}" enctype="multipart/form-data" method="post"> \t\t<div class="margin_bottom_10"> \t\t\t{$sPostCaptionC} ( <span id="captCounter">{$this->aBlogConf['blogCaptionMaxLenght']}</span> {$sCharactersLeftC} ) \t\t</div> \t\t<div class="margin_bottom_10"> \t\t\t<div class="edit_error" style="display:{$sCPTstyle}"> \t\t\t\t{$sCPTmsg} \t\t\t</div> \t\t\t<input type="text" size="70" name="caption" id="caption" class="categoryCaption1" value="{$sPostCaption}" onkeydown="return charCounter('caption', '{$this->aBlogConf['blogCaptionMaxLenght']}', 'captCounter');" /> \t\t</div> \t\t<div class="margin_bottom_10"> \t\t\t{$sTagsC} \t\t</div> \t\t<div class="margin_bottom_10"> \t\t\t<input type="text" size="70" name="tags" id="tags" value="{$sPostTags}" /> \t\t</div> \t\t<div class="margin_bottom_10"> \t\t\t{$sPostTextC} \t\t</div> \t\t<div class="blogTextAreaKeeper"> \t\t\t<div class="edit_error" style="display:{$sPTstyle}"> \t\t\t\t{$sPTmsg} \t\t\t</div> \t\t\t<textarea name="blogText" rows="20" cols="60" class="classfiedsTextArea" style="width:800px;height:500px;" id="desc">{$sPostText}</textarea> \t\t</div> \t\t<br /> \t\t<div class="clear_both"></div> \t\t<div class="margin_bottom_10"> \t\t\t<div class="edit_error" style="display:{$sCATIDstyle}"> \t\t\t\t{$sCATIDmsg} \t\t\t</div> \t\t\t{$sCategPictSpans} \t\t</div> \t\t<div class="assocImageBlock"> \t\t\t<div class="margin_bottom_10"> \t\t\t\t{$sAssociatedImageC} \t\t\t</div> \t\t\t<div class="margin_bottom_10"> \t\t\t\t<input type="file" name="BlogPic"> \t\t\t</div> \t\t\t{$sPostPictureTag} \t\t\t<div class="clear_both"></div> \t\t</div> \t\t<div class="margin_bottom_10"> \t\t\t<div class="margined_left">{$sPostCommentPerC} \t\t\t</div> \t\t\t<div class="margined_left"> \t\t\t\t<div class="edit_error" style="display:{$sCPstyle}"> \t\t\t\t\t{$sCPmsg} \t\t\t\t</div> \t\t\t\t<input type="radio" {$sCheckedCommPermP} name="commentPerm" value="public" checked="checked" /> \t\t\t\t{$sPublicC}<br /> \t\t\t\t<input type="radio" {$sCheckedCommPermF} name="commentPerm" value="friends" /> \t\t\t\t{$sFriendsOnlyC} \t\t\t</div> \t\t\t<div class="margined_left">{$sPostReadPerC} \t\t\t</div> \t\t\t<div class="margined_left"> \t\t\t\t<div class="edit_error" style="display:{$sRPstyle}"> \t\t\t\t\t{$sRPmsg} \t\t\t\t</div> \t\t\t\t<input type="radio" {$sCheckedReadPostPermP} name="readPerm" value="public" /> \t\t\t\t{$sPublicC}<br /> \t\t\t\t<input type="radio" {$sCheckedReadPostPermF} name="readPerm" value="friends" /> \t\t\t\t{$sFriendsOnlyC} \t\t\t</div> \t\t\t<div class="clear_both"></div> \t\t</div> \t\t<!-- <table cellpadding="2" cellspacing="0" border="0"> \t\t\t<tr> \t\t\t\t<td rowspan="2"> \t\t\t\t\t{$sPostCommentPerC} \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t<div class="edit_error" style="display:{$sCPstyle}"> \t\t\t\t\t\t{$sCPmsg} \t\t\t\t\t</div> \t\t\t\t\t<input type="radio" {$sCheckedCommPermP} name="commentPerm" value="public" checked="checked" /> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t{$sPublicC} \t\t\t\t</td> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td> \t\t\t\t\t<input type="radio" {$sCheckedCommPermF} name="commentPerm" value="friends" /> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t{$sFriendsOnlyC} \t\t\t\t</td> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td rowspan="2"> \t\t\t\t\t{$sPostReadPerC} \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t<div class="edit_error" style="display:{$sRPstyle}"> \t\t\t\t\t\t{$sRPmsg} \t\t\t\t\t</div> \t\t\t\t\t<input type="radio" {$sCheckedReadPostPermP} name="readPerm" value="public" /> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t{$sPublicC} \t\t\t\t</td> \t\t\t</tr> \t\t\t<tr> \t\t\t\t<td> \t\t\t\t\t<input type="radio" {$sCheckedReadPostPermF} name="readPerm" value="friends" /> \t\t\t\t</td> \t\t\t\t<td> \t\t\t\t\t{$sFriendsOnlyC} \t\t\t\t</td> \t\t\t</tr> \t\t</table> --> \t\t<div class="margin_bottom_10" style="text-align: center;"> \t\t\t<input type="submit" value="{$sAddBlogC}" /> \t\t\t<input type="hidden" name="action" value="{$sPostAction}" /> \t\t\t<input type="hidden" name="show" value="blogList" /> \t\t\t{$sEditIdStr} \t\t</div> \t</form> </div> EOF; return DesignBoxContent($sNewPostC, $sRetHtml, 1); }
$delay = 2; $class_name = 'shoutbg'; //------------------------------------------- if (!($logged['admin'] = member_auth(1, false))) { if (!($logged['member'] = member_auth(0, false))) { if (!($logged['aff'] = member_auth(2, false))) { $logged['moderator'] = member_auth(3, false); } } } if ($_POST['shout']) { $id = (int) $_COOKIE['memberID']; // This is for anti-spam purpose $count_arr = db_arr("SELECT COUNT( * ) AS `my_count` FROM `shoutbox` WHERE `id` = '{$id}' AND (UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(date) < {$delay})"); if ($count_arr['my_count'] == 0) { $text = strmaxtextlen($_POST['shout'], $oTemplConfig->maxtextlength); $text = process_db_input($text); // Delete the oldest record if count more than $maxrecords $count_arr = db_arr("SELECT COUNT( * ) AS `total_count` FROM `shoutbox`"); if ($count_arr['total_count'] >= $oTemplConfig->maxrecords) { $oldest_date = db_arr("SELECT DATE_FORMAT(`date`, '{$date_format}' ) AS 'date' FROM `shoutbox` ORDER BY `date` ASC LIMIT 1"); db_res("DELETE FROM `shoutbox` WHERE `date` = '{$oldest_date['date']}'"); } // Select last class $last_class = db_arr("SELECT `class` FROM `shoutbox` ORDER BY `date` DESC LIMIT 1"); if (($cn = substr($last_class['class'], -1)) >= $oTemplConfig->classes) { $cn = $class_name . '1'; } else { $cn = $class_name . ($cn + 1); } // Insert to database
function getArticlesList($iCategoryID) { global $sUrl; global $site; global $logged; global $short_date_format; $iCategoryID = (int) $iCategoryID; if (!(int) $iCategoryID) { return ''; } else { $sCategoryQuery = "\n\t\t\t\tSELECT\n\t\t\t\t\t\t`CategoryName`,\n\t\t\t\t\t\t`CategoryDescription`\n\t\t\t\tFROM\n\t\t\t\t\t\t`ArticlesCategory`\n\t\t\t\tWHERE\n\t\t\t\t\t\t`CategoryID` = '{$iCategoryID}'\n\t\t\t\tLIMIT 1;\n\t\t"; $aCategory = db_arr($sCategoryQuery); } $sArticlesQuery = "\n\t\t\t\tSELECT\n\t\t\t\t\t\t`Title`,\n\t\t\t\t\t\t`Text`,\n\t\t\t\t\t\tDATE_FORMAT( `Date`, '{$short_date_format}' ) AS Date,\n\t\t\t\t\t\t`ArticlesID`,\n\t\t\t\t\t\t`ArticleFlag`\n\t\t\t\tFROM\n\t\t\t\t\t\t`Articles`\n\t\t\t\tWHERE\n\t\t\t\t\t\t`CategoryID` = '{$iCategoryID}'\n\t"; $rArticles = db_res($sArticlesQuery); $ret = ''; $ret .= '<div class="navigationLinks">' . "\n"; $ret .= '<span>' . "\n"; $ret .= '<a href="' . $sUrl . 'articles.php">' . "\n"; $ret .= 'Articles' . "\n"; $ret .= '</a>' . "\n"; $ret .= '</span>' . "\n"; $ret .= '<span>' . "\n"; $ret .= '>' . "\n"; $ret .= '</span>' . "\n"; $ret .= '<span>' . "\n"; $ret .= process_line_output($aCategory['CategoryName']) . "\n"; $ret .= '</span>' . "\n"; $ret .= '</div>' . "\n"; $ret .= '<div class="categoryHeader">' . "\n"; $ret .= '<div class="artCaption">' . "\n"; $ret .= process_line_output($aCategory['CategoryName']) . "\n"; $ret .= '</div>' . "\n"; $ret .= '<div>' . "\n"; $ret .= process_text_output($aCategory['CategoryDescription']) . "\n"; $ret .= '</div>' . "\n"; $ret .= '</div>' . "\n"; $i = ''; while ($aArticles = mysql_fetch_assoc($rArticles)) { if ($i % 2 == 0) { $sStyleAdd = '1'; } else { $sStyleAdd = '2'; } $ret .= '<div class="articleBlock' . $sStyleAdd . '">' . "\n"; $ret .= '<div class="title">' . "\n"; $ret .= '<a href="' . $sUrl . 'articles.php?articleID=' . $aArticles['ArticlesID'] . '&action=viewarticle">' . "\n"; $ret .= process_line_output($aArticles['Title']) . "\n"; $ret .= '</a>' . "\n"; $ret .= '</div>' . "\n"; $ret .= '<div class="date">' . "\n"; $ret .= $aArticles['Date'] . "\n"; $ret .= '</div>' . "\n"; $ret .= '<div class="preview">' . "\n"; if ($aArticles['ArticleFlag'] == 'HTML') { $ret .= process_html_output(strmaxtextlen(strip_tags($aArticles['Text']), 200)) . "\n"; } else { $ret .= process_text_output(strmaxtextlen($aArticles['Text'], 200)) . "\n"; } $ret .= '</div>' . "\n"; if ($logged['admin']) { $ret .= '<div class="categoryEdit">' . "\n"; $ret .= '<a href="' . $site['url_admin'] . 'articles.php?articleID=' . $aArticles['ArticlesID'] . '&action=editarticle">' . "\n"; $ret .= 'Edit' . "\n"; $ret .= '</a>' . "\n||"; $ret .= '<a href="' . $site['url_admin'] . 'articles.php?articleID=' . $aArticles['ArticlesID'] . '&action=deletearticle" onclick="javascript: return confirm(\' Are you sure ?\')">' . "\n"; $ret .= 'Delete' . "\n"; $ret .= '</a>' . "\n"; $ret .= '</div>' . "\n"; } $ret .= '</div>' . "\n"; $i++; } return $ret; }
/** * Function will send the compose message ; * * @param : $sMessageSubject (string) - message's subject ; * @param : $sMessageBody (string) - message's body ; * @param : $vRecipientID (variant)- message's recipient ID or NickName; * @param : $aComposeSettings (array) - contain all needed settings for compose message ; * [ send_copy ] (bolean) - allow to send message to phisical recipient's email ; * [ notification ] (boolean) - allow to send notification to the recipient's email ; * [ send_copy_to_me ] (boolean) - allow to send message to phisical sender's email ; * @return : signaling information with Html ; */ function sendMessage($sMessageSubject, $sMessageBody, $vRecipientID, &$aComposeSettings) { $sMessageSubject = process_db_input($sMessageSubject, BX_TAGS_STRIP); $sMessageSubjectCopy = $GLOBALS['MySQL']->unescape($sMessageSubject); $sMessageBody = process_db_input($sMessageBody, BX_TAGS_VALIDATE); $sCopyMessage = $GLOBALS['MySQL']->unescape($sMessageBody); if (!$sMessageSubject || !$sMessageBody) { $this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED; return MsgBox(_t('_please_fill_next_fields_first')); } // init some needed variables ; $sReturnMessage = null; $sComposeUrl = BX_DOL_URL_ROOT . 'mail.php?mode=compose'; // try to define member's ID ; $iRecipientID = (int) getId($vRecipientID); if (!$iRecipientID) { $this->iSendMessageStatusCode = BX_MAILBOX_SEND_UNKNOWN_RECIPIENT; return MsgBox(_t('_Profile not found')); } $aRecipientInfo = getProfileInfo($iRecipientID); $oEmailTemplate = new BxDolEmailTemplates(); $bAllowToSend = true; $this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED; // ** check permission for recipient member ; // Check if member is blocked ; $sQuery = "\n SELECT \n `ID`, `Profile` \n FROM \n `sys_block_list` \n WHERE \n `Profile` = {$this->aMailBoxSettings['member_id']} \n AND \n `ID` = '{$iRecipientID}'\n "; if (db_arr($sQuery)) { $sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_BLOCK')); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_BLOCKED; $bAllowToSend = false; } // antispam check ; $sQuery = "\n SELECT \n `ID` \n FROM \n `sys_messages` \n WHERE \n `Sender` = {$this->aMailBoxSettings['member_id']} \n AND \n date_add(`Date`, INTERVAL {$this->iWaitMinutes} MINUTE) > Now()\n "; if (db_arr($sQuery)) { $sReturnMessage = MsgBox(_t('_You have to wait for PERIOD minutes before you can write another message!', $this->iWaitMinutes, $sComposeUrl)); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_WAIT; $bAllowToSend = false; } // additional antispam check ; if (bx_is_spam($sCopyMessage)) { $sReturnMessage = MsgBox(sprintf(_t("_sys_spam_detected"), BX_DOL_URL_ROOT . 'contact.php')); $bAllowToSend = false; } // check if member not active ; if ($aRecipientInfo['Status'] != 'Active') { $sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_NOT_ACTIVE', $sComposeUrl)); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_RECIPIENT_NOT_ACTIVE; $bAllowToSend = false; } // chek membership level; if (!$this->isSendMessageAlowed($this->aMailBoxSettings['member_id'], true)) { $sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE_MEMBERSHIP_DISALLOW')); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED_MEMBERSHIP_DISALLOW; $bAllowToSend = false; } // ** allow to send message ; if ($bAllowToSend) { $sQuery = "\n INSERT INTO \n `sys_messages` \n SET \n `Sender` = {$this->aMailBoxSettings['member_id']},\n `Recipient` = {$iRecipientID}, \n `Subject` = '{$sMessageSubject}',\n `Text` = '{$sMessageBody}',\n `Date` = NOW(), \n `New` = '1',\n `Type` = 'letter'\n "; if (db_res($sQuery)) { $sReturnMessage = MsgBox(_t('_MESSAGE_SENT', $sComposeUrl, getProfileLink($iRecipientID), $aRecipientInfo['NickName'])); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_SUCCESS; //--- create system event bx_import('BxDolAlerts'); $aAlertData = array('msg_id' => db_last_id(), 'subject' => $sMessageSubjectCopy, 'body' => $sCopyMessage, 'send_copy' => $aComposeSettings['send_copy'], 'notification' => $aComposeSettings['notification'], 'send_copy_to_me' => $aComposeSettings['send_copy_to_me']); $oZ = new BxDolAlerts('profile', 'send_mail_internal', $this->aMailBoxSettings['member_id'], $iRecipientID, $aAlertData); $oZ->alert(); // ** check the additional parameters ; // send message to phisical recipient's email ; if ($aComposeSettings['send_copy']) { $aTemplate = $oEmailTemplate->getTemplate('t_Message', $iRecipientID); $aPlus = array(); $aPlus['MessageText'] = strmaxtextlen(replace_full_uris($sCopyMessage), $this->iMaxMessageSize); $aPlus['ProfileReference'] = getNickName($this->aMailBoxSettings['member_id']); $aPlus['ProfileUrl'] = getProfileLink($this->aMailBoxSettings['member_id']); sendMail($aRecipientInfo['Email'], $sMessageSubjectCopy, $aTemplate['Body'], $iRecipientID, $aPlus); } // send notification to the recipient's email ; if ($aComposeSettings['notification']) { $aTemplate = $oEmailTemplate->getTemplate('t_Compose', $iRecipientID); $aPlus['ProfileReference'] = getNickName($this->aMailBoxSettings['member_id']); $aPlus['ProfileUrl'] = getProfileLink($this->aMailBoxSettings['member_id']); sendMail($aRecipientInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], $iRecipientID, $aPlus); } // allow to send message to phisical sender's email; if ($aComposeSettings['send_copy_to_me']) { $aSenderInfo = getProfileInfo($this->aMailBoxSettings['member_id']); $aTemplate = $oEmailTemplate->getTemplate('t_MessageCopy', $this->aMailBoxSettings['member_id']); $aPlus['your subject here'] = $sMessageSubjectCopy; $aPlus['your message here'] = $sCopyMessage; sendMail($aSenderInfo['Email'], $aTemplate['Subject'], $aTemplate['Body'], $this->aMailBoxSettings['member_id'], $aPlus); } } else { $sReturnMessage = MsgBox(_t('_FAILED_TO_SEND_MESSAGE')); $this->iSendMessageStatusCode = BX_MAILBOX_SEND_FAILED; } } return $sReturnMessage; }