deeemm-cms /admin/includes/sitemap_settings.php

Language PHP Lines 221
MD5 Hash 61f4985fdd460c010ce0dd5dbe07bad9 Estimated Cost $4,307 (why?)
Repository https://bitbucket.org/mpercy/deeemm-cms View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php

defined( '_INDM' ) or die( 'POSSIBLE HACK ATTEMPT!' );

/*===========================================================================
Check user priviledges
===========================================================================*/
require VALIDATE;

if ($user != 'ADMIN') header("Location: " . $default_url . "index.php");

$main = read_file("templates/admin_sitemap.tpl");

/*===========================================================================
Propogate the site map
============================================================================*/

//generate list with links for modifying category
foreach($all_tables as $value){
	$tables_list = '';
	$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "core_structure` WHERE `table` = '$value'");
	while($sql_result = mysql_fetch_array($sql_query)){
		$type = $sql_result[type];
		$media_library_default_view = $sql_result[media_library_default_view];
		$num_slideshow_images = $sql_result[num_slideshow_images];
		$imagebox_type = $sql_result[imagebox_type];
		$display_in_margin = $sql_result[display_in_margin];
		$display_in_sitemap = $sql_result[display_in_sitemap];
		$allow_comments = $sql_result[allow_comments];
		$category = $sql_result[category_lan_ . $language];
	}

	//get highest order page
	$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . "$value` WHERE `id` > 0 ORDER BY `order` LIMIT 1");
	if($sql_result = mysql_fetch_array($sql_query)){
		$id = $sql_result[id];
		$link_url = $sql_result[link_url];
	}

	//get main heading

	switch ($type) {

		case 'list';
		case 'normal';
			if (isset($link_url) && $link_url <> '') {
			$tables_list .= str_replace($value, 
			"<HR size='1px' color='#ddd' class='clear_both'>
			<div class='nav_entry'><span class='float_right'>
				<a href='$default_url".$admin_dir."index.php?action=add'>
					<img class='icon' title='Add Item to Category' src='$default_url"."admin/icons/article_add.gif'>
				</a> 
				<a href='$default_url".$admin_dir."index.php?action=add_link'>
					<img class='icon' title='Add Link to Category' src='$default_url"."admin/icons/link_add.gif'>
				</a> 
				<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_down_category'>
					<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
				</a> 
				<a href='$default_url"."$admin_dir"."index.php?category=$value&amp;action=move_up_category'>
					<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
					<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value. "' onClick=\"javascript:return confirm('[lan]delete_warning[/lan] $value ?')\">
					<img class='icon' title='Delete' src='$default_url".$templates_dir."images/icons/article_delete.gif'>
				</a>
			</span>
			<img class='icon' title='$type' src='$default_url" . "admin/icons/$type.gif'>&nbsp;&nbsp;
				<a class='sitemap_item' href='" . $link_url . "'>" . $category . "</A></div>"
			, $value);
			
			} else {
			
			$tables_list .= str_replace($value, 
			"<HR size='1px' color='#ddd' class='clear_both'>
			<div class='nav_entry'><span class='float_right'>
			<a href='$default_url".$admin_dir."index.php?action=add'>
				<img class='icon' title='Add Item to Category' src='$default_url"."admin/icons/article_add.gif'>
			</a> 
			<a href='$default_url".$admin_dir."index.php?action=add_link'>
				<img class='icon' title='Add Link to Category' src='$default_url"."admin/icons/link_add.gif'>
			</a> 
			<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_down_category'>
				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
			</a> 
			<a href='$default_ur"."$admin_dirl"."index.php?category=$value&amp;action=move_up_category'>
				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
			</a>&nbsp;
			<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
			</a>&nbsp;
			<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value. "' 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" . "admin/icons/$type.gif'>&nbsp;&nbsp;
			<a class='sitemap_item' href='$default_url"."index.php?page=" . $value . "&amp;id=$id'>" . $category . "</A></div>"
			, $value);
			}
		break;

		case 'media';
			$tables_list .= str_replace($value, 
			"<HR size='1px' color='#ddd' class='clear_both'>
			<div class='nav_entry'><span class='float_right'>
			<a href='$default_url"."$admin_dir"."index.php?action=add_media'>
				<img class='icon' title='Add Media to Category' src='$default_url"."admin/icons/article_add.gif'>
			</a> 
			<a href='$default_url"."$admin_dir"."index.php?category=$value&amp;action=move_down_category'>
				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_down.gif'>
			</a> 
			<a href='$default_url".$admin_dir."index.php?category=$value&amp;action=move_up_category'>
				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
			</a>&nbsp;
			<a href='$default_url"."$admin_dir"."index.php?action=edit_categories&amp;category=$value#1'>
				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
			</a>&nbsp;
			<a href='$default_url"."$admin_dir"."index.php?action=delete_category&amp;category=" . $value . "' 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" . "admin/icons/$type.gif'>&nbsp;&nbsp;
			<a class='sitemap_item' href='$default_url"."index.php?page=" . $value . "'>" . $category . "</A></div>", $value);
		break;
	}


	//get sub heading
	$sql_query  = mysql_query("SELECT * FROM `" . $db_table_prefix . 'cat_' . "$value` ORDER BY `order`");
	while ($sql_result = mysql_fetch_array($sql_query)){
		$title = $sql_result[title_lan_ . $language];
		$id = $sql_result[id];
		$link_url = $sql_result[link_url];

		if ($type == 'normal'){
			if (isset($link_url) && $link_url <> '') {
				$tables_list .= str_replace($value, 
				"<div class='nav_entry'>
				<ul><span class='float_right'>
				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_down_subcategory'>
				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
				</a> 
				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_up_subcategory'>
				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=edit_link'>
				<img class='icon' title='Edit' src='$default_url"."admin/icons/link_edit.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=delete' onClick=\"javascript:return confirm('[lan]delete_warning[/lan]')\">
				<img class='icon' title='Delete' src='$default_url"."admin/icons/link_delete.gif'>
				</a>
				</span>
				<img class='icon' title='link' src='$default_url" . "admin/icons/link.gif'>&nbsp;&nbsp;
				<a class='sitemap_item' href='$link_url'>" . $title . "</A></ul></div>", $value);
			} else {
				$tables_list .= str_replace($value, 
				"<div class='nav_entry'>
				<ul><span class='float_right'>
				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_down_subcategory'>
				<img class='icon' title='Move Down' src='$default_url"."admin/icons/article_move_down.gif'>
				</a> 
				<a href='$default_url"."$admin_dir"."index.php?id=$id&amp;category=$value&amp;action=move_up_subcategory'>
				<img class='icon' title='Move Up' src='$default_url"."admin/icons/article_move_up.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=edit'>
				<img class='icon' title='Edit' src='$default_url"."admin/icons/article_edit.gif'>
				</a>&nbsp;
				<a href='$default_url"."$admin_dir"."index.php?page=$value&amp;id=$id&amp;action=delete' onClick=\"javascript:return confirm('[lan]delete_warning[/lan]')\">
				<img class='icon' title='Delete' src='$default_url"."admin/icons/article_delete.gif'>
				</a>
				</span><img class='icon' title='$type' src='$default_url" . "admin/icons/page.gif'>&nbsp;&nbsp;
				<a class='sitemap_item' href='../index.php?page=" . $value . "&amp;id=$id'>" . $title . "</A></ul></div>", $value);
			}
		}
	}
	
	$tables_list = str_replace('  ', '', $tables_list);
	
	if (isset($display_in_sitemap) && $display_in_sitemap <> ''){
		$sitemap_list .= $tables_list;
	} else {
		$non_sitemap_list .= $tables_list;
	}
}
if (!$non_sitemap_list) $non_sitemap_list = "<span><center>No content available</center></span>";


/*===========================================================================
Propogate the static content list
===========================================================================*/
$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "static_content`");
while($sql_result = @mysql_fetch_array($sql_query))
{
	$title = $sql_result[title_lan_ . $language];
	$id = $sql_result[id];
	$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);
}
if (!$id) $static_content_list = "<span><center>No static content available<c/enter></span>";
	
/*===========================================================================
Propogate the orphan page list
===========================================================================*/
$sql_query = mysql_query("SELECT * FROM `" . $db_table_prefix . "cat_orphan`");
while($sql_result = @mysql_fetch_array($sql_query))
{
	$title = $sql_result[title_lan_ . $language];
	$id = $sql_result[id];
	$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);
}
if (!$id) $orphan_list = "<span><center>No orphan pages available</center></span>";

/*===========================================================================
Create and propogate the sitemap editor
===========================================================================*/

$sitemap_editor = replace_variables($sitemap_editor);


?>
Back to Top