[Openfirst-cvscommit] news/admin delcomment.php,1.3,1.4 editnews.php,1.5,1.6 index.php,1.17,1.18 kil
Brought to you by:
xtimg
From: Jamie <ast...@us...> - 2006-02-23 16:35:22
|
Update of /cvsroot/openfirst/news/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24914/news/admin Modified Files: delcomment.php editnews.php index.php killnews.php Log Message: The basics are mostly working, still have a long, long ways to go. Index: index.php =================================================================== RCS file: /cvsroot/openfirst/news/admin/index.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** index.php 6 Feb 2006 01:52:07 -0000 1.17 --- index.php 23 Feb 2006 16:35:15 -0000 1.18 *************** *** 27,30 **** --- 27,31 ---- */ include_once("../../includes/globals.php"); + $ogUser->mustBeAdmin(); include_once($ogHeader); *************** *** 33,37 **** $ogUser->mustBeAdmin(); ! if(! isset($_POST["news"])) { // Display a form for news. $upload_dir = dirname(__FILE__)."/../images/upload/"; --- 34,38 ---- $ogUser->mustBeAdmin(); ! if(!isset($_POST["title"])) { // Display a form for news. $upload_dir = dirname(__FILE__)."/../images/upload/"; *************** *** 48,52 **** <tr> <td><div align="right">Headline</div></td> ! <td><input name="title" type="text" value="openFIRST News" style="width: 250px;"></td> </tr> <tr valign="top"> --- 49,53 ---- <tr> <td><div align="right">Headline</div></td> ! <td><input name="title" id="title" type="text" value="openFIRST News" style="width: 250px;"></td> </tr> <tr valign="top"> *************** *** 59,63 **** foreach(glob($upload_dir.'*') as $filename) { if ($filename != "." && $filename != "..") { ! echo("<option>$filename</option>"); } } --- 60,64 ---- foreach(glob($upload_dir.'*') as $filename) { if ($filename != "." && $filename != "..") { ! echo "<option>".htmlentities(basename($filename))."</option>"; } } *************** *** 65,76 **** ?> </select> ! <br><input type="radio" name="imagesrc" id="imagesrc2" value="2"><label for="imagesrc2">Upload New Image</label> <?php if(is_writeable($upload_dir)){ ! echo('<input type="file" name="imgfile" accept="image/*" style="width: 250px;">'); }else{ ! echo('<br>Image uploading is disabled'); }?> ! <br><input type="radio" name="imagesrc" id="imagesrc3" value="3"><label for="imagesrc3">Specify Filename (Advanced)</label> <input type="text" name="customimg" style="width: 250px;"> </td> --- 66,77 ---- ?> </select> ! <br /><input type="radio" name="imagesrc" id="imagesrc2" value="2"><label for="imagesrc2">Upload New Image</label> <?php if(is_writeable($upload_dir)){ ! echo '<input type="file" name="imgfile" accept="image/*" style="width: 250px;">'; }else{ ! echo '<br />Image uploading is disabled'; }?> ! <br /><input type="radio" name="imagesrc" id="imagesrc3" value="3"><label for="imagesrc3">Specify Filename (Advanced)</label> <input type="text" name="customimg" style="width: 250px;"> </td> *************** *** 81,91 **** <td> <?php ! $dhtml=function_exists("make_wysiwyg"); ! if($dhtml){ ! make_wysiwyg("news", 500, 300, "Insert your news here."); ! } ! else{ ! echo('<textarea name="news" cols="60" rows="20">Insert your news here.</textarea>'); ! } ?> </td> --- 82,86 ---- <td> <?php ! echo $ogEditorPlugin->getEditField('news', 20, 60, "Insert your news here."); ?> </td> *************** *** 94,105 **** <td> </td> <td> ! <?php ! if($dhtml){ ! echo('<input name="news2" type="button" value="Add News Item" onclick="dhtmlEditorPrepareSubmit(); document.NewsForm.submit();" />'); ! } ! else { ! echo('<input name="news2" type="submit" value="Add News Item" />'); ! } ! ?> <input name="reset" type="reset" value="Clear News Item" /> </td> </tr> --- 89,93 ---- <td> </td> <td> ! <input name="news2" type="submit" value="Add News Item" /> <input name="reset" type="reset" value="Clear News Item" /> </td> </tr> *************** *** 110,118 **** } else { // Add the news. ! $now = date("D M j G:i:s T Y"); include('uploader.php'); ! $query = ofirst_dbquery("INSERT INTO ofirst_news (date, poster, title, news, image) VALUES ('$now', '$user->user', '" . $_POST["title"] . "', '" . $_POST["news"] . "', '" . $image . "');"); ! ! echo("The news item " . $_POST["title"] . " has been added. [ <a href='../index.php'>Main</a> ]"); } --- 98,118 ---- } else { // Add the news. ! $now = time(); include('uploader.php'); ! $res = $ogDB->insert('news', array( ! 'post_date' => $now, ! 'poster' => $ogUser->getName(), ! 'title' => $_POST['title'], ! 'news' => $ogEditorPlugin->getFieldValue('news'), ! 'image' => $image ! )); ! if (!$res) { ! echo "Error: "; ! echo $ogDB->errorNumber(); ! echo "<br />"; ! echo $ogDB->errorString(); ! } else { ! echo("The news item " . $_POST["title"] . " has been added. [ <a href='../index.php'>Main</a> ]"); ! } } Index: editnews.php =================================================================== RCS file: /cvsroot/openfirst/news/admin/editnews.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** editnews.php 6 Jan 2004 17:16:23 -0000 1.5 --- editnews.php 23 Feb 2006 16:35:15 -0000 1.6 *************** *** 27,37 **** * */ ! include_once("../../config/globals.php"); ! include_once($header); echo("<h1>Edit News Item</h1>"); - if(isset($user->membertype)){ - if($user->membertype == "administrator") { $articleid=0; if(isset($_GET["id"])){ --- 27,36 ---- * */ ! include_once("../../includes/globals.php"); ! $ogUser->mustBeAdmin(); ! include_once($ogHeader); echo("<h1>Edit News Item</h1>"); $articleid=0; if(isset($_GET["id"])){ *************** *** 41,47 **** if(! isset($_POST["news"])) { // Display a form for news. ! $query = ofirst_dbquery("SELECT * FROM ofirst_news WHERE ID='$articleid'"); ! if (ofirst_dbnum_rows($query) != 0){ ! $news = ofirst_dbfetch_object($query); ?> <form name="NewsForm" id="NewsForm" method="post" action="editnews.php" enctype="multipart/form-data"> --- 40,46 ---- if(! isset($_POST["news"])) { // Display a form for news. ! $query = $ogDB->select('news', '*', array('ID' => $articleid)); ! if ($ogDB->numberOfRows($query) != 0){ ! $news = $ogDB->fetchObject($query); ?> <form name="NewsForm" id="NewsForm" method="post" action="editnews.php" enctype="multipart/form-data"> *************** *** 76,80 **** <br><input type="radio" name="imagesrc" id="imagesrc2" value="2"><label for="imagesrc2">Upload New Image</label> <?php ! if(is_writeable($fbasepath."/news/images/upload/")){ echo('<input type="file" name="imgfile" accept="image/*" style="width: 250px;">'); }else{ --- 75,79 ---- <br><input type="radio" name="imagesrc" id="imagesrc2" value="2"><label for="imagesrc2">Upload New Image</label> <?php ! if(is_writeable($ogCurrentModule->getDir()."/images/upload/")){ echo('<input type="file" name="imgfile" accept="image/*" style="width: 250px;">'); }else{ *************** *** 90,100 **** <td> <?php ! $dhtml=function_exists("make_wysiwyg"); ! if($dhtml){ ! make_wysiwyg("news", 500, 300, $news->news); ! } ! else{ ! echo('<textarea name="news" cols="60" rows="20">$news->news</textarea>'); ! } ?> </td> --- 89,93 ---- <td> <?php ! echo $ogEditorPlugin->getEditField('news', 20, 60, "Insert your news here."); ?> </td> *************** *** 103,114 **** <td> </td> <td> ! <?php ! if($dhtml){ ! echo('<input name="news2" type="button" id="news2" value="Save Changes" onclick="dhtmlEditorPrepareSubmit(); document.NewsForm.submit();" />'); ! } ! else { ! echo('<input name="news2" type="submit" id="news2" value="Save Changes" />'); ! } ! ?> <input name="reset" type="reset" /> <input name="StoryID" id="StoryID" type="hidden" value="<?php echo($news->ID); ?>"/> </td> --- 96,100 ---- <td> </td> <td> ! <input name="news2" type="submit" id="news2" value="Save Changes" /> <input name="reset" type="reset" /> <input name="StoryID" id="StoryID" type="hidden" value="<?php echo($news->ID); ?>"/> </td> *************** *** 123,137 **** } } else { ! // Add the news. ! $now = date("D M j G:i:s T Y"); include('uploader.php'); ! $query=ofirst_dbquery("UPDATE ofirst_news SET date='".$now."', poster='".$user->user."', title='".$_POST["title"]."', news='".$_POST["news"]."', image='".$image."' WHERE ID='".$_POST["StoryID"]."';"); ! ! echo("The news item "" . $_POST["title"] . "" has been modified. [ <a href='../index.php'>Main</a> ]"); ! } ! } ! } else { ! echo("You must be logged on as an administrative user to edit news."); } ! include_once($footer); ?> --- 109,132 ---- } } else { ! // Update the news. ! $now = time(); include('uploader.php'); ! $res = $ogDB->insert('news', array( ! 'post_date' => $now, ! 'poster' => $ogUser->getName(), ! 'title' => $_POST['title'], ! 'news' => $ogEditorPlugin->getFieldValue('news'), ! 'image' => $image ! )); ! if (!$res) { ! echo "Error: "; ! echo $ogDB->errorNumber(); ! echo "<br />"; ! echo $ogDB->errorString(); ! } else { ! echo("The news item " . $_POST["title"] . " has been added. [ <a href='../index.php'>Main</a> ]"); ! } } ! ! include_once($ogFooter); ?> Index: delcomment.php =================================================================== RCS file: /cvsroot/openfirst/news/admin/delcomment.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** delcomment.php 24 Dec 2003 00:48:14 -0000 1.3 --- delcomment.php 23 Feb 2006 16:35:12 -0000 1.4 *************** *** 1,5 **** <?php /* ! * openFIRST.news - delcomment.php * * Copyright (C) 2003, --- 1,5 ---- <?php /* ! * openfirst.news - delcomment.php * * Copyright (C) 2003, *************** *** 26,31 **** * */ ! include_once("../../config/globals.php"); ! include_once($header); ?> <br> --- 26,32 ---- * */ ! include_once("../../includes/globals.php"); ! $ogUser->mustBeAdmin(); ! include_once($ogHeader); ?> <br> *************** *** 37,67 **** <td align="center"> <?php ! $admin=false; ! if (isset($user->membertype)){ ! $admin=($user->membertype == "administrator"); ! } ! ! if($admin) { ! if(!isset($_POST["CommentID"])) { ! $query = ofirst_dbquery("SELECT * FROM ofirst_news_comments WHERE ID='".$_GET["id"]."'"); ! if (ofirst_dbnum_rows($query) != 0){ ! echo('<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'); ! echo('<input name="CommentID" type="hidden" value="'.$_GET["id"].'">'); ! echo('<div>Delete comment?</div><br>'); ! echo('<input type="submit" value="Confirm"></form>'); ! } else { ! echo('<div>This comment does not exist.</div>'); ! } ! } else { ! // Delete the news by ID. ! ofirst_dbquery("DELETE FROM ofirst_news_comments WHERE ID=".$_POST["CommentID"].";"); ! echo("The comment has been deleted. [ <a href='../index.php'>Main</a> ]"); } } else { ! echo("You must be logged on as an administrative user to delete comments."); } echo("</td></tr></table>"); ! include_once($footer); ?> --- 38,59 ---- <td align="center"> <?php ! if(!isset($_POST["CommentID"])) { ! $query = ofirst_dbquery("SELECT * FROM ofirst_news_comments WHERE ID='".$_GET["id"]."'"); ! if (ofirst_dbnum_rows($query) != 0){ ! echo('<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'); ! echo('<input name="CommentID" type="hidden" value="'.$_GET["id"].'">'); ! echo('<div>Delete comment?</div><br>'); ! echo('<input type="submit" value="Confirm"></form>'); } else { ! echo('<div>This comment does not exist.</div>'); } + } else { ! // Delete the news by ID. ! ofirst_dbquery("DELETE FROM ofirst_news_comments WHERE ID=".$_POST["CommentID"].";"); ! echo("The comment has been deleted. [ <a href='../index.php'>Main</a> ]"); } echo("</td></tr></table>"); ! include_once($ogFooter); ?> Index: killnews.php =================================================================== RCS file: /cvsroot/openfirst/news/admin/killnews.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** killnews.php 24 Dec 2003 00:48:14 -0000 1.4 --- killnews.php 23 Feb 2006 16:35:15 -0000 1.5 *************** *** 1,3 **** --- 1,5 ---- <?php + + /* * openFIRST.news - admin/killnews.php *************** *** 26,31 **** * */ ! include_once("../../config/globals.php"); ! include_once($header); ?> <br> --- 28,34 ---- * */ ! include_once ("../../includes/globals.php"); ! $ogUser->mustBeAdmin(); ! include_once ($ogHeader); ?> <br> *************** *** 37,80 **** <td align="center"> <?php - $admin=false; - if (isset($user->membertype)){ - $admin=($user->membertype == "administrator"); - } - if($admin) { - $id=0; - if(isset($_GET["id"])){ - $id=$_GET["id"]; - } - if(!isset($_POST["StoryID"])) { - $query = ofirst_dbquery("SELECT * FROM ofirst_news WHERE ID='".$id."'"); - $title=""; - $found=false; - if (ofirst_dbnum_rows($query) != 0){ - $news = ofirst_dbfetch_object($query); - $found=true; - $title=$news->title; - } - if($found){ - echo('<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'); - echo('<input name="StoryID" type="hidden" value="'.$_GET["id"].'">'); - echo('<div>Delete news item "'.$title.'"?</div><br>'); - echo('<input type="submit" value="Confirm"></form>'); - } - else { - echo('<div>This news item does not exist.</div>'); - } ! } else { ! // Delete the news by ID. ! ofirst_dbquery("DELETE FROM ofirst_news WHERE ID=".$_POST["StoryID"].";"); ! echo("The news item has been deleted. [ <a href='../index.php'>Main</a> ]"); ! } } ! else { ! echo("You must be logged on as an administrative user to delete news."); } - echo("</td></tr></table>"); ! include_once($footer); ?> --- 40,84 ---- <td align="center"> <?php ! $admin = false; ! if (isset ($user->membertype)) { ! $admin = ($user->membertype == "administrator"); ! } ! $id = 0; ! if (isset ($_GET["id"])) { ! $id = $_GET["id"]; ! } ! if (!isset ($_POST["StoryID"])) { ! $query = $ogDB->select('news', '*', array('ID' => $id)); ! $title = ""; ! $found = false; ! if ($ogDB->numberOfRows($query) != 0) { ! $news = $ogDB->fetchObject($query); ! $found = true; ! $title = $news->title; } ! ! if ($found) { ! echo ('<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'); ! echo ('<input name="StoryID" type="hidden" value="'.$_GET["id"].'">'); ! echo ('<div>Delete news item "'.$title.'"?</div><br>'); ! echo ('<input type="submit" value="Confirm"></form>'); ! } else { ! echo ('<div>This news item does not exist.</div>'); } ! } else { ! // Delete the news by ID. ! if ($ogDB->delete('news', array('ID' => $_POST["StoryID"]))) ! echo ("The news item has been deleted. [ <a href='../index.php'>Main</a> ]"); ! else ! echo "<p class=\"error\">Error: ".htmlentities($ogDB->errorText()).'</p>'; ! } ! ! echo ("</td></tr></table>"); ! ! include_once ($ogFooter); ?> + + |