Пример #1
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');
     }
 }
Пример #2
0
 /**
  * Controller
  */
 public function process()
 {
     // $this->request()->cache('text/html', strtotime('-2 days'), 7);
     if ($sPlugin = Phpfox_Plugin::get('core.component_controller_index_member_start')) {
         eval($sPlugin);
     }
     if ($this->request()->segment(1) != 'hashtag') {
         Phpfox::isUser(true);
     }
     if ($this->request()->get('req3') == 'customize') {
         define('PHPFOX_IN_DESIGN_MODE', true);
         define('PHPFOX_CAN_MOVE_BLOCKS', true);
         if ($iTestStyle = $this->request()->get('test_style_id')) {
             if (Phpfox_Template::instance()->testStyle($iTestStyle)) {
             }
         }
         $aDesigner = array('current_style_id' => Phpfox::getUserBy('style_id'), 'design_header' => Phpfox::getPhrase('core.customize_dashboard'), 'current_page' => $this->url()->makeUrl(''), 'design_page' => $this->url()->makeUrl('core.index-member', 'customize'), 'block' => 'core.index-member', 'item_id' => Phpfox::getUserId(), 'type_id' => 'user');
         $this->setParam('aDesigner', $aDesigner);
         $this->template()->setPhrase(array('theme.are_you_sure'))->setHeader('cache', array('style.css' => 'style_css', 'video.css' => 'module_video', 'design.js' => 'module_theme', 'select.js' => 'module_theme'));
         if (Phpfox::getParam('profile.can_drag_drop_blocks_on_profile')) {
             $this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">$Behavior.core_controller_member_designonupdate = function() { function designOnUpdate() { $Core.design.updateSorting(); } };</script>', '<script type="text/javascript">$Behavior.core_controller_init = function() { $Core.design.init({type_id: \'user\'}); };</script>'));
         }
     } else {
         // $this->template()->setHeader('jquery/ui.js', 'static_script');
         $this->template()->setHeader('cache', array('sort.js' => 'module_theme', 'design.js' => 'module_theme', 'video.css' => 'module_video'))->setHeader(array());
     }
     if (Phpfox::getParam('video.convert_servers_enable')) {
         $this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>');
     }
     Phpfox_Module::instance()->setCacheBlockData(array('table' => 'user_dashboard', 'field' => 'user_id', 'item_id' => Phpfox::getUserId(), 'controller' => 'core.index-member'));
     $this->template()->setHeader('cache', array('feed.js' => 'module_feed', 'welcome.css' => 'style_css', 'announcement.css' => 'style_css', 'comment.css' => 'style_css', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script'))->setEditor(array('load' => 'simple'));
 }
Пример #3
0
 public function process()
 {
     if ($this->request()->segment(2) == 'search') {
         return false;
     }
     $title = '';
     $threads = [];
     $type = 'threads';
     if (Phpfox_Module::instance()->getFullControllerName() == 'forum.forum') {
         $title = 'Recent Posts';
         $threads = Forum_Service_Post_Post::instance()->getRecentForForum($this->request()->segment(2));
         $type = 'posts';
     } else {
         $title = 'Recent Discussions';
         $ids = [];
         $forums = Forum_Service_Forum::instance()->getForums();
         foreach ($forums as $forum) {
             $ids[] = $forum['forum_id'];
             $childs = Forum_Service_Forum::instance()->id($forum['forum_id'])->getChildren();
             if ($childs) {
                 foreach ($childs as $id) {
                     $ids[] = $id;
                 }
             }
         }
         $cond[] = 'ft.forum_id IN(' . implode(',', $ids) . ') AND ft.group_id = 0 AND ft.view_id >= 0';
         list($cnt, $threads) = Forum_Service_Thread_Thread::instance()->get($cond, 'ft.time_update DESC', 0, 20);
     }
     $this->template()->assign(['sHeader' => $title, 'threads' => $threads, 'type' => $type]);
     return 'block';
 }
Пример #4
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.force_404_check')) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     $this->url()->send('user.browse');
 }
Пример #5
0
 public function import($aVals, $bMissingOnly = false)
 {
     $iProductId = Admincp_Service_Product_Product::instance()->getId($aVals['product']);
     if (!is_array($aVals)) {
         return false;
     }
     $aCache = array();
     if ($bMissingOnly) {
         $aRows = $this->database()->select('call_name')->from(Phpfox::getT('plugin_hook'))->execute('getRows', array('free_result' => true));
         foreach ($aRows as $aRow) {
             $aCache[md5($aRow['call_name'])] = $aRow['call_name'];
         }
     }
     $aSql = array();
     $aVals = isset($aVals['hook'][0]) ? $aVals['hook'] : array($aVals['hook']);
     foreach ($aVals as $aVal) {
         if ($bMissingOnly && isset($aCache[md5($aVal['call_name'])])) {
             continue;
         }
         $iModuleId = Phpfox_Module::instance()->getModuleId($aVal['module']);
         $aSql[] = array($aVal['hook_type'], $iModuleId, $iProductId, $aVal['call_name'], $aVal['added'], $aVal['version_id']);
     }
     if ($aSql) {
         $this->database()->multiInsert(Phpfox::getT('plugin_hook'), array('hook_type', 'module_id', 'product_id', 'call_name', 'added', 'version_id'), $aSql);
     }
     return true;
 }
Пример #6
0
    /**
     * Controller
     */
    public function process()
    {
        if (Phpfox::getParam('core.phpfox_is_hosted')) {
            $this->url()->send('admincp');
        }
        if ($aVals = $this->request()->getArray('val')) {
            if (Phpfox::getService('theme.template.process')->add($aVals)) {
                $this->url()->send('admincp.theme.template.add', null, Phpfox::getPhrase('theme.template_successfully_added'));
            }
        }
        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: "js_template_content"	
							,start_highlight: true
							,allow_resize: "both"
							,allow_toggle: false
							,word_wrap: false
							,language: "en"
							,syntax: "html"
						});		
					</script>'));
        }
        $this->template()->setTitle(Phpfox::getPhrase('theme.create_a_new_template'))->setBreadcrumb(Phpfox::getPhrase('theme.create_new_template'))->assign(array('aThemes' => Theme_Service_Theme::instance()->get(), 'aModules' => Phpfox_Module::instance()->getModules()));
    }
