コード例 #1
0
ファイル: HistoryContent.php プロジェクト: robbrandt/Content
 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;
 }
コード例 #2
0
ファイル: ClonePage.php プロジェクト: projectesIF/Sirius
    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;
    }
コード例 #3
0
ファイル: Util.php プロジェクト: robbrandt/Content
 public static function contentMainEditExpandAll($belowPageId = null)
 {
     $expandedPageIds = SessionUtil::getVar('contentExpandedPageIds', array());
     foreach (Content_Util::contentMainEditGetPagesList($belowPageId) as $page) {
         $expandedPageIds[$page['id']] = 1;
     }
     SessionUtil::setVar('contentExpandedPageIds', $expandedPageIds);
 }
コード例 #4
0
 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>&amp;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
0
ファイル: EditPage.php プロジェクト: robbrandt/Content
 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
0
ファイル: Layout.php プロジェクト: robbrandt/Content
 public function getLayouts($args)
 {
     $plugins = Content_Util::getPlugins('Layout');
     $layouts = array();
     $names = array();
     // module var for which layouts to display
     $layoutDisplay = $this->getVar('layoutDisplay');
     for ($i = 0, $cou = count($plugins); $i < $cou; ++$i) {
         $plugin = $plugins[$i];
         if ($layoutDisplay[$plugin->getTemplateType()]['display']) {
             $layouts[$i] = array('module' => $plugin->getModule(), 'name' => $plugin->getName(), 'title' => $plugin->getTitle(), 'description' => $plugin->getDescription(), 'numberOfContentAreas' => $plugin->getNumberOfContentAreas(), 'image' => $plugin->getImage(), 'templateType' => $plugin->getTemplateType());
             $names[$i] = $layouts[$i]['name'];
         }
     }
     // sort the layouts array by the name
     array_multisort($names, SORT_ASC, $layouts);
     return $layouts;
 }
コード例 #7
0
ファイル: TranslatePage.php プロジェクト: projectesIF/Sirius
    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>&amp;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;
    }
コード例 #8
0
ファイル: NewPage.php プロジェクト: projectesIF/Sirius
    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;
    }
コード例 #9
0
ファイル: NewContent.php プロジェクト: projectesIF/Sirius
    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;
    }
コード例 #10
0
ファイル: Layout.php プロジェクト: projectesIF/Sirius
    public function getLayouts($args)
    {
        $plugins = Content_Util::getPlugins('Layout');
        $layouts = array();
        $names = array();

        for ($i = 0, $cou = count($plugins); $i < $cou; ++$i) {
            $plugin = $plugins[$i];
            $layouts[$i] = array(
                'module' => $plugin->getModule(),
                'name' => $plugin->getName(),
                'title' => $plugin->getTitle(),
                'description' => $plugin->getDescription(),
                'numberOfContentAreas' => $plugin->getNumberOfContentAreas(),
                'image' => $plugin->getImage());
            $names[$i] = $layouts[$i]['name'];
        }
        // sort the layouts array by the name
        array_multisort($names, SORT_ASC, $layouts);

        return $layouts;
    }
コード例 #11
0
ファイル: EditContent.php プロジェクト: projectesIF/Sirius
    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;
    }
