本文整理汇总了PHP中Phpfox_Module::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Module::instance方法的具体用法?PHP Phpfox_Module::instance怎么用?PHP Phpfox_Module::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox_Module
的用法示例。
在下文中一共展示了Phpfox_Module::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* 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 = [];
//.........这里部分代码省略.........
示例2: process
/**
* 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: process
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: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.force_404_check')) {
return Phpfox_Module::instance()->setController('error.404');
}
$this->url()->send('user.browse');
}
示例5: import
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: process
/**
* 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: process
/**
* 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: process
/**
* 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: _loadBlocks
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: process
/**
* 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: process
/**
* 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: process
/**
* 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: process
/**
* 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: process
/**
* 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: process
/**
* 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';
}
}