public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $html = '<pre>'; /* $this->entityManager->getConnection() ->getConfiguration() ->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger()) ; */ //$customer = $this->entityManager->find(ENTITY_CUSTOMER, 1); //$this->P->oPayload->cl_html = \HaaseIT\Tools::debug($customer->getName(), 'customername', true); $dql = "SELECT l, b FROM " . ENTITY_USERPAGE_LANG . " l JOIN l.basepage b WHERE l.language = ?1 AND b.key = ?2"; //$dql = "SELECT l FROM ".ENTITY_USERPAGE_LANG." l"; //die($dql); try { $pages = $this->entityManager->createQuery($dql)->setParameter(1, 'de')->setParameter(2, '/index.html')->setMaxResults(10)->getResult(); foreach ($pages as $page) { $html .= 'base id:' . $page->getBasepage()->getId() . PHP_EOL; $html .= 'base key:' . $page->getBasepage()->getKey() . PHP_EOL; $html .= 'base group:' . $page->getBasepage()->getGroup() . PHP_EOL; $html .= 'base pagetype:' . $page->getBasepage()->getPagetype() . PHP_EOL; $html .= 'base pageconfig:' . $page->getBasepage()->getPageconfig() . PHP_EOL; $html .= 'base subnav:' . $page->getBasepage()->getSubnav() . PHP_EOL; $html .= 'lang id:' . $page->getId() . PHP_EOL; $html .= 'lang language:' . $page->getLanguage() . PHP_EOL; $html .= 'lang html:' . $page->getHtml() . PHP_EOL; $html .= 'lang keywords:' . $page->getKeywords() . PHP_EOL; $html .= 'lang description:' . $page->getDescription() . PHP_EOL; $html .= 'lang title:' . $page->getTitle() . PHP_EOL; $page->getBasepage()->setGroup('testi'); $page->setKeywords('testi kel'); $this->serviceManager->get('entitymanager')->persist($page); $this->serviceManager->get('entitymanager')->flush(); } } catch (\Exception $e) { $html .= \HaaseIT\Tools::debug($e, 'exception', true); } $this->P->oPayload->cl_html = $html . '</pre>'; }
private static function getDebug($aP, $P) { if (!empty($_POST)) { Tools::debug($_POST, '$_POST'); } elseif (!empty($_REQUEST)) { Tools::debug($_REQUEST, '$_REQUEST'); } if (!empty($_SESSION)) { Tools::debug($_SESSION, '$_SESSION'); } Tools::debug($aP, '$aP'); //Tools::debug($P, '$P'); }
/** * */ public function preparePage() { $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager); $this->P->cb_pagetype = 'content'; $sLogData = ''; $iId = \filter_input(INPUT_POST, 'custom', FILTER_SANITIZE_NUMBER_INT); $sql = 'SELECT * FROM orders WHERE o_id = ' . $iId . ' AND o_paymentmethod' . " = 'paypal' AND o_paymentcompleted = 'n'"; $hResult = $this->db->query($sql); if ($hResult->rowCount() == 1) { $aOrder = $hResult->fetch(); $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder); $postdata = ''; foreach ($_POST as $i => $v) { $postdata .= $i . '=' . urlencode($v) . '&'; } $postdata .= 'cmd=_notify-validate'; $web = parse_url(HelperConfig::$shop["paypal"]["url"]); if ($web['scheme'] == 'https') { $web['port'] = 443; $ssl = 'ssl://'; } else { $web['port'] = 80; $ssl = ''; } $fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30); if ($fp) { fputs($fp, "POST " . $web['path'] . " HTTP/1.1\r\n"); fputs($fp, "Host: " . $web['host'] . "\r\n"); fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-length: " . strlen($postdata) . "\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $postdata . "\r\n\r\n"); $info = []; while (!feof($fp)) { $info[] = @fgets($fp, 1024); } fclose($fp); $info = implode(',', $info); if (!(strpos($info, 'VERIFIED') === false)) { $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\n"; $sLogData .= "W00T!\n\n"; $sLogData .= \HaaseIT\Tools::debug($_REQUEST, '', true, true) . "\n\n"; // Check if the transaction id has been used before $sTxn_idQ = 'SELECT o_paypal_tx FROM orders WHERE o_paypal_tx = :txn_id'; $hTxn_idResult = $this->db->prepare($sTxn_idQ); $hTxn_idResult->bindValue(':txn_id', $_REQUEST["txn_id"]); $hTxn_idResult->execute(); if ($hTxn_idResult->rowCount() == 0) { if ($_REQUEST["mc_gross"] == number_format($fGesamtbrutto, 2, '.', '') && $_REQUEST["custom"] == $aOrder['o_id'] && $_REQUEST["payment_status"] == "Completed" && $_REQUEST["mc_currency"] == HelperConfig::$shop["paypal"]["currency_id"] && $_REQUEST["business"] == HelperConfig::$shop["paypal"]["business"]) { $aTxnUpdateData = ['o_paypal_tx' => $_REQUEST["txn_id"], 'o_paymentcompleted' => 'y', 'o_id' => $iId]; $sql = \HaaseIT\DBTools::buildPSUpdateQuery($aTxnUpdateData, 'orders', 'o_id'); $hResult = $this->db->prepare($sql); foreach ($aTxnUpdateData as $sKey => $sValue) { $hResult->bindValue(':' . $sKey, $sValue); } $hResult->execute(); $sLogData .= "-- Alles ok. Zahlung erfolgreich. TXNID: " . $_REQUEST["txn_id"] . " --\n\n"; } else { $sLogData .= "-- In my country we have problem; Problem is evaluation. Throw the data down the log!\n"; $sLogData .= "mc_gross: " . $_REQUEST["mc_gross"] . ' - number_format($fGesamtbrutto, 2, \'.\', \'\'): ' . number_format($fGesamtbrutto, 2, '.', '') . "\n"; $sLogData .= "custom: " . $_REQUEST["custom"] . ' - $aOrder[\'o_id\']: ' . $aOrder['o_id'] . "\n"; $sLogData .= "payment_status: " . $_REQUEST["payment_status"] . "\n"; $sLogData .= "mc_currency: " . $_REQUEST["mc_currency"] . ' - HelperConfig::$shop["paypal"]["currency_id"]: ' . HelperConfig::$shop["paypal"]["currency_id"] . "\n"; $sLogData .= "business: " . $_REQUEST["receiver_email"] . ' - HelperConfig::$shop["paypal"]["business"]: ' . HelperConfig::$shop["paypal"]["business"] . "\n\n"; } } else { // INVALID LOGGING ERROR $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\nPHAIL\n\n"; $sLogData .= "!!! JEMAND HAT EINE ALTE TXN_ID BENUTZT: " . $_REQUEST["txn_id"] . " !!!\n\n"; $sLogData .= "!!! INVALID !!!\n\n"; } } else { $sLogData .= "-- new entry - " . date(HelperConfig::$core['locale_format_date_time']) . " --\n\nPHAIL - Transaktion fehlgeschlagen. TXNID: " . $_REQUEST["txn_id"] . "\n" . $info . "\n\n"; } $fp = fopen(PATH_LOGS . FILE_PAYPALLOG, 'a'); // Write $somecontent to our opened file. fwrite($fp, $sLogData); fclose($fp); } } die; }
/** * @param bool $bCust * @param int $iId * @return mixed */ private function buildOrderMailBody($bCust = true, $iId = 0) { $aSHC = SHelper::buildShoppingCartTable($_SESSION["cart"], true); $aData = ['customerversion' => $bCust, 'datetime' => date("d.m.Y - H:i"), 'custno' => isset($this->post["custno"]) && strlen(trim($this->post["custno"])) >= HelperConfig::$customer["minimum_length_custno"] ? $this->post["custno"] : '', 'corpname' => $this->getPostValue('corpname'), 'name' => $this->getPostValue('name'), 'street' => $this->getPostValue('street'), 'zip' => $this->getPostValue('zip'), 'town' => $this->getPostValue('town'), 'phone' => $this->getPostValue('phone'), 'cellphone' => $this->getPostValue('cellphone'), 'fax' => $this->getPostValue('fax'), 'email' => $this->getPostValue('email'), 'country' => isset($this->post["country"]) && trim($this->post["country"]) != '' ? isset(HelperConfig::$countries["countries_" . HelperConfig::$lang][$this->post["country"]]) ? HelperConfig::$countries["countries_" . HelperConfig::$lang][$this->post["country"]] : $this->post["country"] : '', 'remarks' => $this->getPostValue('remarks'), 'tos' => $this->getPostValue('tos'), 'cancellationdisclaimer' => $this->getPostValue('cancellationdisclaimer'), 'paymentmethod' => $this->getPostValue('paymentmethod'), 'shippingcost' => !isset($_SESSION["shippingcost"]) || $_SESSION["shippingcost"] == 0 ? false : $_SESSION["shippingcost"], 'paypallink' => isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'paypal' ? $_SERVER["SERVER_NAME"] . '/_misc/paypal.html?id=' . $iId : '', 'sofortueberweisunglink' => isset($this->post["paymentmethod"]) && $this->post["paymentmethod"] == 'sofortueberweisung' ? $_SERVER["SERVER_NAME"] . '/_misc/sofortueberweisung.html?id=' . $iId : '', 'SESSION' => !$bCust ? Tools::debug($_SESSION, '$_SESSION', true, true) : '', 'POST' => !$bCust ? Tools::debug($this->post, '$this->post', true, true) : '', 'orderid' => $iId]; $aM["customdata"] = $aSHC; $aM['currency'] = HelperConfig::$shop["waehrungssymbol"]; if (isset(HelperConfig::$shop["custom_order_fields"])) { $aM["custom_order_fields"] = HelperConfig::$shop["custom_order_fields"]; } $aM["customdata"]["mail"] = $aData; return $this->serviceManager->get('twig')->render('shop/mail-order-html.twig', $aM); }