/**
  * @see	\cms\data\page\PageNodeTree::isIncluded()
  */
 protected function isIncluded(PageNode $pageNode)
 {
     if (!$pageNode->canRead()) {
         return false;
     }
     return parent::isIncluded($pageNode);
 }
Пример #2
0
 public static function edit_display($row)
 {
     //$row['data'] = unserialize($row['data']);
     self::$row = $row;
     i18n::set('admin');
     if ($_POST['cc_form'] == 'edit_page') {
         plugin('admin_edit_post_pre_processing');
         $id = $_GET['id'];
         $title = filter('admin_edit_post_title', self::get('title'));
         $content = filter('admin_edit_post_content', self::get('content_area'));
         $last_modified = filter('admin_edit_post_last_modified', time());
         $settings = filter('admin_edit_post_settings', self::get('settings'));
         $weight = filter('admin_edit_post_weight', self::get('weight'));
         $menutitle = filter('admin_edit_post_menutitle', self::get('menutitle'));
         $parent_id = filter('admin_edit_post_parent_id', self::get('parent_id'));
         $type = filter('admin_edit_post_type', self::get('content_type'));
         $slug = filter('admin_edit_post_slug', self::get('slug'));
         $values = array('title' => $title, 'content' => $content, 'settings' => unserialize($settings), 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
         plugin('admin_edit_post_post_processing');
         $values = filter('admin_edit_post_posted_values', $values);
         $values['settings'] = serialize($values['settings']);
         $res = Content::editNode($id, $type, $values);
         if ($res) {
             $message = Message::success('Page updated successfully!');
         } else {
             $message = Message::success('Page update failed (DB Error)!');
         }
         //Hooks::bind('post_edit_page', 'EditPage::handlePost');
     }
     $r = $message;
     $tl = $themeList = array_subkeys(Themes::getThemeList(), 'name');
     $tl['-1'] = 'Default Theme';
     ksort($tl);
     $form = new Form('self', 'post', 'edit_page');
     $form->addHidden('settings', serialize(self::get('settings')));
     $form->startFieldset(__('page-info'), array('id' => 'page_info_f'));
     $form->addInput(__('page-title'), 'text', 'title', self::get('title'), array('class' => 'large'));
     $form->addHidden('content_type', self::get('type'));
     $form->addSelectList(__('theme-override'), 'theme', $tl, true, self::get('theme'));
     $form->addSelectList(__('parent'), 'parent_id', self::buildParentOptions(), true, self::get('parent_id'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields', array(&$form));
     $form->startFieldset(__('menu-settings'), array('id' => 'menu_settings_f'));
     $form->addInput(__('menu-title'), 'text', 'menutitle', self::get('menutitle'));
     $form->addInput(__('slug'), 'text', 'slug', self::get('slug'));
     $form->addInput(__('weight'), 'text', 'weight', self::get('weight'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields2', array(&$form));
     $form->startFieldset(__('content'));
     $form->addEditor('', 'content_area', self::get('content_area'));
     $form->endFieldset();
     plugin('admin_edit_custom_fields3', array(&$form));
     $form->addSubmit('', 'save', __('save'));
     $page_title = __('edit-page');
     i18n::restore();
     return array($page_title, $r . $form->endAndGetHTML());
 }
Пример #3
0
 private function processData()
 {
     if ($this->parsedTitle->nsCode() !== WikiTitle::NS_MAIN) {
         return false;
     }
     if (!$this->parsePage()) {
         return true;
     }
     // we're done, give up
     try {
         $configHolder = $this->configHandler->loadConfigFile();
     } catch (\Exception $e) {
         return $this->response(500, 'Internal server error', 'Failed to load config: ' . $e);
     }
     // forward source to ultrapedia
     if (!$this->sendWiki()) {
         return true;
     }
     // error response already sent
     $secs = microtime(true);
     $extractor = $configHolder->extractor;
     // destinations must be SingletonQuadDestinations, so key doesn't matter
     // destination must be a StringQuadDestination
     // TODO: check types
     $destination = $configHolder->destinations->getDestination('');
     $pageUri = OntologyNamespaces::appendUri(OntologyNamespaces::DBPEDIA_INSTANCE_NAMESPACE, $this->parsedTitle->encoded());
     $pageContext = new mapping\PageContext($pageUri);
     $extractor->extract($this->parsedPage, $pageUri, $pageContext);
     $delete = $this->delete($this->parsedPage->getSourceUriPrefix());
     $insert = $this->insert((string) $destination);
     $sparul = $this->sparul(array($delete, $insert));
     $this->log->info('Successfully extracted data (' . (microtime(true) - $secs) * 1000 . ' millis)');
     // send triples to triple store
     if (!$this->sendSparul($sparul)) {
         return true;
     }
     // error response already sent
     return $this->response(200, 'Successfully extracted data', $this->reply ? "Successfully extracted data.\n\n" . $sparul : null);
 }
Пример #4
0
 public static function create_display()
 {
     i18n::set('external-link-nodetype');
     $message = "";
     if ($_POST['cc_form'] == 'create_external_link') {
         $id = $_GET['id'];
         $weight = self::get('weight');
         $menutitle = self::get('menutitle');
         $parent_id = self::get('parent_id');
         $slug = self::get('slug');
         if (empty($url) || empty($text)) {
             $message = Message::error(__('blank-error'));
         } else {
             if (empty($weight)) {
                 $weight = '0';
             }
             $values = array('title' => '', 'content' => '', 'settings' => 'a:0:{}', 'weight' => $weight, 'menutitle' => $menutitle, 'parent_id' => $parent_id, 'slug' => $slug);
             $res = Content::createNode($_GET['type'], $values);
             if ($res) {
                 $message = Message::success(sprintf(__('link-creation-successful') . ' (<a href="%s">%s</a>)', Admin::link('content'), __('admin', 'view-all-pages')));
             } else {
                 $message = Message::error(__('link-creation-failed'));
             }
         }
     }
     $r = $message;
     $form = new Form('self', 'post', 'create_external_link');
     $form->addInput(__('url'), 'text', 'slug', self::get('slug'));
     $form->addInput(__('display-text'), 'text', 'menutitle', self::get('menutitle'));
     $form->addSelectList(__('parent'), 'parent_id', PageNode::buildParentOptions(), true, $_POST['parent_id'] ? $_POST['parent_id'] : '0');
     $form->addInput(__('weight'), 'text', 'weight', self::get('weight'));
     $form->addSubmit('', 'create', 'Create');
     i18n::restore();
     return array(__('external-link-nodetype', 'create-external-link'), $form->endAndGetHTML());
 }