Permalink
Browse files

-Lots of small bug fixes

  • Loading branch information...
1 parent 6e5fed0 commit c583e3df306aaf6f269768a461b4851b6642eed2 @Finalfantasykid committed Aug 20, 2011
@@ -7,7 +7,6 @@
function ContentBlock($name, $editLink=null){
global $out;
- $out->setTitle($name);
$this->name = $name.$editLink;
}
@@ -8,7 +8,7 @@ class ContentPage extends ContentBlock{
var $date;
function ContentPage($name_id){
- global $db, $parser, $me;
+ global $db, $parser, $me, $out;
if($_GET['edit'] == true && $me->isStaff()){
$parser->parserOn = false;
}
@@ -14,6 +14,10 @@
define('HOOK_AFTER_FOOTER', 'After Footer');
define('HOOK_BEFORE_CATEGORY', 'Before Category');
define('HOOK_AFTER_CATEGORY', 'After Category');
+define('HOOK_BEFORE_MENU_ITEM', 'Before Menu Item');
+define('HOOK_AFTER_MENU_ITEM', 'After Menu Item');
+define('HOOK_BEFORE_MENU_CATEGORIES', 'Before Menu Categories');
+define('HOOK_AFTER_MENU_CATEGORIES', 'After Menu Categories');
define('HOOK_UNKNOWN_PAGE', 'Unknown Page');
define('HOOK_THEME_VARS', 'Theme Vars');
define('HOOK_AFTER_STYLE', 'After Style');
@@ -42,6 +46,10 @@ function HookProcessor(){
$this->hooks[HOOK_AFTER_FOOTER] = array();
$this->hooks[HOOK_BEFORE_CATEGORY] = array();
$this->hooks[HOOK_AFTER_CATEGORY] = array();
+ $this->hooks[HOOK_BEFORE_MENU_ITEM] = array();
+ $this->hooks[HOOK_AFTER_MENU_ITEM] = array();
+ $this->hooks[HOOK_BEFORE_MENU_CATEGORIES] = array();
+ $this->hooks[HOOK_AFTER_MENU_CATEGORIES] = array();
$this->hooks[HOOK_UNKNOWN_PAGE] = array();
$this->hooks[HOOK_THEME_VARS] = array();
$this->hooks[HOOK_AFTER_STYLE] = array();
@@ -97,7 +97,12 @@ static function uploadImage($file, $page, $title){
function ImagePage($name_id){
global $db, $me;
$this->name_id = $name_id;
- $page = max(1, $_GET['p']);
+ if(isset($_GET['p'])){
+ $page = max(1, $_GET['p']);
+ }
+ else{
+ $page = 1;
+ }
$id = ($page-1)*36;
$sql = "SELECT COUNT(*) as count, name
@@ -128,7 +133,7 @@ function ImagePage($name_id){
}
}
- if($me->isStaff() && $_GET['edit'] != true){
+ if($me->isStaff() && (!isset($_GET['edit']) || $_GET['edit'] != true)){
$editLink = "&nbsp;&nbsp;<a class='light' href='index.php?page=media&amp;name_id={$_GET['name_id']}&amp;edit=true'>[Edit]</a>";
}
@@ -160,7 +165,7 @@ function updatePage(){
function generateBody(){
global $db, $me, $fullURL, $parser;
if($this->created){
- if($_GET['delete'] != null && $me->isStaff()){
+ if(isset($_GET['delete']) && $me->isStaff()){
$status = $this->deleteImage();
if($status){
$url = str_ireplace("&delete={$_GET['delete']}", "", $fullURL);
@@ -175,7 +180,7 @@ function generateBody(){
return false;
}
}
- else if($_GET['update'] == true && $_POST['submit'] == "Update Page" && $me->isStaff()){
+ else if(isset($_GET['update']) && $_GET['update'] == true && isset($_POST['submit']) && $_POST['submit'] == "Update Page" && $me->isStaff()){
$status = $this->updatePage();
if($status){
@@ -191,7 +196,7 @@ function generateBody(){
return false;
}
}
- else if($_GET['edit'] == true && $me->isStaff()){
+ else if(isset($_GET['edit']) && $_GET['edit'] == true && $me->isStaff()){
$count = count($this->thumbnails);
$this->name = "<form action='$fullURL&amp;update=true' method='post'>Title: <input type='text' size='50' name='name' value='$name' />";
$this->body .= "<center><input type='submit' name='submit' value='Update Page' /></form></br /><br /><b>Total Images:</b> {$this->count}</center><br />";
@@ -219,7 +224,7 @@ function generateBody(){
$this->body .= "</center>\n";
}
}
- else if($_GET['upload'] == true && $_POST['submit'] == "Upload" && $me->isStaff()){
+ else if(isset($_GET['upload']) && $_GET['upload'] == true && isset($_POST['submit']) && $_POST['submit'] == "Upload" && $me->isStaff()){
foreach($_FILES as $file){
if($file['name'] != ""){
$status = self::uploadImage($file, $_GET['name_id'], $parser->stripHTML($_POST['title']));
@@ -283,7 +288,12 @@ function generateBody(){
$this->body .= "</div>";
}
if($this->nPages > 1){
- $page = max(1, $_GET['p']);
+ if(isset($_GET['p'])){
+ $page = max(1, $_GET['p']);
+ }
+ else{
+ $page = 1;
+ }
$id = ($page-1)*36;
$this->body .= "<center style='margin-bottom:5px;'>";
$this->body .= "<a class='light' href='index.php?page=media&amp;name_id={$this->name_id}&amp;p=1'>&lt;&lt;First</a> | ";
@@ -6,9 +6,11 @@ class Message extends ContentBlock{
var $redirect;
function Message($name, $message, $redirect=null){
+ global $out;
parent::ContentBlock($name);
$this->message = $message;
$this->redirect = $redirect;
+ $out->setTitle($name." - ".SITE_TITLE);
}
function generateBody(){
@@ -33,7 +33,6 @@ function NewsPost($row, $isMore){
WHERE `c_n_id` = '{$this->id}'";
$rows2 = $db->execSQL($sql);
$this->comments = $rows2[0]['count'];
- $out->setTitle($this->articleName);
if ($row['more'] == ""){
$this->more = "";
}
@@ -14,6 +14,7 @@ function setTitle($title, $overide=false){
if($this->title == null || $overide){
$this->title = SITE_TITLE;
}
+ $this->title = $title;
}
function addScript($script){
@@ -53,14 +54,16 @@ function generateHTML(){
<link href='style.php' rel='stylesheet' type='text/css' />
<link href='colorbox.css' rel='stylesheet' type='text/css' media='screen' />
{$this->links}
- <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script>
- <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js'></script>
+ <script type='text/javascript' src='js/jquery.min.js'></script>
+ <script type='text/javascript' src='js/jquery-ui.min.js'></script>
<script type='text/javascript' src='js/jquery.colorbox-min.js'></script>
<script type='text/javascript' src='js/functions.js'></script>
{$this->scripts}
<title>{$this->title}</title>
</head>
<!--DEBUG
+".phpversion()."
+".ini_get('max_file_uploads')."
{$this->debug}-->
{$this->body}";
$hooks->processHook(HOOK_BEFORE_FINAL_OUTPUT, array(&$output));
View
@@ -131,11 +131,11 @@ function generateHTML(){
$rows2 = $db->execSQL($sql);
$comments = new Comments($rows[0]['title'], $rows2);
$ret .= $comments->generateHTML();
+ $out->setTitle($newsPost->articleName." - ".SITE_TITLE);
}
else {
$error = new Message("Article Not Found", "<p class='centered'>There is no article with the id '{$_GET['article']}'. <a href='index.php'>Click Here</a> to return to the main index.</p>");
$ret .= $error->generateHTML();
-
}
}
break;
@@ -155,6 +155,7 @@ function generateHTML(){
$rows2 = $db->execSQL($sql);
$comments = new Comments($rows[0]['title'], $rows2);
$ret .= $comments->generateHTML();
+ $out->setTitle($rows[0]['title']." Comments - ".SITE_TITLE);
}
else {
$error = new Message("Article Not Found", "<p class='centered'>There is no article with the id '$nid'. <a href='index.php'>Click Here</a> to return to the main index.</p>");
@@ -169,11 +170,13 @@ function generateHTML(){
$content = new ContentPage($_GET['name_id']);
$this->name = SITE_TITLE." Content";
$ret .= $content->generateHTML();
+ $out->setTitle($content->name." - ".SITE_TITLE);
break;
case 'media':
$media = new ImagePage($_GET['name_id']);
$this->name = SITE_TITLE." Media";
$ret .= $media->generateHTML();
+ $out->setTitle($media->name." - ".SITE_TITLE);
break;
}
$ret .=
@@ -41,29 +41,39 @@ function SiteMenuCategory($row){
}
function addLink($id, $label, $url){
- global $me;
+ global $me, $hooks;
$style = "";
$delete = "";
$edit = "";
+ $hooks->processHook(HOOK_BEFORE_MENU_ITEM, array($this, &$label, &$url));
if($me->isStaff()){
$style = " style='cursor:pointer;float:left;'";
$delete = "<a style='display:inline;float:left;' name='cat{$id}' href='javascript:deleteLink(\"link{$id}\");'>[X]&nbsp;</a>";
$edit = "<div style='margin-left:0;margin-right:0;cursor:pointer;' onClick='editLink(this, \"link{$id}\");'>&nbsp;</div>";
}
- $this->links[] = "<div id='link{$id}'>$delete<span$style><a class='light' href='$url'>$label</a></span>$edit</div>";
+ $link = "<div id='link{$id}'>$delete<span$style><a class='light' href='$url'>$label</a></span>$edit</div>";
+ $hooks->processHook(HOOK_AFTER_MENU_ITEM, array($this, &$link));
+ if($link != null){
+ $this->links[] = $link;
+ }
}
function addText($id, $label){
- global $me;
+ global $me, $hooks;
$style = "";
$delete = "";
$edit = "";
+ $hooks->processHook(HOOK_BEFORE_MENU_ITEM, array($this, &$label, ""));
if($me->isStaff()){
$style = " style='cursor:pointer;'";
$delete = "<a style='display:inline;float:left;' name='cat{$id}' href='javascript:deleteLink(\"link{$id}\");'>[X]&nbsp;</a>";
$edit = "<div style='margin-left:0;margin-right:0;' onClick='editLink(this, \"link{$id}\");'>&nbsp;</div>";
}
- $this->links[] = "<div$style id='link{$id}'>$delete<span style='float:left;' onClick='editLink(this, \"link{$id}\");'>$label</span>$edit</div>";
+ $link = "<div$style id='link{$id}'>$delete<span style='float:left;' onClick='editLink(this, \"link{$id}\");'>$label</span>$edit</div>";
+ $hooks->processHook(HOOK_AFTER_MENU_ITEM, array($this, &$link));
+ if($link != null){
+ $this->links[] = $link;
+ }
}
function generateHTML(){
View
@@ -28,7 +28,9 @@
$out->addHTML("</ul>
</div>
<div class='below_navbar'>
- <div class='site_menu'>
+ <div class='site_menu'>");
+ $hooks->processHook(HOOK_BEFORE_MENU_CATEGORIES, array(&$out));
+ $out->addHTML("
<div class='site_menu_head'></div>
<div id='categories'>");
$cats = "";
@@ -45,6 +47,7 @@
else{
$out->addHTML("<div style='text-align:center;padding:5px;display:block;'></div>");
}
+$hooks->processHook(HOOK_AFTER_MENU_CATEGORIES, array(&$out));
$out->addHTML("</div>
<div class='content'>
<table class='middleTable'>
Oops, something went wrong.

0 comments on commit c583e3d

Please sign in to comment.