0)); if (!defined('IN_serendipity')) { define('IN_serendipity', true); } include(S9Y_INCLUDE_PATH . 'include/compat.inc.php'); if (defined('USE_MEMSNAP')) { memSnap('Framework init'); } // The version string $serendipity['version'] = '1.7-alpha1'; // Setting this to 'false' will enable debugging output. All alpa/beta/cvs snapshot versions will emit debug information by default. To increase the debug level (to enable Smarty debugging), set this flag to 'debug'. $serendipity['production'] = (preg_match('@\-(alpha|beta|cvs)@', $serendipity['version']) ? false : true); // Set error reporting error_reporting(E_ALL & ~E_NOTICE); if ($serendipity['production'] !== true) { if ($serendipity['production'] === 'debug') { error_reporting(E_ALL); } @ini_set('display_errors', 'on'); } /** * Set our own exeption handler to convert all errors into exeptions automatically * * @access public * @param standard * @return null */ function errorToExceptionHandler($errNo, $errStr, $errFile, $errLine, $errContext) { // ToDo: enhance for special serendipity error needs, // like $errContext or specify tracing off in user context // @disabled errors will not appear $rep = ini_get('error_reporting'); // function error handler must return false to support $php_errormsg if(!($rep & $errStr)) { return false; } // respect user has set php to not display errors at all // may be overridden by if(ini_get('display_errors') == 0) print error in further context elseif (error_reporting() == 0) { return; } else { if($serendipity['production'] !== true) echo ' == DEBUG MODE == '; echo '
';
throw new ErrorException($errStr, 0, $errNo, $errFile, $errLine);
echo '';
}
return true;
}
// Default rewrite method
$serendipity['rewrite'] = 'none';
// Message container
$serendipity['messagestack'] = array();
// Can the user change the date of publishing for an entry?
$serendipity['allowDateManipulation'] = true;
// How much time is allowed to pass since the publising of an entry, so that a comment to that entry
// will update it's LastModified stamp? If the time is passed, a comment to an old entry will no longer
// push an article as being updated.
$serendipity['max_last_modified'] = 60 * 60 * 24 * 7;
// Clients can send a If-Modified Header to the RSS Feed (Conditional Get) and receive all articles beyond
// that date. However it is still limited by the number below of maximum entries
$serendipity['max_fetch_limit'] = 50;
// How many bytes are allowed for fetching trackbacks, so that no binary files get accidently trackbacked?
$serendipity['trackback_filelimit'] = 150 * 1024;
if (!isset($serendipity['fetchLimit'])) {
$serendipity['fetchLimit'] = 15;
}
if (!isset($serendipity['RSSfetchLimit'])) {
$serendipity['RSSfetchLimit'] = 15;
}
if (!isset($serendipity['mediaProperties'])) {
$serendipity['mediaProperties'] = 'DPI;COPYRIGHT;TITLE;COMMENT1:MULTI;COMMENT2:MULTI;ALT';
}
if (!isset($serendipity['use_PEAR'])) {
$serendipity['use_PEAR'] = true;
}
if (!isset($serendipity['useHTTP-Auth'])) {
$serendipity['useHTTP-Auth'] = true;
}
if (!isset($serendipity['CacheControl'])) {
$serendipity['CacheControl'] = true;
}
if (!isset($serendipity['expose_s9y'])) {
$serendipity['expose_s9y'] = true;
}
// Should IFRAMEs be used for previewing entries and sending trackbacks?
$serendipity['use_iframe'] = true;
/* Default language for autodetection */
$serendipity['autolang'] = 'en';
/* Name of folder for the default theme */
$serendipity['defaultTemplate'] = 'bulletproof';
/* Availiable languages */
if (!isset($serendipity['languages'])) {
$serendipity['languages'] = array('en' => 'English',
'de' => 'German',
'da' => 'Danish',
'es' => 'Spanish',
'fr' => 'French',
'fi' => 'Finnish',
'cs' => 'Czech (Win-1250)',
'cz' => 'Czech (ISO-8859-2)',
'nl' => 'Dutch',
'is' => 'Icelandic',
'tr' => 'Turkish',
'se' => 'Swedish',
'pt' => 'Portuguese Brazilian',
'pt_PT' => 'Portuguese European',
'bg' => 'Bulgarian',
'hu' => 'Hungarian',
'no' => 'Norwegian',
'pl' => 'Polish',
'ro' => 'Romanian',
'it' => 'Italian',
'ru' => 'Russian',
'fa' => 'Persian',
'tw' => 'Traditional Chinese (Big5)',
'tn' => 'Traditional Chinese (UTF-8)',
'zh' => 'Simplified Chinese (GB2312)',
'cn' => 'Simplified Chinese (UTF-8)',
'ja' => 'Japanese',
'ko' => 'Korean',
'sa' => 'Arabic',
'ta' => 'Tamil');
}
/* Available Calendars */
$serendipity['calendars'] = array('gregorian' => 'Gregorian',
'persian-utf8' => 'Persian (utf8)');
/*
* Load main language file
*/
include($serendipity['serendipityPath'] . 'include/lang.inc.php');
$serendipity['charsets'] = array(
'UTF-8/' => 'UTF-8',
'' => CHARSET_NATIVE
);
@define('PATH_SMARTY_COMPILE', 'templates_c'); // will be placed inside the template directory
@define('USERLEVEL_ADMIN', 255);
@define('USERLEVEL_CHIEF', 1);
@define('USERLEVEL_EDITOR', 0);
@define('VIEWMODE_THREADED', 'threaded');
@define('VIEWMODE_LINEAR', 'linear');
/*
* Kill the script if we are not installed, and not inside the installer
*/
if ( !defined('IN_installer') && IS_installed === false ) {
header('Status: 302 Found');
header('X-RequireInstall: 1');
header('Location: ' . (strtolower($_SERVER['HTTPS']) == 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])) . '/serendipity_admin.php');
serendipity_die(sprintf(SERENDIPITY_NOT_INSTALLED, 'serendipity_admin.php'));
}
/* Do the PEAR dance. If $serendipity['use_PEAR'] is set to FALSE, Serendipity will first put its own PEAR include path.
By default, a local PEAR will be used. */
if (function_exists('get_include_path')) {
$old_include = @get_include_path();
} else {
$old_include = @ini_get('include_path');
}
$new_include = ($serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : '')
. S9Y_INCLUDE_PATH . 'bundled-libs/' . PATH_SEPARATOR
. S9Y_INCLUDE_PATH . 'bundled-libs/Smarty/libs/' . PATH_SEPARATOR
. $serendipity['serendipityPath'] . PATH_SEPARATOR
. (!$serendipity['use_PEAR'] ? $old_include . PATH_SEPARATOR : '');
if (function_exists('set_include_path')) {
$use_include = @set_include_path($new_include);
} else {
$use_include = @ini_set('include_path', $new_include);
}
if ($use_include !== $false && $use_include == $new_include) {
@define('S9Y_PEAR', true);
@define('S9Y_PEAR_PATH', '');
} else {
@define('S9Y_PEAR', false);
@define('S9Y_PEAR_PATH', S9Y_INCLUDE_PATH . 'bundled-libs/');
}
/* PEAR path setup inclusion finished */
if (defined('IN_installer') && IS_installed === false) {
$serendipity['lang'] = $serendipity['autolang'];
$css_mode = 'serendipity_admin.css';
return 1;
}
/*
* Load DB configuration information
* Load Functions
* Make sure that the file included is in the current directory and not any possible
* include path
*/
if (@file_exists($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php')) {
$local_config = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php';
} elseif (defined('S9Y_DATA_PATH')) {
// Shared installation!
$local_config = S9Y_DATA_PATH . '/serendipity_config_local.inc.php';
} elseif (@file_exists($serendipity['serendipityPath'] . '/serendipity_config_local.inc.php')) {
$local_config = $serendipity['serendipityPath'] . '/serendipity_config_local.inc.php';
} else {
// Installation fallback
$local_config = S9Y_INCLUDE_PATH . '/serendipity_config_local.inc.php';
}
if (!is_readable($local_config)) {
$serendipity['lang'] = 'en';
include(S9Y_INCLUDE_PATH . 'include/lang.inc.php');
serendipity_die(sprintf(INCLUDE_ERROR . '