function download() { $file_id = params::get('file'); db::table('files'); db::where('file_id', $file_id); $file = db::assoc(); if (db::rows() == 0) { web::error404(); } $file_link = FILES_ROOT . 'all/' . $file_id . '.' . $file['file_type']; files::downloadFile($file_link); }
function show() { $event = web::getEvent(); if ($event === false) { $year = date('Y'); } else { $year = $event; } s::set('info_date_select', htmlspecialchars($year)); $sql = "SELECT `section_year` as date FROM `info_sections` WHERE `section_view`='0' GROUP BY `date` ORDER BY `date` DESC"; $res = db::query($sql); $rows = mysql_num_rows($res); if ($rows > 1) { s::add('info_date_selector', '<ul class="years">'); while ($row = mysql_fetch_assoc($res)) { if ($row['date'] == $year) { $row['date'] = '<li><span>' . $row['date'] . '</span></li>'; } else { $row['date'] = '<li><a href="' . web::get('page_folder') . '' . $row['date'] . '/">' . $row['date'] . '</a></li>'; } s::add('info_date_selector', $row['date']); } s::add('info_date_selector', '</ul>'); } $files = array(); db::table('info_files'); $r = db::select(); while ($a = mysql_fetch_assoc($r)) { $files[$a['section_id']][] = $a; } db::table('info_sections'); db::order('section_order', 'DESC'); db::where('section_year', $year); $r = db::select(); if (db::rows() == 0) { web::error404(); } while ($a = mysql_fetch_assoc($r)) { if ($a['section_view'] == '0') { s::roll('sections', $a); } else { s::roll('sections_view', $a); } if (isset($files[$a['section_id']])) { foreach ($files[$a['section_id']] as $v) { $v['file_icon'] = files::getFileIco($v['file_type']); $v['file_size'] = files::parseSizeSmart($v['file_size']); s::roll('items' . $a['section_id'], $v); } } } }
function showOne() { $news_id = web::getThis(); db::table('news'); db::where('news_pub', '1'); $news = db::assoc(); if (db::rows() == 0) { web::error404(); } $news['news_date'] = dt::date2print('%d %F %Y', $news['news_date']); s::set('page_title', $news['news_title']); s::set('page_header', $news['news_title']); s::set($news); }
function showSection() { $section_id = web::getThis(); $item_id = web::getEvent(); if ($item_id !== false) { buffer::setTmpl('card.html'); self::showCard($item_id, $section_id); return false; } $dir = IMAGES_ROOT . 'sections/'; $dir_path = IMAGES_PATH . 'sections/'; db::table('catalog_sections'); db::where('section_id', $section_id); $section = db::assoc(); if (db::rows() == 0) { web::error404(); } s::set($section); s::set('page_title', $section['section_name']); s::set('page_header', $section['section_name']); $file = $dir . $section['section_id'] . '.jpg'; if (file_exists($file)) { s::set('section_img', '<img src="' . $dir_path . $section['section_id'] . '.jpg' . '" />'); } db::table('catalog_items'); db::where('section_id', $section_id); $r = db::select('item_name', 'item_id', 'item_desc'); $i = 0; while ($a = mysql_fetch_assoc($r)) { $i++; if ($i % 2) { s::roll('items1', $a); } else { s::roll('items2', $a); } } }