9 |
$ss = array("HTTP_GET_VARS", "HTTP_POST_VARS", "HTTP_POST_FILES"); |
$ss = array("HTTP_GET_VARS", "HTTP_POST_VARS", "HTTP_POST_FILES"); |
10 |
while (list($key, $val) = each($ss)) array_walk($$val, "ss"); |
while (list($key, $val) = each($ss)) array_walk($$val, "ss"); |
11 |
# ---KLUDGE-END--- |
# ---KLUDGE-END--- |
12 |
$phptmp = "php"; |
$phptmp = "^php"; |
13 |
function sql($sql) { |
function sql($sql) { |
14 |
# echo "<TT><B>[SQL]</B> $sql<BR>\n"; |
# echo "<TT><B>[SQL]</B> $sql<BR>\n"; |
15 |
} |
} |
49 |
if ($cancel || $save) { |
if ($cancel || $save) { |
50 |
if ($save) { |
if ($save) { |
51 |
// Move temp pics & save article. |
// Move temp pics & save article. |
52 |
if (ereg("^$phptmp", $titlepic_url2) && $ed_id > 0) { |
if (ereg("$phptmp", $titlepic_url2) && $ed_id > 0) { |
53 |
$sql = "SELECT title_pic FROM news WHERE (news_id = $ed_id)"; |
$sql = "SELECT title_pic FROM news WHERE (news_id = $ed_id)"; |
54 |
sql($sql); |
sql($sql); |
55 |
$sth = $dbh->prepare($sql); |
$sth = $dbh->prepare($sql); |
143 |
} |
} |
144 |
} else { |
} else { |
145 |
// Delete temp pics. |
// Delete temp pics. |
146 |
if (ereg("^$phptmp", $titlepic_url2)) |
if (ereg("$phptmp", $titlepic_url2)) |
147 |
MyDelete($syspicdir."/".$titlepic_url2); |
MyDelete($syspicdir."/".$titlepic_url2); |
148 |
$i = 1; |
$i = 1; |
149 |
while (isset(${"ed_textpic_id_".$i})) { |
while (isset(${"ed_textpic_id_".$i})) { |
150 |
$tmp = ${"textpic_url2_".$i}; |
$tmp = ${"textpic_url2_".$i}; |
151 |
if (ereg("^$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp); |
if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp); |
152 |
$i++; |
$i++; |
153 |
} |
} |
154 |
} |
} |
155 |
if (!$art["limit"]) $art["limit"] = 1; |
if (!isset($art["limit"])) $art["limit"] = 1; |
156 |
if (!$art["npar"]) $art["npar"] = 1; |
if (!isset($art["npar"])) $art["npar"] = 1; |
157 |
return array_shift(newsLoad($ed_id, $ed_cat, |
return array_shift(newsLoad($ed_id, $ed_cat, |
158 |
$art["limit"], $art["npar"])); |
$art["limit"], $art["offset"], $art["npar"])); |
159 |
} |
} |
160 |
// Handle temp pic upload. |
// Handle temp pic upload. |
161 |
global $HTTP_POST_FILES; |
global $HTTP_POST_FILES; |
173 |
$titlepic_url = $nm.$ext; |
$titlepic_url = $nm.$ext; |
174 |
$titlepic_name = $name; |
$titlepic_name = $name; |
175 |
$u = $titlepic_url2; |
$u = $titlepic_url2; |
176 |
if (ereg("^$phptmp", $u)) MyDelete($syspicdir."/".$u); |
if (ereg("$phptmp", $u)) MyDelete($syspicdir."/".$u); |
177 |
unset($clear_main, $clr_main); |
unset($clear_main, $clr_main); |
178 |
} else if (ereg("^ed_textpic_url_([1-9][0-9]*)$", $key, $regs)) { |
} else if (ereg("^ed_textpic_url_([1-9][0-9]*)$", $key, $regs)) { |
179 |
$n = $regs[1]; |
$n = $regs[1]; |
180 |
${"textpic_url_".$n} = $nm.$ext; |
${"textpic_url_".$n} = $nm.$ext; |
181 |
${"textpic_name_".$n} = $name; |
${"textpic_name_".$n} = $name; |
182 |
$u = ${"textpic_url2_".$n}; |
$u = ${"textpic_url2_".$n}; |
183 |
if (ereg("^$phptmp", $u)) MyDelete($syspicdir."/".$u2); |
if (ereg("$phptmp", $u)) MyDelete($syspicdir."/".$u2); |
184 |
unset(${"clear_".$n}, ${"clr_".$n}); |
unset(${"clear_".$n}, ${"clr_".$n}); |
185 |
} else { |
} else { |
186 |
// [?!?] |
// [?!?] |
222 |
array_keys(array_merge($HTTP_GET_VARS, |
array_keys(array_merge($HTTP_GET_VARS, |
223 |
$HTTP_POST_VARS)))) > 0); |
$HTTP_POST_VARS)))) > 0); |
224 |
$ed_pgfs = array(); |
$ed_pgfs = array(); |
225 |
|
$ed_warning = 0; |
226 |
if ($ed_edit || $ed_preview || $add || $delete || $clear) { |
if ($ed_edit || $ed_preview || $add || $delete || $clear) { |
227 |
global $ed_title, $ed_lead, $ed_titlepic_pos, |
global $ed_title, $ed_lead, $ed_titlepic_pos, |
228 |
$ed_titlepic_alt, $ed_cat, $ed_more; |
$ed_titlepic_alt, $ed_cat, $ed_more; |
231 |
if (!$titlepic_url && !($clear_main || $clr_main)) |
if (!$titlepic_url && !($clear_main || $clr_main)) |
232 |
$titlepic_url = $art["pic_url"]; |
$titlepic_url = $art["pic_url"]; |
233 |
list($width, $height) = PicSize($titlepic_url); |
list($width, $height) = PicSize($titlepic_url); |
234 |
|
global $ed_title_force; |
235 |
|
if ($titlepic_url && !$ed_titlepic_pos && !$ed_title_force) $ed_warning = 2; |
236 |
$i = 1; |
$i = 1; |
237 |
while (isset(${"ed_text_id_".$i})) { |
while (isset(${"ed_text_id_".$i})) { |
238 |
$id = ${"ed_text_id_".$i}; |
$id = ${"ed_text_id_".$i}; |
280 |
for ($i = 0; $i < intval($add_num); $i++) |
for ($i = 0; $i < intval($add_num); $i++) |
281 |
array_push($ed_pgfs, array(-1, "", "", -1, "", "", "", "", 0, 0, 0, true)); |
array_push($ed_pgfs, array(-1, "", "", -1, "", "", "", "", 0, 0, 0, true)); |
282 |
} |
} |
283 |
|
$ed_empty = ($ed_title || $ed_lead || $ed_titlepic_pos || $ed_more) ? false : true; |
284 |
$ed_text = array(); |
$ed_text = array(); |
|
$ed_empties = false; |
|
285 |
$ed_records = array(); |
$ed_records = array(); |
286 |
|
$ed_warnings = ($ed_warning ? true : false); |
287 |
$i = 1; |
$i = 1; |
288 |
while (list($key, $val) = each($ed_pgfs)) { |
while (list($key, $val) = each($ed_pgfs)) { |
289 |
list($id, $txt, $tit, $lev, $cls, $pic, $name, $alt, $pos, $w, $h, $new) = $val; |
list($id, $txt, $tit, $lev, $cls, $pic, $name, $alt, $pos, $w, $h, $new) = $val; |
297 |
if ($val["id"] == $lev) $class = $val["class"]; |
if ($val["id"] == $lev) $class = $val["class"]; |
298 |
if ((${"clear_".$i} || ${"clr_".$i}) && $ed_preview && (${"textpic_name_".$i} != ${"textpic_url2_".$i})) { |
if ((${"clear_".$i} || ${"clr_".$i}) && $ed_preview && (${"textpic_name_".$i} != ${"textpic_url2_".$i})) { |
299 |
$tmp = ${"textpic_url2_".$i}; |
$tmp = ${"textpic_url2_".$i}; |
300 |
if (ereg("^$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp); |
if (ereg("$phptmp", $tmp)) MyDelete($syspicdir."/".$tmp); |
301 |
$picurl = ${"textpic_url_".$i} = ${"textpic_url2_".$i} = $name = ""; |
$picurl = ${"textpic_url_".$i} = ${"textpic_url2_".$i} = $name = ""; |
302 |
} |
} |
303 |
if (!$name) $name = $picurl; |
if (!$name) $name = $picurl; |
304 |
$txt = MyEscape($txt); |
$txt = MyEscape(convert_html($txt)); |
305 |
$txt2 = ParseNewline($txt); |
$txt2 = ParseNewline($txt, true); |
306 |
|
global ${"ed_text_force_".$i}; |
307 |
|
$force = ${"ed_text_force_".$i}; |
308 |
$empty = (($ed_preview && !$txt && !$pos && !$new) ? true : false); |
$empty = (($ed_preview && !$txt && !$pos && !$new) ? true : false); |
309 |
|
$warning = 0; |
310 |
|
if ($empty && !$force) $warning = 1; |
311 |
|
if ($picurl && !$pos && !$force) $warning = 2; |
312 |
$ed_empty = $ed_empty && $empty; |
$ed_empty = $ed_empty && $empty; |
313 |
global ${"ed_text_force_".$i}; |
$ed_warnings = $ed_warnings || ($warning && !$force); |
|
$ed_empties = $ed_empties || ($empty && !${"ed_text_force_".$i}); |
|
314 |
array_push($ed_text, array( |
array_push($ed_text, array( |
315 |
"id" => $id, |
"id" => $id, |
316 |
"n" => $i, |
"n" => $i, |
317 |
"txt" => $txt2, |
"txt" => $txt2, |
318 |
"txt2" => $txt, |
"txt2" => $txt, |
319 |
"title" => MyEscape($tit), |
"title" => MyEscape(convert_html($tit)), |
320 |
"level" => $lev, |
"level" => $lev, |
321 |
"class" => MyEscape($class), |
"class" => MyEscape(convert_html($class)), |
322 |
"url" => MyEscape($picurl), |
"url" => MyEscape(convert_html($picurl)), |
323 |
"name" => MyEscape($name), |
"name" => MyEscape(convert_html($name)), |
324 |
"alt" => MyEscape($alt), |
"alt" => MyEscape(convert_html($alt)), |
325 |
"width" => $w, |
"width" => $w, |
326 |
"height" => $h, |
"height" => $h, |
327 |
"pos" => $pos, |
"pos" => $pos, |
328 |
"empty" => $empty, |
"warning" => $warning, |
329 |
"clr" => (${"clear_".$i} || ${"clr_".$i} || !$picurl) ? true : false |
"clr" => (${"clear_".$i} || ${"clr_".$i} || !$picurl) ? true : false |
330 |
)); |
)); |
331 |
$i++; |
$i++; |
332 |
} |
} |
333 |
if ($ed_empties) $ed_preview = false; |
if ($ed_warnings) $ed_preview = false; |
334 |
$tp->assign("ed_id", $ed_id); |
$tp->assign("ed_id", $ed_id); |
335 |
$tp->assign("ed_cat", $ed_cat); |
$tp->assign("ed_cat", $ed_cat); |
336 |
$tp->assign("ed_preview", $ed_preview); |
$tp->assign("ed_preview", $ed_preview); |
337 |
$tp->assign("ed_trigger", $trigger); |
$tp->assign("ed_trigger", $trigger); |
338 |
$tp->assign("ed_title", MyEscape($ed_title)); |
$tp->assign("ed_title", MyEscape(convert_html($ed_title))); |
339 |
$tp->assign("ed_lead", MyEscape($ed_lead)); |
$tp->assign("ed_lead", MyEscape(convert_html($ed_lead))); |
340 |
$tp->assign("ed_titlepic_pos", $ed_titlepic_pos); |
$tp->assign("ed_titlepic_pos", $ed_titlepic_pos); |
341 |
$tp->assign("ed_titlepic_url", MyEscape($titlepic_url)); |
$tp->assign("ed_titlepic_url", MyEscape(convert_html($titlepic_url))); |
342 |
$tp->assign("ed_titlepic_url2", MyEscape($titlepic_url2)); |
$tp->assign("ed_titlepic_url2", MyEscape(convert_html($titlepic_url2))); |
343 |
$tp->assign("ed_titlepic_name", MyEscape($titlepic_name)); |
$tp->assign("ed_titlepic_name", MyEscape(convert_html($titlepic_name))); |
344 |
$tp->assign("ed_titlepic_alt", MyEscape($ed_titlepic_alt)); |
$tp->assign("ed_titlepic_alt", MyEscape(convert_html($ed_titlepic_alt))); |
345 |
$tp->assign("ed_titlepic_width", $width); |
$tp->assign("ed_titlepic_width", $width); |
346 |
$tp->assign("ed_titlepic_height", $height); |
$tp->assign("ed_titlepic_height", $height); |
347 |
$tp->assign("ed_more", MyEscape($ed_more)); |
$tp->assign("ed_more", MyEscape($ed_more)); |
348 |
$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); |
349 |
$tp->assign("ed_text", $ed_text); |
$tp->assign("ed_text", $ed_text); |
350 |
$tp->assign("ed_empty", $ed_empty); |
$tp->assign("ed_empty", $ed_empty); |
351 |
$tp->assign("ed_empties", $ed_empties); |
$tp->assign("ed_warning", $ed_warning); |
352 |
$tp->assign("ed_read", count($ed_text) > 1); |
$tp->assign("ed_warnings", $ed_warnings); |
353 |
$tp->assign("ed_records", $ed_records); |
$tp->assign("ed_records", $ed_records); |
354 |
$tp->assign("newspicdir", "$picdir/"); |
$tp->assign("newspicdir", "$picdir/"); |
355 |
$params = array(); |
$params = array(); |
359 |
if ($trigger) array_push($params, "$trigger=1"); |
if ($trigger) array_push($params, "$trigger=1"); |
360 |
global $PHP_SELF; |
global $PHP_SELF; |
361 |
$tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?".implode("&", $params))); |
$tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?".implode("&", $params))); |
362 |
|
global $onload; |
363 |
|
$onload .= "document.forms[0].elements[0].focus();"; |
364 |
return $tp->fetch("edit.tpl"); |
return $tp->fetch("edit.tpl"); |
365 |
} |
} |
366 |
?> |
?> |