Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [05-2008 Date Index] [Date Next] || [Thread Prev] [05-2008 Thread Index] [Thread Next]

[dokuwiki] [patch] install.php readable

  • From: Francisc Rusznyak <francisc@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 11 May 2008 11:59:04 +0200
Hi,

i would love to help developing dokuwiki in the near future, to start i
have done a little bit of refactoring in the install.php to make it
readable and to enhance bugfixing.

Patch against latest dev attached, would be nice if you can include it.

Since i have no experience with darcs and with the development of
dokuwiki im not sure if this is the correct way to get my patches
upstream, if im doing it wrong please tell me :)

I followed the instructions from http://wiki.splitbrain.org/wiki:darcs
to create a darcs-patch but im not sure if the result is what you need
to include into the repository.

Franz
New patches:

[install.diff
Franz <francisc@xxxxxxxxxxx>**20080508211121] {
hunk ./inc/infoutils.php 319
-
hunk ./install.php 8
-if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
-if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/');
-if(!defined('DOKU_LOCAL')) define('DOKU_LOCAL',DOKU_INC.'conf/');
+if (!defined('DOKU_INC')) {
+    define('DOKU_INC', dirname(__FILE__) . '/');
+}
+if (!defined('DOKU_CONF')) {
+    define('DOKU_CONF', DOKU_INC . 'conf/');
+}
+if (!defined('NL')) {
+    define('NL', "\n");
+}
+
hunk ./install.php 20
-if (!defined('DOKU_E_LEVEL')) { error_reporting(E_ALL ^ E_NOTICE); }
-else { error_reporting(DOKU_E_LEVEL); }
+if (defined('DOKU_E_LEVEL')) {
+    error_reporting(DOKU_E_LEVEL);
+}
+else {
+    error_reporting(E_ALL ^ E_NOTICE);
+}
hunk ./install.php 28
-if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
-    if (!empty($_GET))    remove_magic_quotes($_GET);
-    if (!empty($_POST))   remove_magic_quotes($_POST);
+if (get_magic_quotes_gpc() and !defined('MAGIC_QUOTES_STRIPPED')) {
+    if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
+    if (!empty($_GET)) remove_magic_quotes($_GET);
+    if (!empty($_POST)) remove_magic_quotes($_POST);
hunk ./install.php 33
-    if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
hunk ./install.php 34
-    define('MAGIC_QUOTES_STRIPPED',1);
+    define('MAGIC_QUOTES_STRIPPED', 1);
hunk ./install.php 36
+
hunk ./install.php 38
-@ini_set('magic_quotes_sybase',0);
+@ini_set('magic_quotes_sybase', 0);
hunk ./install.php 41
-require_once(DOKU_INC.'inc/lang/en/lang.php');
-$LC = preg_replace('/[^a-z\-]+/','',$_REQUEST['l']);
-if(!$LC) $LC = 'en';
-if($LC && $LC != 'en' ) {
-    require_once(DOKU_INC.'inc/lang/'.$LC.'/lang.php');
+require_once(DOKU_INC . 'inc/lang/en/lang.php');
+$LC = preg_replace('/[^a-z\-]+/', '', $_REQUEST['l']);
+if (!$LC) {
+    $LC = 'en';
+}
+if ($LC and $LC != 'en') {
+    require_once(DOKU_INC . 'inc/lang/' . $LC . '/lang.php');
hunk ./install.php 50
-// initialise variables ...
-$error = array();
+// will contain possible errors
+$errors = array();
hunk ./install.php 53
+// hashvalues for the dokuwiki releases
hunk ./install.php 55
-    '2005-09-22'   => 'e33223e957b0b0a130d0520db08f8fb7',
-    '2006-03-05'   => '51295727f79ab9af309a2fd9e0b61acc',
-    '2006-03-09'   => '51295727f79ab9af309a2fd9e0b61acc',
-    '2006-11-06'   => 'b3a8af76845977c2000d85d6990dd72b',
-    '2007-05-24'   => 'd80f2740c84c4a6a791fd3c7a353536f',
-    '2007-06-26'   => 'b3ca19c7a654823144119980be73cd77',
-    '2008-05-04'   => '1e5c42eac3219d9e21927c39e3240aad',
+    '2005-09-22' => 'e33223e957b0b0a130d0520db08f8fb7',
+    '2006-03-05' => '51295727f79ab9af309a2fd9e0b61acc',
+    '2006-03-09' => '51295727f79ab9af309a2fd9e0b61acc',
+    '2006-11-06' => 'b3a8af76845977c2000d85d6990dd72b',
+    '2007-05-24' => 'd80f2740c84c4a6a791fd3c7a353536f',
+    '2007-06-26' => 'b3ca19c7a654823144119980be73cd77',
+    '2008-05-04' => '1e5c42eac3219d9e21927c39e3240aad'
hunk ./install.php 65
-
hunk ./install.php 67
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<?php echo $LC?>"
- lang="<?php echo $LC?>" dir="<?php echo $lang['direction']?>">
-<head>
+
+?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="<?php print $LC; ?>" 
lang="<?php print $LC; ?>" dir="<?php print $lang['direction']; ?>"><head>
+
hunk ./install.php 72
-    <title><?php echo $lang['i_installer']?></title>
+    <title><?php print $lang['i_installer']; ?></title>
hunk ./install.php 75
-        img { border: none }
-        br.cl { clear:both; }
+        img { border: none; }
+        .cl { clear: both; }
hunk ./install.php 78
-        fieldset { border: none }
+        fieldset { border: none; }
hunk ./install.php 81
+        h1#installheader { float: left; }
+        img#headerlogo { vertical-align: middle; }
+        #langselect { float:right; margin: 1em; }
+        #rightcol { float: right; width: 34%; }
+        #leftcol { float: left; width: 58%; }
hunk ./install.php 87
-    <script type="text/javascript" language="javascript">
+    <script type="text/javascript">
hunk ./install.php 104
-</head>
-<body style="">
-    <h1 style="float:left">
-        <img src="http://wiki.splitbrain.org/_media/wiki:dokuwiki-64.png";
-             style="vertical-align: middle;" alt="" />
-        <?php echo $lang['i_installer']?>
+
+</head><body lang="<?php echo $LC; ?>" dir="<?php print $lang['direction']?>">
+
+    <h1 id="installheader">
+        <?php /*TODO: load image from local folder*/ ?>
+        <img src="http://wiki.splitbrain.org/_media/wiki:dokuwiki-64.png"; 
id="headerlogo" alt="" />
+        <?php print $lang['i_installer'] . NL; ?>
hunk ./install.php 112
-    <div style="float:right; margin: 1em;">
-        <?php langsel()?>
+    <div id="langselect">
+        <?php langsel(); ?>
hunk ./install.php 117
-    <div style="float: right; width: 34%;">
-        <?php
-            if(@file_exists(DOKU_INC.'inc/lang/'.$LC.'/install.html')){
-                include(DOKU_INC.'inc/lang/'.$LC.'/install.html');
-            }else{
-                print "<div lang=\"en\" dir=\"ltr\">\n";
-                include(DOKU_INC.'inc/lang/en/install.html');
-                print "</div>\n";
-            }
-        ?>
+
+    <?php
+
+    $language = $LC;
+    $direction = $lang['direction'];
+
+    if ( @file_exists(DOKU_INC . 'inc/lang/' . $language . '/install.html') ) {
+        $language = 'en';
+        $direction = 'ltr';
+    }
+
+    ?>
+
+    <div id="rightcol" lang="<?php print $language; ?>" dir="<?php print 
$direction; ?>">
+        <?php include(DOKU_INC . 'inc/lang/' . $language . '/install.html'); ?>
hunk ./install.php 134
-    <div style="float: left; width: 58%;">
+    <div id="leftcol">
hunk ./install.php 136
-            if(! (check_functions() && check_permissions()) ){
-                echo '<p>'.$lang['i_problems'].'</p>';
+
+            if (!check_functions() or !check_permissions()) {
+                print '<p>' . $lang['i_problems'] . '</p>';
hunk ./install.php 141
-            }elseif(!check_configs()){
-                echo '<p>'.$lang['i_modified'].'</p>';
+            }
+            elseif (!check_configs()) {
+                print '<p>' . $lang['i_modified'] . '</p>';
hunk ./install.php 145
-            }elseif($_REQUEST['submit']){
-                if(!check_data($_REQUEST['d'])){
+            }
+            elseif ($_REQUEST['submit']) {
+                if (!check_data($_REQUEST['d'])) {
hunk ./install.php 150
-                }elseif(!store_data($_REQUEST['d'])){
-                    echo '<p>'.$lang['i_failure'].'</p>';
+                }
+                elseif (!store_data($_REQUEST['d'])) {
+                    print '<p>' . $lang['i_failure'] . '</p>';
hunk ./install.php 154
-                }else{
-                    echo '<p>'.$lang['i_success'].'</p>';
hunk ./install.php 155
-            }else{
+                else {
+                    print '<p>' . $lang['i_success'] . '</p>';
+                }
+            }
+            else {
hunk ./install.php 165
-<div style="clear: both">
-  <a href="http://wiki.splitbrain.org/wiki:dokuwiki";><img 
src="lib/tpl/default/images/button-dw.png" alt="driven by DokuWiki" /></a>
-  <a href="http://www.php.net";><img 
src="lib/tpl/default/images/button-php.gif" alt="powered by PHP" /></a>
-</div>
-</body>
-</html>
+    <div class="cl">
+        <a href="http://wiki.splitbrain.org/wiki:dokuwiki";><img 
src="lib/tpl/default/images/button-dw.png" alt="driven by DokuWiki" /></a>
+        <a href="http://www.php.net";><img 
src="lib/tpl/default/images/button-php.gif" alt="powered by PHP" /></a>
+    </div>
+
+</body></html>
+
hunk ./install.php 174
+
hunk ./install.php 178
-function print_form($d){
+function print_form($d)
+{
hunk ./install.php 183
-    if(!is_array($d)) $d = array();
-    $d = array_map('htmlspecialchars',$d);
+    if (!is_array($d)) {
+        $d = array();
+    }
+    $d = array_map('htmlspecialchars', $d);
hunk ./install.php 188
-    if(!isset($d['acl'])) $d['acl']=1;
+    if (!isset($d['acl'])) {
+        $d['acl'] = 1;
+    }
hunk ./install.php 192
+    var_dump($d['acl']);
+
hunk ./install.php 196
-    <input type="hidden" name="l" value="<?php echo $LC ?>" />
-    <fieldset>
-        <label for="title"><?php echo $lang['i_wikiname']?>
-        <input type="text" name="d[title]" id="title" value="<?php echo 
$d['title'] ?>" style="width: 20em;" />
+    <input type="hidden" name="l" value="<?php print $LC; ?>" />
+        <label for="title"><?php print $lang['i_wikiname']; ?>
+            <input type="text" name="d[title]" id="title" value="<?php print 
$d['title']; ?>" style="width: 20em;" />
hunk ./install.php 202
-            <label for="acl">
-            <input type="checkbox" name="d[acl]" id="acl" <?php 
echo(($d['acl'] ? 'checked="checked"' : ''));?> />
-            <?php echo $lang['i_enableacl']?></label>
+            <label for="acl"><?php print $lang['i_enableacl']; ?>
+                <input type="checkbox" name="d[acl]" id="acl" <?php if 
($d['acl']) { print ' checked="checked"'; } ?>/>
+            </label>
hunk ./install.php 207
-                <label for="superuser"><?php echo 
$lang['i_superuser']?></label>
-                <input class="text" type="text" name="d[superuser]" 
id="superuser" value="<?php echo $d['superuser'] ?>" />
+                <label for="superuser"><?php print $lang['i_superuser']; 
?></label>
+                <input class="text" type="text" name="d[superuser]" 
id="superuser" value="<?php print $d['superuser']; ?>" />
hunk ./install.php 210
-                <label for="fullname"><?php echo $lang['fullname']?></label>
-                <input class="text" type="text" name="d[fullname]" 
id="fullname" value="<?php echo $d['fullname'] ?>" />
+                <label for="fullname"><?php print $lang['fullname']; ?></label>
+                <input class="text" type="text" name="d[fullname]" 
id="fullname" value="<?php print $d['fullname']; ?>" />
hunk ./install.php 213
-                <label for="email"><?php echo $lang['email']?></label>
-                <input class="text" type="text" name="d[email]" id="email" 
value="<?php echo $d['email'] ?>" />
+                <label for="email"><?php print $lang['email']; ?></label>
+                <input class="text" type="text" name="d[email]" id="email" 
value="<?php print $d['email']; ?>" />
hunk ./install.php 216
-                <label for="password"><?php echo $lang['pass']?></label>
+                <label for="password"><?php print $lang['pass']; ?></label>
hunk ./install.php 219
-                <label for="confirm"><?php echo $lang['passchk']?></label>
+                <label for="confirm"><?php print $lang['passchk']; ?></label>
hunk ./install.php 222
-                <label for="policy"><?php echo $lang['i_policy']?></label>
+                <label for="policy"><?php print $lang['i_policy']; ?></label>
hunk ./install.php 224
-                    <option value="0" <?php echo ($d['policy'] == 
0)?'selected="selected"':'' ?>><?php echo $lang['i_pol0']?></option>
-                    <option value="1" <?php echo ($d['policy'] == 
1)?'selected="selected"':'' ?>><?php echo $lang['i_pol1']?></option>
-                    <option value="2" <?php echo ($d['policy'] == 
2)?'selected="selected"':'' ?>><?php echo $lang['i_pol2']?></option>
+                    <option value="0" <?php if ($d['policy'] == 0) { print ' 
selected="selected"'; } ?>><?php print $lang['i_pol0']; ?></option>
+                    <option value="1" <?php if ($d['policy'] == 1) { print ' 
selected="selected"'; } ?>><?php print $lang['i_pol1']; ?></option>
+                    <option value="2" <?php if ($d['policy'] == 2) { print ' 
selected="selected"'; } ?>><?php print $lang['i_pol2']; ?></option>
hunk ./install.php 231
-    </fieldset>
-    <fieldset id="process">
-        <input class="button" type="submit" name="submit" value="<?php echo 
$lang['btn_save']?>" />
-    </fieldset>
+        <fieldset id="process">
+            <input class="button" type="submit" name="submit" value="<?php 
print $lang['btn_save']; ?>" />
+        </fieldset>
hunk ./install.php 238
-function print_retry() {
-  global $lang;
-  global $LC;
+/**
+ * Print the retry buttom
+ */
+function print_retry()
+{
+    global $lang;
+    global $LC;
hunk ./install.php 248
-        <input type="hidden" name="l" value="<?php echo $LC ?>" />
-        <input class="button" type="submit" value="<?php echo 
$lang['i_retry'];?>" />
+        <input type="hidden" name="l" value="<?php echo $LC; ?>" />
+        <input class="button" type="submit" value="<?php echo 
$lang['i_retry']; ?>" />
hunk ./install.php 255
+
hunk ./install.php 261
-function check_data(&$d){
+function check_data(&$d)
+{
hunk ./install.php 264
-    global $error;
+    global $errors;
hunk ./install.php 272
-    if(empty($d['title'])){
-        $error[] = sprintf($lang['i_badval'],$lang['i_wikiname']);
-        $ok      = false;
+    if (empty($d['title'])) {
+        $errors[] = sprintf($lang['i_badval'], $lang['i_wikiname']);
+        $ok = false;
hunk ./install.php 276
-    if($d['acl']){
-        if(!preg_match('/^[a-z1-9_]+$/',$d['superuser'])){
-            $error[] = sprintf($lang['i_badval'],$lang['i_superuser']);
-            $ok      = false;
+    if ($d['acl']) {
+        if (!preg_match('/^[a-z1-9_]+$/', $d['superuser'])) {
+            $errors[] = sprintf($lang['i_badval'], $lang['i_superuser']);
+            $ok = false;
hunk ./install.php 281
-        if(empty($d['password'])){
-            $error[] = sprintf($lang['i_badval'],$lang['pass']);
-            $ok      = false;
+        if (empty($d['password'])) {
+            $errors[] = sprintf($lang['i_badval'], $lang['pass']);
+            $ok = false;
hunk ./install.php 285
-        if($d['confirm'] != $d['password']){
-            $error[] = sprintf($lang['i_badval'],$lang['passchk']);
-            $ok      = false;
+        if ($d['confirm'] != $d['password']) {
+            $errors[] = sprintf($lang['i_badval'], $lang['passchk']);
+            $ok = false;
hunk ./install.php 289
-        if(empty($d['fullname']) || strstr($d['fullname'],':')){
-            $error[] = sprintf($lang['i_badval'],$lang['fullname']);
-            $ok      = false;
+        if (empty($d['fullname']) or strstr($d['fullname'],':')) {
+            $errors[] = sprintf($lang['i_badval'], $lang['fullname']);
+            $ok = false;
hunk ./install.php 293
-        if(empty($d['email']) || strstr($d['email'],':') || 
!strstr($d['email'],'@')){
-            $error[] = sprintf($lang['i_badval'],$lang['email']);
-            $ok      = false;
+        if (empty($d['email']) or strstr($d['email'], ':') or 
!strstr($d['email'], '@')) {
+            $errors[] = sprintf($lang['i_badval'], $lang['email']);
+            $ok = false;
hunk ./install.php 301
+
hunk ./install.php 307
-function store_data($d){
+function store_data($d)
+{
hunk ./install.php 314
-    $now    = date('r');
-    $output = <<<EOT
-<?php
-/**
- * Dokuwiki's Main Configuration File - Local Settings
- * Auto-generated by install script
- * Date: $now
- */
+    $now = date('r');
+    $configfile = '<' . '?php ' . NL .
+        '/**' . NL .
+        ' * Dokuwiki\'s Main Configuration File - Local Settings' . NL .
+        ' * Auto-generated by install script' . NL .
+        ' * Date: ' . $now . NL .
+        ' */' . NL .
+        '$conf[\'title\'] = \''. addslashes($d['title']) . ';' . NL .
+        '$conf[\'lang\'] = \'' . addslashes($LC) . ';' . NL;
hunk ./install.php 324
-EOT;
-    $output .= '$conf[\'title\'] = \''.addslashes($d['title'])."';\n";
-    $output .= '$conf[\'lang\'] = \''.addslashes($LC)."';\n";
-    if($d['acl']){
-        $output .= '$conf[\'useacl\'] = 1'.";\n";
-        $output .= "\$conf['superuser'] = '@admin';\n";
+    if ($d['acl']) {
+        $configfile .= '$conf[\'useacl\'] = 1;' . NL .
+            '$conf[\'superuser\'] = \'@admin\';' . NL;
hunk ./install.php 328
-    $ok = $ok && fileWrite(DOKU_LOCAL.'local.php',$output);
-
+    $ok = $ok and fileWrite(DOKU_CONF . 'local.php', $configfile);
hunk ./install.php 333
-        $output = join(":",array($d['superuser'], md5($d['password']), 
$d['fullname'], $d['email'], 'admin,user'));
-        $output = 
@file_get_contents(DOKU_CONF.'users.auth.php.dist')."\n$output\n";
-        $ok = $ok && fileWrite(DOKU_LOCAL.'users.auth.php', $output);
+        $userdata = join(":", array($d['superuser'], md5($d['password']), 
$d['fullname'], $d['email'], 'admin,user'));
+        $userauthfile = @file_get_contents(DOKU_CONF . 'users.auth.php.dist') 
. NL . $userdata . NL;
+
+        $ok = $ok and fileWrite(DOKU_CONF . 'users.auth.php', $userauthfile);
hunk ./install.php 339
-        $output = <<<EOT
-# acl.auth.php
-# <?php exit()?>
-# Don't modify the lines above
-#
-# Access Control Lists
-#
-# Auto-generated by install script
-# Date: $now
+        $aclauthfile = '<' . '?php ' . NL .
+            '# acl.auth.php' . NL .
+            '# <?php exit()?>' . NL .
+            '# Don\'t modify the lines above' . NL .
+            '#' . NL .
+            '# Access Control Lists' . NL .
+            '#' . NL .
+            '# Auto-generated by install script' . NL .
+            '# Date: ' . $now . NL;
hunk ./install.php 349
-EOT;
-        if($d['policy'] == 2){
-            $output .=  "*               @ALL          0\n";
-            $output .=  "*               @user         8\n";
-        }elseif($d['policy'] == 1){
-            $output .=  "*               @ALL          1\n";
-            $output .=  "*               @user         8\n";
-        }else{
-            $output .=  "*               @ALL          8\n";
+        if ($d['policy'] == 2) {
+            $aclauthfile .= '*               @ALL          0' . NL;
+            $aclauthfile .= '*               @user         8' . NL;
+        }
+        elseif ($d['policy'] == 1) {
+            $aclauthfile .= '*               @ALL          1' . NL;
+            $aclauthfile .= '*               @user         8' . NL;
hunk ./install.php 357
-        $ok = $ok && fileWrite(DOKU_LOCAL.'acl.auth.php', $output);
+        else {
+            $aclauthfile .=  '*               @ALL          8' . NL;
+        }
+        $ok = $ok and fileWrite(DOKU_CONF . 'acl.auth.php', $aclauthfile);
hunk ./install.php 365
+
hunk ./install.php 371
-function fileWrite($filename, $data) {
-    global $error;
+function fileWrite($filename, $data)
+{
+    global $errors;
hunk ./install.php 376
-    if (($fp = @fopen($filename, 'wb')) === false) {
-        $filename = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}/', 
$filename);
-        $error[]  = sprintf($lang['i_writeerr'],$filename);
-        return false;
-    }
+    if (!empty($data)) {
+        $fp = @fopen($filename, 'wb');
+
+        if ($fp === false) {
+            $filename = str_replace($_SERVER['DOCUMENT_ROOT'], 
'{DOCUMENT_ROOT}/', $filename);
+            $errors[] = sprintf($lang['i_writeerr'], $filename);
+            return false;
+        }
hunk ./install.php 385
-    if (!empty($data)) { fwrite($fp, $data);  }
-    fclose($fp);
+        fwrite($fp, $data);
+        fclose($fp);
+    }
hunk ./install.php 398
-function check_configs(){
-    global $error;
+function check_configs()
+{
+    global $errors;
hunk ./install.php 407
-        'local' => DOKU_LOCAL.'local.php',
-        'users' => DOKU_LOCAL.'users.auth.php',
-        'auth'  => DOKU_LOCAL.'acl.auth.php'
+        'local' => DOKU_CONF . 'local.php',
+        'users' => DOKU_CONF . 'users.auth.php',
+        'auth'  => DOKU_CONF . 'acl.auth.php'
hunk ./install.php 412
-
hunk ./install.php 413
-    $installation_hash = md5(preg_replace("/(\015\012)|(\015)/","\012",
-                             @file_get_contents(DOKU_CONF.'dokuwiki.php')));
+    $installation_hash = md5(preg_replace("/(\015\012)|(\015)/", "\012", 
@file_get_contents(DOKU_CONF . 'dokuwiki.php')));
hunk ./install.php 415
-        $error[] = sprintf($lang['i_badhash'],$installation_hash);
+        $errors[] = sprintf($lang['i_badhash'], $installation_hash);
hunk ./install.php 422
-            $file    = 
str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}/', $file);
-            $error[] = sprintf($lang['i_confexists'],$file);
-            $ok      = false;
+            $file = str_replace($_SERVER['DOCUMENT_ROOT'], '{DOCUMENT_ROOT}/', 
$file);
+            $errors[] = sprintf($lang['i_confexists'], $file);
+            $ok = false;
hunk ./install.php 436
-function check_permissions(){
-    global $error;
+function check_permissions()
+{
+    global $errors;
hunk ./install.php 442
-        'conf'      => DOKU_LOCAL,
-        'data'      => DOKU_INC.'data',
-        'pages'     => DOKU_INC.'data/pages',
-        'attic'     => DOKU_INC.'data/attic',
-        'media'     => DOKU_INC.'data/media',
-        'meta'      => DOKU_INC.'data/meta',
-        'cache'     => DOKU_INC.'data/cache',
-        'locks'     => DOKU_INC.'data/locks',
-        'index'     => DOKU_INC.'data/index',
-        'tmp'       => DOKU_INC.'data/tmp'
+        'conf' => DOKU_CONF,
+        'data' => DOKU_INC . 'data',
+        'pages' => DOKU_INC . 'data/pages',
+        'attic' => DOKU_INC . 'data/attic',
+        'media' => DOKU_INC . 'data/media',
+        'meta' => DOKU_INC . 'data/meta',
+        'cache' => DOKU_INC . 'data/cache',
+        'locks' => DOKU_INC . 'data/locks',
+        'index' => DOKU_INC . 'data/index',
+        'tmp' => DOKU_INC . 'data/tmp'
hunk ./install.php 455
-    foreach($dirs as $dir){
-        if(!@file_exists("$dir/.") || !@is_writable($dir)){
-            $dir     = 
str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', $dir);
-            $error[] = sprintf($lang['i_permfail'],$dir);
-            $ok      = false;
+    foreach ($dirs as $dir) {
+        if (!@file_exists($dir . '/.') or !@is_writable($dir)){
+            $dir = str_replace($_SERVER['DOCUMENT_ROOT'],'{DOCUMENT_ROOT}', 
$dir);
+            $errors[] = sprintf($lang['i_permfail'], $dir);
+            $ok = false;
hunk ./install.php 465
+
hunk ./install.php 471
-function check_functions(){
-    global $error;
+function check_functions()
+{
+    global $errors;
hunk ./install.php 477
-    if(version_compare(phpversion(),'4.3.3','<')){
-        $error[] = sprintf($lang['i_phpver'],phpversion(),'4.3.3');
+    if (version_compare(phpversion(), '4.3.3','<')) {
+        $errors[] = sprintf($lang['i_phpver'], phpversion(), '4.3.3');
hunk ./install.php 482
-    $funcs = explode(' ','addslashes basename call_user_func chmod copy fgets 
'.
-                         'file file_exists fseek flush filesize ftell fopen '.
-                         'glob header ignore_user_abort ini_get mail mkdir '.
-                         'ob_start opendir parse_ini_file readfile realpath '.
-                         'rename rmdir serialize session_start unlink usleep '.
-                         'preg_replace file_get_contents');
+    $funcs = explode(' ', 'addslashes basename call_user_func chmod copy fgets 
'.
+        'file file_exists fseek flush filesize ftell fopen '.
+        'glob header ignore_user_abort ini_get mail mkdir '.
+        'ob_start opendir parse_ini_file readfile realpath '.
+        'rename rmdir serialize session_start unlink usleep '.
+        'preg_replace file_get_contents');
hunk ./install.php 494
-    foreach($funcs as $func){
-        if(!function_exists($func)){
-            $error[] = sprintf($lang['i_funcna'],$func);
+    foreach ($funcs as $func) {
+        if (!function_exists($func)) {
+            $errors[] = sprintf($lang['i_funcna'], $func);
hunk ./install.php 503
+
hunk ./install.php 508
+ * @author Franz <francisc@xxxxxxxxxxx>
hunk ./install.php 510
-function langsel(){
+function langsel()
+{
hunk ./install.php 515
-    $dir = DOKU_INC.'inc/lang';
-    $dh  = opendir($dir);
-    if(!$dh) return;
-
-    $langs = array();
-    while (($file = readdir($dh)) !== false) {
-        if(preg_match('/^[\._]/',$file)) continue;
-        if(is_dir($dir.'/'.$file) && @file_exists($dir.'/'.$file.'/lang.php')){
-            $langs[] = $file;
+    $languages = array();
+    foreach (glob(DOKU_INC . 'inc/lang/*') as $file) {
+        $file = strtolower(basename($file));
+        if (preg_match('/^[^\._]/', $file)) {
+            $languages[] = $file;
hunk ./install.php 522
-    closedir($dh);
-    sort($langs);
+    sort($languages);
+?>
hunk ./install.php 525
+<form action="">
+    <?php print $lang['i_chooselang']; ?>:
+    <select name="l" onchange="submit()">
+    <?php foreach ($languages as $language) { ?>
+        <option value="<?php print $language; ?>"<?php if ($language == $LC) { 
print ' selected="selected"'; } ?>><?php print $language; ?></option>
+    <?php } ?>
+    </select>
+    <input type="submit" value="<?php print $lang['btn_update']; ?>" />
+</form>
hunk ./install.php 535
-    echo '<form action="">';
-    echo $lang['i_chooselang'];
-    echo ': <select name="l" onchange="submit()">';
-    foreach($langs as $l){
-        $sel = ($l == $LC) ? 'selected="selected"' : '';
-        echo '<option value="'.$l.'" '.$sel.'>'.$l.'</option>';
-    }
-    echo '</select> ';
-    echo '<input type="submit" value="'.$lang['btn_update'].'" />';
-    echo '</form>';
+<?php
hunk ./install.php 538
+
hunk ./install.php 544
-function print_errors(){
-    global $error;
-    echo '<ul>';
-    foreach ($error as $err){
-        echo "<li>$err</li>";
+function print_errors()
+{
+    global $errors;
+
+    print '<ul>';
+    foreach ($errors as $error) {
+        print '<li>' . $error . '</li>' . "\n";
hunk ./install.php 552
-    echo '</ul>';
+    print '</ul>';
hunk ./install.php 555
+
hunk ./install.php 561
-function remove_magic_quotes(&$array) {
-  foreach (array_keys($array) as $key) {
-    if (is_array($array[$key])) {
-      remove_magic_quotes($array[$key]);
-    }else {
-      $array[$key] = stripslashes($array[$key]);
+function remove_magic_quotes(&$array)
+{
+    foreach (array_keys($array) as $key) {
+        if (is_array($array[$key])) {
+            remove_magic_quotes($array[$key]);
+        }
+        else {
+            $array[$key] = stripslashes($array[$key]);
+        }
hunk ./install.php 571
-  }
hunk ./install.php 573
-
}

Context:

[TAG release stable 2008-05-05
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20080505170856]
Patch bundle hash:
9f3c30fdc5bf3129e145de3dfc0a38df773e22f4




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.