function title() { $url = query::$url; $func = 'title_'.$url[1]; if (method_exists($this, $func) && $return = $this->$func($url)) { return def::site('short_name') . ' ' . $return; } return def::site('name'); }
protected function get_title() { $short = def::site('short_name') . ' '; if (count($this->data['items']) == 1) { $item = reset($this->data['items']); if (empty($item['in_batch'])) { return $short . $item['title']; } } return def::site('name'); }
public function process_actions() { $redirect = null; foreach ($this->actions as $type => $actions) { if ($type == 'redirect') { $redirect = array_pop($actions); } } if ($redirect !== null) { $redirect = 'http://' . def::site('domain') . (empty($redirect) ? $_SERVER["REQUEST_URI"] : $redirect); engine::redirect($redirect); } }
function edit_personal_menu () { $id = (int) query::$get['id']; $return = Database::get_full_row('head_menu_user', $id); if (!empty($return)) { $return['count'] = Database::get_count('head_menu_user', 'cookie = ?', query::$cookie ); if ($return['url']{0} == '/') { $return['url'] = 'http://'.def::site('domain').$return['url']; } } return $return; }
protected function get_title() { $short = def::site('short_name') . ' '; if (count($this->data['items']) == 1) { $item = reset($this->data['items']); if (empty($item['in_batch'])) { return $short . $item->get_title(); } } if (count($this->meta) > 1) { return $short . 'Записи. Просмотр сложной выборки.'; } if (count($this->meta) == 1) { $meta = reset($this->meta); if (!$meta->is_simple()) { return $short . 'Записи. Просмотр сложной выборки.'; } $type = $meta->get_type(); $alias = $meta->get_meta(); $name = Database::get_field($type, 'name', 'alias = ?', $alias); $meta_name = $meta->get_type_rus(); return $short . 'Записи. ' . $meta_name . ': ' . $name; } return def::site('name'); }
echo $image['id']; ?> /"> <img align="left" src="<?php echo $def['site']['dir']; ?> /images/board/thumbs/<?php echo $image['thumb']; ?> .jpg"> </a> <? } } if (!empty($thread['content']['flash'])) { foreach ($thread['content']['flash'] as $flash) { ?> <a href="http://<?php echo def::site('domain'); echo $def['site']['dir']; ?> /images/board/full/<?php echo $flash['full']; ?> "> <img align="left" src="<?php echo $def['site']['dir']; ?> /images/flash.png"> </a> <? } } ?> <div class="posttext"> <?php echo $thread['text'];
include_once ROOT_DIR . SL . 'engine' . SL . 'twig_init.php'; } if (_TYPE_ != 'cron') { list($get, $post) = query::get_globals($_GET, $_POST); } include_once ROOT_DIR . SL . 'engine' . SL . 'metafunctions.php'; // Тут мы работаем с сессиями if (_TYPE_ != 'cron' && _TYPE_ != 'api') { // Логично, что у крона или апи сессии нет. // Удалим все левые куки, нечего захламлять пространство foreach ($_COOKIE as $key => $cook) { if ($key != 'settings') { setcookie($key, "", time() - 3600); } } $cookie_domain = (def::site('domain') != 'localhost' ? def::site('domain') : '') . SITE_DIR; // Хэш. Берем либо из cookie, если валиден, либо генерим новый query::$cookie = !empty($_COOKIE['settings']) && $check->hash($_COOKIE['settings']) ? $_COOKIE['settings'] : md5(microtime(true)); // Пробуем прочитать настройки для хэша $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'])))) {
$redirect = 'http://'.def::site('domain').'/'. (empty($url[3]) ? 'news/' : $url[3].'/'. ($url[4] == 'all' ? '' : $url[4].'/'.$url[5]) ); engine::redirect($redirect); } if (isset(query::$post['do'])) { query::$post['do'] = explode('.', query::$post['do']); if (count(query::$post['do']) == 2) { $input_class = 'input__'.query::$post['do'][0]; $input = new $input_class; $input_function = query::$post['do'][1]; $input->$input_function(query::$post); } $redirect = 'http://'.def::site('domain').(empty($input->redirect) ? $_SERVER["REQUEST_URI"] : $input->redirect); engine::redirect($redirect); } elseif (isset(query::$post['action']) && in_array(query::$post['action'], array('Create', 'Update', 'Delete'))) { $class = query::$post['action'] . '_' . ucfirst($url[1]); if (class_exists($class)) { $worker = new $class(); $function = empty(query::$post['function']) ? 'main' : query::$post['function']; if ($worker->check_access($function)) {
protected static function image_encode ($img) { $img = $img[0]; preg_match('/src="([^"]+)"/is',$img,$src); $src = $src[1]; $data = fread(fopen(ROOT_DIR.SL.$src,'r'),filesize(ROOT_DIR.SL.$src)); $data = chunk_split(base64_encode($data)); $ext = end(explode('.',$src)); switch ($ext) { case 'jpg': case 'jpeg': return str_replace($src,'data:image/jpeg;base64,'.$data,$img); case 'gif': return str_replace($src,'data:image/gif;base64,'.$data,$img); case 'png': return str_replace($src,'data:image/png;base64,'.$data,$img); default: return str_replace($src,'http://'.def::site('domain').$src,$img); } }
protected function get_title() { return def::site('name'); }
protected function get_title() { return def::site('short_name') . ' Записи. Битые ссылки.'; }