diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-18 00:17:07 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-18 00:17:07 +0000 |
commit | 0f42e1a7816893e083f49c933d1393a102a3510e (patch) | |
tree | 70ec94d02d098e75453d5961d9b6a9c0b77be469 /h-source/Application/Controllers/WikiController.php | |
parent | 265e0708d6eea9de98b36035fff1287a01221a00 (diff) |
improved wiki
Diffstat (limited to 'h-source/Application/Controllers/WikiController.php')
-rw-r--r-- | h-source/Application/Controllers/WikiController.php | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index 8e26454..a1b39ce 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -58,7 +58,10 @@ class WikiController extends BaseController //insert the new wiki page $this->m['WikiModel']->updateTable('insert'); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } } $data['notice'] = $this->m['WikiModel']->notice; @@ -114,7 +117,10 @@ class WikiController extends BaseController //carry out the update database action $this->m['WikiModel']->updateTable('update'); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } } $data['notice'] = $this->m['WikiModel']->notice; @@ -142,13 +148,13 @@ class WikiController extends BaseController } } - protected function viewRedirect($titleClean) - { - if ($this->m['WikiModel']->queryResult) - { - $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean); - } - } +// protected function viewRedirect($titleClean) +// { +// if ($this->m['WikiModel']->queryResult) +// { +// $this->redirect($this->controller.'/page/'.$this->lang.'/'.$titleClean); +// } +// } public function page($lang = 'en', $title_clean = null) { @@ -313,10 +319,11 @@ class WikiController extends BaseController $clean['id_rev'] = (int)$id_rev; $data['id_wiki'] = $clean['id_wiki']; - $tree_name = $this->m['WikiModel']->getTheModelName((int)$data['id_wiki']); + $tree_name = $this->m['WikiModel']->getTheModelName((int)$clean['id_wiki']); $data['tree_name'] = $tree_name; $data['tree'] = $this->getSpecPageLink() . " » " . $this->getViewLink($data['tree_name'])." » " . $this->getHistoryLink($data['id_wiki']) . " » ".gtext('Differences'); - + + $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']); $data['showDiff'] = false; $diffArray = array(); @@ -414,7 +421,10 @@ class WikiController extends BaseController { $this->m['WikiModel']->makeCurrent($clean['id_rev']); - $this->viewRedirect($this->m['WikiModel']->lastTitleClean); + if ($this->m['WikiModel']->queryResult) + { + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$this->m['WikiModel']->lastTitleClean); + } $data['notice'] = $this->m['WikiModel']->notice; } @@ -512,20 +522,31 @@ class WikiController extends BaseController $this->right(); } - public function deleted($lang = 'en') + protected function see($lang = 'en', $status = 'blocked') { $this->s['registered']->check('admin'); - $data['topString'] = 'list of deleted pages'; - $data['title'] = gtext('list of deleted pages').' - '.Website::$generalName; + switch ($status) + { + case 'deleted': + $data['topString'] = 'list of deleted pages'; + $data['title'] = gtext('list of deleted pages').' - '.Website::$generalName; + $whereClause = '-deleted'; + break; + case 'blocked': + $data['topString'] = 'list of blocked pages'; + $data['title'] = gtext('list of blocked pages').' - '.Website::$generalName; + $whereClause = 'blocked'; + break; + } $this->setArgKeys(array('page:forceNat'=>1)); $this->shift(1); - $this->helper('Pages','wiki/deleted/'.$this->lang,'page'); + $this->helper('Pages','wiki/'.$status.'/'.$this->lang,'page'); - $this->m['WikiModel']->clear()->select()->where(array('-deleted'=>'yes'))->orderBy('id_wiki desc'); + $this->m['WikiModel']->clear()->select()->where(array($whereClause=>'yes'))->orderBy('id_wiki desc'); $recordNumber = $this->m['WikiModel']->rowNumber(); $page = $this->viewArgs['page']; @@ -541,6 +562,16 @@ class WikiController extends BaseController $this->right(); } + public function deleted($lang = 'en') + { + $this->see($lang,'deleted'); + } + + public function blocked($lang = 'en') + { + $this->see($lang,'blocked'); + } + //print all the modifications to the wiki public function modifications($lang = 'en') { |