Exemplo n.º 1
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
     $sql = 'SELECT * FROM orders ';
     $sql .= "WHERE o_id = :id AND o_paymentmethod = 'paypal' AND o_paymentcompleted = 'n'";
     /** @var \PDOStatement $hResult */
     $hResult = $this->serviceManager->get('db')->prepare($sql);
     $hResult->bindValue(':id', $iId, \PDO::PARAM_INT);
     $hResult->execute();
     if ($hResult->rowCount() == 1) {
         $aOrder = $hResult->fetch();
         $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder);
         $sPaypalURL = HelperConfig::$shop["paypal"]["url"] . '?cmd=_xclick&rm=2&custom=' . $iId . '&business=' . HelperConfig::$shop["paypal"]["business"];
         $sPaypalURL .= '&notify_url=http://' . $_SERVER["SERVER_NAME"] . '/_misc/paypal_notify.html&item_name=' . $this->textcats->T("misc_paypaypal_paypaltitle") . ' ' . $iId;
         $sPaypalURL .= '&currency_code=' . HelperConfig::$shop["paypal"]["currency_id"] . '&amount=' . str_replace(',', '.', number_format($fGesamtbrutto, 2, '.', ''));
         if (HelperConfig::$shop["interactive_paymentmethods_redirect_immediately"]) {
             header('Location: ' . $sPaypalURL);
             die;
         }
         $this->P->oPayload->cl_html = $this->textcats->T("misc_paypaypal_greeting") . '<br><br>';
         $this->P->oPayload->cl_html .= '<a href="' . $sPaypalURL . '">' . $this->textcats->T("misc_paypaypal") . '</a>';
     } else {
         $this->P->oPayload->cl_html = $this->textcats->T("misc_paypaypal_paymentnotavailable");
     }
 }
Exemplo n.º 2
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     unset($_SESSION["user"]);
     if (HelperConfig::$core["enable_module_shop"] && isset($_SESSION["cart"])) {
         \HaaseIT\HCSF\Shop\Helper::refreshCartItems($this->serviceManager);
     }
     $this->P->oPayload->cl_html = $this->serviceManager->get('textcats')->T("logout_message");
 }