Пример #7
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $bIsEdit = false;
     if (($iEditId = $this->request()->get('id')) || ($iEditId = $this->request()->get('module_id'))) {
         Phpfox::getUserParam('admincp.can_manage_modules', true);
         $aRow = Phpfox::getService('admincp.module')->getForEdit($iEditId);
         $bIsEdit = true;
         if ($aRow['is_menu'] && !empty($aRow['menu'])) {
             $aMenus = unserialize($aRow['menu']);
             $aSubs = array();
             foreach ($aMenus as $sPhrase => $aMenu) {
                 $aParts = explode('.', $sPhrase);
                 $aSubs[] = array('phrase' => Phpfox::getService('language.phrase')->getStaticPhrase($sPhrase), 'link' => implode('.', $aMenu['url']), 'var_name' => $aParts[1]);
             }
             $aRow['menu'] = $aSubs;
         }
         $this->template()->assign(array('aForms' => $aRow));
     } else {
         Phpfox::getUserParam('admincp.can_add_new_modules', true);
     }
     $aValidation = array('module_id' => Phpfox::getPhrase('admincp.select_name_for_your_module'));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if ($bIsEdit) {
                 if (Phpfox::getService('admincp.module.process')->update($aRow['module_id'], $aVals)) {
                     $this->url()->send('admincp', array('module', 'add', 'id' => $aRow['module_id']), Phpfox::getPhrase('admincp.module_successfully_updated'));
                 }
             } else {
                 if (Phpfox_Module::instance()->isModule($aVals['module_id'])) {
                     Phpfox_Error::set(Phpfox::getPhrase('admincp.module_name_already_used'));
                 } else {
                     if ($sName = Phpfox::getService('admincp.module.process')->add($aVals)) {
                         $this->url()->send('admincp', array('module'), Phpfox::getPhrase('admincp.module_successfully_created_redirect'));
                     }
                 }
             }
         }
     }
     $aVals = $this->request()->getArray('val');
     $aMenus = array();
     if (isset($aVals['menu']) || isset($aRow['menu'])) {
         $aSubMenus = $bIsEdit ? $aRow['menu'] : $aVals['menu'];
         if (is_array($aSubMenus) && count($aSubMenus)) {
             foreach ($aSubMenus as $iKey => $aMenu) {
                 if (empty($aMenu['phrase'])) {
                     continue;
                 }
                 $aMenus[$iKey] = $aMenu;
             }
         }
     }
     $this->template()->setBreadCrumb($bIsEdit ? 'Editing Module: ' . $aRow['module_id'] : Phpfox::getPhrase('admincp.create_module'), $this->url()->current(), true)->setTitle($bIsEdit ? 'Editing Module: ' . $aRow['module_id'] : Phpfox::getPhrase('admincp.create_module'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aLanguages' => $bIsEdit ? Phpfox::getService('language')->getWithPhrase($aRow['phrase_var_name']) : Phpfox::getService('language')->get(), 'sDir' => PHPFOX_DIR_MODULE, 'aMenus' => $aMenus, 'iMenus' => $bIsEdit && count($aRow['menu']) ? count($aRow['menu']) - 1 : (isset($aVals['menu']) ? count($aVals['menu']) - 1 : 3), 'sPhpfoxDs' => PHPFOX_DS, 'bIsEdit' => $bIsEdit));
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_module_add_process')) ? eval($sPlugin) : false;
 }
Пример #8
0
 /**
  * Controller
  */
 public function process()
 {
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if (($sLegacyThread = $this->request()->get('req3')) && !empty($sLegacyThread) && !is_numeric($sLegacyTitle)) {
             $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('thread_id', 'title'), 'table' => 'forum_thread', 'redirect' => 'forum.thread', 'title' => $sLegacyThread));
         } else {
             $aForumParts = explode('-', $sLegacyTitle);
             if (isset($aForumParts[1])) {
                 $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('forum_id', 'name'), 'table' => 'forum', 'redirect' => 'forum', 'search' => 'forum_id', 'title' => $aForumParts[1]));
             }
         }
     }
     Phpfox::getUserParam('forum.can_view_forum', true);
     $aParentModule = $this->getParam('aParentModule');
     if (Phpfox::getParam('core.phpfox_is_hosted') && empty($aParentModule)) {
         $this->url()->send('');
     } else {
         if (empty($aParentModule) && $this->request()->get('view') == 'new') {
             $aDo = explode('/', $this->request()->get('do'));
             if ($aDo[0] == 'mobile' || isset($aDo[1]) && $aDo[1] == 'mobile') {
                 Phpfox_Module::instance()->getComponent('forum.forum', array('bNoTemplate' => true), 'controller');
                 return;
             }
         }
     }
     if ($this->request()->get('req2') == 'topics' || $this->request()->get('req2') == 'posts') {
         return Phpfox_Module::instance()->setController('error.404');
     }
     $this->template()->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl('forum'))->setPhrase(array('forum.provide_a_reply', 'forum.adding_your_reply', 'forum.are_you_sure', 'forum.post_successfully_deleted', 'forum.reply_multi_quoting'))->setHeader('cache', array('forum.js' => 'module_forum'));
     if ($aParentModule !== null) {
         Phpfox_Module::instance()->getComponent('forum.forum', array('bNoTemplate' => true), 'controller');
         return;
     }
     if ($this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('forum.forum');
     }
     if ($aParentModule === null) {
         Phpfox_Search::instance()->set(array('type' => 'forum', 'search_tool' => array('table_alias' => 'ft', 'search' => array('action' => $this->url()->makeUrl('forum.search'), 'default_value' => 'Search...', 'name' => 'search', 'field' => array('ft.title')), 'sort' => array('latest' => array('ft.time_stamp', Phpfox::getPhrase('blog.latest'))), 'show' => array(5, 10, 15)), 'field' => array('depend' => 'result', 'fields' => array('fp.post_id', 'ft.thread_id'))));
     }
     $this->setParam('bIsForum', true);
     // Phpfox::getService('forum')->buildMenu();
     $aIds = [];
     $aForums = Phpfox::getService('forum')->live()->getForums();
     foreach ($aForums as $aForum) {
         $aIds[] = $aForum['forum_id'];
         $aChilds = (array) Phpfox::getService('forum')->id($aForum['forum_id'])->getChildren();
         foreach ($aChilds as $iId) {
             $aIds[] = $iId;
         }
     }
     Phpfox::getService('forum')->id(null);
     /*
     list($iCnt, $aThreads) = Forum_Service_Thread_Thread::instance()
     	->get('ft.forum_id IN(' . implode(',', $aIds) . ') AND ft.group_id = 0 AND ft.view_id >= 0 AND ft.is_announcement = 0', 'ft.order_id DESC', '', 0, 20);
     */
     $this->template()->setTitle(Phpfox::getPhrase('forum.forum'))->assign(array('aForums' => Phpfox::getService('forum')->live()->getForums(), 'bHasCategory' => Phpfox::getService('forum')->hasCategory(), 'aCallback' => null));
     Phpfox::getService('forum')->buildMenu();
 }
