本文整理汇总了PHP中is_dataroot_insecure函数的典型用法代码示例。如果您正苦于以下问题:PHP is_dataroot_insecure函数的具体用法?PHP is_dataroot_insecure怎么用?PHP is_dataroot_insecure使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_dataroot_insecure函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_context_instance
$context = get_context_instance(CONTEXT_SYSTEM);
require_capability('moodle/site:config', $context);
// check that site is properly customized
$site = get_site();
if (empty($site->shortname)) {
// probably new installation - lets return to frontpage after this step
// remove settings that we want uninitialised
unset_config('registerauth');
redirect('upgradesettings.php?return=site');
}
// Check if we are returning from moodle.org registration and if so, we mark that fact to remove reminders
if (!empty($id) and $id == $CFG->siteidentifier) {
set_config('registered', time());
}
// setup critical warnings before printing admin tree block
$insecuredataroot = is_dataroot_insecure(true);
$SESSION->admin_critical_warning = $insecuredataroot == INSECURE_DATAROOT_ERROR;
$adminroot = admin_get_root();
// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)) {
redirect('upgradesettings.php');
}
// Everything should now be set up, and the user is an admin
// Print default admin page with notifications.
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
$cronoverdue = $lastcron < time() - 3600 * 24;
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
$updateschecker = available_update_checker::instance();
$availableupdates = $updateschecker->get_update_info('core', array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
示例2: admin_critical_warnings_present
/**
* Test if and critical warnings are present
* @return bool
*/
function admin_critical_warnings_present()
{
global $SESSION;
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
return 0;
}
if (!isset($SESSION->admin_critical_warning)) {
$SESSION->admin_critical_warning = 0;
if (is_dataroot_insecure(true) === INSECURE_DATAROOT_ERROR) {
$SESSION->admin_critical_warning = 1;
}
}
return $SESSION->admin_critical_warning;
}
示例3: install_print_footer
install_print_footer($config);
die;
} else {
$config->stage = INSTALL_DATABASE;
}
}
}
if ($config->stage == INSTALL_DOWNLOADLANG) {
if (empty($CFG->dataroot)) {
$config->stage = INSTALL_PATHS;
} else if (is_dataroot_insecure()) {
$hint_dataroot = get_string('pathsunsecuredataroot', 'install');
$config->stage = INSTALL_PATHS;
} else if (!file_exists($CFG->dataroot)) {
$a = new stdClass();
$a->parent = dirname($CFG->dataroot);
$a->dataroot = $CFG->dataroot;
if (!is_writable($a->parent)) {
$hint_dataroot = get_string('pathsroparentdataroot', 'install', $a);
$config->stage = INSTALL_PATHS;
} else {
if (!install_init_dataroot($CFG->dataroot, $CFG->directorypermissions)) {
$hint_dataroot = get_string('pathserrcreatedataroot', 'install', $a);
$config->stage = INSTALL_PATHS;
}
示例4: report_security_check_unsecuredataroot
/**
* Verifies fatal misconfiguration of dataroot
* @param bool $detailed
* @return object result
*/
function report_security_check_unsecuredataroot($detailed = false)
{
global $CFG;
$result = new object();
$result->issue = 'report_security_check_unsecuredataroot';
$result->name = get_string('check_unsecuredataroot_name', 'report_security');
$result->info = null;
$result->details = null;
$result->status = null;
$result->link = null;
$insecuredataroot = is_dataroot_insecure(true);
if ($insecuredataroot == INSECURE_DATAROOT_WARNING) {
$result->status = REPORT_SECURITY_SERIOUS;
$result->info = get_string('check_unsecuredataroot_warning', 'report_security', $CFG->dataroot);
} else {
if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
$result->status = REPORT_SECURITY_CRITICAL;
$result->info = get_string('check_unsecuredataroot_error', 'report_security', $CFG->dataroot);
} else {
$result->status = REPORT_SECURITY_OK;
$result->info = get_string('check_unsecuredataroot_ok', 'report_security');
}
}
if ($detailed) {
$result->details = get_string('check_unsecuredataroot_details', 'report_security');
}
return $result;
}
示例5: get_string
}
/// check dirroot
if (($fh = @fopen($INSTALL['dirrootform'] . '/install.php', 'r')) === false) {
$errormsg .= get_string('dirrooterror', 'install') . '<br />';
$INSTALL['dirrootform'] = $INSTALL['dirroot'];
}
if ($fh) {
fclose($fh);
}
/// check dataroot
$CFG->dataroot = $INSTALL['dataroot'];
$CFG->wwwroot = $INSTALL['wwwroot'];
if (make_upload_directory('sessions', false) === false) {
$errormsg .= get_string('datarooterror', 'install') . '<br />';
} else {
if (is_dataroot_insecure(true) == INSECURE_DATAROOT_ERROR) {
$errormsg .= get_string('datarootpublicerror', 'install') . '<br />';
}
}
if (!empty($errormsg)) {
$nextstage = DIRECTORY;
}
error_reporting(7);
}
//==========================================================================//
/// Check database settings if stage 3 data submitted
/// Try to connect to the database. If that fails then try to create the database
if ($INSTALL['stage'] == DATABASE) {
/// different format for postgres7 by socket
if ($INSTALL['dbtype'] == 'postgres7' and $INSTALL['dbhost'] == 'localhost' || $INSTALL['dbhost'] == '127.0.0.1') {
$INSTALL['dbhost'] = "user='{$INSTALL['dbuser']}' password='{$INSTALL['dbpass']}' dbname='{$INSTALL['dbname']}'";
示例6: define
$INSTALL['version'] = $version;
$INSTALL['release'] = $release;
/// Have the $db object ready because we are going to use it often
define('ADODB_ASSOC_CASE', 0);
//Use lowercase fieldnames for ADODB_FETCH_ASSOC
$db =& ADONewConnection($INSTALL['dbtype']);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
/// guess the www root
if ($INSTALL['wwwroot'] == '') {
list($INSTALL['wwwroot'], $xtra) = explode('/install.php', qualified_me());
$INSTALL['wwwrootform'] = $INSTALL['wwwroot'];
// now try to guess the correct dataroot not accessible via web
$CFG->wwwroot = $INSTALL['wwwroot'];
$i = 0;
//safety check - dirname might return some unexpected results
while (is_dataroot_insecure()) {
$parrent = dirname($CFG->dataroot);
$i++;
if ($parrent == '/' or $parrent == '.' or preg_match('/^[a-z]:\\\\?$/i', $parrent) or $i > 100) {
$CFG->dataroot = '';
//can not find secure location for dataroot
break;
}
$CFG->dataroot = dirname($parrent) . '/moodledata';
}
$INSTALL['dataroot'] = $CFG->dataroot;
}
$headstagetext = array(WELCOME => get_string('chooselanguagehead', 'install'), COMPATIBILITY => get_string('compatibilitysettingshead', 'install'), DIRECTORY => get_string('directorysettingshead', 'install'), DATABASE => get_string('databasesettingshead', 'install'), ADMIN => get_string('admindirsettinghead', 'install'), ENVIRONMENT => get_string('environmenthead', 'install'), DOWNLOADLANG => get_string('downloadlanguagehead', 'install'), SAVE => get_string('configurationcompletehead', 'install'));
$substagetext = array(WELCOME => get_string('chooselanguagesub', 'install'), COMPATIBILITY => get_string('compatibilitysettingssub', 'install'), DIRECTORY => get_string('directorysettingssub', 'install'), DATABASE => get_string('databasesettingssub', 'install'), ADMIN => get_string('admindirsettingsub', 'install'), ENVIRONMENT => get_string('environmentsub', 'install'), DOWNLOADLANG => get_string('downloadlanguagesub', 'install'), SAVE => get_string('configurationcompletesub', 'install'));
//==========================================================================//
/// Are we in help mode?