Exemple #1
0
 public static function upload()
 {
     if (!($me = session_essence::get('me'))) {
         request_essence::load_request();
     }
     $validation = self::validate_upload();
     if ($validation->valid()) {
         $uploaded_file = data_essence::get('files', 'file-file');
         $uploaded_file_extension_array = split('\\.', $uploaded_file['name']);
         $uploaded_file_extension = sizeof($uploaded_file_extension_array) > 1 ? end($uploaded_file_extension_array) : '';
         $uploaded_file_name = md5(time()) . '.' . $uploaded_file_extension;
         $uploaded_file_url = config_essence::get('root_url') . 'application/resource/upload/' . md5($me->get_login()) . '/';
         $uploaded_file_dir = config_essence::get('root_dir') . 'application/resource/upload/' . md5($me->get_login()) . '/';
         if (!is_dir($uploaded_file_dir)) {
             mkdir($uploaded_file_dir, 0777);
         }
         move_uploaded_file($uploaded_file['tmp_name'], $uploaded_file_dir . $uploaded_file_name);
         $file = new file_object();
         $file->set_name($uploaded_file_name);
         $file->set_origin_name($uploaded_file['name']);
         $file->set_header(data_essence::get('post', 'file-header', array('trim', 'striptags')));
         $file->set_content(data_essence::get('post', 'file-content', array('trim', 'striptags')));
         $file->set_user_agent(data_essence::get('server', 'HTTP_USER_AGENT'));
         $file->set_user_ip(data_essence::get('server', 'REMOTE_ADDR'));
         $file->set_user_id($me->get_id());
         if ($file_id = file_model::add_file($file)) {
             request_essence::load_request('user', 'view', array($me->get_login()));
         }
     }
     view_essence::assign('breadcrumb', 'Загрузка файла');
     view_essence::assign('validation', $validation);
     view_essence::display('file/upload');
 }
Exemple #2
0
 public static function clear_cache($names)
 {
     if (config_essence::get('enable_cache', 'chache')) {
         foreach ($names as $name) {
             @unlink(config_essence::get('root_dir') . 'application/resource/cache/' . md5($name));
         }
     }
 }
Exemple #3
0
 public static function fetch($resource_name, $path = 'application/view/template/')
 {
     /* Extract variables */
     extract(self::$variables, EXTR_OVERWRITE);
     /* Fetch template */
     if (is_file(config_essence::get('root_dir') . $path . $resource_name . '.php')) {
         ob_start();
         include_once config_essence::get('root_dir') . $path . $resource_name . '.php';
         return ob_get_clean();
     } else {
         trigger_error('File ' . config_essence::get('root_dir') . $path . $resource_name . '.php' . ' does not exist');
     }
 }
Exemple #4
0
 public static function init()
 {
     if (config_essence::get('host', 'database') and config_essence::get('user', 'database') and config_essence::get('name', 'database')) {
         self::$db = mysql_connect(config_essence::get('host', 'database'), config_essence::get('user', 'database'), config_essence::get('password', 'database'));
         if (self::$db) {
             if (mysql_select_db(config_essence::get('name', 'database'))) {
                 mysql_query("set character_set_client='utf8'");
                 mysql_query("set character_set_results='utf8'");
                 mysql_query("set collation_connection='utf8_general_ci'");
                 return true;
             }
         }
     }
     return false;
 }
Exemple #5
0
 public static function init($type)
 {
     /* Run application filter */
     if (config_essence::get('enable_' . $type . '_filter', 'filter')) {
         if (class_exists($type . '_filter_application')) {
             if (method_exists($type . '_filter_application', 'run')) {
                 call_user_func_array(array($type . '_filter_application', 'run'), array());
             } else {
                 trigger_error('Method run of filter class ' . $type . '_filter_application does not exist');
             }
         } else {
             trigger_error('Filter class ' . $type . '_filter_application does not exist');
         }
     }
 }
Exemple #6
0
 public static function debug($errno, $errstr, $errfile, $errline)
 {
     /* Show error */
     if (config_essence::get('show_errors', 'error')) {
         view_essence::assign('errno', $errno);
         view_essence::assign('errstr', $errstr);
         view_essence::assign('errfile', $errfile);
         view_essence::assign('errline', $errline);
         view_essence::display('debug', 'framework/template/');
     }
     /* Log error */
     if (config_essence::get('log_errors', 'error')) {
         file_put_contents('errors.txt', @file_get_contents('errors.txt') . date("Y-m-d H:i:s") . "\r\n" . 'Error: ' . $errno . "\r\n" . 'Message: ' . $errstr . "\r\n" . 'File: ' . $errfile . "\r\n" . 'Line: ' . $errline . "\r\n\r\n");
     }
     /* Return true to disable default error handler */
     return true;
 }
Exemple #7
0
?>
" />
												
												<span class="validation"><?php 
echo $validation->get('authorization-contact-icq');
?>
</span>
												
											</td>
											
										</tr>
										
										<tr>
											
											<td colspan="2" class="control">
												
												<input type="submit" class="button" name="authorization-submit" value="Изменить профиль" />
												
											</td>
											
										</tr>
																				
									</table>
									
								</form>
								
							</div>
							
<?php 
include config_essence::get('root_dir') . 'application/view/template/index/footer.php';
Exemple #8
0
 public static function load_request($request_action = '', $request_method = '', $request_params = array())
 {
     $url = config_essence::get('root_url');
     if ($request_action && $request_method) {
         $url .= $request_action . '/' . $request_method . '/' . (sizeof($request_params) > 0 ? join('/', $request_params) : '');
     }
     header('location: ' . $url);
 }
Exemple #9
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

	<head>
	
		<base href="<?php 
echo config_essence::get('root_url');
?>
" />
		
		<title>Onliner</title>
		
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		
		<link rel="stylesheet" type="text/css" href="application/view/css/styles.css" />
		
		<script type="text/javascript" language="javascript" src="application/view/javascript/jquery.js"></script>
		
		<script type="text/javascript" language="javascript" src="application/view/javascript/scripts.js"></script>
		
	</head>
	
	<body>
		
		<div class="page">
		
			<div class="page-block block-header">
				
				<table cellspacing="0px" cellpadding="0px" border="0px" width="100%">
					
Exemple #10
0
<?php

/* Onliner Test */
/* Version 1.0 */
/* 1. Initialize error handler */
error_essence::init();
/* 2. Initialize session manager */
session_essence::init();
/* 3. Initilize configuration */
config_essence::init();
/* 4. Initialize request */
request_essence::init();
/* 5. Initialize pre filter */
filter_essence::init('pre');
/* 6. Initialize action */
action_essence::init();
/* 7. Initialize post filter */
filter_essence::init('post');
Exemple #11
0
 public function get_delete_url()
 {
     return config_essence::get('root_url') . 'file/delete/' . $this->get_id();
 }
Exemple #12
0
 public function get_reply_url()
 {
     return config_essence::get('root_url') . 'file/add_comment/' . $this->get_file_id() . '/' . $this->get_id();
 }
Exemple #13
0
 public function get_url()
 {
     return config_essence::get('root_url') . 'user/view/' . $this->get_login() . '/';
 }