From 84d0d57228ed159384c023e4f732d61b5cb25364 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Mon, 28 Dec 2009 06:25:49 +0000 Subject: Added SMF forum Added block to interface with SMF logins (called forum_login) Fixed pages by removing articles Added contentHeading to page generation git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@404 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- admin/admin_functions.php | 6 +- admin/index.php | 15 ++- admin/news/functions.php | 14 +-- admin/pages/functions.php | 272 ++++++++-------------------------------------- admin/pages/index.php | 34 ++---- admin/style.css | 28 ++++- 6 files changed, 97 insertions(+), 272 deletions(-) (limited to 'admin') diff --git a/admin/admin_functions.php b/admin/admin_functions.php index 95c2aa5..1f5f866 100644 --- a/admin/admin_functions.php +++ b/admin/admin_functions.php @@ -134,7 +134,11 @@ $num = 1; } $num++; } - echo "\n"; + + if($num == 1) + echo "\n"; + else + echo "\n"; } /** diff --git a/admin/index.php b/admin/index.php index 754ef89..773cbc9 100644 --- a/admin/index.php +++ b/admin/index.php @@ -57,7 +57,7 @@ include 'header.php'; ?>
-
+
@@ -107,24 +107,27 @@ include 'header.php';
- - Queries: %d | Fetches: %d
\n", $totaltime, ((float)memory_get_usage()/1024/1024), ((float)memory_get_peak_usage()/1024/1024), $phpversion, $db_queries, $db_fetches); - ?> +?>



- - +"; - echo "{$row['title']} | {$row['catname']}  
"; + echo ""; + echo "{$news['title']} | {$news['catname']}  
"; if(($len = strlen($newsBody))>150) echo substr($newsBody, 0, 150)."..."; else echo $newsBody; echo '
'; - echo "Posted By: {$row['author']} on ".date('D M j, Y g:i a T', strtotime($news['date'])); + echo "Posted By: {$news['author']} on ".date('D M j, Y g:i a T', strtotime($news['date'])); echo '

'; } @@ -129,14 +129,6 @@ function EditNews($news_id){ else echo ""; } - /** FIXME - while(($row = $db->Fetch($result))!= false){ - if($author_id == $row['user_id']) - echo ""; - else - echo ""; - } - */ echo ""; } diff --git a/admin/pages/functions.php b/admin/pages/functions.php index 7152546..8b1f3b6 100644 --- a/admin/pages/functions.php +++ b/admin/pages/functions.php @@ -22,177 +22,10 @@ * You MUST declare $db as global inside your functions in order access MySQL from here. */ -function ListArticles($pageid) -{ - global $db; - $result = $db->Query("SELECT article_id,title FROM bayonet_articles WHERE `page_id` = $pageid ORDER BY `weight`"); - $articles = $row = $db->Fetch($result); - - echo "
"; - - ?> - - - - -
-  Add New Article','?op=pages&edit='.$pageid.'&newarticle=true'); ?> -
No Articles Found.
"; - return; - } - - foreach($articles as $article) - { - if($_GET['aid'] == $article['article_id']) - echo ''; - else - echo ''; - ?> - - ^ - - - - v - - - "; -} - -function NewArticle($page_id) -{ - global $db; - if(isset($_POST['newarticleprocessed'])) - { - //Secure our data to prevent injection attacks. - $title = addslashes($_POST['title']); - $text = addslashes($_POST['text']); - if(empty($title) || empty($text)) - { - echo "You must fill everything out before proceeding."; - return; - } - - $weight = 0; - $result = $db->Query("SELECT * FROM `bayonet_articles` WHERE `page_id` = $page_id ORDER BY `weight` DESC LIMIT 1"); - $row = $db->Fetch($result); - - $weight = $row['weight']; - $weight++; - - //Update the database with the new data. - $db->Query("INSERT INTO `bayonet_articles` (`article_id` ,`page_id` ,`title` ,`text`, `weight`)VALUES (NULL , $page_id, '$title', '$text', '$weight')"); - echo "New article, '$title', has been added.\n"; - PageRedirect(2, "?op=pages&edit={$_GET['edit']}"); - //die, because we have completed what we wanted to do. - return; - } - - ?> -

Add New Article

-
- - - - -
Title:
-
- Query("UPDATE bayonet_articles SET title = '$title', text = '$text' WHERE article_id = '$article_id'"); - echo "Article, '$title', has been edited.\n

Please wait while you are redirected.

- Click here if you don't feel like waiting."; - - //echo ""; - PageRedirect(2,"?op=pages&edit={$_GET['edit']}&aid={$article_id}"); - - //die, because we have completed what we wanted to do. - return; - } - - - //Grab the page from the database according to the $article_id passed to the function. - $result = $db->Query("SELECT title,text FROM bayonet_articles WHERE article_id = '$article_id'"); - $article = $db->Fetch($result); - $article = $row; - - ?> -
- - - -
- - - Delete This Article -
-
- Query("SELECT `title` FROM `bayonet_articles` WHERE `article_id` = '$article_id'"); - $article = $db->Fetch($result); - - if(isset($_POST['proceed'])) - { - echo "Article '{$article['title']}', was deleted."; - $db->Query("DELETE FROM bayonet_articles WHERE article_id = '$article_id' LIMIT 1"); - PageRedirect(2, "?op=pages&edit={$_GET['edit']}"); - return; - } - if(isset($_POST['cancel'])) - { - echo "User cancelled deletion of article: '{$article['title']}'"; - PageRedirect(2, "?op=pages&edit={$_GET['edit']}&aid={$article_id}"); - return; - } - ?> -
- - - -
Are you SURE you want to delete the article titled: ''?
   
-
- Query("SELECT page_id,title FROM bayonet_pages"); + $result = $db->Query("SELECT `page_id`,`title` FROM `bayonet_pages`"); $pages = $db->Fetch($result); echo ""; @@ -215,7 +48,7 @@ function ListPages($pid = NULL) foreach($pages as $page) { $edit = false; - if($pid == $page['page_id']){ + if($_GET['edit'] == $page['page_id']){ $edit = true; echo ''; }else @@ -230,25 +63,6 @@ function ListPages($pid = NULL) - - - - - - - - - - "; @@ -257,10 +71,11 @@ function ListPages($pid = NULL) function NewPage() { global $db; - if(isset($_POST['newpageprocessed'])) + if(isset($_POST['processed'])) { //Secure our data to prevent injection attacks. $title = addslashes($_POST['title']); + $text = addslashes($_POST['text']); if(empty($title)) { echo "You must fill everything out before proceeding."; @@ -271,6 +86,7 @@ function NewPage() $db->Query("INSERT INTO `bayonet_pages` (`page_id` ,`author_id` ,`page_created` ,`title` ,`text`)VALUES (NULL , '0',CURRENT_TIMESTAMP , '$title', '$text')"); echo "New page, '$title', has been added.\n"; + PageRedirect(2, "?op=pages"); //die, because we have completed what we wanted to do. return; } @@ -279,8 +95,9 @@ function NewPage()

Add New Page

-  View this Page','../index.php?load=page&id='.$pid.'" target=\"blank'); ?> -
-  Edit this Page','?op=pages&edit=true&pid='.$pid); ?> -
-  Delete this Page','?op=pages&delete='.$pid); ?> -
- - + + +
Title
Title:
Text:
Query("UPDATE bayonet_pages SET title = '$title' WHERE page_id = '$page_id'"); + $db->Query("UPDATE `bayonet_pages` SET `title` = '$title', `text` = '$text' WHERE `page_id` = '$page_id'"); echo "Page, '$title', has been edited.\n"; + PageRedirect(2, "?op=pages&edit={$page_id}"); //die, because we have completed what we wanted to do. return; } - -?> - - - - - - - - -
- - - - - 0){ - EditArticle($aid); - } - ?> -
+ + //Grab the page from the database according to the $article_id passed to the function. + $result = $db->Query("SELECT `title`, `text` FROM `bayonet_pages` WHERE `page_id` = '$page_id' LIMIT 1"); + $page = $db->FetchRow($result); + ?> +
+ + + + + + + + + + + + +
+ +  View this Page','../index.php?load=page&id='.$page_id.'" target=\"blank'); ?> + Delete This Page","?op=pages&delete={$page_id}"); ?> +
Title:
Text:
+
Query("SELECT title FROM bayonet_pages WHERE page_id = '$page_id'"); - $page = $db->Fetch($result); + $result = $db->Query("SELECT title FROM bayonet_pages WHERE page_id = '$page_id' LIMIT 1"); + $page = $db->FetchRow($result); if(isset($_POST['proceed'])) { echo "Page '{$page['title']}', was deleted."; $db->Query("DELETE FROM bayonet_pages WHERE page_id = '$page_id' LIMIT 1"); + PageRedirect(2, "?op=pages&edit={$page_id}"); return; } if(isset($_POST['cancel'])) { echo "User cancelled deletion of page: '{$page['title']}'"; + PageRedirect(2, "?op=pages&edit={$page_id}"); return; } if($page_id == 1){ - echo "You can not delete the home page."; + echo "You can not delete the home page."; + PageRedirect(2, "?op=pages&edit={$page_id}"); return; } ?> -
+ diff --git a/admin/pages/index.php b/admin/pages/index.php index ce3ec74..7fba032 100644 --- a/admin/pages/index.php +++ b/admin/pages/index.php @@ -19,7 +19,6 @@ ?>

- Manage Pages

- -Order articles needs to be completed. @@ -43,36 +37,28 @@ if(isset($_GET['edit'])) + "; - //return; + DeletePage($page_id); } else if(isset($_GET['create'])) { $create = $_GET['create']; if($create) { - echo ""; - //return; } } - else - { - echo " - "; - } - ?> - +
Are you SURE you want to delete the page titled: ''?
All articles attached to this page will be deleted as well.
   
"; - DeletePage($page_id); - echo ""; NewPage(); - echo " - -
diff --git a/admin/style.css b/admin/style.css index f81da65..54e671c 100644 --- a/admin/style.css +++ b/admin/style.css @@ -34,7 +34,7 @@ h3 { font-size:20px; } -div.content { +div.wrapper { width:1024px; background-color:white; padding:15px; @@ -109,6 +109,32 @@ fieldset { padding:0px; border: 1px solid #a1a1a1; } + /********************************* + ** Content Styles ** + *********************************/ + div.contentBorder1 { + background-color:white; + border:1px solid #3666ba; + } + div.contentBorder2 { + background-color:white; + border:1px solid #333333; + } + div.contentHeading { + background-repeat:repeat-x; + background-color:#112f50; + text-align:left; + height:25px; + padding-left:10px; + padding-right:10px; + padding-top:5px; + color:white; + } + div.content { + text-align:left; + padding:10px; + color:#333333; + } /* START>> CALENDAR STYLES*/ .monthTitle{ color:black; -- cgit