Location: PHPKode > projects > ProjectPress > projectpress/pm-admin/edit_news.php
<?php 
/**
 * ProjectPress edit news form
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(__FILE__)) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

// User is logged in and is an admin.
is_admin();

// Enable for error checking and troubleshooting.
//display_errors();

if (isset($_POST['news']) && $_POST['news'] == 'Submit') {
	 $title = pmdb::connect()->escape($_POST['title']);
	 $text = pmdb::connect()->escape($_POST['text']);

	 pmdb::connect()->query("UPDATE ". DB ."news SET title='$title',text='$text' WHERE newsid = '".$_GET['id']."' LIMIT 1");
}

	$result = pmdb::connect()->query("SELECT * FROM ". DB ."news WHERE newsid = '".$_GET['id']."' LIMIT 1");
	$row = $result->fetch_array();

	/**
	 * Creates a new template for the add member page.
	 */
	$editnews = new Template(PM_DIR . "pm-includes/tpl/edit_news.tpl");
	$editnews->set("pmurl", get_pm_option('siteurl'));
	$editnews->set("id", $_GET['id']);
	$editnews->set("newstitle", $row['title']);
	$editnews->set("text", $row['text']);
	
	/**
	 * Outputs the page with add member form.
	 */
	echo $editnews->output();

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress