コード例 #1
0
ファイル: link.php プロジェクト: nemein/openpsa
 /**
  * Displays an article edit view.
  *
  * Note, that the article for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation article
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     $this->_content_topic->require_do('midgard:create');
     if (!$this->_config->get('enable_article_links')) {
         throw new midcom_error_notfound('Article linking disabled');
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             $this->_article = new midcom_db_article($this->_link->article);
             return new midcom_response_relocate("{$this->_article->name}/");
         case 'cancel':
             if (isset($_GET['article'])) {
                 if ($this->_config->get('view_in_url')) {
                     $prefix = 'view/';
                 } else {
                     $prefix = '';
                 }
                 try {
                     $article = new midcom_db_article($_GET['article']);
                     return new midcom_response_relocate("{$prefix}{$article->name}/");
                 } catch (midcom_error $e) {
                     $e->log();
                 }
             }
             return new midcom_response_relocate('');
     }
     $this->_prepare_request_data();
     $title = sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('article link'));
     midcom::get('head')->set_pagetitle("{$this->_topic->extra}: {$title}");
     $this->_update_breadcrumb_line($handler_id);
 }
コード例 #2
0
ファイル: create.php プロジェクト: nemein/openpsa
 /**
  * Displays an article edit view.
  *
  * Note, that the article for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation article
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     $this->_content_topic->require_do('midgard:create');
     $this->_schema = $args[0];
     if ($handler_id == 'createindex') {
         $this->_indexmode = true;
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             // #809 should have taken care of this, but see same place in n.n.static
             if (strlen($this->_article->name) == 0) {
                 // Generate something to avoid empty "/" links in case of failures
                 $this->_article->name = time();
                 $this->_article->update();
             }
             // Index the article
             $indexer = midcom::get('indexer');
             net_nehmer_blog_viewer::index($data['controller']->datamanager, $indexer, $this->_content_topic);
             // *** FALL THROUGH ***
         // *** FALL THROUGH ***
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_prepare_request_data();
     $title = sprintf($this->_l10n_midcom->get('create %s'), $this->_schemadb[$this->_schema]->description);
     midcom::get('head')->set_pagetitle("{$this->_topic->extra}: {$title}");
     $this->add_breadcrumb("create/{$this->_schema}/", sprintf($this->_l10n_midcom->get('create %s'), $this->_schemadb[$this->_schema]->description));
 }
コード例 #3
0
ファイル: move.php プロジェクト: nemein/openpsa
 private function _move_object($target)
 {
     $move_to_topic = new midcom_db_topic();
     $move_to_topic->get_by_id($target);
     if (!$move_to_topic->guid) {
         throw new midcom_error('Failed to move the topic. Could not get the target topic');
     }
     $move_to_topic->require_do('midgard:create');
     if (is_a($this->_object, 'midcom_db_topic')) {
         $name = $this->_object->name;
         $this->_object->name = '';
         // Prevents problematic location to break the site, we set this back below...
         $up = $this->_object->up;
         $this->_object->up = $move_to_topic->id;
         if (!$this->_object->update()) {
             throw new midcom_error('Failed to move the topic, reason ' . midcom_connection::get_error_string());
         }
         if (!midcom_admin_folder_management::is_child_listing_finite($this->_object)) {
             $this->_object->up = $up;
             $this->_object->name = $name;
             $this->_object->update();
             throw new midcom_error("Refusing to move this folder because the move would have created an " . "infinite loop situation caused by the symlinks on this site. The " . "whole site would have been completely and irrevocably broken if this " . "move would have been allowed to take place. Infinite loops can not " . "be allowed. Sorry, but this was for your own good.");
         }
         // It was ok, so set name back now
         $this->_object->name = $name;
         $this->_object->update();
     } else {
         $this->_object->topic = $move_to_topic->id;
         if (!$this->_object->update()) {
             throw new midcom_error('Failed to move the article, reason ' . midcom_connection::get_error_string());
         }
     }
 }
コード例 #4
0
ファイル: create.php プロジェクト: nemein/openpsa
 /**
  * Displays an article edit view.
  *
  * Note, that the article for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation article
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     $this->_content_topic->require_do('midgard:create');
     $this->_schema = $args[0];
     if ($handler_id == 'createindex') {
         $this->_indexmode = true;
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             /**
              * http://trac.midgard-project.org/ticket/809 should have taken care of this.
              * BUT: to be extra careful, let's do this sanity-check anyway.
              */
             if (strlen($this->_article->name) == 0) {
                 // Generate something to avoid empty "/" links in case of failures
                 $this->_article->name = time();
                 $this->_article->update();
             }
             // Index the article
             $indexer = midcom::get('indexer');
             net_nehmer_static_viewer::index($data['controller']->datamanager, $indexer, $this->_content_topic);
             if ($this->_article->name === 'index') {
                 return new midcom_response_relocate('');
             }
             return new midcom_response_relocate("{$this->_article->name}/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_prepare_request_data();
     $title = sprintf($this->_l10n_midcom->get('create %s'), $this->_schemadb[$this->_schema]->description);
     midcom::get('head')->set_pagetitle("{$this->_topic->extra}: {$title}");
     $this->add_breadcrumb("create/{$this->_schema}/", sprintf($this->_l10n_midcom->get('create %s'), $this->_schemadb[$this->_schema]->description));
 }
コード例 #5
0
ファイル: link.php プロジェクト: nemein/openpsa
 /**
  * Displays an article edit view.
  *
  * Note, that the article for non-index mode operation is automatically determined in the can_handle
  * phase.
  *
  * If create privileges apply, we relocate to the index creation article
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_create($handler_id, array $args, array &$data)
 {
     $this->_content_topic->require_do('midgard:create');
     if (!$this->_config->get('enable_article_links')) {
         throw new midcom_error_notfound('Article linking disabled');
     }
     $data['controller'] = $this->get_controller('create');
     switch ($data['controller']->process_form()) {
         case 'save':
             $this->_article = new midcom_db_article($this->_link->article);
             return new midcom_response_relocate("{$this->_article->name}/");
         case 'cancel':
             return new midcom_response_relocate('');
     }
     $this->_prepare_request_data();
     $title = sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('article link'));
     midcom::get('head')->set_pagetitle("{$this->_topic->extra}: {$title}");
     $this->add_breadcrumb("create/link/", sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('article link')));
 }