<?php
/*
* @ServerMon v1.1
* @Developed by Maksa988
* @www.Server-Mon.ru
* @Copyright (C) 2014
*/
 if(!defined('SMON'))
	die('Hacking attempt!');

class Config {
	public function setting($var) {
		global $db;
		$sql = "SELECT * FROM `".$this->cfg('prefix')."settings`";
		$result = $db->query($sql);
		$setting = $result->fetch_assoc();
		return $setting['setting_'.$var];
	}
	
	public function cfg($var){
		global $config;
		return $config[$var];
	}
	
	public function header(){
		$this->data['title'] = $this->setting('title');
		$this->data['description'] = $this->setting('description');
		$this->data['keywords'] = $this->setting('keywords');
		$this->data['theme'] =  '/theme/'.$this->setting('theme').'/';
		$this->model('users');
		if(!empty($_SESSION['user_id'])){
			$user = $this->usersModel->getUser($_SESSION['user_id']);
			if($user['user_client']){
				$this->data['access_download'] = 1;
			} else {
				$this->data['access_download'] = 0;
			}
		} else {
			$this->data['access_download'] = 0;
		}
	}
}