16 |
} |
} |
17 |
function my_cmp($a, $b) { return MyCompare($a["txt"], $b["txt"]); } |
function my_cmp($a, $b) { return MyCompare($a["txt"], $b["txt"]); } |
18 |
function newsEdit($art, $trigger = "", $isVijest = false) { |
function newsEdit($art, $trigger = "", $isVijest = false) { |
19 |
global $phptmp, $picdir, $syspicdir, $aupicdir, $sysaupicdir, $section, $section_menu, $dbh, $tpl; |
global $phptmp, $picdir, $syspicdir, $aupicdir, $sysaupicdir, $dbh, $tpl; |
20 |
|
global $section, $section_menu, $section_menu2, $spec; |
21 |
global $ed_id, $ed_cat, $isMed; |
global $ed_id, $ed_cat, $isMed; |
22 |
$i = 1; |
$i = 1; |
23 |
global $ed_delete_main, $ed_del_main; |
global $ed_delete_main, $ed_del_main; |
136 |
$sql = "INSERT INTO news (category, title, lead, title_pic, title_alt, title_pos, author_pic, author_alt, author_info, url, url_title, plivamed, d_orig, d_change) VALUES ('$ed_cat', $ed_title, $ed_lead, $ed_titlepic_nm, $ed_titlepic_alt, $ed_titlepic_pos, $ed_author_nm, $ed_author_alt, $ed_author_info, $ed_more, $ed_more_title, ".($isMed?"true":"false").", NOW(), NOW())"; |
$sql = "INSERT INTO news (category, title, lead, title_pic, title_alt, title_pos, author_pic, author_alt, author_info, url, url_title, plivamed, d_orig, d_change) VALUES ('$ed_cat', $ed_title, $ed_lead, $ed_titlepic_nm, $ed_titlepic_alt, $ed_titlepic_pos, $ed_author_nm, $ed_author_alt, $ed_author_info, $ed_more, $ed_more_title, ".($isMed?"true":"false").", NOW(), NOW())"; |
137 |
sql($sql); |
sql($sql); |
138 |
$dbh->dbh_do($sql); |
$dbh->dbh_do($sql); |
139 |
$sql = "SELECT news_id FROM news WHERE (title = $ed_title)"; |
$sql = "SELECT currval('news_news_id_seq')::text"; |
140 |
sql($sql); |
sql($sql); |
141 |
$sth = $dbh->prepare($sql); |
$sth = $dbh->prepare($sql); |
142 |
if (!$sth) error("Cannot prepare query: \"$sql\""); |
if (!$sth) error("Cannot prepare query: \"$sql\""); |
295 |
} |
} |
296 |
// ----- |
// ----- |
297 |
$tp = new Smarty(); |
$tp = new Smarty(); |
|
// ----- |
|
298 |
$tp->assign("levels", $levels); |
$tp->assign("levels", $levels); |
299 |
// ----- |
// ----- |
300 |
global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos, |
global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos, |
525 |
$params = array(); |
$params = array(); |
526 |
if ($section) array_push($params, "section=$section"); |
if ($section) array_push($params, "section=$section"); |
527 |
if ($section_menu) array_push($params, "section_menu=$section_menu"); |
if ($section_menu) array_push($params, "section_menu=$section_menu"); |
528 |
|
if ($section_menu2) array_push($params, "section_menu2=$section_menu2"); |
529 |
|
if ($spec) array_push($params, "spec=$spec"); |
530 |
if ($ed_id) array_push($params, "ed_id=$ed_id"); |
if ($ed_id) array_push($params, "ed_id=$ed_id"); |
531 |
if ($ed_preview) array_push($params, "ed_preview=$ed_preview"); |
if ($ed_preview) array_push($params, "ed_preview=$ed_preview"); |
532 |
if ($trigger) array_push($params, "$trigger=1"); |
if ($trigger) array_push($params, "$trigger=1"); |
533 |
global $PHP_SELF; |
$tp->assign("FORM_ACTION", HTMLSpecialChars("?".implode("&", $params))); |
|
$tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?".implode("&", $params))); |
|
534 |
if (!$ed_preview) { |
if (!$ed_preview) { |
535 |
global $onload; |
global $onload; |
536 |
$onload .= "document.forms[1].elements[0].focus();"; |
$onload .= "document.forms[1].elements[0].focus();"; |