Uses salted MD5 hashs. Salt is 8 bytes long.
The same mechanism is used by Apache's 'apr1' method. This will
fallback to a implementation in pure PHP if MD5 support is not
available in crypt()
/** * Writes the data to the config files * * @author Chris Smith <*****@*****.**> */ function store_data($d) { global $LC; $ok = true; $d['policy'] = (int) $d['policy']; // create local.php $now = gmdate('r'); $output = <<<EOT <?php /** * Dokuwiki's Main Configuration File - Local Settings * Auto-generated by install script * Date: {$now} */ EOT; $output .= '$conf[\'title\'] = \'' . addslashes($d['title']) . "';\n"; $output .= '$conf[\'lang\'] = \'' . addslashes($LC) . "';\n"; $output .= '$conf[\'license\'] = \'' . addslashes($d['license']) . "';\n"; if ($d['acl']) { $output .= '$conf[\'useacl\'] = 1' . ";\n"; $output .= "\$conf['superuser'] = '******';\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'local.php', $output); if ($d['acl']) { // hash the password $phash = new PassHash(); $pass = $phash->hash_smd5($d['password']); // create users.auth.php // --- user:SMD5password:Real Name:email:groups,comma,seperated $output = join(":", array($d['superuser'], $pass, $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); // create acl.auth.php $output = <<<EOT # acl.auth.php # <?php exit()?> # Don't modify the lines above # # Access Control Lists # # Auto-generated by install script # Date: {$now} 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"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'acl.auth.php', $output); } return $ok; }
/** * Writes the data to the config files * * @author Chris Smith <*****@*****.**> * * @param array $d * @return bool */ function store_data($d) { global $LC; $ok = true; $d['policy'] = (int) $d['policy']; // create local.php $now = gmdate('r'); $output = <<<EOT <?php /** * Dokuwiki's Main Configuration File - Local Settings * Auto-generated by install script * Date: {$now} */ EOT; // add any config options set by a previous installer $preset = __DIR__ . '/install.conf'; if (file_exists($preset)) { $output .= "# preset config options\n"; $output .= file_get_contents($preset); $output .= "\n\n"; $output .= "# options selected in installer\n"; @unlink($preset); } $output .= '$conf[\'title\'] = \'' . addslashes($d['title']) . "';\n"; $output .= '$conf[\'lang\'] = \'' . addslashes($LC) . "';\n"; $output .= '$conf[\'license\'] = \'' . addslashes($d['license']) . "';\n"; if ($d['acl']) { $output .= '$conf[\'useacl\'] = 1' . ";\n"; $output .= "\$conf['superuser'] = '******';\n"; } if (!$d['allowreg']) { $output .= '$conf[\'disableactions\'] = \'register\'' . ";\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'local.php', $output); if ($d['acl']) { // hash the password $phash = new PassHash(); $pass = $phash->hash_smd5($d['password']); // create users.auth.php // --- user:SMD5password:Real Name:email:groups,comma,seperated $output = join(":", array($d['superuser'], $pass, $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); // create acl.auth.php $output = <<<EOT # acl.auth.php # <?php exit()?> # Don't modify the lines above # # Access Control Lists # # Auto-generated by install script # Date: {$now} 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"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'acl.auth.php', $output); } // enable popularity submission if ($d['pop']) { @touch(DOKU_INC . 'data/cache/autosubmit.txt'); } // disable auth plugins til needed $output = <<<EOT <?php /* * Local plugin enable/disable settings * * Auto-generated by install script * Date: {$now} */ \$plugins['authad'] = 0; \$plugins['authldap'] = 0; \$plugins['authmysql'] = 0; \$plugins['authpgsql'] = 0; EOT; $ok = $ok && fileWrite(DOKU_LOCAL . 'plugins.local.php', $output); return $ok; }