403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/meusitei/public_html/central/Library/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/meusitei/public_html/central/Library/MasterTemplate.php
<?php

class MasterTemplate
{
	var $config;			// Holds our configuration from <configuration.php>
	var $master_html;	// This is the Flexy Engine Compiler Class
	var $output;			// Holds all information that we want to output to the templates
	
	function MasterTemplate()
	{
		// Load Configuration from <configuration.php>
		global $configuration;
		$this->config = $configuration;
		
		// Set Master Template
		$this->master_html = 'master.html';
		
		// Set Standard Output Options
		$this->output['webRoot']				= $this->config['directory_www'];	// Sets a shortcode to access your URL
		$this->output['site_name']			= $this->config['site']['name'];	// Sets the name of the knowledge base (shows in title)
		$this->output['site_logo']			= $this->config['site']['logo'];	// Sets the logo image
		$this->output['administration']	=	null;														// This will hold administration information when you are logged in
		$this->output['breadcrumbs']		= array();												// Holds our breadcrumb navigation
		
		// Set Standard Selects
		$this->output['select']['answer'] = array(
			0 => 'No',
			1 => 'Yes',
		);																															// Creates a simple Yes/No select box

		// Check to see if we need to generate the data objects for the database
		// This needs to be done when we change the database or add new tables/fields/etc
		if($this->config['database']['generate'])
		{
			$this->GenerateDatabase();
		}
		
		// Set Administration Options
		if(isset($_SESSION['administration']))
		{
			// if the session has a setting called administration, then assign it into the output
			$this->output['administration'] = $_SESSION['administration'];
		}
		
		// Gather Navigation Categories
		$this->output['navigation'] = $this->FetchNavigation();
	}
	
	/*
	*	Render Template
	*
	*		This function calls the Flexy Template Engine and renders the master template and calls the outputBody function
	*
	*/
	function RenderTemplate()
	{
		$master = new HTML_Template_Flexy($this->config['flexy']);
		$master->compile($this->master_html);
		$master->outputObject($this);
	}
	
	/*
	*	Fetch Navigation
	*
	*		This function returns an array of all the active categories from our database
	*
	*/
	function FetchNavigation()
	{
		$categories 	= array();
		$category_db	= DB_DataObject::factory('categories');
		
		// Query the categories table
		$category_db->whereAdd('category_active = 1', 'and');
		$category_db->orderBy('category_rank, category_name');
		$category_db->find();
		while($category_db->fetch())	// Loop through the records we find
		{
			// Store that return into an array
			$categories[$category_db->category_id] = $category_db->toArray();
		}
		
		return $categories;
	}
	
	/*
	*	Add Bread Crumb
	*
	*		This function is used to add a bread crumb into the navigation
	*
	*/
	function AddBreadCrumb($name, $link)
	{
		// 
		$this->output['breadcrumbs'][] = array(
			'name' => $name,
			'link' => $link,
			'last'	=> false,
		);
		
		$crumbs = $this->output['breadcrumbs'];
		
		// Is there more than 1 Crumb?
		if(count($crumbs) <= 1)
		{
			$crumbs[0]['last'] = false;
		}
		else
		{
			for($idx = 0; $idx < (count($crumbs) - 1); $idx ++)
			{
				$crumbs[$idx]['last'] = true;
			}
		}
		
		$this->output['breadcrumbs'] = $crumbs;
		
	}
	
	/*
	*	Get Categoru
	*
	*		This function returns the information about a specific category
	*
	*/
	function GetCategory($category_id)
	{
		$category = array();
		
		$category_db = DB_DataObject::factory('categories');
		$category_db->whereAdd('category_id = '. $category_id, 'and');
		$category_db->whereAdd('category_active = 1', 'and');
		if($category_db->find(true))
		{
			$category = $category_db->toArray();
		}
		
		return $category;
	}
	