コード例 #12
0
ファイル: User.php プロジェクト: robbrandt/Content
 /**
  * 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');
 }
コード例 #13
0
ファイル: Content.php プロジェクト: robbrandt/Content
 public function getContentTypes($args)
 {
     $includeInactive = isset($args['includeInactive']) ? $args['includeInactive'] : false;
     $plugins = Content_Util::getPlugins('Content');
     $contentTypes = array();
     for ($i = 0, $cou = count($plugins); $i < $cou; ++$i) {
         $plugin =& $plugins[$i];
         if ($includeInactive || $plugin->isActive()) {
             $contentTypes[] = array('module' => $plugin->getModule(), 'name' => $plugin->getName(), 'title' => $plugin->getTitle(), 'description' => $plugin->getDescription(), 'adminInfo' => $plugin->getAdminInfo(), 'isActive' => $plugin->isActive());
         }
     }
     return $contentTypes;
 }
コード例 #14
0
ファイル: User.php プロジェクト: projectesIF/Sirius
    /**
     * 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;
        }

        return $this->view->fetch('user/sitemap.tpl');
    }
コード例 #15
0
ファイル: Main.php プロジェクト: robbrandt/Content
 public function handleCommand(Zikula_Form_View $view, &$args)
 {
     $url = ModUtil::url('Content', 'admin', 'main');
     if ($args['commandName'] == 'editPage') {
         $url = ModUtil::url('Content', 'admin', 'editPage', array('pid' => $args['commandArgument']));
     } else {
         if ($args['commandName'] == 'newSubPage') {
             $url = ModUtil::url('Content', 'admin', 'newPage', array('pid' => $args['commandArgument'], 'loc' => 'sub'));
         } else {
             if ($args['commandName'] == 'newPage') {
                 $url = ModUtil::url('Content', 'admin', 'newPage', array('pid' => $args['commandArgument']));
             } else {
                 if ($args['commandName'] == 'clonePage') {
                     $url = ModUtil::url('Content', 'admin', 'clonepage', array('pid' => $args['commandArgument']));
                 } else {
                     if ($args['commandName'] == 'pageDrop') {
                         $srcId = FormUtil::getPassedValue('contentTocDragSrcId', null, 'POST');
                         $dstId = FormUtil::getPassedValue('contentTocDragDstId', null, 'POST');
                         list($dummy, $srcId) = explode('_', $srcId);
                         list($dummy, $dstId) = explode('_', $dstId);
                         $ok = ModUtil::apiFunc('Content', 'Page', 'pageDrop', array('srcId' => $srcId, 'dstId' => $dstId));
                         if (!$ok) {
                             return $this->view->registerError(null);
                         }
                     } else {
                         if ($args['commandName'] == 'decIndent') {
                             $pageId = (int) $args['commandArgument'];
                             $ok = ModUtil::apiFunc('Content', 'Page', 'decreaseIndent', array('pageId' => $pageId));
                             if (!$ok) {
                                 return $this->view->registerError(null);
                             }
                         } else {
                             if ($args['commandName'] == 'incIndent') {
                                 $pageId = (int) $args['commandArgument'];
                                 $ok = ModUtil::apiFunc('Content', 'Page', 'increaseIndent', array('pageId' => $pageId));
                                 if (!$ok) {
                                     return $this->view->registerError(null);
                                 }
                             } else {
                                 if ($args['commandName'] == 'deletePage') {
                                     $pageId = (int) $args['commandArgument'];
                                     $ok = ModUtil::apiFunc('Content', 'Page', 'deletePage', array('pageId' => $pageId));
                                     if ($ok === false) {
                                         return $this->view->registerError(null);
                                     }
                                 } else {
                                     if ($args['commandName'] == 'history') {
                                         $pageId = (int) $args['commandArgument'];
                                         $url = ModUtil::url('Content', 'admin', 'history', array('pid' => $pageId));
                                     } else {
                                         if ($args['commandName'] == 'sortPagesBelowByTitle') {
                                             $pageId = (int) $args['commandArgument'];
                                             $ok = ModUtil::apiFunc('Content', 'Page', 'orderPages', array('pageId' => $pageId));
                                             if ($ok === false) {
                                                 return $this->view->registerError(null);
                                             }
                                         } else {
                                             if ($args['commandName'] == 'toggleExpand') {
                                                 $pageId = FormUtil::getPassedValue('contentTogglePageId', null, 'POST');
                                                 Content_Util::contentMainEditExpandToggle($pageId);
                                             } else {
                                                 if ($args['commandName'] == 'expandAll') {
                                                     Content_Util::contentMainEditExpandAll();
                                                 } else {
                                                     if ($args['commandName'] == 'expandAllBelow') {
                                                         Content_Util::contentMainEditExpandAll($args['commandArgument']);
                                                     } else {
                                                         if ($args['commandName'] == 'collapseAll') {
                                                             Content_Util::contentMainEditCollapseAll();
                                                         } else {
                                                             if ($args['commandName'] == 'collapseAllBelow') {
                                                                 Content_Util::contentMainEditCollapseAll($args['commandArgument']);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->view->redirect($url);
     return true;
 }
コード例 #16
0
ファイル: Page.php プロジェクト: projectesIF/Sirius
    public function increaseIndent($args)
    {
        $pageId = (int) $args['pageId'];
        $page = DBUtil::selectObjectByID('content_page', $pageId);

        // Cannot indent topmost page
        if ($page['position'] == 0) {
            return true;
        }

        $parentPageId = $page['parentPageId'];
        $position = $page['position'];

        $dbtables = DBUtil::getTables();
        $pageTable = $dbtables['content_page'];
        $pageColumn = $dbtables['content_page_column'];

        $where = "$pageColumn[parentPageId] = $parentPageId AND $pageColumn[position] = $position-1";

        $previousPage = DBUtil::selectObject('content_page', $where);
        $thisPage = DBUtil::selectObjectByID('content_page', $pageId);
        if (!isset($previousPage['id']) || !isset($thisPage['urlname'])) {
            return LogUtil::registerError($this->__('Error! The indentation of this page cannot be increased.'));
        }

        $ok = $this->isUniqueUrlnameByParentID(array('urlname' => $thisPage['urlname'], 'parentId' => $previousPage['id']));
        if (!$ok) {
            return LogUtil::registerError($this->__('Error! There is already another page registered with the supplied permalink URL.'));
        }

        $ok = $this->removePage(array('id' => $pageId));
        if ($ok === false) {
            return false;
        }
        DBUtil::flushCache('content_page');

        // Find new position (last in existing sub-pages)
        $sql = "
            SELECT MAX($pageColumn[position])
            FROM $pageTable
            WHERE $pageColumn[parentPageId] = $previousPage[id]";

        $newPosition = DBUtil::selectScalar($sql);
        if ($newPosition == null) {
            $newPosition = 0;
        }
        $ok = $this->insertPage(array('pageId' => $pageId, 'position' => $newPosition, 'parentPageId' => $previousPage['id']));
        if ($ok === false) {
            return false;
        }
        /*
          $ok = $this->updateNestedSetValues();
          if ($ok === false)
          return false;
         */
        Content_Util::clearCache();
        return true;
    }