/[health_html]/inc/newsEdit.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/newsEdit.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by ravilov, Wed Sep 26 13:04:28 2001 UTC revision 1.14 by ravilov, Fri Oct 12 09:22:02 2001 UTC
# Line 117  sql($sql); Line 117  sql($sql);
117                                  }                                  }
118                                  global $ed_title, $ed_lead, $ed_titlepic_alt,                                  global $ed_title, $ed_lead, $ed_titlepic_alt,
119                                          $ed_titlepic_pos, $ed_more, $ed_more_title,                                          $ed_titlepic_pos, $ed_more, $ed_more_title,
120                                          $ed_cat, $ed_author_alt, $ed_author_info;                                          $ed_cat, $ed_author_alt, $ed_author_info,
121                                            $ed_author_ime, $ed_prikazi;
122                                  $ed_title = MyQuote($ed_title);                                  $ed_title = MyQuote($ed_title);
123                                  $ed_lead = MyQuote($ed_lead);                                  $ed_lead = MyQuote($ed_lead);
124                                  $ed_author_nm = urldecode(MyQuote(basename($author_name)));                                  $ed_author_nm = urldecode(MyQuote(basename($author_name)));
125                                  $ed_author_alt = MyQuote($ed_author_alt);                                  $ed_author_alt = MyQuote($ed_author_alt);
126                                    $ed_author_ime = MyQuote($ed_author_ime);
127                                  $ed_author_info = MyQuote($ed_author_info);                                  $ed_author_info = MyQuote($ed_author_info);
128                                  $ed_titlepic_nm = urldecode(MyQuote(basename($titlepic_name)));                                  $ed_titlepic_nm = urldecode(MyQuote(basename($titlepic_name)));
129                                  $ed_titlepic_alt = MyQuote($ed_titlepic_alt);                                  $ed_titlepic_alt = MyQuote($ed_titlepic_alt);
# Line 129  sql($sql); Line 131  sql($sql);
131                                  $ed_more_title = MyQuote($ed_more_title);                                  $ed_more_title = MyQuote($ed_more_title);
132                                  if (!$ed_titlepic_pos) $ed_titlepic_pos = 0;                                  if (!$ed_titlepic_pos) $ed_titlepic_pos = 0;
133                                  if ($ed_id > 0) {                                  if ($ed_id > 0) {
134                                          $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, url = $ed_more, url_title = $ed_more_title, plivamed = ".($isMed?"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, 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)";
135  sql($sql);  sql($sql);
136                                          $dbh->dbh_do($sql);                                          $dbh->dbh_do($sql);
137                                  } else {                                  } else {
138                                          $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, author_name, 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_more, $ed_more_title, ".($isMed?"true":"false").", ".($ed_prikazi?"true":"false").", NOW(), NOW())";
139  sql($sql);  sql($sql);
140                                          $dbh->dbh_do($sql);                                          $dbh->dbh_do($sql);
141                                          $sql = "SELECT news_id FROM news WHERE (title = $ed_title)";                                          $sql = "SELECT currval('news_news_id_seq')::text";
142  sql($sql);  sql($sql);
143                                          $sth = $dbh->prepare($sql);                                          $sth = $dbh->prepare($sql);
144                                          if (!$sth) error("Cannot prepare query: \"$sql\"");                                          if (!$sth) error("Cannot prepare query: \"$sql\"");
# Line 295  sql($sql); Line 297  sql($sql);
297                  }                  }
298                  // -----                  // -----
299                  $tp = new Smarty();                  $tp = new Smarty();
                 // -----  
