function get_data() { global $url; global $data; global $error; global $check; global $sets; if (substr($url[2],0,1) == '=') { $alias = array('p' => 'post', 'v' => 'video', 'a' => 'art', 'c' => 'comment', 'o' => 'orders', 'u' => 'post_update', 'n' => 'news'); $types = array_filter(array_unique(str_split(substr($url[2],1)))); $data = array(); foreach ($types as $type) { if ($type != 'm') { if (is_array($new_data = obj::db()->sql('select *,"'.$alias[$type].'" as type from '.$alias[$type].' where area="'.($type != 'o' ? 'main' : 'workshop').'" order by sortdate desc limit 0, 30','sortdate'))) { $data = $data + $new_data; } } } /* Для очередей премодерации */ if (array_search('m', $types)) { foreach ($types as $type) { if ($type != 'o' && $type != 'm') { if (is_array($new_data = obj::db()->sql('select *,"'.$alias[$type].'" as type from '.$alias[$type].' where area="workshop" order by sortdate desc limit 0, 30','sortdate'))) { $data = $data + $new_data; } } } } krsort($data); $return['items'] = array_slice($data,0,50,true); } elseif (is_array($condition = explode('|',_base64_decode($url[2])))) { if ($check->lat(implode('',$condition))) $return['items'] = obj::db()->sql('select *,"'.$condition[0].'" as type from '.$condition[0].' where area="'.($condition[0] != 'orders' ? 'main' : 'workshop').'" and locate("|'.$condition[2].'|",'.$condition[1].') order by sortdate desc limit 0, 20','sortdate'); else { $error = true; return ''; } } else { $error = true; return ''; } if (!empty($return['items'])) { foreach ($return['items'] as &$item) { $function = 'convert_'.$item['type']; $item = $this->$function($item); $item['rss_title'] = html_entity_decode($item['title']); $item['rss_base'] = 'http://'.$_SERVER['HTTP_HOST'].'/'; $item['guid'] = $alias[$type].'-'.$item['id']; } reset($return['items']); } else { $return['items'] = array(); } $data['feed']['domain'] = 'http://'.$_SERVER['HTTP_HOST']; $return['lastbuild'] = ceil(key($return['items'])/1000); $return['navi']['base'] = $data['feed']['domain'].'/art/'; // Используется только в шаблоне для арта, поэтому и такое значение return $return; }
function updated() { global $url; global $error; $time = current(unpack('i*',_base64_decode($url[3])))*1000; $return['boards'] = $this->board_categories; $return['display'] = array('board_page','navi','board_menu'); $return['navi']['curr'] = max(1,$url[5]); $limit = 'limit '.($return['navi']['curr']-1)*sets::pp('board').', '.sets::pp('board'); $condition = $url[2] == 'new' ? 'board.sortdate > '.$time.' AND ' : 'board.updated > '.$time.' AND board.sortdate < '.$time.' AND '; $return['threads'] = $this->get_threads($condition, $limit); if (empty($return['threads'])) { $error = true; $this->side_modules['top'] = array('board_list'); } $return['navi']['start'] = max($return['navi']['curr']-5,2); $return['navi']['last'] = ceil(obj::db()->sql(' SELECT count(distinct(board.id)) FROM board LEFT JOIN board_category ON board.id=board_category.thread_id WHERE '.$condition.' board.`type` = "thread" AND board_category.actual = 1 ',2)/sets::pp('board')); $return['navi']['base'] = '/board/'.$url[2].'/'.$url[3].'/'; return $return; }
function decrypt($input) { return _crypt(_base64_decode($input),true); }