From a855ea347f8668cefb04360b2d7158d8939e07ac Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Fri, 18 Feb 2011 02:19:48 +0000 Subject: improved wiki --- .../Application/Controllers/UsersController.php | 3 +- .../Application/Controllers/WikiController.php | 5 +- h-source/Application/Include/myFunctions.php | 8 +- h-source/Application/Models/WikiModel.php | 10 ++- h-source/Application/Views/Wiki/page.php | 88 +++++++++++----------- 5 files changed, 62 insertions(+), 52 deletions(-) (limited to 'h-source') diff --git a/h-source/Application/Controllers/UsersController.php b/h-source/Application/Controllers/UsersController.php index 4fa078b..95addf4 100644 --- a/h-source/Application/Controllers/UsersController.php +++ b/h-source/Application/Controllers/UsersController.php @@ -76,7 +76,8 @@ class UsersController extends BaseController case 'accepted': if (strcmp($redirect,'') !== 0) { - $this->redirect($redirect,0); + $redirect = html_entity_decode($redirect,ENT_QUOTES,DEFAULT_CHARSET); + header('Location: http://'.DOMAIN_NAME."/".$redirect); } else { diff --git a/h-source/Application/Controllers/WikiController.php b/h-source/Application/Controllers/WikiController.php index a1b39ce..8f389e5 100644 --- a/h-source/Application/Controllers/WikiController.php +++ b/h-source/Application/Controllers/WikiController.php @@ -139,7 +139,7 @@ class WikiController extends BaseController } else { - $this->redirect("users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".encodeUrl($title),0); + header('Location: http://'.DOMAIN_NAME."/users/login/".$this->lang."?redirect=".$this->controller."/page/".$this->lang."/".titleForRedirect($title)); } } else @@ -198,7 +198,8 @@ class WikiController extends BaseController { $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)); + $n = titleForRedirect($newTitle); + header('Location: http://'.DOMAIN_NAME.'/wiki/page/'.$this->lang.'/'.$n); } else { diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 6b87958..d0d51bf 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -30,8 +30,7 @@ function encodeUrl($url) $url = str_replace(')','-',$url); $url = str_replace('/','-',$url); $url = str_replace('@','-at-',$url); - $url = str_replace('#','-at-',$url); - $url = str_replace('?','-at-',$url); + $url = str_replace('?','-',$url); // $temp = null; // for ($i=0;$istrongConditions['insert'] = array( "checkLength|99" => 'title|'.gtext('title is too length'), + "+checkNotEmpty" => 'page', "+checkLength|9000" => 'page|'.gtext('the page text is too length'), ); $this->strongConditions['update'] = array( "checkLength|99" => 'title|'.gtext('title is too length'), + "+checkNotEmpty" => 'page', "+checkLength|9000" => 'page|'.gtext('the page text is too length'), ); @@ -95,8 +97,8 @@ class WikiModel extends Model_Map { $clean['id'] = $resId[0]['wiki']['id_wiki']; $this->lastId = $clean['id']; $this->lastTitle = $resId[0]['wiki']['title']; - $this->lastTitleClean = encodeUrl($resId[0]['wiki']['title']); - $this->db->update('wiki','title_clean',array($this->lastTitleClean),'id_wiki='.$clean['id']); + $this->lastTitleClean = titleForRedirect($resId[0]['wiki']['title']); + $this->db->update('wiki','title_clean',array(encodeUrl($resId[0]['wiki']['title'])),'id_wiki='.$clean['id']); //update the history table $this->updateHistory('insert'); @@ -138,7 +140,7 @@ class WikiModel extends Model_Map { { $this->lastId = $clean['id']; $this->lastTitle = $this->values['title']; - $this->lastTitleClean = $this->values['title_clean']; + $this->lastTitleClean = html_entity_decode($this->values['title_clean'],ENT_QUOTES,DEFAULT_CHARSET); //update the history table $this->updateHistory('update'); @@ -190,7 +192,7 @@ class WikiModel extends Model_Map { { $this->lastId = $clean['id_wiki']; $this->lastTitle = $this->values['title']; - $this->lastTitleClean = $this->values['title_clean']; + $this->lastTitleClean = html_entity_decode($this->values['title_clean'],ENT_QUOTES,DEFAULT_CHARSET); //update the history table $this->updateHistory('update'); diff --git a/h-source/Application/Views/Wiki/page.php b/h-source/Application/Views/Wiki/page.php index da5b9d5..c0cfa8b 100644 --- a/h-source/Application/Views/Wiki/page.php +++ b/h-source/Application/Views/Wiki/page.php @@ -85,9 +85,7 @@ - - - + action,'revision') === 0) { ?> @@ -99,8 +97,10 @@
- - + action,'page') === 0 ) { ?> + + +
@@ -112,57 +112,59 @@
- - -
- - + action,'page') === 0 ) { ?> + + +
+ + - "> + "> - + - "> + "> - + - -
-
page
- ">view details -
-
+ +
+
page
+ ">view details +
+
-
- +
+ - - -
- - + + +
+ + - "> + "> - + - "> + "> - + - -
-
page_del
- ">view details -
- -
- + +
+
page_del
+ ">view details +
+ +
+ +
+ +
- -
-
-
+
+ -- cgit v1.2.3