} if (!$edit_mode) { $form['author'] = $user['username']; $form['added'] = array(date('j'), date('m'), date('Y'), date('H'), date('i')); } // Form values $form['add'] = $_POST['add'] ? true : false; $form['edit'] = $_POST['edit'] ? true : false; if ($form['add'] || $form['edit']) { $form = $_POST; $errors[] = !$form['name'] ? $lang['ERROR_TITLE'] : ''; $errors[] = !$form['author'] ? $lang['ERROR_AUTHOR'] : ''; $errors[] = !$form['content'] ? $lang['ERROR_CONTENT'] : ''; // No errors if (!in_array(true, $errors)) { $form['author_id'] = (int) identify_user($form['author']); $form['author_id'] && ($form['author'] = ''); // Add if ($form['add']) { sql_query(' INSERT INTO ' . db_prefix . 'news (title, author, added, description, keywords, content, extended_content, author_id, category_id) VALUES ( "' . $form['title'] . '", "' . $form['author'] . '", ' . (int) mktime($form['added'][3], $form['added'][4], 0, $form['added'][1], $form['added'][0], $form['added'][2]) . ', 1, "' . $form['description'] . '", "' . $form['keywords'] . '", "' . $form['content'] . '", "' . $form['extended_content'] . '", ' . $form['author_id'] . ',
require_once "class.Session.php"; require_once "class.User.php"; $theme = 'clean'; $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit; } $mysqli->query("SET NAMES 'utf8'"); date_default_timezone_set('GMT'); $mysqli->query("SET time_zone='+0:00'"); require_once 'conf/conf.php'; $max_session_time = 10000000; $max_session_time_in_milliseconds = 1000 * $max_session_time; $session = new Session($max_session_time); $user = identify_user(); //print_r($user); include_once 'libs/Smarty/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->template_dir = 'templates'; $smarty->compile_dir = 'server_files/smarty/templates_c'; $smarty->cache_dir = 'server_files/smarty/cache'; $smarty->config_dir = 'server_files/smarty/configs'; $_client_locale = 'en_GB.UTF-8'; include_once 'set_locales.php'; $smarty->assign('lang_code', $_SESSION['text_locale_code']); $smarty->assign('lang_country_code', strtolower($_SESSION['text_locale_country_code'])); $args = "?"; foreach ($_GET as $key => $value) { if ($key != '_locale') { $args .= $key . '=' . $value . '&';