本文整理汇总了PHP中PageUtil::setVar方法的典型用法代码示例。如果您正苦于以下问题:PHP PageUtil::setVar方法的具体用法?PHP PageUtil::setVar怎么用?PHP PageUtil::setVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageUtil
的用法示例。
在下文中一共展示了PageUtil::setVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false), 'includeContent' => false));
if ($page === false) {
throw new Zikula_Exception_Fatal($this->__('Page not found'));
}
// Only allow subpages if edit access on parent page
if (!SecurityUtil::checkPermission('Content:page:', $page['id'] . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
PageUtil::setVar('title', $this->__('Clone page') . ' : ' . $page['title']);
$this->view->assign('page', $page);
Content_Util::contentAddAccess($this->view, $this->pageId);
return true;
}
示例2: pageSetVar
public function pageSetVar($name, $value = null)
{
if (in_array($name, array('stylesheet', 'javascript'))) {
$value = explode(',', $value);
}
\PageUtil::setVar($name, $value);
}
示例3: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
$offset = (int) FormUtil::getPassedValue('offset');
if ((bool) $this->getVar('inheritPermissions', false) === true) {
if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
} else {
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => false, 'filter' => array('checkActive' => false), 'enableEscape' => true, 'translate' => false, 'includeContent' => false, 'includeCategories' => false));
if ($page === false) {
return $this->view->registerError(null);
}
$versionscnt = ModUtil::apiFunc('Content', 'History', 'getPageVersionsCount', array('pageId' => $this->pageId));
$versions = ModUtil::apiFunc('Content', 'History', 'getPageVersions', array('pageId' => $this->pageId, 'offset' => $offset));
if ($versions === false) {
return $this->view->registerError(null);
}
$this->view->assign('page', $page);
$this->view->assign('versions', $versions);
Content_Util::contentAddAccess($this->view, $this->pageId);
// Assign the values for the smarty plugin to produce a pager
$this->view->assign('numitems', $versionscnt);
PageUtil::setVar('title', $this->__("Page history") . ' : ' . $page['title']);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
return true;
}
示例4: initialize
public function initialize(Zikula_Form_View $view)
{
$this->contentId = (int) FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : -1);
$this->language = ZLanguage::getLanguageCode();
$content = ModUtil::apiFunc('Content', 'Content', 'getContent', array('id' => $this->contentId, 'language' => $this->language, 'translate' => false));
if ($content === false) {
return $this->view->registerError(null);
}
$this->contentType = ModUtil::apiFunc('Content', 'Content', 'getContentType', $content);
if ($this->contentType === false) {
return $this->view->registerError(null);
}
$this->pageId = $content['pageId'];
if ((bool) $this->getVar('inheritPermissions', false) === true) {
if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
} else {
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false)));
if ($page === false) {
return $this->view->registerError(null);
}
if ($this->language == $page['language']) {
return $this->view->registerError(LogUtil::registerError($this->__f('Sorry, you cannot translate an item to the same language as it\'s default language ("%1$s"). Change the current site language ("%2$s") to some other language on the <a href="%3$s">localisation settings</a> page.<br /> Another way is to add, for instance, <strong>&lang=de</strong> to the url for changing the current site language to German and after that the item can be translated to German.', array($page['language'], $this->language, ModUtil::url('Settings', 'admin', 'multilingual')))));
}
$translationInfo = ModUtil::apiFunc('Content', 'Content', 'getTranslationInfo', array('contentId' => $this->contentId));
if ($translationInfo === false) {
return $this->view->registerError(null);
}
PageUtil::setVar('title', $this->__("Translate content item") . ' : ' . $page['title']);
$templates = $this->contentType['plugin']->getTranslationTemplates();
$this->view->assign('translationtemplates', $templates);
$this->view->assign('page', $page);
$this->view->assign('data', $content['data']);
$this->view->assign('isTranslatable', $content['isTranslatable']);
$this->view->assign('translated', isset($content['translated']) ? $content['translated'] : array());
$this->view->assign('translationInfo', $translationInfo);
$this->view->assign('translationStep', $this->contentId);
$this->view->assign('language', $this->language);
$this->view->assign('contentType', $this->contentType);
Content_Util::contentAddAccess($this->view, $this->pageId);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
if ($this->backref != null) {
$returnUrl = $this->backref;
} else {
$returnUrl = ModUtil::url('Content', 'admin', 'editpage', array('pid' => $this->pageId));
}
ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentTranslateContent{$this->contentId}", 'returnUrl' => $returnUrl));
return true;
}
示例5: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = (int) FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : -1);
if ((bool) $this->getVar('inheritPermissions', false) === true) {
if (!ModUtil::apiFunc('Content', 'page', 'checkPermissionForPageInheritance', array('pageId' => $this->pageId, 'level' => ACCESS_EDIT))) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
} else {
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'editing' => true, 'filter' => array('checkActive' => false), 'enableEscape' => false, 'translate' => false, 'includeContent' => true, 'includeCategories' => true));
if ($page === false) {
return $this->view->registerError(null);
}
// load the category registry util
$mainCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropPrimary'), 30);
$secondCategory = CategoryRegistryUtil::getRegisteredModuleCategory('Content', 'content_page', $this->getVar('categoryPropSecondary'));
$multilingual = ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual');
if ($page['language'] == ZLanguage::getLanguageCode()) {
$multilingual = false;
}
PageUtil::setVar('title', $this->__("Edit page") . ' : ' . $page['title']);
$pagelayout = ModUtil::apiFunc('Content', 'Layout', 'getLayout', array('layout' => $page['layout']));
if ($pagelayout === false) {
return $this->view->registerError(null);
}
$layouts = ModUtil::apiFunc('Content', 'Layout', 'getLayouts');
if ($layouts === false) {
return $this->view->registerError(null);
}
$layoutTemplate = $page['layoutEditTemplate'];
$this->view->assign('layoutTemplate', $layoutTemplate);
$this->view->assign('mainCategory', $mainCategory);
$this->view->assign('secondCategory', $secondCategory);
$this->view->assign('page', $page);
$this->view->assign('multilingual', $multilingual);
$this->view->assign('layouts', $layouts);
$this->view->assign('pagelayout', $pagelayout);
$this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
$this->view->assign('categoryUsage', $this->getVar('categoryUsage'));
Content_Util::contentAddAccess($this->view, $this->pageId);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back', 0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
if ($this->backref != null) {
$returnUrl = $this->backref;
} else {
$returnUrl = ModUtil::url('Content', 'admin', 'main');
}
ModUtil::apiFunc('PageLock', 'user', 'pageLock', array('lockName' => "contentPage{$this->pageId}", 'returnUrl' => $returnUrl));
return true;
}
示例6: initialize
public function initialize(Zikula_Form_View $view)
{
$offset = (int) FormUtil::getPassedValue('offset');
$versionscnt = ModUtil::apiFunc('Content', 'History', 'getDeletedPagesCount');
$versions = ModUtil::apiFunc('Content', 'History', 'getDeletedPages', array('offset' => $offset));
if ($versions === false) {
return $this->view->registerError(null);
}
// Assign the values for the smarty plugin to produce a pager
$this->view->assign('numitems', $versionscnt);
foreach ($versions as &$version) {
$version['data'] = unserialize($version['data']);
}
$this->view->assign('versions', $versions);
PageUtil::setVar('title', $this->__("Restore deleted pages"));
return true;
}
示例7: smarty_function_pagesetvar
/**
* Zikula_View function to set page variable
*
* This function obtains a page-specific variable from the Zikula system.
*
* Available parameters:
* - name: The name of the page variable to set
* - value: The value of the page variable to set
*
* Zikula doesn't impose any restriction on the page variable's name except for duplicate
* and reserved names. As of this writing, the list of reserved names consists of
* <ul>
* <li>title</li>
* <li>stylesheet</li>
* <li>javascript</li>
* <li>body</li>
* <li>header</li>
* <li>footer</li>
* </ul>
*
* In addition, if your system is operating in legacy compatibility mode, then
* the variable 'rawtext' is reserved, and maps to 'header'. (When not operating in
* legacy compatibility mode, 'rawtext' is not reserved and will not be rendered
* to the page output by the page variable output filter.)
*
* Example
* {pagesetvar name="title" value="mytitle"}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string
*/
function smarty_function_pagesetvar($params, Zikula_View $view)
{
$name = isset($params['name']) ? $params['name'] : null;
$value = isset($params['value']) ? $params['value'] : null;
if (!$name) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pagesetvar', 'name')));
return false;
}
if (!$value) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pagesetvar', 'value')));
return false;
}
if (in_array($name, array('stylesheet', 'javascript'))) {
$value = explode(',', $value);
}
PageUtil::setVar($name, $value);
}
示例8: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = (int) FormUtil::getPassedValue('pid', -1);
$this->language = ZLanguage::getLanguageCode();
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false), 'translate' => false));
if ($page === false) {
return $this->view->registerError(null);
}
// if trying to translate a page into the same language report error and redirect to page list
if (!strcmp($this->language, $page['language'])) {
return $this->view->registerError(LogUtil::registerError(
$this->__f('Sorry, you cannot translate an item to the same language as it\'s default language ("%1$s"). Change the current site language ("%2$s") to some other language on the <a href="%3$s">localisation settings</a> page.<br /> Another way is to add, for instance, <strong>&lang=de</strong> to the url for changing the current site language to German and after that the item can be translated to German.', array($page['language'], $this->language, ModUtil::url('Settings', 'admin', 'multilingual'))),
null,
ModUtil::url('Content', 'admin', 'main')));
}
PageUtil::setVar('title', $this->__("Translate page") . ' : ' . $page['title']);
$this->view->assign('page', $page);
$this->view->assign('translated', $page['translated']);
$this->view->assign('language', $this->language);
Content_Util::contentAddAccess($this->view, $this->pageId);
if (!$this->view->isPostBack() && FormUtil::getPassedValue('back',0)) {
$this->backref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
}
if ($this->backref != null) {
$returnUrl = $this->backref;
} else {
$returnUrl = ModUtil::url('Content', 'admin', 'editPage', array('pid' => $this->pageId));
}
ModUtil::apiFunc('PageLock', 'user', 'pageLock',
array('lockName' => "contentTranslatePage{$this->pageId}",
'returnUrl' => $returnUrl));
return true;
}
示例9: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
$this->location = FormUtil::getPassedValue('loc', isset($this->args['loc']) ? $this->args['loc'] : null);
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_ADD)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
// Only allow subpages if edit access on parent page
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
if ($this->pageId != null) {
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'includeContent' => false, 'filter' => array('checkActive' => false)));
if ($page === false) {
return $this->view->registerError(null);
}
} else {
$page = null;
}
$layouts = ModUtil::apiFunc('Content', 'Layout', 'getLayouts');
if ($layouts === false) {
return $this->view->registerError(null);
}
PageUtil::setVar('title', $this->__('Add new page'));
$this->view->assign('layouts', $layouts);
$this->view->assign('page', $page);
$this->view->assign('location', $this->location);
if ($this->location == 'sub') {
$this->view->assign('locationLabel', $this->__('Located below:'));
} else {
$this->view->assign('locationLabel', $this->__('Located after:'));
}
Content_Util::contentAddAccess($this->view, $this->pageId);
return true;
}
示例10: initialize
public function initialize(Zikula_Form_View $view)
{
$this->pageId = FormUtil::getPassedValue('pid', isset($this->args['pid']) ? $this->args['pid'] : null);
$this->contentAreaIndex = FormUtil::getPassedValue('cai', isset($this->args['cai']) ? $this->args['cai'] : null);
$this->position = FormUtil::getPassedValue('pos', isset($this->args['pos']) ? $this->args['pos'] : 0);
$this->contentId = FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : null);
$this->above = FormUtil::getPassedValue('above', isset($this->args['above']) ? $this->args['above'] : 0);
if ($this->contentId != null) {
$content = ModUtil::apiFunc('Content', 'Content', 'getContent', array('id' => $this->contentId));
if ($content === false) {
return $this->view->registerError(null);
}
$this->pageId = $content['pageId'];
$this->contentAreaIndex = $content['areaIndex'];
$this->position = ($this->above ? $content['position'] : $content['position'] + 1);
}
if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
if ($this->pageId == null) {
return $this->view->setErrorMsg($this->__("Missing page ID (pid) in URL"));
}
if ($this->contentAreaIndex == null) {
return $this->view->setErrorMsg($this->__("Missing content area index (cai) in URL"));
}
$page = ModUtil::apiFunc('Content', 'Page', 'getPage', array('id' => $this->pageId, 'filter' => array('checkActive' => false)));
if ($page === false) {
return $this->view->registerError(null);
}
PageUtil::setVar('title', $this->__("Add new content to page") . ' : ' . $page['title']);
$this->view->assign('page', $page);
$this->view->assign('htmlBody', 'admin/newcontent.tpl');
Content_Util::contentAddAccess($this->view, $this->pageId);
return true;
}
示例11: smarty_function_pagesetvar
/**
* Zikula_View function to set page variable
*
* This function obtains a page-specific variable from the Zikula system.
*
* Available parameters:
* - name: The name of the page variable to set
* - value: The value of the page variable to set
*
* Zikula doesn't impose any restriction on the page variable's name except for duplicate
* and reserved names. As of this writing, the list of reserved names consists of
* <ul>
* <li>title</li>
* <li>stylesheet</li>
* <li>javascript</li>
* <li>body</li>
* <li>header</li>
* <li>footer</li>
* </ul>
*
* In addition, if your system is operating in legacy compatibility mode, then
* the variable 'rawtext' is reserved, and maps to 'header'. (When not operating in
* legacy compatibility mode, 'rawtext' is not reserved and will not be rendered
* to the page output by the page variable output filter.)
*
* Example
* {pagesetvar name="title" value="mytitle"}
*
* @param array $params All attributes passed to this function from the template.
* @param Zikula_View $view Reference to the Zikula_View object.
*
* @return string
*/
function smarty_function_pagesetvar($params, Zikula_View $view)
{
$name = isset($params['name']) ? $params['name'] : null;
$value = isset($params['value']) ? $params['value'] : null;
if (!$name) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pagesetvar', 'name')));
return false;
}
if (!$value) {
$view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('pagesetvar', 'value')));
return false;
}
// handle Clip which is manually loading a Theme's stylesheets
if ($name == 'stylesheet' && false !== strpos($value, 'system/Theme/style/')) {
$value = str_replace('system/Theme/style/', 'system/ThemeModule/Resources/public/css/', $value);
}
if (in_array($name, array('stylesheet', 'javascript'))) {
$value = explode(',', $value);
}
PageUtil::setVar($name, $value);
}
示例12: initialize
public function initialize(Zikula_Form_View $view)
{
if (!SecurityUtil::checkPermission('Content:page:', '::', ACCESS_EDIT)) {
throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission());
}
// Include categories only when 2nd category enabled in settings
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', array('editing' => true, 'filter' => array('checkActive' => false, 'expandedPageIds' => SessionUtil::getVar('contentExpandedPageIds', array())), 'enableEscape' => true, 'translate' => false, 'includeLanguages' => true, 'includeCategories' => $this->getVar('categoryUsage') < 3, 'orderBy' => 'setLeft'));
if ($pages === false) {
return $this->view->registerError(null);
}
// Get categories names if enabled
if ($this->getVar('$categoryUsage') < 4) {
$lang = ZLanguage::getLanguageCode();
$categories = array();
foreach ($pages as $page) {
$cat = CategoryUtil::getCategoryByID($page['categoryId']);
$categories[$page['id']] = array();
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
if (isset($page['categories']) && is_array($page['categories'])) {
foreach ($page['categories'] as $pageCat) {
$cat = CategoryUtil::getCategoryByID($pageCat['categoryId']);
$categories[$page['id']][] = isset($cat['display_name'][$lang]) ? $cat['display_name'][$lang] : $cat['name'];
}
}
}
$this->view->assign('categories', $categories);
}
PageUtil::setVar('title', $this->__('Page list and content structure'));
$csssrc = ThemeUtil::getModuleStylesheet('admin', 'admin.css');
PageUtil::addVar('stylesheet', $csssrc);
$this->view->assign('pages', $pages);
$this->view->assign('multilingual', ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual'));
$this->view->assign('enableVersioning', $this->getVar('enableVersioning'));
$this->view->assign('language', ZLanguage::getLanguageCode());
Content_Util::contentAddAccess($this->view, null);
return true;
}
示例13: init
//.........这里部分代码省略.........
// Check that Zikula is installed before continuing
if (System::getVar('installed') == 0 && !System::isInstalling()) {
System::redirect(System::getBaseUrl() . 'install.php?notinstalled');
System::shutDown();
}
if ($stage & self::STAGE_DB) {
try {
$dbEvent = new Zikula_Event('core.init', $this, array('stage' => self::STAGE_DB));
$this->eventManager->notify($dbEvent);
} catch (PDOException $e) {
if (!System::isInstalling()) {
header('HTTP/1.1 503 Service Unavailable');
require_once System::getSystemErrorTemplate('dbconnectionerror.tpl');
System::shutDown();
} else {
return false;
}
}
}
if ($stage & self::STAGE_TABLES) {
// Initialise dbtables
ModUtil::dbInfoLoad('Extensions', 'Extensions');
ModUtil::initCoreVars();
ModUtil::dbInfoLoad('Settings', 'Settings');
ModUtil::dbInfoLoad('Theme', 'Theme');
ModUtil::dbInfoLoad('Users', 'Users');
ModUtil::dbInfoLoad('Groups', 'Groups');
ModUtil::dbInfoLoad('Permissions', 'Permissions');
ModUtil::dbInfoLoad('Categories', 'Categories');
if (!System::isInstalling()) {
ModUtil::registerAutoloaders();
}
$coreInitEvent->setArg('stage', self::STAGE_TABLES);
$this->eventManager->notify($coreInitEvent);
}
if ($stage & self::STAGE_SESSIONS) {
SessionUtil::requireSession();
$coreInitEvent->setArg('stage', self::STAGE_SESSIONS);
$this->eventManager->notify($coreInitEvent);
}
// Have to load in this order specifically since we cant setup the languages until we've decoded the URL if required (drak)
// start block
if ($stage & self::STAGE_LANGS) {
$lang = ZLanguage::getInstance();
}
if ($stage & self::STAGE_DECODEURLS) {
System::queryStringDecode();
$coreInitEvent->setArg('stage', self::STAGE_DECODEURLS);
$this->eventManager->notify($coreInitEvent);
}
if ($stage & self::STAGE_LANGS) {
$lang->setup();
$coreInitEvent->setArg('stage', self::STAGE_LANGS);
$this->eventManager->notify($coreInitEvent);
}
// end block
if ($stage & self::STAGE_MODS) {
// Set compression on if desired
if (System::getVar('UseCompression') == 1) {
//ob_start("ob_gzhandler");
}
ModUtil::load('SecurityCenter');
$coreInitEvent->setArg('stage', self::STAGE_MODS);
$this->eventManager->notify($coreInitEvent);
}
if ($stage & self::STAGE_THEME) {
// register default page vars
PageUtil::registerVar('title');
PageUtil::setVar('title', System::getVar('defaultpagetitle'));
PageUtil::registerVar('keywords', true);
PageUtil::registerVar('stylesheet', true);
PageUtil::registerVar('javascript', true);
PageUtil::registerVar('jsgettext', true);
PageUtil::registerVar('body', true);
PageUtil::registerVar('header', true);
PageUtil::registerVar('footer', true);
$theme = Zikula_View_Theme::getInstance();
// set some defaults
// Metadata for SEO
$this->serviceManager['zikula_view.metatags']['description'] = System::getVar('defaultmetadescription');
$this->serviceManager['zikula_view.metatags']['keywords'] = System::getVar('metakeywords');
$coreInitEvent->setArg('stage', self::STAGE_THEME);
$this->eventManager->notify($coreInitEvent);
}
// check the users status, if not 1 then log him out
if (UserUtil::isLoggedIn()) {
$userstatus = UserUtil::getVar('activated');
if ($userstatus != Users_Constant::ACTIVATED_ACTIVE) {
UserUtil::logout();
// TODO - When getting logged out this way, the existing session is destroyed and
// then a new one is created on the reentry into index.php. The message
// set by the registerStatus call below gets lost.
LogUtil::registerStatus(__('You have been logged out.'));
System::redirect(ModUtil::url('Users', 'user', 'login'));
}
}
if ($stage & self::STAGE_POST && $this->stage & ~self::STAGE_POST) {
$this->eventManager->notify(new Zikula_Event('core.postinit', $this, array('stages' => $stage)));
}
}
示例14: sitemap
/**
* View sitemap
*
* @return Renderer
*/
public function sitemap($args)
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:page:', '::', ACCESS_READ), LogUtil::getErrorMsgPermission());
$pages = ModUtil::apiFunc('Content', 'Page', 'getPages', array('orderBy' => 'setLeft', 'makeTree' => true, 'filter' => array('checkInMenu' => true)));
if ($pages === false) {
return false;
}
if ($this->getVar('overrideTitle')) {
PageUtil::setVar('title', $this->__('Sitemap'));
}
$this->view->assign('pages', $pages);
Content_Util::contentAddAccess($this->view, null);
$tpl = FormUtil::getPassedValue('tpl', '', 'GET');
if ($tpl == 'xml') {
$this->view->display('user/sitemap.xml');
return true;
}
// Register a page variable breadcrumbs with the Content page hierarchy as array of array(url, title)
if ((bool) $this->getVar('registerBreadcrumbs', false) === true) {
// first include self, then loop over parents until root is reached
$modInfo = $this->getModInfo();
$breadcrumbs[] = array('url' => ModUtil::url('Content', 'user', 'sitemap'), 'title' => $modInfo['displayname'] . ' ' . $this->__('Sitemap'));
PageUtil::registerVar('breadcrumbs', false, $breadcrumbs);
}
return $this->view->fetch('user/sitemap.tpl');
}
示例15: display
//.........这里部分代码省略.........
'monthname' => $monthname,
'monthnum' => $monthnum,
'day' => $day));
$sid = $item['sid'];
System::queryStringSetVar('sid', $sid);
}
}
if ($item === false) {
return LogUtil::registerError($this->__('Error! No such article found.'), 404);
}
// For caching reasons you must pass a cache ID
$accesslevel = ACCESS_READ;
if (SecurityUtil::checkPermission('News::', "::", ACCESS_COMMENT)) $accesslevel = ACCESS_COMMENT;
if (SecurityUtil::checkPermission('News::', "::", ACCESS_EDIT)) $accesslevel = ACCESS_EDIT;
$pagedir = ($page>1) ? '|pg'. $page : '';
$this->view->setCacheId($sid .'|a'. $accesslevel . $pagedir);
// Explode the story into an array of seperate pages
$allpages = explode('<!--pagebreak-->', $item['bodytext']);
// Set the item bodytext to be the required page
// nb arrays start from zero, pages from one
$item['bodytext'] = $allpages[$page - 1];
$numpages = count($allpages);
unset($allpages);
// If the pagecount is greater than 1 and we're not on the frontpage
// don't show the hometext
if ($numpages > 1 && $page > 1) {
$item['hometext'] = '';
}
// $info is array holding raw information.
// Used below and also passed to the theme - jgm
$info = ModUtil::apiFunc('News', 'user', 'getArticleInfo', $item);
// $links is an array holding pure URLs to specific functions for this article.
// Used below and also passed to the theme - jgm
$links = ModUtil::apiFunc('News', 'user', 'getArticleLinks', $info);
// $preformat is an array holding chunks of preformatted text for this article.
// Used below and also passed to the theme - jgm
$preformat = ModUtil::apiFunc('News', 'user', 'getArticlePreformat', array('info' => $info,
'links' => $links));
// set the page title
if ($numpages <= 1) {
PageUtil::setVar('title', $info['title']);
} else {
PageUtil::setVar('title', $info['title'] . ' :: ' . $this->__f('page %s', $page));
}
// Assign the story info arrays
$this->view->assign(array('info' => $info,
'links' => $links,
'preformat' => $preformat,
'page' => $page));
$modvars = $this->getVars();
$this->view->assign('lang', ZLanguage::getLanguageCode());
$this->view->assign('catimagepath', $this->getVar('catimagepath'));
// get more articletitles in the categories of this article
if ($modvars['enablecategorization'] && $modvars['enablemorearticlesincat']) {
// check how many articles to display
if ($modvars['morearticlesincat'] > 0 && !empty($info['categories'])) {
$morearticlesincat = $modvars['morearticlesincat'];
} elseif ($modvars['morearticlesincat'] == 0 && is_array($info['attributes']) && array_key_exists('morearticlesincat', $info['attributes'])) {
$morearticlesincat = $info['attributes']['morearticlesincat'];
} else {
$morearticlesincat = 0;
}
if ($morearticlesincat > 0) {
// get the categories registered for News
$catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'news');
foreach (array_keys($catregistry) as $property) {
$catFilter[$property] = $info['categories'][$property]['id'];
}
// get matching news articles
$morearticlesincat = ModUtil::apiFunc('News', 'user', 'getall', array('numitems' => $morearticlesincat,
'status' => 0,
'filterbydate' => true,
'category' => $catFilter,
'catregistry' => $catregistry,
'query' => array(array('sid', '!=', $sid))));
}
} else {
$morearticlesincat = 0;
}
$this->view->assign('morearticlesincat', $morearticlesincat);
// Now lets assign the informatation to create a pager for the review
$this->view->assign('pager', array('numitems' => $numpages,
'itemsperpage' => 1));
// Return the output that has been generated by this function
return $this->view->fetch('user/article.tpl');
}