function Step2B() { global $dbConn; // Connect to database. list($aDBInfo, $strError) = InitDatabase(); // Return any errors. if ($strError) { return $strError; } // Execute the upgrade SQL script. if (!$_SESSION["upgrade.{$aDBInfo['type']}"]) { if (ExecuteSQL("./includes/upgrade.{$aDBInfo['type']}")) { // Mark us as having executed the SQL script. $_SESSION["upgrade.{$aDBInfo['type']}"] = TRUE; } else { // Couldn't execute install.sql. return "Could not execute <code>upgrade.{$aDBInfo['type']}</code>.<br /><b>Database says</b>: " . $dbConn->geterror(); } } // Load the current configuration settings. $dbConn->query("SELECT content FROM configuration WHERE name='settings'"); list($aConfig) = $dbConn->getresult(); $aConfig = unserialize($aConfig); // Update settings. $aConfig['version'] = '0.16a'; // Sanitize it for the database. $strSettings = $dbConn->sanitize(serialize($aConfig)); $dbConn->query("DELETE FROM configuration WHERE name='settings'"); $dbConn->query("INSERT INTO configuration(name, content) VALUES('settings', '{$strSettings}')"); // What is the address of their forums? $strForums = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], 'setup/index.php')) . 'index.php'; // Delete old cookies. $path = substr(pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME), 0, strpos(pathinfo($_SERVER['PHP_SELF'], PATHINFO_DIRNAME), 'setup')); setcookie('activeuserid', '', time(), $path); setcookie('activepassword', '', time(), $path); setcookie('s', '', time(), $path); // Destroy the session. session_unset(); session_destroy(); // Tell the user it was a success. PrintHeader(); ?> <h1>Upgrade Successful!</h1> <p>Your forums have been successfully upgraded from V0.15a to V0.16a. <b>You should delete the <code>setup</code> directory in your forums' path before continuing, as it is now a security risk.</b></p> <p>You can visit your upgraded forums at this address:</p> <blockquote><a href="<?php echo $strForums; ?> "><?php echo htmlspecialchars("{$_SERVER['HTTP_HOST']}{$strForums}"); ?> </a></blockquote> <p>If you or your users have any problems while using your upgraded community, stop by the <a href="http://www.ovbb.org/forums/forumdisplay.php?forumid=3">OvBB Project Forums</a> to seek support.</p> <?php PrintFooter(); }
function Step4() { global $dbConn; // Connect to database. list(, $strError) = InitDatabase(); // Are they submitting? if (isset($_REQUEST['submit'])) { $strError = Step4B(); } // Header PrintHeader(); // Print out any errors. if ($strError) { echo "<p><b>Error:</b> {$strError}</p>\n"; } else { $dbConn->query("SELECT content FROM configuration WHERE name='settings'"); list($strValue) = $dbConn->getresult(); $_SESSION['config'] = $CFG = unserialize($strValue); } ?> <h1>Create Administrator's Account</h1> <p>Your forums are basically setup now, but you should create an administrator account. This can be either the account you will typically use, or one dedicated to administrative tasks.</p> <blockquote><form action="index.php" method="post"> <b>Username</b> <div><input type="text" name="username" maxlength="<?php echo $CFG['maxlen']['username']; ?> " value="<?php echo htmlspecialchars($_SESSION['username']); ?> " /></div><br /> <b>Password</b> <div><input type="password" name="password" maxlength="<?php echo $CFG['maxlen']['password']; ?> " value="<?php echo htmlspecialchars($_SESSION['password']); ?> " /></div><br /> <b>E-Mail</b> <div><input type="text" name="email" maxlength="<?php echo $CFG['maxlen']['email']; ?> " value="<?php echo htmlspecialchars($_SESSION['email']); ?> " /></div><br /> <input type="submit" name="submit" value="Go" /> </form></blockquote> <?php // Footer PrintFooter(); }
create_tables($sqlite_db); setup_params($sqlite_db, $date, "FULL"); $sqlite_db->query("DROP TABLE tables"); $sqlite_db->query("DROP TABLE dir0"); $sqlite_db->query("DROP TABLE ref0"); $sqlite_db->query("CREATE TABLE dir0(code INTEGER PRIMARY KEY, name, info, parent INTEGER NOT NULL)"); $sqlite_db->query("CREATE TABLE ref0(code INTEGER, book INTEGER, PRIMARY KEY(code, book))"); $sqlite_db->query("CREATE INDEX dir0_parent ON dir0(parent)"); $sqlite_db->query("CREATE INDEX ref0_book ON ref0(book)"); $sqlite_db->query("CREATE TABLE tables(id INTEGER PRIMARY KEY AUTOINCREMENT,title,\n\tdir_file,dir_data,dir_type,dir_code,dir_name,dir_info,dir_prnt,\n\tref_file,ref_data,ref_type,ref_code,ref_book,fb2_code)"); $sqlite_db->query("INSERT INTO tables(title,dir_data,dir_type,dir_code,dir_name,dir_prnt,ref_data,ref_type,ref_code,ref_book)\n\tVALUES ('Тематический рубрикатор','dir0','INTEGER','code','name','parent','ref0','id','code','book')"); convert_books($mysql_db, $sqlite_db); convert_auth($mysql_db, $sqlite_db); convert_dates($mysql_db, $sqlite_db); convert_topics($mysql_db, $sqlite_db); create_indexes($sqlite_db); } $mysql_srvr = 'localhost'; $mysql_user = '******'; $mysql_pass = '******'; $mysql_base = 'bookwarrior'; $sqlitefile = 'myrulib.db'; include 'settings.php'; $sqlite_db = new PDO('sqlite:./myrulib.db'); $mysql_db = new mysqli($mysql_srvr, $mysql_user, $mysql_pass, $mysql_base); $mysql_db->query("SET NAMES utf8"); $date = date('Ymd'); echo "Today: " . $date . "\n"; InitDatabase($mysql_db); FullImport($mysql_db, $sqlitefile, $date); system("zip genesis.db.zip {$sqlitefile}");
// Software Foundation, either version 3 of the License, or any later version. // // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for // more details. // // You should have received a copy of the GNU General Public License along with // this program. If not, see <http://www.gnu.org/licenses/>. namespace nztv; // This file imports functions and sets up the database. Standard // initialization stuff, ya know? define('PHALANX_ROOT', getcwd() . '/phalanx'); require './config.php'; require './book_keeper.php'; require './episode.php'; require './functions.php'; require './provider.php'; require './show.php'; // Load the database. $new_db = false; if (!file_exists(\config::$database_path)) { echo "Database does not exist at '" . \config::$database_path . "'. Creating.\n"; $new_db = true; } $database_ = new \PDO('sqlite:' . \config::$database_path); if ($new_db) { InitDatabase($database_); } \phalanx\data\Model::set_db($database_);