Пример #9
0
 private function _loadBlocks($location)
 {
     echo '<div class="_block" data-location="' . $location . '">';
     $blocks = \Phpfox_Module::instance()->getModuleBlocks($location);
     foreach ($blocks as $block) {
         \Phpfox::getBlock($block);
     }
     echo '</div>';
 }
Пример #10
0
 /**
  * Controller
  */
 public function process()
 {
     $bPass = false;
     if (!Phpfox::isUser() && (Phpfox_Module::instance()->getFullControllerName() != 'user.register' && Phpfox_Module::instance()->getFullControllerName() != 'core.index-visitor')) {
         $bPass = true;
     }
     if ($bPass === false) {
         return false;
     }
 }
Пример #11
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('photo.can_view_photos', true);
     if ($sTag = $this->request()->get('req3')) {
         return Phpfox_Module::instance()->setController('photo.index');
     }
     $this->template()->setTitle(Phpfox::getPhrase('photo.photo_tags'))->setBreadcrumb(Phpfox::getPhrase('photo.photo'), $this->url()->makeUrl('photo'))->setBreadcrumb(Phpfox::getPhrase('photo.tags'), $this->url()->makeUrl('photo.tag'), true);
     $this->setParam('iTagDisplayLimit', 75);
     $this->setParam('bNoTagBlock', true);
 }
Пример #12
0
 /**
  * Controller
  */
 public function process()
 {
     if (!$this->request()->get('user') && !$this->request()->get('id')) {
         Phpfox::isUser(true);
     }
     list($bIsRegistration, $sNextUrl) = $this->url()->isRegistration(2);
     ($sPlugin = Phpfox_Plugin::get('invite.component_controller_index_process_start')) ? eval($sPlugin) : false;
     // is a user sending an invite
     if ($aVals = $this->request()->getArray('val')) {
         // we may have a bunch of emails separated by commas, lets array them
         $aMails = explode(',', $aVals['emails']);
         list($aMails, $aInvalid, $aCacheUsers) = Phpfox::getService('invite')->getValid($aMails, Phpfox::getUserId());
         // failed emails
         $sFailed = '';
         $bSent = true;
         if (!empty($aMails)) {
             foreach ($aMails as $sMail) {
                 $sMail = trim($sMail);
                 // we insert the invite id and send the reference, so we can track which users
                 // have signed up
                 $iInvite = Phpfox::getService('invite.process')->addInvite($sMail, Phpfox::getUserId());
                 ($sPlugin = Phpfox_Plugin::get('invite.component_controller_index_process_send')) ? eval($sPlugin) : false;
                 $sFromEmail = Phpfox::getParam('core.email_from_email');
                 // check if we could send the mail
                 $sLink = Phpfox_Url::instance()->makeUrl('invite', array('id' => $iInvite));
                 $bSent = Phpfox::getLib('mail')->to($sMail)->fromEmail(empty($sFromEmail) ? Phpfox::getUserBy('email') : Phpfox::getParam('core.email_from_email'))->fromName(Phpfox::getUserBy('full_name'))->subject(array('invite.full_name_invites_you_to_site_title', array('full_name' => Phpfox::getUserBy('full_name'), 'site_title' => Phpfox::getParam('core.site_title'))))->message(array('invite.full_name_invites_you_to_site_title_link', array('full_name' => Phpfox::getUserBy('full_name'), 'site_title' => Phpfox::getParam('core.site_title'), 'link' => $sLink)))->send();
             }
         }
         if ($bIsRegistration === true) {
             $this->url()->send($sNextUrl, null, Phpfox::getPhrase('invite.your_friends_have_successfully_been_invited'));
         }
         $this->template()->assign(array('aValid' => $aMails, 'aInValid' => $aInvalid, 'aUsers' => $aCacheUsers));
     }
     // check if someone is visiting a link sent by email
     if ($iId = $this->request()->getInt('id')) {
         if (Phpfox::isUser() == true) {
             $this->url()->send('core.index-member');
         }
         // we update the entry to be seen:
         if (Phpfox::getService('invite.process')->updateInvite($iId, true)) {
             $this->url()->send('user.register');
         } else {
             Phpfox_Error::set('Your invitation has expired or it was not valid');
             return Phpfox_Module::instance()->setController('core.index-visitor');
         }
     } elseif ($iId = $this->request()->getInt('user')) {
         if (Phpfox::getService('invite.process')->updateInvite($iId, false)) {
             $this->url()->send('user.register');
         }
     }
     $this->template()->setTitle(Phpfox::getPhrase('invite.invite_your_friends'))->setBreadcrumb(Phpfox::getPhrase('invite.invite_your_friends'))->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sSiteEmail' => Phpfox::getUserBy('email'), 'sSiteTitle' => Phpfox::getParam('core.site_title'), 'sIniviteLink' => Phpfox_Url::instance()->makeUrl('invite', array('user' => Phpfox::getUserId())), 'bIsRegistration' => $bIsRegistration, 'sNextUrl' => $this->url()->makeUrl($sNextUrl)));
     ($sPlugin = Phpfox_Plugin::get('invite.component_controller_index_process_end')) ? eval($sPlugin) : false;
 }
