} else { 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';
$id_user = sha1(time() . $_POST['user_name'] . $pw); $secret = sha1(time() . rand(1, 50) . $_POST['admin_password'] . $_POST['user_name'] . $settings['salt2']['@attributes']['value']); $props = array(); $props['id_user'] = $id_user; $props['user_name'] = $_POST['user_name']; $props['email'] = $_POST['admin_email']; $props['pw'] = $pw; $props['secret'] = $secret; $props['lang'] = "undefined"; foreach ($_POST as $PK => $PV) { if ($PK != "Submit" && $PK != "btnSubmit" && $PK != "submit") { $PAGE->body = $PAGE->body . "<input type='hidden' name='" . str_replace("'", "", $PK) . "' value='" . str_replace("'", "", $PV) . "'/>"; } } //echo "creating user"; $new_user = new user_id_user(); $new_user->create($props); $PAGE->body = $PAGE->body . "<input type='hidden' name='id_user' value='" . $new_user->id_user . "'/>"; $props = array(); $props['user_name'] = $_POST['user_name']; $props['id_user'] = $id_user; $props['email'] = $_POST['admin_email']; $props['pw'] = $pw; $props['secret'] = $secret; $props['lang'] = "undefined"; $new_user = new user_user_name(); $new_user->create($props); $new_id = sha1(time() . rand(1, 20) . "Linux" . "nux"); $props = array(); $props['id'] = $new_id; $props['name'] = "Linux";
$update_user = new user_id_user(); $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) {
$props['id_constraint_type'] = $hfp_constraint['constraint_type']; $props['str_constraint_text'] = $hfp_constraint['constraint_text']; $new_hfp_vcs = new hfp_vcs(); $new_hfp_vcs->create($props); //usleep(10); } // end foreach } //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;
$REQUEST = ""; $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");