2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.admin.inc.php';
4 require_once 'diogenes.icons.inc.php';
6 $page = new DiogenesAdmin
;
7 $bbarrel =& $page->barrel
;
8 $homepage = $bbarrel->getPID('');
10 // filename transformations
11 function makeFileLoc($log_file) {
12 global $homepage, $bbarrel;
14 if (stristr($log_file, '/') == FALSE
) {
15 // this is a directory
19 $myfile = basename($log_file);
20 $mydir = dirname($log_file);
23 $myloc = $bbarrel->getLocation($mydir);
24 if ($myloc or ($mydir == $homepage))
26 $log_file = $myloc ?
"$myloc/$myfile" : $myfile;
29 return array($log_file, $mydir, $myfile);
33 // retrieve recent events
34 $res = $globals->db
->query("select e.action,e.stamp,e.data,a.text,s.auth,s.uid "
35 ."from {$globals->table_log_events} as e "
36 ."left join {$globals->table_log_actions} as a on e.action=a.id "
37 ."left join {$globals->table_log_sessions} as s on e.session=s.id "
38 ."where e.data like '{$bbarrel->alias}:%' "
39 ."order by stamp desc limit 0,10");
40 while ($myarr = mysql_fetch_array($res)) {
41 $myarr['username'] = call_user_func(array($globals->session
,'getUsername'),$myarr['auth'],$myarr['uid']);
42 list($op_alias, $op_file) = split(":",$myarr['data']);
44 switch($myarr['text']) {
46 $myarr['icon'] = $globals->icons
->get_action_icon('add');
47 $myarr['desc'] = __("site created");
50 case "barrel_options":
51 $myarr['icon'] = $globals->icons
->get_action_icon('properties');
52 $myarr['desc'] = array(__("barrel options"), "options");
55 case "barrel_plugins":
56 $myarr['icon'] = $globals->icons
->get_action_icon('plugins');
57 $myarr['desc'] = array(__("barrel plugins"), "plugins");
61 $myarr['icon'] = $globals->icons
->get_action_icon('add');
62 list($op_file, $mydir, $myfile) = makeFileLoc($op_file);
63 $myarr['desc'] = array(__("page created"), "pages?dir=$mydir");
67 $myarr['icon'] = $globals->icons
->get_action_icon('remove');
68 $myarr['desc'] = __("page removed");
72 $myarr['icon'] = $globals->icons
->get_action_icon('properties');
73 list($op_file, $mydir, $myfile) = makeFileLoc($op_file);
74 $myarr['desc'] = array(__("page properties"), "pages?dir=$mydir");
78 $myarr['icon'] = $globals->icons
->get_action_icon('plugins');
79 list($op_file, $mydir, $myfile) = makeFileLoc($op_file);
80 $myarr['desc'] = array(__("page plugins"), "plugins?plug_page=$mydir");
84 $myarr['icon'] = $globals->icons
->get_action_icon('update');
85 list($op_file, $mydir, $myfile) = makeFileLoc($op_file);
86 $myarr['desc'] = array(__("file updated"), "files?action=revs&dir=$mydir&target=$myfile");
90 $myarr['icon'] = $globals->icons
->get_action_icon('delete');
91 list($op_file, $mydir, $myfile) = makeFileLoc($op_file);
92 $myarr['desc'] = __("file deleted");
97 $myarr['file'] = $op_file;
99 if (isset($myarr['desc']))
100 $page->append('events',$myarr);
102 mysql_free_result($res);
105 $page->assign('greeting',__("Welcome to the Diogenes backoffice"));
106 $page->assign('msg_date',__("date"));
107 $page->assign('msg_user',__("user"));
108 $page->assign('msg_event',__("event"));
109 $page->display('admin-index.tpl');