Пример #1
0
});
//
//	URL:	/api/v1/people
//	Method: POST
//	Params:
//		Required: peopleid, newpeopleid
//	Returns: true / false on the updates being successful
//
$app->post('/people/:peopleid/transferdevicesto/:newpeopleid', function ($peopleid, $newpeopleid) use($app, $person) {
    $response['error'] = false;
    $response['errorcode'] = 200;
    // Verify the userids are real
    foreach (array('peopleid', 'newpeopleid') as $var) {
        $p = new People();
        $p->UserID = ${$var};
        if (!$p->GetPerson() && ($var != 'newpeopleid' && ${$var} == 0)) {
            $response['error'] = true;
            $response['message'] = "{$var} is not valid";
            continue;
        }
    }
    // If we error above don't attempt to make changes
    if (!$response['error']) {
        $dev = new Device();
        $dev->PrimaryContact = $peopleid;
        foreach ($dev->Search() as $d) {
            $d->PrimaryContact = $newpeopleid;
            if (!$d->UpdateDevice()) {
                // If we encounter an error stop immediately
                $response['error'] = true;
                $response['message'] = __("Device update has failed");
Пример #2
0
     $tooltip .= __($row["Label"]) . ": {$pan->PanelLabel}<br>\n";
     break;
 case "PanelVoltage":
     $pan = new PowerPanel();
     $pan->PanelID = $pdu->PanelID;
     $pan->GetPanel();
     $tooltip .= __($row["Label"]) . ": " . $pan->PanelVoltage . " / " . intval($pan->PanelVoltage / 1.73) . "<br>\n";
     break;
 case "PanelPole":
     $tooltip .= __($row["Label"]) . ": " . $pdu->GetAllBreakerPoles() . "<br>\n";
     break;
 case "PrimaryContact":
     $pc = new People();
     $pc->PersonID = $dev->PrimaryContact;
     if ($pc->PersonID > 0) {
         $pc->GetPerson();
         $tooltip .= __($row["Label"]) . ": " . $pc->LastName . ", " . $pc->FirstName . "<br>\n";
     } else {
         $tooltip .= __($row["Label"]) . ": " . __("Unassigned") . "<br>\n";
     }
     break;
 case "Weight":
     $dev->{$row}["Field"] = $dev->GetDeviceTotalWeight();
     goto end;
     // cringe now
 // cringe now
 case "NominalWatts":
     $dev->{$row}["Field"] = $dev->GetDeviceTotalPower();
     goto end;
     // f**k you, yeah I really did that
 // f**k you, yeah I really did that
Пример #3
0
             $outageStatus = __("Degraded");
         } elseif ($fsDiverse) {
             $outageStatus = __("Degraded/Fail-Safe");
         } else {
             $outageStatus = __("Normal");
         }
     }
 }
 if (!$skipNormal || $skipNormal && ($outageStatus == __("Down") || $outageStatus == __("Undocumented"))) {
     echo "<tr>\n";
     printf("<td>%s</td>\n", $cabRow->Location);
     printf("<td>%s</td>\n", $devRow->Label);
     printf("<td>%s</td>\n", $outageStatus);
     printf("<td>%s</td>\n", $devRow->Position);
     $tmpPerson->PersonID = $devRow->PrimaryContact;
     $tmpPerson->GetPerson();
     printf("<td>%s</td>\n", $tmpPerson->Email);
     $dept->DeptID = $devRow->Owner;
     $dept->GetDeptByID();
     printf("<td>%s</td>\n", $dept->Name);
     echo "</tr>\n";
 }
 if ($devRow->ChassisSlots > 0 || $devRow->RearChassisSlots > 0) {
     $kidList = $devRow->GetDeviceChildren();
     foreach ($kidList as $k) {
         $tmpPerson->PersonID = $devRow->PrimaryContact;
         $tmpPerson->GetPerson();
         echo "<tr>\n";
         printf("<td>%s</td>\n", $cabRow->Location);
         printf("<td>%s</td>\n", $k->Label);
         printf("<td>%s</td>\n", $outageStatus);
Пример #4
0
function buildESXtable($DeviceID)
{
    $ESX = new ESX();
    $ESX->DeviceID = $DeviceID;
    $vmList = $ESX->GetDeviceInventory();
    print "\n<div class=\"table border\"><div><div>" . __("VM Name") . "</div><div>" . __("Status") . "</div><div>" . __("Owner") . "</div><div>" . __("Primary Contact") . "</div><div>" . __("Last Updated") . "</div></div>\n";
    foreach ($vmList as $vmRow) {
        $onOff = preg_match('/off/i', $vmRow->vmState) ? 'off' : 'on';
        $Dept = new Department();
        $Dept->DeptID = $vmRow->Owner;
        if ($Dept->DeptID > 0) {
            $Dept->GetDeptByID();
        } else {
            $Dept->Name = __("Unknown");
        }
        if ($vmRow->PrimaryContact > 0) {
            $con = new People();
            $con->PersonID = $vmRow->PrimaryContact;
            $con->GetPerson();
            $PCName = $con->LastName . ", " . $con->FirstName;
        } else {
            $PCName = __("Unknown");
        }
        print "<div><div>{$vmRow->vmName}</div><div class=\"{$onOff}\">{$vmRow->vmState}</div><div><a href=\"updatevmowner.php?vmindex={$vmRow->VMIndex}\">{$Dept->Name}</a></div><div><a href=\"updatevmowner.php?vmindex={$vmRow->VMIndex}\">{$PCName}</a></div><div>{$vmRow->LastUpdated}</div></div>\n";
    }
    echo '</div> <!-- END div.table -->';
}
Пример #5
0
$dev = new Device();
$req = new RackRequest();
$contact = new People();
$tmpContact = new People();
$formfix = $error = '';
$contactList = $person->GetUserList();
//We only need to worry about sending email in the event this is a new submission and no other time.
if (isset($_POST["action"])) {
    if (isset($_REQUEST['requestid']) && $_REQUEST['requestid'] > 0) {
        $req->RequestID = $_REQUEST['requestid'];
        $req->GetRequest();
        $contact->PersonID = $req->RequestorID;
        $contact->GetPerson();
    }
    $tmpContact->PersonID = $_POST["requestorid"];
    $tmpContact->GetPerson();
    // If any port other than 25 is specified, assume encryption and authentication
    if ($config->ParameterArray['SMTPPort'] != 25) {
        $transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort'])->setEncryption('ssl')->setUsername($config->ParameterArray['SMTPUser'])->setPassword($config->ParameterArray['SMTPPassword']);
    } else {
        $transport = Swift_SmtpTransport::newInstance()->setHost($config->ParameterArray['SMTPServer'])->setPort($config->ParameterArray['SMTPPort']);
    }
    $mailer = Swift_Mailer::newInstance($transport);
    $message = Swift_Message::NewInstance()->setSubject($config->ParameterArray['MailSubject']);
    // Set from address
    try {
        $message->setFrom($config->ParameterArray['MailFromAddr']);
    } catch (Swift_RfcComplianceException $e) {
        $error .= __("MailFrom") . ": <span class=\"errmsg\">" . $e->getMessage() . "</span><br>\n";
    }
    // Add rack requestor to the list of recipients
Пример #6
0
 $pdf->SetFont($config->ParameterArray['PDFfont'], 'B', 16);
 $pdf->Cell(0, 15, __("Devices between {$start_year} and {$year} years old"), '', 1, 'C', 0);
 $pdf->SetFont($config->ParameterArray['PDFfont'], '', 10);
 $headerTags = array(__("Label"), __("Age"), __("Owner"), __("Primary Contact"));
 $cellWidths = array(45, 30, 50, 45);
 $maxval = count($headerTags);
 for ($col = 0; $col < $maxval; $col++) {
     $pdf->Cell($cellWidths[$col], 7, $headerTags[$col], 1, 0, 'C', 0);
 }
 $pdf->Ln();
 $fill = 1;
 foreach ($age_list[$year] as $devRow) {
     $dept->DeptID = $devRow->Owner;
     $dept->GetDeptByID();
     $con->PersonID = $devRow->PrimaryContact;
     $con->GetPerson();
     if ($devRow->MfgDate > "1970-01-01") {
         $date1 = new DateTime($devRow->MfgDate);
     } else {
         $date1 = new DateTime($devRow->InstallDate);
     }
     $date2 = new DateTime('now');
     $interval = $date1->diff($date2);
     $years = $interval->format('%y y %m m %d d');
     $cellHeight = 6;
     $pdf->Cell($cellWidths[0], $cellHeight, $devRow->Label, 1, 0, 'L', $fill);
     $pdf->Cell($cellWidths[1], $cellHeight, $years, 1, 0, 'L', $fill);
     $pdf->Cell($cellWidths[2], $cellHeight, $dept->Name, 1, 0, 'L', $fill);
     $pdf->Cell($cellWidths[3], $cellHeight, $con->FirstName . ' ' . $con->LastName, 1, 1, 'L', $fill);
     $fill = !$fill;
 }
Пример #7
0
<?php

require_once 'db.inc.php';
require_once 'facilities.inc.php';
$subversion = __("Data Center Contact Detail");
if (!$person->SiteAdmin) {
    header('Location: ' . redirect());
    exit;
}
$userRights = new People();
$status = "";
if (isset($_REQUEST['PersonID']) && strlen($_REQUEST['PersonID']) > 0) {
    $userRights->PersonID = $_REQUEST['PersonID'];
    $userRights->GetPerson();
}
if (isset($_POST['action']) && isset($_POST['UserID'])) {
    if (($_POST['action'] == 'Create' || $_POST['action'] == 'Update') && (isset($_POST['LastName']) && $_POST['LastName'] != null && $_POST['LastName'] != '')) {
        $userRights->UserID = $_POST['UserID'];
        $userRights->LastName = $_POST['LastName'];
        $userRights->FirstName = $_POST['FirstName'];
        $userRights->Phone1 = $_POST['Phone1'];
        $userRights->Phone2 = $_POST['Phone2'];
        $userRights->Phone3 = $_POST['Phone3'];
        $userRights->Email = $_POST['Email'];
        $userRights->AdminOwnDevices = isset($_POST['AdminOwnDevices']) ? 1 : 0;
        $userRights->ReadAccess = isset($_POST['ReadAccess']) ? 1 : 0;
        $userRights->WriteAccess = isset($_POST['WriteAccess']) ? 1 : 0;
        $userRights->DeleteAccess = isset($_POST['DeleteAccess']) ? 1 : 0;
        $userRights->ContactAdmin = isset($_POST['ContactAdmin']) ? 1 : 0;
        $userRights->RackRequest = isset($_POST['RackRequest']) ? 1 : 0;
        $userRights->RackAdmin = isset($_POST['RackAdmin']) ? 1 : 0;
Пример #8
0
require_once "db.inc.php";
require_once "facilities.inc.php";
if (!$person->ContactAdmin) {
    // No soup for you.
    header('Location: ' . redirect());
    exit;
}
// This page has no function without a valid dept id
if (!isset($_REQUEST['personid'])) {
    echo "How'd you get here without a referral?";
    exit;
}
$dept = new Department();
$person = new People();
$person->PersonID = isset($_POST['personid']) ? $_POST['personid'] : $_GET['personid'];
$person->GetPerson();
// Update if form was submitted and action is set
if (isset($_POST['action']) && $_POST['action'] == "Submit") {
    $grpMembers = $_POST['chosen'];
    $person->AssignDepartments($grpMembers);
}
$deptList = $person->GetDeptsByPerson();
$departmentList = $dept->GetDepartmentList();
$possibleList = array_obj_diff($departmentList, $deptList);
function array_obj_diff($array1, $array2)
{
    foreach ($array1 as $key => $value) {
        $array1[$key] = serialize($value);
    }
    foreach ($array2 as $key => $value) {
        $array2[$key] = serialize($value);