1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-04 21:57:51 +02:00

Bug #3136 - page formatting better on password error. Also, doesn't cache password protected files pending a better solution when cache handling improved.

This commit is contained in:
e107steved
2006-12-22 20:51:32 +00:00
parent 64c78857b6
commit 87f59042ff

View File

@@ -11,9 +11,10 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/page.php,v $ | $Source: /cvs_backup/e107_0.8/page.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2006-12-07 17:47:20 $ - mods to make password protected pages work | $Date: 2006-12-22 20:51:32 $
| $Author: sweetas $ | $Author: e107steved $
|
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -52,7 +53,6 @@ else
} }
else else
{ {
$tmp = $page -> showPage(); $tmp = $page -> showPage();
define("e_PAGETITLE", $tmp['title']); define("e_PAGETITLE", $tmp['title']);
require_once(HEADERF); require_once(HEADERF);
@@ -62,12 +62,20 @@ else
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
if ($tmp['cachecontrol'] == TRUE)
{
ob_start(); ob_start();
$ns -> tablerender($tmp['title'], $tmp['text']); $ns -> tablerender($tmp['title'], $tmp['text']);
$cache_data = ob_get_flush(); $cache_data = ob_get_flush();
$e107cache->set($cacheString, $cache_data); $e107cache->set($cacheString, $cache_data);
$e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']); $e107cache->set($cachePageTitle, $tmp['title']."^".$tmp['comment_flag']);
$comment_flag = $tmp['comment_flag']; $comment_flag = $tmp['comment_flag'];
}
else
{
$ns -> tablerender($tmp['title'], $tmp['text']);
$comment_flag = $tmp['comment_flag'];
}
} }
if($com = $page -> pageComment($comment_flag)) if($com = $page -> pageComment($comment_flag))
@@ -83,15 +91,15 @@ require_once(FOOTERF);
class pageClass class pageClass
{ {
var $bullet; /* bullet image */ var $bullet; /* bullet image */
var $pageText; /* main text of selected page, not parsed */ var $pageText; /* main text of selected page, not parsed */
var $multipageFlag; /* flag - true if multiple page page, false if not */ var $multipageFlag; /* flag - true if multiple page page, false if not */
var $pageTitles; /* array containing page titles */ var $pageTitles; /* array containing page titles */
var $pageID; /* id number of page to be displayed */ var $pageID; /* id number of page to be displayed */
var $pageSelected; /* selected page of multiple page page */ var $pageSelected; /* selected page of multiple page page */
var $pageToRender; /* parsed page to be sent to screen */ var $pageToRender; /* parsed page to be sent to screen */
var $debug; /* temp debug flag */ var $debug; /* temp debug flag */
var $title; /* title of page, it if has one (as defined in [newpage=title] tag */ var $title; /* title of page, it if has one (as defined in [newpage=title] tag */
function pageClass($debug=FALSE) function pageClass($debug=FALSE)
@@ -172,7 +180,7 @@ class pageClass
$this -> pageText = $page_text; $this -> pageText = $page_text;
$this -> pageCheckPerms($page_class, $page_password); $this -> pageCheckPerms($page_class, $page_password, $page_title);
if($this -> debug) if($this -> debug)
{ {
@@ -201,6 +209,7 @@ class pageClass
$ret['text'] = $text; $ret['text'] = $text;
$ret['comment_flag'] = $page_comment_flag; $ret['comment_flag'] = $page_comment_flag;
$ret['err'] = FALSE; $ret['err'] = FALSE;
$ret['cachecontrol'] = (isset($page_password) && !$page_password); // Don't cache password protected pages
return $ret; return $ret;
} }
@@ -285,7 +294,6 @@ class pageClass
function pageRating($page_rating_flag) function pageRating($page_rating_flag)
{ {
global $imode;
if($page_rating_flag) if($page_rating_flag)
{ {
require_once(e_HANDLER."rate_class.php"); require_once(e_HANDLER."rate_class.php");
@@ -298,7 +306,7 @@ class pageClass
{ {
$ratearray[2] = 0; $ratearray[2] = 0;
} }
$rate_text .= "<img src='".e_IMAGE."packs/".$imode."/rate/box/box".$ratearray[1].".png' alt='' style='vertical-align:middle;' />\n"; $rate_text .= "<img src='".e_IMAGE."rate/box/box".$ratearray[1].".png' alt='' style='vertical-align:middle;' />\n";
$rate_text .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;"; $rate_text .= "&nbsp;".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]."&nbsp;";
$rate_text .= ($ratearray[0] == 1 ? "vote" : "votes"); $rate_text .= ($ratearray[0] == 1 ? "vote" : "votes");
} }
@@ -345,9 +353,13 @@ class pageClass
} }
} }
function pageCheckPerms($page_class, $page_password) function pageCheckPerms($page_class, $page_password, $page_title="&nbsp;")
{ {
global $ns, $tp, $HEADER, $FOOTER, $sql, $imode; global $ns, $tp, $HEADER, $FOOTER, $sql; // $tp added
define("e_PAGETITLE", $page_title);
// HEADERF requires that $tp is defined - hence declared as global above.
require_once(HEADERF); // Do header now in case wrong password was entered
if (!check_class($page_class)) if (!check_class($page_class))
{ {
@@ -375,11 +387,14 @@ class pageClass
{ {
return TRUE; return TRUE;
} }
// Invalid/empty password here
} }
// Need to prompt for password here
if ($_POST['submit_page_pw']) if ($_POST['submit_page_pw'])
{ {
message_handler("MESSAGE", LAN_PAGE_7); message_handler("MESSAGE", LAN_PAGE_7); // Invalid password
} }
$pw_entry_text = " $pw_entry_text = "
@@ -392,7 +407,7 @@ class pageClass
<tr> <tr>
<td class='forumheader3' style='width:20%;'>".LAN_PAGE_9.":</td> <td class='forumheader3' style='width:20%;'>".LAN_PAGE_9.":</td>
<td class='forumheader3' style='width: 60%;'><input type='password' id='page_pw' name='page_pw' style='width: 90%;'/></td> <td class='forumheader3' style='width: 60%;'><input type='password' id='page_pw' name='page_pw' style='width: 90%;'/></td>
<td class='forumheader3' style='width:20%; vertical-align:middle; margin-left:auto; margin-right:auto; text-align:center;'><img src='".e_IMAGE."packs/".$imode."/generic/password.png' alt='' /></td> <td class='forumheader3' style='width:20%; vertical-align:middle; margin-left:auto; margin-right:auto; text-align:center;'><img src='".e_IMAGE."generic/".IMODE."/password.png' alt='' /></td>
</tr> </tr>
<tr> <tr>
<td class='forumheader' colspan='3' style='text-align:center;'><input class='button' type='submit' name='submit_page_pw' value='".LAN_PAGE_10."' /></td> <td class='forumheader' colspan='3' style='text-align:center;'><input class='button' type='submit' name='submit_page_pw' value='".LAN_PAGE_10."' /></td>
@@ -403,9 +418,7 @@ class pageClass
"; ";
// Mustn't return to higher level code here // Mustn't return to higher level code here
// HEADERF requires that $tp is defined - hence declared as global above. $ns->tablerender($page_title, $pw_entry_text); // HEADERF also clears $text - hence different variable
require_once(HEADERF);
$ns->tablerender("&nbsp;", $pw_entry_text); // HEADERF also clears $text - hence different variable
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }