Exemple #1
0
 if (isset($_POST['uid']) && isset($_POST['secret'])) {
     // UID + Secret
     $u = new user_id_user();
     $u->get_from_hashrange($_POST['uid']);
     if ($u->user_name != "undefined") {
         if ($u->secret != $_POST['secret']) {
             $u = false;
         }
     } else {
         $u = false;
     }
 } else {
     if (isset($_GET['uid']) && isset($_GET['secret'])) {
         // UID + Secret
         $u = new user_id_user();
         $u->get_from_hashrange($_GET['uid']);
         if ($u->user_name != "undefined") {
             if ($u->secret != $_GET['secret']) {
                 $u = false;
             }
         } else {
             $u = false;
         }
     } else {
         if (false) {
             // LDAP PLACEHOLDER - NEED TO TEST
             $u = false;
             /*
             
             $ldapconfig['host'] = 'localhost';
             $ldapconfig['port'] = NULL;
            $update_user->get_from_hashrange($u->id_user);
            if ($update_user->id_user != "undefined") {
                $props = array();
                $props['lang'] = $u->lang;
                $update_user->update($props);
            }
        }
    }
}
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'generate-new-secret-key') {
        $props = array();
        $props['secret'] = sha1(time() . rand(1, 20) . $u->user_name);
        $u->update($props);
        $existing_user_by_id = new user_id_user();
        $existing_user_by_id->get_from_hashrange($u->id_user);
        if ($existing_user_by_id->id_user != "undefined") {
            $existing_user_by_id->update($props);
        }
    }
}
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'hf-edit-system-kind') {
        $refresh_assignments = false;
        if (isset($_POST['btnSubmit'])) {
            // add new hf system kinds
            $hfsk = new hf_system_kind();
            $all_hf_sk = $hfsk->get_from_hashrange($qn);
            if (isset($_POST['system_kind'])) {
                foreach ($_POST['system_kind'] as $psk) {
                    $found_existing_hsk = FALSE;
        //usleep(10);
    }
    // end foreach
    usleep(10);
    return $retval;
}
// end function
$new_user = new user_id_user();
if (!isset($_POST['id_user'])) {
    echo "ERROR: NO POST DATA";
    echo "<pre>";
    print_r($_POST);
    exit;
}
while (trim($new_user->id_user) == "undefined") {
    $new_user->get_from_hashrange($_POST['id_user']);
    //echo "ERROR: NO USER";
    //echo "<pre>";
    //print_r($new_user);
    sleep(3);
}
$u = $new_user;
global $u;
$u->build(array("obj_hfs", "obj_servers"));
// use $first_step_of_library_installation as the start
$library_step = $first_step_of_library_installation;
// this one is 14
// $id_user,$hf_name,$hf_expression,$inheritable,$sys_kinds,$resources,$hf_parameters,$inherit_from="")
if ($_GET['page'] == $library_step + 0) {
    // default wget
    $_POST['default_wget'] = add_library_hf(array('id_user' => $u->id_user, 'hf_name' => "default wget", 'hf_expression' => "(.*)", 'inheritable' => true, 'sys_kinds' => array('Windows', 'Linux', 'Mac', 'FreeBSD', 'Cygwin', 'Solaris'), 'resources' => array(array('filename' => 'run.bat', 'content' => 'if exist "[SERVERBINS]\\wget\\wget.exe" "[SERVERBINS]\\wget\\wget.exe" -d -O output.txt -U "[wget_user_agent]" --timeout=[wget_timeout] --tries=[wget_tries] --no-check-certificate "[wget_url]" 1>>error.txt 2>&1
Exemple #4
0
 $REMOTE_JOB_TYPE = "";
 $id_user = "";
 $secret = "";
 // LOOP THROUGH ALL AUTHS
 for ($a = 0; $a < count($auth['auth']); $a++) {
     if ($auth['auth'][$a] == false) {
         logger("Unable to read auth\n");
         sleep(10);
         continue;
     }
     $AUTH = $auth['auth'][$a];
     $id_user = $AUTH['@attributes']['uid'];
     $secret = $AUTH['@attributes']['secret'];
     // READ USER CREDENTIALS PROVIDED & CONFIRM MATCH
     $check_user = new user_id_user();
     $check_user->get_from_hashrange($id_user);
     if ($check_user->secret == 'undefined') {
         logger("UNABLE TO MATCH SECRET FOR USER " . $id_user . ".\n");
         //$auth['auth'][$a]=false;
         sleep(10);
         $auth = xmlToArray(simplexml_load_file($auth_file));
         if (!isset($auth['auth'][0])) {
             $auth['auth'][0] = $auth['auth'];
             unset($auth['auth']['@attributes']);
         }
         continue;
     }
     if ($check_user->secret != $secret) {
         logger($check_user->secret . " =? " . $secret);
         logger("AUTH.XML ENTRY FAILED FOR USER NAME:" . $check_user->user_name . "\n");
         //$auth['auth'][$a]=false;