tighten return codes
[diogenes.git] / include / admin / plugins.php
1 <?php
2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.admin.inc.php';
4 require_once 'Plugin/Editor.php';
5 require_once 'Barrel/Page.php';
6
7 $page = new DiogenesAdmin;
8
9 $bbarrel = $page->barrel;
10
11 if (!$bbarrel->hasFlag('plug')) {
12 return;
13 }
14
15 $page->assign('post',$page->script_self());
16
17 $dir = isset($_REQUEST['plug_page']) ? $_REQUEST['plug_page'] : 0;
18
19 if ($dir != 0)
20 {
21 $bpage = Diogenes_Barrel_Page::fromDb($bbarrel, $dir);
22 $page->assign('greeting',__("Page plugins ") . " - " . ($bpage->props['location'] ? $bpage->props['location'] : __("home")) );
23 $page->toolbar(__("Page"), $bpage->make_toolbar());
24 $wperms = $bpage->props['wperms'];
25 } else {
26 $page->assign('greeting',__("Available plugins"));
27 $wperms = '';
28 }
29
30 /* plugin editor */
31 $editor = new Diogenes_Plugin_Editor($page->alias, $dir, $wperms);
32 if ($dir == 0) {
33 $editor->readonly = 1;
34 $editor->hide_params(1);
35 }
36 $editor->run($page,'page_content');
37 $page->display('');
38 ?>