function getConfig() { // Start with an empty array $config = array(); // Get the config values $config['db_host'] = YDConfig::get('db_host', 'localhost'); $config['db_name'] = YDConfig::get('db_name', 'yellowd_ydweblog'); $config['db_user'] = YDConfig::get('db_user', 'root'); $config['db_pass'] = YDConfig::get('db_pass', ''); $config['db_prefix'] = YDConfig::get('db_prefix', ''); $config['weblog_title'] = YDConfig::get('weblog_title', 'Untitled weblog'); $config['weblog_description'] = YDConfig::get('weblog_description', ''); $config['weblog_entries_fp'] = YDConfig::get('weblog_entries_fp', 1); $config['weblog_skin'] = YDConfig::get('weblog_skin', 'default'); $config['weblog_language'] = YDConfig::get('weblog_language', 'nl'); $config['google_analytics'] = YDConfig::get('google_analytics', ''); $config['include_debug_info'] = YDConfig::get('include_debug_info', false); $config['email_new_comment'] = YDConfig::get('email_new_comment', true); $config['email_new_item'] = YDConfig::get('email_new_item', true); $config['max_syndicated_items'] = YDConfig::get('max_syndicated_items', 20); $config['use_cache'] = YDConfig::get('use_cache', false); $config['friendly_urls'] = YDConfig::get('friendly_urls', false); $config['dflt_is_draft'] = YDConfig::get('dflt_is_draft', false); $config['blocked_ips'] = YDConfig::get('blocked_ips', YDFormatStringWithListValues('')); $config['akismet_key'] = YDConfig::get('akismet_key', ''); $config['max_img_size_x'] = YDConfig::get('max_img_size_x', ''); $config['max_img_size_y'] = YDConfig::get('max_img_size_y', ''); $config['comment_interval'] = YDConfig::get('comment_interval', 10); $config['max_comment_length'] = YDConfig::get('max_comment_length', 1500); $config['max_comment_links'] = YDConfig::get('max_comment_links', 1); // Return the configuration return $config; }
} // Update the database prefix YDConfig::set('YD_DB_TABLEPREFIX', YDConfig::get('db_prefix', '')); // Get the cache filename $cache_file = YD_DIR_TEMP . '/' . YD_WEBLOG_CACHE_PREFIX . md5(YDRequest::getNormalizedCurrentUrl()) . '.' . YD_WEBLOG_CACHE_SUFFIX; @define('YD_WEBLOG_CACHE_FNAME', $cache_file); // Include the standard modules YDInclude('YDDatabase.php'); YDInclude('YDDatabaseMetaData.php'); YDInclude('YDTemplate.php'); // Include other libraries YDInclude(dirname(__FILE__) . '/YDWeblogAPI.php'); YDInclude(dirname(__FILE__) . '/YDWeblogRequest.php'); YDInclude(YD_DIR_HOME . '/3rdparty/smarty/libs/plugins/modifier.truncate.php'); // Check for blocked IP addresses $blocked_ips = YDFormatStringWithListValues(YDConfig::get('blocked_ips', '')); // Check if the current IP address is blocked or not if ($blocked_ips != '') { $blocked_ips = explode(', ', $blocked_ips); foreach ($blocked_ips as $ip) { if (YDStringUtil::match($_SERVER['REMOTE_ADDR'], $ip)) { die('IP address ' . $_SERVER['REMOTE_ADDR'] . ' is blocked.'); } } } // Cache output if needed if (YDConfig::get('use_cache', false)) { if (sizeof($_POST) == 0) { if (is_file(YD_WEBLOG_CACHE_FNAME)) { $data = file_get_contents(YD_WEBLOG_CACHE_FNAME); @(include dirname(__FILE__) . '/cache_filter.php');