예제 #1
0
파일: gouf.php 프로젝트: 4otaku/4otaku
 public function __construct()
 {
     parent::__construct();
     $this->per_page = sets::pp('post_gouf');
     $sorter = new Database_Sorter('overall');
     $this->sorters[] = $sorter;
 }
예제 #2
0
파일: comment.php 프로젝트: 4otaku/4otaku
 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'))));
 }
예제 #3
0
파일: check.php 프로젝트: 4otaku/4otaku
	public static function rights($soft = false) {
		if (sets::user('rights')) {
			return true;
		}

		if ($soft) {
			return false;
		}

		die;
	}
예제 #4
0
파일: abstract.php 프로젝트: 4otaku/4otaku
 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;
 }
예제 #5
0
파일: video.php 프로젝트: 4otaku/4otaku
 public function set_sizes($sizes, $height = false)
 {
     if (!empty($height) && is_numeric($sizes)) {
         $sizes = array($sizes, $height);
     }
     if (!is_array($sizes)) {
         $sizes = explode('x', sets::video($sizes));
     }
     $this->width = $sizes[0];
     $this->height = $sizes[1];
     return $this;
 }
예제 #6
0
파일: box.php 프로젝트: 4otaku/4otaku
	function plugins () {

		$plugins = Database::get_full_vector('plugin');

		$used = sets::array_get('plugins');

		foreach ($plugins as $id => &$plugin) {
			$plugin['on'] = !empty($used[$id]);
		}

		return $plugins;
	}
예제 #7
0
파일: news.php 프로젝트: 4otaku/4otaku
 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');
     }
 }
예제 #8
0
파일: abstract.php 프로젝트: 4otaku/4otaku
 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;
 }
예제 #9
0
파일: video.php 프로젝트: 4otaku/4otaku
 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;
 }
예제 #10
0
파일: head.php 프로젝트: 4otaku/4otaku
	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,
		);
	}
예제 #11
0
 public function set($key, $value = null)
 {
     parent::set($key, $value);
     if (in_array($key, $this->meta_fields)) {
         $meta = (array) $this->get('meta', true);
         if (is_string($value)) {
             $value = array_unique(array_filter(explode('|', $value)));
         }
         $meta[$key] = array();
         foreach ((array) $value as $item) {
             $meta[$key][$item] = array();
         }
         parent::set('meta', $meta);
         if ($key == 'category' && !sets::show('nsfw')) {
             if (in_array($this->nsfw_category, $value)) {
                 $this->set('hidden', true);
             }
         }
     }
     return $this;
 }
예제 #12
0
파일: def.php 프로젝트: 4otaku/4otaku
	static function get($name, $key = false, $sets_retrieve = true) {
		if ($key === false) {
			return self::array_get($name);
		}

		if (isset(self::$data[$name][$key])) {
			return self::$data[$name][$key];
		}

		// Если внезапно нужной настройки не оказалось, последние меры умирающего.
		if (empty(self::$data)) {
			include ROOT_DIR.SL.'engine'.SL.'config.php';
			self::import($def);
			if (isset($def[$name][$key])) {
				return $def[$name][$key];
			}
		}

		if ($sets_retrieve && ($sets = sets::get($name,$key,false))) {
//			return $sets;
		}

		return null;
	}
예제 #13
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']));
 }
예제 #14
0
파일: board.php 프로젝트: 4otaku/4otaku
?>
>5</option>
	<option value="7"<?php 
echo sets::pp('board_posts') == 7 ? ' selected="yes"' : '';
?>
>7</option>
	<option value="10"<?php 
echo sets::pp('board_posts') == 10 ? ' selected="yes"' : '';
?>
>10</option>
	<option value="15"<?php 
echo sets::pp('board_posts') == 15 ? ' selected="yes"' : '';
?>
>15</option>
	<option value="20"<?php 
