コード例 #1
0
 function Miscellaneous()
 {
     $this->MakeSafe();
     $tmpDCEventLog = new DCEventLog();
     $tmpDCEventLog->DataCenterID = $this->DataCenterID;
     class_exists('LogActions') ? LogActions::LogThis($this, $tmpDCEventLog) : '';
 }
コード例 #2
0
ファイル: install.php プロジェクト: Gusenichka/openDCIM
 function CreateDevice()
 {
     global $dbh;
     $this->MakeSafe();
     $this->Label = transform($this->Label);
     $this->SerialNo = transform($this->SerialNo);
     $this->AssetTag = transform($this->AssetTag);
     $sql = "INSERT INTO fac_Device SET Label=\"{$this->Label}\", SerialNo=\"{$this->SerialNo}\", AssetTag=\"{$this->AssetTag}\", \n\t\t\t\t\tPrimaryIP=\"{$this->PrimaryIP}\", SNMPCommunity=\"{$this->SNMPCommunity}\", ESX={$this->ESX}, Owner={$this->Owner}, \n\t\t\t\t\tEscalationTimeID={$this->EscalationTimeID}, EscalationID={$this->EscalationID}, PrimaryContact={$this->PrimaryContact}, \n\t\t\t\t\tCabinet={$this->Cabinet}, Position={$this->Position}, Height={$this->Height}, Ports={$this->Ports}, \n\t\t\t\t\tFirstPortNum={$this->FirstPortNum}, TemplateID={$this->TemplateID}, NominalWatts={$this->NominalWatts}, \n\t\t\t\t\tPowerSupplyCount={$this->PowerSupplyCount}, DeviceType=\"{$this->DeviceType}\", ChassisSlots={$this->ChassisSlots}, \n\t\t\t\t\tRearChassisSlots={$this->RearChassisSlots},ParentDevice={$this->ParentDevice}, \n\t\t\t\t\tMfgDate=\"" . date("Y-m-d", strtotime($this->MfgDate)) . "\", \n\t\t\t\t\tInstallDate=\"" . date("Y-m-d", strtotime($this->InstallDate)) . "\", WarrantyCo=\"{$this->WarrantyCo}\", \n\t\t\t\t\tWarrantyExpire=\"" . date("Y-m-d", strtotime($this->WarrantyExpire)) . "\", Notes=\"{$this->Notes}\", \n\t\t\t\t\tReservation={$this->Reservation}, HalfDepth={$this->HalfDepth}, BackSide={$this->BackSide};";
     if (!$dbh->exec($sql)) {
         $info = $dbh->errorInfo();
         error_log("PDO Error: {$info[2]} SQL={$sql}");
         return false;
     }
     $this->DeviceID = $dbh->lastInsertId();
     class_exists('LogActions') ? LogActions::LogThis($this) : '';
     return $this->DeviceID;
 }
コード例 #3
0
ファイル: assets.inc.php プロジェクト: ghasedak/openDCIM
 function RemoveFromTemplatesAndDevices()
 {
     global $dbh;
     $this->AttributeID = intval($this->AttributeID);
     $sql = "DELETE FROM fac_DeviceTemplateCustomValue WHERE AttributeID={$this->AttributeID};";
     if (!$dbh->query($sql)) {
         $info = $dbh->errorInfo();
         error_log("RemoveDeviceCustomAttribute::PDO Error: {$info[2]} SQL={$sql}");
         return false;
     }
     $sql = "DELETE FROM fac_DeviceCustomValue WHERE AttributeID={$this->AttributeID};";
     if (!$dbh->query($sql)) {
         $info = $dbh->errorInfo();
         error_log("RemoveDeviceCustomAttribute::PDO Error: {$info[2]} SQL={$sql}");
         return false;
     }
     class_exists('LogActions') ? LogActions::LogThis($this) : '';
     return true;
 }
コード例 #4
0
ファイル: power.inc.php プロジェクト: ghasedak/openDCIM
 function MakeConnection()
 {
     global $dbh;
     $this->MakeSafe();
     $sql = "INSERT INTO fac_PanelSchedule SET PanelID={$this->PanelID}, \n\t\t\tPolePosition={$this->PolePosition}, NumPoles={$this->NumPoles}, \n\t\t\tLabel=\"{$this->Label}\" ON DUPLICATE KEY UPDATE Label=\"{$this->Label}\", \n\t\t\tNumPoles={$this->NumPoles};";
     class_exists('LogActions') ? LogActions::LogThis($this) : '';
     return $dbh->query($sql);
 }
