/** * Controller */ public function process() { $sCountryChildValue = $this->getParam('country_child_value'); $mCountryChildFilter = $this->getParam('country_child_filter', $this->request()->get('country_child_filter', null)); $sCountryChildType = $this->getParam('country_child_type', null); $sCountryChildId = null; if (empty($sCountryChildValue) && Phpfox::isUser() && $mCountryChildFilter === null && !$this->getParam('country_not_user')) { $sCountryChildValue = Phpfox::getUserBy('country_iso'); } $iSearchId = 0; if ($mCountryChildFilter !== null) { $search = $this->request()->get('search'); if (Phpfox::isAdminPanel() && isset($search['country'])) { $sCountryChildValue = $search['country']; $sCountryChildId = isset($search['country_child_id']) ? $search['country_child_id'] : ''; } else { $iSearchId = $this->request()->get('search-id'); if (!empty($iSearchId) && isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country'])) { $sCountryChildValue = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country']; } if (isset($_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id'])) { $sCountryChildId = $_SESSION[Phpfox::getParam('core.session_prefix')]['search'][$sCountryChildType][$iSearchId]['country_child_id']; } } } /* Last resort, get is a little heavy but controller didnt provide a child country*/ /* if ($sCountryChildId == null && $this->getParam('country_child_id') == null) { $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true); $sCountryChildId = $aUser['country_child_id']; } */ $this->template()->assign(array('aCountryChildren' => Phpfox::getService('core.country')->getChildren($sCountryChildValue), 'iCountryChildId' => (int) $this->getParam('country_child_id', $sCountryChildId), 'bForceDiv' => $this->getParam('country_force_div', false), 'mCountryChildFilter' => $mCountryChildFilter)); }
private function _checkIsThisAViewDetailRequest() { /** * Check if we are going to view an actual fundraising instead of the fundraising index page. * The 2nd URL param needs to be numeric. */ if ($this->_aParentModule === null && $this->request()->getInt('req2') && !Phpfox::isAdminPanel()) { return true; } else { return false; } }
/** * Controller */ public function process() { if (!Phpfox::isAdminPanel()) { $sCurrentCategory = $this->getParam('sCurrentCategory', null); $aCategories = Phpfox::getService('photo.category')->getForBrowse($sCurrentCategory, $this->getParam('sPhotoCategorySubSystem', null)); if (empty($aCategories)) { return false; } $aCallback = $this->getParam('aCallback', false); if ($aCallback !== false && is_array($aCategories)) { $sHomeUrl = '/' . Phpfox_Url::instance()->doRewrite($aCallback['url_home_array'][0]) . '/' . implode('/', $aCallback['url_home_array'][1]) . '/' . Phpfox_Url::instance()->doRewrite('photo') . '/'; foreach ($aCategories as $iKey => $aCategory) { $aCategories[$iKey]['url'] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('photo') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory['url']); if (isset($aCategory['sub'])) { foreach ($aCategory['sub'] as $iSubKey => $aSubCategory) { $aCategories[$iKey]['sub'][$iSubKey]['url'] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('photo') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aSubCategory['url']); } } } } if (!is_array($aCategories)) { return false; } $this->template()->assign(array('aCategories' => $aCategories, 'sHeader' => $this->getParam('hasSubCategories') ? Phpfox::getPhrase('photo.subcategories') : Phpfox::getPhrase('photo.categories'))); return 'block'; } if ($this->getParam('bIsTagSearch') === true) { return false; } $aCallback = $this->getParam('aCallback', null); $sCategories = Phpfox::getService('photo.category')->get($this->getParam('anchor', true)); if ($aCallback !== null) { $sCategories = preg_replace('/href=\\"(.*?)\\/photo\\/(.*?)\\"/i', 'href="' . Phpfox_Url::instance()->makeUrl($aCallback['url_home']) . '\\2"', $sCategories); } $this->template()->assign(array('sHeader' => Phpfox::getPhrase('photo.categories'), 'sCategories' => $sCategories, 'bParent' => $this->getParam('parent', true))); }
/** * Class process method wnich is used to execute this component. */ public function process() { $aParentModule = $this->getParam('aParentModule'); if ($aParentModule === null && $this->request()->getInt('req2') > 0) { if ($this->request()->get('req1') == 'pages' && Phpfox::isModule('pages') == false || $aParentModule['module_id'] == 'pages' && Phpfox::getService('pages')->hasPerm($aParentModule['item_id'], 'blog.view_browse_blog') == false) { return Phpfox_Error::display(Phpfox::getPhrase('blog.cannot_display_due_to_privacy')); } return Phpfox::getLib('module')->setController('blog.view'); } if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) { Phpfox::getService('core')->getLegacyItem(array('field' => array('blog_id', 'title'), 'table' => 'blog', 'redirect' => 'blog', 'title' => $sLegacyTitle, 'search' => 'title')); } if ($this->request()->get('req2') == 'main') { return Phpfox::getLib('module')->setController('error.404'); } ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_start')) ? eval($sPlugin) : false; if (($iRedirectId = $this->request()->get('redirect')) && ($aRedirectBlog = Phpfox::getService('blog')->getBlogForEdit($iRedirectId))) { Phpfox::permalink('blog', $aRedirectBlog['blog_id'], $aRedirectBlog['title'], true); } Phpfox::getUserParam('blog.view_blogs', true); if (defined('PHPFOX_IS_AJAX_CONTROLLER')) { $bIsProfile = true; $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id')); $this->setParam('aUser', $aUser); } else { $bIsProfile = $this->getParam('bIsProfile'); if ($bIsProfile === true) { $aUser = $this->getParam('aUser'); $this->search()->setCondition('AND blog.user_id = ' . $aUser['user_id']); } } /** * Check if we are going to view an actual blog instead of the blog index page. * The 2nd URL param needs to be numeric. */ if (!Phpfox::isAdminPanel()) { if ($this->request()->getInt('req2') > 0 && !isset($aParentModule['module_id'])) { /** * Since we are going to be viewing a blog lets reset the controller and get out of this one. */ return Phpfox::getLib('module')->setController('blog.view'); } } if ($this->request()->get('req2') == 'category' && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle) && !is_numeric($sLegacyTitle)) { $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'blog_category', 'redirect' => 'blog.category', 'title' => $sLegacyTitle, 'search' => 'name_url')); } /** * This creates a global variable that can be used in other components. This is a good way to * pass information to other components. */ $this->setParam('sTagType', 'blog'); $this->template()->setTitle($bIsProfile ? Phpfox::getPhrase('blog.full_name_s_blogs', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('blog.blog_title'))->setBreadCrumb($bIsProfile ? Phpfox::getPhrase('blog.blogs') : Phpfox::getPhrase('blog.blog_title'), $bIsProfile ? $this->url()->makeUrl($aUser['user_name'], 'blog') : $this->url()->makeUrl('blog')); $sView = $this->request()->get('view'); $this->search()->set(array('type' => 'blog', 'field' => 'blog.blog_id', 'search_tool' => array('table_alias' => 'blog', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('blog', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('blog', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('blog.search_blogs_dot'), 'name' => 'search', 'field' => array('blog.title', 'blog_text.text')), 'sort' => array('latest' => array('blog.time_stamp', Phpfox::getPhrase('blog.latest')), 'most-viewed' => array('blog.total_view', Phpfox::getPhrase('blog.most_viewed')), 'most-liked' => array('blog.total_like', Phpfox::getPhrase('blog.most_liked')), 'most-talked' => array('blog.total_comment', Phpfox::getPhrase('blog.most_discussed'))), 'show' => array(5, 10, 15)))); $aBrowseParams = array('module_id' => 'blog', 'alias' => 'blog', 'field' => 'blog_id', 'table' => Phpfox::getT('blog'), 'hide_view' => array('pending', 'my')); $aFilterMenu = array(); if (!defined('PHPFOX_IS_USER_PROFILE') && !isset($aParentModule['module_id'])) { $aFilterMenu = array(Phpfox::getPhrase('blog.all_blogs') => '', Phpfox::getPhrase('blog.my_blogs') => 'my'); if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend')) { $aFilterMenu[Phpfox::getPhrase('blog.friends_blogs')] = 'friend'; } if (Phpfox::getUserParam('blog.can_approve_blogs')) { $iPendingTotal = Phpfox::getService('blog')->getPendingTotal(); if ($iPendingTotal) { $aFilterMenu[Phpfox::getPhrase('blog.pending_blogs') . (Phpfox::getUserParam('blog.can_approve_blogs') ? '<span class="pending">' . $iPendingTotal . '</span>' : 0)] = 'pending'; } } } ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_search')) ? eval($sPlugin) : false; $this->template()->buildSectionMenu('blog', $aFilterMenu); switch ($sView) { case 'spam': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 9'); } break; case 'pending': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 0'); } break; case 'my': Phpfox::isUser(true); $this->search()->setCondition('AND blog.user_id = ' . Phpfox::getUserId()); break; case 'draft': Phpfox::isUser(true); $this->search()->setCondition("AND blog.user_id = " . $aUser['user_id'] . " AND blog.is_approved IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '1') . ") AND blog.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ") AND blog.post_status = 2"); break; default: $aPage = $this->getParam('aPage'); $sCondition = "AND blog.is_approved = 1 AND blog.post_status = 1" . (Phpfox::getUserParam('privacy.can_comment_on_all_items') ? "" : " AND blog.privacy IN(%PRIVACY%)"); if (isset($aPage['privacy']) && $aPage['privacy'] == 1) { $sCondition = "AND blog.is_approved = 1 AND blog.privacy IN(%PRIVACY%, 1) AND blog.post_status = 1"; } $this->search()->setCondition($sCondition); break; } if ($this->request()->get($bIsProfile === true ? 'req3' : 'req2') == 'category') { if ($aBlogCategory = Phpfox::getService('blog.category')->getCategory($this->request()->getInt($bIsProfile === true ? 'req4' : 'req3'))) { $this->template()->setBreadCrumb(Phpfox::getPhrase('blog.category')); $this->search()->setCondition('AND blog_category.category_id = ' . $this->request()->getInt($bIsProfile === true ? 'req4' : 'req3') . ' AND blog_category.user_id = ' . ($bIsProfile ? (int) $aUser['user_id'] : 0)); $this->template()->setTitle(Phpfox::getLib('locale')->convert($aBlogCategory['name'])); $this->template()->setBreadCrumb(Phpfox::getLib('locale')->convert($aBlogCategory['name']), $this->url()->makeUrl('current'), true); $this->search()->setFormUrl($this->url()->permalink(array('blog.category', 'view' => $this->request()->get('view')), $aBlogCategory['category_id'], $aBlogCategory['name'])); $bIsValidCategory = true; } } elseif ($this->request()->get(defined('PHPFOX_IS_PAGES_VIEW') ? 'req4' : ($bIsProfile === true ? 'req3' : 'req2')) == 'tag') { if ($aTag = Phpfox::getService('tag')->getTagInfo('blog', $this->request()->get(defined('PHPFOX_IS_PAGES_VIEW') ? 'req5' : ($bIsProfile === true ? 'req4' : 'req3')))) { $this->template()->setBreadCrumb(Phpfox::getPhrase('tag.topic') . ': ' . $aTag['tag_text'] . '', $this->url()->makeUrl('current'), true); $this->search()->setCondition('AND tag.tag_text = \'' . Phpfox::getLib('database')->escape($aTag['tag_text']) . '\''); $bIsValidTag = true; } } if (isset($aParentModule) && isset($aParentModule['module_id'])) { /* Only get items without a parent (not belonging to pages) */ $this->search()->setCondition('AND blog.module_id = \'' . $aParentModule['module_id'] . '\' AND blog.item_id = ' . (int) $aParentModule['item_id']); } else { if ($aParentModule === null) { if (($sView == 'pending' || $sView == 'draft') && Phpfox::getUserParam('blog.can_approve_blogs')) { } else { $this->search()->setCondition('AND blog.module_id = \'blog\''); } } } // http://www.phpfox.com/tracker/view/15375/ if (defined('PHPFOX_IS_PAGES_VIEW') && Phpfox::getService('pages')->hasPerm(null, 'blog.view_browse_blogs') || !defined('PHPFOX_IS_PAGES_VIEW') && $aParentModule['module_id'] == 'pages' && Phpfox::getService('pages')->hasPerm($aParentModule['item_id'], 'blog.view_browse_blogs')) { if (Phpfox::getService('pages')->isAdmin($aParentModule['item_id'])) { $this->request()->set('view', 'pages_admin'); } elseif (Phpfox::getService('pages')->isMember($aParentModule['item_id'])) { $this->request()->set('view', 'pages_member'); } } // http://www.phpfox.com/tracker/view/15445/ if (Phpfox::getService('profile')->timeline() && ($bIsProfile || defined('PHPFOX_IS_PAGES_VIEW'))) { // Should we set the special menu? $bSpecialMenu = !defined('PHPFOX_IS_AJAX_CONTROLLER'); // Are we viewing the content of the special menu? $bIsActive = $sView == 'draft' ? true : false; $aDrafts = array('phrase' => Phpfox::getPhrase('profile.drafts'), 'url' => Phpfox::getLib('url')->makeUrl('profile.blog.view_draft'), 'total' => Phpfox::getService('blog')->getTotalDrafts($aUser['user_id']), 'active' => $bIsActive); $this->template()->setHeader(array('profile.css' => 'module_blog'))->assign(array('bSpecialMenu' => $bSpecialMenu, 'aDrafts' => $aDrafts)); } // END $this->search()->browse()->params($aBrowseParams)->execute(); $aItems = $this->search()->browse()->getRows(); Phpfox::getLib('pager')->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount())); Phpfox::getService('blog')->getExtra($aItems, 'user_profile'); ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_middle')) ? eval($sPlugin) : false; $this->template()->setMeta('keywords', Phpfox::getParam('blog.blog_meta_keywords')); $this->template()->setMeta('description', Phpfox::getParam('blog.blog_meta_description')); if ($bIsProfile) { $this->template()->setMeta('description', '' . $aUser['full_name'] . ' has ' . $this->search()->browse()->getCount() . ' blogs.'); } foreach ($aItems as $aItem) { $this->template()->setMeta('keywords', $this->template()->getKeywords($aItem['title'])); if (!empty($aItem['tag_list'])) { $this->template()->setMeta('keywords', Phpfox::getService('tag')->getKeywords($aItem['tag_list'])); } } /** * Here we assign the needed variables we plan on using in the template. This is used to pass * on any information that needs to be used with the specific template for this component. */ $this->template()->assign(array('iCnt' => $this->search()->browse()->getCount(), 'aItems' => $aItems, 'sSearchBlock' => Phpfox::getPhrase('blog.search_blogs_'), 'bIsProfile' => $bIsProfile, 'sTagType' => $bIsProfile === true ? 'blog_profile' : 'blog', 'sBlogStatus' => $this->request()->get('status'), 'iShorten' => Phpfox::getParam('blog.length_in_index'), 'sView' => $sView))->setHeader('cache', array('quick_submit.js' => 'module_blog', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed')); $this->setParam('global_moderation', array('name' => 'blog', 'ajax' => 'blog.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('blog.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('blog.approve'), 'action' => 'approve')))); $iStartCheck = 0; if (isset($bIsValidCategory)) { $iStartCheck = 5; } elseif (isset($bIsValidTag)) { $iStartCheck = 4; } if (!defined('PHPFOX_ALLOW_ID_404_CHECK')) { $iAllowIds = uniqid(); define('PHPFOX_ALLOW_ID_404_CHECK', $iAllowIds); } else { $iAllowIds = PHPFOX_ALLOW_ID_404_CHECK; } $aRediAllow = array('category', 'tag', $iAllowIds); if (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE) { $aRediAllow[] = 'blog'; } $aCheckParams = array('url' => $this->url()->makeUrl('blog'), 'start' => $iStartCheck, 'reqs' => array('2' => $aRediAllow, '3' => $aRediAllow)); if (Phpfox::getParam('core.force_404_check') && !Phpfox::getService('core.redirect')->check404($aCheckParams)) { return Phpfox::getLib('module')->setController('error.404'); } ($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_end')) ? eval($sPlugin) : false; }
/** * Gets the full path of the cached template file * * @param string $sName Name of the template * @return string Full path to cached template */ private function _getCachedName($sName) { if (!defined('PHPFOX_INSTALLER')) { if (!is_dir(PHPFOX_DIR_CACHE . 'template' . PHPFOX_DS)) { mkdir(PHPFOX_DIR_CACHE . 'template' . PHPFOX_DS); chmod(PHPFOX_DIR_CACHE . 'template' . PHPFOX_DS, 0777); } } return (defined('PHPFOX_IS_HOSTED_SCRIPT') ? PHPFOX_IS_HOSTED_SCRIPT . Phpfox::getCleanVersion() . '' : '') . (defined('PHPFOX_TMP_DIR') ? PHPFOX_TMP_DIR : PHPFOX_DIR_CACHE) . (defined('PHPFOX_TMP_DIR') || PHPFOX_SAFE_MODE ? 'template_' : 'template/') . str_replace(array(PHPFOX_DIR_THEME, PHPFOX_DIR_MODULE, PHPFOX_DS), array('', '', '_'), $sName) . (Phpfox::isAdminPanel() ? '_admincp' : '') . (PHPFOX_IS_AJAX ? '_ajax' : '') . '.php'; }
FB.Event.subscribe(\'auth.login\', function(response) { if (response.authResponse) { $(\'body\').html(\'<div id="fb-root"></div><div id="facebook_connection">' . Phpfox::getPhrase('facebook.connecting_to_facebook_please_hold') . '</div>\'); window.location.href = \'' . Phpfox_Url::instance()->makeUrl('facebook.frame') . '\'; } }); }; ' . $sFacebookAsync . ' </script>')); } } } else { if (Phpfox::isUser() && !Phpfox::isAdminPanel() && Phpfox::getParam('facebook.facebook_app_id')) { $oTpl->setHeader(array('<script type="text/javascript"> window.onload = function() { FB.init( { appId : \'' . Phpfox::getParam('facebook.facebook_app_id') . '\', status : true, cookie : true, oauth : true, xfbml : true }); }; ' . $sFacebookAsync . ' </script>'));
/** * Returns paging info: 'totalPages', 'totalRows', 'current', 'fromRow','toRow', 'firstUrl', 'prevUrl', 'nextUrl', 'lastUrl', 'urls' (url=>page) * * @param Url $oUrl page url * @return array paging info */ private function _getInfo() { if (Phpfox::isAdminPanel()) { if ($this->getTotalPages() == 0) { return false; } $sParams = ''; if (count($this->_aParams)) { foreach ($this->_aParams as $iKey => $sValue) { if (in_array($iKey, array('phpfox', Phpfox::getTokenName(), 'page', PHPFOX_GET_METHOD, 'ajax_page_display'))) { continue; } if (is_array($sValue)) { foreach ($sValue as $sKey => $sNewValue) { if (is_numeric($sKey)) { continue; } $sParams .= '&' . $iKey . '[' . $sKey . ']=' . $sNewValue; } } else { if (PHPFOX_IS_AJAX && $iKey == 'feed' && Phpfox::isModule('comment') && Phpfox::getParam('comment.load_delayed_comments_items')) { continue; } $sParams .= '&' . $iKey . '=' . $sValue; } } } $aInfo = array('totalPages' => $this->_iPagesCount, 'totalRows' => $this->_iCnt, 'current' => $this->_iPage, 'fromRow' => $this->_iFirstRow + 1, 'toRow' => $this->_iLastRow, 'displaying' => $this->_iCnt <= $this->_iPageSize * $this->_iPage ? $this->_iCnt : $this->_iPageSize * $this->_iPage, 'sParams' => $sParams, 'phrase' => $this->_sPhrase, 'icon' => $this->_sIcon); list($nStart, $nEnd) = $this->_getPos(); $oUrl = Phpfox_Url::instance(); $oUrl->clearParam('page'); if ($this->_iPage != 1) { $oUrl->setParam($this->_sUrlKey, 1); $aInfo['firstAjaxUrl'] = 1; $aInfo['firstUrl'] = $oUrl->getFullUrl(); $oUrl->setParam($this->_sUrlKey, $this->_iPage - 1); $aInfo['prevAjaxUrl'] = $this->_iPage - 1; $aInfo['prevUrl'] = $oUrl->getFullUrl(); Phpfox_Template::instance()->setHeader('<link rel="prev" href="' . $aInfo['prevUrl'] . '" />'); } for ($i = $nStart; $i <= $nEnd; $i++) { if ($this->_iPage == $i) { $oUrl->setParam($this->_sUrlKey, $i); $aInfo['urls'][$oUrl->getFullUrl()] = $i; } else { $oUrl->setParam($this->_sUrlKey, $i); $aInfo['urls'][$oUrl->getFullUrl()] = $i; } } $oUrl->setParam($this->_sUrlKey, $this->_iPage + 1); $aInfo['nextAjaxUrlPager'] = $oUrl->getFullUrl(); if ($this->_iPagesCount != $this->_iPage) { $oUrl->setParam($this->_sUrlKey, $this->_iPage + 1); $aInfo['nextAjaxUrl'] = $this->_iPage + 1; $aInfo['nextUrl'] = $oUrl->getFullUrl(); Phpfox_Template::instance()->setHeader('<link rel="next" href="' . $aInfo['nextUrl'] . '" />'); $oUrl->setParam($this->_sUrlKey, $this->_iPagesCount); $aInfo['lastUrl'] = $oUrl->getFullUrl(); $aInfo['lastAjaxUrl'] = $this->_iPagesCount; } $aInfo['sParamsAjax'] = str_replace("'", "\\'", $aInfo['sParams']); Phpfox_Template::instance()->assign(array('aPager' => $aInfo, 'sAjax' => $this->_sAjax)); } else { $sNextPage = (int) Phpfox_Request::instance()->get('page', 1) + 1; Phpfox_Url::instance()->clearParam('page'); $_GET['page'] = $sNextPage; Phpfox_Template::instance()->assign(array('sCurrentUrl' => Phpfox_Url::instance()->makeUrl('current'), 'sNextIteration' => $sNextPage)); } }
<?php $sPathImage = Phpfox::getLib('url')->getDomain() . 'module/slscrolltotop/static/image/'; $sPathJS = Phpfox::getLib('url')->getDomain() . 'module/slscrolltotop/static/jscript/'; $data = Phpfox::getService('slscrolltotop.getdata')->getList(); if ($data["enable_module"]) { $showScrollToTop = 1; $flagLoadScriptForAdminCP = 0; if (Phpfox::isAdminPanel()) { $flagLoadScriptForAdminCP = 1; if (Phpfox::getLib('module')->getModuleName() != "slscrolltotop") { $showScrollToTop = 0; } } if ($showScrollToTop) { if ($data["style"] < 1 or $data["style"] > 7) { $data["style"] = 1; } echo ' <div id="ScrollToTop" class="ScrollToTop_Global ScrollToTop_Style_' . $data["style"] . '"> <span>' . $data["text_display"] . '</span> </div>'; echo Phpfox::getService('slscrolltotop.process')->loadStyle($sPathImage, $data); echo Phpfox::getService('slscrolltotop.process')->loadScript($sPathImage, $sPathJS, $data, $flagLoadScriptForAdminCP); } }
/** * Class process method wnich is used to execute this component. */ public function process() { if (defined('PHPFOX_IS_USER_PROFILE') && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) { Phpfox::getService('core')->getLegacyItem(array( 'field' => array('blog_id', 'title'), 'table' => 'blog', 'redirect' => 'blog', 'title' => $sLegacyTitle ) ); } if ($this->request()->get('req2') == 'main') { return Phpfox::getLib('module')->setController('error.404'); } (($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_start')) ? eval($sPlugin) : false); if (($iRedirectId = $this->request()->get('redirect')) && ($aRedirectBlog = Phpfox::getService('blog')->getBlogForEdit($iRedirectId))) { Phpfox::permalink('blog', $aRedirectBlog['blog_id'], $aRedirectBlog['title'], true); } Phpfox::getUserParam('blog.view_blogs', true); if (defined('PHPFOX_IS_AJAX_CONTROLLER')) { $bIsProfile = true; $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id')); $this->setParam('aUser', $aUser); } else { $bIsProfile = $this->getParam('bIsProfile'); if ($bIsProfile === true) { $aUser = $this->getParam('aUser'); } } /** * Check if we are going to view an actual blog instead of the blog index page. * The 2nd URL param needs to be numeric. */ if (!Phpfox::isAdminPanel()) { if ($this->request()->getInt('req2') > 0) { /** * Since we are going to be viewing a blog lets reset the controller and get out of this one. */ return Phpfox::getLib('module')->setController('blog.view'); } } if ($this->request()->get('req2') == 'category' && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) { $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array( 'field' => array('category_id', 'name'), 'table' => 'blog_category', 'redirect' => 'blog.category', 'title' => $sLegacyTitle, 'search' => 'name_url' ) ); } /** * This creates a global variable that can be used in other components. This is a good way to * pass information to other components. */ $this->setParam('sTagType', 'blog'); $this->template()->setTitle(($bIsProfile ? Phpfox::getPhrase('blog.full_name_s_blogs', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('blog.blog_title')))->setBreadCrumb(($bIsProfile ? 'Blogs' : Phpfox::getPhrase('blog.blog_title')), ($bIsProfile ? $this->url()->makeUrl($aUser['user_name'], 'blog') : $this->url()->makeUrl('blog'))); $sView = $this->request()->get('view'); $this->search()->set(array( 'type' => 'blog', 'field' => 'blog.blog_id', 'search_tool' => array( 'table_alias' => 'blog', 'search' => array( 'action' => ($bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('blog', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('blog', array('view' => $this->request()->get('view')))), 'default_value' => Phpfox::getPhrase('blog.search_blogs_dot'), 'name' => 'search', 'field' => 'blog_text.text' ), 'sort' => array( 'latest' => array('blog.time_stamp', Phpfox::getPhrase('blog.latest')), 'most-viewed' => array('blog.total_view', Phpfox::getPhrase('blog.most_viewed')), 'most-liked' => array('blog.total_like', Phpfox::getPhrase('blog.most_liked')), 'most-talked' => array('blog.total_comment', Phpfox::getPhrase('blog.most_discussed')) ), 'show' => array(5, 10, 15) ) ) ); $aBrowseParams = array( 'module_id' => 'blog', 'alias' => 'blog', 'field' => 'blog_id', 'table' => Phpfox::getT('blog'), 'hide_view' => array('pending', 'my') ); $aFilterMenu = array(); if (!defined('PHPFOX_IS_USER_PROFILE')) { $aFilterMenu = array( Phpfox::getPhrase('blog.all_blogs') => '', Phpfox::getPhrase('blog.my_blogs') => 'my' ); if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend')) { $aFilterMenu[Phpfox::getPhrase('blog.friends_blogs')] = 'friend'; } if (Phpfox::getUserParam('blog.can_approve_blogs')) { $iPendingTotal = Phpfox::getService('blog')->getPendingTotal(); if ($iPendingTotal) { $aFilterMenu[Phpfox::getPhrase('blog.pending_blogs') . (Phpfox::getUserParam('blog.can_approve_blogs') ? '<span class="pending">' . $iPendingTotal . '</span>' : 0)] = 'pending'; } } } (($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_search')) ? eval($sPlugin) : false); $this->template()->buildSectionMenu('blog', $aFilterMenu); switch ($sView) { case 'spam': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 9'); } break; case 'pending': Phpfox::isUser(true); if (Phpfox::getUserParam('blog.can_approve_blogs')) { $this->search()->setCondition('AND blog.is_approved = 0'); } break; case 'my': Phpfox::isUser(true); $this->search()->setCondition('AND blog.user_id = ' . Phpfox::getUserId()); break; case 'draft': Phpfox::isUser(true); $this->search()->setCondition("AND blog.user_id = " . $aUser['user_id'] . " AND blog.is_approved IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '1') . ") AND blog.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('privacy')->getForBrowse($aUser)) . ") AND blog.post_status = 2"); break; default: if ($bIsProfile === true) { $this->search()->setCondition("AND blog.user_id = " . $aUser['user_id'] . " AND blog.is_approved IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1' : '1') . ") AND blog.privacy IN(" . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('privacy')->getForBrowse($aUser)) . ") AND blog.post_status IN(" . ($aUser['user_id'] == Phpfox::getUserId() ? '0,1,2' : '1') . ")"); } else { $this->search()->setCondition("AND blog.is_approved = 1 AND blog.privacy IN(%PRIVACY%) AND blog.post_status = 1"); } break; } if ($this->request()->get(($bIsProfile === true ? 'req3' : 'req2')) == 'category') { if ($aBlogCategory = Phpfox::getService('blog.category')->getCategory($this->request()->getInt(($bIsProfile === true ? 'req4' : 'req3')))) { $this->template()->setBreadCrumb(Phpfox::getPhrase('blog.category')); $this->search()->setCondition('AND blog_category.category_id = ' . $this->request()->getInt(($bIsProfile === true ? 'req4' : 'req3')) . ' AND blog_category.user_id = ' . ($bIsProfile ? (int) $aUser['user_id'] : 0)); $this->template()->setTitle(Phpfox::getLib('locale')->convert($aBlogCategory['name'])); $this->template()->setBreadCrumb(Phpfox::getLib('locale')->convert($aBlogCategory['name']), $this->url()->makeUrl('current'), true); $this->search()->setFormUrl($this->url()->permalink(array('blog.category', 'view' => $this->request()->get('view')), $aBlogCategory['category_id'], $aBlogCategory['name'])); } } elseif ($this->request()->get(($bIsProfile === true ? 'req3' : 'req2')) == 'tag') { if (($aTag = Phpfox::getService('tag')->getTagInfo('blog', $this->request()->get(($bIsProfile === true ? 'req4' : 'req3'))))) { $this->template()->setBreadCrumb('Topic: ' . $aTag['tag_text'] . '', $this->url()->makeUrl('current'), true); $this->search()->setCondition('AND tag.tag_text = \'' . Phpfox::getLib('database')->escape($this->request()->get(($bIsProfile === true ? 'req4' : 'req3'))) . '\' AND tag.added > ' . (PHPFOX_TIME - (86400 * Phpfox::getParam('tag.tag_days_treading'))) . ''); } } $this->search()->browse()->params($aBrowseParams)->execute(); $aItems = $this->search()->browse()->getRows(); Phpfox::getLib('pager')->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount())); Phpfox::getService('blog')->getExtra($aItems, 'user_profile'); (($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_middle')) ? eval($sPlugin) : false); $this->template()->setMeta('keywords', Phpfox::getParam('blog.blog_meta_keywords')); $this->template()->setMeta('description', Phpfox::getParam('blog.blog_meta_description')); if ($bIsProfile) { $this->template()->setMeta('description', '' . $aUser['full_name'] . ' has ' . $this->search()->browse()->getCount() . ' blogs.'); } foreach ($aItems as $aItem) { $this->template()->setMeta('keywords', $this->template()->getKeywords($aItem['title'])); if (!empty($aItem['tag_list'])) { $this->template()->setMeta('keywords', Phpfox::getService('tag')->getKeywords($aItem['tag_list'])); } } /** * Here we assign the needed variables we plan on using in the template. This is used to pass * on any information that needs to be used with the specific template for this component. */ $this->template()->assign(array( 'iCnt' => $this->search()->browse()->getCount(), 'aItems' => $aItems, 'sSearchBlock' => Phpfox::getPhrase('blog.search_blogs_'), 'bIsProfile' => $bIsProfile, 'sTagType' => ($bIsProfile === true ? 'blog_profile' : 'blog'), 'sBlogStatus' => $this->request()->get('status'), 'iShorten' => Phpfox::getParam('blog.length_in_index'), 'sView' => $sView ) ) ->setHeader('cache', array( 'quick_submit.js' => 'module_blog', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed' ) ); $this->setParam('global_moderation', array( 'name' => 'blog', 'ajax' => 'blog.moderation', 'menu' => array( array( 'phrase' => Phpfox::getPhrase('blog.delete'), 'action' => 'delete' ), array( 'phrase' => Phpfox::getPhrase('blog.approve'), 'action' => 'approve' ) ) ) ); (($sPlugin = Phpfox_Plugin::get('blog.component_controller_index_process_end')) ? eval($sPlugin) : false); }
* @version $Id: controller.html.php 64 2009-01-19 15:05:54Z Raymond_Benc $ */ if (count((array) $this->_aVars['aSettings'])) { foreach ((array) $this->_aVars['aSettings'] as $this->_aVars['aSetting']) { ?> <div class="table js_custom_groups<?php if (isset($this->_aVars['aSetting']['group_id'])) { ?> js_custom_group_<?php echo $this->_aVars['aSetting']['group_id']; } ?> "> <div class="table_left"> <?php if ($this->_aVars['aSetting']['is_required'] && !Phpfox::isAdminPanel()) { if (Phpfox::getParam('core.display_required')) { ?> <span class="required"><?php echo Phpfox::getParam('core.required_symbol'); ?> </span><?php } } echo Phpfox::getPhrase($this->_aVars['aSetting']['phrase_var_name']); ?> : </div> <div class="table_right"> <?php Phpfox::getLib('template')->getBuiltFile('custom.block.form');
{ if (response.session) { $(\'body\').html(\'<div id="fb-root"></div><div id="facebook_connection">Connecting to Facebook. Please hold...</div>\'); window.location.href = \'' . Phpfox::getLib('url')->makeUrl('facebook.frame') . '\'; } }); </script>') ); } } } else { if (Phpfox::isUser() && !Phpfox::isAdminPanel()) { $oTpl->setHeader(array( '<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>', '<script type="text/javascript"> $(function() { FB.init( { appId : \'' . Phpfox::getParam('facebook.facebook_app_id') . '\', status : true, cookie : true, xfbml : true }); }); </script>')
/** * Loads and outputs the current page based on the controller we loaded with the method setController(). * * @see self::setController() */ public function getController() { // Get the component $this->_oController = $this->getComponent($this->_sModule . '.' . $this->_sController, array('bNoTemplate' => true), 'controller'); if (!Phpfox::isAdminPanel() && !defined('PHPFOX_INSTALLER')) { $db = Phpfox_Database::instance(); $cache = Phpfox_Cache::instance(); $name = Phpfox_Module::instance()->getFullControllerName(); $pageMeta = $cache->set('page_meta_' . $name); $meta = $cache->get($pageMeta); if ($meta === false) { $theme = $db->select('*')->from(':theme_template')->where(['type_id' => 'meta', 'name' => $name])->get(); $cache->save($pageMeta, isset($theme['template_id']) ? json_decode($theme['html_data']) : []); $meta = $cache->get($pageMeta); } // $this->_meta = $meta; Phpfox_Template::instance()->setPageMeta($meta); } }
/** * Build a URL based on the apache rewrite rules. * * @param array $aParts ARRAY of all the URL parts. * @param array $aParams ARRAY of all the requests. * @return string Converted URL. */ private function _makeUrl(&$aParts, &$aParams) { if (isset($this->aRewrite[$aParts[0]]) && !is_array($this->aRewrite[$aParts[0]])) { $aParts[0] = $this->aRewrite[$aParts[0]]; } $sUrls = ''; foreach ($aParts as $iPartKey => $sPart) { if (Phpfox::getParam('core.url_rewrite') == 3 && $iPartKey == 0) { continue; } if (empty($sPart)) { continue; } if ($iPartKey === 0 && $sPart == 'admincp') { $sPart = Phpfox::getParam('admincp.admin_cp'); } if ($aParts[0] != 'admincp' && isset($this->aRewrite[$sPart]) && !is_array($this->aRewrite[$sPart])) { $sPart = $this->aRewrite[$sPart]; } $sUrls .= str_replace('.', '', $sPart) . '/'; } if ($aParams && is_array($aParams)) { $iIteration = 0; foreach ($aParams as $sKey => $sValue) { if (is_null($sValue)) { continue; } if ($aParts[0] != 'admincp' && is_numeric($sKey) && isset($this->aRewrite[str_replace('.', '', $sValue)]) && !is_array($this->aRewrite[str_replace('.', '', $sValue)])) { $sValue = $this->aRewrite[str_replace('.', '', $sValue)]; } if (is_numeric($sKey)) { $sUrls .= str_replace('.', '', $sValue) . '/'; continue; } $iIteration++; if ($iIteration === 1) { $sUrls .= '?'; } if (is_array($sValue)) { foreach ($sValue as $subKey => $subValue) { $sUrls .= $sKey . '[' . $subKey . ']=' . (Phpfox::isAdminPanel() ? $subValue : str_replace('.', '', $subValue)) . '&'; } continue; } $sUrls .= $sKey . '=' . (Phpfox::isAdminPanel() ? $sValue : str_replace('.', '', $sValue)) . '&'; } $sUrls = rtrim($sUrls, '&'); } if (preg_match('/\\#/', $sUrls)) { // $sUrls = rtrim($sUrls, '/'); } $this->_bIsUsed = false; $sSubUrl = rtrim($sUrls, '.'); if (isset($this->aRewrite[$sSubUrl]) && !is_array($this->aRewrite[$sSubUrl])) { $sUrls = $this->aRewrite[$sSubUrl] . '/'; } return $sUrls; }
/** * Starts the phpFox engine. Used to get and display the pages controller. * */ public static function run() { $oTpl = Phpfox::getLib('template'); $aLocale = Phpfox::getLib('locale')->getLang(); $oReq = Phpfox::getLib('request'); $oModule = Phpfox::getLib('module'); $cache_id = Phpfox::getLib('cache')->set('auth_token_' . $_SERVER['REMOTE_ADDR']); if (defined('PHPFOX_FORCE_TOKEN') && !Phpfox::getLib('cache')->get($cache_id, 60)) { require_once PHPFOX_DIR_LIB . 'recaptcha' . PHPFOX_DS . 'recaptchalib.php'; $failed = ''; if (!empty($_POST["recaptcha_challenge_field"])) { $resp = recaptcha_check_answer(PHPFOX_FORCE_PRIVATE, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $failed = '<div class="error">Captcha Failed. Try again!</div>'; } else { Phpfox::getLib('cache')->save($cache_id, true); ob_clean(); header('Location: ' . Phpfox::getParam('core.path')); exit; } } $html = ' <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> <head> <title>Human Verification</title> <style type="text/css"> body { background:#e2e2e2; margin:0px; font-size:90%; font:inherit; vertical-align: baseline; font-family: "Helvetica Neue", Arial, sans-serif; font-size:90%; color:#333; line-height:1.5; word-wrap:break-word; } #site_auth { background:#fff; margin-top:200px; text-align:center; padding:50px 0px 50px 0px; } #site_auth form { margin:0px; padding:0px; max-width:500px; margin:auto; } h1 { font-size:2.6em; font-weight:300; letter-spacing:2px; } p { padding:0px 0px 20px 0px; margin:0px; color:#808080; font-size:0.9em; } .submit { margin:20px 0px 0px 0px; padding:10px 30px 10px 30px; background:#71B33D; color:#fff; font-size:1.1em; border:0px; text-transform:uppercase; cursor:pointer; border-radius:3px; } .error { background:#EA5859; color:#fff; padding:20px; margin-bottom:10px; font-size:1.2em; } </style> </head> <body> <div id="site_auth"> <form method="post" action="' . Phpfox::getParam('core.path') . '"> <h1>Human Verification</h1> <p> This site requires you to be a human in order to view the site. Please take a moment to pass the captcha below. Once you have verified you are human you will get a 1 hour token to view the site, thereafter you must renew your token. </p> ' . $failed . ' <div style="margin:auto; display:inline-block;">' . recaptcha_get_html(PHPFOX_FORCE_KEY) . '</div> <div> <input type="submit" value="Submit" class="submit" /> </div> </form> </div> </body> </html> '; echo $html; exit; } ($sPlugin = Phpfox_Plugin::get('run_start')) ? eval($sPlugin) : false; // Load module blocks $oModule->loadBlocks(); if (Phpfox::isMobile() && $oReq->get('req1') == 'go-to-full-site') { Phpfox::getLib('session')->set('mobilestatus', 'true'); Phpfox::getLib('url')->send('phpfox_full_site'); } if (!Phpfox::getParam('core.branding')) { $oTpl->setHeader(array('<meta name="author" content="phpFox" />')); } if (strtolower(Phpfox::getLib('request')->get('req1')) == Phpfox::getParam('admincp.admin_cp')) { self::$_bIsAdminCp = true; } $sImage = Phpfox::getUserBy('user_image'); $bIsAd = false; $oRequest = Phpfox::getLib('request'); if ($oRequest->get('id') && $oRequest->get('req1') == 'ad' && $oRequest->get('req2') == 'iframe') { $bIsAd = true; } if (!Phpfox::getService('ban')->check('ip', Phpfox::getIp())) { $oModule->setController('ban.message'); } else { if (!self::$_bIsAdminCp && Phpfox::getParam('core.site_is_offline') && !Phpfox::getUserParam('core.can_view_site_offline') && $bIsAd != true) { if (Phpfox::getLib('request')->get('req1') == 'user' && (Phpfox::getLib('request')->get('req2') == 'login' || Phpfox::getLib('request')->get('req2') == 'logout') || Phpfox::getLib('request')->get('req1') == 'contact' || Phpfox::getLib('request')->get('req1') == 'captcha') { $oModule->setController(); } else { $oModule->setController('core.offline'); } } else { $oModule->setController(); } } if (!PHPFOX_IS_AJAX_PAGE) { if (Phpfox::isMobile()) { $oTpl->setMobileHeader(array('<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />')); } $oTpl->setImage(array('ajax_small' => 'ajax/small.gif', 'ajax_large' => 'ajax/large.gif', 'loading_animation' => 'misc/loading_animation.gif', 'close' => 'misc/close.gif', 'move' => 'misc/move.png', 'calendar' => 'jquery/calendar.gif')); $oTpl->setHeader(array('<meta http-equiv="Content-Type" content="text/html; charset=' . $aLocale['charset'] . '" />', '<meta http-equiv="cache-control" content="no-cache" />', '<meta http-equiv="expires" content="-1" />', '<meta http-equiv="pragma" content="no-cache" />', '<link rel="shortcut icon" type="image/x-icon" href="' . Phpfox::getParam('core.path') . 'favicon.ico?v=' . $oTpl->getStaticVersion() . '" />'))->setMeta('keywords', Phpfox::getLib('locale')->convert(Phpfox::getParam('core.keywords')))->setMeta('robots', 'index,follow'); if (Phpfox::getParam('core.include_master_files') && Phpfox::isAdminPanel() != true) { $oTpl->setHeader('master', Phpfox::getMasterFiles()); } else { $oTpl->setHeader('cache', Phpfox::getMasterFiles()); } if (!defined('PHPFOX_IS_AD_PREVIEW') && !defined('PHPFOX_IN_DESIGN_MODE') && !defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.site_wide_ajax_browsing')) { $oTpl->setHeader('cache', array('jquery/plugin/jquery.address.js' => 'static_script')); } if (Phpfox::isModule('photo') && Phpfox::getParam('photo.pre_load_header_view')) { $oTpl->setHeader('cache', array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'jquery/plugin/imgnotes/jquery.tag.js' => 'static_script', 'jquery/plugin/imgnotes/jquery.imgareaselect.js' => 'static_script', 'jquery/plugin/imgnotes/jquery.imgnotes.js' => 'static_script', 'imgnotes.css' => 'style_css', 'imgareaselect-default.css' => 'style_css', 'quick_edit.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'view.js' => 'module_photo', 'photo.js' => 'module_photo', 'switch_legend.js' => 'static_script', 'switch_menu.js' => 'static_script', 'view.css' => 'module_photo', 'feed.js' => 'module_feed', 'edit.css' => 'module_photo', 'index.js' => 'module_photo')); } if (Phpfox::isModule('friend')) { $oTpl->setPhrase(array('friend.show_more_results_for_search_term')); } if (PHPFOX_DEBUG) { $oTpl->setHeader('cache', array('debug.css' => 'style_css')); } if (!Phpfox::isMobile() && Phpfox::isUser() && Phpfox::getParam('user.enable_user_tooltip')) { $oTpl->setHeader('cache', array('user_info.js' => 'static_script')); } if (Phpfox::isModule('captcha') && Phpfox::getParam('captcha.recaptcha')) { // http://www.phpfox.com/tracker/view/14456/ $sUrl = (Phpfox::getParam('core.force_https_secure_pages') ? 'https' : 'http') . "://www.google.com/recaptcha/api/js/recaptcha_ajax.js"; $oTpl->setHeader('<script type="text/javascript" src="' . $sUrl . '"></script>'); } } if ($sPlugin = Phpfox_Plugin::get('get_controller')) { eval($sPlugin); } $oModule->getController(); Phpfox::getService('admincp.seo')->setHeaders(); if (!defined('PHPFOX_DONT_SAVE_PAGE')) { Phpfox::getLib('session')->set('redirect', Phpfox::getLib('url')->getFullUrl(true)); } if (!defined('PHPFOX_NO_CSRF')) { Phpfox::getService('log.session')->verifyToken(); } ($sPlugin = Phpfox_Plugin::get('run')) ? eval($sPlugin) : false; if (!self::isAdminPanel()) { if (!Phpfox::isMobile() && !PHPFOX_IS_AJAX_PAGE && Phpfox::isModule('rss') && !defined('PHPFOX_IS_USER_PROFILE')) { $aFeeds = Phpfox::getService('rss')->getLinks(); if (is_array($aFeeds) && count($aFeeds)) { foreach ($aFeeds as $sLink => $sPhrase) { $oTpl->setHeader('<link rel="alternate" type="application/rss+xml" title="' . $sPhrase . '" href="' . $sLink . '" />'); } } } $aPageLastLogin = Phpfox::isModule('pages') && Phpfox::getUserBy('profile_page_id') ? Phpfox::getService('pages')->getLastLogin() : false; $oTpl->assign(array('aMainMenus' => $oTpl->getMenu('main'), 'aRightMenus' => $oTpl->getMenu('main_right'), 'aAppMenus' => $oTpl->getMenu('explore'), 'aSubMenus' => $oTpl->getMenu(), 'aFooterMenu' => $oTpl->getMenu('footer'), 'aBlocks1' => $oTpl->bIsSample ? true : Phpfox::getLib('module')->getModuleBlocks(1), 'aBlocks3' => $oTpl->bIsSample ? true : Phpfox::getLib('module')->getModuleBlocks(3), 'aAdBlocks1' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Phpfox::getService('ad')->getForBlock(1, false, false) : null), 'aAdBlocks3' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Phpfox::getService('ad')->getForBlock(3, false, false) : null), 'bIsUsersProfilePage' => defined('PHPFOX_IS_USER_PROFILE') ? true : false, 'sStyleLogo' => $oTpl->getStyleLogo(), 'aStyleInUse' => $oTpl->getStyleInUse(), 'sGlobalUserFullName' => Phpfox::isUser() ? Phpfox::getUserBy('full_name') : null, 'aGlobalUser' => Phpfox::isUser() ? Phpfox::getUserBy(null) : array(), 'sFullControllerName' => str_replace(array('.', '/'), '_', Phpfox::getLib('module')->getFullControllerName()), 'iGlobalProfilePageId' => Phpfox::getUserBy('profile_page_id'), 'aGlobalProfilePageLogin' => $aPageLastLogin, 'aInstalledApps' => Phpfox::isUser() && Phpfox::isModule('apps') ? Phpfox::getService('apps')->getInstalledApps() : array(), 'sSiteTitle' => Phpfox::getParam('core.site_title'))); $oTpl->setEditor(); if (isset($aPageLastLogin['style_id']) && $aPageLastLogin['style_id'] > 0) { Phpfox::getLib('template')->testStyle($aPageLastLogin['style_id']); } if (Phpfox::isModule('captcha')) { $sCaptchaHeader = Phpfox::getParam('captcha.recaptcha_header'); if (strlen(preg_replace('/\\s\\s+/', '', $sCaptchaHeader)) > 0) { $oTpl->setHeader(array($sCaptchaHeader)); } } if (!PHPFOX_IS_AJAX_PAGE && !defined('PHPFOX_SKIP_IM')) { if (!defined('PHPFOX_IN_DESIGN_MODE')) { if (Phpfox::isUser() && Phpfox::isModule('subscribe') && Phpfox::getParam('subscribe.subscribe_is_required_on_sign_up') && Phpfox::getUserBy('user_group_id') == '2' && (int) Phpfox::getUserBy('subscribe_id') > 0) { } else { if (Phpfox::isModule('notification') && Phpfox::isUser() && Phpfox::getParam('notification.notify_on_new_request')) { $oTpl->setHeader('cache', array('update.js' => 'module_notification')); } if (!Phpfox::isMobile() && Phpfox::isModule('im') && Phpfox::isUser() && Phpfox::getUserBy('profile_page_id') <= 0 && Phpfox::getParam('im.enable_im_in_footer_bar') && !$oTpl->bIsSample) { $oTpl->setPhrase(array('im.conversations', 'im.more_conversations', 'im.are_you_sure'))->setImage(array('misc_minimize' => 'misc/minimize.gif'))->setHeader('cache', array('im.js' => 'module_im', 'im.css' => 'style_css', 'player/' . Phpfox::getParam('core.default_music_player') . '/core.js' => 'static_script'))->setHeader(array('<script type="text/javascript">oCore[\'im.is_hidden\'] = \'' . Phpfox::getUserBy('im_hide') . '\';</script>', '<script type="text/javascript">$Behavior.loadMusicPlayer = function() { if (typeof $f == \'undefined\') { $Core.loadStaticFile(\'' . $oTpl->getStyle('static_script', 'player/' . Phpfox::getParam('core.default_music_player') . '/' . Phpfox::getParam('core.default_music_player')) . '.js\'); } else { $Core.player.load({id: \'js_im_player\', type: \'music\'}); } $Behavior.loadMusicPlayer = function() {} }</script>')); } } } } } if (!PHPFOX_IS_AJAX_PAGE && ($sHeaderFile = $oTpl->getHeaderFile())) { ($sPlugin = Phpfox_Plugin::get('run_get_header_file_1')) ? eval($sPlugin) : false; require_once $sHeaderFile; } list($aBreadCrumbs, $aBreadCrumbTitle) = $oTpl->getBreadCrumb(); /* Delayed unlink, we now delete all the images */ if (Phpfox::getParam('core.keep_files_in_server') == false) { $oSess = Phpfox::getLib('session'); $aFiles = $oSess->get('deleteFiles'); if (is_array($aFiles)) { foreach ($aFiles as $sFile) { if (file_exists($sFile)) { unlink($sFile); } } } $oSess->remove('deleteFiles'); } $oTpl->assign(array('aErrors' => Phpfox_Error::getDisplay() ? Phpfox_Error::get() : array(), 'sPublicMessage' => Phpfox::getMessage(), 'sLocaleDirection' => $aLocale['direction'], 'sLocaleCode' => $aLocale['language_code'], 'sLocaleFlagId' => $aLocale['image'], 'sLocaleName' => $aLocale['title'], 'aRequests' => Phpfox::getLib('request')->getRequests(), 'aBreadCrumbs' => $aBreadCrumbs, 'aBreadCrumbTitle' => $aBreadCrumbTitle, 'sCopyright' => '© ' . Phpfox::getPhrase('core.copyright') . ' ' . Phpfox::getParam('core.site_copyright'))); Phpfox::clearMessage(); unset($_SESSION['phpfox']['image']); if (Phpfox::getParam('core.cron')) { require_once PHPFOX_DIR_CRON . 'exec.php'; } if (!PHPFOX_IS_AJAX_PAGE && $oTpl->sDisplayLayout) { $oTpl->getLayout($oTpl->sDisplayLayout); } if (Phpfox::getParam('language.cache_phrases')) { Phpfox::getLib('locale')->cache(); } // Use GZIP to output the data if we can if (Phpfox::getParam('core.use_gzip') && !PHPFOX_IS_AJAX_PAGE) { $sContent = ob_get_contents(); ob_clean(); if (function_exists('gzencode')) { $sGzipContent = gzencode($sContent, Phpfox::getParam('core.gzip_level'), FORCE_GZIP); } else { if (function_exists('gzcompress') && function_exists('crc32')) { $iSize = strlen($sContent); $iCrc = crc32($sContent); $sGzipContent = "‹ÿ"; $sGzipContent .= substr(gzcompress($sContent, Phpfox::getParam('core.gzip_level')), 2, -4); $sGzipContent .= pack('V', $iCrc); $sGzipContent .= pack('V', $iSize); } } $sOutputContent = isset($sGzipContent) ? $sGzipContent : $sContent; if (Phpfox::getParam('core.check_body_for_text') && !defined('PHPFOX_INSTALLER') && Phpfox::getLib('request')->get('req1') != 'ad') { if (!preg_match(Phpfox::getParam('core.check_body_regex'), $sContent)) { header(Phpfox::getParam('core.check_body_header')); echo Phpfox::getParam('core.check_body_offline_message'); exit; } } if (isset($sGzipContent)) { header("Content-Encoding: " . (in_array('x-gzip', Phpfox::getParam('core.gzip_encodings')) ? "x-gzip" : "gzip")); } echo $sOutputContent; } }
public function isActiveAdminSession() { if (!Phpfox::getParam('core.admincp_do_timeout')) { if (Phpfox::isAdminPanel()) { $this->database()->update(Phpfox::getT('user_field'), array('in_admincp' => PHPFOX_TIME), 'user_id = ' . Phpfox::getUserId()); } return true; } if (Phpfox::getUserBy('fb_user_id') > 0) { return true; } $iLastLoggedIn = (int) Phpfox::getUserBy('in_admincp'); if ($iLastLoggedIn < PHPFOX_TIME - Phpfox::getParam('core.admincp_timeout') * 60) { return false; } $this->database()->update(Phpfox::getT('user_field'), array('in_admincp' => PHPFOX_TIME), 'user_id = ' . Phpfox::getUserId()); return true; }
/** * Returns an array with the css and js files to be loaded in every controller */ public static function getMasterFiles() { $aOut = array('<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css?v=' . Phpfox_Template::instance()->getStaticVersion() . '" rel="stylesheet">', 'jquery/jquery.js' => 'static_script', 'jquery/ui.js' => 'static_script', 'jquery/plugin/jquery.nanoscroller.min.js' => 'static_script', 'common.js' => 'static_script', 'main.js' => 'static_script', 'ajax.js' => 'static_script', 'thickbox/thickbox.js' => 'static_script', 'search.js' => 'module_friend', 'feed.js' => 'module_feed'); if (Phpfox::isAdminPanel()) { $aOut = array_merge(array('layout.css' => 'style_css', 'common.css' => 'style_css', 'thickbox.css' => 'style_css', 'jquery.css' => 'style_css', 'comment.css' => 'style_css', 'pager.css' => 'style_css'), $aOut); } ($sPlugin = Phpfox_Plugin::get('get_master_files')) ? eval($sPlugin) : false; return $aOut; }
/** * Gets all the blocks for a specific location on a specific page. * * @param int Position on the template. * @param bool (Optional) If blocks are already loaded set this to TRUE to reload them anyway. * @return array Returns a list of blocks for that page and in a specific order. */ public function getModuleBlocks($iId, $bForce = false) { // edited the tempalte.cache instead easier for DnD static $aBlocks = array(); static $bIsOrdered = false; if (isset($aBlocks[$iId]) && $bForce === false) { return $aBlocks[$iId]; } $aBlocks[$iId] = array(); if (defined('PHPFOX_IS_USER_PROFILE') && $iId == 11) { $aBlocks[$iId][] = 'profile.pic'; } if (defined('PHPFOX_IS_USER_PROFILE_INDEX') && $iId == 1) { $aBlocks[$iId][] = 'custom.panel'; } if (defined('PHPFOX_IS_PAGES_VIEW') && $iId == 11) { $aBlocks[$iId][] = 'pages.photo'; } ($sPlugin = Phpfox_Plugin::get('get_module_blocks')) ? eval($sPlugin) : false; /* if (is_object($this->_oBlocklet) && method_exists($this->_oBlocklet, 'location_' . $iId)) { call_user_func([$this->_oBlocklet, 'location_' . $iId]); } */ //$sController = strtolower($this->_sModule . '.' . $this->_sController); $sController = strtolower($this->_sModule . '.' . str_replace(array('\\', '/'), '.', $this->_sController)); if (\Core\Route\Controller::$name) { $sController = 'route_' . \Core\Route\Controller::$name['route']; $sController = str_replace('/', '_', $sController); } // $this->blocks = $this->_aModuleBlocks; // $this->_aModuleBlocks = $this->blocks; if (isset($this->_aModuleBlocks[$sController][$iId]) || isset($this->_aModuleBlocks[str_replace('.index', '', $sController)][$iId]) || isset($this->_aModuleBlocks[$this->_sModule][$iId]) || isset($this->_aModuleBlocks[''][$iId])) { $aCachedBlocks = array(); if (isset($this->_aModuleBlocks[$sController][$iId])) { foreach ($this->_aModuleBlocks[$sController][$iId] as $mKey => $mData) { $aCachedBlocks[$mKey] = $mData; } } if (isset($this->_aModuleBlocks[str_replace('.index', '', $sController)][$iId])) { foreach ($this->_aModuleBlocks[str_replace('.index', '', $sController)][$iId] as $mKey => $mData) { $aCachedBlocks[$mKey] = $mData; } } if (isset($this->_aModuleBlocks[$this->_sModule][$iId])) { foreach ($this->_aModuleBlocks[$this->_sModule][$iId] as $mKey => $mData) { $aCachedBlocks[$mKey] = $mData; } } if (isset($this->_aModuleBlocks[''][$iId]) && !Phpfox::isAdminPanel()) { foreach ($this->_aModuleBlocks[''][$iId] as $mKey => $mData) { $aCachedBlocks[$mKey] = $mData; } } foreach ($aCachedBlocks as $sKey => $sValue) { if (!empty($sValue)) { if (in_array(Phpfox::getUserBy('user_group_id'), unserialize($sValue))) { continue; } } $aControllerParts = array(); if (preg_match('/\\./', $sController)) { $aControllerParts = explode('.', $sController); } if (isset($this->_aBlockWithSource[$sController][$iId][$sKey]) || isset($this->_aBlockWithSource[str_replace('.index', '', $sController)][$iId][$sKey]) || isset($this->_aBlockWithSource[''][$iId][$sKey]) || count($aControllerParts) && isset($this->_aBlockWithSource[$aControllerParts[0]][$iId][$sKey])) { $oCache = Phpfox::getLib('cache'); $sCacheId = $oCache->set(array('block', 'file_' . $sKey)); if (($aCacheData = $oCache->get($sCacheId)) && isset($aCacheData['block_id'])) { $this->_aCacheBlockId[md5($aCacheData['source_parsed'])] = array('block_id' => $aCacheData['block_id'], 'location' => $aCacheData['location']); $aBlocks[$iId][] = array($aCacheData['source_parsed']); } } else { $aBlocks[$iId][] = $sKey; if ($sPlugin = Phpfox_Plugin::get('library_module_getmoduleblocks_1')) { eval($sPlugin); if (isset($bReturnFromPlugin)) { return $bReturnFromPlugin; } } } } } if (isset($this->_aCallbackBlock[$iId])) { $aBlocks[$iId] = array_merge($aBlocks[$iId], array($this->_aCallbackBlock[$iId])); } if (!count($aBlocks[$iId]) && (Theme_Service_Theme::instance()->isInDnDMode() || defined('PHPFOX_IN_DESIGN_MODE'))) { $aBlocks[$iId] = true; } // support clean template if ($iId == 1 && !Phpfox::isAdminPanel() && Phpfox_Template::instance()->getThemeFolder() == 'bootstrap') { array_unshift($aBlocks[$iId], 'core.template-menusub'); } if ($iId == '3' && !Phpfox::isAdminPanel()) { // \Phpfox::getBlock('ad.display', array('block_id' => 3)); $aBlocks[$iId][] = 'ad.display'; } /* if (isset($this->blocks[$sController]) && isset($this->blocks[$sController][$iId])) { $aBlocks[$iId] = array_merge($aBlocks[$iId], (array) $this->blocks[$sController][$iId]); d($this->blocks[$sController][$iId]); exit; } */ if (isset($this->blocks['*']) && isset($this->blocks['*'][$iId])) { $content = $this->blocks['*'][$iId]; /* if (isset($content['callback'])) { $content = call_user_func($content['callback'], $content['object']); } */ $aBlocks[$iId] = array_merge($aBlocks[$iId], (array) $content); } if (isset($this->blocks[$sController]) && isset($this->blocks[$sController][$iId])) { $content = $this->blocks[$sController][$iId]; /* if (isset($content['callback'])) { $content = call_user_func($content['callback'], $content['object']); } */ $aBlocks[$iId] = array_merge($aBlocks[$iId], (array) $content); } return $aBlocks[$iId]; }
<?php $sPathImage = Phpfox::getLib('url')->getDomain() . 'module/slscrolltotop/static/image/'; $sPathJS = Phpfox::getLib('url')->getDomain() . 'module/slscrolltotop/static/jscript/'; $data = Phpfox::getService('slscrolltotop.getdata')->getList(); if ($data["enable_module"]) { $flagIncludeJS = 1; if (Phpfox::isAdminPanel() and Phpfox::getLib('module')->getModuleName() != "slscrolltotop") { $flagIncludeJS = 0; } if ($flagIncludeJS) { Phpfox::getLib('template')->setHeader(array('jquery.backgroundPosition.js' => 'module_slscrolltotop')); } }