echo sets::pp('board_posts') == 20 ? ' selected="yes"' : '';
?>
>20</option>
</select>
<br />
Все треды на главной: 
<input type="checkbox" class="settings" rel="board.allthreads" value="1"<?php 
echo sets::board('allthreads') ? ' checked' : '';
?>
>
<br />
Сразу показывать видео: 
<input type="checkbox" class="settings" rel="board.embedvideo" value="1"<?php 
echo sets::board('embedvideo') ? ' checked' : '';
?>
>
예제 #15
0
파일: art.php 프로젝트: 4otaku/4otaku
			<tr>
				<td colspan="2" id="is_dublicates">

				</td>
			</tr>
			<tr id="transparent" class="art_images">
				<td colspan="2">

				</td>
			</tr>
			<tr>
				<td class="input field_name">
					Теги
				</td>
				<td class="inputdata input_tags">
					<? if (!sets::edit('newtags')) { ?>
						<input size="65%" name="tags" value="" type="text">
					<? } else { ?>
						<div id="add_tags">
							<div class="tags-loader">
								<img src="/images/ajax-loader.gif" />
							</div>
							<select data-placeholder=" "
								 multiple
								 id="chozen"
								 name="tag[]">
							</select>
						</div>
					<? } ?>
				</td>
			</tr>
예제 #16
0
파일: edit.php 프로젝트: 4otaku/4otaku
	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']));
		}
	}