Пример #13
0
 /**
  * Controller
  */
 public function process()
 {
     $bIsEdit = false;
     $oSession = Phpfox::getLib('session');
     $aValidation = array('product_id' => Phpfox::getPhrase('page.select_product'), 'title' => Phpfox::getPhrase('page.missing_title'), 'title_url' => Phpfox::getPhrase('page.missing_url_title'), 'is_active' => Phpfox::getPhrase('page.specify_page_active'), 'text' => Phpfox::getPhrase('page.page_missing_data'));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
     if (($iPageId = $this->request()->getInt('id')) || ($iPageId = $this->request()->getInt('page_id'))) {
         Phpfox::getUserParam('page.can_manage_custom_pages', true);
         $aPage = Phpfox::getService('page')->getForEdit($iPageId);
         if (isset($aPage['page_id'])) {
             $bIsEdit = true;
             // $aPage['attachment'] = (Phpfox::isModule('attachment') ? Phpfox::getService('attachment')->getForItemEdit($aPage['page_id'], 'page', Phpfox::getUserId()) : '');
             if (Phpfox::isModule('tag')) {
                 $aTags = Tag_Service_Tag::instance()->getTagsById('page', $aPage['page_id']);
                 if (isset($aTags[$aPage['page_id']])) {
                     $aPage['tag_list'] = '';
                     foreach ($aTags[$aPage['page_id']] as $aTag) {
                         $aPage['tag_list'] .= ' ' . $aTag['tag_text'] . ',';
                     }
                     $aPage['tag_list'] = trim(trim($aPage['tag_list'], ','));
                 }
             }
             $this->template()->assign(array('aForms' => $aPage, 'aAccess' => empty($aPage['disallow_access']) ? null : unserialize($aPage['disallow_access'])));
         }
     }
     if ($aVals = $this->request()->getArray('val')) {
         Phpfox::getLib('parse.input')->allowTitle(Phpfox::getLib('parse.input')->cleanTitle($aVals['title_url']), Phpfox::getPhrase('page.invalid_title'));
         if ($oValid->isValid($aVals)) {
             if ($bIsEdit) {
                 $sMessage = Phpfox::getPhrase('page.page_successfully_updated');
                 $sReturn = Phpfox::getService('page.process')->update($aPage['page_id'], $aVals, $aPage['user_id']);
                 $aUrl = null;
             } else {
                 $sMessage = Phpfox::getPhrase('page.successfully_added');
                 $sReturn = Phpfox::getService('page.process')->add($aVals);
                 $aUrl = null;
             }
             if ($sReturn) {
                 return ['redirect' => $this->url()->makeUrl($sReturn, null, $sMessage)];
             }
         } else {
             $aError = Phpfox_Error::get();
             $sError = '';
             if (is_array($aError)) {
                 $sError = implode(' ', $aError);
             } else {
                 $sError = $aError;
             }
             return ['error' => $sError];
         }
     }
     $this->template()->setSectionTitle('<a href="' . $this->url()->makeUrl('admincp.page') . '">Custom Pages</a>')->setTitle(Phpfox::getPhrase('page.add_new_page'))->setBreadCrumb(Phpfox::getPhrase('page.add_new_page'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aUserGroups' => Phpfox::getService('user.group')->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsEdit' => $bIsEdit, 'aModules' => Phpfox_Module::instance()->getModules(), 'bFormIsPosted' => count($aVals) ? true : false))->setEditor()->setHeader(array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'switch_menu.js' => 'static_script', '<script type="text/javascript">var Attachment = {sCategory: "page", iItemId: "' . (isset($aPage['page_id']) ? $aPage['page_id'] : '') . '"};</script>'));
 }
Пример #14
0
 /**
  * Controller
  */
 public function process()
 {
     $oCache = Phpfox::getLib('cache');
     $sRequest = $this->request()->get('req1');
     $sCacheId = $oCache->set('page_' . md5($sRequest));
     $bIsCached = false;
     if (!($aPage = $oCache->get($sCacheId))) {
         $aPage = Phpfox::getService('page')->getPage($sRequest, true);
         $bIsCached = true;
     }
     if (!isset($aPage['page_id'])) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     if (!Phpfox::isModule($aPage['module_id']) || $aPage['is_active'] == 0) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     if ($bIsCached && !$aPage['add_view']) {
         $oCache->save($sCacheId, $aPage);
     }
     if (!empty($aPage['disallow_access'])) {
         $aUserGroups = unserialize($aPage['disallow_access']);
         if (in_array(Phpfox::getUserBy('user_group_id'), $aUserGroups)) {
             $this->url()->send('subscribe');
         }
     }
     if ($aPage['full_size']) {
         $this->template()->setFullSite();
     }
     $aPage['bookmark_url'] = $this->url()->makeUrl($aPage['title_url']);
     if (!$aPage['is_active'] && Phpfox::getUserParam('page.can_manage_custom_pages') && Phpfox::getUserParam('admincp.has_admin_access')) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     if ($aPage['add_view'] && Phpfox::getUserId() && !$aPage['has_viewed']) {
         Phpfox::getService('track.process')->add('page', $aPage['page_id']);
         Phpfox::getService('page.process')->updateView($aPage['page_id']);
     }
     if ($aPage['total_tag'] > 0 && Phpfox::isModule('tag')) {
         $aTags = Tag_Service_Tag::instance()->getTagsById('page', $aPage['page_id']);
         if (isset($aTags[$aPage['page_id']])) {
             $aPage['tag_list'] = $aTags[$aPage['page_id']];
         }
     }
     if (!empty($aPage['keyword'])) {
         $this->template()->setMeta('keywords', $aPage['keyword']);
     }
     if (!empty($aPage['description'])) {
         $this->template()->setMeta('description', $aPage['description']);
     }
     ($sPlugin = Phpfox_Plugin::get('page.component_controller_view_process')) ? eval($sPlugin) : false;
     $this->template()->setTitle($aPage['is_phrase'] ? Phpfox::getPhrase($aPage['title']) : $aPage['title'])->assign(array('aPage' => $aPage));
 }
Пример #15
0
 /**
  * Controller
  */
 public function process()
 {
     $sImage = 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' => '_120', 'max_width' => 100, 'max_height' => 100)));
     $aGroup = Phpfox::getService('user.group')->getGroup(Phpfox::getUserBy('user_group_id'));
     $this->template()->assign(array('aUserGroup' => $aGroup, 'sImage' => $sImage, 'aDashboards' => Phpfox::getService('core')->getDashboardLinks(), 'sBlockLocation' => Phpfox_Module::instance()->getBlockLocation('core.dashboard'), 'sTotalUserViews' => Phpfox::getUserBy('total_view'), 'sLastLogin' => Phpfox::getLib('date')->convertTime(Phpfox::getUserBy('last_login'), 'core.profile_time_stamps')));
     if (!PHPFOX_IS_AJAX) {
         $aMenus = array();
         foreach (Phpfox::getService('core')->getDashboardMenus() as $sPhrase => $sLink) {
             $aMenus[Phpfox::getPhrase($sPhrase)] = $sLink;
         }
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('core.dashboard'), 'aMenu' => $aMenus));
         return 'block';
     }
 }
Пример #16
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('forum.can_view_forum', true);
     if ($this->request()->get('module')) {
         if ($this->request()->get('req5')) {
             return Phpfox_Module::instance()->setController('forum.forum');
         }
     }
     if ($sTag = $this->request()->get('req3')) {
         return Phpfox_Module::instance()->setController('forum.forum');
     }
     $this->template()->setTitle(Phpfox::getPhrase('forum.forum_tags'))->setBreadcrumb(Phpfox::getPhrase('forum.forum'), $this->url()->makeUrl('forum'))->setBreadcrumb(Phpfox::getPhrase('forum.tags'), $this->url()->makeUrl('forum.tag'), true);
     $this->setParam('iTagDisplayLimit', Phpfox::getParam('forum.total_forum_tags_display'));
 }