Exemplo n.º 3
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     $_SESSION["formsave_addrform"]["country"] = $_POST["country"];
     \HaaseIT\HCSF\Shop\Helper::buildShoppingCartTable($_SESSION["cart"]);
     header("Content-Type: text/html; charset=UTF-8");
     $return = '<div>';
     $return .= '<div id="shippingcostbrutto_new">' . number_format($_SESSION["cartpricesums"]["fVersandkostenbrutto"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '<div id="vatfull_new">' . number_format(round($_SESSION["cartpricesums"]["fSteuervoll"], 2), HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '<div id="totalbrutto_new">' . number_format(round($_SESSION["cartpricesums"]["fGesamtbrutto"], 2), HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '<div id="shippingcostnetto_new">' . number_format($_SESSION["cartpricesums"]["fVersandkostennetto"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '<div id="vatreduced_new">' . number_format(round($_SESSION["cartpricesums"]["fSteuererm"], 2), HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '<div id="totalnetto_new">' . number_format(round($_SESSION["cartpricesums"]["fGesamtnetto"], 2), HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . '</div>';
     $return .= '</div>';
     die($return);
 }
Exemplo n.º 4
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     if (HelperConfig::$shop["show_pricesonlytologgedin"] && !\HaaseIT\HCSF\Customer\Helper::getUserData()) {
         $this->P->oPayload->cl_html = $this->serviceManager->get('textcats')->T("denied_notloggedin");
     } else {
         $this->P->cb_customcontenttemplate = 'shop/checkedout';
         $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
         $sql = 'SELECT * FROM orders WHERE o_id = :id AND o_paymentcompleted = \'n\'';
         /** @var \PDOStatement $hResult */
         $hResult = $this->serviceManager->get('db')->prepare($sql);
         $hResult->bindValue(':id', $iId, \PDO::PARAM_INT);
         $hResult->execute();
         if ($hResult->rowCount() == 1) {
             $this->P->cb_customdata["order"] = $hResult->fetch();
             $this->P->cb_customdata["gesamtbrutto"] = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($this->P->cb_customdata["order"]);
         }
     }
 }
Exemplo n.º 5
0
 /**
  *
  */
 public function preparePage()
 {
     $this->P = new \HaaseIT\HCSF\CorePage($this->serviceManager);
     $this->P->cb_pagetype = 'content';
     $iId = \filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
     $sql = 'SELECT * FROM orders ' . "WHERE o_id = :id AND o_paymentmethod = 'sofortueberweisung' AND o_paymentcompleted = 'n'";
     /** @var \PDOStatement $hResult */
     $hResult = $this->serviceManager->get('db')->prepare($sql);
     $hResult->bindValue(':id', $iId, \PDO::PARAM_INT);
     $hResult->execute();
     if ($hResult->rowCount() == 1) {
         $aOrder = $hResult->fetch();
         $fGesamtbrutto = \HaaseIT\HCSF\Shop\Helper::calculateTotalFromDB($aOrder);
         $sPURL = 'https://www.sofortueberweisung.de/payment/start?user_id=' . HelperConfig::$shop["sofortueberweisung"]["user_id"] . '&amp;project_id=' . HelperConfig::$shop["sofortueberweisung"]["project_id"] . '&amp;amount=' . number_format($fGesamtbrutto, 2, '.', '') . '&amp;currency_id=' . HelperConfig::$shop["sofortueberweisung"]["currency_id"] . '&amp;reason_1=' . urlencode($this->textcats->T("misc_paysofortueberweisung_ueberweisungsbetreff") . ' ') . $iId;
         if (HelperConfig::$shop["interactive_paymentmethods_redirect_immediately"]) {
             header('Location: ' . $sPURL);
             die;
         }
         $this->P->oPayload->cl_html = $this->textcats->T("misc_paysofortueberweisung_greeting") . '<br><br>';
         $this->P->oPayload->cl_html .= '<a href="' . $sPURL . '">' . $this->textcats->T("misc_paysofortueberweisung") . '</a>';
     } else {
         $this->P->oPayload->cl_html = $this->textcats->T("misc_paysofortueberweisung_paymentnotavailable");
     }
 }
Exemplo n.º 6
0
 public static function getShoppingcartData()
 {
     $aCartinfo = ['numberofitems' => 0, 'cartsums' => [], 'cartsumnetto' => 0, 'cartsumbrutto' => 0];
     if ((!HelperConfig::$shop["show_pricesonlytologgedin"] || CHelper::getUserData()) && isset($_SESSION["cart"]) && count($_SESSION["cart"])) {
         $aCartsums = \HaaseIT\HCSF\Shop\Helper::calculateCartItems($_SESSION["cart"]);
         $aCartinfo = ['numberofitems' => count($_SESSION["cart"]), 'cartsums' => $aCartsums, 'cartsumnetto' => $aCartsums["sumvoll"] + $aCartsums["sumerm"], 'cartsumbrutto' => $aCartsums["sumvoll"] + $aCartsums["sumerm"] + $aCartsums["taxerm"] + $aCartsums["taxvoll"]];
         unset($aCartsums);
         foreach ($_SESSION["cart"] as $sKey => $aValue) {
             $aCartinfo["cartitems"][$sKey] = ['cartkey' => $sKey, 'name' => $aValue["name"], 'amount' => $aValue["amount"], 'img' => $aValue["img"], 'price' => $aValue["price"]];
         }
     }
     return $aCartinfo;
 }
Exemplo n.º 7
0
 /**
  * @param $CSA
  * @return array
  */
 private function handleShopAdmin($CSA)
 {
     $aSData = [];
     $aData = [];
     if (!isset($_GET["action"])) {
         $bIgnoreStorno = false;
         $sql = 'SELECT * FROM orders WHERE ';
         if (!isset($_REQUEST["type"]) or $_REQUEST["type"] == 'openinwork') {
             $sql .= "(o_ordercompleted = 'n' OR o_ordercompleted = 'i') ";
         } elseif ($_REQUEST["type"] == 'closed') {
             $sql .= "o_ordercompleted = 'y' ";
         } elseif ($_REQUEST["type"] == 'open') {
             $sql .= "o_ordercompleted = 'n' ";
         } elseif ($_REQUEST["type"] == 'inwork') {
             $sql .= "o_ordercompleted = 'i' ";
         } elseif ($_REQUEST["type"] == 'storno') {
             $sql .= "o_ordercompleted = 's' ";
         } elseif ($_REQUEST["type"] == 'deleted') {
             $sql .= "o_ordercompleted = 'd' ";
         } elseif ($_REQUEST["type"] == 'all') {
             $sql .= "o_ordercompleted != 'd' ";
             $bIgnoreStorno = true;
         } else {
             die(HardcodedText::get('shopadmin_error_invalidrequest'));
         }
         $bFromTo = false;
         $sFrom = null;
         $sTo = null;
         if (isset($_REQUEST["type"]) && ($_REQUEST["type"] == 'deleted' or $_REQUEST["type"] == 'all' or $_REQUEST["type"] == 'closed')) {
             $sql .= "AND ";
             $sFrom = \filter_var($_REQUEST["fromyear"], FILTER_SANITIZE_NUMBER_INT) . '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["frommonth"], FILTER_SANITIZE_NUMBER_INT));
             $sFrom .= '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["fromday"], FILTER_SANITIZE_NUMBER_INT));
             $sTo = \filter_var($_REQUEST["toyear"], FILTER_SANITIZE_NUMBER_INT) . '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["tomonth"], FILTER_SANITIZE_NUMBER_INT));
             $sTo .= '-' . Tools::dateAddLeadingZero(\filter_var($_REQUEST["today"], FILTER_SANITIZE_NUMBER_INT));
             $sql .= "o_orderdate >= :from ";
             $sql .= "AND o_orderdate <= :to ";
             $bFromTo = true;
         }
         $sql .= "ORDER BY o_ordertimestamp DESC";
         $hResult = $this->db->prepare($sql);
         if ($bFromTo) {
             $hResult->bindValue(':from', $sFrom);
             $hResult->bindValue(':to', $sTo);
         }
         $hResult->execute();
         if ($hResult->rowCount() != 0) {
             $i = 0;
             $j = 0;
             $k = 0;
             $fGesamtnetto = 0.0;
             while ($aRow = $hResult->fetch()) {
                 if ($aRow["o_ordercompleted"] == 'y') {
                     $sStatus = '<span style="color: green; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_completed') . '</span>';
                 } elseif ($aRow["o_ordercompleted"] == 'n') {
                     $sStatus = '<span style="color: orange; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_open') . '</span>';
                 } elseif ($aRow["o_ordercompleted"] == 'i') {
                     $sStatus = '<span style="color: orange;">' . HardcodedText::get('shopadmin_orderstatus_inwork') . '</span>';
                 } elseif ($aRow["o_ordercompleted"] == 's') {
                     $sStatus = '<span style="color: red; font-weight: bold;">' . HardcodedText::get('shopadmin_orderstatus_canceled') . '</span>';
                 } elseif ($aRow["o_ordercompleted"] == 'd') {
                     $sStatus = HardcodedText::get('shopadmin_orderstatus_deleted');
                 } else {
                     $sStatus = '';
                 }
                 if ($aRow["o_paymentcompleted"] == 'y') {
                     $sZahlungsmethode = '<span style="color: green;">';
                 } else {
                     $sZahlungsmethode = '<span style="color: red;">';
                 }
                 $mZahlungsmethode = $this->serviceManager->get('textcats')->T("order_paymentmethod_" . $aRow["o_paymentmethod"], true);
                 if ($mZahlungsmethode) {
                     $sZahlungsmethode .= $mZahlungsmethode;
                 } else {
                     $sZahlungsmethode .= ucwords($aRow["o_paymentmethod"]);
                 }
                 $sZahlungsmethode .= '</span>';
                 if (trim($aRow["o_corpname"]) == '') {
                     $sName = $aRow["o_name"];
                 } else {
                     $sName = $aRow["o_corpname"];
                 }
                 $aData[] = ['o_id' => $aRow["o_id"], 'o_account_no' => $aRow["o_custno"], 'o_email' => $aRow["o_email"], 'o_cust' => $sName . '<br>' . $aRow["o_zip"] . ' ' . $aRow["o_town"], 'o_authed' => $aRow["o_authed"], 'o_sumnettoall' => number_format($aRow["o_sumnettoall"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . ' ' . HelperConfig::$shop["waehrungssymbol"] . ($aRow["o_mindermenge"] != 0 && $aRow["o_mindermenge"] != '' ? '<br>+' . number_format($aRow["o_mindermenge"], HelperConfig::$core['numberformat_decimals'], HelperConfig::$core['numberformat_decimal_point'], HelperConfig::$core['numberformat_thousands_seperator']) . ' ' . HelperConfig::$shop["waehrungssymbol"] : ''), 'o_order_status' => $sStatus . (trim($aRow["o_lastedit_user"]) != '' ? '<br>' . $aRow["o_lastedit_user"] : ''), 'o_ordertime_number' => date(HelperConfig::$core['locale_format_date_time'], $aRow["o_ordertimestamp"]) . (trim($aRow["o_transaction_no"]) != '' ? '<br>' . $aRow["o_transaction_no"] : ''), 'o_order_host_payment' => $sZahlungsmethode . '<br>' . $aRow["o_srv_hostname"]];
                 if (!($aRow["o_ordercompleted"] == 's' && $bIgnoreStorno)) {
                     $fGesamtnetto += $aRow["o_sumnettoall"];
                     $j++;
                 } else {
                     $k++;
                 }
                 $i++;
             }
             $aSData['listtable_orders'] = Tools::makeListtable($CSA["list_orders"], $aData, $this->serviceManager->get('twig'));
             $aSData['listtable_i'] = $i;
             $aSData['listtable_j'] = $j;
             $aSData['listtable_k'] = $k;
             $aSData['listtable_gesamtnetto'] = $fGesamtnetto;
         } else {
             $aSData['nomatchingordersfound'] = true;
         }
     } elseif (isset($_GET["action"]) && $_GET["action"] == 'edit') {
         $iId = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
         $sql = 'SELECT * FROM orders WHERE o_id = :id';
         /** @var \PDOStatement $hResult */
         $hResult = $this->db->prepare($sql);
         $hResult->bindValue(':id', $iId);
         $hResult->execute();
         if ($hResult->rowCount() == 1) {
             $aSData["orderdata"] = $hResult->fetch();
             $sql = 'SELECT * FROM orders_items WHERE oi_o_id = :id';
             $hResult = $this->db->prepare($sql);
             $hResult->bindValue(':id', $iId);
             $hResult->execute();
             $aItems = $hResult->fetchAll();
             $aUserdata = ['cust_no' => $aSData["orderdata"]["o_custno"], 'cust_email' => $aSData["orderdata"]["o_email"], 'cust_corp' => $aSData["orderdata"]["o_corpname"], 'cust_name' => $aSData["orderdata"]["o_name"], 'cust_street' => $aSData["orderdata"]["o_street"], 'cust_zip' => $aSData["orderdata"]["o_zip"], 'cust_town' => $aSData["orderdata"]["o_town"], 'cust_phone' => $aSData["orderdata"]["o_phone"], 'cust_cellphone' => $aSData["orderdata"]["o_cellphone"], 'cust_fax' => $aSData["orderdata"]["o_fax"], 'cust_country' => $aSData["orderdata"]["o_country"], 'cust_group' => $aSData["orderdata"]["o_group"]];
             $aSData["customerform"] = \HaaseIT\HCSF\Customer\Helper::buildCustomerForm(HelperConfig::$lang, 'shopadmin', '', $aUserdata);
             $aSData["orderdata"]["options_shippingservices"] = [''];
             foreach (HelperConfig::$shop["shipping_services"] as $sValue) {
                 $aSData["orderdata"]["options_shippingservices"][] = $sValue;
             }
             $aItemsCarttable = [];
             foreach ($aItems as $aValue) {
                 $aPrice = ['netto_list' => $aValue["oi_price_netto_list"], 'netto_sale' => $aValue["oi_price_netto_sale"], 'netto_rebated' => $aValue["oi_price_netto_rebated"], 'netto_use' => $aValue["oi_price_netto_use"], 'brutto_use' => $aValue["oi_price_brutto_use"]];
                 //$aPrice = $oItem->calcPrice($aValue["oi_price_netto"], HelperConfig::$shop["vat"][$aValue["oi_vat_id"]], '', true);
                 $aItemsCarttable[$aValue["oi_cartkey"]] = ['amount' => $aValue["oi_amount"], 'price' => $aPrice, 'vat' => $aValue["oi_vat"], 'rg' => $aValue["oi_rg"], 'rg_rebate' => $aValue["oi_rg_rebate"], 'name' => $aValue["oi_itemname"], 'img' => $aValue["oi_img"]];
             }
             $aSData = array_merge(\HaaseIT\HCSF\Shop\Helper::buildShoppingCartTable($aItemsCarttable, true, $aSData["orderdata"]["o_group"], '', $aSData["orderdata"]["o_vatfull"], $aSData["orderdata"]["o_vatreduced"]), $aSData);
         } else {
             $aSData['ordernotfound'] = true;
         }
     }
     return $aSData;
 }
Exemplo n.º 8
0
 private function showMyOrders($COList)
 {
     $return = '';
     $sql = 'SELECT * FROM orders WHERE o_custno = :custno ORDER BY o_ordertimestamp DESC';
     $hResult = $this->db->prepare($sql);
     $hResult->bindValue(':custno', CHelper::getUserData('cust_no'));
     $hResult->execute();
     if ($hResult->rowCount() >= 1) {
         $aData = [];
         while ($aRow = $hResult->fetch()) {
             $sStatus = SHelper::showOrderStatusText($this->textcats, $aRow["o_ordercompleted"]);
             if ($aRow["o_paymentmethod"] == 'prepay') {
                 $sPaymentmethod = $this->textcats->T("order_paymentmethod_prepay");
             } elseif ($aRow["o_paymentmethod"] == 'paypal') {
                 $sPaymentmethod = $this->textcats->T("order_paymentmethod_paypal");
             } elseif ($aRow["o_paymentmethod"] == 'debit') {
                 $sPaymentmethod = $this->textcats->T("order_paymentmethod_debit");
             } elseif ($aRow["o_paymentmethod"] == 'invoice') {
                 $sPaymentmethod = $this->textcats->T("order_paymentmethod_invoice");
             } else {
                 $sPaymentmethod = ucwords($aRow["o_paymentmethod"]);
             }
             if ($aRow["o_paymentcompleted"] == 'y') {
                 $sPaymentstatus = ucwords($this->textcats->T("misc_yes"));
             } else {
                 $sPaymentstatus = ucwords($this->textcats->T("misc_no"));
             }
             $aData[] = ['o_id' => $aRow["o_id"], 'o_order_status' => $sStatus, 'o_ordertime' => date(HelperConfig::$customer['locale_format_date_time'], $aRow["o_ordertimestamp"]), 'o_paymentmethod' => $sPaymentmethod, 'o_paymentcompleted' => $sPaymentstatus, 'o_shipping_service' => $aRow["o_shipping_service"], 'o_shipping_trackingno' => $aRow["o_shipping_trackingno"]];
         }
         $return .= \HaaseIT\Tools::makeListtable($COList, $aData, $this->serviceManager->get('twig'));
     } else {
         $return .= $this->textcats->T("myorders_no_orders_to_display");
     }
     return $return;
 }
Exemplo n.º 9
0
 public static function generatePage(ServiceManager $serviceManager, $P)
 {
     $requesturi = $serviceManager->get('request')->getRequestTarget();
     $aP = ['language' => HelperConfig::$lang, 'pageconfig' => $P->cb_pageconfig, 'pagetype' => $P->cb_pagetype, 'subnavkey' => $P->cb_subnav, 'requesturi' => $requesturi, 'requesturiarray' => parse_url($requesturi), 'locale_format_date' => HelperConfig::$core['locale_format_date'], 'locale_format_date_time' => HelperConfig::$core['locale_format_date_time'], 'maintenancemode' => HelperConfig::$core['maintenancemode'], 'numberformat_decimals' => HelperConfig::$core['numberformat_decimals'], 'numberformat_decimal_point' => HelperConfig::$core['numberformat_decimal_point'], 'numberformat_thousands_seperator' => HelperConfig::$core['numberformat_thousands_seperator']];
     if (HelperConfig::$core["enable_module_customer"]) {
         $aP["isloggedin"] = \HaaseIT\HCSF\Customer\Helper::getUserData();
         $aP["enable_module_customer"] = true;
     }
     if (HelperConfig::$core["enable_module_shop"]) {
         $aP["currency"] = HelperConfig::$shop["waehrungssymbol"];
         $aP["orderamounts"] = HelperConfig::$shop["orderamounts"];
         if (isset(HelperConfig::$shop["vat"]["full"])) {
             $aP["vatfull"] = HelperConfig::$shop["vat"]["full"];
         }
         if (isset(HelperConfig::$shop["vat"]["reduced"])) {
             $aP["vatreduced"] = HelperConfig::$shop["vat"]["reduced"];
         }
         if (isset(HelperConfig::$shop["custom_order_fields"])) {
             $aP["custom_order_fields"] = HelperConfig::$shop["custom_order_fields"];
         }
         $aP["enable_module_shop"] = true;
     }
     if (isset($P->cb_key)) {
         $aP["path"] = pathinfo($P->cb_key);
     } else {
         $aP["path"] = pathinfo($aP["requesturi"]);
     }
     if ($P->cb_customcontenttemplate != NULL) {
         $aP["customcontenttemplate"] = $P->cb_customcontenttemplate;
     }
     if ($P->cb_customdata != NULL) {
         $aP["customdata"] = $P->cb_customdata;
     }
     if (isset($_SERVER["HTTP_REFERER"])) {
         $aP["referer"] = $_SERVER["HTTP_REFERER"];
     }
     // if there is no subnav defined but there is a default subnav defined, use it
     // subnavkey can be used in the templates to find out, where we are
     if ((!isset($aP["subnavkey"]) || $aP["subnavkey"] == '') && HelperConfig::$core["subnav_default"] != '') {
         $aP["subnavkey"] = HelperConfig::$core["subnav_default"];
         $P->cb_subnav = HelperConfig::$core["subnav_default"];
     }
     if ($P->cb_subnav != NULL && isset(HelperConfig::$navigation[$P->cb_subnav])) {
         $aP["subnav"] = HelperConfig::$navigation[$P->cb_subnav];
     }
     // Get page title, meta-keywords, meta-description
     $aP["pagetitle"] = $P->oPayload->getTitle();
     $aP["keywords"] = $P->oPayload->cl_keywords;
     $aP["description"] = $P->oPayload->cl_description;
     // TODO: Add head scripts to DB
     //if (isset($P["head_scripts"]) && $P["head_scripts"] != '') $aP["head_scripts"] = $P["head_scripts"];
     // Shopping cart infos
     if (HelperConfig::$core["enable_module_shop"]) {
         $aP["cartinfo"] = SHelper::getShoppingcartData();
     }
     $aP["countrylist"][] = ' | ';
     foreach (HelperConfig::$countries["countries_" . HelperConfig::$lang] as $sKey => $sValue) {
         $aP["countrylist"][] = $sKey . '|' . $sValue;
     }
     if (HelperConfig::$core["enable_module_shop"] && ($aP["pagetype"] == 'itemoverview' || $aP["pagetype"] == 'itemoverviewgrpd' || $aP["pagetype"] == 'itemdetail')) {
         $aP = SHelper::handleItemPage($serviceManager, $P, $aP);
     }
     $aP["content"] = $P->oPayload->cl_html;
     $aP["content"] = str_replace("@", "&#064;", $aP["content"]);
     // Change @ to HTML Entity -> maybe less spam mails
     $aP['lang_available'] = HelperConfig::$core['lang_available'];
     $aP['lang_detection_method'] = HelperConfig::$core['lang_detection_method'];
     $aP['lang_by_domain'] = HelperConfig::$core['lang_by_domain'];
     if (HelperConfig::$core['debug']) {
         self::getDebug($aP, $P);
         $aP["debugdata"] = Tools::$sDebug;
     }
     return $aP;
 }
Exemplo n.º 10
0
 /**
  *
  */
 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;
 }
Exemplo n.º 11
0
 /**
  * @param $sReply
  * @param array $aMore
  */
 private function replyToCartUpdate($sReply, $aMore = [])
 {
     if (isset($_REQUEST["ajax"])) {
         $aAR = ['cart' => $_SESSION["cart"], 'reply' => $sReply, 'cartsums' => \HaaseIT\HCSF\Shop\Helper::calculateCartItems($_SESSION["cart"]), 'currency' => HelperConfig::$shop["waehrungssymbol"], 'numberformat_decimals' => HelperConfig::$core['numberformat_decimals'], 'numberformat_decimal_point' => HelperConfig::$core['numberformat_decimal_point'], 'numberformat_thousands_seperator' => HelperConfig::$core['numberformat_thousands_seperator']];
         if (count($aMore)) {
             $aAR = array_merge($aAR, $aMore);
         }
         echo $this->serviceManager->get('twig')->render('shop/update-cart.twig', $aAR);
     } else {
         $aMSG["msg"] = $sReply;
         if (count($aMore)) {
             $aMSG = array_merge($aMSG, $aMore);
         }
         header('Location: ' . \HaaseIT\Tools::makeLinkHRefWithAddedGetVars($_SERVER["HTTP_REFERER"], $aMSG, true, false));
     }
     die;
 }
Exemplo n.º 12
0
 /**
  * @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);
 }