$serendipity['POST']['user'] = $_REQUEST['http_auth_user']; $serendipity['POST']['pass'] = $_REQUEST['http_auth_pw']; } serendipity_login(false); } if (isset($_SESSION['serendipityAuthorid'])) { serendipity_load_configuration($_SESSION['serendipityAuthorid']); $serendipity['lang'] = serendipity_getPostAuthSessionLanguage(); } // Try to fix some path settings. It seems common users have this setting wrong // when s9y is installed into the root directory, especially 0.7.1 upgrade users. if (empty($serendipity['serendipityHTTPPath'])) { $serendipity['serendipityHTTPPath'] = '/'; } /* Changing this is NOT recommended, rewrite rules does not take them into account - yet */ serendipity_initPermalinks(); // Apply constants/definitions from custom permalinks serendipity_permalinkPatterns(); /* * Load main language file again, because now we have the preferred language */ include S9Y_INCLUDE_PATH . 'include/lang.inc.php'; /* * Reset charset definition now that final language is known */ $serendipity['charsets'] = array('UTF-8/' => 'UTF-8', '' => CHARSET_NATIVE); /* * Set current locale, if any has been defined */ if (defined('DATE_LOCALES')) { $locales = explode(',', DATE_LOCALES);
/** * Check the serendipity Installation for problems, during installation * * @access public * @return boolean Errors encountered? */ function serendipity_checkInstallation() { global $serendipity, $umask; $errs = array(); serendipity_initPermalinks(); // Check dirs if (!is_dir($_POST['serendipityPath'])) { $errs[] = sprintf(DIRECTORY_NON_EXISTANT, htmlspecialchars($_POST['serendipityPath'])); } elseif (!is_dir($_POST['serendipityPath'] . $_POST['uploadPath']) && @mkdir($_POST['serendipityPath'] . $_POST['uploadPath'], $umask) !== true) { $errs[] = sprintf(DIRECTORY_CREATE_ERROR, htmlspecialchars($_POST['serendipityPath']) . htmlspecialchars($_POST['uploadPath'])); } elseif (!is_writable($_POST['serendipityPath'] . $_POST['uploadPath'])) { $errs[] = sprintf(DIRECTORY_WRITE_ERROR, htmlspecialchars($_POST['serendipityPath']) . htmlspecialchars($_POST['uploadPath'])); $errs[] = sprintf(DIRECTORY_RUN_CMD, 'chmod go+rws', htmlspecialchars($_POST['serendipityPath']) . htmlspecialchars($_POST['uploadPath'])); } // Attempt to create the template compile directory, it might already be there, but we just want to be sure if (!is_dir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE) && @mkdir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE, $umask) !== true) { $errs[] = sprintf(DIRECTORY_CREATE_ERROR, htmlspecialchars($_POST['serendipityPath']) . PATH_SMARTY_COMPILE); $errs[] = sprintf(DIRECTORY_RUN_CMD, 'mkdir', htmlspecialchars($_POST['serendipityPath']) . PATH_SMARTY_COMPILE); $errs[] = sprintf(DIRECTORY_RUN_CMD, 'chmod go+rwx', htmlspecialchars($_POST['serendipityPath']) . PATH_SMARTY_COMPILE); } elseif (is_dir($_POST['serendipityPath'] . PATH_SMARTY_COMPILE) && !is_writeable($_POST['serendipityPath'] . PATH_SMARTY_COMPILE) && @chmod($_POST['serendipityPath'] . PATH_SMARTY_COMPILE, $umask) !== true) { $errs[] = sprintf(DIRECTORY_RUN_CMD, 'chmod go+rwx', htmlspecialchars($_POST['serendipityPath']) . PATH_SMARTY_COMPILE); } // Attempt to create the archives directory if (!is_dir($_POST['serendipityPath'] . PATH_ARCHIVES) && @mkdir($_POST['serendipityPath'] . PATH_ARCHIVES, $umask) !== true) { $errs[] = sprintf(DIRECTORY_CREATE_ERROR, htmlspecialchars($_POST['serendipityPath']) . PATH_ARCHIVES); $errs[] = sprintf(DIRECTORY_RUN_CMD, 'mkdir', htmlspecialchars($_POST['serendipityPath']) . PATH_ARCHIVES); $errs[] = sprintf(DIRECTORY_RUN_CMD, 'chmod go+rwx', htmlspecialchars($_POST['serendipityPath']) . PATH_ARCHIVES); } // Check imagick if ($_POST['magick'] == 'true' && function_exists('is_executable') && !@is_executable($_POST['convert'])) { $errs[] = sprintf(CANT_EXECUTE_BINARY, 'convert imagemagick'); } if ($_POST['dbType'] == 'sqlite' || $_POST['dbType'] == 'sqlite3') { // We don't want that our SQLite db file can be guessed from other applications on a server // and have access to our's. So we randomize the SQLite dbname. $_POST['sqlitedbName'] = $_POST['dbName'] . '_' . md5(time()); } if (empty($_POST['dbPrefix']) && empty($serendipity['dbPrefix'])) { $errs[] = sprintf(EMPTY_SETTING, INSTALL_DBPREFIX); } $serendipity['dbType'] = $_POST['dbType']; // Probe database // (do it after the dir stuff, as we need to be able to create the sqlite database) @(include_once $_POST['serendipityPath'] . 'include/db/db.inc.php'); // For shared installations, probe the file on include path include_once S9Y_INCLUDE_PATH . 'include/db/db.inc.php'; if (S9Y_DB_INCLUDED) { serendipity_db_probe($_POST, $errs); } return count($errs) > 0 ? $errs : ''; }