summaryrefslogtreecommitdiffstats
path: root/admin/index.php
blob: a830897a3b583c0ec7abc07458c199ec94aa3f12 (plain)
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
<?php
/*

 Copyright (c) 2001 - 2005 Ampache.org
 All rights reserved.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

/*!
	@header Admin Index
 Do most of the dirty work of displaying the mp3 catalog

*/

require ("../modules/init.php");

$action = scrub_in($_REQUEST['action']);

if (!$user->has_access(100)) { 
	header ("Location: " . conf('web_path') . "/index.php?access=denied");
	exit();
}


// let's set the preferences here so that they take affect on the fly
if ( $action == 'Update Preferences' ) {
	update_site_preferences($preferences_id, 'true', $new_m_host, $new_w_host, 
		$new_site_title, $new_login_message, $new_session_lifetime, $new_font, 
		$new_background_color, $new_primary_color, $new_secondary_color, 
		$new_primary_font_color, $new_secondary_font_color,
		$new_error_color, $new_popular_threshold);
	// reload the preferences now
	set_preferences();
}

show_template('header'); 
show_menu_items('Admin');

if ( $action == 'show_site_preferences' ) {
	show_admin_menu('Site Preferences');
}
elseif ( ($action == 'show_users') || ($action == 'show_new_user')) {
	show_admin_menu('Users');
}
elseif ( $action == 'show_update_catalog' ) {
	show_admin_menu('Catalog'); 
}
else {
	show_admin_menu('...');
}

if ( $action == 'Update Preferences' ) {
	$action = 'show_preferences';
}
elseif ( $action == 'show_update_catalog' ) {
        show_update_catalog();
}
elseif ( $action == 'show_file_manager' ) {
        show_file_manager();
}
elseif ( $action == 'show_site_preferences' ) {
	$user = new User(0);
	require (conf('prefix') . "/templates/show_preferences.inc");
}
elseif ( $action == 'show_preferences' ) {
	$user = new User($_REQUEST['user_id']);
	require (conf('prefix') . "/templates/show_preferences.inc");
}
elseif ( $action == 'show_orphaned_files' ) {
        show_orphaned_files();
}
else {
	require (conf('prefix') . "/templates/show_admin_index.inc");
} // if they didn't pick anything

echo "<br /><br />";
show_admin_menu('');
show_menu_items('Admin');
?>

</body>
</html>