summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/inc/init.php b/inc/init.php
index 075469ddb..621466196 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -70,6 +70,10 @@
$conf['mediadir'] = realpath($conf['mediadir']);
if(!$conf['mediadir']) msg('Wrong mediadir! Check config!',-1);
+ // automatic upgrade to script versions of certain files
+ scriptify('conf/users.auth');
+ scriptify('conf/acl.auth');
+
/**
* remove magic quotes recursivly
*
@@ -135,6 +139,32 @@ function getBaseURL($abs=false){
return $proto.$host.$port.$dir;
}
+function scriptify($file) {
+ // checks
+ if (!is_readable($file)) {
+ return;
+ }
+ $fn = $file.'.php';
+ if (@file_exists($fn)) {
+ return;
+ }
+ $fh = fopen($fn, 'w');
+ if (!$fh) {
+ die($fn.' is not writable!');
+ }
+ // write php exit hack first
+ fwrite($fh, "# $fn\n");
+ fwrite($fh, '# <?php exit()?>'."\n");
+ fwrite($fh, "# Don't modify the lines above\n");
+ fwrite($fh, "#\n");
+ // copy existing lines
+ $lines = file($file);
+ foreach ($lines as $line){
+ fwrite($fh, $line);
+ }
+ $fclose($fh);
+}
+
//Setup VIM: ex: et ts=2 enc=utf-8 :