\n"; echo "
\n"; echo "verifing database connection
\n"; try { $db = DB::newInstance($cfg['db']['dsn'],$cfg['db']['user'],$cfg['db']['passwd']); echo "- database connection successfull"; } catch (DBException $e) { echo "- error: ".$e->getMessage(); $valid=false; } echo "
\n"; echo ''; } else { $valid = true; echo "checking system config:
\n"; if (file_exists('../cfg/cfg.system.php')) include('../cfg/cfg.system.php'); else die('missing syscfg'); echo "- syscfg found and loaded
\n"; echo "
\n"; echo "verifing database connection
\n"; try { $db = DB::newInstance($cfg['db']['dsn'],$cfg['db']['user'],$cfg['db']['passwd']); echo "- database connection successfull


\n"; if (!$valid) die('terminated'); switch ($_REQUEST['step']) { case 1: echo ' resetting password
'; $search = array( 'site_id' => NULL, 'login' => trim($_POST['login']), 'masteradmin' => true ); $result = $db->table('accounts')->select($search); $usr = $result->fetchObject(); $result->close(); // generating hashed password // TODO: use user service for that $passwd = trim($_POST['passwd']); $seed = (int) $usr->seed; $seedhash = md5($seed); $rounds = 5 + ($seed % 45); $pwhash = md5($passwd); for ($i = 0; $i < $rounds; $i++) $pwhash = sha1($pwhash.$passwd); $pwhash = '$1#'.$seed.'$'.$pwhash; $data = array( 'password' => $pwhash ); $db->table('accounts')->update($data,$search); echo '
All done, now remove the /install directory
'; echo 'Then you can go to the admin page or the main page'; break; } } ?>