summaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/admin/add.php11
-rw-r--r--code/admin/admin.css5
-rw-r--r--code/admin/admin.js3
-rw-r--r--code/admin/index.php6
-rw-r--r--code/admin/render.php17
5 files changed, 35 insertions, 7 deletions
diff --git a/code/admin/add.php b/code/admin/add.php
index c839e0a..0869dd5 100644
--- a/code/admin/add.php
+++ b/code/admin/add.php
@@ -9,7 +9,11 @@
// Localization Init
l10n_init($site_conf['site_admin_lang']);
- $kind=sanitize($_GET, 'kind', '/[^a-z_]+/', 'page'); /* Could be : page, media */
+ // URL parameter parsing
+ $kind = sanitize($_GET, 'kind', '/[^a-z_]+/', 'page'); /* Could be : page, media */
+
+ // Pre-computed because used twice
+ $page_title = _('Admin') . ' - ' . ( ($kind=='media')?_('Add a media'):_('Add a page') );
?>
<!DOCTYPE html>
<html>
@@ -18,9 +22,10 @@
<link rel="stylesheet" href="treeview.css">
<link rel="stylesheet" href="admin.css">
<script type="text/javascript" src="admin.js"></script>
-<title><?=($kind=='media')?_('Add media'):_('Add page')?></title>
+<title><?=$page_title?></title>
</head>
<body>
+<h1><?=$page_title?></h1>
<form>
<fieldset>
@@ -50,6 +55,8 @@
<input id="fold_add_item" type="button" value="<?=_('Add page')?>" onclick="go_add('<?=$kind?>','item');">
</fieldset>
+<input id="fold_back_admin" type="button" value="<?=_('Back to admin')?>" onclick="go_admin_page();">
+
</form>
</body>
</html>
diff --git a/code/admin/admin.css b/code/admin/admin.css
index f01a35d..f394ef9 100644
--- a/code/admin/admin.css
+++ b/code/admin/admin.css
@@ -1,3 +1,8 @@
+h1 {
+ text-align:center;
+ font-size:160%
+}
+
fieldset {
display:inline-block;
vertical-align: top;
diff --git a/code/admin/admin.js b/code/admin/admin.js
index 3d0125d..669658d 100644
--- a/code/admin/admin.js
+++ b/code/admin/admin.js
@@ -91,6 +91,9 @@ function save_site_props() {
}
// Admin other actions (with page change or refresh)
+function go_admin_page() {
+ document.location = './';
+}
function go_add_form(kind) {
document.location = 'add.php?kind=' + encodeURIComponent(kind);
}
diff --git a/code/admin/index.php b/code/admin/index.php
index ddb95b3..dc10206 100644
--- a/code/admin/index.php
+++ b/code/admin/index.php
@@ -8,6 +8,9 @@
// Localization Init
l10n_init($site_conf['site_admin_lang']);
+
+ // Pre-computed because used twice
+ $page_title = _('Admin');
?>
<!DOCTYPE html>
<html>
@@ -17,9 +20,10 @@
<link rel="stylesheet" href="admin.css">
<script type="text/javascript" src="microajax.minified.js"></script>
<script type="text/javascript" src="admin.js"></script>
-<title><?=_('Admin')?></title>
+<title><?=$page_title?></title>
</head>
<body>
+<h1><?=$page_title?></h1>
<form>
<fieldset>
diff --git a/code/admin/render.php b/code/admin/render.php
index 9d4175e..2d49f01 100644
--- a/code/admin/render.php
+++ b/code/admin/render.php
@@ -1,14 +1,23 @@
<?php
require_once('utils.php');
- need_auth();
// Config loading
$site_conf = load_ini_site_conf("content/site_conf.ini");
if ( ! is_array($site_conf) ) trigger_error("Error parsing site_conf.ini", E_USER_ERROR);
- // URL params clean-up
- $action=sanitize($_GET, 'action', '/[^a-z_]+/', 'preview'); /* Could be : preview, edit, publish */
- $page=sanitize($_GET, 'page', '/[^a-z0-9\/]+/', $site_conf['site_default_page']); // Never put \. in this regex
+ if (PHP_SAPI === 'cli') {
+ // In cli mode, take args from the command line
+ $params=array(
+ 'action' => 'publish',
+ 'page' => $argv[1]
+ );
+ } else {
+ // In web mode, take from args from GET request
+ $params=&$_GET;
+ }
+ // params clean-up
+ $action=sanitize($params, 'action', '/[^a-z_]+/', 'preview'); /* Could be : preview, edit, publish */
+ $page=sanitize($params, 'page', '/[^a-z0-9\/]+/', $site_conf['site_default_page']); // Never put \. in this regex
// Template vars init ($page, $page_path, $page_props, $page_tpl_url)
$page_path = "content/$page";