예제 #1
2
 /**
  * Sets the controller for the page we are on. This method controlls what component to load, which 
  * will be used to display the content on that page.
  *
  * @param string $sController (Optional) We find the controller by default, however you can override our default findings by passing the name of the controller with this argument.
  */
 public function setController($sController = '')
 {
     if ($sController) {
         $aParts = explode('.', $sController);
         $this->_sModule = $aParts[0];
         $this->_sController = substr_replace($sController, '', 0, strlen($this->_sModule . '_'));
         ($sPlugin = Phpfox_Plugin::get('set_defined_controller')) ? eval($sPlugin) : false;
         $this->getController();
         return null;
     }
     if ($View = (new Core\Route\Controller())->get()) {
         return $View;
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_start')) ? eval($sPlugin) : false;
     $oReq = Phpfox_Request::instance();
     $oPage = Phpfox::getService('page');
     $this->_sModule = ($sReq1 = $oReq->get('req1')) ? strtolower($sReq1) : Phpfox::getParam('core.module_core');
     if (($sFrame = $oReq->get('frame')) && in_array($sFrame, $this->_aFrames)) {
         $aFrameParts = explode('-', $sFrame);
         $this->_sModule = strtolower($aFrameParts[0]);
         $this->_sController = strtolower($aFrameParts[1]);
     }
     $this->_aPages = $oPage->getCache();
     if (isset($this->_aPages[$oReq->get('req1')])) {
         $this->_sModule = 'page';
         $this->_sController = 'view';
     }
     $sDir = PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS;
     if ($oReq->get('req2') == Phpfox::getParam('admincp.admin_cp')) {
         Phpfox_Url::instance()->send($oReq->get('req2') . '.' . $oReq->get('req1'));
     }
     if ($oReq->get('req1') == 'admincp' && Phpfox::getParam('admincp.admin_cp') != 'admincp') {
         Phpfox_Url::instance()->send('error.404');
     }
     if ($oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req3') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . strtolower($oReq->get('req3')) . '.class.php')) {
         $this->_sController = strtolower($oReq->get('req2') . '.' . $oReq->get('req3'));
     } elseif (strtolower($this->_sModule) != Phpfox::getParam('admincp.admin_cp') && $oReq->get('req2') && file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . strtolower($oReq->get('req2')) . PHPFOX_DS . 'index.class.php')) {
         $this->_sController = strtolower($oReq->get('req2')) . '.index';
     } else {
         // Over-ride the index page to display the content for guests or members
         if ($this->_sModule == Phpfox::getParam('core.module_core') && $this->_sController == 'index' && Phpfox::getParam('core.module_core') == PHPFOX_MODULE_CORE) {
             $this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
         }
         if (!file_exists($sDir . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) {
             $this->_sModule = 'profile';
         }
         ($sPlugin = Phpfox_Plugin::get('set_controller_else_end')) ? eval($sPlugin) : false;
     }
     if ($this->_sModule == 'theme') {
         if (preg_match('/^(.*?)\\.(jpg|jpeg|gif|png|css|js)$/i', $_GET[PHPFOX_GET_METHOD])) {
             $this->_sModule = 'error';
             $this->_sController = '404';
         }
     }
     if ($this->_sModule != 'profile' && !isset($this->_aModules[$this->_sModule])) {
         $this->_sModule = 'error';
         $this->_sController = '404';
     }
     if (Phpfox::getParam('admincp.admin_cp') != 'admincp' && $oReq->get('req1') == Phpfox::getParam('admincp.admin_cp')) {
         $this->_sModule = 'admincp';
     }
     /*
     		if (Phpfox::isUser() && Phpfox::getParam('core.is_auto_hosted') && Phpfox::getService('log.session')->getOnlineMembers() > Phpfox::getParam('core.phpfox_max_users_online'))
     		{
     			$this->_sModule = 'core';
     			$this->_sController = 'full';
     		}		
     */
     if ($oReq->segment(1) == 'hashtag') {
         $this->_sModule = 'core';
         $this->_sController = Phpfox::isUser() ? 'index-member' : 'index-visitor';
     }
     ($sPlugin = Phpfox_Plugin::get('module_setcontroller_end')) ? eval($sPlugin) : false;
     // Set the language pack cache
     if (Phpfox::getParam('language.cache_phrases')) {
         Phpfox_Locale::instance()->setCache();
     }
     $bCookie = Phpfox::getCookie('page_login') && Phpfox::getUserBy('profile_page_id') > 0;
     if (Phpfox::isUser() && $bCookie != 1 && Phpfox::getUserParam('user.require_profile_image') && Phpfox::getUserBy('user_image') == '' && !($this->_sModule == 'user' && $this->_sController == 'photo' || $this->_sModule == 'user' && $this->_sController == 'logout' || $this->_sModule == 'subscribe')) {
         Phpfox_Url::instance()->send('user.photo', null, Phpfox::getPhrase('user.you_are_required_to_upload_a_profile_image'));
     }
     if (Phpfox::getParam('core.force_https_secure_pages')) {
         $sController = str_replace('mobile.', '', $this->getFullControllerName());
         if ($sController == 'core.index-member' || $sController == 'core.index-visitor') {
             // fixes 14276
             $sController = '';
         }
         if (in_array(str_replace('mobile.', '', $this->getFullControllerName()), Phpfox::getService('core')->getSecurePages())) {
             if (!isset($_SERVER['HTTPS'])) {
                 Phpfox_Url::instance()->send($sController);
             }
         } else {
             if (Phpfox::getParam('core.force_secure_site')) {
                 if (!isset($_SERVER['HTTPS'])) {
                     Phpfox_Url::instance()->send($sController);
                 }
             }
         }
     }
     if (Phpfox::getParam('core.site_is_offline') && !Phpfox::getUserParam('core.can_view_site_offline') && ($this->_sModule != 'user' && $this->_sModule != 'captcha' && !in_array($this->_sController, ['login', 'logout']))) {
         $this->_sModule = 'core';
         $this->_sController = 'offline';
         define('PHPFOX_SITE_IS_OFFLINE', true);
     }
 }
예제 #2
1
 /**
  * Controller
  */
 public function process()
 {
     $bIsUserProfile = $this->getParam('bIsProfile');
     if ($bIsUserProfile) {
         $aUser = $this->getParam('aUser');
     }
     Phpfox::getUserParam('pages.can_view_browse_pages', true);
     if ($this->request()->getInt('req2') > 0) {
         /*
         Phpfox_Module::instance()->setCacheBlockData(array(
         		'table' => 'pages_design_order',
         		'field' => 'page_id',
         		'item_id' => $this->request()->getInt('req2'),
         		'controller' => 'pages.view'
         	)
         );
         */
         return Phpfox_Module::instance()->setController('pages.view');
     }
     if (($iDeleteId = $this->request()->getInt('delete')) && Phpfox::getService('pages.process')->delete($iDeleteId)) {
         $this->url()->send('pages', array(), Phpfox::getPhrase('pages.page_successfully_deleted'));
     }
     $sView = $this->request()->get('view');
     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');
         }
     }
     if ($bIsProfile) {
         $this->template()->setTitle(Phpfox::getPhrase('pages.full_name_s_pages', array('full_name' => $aUser['full_name'])))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl($aUser['user_name'], array('pages')));
     } else {
         $this->template()->setTitle(Phpfox::getPhrase('pages.pages'))->setBreadcrumb(Phpfox::getPhrase('pages.pages'), $this->url()->makeUrl('pages'));
     }
     $this->search()->set(array('type' => 'pages', 'field' => 'pages.page_id', 'search_tool' => array('table_alias' => 'pages', 'search' => array('action' => $bIsProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('pages', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('pages', array('view' => $this->request()->get('view'))), 'default_value' => Phpfox::getPhrase('pages.search_pages'), 'name' => 'search', 'field' => 'pages.title'), 'sort' => array('latest' => array('pages.time_stamp', Phpfox::getPhrase('pages.latest')), 'most-liked' => array('pages.total_like', Phpfox::getPhrase('pages.most_liked'))), 'show' => array(10, 15, 20))));
     $aBrowseParams = array('module_id' => 'pages', 'alias' => 'pages', 'field' => 'page_id', 'table' => Phpfox::getT('pages'), 'hide_view' => array('pending', 'my'));
     $aFilterMenu = array();
     if (!defined('PHPFOX_IS_USER_PROFILE')) {
         $aFilterMenu = array(Phpfox::getPhrase('pages.all_pages') => '', Phpfox::getPhrase('pages.my_pages') => 'my');
         if (!Phpfox::getParam('core.friends_only_community') && Phpfox::isModule('friend') && !Phpfox::getUserBy('profile_page_id')) {
             $aFilterMenu[Phpfox::getPhrase('pages.friends_pages')] = 'friend';
         }
         if (Phpfox::getUserParam('pages.can_moderate_pages')) {
             $iPendingTotal = Phpfox::getService('pages')->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu['' . Phpfox::getPhrase('pages.pending_pages') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
     }
     switch ($sView) {
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id IN(0,1) AND pages.user_id = ' . Phpfox::getUserId());
             break;
         case 'pending':
             Phpfox::isUser(true);
             if (Phpfox::getUserParam('pages.can_moderate_pages')) {
                 $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 1');
             }
             break;
         default:
             if (Phpfox::getUserParam('privacy.can_view_all_items')) {
                 $this->search()->setCondition('AND pages.app_id = 0 ');
             } else {
                 $this->search()->setCondition('AND pages.app_id = 0 AND pages.view_id = 0 AND pages.privacy IN(%PRIVACY%)');
             }
             break;
     }
     // $this->template()->buildSectionMenu('pages', $aFilterMenu);
     $bIsValidCategory = false;
     if ($this->request()->get('req2') == 'category' && ($iCategoryId = $this->request()->getInt('req3')) && ($aType = Phpfox::getService('pages.type')->getById($iCategoryId))) {
         $bIsValidCategory = true;
         $this->setParam('iCategory', $iCategoryId);
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aType['name']), Phpfox::permalink('pages.category', $aType['type_id'], $aType['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
     }
     if ($this->request()->get('req2') == 'sub-category' && ($iSubCategoryId = $this->request()->getInt('req3')) && ($aCategory = Phpfox::getService('pages.category')->getById($iSubCategoryId))) {
         $bIsValidCategory = true;
         $this->setParam('iCategory', $aCategory['type_id']);
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['type_name']), Phpfox::permalink('pages.category', $aCategory['type_id'], $aCategory['type_name']) . ($sView ? 'view_' . $sView . '/' . '' : ''));
         $this->template()->setBreadcrumb(Phpfox_Locale::instance()->convert($aCategory['name']), Phpfox::permalink('pages.sub-category', $aCategory['category_id'], $aCategory['name']) . ($sView ? 'view_' . $sView . '/' . '' : ''), true);
     }
     if (isset($aType['type_id'])) {
         $this->search()->setCondition('AND pages.type_id = ' . (int) $aType['type_id']);
     }
     if (isset($aType['category_id'])) {
         $this->search()->setCondition('AND pages.category_id = ' . (int) $aType['category_id']);
     } elseif (isset($aCategory['category_id'])) {
         $this->search()->setCondition('AND pages.category_id = ' . (int) $aCategory['category_id']);
     }
     if ($bIsUserProfile) {
         $this->search()->setCondition('AND pages.user_id = ' . (int) $aUser['user_id']);
     }
     $aPages = [];
     $aCategories = [];
     $bShowCategories = false;
     if ($this->search()->isSearch()) {
         $bIsValidCategory = true;
     }
     if ($bIsValidCategory) {
         $this->search()->browse()->params($aBrowseParams)->execute();
         $aPages = $this->search()->browse()->getRows();
         foreach ($aPages as $iKey => $aPage) {
             if (!isset($aPage['vanity_url']) || empty($aPage['vanity_url'])) {
                 $aPages[$iKey]['url'] = Phpfox::permalink('pages', $aPage['page_id'], $aPage['title']);
             } else {
                 $aPages[$iKey]['url'] = $aPage['vanity_url'];
             }
         }
         Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     } else {
         $bShowCategories = true;
         $aCategories = Phpfox::getService('pages.category')->getForBrowse(0, true, $bIsProfile ? $aUser['user_id'] : null);
     }
     $this->template()->setHeader('cache', array('comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed', 'pages.js' => 'module_pages'))->assign(array('sView' => $sView, 'aPages' => $aPages, 'aCategories' => $aCategories, 'bShowCategories' => $bShowCategories));
     $this->setParam('global_moderation', array('name' => 'pages', 'ajax' => 'pages.pageModeration', 'menu' => array(array('phrase' => Phpfox::getPhrase('pages.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('pages.approve'), 'action' => 'approve'))));
     $iStartCheck = 0;
     if ($bIsValidCategory == true) {
         $iStartCheck = 5;
     }
     $aRediAllow = array('category');
     if (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE) {
         $aRediAllow[] = 'pages';
     }
     $aCheckParams = array('url' => $this->url()->makeUrl('pages'), 'start' => $iStartCheck, 'reqs' => array('2' => $aRediAllow));
     if (Phpfox::getParam('core.force_404_check') && !Phpfox::getService('core.redirect')->check404($aCheckParams)) {
         return Phpfox_Module::instance()->setController('error.404');
     }
 }
예제 #3
0
 /**
  * Controller
  */
 public function process()
 {
     if (!($aPurchase = Phpfox::getService('subscribe.purchase')->getInvoice($this->request()->getInt('id')))) {
         return Phpfox_Error::display(Phpfox::getPhrase('subscribe.unable_to_find_this_invoice'));
     }
     $this->template()->setTitle(Phpfox::getPhrase('subscribe.membership_packages'))->setBreadcrumb(Phpfox::getPhrase('subscribe.membership_packages'), $this->url()->makeUrl('subscribe'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscriptions'), $this->url()->makeUrl('subscribe.list'))->setBreadcrumb(Phpfox::getPhrase('subscribe.order_purchase_id_title', array('purchase_id' => $aPurchase['purchase_id'], 'title' => Phpfox_Locale::instance()->convert($aPurchase['title']))), null, true)->assign(array('aPurchase' => $aPurchase));
 }
예제 #4
0
 /**
  * Controller
  */
 public function process()
 {
     $bIsEdit = false;
     if ($iId = $this->request()->getInt('id')) {
         if ($aPackage = Phpfox::getService('subscribe')->getForEdit($iId)) {
             $bIsEdit = true;
             $this->template()->assign('aForms', $aPackage);
             $this->setParam('currency_value_val[cost]', unserialize($aPackage['cost']));
             if (!empty($aPackage['recurring_cost'])) {
                 $this->setParam('currency_value_val[recurring_cost]', unserialize($aPackage['recurring_cost']));
             }
         }
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($bIsEdit) {
             if (Phpfox::getService('subscribe.process')->update($aPackage['package_id'], $aVals)) {
                 $this->url()->send('admincp.subscribe.add', array('id' => $aPackage['package_id']), Phpfox::getPhrase('subscribe.package_successfully_update'));
             }
         } else {
             if (Phpfox::getService('subscribe.process')->add($aVals)) {
                 $this->url()->send('admincp.subscribe', null, Phpfox::getPhrase('subscribe.package_successfully_added'));
             }
         }
     }
     $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('subscribe.editing_subscription_package') . ': ' . $aPackage['title'] : Phpfox::getPhrase('subscribe.create_new_subscription_package'))->setBreadcrumb(Phpfox::getPhrase('subscribe.subscription_packages'), $this->url()->makeUrl('admincp.subscribe'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('subscribe.editing') . ': ' . Phpfox_Locale::instance()->convert($aPackage['title']) : Phpfox::getPhrase('subscribe.create_new_subscription_package'), null, true)->assign(array('aUserGroups' => Phpfox::getService('user.group')->get(), 'bIsEdit' => $bIsEdit));
 }
예제 #5
0
 /**
  * Controller
  */
 public function process()
 {
     $aBanFilter = $this->getParam('aBanFilter');
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if (Phpfox::getService('ban.process')->delete($iDeleteId)) {
             $this->url()->send($aBanFilter['url'], null, Phpfox::getPhrase('ban.filter_successfully_deleted'));
         }
     }
     if ($sBanValue = $this->request()->get('find_value')) {
         $aBan = $this->request()->getArray('aBan');
         $aVals = array_merge(array('type_id' => $aBanFilter['type'], 'find_value' => $sBanValue, 'replacement' => $this->request()->get('replacement', null)), $aBan);
         if (Phpfox::getService('ban.process')->add($aVals, $aBanFilter)) {
             $this->url()->send($aBanFilter['url'], null, Phpfox::getPhrase('ban.filter_successfully_added'));
         }
     }
     $aFilters = Phpfox::getService('ban')->getFilters($aBanFilter['type']);
     foreach ($aFilters as $iKey => $aFilter) {
         $aFilters[$iKey]['s_user_groups_affected'] = '';
         if (is_array($aFilter['user_groups_affected'])) {
             foreach ($aFilter['user_groups_affected'] as $aGroup) {
                 $aFilters[$iKey]['s_user_groups_affected'] .= Phpfox_Locale::instance()->convert($aGroup['title']) . ', ';
             }
             $aFilters[$iKey]['s_user_groups_affected'] = rtrim($aFilters[$iKey]['s_user_groups_affected'], ', ');
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('ban.ban') . ': ' . $aBanFilter['title'])->setBreadcrumb(Phpfox::getPhrase('ban.ban_filters'))->setSectionTitle('Ban: ' . $aBanFilter['title'])->assign(array('aFilters' => $aFilters, 'aBanFilter' => $aBanFilter));
 }
예제 #6
0
 /**
  * Controller
  */
 public function process()
 {
     list($aGroups, $aModules, $aProductGroups) = Phpfox::getService('admincp.setting.group')->get();
     $aCond = array();
     $aUrl = array();
     $sSettingTitle = '';
     if ($sSettingId = $this->request()->get('setting-id')) {
         $aCond[] = " AND setting.setting_id = " . (int) $sSettingId;
         $aUrl = array('setting', 'edit', 'setting-id' => $sSettingId);
     }
     if ($sGroupId = $this->request()->get('group-id')) {
         $aCond[] = " AND setting.group_id = '" . Phpfox_Database::instance()->escape($sGroupId) . "' AND setting.is_hidden = 0 ";
         $aUrl = array('setting', 'edit', 'group-id' => $sGroupId);
         foreach ($aGroups as $aGroup) {
             if ($aGroup['group_id'] == $sGroupId) {
                 $sSettingTitle = $aGroup['var_name'];
                 break;
             }
         }
     }
     if ($iModuleId = $this->request()->get('module-id')) {
         $aCond[] = " AND setting.module_id = '" . Phpfox_Database::instance()->escape($iModuleId) . "' AND setting.is_hidden = 0 ";
         $aUrl = array('setting', 'edit', 'module-id' => $iModuleId);
         foreach ($aModules as $aModule) {
             if ($aModule['module_id'] == $iModuleId) {
                 $sSettingTitle = $aModule['module_id'];
                 break;
             }
         }
     }
     if ($sProductId = $this->request()->get('product-id')) {
         $aCond[] = " AND setting.product_id = '" . Phpfox_Database::instance()->escape($sProductId) . "' AND setting.is_hidden = 0 ";
         $aUrl = array('setting', 'edit', 'product-id' => $sProductId);
         foreach ($aProductGroups as $aProduct) {
             if ($aProduct['product_id'] == $sProductId) {
                 $sSettingTitle = $aProduct['var_name'];
                 break;
             }
         }
     }
     $aSettings = Phpfox::getService('admincp.setting')->get($aCond);
     if ($aVals = $this->request()->getArray('val')) {
         if (Phpfox::getService('admincp.setting.process')->update($aVals)) {
             // $this->url()->send('admincp', $aUrl, Phpfox::getPhrase('admincp.updated'));
             return ['updated' => true];
         }
     }
     $sWatermarkImage = Phpfox::getParam('core.url_watermark') . sprintf(Phpfox::getParam('core.watermark_image'), '') . '?v=' . uniqid();
     if (!file_exists(Phpfox::getParam('core.dir_watermark') . sprintf(Phpfox::getParam('core.watermark_image'), '')) && Phpfox::getParam('core.allow_cdn')) {
         $sWatermarkImage = Phpfox::getLib('cdn')->getUrl(str_replace(PHPFOX_DIR, '', $sWatermarkImage));
     }
     if (Phpfox::isModule($sSettingTitle)) {
         $sSettingTitle = Phpfox_Locale::instance()->translate($sSettingTitle, 'module');
     }
     $this->template()->setSectionTitle($sSettingTitle);
     $this->template()->setBreadCrumb(Phpfox::getPhrase('admincp.manage_settings'), $this->url()->makeUrl('admincp.setting'))->setBreadCrumb(Phpfox::getPhraseT($sSettingTitle, 'module'), null, true)->setTitle(Phpfox::getPhrase('admincp.manage_settings'))->assign(array('aGroups' => $aGroups, 'aModules' => $aModules, 'aProductGroups' => $aProductGroups, 'aSettings' => $aSettings, 'sSettingTitle' => $sSettingTitle, 'sWatermarkImage' => $sWatermarkImage));
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_edit_process')) ? eval($sPlugin) : false;
 }
예제 #7
0
 /**
  * Controller
  */
 public function process()
 {
     $aUser = Phpfox::getService('user')->get(Phpfox::getUserId(), true);
     $aGroup = Phpfox::getService('user.group')->getGroup($aUser['user_group_id']);
     $aInfo = array(Phpfox::getPhrase('core.membership') => (empty($aGroup['icon_ext']) ? '' : '<img src="' . Phpfox::getParam('core.url_icon') . $aGroup['icon_ext'] . '" class="v_middle" alt="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" title="' . Phpfox_Locale::instance()->convert($aGroup['title']) . '" /> ') . $aGroup['prefix'] . Phpfox_Locale::instance()->convert($aGroup['title']) . $aGroup['suffix'], Phpfox::getPhrase('core.activity_points') => $aUser['activity_points'], Phpfox::getPhrase('core.profile_views') => $aUser['total_view'], Phpfox::getPhrase('core.space_used') => Phpfox::getUserParam('user.total_upload_space') === 0 ? Phpfox::getPhrase('user.space_total_out_of_unlimited', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']))) : Phpfox::getPhrase('user.space_total_out_of_total', array('space_total' => Phpfox_File::instance()->filesize($aUser['space_total']), 'total' => Phpfox::getUserParam('user.total_upload_space'))), Phpfox::getPhrase('core.member_since') => Phpfox::getLib('date')->convertTime($aUser['joined'], 'core.profile_time_stamps'));
     if (Phpfox::isModule('rss')) {
         $aInfo[Phpfox::getPhrase('rss.rss_subscribers')] = '<a href="#" onclick="tb_show(\'' . Phpfox::getPhrase('rss.rss_subscribers_log') . '\', $.ajaxBox(\'rss.log\', \'height=500&amp;width=500\')); return false;">' . $aUser['rss_count'] . '</a>';
     }
     $this->template()->assign(array('aInfos' => $aInfo));
 }
예제 #8
0
 /**
  * Controller
  */
 public function process()
 {
     $this->_setMenuName('admincp.user.browse');
     $bIsEdit = false;
     if ($iId = $this->request()->getInt('id')) {
         if ($aUser = Phpfox::getService('user')->getForEdit($iId)) {
             $bIsEdit = true;
             if (!empty($aUser['birthday'])) {
                 $aUser = array_merge($aUser, Phpfox::getService('user')->getAgeArray($aUser['birthday']));
             }
             $this->template()->assign('aForms', $aUser);
             if (Phpfox::getService('user')->isAdminUser($aUser['user_id'])) {
                 return Phpfox_Error::display(Phpfox::getPhrase('user.you_are_unable_to_edit_a_site_administrators_account'));
             }
         }
     }
     if (!isset($aUser)) {
         $this->url()->send('admincp', null, 'This section requires that you select.');
     }
     if ($aVals = $this->request()->getArray('val')) {
         if ($bIsEdit) {
             if (Phpfox::getService('user.process')->updateAdvanced($aUser['user_id'], $aVals)) {
                 Phpfox::getService('custom.process')->updateFields($aUser['user_id'], Phpfox::getUserId(), $this->request()->getArray('custom'));
                 if (Phpfox::getUserParam('user.can_edit_other_user_privacy')) {
                     Phpfox::getService('user.privacy.process')->update($aVals, $aUser['user_id']);
                 }
                 $this->url()->send('admincp.user.add', array('id' => $aUser['user_id']), Phpfox::getPhrase('user.user_successfully_updated'));
             }
         } else {
         }
     }
     $aUserGroups = array();
     foreach (Phpfox::getService('user.group')->get() as $aUserGroup) {
         $aUserGroups[$aUserGroup['user_group_id']] = Phpfox_Locale::instance()->convert($aUserGroup['title']);
     }
     $aLanguages = array();
     foreach (Phpfox::getService('language')->get(array('l.user_select = 1')) as $aLanguage) {
         $aLanguages[$aLanguage['language_id']] = Phpfox::getLib('parse.output')->clean($aLanguage['title']);
     }
     $aEditForm = array('basic' => array('title' => Phpfox::getPhrase('user.basic_information'), 'data' => array(array('title' => Phpfox::getPhrase('user.display_name'), 'value' => isset($aVals['full_name']) ? $aVals['full_name'] : (isset($aUser['full_name']) ? $aUser['full_name'] : ''), 'type' => 'input:text', 'id' => 'full_name', 'required' => true), array('title' => Phpfox::getPhrase('user.username'), 'value' => isset($aVals['user_name']) ? $aVals['user_name'] : (isset($aUser['user_name']) ? $aUser['user_name'] : ''), 'type' => 'input:text:check', 'id' => 'user_name', 'required' => true), array('title' => Phpfox::getPhrase('user.password'), 'value' => '', 'type' => 'input:password:check', 'id' => 'password', 'required' => true), array('title' => Phpfox::getPhrase('user.email'), 'value' => isset($aVals['email']) ? $aVals['email'] : (isset($aUser['email']) ? $aUser['email'] : ''), 'type' => 'input:text:check', 'id' => 'email', 'required' => true), array('title' => Phpfox::getPhrase('user.user_group'), 'value' => isset($aVals['user_group_id']) ? $aVals['user_group_id'] : (isset($aUser['user_group_id']) ? $aUser['user_group_id'] : ''), 'type' => 'select', 'id' => 'user_group_id', 'options' => $aUserGroups, 'required' => true), array('title' => Phpfox::getPhrase('user.location'), 'value' => isset($aVals['country_iso']) ? $aVals['country_iso'] : (isset($aUser['country_iso']) ? $aUser['country_iso'] : ''), 'type' => 'select', 'id' => 'country_iso', 'options' => Phpfox::getService('core.country')->get()), array('title' => Phpfox::getPhrase('user.city'), 'value' => isset($aVals['city_location']) ? $aVals['city_location'] : (isset($aUser['city_location']) ? $aUser['city_location'] : ''), 'type' => 'input:text', 'id' => 'city_location'), array('title' => Phpfox::getPhrase('user.zip_postal_code'), 'value' => isset($aVals['postal_code']) ? $aVals['postal_code'] : (isset($aUser['postal_code']) ? $aUser['postal_code'] : ''), 'type' => 'input:text', 'id' => 'postal_code'), array('title' => Phpfox::getPhrase('user.gender'), 'value' => isset($aVals['gender']) ? $aVals['gender'] : (isset($aUser['gender']) ? $aUser['gender'] : ''), 'type' => 'select', 'id' => 'gender', 'options' => Phpfox::getService('core')->getGenders(), 'required' => true), array('title' => Phpfox::getPhrase('user.date_of_birth'), 'type' => 'date_of_birth'), array('title' => Phpfox::getPhrase('user.time_zone'), 'value' => isset($aVals['time_zone']) ? $aVals['time_zone'] : (isset($aUser['time_zone']) ? $aUser['time_zone'] : ''), 'type' => 'select', 'id' => 'time_zone', 'options' => Phpfox::getService('core')->getTimeZones()), array('title' => Phpfox::getPhrase('user.status'), 'value' => isset($aVals['status']) ? $aVals['status'] : (isset($aUser['status']) ? $aUser['status'] : ''), 'type' => 'input:text', 'id' => 'status'), array('title' => Phpfox::getPhrase('user.spam_count'), 'value' => isset($aVals['total_spam']) ? $aVals['total_spam'] : (isset($aUser['total_spam']) ? $aUser['total_spam'] : ''), 'type' => 'input:text', 'id' => 'total_spam'), array('title' => Phpfox::getPhrase('user.primary_language'), 'value' => isset($aVals['language_id']) ? $aVals['language_id'] : (isset($aUser['language_id']) ? $aUser['language_id'] : ''), 'type' => 'select', 'id' => 'language_id', 'options' => $aLanguages), array('title' => Phpfox::getPhrase('user.forum_signature'), 'value' => isset($aVals['signature']) ? $aVals['signature'] : (isset($aUser['signature']) ? $aUser['signature'] : ''), 'type' => 'input:textarea', 'id' => 'signature'))));
     ($sPlugin = Phpfox_Plugin::get('user.component_controller_admincp_add')) ? eval($sPlugin) : false;
     list($aUserPrivacy, $aNotifications, $aProfiles) = Phpfox::getService('user.privacy')->get($aUser['user_id']);
     $this->setParam('aUser', $aUser);
     $aActivityPoints = array();
     $aActivityPoints['activity_total'] = array(Phpfox::getPhrase('user.total_activity') => $aUser['activity_total']);
     $aActivityPoints['activity_points'] = array(Phpfox::getPhrase('user.total_activity_points') => $aUser['activity_points']);
     $aMassActivityCallback = Phpfox::massCallback('getActivityPointField');
     foreach ($aMassActivityCallback as $aMassActivityCallbackModules) {
         foreach ($aMassActivityCallbackModules as $sName => $sValue) {
             $aActivityPoints[$sValue] = array($sName => $aUser[$sValue]);
         }
     }
     $aSettings = Phpfox::getService('custom')->getForEdit(array('user_main', 'user_panel', 'profile_panel'), $aUser['user_id'], $aUser['user_group_id'], false, $aUser['user_id']);
     $this->template()->setSectionTitle('Members')->setTitle(Phpfox::getPhrase('user.editing_member'))->setBreadcrumb(Phpfox::getPhrase('user.browse_members'), $this->url()->makeUrl('admincp.user.browse'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('user.editing_member') . ': ' . $aUser['full_name'] . ' (#' . $aUser['user_id'] . ')' : Phpfox::getPhrase('user.add_new_member'), null, true)->setPhrase(array('user.loading_custom_fields'))->setHeader('cache', array('country.js' => 'module_core'))->assign(array('bIsEdit' => $bIsEdit, 'iFormUserId' => $bIsEdit ? $aUser['user_id'] : '', 'aEditForm' => $aEditForm, 'aSettings' => $aSettings, 'aUser' => $aUser, 'aPrivacyNotifications' => $aNotifications, 'aProfiles' => $aProfiles, 'aUserPrivacy' => $aUserPrivacy, 'aActivityPoints' => $aActivityPoints, 'sDobStart' => Phpfox::getParam('user.date_of_birth_start'), 'sDobEnd' => Phpfox::getParam('user.date_of_birth_end')));
 }
예제 #9
0
 /**
  * @todo Cache ME
  *
  * @param unknown_type $iId
  * @return unknown
  */
 public function getGroup($iId)
 {
     static $aCache = array();
     if (!isset($aCache[$iId])) {
         $aCache[$iId] = $this->database()->select('user_group.*')->from($this->_sTable, 'user_group')->where('user_group_id = ' . (int) $iId)->execute('getRow');
     }
     $sPhraseVar = 'user.' . str_replace(' ', '_', strtolower($aCache[$iId]['title']));
     if (Phpfox_Locale::instance()->isPhrase($sPhraseVar)) {
         $aCache[$iId]['title'] = Phpfox::getPhrase($sPhraseVar);
     }
     return $aCache[$iId];
 }
예제 #10
0
 public function getGroups()
 {
     $aRows = $this->database()->select('setting_group.group_id, language_phrase.text AS language_var_name')->from($this->_sTable, 'setting_group')->leftJoin(Phpfox::getT('product'), 'product', 'product.product_id = setting_group.product_id AND product.is_active = 1')->leftJoin(Phpfox::getT('language_phrase'), 'language_phrase', array("language_phrase.language_id = '" . $this->database()->escape(Phpfox_Locale::instance()->getLangId()) . "'", "AND language_phrase.var_name = setting_group.var_name"))->execute('getSlaveRows');
     foreach ($aRows as $iKey => $aRow) {
         if (!empty($aRow['language_var_name'])) {
             $aParts = explode('</title><info>', $aRow['language_var_name']);
             $aRows[$iKey]['var_name'] = str_replace('<title>', '', $aParts[0]);
             $aRows[$iKey]['setting_info'] = str_replace(array("\n", '</info>'), array("<br />", ''), $aParts[1]);
         }
     }
     return $aRows;
 }
예제 #11
0
 /**
  * Controller
  */
 public function process()
 {
     if ($this->template()->getThemeFolder() == 'nebula' || $this->template()->getParentThemeFolder() == 'nebula') {
         return false;
     }
     // If the user is not a member don't display this block
     if (!Phpfox::isUser()) {
         return false;
     }
     $sUserProfileImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true)), array('path' => 'core.url_user', 'file' => Phpfox::getUserBy('user_image'), 'suffix' => '_50_square', 'max_width' => 50, 'max_height' => 50)));
     $aGroup = Phpfox::getService('user.group')->getGroup(Phpfox::getUserBy('user_group_id'));
     // Assign template vars
     $this->template()->assign(array('sUserProfileImage' => $sUserProfileImage, 'sUserProfileUrl' => $this->url()->makeUrl('profile', Phpfox::getUserBy('user_name')), 'sCurrentUserName' => Phpfox::getLib('parse.output')->shorten(Phpfox::getLib('parse.output')->clean(Phpfox::getUserBy('full_name')), Phpfox::getParam('user.max_length_for_username'), '...'), 'sCurrentTimeStamp' => Phpfox::getTime(Phpfox::getParam('core.global_welcome_time_stamp'), PHPFOX_TIME), 'iTotalActivityPoints' => (int) Phpfox::getUserBy('activity_points'), 'iTotalProfileViews' => (int) Phpfox::getUserBy('total_view'), 'sUserGroupFullName' => Phpfox_Locale::instance()->convert($aGroup['title'])));
 }
예제 #12
0
 public function updateSetting($aVals)
 {
     $aModules = explode('|', $aVals['module']);
     $aVals['name'] = strtolower(preg_replace("/\\W/i", "_", $aVals['name']));
     $this->database()->update($this->_sTable, array('module_id' => $aModules[0], 'product_id' => $aVals['product_id'], 'name' => $aVals['name'], 'type_id' => $aVals['type'], 'default_admin' => $aVals['user_group'][ADMIN_USER_ID], 'default_user' => $aVals['user_group'][NORMAL_USER_ID], 'default_guest' => $aVals['user_group'][GUEST_USER_ID], 'default_staff' => $aVals['user_group'][STAFF_USER_ID]), 'setting_id = ' . (int) $aVals['setting_id']);
     if (Phpfox_Locale::instance()->isPhrase('admincp.user_setting_' . $aVals['name'])) {
         foreach ($aVals['text'] as $sLang => $sValue) {
             Phpfox::getService('language.phrase.process')->updateVarName($sLang, 'admincp.user_setting_' . $aVals['name'], $sValue);
         }
     } else {
         Phpfox::getService('language.phrase.process')->add(array('var_name' => 'user_setting_' . $aVals['name'], 'product_id' => $aVals['product_id'], 'module' => $aVals['module'], 'text' => $aVals['text']));
     }
     $this->cache()->remove('user_group_setting', 'substr');
     return true;
 }
예제 #13
0
 /**
  * Cleans the values and calls the sending function
  *
  * @param array $aValues
  * @return unknown
  */
 public function sendContactMessage($aValues)
 {
     $sSiteEmail = Phpfox::getParam('contact.contact_staff_emails');
     if (empty($sSiteEmail)) {
         $sSiteEmail = Phpfox::getParam('core.email_from_email');
     }
     if (empty($sSiteEmail)) {
         return false;
     }
     // its better if we instantiate here instead of dynamic calling the lib every time
     $oParser = Phpfox::getLib('parse.input');
     // Remove all tags to make it plain text
     $sText = '';
     if (Phpfox::getUserId()) {
         $sText .= Phpfox::getPhrase('contact.full_name') . ': ' . Phpfox::getUserBy('full_name') . '<br />';
         $sText .= Phpfox::getPhrase('contact.user_id') . ': ' . Phpfox::getUserId() . '<br />';
         $sText .= Phpfox::getPhrase('contact.profile') . ': ' . Phpfox_Url::instance()->makeUrl(Phpfox::getUserBy('user_name')) . '<br />';
     }
     $sText .= Phpfox::getPhrase('contact.email') . ': ' . $aValues['email'] . '<br />';
     $sText .= '------------------------------------------------------------<br />';
     if (!empty($aValues['category_id']) && $aValues['category_id'] == 'phpfox_sales_ticket') {
         $sText = $oParser->clean($aValues['text']);
     } else {
         $sText .= Phpfox::getParam('contact.allow_html_in_contact') == true ? $oParser->prepare($aValues['text']) : $oParser->clean($aValues['text']);
     }
     // check if the user is logged in to include
     if (Phpfox::getUserId() > 0) {
         $aValues['full_name'] .= ' (user id:' . Phpfox::getUserId() . ')';
     }
     // send the mail
     $aMails = explode(',', $sSiteEmail);
     if (!empty($aValues['category_id']) && $aValues['category_id'] == 'phpfox_sales_ticket') {
         $aValues['category_id'] = '';
     }
     $bResult = true;
     foreach ($aMails as $sMail) {
         $sMail = trim($sMail);
         $bSend = Phpfox::getLib('mail')->to($sMail)->messageHeader(false)->subject((!empty($aValues['category_id']) ? Phpfox_Locale::instance()->convert($aValues['category_id']) . ': ' : '') . $aValues['subject'])->message($sText)->fromName($aValues['full_name'])->fromEmail(Phpfox::getParam('core.email_from_email'))->send();
         $bResult = $bResult && $bSend;
     }
     if (isset($aValues['copy'])) {
         Phpfox::getLib('mail')->to($aValues['email'])->messageHeader(false)->subject((!empty($aValues['category_id']) ? Phpfox_Locale::instance()->convert($aValues['category_id']) . ': ' : '') . $aValues['subject'])->message($sText)->fromName(Phpfox::getParam('core.mail_from_name'))->fromEmail(Phpfox::getParam('core.email_from_email'))->send();
     }
     if (Phpfox::getParam('contact.enable_auto_responder')) {
         Phpfox::getLib('mail')->to($aValues['email'])->messageHeader(false)->subject(Phpfox::getParam('contact.auto_responder_subject'))->message(Phpfox::getParam('contact.auto_responder_message'))->fromEmail(Phpfox::getParam('core.email_from_email'))->fromName(Phpfox::getParam('core.site_title'))->send();
     }
     return $bResult;
 }
예제 #14
0
파일: add.class.php 프로젝트: lev1976g/core
    /**
     * Controller
     */
    public function process()
    {
        Phpfox::getUserParam('admincp.can_add_new_block', true);
        $bIsEdit = false;
        if (($iEditId = $this->request()->getInt('id')) || ($iEditId = $this->request()->getInt('block_id'))) {
            $aRow = Admincp_Service_Block_Block::instance()->getForEdit($iEditId);
            $bIsEdit = true;
            $this->template()->assign(array('aForms' => $aRow, 'aAccess' => empty($aRow['disallow_access']) ? null : unserialize($aRow['disallow_access'])));
        }
        $aValidation = array('product_id' => Phpfox::getPhrase('admincp.select_product'), 'location' => Phpfox::getPhrase('admincp.select_block_placement'), 'is_active' => Phpfox::getPhrase('admincp.specify_block_active'));
        $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
        if ($aVals = $this->request()->getArray('val')) {
            if ($oValid->isValid($aVals)) {
                if ($bIsEdit) {
                    $sMessage = Phpfox::getPhrase('admincp.successfully_updated');
                    $aUrl = array('block', 'add', 'id' => $aRow['block_id']);
                    Phpfox::getService('admincp.block.process')->update($aRow['block_id'], $aVals);
                } else {
                    $sMessage = Phpfox::getPhrase('admincp.block_successfully_added');
                    $aUrl = array('block');
                    Phpfox::getService('admincp.block.process')->add($aVals);
                }
                $this->url()->send('admincp', $aUrl, $sMessage);
            }
        }
        if (Phpfox::getParam('core.enabled_edit_area')) {
            $this->template()->setHeader(array('editarea/edit_area_full.js' => 'static_script', '<script type="text/javascript">				
						editAreaLoader.init({
							id: "source_code"	
							,start_highlight: true
							,allow_resize: "both"
							,allow_toggle: false
							,word_wrap: false
							,language: "en"
							,syntax: "php"
						});		
					</script>'));
        }
        $aStyles = Theme_Service_Style_Style::instance()->getStyles();
        if ($bIsEdit) {
            foreach ($aStyles as $iKey => $aStyle) {
                if (isset($aRow['style_id']) && isset($aRow['style_id'][$aStyle['style_id']])) {
                    $aStyles[$iKey]['block_is_selected'] = $aRow['style_id'][$aStyle['style_id']];
                }
            }
        }
        $this->template()->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aControllers' => Phpfox::getService('admincp.component')->get(true), 'aComponents' => Phpfox::getService('admincp.component')->get(), 'aUserGroups' => Phpfox::getService('user.group')->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit, 'aStyles' => $aStyles))->setTitle(Phpfox::getPhrase('admincp.block_manager'))->setBreadcrumb(Phpfox::getPhrase('admincp.block_manager'), $this->url()->makeUrl('admincp.block'))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('admincp.editing') . ': ' . (empty($aRow['m_connection']) ? Phpfox::getPhrase('admincp.site_wide') : $aRow['m_connection']) . (empty($aRow['component']) ? '' : '::' . rtrim(str_replace('|', '::', $aRow['component']), '::')) . (empty($aRow['title']) ? '' : ' (' . Phpfox_Locale::instance()->convert($aRow['title']) . ')') : Phpfox::getPhrase('admincp.add_new_block'), $this->url()->makeUrl('admincp.block.add'), true)->setTitle(Phpfox::getPhrase('admincp.add_new_block'));
    }
예제 #15
0
 public function import($aVals, $sProductName = null, $bMissingOnly = false, $bIsInstall = false)
 {
     if ($bMissingOnly) {
         $aLang = Phpfox::getService('language')->getLanguageByName($aVals['settings']['title']);
         if (!isset($aLang['language_id'])) {
             return Phpfox_Error::set(Phpfox::getPhrase('language.cannot_import'));
         }
         $aSql = array();
         foreach ($aVals['phrases']['phrase'] as $aValue) {
             $sPhrase = $aValue['module_id'] . '.' . $aValue['var_name'];
             $bPassed = true;
             if (!$bIsInstall && !Phpfox_Locale::instance()->isPhrase($sPhrase)) {
                 $bPassed = false;
             }
             if ($bPassed) {
                 $iModuleId = Phpfox_Module::instance()->getModuleId($aValue['module_id']);
                 $aSql[] = array($aLang['language_id'], $iModuleId, $sProductName, $aValue['version_id'], $aValue['var_name'], $aValue['value'], $aValue['value'], $aValue['added']);
             }
         }
         if ($aSql) {
             $this->database()->multiInsert(Phpfox::getT('language_phrase'), array('language_id', 'module_id', 'product_id', 'version_id', 'var_name', 'text', 'text_default', 'added'), $aSql);
             $this->cache()->remove('locale', 'substr');
         }
         return true;
     } else {
         $this->add(array('title' => $aVals['settings']['title'], 'user_select' => $aVals['settings']['user_select'], 'language_code' => $aVals['settings']['language_code'], 'charset' => $aVals['settings']['charset'], 'direction' => $aVals['settings']['direction'], 'time_stamp' => $aVals['settings']['time_stamp'], 'created' => $aVals['settings']['created'], 'site' => $aVals['settings']['site'], 'is_default' => $bIsInstall ? 1 : 0, 'is_master' => $bIsInstall ? 1 : 0));
         $aSql = array();
         $iLength = 0;
         $iLanguageId = $aVals['settings']['language_code'];
         foreach ($aVals['phrases']['phrase'] as $aValue) {
             $iModuleId = Phpfox_Module::instance()->getModuleId($aValue['module']);
             $aSql[] = array($iLanguageId, $iModuleId, $sProductName, $aValue['version_id'], $aValue['var_name'], $aValue['value'], $aValue['value'], $aValue['added']);
             $iLength += strlen($aValue['value']);
             if ($iLength > 102400) {
                 $this->database()->multiInsert(Phpfox::getT('language_phrase'), array('language_id', 'module_id', 'product_id', 'version_id', 'var_name', 'text', 'text_default', 'added'), $aSql);
                 $aSql = array();
                 $iLength = 0;
             }
         }
         if ($aSql) {
             $this->database()->multiInsert(Phpfox::getT('language_phrase'), array('language_id', 'module_id', 'product_id', 'version_id', 'var_name', 'text', 'text_default', 'added'), $aSql);
         }
         unset($aSql, $iLength);
         $this->cache()->remove('locale', 'substr');
     }
     return true;
 }
예제 #16
0
 public function setHeaders()
 {
     $sCacheId = $this->cache()->set('seo_nofollow_build');
     if (!($aNoFollows = $this->cache()->get($sCacheId))) {
         $aRows = $this->database()->select('*')->from(Phpfox::getT('seo_nofollow'))->execute('getSlaveRows');
         $aNoFollows = array();
         foreach ($aRows as $aRow) {
             $aNoFollows[$aRow['url']] = true;
         }
         $this->cache()->save($sCacheId, $aNoFollows);
     }
     if (count($aNoFollows)) {
         $sUrl = trim(Phpfox_Url::instance()->getFullUrl(true), '/');
         if (isset($aNoFollows[$sUrl])) {
             Phpfox_Template::instance()->setHeader('<meta name="robots" content="nofollow" />');
         }
     }
     $sCacheId = $this->cache()->set('seo_meta_build');
     if (!($aMetas = $this->cache()->get($sCacheId))) {
         $aRows = $this->database()->select('*')->from(Phpfox::getT('seo_meta'))->execute('getSlaveRows');
         $aMetas = array();
         foreach ($aRows as $aRow) {
             if (!isset($aMetas[$aRow['url']])) {
                 $aMetas[$aRow['url']] = array();
             }
             $aMetas[$aRow['url']][] = $aRow;
         }
         $this->cache()->save($sCacheId, $aMetas);
     }
     if (count($aMetas)) {
         $sUrl = trim(Phpfox_Url::instance()->getFullUrl(true), '/');
         if (isset($aMetas[$sUrl])) {
             foreach ($aMetas[$sUrl] as $aMeta) {
                 if ($aMeta['type_id'] == '2') {
                     Phpfox_Template::instance()->setTitle(Phpfox_Locale::instance()->convert($aMeta['content']));
                     continue;
                 }
                 Phpfox_Template::instance()->setMeta(!$aMeta['type_id'] ? 'keywords' : 'description', $aMeta['content']);
             }
         }
     }
 }
예제 #17
0
 /**
  * This function adds a ban filter, it was not renamed after 2.1 for compatibility
  * @param array $aVals
  * @param <type> $aBanFilter
  * @return true
  */
 public function add($aVals, &$aBanFilter = null)
 {
     Phpfox::isAdmin(true);
     $aForm = array('type_id' => array('type' => 'string:required'), 'find_value' => array('type' => 'string:required', 'message' => Phpfox::getPhrase('ban.filter_value_is_required')), 'reason' => array('type' => 'string'), 'days_banned' => array('type' => 'int'), 'return_user_group' => array('type' => 'int'), 'bShow' => array('type' => 'string'), 'user_groups_affected' => array('type' => 'array'));
     if ($aBanFilter !== null && isset($aBanFilter['replace'])) {
         $aForm['replacement'] = array('type' => 'string:required', 'message' => Phpfox::getPhrase('ban.filter_replacement_is_required'));
     }
     $aVals = $this->validator()->process($aForm, $aVals);
     if (!Phpfox_Error::isPassed()) {
         return false;
     }
     if ($aVals['find_value'] == Phpfox::getIp()) {
         return Phpfox_Error::set('You cannot ban yourself.');
     }
     $aVals['user_id'] = Phpfox::getUserId();
     $aVals['time_stamp'] = PHPFOX_TIME;
     $aVals['find_value'] = $this->preParse()->convert($aVals['find_value']);
     if (isset($aVals['bShow']) && $aVals['bShow'] == '0' || !isset($aVals['bShow'])) {
         unset($aVals['reason']);
         unset($aVals['days_banned']);
         unset($aVals['return_user_group']);
     } else {
         $aVals['reason'] = !Phpfox_Locale::instance()->isPhrase($aVals['reason']) ? Phpfox::getLib('parse.input')->clean($aVals['reason']) : $aVals['reason'];
         $aVals['days_banned'] = (int) $aVals['days_banned'];
         $aVals['return_user_group'] = (int) $aVals['return_user_group'];
         if (!isset($aVals['user_groups_affected'])) {
             $aVals['user_groups_affected'] = array();
         }
         $aVals['user_groups_affected'] = serialize($aVals['user_groups_affected']);
     }
     unset($aVals['bShow']);
     if (isset($aVals['replacement'])) {
         $aVals['replacement'] = $this->preParse()->convert($aVals['replacement']);
     }
     if (empty($aVals['user_groups_affected'])) {
         $aVals['user_groups_affected'] = '';
     }
     $this->database()->insert($this->_sTable, $aVals);
     $this->cache()->remove('ban', 'substr');
     return true;
 }
예제 #18
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('language.can_manage_lang_packs', true);
     if ($this->request()->get('no')) {
         $this->url()->send('admincp', 'language');
     }
     $iId = $this->request()->get('id');
     if (!$iId) {
         return Phpfox_Error::display(Phpfox::getPhrase('language.invalid_language'));
     }
     $aLanguage = Phpfox::getService('language')->getLanguage($iId);
     if (!isset($aLanguage['language_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('language.invalid_language_package'));
     }
     if ($this->request()->get('yes')) {
         if (Phpfox::getService('language.process')->delete($iId)) {
             Phpfox_Locale::instance()->autoLoadLanguage();
             $this->url()->send('admincp', 'language', Phpfox::getPhrase('language.language_package_successfully_deleted'));
         }
     }
     $this->template()->assign(array('aLanguage' => $aLanguage))->setTitle(Phpfox::getPhrase('language.manage_language_packages'))->setTitle(Phpfox::getPhrase('language.delete'))->setBreadcrumb(Phpfox::getPhrase('language.manage_language_packages'))->setBreadcrumb(Phpfox::getPhrase('language.delete'));
 }
예제 #19
0
파일: add.class.php 프로젝트: lev1976g/core
 /**
  * Controller
  */
 public function process()
 {
     $iGroupId = $this->request()->getInt('id');
     $sModule = $this->request()->get('module');
     $this->template()->setSectionTitle(Phpfox::getPhrase('user.manage_user_groups'))->setHeader('cache', array('jquery/plugin/jquery.scrollTo.js' => 'static_script'));
     if ($iGroupId) {
         if ($this->request()->get('setting')) {
             Phpfox::getUserParam('user.can_manage_user_group_settings', true);
         } else {
             Phpfox::getUserParam('user.can_edit_user_group', true);
         }
         if ($aVals = $this->request()->getArray('val')) {
             if (Phpfox::getService('user.group.process')->update($iGroupId, $aVals)) {
                 $this->url()->send('admincp.user.group', null, Phpfox::getPhrase('user.user_group_updated'));
             }
         }
         $aGroup = Phpfox::getService('user.group')->getGroup($iGroupId);
         // http://www.phpfox.com/tracker/view/14644/
         if (Phpfox::getParam('core.allow_cdn')) {
             $aGroup['server_id'] = Phpfox::getLib('cdn')->getServerId();
         } else {
             $aGroup['server_id'] = 0;
         }
         if (!isset($aGroup['user_group_id'])) {
             return Phpfox_Error::display(Phpfox::getPhrase('user.invalid_user_group'));
         }
         $this->template()->assign(array('aModules' => Phpfox::getService('user.group.setting')->getModules($iGroupId), 'aForms' => $aGroup, 'sModule' => $sModule, 'iGroupId' => $iGroupId, 'bEditSettings' => $this->request()->get('setting') ? true : false))->setBreadcrumb(Phpfox::getPhrase('user.manage_settings') . ': ' . Phpfox_Locale::instance()->convert($aGroup['title']) . ' (ID#' . $aGroup['user_group_id'] . ')', $this->url()->makeUrl('current'), true)->setHeader('cache', array('template.css' => 'style_css'));
     } else {
         if ($aVals = $this->request()->getArray('val')) {
             if ($iId = Phpfox::getService('user.group.process')->add($aVals)) {
                 $this->url()->send('admincp.user.group', null, Phpfox::getPhrase('user.user_group_successfully_added'));
             }
         }
         $this->template()->setBreadcrumb(Phpfox::getPhrase('user.create_new_user_group'), $this->url()->makeUrl('current'), true)->setTitle(Phpfox::getPhrase('user.create_new_user_group'))->assign(array('aGroups' => Phpfox::getService('user.group')->get()));
     }
 }
예제 #20
0
 /**
  * This function scans every .php file in PHPFOX_DIR for >subject() and >message() and picks up 
  * the language phrase used in each case then it renews the cache file
  * @param bool $bForce Forces to create the cache file anew, if false it only returns the cache file if available
  * @return array
  */
 public function getMailPhrases($bForce = false)
 {
     $sCacheId = $this->cache()->set('language_mail_phrases');
     $aPhrases = array();
     if ($bForce || !($aPhrases = $this->cache()->get($sCacheId))) {
         $aAllFiles = Phpfox_File::instance()->getAllFiles(PHPFOX_DIR_MODULE, true);
         foreach ($aAllFiles as $sFileName) {
             $aSubjects = $aMessages = array();
             if (substr($sFileName, strrpos($sFileName, '.') + 1) != 'php') {
                 // only check .php files
                 continue;
             }
             $sContent = file_get_contents($sFileName);
             $iSubject = preg_match_all('/>subject\\((.+[^ ])\\)/', $sContent, $aSubjects);
             $iMessage = preg_match_all('/>message\\((.+[^ ])\\)/', $sContent, $aMessages);
             if ($iSubject === false || $iMessage === false) {
                 return Phpfox_Error::set('Error finding subjects and messages');
             }
             if (empty($aSubjects) && empty($aMessages) || empty($aSubjects[1]) && empty($aMessages[1])) {
                 continue;
             }
             $aTemp = array_merge($aSubjects[1], $aMessages[1]);
             foreach ($aTemp as $sTemp) {
                 if (preg_match('/([a-z]+\\.[a-z\\_]+)/', $sTemp, $aMatch)) {
                     if (!Phpfox_Locale::instance()->isPhrase($aMatch[1])) {
                         continue;
                     }
                     $aPhrase = explode('.', $aMatch[1]);
                     $aPhrases[$aMatch[1]] = array('file' => $sFileName, 'var_name' => $aPhrase[1], 'module' => $aPhrase[0], 'phrase_id' => $aMatch[1]);
                 }
             }
         }
         $this->cache()->save($sCacheId, $aPhrases);
     }
     return $aPhrases;
 }
예제 #21
0
 /**
  * @see Phpfox_Locale::translate()
  * @param string $sParam
  * @param string $sPrefix
  * @return string
  */
 public static function getPhraseT($sParam, $sPrefix)
 {
     return Phpfox_Locale::instance()->translate($sParam, $sPrefix);
 }
예제 #22
0
파일: App.php 프로젝트: JerwinPRO/phpfox
 /**
  * @return App\Object[]
  */
 public function all($includeModules = false)
 {
     $apps = [];
     if ($includeModules) {
         $modules = \Phpfox_Module::instance()->all();
         $skip = ['friend', 'like', 'announcement', 'notification', 'poke', 'poll', 'quiz', 'egift', 'newsletter', 'subscribe', 'comment', 'captcha', 'attachment', 'admincp', 'api', 'apps', 'ban', 'core', 'custom', 'emoticon', 'error', 'favorite', 'help', 'im', 'input', 'invite', 'language', 'link', 'log', 'mobile', 'page', 'privacy', 'profile', 'rate', 'report', 'request', 'rss', 'search', 'share', 'tag', 'theme', 'track', 'user'];
         foreach ($modules as $module_id) {
             if (in_array($module_id, $skip)) {
                 continue;
             }
             $coreFile = PHPFOX_DIR_MODULE . $module_id . '/install/version/v3.phpfox';
             // p($coreFile);
             if ($includeModules == '__core') {
                 if (!file_exists($coreFile)) {
                     continue;
                 }
             } else {
                 if ($includeModules == '__not_core' || $includeModules == '__remove_core') {
                     if (file_exists($coreFile)) {
                         continue;
                     }
                 }
             }
             $app = ['id' => '__module_' . $module_id, 'name' => \Phpfox_Locale::instance()->translate($module_id, 'module'), 'path' => null, 'is_module' => true];
             $apps[] = new App\Object($app);
         }
         // exit;
         if ($includeModules == '__core' || $includeModules == '__not_core') {
             return $apps;
         }
     }
     foreach ($this->_apps as $app) {
         $apps[] = new App\Object($app);
     }
     return $apps;
 }
예제 #23
0
파일: View.php 프로젝트: lev1976g/core
 public function getContent()
 {
     $Template = \Phpfox_Template::instance();
     if (!$this->_render) {
         /*
         if (PHPFOX_IS_AJAX_PAGE) {
         	\Phpfox_Module::instance()->getControllerTemplate();
         	$content = ob_get_contents(); ob_clean();
         	$content = (string) new View\Functions('content', $content);
         	return $content;
         }
         else {
         	\Phpfox_Module::instance()->getControllerTemplate();
         	$content = ob_get_contents(); ob_clean();
         
         	$this->_render['name'] = '@Base/Layout.html';
         	$this->_render['params']['content'] = $content;
         }
         */
         \Phpfox_Module::instance()->getControllerTemplate();
         $content = ob_get_contents();
         ob_clean();
         $this->_render['name'] = '@Base/' . self::$template . '.html';
         $this->_render['params']['content'] = $content;
     }
     $params = $this->_render['params'];
     $params['content'] = $this->_env->render($this->_render['name'], $params);
     if (PHPFOX_IS_AJAX_PAGE) {
         $content = (string) new View\Functions('content', $params['content']);
         return $content;
     }
     // $params['content'] = '<div class="_block_content">' . $params['content'] . '</div>';
     $params['content'] = new View\Functions('content', $params['content']);
     $params['header'] = $Template->getHeader();
     $params['title'] = $Template->getTitle();
     $params['js'] = $Template->getFooter();
     $params['nav'] = new View\Functions('nav');
     $params['menu'] = new View\Functions('menu');
     $params['share'] = new View\Functions('share');
     $params['notify'] = new View\Functions('notify');
     $params['search'] = new View\Functions('search');
     $params['footer'] = new View\Functions('footer');
     $params['errors'] = new View\Functions('errors');
     $params['top'] = new View\Functions('top');
     $params['left'] = new View\Functions('left');
     $params['right'] = new View\Functions('right');
     $params['h1'] = new View\Functions('h1');
     $params['breadcrumb'] = new View\Functions('breadcrumb');
     $params['notification'] = new View\Functions('notification');
     $params['logo'] = new View\Functions('logo');
     $params['body'] = 'id="page_' . \Phpfox_Module::instance()->getPageId() . '" class="' . \Phpfox_Module::instance()->getPageClass() . '"';
     // d($params['active']); exit;
     $locale = \Phpfox_Locale::instance()->getLang();
     $params['html'] = 'xmlns="http://www.w3.org/1999/xhtml" dir="' . $locale['direction'] . '" lang="' . $locale['language_code'] . '"';
     // return $this->_env->render($this->_render['name'], $params);
     return $this->_env->render('@Theme/' . self::$template . '.html', $params);
 }
예제 #24
0
 /**
  * Controller
  */
 public function process()
 {
     define('PHPFOX_PAGER_FORCE_COUNT', true);
     Phpfox::getUserParam('forum.can_view_forum', true);
     $iPage = $this->request()->getInt('page');
     $iPageSize = Phpfox::getParam('forum.total_posts_per_thread');
     $aThreadCondition = array();
     $aCallback = $this->getParam('aCallback', null);
     if (($iPostRedirect = $this->request()->getInt('permalink')) && ($sUrl = Phpfox::getService('forum.callback')->getFeedRedirectPost($iPostRedirect))) {
         $this->url()->forward(preg_replace('/\\/post_(.*)\\//i', '/view_\\1/', $sUrl));
     }
     if (Phpfox::isUser() && ($iView = $this->request()->getInt('view')) && Phpfox::isModule('notification')) {
         Phpfox::getService('notification.process')->delete('forum_subscribed_post', $iView, Phpfox::getUserId());
         Phpfox::getService('notification.process')->delete('forum_post_like', $iView, Phpfox::getUserId());
     }
     if (($iRedirect = $this->request()->getInt('redirect')) && ($aThread = Forum_Service_Thread_Thread::instance()->getForRedirect($iRedirect))) {
         if ($aThread['group_id'] > 0) {
             $aCallback = Phpfox::callback('group.addForum', $aThread['group_id']);
             if (isset($aCallback['module'])) {
                 $this->url()->send($aCallback['url_home'], array('forum', $aThread['title_url']));
             }
         }
         $this->url()->send('forum', array($aThread['forum_url'] . '-' . $aThread['forum_id'], $aThread['title_url']));
     }
     $threadId = $this->request()->getInt('req3');
     if ($this->request()->segment(3) == 'replies' && $this->request()->getInt('id')) {
         $threadId = $this->request()->getInt('id');
         $iPage = 1;
         $iPageSize = 200;
         $this->template()->setBreadCrumb('Latest Replies', $this->url()->current(), true);
         $this->template()->assign(['isReplies' => true]);
     }
     $aThreadCondition[] = 'ft.thread_id = ' . $threadId . '';
     $sPermaView = $this->request()->get('view', null);
     if ((int) $sPermaView <= 0) {
         $sPermaView = null;
     }
     list($iCnt, $aThread) = Forum_Service_Thread_Thread::instance()->getThread($aThreadCondition, array(), 'fp.time_stamp ASC', $iPage, $iPageSize, $sPermaView);
     if (!isset($aThread['thread_id'])) {
         return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_thread'));
     }
     if ($aThread['group_id'] > 0) {
         $aCallback = Phpfox::callback('pages.addForum', $aThread['group_id']);
         if (!Phpfox::getService('pages')->hasPerm($aThread['group_id'], 'forum.view_browse_forum')) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_thread'));
         }
     }
     Phpfox::getService('core.redirect')->check($aThread['title'], 'req4');
     if ($aThread['view_id'] != '0' && $aThread['user_id'] != Phpfox::getUserId()) {
         if (!Phpfox::getUserParam('forum.can_approve_forum_thread') && !Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'approve_thread')) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_thread'));
         }
     }
     if ($aCallback === null && !Phpfox::getService('forum')->hasAccess($aThread['forum_id'], 'can_view_forum')) {
         if (Phpfox::isUser()) {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.you_do_not_have_the_proper_permission_to_view_this_thread'));
         } else {
             return Phpfox_Error::display(Phpfox::getPhrase('forum.log_in_to_view_thread'));
         }
     }
     if ($aCallback === null && !Phpfox::getService('forum')->hasAccess($aThread['forum_id'], 'can_view_thread_content')) {
         $this->url()->send('forum', null, Phpfox::getPhrase('forum.you_do_not_have_the_proper_permission_to_view_this_thread'));
     }
     Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt));
     $aForum = Phpfox::getService('forum')->id($aThread['forum_id'])->getForum();
     if ($this->request()->get('approve') && (Phpfox::getUserParam('forum.can_approve_forum_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'approve_thread')) && $aThread['view_id']) {
         $sCurrentUrl = $this->url()->permalink('forum.thread', $aThread['thread_id'], $aThread['title']);
         if (Phpfox::getService('forum.thread.process')->approve($aThread['thread_id'], $sCurrentUrl)) {
             $this->url()->forward($sCurrentUrl);
         }
     }
     if ($iPostId = $this->request()->getInt('post')) {
         $iCurrentPage = Forum_Service_Post_Post::instance()->getPostPage($aThread['thread_id'], $iPostId, $iPageSize);
         $sFinalLink = $this->url()->permalink('forum.thread', $aThread['thread_id'], $aThread['title'], false, null, array('page' => $iCurrentPage));
         $this->url()->forward($sFinalLink . '#post' . $iPostId);
     }
     if (!$aThread['is_seen']) {
         if ($aCallback === null) {
             Phpfox::getService('forum.process')->updateTrack($aForum['forum_id']);
         }
         Phpfox::getService('forum.thread.process')->updateTrack($aThread['thread_id']);
     }
     if (Phpfox::isModule('tag') && $aCallback === null) {
         $aTags = Tag_Service_Tag::instance()->getTagsById($aCallback === null ? 'forum' : 'forum_group', $aThread['thread_id']);
         if (isset($aTags[$aThread['thread_id']])) {
             $aThread['tag_list'] = $aTags[$aThread['thread_id']];
         }
     }
     // Add tags to meta keywords
     if (!empty($aThread['tag_list']) && $aThread['tag_list'] && Phpfox::isModule('tag')) {
         $this->template()->setMeta('keywords', Tag_Service_Tag::instance()->getKeywords($aThread['tag_list']));
     }
     $this->setParam('iActiveForumId', $aForum['forum_id']);
     if (Phpfox::getParam('forum.rss_feed_on_each_forum')) {
         if ($aCallback === null) {
             $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('forum.forum') . ': ' . $aForum['name'] . '" href="' . $this->url()->makeUrl('forum', array('rss', 'forum' => $aForum['forum_id'])) . '" />');
         } else {
             $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('forum.group_forum') . ': ' . $aCallback['title'] . '" href="' . $this->url()->makeUrl('forum', array('rss', 'group' => $aCallback['group_id'])) . '" />');
         }
     }
     if (Phpfox::getParam('forum.enable_rss_on_threads')) {
         $this->template()->setHeader('<link rel="alternate" type="application/rss+xml" title="' . Phpfox::getPhrase('forum.thread') . ': ' . $aThread['title'] . '" href="' . $this->url()->makeUrl('forum', array('rss', 'thread' => $aThread['thread_id'])) . '" />');
     }
     if ($aCallback === null) {
         $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl('forum'))->setBreadcrumb($aForum['breadcrumb'])->setBreadcrumb(Phpfox_Locale::instance()->convert($aForum['name']), $this->url()->permalink('forum', $aForum['forum_id'], $aForum['name']));
     } else {
         $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.pages'), $this->url()->makeUrl('pages'));
         $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
         $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.discussions'), $aCallback['url_home'] . 'forum/');
     }
     $bCanManageThread = false;
     $bCanEditThread = false;
     $bCanDeleteThread = false;
     $bCanStickThread = false;
     $bCanCloseThread = false;
     $bCanMergeThread = false;
     if ($aCallback === null) {
         if (Phpfox::getUserParam('forum.can_edit_own_post') && $aThread['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('forum.can_edit_other_posts') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'edit_post')) {
             $bCanEditThread = true;
         }
         if (Phpfox::getUserParam('forum.can_delete_own_post') && $aThread['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('forum.can_delete_other_posts') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'delete_post')) {
             $bCanDeleteThread = true;
         }
         if (Phpfox::getUserParam('forum.can_stick_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'post_sticky')) {
             $bCanStickThread = true;
         }
         if (Phpfox::getUserParam('forum.can_close_a_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'close_thread')) {
             $bCanCloseThread = true;
         }
         if (Phpfox::getUserParam('forum.can_merge_forum_threads') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'merge_thread')) {
             $bCanMergeThread = true;
         }
         if (Phpfox::getUserParam('forum.can_edit_own_post') && $aThread['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('forum.can_edit_other_posts') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'edit_post') || (Phpfox::getUserParam('forum.can_move_forum_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'move_thread')) || (Phpfox::getUserParam('forum.can_copy_forum_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'copy_thread')) || Phpfox::getUserParam('forum.can_delete_own_post') && $aThread['user_id'] == Phpfox::getUserId() || Phpfox::getUserParam('forum.can_delete_other_posts') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'delete_post') || (Phpfox::getUserParam('forum.can_stick_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'post_sticky')) || (Phpfox::getUserParam('forum.can_close_a_thread') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'close_thread')) || (Phpfox::getUserParam('forum.can_merge_forum_threads') || Phpfox::getService('forum.moderate')->hasAccess($aThread['forum_id'], 'merge_thread'))) {
             $bCanManageThread = true;
         }
     } else {
         if (Phpfox::getService('pages')->isAdmin($aCallback['item'])) {
             $bCanEditThread = true;
             $bCanDeleteThread = true;
             $bCanStickThread = true;
             $bCanCloseThread = true;
             $bCanMergeThread = true;
             $bCanManageThread = true;
         }
     }
     $bCanPurchaseSponsor = false;
     if ((Phpfox::getUserParam('forum.can_purchase_sponsor') && $aThread['user_id'] == Phpfox::getUserId() || ($bCanCloseThread || $bCanStickThread) || Phpfox::getUserParam('forum.can_sponsor_thread')) && !defined('PHPFOX_IS_GROUP_VIEW')) {
         $bCanPurchaseSponsor = true;
     }
     $sCurrentThreadLink = $aCallback === null ? $this->url()->makeUrl('forum', array($aForum['name_url'] . '-' . $aForum['forum_id'], $aThread['title_url'])) : $this->url()->makeUrl($aCallback['url_home'], $aThread['title_url']);
     if ($this->request()->get('view')) {
         Phpfox_Module::instance()->appendPageClass('single_mode');
     }
     if (Phpfox::isUser()) {
         $this->template()->menu('Reply', '#', 'onclick="$Core.box(\'forum.reply\', 800, \'id=' . $aThread['thread_id'] . '\'); return false;"');
     }
     $this->template()->setTitle($aThread['title'])->setBreadcrumb($aThread['title'], $this->url()->permalink('forum.thread', $aThread['thread_id'], $aThread['title']), true)->setMeta('description', $aThread['title'] . ' - ' . $aForum['name'])->setMeta('keywords', $this->template()->getKeywords($aThread['title']))->setPhrase(array('forum.provide_a_reply', 'forum.adding_your_reply', 'forum.are_you_sure', 'forum.post_successfully_deleted'))->setEditor()->setHeader('cache', array('jquery/plugin/jquery.scrollTo.js' => 'static_script', 'quick_edit.js' => 'static_script', 'forum.js' => 'module_forum', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'switch_legend.js' => 'static_script', 'switch_menu.js' => 'static_script', 'feed.js' => 'module_feed'))->assign(array('aThread' => $aThread, 'aPost' => isset($aThread['post_starter']) ? $aThread['post_starter'] : '', 'iTotalPosts' => $iCnt, 'sCurrentThreadLink' => $sCurrentThreadLink, 'aCallback' => $aCallback, 'bCanManageThread' => $bCanManageThread, 'bCanEditThread' => $bCanEditThread, 'bCanDeleteThread' => $bCanDeleteThread, 'bCanStickThread' => $bCanStickThread, 'bCanCloseThread' => $bCanCloseThread, 'bCanMergeThread' => $bCanMergeThread, 'bCanPurchaseSponsor' => $bCanPurchaseSponsor, 'sPermaView' => $sPermaView, 'aPoll' => empty($aThread['poll']) ? false : $aThread['poll'], 'bIsViewingPoll' => true, 'bIsCustomPoll' => true, 'sMicroPropType' => 'CreativeWork'));
     $this->setParam('global_moderation', array('name' => 'forumpost', 'ajax' => 'forum.postModeration', 'menu' => array(array('phrase' => Phpfox::getPhrase('forum.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('forum.approve'), 'action' => 'approve'))));
     Phpfox::getLib('parse.output')->setEmbedParser(array('width' => 640, 'height' => 360));
     if ($this->request()->get('is_ajax_get')) {
         $this->template()->assign('isReplies', true);
         Phpfox_Module::instance()->getControllerTemplate();
         $content = ob_get_contents();
         ob_clean();
         return ['run' => "\$('.thread_replies .fa').remove();", 'html' => ['to' => '.tr_content', 'with' => $content]];
     }
 }
예제 #25
0
 /**
  * Converts a string with non-latin characters into UNICODE. This method is used with the method _utf8ToUnicode().
  *
  * @see self::_utf8ToUnicode()
  * @param array $unicode ARRAY of unicode values.
  * @param bool $bForUrl TRUE for URL strings, FALSE for general usage.
  * @return string Returns string that has been converted.
  */
 private function _unicodeToEntitiesPreservingAscii($unicode, $bForUrl = false)
 {
     $entities = '';
     foreach ($unicode as $value) {
         if ($bForUrl === true) {
             if ($value == 42 || $value > 127) {
                 $sCacheValue = Phpfox_Locale::instance()->parse('&#' . $value . ';', false);
                 $entities .= preg_match('/[^a-zA-Z]+/', $sCacheValue) ? '-' . $value : $sCacheValue;
             } else {
                 $entities .= preg_match('/[^0-9a-zA-Z]+/', chr($value)) ? ' ' : chr($value);
             }
         } else {
             $entities .= $value == 42 ? '&#' . $value . ';' : $value > 127 ? '&#' . $value . ';' : chr($value);
         }
     }
     $entities = str_replace("'", '&#039;', $entities);
     return $entities;
 }
예제 #26
0
 /**
  * @todo Cache
  * @todo MSSQL is not playing nice and is not allowing a "text" field to be in the ORDER
  * Once removed from the ORDER it will still throw a fatal error because of the COUNT requires
  * the text to be in the order. Yet another Catch 22 for Microsoft. In any case created a PHP fix for the
  * time being, however need to do further testing on MSSQL as there must be a way!
  * 
  * @return unknown
  */
 public function getModulesForSettings()
 {
     $this->database()->select('COUNT(setting.module_id) AS total_settings, ')->group('m.module_id');
     $aRows = $this->database()->select("m.module_id, language_phrase.text AS info")->from($this->_sTable, "m")->leftJoin(Phpfox::getT('setting'), 'setting', array('setting.module_id = m.module_id AND setting.is_hidden = 0'))->leftJoin(Phpfox::getT('language_phrase'), 'language_phrase', array("language_phrase.language_id = '" . Phpfox_Locale::instance()->getLangId() . "'", 'AND m.phrase_var_name = language_phrase.var_name'))->where('m.is_active = 1')->order('m.module_id ASC')->execute('getSlaveRows');
     return $aRows;
 }
예제 #27
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     Phpfox::getUserParam('admincp.has_admin_access', true);
     if (Phpfox::getParam('core.admincp_http_auth')) {
         $aAuthUsers = Phpfox::getParam('core.admincp_http_auth_users');
         if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW']) && isset($aAuthUsers[Phpfox::getUserId()]) && ($_SERVER['PHP_AUTH_USER'] == $aAuthUsers[Phpfox::getUserId()]['name'] && $_SERVER['PHP_AUTH_PW'] == $aAuthUsers[Phpfox::getUserId()]['password'])) {
         } else {
             header("WWW-Authenticate: Basic realm=\"AdminCP\"");
             header("HTTP/1.0 401 Unauthorized");
             exit("NO DICE!");
         }
     }
     if (Phpfox::getParam('admincp.admin_cp') != $this->request()->get('req1')) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     if (!Phpfox::getService('user.auth')->isActiveAdminSession()) {
         return Phpfox_Module::instance()->setController('admincp.login');
     }
     if ($this->request()->get('upgraded')) {
         Phpfox::getLib('cache')->remove();
         Phpfox::getLib('template.cache')->remove();
         $this->url()->send('admincp');
     }
     $this->_sModule = ($sReq2 = $this->request()->get('req2')) ? strtolower($sReq2) : Phpfox::getParam('admincp.admin_cp');
     if ($this->_sModule == 'logout') {
         $this->_sController = $this->_sModule;
         $this->_sModule = 'admincp';
     } else {
         $this->_sController = ($sReq3 = $this->request()->get('req3')) ? $sReq3 : $this->_sController;
     }
     if ($sReq4 = $this->request()->get('req4')) {
         $sReq4 = str_replace(' ', '', strtolower(str_replace('-', ' ', $sReq4)));
     }
     $sReq5 = $this->request()->get('req5');
     $bPass = false;
     if (file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . '.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController;
         $bPass = true;
     }
     if (!$bPass && $sReq5 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . $sReq5 . '.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.' . $sReq5;
         $bPass = true;
     }
     if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4;
         $bPass = true;
     }
     if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $this->_sController . '.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.' . $this->_sController;
         $bPass = true;
     }
     if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4;
         $bPass = true;
     }
     if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . PHPFOX_DS . 'index.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.' . $sReq4 . '.index';
         $bPass = true;
     }
     if (!$bPass && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . 'admincp' . PHPFOX_DS . $this->_sController . PHPFOX_DS . 'index.class.php')) {
         $this->_sController = 'admincp.' . $this->_sController . '.index';
         $bPass = true;
     }
     if (!$bPass && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . '.class.php')) {
         $this->_sController = $this->_sModule . '.' . $this->_sController;
         $this->_sModule = 'admincp';
         $bPass = true;
     }
     if (!$bPass && $sReq4 && file_exists(PHPFOX_DIR_MODULE . 'admincp' . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sModule . PHPFOX_DS . $this->_sController . PHPFOX_DS . $sReq4 . '.class.php')) {
         $this->_sController = $this->_sModule . '.' . $this->_sController . '.' . $sReq4;
         $this->_sModule = 'admincp';
         $bPass = true;
     }
     if (!$bPass && Phpfox::getParam('admincp.admin_cp') != 'admincp' && file_exists(PHPFOX_DIR_MODULE . $this->_sModule . PHPFOX_DS . PHPFOX_DIR_MODULE_COMPONENT . PHPFOX_DS . 'controller' . PHPFOX_DS . $this->_sController . '.class.php')) {
         $bPass = true;
     }
     $bForceIndex = false;
     if (!$bPass && Phpfox::isModule($this->request()->segment('req2'))) {
         $this->_sModule = 'admincp';
         $this->_sController = 'app.index';
         $bForceIndex = true;
         $bPass = true;
     }
     // Get the menu we will used to display all the "Modules"
     // $aModules = Phpfox::getService('admincp.module')->getAdminMenu();
     // Create AdminCP menu
     $aMenus = array('admincp.users' => array('admincp.browse_members' => 'admincp.user.browse', 'admincp.user_group_manager' => array('admincp.manage_user_groups' => 'admincp.user.group', 'admincp.create_user_group' => 'admincp.user.group.add', 'admincp.add_user_group_setting' => 'admincp.user.group.setting'), 'admincp.user_cancellation_options' => array('admincp.user_cancellation_options_add' => 'admincp.user.cancellations.add', 'admincp.user_cancellation_options_manage' => 'admincp.user.cancellations.manage', 'admincp.user_cancellations_feedback' => 'admincp.user.cancellations.feedback'), 'user.promotions' => array('user.manage_promotions' => 'admincp.user.promotion', 'user.add_promotion' => 'admincp.user.promotion.add'), 'admincp.inactive_members' => 'admincp.user.inactivereminder'));
     $aMenus = ['<i class="fa fa-dashboard"></i>Dashboard' => 'admincp', '<i class="fa fa-cubes"></i>Apps' => 'admincp.apps', '<i class="fa fa-paint-brush"></i>Themes' => 'admincp.theme', 'Members', '<i class="fa fa-search"></i>Search' => 'admincp.user.browse', '<i class="fa fa-users"></i>User Groups' => 'admincp.user.group', '<i class="fa fa-diamond"></i>Promotions' => 'admincp.user.promotion', '<i class="fa fa-th-list"></i>Custom Fields' => 'admincp.custom', 'Site', '<i class="fa fa-file-text-o"></i>Pages' => 'admincp.page', '<i class="fa fa-bars"></i>Menus' => 'admincp.menu', '<i class="fa fa-th"></i>Blocks' => 'admincp.block', '<i class="fa fa-language"></i>Phrases' => 'admincp.language.phrase', 'Tools', 'Settings' => ['Countries' => 'admincp.core.country', 'Currencies' => 'admincp.core.currency', 'Attachments' => 'admincp.attachment', 'Payment Gateways' => 'admincp.api.gateway', 'Language' => 'admincp.language', 'Short URLs' => 'admincp.setting.url', 'User', 'Settings' => $this->url()->makeUrl('admincp.setting.edit', ['module-id' => 'user']), 'Registration' => $this->url()->makeUrl('admincp.setting.edit', ['group-id' => 'registration']), 'Relationship Statues' => 'admincp.custom.relationships', 'Cancellation Options' => 'admincp.user.cancellations.manage', 'Subscription Packages' => 'admincp.subscribe', 'E-Gifts' => 'admincp.egift.categories', 'Anti-SPAM Questions' => 'admincp.user.spam'], '<i class="fa fa-th-large"></i>Modules' => 'admincp.product', '<i class="fa fa-bullhorn"></i>Announcements' => 'admincp.announcement', '<i class="fa fa-newspaper-o"></i>Newsletter' => 'admincp.newsletter.manage', '<i class="fa fa-info"></i>Status' => array(Phpfox::getPhrase('core.site_statistics') => 'admincp.core.stat', Phpfox::getPhrase('core.admincp_menu_system_overview') => 'admincp.core.system', Phpfox::getPhrase('admincp.inactive_members') => 'admincp.user.inactivereminder'), '<i class="fa fa-server"></i>Maintenance' => array(Phpfox::getPhrase('admincp.menu_cache_manager') => 'admincp.maintain.cache', Phpfox::getPhrase('admincp.admincp_menu_reparser') => 'admincp.maintain.reparser', Phpfox::getPhrase('admincp.remove_duplicates') => 'admincp.maintain.duplicate', Phpfox::getPhrase('admincp.counters') => 'admincp.maintain.counter', Phpfox::getPhrase('admincp.check_modified_files') => 'admincp.checksum.modified', Phpfox::getPhrase('admincp.check_unknown_files') => 'admincp.checksum.unknown', Phpfox::getPhrase('admincp.find_missing_settings') => 'admincp.setting.missing', 'Toggle Modules' => $this->url()->makeUrl('admincp.module', ['view' => 'all'])), '<i class="fa fa-ban"></i>Ban Filters' => array(Phpfox::getPhrase('ban.ban_filter_username') => 'admincp.ban.username', Phpfox::getPhrase('ban.ban_filter_email') => 'admincp.ban.email', Phpfox::getPhrase('ban.ban_filter_display_name') => 'admincp.ban.display', Phpfox::getPhrase('ban.ban_filter_ip') => 'admincp.ban.ip', Phpfox::getPhrase('ban.ban_filter_word') => 'admincp.ban.word')];
     /*
     $aThemes = [];
     foreach (Theme_Service_Theme::instance()->get() as $aTheme) {
     	$aThemes[$aTheme['name']] = $this->url()->makeUrl('admincp.theme.manage', ['id' => $aTheme['theme_id']]);
     }
     */
     // d($aThemes); exit;
     list($aGroups, $aModules, $aProductGroups) = Phpfox::getService('admincp.setting.group')->get();
     $aCache = $aGroups;
     $aGroups = [];
     // $aGroups[] = 'Site &amp; Server';
     foreach ($aCache as $key => $value) {
         $n = $key;
         switch ($value['group_id']) {
             case 'cookie':
                 $n = 'Browser Cookies';
                 break;
             case 'site_offline_online':
                 $n = 'Toggle Site';
                 break;
             case 'general':
                 $n = 'Site Settings';
                 break;
             case 'mail':
                 $n = 'Mail Server';
                 break;
             case 'spam':
                 $n = 'Spam Assistance';
                 break;
             case 'registration':
                 continue 2;
                 break;
         }
         // unset($aGroups[$key]);
         $aGroups[$n] = $value;
     }
     ksort($aGroups);
     // d($aGroups); exit;
     $aApps = [];
     /*
     $aProducts = Admincp_Service_Product_Product::instance()->getNewProductsForInstall();
     if (count($aProducts)) {
     	foreach ($aProducts as $aProduct) {
     		$aApps[$aProduct['title']] = [
     			'highlight' => true,
     			'message' => 'Install',
     			'url' => $this->url()->makeUrl('admincp.product.install', ['id' => $aProduct['product_id']])
     		];
     	}
     }
     */
     /*
     $aSkip = ['apps', 'user', 'track', 'tinymce', 'theme', 'tag', 'subscribe', 'share', 'search', 'rss', 'request', 'report', 'rate', 'profile', 'privacy', 'page', 'notification', 'mobile', 'log', 'link', 'like', 'language', 'input', 'admincp', 'api', 'apps', 'attachment', 'ban', 'comment', 'contact', 'core', 'custom', 'emoticon', 'error', 'favorite', 'help', 'im'];
     foreach (Phpfox_Module::instance()->getModules() as $sModule) {
     	if (in_array($sModule, $aSkip)) {
     		continue;
     	}
     
     	// $aApps[$sModule] = $this->url()->makeUrl('admincp.app', ['id' => $sModule]);
     	$aApps[$sModule] = $this->url()->makeUrl('admincp.' . $sModule);
     }
     */
     $aSettings = [];
     foreach ($aGroups as $sGroupName => $aGroupValues) {
         $aSettings[$sGroupName] = $this->url()->makeUrl('admincp.setting.edit', ['group-id' => $aGroupValues['group_id']]);
         // $aMenus['Settings'][$sGroupName] = '#';
     }
     // d($aSettings); exit;
     $aCache = $aMenus;
     $aMenus = [];
     foreach ($aCache as $sKey => $mValue) {
         /*
         if ($mValue == '#modules') {
         	$aMenus[$sKey] = $aApps;
         
         	continue;
         }
         else if ($mValue == '#themes') {
         	$aMenus[$sKey] = $aThemes;
         
         	continue;
         }
         */
         /*
         if (is_string($mValue) && $mValue === 'Tools') {
         
         	// d($mValue);
         	$aMenus[$sKey] = 'Modules';
         	foreach ((new Core\App())->all('__core') as $Core) {
         		$icon = '';
         		$name = $Core->name;
         		$id = str_replace('__module_', '', $Core->id);
         		switch ($id) {
         			case 'ad':
         				$icon = 'money';
         				break;
         			case 'blog':
         				$icon = 'file';
         				break;
         		}
         
         		if (!empty($icon)) {
         			$icon = '<i class="fa fa-' . $icon . '"></i>';
         		}
         
         		$aMenus[$icon . $Core->name] = $this->url()->makeUrl('admincp.app', ['id' => $Core->id]);
         	}
         
         	$sKey++;
         }
         */
         if ($sKey === 'Settings') {
             $sKey = '<i class="fa fa-cog"></i>Settings';
             /*
             $aMerge = [];
             foreach ($mValue as $sSubKey => $sSubValue) {
             	if (strpos($sSubValue, '.')) {
             		$aMerge[Phpfox::getPhrase($sSubKey)] = $sSubValue;
             	}
             	else {
             		$aMerge[] = $sSubValue;
             	}
             }
             $mValue = array_merge($aSettings, $aMerge);
             */
             $moduleSettings = [];
             foreach ((new Core\App())->all('__core') as $Core) {
                 $name = $Core->name;
                 $id = str_replace('__module_', '', $Core->id);
                 $url = $this->url()->makeUrl('admincp.app', ['id' => $Core->id]);
                 $goSettings = false;
                 $goIndex = false;
                 switch ($id) {
                     case 'ad':
                         $name = 'Ad Campaigns';
                         break;
                     case 'blog':
                         $name = 'Blog Categories &amp; Settings';
                         break;
                     case 'contact':
                         $name = '"Contact Us" Form';
                         break;
                         /*
                         case 'user':
                         	$goSettings = true;
                         	$name = 'User';
                         	break;
                         */
                     /*
                     case 'user':
                     	$goSettings = true;
                     	$name = 'User';
                     	break;
                     */
                     case 'feed':
                         $goSettings = true;
                         $this->template()->setSectionTitle('Activity Feed');
                         break;
                     case 'forum':
                         $name = 'Forums';
                         $goIndex = true;
                         break;
                     case 'mail':
                         $name = 'Private Messages';
                         break;
                     case 'event':
                     case 'photo':
                     case 'marketplace':
                     case 'music':
                     case 'pages':
                         $goIndex = true;
                         break;
                 }
                 if ($goSettings) {
                     $url = $this->url()->makeUrl('admincp.setting.edit', ['module-id' => $id]);
                 } else {
                     if ($goIndex) {
                         $url = $this->url()->makeUrl('admincp.' . $id);
                     }
                 }
                 $moduleSettings[$name] = $url;
             }
             $mValue = array_merge($aSettings, $mValue, ['Modules'], $moduleSettings);
         }
         $aMenus[$sKey] = $mValue;
         if (is_string($mValue) && $mValue == 'admincp.theme' && PHPFOX_IS_TECHIE) {
             $aMenus['<i class="fa fa-sheqel"></i>Techie'] = ['Products' => 'admincp.product', 'Modules' => 'admincp.module', 'Plugins' => 'admincp.plugin', 'Components' => 'admincp.component'];
         }
     }
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_index_process_menu')) ? eval($sPlugin) : false;
     $aUser = Phpfox::getUserBy();
     // $aUser['full_name'] = substr($aUser['full_name'], 0, Phpfox::getParam('user.maximum_length_for_full_name'));
     $sSectionTitle = '';
     $app = $this->request()->get('req2');
     $bForceIndex = true;
     if ($app == 'app') {
         $app = str_replace('__module_', '', $this->request()->get('id'));
         $bForceIndex = false;
     }
     $is_settings = false;
     if ($this->url()->getUrl() == 'admincp/setting/edit') {
         $app = $this->request()->get('module-id');
         $is_settings = true;
     }
     $aSkipModules = ['api', 'comment', 'feed', 'apps', 'announcement', 'ban', 'facebook', 'user', 'core', 'custom', 'admincp', 'page', 'language', 'attachment', 'theme'];
     $searchSettings = Admincp_Service_Setting_Setting::instance()->getForSearch($aSkipModules);
     $this->template()->setHeader('<script>var admincpSettings = ' . json_encode($searchSettings) . ';</script>');
     if ($is_settings && in_array($app, $aSkipModules) && $app != 'user' && $app != 'feed') {
         $this->url()->send('admincp');
     }
     if ($app && Phpfox::isModule($app) && !in_array($app, $aSkipModules)) {
         $app = Phpfox_Module::instance()->get($app);
         $name = Phpfox_Locale::instance()->translate($app['module_id'], 'module');
         $sSectionTitle = $name;
         $menu = unserialize($app['menu']);
         $menus = [];
         $current = $this->url()->getUrl();
         $infoActive = false;
         if ($this->request()->get('req2') == 'app') {
             $infoActive = true;
         }
         if (Admincp_Service_Setting_Setting::instance()->moduleHasSettings($app['module_id'])) {
             $menus['Settings'] = ['is_active' => $is_settings, 'url' => $this->url()->makeUrl('admincp.setting.edit', ['module-id' => $app['module_id']])];
         }
         if (is_array($menu) && count($menu)) {
             foreach ($menu as $key => $value) {
                 $is_active = false;
                 $url = 'admincp.' . implode('.', $value['url']);
                 if ($current == str_replace('.', '/', $url)) {
                     $is_active = true;
                     if ($infoActive) {
                         $menus['Info']['is_active'] = false;
                     }
                 }
                 $menus[Phpfox::getPhrase($key)] = ['url' => $url, 'is_active' => $is_active];
             }
         }
         $this->template()->assign(['aSectionAppMenus' => $menus, 'ActiveApp' => (new Core\App())->get('__module_' . $app['module_id'])]);
     }
     $this->template()->assign(array('sSectionTitle' => $sSectionTitle, 'aModulesMenu' => $aModules, 'aAdminMenus' => $aMenus, 'aUserDetails' => $aUser, 'sPhpfoxVersion' => PhpFox::getVersion(), 'sSiteTitle' => Phpfox::getParam('core.site_title')))->setHeader(array('menu.css' => 'style_css', 'menu.js' => 'style_script', 'admin.js' => 'static_script', 'jquery/plugin/jquery.mosaicflow.min.js' => 'static_script'))->setTitle(Phpfox::getPhrase('admincp.admin_cp'));
     if (in_array($app, ['plugin', 'module', 'component'])) {
         $this->template()->setSectionTitle('Techie: ' . ucwords($app));
         $this->template()->setActionMenu(['New ' . ucwords($app) => ['url' => $this->url()->makeUrl('admincp.' . $app . '.add'), 'class' => 'popup']]);
     }
     if ($bPass) {
         Phpfox_Module::instance()->setController($this->_sModule . '.' . $this->_sController);
         $sMenuController = str_replace(array('.index', '.phrase'), '', 'admincp.' . ($this->_sModule != 'admincp' ? $this->_sModule . '.' . str_replace('admincp.', '', $this->_sController) : $this->_sController));
         $aCachedSubMenus = array();
         $sActiveSideBar = '';
         if ($sMenuController == 'admincp.setting.edit') {
             $sMenuController = 'admincp.setting';
         }
         if ($this->_getMenuName() !== null) {
             $sMenuController = $this->_getMenuName();
         }
         /*
         foreach ($aMenus as $sKey => $aSubMenus)
         {
         	if (is_array($aSubMenus))
         	{
         		foreach ($aSubMenus as $sSubkey => $mSubMenus)
         		{					
         			if (is_array($mSubMenus))
         			{
         				foreach ($mSubMenus as $sSubkey2 => $mSubMenus2)
         				{
         					if ($sMenuController == $mSubMenus2)
         					{
         						$sActiveSideBar = $sSubkey;
         						
         						foreach ($aSubMenus as $sSubkey3 => $mSubMenus3)
         						{
         							if (is_array($mSubMenus3))
         							{
         								$aCachedSubMenus[$sSubkey3] = $mSubMenus3;
         							}
         							else 
         							{
         								$aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3;
         							}
         						}
         					}
         				}
         			}
         			else 
         			{
         				if ($sMenuController == $mSubMenus)
         				{
         					$sActiveSideBar = $sKey;	
         					
         					foreach ($aSubMenus as $sSubkey3 => $mSubMenus3)
         					{
         						if (is_array($mSubMenus3))
         						{
         							$aCachedSubMenus[$sSubkey3] = $mSubMenus3;
         						}
         						else 
         						{
         							$aCachedSubMenus[$sKey][$sSubkey3] = $mSubMenus3;
         						}
         					}
         				}
         			}
         		}
         	}
         }				
         
         $bIsModuleConnection = false;
         if (!$aCachedSubMenus)
         {			
         	$bIsModuleConnection = true;
         	$sActiveSideBar = $this->_sModule;
         	foreach ($aModules as $aModule)
         	{
         		if (!isset($aModule['module_id']))
         		{
         			continue;
         		}
         		
         		if (!$aModule['is_menu'])
         		{
         			continue;
         		}
         		
         		if (!is_array($aModule['menu']))
         		{
         			continue;
         		}
         		
         		foreach ($aModule['menu'] as $sPhrase => $aLink)
         		{
         			$aCachedSubMenus[$aModule['module_id']][$sPhrase] = 'admincp.' . str_replace('/', '.', $aLink['url']);
         		}				
         	}			
         }
         */
         $this->template()->assign(array('aCachedSubMenus' => $aCachedSubMenus, 'sActiveSideBar' => $sActiveSideBar, 'bIsModuleConnection' => false, 'sMenuController' => $sMenuController, 'aActiveMenus' => false && isset($aCachedSubMenus[$sActiveSideBar]) ? $aCachedSubMenus[$sActiveSideBar] : array()));
     } else {
         if ($this->_sModule != Phpfox::getParam('admincp.admin_cp')) {
             Phpfox_Module::instance()->setController('error.404');
         } else {
             Phpfox::getService('admincp')->check();
             /*
             				define('PHPFOX_CAN_MOVE_BLOCKS', true);
             				
             				$this->template()->setHeader('cache', array(													
             							'sort.js' => 'module_theme',
             							'design.js' => 'module_theme',			
             							'jquery/ui.js' => 'static_script',
             						)
             					)
             					->setHeader(array(	
             						'<script type="text/javascript">function designOnUpdate() { $Core.design.updateSorting(); }</script>',
             						'<script type="text/javascript">$Core.design.init({type_id: \'admincp\'});</script>'
             					)
             				);						
             				
             				Phpfox_Module::instance()->setCacheBlockData(array(
             						'table' => 'admincp_dashboard',
             						'field' => 'user_id',
             						'item_id' => Phpfox::getUserId(),
             						'controller' => 'admincp.index'
             					)
             				);				
             */
             $this->template()->setBreadcrumb(Phpfox::getPhrase('admincp.dashboard'))->setTitle(Phpfox::getPhrase('admincp.dashboard'))->assign(array('bIsModuleConnection' => false, 'bIsDashboard' => true, 'aNewProducts' => Admincp_Service_Product_Product::instance()->getNewProductsForInstall()));
         }
     }
 }
예제 #28
0
 private function _get($iParentId, $iActive = null)
 {
     $aCategories = $this->database()->select('*')->from($this->_sTable)->where('parent_id = ' . (int) $iParentId . ' AND is_active = ' . (int) $iActive . '')->order('ordering ASC')->execute('getRows');
     if (count($aCategories)) {
         $aCache = array();
         if ($iParentId != 0) {
             $this->_iCnt++;
         }
         if ($this->_sDisplay == 'option') {
         } elseif ($this->_sDisplay == 'admincp') {
             $sOutput = '<ul>';
         } else {
             $this->_sOutput .= '<div class="js_mp_parent_holder" id="js_mp_holder_' . $iParentId . '" ' . ($iParentId > 0 ? ' style="display:none; padding:5px 0px 0px 0px;"' : '') . '>';
             $this->_sOutput .= '<select name="val[category][]" class="js_mp_category_list" id="js_mp_id_' . $iParentId . '">' . "\n";
             $this->_sOutput .= '<option value="">' . ($iParentId === 0 ? Phpfox::getPhrase('marketplace.select') : Phpfox::getPhrase('marketplace.select_a_sub_category')) . ':</option>' . "\n";
         }
         foreach ($aCategories as $iKey => $aCategory) {
             $aCache[] = $aCategory['category_id'];
             if ($this->_sDisplay == 'option') {
                 $this->_sOutput .= '<option value="' . $aCategory['category_id'] . '" id="js_mp_category_item_' . $aCategory['category_id'] . '">' . ($this->_iCnt > 0 ? str_repeat('&nbsp;', $this->_iCnt * 2) . ' ' : '') . Phpfox_Locale::instance()->convert($aCategory['name']) . '</option>' . "\n";
                 $this->_sOutput .= $this->_get($aCategory['category_id'], $iActive);
             } elseif ($this->_sDisplay == 'admincp') {
                 $sOutput .= '<li><img src="' . Phpfox_Template::instance()->getStyle('image', 'misc/draggable.png') . '" alt="" /> <input type="hidden" name="order[' . $aCategory['category_id'] . ']" value="' . $aCategory['ordering'] . '" class="js_mp_order" /><a href="#?id=' . $aCategory['category_id'] . '" class="js_drop_down">' . Phpfox_Locale::instance()->convert($aCategory['name']) . '</a>' . $this->_get($aCategory['category_id'], $iActive) . '</li>' . "\n";
             } else {
                 $this->_sOutput .= '<option value="' . $aCategory['category_id'] . '" id="js_mp_category_item_' . $aCategory['category_id'] . '">' . Phpfox_Locale::instance()->convert($aCategory['name']) . '</option>' . "\n";
             }
         }
         if ($this->_sDisplay == 'option') {
         } elseif ($this->_sDisplay == 'admincp') {
             $sOutput .= '</ul>';
             return $sOutput;
         } else {
             $this->_sOutput .= '</select>' . "\n";
             $this->_sOutput .= '</div>';
             foreach ($aCache as $iCateoryId) {
                 $this->_get($iCateoryId, $iActive);
             }
         }
         $this->_iCnt = 0;
     }
 }
예제 #29
0
 /**
  * Gets any data we plan to place within the HTML tags <head></head>.
  * This method also groups the data to give the template a nice clean look.
  *
  * @return string|array $sData Returns the HTML data to be placed within <head></head>
  */
 public function getHeader($bReturnArray = false)
 {
     if (Phpfox::isAdminPanel()) {
         $this->setHeader(array('custom.css' => 'style_css'));
     }
     if ($this->delayedHeaders) {
         foreach ($this->delayedHeaders as $header) {
             $this->setHeader('cache', $header);
         }
     }
     // $this->setHeader('<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">');
     Core\Event::trigger('lib_phpfox_template_getheader', $this);
     foreach ((new Core\App())->all() as $App) {
         if ($App->head && is_array($App->head)) {
             foreach ($App->head as $head) {
                 $this->setHeader($head);
             }
         }
         if ($App->settings) {
             $Setting = new Core\Setting();
             foreach ($App->settings as $key => $setting) {
                 if (isset($setting->js_variable)) {
                     $this->setHeader('<script>var ' . $key . ' = "' . $Setting->get($key) . '";</script>');
                 }
             }
         }
     }
     $aArrayData = array();
     $sData = '';
     $sJs = '';
     $iVersion = $this->getStaticVersion();
     $oUrl = Phpfox_Url::instance();
     $aUrl = $oUrl->getParams();
     if (!defined('PHPFOX_DESIGN_DND')) {
         define('PHPFOX_DESIGN_DND', false);
     }
     if (!PHPFOX_IS_AJAX_PAGE) {
         ($sPlugin = Phpfox_Plugin::get('template_getheader')) ? eval($sPlugin) : false;
         $sJs .= "\t\t\tvar oCore = {'core.is_admincp': " . (Phpfox::isAdminPanel() ? 'true' : 'false') . ", 'core.section_module': '" . Phpfox_Module::instance()->getModuleName() . "', 'profile.is_user_profile': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? 'true' : 'false') . ", 'log.security_token': '" . Phpfox::getService('log.session')->getToken() . "', 'core.url_rewrite': '" . Phpfox::getParam('core.url_rewrite') . "', 'core.country_iso': '" . (Phpfox::isUser() ? Phpfox::getUserBy('country_iso') : '') . "', 'core.can_move_on_a_y_and_x_axis' : " . (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.can_move_on_a_y_and_x_axis') ? 'true' : 'false') . ", 'core.default_currency': '" . (defined('PHPFOX_INSTALLER') ? 'USD' : Phpfox::getService('core.currency')->getDefault()) . "', 'core.enabled_edit_area': " . (Phpfox::getParam('core.enabled_edit_area') ? 'true' : 'false') . ", 'core.disable_hash_bang_support': " . (Phpfox::getParam('core.disable_hash_bang_support') ? 'true' : 'false') . ", 'core.site_wide_ajax_browsing': " . (!defined('PHPFOX_IN_DESIGN_MODE') && Phpfox::getParam('core.site_wide_ajax_browsing') && !Phpfox::isAdminPanel() && Phpfox::isUser() ? 'true' : 'false') . ", 'profile.user_id': " . (defined('PHPFOX_IS_USER_PROFILE') && PHPFOX_IS_USER_PROFILE ? Profile_Service_Profile::instance()->getProfileUserId() : 0) . "};\n";
         // You are filtering out the controllers which should not load 'content' ajaxly, finding a way for pages.view/1/info and like that
         $sProgressCssFile = $this->getStyle('css', 'progress.css');
         $sStylePath = str_replace(Phpfox::getParam('core.path'), '', str_replace('progress.css', '', $sProgressCssFile));
         $aJsVars = array('sJsHome' => Phpfox::getParam('core.path'), 'sJsHostname' => $_SERVER['HTTP_HOST'], 'sSiteName' => Phpfox::getParam('core.site_title'), 'sJsStatic' => $oUrl->getDomain() . PHPFOX_STATIC, 'sJsStaticImage' => Phpfox::getParam('core.url_static_image'), 'sImagePath' => $this->getStyle('image'), 'sStylePath' => $this->getStyle('css'), 'sVersion' => Phpfox::getId(), 'sJsAjax' => $oUrl->getDomain() . PHPFOX_STATIC . 'ajax.php', 'sStaticVersion' => $iVersion, 'sGetMethod' => PHPFOX_GET_METHOD, 'sDateFormat' => defined('PHPFOX_INSTALLER') ? '' : Phpfox::getParam('core.date_field_order'), 'sEgiftStyle' => $this->getStyle('css', 'display.css', 'egift'), 'sGlobalTokenName' => Phpfox::getTokenName(), 'sController' => Phpfox_Module::instance()->getFullControllerName(), 'bJsIsMobile' => Phpfox::isMobile() ? true : false, 'sProgressCssFile' => $sProgressCssFile, 'sHostedVersionId' => defined('PHPFOX_IS_HOSTED_VERSION') ? PHPFOX_IS_HOSTED_VERSION : '');
         if (!defined('PHPFOX_INSTALLER')) {
             $aJsVars['bWysiwyg'] = Phpfox::getParam('core.wysiwyg') != 'default' && Phpfox::getParam('core.allow_html') ? true : false;
             $aJsVars['sEditor'] = Phpfox::getParam('core.wysiwyg');
             $aJsVars['sJsCookiePath'] = Phpfox::getParam('core.cookie_path');
             $aJsVars['sJsCookieDomain'] = Phpfox::getParam('core.cookie_domain');
             $aJsVars['sJsCookiePrefix'] = Phpfox::getParam('core.session_prefix');
             $aJsVars['bPhotoTheaterMode'] = Phpfox::isModule('photo') ? Phpfox::getParam('photo.view_photos_in_theater_mode') : false;
             $aJsVars['bUseHTML5Video'] = false;
             // ((Phpfox::isModule('video') && Phpfox::getParam('video.upload_for_html5')) ? true : false);
             if (Phpfox::isAdmin()) {
                 $aJsVars['sAdminCPLocation'] = Phpfox::getParam('admincp.admin_cp');
             } else {
                 $aJsVars['sAdminCPLocation'] = '';
             }
             if (Phpfox::isModule('notification')) {
                 $aJsVars['notification.notify_ajax_refresh'] = Phpfox::getParam('notification.notify_ajax_refresh');
             }
             $sLocalDatepicker = PHPFOX_STATIC . 'jscript/jquery/locale/jquery.ui.datepicker-' . strtolower(Phpfox_Locale::instance()->getLangId()) . '.js';
             if (file_exists($sLocalDatepicker)) {
                 $sFile = str_replace(PHPFOX_STATIC . 'jscript/', '', $sLocalDatepicker);
                 $this->setHeader(array($sFile => 'static_script'));
             }
             /* Only in a few cases will we want to add the visitor's IP */
             if (Phpfox::getParam('core.google_api_key') != '' && Phpfox::getParam('core.ip_infodb_api_key')) {
                 // $aJsVars['sIP'] = Phpfox_Request::instance()->getIp();
             }
             $aJsVars['bEnableMicroblogSite'] = Phpfox::isModule('microblog') ? Phpfox::getParam('microblog.enable_microblog_site') : false;
         }
         ($sPlugin = Phpfox_Plugin::get('template_getheader_setting')) ? eval($sPlugin) : false;
         if (Phpfox::isModule('input') && false) {
             $this->setHeader('cache', array('browse.css' => 'style_css'));
         }
         $sJs .= "\t\t\tvar oParams = {";
         $iCnt = 0;
         foreach ($aJsVars as $sVar => $sValue) {
             $iCnt++;
             if ($iCnt != 1) {
                 $sJs .= ",";
             }
             if (is_bool($sValue)) {
                 $sJs .= "'{$sVar}': " . ($sValue ? 'true' : 'false');
             } elseif (is_numeric($sValue)) {
                 $sJs .= "'{$sVar}': " . $sValue;
             } else {
                 $sJs .= "'{$sVar}': '" . str_replace("'", "\\'", $sValue) . "'";
             }
         }
         $sJs .= "};\n";
         if (!defined('PHPFOX_INSTALLER')) {
             $aLocaleVars = array('core.are_you_sure', 'core.yes', 'core.no', 'core.save', 'core.cancel', 'core.go_advanced', 'core.processing', 'emoticon.emoticons', 'attachment.attach_files', 'core.close', 'core.language_packages', 'core.move_this_block', 'core.uploading', 'language.loading', 'core.saving', 'core.loading_text_editor', 'core.quote', 'core.loading');
             if (Phpfox::isModule('im') && Phpfox::getParam('im.enable_im_in_footer_bar')) {
                 $aLocaleVars[] = 'im.find_your_friends';
             }
             ($sPlugin = Phpfox_Plugin::get('template_getheader_language')) ? eval($sPlugin) : false;
             $sJs .= "\t\t\tvar oTranslations = {";
             $iCnt = 0;
             foreach ($aLocaleVars as $sValue) {
                 $aParts = explode('.', $sValue);
                 if ($aParts[0] != 'core' && !Phpfox::isModule($aParts[0])) {
                     continue;
                 }
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sValue}': '" . html_entity_decode(str_replace("'", "\\'", Phpfox::getPhrase($sValue)), null, 'UTF-8') . "'";
             }
             $sJs .= "};\n";
             $aModules = Phpfox_Module::instance()->getModules();
             $sJs .= "\t\t\tvar oModules = {";
             $iCnt = 0;
             foreach ($aModules as $sModule => $iModuleId) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sModule}': true";
             }
             $sJs .= "};\n";
         }
         if (count($this->_aImages)) {
             $sJs .= "\t\t\tvar oJsImages = {";
             foreach ($this->_aImages as $sKey => $sImage) {
                 $sJs .= $sKey . ': \'' . $sImage . '\',';
             }
             $sJs = rtrim($sJs, ',');
             $sJs .= "};\n";
         }
         /*
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active'])
         {
         */
         $aEditorButtons = Phpfox::getLib('editor')->getButtons();
         $iCnt = 0;
         $sJs .= "\t\t\tvar oEditor = {";
         if (count($this->_aEditor) && isset($this->_aEditor['active']) && $this->_aEditor['active']) {
             foreach ($this->_aEditor as $sVar => $mValue) {
                 $iCnt++;
                 if ($iCnt != 1) {
                     $sJs .= ",";
                 }
                 $sJs .= "'{$sVar}': " . (is_bool($mValue) ? $mValue === true ? 'true' : 'false' : "'{$mValue}'") . "";
             }
             $sJs .= ", ";
         }
         $sJs .= "images:[";
         foreach ($aEditorButtons as $mEditorButtonKey => $aEditorButton) {
             $sJs .= "{";
             foreach ($aEditorButton as $sEditorButtonKey => $sEditorButtonValue) {
                 $sJs .= "" . $sEditorButtonKey . ": '" . $sEditorButtonValue . "',";
             }
             $sJs = rtrim($sJs, ',') . "},";
         }
         $sJs = rtrim($sJs, ',') . "]";
         $sJs .= "};\n";
         // }
         if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
             $sData .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/' . Phpfox::getParam('core.jquery_google_cdn_version') . '/jquery.min.js"></script>' . "\n";
         }
     }
     if (PHPFOX_IS_AJAX_PAGE) {
         $this->_aCacheHeaders = array();
     }
     $bIsHttpsPage = false;
     if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.force_https_secure_pages')) {
         if (in_array(str_replace('mobile.', '', Phpfox_Module::instance()->getFullControllerName()), Phpfox::getService('core')->getSecurePages()) && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) {
             $bIsHttpsPage = true;
         }
     }
     $aSubCache = array();
     $sStyleCacheData = '';
     $sJsCacheData = '';
     $aCacheJs = array();
     $aCacheCSS = array();
     $this->_sFooter = '';
     $sJs .= "\t\t\t" . 'var $Behavior = {}, $Ready = $Ready = function(callback) {$Behavior[callback.toString().length] = callback;}, $Events = {}, $Event = function(callback) {$Events[callback.toString().length] = callback;};' . "\n";
     $sJs .= "\t\t\t" . 'var $Core = {};' . "\n";
     $aCustomCssFile = array();
     foreach ($this->_aHeaders as $aHeaders) {
         if (!is_array($aHeaders)) {
             $aHeaders = array($aHeaders);
         }
         foreach ($aHeaders as $mKey => $mValue) {
             $sQmark = strpos($mKey, '?') ? '&amp;' : '?';
             if (is_numeric($mKey)) {
                 if ($mValue === null) {
                     continue;
                 }
                 if ($bReturnArray) {
                     $aArrayData[] = $mValue;
                 } else {
                     if (is_string($mValue) && (strpos($mValue, '.js') !== false || strpos($mValue, 'javascript') !== false)) {
                         if (strpos($mValue, 'RecaptchaOptions')) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $this->_sFooter .= "\t\t" . $mValue;
                         }
                     } else {
                         if (is_string($mValue)) {
                             $sData .= "\t\t" . $mValue . "\n";
                         } else {
                             $sData .= "\t\t" . implode($mValue) . "\n";
                         }
                     }
                 }
             } else {
                 if ($mKey == 'master') {
                     $aMaster = array('css' => array(), 'jscript' => array());
                     foreach ($mValue as $sValKey => $sValVal) {
                         if (strpos($sValKey, '.css') !== false) {
                             if ($sValVal == 'style_css') {
                                 $aMaster['css'][] = 'theme' . PHPFOX_DS . 'frontend' . PHPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . 'style' . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . 'css' . PHPFOX_DS . $sValKey;
                             } else {
                                 if (strpos($sValVal, 'module_') !== false) {
                                     $aMaster['css'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'css' . PHFPFOX_DS . $this->getThemeFolder() . PHPFOX_DS . $this->getStyleFolder() . PHPFOX_DS . $sValKey;
                                 }
                             }
                         } else {
                             if (strpos($sValKey, '.js') !== false) {
                                 if ($sValVal == 'static_script') {
                                     $aMaster['jscript'][] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                 } else {
                                     if (strpos($sValVal, 'module_') !== false) {
                                         $aMaster['jscript'][] = 'module' . PHPFOX_DS . str_replace('module_', '', $sValVal) . PHPFOX_DS . 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $sValKey;
                                     }
                                 }
                             }
                         }
                     }
                     unset($this->_aHeaders[$mKey]);
                     // just to avoid confusions
                     $this->_aHeaders['master'] = $aMaster;
                 } else {
                     $bToHead = false;
                     // This happens when the developer needs something to go to <head>
                     if (is_array($mValue)) {
                         $aKeyHead = array_keys($mValue);
                         $aKeyValue = array_values($mValue);
                         $bToHead = $mKey == 'head';
                         $mKey = array_pop($aKeyHead);
                         $mValue = array_pop($aKeyValue);
                     }
                     switch ($mValue) {
                         case 'style_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = $this->getStyle('jscript', $mKey);
                             } else {
                                 //$sJsCacheData .= str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey)) . ',';
                                 if ($bToHead == 'head') {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 } else {
                                     $aCacheJs[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('jscript', $mKey));
                                 }
                             }
                             break;
                         case 'style_css':
                             $bCustomStyle = false;
                             if ($bCustomStyle === false) {
                                 if ($bReturnArray) {
                                     $aArrayData[] = $this->getStyle('css', $mKey);
                                 } else {
                                     $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey));
                                 }
                             } else {
                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT')) {
                                     $bLoadCustomThemeOverwrite = true;
                                 } else {
                                     if ($bReturnArray) {
                                         $aArrayData[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                     } else {
                                         if (isset($this->_aCacheHeaders[$mKey])) {
                                             // $sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . ',';
                                             $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '';
                                         } else {
                                             if ($bIsHttpsPage) {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_secure_' . $mKey;
                                             } else {
                                                 //$sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey . '?v=' . $iVersion . '" />' . "\n";
                                                 $aCustomCssFile[] = Phpfox::getParam('core.url_file') . 'static/' . $this->_aTheme['style_id'] . '_' . $mKey;
                                             }
                                         }
                                     }
                                 }
                             }
                             break;
                         case 'static_script':
                             if (isset($aSubCache[$mKey][$mValue])) {
                                 continue;
                             }
                             if (!defined('PHPFOX_INSTALLER') && Phpfox::getParam('core.load_jquery_from_google_cdn')) {
                                 if ($mKey == 'jquery/ui.js' || $mKey == 'jquery/jquery.js') {
                                     if ($mKey == 'jquery/ui.js') {
                                         $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/' . Phpfox::getParam('core.jquery_ui_google_cdn_version') . '/jquery-ui.min.js"></script>' . "\n";
                                     }
                                     continue;
                                 }
                             }
                             if ($bReturnArray) {
                                 $aArrayData[] = Phpfox::getParam('core.url_static_script') . $mKey;
                             } else {
                                 if (isset($this->_aCacheHeaders[$mKey])) {
                                     // $sJsCacheData .= $mKey . ',';
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static' . PHPFOX_DS . 'jscript' . PHPFOX_DS . $mKey;
                                     }
                                 } else {
                                     //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static_script') . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                     if ($bToHead == 'head') {
                                         $aCacheCSS[] = 'static/jscript/' . $mKey;
                                     } else {
                                         $aCacheJs[] = 'static/jscript/' . $mKey;
                                     }
                                 }
                             }
                             break;
                         default:
                             if (preg_match('/module/i', $mValue)) {
                                 $aParts = explode('_', $mValue);
                                 if (isset($aParts[1]) && Phpfox::isModule($aParts[1])) {
                                     if (substr($mKey, -3) == '.js') {
                                         if ($bReturnArray) {
                                             $aArrayData[] = Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                         } else {
                                             if (isset($this->_aCacheHeaders[$mKey])) {
                                                 //$sJsCacheData .= 'module/' . $aParts[1] . '/static/jscript/' . $mKey . ',';
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                 	$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getCdnPath() . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 }	
                                                 else
                                                 {
                                                 */
                                                 //$sData .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . 'module/' . $aParts[1] . '/static/jscript/' . $mKey . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
                                                 $aCacheJs[] = 'module/' . $aParts[1] . '/static/jscript/' . $mKey;
                                                 // }
                                             }
                                         }
                                     } elseif (substr($mKey, -4) == '.css') {
                                         $aCacheCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                         $bCustomStyle = false;
                                         if ($bCustomStyle === false) {
                                             if ($bReturnArray) {
                                                 //$aArrayData[] = $this->getStyle('css', $mKey, $aParts[1]);
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                             } else {
                                                 /*
                                                 if (defined('PHPFOX_IS_HOSTED_SCRIPT'))
                                                 {
                                                     $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . str_replace(Phpfox::getParam('core.path'), Phpfox::getCdnPath(), $this->getStyle('css', $mKey, $aParts[1])) . $sQmark . 'v=' . $iVersion . '" />' . "\n";
                                                 }
                                                 else
                                                 {
                                                 */
                                                 $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', $this->getStyle('css', $mKey, $aParts[1]));
                                                 // }
                                             }
                                         } else {
                                             //$sStyleCacheData .= str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey . ',';
                                             $aCachesCSS[] = str_replace(Phpfox::getParam('core.path'), '', Phpfox::getParam('core.url_file')) . 'static/' . $this->_aTheme['style_id'] . '_' . $aParts[1] . '_' . $mKey;
                                         }
                                     }
                                 }
                             }
                             break;
                     }
                     $aSubCache[$mKey][$mValue] = true;
                 }
             }
         }
     }
     $sCacheData = '';
     $sCacheData .= "\n\t\t<script type=\"text/javascript\">\n";
     $sCacheData .= $sJs;
     $sCacheData .= "\t\t</script>";
     if (!empty($sStyleCacheData)) {
         $sCacheData .= "\n\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=css&amp;s=' . $sStylePath . '&amp;f=' . rtrim($sStyleCacheData, ',') . '&amp;v=' . $iVersion . '" />';
     }
     if (!empty($sJsCacheData)) {
         $sCacheData .= "\n\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.url_static') . 'gzip.php?t=js&amp;f=' . rtrim($sJsCacheData, ',') . '&amp;v=' . $iVersion . '"></script>';
     }
     if (!empty($sCacheData)) {
         $sData = preg_replace('/<link rel="shortcut icon" type="image\\/x-icon" href="(.*?)" \\/>/i', '<link rel="shortcut icon" type="image/x-icon" href="\\1" />' . $sCacheData, $sData);
     }
     if ($bReturnArray) {
         $sData = '';
     }
     $aCacheJs = array_unique($aCacheJs);
     $aSubCacheCheck = array();
     foreach ($aCacheCSS as $sFile) {
         if (defined('PHPFOX_INSTALLER')) {
             $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
         } else {
             if (isset($aSubCacheCheck[$sFile])) {
                 continue;
             }
             $aSubCacheCheck[$sFile] = true;
             $sData .= "\t\t" . '<link rel="stylesheet" type="text/css" href="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '" />' . "\n";
         }
     }
     foreach ($aCacheJs as $sFile) {
         if (defined('PHPFOX_INSTALLER')) {
             $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="../' . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
         } else {
             $this->_sFooter .= "\t\t" . '<script type="text/javascript" src="' . Phpfox::getParam('core.path') . $sFile . $sQmark . 'v=' . $iVersion . '"></script>' . "\n";
         }
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $this->_sFooter .= "\t\t" . '<script type="text/javascript"> $Core.init(); </script>' . "\n";
     }
     if (count($this->_aPhrases)) {
         $sData .= "\n\t\t<script type=\"text/javascript\">\n\t\t";
         foreach ($this->_aPhrases as $sVar => $sPhrase) {
             $sPhrase = html_entity_decode($sPhrase, null, 'UTF-8');
             $sData .= "\t\t\toTranslations['{$sVar}'] = '" . str_replace("'", "\\'", $sPhrase) . "';\n";
         }
         $sData .= "\t\t</script>\n";
     }
     if (!defined('PHPFOX_INSTALLER') && !Phpfox::isAdminPanel()) {
         $Request = \Phpfox_Request::instance();
         if ($Request->segment(1) == 'theme' && $Request->segment(2) == 'demo') {
             $sData .= '<link href="' . Phpfox::getParam('core.path') . 'theme/default/flavor/default.css?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
         } else {
             $Theme = $this->_theme->get();
             $sData .= '<link href="' . Phpfox::getParam('core.path') . 'themes/' . $Theme->folder . '/flavor/' . $Theme->flavor_folder . '.css?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
         }
     }
     if (!defined('PHPFOX_INSTALLER')) {
         $Apps = new Core\App();
         foreach ($Apps->all() as $App) {
             $assets = $App->path . 'assets/';
             if (file_exists($assets . 'autoload.js')) {
                 $url = str_replace(PHPFOX_DIR_SITE, Phpfox::getParam('core.path'), $assets) . 'autoload.js';
                 $this->_sFooter .= '<script src="' . $url . '?v=' . Phpfox::internalVersion() . '"></script>';
             }
             if (file_exists($assets . 'autoload.css')) {
                 $url = str_replace(PHPFOX_DIR_SITE, Phpfox::getParam('core.path'), $assets) . 'autoload.css';
                 $sData .= '<link href="' . $url . '?v=' . Phpfox::internalVersion() . '" rel="stylesheet">';
             }
         }
         if (!Phpfox::isAdminPanel() && is_object($this->_theme)) {
             $asset = $this->_theme->get()->getPath() . 'assets/autoload.js';
             if (file_exists($asset)) {
                 $url = str_replace([PHPFOX_DIR_SITE, PHPFOX_DIR], Phpfox::getParam('core.path'), $asset);
                 $this->_sFooter .= '<script src="' . $url . '?v=' . Phpfox::internalVersion() . '"></script>';
             }
         }
     }
     if (isset($this->_meta['head'])) {
         $sData .= $this->_meta['head'];
         if (Phpfox::isAdmin()) {
             $this->_sFooter .= '<script>var page_editor_meta = ' . json_encode(['head' => $this->_meta['head']]) . ';</script>';
         }
     }
     if ($bReturnArray) {
         $aArrayData[] = $sData;
         return $aArrayData;
     }
     // Convert meta data
     $bHasNoDescription = false;
     if (count($this->_aMeta) && !PHPFOX_IS_AJAX_PAGE && !defined('PHPFOX_INSTALLER')) {
         $oPhpfoxParseOutput = Phpfox::getLib('parse.output');
         $aFind = array('&lt;', '&gt;', '$');
         $aReplace = array('<', '>', '&36;');
         foreach ($this->_aMeta as $sMeta => $sMetaValue) {
             $sMetaValue = str_replace($aFind, $aReplace, $sMetaValue);
             $sMetaValue = strip_tags($sMetaValue);
             $sMetaValue = str_replace(array("\n", "\r"), "", $sMetaValue);
             $bIsCustomMeta = false;
             switch ($sMeta) {
                 case 'keywords':
                     if (isset($this->_meta['keywords'])) {
                         $sMetaValue = $this->_meta['keywords'];
                         continue;
                     }
                     $sKeywordSearch = Phpfox::getParam('core.words_remove_in_keywords');
                     if (!empty($sKeywordSearch)) {
                         $aKeywordsSearch = array_map('trim', explode(',', $sKeywordSearch));
                     }
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_keyword_limit'));
                     $sMetaValue = trim(rtrim(trim($sMetaValue), ','));
                     $aParts = explode(',', $sMetaValue);
                     $sMetaValue = '';
                     $aKeywordCache = array();
                     foreach ($aParts as $sPart) {
                         $sPart = trim($sPart);
                         if (isset($aKeywordCache[$sPart])) {
                             continue;
                         }
                         if (isset($aKeywordsSearch) && in_array(strtolower($sPart), array_map('strtolower', $aKeywordsSearch))) {
                             continue;
                         }
                         $sMetaValue .= $sPart . ', ';
                         $aKeywordCache[$sPart] = true;
                     }
                     $sMetaValue = rtrim(trim($sMetaValue), ',');
                     break;
                 case 'description':
                     if (isset($this->_meta['description'])) {
                         $sMetaValue = $this->_meta['description'];
                         continue;
                     }
                     $bHasNoDescription = true;
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                     break;
                 case 'robots':
                     $bIsCustomMeta = false;
                     break;
                 default:
                     $bIsCustomMeta = true;
                     break;
             }
             $sMetaValue = str_replace('"', '\\"', $sMetaValue);
             $sMetaValue = Phpfox_Locale::instance()->convert($sMetaValue);
             $sMetaValue = html_entity_decode($sMetaValue, null, 'UTF-8');
             $sMetaValue = str_replace(array('<', '>'), '', $sMetaValue);
             if ($bIsCustomMeta) {
                 if ($sMeta == 'og:description') {
                     $sMetaValue = $oPhpfoxParseOutput->shorten($oPhpfoxParseOutput->clean($sMetaValue), Phpfox::getParam('core.meta_description_limit'));
                 }
                 switch ($sMeta) {
                     case 'canonical':
                         $sCanonical = $sMetaValue;
                         $sCanonical = preg_replace('/\\/when\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/show\\_([a-zA-Z0-9\\-]+)\\//i', '/', $sCanonical);
                         $sCanonical = preg_replace('/\\/view\\_\\//i', '/', $sCanonical);
                         if (Phpfox::isMobile()) {
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sCanonical = str_replace(Phpfox::getParam('core.path') . 'mobile/', Phpfox::getParam('core.path'), $sMetaValue);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sCanonical = str_replace('?' . PHPFOX_GET_METHOD . '=/mobile/', '?' . PHPFOX_GET_METHOD . '=/', $sMetaValue);
                             }
                         }
                         $sData .= "\t\t<link rel=\"canonical\" href=\"{$sCanonical}\" />\n";
                         if (!Phpfox::isMobile()) {
                             $sMobileReplace = '';
                             if (Phpfox::getParam('core.url_rewrite') == '1') {
                                 $sMobileReplace = str_replace(Phpfox::getParam('core.path'), Phpfox::getParam('core.path') . 'mobile/', $sCanonical);
                             } elseif (Phpfox::getParam('core.url_rewrite') == '2') {
                                 $sMobileReplace = str_replace('?' . PHPFOX_GET_METHOD . '=/', '?' . PHPFOX_GET_METHOD . '=/mobile/', $sCanonical);
                             }
                             $sData .= "\t\t<link rel=\"alternate\" media=\"only screen and (max-width: 640px)\" href=\"{$sMobileReplace}\" />\n";
                         }
                         break;
                     default:
                         $sData .= "\t\t<meta property=\"{$sMeta}\" content=\"{$sMetaValue}\" />\n";
                         break;
                 }
             } else {
                 if (strpos($sData, 'meta name="' . $sMeta . '"') !== false) {
                     $sData = preg_replace("/<meta name=\"{$sMeta}\" content=\"(.*?)\" \\/>\n\t/i", "<meta" . ($sMeta == 'description' ? ' property="og:description" ' : '') . " name=\"{$sMeta}\" content=\"" . $sMetaValue . "\" />\n\t", $sData);
                 } else {
                     $sData = preg_replace('/<meta/', '<meta name="' . $sMeta . '" content="' . $sMetaValue . '" />' . "\n\t\t" . '<meta', $sData, 1);
                 }
             }
         }
         if (!$bHasNoDescription) {
             $sData .= "\t\t" . '<meta name="description" content="' . Phpfox::getLib('parse.output')->clean(Phpfox_Locale::instance()->convert(Phpfox::getParam('core.description'))) . '" />' . "\n";
         }
     }
     // Clear from memory
     $this->_aHeaders = array();
     $this->_aMeta = array();
     return $sData;
 }