Пример #17
0
 public function loadProfileBlock()
 {
     exit;
     $sProfileUrl = str_replace('profile_', '', $this->get('url'));
     if ($this->get('url') == 'profile_info') {
         $sProfileUrl = 'profile';
     }
     if (!Phpfox::isModule($sProfileUrl)) {
         Phpfox_Error::set('Trying to load an invalid module.');
     } else {
         if (!Phpfox::hasCallback($sProfileUrl, 'getAjaxProfileController')) {
             Phpfox_Error::set('Unable to load the section you are looking for.');
         }
     }
     if (Phpfox_Error::isPassed()) {
         $oModule = Phpfox_Module::instance();
         $oTpl = Phpfox_Template::instance();
         $oTpl->assign(array('bIsAjaxLoader' => true));
         $aStyleInUse = $oTpl->getStyleInUse();
         $oModule->loadBlocks();
         $aUrlParams = array($this->get('user_name'));
         if ($this->get('url') != 'profile') {
             $aUrlParams[] = str_replace('profile_', '', $this->get('url'));
         }
         Phpfox_Url::instance()->setParam($aUrlParams);
         $oModule->setController(Phpfox::callback($sProfileUrl . '.getAjaxProfileController'));
         if ($aStyleInUse['total_column'] == '3') {
             $oTpl->assign(array('aBlocks1' => $oTpl->bIsSample ? true : Phpfox_Module::instance()->getModuleBlocks(1), 'aBlocks3' => $oTpl->bIsSample ? true : Phpfox_Module::instance()->getModuleBlocks(3), 'aAdBlocks1' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Ad_Service_Ad::instance()->getForBlock(1) : null), 'aAdBlocks3' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Ad_Service_Ad::instance()->getForBlock(3) : null)));
         } else {
             $oTpl->assign(array('aBlocks1' => array(), 'aBlocks3' => array(), 'aAdBlocks1' => array(), 'aAdBlocks3' => array()));
         }
         $oTpl->assign(array('sPublicMessage' => Phpfox::getMessage(), 'aErrors' => Phpfox_Error::getDisplay() ? Phpfox_Error::get() : array(), 'aStyleInUse' => $aStyleInUse));
         list($aBreadCrumbs, $aBreadCrumbTitle) = $oTpl->getBreadCrumb();
         $this->remove('#js_temp_breadcrumb');
         if (count($aBreadCrumbs)) {
             foreach ($aBreadCrumbs as $sLink => $sPhrase) {
                 $this->append('h1', '<span id="js_temp_breadcrumb"><span class="profile_breadcrumb">&#187;</span><a href="' . $sLink . '">' . $sPhrase . '</a></span>');
                 break;
             }
         }
         $oTpl->getLayout($oTpl->sDisplayLayout);
         $this->html($aStyleInUse['total_column'] == '3' ? '#content_load_data' : '#content', $this->getContent(false));
         if ($this->get('url') == 'profile_info') {
             $this->call('$Core.loadProfileInfo();');
         }
     } else {
         $this->html('#js_profile_block_view_data_' . $this->get('url'), implode('', Phpfox_Error::get()));
     }
     $this->call('$Core.loadInit();');
 }
Пример #18
0
 /**
  * Displays the error message and directly creates a variable for the template engine
  *
  * @static 
  * @param string $sMsg Error message you want to display on the current page the user is on.
  */
 public static function display($sMsg, $iErrCode = null)
 {
     if (PHPFOX_IS_AJAX) {
         echo $sMsg;
     } else {
         Phpfox_Module::instance()->setController('error.display');
         Phpfox_Template::instance()->assign(array('sErrorMessage' => $sMsg));
     }
     if ($iErrCode !== null) {
         $oUrl = Phpfox_Url::instance();
         header($oUrl->getHeaderCode($iErrCode));
     }
     return false;
 }
Пример #19
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('forum.can_view_forum', true);
     $aGroup = $this->getParam('aGroup');
     if (!Phpfox::getService('group')->hasAccess($aGroup['group_id'], 'can_use_forum')) {
         return Phpfox_Error::display(Phpfox::getPhrase('forum.forum_section_is_closed'));
     }
     $this->template()->setFullSite();
     if ($this->request()->get('req4')) {
         $this->setParam('aCallback', array('group_id' => $aGroup['group_id'], 'url_home' => 'group.' . $aGroup['title_url'] . '.forum', 'title' => $aGroup['title']));
         return Phpfox_Module::instance()->setController('forum.thread');
     }
     $this->setParam('aCallback', array('group_id' => $aGroup['group_id'], 'url_home' => 'group.' . $aGroup['title_url'] . '.forum', 'title' => $aGroup['title']));
     return Phpfox_Module::instance()->setController('forum.forum');
 }
Пример #20
0
 /**
  * Controller
  */
 public function process()
 {
     $aGroup = $this->getParam('aGroup');
     if (!Phpfox::getService('group')->hasAccess($aGroup['group_id'], 'can_use_event')) {
         return Phpfox_Error::display(Phpfox::getPhrase('event.the_events_section_is_closed'));
     }
     if ($this->request()->get('req4') == 'view') {
         $this->setParam('aCallback', array('request' => 'req5', 'item' => $aGroup['group_id'], 'module' => 'group', 'host' => $aGroup['title'], 'url' => array('group', array($aGroup['title_url'])), 'url_home' => array('group', array($aGroup['title_url']))));
         return Phpfox_Module::instance()->setController('event.view');
     } elseif ($this->request()->get('req4') == 'add') {
         $this->url()->send('event.add', array('module' => 'group', 'item' => $aGroup['group_id']));
     }
     $this->setParam('aCallback', array('category_request' => 3, 'item' => $aGroup['group_id'], 'module' => 'group', 'url' => array('group', array($aGroup['title_url'], 'event', 'view')), 'url_home' => array('group', array($aGroup['title_url']))));
     return Phpfox_Module::instance()->setController('event.index');
 }
