PageRenderTime 51ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/admin/includes/edit_link.php

https://bitbucket.org/mpercy/deeemm-cms
PHP | 73 lines | 55 code | 11 blank | 7 comment | 12 complexity | 51b9ab358e693fa91c92ed01cf8b7f76 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause
  1. <?php
  2. defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );
  3. /*===========================================================================
  4. Check user priviledges
  5. ===========================================================================*/
  6. require VALIDATE;
  7. if ($user != 'ADMIN') header("Location: " . $default_url . "index.php");
  8. $main = read_file("templates/edit_link.tpl");
  9. //>create array of all categories in structure
  10. for($count=1;$count<$num_tables+1;$count++){
  11. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `id` = '$count'");
  12. while($sql_result = mysql_fetch_array($sql_query)){
  13. if ($sql_result[table] != $media_library) {
  14. $parents[] .= $sql_result[table];
  15. }
  16. }
  17. }
  18. //>if $id is set file must exist in database so get data
  19. if (isset($id) && $id <> ''){
  20. $admin_title = 'Edit Link';
  21. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . $page . "` WHERE `id` = '$id'");
  22. while($sql_result = mysql_fetch_array($sql_query)){
  23. $article_date = $sql_result[date];
  24. $article_date = strftime("%a %d %b %Y", strtotime($article_date));
  25. $order = $sql_result[order];
  26. $parent = $sql_result[parent];
  27. $child = $sql_result[child];
  28. $category = $sql_result[category];
  29. $link_url = $sql_result[link_url];
  30. $title_lan_1 = $sql_result[title_lan_1];
  31. $title_lan_2 = $sql_result[title_lan_2];
  32. $title_lan_3 = $sql_result[title_lan_3];
  33. $title_lan_4 = $sql_result[title_lan_4];
  34. $tool_tip_lan_1 = $sql_result[tool_tip_lan_1];
  35. $tool_tip_lan_2 = $sql_result[tool_tip_lan_2];
  36. $tool_tip_lan_3 = $sql_result[tool_tip_lan_3];
  37. $tool_tip_lan_4 = $sql_result[tool_tip_lan_4];
  38. }
  39. $article_ref = "index.php?page=$page&id=$id";
  40. } else {
  41. //>page doesn't exist so no need to get data
  42. $admin_title= 'Add Link';
  43. if ($page == 'admin') {
  44. $parent = $all_tables[0];
  45. } else {
  46. $parent = $page;
  47. }
  48. $article_ref = "index.php?page=admin";
  49. }
  50. //>propogate parent drop down list
  51. $parent_array = str_replace($parent, '', $all_tables);
  52. $parent_array = str_replace('orphan', '', $all_tables);
  53. $parent_list = "<select style=\"width:71%; float:right\" name='parent'><option value='$parent' checked='true'>$parent</option>";
  54. foreach($parent_array as $value){
  55. if ($value !== $media_library) {
  56. $value = str_replace($value, "<option value='$value'>$value</option>", $value);
  57. $parent_list .= $value;
  58. }
  59. }
  60. $parent_list = str_replace(' ', '', $parent_list);
  61. $parent_list .= '</select>';
  62. ?>