예제 #17
0
파일: art.php 프로젝트: 4otaku/4otaku
    function get_data()
    {
        if ($this->template != 'slideshow') {
            global $url;
            global $error;
            global $sets;
            global $def;
            if (is_numeric($url[2])) {
                $return['display'] = array('booru_single', 'comments');
                $return['art'] = $this->get_art(1, 'id=' . $url[2] . ' and area != "deleted"');
                $url['area'] = $return['art'][0]['area'];
                $return['comments'] = $this->get_comments($url[1], $url[2], is_numeric($url[5]) ? $url[5] : ($url[4] == 'all' ? false : 1));
                $return['navi']['curr'] = $url[4] == 'all' ? 'all' : max(1, $url[5]);
                $return['navi']['all'] = true;
                $return['navi']['name'] = "Страница комментариев";
                $return['navi']['meta'] = $url[2] . '/comments/';
                $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                $return['navi']['last'] = ceil($return['comments']['number'] / $sets['pp']['comment_in_post']);
                $this->side_modules['top'] = array();
                $return['art'][0]['rating'] = $this->get_rating($url[2]);
                $return['art'][0]['packs'] = $this->get_packs($url[2]);
                $return['art'][0]['pool'] = $this->get_pools($url[2]);
            } elseif ($url[2] != 'pool' && $url[2] != 'cg_packs' && $url[2] != 'download') {
                $return['display'] = array('booru_page', 'navi');
                if ($url[2] == 'page' || !$url[2]) {
                    $area = 'area = "' . $url['area'] . '"';
                    $return['navi']['curr'] = max(1, $url[3]);
                    if ($sets['art']['sort'] == 'tag-desc') {
                        $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area, 'order by (length(tag) - length(replace(tag,\'|\',\'\'))) desc');
                    } elseif ($sets['art']['sort'] == 'tag-asc') {
                        $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area, 'order by (length(tag) - length(replace(tag,\'|\',\'\')))');
                    } else {
                        $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area);
                    }
                } elseif ($url[2] == 'date') {
                    $parts = explode('-', $url[3]);
                    if (is_numeric($parts[0] . $parts[1] . $parts[2]) && count($parts) == 3) {
                        $area = 'area = "' . $url['area'] . '" and pretty_date ="' . Transform_Time::ru_month($parts[1]) . ' ' . $parts[2] . ', ' . $parts[0] . '"';
                        $return['navi']['curr'] = max(1, $url[5]);
                        $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area);
                        $return['navi']['meta'] = $url[2] . '/' . $url[3] . '/';
                    } else {
                        $error = true;
                    }
                } elseif ($url[2] != 'mixed') {
                    $this->mixed_parse($url[2] . '=' . $url[3]);
                    $area = 'area = "' . $url['area'] . '" and locate("|' . ($url['tag'] ? $url['tag'] : mysql_real_escape_string($url[3])) . '|",art.' . $url[2] . ')';
                    $return['navi']['curr'] = max(1, $url[5]);
                    $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area);
                    $return['navi']['meta'] = $url[2] . '/' . $url[3] . '/';
                    $return['rss'] = $this->make_rss($url[1], $url[2], $url[3]);
                } else {
                    $area = $this->mixed_make_sql($this->mixed_parse($url[3]));
                    $return['navi']['curr'] = max(1, $url[5]);
                    $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], $area);
                    $return['navi']['meta'] = $url[2] . '/' . $url[3] . '/';
                }
                $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                $return['navi']['last'] = ceil(obj::db()->sql('select count(id) from art where (' . $area . ')', 2) / $sets['pp']['art']);
            } else {
                if ($url[2] == 'pool') {
                    if (is_numeric($url[3])) {
                        if ($url[4] != 'sort') {
                            $return['display'] = array('booru_poolsingle', 'booru_page', 'navi');
                        } else {
                            $return['display'] = array('booru_poolsingle', 'booru_page');
                        }
                        $return['pool'] = Database::get_full_row('art_pool', $url[3]);
                        $query = Database::set_counter()->order('order', 'asc');
                        if ($url[4] != 'sort') {
                            $return['navi']['curr'] = max(1, $url[5]);
                            $return['navi']['meta'] = $url[2] . '/' . $url[3] . '/';
                            $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                            $query->limit(sets::pp('art'), ($return['navi']['curr'] - 1) * sets::pp('art'));
                        }
                        $pool = $query->get_vector('art_in_pool', 'art_id', 'pool_id = ?', $url[3]);
                        $return['pool']['count'] = Database::get_counter();
                        if ($url[4] != 'sort') {
                            $return['navi']['last'] = ceil($return['pool']['count'] / $sets['pp']['art']);
                        }
                        $where = 'id=' . implode(' or id=', $pool);
                        $pool = array_flip($pool);
                        if ($art = $this->get_art(false, $where, '')) {
                            foreach ($art as $one) {
                                $return['art']['thumbs'][$pool[$one['id']]] = $one;
                            }
                            ksort($return['art']['thumbs']);
                        }
                        $return['rss'] = $this->make_rss($url[1], $url[2], $url[3]);
                    } else {
                        $return['display'] = array('booru_poolpage', 'navi');
                        $return['navi']['curr'] = max(1, $url[4]);
                        $return['navi']['meta'] = $url[2] . '/';
                        $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                        $return['navi']['last'] = ceil(obj::db()->sql('select count(id) from art_pool', 2) / $sets['pp']['art_pool']);
                        $return['pools'] = obj::db()->sql('
							select p.id as id, p.name as name, count(*) as count
							from art_pool as p left join art_in_pool as a on p.id = a.pool_id
							group by p.id order by p.sortdate desc
							limit ' . ($return['navi']['curr'] - 1) * $sets['pp']['art_pool'] . ', ' . $sets['pp']['art_pool'], 'id');
                    }
                } elseif ($url[2] == 'cg_packs') {
                    $this->side_modules['top'] = array();
                    if (is_numeric($url[3])) {
                        $return['display'] = array('booru_pack_single', 'booru_page', 'navi');
                        $return['navi']['curr'] = max(1, $url[5]);
                        $return['navi']['meta'] = $url[2] . '/' . $url[3] . '/';
                        $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                        $return['navi']['last'] = ceil(obj::db()->sql('select count(*) from art_in_pack where pack_id=' . $url[3], 2) / $sets['pp']['art']);
                        $return['pool'] = obj::db()->sql('select * from art_pack where id=' . $url[3], 1);
                        $return['art']['thumbs'] = $this->get_art(($return['navi']['curr'] - 1) * $sets['pp']['art'] . ', ' . $sets['pp']['art'], 'p.pack_id=' . $url[3], 'order by p.`order`', 'as a left join art_in_pack as p on a.id = p.art_id');
                    } else {
                        $return['display'] = array('booru_pack_list', 'navi');
                        $return['navi']['curr'] = max(1, $url[4]);
                        $return['navi']['meta'] = $url[2] . '/';
                        $return['navi']['start'] = max($return['navi']['curr'] - 5, 2);
                        $return['navi']['last'] = ceil(obj::db()->sql('select count(*) from art_pack where cover != ""', 2) / $sets['pp']['art_cg_pool']);
                        $return['pools'] = obj::db()->sql('select * from art_pack where cover != "" order by `date` desc limit ' . ($return['navi']['curr'] - 1) * $sets['pp']['art_cg_pool'] . ', ' . $sets['pp']['art_cg_pool'], 'id');
                    }
                } else {
                    if ($url[3] == 'pack') {
                        if (empty($url[4]) || !is_numeric($url[4])) {
                            $error = true;
                        } else {
                            if (empty($url[5]) || !is_numeric($url[5])) {
                                $pack = obj::db()->sql("select title, weight from art_pack where id = {$url['4']}", 1);
                                if ($pack['weight'] == 0) {
                                    $error = true;
                                } else {
                                    $this->template = 'download';
                                    $this->side_modules = array();
                                    $name = str_replace(array(' ', ';'), '_', $pack['title']);
                                    $file = ROOT_DIR . SL . 'files' . SL . 'pack_cache' . SL . 'pack_' . $url[4] . '.zip';
                                    return array('file' => $file, 'name' => $name . '.zip');
                                }
                            } else {
                                $this->template = 'download';
                                $this->side_modules = array();
                                $art = obj::db()->sql("\n\t\t\t\t\t\t\t\t\tselect a.md5, a.extension, p.filename\n\t\t\t\t\t\t\t\t\tfrom art as a left join art_in_pack as p on a.id = p.art_id\n\t\t\t\t\t\t\t\t\twhere a.id = {$url['5']} and p.pack_id = {$url['4']}", 1);
                                $file = ROOT_DIR . SL . 'images' . SL . 'booru' . SL . 'full' . SL . $art['md5'] . '.' . $art['extension'];
                                if (pathinfo($file, PATHINFO_EXTENSION) == 'jpg') {
                                    $type = 'jpeg';
                                } else {
                                    $type = pathinfo($file, PATHINFO_EXTENSION);
                                }
                                return array('file' => $file, 'name' => $art['filename'], 'type' => $type);
                            }
                        }
                    } else {
                        $this->template = 'download';
                        $this->side_modules = array();
                        if (pathinfo($url[3], PATHINFO_EXTENSION) == 'jpg') {
                            $type = 'jpeg';
                        } else {
                            $type = pathinfo($url[3], PATHINFO_EXTENSION);
                        }
                        return array('file' => ROOT_DIR . SL . 'images' . SL . 'booru' . SL . 'full' . SL . $url[3], 'name' => $url[3], 'type' => $type);
                    }
                }
            }
            $return['navi']['base'] = '/art' . ($url['area'] != $def['area'][0] ? '/' . $url['area'] : '') . '/';
            return $return;
        }
    }
