aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application')
-rw-r--r--h-source/Application/Controllers/UsersController.php3
-rw-r--r--h-source/Application/Controllers/WikiController.php5
-rw-r--r--h-source/Application/Include/myFunctions.php8
-rw-r--r--h-source/Application/Models/WikiModel.php10
-rw-r--r--h-source/Application/Views/Wiki/page.php88
5 files changed, 62 insertions, 52 deletions
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;$i<strlen($url); $i++)
@@ -51,6 +50,11 @@ function encodeUrl($url)
return $url;
}
+function titleForRedirect($title)
+{
+ return html_entity_decode(encodeUrl($title),ENT_QUOTES,DEFAULT_CHARSET);
+}
+
// function encodeUrl($url)
// {
// $url = str_replace(' ','-',$url);
diff --git a/h-source/Application/Models/WikiModel.php b/h-source/Application/Models/WikiModel.php
index 2ee7505..3e768d3 100644
--- a/h-source/Application/Models/WikiModel.php
+++ b/h-source/Application/Models/WikiModel.php
@@ -53,11 +53,13 @@ class WikiModel extends Model_Map {
$this->strongConditions['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 @@
<?php echo gtext('This wiki page has been deleted'); ?>
</div>
- <?php } ?>
-
- <?php if (!$isDeleted) { ?>
+ <?php } else { ?>
<!--if revision-->
<?php if (strcmp($this->action,'revision') === 0) { ?>
@@ -99,8 +97,10 @@
<?php foreach ($table as $page) { ?>
<div class="wiki_page_title">
<?php echo $page[$tableName]['title']?>
- <?php if ($isBlocked) { ?>
- <span class="blocked_notice"><?php echo gtext('This wiki page has been blocked'); ?></span>
+ <?php if ( strcmp($this->action,'page') === 0 ) { ?>
+ <?php if ($isBlocked) { ?>
+ <span class="blocked_notice"><?php echo gtext('This wiki page has been blocked'); ?></span>
+ <?php } ?>
<?php } ?>
</div>
<div class="wiki_page_content">
@@ -112,57 +112,59 @@
</div>
- <!--block the page-->
- <?php if ($isadmin) { ?>
- <div class="moderator_box">
- <?php if ($isBlocked) { ?>
- <?php echo gtext('This wiki page has been blocked'); ?>
+ <?php if ( strcmp($this->action,'page') === 0 ) { ?>
+ <!--block the page-->
+ <?php if ($isadmin) { ?>
+ <div class="moderator_box">
+ <?php if ($isBlocked) { ?>
+ <?php echo gtext('This wiki page has been blocked'); ?>
- <a id="<?php echo $id_wiki;?>" class="pageunblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/unlock.png"><?php echo gtext('unblock the wiki page'); ?></a>
+ <a id="<?php echo $id_wiki;?>" class="pageunblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/unlock.png"><?php echo gtext('unblock the wiki page'); ?></a>
- <?php } else { ?>
+ <?php } else { ?>
- <a id="<?php echo $id_wiki;?>" class="pageblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/lock.png"><?php echo gtext('block the wiki page'); ?></a>
+ <a id="<?php echo $id_wiki;?>" class="pageblock_page block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/lock.png"><?php echo gtext('block the wiki page'); ?></a>
- <?php } ?>
+ <?php } ?>
- <!--view details-->
- <div class="show_hidden_box_ext">
- <div class="md_type">page</div>
- <a id="<?php echo $id_wiki;?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
- <div class="moderation_details_box"></div>
- </div>
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">page</div>
+ <a id="<?php echo $id_wiki;?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+ <div class="moderation_details_box"></div>
+ </div>
- </div>
- <?php } ?>
+ </div>
+ <?php } ?>
- <!--delete the page-->
- <?php if ($isadmin) { ?>
- <div class="moderator_box_deleted">
- <?php if ($isDeleted) { ?>
- <?php echo gtext('This wiki page has been deleted'); ?>
+ <!--delete the page-->
+ <?php if ($isadmin) { ?>
+ <div class="moderator_box_deleted">
+ <?php if ($isDeleted) { ?>
+ <?php echo gtext('This wiki page has been deleted'); ?>
- <a id="<?php echo $id_wiki;?>" class="pageshow_page_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('restore the wiki page'); ?></a>
+ <a id="<?php echo $id_wiki;?>" class="pageshow_page_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('restore the wiki page'); ?></a>
- <?php } else { ?>
+ <?php } else { ?>
- <a id="<?php echo $id_wiki;?>" class="pagehide_page_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png"><?php echo gtext('delete the wiki page'); ?></a>
+ <a id="<?php echo $id_wiki;?>" class="pagehide_page_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png"><?php echo gtext('delete the wiki page'); ?></a>
- <?php } ?>
+ <?php } ?>
- <!--view details-->
- <div class="show_hidden_box_ext">
- <div class="md_type">page_del</div>
- <a id="<?php echo $id_wiki;?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
- <div class="details_of_hidden_message">
- <?php foreach ($table as $page) { ?>
- <div class="wiki_page_content">
- <?php echo decodeWikiText($page[$tableName]['page'])?>
+ <!--view details-->
+ <div class="show_hidden_box_ext">
+ <div class="md_type">page_del</div>
+ <a id="<?php echo $id_wiki;?>" class="hidden_message_view_details" href="<?php echo $this->baseUrl."/home/index/$lang";?>">view details</a>
+ <div class="details_of_hidden_message">
+ <?php foreach ($table as $page) { ?>
+ <div class="wiki_page_content">
+ <?php echo decodeWikiText($page[$tableName]['page'])?>
+ </div>
+ <?php } ?>
+ <div class="moderation_details_box"></div>
</div>
- <?php } ?>
- <div class="moderation_details_box"></div>
</div>
- </div>
- </div>
+ </div>
+ <?php } ?>
<?php } ?>