"; print_r($pages); echo ""; echo "pageCount ".$pageCount."
"; print_r($this -> pageTitles); echo ""; + echo "
"; print_r($this->pageTitles); echo ""; } } } function pageIndex() { - global $tp,$pref; - $itext = ''; - if(isset($pref['old_np']) && $pref['old_np']) - { - $count = 0; - foreach($this -> pageTitles as $title) - { - if (!$count) { $itext = "
";
- if ($ratearray = $rater->getrating("page", $this -> pageID))
+ if ($ratearray = $rater->getrating("page", $this->pageID))
{
if ($ratearray[2] == "")
{
$ratearray[2] = 0;
}
- $rate_text .= "![]() ![]() | ";
- if (!$rater->checkrated("page", $this -> pageID) && USER)
+ if (!$rater->checkrated("page", $this->pageID) && USER)
{
- $rate_text .= $rater->rateselect(" ".LAN_PAGE_4."", "page", $this -> pageID);
+ $rate_text .= $rater->rateselect(" ".LAN_PAGE_4."", "page", $this->pageID);
}
else if(!USER)
{
@@ -366,8 +465,6 @@ class pageClass
function pageComment($page_comment_flag)
{
- global $sql, $ns, $e107cache, $tp, $comment_shortcodes,$cacheString;
-
if($page_comment_flag)
{
require_once(e_HANDLER."comment_class.php");
@@ -375,11 +472,12 @@ class pageClass
if (isset($_POST['commentsubmit']))
{
- $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "page", $this -> pageID, $pid, $_POST['subject']);
- $e107cache->clear("comment.page.".$this -> pageID);
- $e107cache->clear($cacheString);
+ $cobj->enter_comment($_POST['author_name'], $_POST['comment'], "page", $this->pageID, $pid, $_POST['subject']);
+ $e107cache = e107::getCache();
+ $e107cache->clear("comment.page.".$this->pageID);
+ $e107cache->clear($this->cacheString);
}
- return $cobj->compose_comment("page", "comment", $this -> pageID, 0, $this -> title);
+ return $cobj->compose_comment("page", "comment", $this->pageID, 0, $this->title, false, true);
}
}
@@ -390,80 +488,64 @@ class pageClass
if (!check_class($page_class))
{
- 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
- message_handler("MESSAGE", LAN_PAGE_6);
- require_once(FOOTERF); exit;
+ $this->authorized = 'class';
+ return false;
}
if (!$page_password)
{
- return TRUE;
+ $this->authorized = true;
+ $cookiename = $this->getCookieName();
+ if(isset($_COOKIE[$cookiename])) cookie($cookiename, '', (time() - 2592000));
+ return true;
}
if(isset($_POST['submit_page_pw']))
{
if($_POST['page_pw'] == $page_password)
{
- $this -> setPageCookie();
+ $this->setPageCookie();
+ $this->authorized = true;
+ return true;
+ }
+ else
+ {
+ e107::getMessage()->addError(LAN_PAGE_7);
}
}
else
{
- $cookiename = "e107page_".$this -> pageID;
+ // TODO - e_COOKIE
+ $cookiename = $this->getCookieName();
if(isset($_COOKIE[$cookiename]) && ($_COOKIE[$cookiename] == md5($page_password.USERID)))
{
+ $this->authorized = true;
return TRUE;
}
// Invalid/empty password here
}
+
+ $this->authorized = 'pw';
+ return false;
+ }
- 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
-
- // Need to prompt for password here
- if (isset($_POST['submit_page_pw']))
- {
- message_handler("MESSAGE", LAN_PAGE_7); // Invalid password
- }
-
- $pw_entry_text = "
-
-
-
- ";
- // Mustn't return to higher level code here
-
- $ns->tablerender($page_title, $pw_entry_text,"cpage_pw"); // HEADERF also clears $text - hence different variable
- require_once(FOOTERF);
- exit;
+ function getCookieName()
+ {
+ return e_COOKIE.'_page_'.$this->pageID;
}
function setPageCookie()
{
- global $pref;
+ if(!$this->pageID || !vartrue($_POST['page_pw'])) return;
+ $pref = e107::getPref();
+
$pref['pageCookieExpire'] = max($pref['pageCookieExpire'], 120);
$hash = md5($_POST['page_pw'].USERID);
- cookie("e107page_".e_QUERY, $hash, (time() + $pref['pageCookieExpire']));
- header("location:".e_SELF."?".e_QUERY);
- exit;
+
+ cookie($this->getCookieName(), $hash, (time() + $pref['pageCookieExpire']));
+ //header("location:".e_SELF."?".e_QUERY);
+ //exit;
}
}
|