decrypt() public static method

Decrypted a string.
public static decrypt ( string $ciphertext ) : string
$ciphertext string
return string
Exemplo n.º 1
0
 public static function getSessionId()
 {
     if (!isset($_COOKIE[static::$name])) {
         return null;
     }
     return Encryption::decrypt($_COOKIE[static::$name]);
 }
 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);
             }
         }
     }
 }
Exemplo n.º 3
0
 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;
         }
     }
 }
 /**
  * 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;
 }
Exemplo n.º 5
0
 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);
         }
     }
 }
Exemplo n.º 6
0
 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";
     }
 }
Exemplo n.º 7
0
 /**
  * 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;
 }
 /**
  * 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);
 }
 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")));
 }
 /**
  * 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;
 }
Exemplo n.º 11
0
 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;
     }
 }
Exemplo n.º 12
0
 /**
  * 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));
     }
 }
Exemplo n.º 13
0
 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'));
     }
 }
Exemplo n.º 14
0
 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.");
     }
 }
 /**
  * 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);
 }
Exemplo n.º 16
0
 function MailBox($mailbox = '', $p = '', $s = '')
 {
     global $current_user;
     require_once 'include/utils/encryption.php';
     $oencrypt = new Encryption();
     $this->db = PearDatabase::getInstance();
     $this->db->println("Entering MailBox({$mailbox})");
     $this->mailbox = $mailbox;
     $tmp = getMailServerInfo($current_user);
     if ($this->db->num_rows($tmp) < 1) {
         $this->enabled = 'false';
     } else {
         $this->enabled = 'true';
     }
     $this->boxinfo = $this->db->fetch_array($tmp);
     $this->login_username = trim($this->boxinfo["mail_username"]);
     $this->secretkey = $oencrypt->decrypt(trim($this->boxinfo["mail_password"]));
     $this->imapServerAddress = gethostbyname(trim($this->boxinfo["mail_servername"]));
     $this->mail_protocol = $this->boxinfo["mail_protocol"];
     $this->ssltype = $this->boxinfo["ssltype"];
     $this->sslmeth = $this->boxinfo["sslmeth"];
     $this->box_refresh = trim($this->boxinfo["box_refresh"]);
     $this->mails_per_page = trim($this->boxinfo["mails_per_page"]);
     if ($this->mails_per_page < 1) {
         $this->mails_per_page = 20;
     }
     $this->account_name = $this->boxinfo["account_name"];
     $this->display_name = $this->boxinfo["display_name"];
     //$this->imapServerAddress=$this->boxinfo["mail_servername"];
     $this->db->println("Setting Mailbox Name");
     if ($this->mailbox != "") {
         $this->mailbox = $mailbox;
     }
     $this->db->println("Opening Mailbox");
     if (!$this->mbox && $this->mailbox != "") {
         $this->getImapMbox();
     }
     $this->db->println("Loading mail list");
     $pa = $p;
     $se = $s;
     if ($this->mbox) {
         if ($se != "") {
             $this->mailList = $this->searchMailList($se, $pa);
         } else {
             if ($pa == "") {
                 $this->mailList = $this->customMailList(0);
             } else {
                 $this->mailList = $this->customMailList($pa);
             }
         }
     }
     $this->db->println("Exiting MailBox({$mailbox})");
 }
Exemplo n.º 17
0
 /**
  * Generate label for this record.
  *
  * @param array
  * @param string
  *
  * @return string
  */
 public function getLabel($row, $label)
 {
     $objForm = \FormModel::findById($row['master_id']);
     if ($objForm != null && $objForm->encryptLeadsData) {
         $arrTokens = array('created' => \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $row['created']));
         $objData = \Database::getInstance()->prepare("SELECT * FROM tl_lead_data WHERE pid=?")->execute($row['id']);
         while ($objData->next()) {
             Haste\Util\StringUtil::flatten(deserialize(\Encryption::decrypt($objData->value)), $objData->name, $arrTokens);
         }
         return \Haste\Util\StringUtil::recursiveReplaceTokensAndTags($objForm->leadLabel, $arrTokens);
     }
     return parent::getLabel($row, $label);
 }
 /**
  * Get a Salesforce client object by passing an API
  *
  * @access		public
  * @param		mixed
  * @return		object|null
  */
 public static function getClient($varApi)
 {
     if ($varApi instanceof \Database\Result) {
         $varApi = new ApiConfig($varApi);
     } elseif (is_numeric($varApi)) {
         $varApi = SF_ApiConfig::findByPk($varApi);
     }
     if ($varApi === null || !$varApi instanceof SF_ApiConfig) {
         return null;
     }
     $objBuilder = new SF_ClientBuilder($varApi->wsdlpath ?: TL_ROOT . '/system/modules/salesforce/vendorfiles/soapclient/partner.wsdl.xml', $varApi->username, \Encryption::decrypt($varApi->password), $varApi->token);
     return $objBuilder->build();
 }
 /**
  * Generate item label and return it as HTML string
  * @param object
  * @param string
  * @param object
  * @param string
  * @param mixed
  * @return string
  */
 public static function generateItemLabel($objItem, $strForeignTable, $objDca = null, $strTitleField = '', $varCallback = null)
 {
     $args = array();
     $label = '';
     $blnSimple = false;
     $showFields = $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['fields'];
     // Generate simple label, e.g. for breadcrumb
     if ($strTitleField != '') {
         $blnSimple = true;
         $showFields['titleField'] = $strTitleField;
     }
     foreach ($showFields as $k => $v) {
         // Decrypt the value
         if ($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['eval']['encrypt']) {
             $objItem->{$v} = \Encryption::decrypt(deserialize($objItem->{$v}));
         }
         if (strpos($v, ':') !== false) {
             list($strKey, $strTable) = explode(':', $v);
             list($strTable, $strField) = explode('.', $strTable);
             $objRef = \Database::getInstance()->prepare("SELECT " . $strField . " FROM " . $strTable . " WHERE id=?")->limit(1)->execute($objItem->{$strKey});
             $args[$k] = $objRef->numRows ? $objRef->{$strField} : '';
         } elseif (in_array($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['flag'], array(5, 6, 7, 8, 9, 10))) {
             $args[$k] = \Date::parse($GLOBALS['TL_CONFIG']['datimFormat'], $objItem->{$v});
         } elseif ($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['inputType'] == 'checkbox' && !$GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['eval']['multiple']) {
             $args[$k] = $objItem->{$v} != '' ? isset($GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['label'][0]) ? $GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['label'][0] : $v : '';
         } else {
             $args[$k] = $GLOBALS['TL_DCA'][$strForeignTable]['fields'][$v]['reference'][$objItem->{$v}] ?: $objItem->{$v};
         }
     }
     $label = vsprintf(strlen($GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['format']) ? $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['format'] : '%s', $args);
     // Shorten the label if it is too long
     if ($GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'] > 0 && $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'] < utf8_strlen(strip_tags($label))) {
         $label = trim(\String::substrHtml($label, $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['maxCharacters'])) . ' …';
     }
     $label = preg_replace('/\\(\\) ?|\\[\\] ?|\\{\\} ?|<> ?/', '', $label);
     // Use the default callback if none provided
     if ($varCallback === null) {
         $varCallback = $GLOBALS['TL_DCA'][$strForeignTable]['list']['label']['label_callback'];
     }
     // Call the label_callback ($row, $label, $this)
     if (is_array($varCallback)) {
         $strClass = $varCallback[0];
         $strMethod = $varCallback[1];
         $label = \System::importStatic($strClass)->{$strMethod}($objItem->row(), $label, $objDca, '', $blnSimple, false);
     } elseif (is_callable($varCallback)) {
         $label = $varCallback($objItem->row(), $label, $objDca, '', $blnSimple, false);
     } else {
         $label = \Image::getHtml('iconPLAIN.gif') . ' ' . ($blnSimple ? $args['titleField'] : $label);
     }
     return $label;
 }
