90 |
$sth->finish(); |
$sth->finish(); |
91 |
usort($autori, "my_cmp_2"); |
usort($autori, "my_cmp_2"); |
92 |
// ----- |
// ----- |
93 |
|
$newsi = array(); |
94 |
|
#$sql = "SELECT news_id, title FROM news WHERE (".($isMed?"":"NOT ")."plivamed) ORDER BY title"; |
95 |
|
$sql = "SELECT news_id, title FROM news ORDER BY title"; |
96 |
|
sql($sql); |
97 |
|
$sth = $dbh->prepare($sql); |
98 |
|
if (!$sth) error("Cannot prepare query: \"$sql\""); |
99 |
|
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
100 |
|
while ($row = $sth->fetchrow_array()) { |
101 |
|
$txt = $row[1]; |
102 |
|
if (strlen($txt) > 55) $txt = substr($txt, 0, 55)."..."; |
103 |
|
array_push($newsi, array("id" => $row[0], "txt" => $txt)); |
104 |
|
} |
105 |
|
$sth->finish(); |
106 |
|
usort($newsi, "my_cmp"); |
107 |
|
// ----- |
108 |
$specs = array(); |
$specs = array(); |
109 |
$sql = "SELECT spec_id, opis FROM specijalizacije WHERE (spec_id != 0) AND (NOT link)"; |
$sql = "SELECT spec_id, opis FROM specijalizacije WHERE (spec_id != 0) AND (NOT link)"; |
110 |
sql($sql); |
sql($sql); |
282 |
sql($sql); |
sql($sql); |
283 |
$dbh->dbh_do($sql); |
$dbh->dbh_do($sql); |
284 |
} |
} |
285 |
|
$sql = "DELETE FROM related WHERE (news_id = $ed_id)"; |
286 |
|
sql($sql); |
287 |
|
$dbh->dbh_do($sql); |
288 |
|
$x = 1; |
289 |
|
$foo = array(); |
290 |
|
while (true) { |
291 |
|
$var = "ed_related_".$x; |
292 |
|
$x++; |
293 |
|
global $$var; |
294 |
|
if (!isset($$var)) break; |
295 |
|
if (!$$var) continue; |
296 |
|
if ($foo[$$var]) continue; |
297 |
|
$foo[$$var] = true; |
298 |
|
$sql = "INSERT INTO related (news_id, rel_id) VALUES ($ed_id, ".$$var.")"; |
299 |
|
sql($sql); |
300 |
|
$dbh->dbh_do($sql); |
301 |
|
} |
302 |
$sql = "DELETE FROM cat_news WHERE (news_id = $ed_id)"; |
$sql = "DELETE FROM cat_news WHERE (news_id = $ed_id)"; |
303 |
sql($sql); |
sql($sql); |
304 |
$dbh->dbh_do($sql); |
$dbh->dbh_do($sql); |
379 |
$tp = new Smarty(); |
$tp = new Smarty(); |
380 |
$tp->assign("levels", $levels); |
$tp->assign("levels", $levels); |
381 |
$tp->assign("autori", $autori); |
$tp->assign("autori", $autori); |
382 |
|
$tp->assign("newsi", $newsi); |
383 |
// ----- |
// ----- |
384 |
global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos, |
global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos, |
385 |
$ed_titlepic_alt, $ed_cat, $ed_more, |
$ed_titlepic_alt, $ed_cat, $ed_more, |
400 |
$ed_warning = 0; |
$ed_warning = 0; |
401 |
$nspecs = array(); |
$nspecs = array(); |
402 |
$ncats = array(); |
$ncats = array(); |
403 |
|
$related = array(); |
404 |
// Transfer data |
// Transfer data |
405 |
if ($ed_edit || $ed_preview || $add || $delete || $clear) { |
if ($ed_edit || $ed_preview || $add || $delete || $clear) { |
406 |
for ($i = 0; $i < count($specs); $i++) { |
for ($i = 0; $i < count($specs); $i++) { |
415 |
$ncats[$categories[$i]["id"]] = $$var ? true : false; |
$ncats[$categories[$i]["id"]] = $$var ? true : false; |
416 |
} |
} |
417 |
global $ed_title, $ed_lead, $ed_titlepic_pos, |
global $ed_title, $ed_lead, $ed_titlepic_pos, |
418 |
$ed_titlepic_alt, $ed_cat, $ed_more, |
$ed_titlepic_alt, $ed_cat, $ed_more, $ed_more_title, |
419 |
$ed_more_title, $ed_author_url, |
$ed_author_url, $ed_author_alt, $ed_author_info, |
420 |
$ed_author_alt, $ed_author_info, |
$ed_author_ime, $ed_author_cv, $ed_prikazi; |
|
$ed_author_ime, $ed_author_cv, |
|
|
$ed_prikazi; |
|
421 |
if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = ""; |
if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = ""; |
422 |
if (!$titlepic_url) $titlepic_url = $titlepic_url2; |
if (!$titlepic_url) $titlepic_url = $titlepic_url2; |
423 |
if (!$titlepic_url && !($clear_main || $clr_main)) $titlepic_url = $art["pic_url"]; |
if (!$titlepic_url && !($clear_main || $clr_main)) $titlepic_url = $art["pic_url"]; |
427 |
global $ed_title_force; |
global $ed_title_force; |
428 |
if ($titlepic_url && !$ed_titlepic_pos && !$ed_title_force) $ed_warning = 2; |
if ($titlepic_url && !$ed_titlepic_pos && !$ed_title_force) $ed_warning = 2; |
429 |
$i = 1; |
$i = 1; |
430 |
|
while (true) { |
431 |
|
$var = "ed_related_".$i; |
432 |
|
global $$var; |
433 |
|
if (!isset($$var)) break; |
434 |
|
array_push($related, $$var); |
435 |
|
$i++; |
436 |
|
} |
437 |
|
$i = 1; |
438 |
while (isset(${"ed_text_id_".$i})) { |
while (isset(${"ed_text_id_".$i})) { |
439 |
$id = ${"ed_text_id_".$i}; |
$id = ${"ed_text_id_".$i}; |
440 |
global ${"ed_text_".$i}, ${"ed_text_title_".$i}, |
global ${"ed_text_".$i}, ${"ed_text_title_".$i}, |
482 |
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
483 |
while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true; |
while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true; |
484 |
$sth->finish(); |
$sth->finish(); |
485 |
|
$sql = "SELECT rel_id FROM related WHERE (news_id = $ed_id)"; |
486 |
|
sql($sql); |
487 |
|
$sth = $dbh->prepare($sql); |
488 |
|
if (!$sth) error("Cannot prepare query: \"$sql\""); |
489 |
|
if (!$sth->execute()) error("Cannot execute query: \"$sql\""); |
490 |
|
while ($row = $sth->fetchrow_array()) { |
491 |
|
list($id) = $row; |
492 |
|
array_push($related, $id); |
493 |
|
} |
494 |
|
$sth->finish(); |
495 |
} else { |
} else { |
496 |
$art["show"] = true; |
$art["show"] = true; |
497 |
for ($j = 0; $j < count($specs); $j++) |
for ($j = 0; $j < count($specs); $j++) |
520 |
$ed_id = $art["id"]; |
$ed_id = $art["id"]; |
521 |
if (!$ed_id) $ed_id = -1; |
if (!$ed_id) $ed_id = -1; |
522 |
} |
} |
523 |
|
for ($i = count($related); $i < 10; $i++) array_push($related, 0); |
524 |
|
$tp->assign("related", $related); |
525 |
$ncats[$ed_cat] = true; |
$ncats[$ed_cat] = true; |
526 |
for ($i = 0; $i < count($specs); $i++) $specs[$i]["check"] = $nspecs[$specs[$i]["id"]]; |
for ($i = 0; $i < count($specs); $i++) $specs[$i]["check"] = $nspecs[$specs[$i]["id"]]; |
527 |
for ($i = 0; $i < count($categories); $i++) $categories[$i]["check"] = $ncats[$categories[$i]["id"]]; |
for ($i = 0; $i < count($categories); $i++) $categories[$i]["check"] = $ncats[$categories[$i]["id"]]; |
565 |
$fullurl = ${"textpic_full_".$i} = ${"textpic_full2_".$i} = $fname = ""; |
$fullurl = ${"textpic_full_".$i} = ${"textpic_full2_".$i} = $fname = ""; |
566 |
} |
} |
567 |
if (!$fname) $fname = $fullurl; |
if (!$fname) $fname = $fullurl; |
568 |
$txt = MyEscape(convert_html($txt), false); |
// ---- |
569 |
$txt2 = ParseNewline($txt, true); |
$txt3 = MyEscape(convert_html($txt), true); |
570 |
$txt3 = str_replace("&", "&", MyEscape(convert_html($txt), true)); |
$txt = str_replace("&", "&", MyEscape(convert_html($txt), false)); |
571 |
$txt3 = str_replace("\"", """, $txt3); |
$txt2 = $ed_preview ? ParseNewline($txt, true) : $txt3; |
572 |
$txt3 = str_replace("<", "<", $txt3); |
// ---- |
573 |
$txt3 = str_replace(">", ">", $txt3); |
$hl3 = MyEscape(convert_html($hl), true); |
574 |
$hl = MyEscape(convert_html($hl), false); |
$hl = str_replace("&", "&", MyEscape(convert_html($hl), false)); |
575 |
$hl2 = ParseNewline($hl, true); |
$hl2 = $ed_preview ? ParseNewline($hl, true) : $hl3; |
576 |
if ($hl2) $hl2 = GetHighlight($hl2); |
if ($hl) $hl = GetHighlight($hl); |
577 |
$hl3 = str_replace("&", "&", MyEscape(convert_html($hl), true)); |
// ---- |
|
$hl3 = str_replace("\"", """, $hl3); |
|
|
$hl3 = str_replace("<", "<", $hl3); |
|
|
$hl3 = str_replace(">", ">", $hl3); |
|
578 |
global ${"ed_text_force_".$i}; |
global ${"ed_text_force_".$i}; |
579 |
$force = ${"ed_text_force_".$i}; |
$force = ${"ed_text_force_".$i}; |
580 |
$empty = (($ed_preview && !$txt && !$pos && !$new) ? true : false); |
$empty = (($ed_preview && !$txt && !$pos && !$new) ? true : false); |
654 |
$tp->assign("AUTHOR", GetAuthor(MyEscape(convert_html($author_url)), |
$tp->assign("AUTHOR", GetAuthor(MyEscape(convert_html($author_url)), |
655 |
MyEscape(convert_html($ed_author_alt)), |
MyEscape(convert_html($ed_author_alt)), |
656 |
MyEscape(convert_html($ed_author_info)), |
MyEscape(convert_html($ed_author_info)), |
657 |
$width2, $height2)); |
$width2, $height2, $ed_author_cv)); |
658 |
} |
} |
659 |
$tp->assign("med", $isMed ? true : false); |
$tp->assign("med", $isMed ? true : false); |
660 |
$params = array(); |
$params = array(); |