	/*
	*	Get Articles
	*
	*		This function returns an array of all the articles associated to the category
	*
	*/
	function GetArticles($category_id)
	{
		$articles = array();
		
		$article_db = DB_DataObject::factory('articles');
		$article_db->whereAdd('article_category_id = '. $category_id, 'and');
		$article_db->whereAdd('article_active = 1', 'and');
		$article_db->orderBy('article_rank');
		$article_db->find();
		while($article_db->fetch())
		{
			$articles[] = $article_db->toArray();
		}
		
		return $articles;
	}
	
	/*
	*	Get Article
	*
	*		This function returns an array of the specified article
	*
	*/
	function GetArticle($category_id)
	{
		$article = array();
		
		$article_db = DB_DataObject::factory('articles');
		$article_db->whereAdd('article_id = '. $category_id, 'and');
		$article_db->whereAdd('article_active = 1', 'and');
		if($article_db->find(true))
		{
			$article = $article_db->toArray();
			
			// Find Category
			$article['category'] = $this->GetCategory($article_db->article_category_id);
		}
		
		return $article;
	}
	
	/*
	*	Generate Database
	*
	*		This function is called when the configuration is told to regenerate the database
	*
	*/
	function GenerateDatabase()
	{
		error_log('Generating Database');
		
		DB_DataObject::debugLevel(0);

		$generator = new DB_DataObject_Generator;
		$generator->start();
	}
	
	/*
	*	Save Form Input
	*
	*		This function is used to save the user input (this is for form validation)
	*
	*/
	function SaveFormInput($data)
	{
		$session_key = $this->config['session']['prefix'] .'form_data';
		$_SESSION[$session_key] = $data;
	}
	
	/*
	*	Get Form Data
	*
	*		This function is used to return any saved data that happened because of validation
	*
	*/
	function GetFormData()
	{
		$data = array();
		$session_key = $this->config['session']['prefix'] .'form_data';
				
		if(isset($_SESSION[$session_key]))
		{
			$data = $_SESSION[$session_key];
			unset($_SESSION[$session_key]);
		}
		
		return $data;
	}
	
	/*
	*	PHP PLUGINS
	*/
	
	function redirect($url)
	{
		header('location:'. $url);
		die;
	}
	
	/*
	*	FLEXY TEMPLATE PLUGINS
	*/
	
	function flexy_nl2br($text)
	{
		return nl2br($text);
	}
	
	function generate_select($select_array, $default_value)
	{
		$html = '<option value="">Please Select a Value</option>';
		
		error_log($default_value);
		
		foreach($select_array as $key => $value)
		{
			$selected = $key == $default_value;
			
			$html .= '<option value="'. $key .'"'. ($selected ? ' selected' : '') .'>'. $value .'</option>';
		}
		
		return $html;
	}
	
	
	// http://ca2.php.net/manual/en/function.array-splice.php#92651
	function MoveArrayUp($input,$index)
	{
		$new_array = $input;
		
		if((count($new_array) > $index) && ($index > 0))
		{
    	array_splice($new_array, $index-1, 0, $input[$index]);
      array_splice($new_array, $index+1, 1);
    } 
    
    return $new_array;
	}
	
	// http://ca2.php.net/manual/en/function.array-splice.php#92651
	function MoveArrayDown($input,$index)
	{
  	$new_array = $input;
         
    if(count($new_array) > $index)
    {
    	array_splice($new_array, $index+2, 0, $input[$index]);
      array_splice($new_array, $index, 1);
    } 
    
    return $new_array;
	}
	
	/*
	*	Set SEO
	*
	*		This function is used to set the SEO variables for the page
	*
	*/
	function SetSEO($title, $description, $keywords)
	{
		// Explode our keywords into a string
		$keywords_string = '';
		foreach($keywords as $keyword)
		{
			$keywords_string .= (strlen($keywords_string) > 0 ? ',' : ''). $keyword;
		}
		
		// Strip our Description
		$description = strip_tags($description);
		
		// Set SEO
		$this->output['site_name'] 					.= ' - '. $title;
		$this->output['seo']['description'] = $description;
		$this->output['seo']['keywords'] 		= $keywords_string;
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit