<?php
/**********************************************************
* ______ ______ ___ _______ ___ ___ _______ *
* | _ \ | _ \ | | | _ || Y || _ | *
* |. | \|. | \|. | |. 1___||. || 1___| *
* |. | |. | |. |___ |. |___ |. \_/ ||____ | *
* |: 1 |: 1 |: 1 ||: 1 ||: | ||: 1 | *
* |::.. . /|::.. . /|::.. . ||::.. . ||::.|:. ||::.. . | *
* `------' `------' `-------'`-------'`--- ---'`-------' *
* _______ _______ *
* .--.--. | _ | | | *
* | | | |___| | __ |___| | *
* \___/ _(__ | |__| / ___/ *
* |: 1 | |: 1 \ *
* |::.. . | |::.. . | *
* `-------' `-------' *
* *
* Script: DDLCMS v3.2 *
* Author: Little Dragon *
* Email: hide@address.com *
* Website: http://www.ddlcms.com *
* *
* Please direct bug reports, suggestions or feedback *
* to the DDLCMS forums: *
* *
* http://www.ddlcms.com/forums *
* *
* DDLCMS is a commercial grade content management *
* system for DDL site owners. It is provided free *
* of charge, provided: *
* *
* 1. You keep the linkback to http://www.ddlcms.com *
* in the footer. *
* *
* 2. You keep the sponsored links to Sharingzone.net *
* on your site. *
* *
* By using this script, you agree that you will not *
* modify, remove, or replace any encoded parts of *
* this script. All encoded parts MUST remain intact *
* for your site to remain in good standing. *
* *
**********************************************************/
session_start();
if(!isset($_SESSION) || !is_array($_SESSION) || !array_key_exists('authuser', $_SESSION))
{
$_SESSION = NULL;
session_destroy();
header('Location: ' . $site_url . '/admin/');
}
define('ADMINDIR', dirname(__FILE__) . '/');
define('WWWROOT', substr(ADMINDIR, 0, -6));
define('BASEDIR', substr(WWWROOT, 0, ##BASEDIR##));
require(BASEDIR . 'funcs.inc');
require(BASEDIR . 'config.php');
require(ADMINDIR . 'adminheader.php');
$c = new config();
?>
<!-- LEFT side -->
<tr>
<td width="180" style="padding: 0;">
<div class='sidebartitle'>
Maintenance
</div>
<a href="<?php echo $site_url; ?>/admin/news.php"> • View Pages</a><br />
<a href="<?php echo $site_url; ?>/admin/addnews.php"> • Add Page</a><br />
<a href="<?php echo $site_url; ?>/admin/submitfiles.php"> • Submit Pages</a><br />
<a href="<?php echo $site_url; ?>/admin/submitfiles.php?submit_to=katz"> • Submit to Katz</a><br />
<a href="<?php echo $site_url; ?>/admin/submitfiles.php?submit_to=phaze"> • Submit to Phaze</a><br />
</td>
<!-- END LEFT SIDE -->
<!-- BEGIN RIGHT SIDE -->
<td width="790" align="left" valign="top" class="mainbox">
<h2>Edit Page</h2>
<?php
# if we are editing a news item, print the following..
if(checkURLQuery('instantLEremove.php', $_GET) === TRUE && $_GET['action'] == 'edit')
{
$id = $_GET['id'];
$getnews = dbcom("SELECT * FROM news WHERE id = $id;");
$contents = mysql_fetch_array($getnews);
?>
<form action="editnews.php" method="post">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<b>Title:</b>
<br />
<input type="text" name="newsTitle" value="<?php echo $contents['title']; ?>" size="80" maxlength="80"/>
</td>
<td width="35%">
<b>Type:</b><br />
<select name="type">
<?php
for($i = 0; $i < count($categories); $i++)
{
if($categories[$i] == $contents['type'])
{
echo '<option selected="selected" value="' . $categories[$i] . '">' . $categories[$i] . '</option>' . "\n";
}
else
{
echo '<option value="' . $categories[$i] . '">' . $categories[$i] . '</option>' . "\n";
}
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<br />
<b>Page Contents:</b><br />
<textarea id="editnews" name="news" rows="6" cols="50"><?php echo $contents[news]; ?></textarea>
<script type="text/javascript">
generate_wysiwyg('editnews');
</script>
<br /><br />
<input type="submit" value="Edit Page" />
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="action" value="doedit" />
</td>
</tr>
</table>
</form>
<?php
require(ADMINDIR . 'adminfooter.php');
die();
}
if(checkPostForm('editNews', $_POST, TRUE) === TRUE && $_POST['action'] == 'doedit')
{
# grab the post vars
$title = $_POST['newsTitle'];
$id = $_POST['id'];
$news = $_POST['news'];
$type = $_POST['type'];
# escape single quotes
$title = Capitalize($title);
$news = str_replace('"', "'", $news);
# update the database
$news = mysql_escape_string($news);
dbcom("UPDATE news SET title='$title', news='$news', type='$type', date=CURRENT_TIMESTAMP WHERE id = $id");
echo '<p>The page has been edited!</p>';
echo "<p><a href=\"$site_url/news-".$id."-".dot($title).".html\" target=_blank><img src=\"$site_url/admin/images/view.png\" alt=\"View Page\" height=16 width=16 align=middle border=0> [View] </a> $title ($type)</p>";
echo '<p><a href="' . $site_url . '/news_katz-' . $id . '-' . dot($title) . '.html" target="_blank"><img src="' . $site_url . '/admin/images/view.png" alt="View Page" height="16" width="16" align="middle" border="0"> [View Katz] </a> ' . $title . ' (' . $type . ')</p>';
echo '<p><a href="' . $site_url . '/news_phaze-' . $id . '-' . dot($title) . '.html" target="_blank"><img src="' . $site_url . '/admin/images/view.png" alt="View Page" height="16" width="16" align="middle" border="0"> [View Phaze] </a> ' . $title . ' (' . $type . ')</p>';
echo "<p><a href=\"$site_url/admin/editnews.php?id=$id&action=edit\" target=_top><img src=\"$site_url/admin/images/edit.png\" alt=\"Edit Page\" height=16 width=16 align=middle border=0> [Edit] </a> $title ($type)</p>";
include(ADMINDIR . 'rss.php');
echo "<p><a href=\"$site_url/rss.xml\" target=_blank><img src=\"$site_url/admin/images/view.png\" alt=\"View RSS Feed\" height=16 width=16 align=middle border=0> See the updated RSS feed</a></p>";
}
else
{
?>
<p>There was an error in editing the news item. Go <a href="javascript:history.go(-1)">Back</a>.</p>
<?php
}
?>
</td>
</tr>
<!-- END RIGHT SIDE -->
<?php
require(ADMINDIR . 'adminfooter.php');
?>