Exemplo n.º 20
0
 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'));
         $verified = true;
         // md5sig validation
         if ($this->config->get('moneybookers_secret')) {
             $hash = $this->request->post['merchant_id'];
             $hash .= $this->request->post['transaction_id'];
             $hash .= strtoupper(md5($this->config->get('moneybookers_secret')));
             $hash .= $this->request->post['mb_amount'];
             $hash .= $this->request->post['mb_currency'];
             $hash .= $this->request->post['status'];
             $md5hash = strtoupper(md5($hash));
             $md5sig = $this->request->post['md5sig'];
             if ($md5hash != $md5sig) {
                 $verified = false;
             }
         }
         if ($verified) {
             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_pending_status_id'), '', TRUE);
                     break;
                 case '-1':
                     $this->model_checkout_order->update($order_id, $this->config->get('moneybookers_canceled_status_id'), '', TRUE);
                     break;
                 case '-2':
                     $this->model_checkout_order->update($order_id, $this->config->get('moneybookers_failed_status_id'), '', TRUE);
                     break;
                 case '-3':
                     $this->model_checkout_order->update($order_id, $this->config->get('moneybookers_chargeback_status_id'), '', TRUE);
                     break;
             }
         } else {
             $this->log->write('md5sig returned (' + $md5sig + ') does not match generated (' + $md5hash + '). Verify Manually. Current order state: ' . $this->config->get('config_order_status_id'));
         }
     }
 }
