/[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.14 by ravilov, Fri Oct 12 09:22:02 2001 UTC revision 1.16 by ravilov, Tue Oct 16 13:07:03 2001 UTC
# Line 15  Line 15 
15                  #echo "<TT><B>[SQL]</B> $sql<BR>\n";                  #echo "<TT><B>[SQL]</B> $sql<BR>\n";
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 my_cmp_2($a, $b) { return MyCompare($a["ime"], $b["ime"]); }
19          function newsEdit($art, $trigger = "", $isVijest = false) {          function newsEdit($art, $trigger = "", $isVijest = false) {
20                  global $phptmp, $picdir, $syspicdir, $aupicdir, $sysaupicdir, $dbh, $tpl;                  global $phptmp, $picdir, $syspicdir, $aupicdir, $sysaupicdir, $dbh;
21                  global $section, $section_menu, $section_menu2, $spec;                  global $section, $section_menu, $section_menu2, $spec;
22                  global $ed_id, $ed_cat, $isMed;                  global $ed_id, $ed_cat, $isMed;
23                  $i = 1;                  $i = 1;
# Line 50  Line 51 
51                          global ${"ed_clear_".$i}, ${"ed_clr_".$i};                          global ${"ed_clear_".$i}, ${"ed_clr_".$i};
52                          ${"clear_".$i} = ${"ed_clear_".$i};                          ${"clear_".$i} = ${"ed_clear_".$i};
53                          ${"clr_".$i} = ${"ed_clr_".$i};                          ${"clr_".$i} = ${"ed_clr_".$i};
54                            global ${"ed_fclear_".$i}, ${"ed_fclr_".$i};
55                            ${"fclear_".$i} = ${"ed_fclear_".$i};
56                            ${"fclr_".$i} = ${"ed_fclr_".$i};
57                          global ${"ed_textpic_url_".$i}, ${"ed_textpic_url2_".$i}, ${"ed_textpic_name_".$i};                          global ${"ed_textpic_url_".$i}, ${"ed_textpic_url2_".$i}, ${"ed_textpic_name_".$i};
58                          ${"textpic_url_".$i} = ${"ed_textpic_url_".$i};                          ${"textpic_url_".$i} = ${"ed_textpic_url_".$i};
59                          ${"textpic_url2_".$i} = ${"ed_textpic_url2_".$i};                          ${"textpic_url2_".$i} = ${"ed_textpic_url2_".$i};
60                          ${"textpic_name_".$i} = urldecode(${"ed_textpic_name_".$i});                          ${"textpic_name_".$i} = urldecode(${"ed_textpic_name_".$i});
61                          # Fix for M$IE                          # Fix for M$IE
62                          if (${"textpic_url_".$i} == "none") ${"textpic_url_".$i} = "";                          if (${"textpic_url_".$i} == "none") ${"textpic_url_".$i} = "";
63                            global ${"ed_textpic_full_".$i}, ${"ed_textpic_full2_".$i}, ${"ed_textpic_fname_".$i};
64                            ${"textpic_full_".$i} = ${"ed_textpic_full_".$i};
65                            ${"textpic_full2_".$i} = ${"ed_textpic_full2_".$i};
66                            ${"textpic_fname_".$i} = urldecode(${"ed_textpic_fname_".$i});
67                            # Fix for M$IE
68                            if (${"textpic_full_".$i} == "none") ${"textpic_full_".$i} = "";
69                          $i++;                          $i++;
70                  }                  }
71                  // -----                  // -----
# Line 70  sql($sql); Line 80  sql($sql);
80                  $sth->finish();                  $sth->finish();
81                  usort($categories, "my_cmp");                  usort($categories, "my_cmp");
82                  // -----                  // -----
83                    $autori = array();
84                    $sql = "SELECT autor_id, ime FROM autori";
85    sql($sql);
86                    $sth = $dbh->prepare($sql);
87                    if (!$sth) error("Cannot prepare query: \"$sql\"");
88                    if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
89                    while ($row = $sth->fetchrow_array()) array_push($autori, array("id" => $row[0], "ime" => MyEscape($row[1], false)));
90                    $sth->finish();
91                    usort($autori, "my_cmp_2");
92                    // -----
93                  $specs = array();                  $specs = array();
94                  $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)";
95  sql($sql);  sql($sql);
# Line 79  sql($sql); Line 99  sql($sql);
99                  while ($row = $sth->fetchrow_array()) array_push($specs, array("id" => $row[0], "txt" => $row[1]));                  while ($row = $sth->fetchrow_array()) array_push($specs, array("id" => $row[0], "txt" => $row[1]));
100                  $sth->finish();                  $sth->finish();
101                  usort($specs, "my_cmp");                  usort($specs, "my_cmp");
102                    array_unshift($specs, array("id" => 0, "txt" => "HOME"));
103                  // -----                  // -----
104                  $levels = array();                  $levels = array();
105                  $sql = "SELECT level_id, class, name FROM par_levels ORDER BY name";                  $sql = "SELECT level_id, class, name FROM par_levels ORDER BY name";
# Line 118  sql($sql); Line 139  sql($sql);
139                                  global $ed_title, $ed_lead, $ed_titlepic_alt,                                  global $ed_title, $ed_lead, $ed_titlepic_alt,
140                                          $ed_titlepic_pos, $ed_more, $ed_more_title,                                          $ed_titlepic_pos, $ed_more, $ed_more_title,
141                                          $ed_cat, $ed_author_alt, $ed_author_info,                                          $ed_cat, $ed_author_alt, $ed_author_info,
142                                          $ed_author_ime, $ed_prikazi;                                          $ed_author_ime, $ed_author_cv, $ed_prikazi;
143                                  $ed_title = MyQuote($ed_title);                                  $ed_title = MyQuote($ed_title);
144                                  $ed_lead = MyQuote($ed_lead);                                  $ed_lead = MyQuote($ed_lead);
145                                  $ed_author_nm = urldecode(MyQuote(basename($author_name)));                                  $ed_author_nm = urldecode(MyQuote(basename($author_name)));
# Line 130  sql($sql); Line 151  sql($sql);
151                                  $ed_more = MyQuote($ed_more);                                  $ed_more = MyQuote($ed_more);
152                                  $ed_more_title = MyQuote($ed_more_title);                                  $ed_more_title = MyQuote($ed_more_title);
153                                  if (!$ed_titlepic_pos) $ed_titlepic_pos = 0;                                  if (!$ed_titlepic_pos) $ed_titlepic_pos = 0;
154                                    if (!$ed_author_cv) $ed_author_cv = 0;
155                                  if ($ed_id > 0) {                                  if ($ed_id > 0) {
156                                          $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)";                                          $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)";
157  sql($sql);  sql($sql);
158                                          $dbh->dbh_do($sql);                                          $dbh->dbh_do($sql);
159                                  } else {                                  } else {
160                                          $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())";                                          $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())";
161  sql($sql);  sql($sql);
162                                          $dbh->dbh_do($sql);                                          $dbh->dbh_do($sql);
163                                          $sql = "SELECT currval('news_news_id_seq')::text";                                          $sql = "SELECT currval('news_news_id_seq')::text";
# Line 161  sql($sql); Line 183  sql($sql);
183                                                  ${"ed_textpic_alt_".$i}, ${"ed_textpic_pos_".$i},                                                  ${"ed_textpic_alt_".$i}, ${"ed_textpic_pos_".$i},
184                                                  ${"ed_text_level_".$i}, ${"ed_hl_".$i},                                                  ${"ed_text_level_".$i}, ${"ed_hl_".$i},
185                                                  ${"ed_textpic_exp_".$i};                                                  ${"ed_textpic_exp_".$i};
186                                          list($id, $tit, $txt, $pic, $orig, $alt, $pos, $del, $lev, $hl, $exp) = array(                                          list($id, $tit, $txt, $pic, $orig,$full, $forig, $alt, $pos, $del, $lev, $hl, $exp) = array(
187                                                  ${"ed_text_id_".$i}, ${"ed_text_title_".$i},                                                  ${"ed_text_id_".$i}, ${"ed_text_title_".$i}, ${"ed_text_".$i},
188                                                  ${"ed_text_".$i}, ${"textpic_url2_".$i}, ${"textpic_name_".$i},                                                  ${"textpic_url2_".$i}, ${"textpic_name_".$i}, ${"textpic_full2_".$i},
189                                                  ${"ed_textpic_alt_".$i}, ${"ed_textpic_pos_".$i},                                                  ${"textpic_fname_".$i}, ${"ed_textpic_alt_".$i},
190                                                  ${"del_".$i}, ${"ed_text_level_".$i}, ${"ed_hl_".$i},                                                  ${"ed_textpic_pos_".$i}, ${"del_".$i}, ${"ed_text_level_".$i},
191                                                  ${"ed_textpic_exp_".$i});                                                  ${"ed_hl_".$i}, ${"ed_textpic_exp_".$i});
192                                          if ($lev != $last_level) {                                          if ($lev != $last_level) {
193                                                  if ($last_level) {                                                  if ($last_level) {
194                                                          if ($last_level < $lev) array_push($parents, $id);                                                          if ($last_level < $lev) array_push($parents, $id);
# Line 182  sql($sql); Line 204  sql($sql);
204                                          $hl = MyQuote($hl);                                          $hl = MyQuote($hl);
205                                          $orig = basename($orig);                                          $orig = basename($orig);
206                                          $org = MyQuote($orig);                                          $org = MyQuote($orig);
207                                            $forig = basename($forig);
208                                            $forg = MyQuote($forig);
209                                          $alt = MyQuote($alt);                                          $alt = MyQuote($alt);
210                                          if (!$pos) $pos = 0;                                          if (!$pos) $pos = 0;
211                                          if ($id && $id > 0) {                                          if ($id && $id > 0) {
# Line 197  sql($sql); Line 221  sql($sql);
221                                                          }                                                          }
222                                                          $sth->finish();                                                          $sth->finish();
223                                                  }                                                  }
224                                                    if ($del || !$forig) {
225                                                            $sql = "SELECT full_pic FROM paragraphs WHERE (news_id = $ed_id) AND (paragraph_id = $id)";
226    sql($sql);
227                                                            $sth = $dbh->prepare($sql);
228                                                            if (!$sth) error("Cannot prepare query: \"$sql\"");
229                                                            if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
230                                                            while ($row = $sth->fetchrow_array()) {
231                                                                    list($pic) = $row;
232                                                                    MyDelete($syspicdir."/".$pic);
233                                                            }
234                                                            $sth->finish();
235                                                    }
236                                                  if ($del) $sql = "DELETE FROM paragraphs WHERE (news_id = $ed_id) AND (paragraph_id = $id)";                                                  if ($del) $sql = "DELETE FROM paragraphs WHERE (news_id = $ed_id) AND (paragraph_id = $id)";
237                                                          else $sql = "UPDATE paragraphs SET title = $tit, level = $lev, text = $txt, hl = $hl, pic = $org, alt = $alt, pos = $pos, pic_title = $exp WHERE (news_id = $ed_id) AND (paragraph_id = $id)";                                                          else $sql = "UPDATE paragraphs SET title = $tit, level = $lev, text = $txt, hl = $hl, pic = $org, full_pic = $forg, alt = $alt, pos = $pos, pic_title = $exp WHERE (news_id = $ed_id) AND (paragraph_id = $id)";
238  sql($sql);  sql($sql);
239                                                  $dbh->dbh_do($sql);                                                  $dbh->dbh_do($sql);
240                                          } else if (!$del) {                                          } else if (!$del) {
241                                                  $sql = "INSERT INTO paragraphs (news_id, title, level, text, pic, alt, pos, hl, pic_title) VALUES ($ed_id, $tit, $lev, $txt, $org, $alt, $pos, $hl, $exp)";                                                  $sql = "INSERT INTO paragraphs (news_id, title, level, text, pic, full_pic, alt, pos, hl, pic_title) VALUES ($ed_id, $tit, $lev, $txt, $org, $forg, $alt, $pos, $hl, $exp)";
242  sql($sql);  sql($sql);
243                                                  $dbh->dbh_do($sql);                                                  $dbh->dbh_do($sql);
244                                                  $sql = "SELECT currval('paragraphs_paragraph_id_seq')::text";                                                  $sql = "SELECT currval('paragraphs_paragraph_id_seq')::text";
# Line 216  sql($sql); Line 252  sql($sql);
252                                                  $last_id = $id = $row;                                                  $last_id = $id = $row;
253                                          }                                          }
254                                          if ($pic) MyMove("$syspicdir/$pic", "$syspicdir/$orig");                                          if ($pic) MyMove("$syspicdir/$pic", "$syspicdir/$orig");
255                                            if ($full) MyMove("$syspicdir/$full", "$syspicdir/$forig");
256                                          $i++;                                          $i++;
257                                  }                                  }
258                                  if ($ed_id) {                                  if ($ed_id) {
# Line 223  sql($sql); Line 260  sql($sql);
260  sql($sql);  sql($sql);
261                                          $dbh->dbh_do($sql);                                          $dbh->dbh_do($sql);
262                                          for ($k = 0; $k < count($specs); $k++) {                                          for ($k = 0; $k < count($specs); $k++) {
263                                                  $var = "ed_spec_".$specs[$k]["id"]; global $$var;                                                  $var = "ed_spec_".$specs[$k]["id"];
264                                                    global $$var;
265                                                  if (!$$var) continue;                                                  if (!$$var) continue;
266                                                  $sql = "INSERT INTO spec_news (news_id, spec_id) VALUES ($ed_id, ".$specs[$k]["id"].")";                                                  $sql = "INSERT INTO spec_news (news_id, spec_id) VALUES ($ed_id, ".$specs[$k]["id"].")";
267  sql($sql);  sql($sql);
# Line 249  sql($sql); Line 287  sql($sql);
287                                  while (isset(${"ed_textpic_id_".$i})) {                                  while (isset(${"ed_textpic_id_".$i})) {
288                                          $tmp = ${"textpic_url2_".$i};                                          $tmp = ${"textpic_url2_".$i};
289                                          if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp);                                          if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp);
290                                            $tmp = ${"textpic_full2_".$i};
291                                            if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp);
292                                          $i++;                                          $i++;
293                                  }                                  }
294                          }                          }
# Line 291  sql($sql); Line 331  sql($sql);
331                                  $u = ${"textpic_url2_".$n};                                  $u = ${"textpic_url2_".$n};
332                                  if (ereg("$phptmp", $u)) MyDelete($syspicdir."/".$u2);                                  if (ereg("$phptmp", $u)) MyDelete($syspicdir."/".$u2);
333                                  unset(${"clear_".$n}, ${"clr_".$n});                                  unset(${"clear_".$n}, ${"clr_".$n});
334                            } else if (ereg("^ed_textpic_full_([1-9][0-9]*)$", $key, $regs)) {
335                                    move_uploaded_file($tname, $syspicdir."/".$nm.$ext);
336                                    $n = $regs[1];
337                                    ${"textpic_full_".$n} = $nm.$ext;
338                                    ${"textpic_fname_".$n} = $name;
339                                    $u = ${"textpic_full2_".$n};
340                                    if (ereg("$phptmp", $u)) MyDelete($syspicdir."/".$u2);
341                                    unset(${"fclear_".$n}, ${"fclr_".$n});
342                          } else {                          } else {
343                                  // [?!?]                                  // ?!?
344                          }                          }
345                  }                  }
346                  // -----                  // -----
347                  $tp = new Smarty();                  $tp = new Smarty();
348                  $tp->assign("levels", $levels);                  $tp->assign("levels", $levels);
349                    $tp->assign("autori", $autori);
350                  // -----                  // -----
351                  global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos,                  global $ed_id, $ed_title, $ed_lead, $ed_titlepic_pos,
352                          $ed_titlepic_alt, $ed_cat, $ed_more,                          $ed_titlepic_alt, $ed_cat, $ed_more,
# Line 323  sql($sql); Line 372  sql($sql);
372                          for ($i = 0; $i < count($specs); $i++) {                          for ($i = 0; $i < count($specs); $i++) {
373                                  $var = "ed_spec_".$specs[$i]["id"];                                  $var = "ed_spec_".$specs[$i]["id"];
374                                  global $$var;                                  global $$var;
375                                  $nspecs[$specs[$i]["id"]] = $$var ? true : false;                                  $foo = isset($$var) ? $$var : ($spec && $spec == $specs[$i]["id"]);
376                                    $nspecs[$specs[$i]["id"]] = $foo ? true : false;
377                          }                          }
378                          for ($i = 0; $i < count($categories); $i++) {                          for ($i = 0; $i < count($categories); $i++) {
379                                  $var = "ed_cat_".$categories[$i]["id"];                                  $var = "ed_cat_".$categories[$i]["id"];
# Line 334  sql($sql); Line 384  sql($sql);
384                                  $ed_titlepic_alt, $ed_cat, $ed_more,                                  $ed_titlepic_alt, $ed_cat, $ed_more,
385                                  $ed_more_title, $ed_author_url,                                  $ed_more_title, $ed_author_url,
386                                  $ed_author_alt, $ed_author_info,                                  $ed_author_alt, $ed_author_info,
387                                  $ed_author_ime, $ed_prikazi;                                  $ed_author_ime, $ed_author_cv,
388                                    $ed_prikazi;
389                          if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = "";                          if (!$HTTP_POST_FILES["ed_titlepic_url"]["name"]) $titlepic_url = "";
390                          if (!$titlepic_url) $titlepic_url = $titlepic_url2;                          if (!$titlepic_url) $titlepic_url = $titlepic_url2;
391                          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 353  sql($sql); Line 404  sql($sql);
404                                  $pic_url = ($HTTP_POST_FILES["ed_textpic_url_".$i]["name"]) ?                                  $pic_url = ($HTTP_POST_FILES["ed_textpic_url_".$i]["name"]) ?
405                                          ${"textpic_url_".$i} : "";                                          ${"textpic_url_".$i} : "";
406                                  if (!$pic_url) $pic_url = ${"textpic_url2_".$i};                                  if (!$pic_url) $pic_url = ${"textpic_url2_".$i};
407                                    $full_url = ($HTTP_POST_FILES["ed_textpic_full_".$i]["name"]) ?
408                                            ${"textpic_full_".$i} : "";
409                                    if (!$full_url) $full_url = ${"textpic_full2_".$i};
410                                  $tmp = "";                                  $tmp = "";
411                                  for ($j = 0; $j < count($art["text"]); $j++)                                  for ($j = 0; $j < count($art["text"]); $j++)
412                                          if ($art["text"][$j]["id"] == $id) $tmp = $art["text"][$j]["pic"];                                          if ($art["text"][$j]["id"] == $id) $tmp = $art["text"][$j]["pic"];
413                                  if (!$pic_url && $tmp && !(${"clear_".$i} || ${"clr_".$i})) $pic_url = $tmp;                                  if (!$pic_url && $tmp && !(${"clear_".$i} || ${"clr_".$i})) $pic_url = $tmp;
414                                    $tmp = "";
415                                    for ($j = 0; $j < count($art["text"]); $j++)
416                                            if ($art["text"][$j]["id"] == $id) $tmp = $art["text"][$j]["full"];
417                                    if (!$full_url && $tmp && !(${"fclear_".$i} || ${"fclr_".$i})) $full_url = $tmp;
418                                  $level = ${"ed_text_level_".$i};                                  $level = ${"ed_text_level_".$i};
419                                  list($w, $h) = PicSize($pic_url);                                  list($w, $h) = PicSize($pic_url);
420                                    list($w2, $h2) = PicSize($full_url);
421                                  array_push($ed_pgfs, array($id,                                  array_push($ed_pgfs, array($id,
422                                          ${"ed_text_".$i}, ${"ed_text_title_".$i},                                          ${"ed_text_".$i}, ${"ed_text_title_".$i},
423                                          $level, $pic_url, ${"textpic_name_".$i},                                          $level, $pic_url, ${"textpic_name_".$i},
424                                            $full_url, ${"textpic_fname_".$i},
425                                          ${"ed_textpic_alt_".$i}, ${"ed_textpic_pos_".$i},                                          ${"ed_textpic_alt_".$i}, ${"ed_textpic_pos_".$i},
426                                          $w, $h, ${"ed_hl_".$i}, ${"ed_textpic_exp_".$i}, false));                                          $w, $h, $w2, $h2, ${"ed_hl_".$i}, ${"ed_textpic_exp_".$i}, false));
427                                  $i++;                                  $i++;
428                          }                          }
429                  } else {                  } else {
# Line 382  sql($sql); Line 442  sql($sql);
442                                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");                                  if (!$sth->execute()) error("Cannot execute query: \"$sql\"");
443                                  while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true;                                  while ($row = $sth->fetchrow_array()) $ncats[$row[0]] = true;
444                                  $sth->finish();                                  $sth->finish();
445                          } else $art["show"] = true;                          } else {
446                                    $art["show"] = true;
447                                    for ($j = 0; $j < count($specs); $j++)
448                                            $nspecs[$specs[$j]["id"]] = ($specs[$j]["id"] == $spec) ? true : false;
449                            }
450                          list($ed_title, $ed_lead, $ed_titlepic_pos, $titlepic_url,                          list($ed_title, $ed_lead, $ed_titlepic_pos, $titlepic_url,
451                                  $titlepic_url2, $titlepic_name, $ed_titlepic_alt,                                  $titlepic_url2, $titlepic_name, $ed_titlepic_alt,
452                                  $ed_cat, $ed_more, $ed_more_title, $width, $height,                                  $ed_cat, $ed_more, $ed_more_title, $width, $height,
453                                  $author_url, $author_url2, $author_name,                                  $author_url, $author_url2, $author_name,
454                                  $ed_author_alt, $ed_author_info, $width2, $height2,                                  $ed_author_alt, $ed_author_info, $width2, $height2,
455                                  $ed_author_ime, $ed_prikazi) = array($art["title"], $art["lead"],                                  $ed_author_ime, $ed_author_cv, $ed_prikazi) = array($art["title"],
456                                  $art["pic_pos"], $art["pic_url"], $art["pic_url"],                                  $art["lead"], $art["pic_pos"], $art["pic_url"], $art["pic_url"],
457                                  urldecode($art["pic_url"]), $art["pic_alt"], $art["category"],                                  urldecode($art["pic_url"]), $art["pic_alt"], $art["category"],
458                                  $art["more"], $art["more_title"], $art["pic_w"], $art["pic_h"],                                  $art["more"], $art["more_title"], $art["pic_w"], $art["pic_h"],
459                                  $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]),                                  $art["au_pic"], $art["au_pic"], urldecode($art["au_pic"]),
460                                  $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"],                                  $art["au_alt"], $art["au_info"], $art["au_w"], $art["au_h"],
461                                  $art["au_name"], $art["show"]);                                  $art["au_name"], $art["au_cv"], $art["show"]);
462                          if ($art["text"]) reset($art["text"]);                          if ($art["text"]) reset($art["text"]);
463                          while ($art["text"] && list($id, $val) = each($art["text"])) {                          while ($art["text"] && list($id, $val) = each($art["text"])) {
464                                  array_push($ed_pgfs, array($val["id"], $val["text"], $val["title"],                                  array_push($ed_pgfs, array($val["id"], $val["text"], $val["title"],
465                                          $val["level"], urldecode($val["pic"]),                                          $val["level"], urldecode($val["pic"]),
466                                          urldecode($val["pic"]), $val["alt"], $val["pos"], $val["w"],                                          urldecode($val["pic"]), urldecode($val["full"]), urldecode($val["full"]),
467                                          $val["h"], $val["hl"], $val["exp"], false));                                          $val["alt"], $val["pos"], $val["w"], $val["h"], $val["fw"], $val["fh"],
468                                            $val["hl"], $val["exp"], false));
469                          }                          }
470                          $ed_id = $art["id"];                          $ed_id = $art["id"];
471                          if (!$ed_id) $ed_id = -1;                          if (!$ed_id) $ed_id = -1;
# Line 417  sql($sql); Line 482  sql($sql);
482                  if ($add) {                  if ($add) {
483                          global $add_num;                          global $add_num;
484                          for ($i = 0; $i < intval($add_num); $i++)                          for ($i = 0; $i < intval($add_num); $i++)
485                                  array_push($ed_pgfs, array(-1, "", "", -1, "", "", "", 0, 0, 0, "", "", true));                                  array_push($ed_pgfs, array(-1, "", "", -1, "", "", "", "", "", 0, 0, 0, 0, 0, "", "", true));
486                  }                  }
487                  $ed_empty = ($ed_title || $ed_lead || $ed_titlepic_pos || $ed_more) ? false : true;                  $ed_empty = ($ed_title || $ed_lead || $ed_titlepic_pos || $ed_more) ? false : true;
488                  $ed_text = array();                  $ed_text = array();
# Line 425  sql($sql); Line 490  sql($sql);
490                  $ed_warnings = ($ed_warning ? true : false);                  $ed_warnings = ($ed_warning ? true : false);
491                  $i = 1;                  $i = 1;
492                  while (list($key, $val) = each($ed_pgfs)) {                  while (list($key, $val) = each($ed_pgfs)) {
493                          list($id, $txt, $tit, $lev, $pic, $name, $alt, $pos, $w, $h, $hl, $exp, $new) = $val;                          list($id, $txt, $tit, $lev, $pic, $name, $fpic, $fname, $alt, $pos, $w, $h, $fw, $fh, $hl, $exp, $new) = $val;
494                          $del = ((${"delete_".$i} || ${"del_".$i}) ? true : false);                          $del = ((${"delete_".$i} || ${"del_".$i}) ? true : false);
495                          array_push($ed_records, array("val" => $del, "id" => $id));                          array_push($ed_records, array("val" => $del, "id" => $id));
496                          if ($del) { $i++; continue; }                          if ($del) { $i++; continue; }
497                          $picurl = ${"textpic_url_".$id};                          $picurl = ${"textpic_url_".$id};
498                          if (!$picurl) $picurl = $pic;                          if (!$picurl) $picurl = $pic;
499                            $fullurl = ${"textpic_full_".$id};
500                            if (!$fullurl) $fullurl = $fpic;
501                          $class = "";                          $class = "";
502                          reset($levels);                          reset($levels);
503                          while (list($k, $v) = each($levels)) if ($v["id"] == $lev) $class = $v["class"];                          while (list($k, $v) = each($levels)) if ($v["id"] == $lev) $class = $v["class"];
# Line 440  sql($sql); Line 507  sql($sql);
507                                  $picurl = ${"textpic_url_".$i} = ${"textpic_url2_".$i} = $name = "";                                  $picurl = ${"textpic_url_".$i} = ${"textpic_url2_".$i} = $name = "";
508                          }                          }
509                          if (!$name) $name = $picurl;                          if (!$name) $name = $picurl;
510                            if ((${"fclear_".$i} || ${"fclr_".$i}) && $ed_preview && (${"textpic_full_".$i} != ${"textpic_full2_".$i})) {
511                                    $tmp = ${"textpic_full2_".$i};
512                                    if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp);
513                                    $fullurl = ${"textpic_full_".$i} = ${"textpic_full2_".$i} = $fname = "";
514                            }
515                            if (!$fname) $fname = $fullurl;
516                          $txt = MyEscape(convert_html($txt), false);                          $txt = MyEscape(convert_html($txt), false);
517                          $txt2 = ParseNewline($txt, true);                          $txt2 = ParseNewline($txt, true);
518                          $txt3 = str_replace("&", "&amp;", MyEscape(convert_html($txt), true));                          $txt3 = str_replace("&", "&amp;", MyEscape(convert_html($txt), true));
# Line 475  sql($sql); Line 548  sql($sql);
548                                  "class" => MyEscape(convert_html($class)),                                  "class" => MyEscape(convert_html($class)),
549                                  "url" => MyEscape(convert_html($picurl)),                                  "url" => MyEscape(convert_html($picurl)),
550                                  "name" => MyEscape(convert_html($name)),                                  "name" => MyEscape(convert_html($name)),
551                                    "full" => MyEscape(convert_html($fullurl)),
552                                    "fname" => MyEscape(convert_html($fname)),
553                                  "alt" => MyEscape(convert_html($alt)),                                  "alt" => MyEscape(convert_html($alt)),
554                                  "w" => $w,                                  "w" => $w,
555                                  "h" => $h,                                  "h" => $h,
556                                    "fw" => $fw,
557                                    "fh" => $fh,
558                                  "pos" => $pos,                                  "pos" => $pos,
559                                  "exp" => MyEscape(convert_html($exp)),                                  "exp" => MyEscape(convert_html($exp)),
560                                  "warning" => $warning,                                  "warning" => $warning,
561                                  "clr" => (${"clear_".$i} || ${"clr_".$i} || !$picurl) ? true : false                                  "clr" => (${"clear_".$i} || ${"clr_".$i} || !$picurl) ? true : false,
562                                    "fclr" => (${"fclear_".$i} || ${"fclr_".$i} || !$fullurl) ? true : false
563                          ));                          ));
564                          $i++;                          $i++;
565                  }                  }
# Line 512  sql($sql); Line 590  sql($sql);
590                  $tp->assign("ed_more_new", strstr($ed_more, "://") ? true : false);                  $tp->assign("ed_more_new", strstr($ed_more, "://") ? true : false);
591                  $tp->assign("ed_more_title", MyEscape($ed_more_title));                  $tp->assign("ed_more_title", MyEscape($ed_more_title));
592                  $tp->assign("ed_prikazi", $ed_prikazi);                  $tp->assign("ed_prikazi", $ed_prikazi);
593                    $tp->assign("ed_author_cv", $ed_author_cv);
594                  $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);
595                  $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);
596                  $tp->assign("ed_text", $ed_text);                  $tp->assign("ed_text", $ed_text);

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

  ViewVC Help
Powered by ViewVC 1.1.26