Beispiel #1
0
 public function __construct($data = array())
 {
     parent::__construct($data);
     $this->set('comment_rights', sets::user('rights') || $this->get('cookie') == query::$cookie);
     $this->set('text', Transform_Text::cut_long_words($this->get('text')));
     $this->set('delete_rights', sets::user('rights'));
     $this->set('avatar', md5(strtolower($this->get('email'))));
 }
Beispiel #2
0
 protected function check_access($url)
 {
     if (sets::user('rights') < $this->minimal_rights) {
         return false;
     }
     $function = $this->get_function($url);
     if (array_key_exists($function, $this->url_rights) && sets::user('rights') < $this->function_rights[$function]) {
         return false;
     }
     return true;
 }
Beispiel #3
0
	public static function rights($soft = false) {
		if (sets::user('rights')) {
			return true;
		}

		if ($soft) {
			return false;
		}

		die;
	}
Beispiel #4
0
 protected function get_items()
 {
     $items = $this->load_batch('news');
     foreach ($items as $id => &$item) {
         $item['id'] = $id;
         $item = new Model_News($item);
         if ($this->area == 'workshop' || sets::user('rights')) {
             $item['is_editable'] = true;
         }
     }
     $this->load_meta($items);
     $this->data['items'] = $items;
     if ($this->count > $this->per_page) {
         $this->data['navi'] = $this->get_bottom_navi('news');
     }
 }
Beispiel #5
0
 public function check_access($function)
 {
     $data = $this->reader->get_data();
     if (sets::user('rights') < $this->minimal_rights) {
         return false;
     }
     if (array_key_exists($function, $this->function_rights) && sets::user('rights') < $this->function_rights[$function]) {
         return false;
     }
     foreach ($data as $key => $item) {
         if (array_key_exists($key, $this->field_rights) && sets::user('rights') < $this->field_rights[$key]) {
             return false;
         }
     }
     return true;
 }
Beispiel #6
0
 public function __construct($reader, $writer)
 {
     parent::__construct($reader, $writer);
     $data = $this->reader->get_data();
     if (empty($data['id']) || !Check::id($data['id'])) {
         throw new Error_Update('Incorrect Id');
     }
     $model = new Model_Video($data['id']);
     $model->load();
     if ($model->is_phantom()) {
         throw new Error_Update('Incorrect Id');
     }
     if ($model['area'] != 'workshop' && !sets::user('rights')) {
         throw new Error_Update('Not enough rights');
     }
     $this->model = $model;
 }
Beispiel #7
0
	protected function get_jss_data($files, $admin_files) {
		$admin_files = (array) $admin_files;

		if (sets::user('rights')) {
			$files = array_merge($files, $admin_files);
		}

		$a = microtime(true);
		$mtime = 0;
		foreach ($files as $file) {
			$path = ROOT_DIR.SL.'jss'.SL.$file;

			$mtime = max($mtime, filemtime($path));
		}

		return array(
			'list' => $files,
			'date' => $mtime,
		);
	}
Beispiel #8
0
 protected function log_version()
 {
     Database::insert('versions', array('type' => $this->table, 'item_id' => $this->get_id(), 'data' => base64_encode(serialize($this->get_data())), 'time' => $this->get('sortdate'), 'author' => sets::user('name'), 'ip' => $_SERVER['REMOTE_ADDR']));
 }
Beispiel #9
0
	<title><?php 
echo $data['head']['title'];
?>
</title>
	<link rel="stylesheet" href="<?php 
echo $def['site']['dir'];
?>
/jss/m/?b=jss&f=plugins.css,main.css,header.css<?php 
echo sets::user('rights') ? ',admin.css' : '';
?>
&ver=23" type="text/css" media="screen" />
	<script type="text/javascript" src="<?php 
echo $def['site']['dir'];
?>
/jss/config.js"></script>
	<script type="text/javascript" src="<?php 
echo $def['site']['dir'];
?>
/jss/m/?b=jss&f=lock.js,jquery-1.6.2.min.js,plugins.js,main.js
		<?php 
echo sets::user('rights') ? ',admin.js' : '';
?>
		<?php 
echo sets::plugins(1) ? ',plugin/censor.js' : '';
?>
		<?php 
echo sets::plugins(2) ? ',plugin/hider.js' : '';
?>
		&ver=36"></script>
</head>
Beispiel #10
0
		</table>
	</div>
	<hr />

	<h3 title="За сутки">Новые комментарии (<?php 
echo count($data['main']['comment']);
?>
)</h3>

	<a id="overview_comments" class="slide" href="#">
		<?php 
echo $variations[sets::user('overview_comments')];
?>
	</a>
	<div class="<?php 
echo sets::user('overview_comments') ? 'closed' : '';
?>
">
		<table cellspacing="0" cellpadding="0">
			<tr>
				<th>Автор</th>
				<th>Текст комментария</th>
				<th>Где оставлен</th>
			</tr>
	<?
		if (is_array($data['main']['comment'])) foreach ($data['main']['comment'] as $item) {
	?>
			<tr>
				<td><?php 
echo $item['username'];
?>
Beispiel #11
0
	public function save () {

		if (
			!ctype_alnum(query::$post['type']) ||
			!Check::num(query::$post['id'])
		) {
			return;
		}

		$input = 'input__'.query::$post['type'];
		$func = 'edit_'.query::$post['part'];

		$input = new $input();

		if (query::$post['type'] == 'order') {
			query::$post['type'] = 'orders';
		}

		$old_data = Database::get_full_row(query::$post['type'], query::$post['id']);
		$input->$func();
		$new_data = Database::get_full_row(query::$post['type'], query::$post['id']);

		if ($old_data != $new_data) {

			unset($new_data['id']);
			Database::update('search', array('lastupdate' => 0),
				'place = ? and item_id = ?',
				array(query::$post['type'], query::$post['id']));

			if (query::$post['type'] == 'orders') {
				query::$post['type'] = 'order';
			}

			Database::insert('versions',array(
				'type' => query::$post['type'],
				'item_id' => query::$post['id'],
				'data' => base64_encode(serialize($new_data)),
				'time' => ceil(microtime(true)*1000),
				'author' => sets::user('name'),
				'ip' => $_SERVER['REMOTE_ADDR']));
		}
	}