Your IP : 216.73.216.1


Current Path : /proc/thread-self/root/usr/local/ei/
Upload File :
Current File : //proc/thread-self/root/usr/local/ei/moodle.php

<?php
$cwd = getcwd();
if (!preg_match('|/home/www/(.+)|', $cwd, $regs))
        exit('Cwd error.');

$config = 'config.php';
if (!($content = file_get_contents($config))) {
        exit("Can't read $config\n");
}

$add = <<<EOF
\$CFG->disablelogintoken = true;
\$CFG->wwwrootendsinpublic = true;

EOF;

$searchString = 'require';
$position = strpos($content, $searchString);

if ($position !== false) {
        $before = substr($content, 0, $position);
        $after = substr($content, $position);

        $new = $before . $add . "\n" . $after;

        file_put_contents($config, $new);
} else {
        file_put_contents($config, $add, FILE_APPEND);
}

#moodle 5.2 temp fix, otherwise upload course file selection fails with err 500
system(<<<CMD
sed -i " s#if (function_exists('apache_child_terminate') && function_exists('memory_get_usage') && ini_get_bool('child_terminate')) {#if (0 \&\& function_exists('apache_child_terminate') \&\& function_exists('memory_get_usage') \&\& ini_get_bool('child_terminate')) {#g" public/lib/classes/shutdown_manager.php
CMD
);

@mkdir('/home/www/moodledata/' . $regs[1], 0777, true);