예제 #18
0
								?>
									<td class="imageholder">
										<div class="image-0">
											<img src="<?php 
echo $block['image'];
?>
" />
										</div>
									</td>
								<?
							}
						?>						
						<td valign="top">
							<?php 
echo $block['comment_count'] > $sets['pp']['comment_in_post'] ? '<p class="help">
									Показываются только ' . $sets['pp']['comment_in_post'] . ' последних ' . obj::transform('text')->wcase(sets::pp('comment_in_post'), 'комментарий', 'комментария', 'комментариев') . '. 
									<a href="' . $def['site']['dir'] . '/' . $block['place'] . '/' . $block['id'] . '/comments/all">
										Читать все
									</a>.
								</p>' : '';
?>
							<?	
								$i = $block['comment_count'];
								foreach ($block['comments'] as $comment) { 
									$i--; 
									if ($i < $sets['pp']['comment_in_post']) {
										?>
											<div class="comment" id="comment-<?php 
echo $comment['id'];
?>
"<?php 
예제 #19
0
파일: head.php 프로젝트: 4otaku/4otaku
	<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>
예제 #20
0
파일: subscribe.php 프로젝트: 4otaku/4otaku
<h2 class="commentsh2">
	Подписаться на комментарии.
</h2>
<form method="post" enctype="multipart/form-data">
	E-mail: <input name="email" value="<?php 
echo sets::get('user', 'mail');
?>
" size="22" type="text" />
	<br /><br />
	<select name="rule_type" class="subscribe_type">
		<option value="all" class="selected">Подписаться на все</option>
		<option value="author">Подписаться на автора</option>
		<option value="category">Подписаться на категорию</option>
		<option value="language">Подписаться на язык</option>
	</select> 
	<span class="subscribe_author subscribe_field hidden">
		<select>
			<? 
				foreach($data['main']['author'] as $alias => $name) {
					?>
						<option value="<?php 
echo $alias;
?>
"><?php 
echo $name;
?>
</option>
					<?
				}
			?>
		</select>
예제 #21
0
파일: board.php 프로젝트: 4otaku/4otaku
	function get_threads($condition = '', $limit = '') {
		$return = $this->get_thread_records($condition, $limit);

		if (is_array($return)) {
			$keys = 'thread='.implode(' or thread=', array_keys($return));
			$posts = obj::db()->sql('select * from board where `type`="post" and ('.$keys.')');

			if (is_array($posts)) {
				foreach ($posts as $post) {
					$return[$post['thread']]['posts'][$post['id']] = $post;
				}

				foreach ($return as $key => $thread) {

					if (!empty($thread['posts'])) {
						list($total_images, $total_flash, $total_video) = $this->process_content($thread['posts']);
						$total = count($thread['posts']);
						krsort($thread['posts']);
						$thread['posts'] = array_slice($thread['posts'],0,sets::pp('board_posts'));
						list($images, $flash, $video) = $this->count_content($thread['posts']);
						$return[$key]['posts'] = array_reverse($thread['posts']);
						$return[$key]['skipped'] = array(
							'images' => ($total_images - $images),
							'flash' => ($total_flash - $flash),
							'video' => ($total_video - $video),
							'posts' => ($total - count($thread['posts'])),
						);
					}
				}
			}
		} else {
			return false;
		}
		$this->build_inner_links($this->inner_links, $return);
		return $return;
	}
예제 #22
0
    // Пробуем прочитать настройки для хэша
    $sess = Database::get_row('settings', array('data', 'lastchange'), 'cookie = ?', query::$cookie);
    // Проверяем полученные настройки
    if (isset($sess['data']) && isset($sess['lastchange'])) {
        // Настройки есть
        // Обновляем cookie еще на 2 мес у клиента, если она поставлена больше месяца назад
        if (intval($sess['lastchange']) < time() - 3600 * 24 * 30) {
            setcookie('settings', query::$cookie, time() + 3600 * 24 * 60, '/', $cookie_domain);
            // Фиксируем факт обновления в БД
            Database::update('settings', array('lastchange' => time()), 'cookie = ?', query::$cookie);
        }
        // Проверяем валидность настроек и исправляем, если что-то не так
        if (base64_decode($sess['data']) !== false && is_array(unserialize(base64_decode($sess['data'])))) {
            // Все ок, применяем сохраненные настройки
            $sets = array_replace_recursive($sets, unserialize(base64_decode($sess['data'])));
            $user = Database::get_row('user', 'login, email, rights', 'cookie = ?', query::$cookie);
            if (!empty($user)) {
                $sets['user'] = array_replace($sets['user'], $user);
            }
            sets::import($sets);
        } else {
            // Заполняем поле настройками 'по-умолчанию' (YTowOnt9 разворачивается в пустой массив)
            Database::update('settings', array('data' => 'YTowOnt9'), 'cookie = ?', query::$cookie);
        }
    } else {
        // Настроек нет, создаем их
        setcookie('settings', query::$cookie, time() + 3600 * 24 * 60, '/', $cookie_domain);
        // Вносим в БД сессию с дефолтными настройками
        Database::insert('settings', array('cookie' => query::$cookie, 'data' => 'YTowOnt9', 'lastchange' => time()));
    }
}
예제 #23
0
파일: overview.php 프로젝트: 4otaku/4otaku
		</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'];
?>
예제 #24
0
?>
			</a>
		<? } ?>
	</span>
	<span class="date">
		<?php 
echo $thread['pretty_date'];
?>
	</span>
	<div class="tbody<?php 
echo empty($thread['multi_content']) ? '' : ' multi';
?>
">
		<? if (!empty($thread['content']['video'])) {
			foreach ($thread['content']['video'] as $video_key => $video) { ?>
				<? if (!sets::board('embedvideo')) { ?>
					<div class="video video_frame" style="height:<?php 
echo $video['height'];
?>
px;">
						<br />
						<input type="button" class="open_video margin10" rel="<?php 
echo $id . '-' . $video_key;
?>
" value="Показать видео">
						<br />
						<input type="button" class="always_embed_video" value="Всегда показывать">
					</div>
				<? } else { ?>
					<div class="video">
						<?php 
예제 #25
0
파일: switcher.php 프로젝트: 4otaku/4otaku
<div class="center margin10" width="100%">
	<? if(!sets::get('board','allthreads')) { ?>
		<a href="#" class="switch_allboards" rel="1">
			Убрать приветствие, показывать тут ленту всех тредов.
		</a>
	<? } else { ?>
		<a href="#" class="switch_allboards" rel="0">
			Убрать ленту всех тредов, показывать тут приветствие.
		</a>	
	<? } ?>
</div>