private function onPurchase() { if (false !== ($error = GWF_Form::validateCSRF_WeakS())) { return GWF_HTML::error('Purchase GWF Modules', $error) . $this->templatePurchase(); } if (!isset($_POST['mod']) || !is_array($_POST['mod'])) { return $this->module->error('err_select_modules') . $this->templatePurchase(); // return GWF_HTML::err('ERR_GENERAL', array( __FILE__, __LINE__)).$this->templatePurchase(); } $purchased_modules = array(); foreach ($_POST['mod'] as $mname => $yes) { if (isset($this->modules[$mname])) { $purchased_modules[] = $mname; } } if (count($purchased_modules) === 0) { return $this->module->error('err_select_modules') . $this->templatePurchase(); } $designs = GWF_Design::getDesigns(); $purchased_designs = array(); foreach ($_POST['design'] as $dname => $yes) { if (array_key_exists($dname, $designs)) { $purchased_designs[] = $dname; } } $user = GWF_User::getStaticOrGuest(); $userid = GWF_Session::getUserID(); if (false === ($client = GWF_Client::getClient($userid))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templatePurchase(); } $order = new GWF_ClientOrder(array('vsco_uid' => $userid, 'vsco_modules' => implode(',', $purchased_modules), 'vsco_designs' => implode(',', $purchased_designs))); Module_Payment::saveTempOrder($order); $tVars = array('order' => Module_Payment::displayOrderS($this->module, $order, $user)); return $this->module->template('order.tpl', $tVars); }
private function templatePay(GWF_Download $dl) { if (false === ($mod_pay = GWF_Module::getModule('Payment'))) { return GWF_HTML::err('ERR_MODULE_MISSING', array('Payment')); } $user = GWF_User::getStaticOrGuest(); $form = $this->getTokenForm($dl); $tVars = array('form' => $form->templateX($this->module->lang('ft_token')), 'order' => Module_Payment::displayOrderS($this->module, $dl, $user)); return $this->module->templatePHP('paid_content.php', $tVars); }