aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers/WikiController.php
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-02-15 17:06:09 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-02-15 17:06:09 +0000
commit4a27b517fc52dde60e5c1837860e4785317490a6 (patch)
tree73b91c5d212f1bb67eb83fea9694cf8d1a360846 /h-source/Application/Controllers/WikiController.php
parentd85570c9946aef61d8d935d9f50169215338d665 (diff)
improved wiki
Diffstat (limited to 'h-source/Application/Controllers/WikiController.php')
-rw-r--r--h-source/Application/Controllers/WikiController.php76
1 files changed, 73 insertions, 3 deletions
diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php
index 1c4c154..65a615a 100644
--- a/h-source/Application/Controllers/WikiController.php
+++ b/h-source/Application/Controllers/WikiController.php
@@ -100,6 +100,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..');
$deleted = $this->m['WikiModel']->select("wiki.deleted")->where(array("id_wiki"=>$clean['id_wiki']))->limit(1)->toList('wiki.deleted')->send();
@@ -161,7 +163,8 @@ class WikiController extends BaseController
$clean['title_clean'] = sanitizeAll($title_clean);
$data['isDeleted'] = 'no';
-
+ $data['isBlocked'] = false;
+
if (isset($title_clean))
{
$res = $this->m['WikiModel']->select()->where(array('title_clean'=>$clean['title_clean']))->orderBy('id_wiki desc')->limit(1)->send();
@@ -172,6 +175,7 @@ class WikiController extends BaseController
$data['tree_name'] = $res[0]['wiki']['title'];
$data['title'] = $res[0]['wiki']['title'] . ' - ' . Website::$generalName;
$data['isDeleted'] = $res[0]['wiki']['deleted'];
+ $data['isBlocked'] = $this->m['WikiModel']->isBlocked($res[0]['wiki']['id_wiki']);
if ( count($res) < 2 )
{
@@ -205,11 +209,14 @@ class WikiController extends BaseController
{
$this->redirect('wiki/page/'.$this->lang.'/Main-Page');
}
+
+ $data['md_javascript'] = "moderator_dialog(\"pageblock\",\"page\");moderator_dialog(\"pageunblock\",\"page\");";
$this->append($data);
$this->load($viewFile);
$this->load('bottom_left');
+ $this->load('moderator_dialog');
$this->right();
}
@@ -225,6 +232,7 @@ class WikiController extends BaseController
$clean['id'] = (int)$id;
$data['id'] = $clean['id'];
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($clean['id']);
+ $data['isBlocked'] = $this->m['WikiModel']->isBlocked($clean['id']);
$data['title'] = 'history - '.Website::$generalName;
@@ -285,6 +293,7 @@ class WikiController extends BaseController
if (count($data['table']) > 0)
{
$data['id_wiki'] = (int)$data['table'][0]['wiki_revisions']['id_wiki'];
+ $data['isDeleted'] = $this->m['WikiModel']->isDeleted($data['id_wiki']);
$data['tree_name'] = $this->m['WikiModel']->getTheModelName($data['id_wiki']);
$data['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; " . $this->getHistoryLink($data['id_wiki']) . " &raquo; ".gtext('Revision');
@@ -400,8 +409,9 @@ class WikiController extends BaseController
if ($this->s['registered']->status['status'] === 'logged')
{
-
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 (isset($_POST['confirmAction']))
{
@@ -442,6 +452,7 @@ class WikiController extends BaseController
$clean['id_wiki'] = (int)$id_wiki;
$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['tree'] = $this->getSpecPageLink() . " &raquo; " . $this->getViewLink($data['tree_name'])." &raquo; ".gtext('Talk');
if (isset($_POST['insertAction']))
@@ -449,6 +460,8 @@ class WikiController extends BaseController
if ($this->s['registered']->status['status'] === 'logged')
{
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..');
$this->m['WikitalkModel']->values['created_by'] = $this->s['registered']->status['id_user'];
$this->m['WikitalkModel']->values['id_wiki'] = $clean['id_wiki'];
@@ -476,7 +489,64 @@ class WikiController extends BaseController
$this->load('talk');
$this->load('moderator_dialog');
$this->right();
-// $this->loadViewAll('talk,moderator_dialog');
+ }
+
+ public function pages($lang = 'en')
+ {
+ $data['title'] = gtext('list of pages').' - '.Website::$generalName;
+
+ $this->setArgKeys(array('page:forceNat'=>1));
+
+ $this->shift(1);
+
+ $this->helper('Pages','wiki/pages/'.$this->lang,'page');
+
+ $this->m['WikiModel']->clear()->select()->where(array('-deleted'=>'no'))->orderBy('id_wiki desc');
+
+ $recordNumber = $this->m['WikiModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+
+ $this->m['WikiModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
+
+ $data['table'] = $this->m['WikiModel']->send();
+
+ $data['pageList'] = $this->h['Pages']->render($page-7,15);
+
+ $this->append($data);
+ $this->load('pages');
+ $this->right();
+ }
+
+ //print all the modifications to the wiki
+ public function modifications($lang = 'en')
+ {
+ $data['title'] = gtext('last modifications').' - '.Website::$generalName;
+
+ $this->setArgKeys(array('page:forceNat'=>1));
+
+ $this->shift(1);
+
+ $whereClauseArray = array(
+ 'gr' => 'registered',
+ 'type' => 'wiki',
+ );
+
+ $this->helper('Pages','wiki/modifications/'.$this->lang,'page');
+
+ $this->m['HistoryModel']->clear()->select()->where($whereClauseArray)->orderBy('id_history desc');
+
+ $recordNumber = $this->m['HistoryModel']->rowNumber();
+ $page = $this->viewArgs['page'];
+
+ $this->m['HistoryModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,30);
+
+ $data['table'] = $this->m['HistoryModel']->send();
+
+ $data['pageList'] = $this->h['Pages']->render($page-7,15);
+
+ $this->append($data);
+ $this->load('modifications');
+ $this->right();
}
protected function getViewLink($ne_name)