PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/core/structure.php

https://bitbucket.org/mpercy/deeemm-cms
PHP | 98 lines | 49 code | 12 blank | 37 comment | 5 complexity | d2af968149d7477bf88f4bbe3359a3ad MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause
  1. <?php
  2. defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );
  3. $admin_email = convert2ascii($conf[admin_email]);
  4. /*===========================================================================
  5. Get site structure from database
  6. ===========================================================================*/
  7. /*
  8. $sql_query = mysql_query("SHOW TABLES");
  9. while($sql_result = mysql_fetch_array($sql_query)){
  10. if ($sql_result[0] <> $db_table_prefix .'admin' && $sql_result[0] <> $db_table_prefix .'static_content' && $sql_result[0] <> $db_table_prefix .'admin' && $sql_result[0] <> $db_table_prefix .'users' && $sql_result[0] <> $db_table_prefix .'structure')
  11. $all_tables[] .= $sql_result[0];
  12. }
  13. */
  14. /*===========================================================================
  15. Get site structure from database
  16. ===========================================================================*/
  17. //count number of tables in structure
  18. $sql_result = mysql_query("SELECT count(*) from `" . $db_table_prefix . "core_structure`");
  19. $num_tables = @mysql_result($sql_result,0);
  20. /*===========================================================================
  21. Create array of ALL pages in structure
  22. ===========================================================================*/
  23. $all_tables = array();
  24. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` ORDER BY `order`");
  25. while($sql_result = mysql_fetch_array($sql_query)){
  26. $all_tables[] .= $sql_result[table];
  27. }
  28. /*===========================================================================
  29. Create array of all MEDIA pages in structure
  30. ===========================================================================*/
  31. unset($imagebox_libraries);
  32. $media_tables = array();
  33. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `type` = 'media' ORDER BY `order`");
  34. while($sql_result = mysql_fetch_array($sql_query)){
  35. $media_tables[] .= $sql_result[table];
  36. //create array of all imagebox libraries
  37. if ($sql_result[display_in_margin] == 'on'){
  38. $imagebox_libraries[] .= $sql_result[table];
  39. }
  40. }
  41. /*===========================================================================
  42. Create array of all unique CATEGORIES in MEDIA LIBRARIES
  43. ===========================================================================*/
  44. $media_categories = array();
  45. foreach($media_tables as $value){
  46. $sql_query = mysql_query("SELECT DISTINCT `category` FROM `" . $db_table_prefix . 'cat_' . $value . "`");
  47. while($sql_result = mysql_fetch_array($sql_query)){
  48. if (!in_array($sql_result[category], $media_categories)){
  49. $media_categories[] .= $sql_result[category];
  50. }
  51. }
  52. }
  53. /*===========================================================================
  54. Create array of all LIST pages in structure
  55. ===========================================================================*/
  56. unset($newsbox_libraries);
  57. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `type` LIKE 'list' ORDER BY `order`");
  58. while($sql_result = mysql_fetch_array($sql_query)){
  59. $list_tables[] .= $sql_result[table];
  60. //create array of all newsbox libraries
  61. if ($sql_result[display_in_margin] == 'on'){
  62. $newsbox_libraries[] .= $sql_result[table];
  63. }
  64. }
  65. /*===========================================================================
  66. Create array of all NORMAL pages in structure
  67. ===========================================================================*/
  68. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `type` = 'normal' ORDER BY `order`");
  69. while($sql_result = mysql_fetch_array($sql_query)){
  70. $normal_tables[] .= $sql_result[table];
  71. }
  72. /*===========================================================================
  73. Create array of all STATIC pages
  74. ===========================================================================*/
  75. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "static_content`");
  76. while($sql_result = mysql_fetch_array($sql_query)){
  77. $static_pages[] .= $sql_result[category];
  78. }
  79. /*===========================================================================
  80. Create array of all ORPHAN pages
  81. ===========================================================================*/
  82. $sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "static_content`");
  83. while($sql_result = mysql_fetch_array($sql_query)){
  84. $orphan_pages[] .= $sql_result[category];
  85. }
  86. ?>