aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers/WikiController.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers/WikiController.php')
-rw-r--r--h-source/Application/Controllers/WikiController.php80
1 files changed, 37 insertions, 43 deletions
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 65a615a..cc0c922 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -102,39 +102,34 @@ class WikiController extends BaseController
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
$deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
- if (strcmp($deleted[0],'no') === 0)
+ $data['tree_name'] = $title;
+
+ if (isset($_POST['updateAction']))
{
- $data['tree_name'] = $title;
+ //carry out the update database action
+ $this->m['WikiModel']->updateTable('update');
- if (isset($_POST['updateAction']))
- {
- //carry out the update database action
- $this->m['WikiModel']->updateTable('update');
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+ }
- $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
- }
-
- $data['notice'] = $this->m['WikiModel']->notice;
-
- $data['id_wiki'] = $clean['id_wiki'];
- $data['submitName'] = "updateAction";
+ $data['notice'] = $this->m['WikiModel']->notice;
- $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
- $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
-
- $this->append($data);
+ $data['id_wiki'] = $clean['id_wiki'];
+ $data['submitName'] = "updateAction";
- $this->load('form');
- $this->load('bottom_left');
- $this->right();
- }
- else
- {
- $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
- }
+ $data['values'] = $this->m['WikiModel']->getFormValues('update','sanitizeHtml');
+ $data['hiddenInput'] = "<input type='hidden' name='id_wiki' value='".$clean['id_wiki']."'>\n";
+
+ $this->append($data);
+
+ $this->load('form');
+ $this->load('bottom_left');
+ $this->right();
}
else
{
@@ -162,7 +157,7 @@ class WikiController extends BaseController
$data['title'] = 'main page - '.Website::$generalName;
$clean['title_clean'] = sanitizeAll($title_clean);
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
$data['isBlocked'] = false;
if (isset($title_clean))
@@ -174,7 +169,7 @@ class WikiController extends BaseController
$data['table'] = $res;
$data['tree_name'] = $res[0]['wiki']['title'];
$data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
- $data['isDeleted'] = $res[0]['wiki']['deleted'];
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($res[0]['wiki']['id_wiki']);;
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($res[0]['wiki']['id_wiki']);
if ( count($res) < 2 )
@@ -233,6 +228,7 @@ class WikiController extends BaseController
$data['id'] = $clean['id'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id']);
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id']);
$data['title'] = 'history - '.Website::$generalName;
@@ -288,7 +284,7 @@ class WikiController extends BaseController
$data['tree'] = null;
$data['tree'] = null;
$data['title'] = 'revision - '.Website::$generalName;
- $data['isDeleted'] = 'no';
+ $data['isDeleted'] = false;
if (count($data['table']) > 0)
{
@@ -394,9 +390,8 @@ class WikiController extends BaseController
if ($clean['id_wiki'] !== 0)
{
- $deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
-
- $data['isDeleted'] = $deleted[0];
+
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
$data['id_rev'] = $clean['id_rev'];
$data['id_wiki'] = $clean['id_wiki'];
@@ -412,21 +407,16 @@ class WikiController extends BaseController
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
if (isset($_POST['confirmAction']))
{
- if (strcmp($deleted[0],'no') === 0)
- {
- $this->m['WikiModel']->makeCurrent($clean['id_rev']);
-
- $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
-
- $data['notice'] = $this->m['WikiModel']->notice;
- }
- else
- {
- $this->redirect($this->controller.'/page/'.$this->lang,2,'deleted..');
- }
+ $this->m['WikiModel']->makeCurrent($clean['id_rev']);
+
+ $this->viewRedirect($this->m['WikiModel']->lastTitleClean);
+
+ $data['notice'] = $this->m['WikiModel']->notice;
}
$this->append($data);
@@ -453,6 +443,8 @@ class WikiController extends BaseController
$data['id_wiki'] = $clean['id_wiki'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id_wiki']);
$data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id_wiki']);
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($clean['id_wiki']);
+
$data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
if (isset($_POST['insertAction']))
@@ -462,6 +454,8 @@ class WikiController extends BaseController
if ($this->m['UsersModel']->isBlocked($this->s['registered']->status['id_user'])) $this->redirect('my/home/'.$this->lang,2,'your account has been blocked..');
if ($this->m['WikiModel']->isBlocked($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been blocked..');
+
+ if ($this->m['WikiModel']->isDeleted($clean['id_wiki'])) $this->redirect('wiki/page/'.$this->lang,2,'this page has been deleted..');
$this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];