fix text for default barrel stylesheet
[diogenes.git] / include / admin / edit.php
... / ...
CommitLineData
1<?php
2require_once 'diogenes.common.inc.php';
3require_once 'diogenes.admin.inc.php';
4require_once 'Barrel/Page.php';
5require_once 'Barrel/File.php';
6
7if (empty($_REQUEST['dir']) && empty($_REQUEST['file']))
8 exit;
9
10// retrieve directory & file info
11$dir = $_REQUEST["dir"];
12$file = $_REQUEST["file"];
13$page = new DiogenesAdmin($dir);
14
15$bbarrel = $page->barrel;
16$bpage = Diogenes_Barrel_Page::fromDb($bbarrel, $dir);
17$bfile = new Diogenes_Barrel_File($bpage, $file);
18
19// rcs handle
20$rcs = $page->getRcs();
21
22// file location & url
23$mydir = $bbarrel->spool->spoolPath($dir);
24$myfile = $bbarrel->spool->spoolPath($dir,$file);
25
26// process requested action
27$action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "";
28switch($action)
29{
30case "update":
31 // update the current file with form contents
32 if (isset($_REQUEST['file_content'])) {
33 $page->info(__("Commiting changes to file") . " $file");
34 $message = empty($_REQUEST['message']) ? "updated using editor" : stripslashes($_REQUEST['message']);
35 $rcs->commit($dir,$file,stripslashes($_REQUEST['file_content']),$message);
36 }
37
38 break;
39}
40
41$rev = array_shift($tmparr = $rcs->logParse($dir,$file));
42
43$page->assign('greeting', __("File editor")." - ". $bpage->getLocation($file). " - {$rev['rev']}");
44$page->assign('post',$page->script_self());
45$page->assign('dir',$dir);
46$page->assign('file',$file);
47$page->assign('source',__("File source"));
48$page->assign('msg_log',__("log message"));
49$page->assign('file_content',htmlspecialchars(file_get_contents($myfile), ENT_NOQUOTES));
50$page->assign('submit',__("Submit"));
51
52// top toolbar
53$page->toolbar(__("Page"), $bpage->make_toolbar());
54$page->toolbar(__("File"), $bfile->make_toolbar(true));
55$page->display('admin-edit.tpl');
56?>