aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/BaseController.php1
-rw-r--r--h-source/Application/Controllers/WikiController.php55
2 files changed, 39 insertions, 17 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 0f7c532..29d0642 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -38,6 +38,7 @@ class BaseController extends Controller
"news" => null,
"download" => null,
"help" => null,
+ "wiki" => null,
);
public function __construct($model, $controller, $queryString) {
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 2ddc54d..1c4c154 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -24,6 +24,9 @@ class WikiController extends BaseController
{
public function __construct($model, $controller, $queryString) {
+
+ $this->_topMenuClasses['wiki'] = " class='currentitem'";
+
parent::__construct($model, $controller, $queryString);
$this->model('UsersModel');
@@ -158,33 +161,51 @@ class WikiController extends BaseController
$clean['title_clean'] = sanitizeAll($title_clean);
$data['isDeleted'] = 'no';
-
- $res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->send();
- if ( count($res) > 0 )
+ if (isset($title_clean))
{
- $data['table'] = $res;
- $data['tree_name'] = $res[0]['wiki']['title'];
- $data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
- $data['isDeleted'] = $res[0]['wiki']['deleted'];
-
- if ( count($res) < 2 )
+ $res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_wiki desc')->limit(1)->send();
+
+ if ( count($res) > 0 )
{
- $data['talk_number'] = $this->m['WikitalkModel']->select('count(*) as numb,id_wiki')->where(array('id_wiki'=>$res[0]['wiki']['id_wiki'],'deleted'=>'no'))->rowNumber();
-
- $viewFile = 'page';
- $data['id_wiki'] = $res[0]['wiki']['id_wiki'];
+ $data['table'] = $res;
+ $data['tree_name'] = $res[0]['wiki']['title'];
+ $data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
+ $data['isDeleted'] = $res[0]['wiki']['deleted'];
+
+ if ( count($res) < 2 )
+ {
+ $data['talk_number'] = $this->m['WikitalkModel']->select('count(*) as numb,id_wiki')->where(array('id_wiki'=>$res[0]['wiki']['id_wiki'],'deleted'=>'no'))->rowNumber();
+
+ $viewFile = 'page';
+ $data['id_wiki'] = $res[0]['wiki']['id_wiki'];
+ }
+ else
+ {
+ $viewFile = 'select';
+ }
}
else
{
- $viewFile = 'select';
+ $rev = new WikirevisionsModel();
+ $res_rev = $rev->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_rev desc')->limit(1)->send();
+ if ( count($res_rev) > 0 )
+ {
+ $clean['idWiki'] = $rev->getIdPage($res_rev[0]['wiki_revisions']['id_rev']);
+ $newTitle = $this->m['WikiModel']->getTheModelName($clean['idWiki']);
+ $this->redirect('wiki/page/'.$this->lang.'/'.encodeUrl($newTitle));
+ }
+ else
+ {
+ $viewFile = 'not_found';
+ }
}
}
else
{
- $viewFile = 'not_found';
+ $this->redirect('wiki/page/'.$this->lang.'/Main-Page');
}
-
+
$this->append($data);
$this->load($viewFile);
@@ -470,7 +491,7 @@ class WikiController extends BaseController
protected function getSpecPageLink()
{
- return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang."'>".$this->controller."</a>";
+ return "<a href='".$this->baseUrl.'/'.$this->controller.'/page/'.$this->lang."/Main-Page'>".ucfirst($this->controller)."</a>";
}
} \ No newline at end of file