Пример #21
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     $aCheckParams = array('url' => $this->url()->makeUrl('friend'), 'start' => 3, 'reqs' => array('2' => array('accept', 'pending')));
     if (Phpfox::getParam('core.force_404_check') && !Phpfox::getService('core.redirect')->check404($aCheckParams)) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     $iPage = $this->request()->getInt('page');
     $iLimit = Phpfox::getParam('friend.total_requests_display');
     $iRequestId = $this->request()->getInt('id');
     list($iCnt, $aFriends) = Phpfox::getService('friend.request')->get($iPage, $iLimit, $iRequestId);
     Phpfox_Pager::instance()->set(array('page' => $iPage, 'size' => $iLimit, 'count' => $iCnt));
     Friend_Service_Friend::instance()->buildMenu();
     $this->setParam('global_moderation', array('name' => 'friend', 'ajax' => 'friend.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('friend.accept'), 'action' => 'accept'), array('phrase' => Phpfox::getPhrase('friend.deny'), 'action' => 'deny'))));
     $this->template()->setTitle(Phpfox::getPhrase('friend.friend_requests'))->setBreadcrumb(Phpfox::getPhrase('friend.friends'), $this->url()->makeUrl('friend'))->assign(array('aFriends' => $aFriends, 'iRequestId' => $iRequestId, 'bIsFriendController' => true));
 }
Пример #22
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;
 }
Пример #23
0
 /**
  * Controller
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     $aValidation = array('var_name' => Phpfox::getPhrase('admincp.add_a_title_for_the_group'), 'info' => Phpfox::getPhrase('admincp.add_information_regarding_group'));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_setting_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if ($sVarName = Phpfox::getService('admincp.setting.group.process')->add($aVals)) {
                 $this->url()->send('admincp.setting.group.add', null, Phpfox::getPhrase('admincp.added') . ': ' . $sVarName);
             }
         }
     }
     $this->template()->setBreadCrumb(Phpfox::getPhrase('admincp.add_setting_group'))->setTitle(Phpfox::getPhrase('admincp.add_setting_group'))->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'aModules' => Phpfox_Module::instance()->getModules()));
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_group_add_process')) ? eval($sPlugin) : false;
 }
Пример #24
0
    public function __construct($controller, $location, $callback)
    {
        $this->request = new Request();
        $this->url = new Url();
        $this->active = (new \Api\User())->get(\Phpfox::getUserId());
        $this->db = new Db();
        $html = call_user_func($callback, $this);
        if (empty($html)) {
            $html = '
			<div class="block">
				' . (isset($this->_arg['title']) ? '<div class="title">' . $this->_arg['title'] . '</div>' : '') . '
				<div class="content">
					' . (isset($this->_arg['content']) ? $this->_arg['content'] : '') . '
				</div>
			</div>
			';
        }
        \Phpfox_Module::instance()->block($controller, $location, $html);
    }
Пример #25
0
 /**
  * Controller
  * @todo Complete the update routine...
  */
 public function process()
 {
     if (Phpfox::getParam('core.phpfox_is_hosted')) {
         $this->url()->send('admincp');
     }
     Phpfox::getUserParam('core.can_add_new_setting', true);
     $bEdit = false;
     if ($iId = $this->request()->getInt('id')) {
         $aSetting = Phpfox::getService('admincp.setting')->getForEdit($iId);
         if (is_array($aSetting) && isset($aSetting['setting_id'])) {
             $bEdit = true;
             $this->url()->send('admincp.setting');
             $this->template()->assign(array('aForms' => $aSetting));
         }
     }
     $aValidation = array('var_name' => array('def' => 'required', 'title' => Phpfox::getPhrase('admincp.add_variable_name')), 'title' => array('def' => 'required', 'title' => Phpfox::getPhrase('admincp.add_title_for_setting')), 'info' => array('def' => 'required', 'title' => Phpfox::getPhrase('admincp.add_information_regarding_setting')));
     $oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_setting_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->getArray('val')) {
         if ($oValid->isValid($aVals)) {
             if ($bEdit) {
                 exit('Updating...');
             } else {
                 if ($sSetting = Phpfox::getService('admincp.setting')->isSetting($aVals['var_name'])) {
                     Phpfox_Error::set(Phpfox::getPhrase('admincp.already_in_use') . ': ' . $sSetting);
                 } else {
                     if ($sSetting = Phpfox::getService('admincp.setting.process')->add($aVals)) {
                         $this->url()->send('admincp', array('setting', 'add'), Phpfox::getPhrase('admincp.added') . ': ' . $sSetting);
                     }
                 }
             }
         }
     }
     $aGroups = Phpfox::getService('admincp.setting.group')->getGroups();
     foreach ($aGroups as $iKey => $aGroup) {
         if (!isset($aGroup['var_name'])) {
             unset($aGroups[$iKey]);
             continue;
         }
     }
     $this->template()->assign(array('aProducts' => Admincp_Service_Product_Product::instance()->get(), 'aGroups' => $aGroups, 'aModules' => Phpfox_Module::instance()->getModules(), 'sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(), 'bEdit' => $bEdit))->setBreadCrumb(Phpfox::getPhrase('admincp.add_setting'))->setTitle(Phpfox::getPhrase('admincp.add_setting'));
     ($sPlugin = Phpfox_Plugin::get('admincp.component_controller_setting_add_process')) ? eval($sPlugin) : false;
 }
Пример #26
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('photo.can_view_photos', true);
     $aGroup = $this->getParam('aGroup');
     if (!Phpfox::getService('group')->hasAccess($aGroup['group_id'], 'can_use_photo')) {
         return Phpfox_Error::display(Phpfox::getPhrase('photo.photo_section_is_closed'));
     }
     $this->setParam('aCallback', array('group_id' => $aGroup['group_id'], 'url_home' => 'group.' . $aGroup['title_url'] . '.photo', 'url_home_array' => array('group', array($aGroup['title_url'])), 'title' => $aGroup['title']));
     if ($this->request()->get('req4') == 'view') {
         return Phpfox_Module::instance()->setController('photo.view');
     } elseif ($this->request()->get('req4') == 'upload') {
         $this->url()->send('photo.upload', array('module' => 'group', 'item' => $aGroup['group_id']));
     }
     $this->template()->removeUrl('photo.index', 'photo.battle');
     $this->template()->removeUrl('photo.index', 'photo.rate');
     $this->template()->removeUrl('photo.index', 'profile.photo');
     $this->template()->removeUrl('photo.index', 'photo.public-album');
     $this->template()->rebuildMenu('photo.index', array('group', array($aGroup['title_url'])));
     return Phpfox_Module::instance()->setController('photo.index');
 }
