/** * Get keywords cloud. * @param $sObject metatgs object to get keywords cloud for * @param $mixedSection search section to refer when keyword is clicked, set the same as $sObject to show content withing the module only, it can be one value or array of values, leave empty to show all possible content upon keyword click * @param $iMaxCount number of tags in keywords cloud, by default @see BX_METATAGS_KEYWORDS_IN_CLOUD * @return tags cloud HTML string */ public function serviceKeywordsCloud($sObject, $mixedSection, $iMaxCount = BX_METATAGS_KEYWORDS_IN_CLOUD) { $o = BxDolMetatags::getObjectInstance($sObject); $aKeywords = $o->keywordsPopularList($iMaxCount); if (!$aKeywords) { return ''; } ksort($aKeywords, SORT_LOCALE_STRING); $iFontDiff = floor($this->_iKeywordsCloudFontSizeMax - $this->_iKeywordsCloudFontSizeMin); $iMinRating = min($aKeywords); $iMaxRating = max($aKeywords); $iRatingDiff = $iMaxRating - $iMinRating; $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff; $sSectionPart = ''; if (is_array($mixedSection)) { $sSectionPart = '§ion[]=' . implode('§ion[]=', $mixedSection); } elseif (is_string($mixedSection)) { $sSectionPart = '§ion[]=' . $mixedSection; } $aUnits = array(); foreach ($aKeywords as $sKeyword => $iCount) { $aUnits[] = array('size' => $this->_iKeywordsCloudFontSizeMin + floor($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff)), 'href' => BX_DOL_URL_ROOT . 'searchKeyword.php?type=keyword&keyword=' . rawurlencode($sKeyword) . $sSectionPart, 'count' => $iCount, 'keyword' => htmlspecialchars_adv($sKeyword)); } $aVars = array('bx_repeat:units' => $aUnits); $this->addCssJs(); return BxDolTemplate::getInstance()->parseHtmlByName('metatags_keywords_cloud.html', $aVars); }
function getCategoriesView($aTotalCategories, $sHrefTempl, $iColumns) { global $oSysTemplate; if (empty($aTotalCategories)) { return MsgBox(_t('_Empty')); } if (!$iColumns) { $iColumns = 1; } $iCount = count($aTotalCategories); $iRowCount = floor($iCount / $iColumns) + ($iCount % $iColumns ? 1 : 0); $iWidthPr = floor(100 / $iColumns); $i = 0; $sCode = '<div class="categories_wrapper bx-def-bc-margin bx-def-font-large">'; foreach ($aTotalCategories as $sCategory => $iCatCount) { if (!($i % $iRowCount)) { if ($i) { $sCode .= '</div>'; } $sCode .= '<div class="categories_col" style="width: ' . $iWidthPr . '%">'; } $aUnit['catHref'] = str_replace('{tag}', rawurlencode(title2uri($sCategory)), $sHrefTempl); $aUnit['category'] = htmlspecialchars_adv($sCategory); $aUnit['count'] = $iCatCount; if ($this->_sCategTmplContent) { $sCode .= $oSysTemplate->parseHtmlByContent($this->_sCategTmplContent, $aUnit); } else { $sCode .= $oSysTemplate->parseHtmlByName($this->_sCategTmplName, $aUnit); } $i++; } $sCode .= '</div></div>'; return $sCode; }
function getTagsView($aTotalTags, $sHrefTempl) { global $oTemplConfig; global $oSysTemplate; if (empty($aTotalTags)) { return MsgBox(_t('_Empty')); } $iMinFontSize = $oTemplConfig->iTagsMinFontSize; $iMaxFontSize = $oTemplConfig->iTagsMaxFontSize; $iFontDiff = $iMaxFontSize - $iMinFontSize; $iMinRating = min($aTotalTags); $iMaxRating = max($aTotalTags); $iRatingDiff = $iMaxRating - $iMinRating; $iRatingDiff = $iRatingDiff == 0 ? 1 : $iRatingDiff; $sCode = '<div class="tags_wrapper">'; $aUnit = array(); foreach ($aTotalTags as $sTag => $iCount) { $aUnit['tagSize'] = $iMinFontSize + round($iFontDiff * (($iCount - $iMinRating) / $iRatingDiff)); $aUnit['tagHref'] = str_replace('{tag}', urlencode(title2uri($sTag)), $sHrefTempl); $aUnit['countCapt'] = _t('_Count'); $aUnit['countNum'] = $iCount; $aUnit['tag'] = htmlspecialchars_adv($sTag); if ($this->_sTagTmplContent) { $sCode .= $oSysTemplate->parseHtmlByContent($this->_sTagTmplContent, $aUnit); } else { $sCode .= $oSysTemplate->parseHtmlByName($this->_sTagTmplName, $aUnit); } } $sCode .= '</div>'; $sCode .= '<div class="clear_both"></div>'; return $sCode; }
function DesignBoxAdmin($sTitle, $sContent, $mixedTopItems = '', $sBottomItems = '', $iIndex = 1) { if (is_array($mixedTopItems)) { $mixedButtons = array(); foreach ($mixedTopItems as $sId => $aAction) { $mixedButtons[] = array('id' => $sId, 'title' => htmlspecialchars_adv(_t($aAction['title'])), 'class' => isset($aAction['class']) ? ' class="' . $aAction['class'] . '"' : '', 'icon' => isset($aAction['icon']) ? '<img' . $sClass . ' src="' . $aAction['icon'] . '" />' : '', 'href' => isset($aAction['href']) ? ' href="' . htmlspecialchars_adv($aAction['href']) . '"' : '', 'target' => isset($aAction['target']) ? ' target="' . $aAction['target'] . '"' : '', 'on_click' => isset($aAction['onclick']) ? ' onclick="' . $aAction['onclick'] . '"' : '', 'bx_if:hide_active' => array('condition' => !isset($aAction['active']) || $aAction['active'] != 1, 'content' => array()), 'bx_if:hide_inactive' => array('condition' => isset($aAction['active']) && $aAction['active'] == 1, 'content' => array())); } } else { $mixedButtons = $mixedTopItems; } return $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_' . (int) $iIndex . '.html', array('title' => $sTitle, 'bx_repeat:actions' => $mixedButtons, 'content' => $sContent, 'bottom_items' => $sBottomItems)); }
function getBuilderPage() { $aPagesForTemplate = array(array('value' => '', 'title' => _t('_adm_txt_pb_select_page'), 'selected' => empty($this->_sPage) ? 'selected="selected"' : '')); $aPages = $this->_getPages(); foreach ($aPages as $r) { $aPagesForTemplate[] = array('value' => $r['page'], 'title' => htmlspecialchars_adv(_t($r['title'])), 'selected' => $r['page'] == $this->_sPage ? 'selected="selected"' : ''); } $sPagesSelector = $GLOBALS['oAdmTemplate']->parseHtmlByName('mobile_builder_pages_selector.html', array('bx_repeat:pages' => $aPagesForTemplate, 'url' => bx_html_attribute(BX_DOL_URL_ADMIN . 'mobileBuilder.php'))); $sPagesSelector = $GLOBALS['oAdmTemplate']->parseHtmlByName('designbox_top_controls.html', array('top_controls' => $sPagesSelector)); if (empty($this->_sPage)) { $this->addExternalResources(); } return $sPagesSelector . (!empty($this->_sPage) ? parent::getBuilderPage() : MsgBox(_t('_Empty'))); }
function PageCodeTemplates($sResult) { $a = get_templates_array(true); $aTemplates = array(); foreach ($a as $k => $r) { $aTemplates[] = array('key' => $k, 'name' => htmlspecialchars_adv($r['name']), 'ver' => htmlspecialchars_adv($r['ver']), 'vendor' => htmlspecialchars_adv($r['vendor']), 'desc' => $r['desc'], 'bx_if:preview' => array('condition' => (bool) $r['preview'], 'content' => array('img' => $r['preview'])), 'bx_if:no_preview' => array('condition' => !$r['preview'], 'content' => array()), 'bx_if:default' => array('condition' => $k == getParam('template'), 'content' => array()), 'bx_if:make_default' => array('condition' => $k != getParam('template'), 'content' => array('key' => $k)), 'bx_if:delete' => array('condition' => $k != getParam('template') && $k != 'uni' && $k != 'alt', 'content' => array('key' => $k))); } $s = $sResult ? MsgBox($sResult, 10) : ''; $s .= $GLOBALS['oAdmTemplate']->parseHtmlByName('templates.html', array('bx_repeat:templates' => $aTemplates)); $sCode = DesignBoxAdmin($GLOBALS['sPageTitle'], $s, $GLOBALS['aTopItems'], '', 11); if ('on' == getParam('feeds_enable')) { $sCode = $sCode . DesignBoxAdmin(_t('_adm_box_cpt_design_templates'), '<div class="RSSAggrCont" rssid="boonex_unity_market_templates" rssnum="5" member="0">' . $GLOBALS['oFunctions']->loadingBoxInline() . '</div>'); } $GLOBALS['oAdmTemplate']->addJsTranslation(array('_Are_you_sure')); return $sCode; }
function saveMemSettings() { $aDigit = array('expire_notification_days', 'promotion_membership_days'); $aCheck = array('expire_notify_once', 'enable_promotion_membership', 'free_mode'); foreach ($aDigit as $i => $sVal) { if ($_POST[$sVal]) { setparam($sVal, htmlspecialchars_adv($_POST[$sVal])); } } foreach ($aCheck as $i => $sVal) { if ('on' == $_POST[$sVal]) { setparam($sVal, 'on'); } else { setparam($sVal, ''); } } }
protected function getGeneral() { $sJsObject = $this->getPageJsObject(); $oTemplate = BxDolStudioTemplate::getInstance(); $sResult = ''; $sTemplate = getParam('template'); $aTemplates = get_templates_array(true, false); $aTmplVarsTemplates = array(); foreach ($aTemplates as $sUri => $aTemplate) { $sIcon = $this->getModuleIcon($aTemplate, 'store'); $bIcon = strpos($sIcon, '.') === false; $aTmplVarsTemplates[] = array('uri' => $sUri, 'title' => htmlspecialchars_adv($aTemplate['title']), 'version' => htmlspecialchars_adv($aTemplate['version']), 'vendor' => htmlspecialchars_adv($aTemplate['vendor']), 'bx_if:icon' => array('condition' => $bIcon, 'content' => array('icon' => $sIcon)), 'bx_if:image' => array('condition' => !$bIcon, 'content' => array('icon_url' => $sIcon)), 'bx_if:default' => array('condition' => $sUri == $sTemplate, 'content' => array()), 'bx_if:make_default' => array('condition' => $sUri != $sTemplate, 'content' => array('js_object' => $sJsObject, 'uri' => $sUri))); } $sContent = $sResult ? MsgBox($sResult, 10) : ''; $sContent .= $oTemplate->parseHtmlByName('templates.html', array('bx_repeat:templates' => $aTmplVarsTemplates)); return $oTemplate->parseHtmlByName('designer.html', array('js_object' => $this->getPageJsObject(), 'content' => $sContent)); }
/** * Get member info */ public function get($aData) { switch ($this->_sObject) { case 'sys_username': return $aData['NickName']; case 'sys_full_name': return htmlspecialchars_adv($aData['FullName'] ? $aData['FullName'] : $aData['NickName']); case 'sys_first_name': return $aData['FirstName'] ? $aData['FirstName'] : $aData['NickName']; case 'sys_first_name_last_name': return $aData['FirstName'] || $aData['LastName'] ? $aData['FirstName'] . ' ' . $aData['LastName'] : $aData['NickName']; case 'sys_last_name_firs_name': return $aData['FirstName'] || $aData['LastName'] ? $aData['LastName'] . ' ' . $aData['FirstName'] : $aData['NickName']; case 'sys_status_message': return $aData['UserStatusMessage']; case 'sys_age_sex': $s = ('0000-00-00' == $aData['DateOfBirth'] ? '' : _t('_y/o', age($aData['DateOfBirth'])) . ' ') . _t('_' . $aData['Sex']); if ($aData['Couple'] > 0) { $aData2 = getProfileInfo($aData['Couple']); $s .= '<br />' . ('0000-00-00' == $aData2['DateOfBirth'] ? '' : _t('_y/o', age($aData2['DateOfBirth'])) . ' ') . _t('_' . $aData2['Sex']); } return $s; case 'sys_location': return (empty($aData['City']) ? '' : htmlspecialchars_adv($aData['City']) . ', ') . _t($GLOBALS['aPreValues']['Country'][$aData['Country']]['LKey']); case 'sys_avatar_2x': if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) { return false; } return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . 'b' . BX_AVA_EXT : ''; case 'sys_avatar': case 'sys_avatar_icon_2x': if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) { return false; } return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . BX_AVA_EXT : ''; case 'sys_avatar_icon': if (!$aData || !@(include_once BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php')) { return false; } return $aData['Avatar'] ? BX_AVA_URL_USER_AVATARS . $aData['Avatar'] . 'i' . BX_AVA_EXT : ''; } }
/** * Check text for spam. * First it check if IP is whitelisted(or under cron execution or user is admin) - for whitelisted IPs check for spam isn't performed, * then it checks URLs found in text for DNSURI black lists (@see BxAntispamDNSURIBlacklists), * then it checks text in Akismet service (@see BxAntispamAkismet). * It can send report if spam is found or tries to inform caller to block the content (depending on configuration). * * @param $sContent content to check for spam * @param $sIp IP address of content poster * @param $isStripSlashes slashes parameter: * BX_SLASHES_AUTO - automatically detect magic_quotes_gpc setting * BX_SLASHES_NO_ACTION - do not perform any action with slashes * @return true if spam detected and content shouln't be recorded, false if content should be processed as usual. */ public function serviceIsSpam($sContent, $sIp = '', $isStripSlashes = BX_SLASHES_AUTO) { if (defined('BX_DOL_CRON_EXECUTE') || isAdmin()) { return false; } if ($this->serviceIsIpWhitelisted($sIp)) { return false; } if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO) { $sContent = stripslashes($sContent); } $bRet = false; if ('on' == $this->_oConfig->getAntispamOption('uridnsbl_enable')) { $oDNSURIBlacklists = bx_instance('BxAntispamDNSURIBlacklists', array(), $this->_aModule); if ($oDNSURIBlacklists->isSpam($sContent)) { $oDNSURIBlacklists->onPositiveDetection($sContent); $bRet = true; } } if (!$bRet && 'on' == $this->_oConfig->getAntispamOption('akismet_enable')) { $oAkismet = bx_instance('BxAntispamAkismet', array(), $this->_aModule); if ($oAkismet->isSpam($sContent)) { $oAkismet->onPositiveDetection($sContent); $bRet = true; } } if ($bRet && 'on' == $this->_oConfig->getAntispamOption('antispam_report')) { $oProfile = BxDolProfile::getInstance(); $aPlus = array('SpammerUrl' => $oProfile->getUrl(), 'SpammerNickName' => $oProfile->getDisplayName(), 'Page' => htmlspecialchars_adv($_SERVER['PHP_SELF']), 'Get' => print_r($_GET, true), 'Post' => print_r($_POST, true), 'SpamContent' => htmlspecialchars_adv($sContent)); bx_import('BxDolEmailTemplates'); $aTemplate = BxDolEmailTemplates::getInstance()->parseTemplate('bx_antispam_spam_report', $aPlus); if (!$aTemplate) { trigger_error('Email template or translation missing: bx_antispam_spam_report', E_USER_ERROR); } sendMail(getParam('site_email'), $aTemplate['Subject'], $aTemplate['Body']); } if ($bRet && 'on' == $this->_oConfig->getAntispamOption('antispam_block')) { return true; } return false; }
function table($a, $sHighlight = '') { if ($this->_isAjaxOutput) { $table = array(); foreach ($a as $r) { if (!$table) { $table[] = array_keys($r); } $rr = array_values($r); if (false !== strpos($rr[0], ' ')) { $rr[0] = str_replace(' ', '-', $rr[0]); } $table[] = $rr; } return $table; } $sId = md5(time() . rand()); $s = '<table id="' . $sId . '" class="bx_profiler_table">'; $th = ''; foreach ($a as $r) { if (!$th) { foreach ($r as $k => $v) { $th .= "<th>{$k}</th>"; } $s .= "<thead><tr>{$th}</tr></thead><tbody>"; } $s .= '<tr>'; foreach ($r as $k => $v) { $sClass = ''; if ($sHighlight && $k == $sHighlight) { $sClass = ' class="highlight" '; } $s .= "<td {$sClass}>" . htmlspecialchars_adv($v) . "</td>"; } $s .= '</tr>'; } $s .= '</tbody></table>'; $s .= '<script type="text/javascript">$(\'#' . $sId . '\').tablesorter();</script>'; return $s; }
function showEditForm($aItem) { ?> <form onsubmit="if( this.form_input_html ) tinyMCE.execCommand('mceRemoveControl', false, 'form_input_html'); saveItemByPost( <?php echo $aItem['ID']; ?> ); return false;" onreset="if( this.form_input_html ) tinyMCE.execCommand('mceRemoveControl', false, 'form_input_html'); hideEditForm(); return false;" name="formItemEdit" id="formItemEdit"> <table class="popup_form_wrapper"> <tr> <td class="corner"><img src="images/op_cor_tl.png" /></td> <td class="side_ver"><img src="images/spacer.gif" /></td> <td class="corner"><img src="images/op_cor_tr.png" /></td> </tr> <tr> <td class="side"><img src="images/spacer.gif" /></td> <td class="container"> <div class="edit_item_table_cont"> <table class="edit_item_table" id="tmp_id_name" > <tr> <td class="form_label">System Name:</td> <td> <input type="text" class="form_input_text" name="Title" value="<?php echo $aItem['Title']; ?> " /> </td> </tr> <tr> <td class="form_label">Description:</td> <td><?php echo $aItem['Desc']; ?> </td> </tr> <tr> <td class="form_label">Language Key:</td> <td> <input type="text" class="form_input_text" name="Caption" value="<?php echo $aItem['Caption']; ?> " /> </td> </tr> <tr> <td class="form_label">Default Name:</td> <td> <input type="text" class="form_input_text" name="LangCaption" value="<?php echo _t($aItem['Caption']); ?> " /> </td> </tr> <tr> <td class="form_label">Visible for:</td> <td> <input type="checkbox" name="Visible_non" value="on" <?php echo strpos($aItem['Visible'], 'non') === false ? '' : 'checked="checked"'; ?> /> Guest <input type="checkbox" name="Visible_memb" value="on" <?php echo strpos($aItem['Visible'], 'memb') === false ? '' : 'checked="checked"'; ?> /> Member </td> </tr> <?php if ($aItem['Func'] == 'Echo') { ?> <tr> <td class="form_label">HTML-content:</td> <td> </td> </tr> <tr> <td class="form_colspan" colspan="2"> <textarea class="form_input_html" id="form_input_html" name="Content"><?php echo htmlspecialchars_adv($aItem['Content']); ?> </textarea> </td> </tr> <?php } elseif ($aItem['Func'] == 'RSS') { list($sUrl, $iNum) = explode('#', $aItem['Content']); $iNum = (int) $iNum; ?> <tr> <td class="form_label">Url of RSS feed:</td> <td><input type="text" class="form_input_text" name="Url" value="<?php echo $sUrl; ?> " /></td> </tr> <tr> <td class="form_label">Number of RSS items (0 - all):</td> <td><input type="text" class="form_input_text" name="Num" value="<?php echo $iNum; ?> " /></td> </tr> <?php } ?> <tr> <td class="form_colspan" colspan="2"> <input type="submit" value="Save" /> <?php if ($aItem['Deletable']) { ?> <input type="button" onclick="if( deleteItem( <?php echo $aItem['ID']; ?> ) && this.form.form_input_html ) tinyMCE.execCommand('mceRemoveControl', false, 'form_input_html');" value="Delete" /> <?php } ?> <input type="reset" value="Cancel" /> </td> </tr> </table> </div> </td> <td class="side"><img src="images/spacer.gif" /></td> </tr> <tr> <td class="corner"><img src="images/op_cor_bl.png" /></td> <td class="side_ver"><img src="images/spacer.gif" /></td> <td class="corner"><img src="images/op_cor_br.png" onload="if( navigator.appName == 'Microsoft Internet Explorer' && version >= 5.5 && version < 7 ) png_fix();" /></td> </tr> </table> </form> <script type="text/javascript">if( document.forms.formItemEdit.form_input_html ) tinyMCE.execCommand('mceAddControl', false, 'form_input_html');</script> <?php }
/** * Generate User`s Blog Post Page * * @return HTML presentation of data */ function GenPostPage($iParamPostID = 0) { $this->iViewingPostID = $iParamPostID > 0 ? $iParamPostID : $this->iViewingPostID; list($sCode, $bShowBlocks) = $this->getViewingPostInfo(); if (empty($this->aViewingPostInfo)) { header("HTTP/1.1 404 Not Found"); $sMsg = _t('_sys_request_page_not_found_cpt'); $GLOBALS['oTopMenu']->setCustomSubHeader($sMsg); return DesignBoxContent($sMsg, MsgBox($sMsg), 1); } $iBlogLimitChars = (int) getParam('max_blog_preview'); $sPostText = htmlspecialchars_adv(mb_substr(trim(strip_tags($this->aViewingPostInfo['PostText'])), 0, $iBlogLimitChars)); $this->_oTemplate->setPageDescription($sPostText); if (mb_strlen($this->aViewingPostInfo['Tags']) > 0) { $this->_oTemplate->addPageKeywords($this->aViewingPostInfo['Tags']); } $sRetHtml .= $sCode; if ($bShowBlocks) { $oBPV = new BxDolBlogsPageView($this); $sRetHtml .= $oBPV->getCode(); } return $sRetHtml; }
function actionBrowse($sParamName = '', $sParamValue = '', $sParamValue1 = '', $sParamValue2 = '', $sParamValue3 = '') { $bAlbumView = false; if ($sParamName == 'album' && $sParamValue1 == 'owner') { $bAlbumView = true; $aAlbumInfo = $this->oAlbums->getAlbumInfo(array('fileUri' => $sParamValue, 'owner' => getID($sParamValue2))); if (empty($aAlbumInfo)) { $this->_oTemplate->displayPageNotFound(); } else { if (!$this->oAlbumPrivacy->check('album_view', $aAlbumInfo['ID'], $this->_iProfileId)) { $sKey = _t('_' . $this->_oConfig->getMainPrefix() . '_access_denied'); $sCode = DesignBoxContent($sKey, MsgBox($sKey), 1); $this->aPageTmpl['header'] = $sKey; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode)); return; } $GLOBALS['oTopMenu']->setCustomSubHeader(_t('_sys_album_x', $aAlbumInfo['Caption'])); $GLOBALS['oTopMenu']->setCustomSubHeaderUrl(BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'browse/album/' . $aAlbumInfo['Uri'] . '/owner/' . $sParamValue2); $GLOBALS['oTopMenu']->setCustomBreadcrumbs(array(_t('_' . $this->_oConfig->getMainPrefix()) => BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'home/', $aAlbumInfo['Caption'] => '')); if ($aAlbumInfo['Owner'] == $this->_iProfileId && $sParamValue2 === getUsername($this->_iProfileId)) { $this->actionAlbumsViewMy('main_objects', $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); return; } } } if ('calendar' == $sParamName) { $sParamValue = (int) $sParamValue; $sParamValue1 = (int) $sParamValue1; $sParamValue2 = (int) $sParamValue2; } $sClassName = $this->_oConfig->getClassPrefix() . 'Search'; bx_import('Search', $this->_aModule); $oSearch = new $sClassName($sParamName, $sParamValue, $sParamValue1, $sParamValue2); $sRss = bx_get('rss'); if ($sRss !== false && $sRss) { $oSearch->aCurrent['paginate']['perPage'] = 10; header('Content-Type: text/xml; charset=UTF-8'); echo $oSearch->rss(); exit; } $sTopPostfix = isset($oSearch->aCurrent['restriction'][$sParamName]) || $oSearch->aCurrent['sorting'] == $sParamName ? $sParamName : 'all'; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_top_menu_' . $sTopPostfix); if (!empty($sParamValue) && isset($oSearch->aCurrent['restriction'][$sParamName])) { $sParamValue = $this->getBrowseParam($sParamName, $sParamValue); $oSearch->aCurrent['restriction'][$sParamName]['value'] = $sParamValue; $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, htmlspecialchars_adv(process_pass_data($sParamValue))); } if ($bAlbumView) { $oSearch->aCurrent['restriction']['allow_view']['value'] = array($aAlbumInfo['AllowAlbumView']); $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_browse_by_' . $sParamName, $aAlbumInfo['Caption']); $this->_oTemplate->setPageDescription(substr(strip_tags($aAlbumInfo['Description']), 0, 255)); } else { $oSearch->aCurrent['restriction']['not_allow_view']['value'] = array(BX_DOL_PG_HIDDEN); } $oSearch->aCurrent['paginate']['perPage'] = (int) $this->_oConfig->getGlParam('number_all'); $sCode = $oSearch->displayResultBlock(); if ($oSearch->aCurrent['paginate']['totalNum'] > 0) { $sCode = $GLOBALS['oFunctions']->centerContent($sCode, '.sys_file_search_unit'); $sCode = $this->_oTemplate->parseHtmlByName('default_padding_thd.html', array('content' => $sCode)); $aAdd = array($sParamName, $sParamValue, $sParamValue1, $sParamValue2, $sParamValue3); foreach ($aAdd as $sValue) { if (strlen($sValue) > 0) { $sArg .= '/' . rawurlencode($sValue); } else { break; } } $sLink = $this->_oConfig->getBaseUri() . 'browse' . $sArg; $oPaginate = new BxDolPaginate(array('page_url' => $sLink . '&page={page}&per_page={per_page}', 'count' => $oSearch->aCurrent['paginate']['totalNum'], 'per_page' => $oSearch->aCurrent['paginate']['perPage'], 'page' => $oSearch->aCurrent['paginate']['page'], 'on_change_per_page' => 'document.location=\'' . BX_DOL_URL_ROOT . $sLink . '&page=1&per_page=\' + this.value;')); $sPaginate = $oPaginate->getPaginate(); } else { $sCode = MsgBox(_t('_Empty')); } if ($sParamName == 'calendar') { $sCaption = _t('_' . $this->_oConfig->getMainPrefix() . '_caption_browse_by_day') . ': ' . getLocaleDate(strtotime("{$sParamValue}-{$sParamValue1}-{$sParamValue2}"), BX_DOL_LOCALE_DATE_SHORT); } $aMenu = array(); $sCode = DesignBoxContent($sCaption, $sCode . $sPaginate, 1, $this->_oTemplate->getExtraTopMenu($aMenu, BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri())); if ($bAlbumView) { $sCode = $this->getAlbumPageView($aAlbumInfo, $sCode); } $this->aPageTmpl['css_name'] = array('browse.css'); $this->aPageTmpl['header'] = $sCaption; $this->_oTemplate->pageCode($this->aPageTmpl, array('page_main_code' => $sCode)); }
function _error($sType, $sParam1 = '', $sParam2 = '') { header('Status: 404 Not Found'); header('HTTP/1.0 404 Not Found'); global $_page; global $_page_cont; $iIndex = 13; $_page['name_index'] = $iIndex; $_page['header'] = _t("_sys_request_" . $sType . "_not_found_cpt"); $_page_cont[$iIndex]['page_main_code'] = MsgBox(_t("_sys_request_" . $sType . "_not_found_cnt", htmlspecialchars_adv($sParam1), htmlspecialchars_adv($sParam2))); PageCode(); exit; }
function getConditionArray($logged) { $aWhere = array(); $aWhere[] = '1'; $iUser = 0; if (isset($_GET['ownerName'])) { $sName = process_db_input($_GET['ownerName']); $iUser = (int) db_value("SELECT `ID` FROM `Profiles` WHERE `NickName`='{$sName}'"); } elseif (isset($_GET['userID'])) { $iUser = (int) $_GET['userID']; } if ($iUser) { $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medProfId']}`={$iUser}"; } if (isset($_GET['tag'])) { $sTag = htmlspecialchars_adv($_GET['tag']); $aWhere[] = "`{$this->sMainTable}`.`{$this->aTableFields['medTags']}` like '%{$sTag}%'"; } if (isset($_GET['action'])) { $sAct = htmlspecialchars_adv($_GET['action']); switch ($sAct) { case 'fav': $sAddon = $this->getFavoriteCondition($this->iViewer); break; case 'del': $sAddon = ''; if (isset($_GET['fileID'])) { $this->deleteMedia($_GET['fileID'], $logged); } break; } } $aSqlQuery['sqlWhere'] = "WHERE " . implode(' AND ', $aWhere) . $sAddon . " AND `Approved`= 'true'"; $iTotalNum = db_value("SELECT COUNT( * ) FROM `{$this->sMainTable}` {$aSqlQuery['sqlWhere']}"); if (!$iTotalNum) { return false; } $iPerPage = (int) $_GET['per_page']; if (!$iPerPage) { $iPerPage = 10; } $iTotalPages = ceil($iTotalNum / $iPerPage); $iCurPage = (int) $_GET['page']; if ($iCurPage > $iTotalPages) { $iCurPage = $iTotalPages; } if ($iCurPage < 1) { $iCurPage = 1; } $sLimitFrom = ($iCurPage - 1) * $iPerPage; $aSqlQuery['sqlLimit'] = "LIMIT {$sLimitFrom}, {$iPerPage}"; $aSqlQuery['sqlOrder'] = 'ORDER BY `medDate` DESC'; if (isset($_GET['rate'])) { $oVotingView = new BxTemplVotingView('g' . $this->sType, 0, 0); $aSql = $oVotingView->getSqlParts('`' . $this->sMainTable . '`', '`' . $this->aTableFields['medID'] . '`'); $sHow = $_GET['rate'] == 'top' ? "DESC" : "ASC"; $aSqlQuery['sqlOrder'] = $oVotingView->isEnabled() ? "ORDER BY `voting_rate` {$sHow}, `voting_count` {$sHow}, `medDate` {$sHow}" : $aSqlQuery['sqlOrder']; $aSqlQuery['rateFields'] = $aSql['fields']; $aSqlQuery['rateJoin'] = $aSql['join']; } return array('query' => $aSqlQuery, 'total' => $iTotalPages, 'per_page' => $iPerPage, 'cur_page' => $iCurPage); }
function actionUpload($sType, $aFile, $aFtpInfo) { $sLogin = htmlspecialchars_adv(clear_xss($aFtpInfo['login'])); $sPassword = htmlspecialchars_adv(clear_xss($aFtpInfo['password'])); $sPath = htmlspecialchars_adv(clear_xss($aFtpInfo['path'])); setParam('sys_ftp_login', $sLogin); setParam('sys_ftp_password', $sPassword); setParam('sys_ftp_dir', $sPath); $sErrMsg = false; $sName = mktime(); $sAbsolutePath = BX_DIRECTORY_PATH_ROOT . "tmp/" . $sName . '.zip'; $sPackageRootFolder = false; if (!class_exists('ZipArchive')) { $sErrMsg = '_adm_txt_modules_zip_not_available'; } if (!$sErrMsg && $this->_isArchive($aFile['type']) && move_uploaded_file($aFile['tmp_name'], $sAbsolutePath)) { // extract uploaded zip package into tmp folder $oZip = new ZipArchive(); if ($oZip->open($sAbsolutePath) !== TRUE) { $sErrMsg = '_adm_txt_modules_cannot_unzip_package'; } if (!$sErrMsg) { $sPackageRootFolder = $oZip->numFiles > 0 ? $oZip->getNameIndex(0) : false; if (file_exists(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder)) { // remove existing tmp folder with the same name bx_rrmdir(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder); } if ($sPackageRootFolder && !$oZip->extractTo(BX_DIRECTORY_PATH_ROOT . 'tmp/')) { $sErrMsg = '_adm_txt_modules_cannot_unzip_package'; } $oZip->close(); } // upload files to the correct folder via FTP if (!$sErrMsg && $sPackageRootFolder) { $oFtp = new BxDolFtp($_SERVER['HTTP_HOST'], $sLogin, $sPassword, $sPath); if (!$oFtp->connect()) { $sErrMsg = '_adm_txt_modules_cannot_connect_to_ftp'; } if (!$sErrMsg && !$oFtp->isDolphin()) { $sErrMsg = '_adm_txt_modules_destination_not_valid'; } if (!$sErrMsg) { $sConfigPath = BX_DIRECTORY_PATH_ROOT . "tmp/" . $sPackageRootFolder . $this->_aTypesConfig[$sType]['configfile']; if (file_exists($sConfigPath)) { include $sConfigPath; $sConfigVar = !empty($this->_aTypesConfig[$sType]['configvarindex']) ? ${$this->_aTypesConfig[$sType]['configvar']}[$this->_aTypesConfig[$sType]['configvarindex']] : ${$this->_aTypesConfig[$sType]['configvar']}; $sSubfolder = $this->_aTypesConfig[$sType]['subfolder']; $sSubfolder = str_replace('{configvar}', $sConfigVar, $sSubfolder); $sSubfolder = str_replace('{packagerootfolder}', $sPackageRootFolder, $sSubfolder); if (!$oFtp->copy(BX_DIRECTORY_PATH_ROOT . "tmp/" . $sPackageRootFolder . '/', $this->_aTypesConfig[$sType]['folder'] . $sSubfolder)) { $sErrMsg = '_adm_txt_modules_ftp_copy_failed'; } } else { $sErrMsg = '_adm_txt_modules_wrong_package_format'; } } } else { $sErrMsg = '_adm_txt_modules_cannot_unzip_package'; } // remove temporary files bx_rrmdir(BX_DIRECTORY_PATH_ROOT . 'tmp/' . $sPackageRootFolder); unlink($sAbsolutePath); } else { $sErrMsg = '_adm_txt_modules_cannot_upload_package'; } return $sErrMsg ? $sErrMsg : '_adm_txt_modules_success_upload'; }
/** * Get standard popup box. * * @param string $sTitle - translated title * @param string $sContent - content of the box * @param array $aActions - an array of actions. See an example below. * @return string HTML of Standard Popup Box * * @see Example of actions * $aActions = array( * 'a1' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript: changeType(this)', 'class' => 'wall-ptype-ctl', 'icon' => 'post_text.png', 'title' => _t('_title_a1'), 'active' => 1), * 'a2' => array('href' => 'javascript:void(0)', 'onclick' => 'javascript: changeType(this)', 'class' => 'wall-ptype-ctl', 'icon' => 'post_text.png', 'title' => _t('_title_a2')) * ); */ function popupBox($sName, $sTitle, $sContent, $aActions = array()) { $iId = !empty($sName) ? $sName : mktime(); $aButtons = array(); foreach ($aActions as $sId => $aAction) { $aButtons[] = array('id' => $sId, 'title' => htmlspecialchars_adv(_t($aAction['title'])), 'class' => isset($aAction['class']) ? ' class="' . $aAction['class'] . '"' : '', 'icon' => isset($aAction['icon']) ? '<img src="' . $aAction['icon'] . '" />' : '', 'href' => isset($aAction['href']) ? ' href="' . htmlspecialchars_adv($aAction['href']) . '"' : '', 'target' => isset($aAction['target']) ? ' target="' . $aAction['target'] . '"' : '', 'on_click' => isset($aAction['onclick']) ? ' onclick="' . $aAction['onclick'] . '"' : '', 'bx_if:hide_active' => array('condition' => !isset($aAction['active']) || $aAction['active'] != 1, 'content' => array()), 'bx_if:hide_inactive' => array('condition' => isset($aAction['active']) && $aAction['active'] == 1, 'content' => array())); } return $GLOBALS['oSysTemplate']->parseHtmlByName('popup_box.html', array('id' => $iId, 'title' => $sTitle, 'bx_repeat:actions' => $aButtons, 'content' => $sContent)); }
function genRSSHtmlOut($sUrl, $iNum = 0) { $php_date_format = getParam('php_date_format'); $oRSS = new BxRSS($sUrl); if (!$oRSS) { return ''; } ob_start(); ?> <div class="rss_feed_wrapper"> <?php $iCounter = 0; foreach ($oRSS->items as $oItem) { $sDate = date($php_date_format, strtotime($oItem->pubDate)); ?> <div class="rss_item_wrapper"> <div class="rss_item_header"> <a href="<?php echo $oItem->link; ?> "><?php echo htmlspecialchars_adv($oItem->title); ?> </a> </div> <div class="rss_item_info"> <span><img src="<?php echo getTemplateIcon('clock.gif'); ?> " /><?php echo $sDate; ?> </span> </div> <div class="rss_item_desc"> <?php echo htmlspecialchars_adv($oItem->description); ?> </div> </div> <?php $iCounter++; if ($iNum != 0 and $iCounter >= $iNum) { break; } } ?> <div class="rss_read_more"> <a href="<?php echo $oRSS->link; ?> "><?php echo _t('_Visit Source'); ?> </a> </div> </div> <?php return ob_get_clean(); }
function copyLanguage() { $newLangName = get_magic_quotes_gpc() ? $_POST['CopyLanguage_Name'] : addslashes($_POST['CopyLanguage_Name']); $sFlag = htmlspecialchars_adv($_POST['Flag']); $sourceLangID = (int) $_POST['CopyLanguage_SourceLangID']; if (strlen($newLangName) <= 0) { return '<font color="red">Error: please specify a name for the new language.</font>'; } mysql_query("\r\n\t\t\tINSERT INTO `LocalizationLanguages`\r\n\t\t\t(`Name`, `Flag`) VALUES\r\n\t\t\t('{$newLangName}', '{$sFlag}')\r\n\t\t"); if (mysql_affected_rows() <= 0) { return '<font color="red">Error: could not add a new language to the database.</font>'; } $newLangID = mysql_insert_id(); $resSourceLangStrings = mysql_query("\r\n\t\t\tSELECT\t`IDKey`, `String`\r\n\t\t\tFROM\t`LocalizationStrings`\r\n\t\t\tWHERE\t`IDLanguage` = {$sourceLangID}\r\n\t\t"); while ($arr = mysql_fetch_assoc($resSourceLangStrings)) { $arr['String'] = addslashes($arr['String']); mysql_query("\r\n\t\t\t\tINSERT INTO `LocalizationStrings`\r\n\t\t\t\t(`IDKey`, `IDLanguage`, `String`) VALUES\r\n\t\t\t\t('{$arr['IDKey']}', {$newLangID}, '{$arr['String']}')\r\n\t\t\t\t"); if (mysql_affected_rows() <= 0) { return '<font color="red">Error: could not add a language string to the database.</font>'; } } return '<font color="green"><b>' . htmlspecialchars(stripslashes($newLangName)) . '</b> language has been successfully created.</font>'; }
} if (strlen($sex)) { $sex_part = "AND Sex = '" . process_db_input($sex, 1) . "'"; } if (strlen($search)) { if ($_GET['s_mail']) { $email_part = " AND `Email` LIKE '%{$search}%' "; } elseif ($_GET['s_nickname']) { $email_part = " AND `NickName` LIKE '%{$search}%' "; } elseif ($_GET[s_id]) { $email_part = " AND `Profiles`.`ID` = '{$search}' "; } } if (isset($_GET['media']) && isset($_GET['status'])) { $sType = htmlspecialchars_adv($_GET['media']); $sStatus = htmlspecialchars_adv($_GET['status']); $sqlJoinPart = "LEFT JOIN `media` ON (`media`.`med_prof_id` = `Profiles`.`ID`)"; $sqlWhere = " AND `med_status` = '{$sStatus}' AND `med_type`='{$sType}'"; $sqlGroup = " GROUP BY `Profiles`.`ID`"; } $sqlCouple = "(`Couple`=0 OR `Couple`>`Profiles`.`ID`)"; $sqlWhere .= ' AND ' . $sqlCouple; // ------------------------------ $sQuery = "SELECT `Profiles`.`ID` as `ID`, \r\n\t\t\t\t `NickName`,\r\n\t\t\t\t `Email`,\r\n\t\t\t\t `Sex`,\r\n\t\t\t\t DATE_FORMAT(`DateLastLogin`, '{$date_format}' ) AS `DateLastLoginCur`,\r\n\t\t\t\t DATE_FORMAT(`DateReg`, '{$date_format}' ) AS `DateReg`,\r\n\t\t\t\t `Status`\r\n\t\t\t\t {$sMemField}\r\n\t\t\t\t FROM `Profiles` {$aff_part_f}\r\n \t\t\t\t {$sqlJoinPart}\r\n\t\t\t\t {$sMemJoin}\r\n\t\t\t\t WHERE 1 {$email_part} {$aff_part_w} {$prof_part} {$sex_part} {$sqlWhere} {$sqlGroup}"; $rData = db_res($sQuery); $p_num = mysql_num_rows($rData); $pages_num = ceil($p_num / $p_per_page); $real_first_p = (int) ($page - 1) * $p_per_page; $page_first_p = $real_first_p + 1; /* checking for incoming value for sort order * if we open this page without sortor param
function getBlockCode_Description() { global $oSysTemplate; $sName = 'DescriptionMe'; $oPF = new BxDolProfileFields(2); if (!$oPF->aBlocks) { return ''; } $aItem = false; foreach ($oPF->aBlocks as $aBlock) { foreach ($aBlock['Items'] as $a) { if ($sName == $a['Name']) { $aItem = $a; break 2; } } } $aProfileInfo = getProfileInfo($this->oProfileGen->_iProfileID); if (!trim($aProfileInfo[$sName])) { return MsgBox(_t('_Empty')); } return array($aItem ? $oPF->getViewableValue($aItem, $aProfileInfo[$sName]) : htmlspecialchars_adv($aProfileInfo[$sName])); }
function displaySearchUnit($aResSQL) { $iVisitorID = getLoggedId(); $oMain = $this->getBlogsMain(); $iPostID = (int) $aResSQL['id']; $sBlogsImagesUrl = BX_BLOGS_IMAGES_URL; $bPossibleToView = $oMain->oPrivacy->check('view', $iPostID, $oMain->_iVisitorID); if (!$bPossibleToView) { if ($this->sMobileWrapper) { return $this->_wrapMobileUnit($oMain->_oTemplate->parseHtmlByTemplateName('browse_unit_private_mobile', array()), $iPostID, $oMain); } else { return $oMain->_oTemplate->parseHtmlByName('browse_unit_private.html', array('extra_css_class' => '')); } } $sCategories = $aResSQL['Categories']; $aCategories = $oMain->getTagLinks($aResSQL['Categories'], 'category', CATEGORIES_DIVIDER); $sStyle = ''; $sFriendStyle = ''; $sPostVote = ''; $sPostMode = ''; $sVotePostRating = $this->oRate->getJustVotingElement(0, 0, $aResSQL['Rate']); $aProfileInfo = getProfileInfo($aResSQL['ownerId']); $sAuthorTitle = process_line_output(getNickName($aProfileInfo['ID'])); $sAuthorUsername = getUsername($aProfileInfo['ID']); $sAuthorLink = getProfileLink($aProfileInfo['ID']); $sCategoryName = $aResSQL['Categories']; $sPostLink = $this->getCurrentUrl('file', $iPostID, $aResSQL['uri']) . $sCategoryUrlAdd; $sAllCategoriesLinks = ''; if (count($aCategories) > 0) { foreach ($aCategories as $iKey => $sCatValue) { $sCatLink = $this->getCurrentUrl('category', title2uri($sCatValue), title2uri($sCatValue), array('ownerId' => $aResSQL['ownerId'], 'ownerName' => $sAuthorUsername)); $sCatName = process_line_output($sCatValue); $aAllCategoriesLinks[] = '<a href="' . $sCatLink . '">' . $sCatName . '</a>'; } $aAllCategoriesLinkHrefs = implode(", ", $aAllCategoriesLinks); $sAllCategoriesLinks = <<<EOF <span class="margined"> <span>{$aAllCategoriesLinkHrefs}</span> </span> EOF; } $sAdminCheck = $sAdminStatus = ''; if ($this->bShowCheckboxes) { $sAdminCheck = <<<EOF <div class="browseCheckbox"><input id="ch{$iPostID}" type="checkbox" name="bposts[]" value="{$iPostID}" /></div> EOF; $sPostStatus = process_line_output($aResSQL['PostStatus']); $sAdminStatus = <<<EOF ({$sPostStatus}) EOF; } $sPostCaption = process_line_output($aResSQL['title']); $sPostCaptionHref = <<<EOF <a class="unit_title bx-def-font-h2" href="{$sPostLink}">{$sPostCaption}</a>{$sAdminStatus} EOF; if ($this->iPostViewType == 3 || $this->sMobileWrapper) { $sFriendStyle = "2"; $sPostMode = '_post'; $sPostCaptionHref = '<div class="unit_title bx-def-font-h2">' . $sPostCaption . '</div>'; } $sDateTime = defineTimeInterval($aResSQL['date']); //$oCmtsView = new BxTemplCmtsView ('blogposts', (int)$iPostID); $iCommentsCnt = (int) $aResSQL['CommentsCount']; $sTagsCommas = $aResSQL['tag']; //$aTags = split(',', $sTagsCommas); $aTags = preg_split("/[;,]/", $sTagsCommas); //search by tag skiping if ($this->sSearchedTag != '' && in_array($this->sSearchedTag, $aTags) == false) { return; } $sTagsHrefs = ''; $aTagsHrefs = array(); foreach ($aTags as $sTagKey) { if ($sTagKey != '') { $sTagLink = $this->getCurrentUrl('tag', $iPostID, htmlspecialchars(title2uri($sTagKey))); $sTagsHrefAny = <<<EOF <a href="{$sTagLink}" title="{$sTagKey}">{$sTagKey}</a> EOF; $aTagsHrefs[] = $sTagsHrefAny; } } $sTagsHrefs = implode(", ", $aTagsHrefs); $sTags = <<<EOF <span class="margined"> <span>{$sTagsHrefs}</span> </span> EOF; $sPostText = $aResSQL['bodyText']; $bOwner = $iVisitorID == $aResSQL['ownerId'] ? true : false; $sOwnerThumb = $sPostPicture = $sPreviewPicture = ''; if ($aResSQL['PostPhoto'] && $this->iPostViewType == 3) { $oMain->_oTemplate->addJs('plugins/fancybox/|jquery.fancybox.js'); $oMain->_oTemplate->addCss('plugins/fancybox/|jquery.fancybox.css'); $sPostPicture = $oMain->_oTemplate->parseHtmlByName('picture_preview.html', array('img_url_big' => $sBlogsImagesUrl . 'orig_' . $aResSQL['PostPhoto'], 'img_url_small' => $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto'])); } if ($aResSQL['PostPhoto'] && ($this->iPostViewType == 1 || $this->iPostViewType == 4 || $this->iPostViewType == 5)) { $sStyle = 'padding-right:' . ($this->iThumbSize + 10) . 'px; min-height:' . $this->iThumbSize . 'px;'; $sPreviewPicture = '<div class="unit_img"><img class="bx-def-shadow bx-def-round-corners" src="' . $sBlogsImagesUrl . 'big_' . $aResSQL['PostPhoto'] . '" /></div>'; } if ($this->iPostViewType == 4) { $sOwnerThumb = $GLOBALS['oFunctions']->getMemberIcon($aResSQL['ownerId'], 'left'); } if ($this->iPostViewType == 4 || $this->iPostViewType == 1 || $this->iPostViewType == 5) { $iBlogLimitChars = (int) getParam('max_blog_preview'); $sPostText = trim(strip_tags($sPostText)); if (mb_strlen($sPostText) > $iBlogLimitChars) { $sPostText = mb_substr($sPostText, 0, $iBlogLimitChars); $sLinkMore = $this->sMobileWrapper ? '' : ' <a title="' . htmlspecialchars_adv(_t('_Read more')) . '" href="' . $sPostLink . '">…</a>'; } $sPostText = htmlspecialchars_adv($sPostText) . $sLinkMore; } $aUnitReplace = array('checkbox' => $sAdminCheck, 'post_caption' => $sPostCaptionHref, 'author_title' => $sAuthorTitle, 'author_username' => $sAuthorUsername, 'author_link' => $sAuthorLink, 'post_date' => $sDateTime, 'all_categories' => $sAllCategoriesLinks, 'comments_count' => $iCommentsCnt, 'post_tags' => $sTags, 'friend_style' => $sFriendStyle, 'post_uthumb' => $sOwnerThumb, 'post_picture2' => $sPostPicture, 'preview_picture' => $sPreviewPicture, 'post_description' => $sPostText, 'post_vote' => $sVotePostRating, 'post_mode' => $sPostMode, 'style' => $sStyle, 'bx_if:full' => array('condition' => $this->iPostViewType != 5, 'content' => array('author_title' => $sAuthorTitle, 'author_username' => $sAuthorUsername, 'author_link' => $sAuthorLink, 'post_date' => $sDateTime))); if ($this->sMobileWrapper) { return $this->_wrapMobileUnit($oMain->_oTemplate->parseHtmlByTemplateName('blogpost_unit_mobile', $aUnitReplace), $iPostID, $oMain); } else { return $oMain->_oTemplate->parseHtmlByTemplateName('blogpost_unit', $aUnitReplace); } }
function showEditForm($aItem, $sMenuSection) { $aForm = array('form_attrs' => array('id' => 'formItemEdit', 'name' => 'formItemEdit', 'action' => $GLOBALS['site']['url_admin'] . 'member_menu_compose.php', 'method' => 'post', 'enctype' => 'multipart/form-data'), 'inputs' => array('Name' => array('type' => 'text', 'name' => 'Name', 'caption' => _t('_adm_mbuilder_System_Name'), 'value' => $aItem['Name'], 'attrs' => array()), 'Caption' => array('type' => 'text', 'name' => 'Caption', 'caption' => _t('_adm_mbuilder_Language_Key'), 'value' => $aItem['Caption'], 'attrs' => array()), 'LangCaption' => array('type' => 'text', 'name' => 'LangCaption', 'caption' => _t('_adm_mbuilder_Default_Name'), 'value' => _t($aItem['Caption']), 'attrs' => array()), 'Link' => array('type' => 'text', 'name' => 'Link', 'caption' => _t('_URL'), 'value' => htmlspecialchars_adv($aItem['Link']), 'attrs' => array()), 'Script' => array('type' => 'text', 'name' => 'Script', 'caption' => _t('_adm_mbuilder_script'), 'value' => htmlspecialchars_adv($aItem['Script']), 'attrs' => array()), 'Icon' => array('type' => 'text', 'name' => 'Icon', 'caption' => _t('_adm_mbuilder_icon'), 'value' => htmlspecialchars_adv($aItem['Icon']), 'attrs' => array()), 'Target' => array('type' => 'radio_set', 'name' => 'Target', 'caption' => _t('_adm_mbuilder_Target_Window'), 'value' => $aItem['Target'] == '_blank' ? '_blank' : '_self', 'values' => array('_self' => _t('_adm_mbuilder_Same'), '_blank' => _t('_adm_mbuilder_New')), 'attrs' => array()), 'submit' => array('type' => 'input_set', array('type' => 'button', 'name' => 'save', 'value' => _t('_Save Changes'), 'attrs' => array('onclick' => 'javascript:saveItem(' . $aItem['ID'] . ');')), array('type' => 'button', 'name' => 'delete', 'value' => _t('_Delete'), 'attrs' => array('onclick' => 'javascript:deleteItem(' . $aItem['ID'] . ');'))))); foreach ($aForm['inputs'] as $sKey => $aInput) { if (in_array($aInput['type'], array('text', 'checkbox')) && !$aItem['Editable']) { $aForm['inputs'][$sKey]['attrs']['disabled'] = "disabled"; } } if (strpos($aItem['Visible'], 'non') !== false) { $aForm['inputs']['Visible']['value'][] = 'non'; } if (strpos($aItem['Visible'], 'memb') !== false) { $aForm['inputs']['Visible']['value'][] = 'memb'; } $oForm = new BxTemplFormView($aForm); return PopupBox('mmc_edit_popup', _t('_adm_mbuilder_edit_item'), $GLOBALS['oAdmTemplate']->parseHtmlByName('design_box_content.html', array('content' => $oForm->getCode() . LoadingBox('formItemEditLoading')))); }
/** * spam checking function * @param $s content to check for spam * @param $isStripSlashes slashes parameter: * BX_SLASHES_AUTO - automatically detect magic_quotes_gpc setting * BX_SLASHES_NO_ACTION - do not perform any action with slashes * @return true if spam detected */ function bx_is_spam($val, $isStripSlashes = BX_SLASHES_AUTO) { if (defined('BX_DOL_CRON_EXECUTE')) { return false; } if (isAdmin()) { return false; } if (bx_is_ip_whitelisted()) { return false; } if (get_magic_quotes_gpc() && $isStripSlashes == BX_SLASHES_AUTO) { $val = stripslashes($val); } $bRet = false; if ('on' == getParam('sys_uridnsbl_enable')) { $oBxDolDNSURIBlacklists = bx_instance('BxDolDNSURIBlacklists'); if ($oBxDolDNSURIBlacklists->isSpam($val)) { $oBxDolDNSURIBlacklists->onPositiveDetection($val); $bRet = true; } } if ('on' == getParam('sys_akismet_enable')) { $oBxDolAkismet = bx_instance('BxDolAkismet'); if ($oBxDolAkismet->isSpam($val)) { $oBxDolAkismet->onPositiveDetection($val); $bRet = true; } } if ($bRet && 'on' == getParam('sys_antispam_report')) { bx_import('BxDolEmailTemplates'); $oEmailTemplates = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplates->getTemplate('t_SpamReportAuto', 0); $iProfileId = getLoggedId(); $aPlus = array('SpammerUrl' => getProfileLink($iProfileId), 'SpammerNickName' => getNickName($iProfileId), 'Page' => htmlspecialchars_adv($_SERVER['PHP_SELF']), 'Get' => print_r($_GET, true), 'SpamContent' => htmlspecialchars_adv($val)); sendMail($GLOBALS['site']['email'], $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus); } if ($bRet && 'on' == getParam('sys_antispam_block')) { return true; } return false; }
function genErrorIcon($sError = '') { if (!$this->bEnableErrorIcon) { return ''; } $sErrorH = ' '; // it has space because jquery doesnt accept it if it is empty if ($sError) { $sError = str_replace("\n", "\\n", $sError); $sError = str_replace("\r", "", $sError); $sErrorH = htmlspecialchars_adv($sError); } return '<i class="warn sys-icon exclamation-sign" float_info="' . $sErrorH . '"></i>'; }
function getViewableSelectSet($mValues, $sValue, $sUseLKey = 'LKey') { global $aPreValues; if (is_string($mValues) and substr($mValues, 0, 2) == $this->sLinkPref) { $sKey = substr($mValues, 2); if (!isset($aPreValues[$sKey])) { return ' '; } $aValues = explode(',', $sValue); $aTValues = array(); foreach ($aValues as $sValue) { $aTValues[] = _t($aPreValues[$sKey][$sValue][$sUseLKey]); } return htmlspecialchars_adv(implode(', ', $aTValues)); } elseif (is_array($mValues)) { $aValues = array(); foreach (explode(',', $sValue) as $sValueOne) { $aValues[] = _t("_FieldValues_{$sValueOne}"); } //$aValues[] = _t( "_$sValueOne" ); return htmlspecialchars_adv(implode(', ', $aValues)); } else { return ''; } }
function fillXmlNodeWithDBData(&$xmlNode, $dbResource, $objectName) { if (!$dbResource) { return; } while ($arrObject = mysql_fetch_assoc($dbResource)) { $objectNode = new XmlNode(); $objectNode->name = $objectName; foreach ($arrObject as $dataName => $dataValue) { if ($_GET['applylang'] and $dataName == 'Name') { $dataValue = _t($_GET['applylang'] . $dataValue); } $dataName = htmlspecialchars_adv($dataName); $dataValue = htmlspecialchars(htmlspecialchars($dataValue)); $objectDataNode = new XmlNode(); $objectDataNode->name = $dataName; $objectDataNode->value = $dataValue; $objectNode->addChild($objectDataNode); } $xmlNode->addChild($objectNode); } }
deleteMedia((int) $iVal, $sType); break; case isset($_POST['Approve']): approveMedia((int) $iVal, $sType); break; } } } $aWhere = array(); $aWhere[] = '1'; if (isset($_GET['userID'])) { $iUser = (int) $_GET['userID']; $aWhere[] = "`a`.`medProfId`={$iUser}"; } if (isset($_GET['tag'])) { $sTag = htmlspecialchars_adv($_GET['tag']); $aWhere[] = "`a`.`medTags` like '%{$sTag}%'"; } $sqlWhere = "WHERE " . implode(', ', $aWhere); $iTotalNum = db_value("SELECT COUNT( * ) FROM `Ray" . $sType . "Files` AS `a` {$sqlWhere}"); if (!$iTotalNum) { $sCode .= '<div>There is no files</div>'; } $iPerPage = 10; $iTotalPages = ceil($iTotalNum / $iPerPage); $iCurPage = (int) $_GET['page']; if ($iCurPage > $iTotalPages) { $iCurPage = $iTotalPages; } if ($iCurPage < 1) { $iCurPage = 1;
/** * Generate User`s Blog Post Page * * @return HTML presentation of data */ function GenPostPage($iParamPostID = 0) { $this->iViewingPostID = $iParamPostID > 0 ? $iParamPostID : $this->iViewingPostID; list($sCode, $bShowBlocks) = $this->getViewingPostInfo(); $iBlogLimitChars = (int) getParam('max_blog_preview'); $sPostText = htmlspecialchars_adv(mb_substr(trim(strip_tags($this->aViewingPostInfo['PostText'])), 0, $iBlogLimitChars)); $this->_oTemplate->setPageDescription($sPostText); if (mb_strlen($this->aViewingPostInfo['Tags']) > 0) { $this->_oTemplate->addPageKeywords($this->aViewingPostInfo['Tags']); } $sRetHtml .= $sCode; if ($bShowBlocks) { $oBPV = new BxDolBlogsPageView($this); $sRetHtml .= $oBPV->getCode(); } return $sRetHtml; }