require_once MYSHOP_PATH . 'class/registryfile.php'; @error_reporting(0); $log = ''; $req = 'cmd=_notify-validate'; $slashes = get_magic_quotes_gpc(); foreach ($_POST as $key => $value) { if ($slashes) { $log .= "{$key}=" . stripslashes($value) . "\n"; $value = urlencode(stripslashes($value)); } else { $log .= "{$key}=" . $value . "\n"; $value = urlencode($value); } $req .= "&{$key}={$value}"; } $paypal = new myshop_paypal(myshop_utils::getModuleOption('paypal_test'), myshop_utils::getModuleOption('paypal_email'), myshop_utils::getModuleOption('paypal_money'), true); $url = $paypal->getURL(true); $header = ''; $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) . "\r\n\r\n"; $errno = 0; $errstr = ''; $fp = fsockopen($url, 80, $errno, $errstr, 30); if ($fp) { fputs($fp, "{$header}{$req}"); while (!feof($fp)) { $res = fgets($fp, 1024); if (strcmp($res, "VERIFIED") == 0) { $log .= "VERIFIED\t"; $paypalok = true;
$button_tray = new XoopsFormElementTray('', ''); $submit_btn = new XoopsFormButton('', 'post', _MYSHOP_SAVE, 'submit'); $button_tray->addElement($submit_btn); $sform->addElement($button_tray); $sform = myshop_utils::formMarkRequiredFields($sform); $xoopsTpl->assign('form', $sform->render()); break; case 'paypal': // Validation before sent to paypal if ($h_myshop_caddy->isCartEmpty()) { myshop_utils::redirect(_MYSHOP_CART_IS_EMPTY, MYSHOP_URL, 4); } listCart(); $password = md5(xoops_makepass()); $passwordCancel = md5(xoops_makepass()); $paypal = new myshop_paypal(myshop_utils::getModuleOption('paypal_test'), myshop_utils::getModuleOption('paypal_email'), myshop_utils::getModuleOption('paypal_money'), true, $passwordCancel); $commande = $h_myshop_commands->create(true); $commande->setVars($_POST); $commande->setVar('cmd_uid', $uid); $commande->setVar('cmd_date', date("Y-m-d")); $commande->setVar('cmd_state', MYSHOP_STATE_NOINFORMATION); $commande->setVar('cmd_ip', myshop_utils::IP()); $commande->setVar('cmd_articles_count', count($cartForTemplate)); $commande->setVar('cmd_total', $commandAmountTTC); $commande->setVar('cmd_shipping', $shippingAmount); $commande->setVar('cmd_password', $password); $commande->setVar('cmd_cancel', $passwordCancel); $commande->setVar('cmd_text', implode("\n", $discountsDescription)); $res = $h_myshop_commands->insert($commande, true); if (!$res) { myshop_utils::redirect(_MYSHOP_ERROR10, MYSHOP_URL, 6);