/** * This method is the default function handling the main area called without defining arguments. * * * @return mixed Output. */ public function main() { // parameter specifying which type of objects we are treating $objectType = $this->request->query->filter('ot', 'collection', FILTER_SANITIZE_STRING); $permLevel = ACCESS_OVERVIEW; $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . '::', '::', $permLevel), LogUtil::getErrorMsgPermission()); }
/** * Ensure we are in an interactive session. * * @return void */ public function preDispatch() { $this->throwForbiddenUnless(\SecurityUtil::checkPermission($this->getName() . '::', '::', \ACCESS_ADMIN), \LogUtil::getErrorMsgPermission()); $session = $this->request->getSession(); $check = (bool) ($session->get('interactive_init') || $session->get('interactive_upgrade') || $session->get('interactive_remove')); $this->throwForbiddenUnless($check, $this->__('This doesnt appear to be an interactive session.')); }
/** * display items for a day * * @param $args array Arguments array. * * @return string html string */ public function display($args) { $eid = FormUtil::getPassedValue('eid', isset($args['eid']) ? $args['eid'] : null, 'REQUEST'); $objectid = FormUtil::getPassedValue('objectid', isset($args['objectid']) ? $args['objectid'] : null, 'REQUEST'); if (!empty($objectid)) { $eid = $objectid; } if (!isset($args['eid']) and !empty($eid)) { $args['eid'] = $eid; } // Chek permissions $this->throwForbiddenUnless(SecurityUtil::checkPermission('Ephemerides::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); // check if the contents are cached. $template = 'ephemerides_user_display.tpl'; if ($this->view->is_cached($template)) { return $this->view->fetch($template); } // get items if (isset($args['eid']) and $args['eid'] > 0) { $items = ModUtil::apiFunc($this->name, 'user', 'getall', $args); } else { $items = ModUtil::apiFunc($this->name, 'user', 'gettoday', $args); } $this->view->assign('items', $items); return $this->view->fetch($template); }
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; }
public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Content::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } $catoptions = array( array('text' => $this->__('Use 2 category levels (1st level single, 2nd level multi selection)'), 'value' => '1'), array('text' => $this->__('Use 2 category levels (both single selection)'), 'value' => '2'), array('text' => $this->__('Use 1 category level'), 'value' => '3'), array('text' => $this->__("Don't use Categories at all"), 'value' => '4') ); $this->view->assign('catoptions', $catoptions); $this->view->assign('categoryusage', 1); $activeoptions = array( array('text' => $this->__('New pages will be active and available in the menu'), 'value' => '1'), array('text' => $this->__('New pages will be inactive and available in the menu'), 'value' => '2'), array('text' => $this->__('New pages will be active and not available in the menu'), 'value' => '3'), array('text' => $this->__('New pages will be inactive and not available in the menu'), 'value' => '4') ); $this->view->assign('activeoptions', $activeoptions); $pageinfolocationoptions = array( array('text' => $this->__('Top of the page, left of the page title'), 'value' => 'top'), array('text' => $this->__('Bottom of the page'), 'value' => 'bottom') ); $this->view->assign('pageinfolocationoptions', $pageinfolocationoptions); // Assign all module vars $this->view->assign('config', ModUtil::getVar('Content')); return true; }
public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } // assign the module mail agent types $view->assign('mailertypeItems', array( array('value' => 1, 'text' => DataUtil::formatForDisplay($this->__("Internal PHP `mail()` function"))), array('value' => 2, 'text' => DataUtil::formatForDisplay($this->__('Sendmail message transfer agent'))), array('value' => 3, 'text' => DataUtil::formatForDisplay($this->__('QMail message transfer agent'))), array('value' => 4, 'text' => DataUtil::formatForDisplay($this->__('SMTP mail transfer protocol'))), array('value' => 5, 'text' => DataUtil::formatForDisplay($this->__('Development/debug mode (Redirect e-mails to LogUtil)'))) )); $view->assign('encodingItems', array( array('value' => '8bit', 'text' => '8bit'), array('value' => '7bit', 'text' => '7bit'), array('value' => 'binary', 'text' => 'binary'), array('value' => 'base64', 'text' => 'base64'), array('value' => 'quoted-printable', 'text' => 'quoted-printable') )); $view->assign('smtpsecuremethodItems', array( array('value' => '', 'text' => 'None'), array('value' => 'ssl', 'text' => 'SSL'), array('value' => 'tls', 'text' => 'TLS') )); // assign all module vars $this->view->assign($this->getVars()); return true; }
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; }
public function display($blockinfo) { // security check $this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:menublock:', "{$blockinfo['title']}::", ACCESS_READ), LogUtil::getErrorMsgPermission()); // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); // --- Setting of the Defaults if (!isset($vars['usecaching'])) { $vars['usecaching'] = false; } if (!isset($vars['root'])) { $vars['root'] = 0; } $this->view->setCacheId($blockinfo['bid']); $this->view->setCaching($vars['usecaching']); if (!$vars['usecaching'] || $vars['usecaching'] && !$this->view->is_cached('block/menu.tpl')) { $options = array('orderBy' => 'setLeft', 'makeTree' => true, 'filter' => array()); if ($vars['root'] > 0) { $options['filter']['superParentId'] = $vars['root']; } // checkInMenu, checkActive is done implicitely $options['filter']['checkInMenu'] = true; $pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options); if ($pages === false) { return false; } $this->view->assign('subPages', $pages); } $blockinfo['content'] = $this->view->fetch('block/menu.tpl'); return BlockUtil::themeBlock($blockinfo); }
public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Content::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } $catoptions = array(array('text' => $this->__('Use 2 category levels (1st level single, 2nd level multi selection)'), 'value' => '1'), array('text' => $this->__('Use 2 category levels (both single selection)'), 'value' => '2'), array('text' => $this->__('Use 1 category level'), 'value' => '3'), array('text' => $this->__("Don't use Categories at all"), 'value' => '4')); $this->view->assign('catoptions', $catoptions); $this->view->assign('categoryusage', 1); $activeoptions = array(array('text' => $this->__('New pages will be active and available in the menu'), 'value' => '1'), array('text' => $this->__('New pages will be inactive and available in the menu'), 'value' => '2'), array('text' => $this->__('New pages will be active and not available in the menu'), 'value' => '3'), array('text' => $this->__('New pages will be inactive and not available in the menu'), 'value' => '4')); $this->view->assign('activeoptions', $activeoptions); $pageinfolocationoptions = array(array('text' => $this->__('Top of the page, left of the page title'), 'value' => 'top'), array('text' => $this->__('Bottom of the page'), 'value' => 'bottom')); $this->view->assign('pageinfolocationoptions', $pageinfolocationoptions); // get all module variables $modvars = ModUtil::getVar('Content'); // Prepare list of layout options that are displayed for new pages $layoutdisplayoptions = array(); $layoutDisplaySelection = array(); foreach ($modvars['layoutDisplay'] as $layout) { $layoutdisplayoptions[] = array('text' => $layout['description'], 'value' => $layout['name']); if ($layout['display']) { $layoutDisplaySelection[] = $layout['name']; } } $this->view->assign('layoutdisplayoptions', $layoutdisplayoptions); $this->view->assign('layoutDisplaySelection', $layoutDisplaySelection); // Assign all module vars $this->view->assign('config', $modvars); return true; }
/** * This method is the default function handling the admin area called without defining arguments. * * * @return mixed Output. */ public function main() { // parameter specifying which type of objects we are treating $objectType = $this->request->query->filter('ot', 'collection', FILTER_SANITIZE_STRING); $permLevel = ACCESS_ADMIN; $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . '::', '::', $permLevel), LogUtil::getErrorMsgPermission()); $redirectUrl = ModUtil::url($this->name, 'admin', 'view', array('ot' => $objectType, 'lct' => 'admin')); return $this->redirect($redirectUrl); }
public function editors() { $this->throwForbiddenUnless(SecurityUtil::checkPermission('Scribite::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission()); // check for all supported editors and generate links $editors = ModUtil::apiFunc('Scribite', 'admin', 'getEditors', array('editorname' => "list")); $this->view->assign('editors', $editors); $this->view->assign('defaulteditor', ModUtil::getVar('Scribite', 'DefaultEditor')); return $this->view->fetch('admin/editors.tpl'); }
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; }
/** * This method provides a item detail view. * * @param string $tpl Name of alternative template (to be used instead of the default template). * @param boolean $raw Optional way to display a template instead of fetching it (required for standalone output). * * @return mixed Output. */ public function display() { $legacyControllerType = $this->request->query->filter('lct', 'user', FILTER_SANITIZE_STRING); System::queryStringSetVar('type', $legacyControllerType); $this->request->query->set('type', $legacyControllerType); $controllerHelper = new MUVideo_Util_Controller($this->serviceManager); // parameter specifying which type of objects we are treating $objectType = 'movie'; $utilArgs = array('controller' => 'movie', 'action' => 'display'); $permLevel = $legacyControllerType == 'admin' ? ACCESS_ADMIN : ACCESS_READ; $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', $permLevel), LogUtil::getErrorMsgPermission()); $entityClass = $this->name . '_Entity_' . ucwords($objectType); $repository = $this->entityManager->getRepository($entityClass); $repository->setControllerArguments(array()); $idFields = ModUtil::apiFunc($this->name, 'selection', 'getIdFields', array('ot' => $objectType)); // retrieve identifier of the object we wish to view $idValues = $controllerHelper->retrieveIdentifier($this->request, array(), $objectType, $idFields); $hasIdentifier = $controllerHelper->isValidIdentifier($idValues); $this->throwNotFoundUnless($hasIdentifier, $this->__('Error! Invalid identifier received.')); $selectionArgs = array('ot' => $objectType, 'id' => $idValues); $entity = ModUtil::apiFunc($this->name, 'selection', 'getEntity', $selectionArgs); $this->throwNotFoundUnless($entity != null, $this->__('No such item.')); unset($idValues); $entity->initWorkflow(); // build ModUrl instance for display hooks; also create identifier for permission check $currentUrlArgs = $entity->createUrlArgs(); $instanceId = $entity->createCompositeIdentifier(); $currentUrlArgs['id'] = $instanceId; // TODO remove this $currentUrlObject = new Zikula_ModUrl($this->name, 'movie', 'display', ZLanguage::getLanguageCode(), $currentUrlArgs); $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', $instanceId . '::', $permLevel), LogUtil::getErrorMsgPermission()); $viewHelper = new MUVideo_Util_View($this->serviceManager); $templateFile = $viewHelper->getViewTemplate($this->view, $objectType, 'display', array()); // set cache id $component = $this->name . ':' . ucwords($objectType) . ':'; $instance = $instanceId . '::'; $accessLevel = ACCESS_READ; if (SecurityUtil::checkPermission($component, $instance, ACCESS_COMMENT)) { $accessLevel = ACCESS_COMMENT; } if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) { $accessLevel = ACCESS_EDIT; } $this->view->setCacheId($objectType . '|' . $instanceId . '|a' . $accessLevel); // assign output data to view object. $this->view->assign($objectType, $entity)->assign('currentUrlObject', $currentUrlObject)->assign($repository->getAdditionalTemplateParameters('controllerAction', $utilArgs)); // initialize $youtubeId = ''; // we get the id from the url $youtubeId = explode('=', $entity['urlOfYoutube']); // assign to template $this->view->assign('youtubeId', $youtubeId[1]); // fetch and return the appropriate template return $viewHelper->processTemplate($this->view, $objectType, 'display', array(), $templateFile); }
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; }
public function initialize(Zikula_Form_View $view) { if (!SecurityUtil::checkPermission('Mailer::', '::', ACCESS_ADMIN)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } $msgtype = $this->getVar('html') ? 'html' : 'text'; $view->assign('msgtype', $msgtype); // assign all module vars $this->view->assign($this->getVars()); return true; }
/** * This method provides a handling of edit requests. * * @param string $ot Treated object type. * @param string $tpl Name of alternative template (to be used instead of the default template). * @param boolean $raw Optional way to display a template instead of fetching it (required for standalone output). * * @return mixed Output. */ public function getVideos() { $controllerHelper = new MUVideo_Util_Controller($this->serviceManager); // parameter specifying which type of objects we are treating $objectType = $this->request->query->filter('ot', 'collection', FILTER_SANITIZE_STRING); $utilArgs = array('controller' => 'user', 'action' => 'getVideos'); if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) { $objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs); } $permLevel = ACCESS_EDIT; $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucfirst($objectType) . ':', '::', $permLevel), LogUtil::getErrorMsgPermission()); // redirect to entity controller System::queryStringSetVar('lct', 'user'); $this->request->query->set('lct', 'user'); return ModUtil::func($this->name, $objectType, 'getVideos', array('lct' => 'user')); }
public function display($blockinfo) { // security check $this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:OnePageBlock:', "{$blockinfo['title']}::", ACCESS_READ), LogUtil::getErrorMsgPermission()); // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); // --- Setting of the Defaults if (!isset($vars['page'])) { $vars['page'] = 0; } if ($vars['page'] > 0) { $blockinfo['content'] = ModUtil::func('Content', 'user', 'view', array('pid' => $vars['page'])); } else { $blockinfo['content'] = $this->__('No page selected'); } return BlockUtil::themeBlock($blockinfo); }
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; }
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; }
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; }
public function display($blockinfo) { // security check $this->throwForbiddenUnless(SecurityUtil::checkPermission('Content:SubPagesBlock:', "{$blockinfo['title']}::", ACCESS_READ), LogUtil::getErrorMsgPermission()); // Break out options from our content field $vars = BlockUtil::varsFromContent($blockinfo['content']); // --- Setting of the Defaults if (!isset($vars['usecaching'])) { $vars['usecaching'] = false; } if (!isset($vars['checkinmenu'])) { $vars['checkinmenu'] = true; } // decode the query string (works with and without shorturls) System::queryStringDecode(); $query['module'] = isset($_REQUEST['module']) ? $_REQUEST['module'] : 'notcontent'; $query['func'] = isset($_REQUEST['func']) ? $_REQUEST['func'] : 'notview'; $query['pid'] = isset($_REQUEST['pid']) ? $_REQUEST['pid'] : 0; $this->view->setCacheId($blockinfo['bid']); $this->view->setCaching($vars['usecaching']); if (!$vars['usecaching'] || $vars['usecaching'] && !$this->view->is_cached('block/subpages.tpl')) { $modinfo = ModUtil::getInfoFromName('content'); if (strtolower($query['module']) == $modinfo['url'] && strtolower($query['func']) == 'view' && $query['pid'] > 0) { $options = array('orderBy' => 'setLeft', 'makeTree' => true, 'includeContent' => false, 'enableEscape' => false, 'filter' => array()); // checkInMenu, checkActive is done implicitely $options['filter']['checkInMenu'] = $vars['checkinmenu']; $options['filter']['parentId'] = $query['pid']; $pages = ModUtil::apiFunc('Content', 'Page', 'getPages', $options); if ($pages === false) { return false; } } else { $pages = null; } $this->view->assign('subPages', $pages); } $blockinfo['content'] = $this->view->fetch('block/subpages.tpl'); return BlockUtil::themeBlock($blockinfo); }
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; }
/** * This method provides a generic item detail view. * * @param string $ot Treated object type. * @param string $tpl Name of alternative template (for alternative display options, feeds and xml output) * @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output) * * @return mixed Output. */ public function display() { $controllerHelper = new Reviews_Util_Controller($this->serviceManager); // parameter specifying which type of objects we are treating $objectType = $this->request->query->filter('ot', 'review', FILTER_SANITIZE_STRING); $utilArgs = array('controller' => 'user', 'action' => 'display'); if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) { $objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs); } $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); $entityClass = $this->name . '_Entity_' . ucwords($objectType); $repository = $this->entityManager->getRepository($entityClass); $repository->setControllerArguments(array()); $idFields = ModUtil::apiFunc($this->name, 'selection', 'getIdFields', array('ot' => $objectType)); // retrieve identifier of the object we wish to view $idValues = $controllerHelper->retrieveIdentifier($this->request, array(), $objectType, $idFields); $hasIdentifier = $controllerHelper->isValidIdentifier($idValues); // check for unique permalinks (without id) $hasSlug = false; $slug = ''; if ($hasIdentifier === false) { $entityClass = $this->name . '_Entity_' . ucwords($objectType); $meta = $this->entityManager->getClassMetadata($entityClass); $hasSlug = $meta->hasField('slug') && $meta->isUniqueField('slug'); if ($hasSlug) { $slug = $this->request->query->filter('slug', '', FILTER_SANITIZE_STRING); $hasSlug = !empty($slug); } } $hasIdentifier |= $hasSlug; $this->throwNotFoundUnless($hasIdentifier, $this->__('Error! Invalid identifier received.')); $entity = ModUtil::apiFunc($this->name, 'selection', 'getEntity', array('ot' => $objectType, 'id' => $idValues, 'slug' => $slug)); $this->throwNotFoundUnless($entity != null, $this->__('No such item.')); unset($idValues); $entity->initWorkflow(); // build ModUrl instance for display hooks; also create identifier for permission check $currentUrlArgs = array('ot' => $objectType); $instanceId = ''; foreach ($idFields as $idField) { $currentUrlArgs[$idField] = $entity[$idField]; if (!empty($instanceId)) { $instanceId .= '_'; } $instanceId .= $entity[$idField]; } $currentUrlArgs['id'] = $instanceId; if (isset($entity['slug'])) { $currentUrlArgs['slug'] = $entity['slug']; } $currentUrlObject = new Zikula_ModUrl($this->name, 'user', 'display', ZLanguage::getLanguageCode(), $currentUrlArgs); $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', $instanceId . '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); $viewHelper = new Reviews_Util_View($this->serviceManager); $templateFile = $viewHelper->getViewTemplate($this->view, 'user', $objectType, 'display', array()); // set cache id $component = $this->name . ':' . ucwords($objectType) . ':'; $instance = $instanceId . '::'; $accessLevel = ACCESS_READ; if (SecurityUtil::checkPermission($component, $instance, ACCESS_COMMENT)) { $accessLevel = ACCESS_COMMENT; } if (SecurityUtil::checkPermission($component, $instance, ACCESS_EDIT)) { $accessLevel = ACCESS_EDIT; } $this->view->setCacheId($objectType . '|' . $instanceId . '|a' . $accessLevel); // assign output data to view object. $this->view->assign($objectType, $entity)->assign('currentUrlObject', $currentUrlObject)->assign($repository->getAdditionalTemplateParameters('controllerAction', $utilArgs)); //$controllerHelper = new Reviews_Util_Controller($this->serviceManager); $controllerHelper->addView($entity['id']); // fetch and return the appropriate template return $viewHelper->processTemplate($this->view, 'user', $objectType, 'display', array(), $templateFile); }
/** * This is a standard function to update the configuration parameters of the * module given the information passed back by the modification form */ public function updateconfig() { $this->throwForbiddenUnless(SecurityUtil::checkPermission('Pages::', '::', ACCESS_ADMIN), LogUtil::getErrorMsgPermission()); $this->checkCsrfToken(); // Update module variables $itemsperpage = (int)FormUtil::getPassedValue('itemsperpage', 25, 'POST'); if ($itemsperpage < 1) { $itemsperpage = 25; } $this->setVar('itemsperpage', $itemsperpage); $enablecategorization = (bool)FormUtil::getPassedValue('enablecategorization', false, 'POST'); $this->setVar('enablecategorization', $enablecategorization); $def_displaywrapper = (bool)FormUtil::getPassedValue('def_displaywrapper', false, 'POST'); $this->setVar('def_displaywrapper', $def_displaywrapper); $def_displaytitle = (bool)FormUtil::getPassedValue('def_displaytitle', false, 'POST'); $this->setVar('def_displaytitle', $def_displaytitle); $def_displaycreated = (bool)FormUtil::getPassedValue('def_displaycreated', false, 'POST'); $this->setVar('def_displaycreated', $def_displaycreated); $def_displayupdated = (bool)FormUtil::getPassedValue('def_displayupdated', false, 'POST'); $this->setVar('def_displayupdated', $def_displayupdated); $def_displaytextinfo = (bool)FormUtil::getPassedValue('def_displaytextinfo', false, 'POST'); $this->setVar('def_displaytextinfo', $def_displaytextinfo); $def_displayprint = (bool)FormUtil::getPassedValue('def_displayprint', false, 'POST'); $this->setVar('def_displayprint', $def_displayprint); $addcategorytitletopermalink = (bool)FormUtil::getPassedValue('addcategorytitletopermalink', false, 'POST'); $this->setVar('addcategorytitletopermalink', $addcategorytitletopermalink); $showpermalinkinput = (bool)FormUtil::getPassedValue('showpermalinkinput', false, 'POST'); $this->setVar('showpermalinkinput', $showpermalinkinput); // the module configuration has been updated successfuly LogUtil::registerStatus($this->__('Done! Module configuration updated.')); return System::redirect(ModUtil::url('Pages', 'admin', 'view')); }
/** * Popup selector for Scribite plugins. * Finds items of a certain object type. * * @param string $objectType The object type. * @param string $editor Name of used Scribite editor. * @param string $sort Sorting field. * @param string $sortdir Sorting direction. * @param int $pos Current pager position. * @param int $num Amount of entries to display. * * @return output The external item finder page */ public function finder() { PageUtil::addVar('stylesheet', ThemeUtil::getModuleStylesheet('Reviews')); $getData = $this->request->query; $controllerHelper = new Reviews_Util_Controller($this->serviceManager); $objectType = $getData->filter('objectType', 'review', FILTER_SANITIZE_STRING); $utilArgs = array('controller' => 'external', 'action' => 'finder'); if (!in_array($objectType, $controllerHelper->getObjectTypes('controller', $utilArgs))) { $objectType = $controllerHelper->getDefaultObjectType('controllerType', $utilArgs); } $this->throwForbiddenUnless(SecurityUtil::checkPermission('Reviews:' . ucwords($objectType) . ':', '::', ACCESS_COMMENT), LogUtil::getErrorMsgPermission()); $entityClass = 'Reviews_Entity_' . ucwords($objectType); $repository = $this->entityManager->getRepository($entityClass); $repository->setControllerArguments(array()); $editor = $getData->filter('editor', '', FILTER_SANITIZE_STRING); if (empty($editor) || !in_array($editor, array('xinha', 'tinymce'))) { return $this->__('Error: Invalid editor context given for external controller action.'); } // fetch selected categories to reselect them in the output // the actual filtering is done inside the repository class $categoryIds = ModUtil::apiFunc('Reviews', 'category', 'retrieveCategoriesFromRequest', array('ot' => $objectType, 'source' => 'GET')); $sort = $getData->filter('sort', '', FILTER_SANITIZE_STRING); if (empty($sort) || !in_array($sort, $repository->getAllowedSortingFields())) { $sort = $repository->getDefaultSortingField(); } $sortdir = $getData->filter('sortdir', '', FILTER_SANITIZE_STRING); $sdir = strtolower($sortdir); if ($sdir != 'asc' && $sdir != 'desc') { $sdir = 'asc'; } $sortParam = $sort . ' ' . $sdir; // the current offset which is used to calculate the pagination $currentPage = (int) $getData->filter('pos', 1, FILTER_VALIDATE_INT); // the number of items displayed on a page for pagination $resultsPerPage = (int) $getData->filter('num', 0, FILTER_VALIDATE_INT); if ($resultsPerPage == 0) { $resultsPerPage = $this->getVar('pageSize', 20); } $where = ''; list($entities, $objectCount) = $repository->selectWherePaginated($where, $sortParam, $currentPage, $resultsPerPage); foreach ($entities as $k => $entity) { $entity->initWorkflow(); } $view = Zikula_View::getInstance('Reviews', false); $view->assign('editorName', $editor)->assign('objectType', $objectType)->assign('items', $entities)->assign('sort', $sort)->assign('sortdir', $sdir)->assign('currentPage', $currentPage)->assign('pager', array('numitems' => $objectCount, 'itemsperpage' => $resultsPerPage)); // assign category properties $properties = null; if (in_array($objectType, $this->categorisableObjectTypes)) { $properties = ModUtil::apiFunc('Reviews', 'category', 'getAllProperties', array('ot' => $objectType)); } $view->assign('properties', $properties)->assign('catIds', $categoryIds); return $view->display('external/' . $objectType . '/find.tpl'); }
public function initialize(Zikula_Form_View $view) { $this->contentId = (int) FormUtil::getPassedValue('cid', isset($this->args['cid']) ? $this->args['cid'] : -1); $content = ModUtil::apiFunc('Content', 'Content', 'getContent', array( 'id' => $this->contentId, 'translate' => false, 'view' => $this->view)); if ($content === false) { return $this->view->registerError(null); } $this->pageId = $content['pageId']; if (!SecurityUtil::checkPermission('Content:page:', $this->pageId . '::', ACCESS_EDIT)) { throw new Zikula_Exception_Forbidden(LogUtil::getErrorMsgPermission()); } if (isset($content['plugin'])) { $this->contentType['plugin'] = $content['plugin']; $this->contentType['module'] = $content['plugin']->getModule(); $this->contentType['name'] = $content['plugin']->getName(); $this->contentType['title'] = $content['plugin']->getTitle(); $this->contentType['description'] = $content['plugin']->getDescription(); $this->contentType['adminInfo'] = $content['plugin']->getAdminInfo(); $this->contentType['isActive'] = $content['plugin']->isActive(); } else { $this->contentType['name'] = $this->__('Unknown'); $this->contentType['title'] = $this->__('Unknown plugin - requires upgrade'); $this->contentType['description'] = $this->__('Disabled plugin - requires upgrade'); $this->contentType['adminInfo'] = $this->__('Disabled plugin - requires upgrade'); $this->contentType['isActive'] = false; } if ($this->contentType === false) { return $this->view->registerError(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); } $editTemplate = "file:" . getcwd() . "/modules/Content/templates/contenttype/blank.tpl"; if (isset($content['plugin'])) { $this->contentType['plugin']->setView($view); $this->contentType['plugin']->startEditing(); $editTemplate = $this->contentType['plugin']->getEditTemplate(); } $multilingual = ModUtil::getVar(ModUtil::CONFIG_MODULE, 'multilingual'); if ($page['language'] == ZLanguage::getLanguageCode()) { $multilingual = false; } PageUtil::setVar('title', $this->__("Edit content item") . ' : ' . $page['title']); $this->view->assign('contentTypeTemplate', $editTemplate); $this->view->assign('page', $page); $this->view->assign('visiblefors', array( array('text' => $this->__('public (all)'), 'value' => '1'), array('text' => $this->__('only logged in members'), 'value' => '0'), array('text' => $this->__('only not logged in people'), 'value' => '2'))); $this->view->assign('content', $content); $this->view->assign('data', $content['data']); $this->view->assign('contentType', $this->contentType); $this->view->assign('multilingual', $multilingual); $this->view->assign('enableVersioning', $this->getVar('enableVersioning')); 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' => "contentContent{$this->contentId}", 'returnUrl' => $returnUrl)); return true; }
public function categories() { $this->throwForbiddenUnless(SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); $this->view->setCacheId('main'); if ($this->view->is_cached('user/main.tpl')) { return $this->view->fetch('user/main.tpl'); } // Create output object $enablecategorization = ModUtil::getVar('AddressBook', 'enablecategorization'); if ($enablecategorization) { // get the categories registered for the AddressBook $catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('AddressBook', 'addressbook_address'); $properties = array_keys($catregistry); $propertiesdata = array(); foreach ($properties as $property) { $rootcat = CategoryUtil::getCategoryByID($catregistry[$property]); if (!empty($rootcat)) { $rootcat['path'] .= '/'; // add this to make the relative paths of the subcategories with ease - mateo $subcategories = CategoryUtil::getCategoriesByParentID($rootcat['id']); $propertiesdata[] = array('name' => $property, 'rootcat' => $rootcat, 'subcategories' => $subcategories); } } // Assign some useful vars to customize the main $this->view->assign('properties', $properties); $this->view->assign('propertiesdata', $propertiesdata); } return $this->view->fetch('user_categories.tpl'); }
/** * 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'); }
public function phpBBcall($args) { $this->throwForbiddenUnless(SecurityUtil::checkPermission('ZphpBB2::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission()); ob_start(); $phpbb_root_path = 'modules/ZphpBB2/vendor/phpBB2/'; include $phpbb_root_path . 'includezik.php'; include $phpbb_root_path . $this->phpBBfile . '.php'; $content = ob_get_contents(); ob_end_clean(); $this->view->assign('content', $content); return $this->view->fetch('user/call.tpl'); }
/** * This method provides a generic handling of all edit requests. * * @param string $ot Treated object type. * @param string $tpl Name of alternative template (for alternative display options, feeds and xml output) * @param boolean $raw Optional way to display a template instead of fetching it (needed for standalone output) * * @return mixed Output. */ public function edit() { $controllerHelper = new Reviews_Util_Controller($this->serviceManager); // parameter specifying which type of objects we are treating $objectType = $this->request->query->filter('ot', 'review', FILTER_SANITIZE_STRING); $utilArgs = array('controller' => 'user', 'action' => 'edit'); if (!in_array($objectType, $controllerHelper->getObjectTypes('controllerAction', $utilArgs))) { $objectType = $controllerHelper->getDefaultObjectType('controllerAction', $utilArgs); } $this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . ':' . ucwords($objectType) . ':', '::', ACCESS_EDIT), LogUtil::getErrorMsgPermission()); // create new Form reference $view = FormUtil::newForm($this->name, $this); // build form handler class name $handlerClass = $this->name . '_Form_Handler_User_' . ucfirst($objectType) . '_Edit'; // determine the output template $viewHelper = new Reviews_Util_View($this->serviceManager); $template = $viewHelper->getViewTemplate($this->view, 'user', $objectType, 'edit', array()); // execute form using supplied template and page event handler return $view->execute($template, new $handlerClass()); }