summaryrefslogtreecommitdiff
path: root/code/admin/render.php
diff options
context:
space:
mode:
authorLudovic Pouzenc <lpouzenc@gmail.com>2013-10-30 00:51:01 +0100
committerLudovic Pouzenc <lpouzenc@gmail.com>2013-10-30 00:51:01 +0100
commit97bd9842f44bb25832f5dd8288372f2199cf3b7b (patch)
tree336f9affdbd5f0a617071ba6058f6872055951bc /code/admin/render.php
parent6ab5a946d9b512889d19ae041002cd78156c3ffc (diff)
downloadeditablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.tar.gz
editablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.tar.bz2
editablesite-97bd9842f44bb25832f5dd8288372f2199cf3b7b.zip
Correction de bugs, amélioration titres admin, traductions.
Diffstat (limited to 'code/admin/render.php')
-rw-r--r--code/admin/render.php17
1 files changed, 13 insertions, 4 deletions
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";