예제 #30
-1
 /**
  * Controller
  */
 public function process()
 {
     ($sPlugin = Phpfox_Plugin::get('profile.component_block_header_process')) ? eval($sPlugin) : false;
     if (defined('PHPFOX_IS_PAGES_ADD')) {
         return false;
     }
     $aUser = $this->getParam('aUser');
     if ($aUser === null) {
         $aUser = $this->getParam('aPage');
     } else {
         if (!isset($aUser['is_featured'])) {
             // If for some reason this is happening too often check the caching in /file/cache/profile
             // and the user service, function get
             $aUser['is_featured'] = false;
         }
     }
     if (!Phpfox::isModule('friend')) {
         $aUser['is_friend'] = false;
     }
     $aUser['is_header'] = true;
     $aUser['is_liked'] = !isset($aUser['is_liked']) || $aUser['is_liked'] === null || $aUser['is_liked'] < 1 ? false : true;
     if (!isset($aUser['user_id'])) {
         return false;
     }
     if (!defined('PAGE_TIME_LINE') && !defined('PHPFOX_IS_PAGES_VIEW')) {
         if (Phpfox::getParam('user.enable_relationship_status')) {
             $sRelationship = Phpfox::getService('custom')->getRelationshipPhrase($aUser);
             $this->template()->assign(array('sRelationship' => $sRelationship));
         }
         $bCanSendPoke = Phpfox::isModule('poke') && Phpfox::getService('poke')->canSendPoke($aUser['user_id']);
         $this->template()->assign(array('bCanPoke' => $bCanSendPoke));
     } else {
         if (isset($aUser['use_timeline']) && $aUser['use_timeline'] || defined('PHPFOX_IS_PAGES_VIEW')) {
             $sPagesSection = Phpfox::getNonRewritten('pages');
             $sModule = $this->request()->get('req1') == $sPagesSection ? $this->request()->get('req3') : $this->request()->get('req2');
             $sModule = Phpfox_Url::instance()->reverseRewrite($sModule);
             if (Phpfox::isModule($sModule) && Phpfox::hasCallback($sModule, 'getPageSubMenu')) {
                 if (defined('PHPFOX_IS_PAGES_VIEW')) {
                     $aPage = $this->getParam('aPage');
                 }
                 $aMenu = Phpfox::callback($sModule . '.getPageSubmenu', defined('PHPFOX_IS_PAGES_VIEW') ? $aPage : $aUser);
                 if (is_array($aMenu)) {
                     foreach ($aMenu as $iKey => $aSubMenu) {
                         $aMenu[$iKey]['module'] = $sModule;
                         if (isset($aSubMenu['phrase'])) {
                             if (Phpfox_Locale::instance()->isPhrase($sModule . '.' . $aSubMenu['phrase'])) {
                                 $aMenu[$iKey]['var_name'] = $aSubMenu['phrase'];
                             } else {
                                 $aMenu[$iKey]['text'] = $aSubMenu['phrase'];
                             }
                             continue;
                         }
                         switch ($sModule) {
                             case 'event':
                                 $aMenu[$iKey]['var_name'] = 'menu_create_new_' . $sModule;
                                 break;
                             case 'forum':
                                 $aMenu[$iKey]['var_name'] = 'post_a_new_thread';
                                 break;
                             case 'music':
                                 $aMenu[$iKey]['var_name'] = 'menu_upload_a_song';
                                 break;
                             case 'photo':
                                 $aMenu[$iKey]['var_name'] = 'upload_a_new_image';
                                 break;
                             case 'video':
                                 $aMenu[$iKey]['var_name'] = 'menu_upload_a_new_video';
                                 break;
                             default:
                                 $aMenu[$iKey]['var_name'] = 'menu_add_new_' . $sModule;
                         }
                     }
                 }
                 $this->template()->assign(array('aSubMenus' => $aMenu));
             }
         }
     }
     $this->template()->assign(array('aUser' => $aUser));
     if (isset($bHideProfileBlockHeader)) {
         return false;
     }
 }