Example #1
0
File: tms.php Project: norico/tms3
function do_action($action, $server, $dedi_cfg, $config)
{
    switch ($action) {
        case 'start':
            do_start($server, $dedi_cfg, $config);
            break;
        case 'stop':
            do_stop($server, $dedi_cfg, $config);
            break;
        case 'restart':
            do_restart($server, $dedi_cfg, $config);
            break;
        case 'status':
            check_status($server, $dedi_cfg, $config);
            break;
        case 'show':
            show_config($server, $dedi_cfg, $config);
            break;
    }
}
$authenticated_user_netid = check_authentication();
auth_site_to_user(id_of('master_admin'), $authenticated_user_netid);
$user_id = get_user_id($authenticated_user_netid);
if (!reason_user_has_privs($user_id, 'db_maintenance')) {
    die('<html><head><title>Reason: Delete Duplicate Relationships</title></head><body><h1>Sorry.</h1><p>You do not have permission to delete duplicate relationships.</p><p>Only Reason users who have database maintenance privileges may do that.</p></body></html>');
}
if (!isset($_GET['fields_referencing'])) {
    $_GET['fields_referencing'] = 'local';
}
if (!isset($_GET['allow_new_from'])) {
    $_GET['allow_new_from'] = 'core';
}
if (!isset($_GET['limit_to_field'])) {
    $_GET['limit_to_field'] = '';
}
show_config($fields);
echo '<h1>"Type" Type File Reference Manager</h1>';
echo '<p>This script examines the types in your reason instance, and discovers references to files on the "local" and/or "core" side of the ';
echo ' file system split. The script allows you to easily change these references, or resolve references to missing files. By default, missing ';
echo ' files and references to "local" files are displayed, and "core" files are shown as available options for new values.</p>';
// we loop through POST and make sure it contains requested changes to type entities and that those are limited to changeable fields.
// once we do this, we actually make the changes.
if (!empty($_POST)) {
    unset($_POST['process']);
    $count = 0;
    foreach ($_POST as $k => $v) {
        $change_values = array();
        // each $k should be an integer that corresponds to a type entity. If not, ignore it.
        if (is_int($k)) {
            $e = new entity($k);
            if (reason_is_entity($e, 'type')) {