PageRenderTime 60ms CodeModel.GetById 47ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/includes/sitemap_settings.php

https://bitbucket.org/mpercy/deeemm-cms
PHP | 220 lines | 176 code | 25 blank | 19 comment | 19 complexity | 61f4985fdd460c010ce0dd5dbe07bad9 MD5 | raw file
  1<?php
  2
  3defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );
  4
  5/*===========================================================================
  6Check user priviledges
  7===========================================================================*/
  8require VALIDATE;
  9
 10if ($user != 'ADMIN') header("Location: " . $default_url . "index.php");
 11
 12$main = read_file("templates/admin_sitemap.tpl");
 13
 14/*===========================================================================
 15Propogate the site map
 16============================================================================*/
 17
 18//generate list with links for modifying category
 19foreach($all_tables as $value){
 20	$tables_list = '';
 21	$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `table` = '$value'");
 22	while($sql_result = mysql_fetch_array($sql_query)){
 23		$type = $sql_result[type];
 24		$media_library_default_view = $sql_result[media_library_default_view];
 25		$num_slideshow_images = $sql_result[num_slideshow_images];
 26		$imagebox_type = $sql_result[imagebox_type];
 27		$display_in_margin = $sql_result[display_in_margin];
 28		$display_in_sitemap = $sql_result[display_in_sitemap];
 29		$allow_comments = $sql_result[allow_comments];
 30		$category = $sql_result[category_lan_ . $language];
 31	}
 32
 33	//get highest order page
 34	$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . "$value` WHERE `id` > 0 ORDER BY `order` LIMIT 1");
 35	if($sql_result = mysql_fetch_array($sql_query)){
 36		$id = $sql_result[id];
 37		$link_url = $sql_result[link_url];
 38	}
 39
 40	//get main heading
 41
 42	switch ($type) {
 43
 44		case 'list';
 45		case 'normal';
 46			if (isset($link_url) && $link_url <> '') {
 47			$tables_list .= str_replace($value, 
 48			"<HR size='1px' color='#ddd' class='clear_both'>
 49			<div class='nav_entry'><span class='float_right'>
 50				<a href='$default_url".$admin_dir."index.php?action=add'>
 51					<img class='icon' title='Add Item to Category' src='$default_url"."admin/icons/article_add.gif'>
 52				</a> 
 53				<a href='$default_url".$admin_dir."index.php?action=add_link'>
 54					<img class='icon' title='Add Link to Category' src='$default_url"."admin/icons/link_add.gif'>
 55				</a> 
 56				<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_down_category'>
 57					<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
 58				</a> 
 59				<a href='$default_url"."$admin_dir"."index.php?category=$value&amp;action=move_up_category'>
 60					<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
 61				</a>&nbsp;
 62				<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
 63					<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
 64				</a>&nbsp;
 65				<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value. "' onClick=\"javascript:return confirm('[lan]delete_warning[/lan] $value ?')\">
 66					<img class='icon' title='Delete' src='$default_url".$templates_dir."images/icons/article_delete.gif'>
 67				</a>
 68			</span>
 69			<img class='icon' title='$type' src='$default_url" . "admin/icons/$type.gif'>&nbsp;&nbsp;
 70				<a class='sitemap_item' href='" . $link_url . "'>" . $category . "</A></div>"
 71			, $value);
 72			
 73			} else {
 74			
 75			$tables_list .= str_replace($value, 
 76			"<HR size='1px' color='#ddd' class='clear_both'>
 77			<div class='nav_entry'><span class='float_right'>
 78			<a href='$default_url".$admin_dir."index.php?action=add'>
 79				<img class='icon' title='Add Item to Category' src='$default_url"."admin/icons/article_add.gif'>
 80			</a> 
 81			<a href='$default_url".$admin_dir."index.php?action=add_link'>
 82				<img class='icon' title='Add Link to Category' src='$default_url"."admin/icons/link_add.gif'>
 83			</a> 
 84			<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_down_category'>
 85				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
 86			</a> 
 87			<a href='$default_ur"."$admin_dirl"."index.php?category=$value&amp;action=move_up_category'>
 88				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
 89			</a>&nbsp;
 90			<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
 91				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
 92			</a>&nbsp;
 93			<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value. "' onClick=\"javascript:return confirm('[lan]delete_warning[/lan] $value ?')\">
 94				<img class='icon' title='Delete' src='$default_url" . "admin/icons/article_delete.gif'>
 95			</a>
 96			</span>
 97				<img class='icon' title='$type' src='$default_url" . "admin/icons/$type.gif'>&nbsp;&nbsp;
 98			<a class='sitemap_item' href='$default_url"."index.php?page=" . $value . "&amp;id=$id'>" . $category . "</A></div>"
 99			, $value);
100			}
101		break;
102
103		case 'media';
104			$tables_list .= str_replace($value, 
105			"<HR size='1px' color='#ddd' class='clear_both'>
106			<div class='nav_entry'><span class='float_right'>
107			<a href='$default_url"."$admin_dir"."index.php?action=add_media'>
108				<img class='icon' title='Add Media to Category' src='$default_url"."admin/icons/article_add.gif'>
109			</a> 
110			<a href='$default_url"."$admin_dir"."index.php?category=$value&amp;action=move_down_category'>
111				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_down.gif'>
112			</a> 
113			<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_up_category'>
114				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
115			</a>&nbsp;
116			<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
117				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
118			</a>&nbsp;
119			<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value . "' onClick=\"javascript:return confirm('[lan]delete_warning[/lan] $value ?')\">
120				<img class='icon' title='Delete' src='$default_url" . "admin/icons/article_delete.gif'>
121			</a>
122			</span>
123			<img class='icon' title='$type' src='$default_url" . "admin/icons/$type.gif'>&nbsp;&nbsp;
124			<a class='sitemap_item' href='$default_url"."index.php?page=" . $value . "'>" . $category . "</A></div>", $value);
125		break;
126	}
127
128
129	//get sub heading
130	$sql_query  = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . "$value` ORDER BY `order`");
131	while ($sql_result = mysql_fetch_array($sql_query)){
132		$title = $sql_result[title_lan_ . $language];
133		$id = $sql_result[id];
134		$link_url = $sql_result[link_url];
135
136		if ($type == 'normal'){
137			if (isset($link_url) && $link_url <> '') {
138				$tables_list .= str_replace($value, 
139				"<div class='nav_entry'>
140				<ul><span class='float_right'>
141				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_down_subcategory'>
142				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
143				</a> 
144				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_up_subcategory'>
145				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
146				</a>&nbsp;
147				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=edit_link'>
148				<img class='icon' title='Edit' src='$default_url"."admin/icons/link_edit.gif'>
149				</a>&nbsp;
150				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=delete' onClick=\"javascript:return confirm('[lan]delete_warning[/lan]')\">
151				<img class='icon' title='Delete' src='$default_url"."admin/icons/link_delete.gif'>
152				</a>
153				</span>
154				<img class='icon' title='link' src='$default_url" . "admin/icons/link.gif'>&nbsp;&nbsp;
155				<a class='sitemap_item' href='$link_url'>" . $title . "</A></ul></div>", $value);
156			} else {
157				$tables_list .= str_replace($value, 
158				"<div class='nav_entry'>
159				<ul><span class='float_right'>
160				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_down_subcategory'>
161				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
162				</a> 
163				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_up_subcategory'>
164				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
165				</a>&nbsp;
166				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=edit'>
167				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
168				</a>&nbsp;
169				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=delete' onClick=\"javascript:return confirm('[lan]delete_warning[/lan]')\">
170				<img class='icon' title='Delete' src='$default_url"."admin/icons/article_delete.gif'>
171				</a>
172				</span><img class='icon' title='$type' src='$default_url" . "admin/icons/page.gif'>&nbsp;&nbsp;
173				<a class='sitemap_item' href='../index.php?page=" . $value . "&amp;id=$id'>" . $title . "</A></ul></div>", $value);
174			}
175		}
176	}
177	
178	$tables_list = str_replace('  ', '', $tables_list);
179	
180	if (isset($display_in_sitemap) && $display_in_sitemap <> ''){
181		$sitemap_list .= $tables_list;
182	} else {
183		$non_sitemap_list .= $tables_list;
184	}
185}
186if (!$non_sitemap_list) $non_sitemap_list = "<span><center>No content available</center></span>";
187
188
189/*===========================================================================
190Propogate the static content list
191===========================================================================*/
192$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "static_content`");
193while($sql_result = @mysql_fetch_array($sql_query))
194{
195	$title = $sql_result[title_lan_ . $language];
196	$id = $sql_result[id];
197	$static_content_list .= str_replace($value, "<div class='nav_entry'><span class='float_right'><a href='$default_url".$admin_dir."index.php?page=static_content&amp;action=edit&amp;id=" . $id . "'><img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'></a>&nbsp<a href='$default_url".$admin_dir."index.php?page=static_content&amp;action=delete&amp;id=" . $id . "' onClick=\"javascript:return confirm('$lan[delete_warning] $value ?')\"><img class='icon' title='Delete' src='$default_url"."admin/icons/article_delete.gif'></a></span><img class='icon' title='$type' src='$default_url".$templates_dir."images/icons/page.gif'>&nbsp;&nbsp;<a class='sitemap_item' href='$default_url"."index.php?page=static_content&amp;id=" . $id . "'>" . $title . "</A><br><br></div><br>", $value);
198}
199if (!$id) $static_content_list = "<span><center>No static content available<c/enter></span>";
200	
201/*===========================================================================
202Propogate the orphan page list
203===========================================================================*/
204$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "cat_orphan`");
205while($sql_result = @mysql_fetch_array($sql_query))
206{
207	$title = $sql_result[title_lan_ . $language];
208	$id = $sql_result[id];
209	$orphan_list .= str_replace($value, "<div class='nav_entry'><span class='float_right'><a href='$default_url".$admin_dir."index.php?page=orphan&amp;action=edit&amp;id=" . $id . "'><img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'></a>&nbsp<a href='$default_url".$admin_dir."index.php?page=orphan&amp;action=delete&amp;id=" . $id . "' onClick=\"javascript:return confirm('[lan]delete_warning[/lan] $value ?')\"><img class='icon' title='Delete' src='$default_url" . "admin/icons/article_delete.gif'></a></span><img class='icon' title='$type' src='$default_url".$templates_dir . "images/icons/page.gif'>&nbsp;&nbsp;<a class='sitemap_item' href='$default_url"."index.php?page=orphan&amp;id=" . $id . "'>" . $title . "</A><br><br></div><br>", $value);
210}
211if (!$id) $orphan_list = "<span><center>No orphan pages available</center></span>";
212
213/*===========================================================================
214Create and propogate the sitemap editor
215===========================================================================*/
216
217$sitemap_editor = replace_variables($sitemap_editor);
218
219
220?>