} if (!is_readable(PMF_ROOT_DIR . '/inc/data.php') && !is_readable(PMF_ROOT_DIR . '/config/database.php')) { print '<p class="center">It seems you never run a version of phpMyFAQ.<br />' . 'Please use the <a href="setup.php">install script</a>.</p>'; HTMLFooter(); die; } if (file_exists(PMF_ROOT_DIR . '/inc/data.php')) { // before 2.6.0-alpha require PMF_ROOT_DIR . '/inc/data.php'; } else { // after 2.6.0-alpha require PMF_ROOT_DIR . '/config/database.php'; } require PMF_ROOT_DIR . '/inc/functions.php'; define('SQLPREFIX', $DB['prefix']); $db = PMF_Db::dbSelect($DB["type"]); $db->connect($DB["server"], $DB["user"], $DB["password"], $DB["db"]); /**************************** STEP 1 OF 4 ***************************/ if ($step == 1) { $faqconfig = PMF_Configuration::getInstance(); $version = $faqconfig->get('main.currentVersion'); ?> <form action="update.php?step=2" method="post"> <fieldset class="installation"> <legend class="installation"><strong>phpMyFAQ <?php print NEWVERSION; ?> Update (Step 1 of 4)</strong></legend> <p>This update will work <strong>only</strong> for the following versions:</p> <ul type="square"> <li>phpMyFAQ 2.0.x</li>
define('PMF_CONFIG_DIR', dirname(dirname(__FILE__)) . '/config'); require PMF_CONFIG_DIR . '/database.php'; require PMF_CONFIG_DIR . '/constants.php'; require PMF_INCLUDE_DIR . '/functions.php'; // TODO: Linkverifier.php contains both PMF_Linkverifier class and // helper functions => move the fns into the class. require_once PMF_INCLUDE_DIR . '/Linkverifier.php'; // // Set the error handler to our pmf_error_handler() function // set_error_handler('pmf_error_handler'); // // Create a database connection // define('SQLPREFIX', $DB['prefix']); $db = PMF_Db::dbSelect($DB['type']); $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']); // // Fetch the configuration // $faqconfig = PMF_Configuration::getInstance(); $faqconfig->getAll(); // // We always need a valid session! // // Avoid any PHP version to move sessions on URLs ini_set('session.use_only_cookies', 1); ini_set('session.use_trans_sid', 0); ini_set('url_rewriter.tags', ''); // // Connect to LDAP server, when LDAP support is enabled
die; } // check LDAP if available if (extension_loaded('ldap') && !is_null($ldap_enabled)) { $datafile = PMF_ROOT_DIR . '/config/ldap.php'; $ret = file_put_contents($datafile, "<?php\n\$PMF_LDAP[\"ldap_server\"] = '" . $ldap_server . "';\n\$PMF_LDAP[\"ldap_port\"] = '" . $ldap_port . "';\n\$PMF_LDAP[\"ldap_user\"] = '" . $ldap_user . "';\n\$PMF_LDAP[\"ldap_password\"] = '" . $ldap_password . "';\n\$PMF_LDAP[\"ldap_base\"] = '" . $ldap_base . "';", LOCK_EX); if (!$ret) { print "<p class=\"error\"><strong>Error:</strong> Cannot write to dataldap.php.</p>"; HTMLFooter(); cleanInstallation(); die; } } // connect to the database using inc/data.php require PMF_ROOT_DIR . '/config/database.php'; $db = PMF_Db::dbSelect($sql_type); $db->connect($DB['server'], $DB['user'], $DB['password'], $DB['db']); if (!$db) { print "<p class=\"error\"><strong>DB Error:</strong> " . $db->error() . "</p>\n"; HTMLFooter(); cleanInstallation(); die; } require_once $sql_type . '.sql.php'; // CREATE TABLES require_once 'config.sql.php'; // INSERTs for configiration require_once 'stopwords.sql.php'; // INSERTs for stopwords print "<p class=\"center\">"; @ob_flush();