ba279a90a375891112069ca39aeacaf8b79f43ab
2 require_once 'diogenes.common.inc.php';
3 require_once 'diogenes.admin.inc.php';
4 require_once 'diogenes.text.inc.php';
5 require_once 'Barrel/Page.php';
6 require_once 'Barrel/File.php';
8 if (!isset($_REQUEST['dir']) && !isset($_REQUEST['file']))
11 // retrieve directory & file info
12 $dir = $_REQUEST["dir"];
13 $file = $_REQUEST["file"];
14 $page = new DiogenesAdmin($dir);
16 $bbarrel = $page->barrel
;
17 $bpage = Diogenes_Barrel_Page
::fromDb($bbarrel, $dir);
18 $bfile = new Diogenes_Barrel_File($bpage, $file);
21 $rcs = $page->getRcs();
23 // file location & url
24 $mydir = $bbarrel->spool
->spoolPath($dir);
25 $myfile = $bbarrel->spool
->spoolPath($dir,$file);
27 // process requested action
28 $action = isset($_REQUEST["action"]) ?
$_REQUEST["action"] : "";
32 // update the current file with form contents
33 if (isset($_REQUEST['file_content'])) {
34 $page->info(__("Commiting changes to file") . " $file");
35 $content = trim(stripslashes($_REQUEST['file_content']));
36 $content = str_replace("\n ","\n",$content);
37 $content = phpUnprotect(htmltoXhtml($content));
38 $message = empty($_REQUEST['message']) ?
"updated using HTML composer" : stripslashes($_REQUEST['message']);
39 $rcs->commit($dir,$file,$content,$message);
45 $rev = array_shift($tmparr = $rcs->logParse($dir,$file));
47 // protect PHP code and XHTML tags
48 $rawdoc = file_get_contents($myfile);
49 $protdoc = xhtmlToHtml(phpProtect($rawdoc));
52 $page->assign('post',$page->script_self());
53 $page->assign('dir',$dir);
54 $page->assign('dirloc',$page->urlBarrel($bbarrel->alias
,$bbarrel->vhost
,$bpage->getLocation()));
56 $page->assign('file',$file);
57 $page->assign('file_content',chunk_split(base64_encode($protdoc)));
58 $page->assign('msg_log',__("log message"));
61 $page->toolbar(__("Page"), $bpage->make_toolbar($page));
62 $page->toolbar(__("File"), $bfile->make_toolbar(true
));
64 $auxpage = new DiogenesBarrel("/".$bbarrel->alias
."/". $bpage->getLocation());
66 switch ($globals->html_editor
) {
68 $page->assign('greeting', "Ekit - ". $bpage->getLocation($file)." - {$rev['rev']}");
69 $page->assign('cssfiles', array_pop($auxpage->sheets
));
70 $page->display('admin-ekit.tpl');
72 case "kafenio": default:
73 $page->assign('greeting', "Kafenio - ". $bpage->getLocation($file)." - {$rev['rev']}");
74 $page->assign('cssfiles', implode(",", $auxpage->sheets
));
75 $page->display('admin-kafenio.tpl');