public static function get_folder_path($id) { if (!$id) { return ''; } static $folders = null; if (!config::config_exists()) { return false; } if ($folders === null) { config::load_config(); $folders = config::search('/^folder_/'); } return isset($folders['folder_' . $id]) ? $folders['folder_' . $id] : false; }
static function save_config($conf) { if (!config::config_exists()) { config::create_config(); } $content = file_get_contents(CONFIG_FILE); $new = substr($content, 0, strpos($content, '//--AUTOCONFIG-START') + 20) . "\n\n"; ksort($conf); $new .= '$_conf = ' . var_export($conf, true) . ";\n"; if (strlen($conf['error_reporting']) != 0) { $new .= '$_conf["error_reporting"] = ' . $conf['error_reporting'] . ";\n\n"; } $new .= substr($content, strpos($content, '//--AUTOCONFIG-END')); if (file_put_contents(CONFIG_FILE_WRITE, $new) === FALSE) { common::error("Failed writing to config.php, make sure it is writale. See Test Server section for more info"); } }
static function dbconnections() { if (!config::config_exists()) { return array(); } return config::get('db'); }
<?php if (LOGGED !== true) { die; } if (!config::config_exists()) { print ' <h2>PhpBF Framework configuration</h2> Config file does not exists or is not valid. Do you want to create a new config file with default values? <br/><br/> <input type="button" value="Create" onclick="document.location.href=\'' . common::url('self') . '?edit=config\';"/> '; } else { config::load_confdata(); print '<h2>PhpBF Framework configuration</h2>'; $first = reset(array_keys(config::$sections)); print '<style> #menu { background: #333; list-style: none; margin: 0; padding: 0; width: 100%; } #menu li { margin: 0; padding: 0; } #menu a { background: #333; border-bottom: 1px solid #393939;