Exemple #1
0
 function action()
 {
     switch ($_REQUEST['page_op']) {
         case 'edit':
             $template['TITLE'] = dgettext('wiki', 'Edit') . ' ' . $this->getTitle();
             $template['CONTENT'] = $this->edit();
             break;
         case 'save':
             $template['TITLE'] = dgettext('wiki', 'Edit') . ' ' . $this->getTitle();
             $template['CONTENT'] = $this->post();
             break;
         case 'delete':
             $template['TITLE'] = dgettext('wiki', 'Delete') . ' ' . $this->getTitle();
             $template['CONTENT'] = $this->kill();
             break;
         case 'raw':
             Header('Content-type: text/plain');
             echo $this->getPagetext(FALSE);
             exit;
             break;
         case 'print':
             Layout::nakedDisplay($this->view());
             break;
         case 'history':
             $template['TITLE'] = $this->getTitle();
             $template['CONTENT'] = $this->history();
             break;
         case 'viewold':
             PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
             $oldpage = new OldWikiPage($_REQUEST['id']);
             $template['TITLE'] = $this->getTitle();
             $template['CONTENT'] = $oldpage->view();
             break;
         case 'restore':
             PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
             $oldpage = new OldWikiPage($_REQUEST['id']);
             $oldpage->restore($this->hits);
             /* Does not return */
             break;
         case 'removeold':
             PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
             $oldpage = new OldWikiPage($_REQUEST['id']);
             $oldpage->remove();
             /* Does not return */
             break;
         case 'compare':
             PHPWS_Core::initModClass('wiki', 'WikiDiff.php');
             $wikiDiff = new WikiDiff(PHPWS_Settings::get('wiki', 'diff_type'));
             $template['TITLE'] = $this->getTitle();
             $template['CONTENT'] = $wikiDiff->diff($_REQUEST['oVer'], $_REQUEST['nVer']);
             break;
         case 'whatlinkshere':
             $template['TITLE'] = $this->getTitle();
             $template['CONTENT'] = $this->whatLinksHere();
             break;
         case 'move':
             $template['TITLE'] = dgettext('wiki', 'Move') . ' ' . $this->getTitle();
             $template['CONTENT'] = $this->move();
             break;
         case 'do_move':
             /* Function never returns: user will be redirected to new page. */
             $this->doMove();
             break;
         case 'discussion':
             $template['TITLE'] = $this->getTitle() . ' ' . dgettext('wiki', 'Discussion');
             $template['CONTENT'] = $this->discussion();
             break;
         case 'togglelock':
             $this->toggleLock();
             PHPWS_Core::goBack();
             break;
         default:
             $this->incHits();
             $template['TITLE'] = $this->getTitle();
             $template['CONTENT'] = $this->view();
             $template['CATEGORIES'] = $this->getCategories();
     }
     Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
 }