Commit | Line | Data |
---|---|---|
6855525e JL |
1 | <?php |
2 | /* | |
3 | * Copyright (C) 2003-2004 Polytechnique.org | |
4 | * http://opensource.polytechnique.org/ | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 | */ | |
20 | ||
21 | ||
22 | require_once 'diogenes.barrel.inc.php'; | |
23 | ||
24 | /** Page for administrators only. | |
25 | */ | |
26 | class DiogenesAdmin extends DiogenesBarrel | |
27 | { | |
28 | /** The constructor. Creates an administrative page. | |
29 | * | |
30 | * @param dir the directory to operate on (optional) | |
31 | */ | |
32 | function DiogenesAdmin($dir = "") | |
33 | { | |
34 | global $globals; | |
35 | ||
36 | $this->DiogenesBarrel(); | |
37 | $this->assign('page',__("Administration")); | |
38 | ||
39 | // check permissions | |
40 | $this->startSession(); | |
41 | if (!empty($dir)) { | |
42 | $res = $globals->db->query("select wperms from {$this->barrel->table_page} where PID='$dir'"); | |
43 | if (!list($wperms) = mysql_fetch_row($res)) | |
44 | $this->kill(__("Directory not found")); | |
45 | $this->checkPerms($wperms); | |
46 | } else { | |
47 | $this->checkPerms('admin'); | |
48 | } | |
49 | } | |
50 | ||
51 | ||
52 | /** Returns the master template for the current context. | |
53 | */ | |
54 | function getTemplate() | |
55 | { | |
56 | return DiogenesPage::getTemplate('master.tpl'); | |
57 | } | |
58 | ||
59 | ||
60 | /** Build the admin menu. | |
61 | */ | |
62 | function makeMenu() { | |
63 | global $globals; | |
64 | ||
65 | // retrieve homepage PID | |
66 | $homepage = $this->barrel->getPID(''); | |
67 | ||
68 | array_push($this->menu, array( 1, __("Home"), $this->urlSite("") ) ); | |
69 | array_push($this->menu, array( 1, __("Admin manual"), __("http://diogenes-doc.polytechnique.org/en-admin/") ) ); | |
70 | array_push($this->menu, array( 0, __("Administration"), "", 1 ) ); | |
71 | array_push($this->menu, array( 1, __("Activity"), "./") ); | |
72 | array_push($this->menu, array( 1, __("Options"), "options") ); | |
73 | if ($this->barrel->hasFlag('plug')) | |
74 | { | |
75 | array_push($this->menu, array( 1, __("Plugins"), "plugins") ); | |
76 | } | |
77 | array_push($this->menu, array( 1, __("Users"), "users") ); | |
78 | array_push($this->menu, array( 1, __("WebDAV"), "webdav") ); | |
79 | array_push($this->menu, array( 0, __("Content"), "", 1 ) ); | |
80 | array_push($this->menu, array( 1, __("Pages catalog"), "files?dir={$homepage}&file={$globals->cssfile}") ); | |
81 | array_push($this->menu, array( 1, __("Edit style sheet"), "edit?dir={$homepage}&file={$globals->cssfile}") ); | |
82 | array_push($this->menu, array( 1, __("Edit menu"), "menus") ); | |
83 | } | |
84 | ||
85 | } | |
86 | ||
87 | ?> |