function display() { current_page('page'); if (!user('logged')) { return login_req(); } $data = ldb_select_one('page', '*', input(1), 'name'); if (!$data) { return core_error_404(); } page_title($data['title']); site_title($data['title']); $out = ''; $out .= $data['text']; return $out; }
function load_module() { // If we have errors & global msg - skip module loading if ($this->global_msg || $this->error) { return; } // Have module? if (!input(0)) { $GLOBALS['input'][0] = 'index'; } if (input(0, 'banner_top')) { return $this->load_banner_top(); } # First - we want static page? /*if (input(0)) { if ($page=ldb_select_one('page', array('id','name'), input(0),'name')) { $GLOBALS['input'][0]='page'; $GLOBALS['input'][1]=$page['name']; } }*/ $module_name = preg_replace('/[^a-z0-9_-]/', '', strtolower(input(0))); $this->module_name = $module_name; // Search file if (!file_exists(CORE_PATH . '/modules/mod_' . $module_name . '.php')) { // No file page_title('404 - Страница не найдена'); return core_error_404(); } # Calculate current page... #$std_pages = array ('news','') require_once CORE_PATH . '/modules/mod_' . $module_name . '.php'; // Load class $module_class = 'mod_' . $module_name; /*if (!method_exists($module_class, 'display')) { // No file return core_error_404 (); }*/ $obj = new $module_class(); $this->mainhref = $obj->display(); }
function get_final() { # Okay, remove th SID @unlink(ROOT_PATH . '/tmp/sid/' . md5($this->sid)); # Check upload data $u_data = ldb_select_one('upload', '*', $this->sid, 'code'); if (!$u_data || $u_data['uid'] != user('id')) { return core_error_404(); } include_once CORE_PATH . '/ttl.php'; $ttl = @$_POST['files_ttl']; if (!isset($GLOBALS['ttl'][$ttl])) { $ttl = $GLOBALS['ttl_def']; } $tms_del = $u_data['tms_last'] + $ttl; $ttl_p = @$_POST['files_ttl_prol'] ? 'Y' : 'N'; # Update TTL ldb_update_by_id('upload', $u_data['id'], array('tms_delete' => $tms_del, 'ttl' => $ttl, 'prolong' => $ttl_p, 'comment' => @$_POST['files_descr'])); ldb_query('UPDATE `upload` SET `file_count`=(SELECT COUNT(*) FROM `file` WHERE `file`.`upid`=`upload`.`id`),`file_size`=(SELECT SUM(`file_size`) FROM `file` WHERE `file`.`upid`=`upload`.`id`) WHERE `id`=' . $u_data['id']); # Redirect to the file control... @header('Location: ' . URL . '/f/' . $this->sid . '/'); }
function display() { current_page('f'); page_title(lang('fl_mylist'), URL . '/files/'); $out = ''; $public = false; if (input(2)) { $public = true; } $sid = input(1); $u_data = ldb_select_one('upload', '*', $sid, 'code'); if (!$u_data) { return core_error_404(); } $GLOBALS['core']->public_wdg = !$public; if ($u_data['uid'] != user('id')) { if (!input(2, $u_data['ph'])) { return core_error_404(); } else { # Public page view... } } $own = $u_data['uid'] == user('id'); if ($own && @$_POST['sub_edit'] && @($_GET['k'] = md5(user('lk')))) { return $this->edit($u_data); } if ($own && @$_GET['del'] && @($_GET['k'] = md5(user('lk')))) { return $this->del($u_data); } page_title(sprintf(lang('fld_title_n'), $u_data['id'])); $f_data = ldb_select('file', '*', '`upid`=' . $u_data['id']); $u_data['time_added'] = date('d.m.Y H:i', $u_data['tms_upload']); $u_data['time_del'] = time_delete($u_data['tms_upload'], $u_data['tms_delete']); $u_data['user'] = user_link($u_data['uid']); $u_data['descr'] = htmlspecialchars($u_data['comment']); $f_list = ''; for ($x = 0; $x < count($f_data); $x++) { $f_link = URL . '/c/d/' . $u_data['code'] . '/' . $f_data[$x]['upn'] . '/' . $f_data[$x]['dh'] . '/' . htmlspecialchars($f_data[$x]['file_name']); $f_flink = URL . '/c/f/' . $u_data['code'] . '/' . $f_data[$x]['upn'] . '/' . $f_data[$x]['dh'] . '/' . htmlspecialchars($f_data[$x]['file_name']); $fd = $f_data[$x]; $fd['size'] = format_size($fd['file_size']); $fd['name'] = htmlspecialchars($fd['file_name']); $tpl = new ltpl('download-file-item'); $tpl->v('f', $fd); $tpl->v('f_link', $f_link); $tpl->v('f_link_f', $f_flink); # Get file icon $f_icon = get_icon($fd['file_ext']); $tpl->v('f_icon', $f_icon); $f_list .= $tpl->get(); } include_once CORE_PATH . '/ttl.php'; $ttl_s = ''; foreach ($GLOBALS['ttl'] as $tm => $tt) { $ttl_s .= '<option value="' . $tm . '"' . ($tm == $u_data['ttl'] ? ' selected="selected"' : '') . '>' . $tt . '</option>'; } $u_data['publink'] = URL . '/f/' . $u_data['code'] . '/' . $u_data['ph'] . '/'; $tpl = new ltpl('download-file'); $tpl->v('u_data', $u_data); $tpl->v('f_list', $f_list); $tpl->v('ttl_sel', $ttl_s); $tpl->v('own', $u_data['uid'] == user('id')); $out .= $tpl->get(); return $out; }