Exemplo n.º 1
0
 public function order_request($params = [])
 {
     $quote = Quote::read_by_params($params);
     if (!isset($quote['id'])) {
         Render::error_404();
     }
     $order = $params;
     $order += $quote;
     $order['country'] = Util::get_countries()[$order['country']];
     $order['payment'] = Util::get_payments()[$order['payment']];
     if (!isset($order['po'])) {
         $order['po'] = '';
     }
     $body = Template::render_doc_by_name('order-email', $order);
     // send order request to "WinWrap Web Primary/web.primary@winwrap.com"
     $linkc = 'https://www.winwrap.com/web/basic/support/admin/new_company.asp' . '?license=16' . '&company=' . urlencode($order['company']) . '&country=' . urlencode($order['country']) . '&billingaddress=' . urlencode(str_replace("\r\n", '|', $order['address'])) . '&billingname=' . urlencode($order['billing_name']) . '&billingaddr=' . urlencode($order['billing_email']) . '&billingphone=' . urlencode($order['billing_phone']) . '&name=' . urlencode($order['technical_name']) . '&addr=' . urlencode($order['technical_email']);
     $link = 'https://www.winwrap.com/web/basic/support/admin/new_fees.asp' . '?licenseid=' . '&company=' . urlencode($order['company']) . '&feecount=0' . '&payment=' . urlencode($order['payment']) . '&po=' . urlencode($order['po']);
     if (!is_null($quote['discount'])) {
         $link .= '&WWXX00=' . urlencode($quote['discount']) . '&WWXX00_DESC=' . urlencode($quote['discount_desc']);
     }
     $problem = false;
     $parts = [];
     foreach ($quote['items'] as $item) {
         $link .= '&' . $item['part'] . '=' . $item['quantity'];
         $part = substr($item['part'], 0, 6);
         if (array_search($part, $parts)) {
             $problem = true;
         } else {
             $parts[] = $part;
         }
         if (isset($item['override'])) {
             $link .= '&' . $part . '-override=' . $item['override'];
         }
     }
     $bodyc = '1) Click on this link to create the new company:' . "\r\n" . $linkc . "\r\n\r\n";
     if ($problem) {
         $bodyc .= '*** the following link will not create the correct fees ***' . "\r\n";
     }
     $bodyc .= '2) Click on this link to create the fees and invoice:' . "\r\n" . $link . "\r\n\r\n" . $body;
     $args = ['IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n\r\n" . 'toname' => 'WinWrap Web Primary', 'toemail' => '*****@*****.**', 'fromname' => 'WinWrap Web Primary', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $bodyc];
     if (GoogleMail::send($args) !== true) {
         header('Status: 500');
         return;
     }
     $status = '1/2: send to ' . $args['toemail'] . "\r\n";
     //echo '<pre>' . $body . '</pre>'; exit;
     // send order request to puchaser
     $args = ['toname' => $order['billing_name'], 'toemail' => $order['billing_email'], 'fromname' => 'WinWrap Support', 'fromemail' => '*****@*****.**', 'subject' => 'WinWrap Basic Order Request', 'body' => $body];
     if (GoogleMail::send($args) !== true) {
         header('Status: 500');
         return;
     }
     $status .= '2/2: send to ' . $args['toemail'];
     Render::text($status);
 }
Exemplo n.º 2
0
 public static function permit_admin()
 {
     if (!self::is_admin()) {
         Render::error_404();
     }
 }
Exemplo n.º 3
0
<?php

// Route resolver
// Load configs
require_once '../../config/config.inc.php';
ContentProcessor::pre();
Session::start();
SiteStructure::initialize();
Router::initialize();
Render::initialize();
// Resolve the incoming request
$parsed_request = Router::resolve($_SERVER['REQUEST_METHOD'], SiteStructure::get_request_uri());
if ($parsed_request) {
    Ctrl::process($parsed_request);
} else {
    Render::error_404();
}