コード例 #1
0
 $fd = fopen('.htaccess', 'w');
 if ($fd === FALSE) {
     @unlink('class/config.php');
     header('HTTP/1.1 500 Internal Error');
     exit;
 }
 fputs($fd, 'RewriteEngine on' . PHP_EOL . 'Options -Indexes +FollowSymlinks' . PHP_EOL);
 fputs($fd, 'RewriteBase ' . ($dir === '' ? '/' : $dir) . PHP_EOL);
 fputs($fd, 'RewriteRule ^(ajax.*) $1 [L,NC,QSA]' . PHP_EOL . 'RewriteRule ^(assets)/(.*) $1/$2 [L,NC]' . PHP_EOL . 'RewriteRule ^.*$ index.php [L,QSA]' . PHP_EOL);
 fclose($fd);
 /*
  * Try opening the database and setting up the User table
  */
 require 'rb.php';
 try {
     $now = r::isodatetime(time() - date('Z'));
     # make sure the timestamp is in UTC (this should fix a weird problem with some XAMPP installations)
     $vals['dbhost'] = $cvalue['dbhost'];
     $vals['dbname'] = $cvalue['dbname'];
     $vals['dbuser'] = $cvalue['dbuser'];
     R::setup('mysql:host=' . $cvalue['dbhost'] . ';dbname=' . $cvalue['dbname'], $cvalue['dbuser'], $cvalue['dbpass']);
     # mysql initialiser
     R::freeze(FALSE);
     R::nuke();
     # clear everything.....
     $user = R::dispense('user');
     $user->email = $cvalue['email'];
     $user->login = $cvalue['admin'];
     $user->password = password_hash($cvalue['adminpw'], PASSWORD_DEFAULT);
     $user->active = 1;
     $user->confirm = 1;