本文整理汇总了PHP中Encryption::decrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::decrypt方法的具体用法?PHP Encryption::decrypt怎么用?PHP Encryption::decrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encryption
的用法示例。
在下文中一共展示了Encryption::decrypt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSessionId
public static function getSessionId()
{
if (!isset($_COOKIE[static::$name])) {
return null;
}
return Encryption::decrypt($_COOKIE[static::$name]);
}
示例2: callback
public function callback()
{
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
if (isset($this->request->post['custom'])) {
$order_id = $encryption->decrypt($this->request->post['custom']);
} else {
$order_id = 0;
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$request = 'cmd=_notify-validate';
foreach ($this->request->post as $key => $value) {
$request .= '&' . $key . '=' . urlencode(stripslashes(html_entity_decode($value, ENT_QUOTES, 'UTF-8')));
}
if (extension_loaded('curl')) {
if (!$this->config->get('pp_standard_test')) {
$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
} else {
$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
}
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
if (strcmp($response, 'VERIFIED') == 0 || $this->request->post['payment_status'] == 'Completed') {
$this->model_checkout_order->confirm($order_id, $this->config->get('pp_standard_order_status_id'));
} else {
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
}
curl_close($ch);
} else {
$header = 'POST /cgi-bin/webscr HTTP/1.0' . "\r\n";
$header .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$header .= 'Content-Length: ' . strlen(utf8_decode($request)) . "\r\n";
$header .= 'Connection: close' . "\r\n\r\n";
if (!$this->config->get('pp_standard_test')) {
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
} else {
$fp = fsockopen('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
}
if ($fp) {
fputs($fp, $header . $request);
while (!feof($fp)) {
$response = fgets($fp, 1024);
if (strcmp($response, 'VERIFIED') == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('pp_standard_order_status_id'));
} else {
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
}
}
fclose($fp);
}
}
}
}
示例3: callback
public function callback()
{
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
if (isset($this->request->post['order_id'])) {
$order_id = $encryption->decrypt($this->request->post['order_id']);
} else {
$order_id = 0;
}
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
switch ($this->request->post['status']) {
case '2':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_id'), '', TRUE);
break;
case '0':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_pending_id'), '', TRUE);
break;
case '-1':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_canceled_id'), '', TRUE);
break;
case '-2':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_failed_id'), '', TRUE);
break;
case '-3':
$this->model_checkout_order->update($order_id, $this->config->get('moneybookers_order_status_chargeback_id'), '', TRUE);
break;
}
}
}
示例4: setClientBy
/**
* Set client by id
*
* @param int $id
*
* @throws Exception
*/
public function setClientBy($id)
{
// Load Client from database
$objClient = \Database::getInstance()->prepare("SELECT * FROM tl_synccto_clients WHERE id = %s")->limit(1)->execute((int) $id);
// Check if a client was loaded
if ($objClient->numRows == 0) {
throw new Exception($GLOBALS['TL_LANG']['ERR']['unknown_client']);
}
// Clean url
$objClient->path = preg_replace("/\\/\\z/i", "", $objClient->path);
$objClient->path = preg_replace("/ctoCommunication.php\\z/i", "", $objClient->path);
// Build path
if ($objClient->path == "") {
$strUrl = $objClient->address . ":" . $objClient->port . "/ctoCommunication.php";
} else {
$strUrl = $objClient->address . ":" . $objClient->port . $objClient->path . "/ctoCommunication.php";
}
$this->setClient($strUrl, $objClient->apikey, $objClient->codifyengine);
if ($objClient->http_auth == true) {
$this->setHttpAuth($objClient->http_username, \Encryption::decrypt($objClient->http_password));
}
// Set debug modus for ctoCom.
if ($GLOBALS['TL_CONFIG']['syncCto_debug_mode'] == true) {
$this->setDebug(true);
$this->setMeasurement(true);
$this->setFileDebug($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['debug'], "CtoComDebug.txt"));
$this->setFileMeasurement($this->objSyncCtoHelper->standardizePath($GLOBALS['SYC_PATH']['debug'], "CtoComMeasurement.txt"));
}
$this->arrClientData = array("title" => $objClient->title, "address" => $objClient->address, "path" => $objClient->path, "port" => $objClient->port);
return $this->arrClientData;
}
示例5: callback
public function callback()
{
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$order_id = $encryption->decrypt(@$this->request->get['order_id']);
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if ($order_info) {
$req = 'cmd=_notify-validate';
foreach ($this->request->post as $key => $value) {
$req .= '&' . $key . '=' . urlencode(stripslashes($value));
}
$header = 'POST /cgi-bin/webscr HTTP/1.0' . "\r\n";
$header .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$header .= 'Content-Length: ' . strlen(utf8_decode($req)) . "\r\n\r\n";
if (!$this->config->get('paypal_test')) {
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
} else {
$fp = fsockopen('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
}
if ($fp) {
fputs($fp, $header . $req);
while (!feof($fp)) {
$res = fgets($fp, 1024);
if (strcmp($res, 'VERIFIED') == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('paypal_order_status_id'));
}
}
fclose($fp);
}
}
}
示例6: run
public function run()
{
global $request;
$em = \Shared\DoctrineHelper::getEntityManager();
$idPlayer = \Encryption::decrypt($request->request->get("idPlayer"));
$objPlayer = \Player\PlayerHelper::getPlayerRepository()->findPlayerByIdPlayerAndIdAccount($idPlayer, $this->objAccount->getId());
if ($objPlayer !== null) {
if ($objPlayer->getGold() < 0) {
$yangsOld = $objPlayer->getGold();
$objPlayer->setGold("1500000000");
$em->persist($objPlayer);
$objLogsDeblocageYangs = new \Site\Entity\LogsDeblocageYangs();
$objLogsDeblocageYangs->setIdPerso($idPlayer);
$objLogsDeblocageYangs->setIdCompte($this->objAccount->getId());
$objLogsDeblocageYangs->setDate(new \DateTime(date("Y-m-d H:i:s")));
$objLogsDeblocageYangs->setIp($this->ipAdresse);
$objLogsDeblocageYangs->setLogYangs($yangsOld);
$em->persist($objLogsDeblocageYangs);
$em->flush();
} else {
echo "YANGS";
}
} else {
echo "NOT_YOU";
}
}
示例7: isCookieValid
/**
* Extract and validate cookie
*
* @access public
* @static static method
* @return bool
*/
public static function isCookieValid()
{
//"auth" or "remember me" cookie
if (empty($_COOKIE['auth'])) {
return false;
}
//check the count before using explode
if (count(explode(':', $_COOKIE['auth'])) !== 3) {
self::remove();
return false;
}
list($encryptedUserId, self::$token, self::$hashedCookie) = explode(':', $_COOKIE['auth']);
//Remember? $hashedCookie was generated from the original user Id, NOT from the encrypted one.
self::$userId = Encryption::decrypt($encryptedUserId);
if (self::$hashedCookie === hash('sha256', self::$userId . ':' . self::$token . Config::get('COOKIE_SECRET_KEY')) && !empty(self::$token) && !empty(self::$userId)) {
$database = Database::openConnection();
$query = "SELECT id, cookie_token FROM users WHERE id = :id AND cookie_token = :cookie_token LIMIT 1";
$database->prepare($query);
$database->bindValue(':id', self::$userId);
$database->bindValue(':cookie_token', self::$token);
$database->execute();
$isValid = $database->countRows() === 1 ? true : false;
} else {
$isValid = false;
}
if (!$isValid) {
Logger::log("COOKIE", self::$userId . " is trying to login using invalid cookie: " . self::$token, __FILE__, __LINE__);
self::remove(self::$userId);
}
return $isValid;
}
示例8: viewList
/**
* Conrtorller funktion for Mode 0,1,2,3
*
* @todo set global current in DC_General
* @todo $strTable is unknown
*/
protected function viewList()
{
// Setup
$objCurrentDataProvider = $this->getDC()->getDataProvider();
$objParentDataProvider = $this->getDC()->getDataProvider('parent');
$showFields = $this->getDC()->arrDCA['list']['label']['fields'];
$arrLimit = $this->calculateLimit();
// Load record from current data provider
$objConfig = $objCurrentDataProvider->getEmptyConfig()->setStart($arrLimit[0])->setAmount($arrLimit[1])->setFilter($this->getFilter())->setSorting(array($this->getDC()->getFirstSorting() => $this->getDC()->getFirstSortingOrder()));
$objCollection = $objCurrentDataProvider->fetchAll($objConfig);
// TODO: set global current in DC_General
/* $this->current[] = $objModelRow->getProperty('id'); */
// foreach ($objCollection as $objModel)
// {
//
// }
//
// Rename each pid to its label and resort the result (sort by parent table)
if ($this->getDC()->arrDCA['list']['sorting']['mode'] == 3) {
$this->getDC()->setFirstSorting('pid');
foreach ($objCollection as $objModel) {
$objFieldConfig = $objParentDataProvider->getEmptyConfig()->setId($objModel->getID());
$objFieldModel = $objParentDataProvider->fetch($objFieldConfig);
$objModel->setProperty('pid', $objFieldModel->getProperty($showFields[0]));
}
$this->arrColSort = array('field' => 'pid', 'reverse' => false);
$objCollection->sort(array($this, 'sortCollection'));
}
if (is_array($showFields)) {
// Label
foreach ($showFields as $v) {
// Decrypt each value
if ($this->getDC()->arrDCA['fields'][$v]['eval']['encrypt']) {
foreach ($objCollection as $objModel) {
$mixValue = $objModel->getProperty($v);
$mixValue = deserialize($mixValue);
$mixValue = $this->objEncrypt->decrypt($mixValue);
$objModel->setProperty($v, $mixValue);
}
}
// ToDo: $strTable is unknown
// if (strpos($v, ':') !== false)
// {
// list($strKey, $strTable) = explode(':', $v);
// list($strTable, $strField) = explode('.', $strTable);
//
//
// $objModel = $this->getDC()->getDataProvider($strTable)->fetch(
// $this->getDC()->getDataProvider()->getEmptyConfig()
// ->setId($row[$strKey])
// ->setFields(array($strField))
// );
//
// $objModelRow->setMeta(DCGE::MODEL_LABEL_ARGS, (($objModel->hasProperties()) ? $objModel->getProperty($strField) : ''));
// }
}
}
$this->getDC()->setCurrentCollecion($objCollection);
}
示例9: __construct
public function __construct()
{
parent::__construct();
global $config;
parent::moduleIsActivated($config["mod_player"]["delete"]["activate"]);
global $request;
$this->objPlayer = parent::VerifMonJoueur(\Encryption::decrypt($request->query->get("idPlayer")));
}
示例10: getLeadsExportRow
/**
* Decrypt data for export
*/
public function getLeadsExportRow($arrField, $arrData, $objConfig, $varValue)
{
if ($this->isEncryptLeadsDataActive($objConfig->pid)) {
if ($arrField['id']) {
$varValue = \Encryption::decrypt($arrData[$arrField['id']]['value']);
}
}
return $varValue;
}
示例11: get_data
public function get_data()
{
extract($this->args);
if (isset($_COOKIE[$name])) {
return $encrypt ? json_decode(html_entity_decode(Encryption::decrypt($_COOKIE[$name], $key))) : json_decode(html_entity_decode($_COOKIE[$name]));
} else {
return (object) $data;
}
}
示例12: Encryption
/**
* Encrypt/Decrypt input.
* @access private
*/
function __crypt($password, $encrypt = true)
{
require_once 'include/utils/encryption.php';
$cryptobj = new Encryption();
if ($encrypt) {
return $cryptobj->encrypt(trim($password));
} else {
return $cryptobj->decrypt(trim($password));
}
}
示例13: callback
public function callback()
{
$this->load->language('payment/paymate');
$error = '';
if (isset($this->request->post['responseCode'])) {
if ($this->request->post['responseCode'] == 'PA' || $this->request->post['responseCode'] == 'PP') {
if (isset($this->request->get['oid']) && isset($this->request->get['conf'])) {
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$order_id = $encryption->decrypt(base64_decode($this->request->get['oid']));
$this->load->model('checkout/order');
$order_info = $this->model_checkout_order->getOrder($order_id);
if (isset($order_info['payment_firstname']) && isset($order_info['payment_lastname']) && strcmp($encryption->decrypt(base64_decode($this->request->get['conf'])), $order_info['payment_firstname'] . $order_info['payment_lastname']) == 0) {
$this->model_checkout_order->confirm($order_id, $this->config->get('paymate_order_status_id'));
} else {
$error = $this->language->get('text_unable');
}
} else {
$error = $this->language->get('text_unable');
}
} else {
$error = $this->language->get('text_declined');
}
} else {
$error = $this->language->get('text_unable');
}
if ($error != '') {
$this->data['heading_title'] = $this->language->get('text_failed');
$this->data['text_message'] = sprintf($this->language->get('text_failed_message'), $error, $this->url->link('information/contact'));
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['continue'] = $this->url->link('common/home');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/success.tpl')) {
$this->template = $this->config->get('config_template') . '/template/common/success.tpl';
} else {
$this->template = 'default/template/common/success.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->response->setOutput($this->render());
} else {
$this->redirect($this->url->link('checkout/success'));
}
}
示例14: loadConfig
public function loadConfig($password)
{
$ciphertext = file_get_contents(self::$CONFIG);
$plain = JSON::decode(Encryption::decrypt($password, $ciphertext));
if ($plain['loaded'] === 'yes') {
$this->config = new Config();
$this->config->setData($plain);
} else {
throw new InvalidPasswordException("Password was not correct.");
}
}
示例15: __construct
/**
* On object creation API gets contacted with credentials to authenticate the user
*
* @param string $email
* @param string $password
*/
public function __construct($email = '', $password = '')
{
if ($email == '' && $GLOBALS['TL_CONFIG']['churchtools_email'] == '') {
throw new \InvalidArgumentException('No E-Mail given. Please fill Churchtools-Mail Settings.');
}
if ($password == '' && $GLOBALS['TL_CONFIG']['churchtools_password'] == '') {
throw new \InvalidArgumentException('No Password given. Please fill Contao Settings Churchtools section.');
}
$postfields = array('email' => $email == '' ? $GLOBALS['TL_CONFIG']['churchtools_email'] : $email, 'password' => $password == '' ? \Encryption::decrypt($GLOBALS['TL_CONFIG']['churchtools_password']) : $password, 'directtool' => 'yes');
$url = $GLOBALS['TL_CONFIG']['churchtools_baseUrl'] . '/?q=login';
$this->request($url, $postfields);
}