当前位置: 首页>>代码示例>>PHP>>正文


PHP Submission::createResult方法代码示例

本文整理汇总了PHP中Submission::createResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::createResult方法的具体用法?PHP Submission::createResult怎么用?PHP Submission::createResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Submission的用法示例。


在下文中一共展示了Submission::createResult方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkoutWithPaypal

function checkoutWithPaypal($total, $cart)
{
    try {
        $paypal = new PayPal(true);
    } catch (Exception $e) {
        Logger::i()->writeLog("Caught Exception: " . $e->getMessage(), 'dev');
        die;
    }
    $params = array('RETURNURL' => createURLForScript("process.php"), 'CANCELURL' => createURLForScript("cancel.php"), 'PAYMENTREQUEST_0_AMT' => floatval(number_format(floatval($total), 2)), 'PAYMENTREQUEST_0_CURRENCYCODE' => 'EUR');
    $params['SOLUTIONTYPE'] = "Sole";
    $params['LANDINGPAGE'] = "Billing";
    $k = 0;
    foreach ($cart as $key => $value) {
        $info = (array) $value;
        $params['L_PAYMENTREQUEST_0_NAME' . $k] = $info["name"];
        $params['L_PAYMENTREQUEST_0_DESCR' . $k] = $info["description"];
        $params['L_PAYMENTREQUEST_0_AMT' . $k] = floatval(number_format(floatval($info['price']), 2));
        $params['L_PAYMENTREQUEST_0_QTY' . $k] = intval($info['quantity']);
        $k++;
    }
    $response = $paypal->doRequest("SetExpressCheckout", $params);
    if ($response) {
        Logger::i()->writeLog("Starting PayPal checkout");
        return $paypal->generateURL($response['TOKEN']);
    } else {
        Logger::i()->writeLog("Could not get token, error = " . $paypal->error, 'dev');
        die(Submission::createResult("Can not checkout at the moment. Please try again later."));
    }
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:29,代码来源:checkout.php

示例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);
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:9,代码来源:update_customer.php

示例3: array

                if ($find !== false && !is_array($find)) {
                    //cart already exists for user
                    if ($find->cart != "e30=" && strlen($find->cart) != 4) {
                        //not empty cart - overwrite with saved one from DB
                        $_SESSION['shopping-cart'] = $find->cart;
                    } else {
                        //empty cart, use session cart
                        if (isset($_SESSION['shopping-cart'])) {
                            DbManager::i()->update("sf_carts", array("cart" => $_SESSION['shopping-cart']), array("userid" => intval($_SESSION['userid'])));
                        }
                    }
                } else {
                    if (isset($_SESSION['shopping-cart'])) {
                        DbManager::i()->insert("sf_carts", array("cart", "userid"), array($_SESSION['shopping-cart'], intval($_SESSION['userid'])));
                    }
                }
            } else {
                Logger::i()->writeLog("Login is incorrect (" . $login['username'] . ":" . $login['password'] . ")");
                echo Submission::createResult("Username or Password are incorrect");
            }
        } else {
            Logger::i()->writeLog("User does not exist: " . $login['username']);
            echo Submission::createResult("No user found with this username");
        }
    } else {
        Logger::i()->writeLog("Could not get check for login, error = " . DbManager::i()->error, 'dev');
        echo Submission::createResult("Username or Password are incorrect");
    }
} else {
    echo Submission::createResult("Please fill in all information");
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:login.php

示例4: 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));
        }
    }
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:settings.php

示例5: unset

                        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"));
        }
    }
} else {
    die(Submission::createResult("User is not logged in"));
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:account_settings.php

示例6: 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));
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:28,代码来源:logs.php

示例7: 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);
            }
        }
    }
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:cart.php

示例8: 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"));
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:customers.php

示例9: die

        }
    }
    $imagePath = null;
    $bigImagePath = null;
    $productPath = null;
    if (($res = processImages("bigimage", $imagePath, $bigImagePath)) || is_null($imagePath) || is_null($bigImagePath)) {
        die(Submission::createResult("Failed to process image -> " . $res));
    }
    if (($res = processFile("productfile", $productPath)) || is_null($productPath)) {
        die(Submission::createResult("Failed to process Product File -> " . $res));
    }
    if (floatval($product['price']) == 0) {
        die(Submission::createResult("Price can not be 0"));
    }
    $soldOut = intval($product['available']) == 0 ? 1 : 0;
    $insert = DbManager::i()->insert("sf_products", array("name", "price", "description", "available", "image", "bigimage", "file", "soldOut"), array($product['name'], floatval($product['price']), $product['description'], intval($product['available']), $imagePath, $bigImagePath, $productPath, $soldOut));
    if ($insert) {
        Logger::i()->writeLog("Added Product successfully");
        echo Submission::createResult("Product added successfully", true);
    } else {
        Logger::i()->writeLog("Could not add product. error = " . DbManager::i()->error, 'dev');
        echo Submission::createResult("Could not add product");
    }
    unset($product);
    unset($imagePath);
    unset($bigImagePath);
    unset($productPath);
} else {
    Logger::i()->writeLog("Tried to access script without post parameters", 'dev');
    echo Submission::createResult("Bad request");
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:add_product.php

示例10: defined

<?php

defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__));
require_once ROOT_DIR . '/class.btc.php';
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.submission.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
if (!SessionManager::i()->isLoggedIn()) {
    Logger::i()->writeLog("User not logged in", 'access');
    die(Submission::createResult("Permission denied"));
}
if (!SessionManager::i()->validateToken("PaymentStatusToken", "token")) {
    Logger::i()->writeLog("Token to get payment status is missing", 'access');
    die(Submission::createResult("Permission denied"));
}
try {
    $btc = new BTC();
    $info = (array) $btc->checkPaymentStatus();
    if ($info['result'] == "success") {
        die(Submission::createResult($info['resultMessage'], true));
    }
} catch (Exception $e) {
    Logger::i()->writeLog("Caught Exception: " . $e->getMessage(), 'dev');
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:24,代码来源:paymentstatus.php

示例11: die

}
if (!SessionManager::i()->validateToken("UpdateProductToken", "token")) {
    Logger::i()->writeLog("Token to update product is missing", 'dev');
    die(Submission::createResult("Token mismatch"));
}
if ($field = Submission::checkFields("action", "product", $_POST)) {
    die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
$product = (array) json_decode(base64_decode($_POST['product']));
switch ($_POST['action']) {
    case 'soldOut':
        if (!DbManager::i()->update("sf_products", array("soldOut" => intval($product['soldOut'])), array("productid" => intval($product['productid'])))) {
            Logger::i()->writeLog("Marking product as soldOut failed, error = " . DbManager::i()->error, 'dev');
            die(Submission::createResult("Failed to mark product as soldOut"));
        }
        break;
    case 'delete':
        if (!DbManager::i()->delete("sf_products", array("productid" => intval($product['productid'])))) {
            Logger::i()->writeLog("Deleting product failed, error = " . DbManager::i()->error, 'dev');
            die(Submission::createResult("Failed to delete product"));
        }
        break;
    case 'product':
        if (!DbManager::i()->update("sf_products", $product, array("productid" => intval($product['productid'])))) {
            Logger::i()->writeLog("Update Product failed, error = " . DbManager::i()->error, 'dev');
            die(Submission::createResult("Failed to update product"));
        }
        break;
    default:
        break;
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:31,代码来源:update_product.php

示例12: 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"));
}
开发者ID:sharedRoutine,项目名称:ShopFix,代码行数:27,代码来源:products.php


注:本文中的Submission::createResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。