--- inc/newsEdit.php 2001/10/23 16:13:59 1.17 +++ inc/newsEdit.php 2001/10/27 16:54:50 1.18 @@ -92,7 +92,9 @@ // ----- $newsi = array(); #$sql = "SELECT news_id, title FROM news WHERE (".($isMed?"":"NOT ")."plivamed) ORDER BY title"; - $sql = "SELECT news_id, title FROM news ORDER BY title"; + $sql = "SELECT news_id, title FROM news"; + if ($ed_id && $ed_id > 0) $sql .= " WHERE (news_id != $ed_id)"; + $sql .= " ORDER BY title"; sql($sql); $sth = $dbh->prepare($sql); if (!$sth) error("Cannot prepare query: \"$sql\""); @@ -154,7 +156,8 @@ global $ed_title, $ed_lead, $ed_titlepic_alt, $ed_titlepic_pos, $ed_more, $ed_more_title, $ed_cat, $ed_author_alt, $ed_author_info, - $ed_author_ime, $ed_author_cv, $ed_prikazi; + $ed_author_ime, $ed_author_cv, $ed_exclusive, + $ed_prikazi; $ed_title = MyQuote($ed_title); $ed_lead = MyQuote($ed_lead); $ed_author_nm = urldecode(MyQuote(basename($author_name))); @@ -167,12 +170,13 @@ $ed_more_title = MyQuote($ed_more_title); if (!$ed_titlepic_pos) $ed_titlepic_pos = 0; if (!$ed_author_cv) $ed_author_cv = 0; + if (!isset($ed_exclusive)) $ed_exclusive = false; if ($ed_id > 0) { - $sql = "UPDATE news SET category = '$ed_cat', title = $ed_title, lead = $ed_lead, title_pic = $ed_titlepic_nm, title_alt = $ed_titlepic_alt, title_pos = $ed_titlepic_pos, author_pic = $ed_author_nm, author_alt = $ed_author_alt, author_info = $ed_author_info, author_name = $ed_author_ime, autor_cv = $ed_author_cv, url = $ed_more, url_title = $ed_more_title, plivamed = ".($isMed?"true":"false").", prikazi = ".($ed_prikazi?"true":"false").", ord = 0, d_change = NOW() WHERE (news_id = $ed_id)"; + $sql = "UPDATE news SET category = '$ed_cat', title = $ed_title, lead = $ed_lead, title_pic = $ed_titlepic_nm, title_alt = $ed_titlepic_alt, title_pos = $ed_titlepic_pos, author_pic = $ed_author_nm, author_alt = $ed_author_alt, author_info = $ed_author_info, author_name = $ed_author_ime, autor_cv = $ed_author_cv, exclusive = ".($ed_exclusive?"true":"false").", url = $ed_more, url_title = $ed_more_title, plivamed = ".($isMed?"true":"false").", prikazi = ".($ed_prikazi?"true":"false").", ord = 0, d_change = NOW() WHERE (news_id = $ed_id)"; sql($sql); $dbh->dbh_do($sql); } else { - $sql = "INSERT INTO news (category, title, lead, title_pic, title_alt, title_pos, author_pic, author_alt, author_info, author_name, autor_cv, url, url_title, plivamed, prikazi, 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_author_ime, $ed_author_cv, $ed_more, $ed_more_title, ".($isMed?"true":"false").", ".($ed_prikazi?"true":"false").", NOW(), NOW())"; + $sql = "INSERT INTO news (category, title, lead, title_pic, title_alt, title_pos, author_pic, author_alt, author_info, author_name, autor_cv, exclusive, url, url_title, plivamed, prikazi, 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_author_ime, $ed_author_cv, ".($ed_exclusive?"true":"false").", $ed_more, $ed_more_title, ".($isMed?"true":"false").", ".($ed_prikazi?"true":"false").", NOW(), NOW())"; sql($sql); $dbh->dbh_do($sql); $sql = "SELECT currval('news_news_id_seq')::text"; @@ -231,8 +235,8 @@ if (!$sth) error("Cannot prepare query: \"$sql\""); if (!$sth->execute()) error("Cannot execute query: \"$sql\""); while ($row = $sth->fetchrow_array()) { - list($pic) = $row; - MyDelete($syspicdir."/".$pic); + list($pic2) = $row; + MyDelete($syspicdir."/".$pic2); } $sth->finish(); } @@ -243,8 +247,8 @@ if (!$sth) error("Cannot prepare query: \"$sql\""); if (!$sth->execute()) error("Cannot execute query: \"$sql\""); while ($row = $sth->fetchrow_array()) { - list($pic) = $row; - MyDelete($syspicdir."/".$pic); + list($pic2) = $row; + MyDelete($syspicdir."/".$pic2); } $sth->finish(); } @@ -417,7 +421,7 @@ global $ed_title, $ed_lead, $ed_titlepic_pos, $ed_titlepic_alt, $ed_cat, $ed_more, $ed_more_title, $ed_author_url, $ed_author_alt, $ed_author_info, - $ed_author_ime, $ed_author_cv, $ed_prikazi; + $ed_author_ime, $ed_author_cv, $ed_exclusive, $ed_prikazi; if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = ""; if (!$titlepic_url) $titlepic_url = $titlepic_url2; if (!$titlepic_url && !($clear_main || $clr_main)) $titlepic_url = $art["pic_url"]; @@ -493,7 +497,7 @@ } $sth->finish(); } else { - $art["show"] = true; + $art["show"] = false; for ($j = 0; $j < count($specs); $j++) $nspecs[$specs[$j]["id"]] = ($specs[$j]["id"] == $spec) ? true : false; } @@ -502,13 +506,13 @@ $ed_cat, $ed_more, $ed_more_title, $width, $height, $author_url, $author_url2, $author_name, $ed_author_alt, $ed_author_info, $width2, $height2, - $ed_author_ime, $ed_author_cv, $ed_prikazi) = array($art["title"], - $art["lead"], $art["pic_pos"], $art["pic_url"], $art["pic_url"], - urldecode($art["pic_url"]), $art["pic_alt"], $art["category"], - $art["more"], $art["more_title"], $art["pic_w"], $art["pic_h"], - $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]), + $ed_author_ime, $ed_author_cv, $ed_exclusive, $ed_prikazi) = + array($art["title"], $art["lead"], $art["pic_pos"], $art["pic_url"], + $art["pic_url"], urldecode($art["pic_url"]), $art["pic_alt"], + $art["category"], $art["more"], $art["more_title"], $art["pic_w"], + $art["pic_h"], $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]), $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"], - $art["au_name"], $art["au_cv"], $art["show"]); + $art["au_name"], $art["au_cv"], $art["ex"], $art["show"]); if ($art["text"]) reset($art["text"]); while ($art["text"] && list($id, $val) = each($art["text"])) { array_push($ed_pgfs, array($val["id"], $val["text"], $val["title"], @@ -640,6 +644,7 @@ $tp->assign("ed_more_title", MyEscape($ed_more_title)); $tp->assign("ed_prikazi", $ed_prikazi); $tp->assign("ed_author_cv", $ed_author_cv); + $tp->assign("ed_exclusive", $ed_exclusive); $tp->assign("ed_clr_main", ($clear_main || $clr_main || !$titlepic_url) ? true : false); $tp->assign("ed_clr_author", ($clear_author || $clr_author || !$author_url) ? true : false); $tp->assign("ed_text", $ed_text);