Exemplo n.º 21
0
 /**
  * Callback function when transaction is complete
  */
 public function callback()
 {
     $this->load->language('payment/etranzact');
     $error = '';
     if (isset($this->request->post['SUCCESS'])) {
         if ($this->request->post['SUCCESS'] == 0) {
             if ($this->request->get['oid'] && isset($this->request->get['conf'])) {
                 $this->load->model('checkout/order');
                 $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('etranzact_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, HTTP_SERVER . 'index.php?route=information/contact');
         $this->data['button_continue'] = $this->language->get('button_continue');
         $this->data['continue'] = HTTP_SERVER . 'index.php?route=common/home';
         $this->template = $this->config->get('config_template') . '/template/common/success.tpl';
         $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
     } else {
         $this->redirect(HTTP_SERVER . 'index.php?route=checkout/success');
     }
 }
Exemplo n.º 22
0
 public function LogIn($username, $password, $module)
 {
     $con = mysql_connect($this->myHost, $this->username, $this->password);
     if (!$con) {
         die('Could not connect: ' . mysql_error());
     }
     mysql_select_db($this->database, $con);
     $result = mysql_query("SELECT employeeID,username,password,module FROM registeredUser where username = '******' and module = '" . mysql_real_escape_string($module) . "' ");
     while ($row = mysql_fetch_array($result)) {
         $this->UserPassword = Encryption::decrypt(Encryption::ENCRYPT_DECRYPT($row['password']));
         $this->UserName = $row['username'];
         $this->UserModule = $row['module'];
         $this->UserEmployeeID = $row['employeeID'];
     }
 }
Exemplo n.º 23
0
 /**
  * upgrade_to_1_1_0 function.
  *
  * @access private
  * @return void
  */
 private function upgrade_to_1_1_0()
 {
     if ($this->Database->tableExists('tl_secure_accessdata')) {
         // Read fields decrypt them an save them
         $objData = \SecureAccessdataModel::findAll();
         if ($objData !== null) {
             while ($objData->next()) {
                 $arrSet = array();
                 // Set vars for update
                 $objData->access_title = \Encryption::decrypt($objData->access_title) == '' ? $objData->access_title : \Encryption::decrypt($objData->access_title);
                 $objData->author = \Encryption::decrypt($objData->author) == '' ? $objData->author : \Encryption::decrypt($objData->author);
                 // Save
                 $objData->save();
             }
         }
     }
 }
Exemplo n.º 24
0
 public function __construct()
 {
     if (isset(Yii::app()->session['customer_id'])) {
         $session_customer_id = Yii::app()->session['customer_id'];
         if ($this->customerId != $session_customer_id) {
             $this->customer_info = HtCustomer::model()->findByPk($session_customer_id);
         }
         if (empty($this->customer_info)) {
             $this->logout();
         }
     }
     if (isset($_COOKIE['customer'])) {
         $encryption = new Encryption(Setting::instance()->get('config_encryption'));
         $login_data = @unserialize($encryption->decrypt($_COOKIE['customer']));
         if (!empty($login_data['auto']) && !empty($login_data['email']) && !empty($login_data['password'])) {
             $this->login($login_data['email'], $login_data['password']);
         }
     }
 }
Exemplo n.º 25
0
 public function run()
 {
     global $request;
     $idSupportDiscussion = \Encryption::decrypt($request->request->get("idSupportDiscussion"));
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idSupportDiscussion);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
     $objAdmins = \Site\SiteHelper::getAdminsRepository()->findAdministrationUser($objSupportDiscussion->getIdAdmin());
     $arrObjSupportMessages = \Site\SiteHelper::getSupportMessagesRepository()->findMessages($this->objAccount->getId(), $idSupportDiscussion);
     $this->arrayTemplate["objSupportDiscussion"] = $objSupportDiscussion;
     $this->arrayTemplate["objAccount"] = $objAccount;
     $this->arrayTemplate["objAdmins"] = $objAdmins;
     $this->arrayTemplate["arrObjSupportMessages"] = $arrObjSupportMessages;
     $this->arrayTemplate["currentAccount"] = $this->objAccount;
     $this->arrayTemplate["currentAdmin"] = $this->objAdmin;
     $this->arrayTemplate["etatLu"] = \SupportEtatMessageHelper::LU;
     $this->arrayTemplate["isAdmin"] = $this->isAdmin;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Exemplo n.º 26
0
 public function run()
 {
     global $request;
     $idDiscussion = \Encryption::decrypt($request->query->get("idDiscussion"));
     $arrObjAdmins = \Site\SiteHelper::getAdminsRepository()->findAll();
     $arrUsers = [];
     foreach ($arrObjAdmins as $objAdmins) {
         $arrDroits = $objAdmins->getDroits();
         if (in_array(\DroitsHelper::SUPPORT_TICKET, $arrDroits)) {
             $objAccount = \Account\AccountHelper::getAccountRepository()->find($objAdmins->getIdCompte());
             if ($objAccount !== null) {
                 $arrUsers[] = $objAdmins;
             }
         }
     }
     $this->arrayTemplate["idDiscussion"] = $idDiscussion;
     $this->arrayTemplate["arrObjAdmins"] = $arrUsers;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
Exemplo n.º 27
0
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idAccount = \Encryption::decrypt($request->query->get("id"));
     if ($idAccount !== null) {
         $objAccount = Account\AccountHelper::getAccountRepository()->find($idAccount);
         if ($objAccount !== null) {
             if ($objAccount->getStatus() != StatusHelper::BANNI) {
                 $objAccount->setStatus(StatusHelper::ACTIF);
                 $em->persist($objAccount);
                 $em->flush();
                 header("LOCATION: index.php?ok");
             } else {
                 echo "Ahah ! Niqué gros !";
             }
         } else {
             echo "Nous n'avons pas trouvé votre compte sur nos serveurs.";
         }
     }
 }
Exemplo n.º 28
0
 public function run()
 {
     global $request;
     $idPlayer = \Encryption::decrypt($request->query->get("id"));
     $templateEquipement = $this->objTwig->loadTemplate("playerEquipement.html5.twig");
     $tailleImageEquipement = getimagesize("../../images/equipement.png");
     $objItemArme = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(4, 4, $idPlayer, "EQUIPMENT", true);
     $objItemArmure = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 0, $idPlayer, "EQUIPMENT", true);
     $objItemCasque = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(1, 1, $idPlayer, "EQUIPMENT", true);
     $objItemBouclier = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(10, 10, $idPlayer, "EQUIPMENT", true);
     $objItemBracelet = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(3, 3, $idPlayer, "EQUIPMENT", true);
     $objItemBoucle = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(6, 6, $idPlayer, "EQUIPMENT", true);
     $objItemCollier = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(5, 5, $idPlayer, "EQUIPMENT", true);
     $objItemChaussure = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(2, 2, $idPlayer, "EQUIPMENT", true);
     $objItemFleche = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(9, 9, $idPlayer, "EQUIPMENT", true);
     $objItemSpecial1 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(7, 7, $idPlayer, "EQUIPMENT", true);
     $objItemSpecial2 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(8, 8, $idPlayer, "EQUIPMENT", true);
     $objItemJambiere = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(23, 23, $idPlayer, "EQUIPMENT", true);
     $viewEquipement = $templateEquipement->render(["tailleImageEquipementWidth" => $tailleImageEquipement[0], "tailleImageEquipementHeight" => $tailleImageEquipement[1], "objItemArme" => $objItemArme, "objItemArmure" => $objItemArmure, "objItemCasque" => $objItemCasque, "objItemBouclier" => $objItemBouclier, "objItemBracelet" => $objItemBracelet, "objItemBoucle" => $objItemBoucle, "objItemCollier" => $objItemCollier, "objItemChaussure" => $objItemChaussure, "objItemFleche" => $objItemFleche, "objItemSpecial1" => $objItemSpecial1, "objItemSpecial2" => $objItemSpecial2, "objItemJambiere" => $objItemJambiere]);
     $arrObjItems = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 180, $idPlayer, "INVENTORY");
     $arrObjItemsPage1 = \Player\PlayerHelper::getItemRepository()->findByPosIntervalAndOwnerId(0, 44, $idPlayer, "INVENTORY");
     $templateEntrepotPage1 = $this->objTwig->loadTemplate("ajaxInventairePage.html5.twig");
     $viewEntrepotPage1 = $templateEntrepotPage1->render(["arrObjItems" => $arrObjItemsPage1, "iDepart" => 0]);
     $templateInventaire = $this->objTwig->loadTemplate("playerInventaire.html5.twig");
     $viewInventaire = $templateInventaire->render(["objAccount" => $this->objAccount, "viewInventairePage1" => $viewEntrepotPage1, "arrObjItems" => $arrObjItems, "idPlayer" => $idPlayer]);
     $templateGenerale = $this->objTwig->loadTemplate("MonPersonnageGenerale.html5.twig");
     $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPlayer);
     $objPlayerIndex = \Player\PlayerHelper::getPlayerIndexRepository()->find($objPlayer->getId());
     $calculateGrade = \Player\PlayerHelper::calculateGrade($objPlayer->getAlignment());
     $haveGuild = \Player\PlayerHelper::haveGuild($objPlayer->getId());
     $isConnected = \Player\PlayerHelper::isConnected($objPlayer, 30);
     $objMarriage = \Player\PlayerHelper::getMarriageRepository()->findMariageByIdPlayer($objPlayer->getId());
     $localisation = json_decode(\Localisation::localize(0, $objPlayer, $isConnected));
     $viewGenerale = $templateGenerale->render(["objAccount" => $this->objAccount, "viewEquipement" => $viewEquipement, "viewInventaire" => $viewInventaire, "objPlayer" => $objPlayer, "objPlayerIndex" => $objPlayerIndex, "localisation" => $localisation, "isConnected" => $isConnected, "calculateGrade" => $calculateGrade, "haveGuild" => $haveGuild, "objMarriage" => $objMarriage]);
     $this->arrayTemplate["viewGenerale"] = $viewGenerale;
     $this->arrayTemplate["idPlayer"] = $idPlayer;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idDiscussion = \Encryption::decrypt($request->request->get("idDiscussion"));
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
     if ($objSupportDiscussion !== null) {
         if ($objSupportDiscussion->getIdCompte() == $this->objAccount->getId() or $objSupportDiscussion->getIdAdmin() == $this->objAccount->getId()) {
             $objSupportDiscussion->setEstArchive(1);
             $em->persist($objSupportDiscussion);
             $em->flush();
             $template = $this->objTwig->loadTemplate("MessagerieDiscussionCloture.html5.twig");
             $result = $template->render(["compte" => $objAccount->getLogin(), "objet" => \SupportObjetsHelper::getLibelle($objSupportDiscussion->getIdObjet())]);
             $subject = 'VamosMT2 - Clôture de votre ticket';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             echo json_encode(["result" => true]);
         } else {
             echo json_encode(["result" => false, "message" => "Le ticket est introuvable."]);
         }
     }
 }
 /**
  * Login the user with previously set cookie
  * @param string $cookie
  * @return bool
  * @throws Exception
  */
 public static function loginWithCookie(string $cookie) : bool
 {
     if (!$cookie) {
         Session::push('feedback_negative', Text::get('FEEDBACK_COOKIE_INVALID'));
         return false;
     }
     // check if cookie can be split into 3 parts
     if (count(explode(':', $cookie)) !== 3) {
         Session::push('feedback_negative', Text::get('FEEDBACK_COOKIE_INVALID'));
         return false;
     }
     list($user_id, $token, $hash) = explode(':', $cookie);
     // decrypt user id
     $user_id = Encryption::decrypt($user_id);
     if ($hash !== hash('sha256', $user_id . ':' . $token) or empty($token) or empty($user_id)) {
         Session::push('feedback_negative', Text::get('COOKIE_INVALID'));
         return false;
     }
     // get data of user that has this id and this token
     $result = UserModel::getUserDataByUserIdAndToken($user_id, $token);
     if ($result) {
         // successfully logged in
         self::setSuccessfulLoginIntoSession($result->user_id, $result->user_name, $result->user_email, $result->user_account_type);
         // save timestamp of this login
         self::saveTimestampOfLoginOfUser($result->user_name);
         Session::push('feedback_positive', Text::get('COOKIE_LOGIN_SUCCESSFUL'));
         return true;
     } else {
         Session::push('feedback_negative', Text::get('FEEDBACK_COOKIE_INVALID'));
         return false;
     }
 }