start
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
start [2022/06/08 03:57] – created 118.100.17.52 | start [2022/06/08 06:59] (current) – removed 118.100.17.52 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | <?php | ||
- | / | ||
- | border: 1px solid #faa; padding: 0.5em 1em;"> | ||
- | <h1 style=" | ||
- | |||
- | It seems this server has no PHP support enabled. You will need to | ||
- | enable PHP before you can install and run DokuWiki. Contact your hosting | ||
- | provider if you're unsure what this means. | ||
- | |||
- | </ | ||
- | /** | ||
- | * Dokuwiki installation assistance | ||
- | * | ||
- | * @author | ||
- | */ | ||
- | |||
- | if(!defined(' | ||
- | if(!defined(' | ||
- | if(!defined(' | ||
- | |||
- | // load and initialize the core system | ||
- | require_once(DOKU_INC.' | ||
- | |||
- | // check for error reporting override or set error reporting to sane values | ||
- | if (!defined(' | ||
- | else { error_reporting(DOKU_E_LEVEL); | ||
- | |||
- | // language strings | ||
- | require_once(DOKU_INC.' | ||
- | if(isset($_REQUEST[' | ||
- | $LC = preg_replace('/ | ||
- | } | ||
- | if(empty($LC)) $LC = ' | ||
- | if($LC && $LC != ' | ||
- | require_once(DOKU_INC.' | ||
- | } | ||
- | |||
- | // initialise variables ... | ||
- | $error = array(); | ||
- | |||
- | // begin output | ||
- | header(' | ||
- | ?> | ||
- | < | ||
- | <html lang="<? | ||
- | < | ||
- | <meta charset=" | ||
- | < | ||
- | < | ||
- | body { width: 90%; margin: 0 auto; font: 84% Verdana, Helvetica, Arial, sans-serif; } | ||
- | img { border: none } | ||
- | br.cl { clear:both; } | ||
- | code { font-size: 110%; color: #800000; } | ||
- | fieldset { border: none } | ||
- | label { display: block; margin-top: 0.5em; } | ||
- | select.text, | ||
- | a {text-decoration: | ||
- | </ | ||
- | < | ||
- | function acltoggle(){ | ||
- | var cb = document.getElementById(' | ||
- | var fs = document.getElementById(' | ||
- | if(!cb || !fs) return; | ||
- | if(cb.checked){ | ||
- | fs.style.display = ''; | ||
- | }else{ | ||
- | fs.style.display = ' | ||
- | } | ||
- | } | ||
- | window.onload = function(){ | ||
- | acltoggle(); | ||
- | var cb = document.getElementById(' | ||
- | if(cb) cb.onchange = acltoggle; | ||
- | }; | ||
- | </ | ||
- | </ | ||
- | <body style=""> | ||
- | <h1 style=" | ||
- | <img src=" | ||
- | | ||
- | <?php echo $lang[' | ||
- | </h1> | ||
- | <div style=" | ||
- | <?php langsel()?> | ||
- | </ | ||
- | <br class=" | ||
- | |||
- | <div style=" | ||
- | <?php | ||
- | if(file_exists(DOKU_INC.' | ||
- | include(DOKU_INC.' | ||
- | }else{ | ||
- | print "< | ||
- | include(DOKU_INC.' | ||
- | print "</ | ||
- | } | ||
- | ?> | ||
- | <a style=" | ||
- | background: transparent | ||
- | url(data/ | ||
- | left top no-repeat; | ||
- | display: block; width: | ||
- | | ||
- | | ||
- | </ | ||
- | |||
- | <div style=" | ||
- | <?php | ||
- | try { | ||
- | if(! (check_functions() && check_permissions()) ){ | ||
- | echo '< | ||
- | print_errors(); | ||
- | print_retry(); | ||
- | }elseif(!check_configs()){ | ||
- | echo '< | ||
- | print_errors(); | ||
- | }elseif(check_data($_REQUEST[' | ||
- | // check_data has sanitized all input parameters | ||
- | if(!store_data($_REQUEST[' | ||
- | echo '< | ||
- | print_errors(); | ||
- | }else{ | ||
- | echo '< | ||
- | } | ||
- | }else{ | ||
- | print_errors(); | ||
- | print_form($_REQUEST[' | ||
- | } | ||
- | } catch (Exception $e) { | ||
- | echo ' | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | |||
- | |||
- | <div style=" | ||
- | <a href=" | ||
- | <a href=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | <?php | ||
- | |||
- | /** | ||
- | * Print the input form | ||
- | * | ||
- | * @param array $d submitted entry ' | ||
- | */ | ||
- | function print_form($d){ | ||
- | global $lang; | ||
- | global $LC; | ||
- | |||
- | include(DOKU_CONF.' | ||
- | |||
- | if(!is_array($d)) $d = array(); | ||
- | $d = array_map(' | ||
- | |||
- | if(!isset($d[' | ||
- | if(!isset($d[' | ||
- | |||
- | ?> | ||
- | <form action="" | ||
- | <input type=" | ||
- | < | ||
- | <label for=" | ||
- | <input type=" | ||
- | </ | ||
- | |||
- | < | ||
- | <label for=" | ||
- | <input type=" | ||
- | <?php echo $lang[' | ||
- | |||
- | < | ||
- | <label for=" | ||
- | <input class=" | ||
- | | ||
- | |||
- | <label for=" | ||
- | <input class=" | ||
- | | ||
- | |||
- | <label for=" | ||
- | <input class=" | ||
- | |||
- | <label for=" | ||
- | <input class=" | ||
- | |||
- | <label for=" | ||
- | <input class=" | ||
- | |||
- | <label for=" | ||
- | <select class=" | ||
- | <option value=" | ||
- | echo $lang[' | ||
- | <option value=" | ||
- | echo $lang[' | ||
- | <option value=" | ||
- | echo $lang[' | ||
- | </ | ||
- | |||
- | <label for=" | ||
- | <input type=" | ||
- | echo(($d[' | ||
- | <?php echo $lang[' | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | < | ||
- | < | ||
- | <?php | ||
- | array_push($license, | ||
- | if(empty($d[' | ||
- | foreach($license as $key => $lic){ | ||
- | echo '< | ||
- | echo '< | ||
- | | ||
- | echo hsc($lic[' | ||
- | if($lic[' | ||
- | echo '</ | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | |||
- | < | ||
- | < | ||
- | <label for=" | ||
- | <input type=" | ||
- | echo(($d[' | ||
- | <?php echo $lang[' | ||
- | <a href=" | ||
- | </ | ||
- | </ | ||
- | |||
- | </ | ||
- | < | ||
- | <button type=" | ||
- | </ | ||
- | </ | ||
- | <?php | ||
- | } | ||
- | |||
- | function print_retry() { | ||
- | global $lang; | ||
- | global $LC; | ||
- | ?> | ||
- | <form action="" | ||
- | < | ||
- | <input type=" | ||
- | <button type=" | ||
- | </ | ||
- | </ | ||
- | <?php | ||
- | } | ||
- | |||
- | /** | ||
- | * Check validity of data | ||
- | * | ||
- | * @author Andreas Gohr | ||
- | * | ||
- | * @param array $d | ||
- | * @return bool ok? | ||
- | */ | ||
- | function check_data(& | ||
- | static $form_default = array( | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | global $lang; | ||
- | global $error; | ||
- | |||
- | if(!is_array($d)) $d = array(); | ||
- | foreach($d as $k => $v) { | ||
- | if(is_array($v)) | ||
- | unset($d[$k]); | ||
- | else | ||
- | $d[$k] = (string)$v; | ||
- | } | ||
- | |||
- | // | ||
- | $d[' | ||
- | |||
- | $ok = false; | ||
- | |||
- | if(isset($_REQUEST[' | ||
- | $ok = true; | ||
- | |||
- | // check input | ||
- | if(empty($d[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | if(isset($d[' | ||
- | if(!preg_match('/ | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | if(empty($d[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | elseif(!isset($d[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | if(empty($d[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | if(empty($d[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | }else{ | ||
- | // Since default = 1, browser won't send acl=0 when user untick acl | ||
- | $d[' | ||
- | } | ||
- | } | ||
- | $d = array_merge($form_default, | ||
- | return $ok; | ||
- | } | ||
- | |||
- | /** | ||
- | * Writes the data to the config files | ||
- | * | ||
- | * @author | ||
- | * | ||
- | * @param array $d | ||
- | * @return bool | ||
- | */ | ||
- | function store_data($d){ | ||
- | global $LC; | ||
- | $ok = true; | ||
- | $d[' | ||
- | |||
- | // create local.php | ||
- | $now = gmdate(' | ||
- | $output = <<< | ||
- | <?php | ||
- | /** | ||
- | * Dokuwiki' | ||
- | * Auto-generated by install script | ||
- | * Date: $now | ||
- | */ | ||
- | |||
- | EOT; | ||
- | // add any config options set by a previous installer | ||
- | $preset = __DIR__.'/ | ||
- | if(file_exists($preset)){ | ||
- | $output .= "# preset config options\n"; | ||
- | $output .= file_get_contents($preset); | ||
- | $output .= " | ||
- | $output .= "# options selected in installer\n"; | ||
- | @unlink($preset); | ||
- | } | ||
- | |||
- | $output .= ' | ||
- | $output .= ' | ||
- | $output .= ' | ||
- | if($d[' | ||
- | $output .= ' | ||
- | $output .= " | ||
- | } | ||
- | if(!$d[' | ||
- | $output .= ' | ||
- | } | ||
- | $ok = $ok && fileWrite(DOKU_LOCAL.' | ||
- | |||
- | if ($d[' | ||
- | // hash the password | ||
- | $phash = new \dokuwiki\PassHash(); | ||
- | $pass = $phash-> | ||
- | |||
- | // create users.auth.php | ||
- | $output = <<< | ||
- | # users.auth.php | ||
- | # <?php exit()?> | ||
- | # Don't modify the lines above | ||
- | # | ||
- | # Userfile | ||
- | # | ||
- | # Auto-generated by install script | ||
- | # Date: $now | ||
- | # | ||
- | # Format: | ||
- | # login: | ||
- | |||
- | EOT; | ||
- | // --- user: | ||
- | $output = $output." | ||
- | $ok = $ok && fileWrite(DOKU_LOCAL.' | ||
- | |||
- | // create acl.auth.php | ||
- | $output = <<< | ||
- | # acl.auth.php | ||
- | # <?php exit()?> | ||
- | # Don't modify the lines above | ||
- | # | ||
- | # Access Control Lists | ||
- | # | ||
- | # Auto-generated by install script | ||
- | # Date: $now | ||
- | |||
- | EOT; | ||
- | if($d[' | ||
- | $output .= " | ||
- | $output .= " | ||
- | }elseif($d[' | ||
- | $output .= " | ||
- | $output .= " | ||
- | }else{ | ||
- | $output .= " | ||
- | } | ||
- | $ok = $ok && fileWrite(DOKU_LOCAL.' | ||
- | } | ||
- | |||
- | // enable popularity submission | ||
- | if($d[' | ||
- | @touch(DOKU_INC.' | ||
- | } | ||
- | |||
- | // disable auth plugins til needed | ||
- | $output = <<< | ||
- | <?php | ||
- | /* | ||
- | * Local plugin enable/ | ||
- | * | ||
- | * Auto-generated by install script | ||
- | * Date: $now | ||
- | */ | ||
- | |||
- | \$plugins[' | ||
- | \$plugins[' | ||
- | \$plugins[' | ||
- | \$plugins[' | ||
- | |||
- | EOT; | ||
- | $ok = $ok && fileWrite(DOKU_LOCAL.' | ||
- | |||
- | return $ok; | ||
- | } | ||
- | |||
- | /** | ||
- | * Write the given content to a file | ||
- | * | ||
- | * @author | ||
- | * | ||
- | * @param string $filename | ||
- | * @param string $data | ||
- | * @return bool | ||
- | */ | ||
- | function fileWrite($filename, | ||
- | global $error; | ||
- | global $lang; | ||
- | |||
- | if (($fp = @fopen($filename, | ||
- | $filename = str_replace($_SERVER[' | ||
- | $error[] | ||
- | return false; | ||
- | } | ||
- | |||
- | if (!empty($data)) { fwrite($fp, $data); | ||
- | fclose($fp); | ||
- | return true; | ||
- | } | ||
- | |||
- | |||
- | /** | ||
- | * check installation dependent local config files and tests for a known | ||
- | * unmodified main config file | ||
- | * | ||
- | * @author | ||
- | * | ||
- | * @return bool | ||
- | */ | ||
- | function check_configs(){ | ||
- | global $error; | ||
- | global $lang; | ||
- | |||
- | $ok = true; | ||
- | |||
- | $config_files = array( | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | |||
- | // configs shouldn' | ||
- | foreach ($config_files as $file) { | ||
- | if (file_exists($file) && filesize($file)) { | ||
- | $file = str_replace($_SERVER[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | } | ||
- | return $ok; | ||
- | } | ||
- | |||
- | |||
- | /** | ||
- | * Check other installation dir/file permission requirements | ||
- | * | ||
- | * @author | ||
- | * | ||
- | * @return bool | ||
- | */ | ||
- | function check_permissions(){ | ||
- | global $error; | ||
- | global $lang; | ||
- | |||
- | $dirs = array( | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ); | ||
- | |||
- | $ok = true; | ||
- | foreach($dirs as $dir){ | ||
- | if(!file_exists(" | ||
- | $dir = str_replace($_SERVER[' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | } | ||
- | return $ok; | ||
- | } | ||
- | |||
- | /** | ||
- | * Check the availability of functions used in DokuWiki and the PHP version | ||
- | * | ||
- | * @author Andreas Gohr < | ||
- | * | ||
- | * @return bool | ||
- | */ | ||
- | function check_functions(){ | ||
- | global $error; | ||
- | global $lang; | ||
- | $ok = true; | ||
- | |||
- | if(version_compare(phpversion(),' | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | |||
- | if(ini_get(' | ||
- | $error[] = $lang[' | ||
- | $ok = false; | ||
- | } | ||
- | |||
- | try { | ||
- | random_bytes(1); | ||
- | } catch (\Exception $th) { | ||
- | // If an appropriate source of randomness cannot be found, an Exception will be thrown by PHP 7+ | ||
- | // this exception is also thrown by paragonie/ | ||
- | $error[] = $lang[' | ||
- | $ok = false; | ||
- | } | ||
- | |||
- | if(ini_get(' | ||
- | $error[] = $lang[' | ||
- | $ok = false; | ||
- | } | ||
- | |||
- | $funcs = explode(' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | |||
- | if (!function_exists(' | ||
- | $funcs[] = ' | ||
- | $funcs[] = ' | ||
- | } | ||
- | |||
- | if(!function_exists(' | ||
- | if(strpos(ini_get(' | ||
- | $disabled = $lang[' | ||
- | } | ||
- | else { | ||
- | $disabled = ""; | ||
- | } | ||
- | $error[] = sprintf($lang[' | ||
- | } | ||
- | |||
- | foreach($funcs as $func){ | ||
- | if(!function_exists($func)){ | ||
- | $error[] = sprintf($lang[' | ||
- | $ok = false; | ||
- | } | ||
- | } | ||
- | return $ok; | ||
- | } | ||
- | |||
- | /** | ||
- | * Print language selection | ||
- | * | ||
- | * @author Andreas Gohr < | ||
- | */ | ||
- | function langsel(){ | ||
- | global $lang; | ||
- | global $LC; | ||
- | |||
- | $dir = DOKU_INC.' | ||
- | $dh = opendir($dir); | ||
- | if(!$dh) return; | ||
- | |||
- | $langs = array(); | ||
- | while (($file = readdir($dh)) !== false) { | ||
- | if(preg_match('/ | ||
- | if(is_dir($dir.'/' | ||
- | $langs[] = $file; | ||
- | } | ||
- | } | ||
- | closedir($dh); | ||
- | sort($langs); | ||
- | |||
- | echo '< | ||
- | echo $lang[' | ||
- | echo ': <select name=" | ||
- | foreach($langs as $l){ | ||
- | $sel = ($l == $LC) ? ' | ||
- | echo '< | ||
- | } | ||
- | echo '</ | ||
- | echo '< | ||
- | echo '</ | ||
- | } | ||
- | |||
- | /** | ||
- | * Print global error array | ||
- | * | ||
- | * @author Andreas Gohr < | ||
- | */ | ||
- | function print_errors(){ | ||
- | global $error; | ||
- | if(!empty($error)) { | ||
- | echo '< | ||
- | foreach ($error as $err){ | ||
- | echo "< | ||
- | } | ||
- | echo '</ | ||
- | } | ||
- | } | ||
start.1654660642.txt.gz · Last modified: 2022/06/08 03:57 by 118.100.17.52