本文整理汇总了PHP中Logger::i方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::i方法的具体用法?PHP Logger::i怎么用?PHP Logger::i使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::i方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPayments
public function getPayments()
{
$payments = DbManager::i()->select("sf_purchases", array("token", "payerid", "type", "cart", "date", "amount", "pending"), array("userid" => intval($_SESSION['userid'])));
if ($payments !== false) {
$purchases = array();
$pending = array();
if (!is_array($payments)) {
$payments = array($payments);
}
foreach ($payments as $payment) {
$payment->type = base64_decode($payment->type);
$payment->payerid = base64_decode($payment->payerid);
$payment->cart = (array) json_decode(base64_decode(base64_decode($payment->cart)));
if ($payment->pending == 1) {
array_push($pending, $payment);
} else {
array_push($purchases, $payment);
}
}
$ret = json_encode(array("payments" => $purchases, "pending" => $pending));
unset($purchases);
unset($pending);
unset($payments);
return $ret;
}
Logger::i()->writeLog("Could not get payments, error = " . DbManager::i()->error, 'dev');
return null;
}
示例2: deleteCustomer
function deleteCustomer($c)
{
$delete = DbManager::i()->delete("sf_members", array("userid" => intval($c)));
if (!$delete) {
Logger::i()->writeLog("Deleting customer {$c} failed, error = " . DbManager::i()->error, 'dev');
return Submission::createResult("Could not delete customer");
}
return Submission::createResult("Customer deleted", true);
}
示例3: checkoutWithBTC
function checkoutWithBTC($total, $cart)
{
$response = null;
try {
$btc = new BTC();
$response = $btc->doPayment($total);
} catch (Exception $e) {
Logger::i()->writeLog("Caught Exception: " . $e->getMessage(), 'dev');
die;
}
Logger::i()->writeLog("Start Bitcoin Checkout with address = " . $response['btcaddress']);
return $response;
}
示例4: ReCaptcha
$reCaptcha = new ReCaptcha(Settings::i()->captcha_private);
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $registration['captcha_response']);
if (!$resp->success) {
die(Submission::createResult("Please validate the Captcha"));
}
}
$u = $registration['username'];
$iv = Crypto::GenerateIV();
$key = Crypto::GenerateKey($u);
$username = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $u)));
$find = DbManager::i()->select("sf_members", array("userid"), array("key" => base64_encode(base64_encode($key))));
if ($find && count($find) > 0) {
die(Submission::createResult("Username is already taken"));
}
$pw = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $registration['password'])));
$email = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $registration['email'])));
$ip = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $_SERVER['REMOTE_ADDR'])));
$key = base64_encode(base64_encode($key));
$iv = base64_encode(base64_encode($iv));
$reg_date = date("Y-m-d");
$insert = DbManager::i()->insert("sf_members", array("username", "email", "password", "key", "iv", "register_date", "ip"), array($username, $email, $pw, $key, $iv, $reg_date, $ip));
if ($insert) {
Logger::i()->writeLog("Account created with username: {$u}");
die(Submission::createResult("Your account has been created successfully", true));
} else {
Logger::i()->writeLog("Could not register user, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Could not register account. Please try again later"));
}
} else {
die(Submission::createResult("Please fill in all information"));
}
示例5: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__) . "/..");
require_once ROOT_DIR . '/class.logger.php';
//requires class.dbmanager
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
if (!SessionManager::i()->isAdminLoggedIn()) {
Logger::i()->writeLog("Admin is not logged in", 'dev');
die(Submission::createResult("Permission denied"));
}
if (!SessionManager::i()->validateToken("LoadLogsToken", "csrf", "GET")) {
Logger::i()->writeLog("Token to load logs is missing", 'dev');
die(Submission::createResult("Permission denied"));
}
$all_logs = Logger::i()->getLogs();
$dev_logs = array();
$access_logs = array();
foreach ($all_logs as $log) {
if ($log->mode == "dev") {
array_push($dev_logs, $log);
} else {
if ($log->mode == "access") {
array_push($access_logs, $log);
}
}
}
echo json_encode(array("all_logs" => $all_logs, "dev_logs" => $dev_logs, "access_logs" => $access_logs));
示例6: die
}
echo Submission::createResult("Missing Shopping Cart");
} else {
if ($request_method == "POST") {
if (!SessionManager::i()->validateToken("CartToken", "token")) {
Logger::i()->writeLog("Token to set cart is missing", 'dev');
die(Submission::createResult("Permission denied"));
}
if (isset($_POST['cart'])) {
$_SESSION['shopping-cart'] = $_POST['cart'];
if (SessionManager::i()->isLoggedIn()) {
$find = DbManager::i()->select("sf_carts", array("cart"), array("userid" => intval($_SESSION['userid'])));
if ($find !== false && !is_array($find)) {
//cart already exists for user
$update = DbManager::i()->update("sf_carts", array("cart" => $_SESSION['shopping-cart']), array("userid" => intval($_SESSION['userid'])));
if (!$update) {
Logger::i()->writeLog("Updating cart failed, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Failed to update cart"));
}
} else {
$insert = DbManager::i()->insert("sf_carts", array("cart", "userid"), array($_SESSION['shopping-cart'], intval($_SESSION['userid'])));
if ($insert) {
Logger::i()->writeLog("Inserting cart failed, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Failed to insert cart"));
}
}
unset($find);
}
}
}
}
示例7: die
require_once ROOT_DIR . '/class.dbmanager.php';
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
if (!SessionManager::i()->isAdminLoggedIn()) {
Logger::i()->writeLog("Tried to access this script without permissions. Was that you?", 'access');
die(Submission::createResult("Permission denied"));
}
if (!SessionManager::i()->validateToken("GetCustomersToken", "token")) {
Logger::i()->writeLog("Token to access customers is missing", 'access');
die(Submission::createResult("Token mismatch"));
}
header("Content-Type: application/json; charset=UTF-8");
$customers = DbManager::i()->select("sf_members", array("userid", "username", "email", "register_date", "ip", "key", "iv"));
if ($customers !== false) {
$members = array();
if (!is_array($customers)) {
$customers = array($customers);
}
foreach ($customers as $customer) {
$key = base64_decode(base64_decode($customer->key));
$iv = base64_decode(base64_decode($customer->iv));
array_push($members, array("customerid" => $customer->userid, "name" => Crypto::DecryptString($key, $iv, base64_decode(base64_decode($customer->username))), "email" => Crypto::DecryptString($key, $iv, base64_decode(base64_decode($customer->email))), "date" => strtotime($customer->register_date) * 1000, "ip" => Crypto::DecryptString($key, $iv, base64_decode(base64_decode($customer->ip)))));
}
echo json_encode(array("customers" => $members));
unset($members);
unset($customers);
} else {
Logger::i()->writeLog("Could not get customers, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Could not load customers"));
}
示例8: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__));
require_once ROOT_DIR . '/class.logger.php';
if (isset($_GET['token'])) {
Logger::i()->writeLog("Payment cancelled with token = " . $_GET['token'], 'payment');
} else {
Logger::i()->writeLog("Payment cancelled with no token", 'payment');
}
header("Location: index.php");
示例9: base64_encode
$payerid = base64_encode(DbManager::i()->escapeString($_GET['PayerID']));
$cart = DbManager::i()->escapeString($_SESSION['shopping-cart']);
$amount = floatval($response['PAYMENTINFO_0_AMT']);
DbManager::i()->insert("sf_purchases", array("token", "payerid", "type", "userid", "cart", "date", "ip", "amount", "pending"), array(base64_encode($response['PAYMENTINFO_0_TRANSACTIONID']), $payerid, base64_encode("PayPal"), $userid, $cart, time(), base64_encode($_SERVER['REMOTE_ADDR']), $amount, 0));
$_SESSION['shopping-cart'] = base64_encode("{}");
DbManager::i()->update("sf_carts", array("cart" => $_SESSION['shopping-cart']), array("userid" => $userid));
$find = DbManager::i()->select("sf_members", array("email", "key", "iv"), array("userid" => $_SESSION['userid']));
if ($find !== false && !is_array($find)) {
$recipient = Crypto::DecryptString(base64_decode(base64_decode($find->key)), base64_decode(base64_decode($find->iv)), base64_decode(base64_decode($find->email)));
$subject = Settings::i()->title . ' Payment received';
$message = generateMessage($first_name, (array) json_decode(base64_decode($cart)), $response['PAYMENTINFO_0_TRANSACTIONID']);
$header = 'From: shopfix@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Reply-To: shopfix@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail($recipient, $subject, $message, $header);
Logger::i()->writeLog("PayPal Transaction registered: " . $response['PAYMENTINFO_0_TRANSACTIONID']);
}
header("Location: index.php");
die;
} else {
header("Location: index.php");
}
} else {
header("Location: index.php");
die;
}
} else {
Logger::i()->writeLog("Could not do express checkout, error = " . $paypal->error, 'dev');
}
} else {
header("Location: index.php");
die;
}
示例10: die
if ($field = Submission::checkFields(array("title"), (array) $settings['cms_settings'])) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
} else {
die(Submission::createResult("Invalid Settings"));
}
}
}
$settings = base64_encode(base64_encode(Crypto::EncryptString(base64_decode(base64_decode(ADMIN_KEY)), base64_decode(base64_decode(ADMIN_IV)), $_POST['settings'])));
$find = DbManager::i()->select("sf_settings", array("settings"));
if ($find !== false && !is_array($find)) {
//settings already exists
$update = DbManager::i()->update("sf_settings", array("settings" => $settings));
if (!$update) {
Logger::i()->writeLog("Could not update settings, error = " . DbManager::i()->error, 'dev');
die;
}
} else {
$insert = DbManager::i()->insert("sf_settings", array("settings"), array($settings));
if (!$insert) {
Logger::i()->writeLog("Could not insert settings, error = " . DbManager::i()->error, 'dev');
die;
}
}
Logger::i()->writeLog("Settings updated");
unset($find);
unset($settings);
die(Submission::createResult("Settings updated successfully", true));
}
}
}
示例11: die
if (!SessionManager::i()->validateToken("LoginToken", "token")) {
Logger::i()->writeLog("Token to login is invalid", 'access');
die(Submission::createResult("Please refresh the page and try again"));
}
if (isset($_POST['login'])) {
$login = (array) json_decode(base64_decode($_POST['login']));
if ($field = Submission::checkFields(array("username", "password", "answer"), $login)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
if (Settings::i()->captcha_private) {
if (!isset($login['captcha_response'])) {
die(Submission::createResult("Please validate the captcha"));
}
$reCaptcha = new ReCaptcha(Settings::i()->captcha_private);
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $login['captcha_response']);
if (!$resp->success) {
die(Submission::createResult("Please validate the Captcha"));
}
}
if ($login['username'] == ADMIN_USER && $login['password'] == ADMIN_PW && $login['answer'] == ADMIN_ANSWER) {
$_SESSION['admin_login'] = 1;
$_SESSION['admin_answer'] = ADMIN_ANSWER;
Logger::i()->writeLog("Login successful");
die(Submission::createResult("Admin Login successful", true));
} else {
Logger::i()->writeLog("Username: " . $login['username'] . " or Password: " . $login['password'] . " are invalid");
die(Submission::createResult("Username or Password are incorrect"));
}
} else {
die(Submission::createResult("Please fill in all information"));
}
示例12: foreach
foreach ($payment->cart as $key => $value) {
if ($key == $_GET['productid']) {
$has_purchased = true;
break;
}
}
if ($has_purchased) {
//purchased
$find = DbManager::i()->select("sf_products", array("file"), array("productid" => intval($_GET['productid'])));
if ($find !== false && !is_array($find)) {
$file_path = $_SERVER['DOCUMENT_ROOT'] . $find->file;
if (file_exists($file_path)) {
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=\"" . str_replace(" ", "_", basename($file_path)) . "\"");
echo file_get_contents($file_path);
Logger::i()->writeLog("User " . $_SESSION['userid'] . " downloaded " . basename($file_path));
} else {
Logger::i()->writeLog("Failed to download file " . basename($file_path) . " - it does not exist", 'dev');
header("Location: index.php");
}
}
} else {
Logger::i()->writeLog("User " . $_SESSION['userid'] . " has not purchased the product he/she is trying to download");
header("Location: index.php");
die;
}
} else {
Logger::i()->writeLog("Could not get purchase for transaction_id = " . $_GET['transaction_id'] . ", error = " . DbManager::i()->error, 'dev');
header("Location: index.php");
die;
}
示例13: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__) . "/..");
require ROOT_DIR . '/class.logger.php';
require ROOT_DIR . '/class.sessionmanager.php';
if (isset($_GET['csrf'])) {
$_GET['csrf'] = str_replace(" ", "+", $_GET["csrf"]);
}
if (SessionManager::i()->isAdminLoggedIn() && (!isset($_GET["csrf"]) || !isset($_SESSION['LogoutToken']))) {
header("Location: admincp.php");
Logger::i()->writeLog("Tried to logout but failed. Either not logged in or tokens are missing", 'dev');
} else {
if (SessionManager::i()->validateToken("LogoutToken", "csrf", "GET")) {
Logger::i()->writeLog("Tried to logout but failed. GET Token = " . $_GET['csrf'] . ", Session Token = " . $_SESSION['LogoutToken'], 'dev');
SessionManager::i()->destroySession(true, "index.php");
} else {
header("Location: admincp.php");
}
}
示例14: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__));
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
if (!SessionManager::i()->validateToken("LoadProductsToken", "token")) {
Logger::i()->writeLog("Token to load products is missing", 'dev');
die(Submission::createResult("Permission denied"));
}
header("Content-Type: application/json; charset=UTF-8");
$products = DbManager::i()->select("sf_products", array("productid", "name", "price", "description", "available", "image", "bigimage", "soldOut"));
if ($products !== false) {
$prods = array();
if (!is_array($products)) {
$products = array($products);
}
foreach ($products as $product) {
array_push($prods, array("productid" => $product->productid, "name" => $product->name, "price" => $product->price, "description" => $product->description, "available" => intval($product->available), "image" => $product->image, "bigimage" => $product->bigimage, "soldOut" => intval($product->soldOut)));
}
echo json_encode(array("products" => $prods));
unset($prods);
unset($products);
} else {
Logger::i()->writeLog("Could not get products, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Could not get products"));
}
示例15: unset
echo Submission::createResult("Password updated successfully", true);
} else {
Logger::i()->writeLog("User password could not be updated, error = " . DbManager::i()->error);
echo Submission::createResult("Could not update password. Please try again later.");
}
unset($pw);
} else {
if (isset($_POST['email'])) {
$email = base64_decode($_POST['email']);
$email = base64_encode(base64_encode(Crypto::EncryptString(base64_decode(base64_decode($userinfo->key)), base64_decode(base64_decode($userinfo->iv)), $email)));
$update = DbManager::i()->update("sf_members", array("email" => $email), array("userid" => $userid));
if ($update) {
Logger::i()->writeLog("User Email updated, UserID = {$userid}");
echo Submission::createResult("Email updated successfully", true);
} else {
Logger::i()->writeLog("User Email could not be updated, reason = " . DbManager::i()->error);
echo Submission::createResult("Could not update email. Please try again later.");
}
unset($email);
} else {
echo Submission::createResult("Invalid POST Parameter");
}
}
unset($userinfo);
} else {
die(Submission::createResult("Could not find user"));
}
} else {
die(Submission::createResult("Invalid request method"));
}
}