300                  $tp->assign("levels", $levels);                  $tp->assign("levels", $levels);
301                  // -----                  // -----
302                  global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos,                  global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos,
303                          $ed_titlepic_alt, $ed_cat, $ed_more,                          $ed_titlepic_alt, $ed_cat, $ed_more,
304                          $ed_more_title, $ed_author_url, $ed_author_alt,                          $ed_more_title, $ed_author_url, $ed_author_alt,
305                          $ed_author_info;                          $ed_author_info, $ed_author_ime, $ed_prikazi;
306                  global $ed_edit, $ed_preview, $preview, $add;                  global $ed_edit, $ed_preview, $preview, $add;
307                  if (!$ed_preview) $ed_preview = ($preview ? true : false);                  if (!$ed_preview) $ed_preview = ($preview ? true : false);
308                  if ($ed_edit) $ed_preview = false;                  if ($ed_edit) $ed_preview = false;
# Line 332  sql($sql); Line 333  sql($sql);
333                          global $ed_title, $ed_lead, $ed_titlepic_pos,                          global $ed_title, $ed_lead, $ed_titlepic_pos,
334                                  $ed_titlepic_alt, $ed_cat, $ed_more,                                  $ed_titlepic_alt, $ed_cat, $ed_more,
335                                  $ed_more_title, $ed_author_url,                                  $ed_more_title, $ed_author_url,
336                                  $ed_author_alt, $ed_author_info;                                  $ed_author_alt, $ed_author_info,
337                                    $ed_author_ime, $ed_prikazi;
338                          if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = "";                          if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = "";
339                          if (!$titlepic_url) $titlepic_url = $titlepic_url2;                          if (!$titlepic_url) $titlepic_url = $titlepic_url2;
340                          if (!$titlepic_url && !($clear_main || $clr_main)) $titlepic_url = $art["pic_url"];                          if (!$titlepic_url && !($clear_main || $clr_main)) $titlepic_url = $art["pic_url"];
# Line 380  sql($sql); Line 382  sql($sql);
382                                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");                                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
383                                  while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true;                                  while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true;
384                                  $sth->finish();                                  $sth->finish();
385                          }                          } else $art["show"] = true;
386                          list($ed_title, $ed_lead, $ed_titlepic_pos, $titlepic_url,                          list($ed_title, $ed_lead, $ed_titlepic_pos, $titlepic_url,
387                                  $titlepic_url2, $titlepic_name, $ed_titlepic_alt,                                  $titlepic_url2, $titlepic_name, $ed_titlepic_alt,
388                                  $ed_cat, $ed_more, $ed_more_title, $width, $height,                                  $ed_cat, $ed_more, $ed_more_title, $width, $height,
389                                  $author_url, $author_url2, $author_name,                                  $author_url, $author_url2, $author_name,
390                                  $ed_author_alt, $ed_author_info, $width2, $height2) =                                  $ed_author_alt, $ed_author_info, $width2, $height2,
391                                  array($art["title"], $art["lead"], $art["pic_pos"],                                  $ed_author_ime, $ed_prikazi) = array($art["title"], $art["lead"],
392                                  $art["pic_url"], $art["pic_url"], urldecode($art["pic_url"]),                                  $art["pic_pos"], $art["pic_url"], $art["pic_url"],
393                                  $art["pic_alt"], $art["category"], $art["more"],                                  urldecode($art["pic_url"]), $art["pic_alt"], $art["category"],
394                                  $art["more_title"], $art["pic_w"], $art["pic_h"],                                  $art["more"], $art["more_title"], $art["pic_w"], $art["pic_h"],
395                                  $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]),                                  $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]),
396                                  $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"]);                                  $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"],
397                                    $art["au_name"], $art["show"]);
398                            if ($art["text"]) reset($art["text"]);
399                          while ($art["text"] && list($id, $val) = each($art["text"])) {                          while ($art["text"] && list($id, $val) = each($art["text"])) {
400                                  array_push($ed_pgfs, array($val["id"], $val["text"], $val["title"],                                  array_push($ed_pgfs, array($val["id"], $val["text"], $val["title"],
401                                          $val["level"], urldecode($val["pic"]),                                          $val["level"], urldecode($val["pic"]),
# Line 438  sql($sql); Line 442  sql($sql);
442                          if (!$name) $name = $picurl;                          if (!$name) $name = $picurl;
443                          $txt = MyEscape(convert_html($txt), false);                          $txt = MyEscape(convert_html($txt), false);
444                          $txt2 = ParseNewline($txt, true);                          $txt2 = ParseNewline($txt, true);
445                          $txt3 = str_replace("&", "&", $txt);                          $txt3 = str_replace("&", "&", MyEscape(convert_html($txt), true));
446                          $txt3 = str_replace("\"", """, $txt3);                          $txt3 = str_replace("\"", """, $txt3);
447                          $txt3 = str_replace("<", "&lt;", $txt3);                          $txt3 = str_replace("<", "&lt;", $txt3);
448                          $txt3 = str_replace(">", "&gt;", $txt3);                          $txt3 = str_replace(">", "&gt;", $txt3);
449                          $hl = MyEscape(convert_html($hl), false);                          $hl = MyEscape(convert_html($hl), false);
450                          $hl2 = ParseNewline($hl, true);                          $hl2 = ParseNewline($hl, true);
451                          if ($hl2) $hl2 = GetHighlight($hl2);                          if ($hl2) $hl2 = GetHighlight($hl2);
452                          $hl3 = str_replace("&", "&amp;", $hl);                          $hl3 = str_replace("&", "&amp;", MyEscape(convert_html($hl), true));
453                          $hl3 = str_replace("\"", "&quot;", $hl3);                          $hl3 = str_replace("\"", "&quot;", $hl3);
454                          $hl3 = str_replace("<", "&lt;", $hl3);                          $hl3 = str_replace("<", "&lt;", $hl3);
455                          $hl3 = str_replace(">", "&gt;", $hl3);                          $hl3 = str_replace(">", "&gt;", $hl3);
# Line 487  sql($sql); Line 491  sql($sql);
491                  $tp->assign("ed_preview", $ed_preview);                  $tp->assign("ed_preview", $ed_preview);
492                  $tp->assign("ed_trigger", $trigger);                  $tp->assign("ed_trigger", $trigger);
493                  $tp->assign("ed_title", MyEscape(convert_html($ed_title)));                  $tp->assign("ed_title", MyEscape(convert_html($ed_title)));
494                  $tp->assign("ed_lead", MyEscape(convert_html($ed_lead)));                  $tp->assign("ed_lead", MyEscape(convert_html($ed_lead), true));
495                    $tp->assign("ed_lead2", ParseNewline(MyEscape(convert_html($ed_lead), false), false));
496                  $tp->assign("ed_titlepic_pos", $ed_titlepic_pos);                  $tp->assign("ed_titlepic_pos", $ed_titlepic_pos);
497                  $tp->assign("ed_titlepic_url", MyEscape(convert_html($titlepic_url)));                  $tp->assign("ed_titlepic_url", MyEscape(convert_html($titlepic_url)));
498                  $tp->assign("ed_titlepic_url2", MyEscape(convert_html($titlepic_url2)));                  $tp->assign("ed_titlepic_url2", MyEscape(convert_html($titlepic_url2)));
# Line 500  sql($sql); Line 505  sql($sql);
505                  $tp->assign("ed_author_name", MyEscape(convert_html($author_name)));                  $tp->assign("ed_author_name", MyEscape(convert_html($author_name)));
506                  $tp->assign("ed_author_alt", MyEscape(convert_html($ed_author_alt)));                  $tp->assign("ed_author_alt", MyEscape(convert_html($ed_author_alt)));
507                  $tp->assign("ed_author_info", MyEscape(convert_html($ed_author_info)));                  $tp->assign("ed_author_info", MyEscape(convert_html($ed_author_info)));
508                    $tp->assign("ed_author_ime", MyEscape(convert_html($ed_author_ime)));
509                  $tp->assign("ed_author_width", $width2);                  $tp->assign("ed_author_width", $width2);
510                  $tp->assign("ed_author_height", $height2);                  $tp->assign("ed_author_height", $height2);
511                  $tp->assign("ed_more", MyEscape($ed_more));                  $tp->assign("ed_more", MyEscape($ed_more));
512                  $tp->assign("ed_more_new", strstr($ed_more, "://") ? true : false);                  $tp->assign("ed_more_new", strstr($ed_more, "://") ? true : false);
513                  $tp->assign("ed_more_title", MyEscape($ed_more_title));                  $tp->assign("ed_more_title", MyEscape($ed_more_title));
514                    $tp->assign("ed_prikazi", $ed_prikazi);
515                  $tp->assign("ed_clr_main", ($clear_main || $clr_main || !$titlepic_url) ? true : false);                  $tp->assign("ed_clr_main", ($clear_main || $clr_main || !$titlepic_url) ? true : false);
516                  $tp->assign("ed_clr_author", ($clear_author || $clr_author || !$author_url) ? true : false);                  $tp->assign("ed_clr_author", ($clear_author || $clr_author || !$author_url) ? true : false);
517                  $tp->assign("ed_text", $ed_text);                  $tp->assign("ed_text", $ed_text);
# Line 516  sql($sql); Line 523  sql($sql);
523                  $tp->assign("aupicdir", "$aupicdir/");                  $tp->assign("aupicdir", "$aupicdir/");
524                  $tp->assign("vijest", $isVijest ? true : false);                  $tp->assign("vijest", $isVijest ? true : false);
525                  if ($ed_preview) {                  if ($ed_preview) {
                         include_once("author.php");  
526                          $tp->assign("AUTHOR", GetAuthor(MyEscape(convert_html($author_url)),                          $tp->assign("AUTHOR", GetAuthor(MyEscape(convert_html($author_url)),
527                                  MyEscape(convert_html($ed_author_alt)),                                  MyEscape(convert_html($ed_author_alt)),
528                                  MyEscape(convert_html($ed_author_info)),                                  MyEscape(convert_html($ed_author_info)),

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.26