本文整理汇总了PHP中Util::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::log方法的具体用法?PHP Util::log怎么用?PHP Util::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::log方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateGitIgnore
public static function updateGitIgnore()
{
Util::log("Updating .gitignore file");
$handle = @fopen(".gitignore", "a");
fclose($handle);
$handle = @fopen(".gitignore", "r+");
if ($handle) {
$entries = array("robo", "build", "lib");
$entriesOk = array();
while (($buffer = fgets($handle, 1024)) !== false) {
foreach ($entries as $entry) {
if (strpos($buffer, "robo") !== false) {
$entriesOk[$entry] = true;
}
}
}
foreach ($entries as $entry) {
if (!isset($entriesOk[$entry])) {
Util::log("New Entry ::" . $entry);
fwrite($handle, "\n" . $entry);
}
}
if (!feof($handle)) {
Util::error("Error: unexpected fgets() fail");
}
fclose($handle);
}
}
示例2: __construct
/**
* @param string $message error message
* @param int $code error code
*/
public function __construct($message, $code = 0)
{
require_once dirname(__FILE__) . '/util.php';
$message .= ' in file ' . $this->getFile() . ' line: ' . $this->getLine();
Util::log('TException', $message . "\n\n" . $this->getTraceAsString());
$this->message = $code . ' : ' . $message;
return $code . ' : ' . $message;
}
示例3: registerOrder
/**
* Method used to add new order to the system
*
* @param string $clientName customer name; up to 96 alphanumeric characters
* @param string $clientEmail customer e-mail; up to 128 alphanumeric characters, must be a valid e-mail address
* @param string $clientPhone customer phone; up to 32 numeric characters
* @param float $amount field containing order amount, dot separated, e.g. 123.45
*
* @throws TException
*
* @return string
*/
public function registerOrder($clientName, $clientEmail, $clientPhone, $amount)
{
$title = $this->generateTitle();
$hash = sha1($clientName . $clientEmail . $clientPhone . $title . $amount . $this->apiHash);
$postData = array('api_login' => $this->apiLogin, 'api_password' => $this->apiPassword, 'cli_name' => $clientName, 'cli_email' => $clientEmail, 'cli_phone' => $clientPhone, 'order' => $title, 'amount' => $amount, 'hash' => $hash);
Validate::validateConfig(Validate::PAYMENT_TYPE_WHITE_LABEL, $postData);
Util::log('White label request data ', print_r($postData, true));
$res = $this->request('RegisterOrder', $postData);
$this->checkError($res);
Util::log('White label server resp', print_r($res, true));
if (strpos($res, '<result>correct</result>') !== -1) {
return $title;
} else {
throw new TException('Invalid server response');
}
}
示例4: directSale
/**
* Card direct sale. Handle request from card gate form in merchant site
* from method getDirectCardForm
* Validate transaction config and all input fields
*
* @param float $orderAmount amount of payment
* @param int $orderID order id
* @param string $orderDesc order description
* @param string $currency transaction currency
*
* @return bool|mixed
*
* @throws TException
*/
public function directSale($orderAmount, $orderID, $orderDesc, $currency = '985')
{
$cardData = Util::post('carddata', 'string');
$clientName = Util::post('client_name', 'string');
$clientEmail = Util::post('client_email', 'string');
$saveCard = Util::post('card_save', 'string');
Util::log('Card direct post params', print_r($_POST, true));
$oneTimeTransaction = $saveCard !== 'on';
$amount = number_format(str_replace(array(',', ' '), array('.', ''), $orderAmount), 2, '.', '');
$amount = (double) $amount;
$api = new CardAPI($this->apiKey, $this->apiPassword, $this->code, $this->hashAlg);
$tmpConfig = array('amount' => $amount, 'name' => $clientName, 'email' => $clientEmail, 'desc' => $orderDesc, 'order_id' => $orderID);
Validate::validateConfig(Validate::PAYMENT_TYPE_CARD_DIRECT, $tmpConfig);
$response = $api->directSale($clientName, $clientEmail, $orderDesc, $amount, $cardData, $currency, $orderID, $oneTimeTransaction);
Util::log('card direct sale response', print_r($response, true));
return $response;
}
示例5: strtolower
// duplication check
if (FileDB::check_duplicate($md5_id)) {
Util::log_and_die("Bad client upload request: duplicated file for " . $md5_id);
}
// type and size check
$type = strtolower(pathinfo($file["name"], PATHINFO_EXTENSION));
$size = $_FILES['file']['size'];
if ($size > MAXSIZE) {
Util::log_and_die("Bad client upload request: file exceed size limit(" . MAXSIZE . "kb)");
} elseif (!in_array($type, $allowed_types)) {
Util::log_and_die("Bad client upload request: unacceptable file format");
}
// build upload path
$upload_dir = "uploads/";
$ext = $type;
$upload_path = $upload_dir . $md5_id . "." . $ext;
// save the uploaded file to filesystem and add record to database
$success = move_uploaded_file($file["tmp_name"], $upload_path) && FileDB::insert_record($upload_path, $from, $md5_id, $title, $category, $desc);
if ($success) {
} else {
Util::log_and_die("Server error: upload failed");
}
FileDB::close();
Util::log_and_echo("Request processed: file uploaded successfully");
// send the new file to peer servers
$success = send_to_peers($upload_path, $md5_id, $title, $category, $desc);
if (!$success) {
Util::log("Response from peers: at least one peer didn't get the file");
}
Util::log("Response from peers: all peers received the file successfully!");
示例6: validateSign
/**
* Check md5 sum to confirm Transferuj response and value of payment amount
*
* @param string $sign sha1 checksum
* @param string $payId unique szkwal payment id
* @param string $notId unique szkwal notification id
* @param string $title payment title in agreed format
* @param string $crc additional client field
* @param float $amount amount of payment
*
* @throws TException
*/
public function validateSign($sign, $payId, $notId, $title, $crc, $amount)
{
Util::log('Szkwal sign check components', print_r(array('sign' => $sign, 'payId' => $payId, 'noti_id' => $notId, 'title' => $title, 'crc' => $crc, 'amount' => $amount, 'hash' => $this->apiHash), true));
$amount = number_format($amount, 2, '.', '');
if ($sign !== sha1($payId . $notId . $title . $crc . $amount . $this->apiHash)) {
throw new TException('invalid checksum');
}
}
示例7: registerSaleBase
/**
* Prepare for register sale @see $this->registerSale
*
* @param string $clientName client name
* @param string $clientEmail client email
* @param string $saleDescription sale description
* @param float $amount amount
* @param string $currency currency
* @param string|null $orderID order id
* @param bool $onetimer
* @param bool $direct
* @param string|null $saledata encrypted credit card data
* @param string $lang
*
* @return bool|mixed
*
* @throws TException
*/
private function registerSaleBase($clientName, $clientEmail, $saleDescription, $amount, $currency = '985', $orderID = null, $onetimer = true, $direct = false, $saledata = null, $lang = 'pl')
{
$amount = number_format(str_replace(array(',', ' '), array('.', ''), $amount), 2, '.', '');
if ($direct && !empty($saledata)) {
$params = array('method' => 'directsale', 'card' => $saledata, 'name' => $clientName, 'email' => $clientEmail, 'desc' => $saleDescription, 'amount' => $amount);
} else {
$params = array('method' => 'register_sale', 'name' => $clientName, 'email' => $clientEmail, 'desc' => $saleDescription, 'amount' => $amount);
}
if ($currency) {
$params['currency'] = $currency;
}
if ($orderID) {
$params['order_id'] = $orderID;
}
if ($onetimer) {
$params['onetimer'] = '1';
}
if ($lang) {
$params['language'] = $lang;
}
$params['sign'] = hash($this->hashAlg, implode('', $params) . $this->verificationCode);
$params['api_password'] = $this->apiPass;
Util::log('Card request', print_r($params, true));
$response = $this->postRequest($this->apiURL . $this->apiKey, $params);
return $response;
}
示例8:
<?php
// server name
$server_name = "sahil";
require_once "file_db.php";
require_once "utility.php";
require_once "file_server_lib.php";
// ======================================================================================================
// Main block begins
// ======================================================================================================
Util::log("Request received: client upload");
// extract picture information
$action = $_POST['action'];
$from = $_POST['from'];
$md5_id = $_POST['md5_id'];
$title = $_POST['title'];
$category = $_POST['category'];
$desc = $_POST['desc'];
if ($action != "update" && $action != "delete") {
Util::log_and_die("Bad Request: unknown action: " . $action);
}
// file id check
if (!$md5_id) {
Util::log_and_die("Bad Request: file's md5 id is missing");
}
// perform task depending on notification type
FileDB::init();
if ($action == "update") {
$success = FileDB::update_record($md5_id, $title, $category, $desc);
if (!$success) {
Util::log_and_die("Server error: file info update failed");
示例9: checkPayment
/**
* Check cURL request from Transferuj server after payment.
* This method check server ip, required fields and md5 checksum sent by payment server.
* Display information to prevent sending repeated notifications.
*
* @param string $paymentType optional payment type default is 'basic'
*
* @throws TException
*
* @return array
*/
public function checkPayment($paymentType = Validate::PAYMENT_TYPE_BASIC)
{
Util::log('check basic payment', '$_POST: ' . "\n" . print_r($_POST, true));
$res = Validate::getResponse($paymentType);
$checkMD5 = $this->checkMD5($res['md5sum'], $res['tr_id'], number_format($res['tr_amount'], 2, '.', ''), $res['tr_crc']);
Util::logLine('Check MD5: ' . (int) $checkMD5);
if ($this->validateServerIP === true && $this->checkServer() === false) {
throw new TException('Request is not from secure server');
}
if ($checkMD5 === false) {
throw new TException('MD5 checksum is invalid');
}
echo 'TRUE';
return $res;
}
示例10: array
// server name
$server_name = "sahil";
require_once "file_db.php";
require_once "utility.php";
require_once "file_server_lib.php";
// ======================================================================================================
// Configuration block begins
// ======================================================================================================
// limit upload file to image types
$allowed_types = array("jpg", "jpeg", "bmp", "gif", "png", "tiff");
// maxmum upload size
define("MAXSIZE", 4096 * 1000);
// ======================================================================================================
// Main block begins
// ======================================================================================================
Util::log("Request received: peer upload");
// extract picture information
$file = $_FILES['file'];
$from = $_POST['from'];
$md5_id = $_POST['md5_id'];
$title = $_POST['title'];
$category = $_POST['category'];
$desc = $_POST['desc'];
// check file data
if (!$file) {
Util::log_and_die("Bad peer upload request: no file data");
}
// check required field
if (!$file || !$from || !$md5_id || !$title) {
Util::log_and_die("Bad peer upload request: required fields are missing");
}
示例11: edit_profile
public function edit_profile($id)
{
$edit = \CODOF\User\User::get();
$id = (int) $id;
if (!$this->can_edit_profile($id)) {
$this->view = 'access_denied';
return false;
}
$values = array("name" => \CODOF\Filter::msg_safe($_POST['name']), "signature" => \CODOF\Format::omessage($_POST['signature']));
$success = true;
if (isset($_FILES) && $_FILES['avatar']['error'] != UPLOAD_ERR_NO_FILE) {
$success = false;
\CODOF\File\Upload::$width = 128;
\CODOF\File\Upload::$height = 128;
\CODOF\File\Upload::$resizeImage = true;
\CODOF\File\Upload::$resizeIconPath = DATA_PATH . PROFILE_ICON_PATH;
$result = \CODOF\File\Upload::do_upload($_FILES['avatar'], PROFILE_IMG_PATH);
if (\CODOF\File\Upload::$error) {
$this->smarty->assign('file_upload_error', $result);
} else {
$values["avatar"] = $result['name'];
$success = true;
}
}
$edited = $edit->set($values);
if (!$edited) {
Util::log("Failed to update user details profile/id/edit");
$success = false;
}
$this->smarty->assign('user_profile_edit', $success);
$this->profile($id, 'edit');
}
示例12: stop
static function stop()
{
self::$end_time = self::getCurrentTime();
self::$total_time = round(self::$end_time - self::$start_time, 3);
Util::log('TIMER : ' . self::$name . ' took ' . self::$total_time . ' seconds');
}