コード例 #5
0
ファイル: devices.php プロジェクト: spezialist1/openDCIM
if (isset($_POST['audit'])) {
    $dev->DeviceID = $_POST['audit'];
    $dev->Audit();
    $dev->AuditStamp = date('r', strtotime($dev->AuditStamp));
    header('Content-Type: application/json');
    echo json_encode($dev);
    exit;
}
if (isset($_POST['olog'])) {
    $dev->DeviceID = $_POST['devid'];
    $dev->GetDevice();
    $dev->OMessage = sanitize($_POST['olog']);
    $tmpDev = new Device();
    $tmpDev->DeviceID = $dev->DeviceID;
    $tmpDev->GetDevice();
    $return = class_exists('LogActions') && $tmpDev->Rights == "Write" ? LogActions::LogThis($dev, $tmpDev) : false;
    header('Content-Type: application/json');
    echo json_encode($return);
    exit;
}
// Set all ports to the same Label pattern, media type or color code
if (isset($_POST['setall'])) {
    $portnames = array();
    if (isset($_POST['spn']) && strlen($_POST['spn']) > 0) {
        // Special Condition to load ports from the device template and use those names
        if ($_POST['spn'] == __("From Template") || $_POST['spn'] == __("Invert Port Labels")) {
            $dev->DeviceID = $_POST['devid'];
            $dev->GetDevice();
            if ($_POST['spn'] == __("From Template")) {
                $ports = isset($_POST['power']) ? new TemplatePowerPorts() : new TemplatePorts();
                $ports->TemplateID = $dev->TemplateID;
コード例 #6
0
ファイル: customers.inc.php プロジェクト: mnibbelink/openDCIM
 function UpdatePeriod()
 {
     $this->MakeSafe();
     $oldperiod = new EscalationTimes();
     $oldperiod->EscalationTimeID = $this->EscalationTimeID;
     $oldperiod->GetEscalationTime();
     $sql = "UPDATE fac_EscalationTimes SET TimePeriod=\"{$this->TimePeriod}\" WHERE \n\t\t\tEscalationTimeID={$this->EscalationTimeID};";
     class_exists('LogActions') ? LogActions::LogThis($this, $oldperiod) : '';
     return $this->query($sql);
 }
コード例 #7
0
 function removePort()
 {
     /*	Remove a single port from a template */
     global $dbh;
     if (!$this->getport()) {
         return false;
     }
     $sql = "DELETE FROM fac_TemplatePowerPorts WHERE TemplateID={$this->TemplateID} AND PortNumber={$this->PortNumber};";
     if (!$dbh->query($sql)) {
         //delete failed, wtf
         return false;
     } else {
         class_exists('LogActions') ? LogActions::LogThis($this) : '';
         return true;
     }
 }
コード例 #8
0
 function UpdateUser()
 {
     global $dbh;
     $this->MakeSafe();
     $olduser = new User();
     $olduser->UserID = $this->UserID;
     $olduser->GetUserRights();
     /* Update a user record based upon the current object attribute values, with UserID as key. */
     $sql = "UPDATE fac_User SET Name=\"{$this->Name}\", ReadAccess={$this->ReadAccess}, \n\t\t\tAdminOwnDevices={$this->AdminOwnDevices}, WriteAccess={$this->WriteAccess}, \n\t\t\tDeleteAccess={$this->DeleteAccess}, ContactAdmin={$this->ContactAdmin}, \n\t\t\tRackRequest={$this->RackRequest}, RackAdmin={$this->RackAdmin}, \n\t\t\tSiteAdmin={$this->SiteAdmin}, Disabled={$this->Disabled} \n\t\t\tWHERE UserID=\"{$this->UserID}\";";
     $this->MakeDisplay();
     class_exists('LogActions') ? LogActions::LogThis($this, $olduser) : '';
     return $dbh->exec($sql);
 }