summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php37
1 files changed, 29 insertions, 8 deletions
diff --git a/inc/common.php b/inc/common.php
index c68eb2899..d1a722f45 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -725,6 +725,12 @@ function checklock($id){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function lock($id){
+ global $conf;
+
+ if($conf['locktime'] == 0){
+ return;
+ }
+
$lock = wikiLockFN($id);
if($_SERVER['REMOTE_USER']){
io_saveFile($lock,$_SERVER['REMOTE_USER']);
@@ -796,15 +802,16 @@ function rawWiki($id,$rev=''){
/**
* Returns the pagetemplate contents for the ID's namespace
*
+ * @triggers COMMON_PAGE_FROMTEMPLATE
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function pageTemplate($data){
- $id = $data[0];
+function pageTemplate($id){
global $conf;
- global $INFO;
- $path = dirname(wikiFN($id));
+ if (is_array($id)) $id = $id[0];
+ $path = dirname(wikiFN($id));
+ $tpl = '';
if(@file_exists($path.'/_template.txt')){
$tpl = io_readFile($path.'/_template.txt');
}else{
@@ -818,7 +825,22 @@ function pageTemplate($data){
$path = substr($path, 0, strrpos($path, '/'));
}
}
- if(!$tpl) return '';
+ $data = compact('tpl', 'id');
+ trigger_event('COMMON_PAGE_FROMTEMPLATE', $data, 'parsePageTemplate', true);
+ return $data['tpl'];
+}
+
+/**
+ * Performs common page template replacements
+ * This is the default action for COMMON_PAGE_FROMTEMPLATE
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function parsePageTemplate($data) {
+ extract($data);
+
+ global $USERINFO;
+ global $conf;
// replace placeholders
$file = noNS($id);
@@ -850,8 +872,8 @@ function pageTemplate($data){
utf8_ucwords($page),
utf8_strtoupper($page),
$_SERVER['REMOTE_USER'],
- $INFO['userinfo']['name'],
- $INFO['userinfo']['mail'],
+ $USERINFO['name'],
+ $USERINFO['mail'],
$conf['dformat'],
), $tpl);
@@ -861,7 +883,6 @@ function pageTemplate($data){
return $tpl;
}
-
/**
* Returns the raw Wiki Text in three slices.
*