/** main entry point for update wizard (called from /program/main_admin.php)
 *
 * This routine takes care of executing update routines for both the core
 * program and modules, themes, etc. It is called automagically whenever
 * the core program version in the database is different from the version
 * in the file {@lnk version.php} (see also {@link main_admin()}).
 *
 * It can also be called manually via 'job=update'. When no specific
 * task is specified, this routine shows the overview of versions for
 * core, modules, themes, etc. Whenever a component is NOT up to date,
 * an [Update] button is displayed. If a component IS up to date, we
 * simply display the word 'OK'. This implies that when everything is up
 * to date, the overview simply displays a list of OK's and the user
 * is 'free to go'.
 *
 * The actual updates for modules, themes, etc. is done via the various
 * subsystems themselves, e.g. by calling htmlpage_upgrade() in the file
 * /program/modules/htmlpage/htmlpage_install.php. The updates for the
 * core program are actually performed from this file right here, see
 * {@link update_core_2010120800()} below for an example.
 *
 * Note that we give a core update high priority: if the core
 * is not up to date, nothing will work, except updating the core.
 *
 * @param object &$output collects the html output
 * @return void results are returned as output in $output
 */
function job_update(&$output)
{
    global $CFG, $WAS_SCRIPT_NAME, $USER;
    $output->set_helptopic('update');
    $task = get_parameter_string('task', TASK_UPDATE_OVERVIEW);
    if ($task == TASK_UPDATE_OVERVIEW) {
        update_show_overview($output);
    } elseif ($task == TASK_UPDATE_CORE) {
        update_core($output);
        update_show_overview($output);
    } elseif (intval($CFG->version) != intval(WAS_VERSION)) {
        $output->add_message(t('update_core_warnning_core_goes_first', 'admin'));
        update_show_overview($output);
    } else {
        $key = get_parameter_string('key', '');
        switch ($task) {
            case TASK_INSTALL_LANGUAGE:
                install_language($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_LANGUAGE:
                update_language($output, $key);
                update_show_overview($output);
                break;
            case TASK_INSTALL_MODULE:
                install_module($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_MODULE:
                update_module($output, $key);
                update_show_overview($output);
                break;
            case TASK_INSTALL_THEME:
                install_theme($output, $key);
                update_show_overview($output);
                break;
            case TASK_UPDATE_THEME:
                update_theme($output, $key);
                update_show_overview($output);
                break;
            default:
                $s = utf8_strlen($task) <= 50 ? $task : utf8_substr($task, 0, 44) . ' (...)';
                $message = t('task_unknown', 'admin', array('{TASK}' => htmlspecialchars($s)));
                $output->add_message($message);
                logger('tools: unknown task: ' . htmlspecialchars($s));
                update_show_overview($output);
                break;
        }
    }
}
Example #2
0
    }
}
// Path to this file
$self = "{$_SERVER['PHP_SELF']}?lang={$lang}";
if (isset($_POST['confirm'])) {
    // Make a backup
    unlink(".{$lang}.php.bak");
    rename("{$lang}.php", ".{$lang}.php.bak");
    rename(".{$lang}.php.work", "{$lang}.php");
    // Reload page, so that form data won't get posted again on refresh
    header("location: {$self}&begin={$begin}" . ($search ? "&search_for=" . urlencode($search) : "") . ($show_empty ? "&empty=" : ""));
    exit;
} else {
    if (isset($_POST['submit']) && isset($_POST['L'])) {
        // Save button was pressed
        update_language($lang, $_POST['L'], @$_POST['E']);
        // Reload page, so that form data won't get posted again on refresh
        header("location: {$self}&begin={$begin}" . ($search ? "&search_for=" . urlencode($search) : "") . ($show_empty ? "&empty=" : ""));
        exit;
    }
}
// One form for all buttons and inputs
echo "<form action=\"{$self}&begin={$begin}" . ($show_empty ? "&empty=" : "") . "\" method=\"post\">\n";
echo "<table cellspacing=0 cellpadding=1>\n<tr><td colspan=3>";
// Make page links
for ($p = 0; $p < $count; $p += $limit) {
    if ($p) {
        echo " | ";
    }
    $bgn = $p + 1;
    $end = min($p + $limit, $count);
Example #3
0
<?php

require_once 'include/common.php';
$op = empty($_GET['op']) ? 'default' : $_GET['op'];
AccessControl('5', null, false);
# null means no log, false means don't redirect
switch ($op) {
    case "updatelanguage":
        update_language();
        break;
    case "updateauthorization":
        update_authorization();
        break;
    case "updateauthentication":
        update_authentication();
        break;
    case "addldapserver":
        add_ldap_server();
        break;
    case "delete_ldap_server":
        delete_ldap_server();
        break;
    case "editldap":
        edit_ldap();
        break;
    case "editdomain":
        edit_domain();
        break;
    case "updateaccountexpire":
        update_accountexpire();
        break;