2011-07-27 Tomas Palacios <tomas.palacios@artica.es>

* godmode/setup/news.php: fixed a bug regarding
        bad timestamps and unability to create site news.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4629 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Aldrioth 2011-07-27 09:43:11 +00:00
parent 9a5d72cd01
commit 98d4ea2396
1 changed files with 6 additions and 2 deletions

View File

@ -32,12 +32,13 @@ ui_print_page_header (__('Site news management'), "", false, "", true);
if (isset ($_POST["create"])) { // If create
$subject = get_parameter ("subject");
$text = get_parameter ("text");
$timestamp = db_get_value ('NOW()', 'tconfig_os', 'id_os', 1);
$values = array(
'subject' => $subject,
'text' => $text,
'author' => $config["id_user"],
'timestamp' => NOW());
'timestamp' => $timestamp);
$id_link = db_process_sql_insert('tnews', $values);
ui_print_result_message ($id_link,
@ -49,8 +50,11 @@ if (isset ($_POST["update"])) { // if update
$id_news = (int) get_parameter ("id_news", 0);
$subject = get_parameter ("subject");
$text = get_parameter ("text");
//NOW() column exists in any table and always displays the current date and time, so let's get the value from a row in a table which can't be deleted.
//This way we prevent getting no value for this variable
$timestamp = db_get_value ('NOW()', 'tconfig_os', 'id_os', 1);
$values = array('subject' => $subject, 'text' => $text, 'timestamp' => 'NOW()');
$values = array('subject' => $subject, 'text' => $text, 'timestamp' => $timestamp);
$result = db_process_sql_update('tnews', $values, array('id_news' => $id_news));
ui_print_result_message ($result,