Пример #27
0
 public function import($aVals, $bMissingOnly = false)
 {
     $iProductId = Admincp_Service_Product_Product::instance()->getId($aVals['product']);
     $aCache = array();
     if ($bMissingOnly) {
         $aRows = $this->database()->select('m_connection, component')->from($this->_sTable)->execute('getRows', array('free_result' => true));
         foreach ($aRows as $aRow) {
             $aCache[md5($aRow['m_connection'] . $aRow['component'])] = $aRow['component'];
         }
     }
     $aSql = array();
     $aVals = isset($aVals['block'][0]) ? $aVals['block'] : array($aVals['block']);
     foreach ($aVals as $aVal) {
         if ($bMissingOnly && isset($aCache[md5($aVal['m_connection'] . $aVal['component'])])) {
             continue;
         }
         $iModuleId = Phpfox_Module::instance()->getModuleId($aVal['module']);
         $aSql[] = array($aVal['type_id'], $aVal['m_connection'], $iModuleId, $iProductId, $aVal['component'], $aVal['location'], 1, $aVal['ordering']);
     }
     if ($aSql) {
         $this->database()->multiInsert($this->_sTable, array('type_id', 'm_connection', 'module_id', 'product_id', 'component', 'location', 'is_active', 'ordering'), $aSql);
     }
     return true;
 }
Пример #28
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()));
         }
     }
 }
Пример #29
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('event.can_access_event', true);
     $aParentModule = $this->getParam('aParentModule');
     if ($aParentModule === null && $this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('event.view');
     }
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if ($this->request()->get('req3') != '') {
             $sLegacyTitle = $this->request()->get('req3');
         }
         $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'event_category', 'redirect' => 'event.category', 'title' => $sLegacyTitle, 'search' => 'name_url'));
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true)) && $aEvent['module_id'] != 'event' && Phpfox::hasCallback($aEvent['module_id'], 'getEventRedirect')) {
         if ($sForward = Phpfox::callback($aEvent['module_id'] . '.getEventRedirect', $aEvent['event_id'])) {
             Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
             $this->url()->forward($sForward);
         }
     }
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if ($mDeleteReturn = Event_Service_Process::instance()->delete($iDeleteId)) {
             if (is_bool($mDeleteReturn)) {
                 $this->url()->send('event', null, Phpfox::getPhrase('event.event_successfully_deleted'));
             } else {
                 $this->url()->forward($mDeleteReturn, Phpfox::getPhrase('event.event_successfully_deleted'));
             }
         }
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true))) {
         Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
         $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']);
     }
     $bIsUserProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsUserProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $bIsUserProfile = true;
         $aUser = $this->getParam('aUser');
     }
     $oServiceEventBrowse = Phpfox::getService('event.browse');
     $sCategory = null;
     $sView = $this->request()->get('view', false);
     $aCallback = $this->getParam('aCallback', false);
     $this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'search' => array('action' => $aParentModule === null ? $bIsUserProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('event', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('event', array('view' => $this->request()->get('view'))) : $aParentModule['url'] . 'event/view_' . $this->request()->get('view') . '/', 'default_value' => Phpfox::getPhrase('event.search_events'), 'name' => 'search', 'field' => 'm.title'), 'sort' => array('latest' => array('m.start_time', Phpfox::getPhrase('event.latest'), 'ASC'), 'most-liked' => array('m.total_like', Phpfox::getPhrase('event.most_liked')), 'most-talked' => array('m.total_comment', Phpfox::getPhrase('event.most_discussed'))), 'show' => array(12, 15, 18, 21))));
     $aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
     switch ($sView) {
         case 'pending':
             if (Phpfox::getUserParam('event.can_approve_events')) {
                 $this->search()->setCondition('AND m.view_id = 1');
             }
             break;
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
             break;
         default:
             if ($bIsUserProfile) {
                 $this->search()->setCondition('AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.module_id = "event" AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
             } elseif ($aParentModule !== null) {
                 $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.module_id = \'' . Phpfox_Database::instance()->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . '');
             } else {
                 switch ($sView) {
                     case 'attending':
                         $oServiceEventBrowse->attending(1);
                         break;
                     case 'may-attend':
                         $oServiceEventBrowse->attending(2);
                         break;
                     case 'not-attending':
                         $oServiceEventBrowse->attending(3);
                         break;
                     case 'invites':
                         $oServiceEventBrowse->attending(0);
                         break;
                 }
                 if ($sView == 'attending') {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
                 } else {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.item_id = ' . ($aCallback !== false ? (int) $aCallback['item'] : 0) . '');
                 }
                 if ($this->request()->getInt('user') && ($aUserSearch = Phpfox::getService('user')->getUser($this->request()->getInt('user')))) {
                     $this->search()->setCondition('AND m.user_id = ' . (int) $aUserSearch['user_id']);
                     $this->template()->setBreadcrumb($aUserSearch['full_name'] . '\'s Events', $this->url()->makeUrl('event', array('user' => $aUserSearch['user_id'])), true);
                 }
             }
             break;
     }
     if ($this->request()->getInt('sponsor') == 1) {
         $this->search()->setCondition('AND m.is_sponsor != 1');
         Phpfox::addMessage(Phpfox::getPhrase('event.sponsor_help'));
     }
     if ($this->request()->get('req2') == 'category') {
         $sCategory = $this->request()->getInt('req3');
         $this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
     }
     if ($sView == 'featured') {
         $this->search()->setCondition('AND m.is_featured = 1');
     }
     $this->setParam('sCategory', $sCategory);
     $oServiceEventBrowse->callback($aCallback)->category($sCategory);
     $this->search()->browse()->params($aBrowseParams)->execute();
     $aFilterMenu = array();
     $bSetFilterMenu = !defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW');
     if ($sPlugin = Phpfox_Plugin::get('event.component_controller_index_set_filter_menu_1')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
     if ($bSetFilterMenu) {
         $aFilterMenu = array(Phpfox::getPhrase('event.all_events') => '', Phpfox::getPhrase('event.my_events') => 'my');
         if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community')) {
             $aFilterMenu[Phpfox::getPhrase('event.friends_events')] = 'friend';
         }
         list($iTotalFeatured, $aFeatured) = Event_Service_Event::instance()->getFeatured();
         if ($iTotalFeatured) {
             $aFilterMenu[Phpfox::getPhrase('event.featured_events') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
         }
         if (Phpfox::getUserParam('event.can_approve_events')) {
             $iPendingTotal = Event_Service_Event::instance()->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu[Phpfox::getPhrase('event.pending_events') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
         $aFilterMenu[] = true;
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_attending')] = 'attending';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_may_attend')] = 'may-attend';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_not_attending')] = 'not-attending';
         $aFilterMenu[Phpfox::getPhrase('event.event_invites')] = 'invites';
         $this->template()->buildSectionMenu('event', $aFilterMenu);
     }
     $this->template()->setTitle($bIsUserProfile ? Phpfox::getPhrase('event.full_name_s_events', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('event.events'))->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('event'))) : ($bIsUserProfile ? $this->url()->makeUrl($aUser['user_name'], 'event') : $this->url()->makeUrl('event')))->setHeader('cache', array('country.js' => 'module_core', 'browse.css' => 'module_event', 'feed.js' => 'module_feed'))->assign(array('aEvents' => $this->search()->browse()->getRows(), 'sView' => $sView, 'aCallback' => $aCallback, 'sParentLink' => $aCallback !== false ? $aCallback['url_home'][0] . '.' . implode('.', $aCallback['url_home'][1]) . '.event' : 'event', 'sApproveLink' => $this->url()->makeUrl('event', array('view' => 'pending'))));
     if ($sCategory !== null) {
         $aCategories = Phpfox::getService('event.category')->getParentBreadcrumb($sCategory);
         $iCnt = 0;
         foreach ($aCategories as $aCategory) {
             $iCnt++;
             $this->template()->setTitle($aCategory[0]);
             if ($aCallback !== false) {
                 $sHomeUrl = '/' . Phpfox_Url::instance()->doRewrite($aCallback['url_home'][0]) . '/' . implode('/', $aCallback['url_home'][1]) . '/' . Phpfox_Url::instance()->doRewrite('event') . '/';
                 $aCategory[1] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('event') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
             }
             $this->template()->setBreadcrumb($aCategory[0], $aCategory[1], empty($sView) ? true : false);
         }
     }
     if ($aCallback !== false) {
         $this->template()->rebuildMenu('event.index', $aCallback['url_home']);
     }
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     $this->setParam('global_moderation', array('name' => 'event', 'ajax' => 'event.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('event.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('event.approve'), 'action' => 'approve'))));
 }
Пример #30
0
 /**
  * Controller
  */
 public function process()
 {
     $aUser = Phpfox::getService('user')->get($this->request()->get('req1'), false);
     if (!isset($aUser['user_id'])) {
         return Phpfox_Module::instance()->setController('error.404');
     }
     define('PHPFOX_IS_USER_PROFILE', true);
     $sImage = Phpfox::getLib('image.helper')->display(array_merge(array('user' => Phpfox::getService('user')->getUserFields(true, $aUser)), array('title' => $aUser['full_name'], 'path' => 'core.url_user', 'file' => $aUser['user_image'], 'suffix' => '_120', 'max_width' => 120, 'max_height' => 120, 'no_default' => Phpfox::getUserId() == $aUser['user_id'] ? false : true, 'no_link' => true)));
     $oUser = Phpfox::getService('user');
     $aUser['gender_name'] = $oUser->gender($aUser['gender']);
     $aUser['birthday_time_stamp'] = $aUser['birthday'];
     $aUser['birthday'] = $oUser->age($aUser['birthday']);
     $aUser['location'] = Phpfox::getPhraseT(Phpfox::getService('core.country')->getCountry($aUser['country_iso']), 'country');
     if (isset($aUser['country_child_id']) && $aUser['country_child_id'] > 0) {
         $aUser['location_child'] = Phpfox::getService('core.country')->getChild($aUser['country_child_id']);
     }
     $this->setParam('aUser', $aUser);
     $this->template()->setMobileHeader(array('profile.css' => 'style_css'));
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.view_profile')) {
         return Phpfox_Module::instance()->setController('profile.private');
     }
     Phpfox::getUserParam('profile.can_view_users_profile', true);
     $aProfileMenu = array($this->url()->makeUrl($aUser['user_name']) => Phpfox::getPhrase('profile.wall'));
     if (Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'profile.basic_info')) {
         $aProfileMenu[$this->url()->makeUrl($aUser['user_name'], 'info')] = Phpfox::getPhrase('profile.info');
     }
     $this->template()->assign(array('aUser' => $aUser, 'sProfileImage' => $sImage, 'bMobileProfileIsActive' => true, 'aMobileSubMenus' => $aProfileMenu, 'sActiveMobileSubMenu' => $this->url()->makeUrl($aUser['user_name'], $this->request()->get('req2') == '' ? null : $this->request()->get('req2'))));
     if ($this->request()->get('req2') == 'info') {
         return Phpfox_Module::instance()->setController('profile.info-mobile');
     }
     if ($aVals = $this->request()->getArray('val')) {
         Phpfox::isUser(true);
         if (isset($aVals['status'])) {
             if (!empty($aVals['status'])) {
                 if ($iId = Phpfox::getService('user.process')->updateStatus(Phpfox::getUserId(), $aVals['status'])) {
                     $this->url()->send($aUser['user_name']);
                 }
             }
         } else {
             Phpfox::getUserParam('comment.can_post_comments', true);
             if (!Phpfox::getService('user.privacy')->hasAccess($aVals['item_id'], 'comment.add_comment')) {
                 Phpfox_Error::set(Phpfox::getPhrase('feed.you_do_not_have_permission_to_add_a_comment_on_this_persons_profile'));
             }
             if (($iFlood = Phpfox::getUserParam('comment.comment_post_flood_control')) !== 0) {
                 $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('feed'), 'condition' => 'type_id = \'comment_profile_my\' AND user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
                 // actually check if flooding
                 if (Phpfox::getLib('spam')->check($aFlood)) {
                     Phpfox_Error::set(Phpfox::getPhrase('feed.posting_a_comment_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime());
                 }
             }
             if (Phpfox::getLib('parse.format')->isEmpty($aVals['feed_text'])) {
                 Phpfox_Error::set(Phpfox::getPhrase('feed.add_some_text_to_your_comment'));
             }
             if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('feed.process')->addComment($aVals))) {
                 $this->url()->send($aUser['user_name']);
             }
         }
     }
     $bHideFeedOnProfile = false;
     if (Phpfox::isModule('feed')) {
         $iFeedPage = $this->request()->get('page', 1);
         list($iFeedCount, $aFeeds) = Feed_Service_Feed::instance()->get($aUser['user_id'], null, $iFeedPage);
         if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'feed.display_on_profile')) {
             $iFeedCount = 0;
             $aFeeds = array();
             $bHideFeedOnProfile = true;
         }
         $iTotalFeeds = (int) Phpfox::getComponentSetting(Phpfox::getUserId(), 'feed.feed_display_limit_dashboard', Phpfox::getParam('feed.feed_display_limit'));
         Phpfox_Pager::instance()->set(array('page' => $iFeedPage, 'size' => $iTotalFeeds, 'count' => $iFeedCount));
         $this->template()->setMobileHeader(array('feed.css' => 'module_feed'))->assign(array('aFeeds' => $aFeeds));
     }
     $this->template()->assign(array('bHideFeedOnProfile' => $bHideFeedOnProfile));
 }