コード例 #1
0
 /**
  * fill a xml element with atrributes from a disk device
  *
  * @param SimpleXmlExtended $mount Xml-Element
  * @param DiskDevice        $dev   DiskDevice
  * @param Integer           $i     counter
  *
  * @return Void
  */
 private function _fillDevice($mount, $dev, $i)
 {
     $mount->addAttribute('MountPointID', $i);
     $mount->addAttribute('FSType', $dev->getFsType());
     $mount->addAttribute('Name', $dev->getName());
     $mount->addAttribute('Free', sprintf("%.0f", $dev->getFree()));
     $mount->addAttribute('Used', sprintf("%.0f", $dev->getUsed()));
     $mount->addAttribute('Total', sprintf("%.0f", $dev->getTotal()));
     $mount->addAttribute('Percent', $dev->getPercentUsed());
     if (PSI_SHOW_MOUNT_OPTION === true) {
         if ($dev->getOptions() !== null) {
             $mount->addAttribute('MountOptions', $dev->getOptions());
         }
     }
     if ($dev->getPercentInodesUsed() !== null) {
         $mount->addAttribute('Inodes', $dev->getPercentInodesUsed());
     }
     if (PSI_SHOW_MOUNT_POINT === true) {
         $mount->addAttribute('MountPoint', $dev->getMountPoint());
     }
 }
コード例 #2
0
ファイル: Db.php プロジェクト: ratepay/oscommerce-module
 /**
  * This method save's all necessary request and response informations in the database
  *
  * @param order $order
  * @param SimpleXmlExtended $request
  * @param string $orderId
  * @param SimpleXMLElement $response
  */
 public static function xmlLog($order, $request, $orderId = 'N/A', $response = null)
 {
     require_once dirname(__FILE__) . '/../../../languages/' . Session::getLang() . '/modules/payment/' . $order->info['payment_method'] . '.php';
     $payment = Loader::getRatepayPayment($order->info['payment_method']);
     if ($payment->logging) {
         $transactionId = 'N/A';
         $subType = 'N/A';
         if ($request->head->{'transaction-id'}) {
             $transactionId = (string) $request->head->{'transaction-id'};
         }
         if ($request->head->operation->attributes()->subtype) {
             $subType = (string) $request->head->operation->attributes()->subtype;
         }
         $operation = (string) $request->head->operation;
         $responseXml = 'N/A';
         if (!empty($response)) {
             $responseXml = $response->asXML();
             $result = (string) $response->head->processing->result;
             $resultCode = (string) $response->head->processing->result->attributes()->code;
             $reasonText = (string) $response->head->processing->reason;
             if ($response->head->{'transaction-id'}) {
                 $transactionId = (string) $response->head->{'transaction-id'};
             }
         } else {
             $result = "Service unavaible.";
             $resultCode = "Service unavaible.";
         }
         $sql = "INSERT INTO ratepay_log " . "(" . "order_number, " . "transaction_id, " . "payment_method, " . "payment_type,  " . "payment_subtype, " . "result, " . "request, " . "response, " . "result_code, " . "reason" . ") " . "VALUES ('" . tep_db_input($orderId) . "', '" . tep_db_input($transactionId) . "', '" . tep_db_input($payment->title) . "', '" . tep_db_input($operation) . "', '" . tep_db_input($subType) . "', '" . tep_db_input($result) . "','" . tep_db_input($request->asXML()) . "','" . tep_db_input($responseXml) . "','" . tep_db_input($resultCode) . "','" . tep_db_input($reasonText) . "')";
         tep_db_query($sql);
         if ($operation == "PAYMENT_CONFIRM" && $transactionId != 'N/A') {
             $sql = "UPDATE ratepay_log SET order_number = '" . tep_db_input($orderId) . "' WHERE transaction_id = '" . tep_db_input($transactionId) . "';";
             tep_db_query($sql);
         }
     }
 }