PageRenderTime 32ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 1ms

/admin/images_edit.php

https://github.com/aravindc/pixelpost
PHP | 1061 lines | 888 code | 117 blank | 56 comment | 210 complexity | a85f41921e434f0010787a7bba4aab08 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. // SVN file version:
  3. // $Id$
  4. if (!isset($_SESSION["pixelpost_admin"]) || $cfgrow['password'] != $_SESSION["pixelpost_admin"] || isset($_GET["_SESSION"]["pixelpost_admin"]) and $_GET["_SESSION"]["pixelpost_admin"] == $_SESSION["pixelpost_admin"] || isset($_POST["_SESSION"]["pixelpost_admin"]) and $_POST["_SESSION"]["pixelpost_admin"] == $_SESSION["pixelpost_admin"] || isset($_COOKIE["_SESSION"]["pixelpost_admin"]) and $_COOKIE["_SESSION"]["pixelpost_admin"] == $_SESSION["pixelpost_admin"])
  5. {
  6. die("Try another day!!");
  7. }
  8. // view=images
  9. if (isset($_GET['view']) and $_GET['view'] == "images")
  10. {
  11. if (isset($_GET['action']) and $_GET['action'] == "masspublish")
  12. {
  13. $idz = $_POST['moderate_image_boxes'];
  14. // This is rather interesting since when multiple pictures have the same datetime stamp only the last one
  15. // will be shown. This means we have to construct single queries for each selected id and give them a
  16. // unique datetimestamp.
  17. // Since the latest image is displayed first we need to sort the idz because the lowest id have to be
  18. // published first.
  19. sort($idz);
  20. $minute_offset = 1;
  21. $current_hour = date("H");
  22. $current_minutes = date("i");
  23. $current_seconds = date("s");
  24. $ids = count($idz) - 1;
  25. $query = "UPDATE " . $pixelpost_db_prefix . "pixelpost SET datetime = ";
  26. for ($i = 0; $i < count($idz); $i++)
  27. {
  28. $datetimestamp = gmdate("Y-m-d H:i:s", mktime($current_hour, $current_minutes - ($minute_offset * ($ids - $i)), $current_seconds, date("m"), date("d"), date("Y")) + (3600 * $tz));
  29. $finalquery = $query . "'" . $datetimestamp . "' WHERE id = '" . (int)$idz[$i] . "'";
  30. $finalquery = sql_query($finalquery);
  31. }
  32. $c = count($idz);
  33. echo "<div class='jcaption confirm'>$admin_lang_imgedit_published $c $admin_lang_imgedit_unpublished_cmnts</div>";
  34. }
  35. if (isset($_GET['action']) and $_GET['action'] == "massdelete")
  36. {
  37. $idz = $_POST['moderate_image_boxes'];
  38. // delete all the images:
  39. for ($i = 0; $i < count($idz); $i++)
  40. {
  41. $imagerow = sql_array("SELECT image FROM " . $pixelpost_db_prefix . "pixelpost where id='" . (int)$idz[$i] . "'");
  42. $image = $imagerow['image'];
  43. $file_to_del = $cfgrow['imagepath'] . $imagerow['image'];
  44. unlink($file_to_del);
  45. $file_to_del = $cfgrow['thumbnailpath'] . "thumb_" . $imagerow['image'];
  46. unlink($file_to_del);
  47. }
  48. $query = "DELETE FROM " . $pixelpost_db_prefix . "pixelpost ";
  49. $where = "WHERE";
  50. $where2 = $where;
  51. $where3 = $where;
  52. for ($i = 0; $i < count($idz) - 1; $i++)
  53. {
  54. $where .= " id = '" . (int)$idz[$i] . "' or ";
  55. $where2 .= " img_id = '" . (int)$idz[$i] . "' or ";
  56. $where3 .= " parent_id = '" . (int)$idz[$i] . "' or ";
  57. }
  58. $lastid = $idz[count($idz) - 1];
  59. $where .= " id = '$lastid' ";
  60. $where2 .= " img_id = '$lastid' ";
  61. $where3 .= " parent_id = '$lastid' ";
  62. $query .= $where;
  63. mysql_query($query) or die(mysql_error());
  64. $c = count($idz);
  65. echo "<div class='jcaption'>$admin_lang_imgedit_delete1 $c $admin_lang_imgedit_delete2</div>";
  66. $query2 = "DELETE FROM " . $pixelpost_db_prefix . "tags " . $where2;
  67. mysql_query($query2) or die(mysql_error());
  68. // delete the comments as well
  69. $query3 = "DELETE FROM " . $pixelpost_db_prefix . "comments " . $where3;
  70. mysql_query($query3) or die(mysql_error());
  71. }
  72. // Mass add or delete categories to images
  73. if (isset($_GET['id']))
  74. {
  75. $_GET['id'] = (int)$_GET['id'];
  76. }
  77. if (isset($_GET['action']) and $_GET['action'] == "masscatedit")
  78. {
  79. $command = $_GET['cmd'];
  80. $command = explode('-', $command);
  81. // if unassign
  82. if (current($command) == 'unassign')
  83. {
  84. $cat_id = end($command);
  85. $idz = $_POST['moderate_image_boxes'];
  86. $query = "DELETE FROM " . $pixelpost_db_prefix . "catassoc ";
  87. $where = "WHERE";
  88. for ($i = 0; $i < count($idz); $i++)
  89. {
  90. $where .= " (cat_id='$cat_id' and image_id='" . (int)$idz[$i] . "') or ";
  91. }
  92. $where .= " 0 ";
  93. $query .= $where;
  94. $query = sql_query($query);
  95. $c = count($idz);
  96. if (isset($admin_lang_imgedit_mass_5, $admin_lang_imgedit_mass_6))
  97. {
  98. echo "<div class='jcaption'>$admin_lang_imgedit_mass_5 $c $admin_lang_imgedit_mass_6.</div>";
  99. }
  100. } // end if un-assign
  101. // if assign
  102. if (current($command) == 'assign')
  103. {
  104. $cat_id = end($command);
  105. $idz = $_POST['moderate_image_boxes'];
  106. // first delete all old values
  107. $query = "DELETE FROM " . $pixelpost_db_prefix . "catassoc ";
  108. $where = "WHERE";
  109. for ($i = 0; $i < count($idz); $i++)
  110. {
  111. $where .= " (cat_id='$cat_id' and image_id='" . (int)$idz[$i] . "]') or ";
  112. }
  113. $where .= " 0 ";
  114. $query .= $where;
  115. $query = sql_query($query);
  116. // now assign the new values
  117. $query_val = array();
  118. for ($i = 0; $i < count($idz); $i++)
  119. {
  120. $query_val[$i] = "(NULL,'$cat_id','" . (int)$idz[$i] . "')";
  121. }
  122. $query_st = "INSERT INTO " . $pixelpost_db_prefix . "catassoc (id,cat_id,image_id) VALUES " . implode(",", $query_val) . ";";
  123. $query = sql_query($query_st);
  124. $c = count($idz);
  125. if (isset($admin_lang_imgedit_mass_7, $admin_lang_imgedit_mass_8))
  126. {
  127. echo "<div class='jcaption'>$admin_lang_imgedit_mass_7 $c $admin_lang_imgedit_mass_8</div>";
  128. }
  129. } // end if assign
  130. } // end if mass edit
  131. // if tagging option
  132. if (isset($_POST['masstagopt']) and $_POST['masstagopt'] != '')
  133. {
  134. if ($_POST['masstagopt'] == 'unset')
  135. {
  136. $idz = $_POST['moderate_image_boxes'];
  137. $ids_array = implode(', ', $idz);
  138. $query = "DELETE FROM " . $pixelpost_db_prefix . "tags ";
  139. $where = "WHERE img_id IN ($ids_array)";
  140. $strtr_arr = array(',' => ' ', ';' => ' ');
  141. $tags = strtr($_POST['masstag'], $strtr_arr);
  142. $pat1 = '/([^a-zA-Z 0-9_-]+)/';
  143. $tags = preg_replace($pat1, '_', $tags);
  144. $pat2 = array('/ _ /', '/ _/', '/(_){2,}/', '/ - /', '/ -/', '/(-){2,}/');
  145. $rep2 = array('', '', '_', '', '', '-');
  146. $tags = preg_replace($pat2, $rep2, $tags);
  147. $tags_arr = preg_split('/[ ]{1,}/', $tags, -1, PREG_SPLIT_NO_EMPTY);
  148. $tags_array = implode('", "', $tags_arr);
  149. $where .= ' AND (tag IN ("' . $tags_array . '") OR alt_tag IN ("' . $tags_array . '"))';
  150. $query .= $where;
  151. if (count($idz) > 0)
  152. $query = sql_query($query);
  153. } else
  154. {
  155. $idz = $_POST['moderate_image_boxes'];
  156. $query = "INSERT INTO " . $pixelpost_db_prefix . "tags VALUES ";
  157. $strtr_arr = array(',' => ' ', ';' => ' ');
  158. $tags = strtr($_POST['masstag'], $strtr_arr);
  159. $pat1 = '/([^a-zA-Z 0-9_-]+)/';
  160. $tags = preg_replace($pat1, '_', $tags);
  161. $pat2 = array('/ _ /', '/ _/', '/(_){2,}/', '/ - /', '/ -/', '/(-){2,}/');
  162. $rep2 = array('', '', '_', '', '', '-');
  163. $tags = preg_replace($pat2, $rep2, $tags);
  164. $tags_arr = preg_split('/[ ]{1,}/', $tags, -1, PREG_SPLIT_NO_EMPTY);
  165. if ($_POST['masstagopt'] == 'set')
  166. {
  167. for ($x = 0; $x < count($idz); $x++)
  168. {
  169. for ($y = 0; $y < count($tags_arr); $y++)
  170. {
  171. $values[1] = '(' . (int)$idz[$x] . ', "' . $tags_arr[$y] . '", "")';
  172. $values[0] = implode(', ', $values);
  173. }
  174. }
  175. } elseif ($_POST['masstagopt'] == 'set2')
  176. {
  177. for ($x = 0; $x < count($idz); $x++)
  178. {
  179. for ($y = 0; $y < count($tags_arr); $y++)
  180. {
  181. $values[1] = '(' . (int)$idz[$x] . ', "", "' . $tags_arr[$y] . '")';
  182. $values[0] = implode(', ', $values);
  183. }
  184. }
  185. }
  186. $query .= $values[0];
  187. if (count($idz) > 0)
  188. $query = @mysql_query($query);
  189. }
  190. }
  191. // x=update
  192. if (isset($_GET['x']) and $_GET['x'] == "update")
  193. {
  194. $headline = clean($_POST['headline']);
  195. $body = clean($_POST['body']);
  196. $alt_headline = clean($_POST['alt_headline']);
  197. $alt_body = clean($_POST['alt_body']);
  198. $comments_settings = clean($_POST['comments_settings']);
  199. $getid = intval($_GET['imageid']);
  200. $newdatetime = intval($_POST['post_year']) . "-" . intval($_POST['post_month']) . "-" . intval($_POST['post_day']) . " " . intval($_POST['post_hour']) . ":" . intval($_POST['post_minute']) . ":" . date('s');
  201. if ($_POST['autodate'] == 1) // post nn days after last post
  202. {
  203. $query = mysql_query("select datetime + INTERVAL " . $cfgrow['daysafterlastpost'] . " DAY from " . $pixelpost_db_prefix . "pixelpost order by datetime desc limit 1");
  204. $row = mysql_fetch_row($query);
  205. if ($row)
  206. $newdatetime = $row[0]; // If there is none, will default to the other value
  207. } else
  208. if ($_POST['autodate'] == 2) // post now
  209. {
  210. $newdatetime = gmdate("Y-m-d H:i:s", time() + (3600 * $cfgrow['timezone']));
  211. } else
  212. if ($_POST['autodate'] == 3) // exifdate
  213. {
  214. $query = mysql_query("select exif_info from " . $pixelpost_db_prefix . "pixelpost where id = '" . $getid . "'");
  215. $exif_image = mysql_fetch_row($query);
  216. if ($exif_image[0] != '')
  217. {
  218. include_once ('../includes/functions_exif.php');
  219. $exif_info = stripslashes($exif_image[0]);
  220. $exif_result = unserialize_exif($exif_info);
  221. $exposuredatetime = $exif_result['DateTimeOriginalSubIFD'];
  222. if ($exposuredatetime != '')
  223. {
  224. list($exifyear, $exifmonth, $exifday, $exifhour, $exifmin, $exifsec) = split('[: ]', $exposuredatetime);
  225. $newdatetime = date("Y-m-d H:i:s", mktime($exifhour, $exifmin, $exifsec, $exifmonth, $exifday, $exifyear));
  226. }
  227. }
  228. }
  229. save_tags_edit($_POST['tags'], $getid);
  230. if ($cfgrow['altlangfile'] != 'Off')
  231. save_tags_edit($_POST['alt_tags'], $getid, "alt_");
  232. $query = "delete from " . $pixelpost_db_prefix . "catassoc where image_id='$getid'";
  233. $result = mysql_query($query) || ("Error: " . mysql_error());
  234. eval_addon_admin_workspace_menu('image_update');
  235. //------------
  236. if ($_FILES['userfile']['tmp_name'] != "")
  237. {
  238. $oldfilename = $_POST['oldfilename'];
  239. $userfile = strtolower($_FILES['userfile']['name']);
  240. $uploadfile = $upload_dir . $oldfilename;
  241. // NEW WORKSPACE ADDED
  242. eval_addon_admin_workspace_menu('image_reupload_start');
  243. if (getimagesize($_FILES['userfile']['tmp_name']))
  244. {
  245. if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
  246. {
  247. chmod($uploadfile, 0644);
  248. $result = check_upload($_FILES['userfile']['error']);
  249. //$filnamn =strtolower($_FILES['userfile']['name']);
  250. //$filnamn = $oldfilename
  251. $filtyp = $_FILES['userfile']['type'];
  252. $filstorlek = $_FILES['userfile']['size'];
  253. $status = "ok";
  254. createthumbnail($oldfilename);
  255. //Get the exif data so we can store it.
  256. include_once ('../includes/functions_exif.php');
  257. $exif_info_db = serialize_exif($uploadfile);
  258. $update = sql_query("update " . $pixelpost_db_prefix . "pixelpost set exif_info='$exif_info_db' where id='$getid'");
  259. $file_reupload_str = '<br/>' . $admin_lang_imgedit_file . '<b>' . $oldfilename . '</b> ' . $admin_lang_imgedit_file_isuploaded;
  260. // NEW WORKSPACE ADDED
  261. eval_addon_admin_workspace_menu('image_reupload_succesful');
  262. } else
  263. {
  264. // something went wrong, try to describe what
  265. if ($_FILES['userfile']['error'] != '0')
  266. {
  267. $result = check_upload($_FILES['userfile']['error']);
  268. } else
  269. {
  270. $result = "$admin_lang_ni_upload_error";
  271. }
  272. echo "<div id='warning'>$admin_lang_error ";
  273. echo "<br/>$result</div><hr/>";
  274. $status = "no";
  275. // NEW WORKSPACE ADDED
  276. eval_addon_admin_workspace_menu('image_reupload_failed');
  277. }
  278. } else
  279. {
  280. echo "<div id='warning'>$admin_lang_error ";
  281. echo "<br/>$admin_lang_pp_up_not_an_image</div><hr/>";
  282. $status = "no";
  283. eval_addon_admin_workspace_menu('image_reupload_failed');
  284. } // end move
  285. } // end prepare of file */
  286. //------------
  287. if (isset($_POST['category']))
  288. {
  289. $query_val = array();
  290. foreach ($_POST['category'] as $val)
  291. {
  292. $category = $val;
  293. $query_val[] = "(NULL,'$val','$getid')";
  294. }
  295. $query_st = "INSERT INTO " . $pixelpost_db_prefix . "catassoc (id,cat_id,image_id) VALUES " . implode(",", $query_val) . ";";
  296. $result = mysql_query($query_st) || die("Error: " . mysql_error());
  297. }
  298. $query = "update " . $pixelpost_db_prefix . "pixelpost set datetime='$newdatetime', headline='$headline', body='$body', category='$category', alt_headline='$alt_headline', alt_body='$alt_body', comments='$comments_settings' where id='$getid'";
  299. $result = mysql_query($query) || ("Error: " . mysql_error() . $admin_lang_imgedit_db_error);
  300. echo "<div class='jcaption'>$admin_lang_imgedit_update</div>
  301. <div class='content confirm'>$admin_lang_done $admin_lang_imgedit_updated #" . $getid . ". " . $file_reupload_str . "</div><p />";
  302. }
  303. echo "<div id='caption'><b>$admin_lang_images</b></div>";
  304. // x=delete
  305. if (isset($_GET['x']) and $_GET['x'] == "delete")
  306. {
  307. eval_addon_admin_workspace_menu('image_deleted');
  308. $getid = intval($_GET['imageid']);
  309. del_tags_edit($getid);
  310. $imagerow = sql_array("SELECT image FROM " . $pixelpost_db_prefix . "pixelpost where id='$getid'");
  311. $image = $imagerow['image'];
  312. $file_to_del = "$upload_dir" . $imagerow['image'];
  313. echo "<div class='jcaption'>$admin_lang_imgedit_deleted </div>
  314. <div class='content confirm'>";
  315. $query = sql_query("delete from " . $pixelpost_db_prefix . "pixelpost where id='$getid'");
  316. $query = "delete from " . $pixelpost_db_prefix . "catassoc where image_id='$getid'";
  317. $result = mysql_query($query) || ("Error: " . mysql_error());
  318. // added by ramin to delete the comments too!!
  319. $query = "delete from " . $pixelpost_db_prefix . "comments where parent_id='$getid'";
  320. $result = mysql_query($query) || ("Error: " . mysql_error());
  321. $query = "delete from " . $pixelpost_db_prefix . "tags where img_id='$getid'";
  322. $result = mysql_query($query) || ("Error: " . mysql_error());
  323. echo "&nbsp;$admin_lang_imgedit_deleted1&nbsp;";
  324. if (unlink($file_to_del))
  325. $image_message = "&nbsp;$admin_lang_imgedit_deleted2&nbsp;&nbsp;";
  326. else
  327. $image_message = "$admin_lang_imgedit_delete_error<p />";
  328. echo $image_message;
  329. $file_to_del = $cfgrow['thumbnailpath'] . "thumb_" . $imagerow['image'];
  330. if (unlink($file_to_del))
  331. $image_message = "&nbsp;$admin_lang_imgedit_deleted3";
  332. else
  333. $image_message = "$admin_lang_imgedit_delete_error2<p />";
  334. echo $image_message . "</div>";
  335. }
  336. // print out a list over images/posts
  337. if (!isset($_GET['id']) or $_GET['id'] == "")
  338. {
  339. // resetting filter entries
  340. unset($selectfcat);
  341. unset($selectftag);
  342. unset($selectfalttag);
  343. unset($selectfmon);
  344. unset($findfid);
  345. if (isset($_POST['filtercat']) && $_POST['selectfcat'] != '')
  346. $selectfcat = $_POST['selectfcat'];
  347. else
  348. if (isset($_GET['selectfcat']))
  349. $selectfcat = $_GET['selectfcat'];
  350. else
  351. if (!isset($_GET['selectfcat']) or !isset($_POST['filtercat']))
  352. $selectfcat = '';
  353. if (isset($_POST['filtertag']) && $_POST['selectftag'] != '')
  354. $selectftag = $_POST['selectftag'];
  355. else
  356. if (isset($_GET['selectftag']))
  357. $selectftag = $_GET['selectftag'];
  358. else
  359. if (!isset($_GET['selectftag']) or !isset($_POST['filtertag']))
  360. $selectftag = '';
  361. if (isset($_POST['filteralttag']) && $_POST['selectfalttag'] != '')
  362. $selectfalttag = $_POST['selectfalttag'];
  363. else
  364. if (isset($_GET['selectfalttag']))
  365. $selectfalttag = $_GET['selectfalttag'];
  366. else
  367. if (!isset($_GET['selectfalttag']) or !isset($_POST['filteralttag']))
  368. $selectfalttag = '';
  369. if (isset($_POST['filtermon']) && $_POST['selectfmon'] != '')
  370. $selectfmon = $_POST['selectfmon'];
  371. else
  372. if (isset($_GET['selectfmon']))
  373. $selectfmon = $_GET['selectfmon'];
  374. else
  375. if (!isset($_GET['selectfmon']) or !isset($_POST['filtermon']))
  376. $selectfmon = '';
  377. if (isset($_POST['findid']) && $_POST['findfid'] != '')
  378. $findfid = $_POST['findfid'];
  379. else
  380. if (!isset($_POST['findid']))
  381. $findfid = '';
  382. // Get number of photos in database depending on filter
  383. if (isset($selectfcat) and $selectfcat != '')
  384. {
  385. $query = "select count(*) as count from " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "catassoc as b WHERE a.id = b.image_id AND b.cat_id = " . $selectfcat;
  386. } else
  387. if (isset($selectftag) and $selectftag != '')
  388. {
  389. $query = "select count(*) as count from " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "tags as b WHERE a.id = b.img_id AND b.tag LIKE '" . $selectftag . "'";
  390. } else
  391. if (isset($selectfalttag) and $selectfalttag != '')
  392. {
  393. $query = "select count(*) as count from " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "tags as b WHERE a.id = b.img_id AND b.alt_tag LIKE '" . $selectfalttag . "'";
  394. } else
  395. if (isset($selectfmon) and $selectfmon != '')
  396. {
  397. $query = "select count(*) as count from " . $pixelpost_db_prefix . "pixelpost WHERE datetime LIKE '" . $selectfmon . "%'";
  398. } else
  399. if (isset($findfid) and $findfid != '')
  400. {
  401. $query = "SELECT count(*) FROM " . $pixelpost_db_prefix . "pixelpost WHERE id = " . $findfid . " limit 0,1";
  402. } else
  403. {
  404. $query = "select count(*) as count from " . $pixelpost_db_prefix . "pixelpost";
  405. }
  406. $photonumb = sql_array($query);
  407. if ($photonumb['count'])
  408. $pixelpost_photonumb = $photonumb['count'];
  409. else
  410. $pixelpost_photonumb = "0";
  411. if (!isset($_GET['page']) or $_GET['page'] == "")
  412. $page = "0";
  413. else
  414. $page = intval($_GET['page']);
  415. $_SESSION['page_pp'] = (int)$page;
  416. if (isset($_SESSION['numimg_pp']))
  417. {
  418. $_SESSION['numimg_pp'] = (int)$_SESSION['numimg_pp'];
  419. }
  420. if (isset($_SESSION['numimg_pp']) and $_SESSION['numimg_pp'] == 0 or !isset($_SESSION['numimg_pp']))
  421. $_SESSION['numimg_pp'] = 10;
  422. elseif (isset($_POST['numimg_pp']) && $_POST['numimg_pp'] > 0)
  423. {
  424. $_SESSION['numimg_pp'] = ($pixelpost_photonumb < $_POST['numimg_pp'] && $pixelpost_photonumb > 0) ? $pixelpost_photonumb : $_POST['numimg_pp'];
  425. }
  426. $currntpg = ceil($page / $_SESSION['numimg_pp']) + 1;
  427. // calculate the number of pages
  428. $num_img_pages = ceil($pixelpost_photonumb / $_SESSION['numimg_pp']);
  429. $num_img_pages = ($num_img_pages > 0) ? $num_img_pages : 1;
  430. // Now the queries to show the select options for filtering
  431. // the query for the select by category statement
  432. $selectfcats = "<option value='' selected=\"selected\">All</option>\n";
  433. $query = mysql_query("select * from " . $pixelpost_db_prefix . "categories order by name");
  434. while (list($id, $name) = mysql_fetch_row($query))
  435. {
  436. $selectfcats .= "<option value='$id'" . ($id == $selectfcat ? ' selected=\"selected\"' : '') . ">" . pullout($name) . "</option>\n";
  437. }
  438. // the query for the select by tag statement
  439. $selectftags = "<option value='' selected=\"selected\">All</option>\n";
  440. $query = mysql_query("select distinct tag from " . $pixelpost_db_prefix . "tags WHERE tag NOT LIKE '' order by tag");
  441. while (list($tag) = mysql_fetch_row($query))
  442. {
  443. $selectftags .= "<option value='$tag'" . ($tag == $selectftag ? ' selected=\"selected\"' : '') . ">" . $tag . "</option>\n";
  444. }
  445. // the query for the select by alt_tag statement
  446. if ($cfgrow['altlangfile'] != 'Off')
  447. {
  448. $selectfalttags = "<option value='' selected=\"selected\">All</option>\n";
  449. $query = mysql_query("select distinct alt_tag from " . $pixelpost_db_prefix . "tags WHERE alt_tag NOT LIKE '' order by alt_tag");
  450. while (list($alt_tag) = mysql_fetch_row($query))
  451. {
  452. $selectfalttags .= "<option value='$alt_tag'" . ($alt_tag == $selectfalttag ? ' selected=\"selected\"' : '') . ">" . $alt_tag . "</option>\n";
  453. }
  454. }
  455. // the query for the select by month statement
  456. $selectfmons = "<option value='' selected=\"selected\">All</option>\n";
  457. $query = mysql_query("select distinct DATE_FORMAT(datetime, '%Y-%m') as fmonth from " . $pixelpost_db_prefix . "pixelpost order by datetime desc");
  458. while (list($fmonth) = mysql_fetch_row($query))
  459. {
  460. $selectfmons .= "<option value='$fmonth'" . ($fmonth == $selectfmon ? ' selected=\"selected\"' : '') . ">" . $fmonth . "</option>\n";
  461. }
  462. $langs = 'admin_lang_' . $cfgrow['langfile'];
  463. $langs = ${$langs};
  464. if ($cfgrow['altlangfile'] != 'Off')
  465. {
  466. $altlangs = 'admin_lang_' . $cfgrow['altlangfile'];
  467. $altlangs = ${$altlangs};
  468. }
  469. echo "<div class='jcaption'><a href='' onclick=\"flip('additionalSelects'); return false;\" title=\"$admin_lang_show $admin_lang_options\">$admin_lang_imgedit_title1 $admin_lang_ni_select_cat, $admin_lang_ni_month, ID</a></div>
  470. <div id=\"additionalSelects\">";
  471. if ($selectfcat == '' and $selectftag == '' and $selectfalttag == '' and $selectfmon == '')
  472. echo "<script language='javascript' type='text/javascript'>flip('additionalSelects');</script>";
  473. echo "<div class='content'>
  474. <form method='post' name='filter' accept-charset='UTF-8' action='index.php?view=images'>
  475. <table width='400' border='0' cellpadding='2'>
  476. <tr>
  477. <td align='right'><strong>$admin_lang_show $admin_lang_imgedit_category_plural:&nbsp;</strong></td>
  478. <td><select name='selectfcat'>$selectfcats</select></td>
  479. <td><input class='cmnt-buttons' type='submit' name='filtercat' value='$admin_lang_go' /></td>
  480. </tr>
  481. <tr>
  482. <td align='right'><strong>$admin_lang_show $admin_lang_ni_tags $langs:&nbsp;</strong></td>
  483. <td><select name='selectftag'>$selectftags</select></td>
  484. <td><input class='cmnt-buttons' type='submit' name='filtertag' value='$admin_lang_go' /></td>
  485. </tr>";
  486. if ($cfgrow['altlangfile'] != 'Off')
  487. {
  488. echo "<tr>
  489. <td align='right'><strong>$admin_lang_show $admin_lang_ni_tags $altlangs:&nbsp;</strong></td>
  490. <td><select name='selectfalttag'>$selectfalttags</select></td>
  491. <td><input class='cmnt-buttons' type='submit' name='filteralttag' value='$admin_lang_go' /></td>
  492. </tr>";
  493. }
  494. echo "<tr>
  495. <td align='right'><strong>$admin_lang_show " . ucfirst($admin_lang_ni_month) . ":&nbsp;</strong></td>
  496. <td><select name='selectfmon'>$selectfmons</select></td>
  497. <td><input class='cmnt-buttons' type='submit' name='filtermon' value='$admin_lang_go' /></td>
  498. </tr>
  499. <tr>
  500. <td align='right' height='50'><strong>$admin_lang_show ID:&nbsp;</strong></td>
  501. <td><input type='text' size='6' name='findfid' value='$findfid' /></td>
  502. <td><input class='cmnt-buttons' type='submit' name='findid' value='$admin_lang_go' /></td>
  503. </tr>
  504. </table></form></div></div>";
  505. //the filter stuff for showing the correct browse pages
  506. if (isset($selectfcat) and $selectfcat != '')
  507. {
  508. $getfstring = '&amp;selectfcat=' . $selectfcat;
  509. } else
  510. if (isset($selectftag) and $selectftag != '')
  511. {
  512. $getfstring = '&amp;selectftag=' . $selectftag;
  513. } else
  514. if (isset($selectfalttag) and $selectfalttag != '')
  515. {
  516. $getfstring = '&amp;selectfalttag=' . $selectfalttag;
  517. } else
  518. if (isset($selectfmon) and $selectfmon != '')
  519. {
  520. $getfstring = '&amp;selectfmon=' . $selectfmon;
  521. } else
  522. {
  523. $getfstring = '';
  524. }
  525. echo "<div class=\"jcaption\"><strong><span id=\"photonumb\">$pixelpost_photonumb</span>$admin_lang_imgedit_title2" . $_SESSION['numimg_pp'] . "$admin_lang_imgedit_title3$currntpg$admin_lang_imgedit_title4$num_img_pages</strong>
  526. </div>
  527. <div class=\"content\">
  528. <form method=\"post\" name=\"manageposts\" id=\"manageposts\" accept-charset=\"UTF-8\" action=\"index.php?view=images&amp;page=$page$getfstring\">
  529. <input class=\"cmnt-buttons\" type=\"button\" onclick=\"checkAll(document.getElementById('manageposts')); return false; \" value=\"$admin_lang_cmnt_check_all\" name=\"chechallbox\" />
  530. <input class=\"cmnt-buttons\" type=\"button\" onclick=\"invertselection(document.getElementById('manageposts')); return false; \" value=\"$admin_lang_cmnt_invert_checks\" name=\"invcheckbox\" />
  531. <input class=\"cmnt-buttons\" type=\"submit\" name=\"submitdelete\" value=\"$admin_lang_cmnt_del_selected\" onclick=\"return (confirm('Delete all selected images? \\n \'Cancel\' to stop, \'OK\' to delete.')) ? document.getElementById('manageposts').action='" . PHP_SELF . "?view=images&amp;action=massdelete' : false;\"/>
  532. <input class=\"cmnt-buttons\" type=\"submit\" name=\"submitpublish\" value=\"$admin_lang_cmnt_publish_sel\" onclick=\"return (confirm('Publish all selected images? \\n \'Cancel\' to stop, \'OK\' to publish.')) ? document.getElementById('manageposts').action='" . PHP_SELF . "?view=images&amp;action=masspublish' : false;\"/>
  533. <br/><br/>
  534. <select name=\"mass-edit-cat\" id=\"mass-edit-cat\" onchange=\"document.getElementById('manageposts').action='" . PHP_SELF . "?view=images&amp;action=masscatedit&amp;cmd='+this.options[this.selectedIndex].value; \" >\n
  535. <option value=\"\">$admin_lang_imgedit_mass_1</option> \n
  536. <option value=\"\"></option> \n
  537. <option value=\"\">--- $admin_lang_imgedit_mass_2 ---</option> \n";
  538. $query = mysql_query("select * from " . $pixelpost_db_prefix . "categories order by name");
  539. while (list($id, $name) = mysql_fetch_row($query))
  540. {
  541. $name = pullout($name);
  542. $cat_name[] = $name;
  543. $ids[] = $id;
  544. echo "<option value=\"assign-$id\">$name</option>\n";
  545. }
  546. echo "<option value=\"\"></option> \n
  547. <option value=\"\">--- $admin_lang_imgedit_mass_3 ---</option> \n";
  548. for ($k = 0; $k < count($cat_name); $k++)
  549. {
  550. $name = $cat_name[$k];
  551. $id = $ids[$k];
  552. echo "<option value='unassign-$id'>$name</option>\n";
  553. }
  554. echo "</select> <input type='text' size='40' name='masstag' value='$admin_lang_imgedit_masstag...' onblur=\"if(this.value=='') this.value='$admin_lang_imgedit_masstag...';\" onfocus=\"if(this.value=='$admin_lang_imgedit_masstag...') this.value='';\" /> <select name='masstagopt' size='1'><option value=''></option><option value='set'>$admin_lang_imgedit_masstag_set</option><option value='set2'>$admin_lang_imgedit_masstag_set2</option><option value='unset'>$admin_lang_imgedit_masstag_unset</option></select>";
  555. echo " <input type=\"submit\" name=\"submit-mass-catedit\" id=\"submit-mass-catedit\" value=\"" . $admin_lang_imgedit_mass_4 . "\" /><p /> <ul>";
  556. //cat filter
  557. if (isset($selectfcat) and $selectfcat != '')
  558. {
  559. $query = "SELECT a.id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "catassoc as b WHERE a.id = b.image_id AND b.cat_id = " . $selectfcat . " ORDER BY a.datetime DESC limit $page," . $_SESSION['numimg_pp'];
  560. }
  561. //tag filter
  562. else
  563. if (isset($selectftag) and $selectftag != '')
  564. {
  565. $query = "SELECT id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "tags as b WHERE a.id = b.img_id AND b.tag LIKE '" . $selectftag . "' ORDER BY a.datetime DESC limit $page," . $_SESSION['numimg_pp'];
  566. }
  567. //alt tag filter
  568. else
  569. if (isset($selectfalttag) and $selectfalttag != '')
  570. {
  571. $query = "SELECT id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost as a, " . $pixelpost_db_prefix . "tags as b WHERE a.id = b.img_id AND b.alt_tag LIKE '" . $selectfalttag . "' ORDER BY a.datetime DESC limit $page," . $_SESSION['numimg_pp'];
  572. }
  573. //month filter
  574. else
  575. if (isset($selectfmon) and $selectfmon != '')
  576. {
  577. $query = "SELECT id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost WHERE datetime LIKE '" . $selectfmon . "%' ORDER BY datetime DESC limit $page," . $_SESSION['numimg_pp'];
  578. } else
  579. if (isset($findfid) and $findfid != '')
  580. {
  581. $query = "SELECT id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost WHERE id = " . $findfid . " limit 0,1";
  582. } else
  583. {
  584. $query = "SELECT id, datetime, headline, body, image, category, alt_headline FROM " . $pixelpost_db_prefix . "pixelpost ORDER BY datetime DESC limit $page," . $_SESSION['numimg_pp'];
  585. }
  586. // construct the pagelinks
  587. if ($pixelpost_photonumb > $_SESSION['numimg_pp'])
  588. {
  589. $pagecounter = 0;
  590. $pcntr = 0;
  591. $image_page_Links = "";
  592. while ($pcntr < $num_img_pages)
  593. {
  594. $pcntr++;
  595. $page_num = ($page == $pagecounter) ? "<strong>$pcntr</strong>" : $pcntr;
  596. $image_page_Links .= "<a href='index.php?view=images&amp;page=$pagecounter$getfstring'>$page_num</a> ";
  597. $pagecounter = $pagecounter + $_SESSION['numimg_pp'];
  598. } // end while
  599. if ($page < (($num_img_pages - 1) * $_SESSION['numimg_pp']))
  600. {
  601. $newpage = $page + $_SESSION['numimg_pp'];
  602. $image_page_Links .= "<a href='index.php?view=images&amp;page=$newpage$getfstring'>$admin_lang_next</a>";
  603. }
  604. if ($page >= $_SESSION['numimg_pp'])
  605. {
  606. $newpage = $page - $_SESSION['numimg_pp'];
  607. $image_page_Links = "<a href='index.php?view=images&amp;page=$newpage$getfstring'>$admin_lang_prev</a> " . $image_page_Links;
  608. }
  609. echo $image_page_Links . "<hr />";
  610. }
  611. $pagec = 0;
  612. $images = mysql_query($query);
  613. while (list($id, $datetime, $headline, $body, $image, $category, $alt_headline) = mysql_fetch_row($images))
  614. {
  615. $headline = pullout($headline);
  616. $alt_headline = pullout($alt_headline);
  617. # $headline = htmlentities($headline);
  618. list($local_width, $local_height, $type, $attr) = getimagesize($cfgrow['imagepath'] . $image);
  619. $fs = filesize($cfgrow['imagepath'] . $image);
  620. $fs *= 0.001;
  621. if (isset($_POST['moderate_image_boxes']))
  622. {
  623. $checked = in_array($id, $_POST['moderate_image_boxes']) ? 'checked' : '';
  624. } else
  625. {
  626. $checked = '';
  627. }
  628. echo "<li><a href=\"../index.php?showimage=$id\"><img src=\"" . $cfgrow['thumbnailpath'] . "thumb_$image\" align=\"left\" hspace=\"3\" alt=\"Click to go to image\" /></a>
  629. <input type=\"checkbox\" class=\"images-checkbox\" name=\"moderate_image_boxes[]\" value=\"$id\" $checked />
  630. <strong><a href=\"" . PHP_SELF . "?view=images&amp;id=$id\">[$admin_lang_imgedit_edit]</a> <a href=\"../index.php?showimage=$id\" target=\"_blank\">[$admin_lang_imgedit_preview]</a> <a onclick=\"return confirmDeleteImg()\" href=\"" . PHP_SELF . "?view=images&amp;x=delete&amp;imageid=$id\">[$admin_lang_imgedit_delete]</a></strong><br/>
  631. <strong>#$id<br/>
  632. $langs $admin_lang_imgedit_title</strong> $headline<br/>";
  633. if ($cfgrow['altlangfile'] != 'Off')
  634. {
  635. echo "<strong>$altlangs $admin_lang_imgedit_alttitle</strong> $alt_headline<br/>";
  636. }
  637. echo "<strong>$admin_lang_imgedit_file_name</strong> $image<br/>
  638. <strong>$admin_lang_imgedit_dimensions</strong> $local_width x $local_height, $fs KB<br/>
  639. <strong>$admin_lang_imgedit_tbpublished</strong> $datetime<br/>";
  640. // categories
  641. echo "<strong>$admin_lang_imgedit_category_plural &nbsp;</strong>";
  642. $category_list = mysql_query("SELECT t2.name FROM " . $pixelpost_db_prefix . "catassoc t1 INNER JOIN " . $pixelpost_db_prefix . "categories t2 ON t1.cat_id = t2.id WHERE t1.image_id = '$id' ORDER BY t2.name ");
  643. while (list($category_name) = mysql_fetch_row($category_list))
  644. {
  645. $category_name = pullout($category_name);
  646. echo "[$category_name]";
  647. }
  648. echo "<br/>";
  649. // tags
  650. echo "<strong>$langs $admin_lang_ni_tags:</strong> ";
  651. echo list_tags_edit($id);
  652. if ($cfgrow['altlangfile'] != 'Off')
  653. {
  654. echo "<br/><strong>$altlangs $admin_lang_ni_tags:</strong> ";
  655. echo list_tags_edit($id, "alt_");
  656. }
  657. echo "<br/>";
  658. // added workspace requested by KArin on the forums
  659. eval_addon_admin_workspace_menu('image_list');
  660. // end workspace
  661. echo "</li>";
  662. $pagec++;
  663. }
  664. echo "</ul></form>";
  665. if ($pixelpost_photonumb > $_SESSION['numimg_pp'])
  666. {
  667. echo $image_page_Links;
  668. }
  669. if (isset($_GET['page']))
  670. {
  671. $page = '&amp;page=' . $_GET['page'];
  672. } else
  673. {
  674. $page = '';
  675. }
  676. echo '<br/>
  677. <form method="post" action="' . PHP_SELF . '?view=images' . $page . $getfstring . '" accept-charset="UTF-8">';
  678. echo $admin_lang_show . ' ';
  679. echo '<input type="text" name="numimg_pp" size="2" value="' . $_SESSION['numimg_pp'] . '" /> ' . $admin_lang_imgedit_img_page . '.
  680. <input type="submit" value="' . $admin_lang_go . '" />
  681. </form>';
  682. echo "</div><p />";
  683. } else
  684. {
  685. // an id is specified, edit the image, pull it out and put it in a form
  686. $getid = intval($_GET['id']);
  687. $imagerow = sql_array("SELECT * FROM " . $pixelpost_db_prefix . "pixelpost where id='$getid'");
  688. $headline = pullout($imagerow['headline']);
  689. $headline = htmlspecialchars($headline, ENT_QUOTES);
  690. $body = pullout($imagerow['body']);
  691. $alt_headline = pullout($imagerow['alt_headline']);
  692. $alt_headline = htmlspecialchars($alt_headline, ENT_QUOTES);
  693. $alt_body = pullout($imagerow['alt_body']);
  694. $image = $imagerow['image'];
  695. // fetch the categories
  696. $category = array();
  697. $query = mysql_query("SELECT `cat_id` FROM " . $pixelpost_db_prefix . "catassoc where image_id='$getid'");
  698. while(list($cat_id) = mysql_fetch_row($query))
  699. {
  700. $category[] = $cat_id;
  701. }
  702. echo "
  703. <div id='submenu'>
  704. <a href='?view=images&amp;id=$getid' ";
  705. $selectedclass = '';
  706. if (!isset($_GET["imagesview"]))
  707. {
  708. $selectedclass = 'selectedsubmenu';
  709. $_GET['imagesview'] = '';
  710. }
  711. echo "class='" . $selectedclass . "'>$admin_lang_imgedit_edit_post</a>";
  712. echo_addon_admin_menus($addon_admin_functions, "images", "&amp;id=" . $getid);
  713. echo "</div>";
  714. eval_addon_admin_workspace_menu("image_edit", "images");
  715. // edit image, list categories etc.
  716. if (isset($_GET['imagesview']) and $_GET['imagesview'] == 'edit' or isset($_GET['imagesview']) and $_GET['imagesview'] == '' or !isset($_GET['imagesview']))
  717. {
  718. $tags = list_tags_edit($_GET['id']);
  719. if ($cfgrow['altlangfile'] != 'Off')
  720. $alt_tags = list_tags_edit($_GET['id'], "alt_");
  721. echo "
  722. <form method='post' action='" . PHP_SELF . "?view=images&amp;x=update&amp;imageid=" . $getid . "&amp;page=" . $_SESSION['page_pp'] . "' enctype='multipart/form-data' accept-charset='UTF-8'>";
  723. echo "
  724. <div class='jcaption'>$admin_lang_imgedit_reupimg</div>
  725. <div class='content'>
  726. <input name='userfile' type='file' size='60'/>
  727. <input name='oldfilename' type = 'hidden' value='$image' />
  728. </div>
  729. <div class='jcaption'>$admin_lang_imgedit_title</div>
  730. <div class='content'>
  731. <input type='text' name='headline' value='$headline' style='width:300px;' />
  732. </div>
  733. <div class='jcaption'>$admin_lang_imgedit_tags_edit</div>
  734. <div class='content'><input type='text' name='tags' style='width:550px;' value='$tags' />";
  735. eval_addon_admin_workspace_menu('edit_image_form_def_lang');
  736. echo "</div>
  737. <div class='jcaption'>$admin_lang_imgedit_txt_desc</div>
  738. <div class='content'>";
  739. if ($cfgrow['markdown'] == 'T')
  740. {
  741. echo "
  742. <div>" . $admin_lang_ni_markdown_text . "<br/>
  743. <a href='http://daringfireball.net/projects/markdown/' title='<?php echo $admin_lang_ni_markdown_hp; ?>' target='_blank'>" . $admin_lang_ni_markdown_hp . "</a>
  744. &nbsp;&nbsp;&nbsp;
  745. <a href='http://daringfireball.net/projects/markdown/basics' title='<?php echo $admin_lang_ni_markdown_element; ?>' target='_blank'>" . $admin_lang_ni_markdown_element . "</a>
  746. &nbsp;&nbsp;&nbsp;
  747. <a href='http://daringfireball.net/projects/markdown/syntax' title='<?php echo $admin_lang_ni_markdown_syntax; ?>' target='_blank'>" . $admin_lang_ni_markdown_syntax . "</a>
  748. </div>";
  749. }
  750. echo " <textarea name='body' cols='50' rows='5' style='width:95%;'>$body</textarea>
  751. </div>
  752. <div class='jcaption'>$admin_lang_imgedit_category_plural</div>
  753. <div class='content'>
  754. ";
  755. category_list_as_table($category, $cfgrow);
  756. echo "</div>";
  757. list($img_width, $img_height, $type, $attr) = getimagesize($cfgrow['imagepath'] . $image);
  758. $img_size = filesize($cfgrow['imagepath'] . $image);
  759. $img_size = number_format($img_size);
  760. $yearUpload = substr($imagerow['datetime'], 0, 4);
  761. $monthUpload = substr($imagerow['datetime'], 5, 2);
  762. $dayUpload = substr($imagerow['datetime'], 8, 2);
  763. $hourUpload = substr($imagerow['datetime'], 11, 2);
  764. $minuteUpload = substr($imagerow['datetime'], 14, 2);
  765. $secondUpload = substr($imagerow['datetime'], 17, 2);
  766. $dateUpload = mktime($hourUpload, $minuteUpload, $secondUpload, $monthUpload, $dayUpload, $yearUpload);
  767. $tz = $cfgrow["timezone"];
  768. $cur_time = gmdate("Y-m-d H:i:s", time() + (3600 * $tz));
  769. echo "<div class='jcaption'>$admin_lang_imgedit_dtime</div>
  770. <div class='content'>
  771. <input type='radio' name='autodate' value='2' id='postnow'/><label for='postnow'>" . $admin_lang_ni_post_now . " (~" . $cur_time . ")</label><br/>
  772. <input type='radio' name='autodate' value='1' id='postdayaft'/><label for='postdayaft'>";
  773. if ($cfgrow['daysafterlastpost'] == 1)
  774. echo $admin_lang_ni_post_one_day_after;
  775. else
  776. echo $admin_lang_ni_post . $cfgrow['daysafterlastpost'] . $admin_lang_ni_post_multiple_days_after;
  777. echo "</label><br/>
  778. <input type='radio' name='autodate' value='3' id='exifdate'/><label for='exifdate'>" . $admin_lang_ni_post_exif_date . "</label><br/>
  779. <input type='radio' name='autodate' value='0' checked='checked' id='specificdate'/><label for='specificdate'>" . $admin_lang_ni_post_spec_date . "</label><br/><br/>
  780. <table id=\"datetable\"><tr>
  781. <td>{$admin_lang_ni_year}</td><td style=\"width:5px;\">-</td><td>{$admin_lang_ni_month}</td><td style=\"width:5px;\">-</td><td>{$admin_lang_ni_day}</td><td><img src='../includes/spacer.gif' height='1' width='30' alt=''/></td><td>{$admin_lang_ni_hour}</td><td style=\"width:5px;\">-</td><td>{$admin_lang_ni_min}</td>
  782. </tr><tr><td><select name='post_year'>
  783. <option value='" . date("Y", $dateUpload) . "'>" . date("Y", $dateUpload) . "</option>";
  784. $lc = 2002;
  785. while ($lc <= (date("Y") + 3))
  786. {
  787. echo "<option";
  788. if (isset($_POST['post_year']) and $_POST['post_year'] == $lc)
  789. echo " SELECTED";
  790. echo " value='$lc'>$lc</option>";
  791. $lc++;
  792. }
  793. echo "</select></td><td style=\"width:5px;\">-</td><td><select name='post_month'>
  794. <option value='" . date("m", $dateUpload) . "'>" . date("m", $dateUpload) . "</option>";
  795. $lc = 1;
  796. while ($lc <= 12)
  797. {
  798. if ($lc < 10)
  799. {
  800. $lc = "0$lc";
  801. }
  802. echo "<option";
  803. if (isset($_POST['post_month']) and $_POST['post_month'] == $lc)
  804. echo " SELECTED";
  805. echo " value='$lc'>$lc</option>";
  806. $lc++;
  807. }
  808. echo "</select></td><td style=\"width:5px;\">-</td><td><select name='post_day'>
  809. <option value='" . date("d", $dateUpload) . "'>" . date("d", $dateUpload) . "</option>";
  810. $lc = 1;
  811. while ($lc <= 31)
  812. {
  813. if ($lc < 10)
  814. {
  815. $lc = "0$lc";
  816. }
  817. echo "<option";
  818. if (isset($_POST['post_day']) and $_POST['post_day'] == $lc)
  819. echo " SELECTED";
  820. echo " value='$lc'>$lc</option>";
  821. $lc++;
  822. }
  823. echo "</select></td><td><img src='../includes/spacer.gif' height='1' width='30' alt=\"\"/></td><td>
  824. <select name='post_hour'>
  825. <option value='" . date("H", $dateUpload) . "'>" . date("H", $dateUpload) . "</option>";
  826. $lc = 0;
  827. while ($lc < 24)
  828. {
  829. if ($lc < 10)
  830. {
  831. $lc = "0$lc";
  832. }
  833. echo "<option";
  834. if (isset($_POST['post_hour']) and $_POST['post_hour'] == $lc)
  835. echo " SELECTED";
  836. echo " value='$lc'>$lc</option>";
  837. $lc++;
  838. }
  839. echo "</select></td><td style=\"width:5px;\">-</td><td><select name='post_minute'>
  840. <option value='" . date("i", $dateUpload) . "'>" . date("i", $dateUpload) . "</option>";
  841. $lc = 0;
  842. while ($lc <= 59)
  843. {
  844. if ($lc < 10)
  845. {
  846. $lc = "0$lc";
  847. }
  848. echo "<option";
  849. if (isset($_POST['post_minute']) and $_POST['post_minute'] == $lc)
  850. echo " SELECTED";
  851. echo " value='$lc'>$lc</option>";
  852. $lc++;
  853. }
  854. echo "</select></td></tr></table></div>";
  855. echo "<div class='jcaption'>$admin_lang_optn_comment_setting2</div>
  856. <div class='content'>$admin_lang_optn_cmnt_mod_txt2
  857. <select name=\"comments_settings\">";
  858. $comments_result = sql_array("SELECT comments FROM " . $pixelpost_db_prefix . "pixelpost where id = '$getid'");
  859. $comments = pullout($comments_result['comments']);
  860. if ($comments == 'A')
  861. {
  862. echo "<option selected=\"selected\" value=\"A\">$admin_lang_optn_cmnt_mod_allowed</option><option value=\"M\">$admin_lang_optn_cmnt_mod_moderation</option><option value=\"F\">$admin_lang_optn_cmnt_mod_forbidden</option>";
  863. } elseif ($comments == 'M')
  864. {
  865. echo "<option value=\"A\">$admin_lang_optn_cmnt_mod_allowed</option><option selected=\"selected\" value=\"M\">$admin_lang_optn_cmnt_mod_moderation</option><option value=\"F\">$admin_lang_optn_cmnt_mod_forbidden</option>";
  866. } else
  867. {
  868. echo "<option value=\"A\">$admin_lang_optn_cmnt_mod_allowed</option><option value=\"M\">$admin_lang_optn_cmnt_mod_moderation</option><option selected=\"selected\" value=\"F\">$admin_lang_optn_cmnt_mod_forbidden</option>";
  869. }
  870. echo "</select></div>";
  871. // Check if the language addon is enabled. If not there is no need to show these fields
  872. if ($cfgrow['altlangfile'] != 'Off')
  873. {
  874. echo "
  875. <div class='jcaption' style='text-align:left;color:black;'>$admin_lang_imgedit_alt_language</div><br />
  876. <div class='jcaption'>$admin_lang_imgedit_title</div>
  877. <div class='content'><input type='text' name='alt_headline' value='$alt_headline' style='width:300px;' /></div>
  878. <div class='jcaption'>$admin_lang_imgedit_tags_edit</div>
  879. <div class='content'><input type='text' name='alt_tags' style='width:550px;' value='$alt_tags' />";
  880. eval_addon_admin_workspace_menu('edit_image_form_alt_lang');
  881. echo "</div>
  882. <div class='jcaption'>$admin_lang_imgedit_txt_desc</div>
  883. <div class='content'>";
  884. if ($cfgrow['markdown'] == 'T')
  885. {
  886. echo "
  887. <div>" . $admin_lang_ni_markdown_text . "<br/>
  888. <a href='http://daringfireball.net/projects/markdown/' title='<?php echo $admin_lang_ni_markdown_hp; ?>' target='_blank'>" . $admin_lang_ni_markdown_hp . "</a>
  889. &nbsp;&nbsp;&nbsp;
  890. <a href='http://daringfireball.net/projects/markdown/basics' title='<?php echo $admin_lang_ni_markdown_element; ?>' target='_blank'>" . $admin_lang_ni_markdown_element . "</a>
  891. &nbsp;&nbsp;&nbsp;
  892. <a href='http://daringfireball.net/projects/markdown/syntax' title='<?php echo $admin_lang_ni_markdown_syntax; ?>' target='_blank'>" . $admin_lang_ni_markdown_syntax . "</a>
  893. </div>";
  894. }
  895. echo " $admin_lang_imgedit_txt_desc<br/>
  896. <textarea name='alt_body' cols='50' rows='5' style='width:95%;'>$alt_body</textarea>
  897. </div><br />";
  898. }
  899. eval_addon_admin_workspace_menu("image_edit_form", "images");
  900. echo "
  901. <div class='jcaption'>$admin_lang_imgedit_img</div>
  902. <div class='content'>
  903. <b>$admin_lang_imgedit_file_name</b> $image, <b>$admin_lang_imgedit_fsize</b> $img_width x $img_height; $img_size <b>kb</b>
  904. <br/>
  905. <img id='itemimg' src='" . $cfgrow['thumbnailpath'] . "thumb_$image' alt='' />
  906. </div>
  907. <div class='content'>
  908. <input type='submit' value='$admin_lang_imgedit_u_post_button' />
  909. </div>
  910. </form>
  911. ";
  912. // Check if the '12c' is selected as the crop then add 3 buttons to the page '+', '-', and 'crop'
  913. if ($cfgrow['crop'] == '12c')
  914. {
  915. $to_echo = "
  916. <br/><br/>
  917. &nbsp;&nbsp;&nbsp;<strong>$admin_lang_imgedit_12cropimg</strong><br/>
  918. $admin_lang_imgedit_12cropimg_txt
  919. <input type='button' name='Submit1' value='$admin_lang_imgedit_uthmb_button' onclick=\"cropCheck('def','" . $image . "');\" />
  920. <input type='button' name='Submit3' value='" . $txt['smaller'] . "' onmousedown=\"cropZoom('in');\" onmouseup='stopZoom();' />
  921. <input type='button' name='Submit4' value='" . $txt['bigger'] . "' onmousedown=\"cropZoom('out');\" onmouseup='stopZoom();' />";
  922. echo $to_echo;
  923. // set the size of the crop frame according to the uploaded image
  924. setsize_cropdiv($image);
  925. //--------------------------------------------------------
  926. $for_echo = "<p/>
  927. <img src='" . $cfgrow['imagepath'] . $image . "' id='myimg' />
  928. <div id='cropdiv'>
  929. <table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' bordercolor='#000000'>
  930. <tr><td><img src='" . $spacer . "' /></td>
  931. </tr></table>
  932. </div>
  933. <div id='editthumbnail'>$admin_lang_imgedit_cropbg</div> <!-- end of edit thumb div -->
  934. ";
  935. echo $for_echo;
  936. //--------------------------------------------------------
  937. } else
  938. echo "$admin_lang_imgedit_12crop_opt<p />";
  939. echo "<!-- end of content div -->
  940. <p />";
  941. }
  942. } // end of if imagesview = edit
  943. } // end view=images
  944. ?>