function admin_controller() { if (isset($_REQUEST['act']) && ($_REQUEST['act'] == 'admin_ajax' || $_REQUEST['act'] == 'admin_delete')) { if (!$GLOBALS['session']->get('adminid')) { exit('未登录'); } } if (!isset($_REQUEST['act']) || $_REQUEST['act'] != 'login' && $_REQUEST['act'] != 'logout') { if (!$GLOBALS['session']->get('adminid')) { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=login'); } } include ROOT_PATH . '/models/common.php'; }
function plugin_controller() { include ROOT_PATH . '/models/common.php'; $this->pdir = ROOT_PATH . '/plugins'; $this->plugin = new common('plugins'); $this->pluginvars = new common('pluginvars'); $this->pluginhooks = new common('pluginhooks'); $adminarr = array('list1'); if (in_array($_REQUEST['act'], $adminarr)) { if (!$GLOBALS['session']->get('adminid')) { sheader('index.php?con=admin&act=login'); } } }
if ($forum['status'] < 1) { //隐藏板块 $jumptobbs = true; } elseif (!empty($forum['password'])) { $jumptobbs = true; } elseif (!empty($forum['viewperm'])) { $viewpermarr = explode("\t", $forum['viewperm']); if (!in_array('7', $viewpermarr)) { $jumptobbs = true; } } elseif (!empty($forum['redirect'])) { $forumurl = $forum['redirect']; $jumptobbs = true; } if ($jumptobbs) { sheader($threadurl); exit; } @(include_once S_ROOT . './data/system/bbsforums.cache.php'); if (!empty($_SGLOBAL['bbsforumarr']) && !empty($_SGLOBAL['bbsforumarr'][$forum['fid']]['name'])) { $forum['name'] = $_SGLOBAL['bbsforumarr'][$forum['fid']]['name']; } $iarr = array(); $listcount = $thread['replies'] + 1; unset($_SGET['lastpost']); $page = 1; $listkey = 'posts'; $action = 'viewthread'; $item['listcount'] = $listcount; $item['tid'] = $tid; $space['jammer'] = 0;
} elseif (!empty($forum['password'])) { $jumptobbs = true; } elseif (!empty($forum['viewperm'])) { $viewpermarr = explode("\t", $forum['viewperm']); if (!in_array('7', $viewpermarr)) { $jumptobbs = true; } } elseif (!empty($forum['redirect'])) { $forumurl = $forum['redirect']; $jumptobbs = true; } if ($_SC['bbsver'] <= 6 && empty($forum['allowshare'])) { $jumptobbs = true; } if ($jumptobbs) { sheader($forumurl); } @(include_once S_ROOT . './data/system/bbsforums.cache.php'); if (!empty($_SGLOBAL['bbsforumarr']) && !empty($_SGLOBAL['bbsforumarr'][$forum['fid']]['name'])) { $forum['name'] = $_SGLOBAL['bbsforumarr'][$forum['fid']]['name']; } $title = $forum['name'] . ' - ' . $_SCONFIG['sitename']; $keywords = $forum['name'] . ',' . $lang['bbs']; $description = $forum['name'] . ',' . $lang['bbs']; $guidearr = array(); $guidearr[] = array('url' => geturl('action/bbs'), 'name' => $channels['menus']['bbs']['name']); $guidearr[] = array('url' => geturl('action/forumdisplay/fid/' . $forum['fid']), 'name' => $forum['name']); $tplname = 'bbs_forumdisplay'; $title = strip_tags($title); $keywords = strip_tags($keywords); $description = strip_tags($description);
$template = str_replace("{stitle}", $stitle, $template); $template = $template . ' ' . $msg['body_data']['subject']; //aipingfa add $feedlist[] = $template; // echo($template."<br />"); } /*echo '<!--'; print_r($_SGLOBAL['member']); print_r($_SGLOBAL['grouparr'][32]); echo '-->';*/ //默认首页 //拆分菜单 $menu_arr_vertical = array_splice($channels['menus'], count($channels['menus']) - 6); if (!empty($channels['default']) && $channels['default'] != 'index.php') { if (strpos($channels['default'], '?')) { sheader(S_URL . '/' . $channels['default']); exit; } else { include_once S_ROOT . './' . $channels['default']; } } else { if (!empty($_SCONFIG['htmlindex'])) { $_SHTML['action'] = 'index'; $_SGLOBAL['htmlfile'] = gethtmlfile($_SHTML); ehtml('get', $_SCONFIG['htmlindextime']); $_SCONFIG['debug'] = 0; } $title = $_SCONFIG['sitename']; $keywords = $_SCONFIG['sitename']; $description = $_SCONFIG['sitename']; include template('index');
function account_action() { if (!$GLOBALS['session']->get('uid')) { sheader(url('user', 'login')); } $container = "and uid=" . $GLOBALS['session']->get('uid'); if (submitcheck('commit') && !empty($_POST['newpassword'])) { if ($_POST['newpassword'] != $_POST['newpassword1']) { sheader(url('user', 'account'), 3, '两次密码输入不一致', 'member_redirect'); } else { $user = $this->user->GetOne($container . ' and pwd="' . md52($_POST['password']) . '"'); if ($user) { $data['pwd'] = md52($_POST['newpassword']); if ($this->user->UpdateData($data, $container)) { sheader(url('user', 'account'), 3, '资料修改成功', 'member_redirect'); } else { sheader(url('user', 'account'), 3, '资料修改失败', 'member_redirect'); } } else { sheader(url('user', 'account'), 3, '资料修改失败,用户不存在', 'member_redirect'); } } } else { include template('member_account'); } }
function ehtml($type, $updatetime = 0) { global $_SGLOBAL, $_SGET, $_SHTML, $_SCONFIG, $lang; if ($type == 'get') { $_SGLOBAL['htmlfile']['updatetime'] = $updatetime; //if(empty($_SGET['php']) && !empty($_SGLOBAL['htmlfile']['path']) && file_exists($_SGLOBAL['htmlfile']['path'])) { // sheader($_SGLOBAL['htmlfile']['url']); //} if (empty($_SGET['php']) && !empty($_SGLOBAL['htmlfile']['path']) && file_exists($_SGLOBAL['htmlfile']['path'])) { if ($_SGLOBAL['htmlfile']['path'] == './html/index.html') { include S_ROOT . './html/index.html'; exit; } else { sheader($_SGLOBAL['htmlfile']['url']); } } } else { if (empty($_SHTML['maxpage']) && !empty($_SGLOBAL['htmlfile']['path'])) { $content = $_SGLOBAL['content']; $theurl = S_URL_ALL . '/index.php?' . arraytostring($_SHTML); $codearr = array('url' => rawurlencode($theurl), 'maketime' => $_SGLOBAL['timestamp'], 'updatetime' => $_SGLOBAL['htmlfile']['updatetime'], 'uid' => empty($_SHTML['uid']) ? 0 : $_SHTML['uid'], 'itemid' => empty($_SHTML['itemid']) ? 0 : $_SHTML['itemid'], 'action' => $_SHTML['action']); $code = rawurlencode(implode('/', $codearr)); $content .= ' <script language="javascript"> <!-- var Modified = new Date(document.lastModified); var copyright = document.getElementById("xspace-copyright"); if(copyright) { copyright.innerHTML += "Last update: <a href=\\"' . $theurl . '/php/1\\" title=\\"' . $lang['the_page_can_be_updated_immediately_hits'] . '\\">"+(Modified.getYear()<200?(Modified.getYear()+1900):Modified.getYear())+"-"+(Modified.getMonth()+1)+"-"+Modified.getDate()+" "+Modified.getHours()+":"+Modified.getMinutes()+":"+Modified.getSeconds() + "</a><br>"; } document.write(\'<script src="' . S_URL . '/batch.html.php?code=' . $code . '&lastmodified=\' + Modified.getTime() + \'" type="text\\/javascript" language="javascript"><\\/script>\'); //--> </script>'; writefile($_SGLOBAL['htmlfile']['path'], $content); } } }
if (!checkperm('allowview')) { showmessage('no_permission'); } $listcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT COUNT(*) FROM ' . tname('spacenews') . ' WHERE itemid=\'' . $itemid . '\''), 0); if ($page > $listcount) { $_SHTML['page'] = $page = 1; } $start = $page - 1; $query = $_SGLOBAL['db']->query('SELECT ii.* FROM ' . tname('spacenews') . ' ii WHERE ii.itemid=\'' . $itemid . '\' ORDER BY ii.pageorder, ii.nid LIMIT ' . $start . ', 1'); if ($msg = $_SGLOBAL['db']->fetch_array($query)) { $news = array_merge($news, $msg); } else { moveitemfolder($itemid, 0, 2); } if (!empty($news['newsurl'])) { sheader(htmlspecialchars_decode($news['newsurl'])); // CSIP change, 加入对url中特殊符的处理 } $news['attacharr'] = array(); $multipage = ''; if ($listcount > 1) { $urlarr = array('action' => 'viewnews', 'itemid' => $itemid); $multipage = multi($listcount, 1, $page, $urlarr, 0); } else { if ($page == 1 && $news['haveattach']) { $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('attachments') . ' WHERE itemid=\'' . $itemid . '\''); while ($attach = $_SGLOBAL['db']->fetch_array($query)) { if (strpos($news['message'], $attach['thumbpath']) === false && strpos($news['message'], $attach['filepath']) === false && strpos($news['message'], 'batch.download.php?aid=' . $attach['aid']) === false) { $attach['filepath'] = A_URL . '/' . $attach['filepath']; $attach['thumbpath'] = A_URL . '/' . $attach['thumbpath']; $attach['url'] = S_URL . '/batch.download.php?aid=' . $attach['aid'];
if (!checkperm('allowvote')) { showmessage('no_permission'); } $pollid = empty($_SGET['pollid']) ? 0 : intval($_SGET['pollid']); if (empty($pollid)) { $pollid = intval(postget('pollid')); } if (empty($pollid)) { showmessage('not_found', S_URL); } $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('polls') . ' WHERE pollid=\'' . $pollid . '\''); if (!($poll = $_SGLOBAL['db']->fetch_array($query))) { showmessage('not_found', S_URL); } if (!empty($poll['pollsurl'])) { sheader($poll['pollsurl']); } if (submitcheck('pollsubmit')) { if (empty($_POST['votekey'])) { showmessage('no_votekey'); } if (empty($_SGLOBAL['supe_uid'])) { $ip = $_SGLOBAL['onlineip']; } else { $ip = $_SGLOBAL['supe_uid']; } $votekeys = $_POST['votekey']; $options = unserialize($poll['options']); if (empty($poll['voters'])) { $voters = array(); } else {
showxml($html); } elseif ($action == 'viewnews') { //查看新闻前一个/后一个 if (!empty($_GET['op']) && !empty($_GET['itemid']) && !empty($_GET['catid'])) { $itemid = intval($_GET['itemid']); $catid = intval($_GET['catid']); $newitemid = 0; if ($itemid && $catid && $_GET['op'] == 'up') { $newitemid = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT itemid FROM ' . tname('spaceitems') . ' WHERE itemid <\'' . $itemid . '\' AND catid=\'' . $catid . '\' ORDER BY itemid DESC LIMIT 1'), 0); } elseif ($itemid && $catid) { $newitemid = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT itemid FROM ' . tname('spaceitems') . ' WHERE itemid >\'' . $itemid . '\' AND catid=\'' . $catid . '\' ORDER BY itemid LIMIT 1'), 0); } if (!empty($newitemid)) { sheader(geturl('action/viewnews/itemid/' . $newitemid)); } else { sheader(geturl('action/viewnews/itemid/' . $itemid)); } } } elseif ($action == 'quote') { //评论引用 include_once S_ROOT . './function/misc.func.php'; $cid = empty($_GET['cid']) ? 0 : intval($_GET['cid']); $html = false; if ($cid) { $item = array(); $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('spacecomments') . ' WHERE cid=\'' . $cid . '\''); if ($item = $_SGLOBAL['db']->fetch_array($query)) { $currentmessage = array(); preg_match_all("/\\<div class=\"new\">(.+)?\\<\\/div\\>/is", $item['message'], $currentmessage, PREG_SET_ORDER); if (!empty($currentmessage)) { $item['message'] = $currentmessage[0][0];
$_SCONFIG['debug'] = 0; } $thecat = array(); if ($catid) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('categories') . " WHERE catid='{$catid}'"); $thecat = $_SGLOBAL['db']->fetch_array($query); } if (empty($thecat)) { showmessage('not_found', S_URL); } $channel = $thecat['type']; if (!checkperm('allowview')) { showmessage('no_permission'); } if (!empty($thecat['url'])) { sheader($thecat['url']); } $upcat = array(); if (!empty($thecat['upid'])) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('categories') . " WHERE catid='{$thecat['upid']}'"); $upcat = $_SGLOBAL['db']->fetch_array($query); } $_SGET['page'] = empty($_SGET['page']) ? 1 : intval($_SGET['page']); $guidearr = array(); $guidearr[] = array('url' => geturl('action/' . $thecat['type']), 'name' => $channels['menus'][$thecat['type']]['name']); if (!empty($upcat)) { $guidearr[] = array('url' => geturl('action/category/catid/' . $upcat['catid']), 'name' => $upcat['name']); } $guidearr[] = array('url' => geturl('action/category/catid/' . $thecat['catid']), 'name' => $thecat['name']); if (!empty($thecat['tpl']) && file_exists(S_ROOT . './templates/' . $_SCONFIG['template'] . '/' . $thecat['tpl'] . '.html.php')) { $tplname = $thecat['tpl'];
} $query = $_SGLOBAL['db']->query('SELECT f.*, ff.name AS upname FROM ' . tname('categories') . ' f LEFT JOIN ' . tname('categories') . ' ff ON ff.catid=f.upid WHERE f.catid=\'' . $news['catid'] . '\''); $thecat = $_SGLOBAL['db']->fetch_array($query); $listcount = $_SGLOBAL['db']->result($_SGLOBAL['db']->query('SELECT COUNT(*) FROM ' . tname('spacenews') . ' WHERE itemid=\'' . $itemid . '\''), 0); if ($page > $listcount) { $_SHTML['page'] = $page = 1; } $start = $page - 1; $query = $_SGLOBAL['db']->query('SELECT ii.* FROM ' . tname('spacenews') . ' ii WHERE ii.itemid=\'' . $itemid . '\' ORDER BY ii.pageorder, ii.nid LIMIT ' . $start . ', 1'); if ($msg = $_SGLOBAL['db']->fetch_array($query)) { $news = array_merge($news, $msg); } else { updatetable('spaceitems', array('folder' => 3), array('itemid' => $itemid)); } if (!empty($news['newsurl'])) { sheader($news['newsurl']); } $news['attacharr'] = array(); $multipage = ''; if ($listcount > 1) { $urlarr = array('action' => 'viewnews', 'itemid' => $itemid); $multipage = multi($listcount, 1, $page, $urlarr, 0); } else { if ($page == 1 && $news['haveattach']) { $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('attachments') . ' WHERE itemid=\'' . $itemid . '\''); while ($attach = $_SGLOBAL['db']->fetch_array($query)) { if (strpos($news['message'], $attach['thumbpath']) === false && strpos($news['message'], $attach['filepath']) === false && strpos($news['message'], 'batch.download.php?aid=' . $attach['aid']) === false) { $attach['filepath'] = A_URL . '/' . $attach['filepath']; $attach['thumbpath'] = A_URL . '/' . $attach['thumbpath']; $attach['url'] = S_URL . '/batch.download.php?aid=' . $attach['aid']; $news['attacharr'][] = $attach;
/** *添加标签 */ function zhikumodify_action() { global $session; $updateid = intval($_REQUEST['updateid']); $zhiku_mod = new common('zhiku'); $file_mod = new common('file'); $tag = array(); if (submitcheck('commit')) { // `topic_id` bigint(20) NOT NULL AUTO_INCREMENT, // `topic_name` varchar(20) NOT NULL COMMENT '文章名称', // `isused` tinyint(1) NOT NULL COMMENT '是否关闭', // `topic_desc` TEXT NOT NULL COMMENT '文章内容', // `topic_tag` varchar(20) NOT NULL COMMENT '话题标语', // `created_time` $data['topic_name'] = $_POST['topic_name']; $data['topic_desc'] = $_POST['topic_desc']; $data['topic_intro'] = $_POST['topic_intro']; $data['file_id'] = $_POST['file_id']; if (intval($data['file_id']) < 1) { $data['file_id'] = $_POST['tag_file_id']; } if ($updateid > 0) { if ($zhiku_mod->UpdateData($data, 'and topic_id=' . $updateid)) { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=zhiku', 3, '修改成功', 'redirect', true); } else { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=zhiku', 3, '修改失败', 'redirect', true); } } else { $data['created_time'] = time(); if ($zhiku_mod->InsertData($data)) { sheader('index.php?con=' . $GLOBALS['setting']['adminpath'] . '&act=zhiku', 3, '添加成功', 'redirect', true); } } } else { if ($updateid) { $zhiku = $zhiku_mod->GetOne('and topic_id=' . $updateid); $zhiku['file'] = $file_mod->GetOne('and file_id=' . $zhiku['file_id']); } include ROOT_PATH . '/views/admin/zhiku_form.php'; } }
function guestbook_action() { if (submitcheck('commit')) { $guestbook_mod = new common('guestbook'); $data['title'] = trim(strip_tags($_POST['title'])); $data['content'] = trim(strip_tags($_POST['content'])); if ($guestbook_mod->InsertData($data)) { sheader(url('index', 'guestbook'), 3, '意见提交成功'); } else { sheader(url('index', 'guestbook'), 3, '意见提交失败'); } } else { include template('guestbook'); } }
break; } } } $wherecatid = ''; foreach ($_GET as $tmpkey => $tmpvalue) { if (!is_array($tmpvalue)) { $tmpvalue = trim($tmpvalue); } if (preg_match("/^mo_/", $tmpkey) && (!is_array($tmpvalue) && strlen($tmpvalue) > 0 || is_array($tmpvalue) && !empty($tmpvalue))) { $key = preg_replace("/(^mo_|_from\$|_to\$)/", '', $tmpkey); if ($key == 'subject') { $sqllikearr['i.`subject`'] = stripsearchkey(shtmlspecialchars($tmpvalue)); } elseif ($key == 'catid') { if (!empty($cacheinfo['categoryarr'][$tmpvalue]['url'])) { sheader($cacheinfo['categoryarr'][$tmpvalue]['url']); } $wherecatid = ' i.catid IN (' . $cacheinfo['categoryarr'][$tmpvalue]['subcatid'] . ') AND '; } elseif ($key == 'username') { $sqlchararr['i.`username`'] = stripsearchkey(shtmlspecialchars($tmpvalue)); } elseif ($key == 'grade') { $sqlchararr['i.`grade`'] = stripsearchkey(shtmlspecialchars($tmpvalue)); } elseif (!empty($columnsinfoarr[$key])) { if (!empty($columnsinfoarr[$key]['isfixed'])) { $pre = 'i.'; } else { $pre = 'm.'; $isfixedsearch = 0; } if ($columnsinfoarr[$key]['formtype'] == 'linkage') { if (!empty($cacheinfo['linkage']['info'][$key][$tmpvalue])) {
function dumpsql_action() { global $db; $dump = $this->dump; /* 设置最长执行时间为5分钟 */ @set_time_limit(300); $run_log = $this->path . '/run.log'; /* 初始化输入变量 */ if (empty($_REQUEST['sql_file_name'])) { $sql_file_name = $dump->get_random_name(); } else { $sql_file_name = str_replace("0xa", '', trim($_REQUEST['sql_file_name'])); // 过滤 0xa 非法字符 $pos = strpos($sql_file_name, '.sql'); if ($pos !== false) { $sql_file_name = substr($sql_file_name, 0, $pos); } } $max_size = empty($_REQUEST['vol_size']) ? 0 : intval($_REQUEST['vol_size']); $vol = empty($_REQUEST['vol']) ? 1 : intval($_REQUEST['vol']); $is_short = empty($_REQUEST['ext_insert']) ? false : true; $dump->is_short = $is_short; /* 变量验证 */ $allow_max_size = intval(@ini_get('upload_max_filesize')); //单位M if ($allow_max_size > 0 && $max_size > $allow_max_size * 1024) { $max_size = $allow_max_size * 1024; //单位K } if ($max_size > 0) { $dump->max_size = $max_size * 1024; } /* 获取要备份数据列表 */ $type = empty($_POST['type']) ? '' : trim($_POST['type']); $tables = array(); switch ($type) { case 'full': $query = $db->query("SHOW TABLES LIKE '" . $GLOBALS['table_prefix'] . "%'"); while ($t = $db->fetch_array($query)) { $table = array_values($t); $tables[$table[0]] = -1; } $dump->put_tables_list($run_log, $tables); break; case 'stand': $temp = array('site', 'user', 'groups ', 'score'); foreach ($temp as $table) { $tables[$GLOBALS['table_prefix'] . $table] = -1; } $dump->put_tables_list($run_log, $tables); break; case 'min': $temp = array('site'); foreach ($temp as $table) { $tables[$GLOBALS['table_prefix'] . $table] = -1; } $dump->put_tables_list($run_log, $tables); break; case 'custom': foreach ($_POST['customtables'] as $table) { $tables[$table] = -1; } $dump->put_tables_list($run_log, $tables); break; } /* 开始备份 */ $tables = $dump->dump_table($run_log, $vol); if ($tables === false) { die($dump->errorMsg()); } if (empty($tables)) { /* 备份结束 */ if ($vol > 1) { /* 有多个文件 */ if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) { sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true); } $list = array(); for ($i = 1; $i <= $vol; $i++) { $list[] = array('name' => $sql_file_name . '_' . $i . '.sql', 'href' => 'data/sqlbackup/' . $sql_file_name . '_' . $i . '.sql'); } sheader('index.php?con=database&act=restore', 3, '文件备份完成', 'redirect', true); } else { /* 只有一个文件 */ if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '.sql', $dump->dump_sql)) { sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true); } $list = array(array('name' => $sql_file_name . '.sql', 'href' => 'data/sqlbackup/' . $sql_file_name . '.sql')); sheader('index.php?con=database&act=restore', 3, '文件备份完成', 'redirect', true); } } else { /* 下一个页面处理 */ if (!@writefile(ROOT_PATH . 'data/sqlbackup/' . $sql_file_name . '_' . $vol . '.sql', $dump->dump_sql)) { sheader('index.php?con=database&act=backup', 3, $sql_file_name . '_' . $vol . '.sql文件写入失败', 'redirect', true); } $lnk = 'index.php?con=database&act=dumpsql&sql_file_name=' . $sql_file_name . '&vol_size=' . $max_size . '&vol=' . ($vol + 1); sheader($lnk, 3, $sql_file_name . '_' . $vol . '.sql文件写入成功,进入下一个文件', 'redirect', true); } }
<?php /* [SupeSite] (C) 2007-2009 Comsenz Inc. $Id: login.php 11183 2009-02-24 02:59:26Z zhaofei $ */ if (!defined('IN_SUPESITE')) { exit('Access Denied'); } if (!empty($_SGLOBAL['supe_uid'])) { sheader(S_URL_ALL); } $registerurl = getbbsurl('register.php', array('referer' => S_URL . '/?action/login')); $lostpassword = getbbsurl('member.php', array('action' => 'lostpasswd')); if (!empty($_COOKIE['_refer'])) { $refer = $_COOKIE['_refer']; } else { $refer = S_URL_ALL; } $title = $lang['login']; include template('site_login');
$listcount = $_SGLOBAL['db']->result($query, 0); $multipage = ''; if ($listcount) { $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('announcements') . ' WHERE starttime <= \'' . $_SGLOBAL['timestamp'] . '\' AND (endtime >= \'' . $_SGLOBAL['timestamp'] . '\' OR endtime = 0) ORDER BY displayorder DESC, starttime DESC LIMIT ' . $start . ',' . $perpage); while ($item = $_SGLOBAL['db']->fetch_array($query)) { $item['starttime'] = $item['starttime'] ? sgmdate($item['starttime']) : '-'; $item['endtime'] = $item['endtime'] ? sgmdate($item['endtime']) : '-'; $item['url'] = geturl('action/announcement/id/' . $item['id']); $listvalue[] = $item; } $urlarr = array('action' => 'announcement'); $multipage = multi($listcount, $perpage, $page, $urlarr, 0); } } else { $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('announcements') . ' WHERE id=\'' . $id . '\''); if ($announce = $_SGLOBAL['db']->fetch_array($query)) { $announce['starttime'] = $announce['starttime'] ? sgmdate($announce['starttime']) : '-'; $announce['endtime'] = $announce['endtime'] ? sgmdate($announce['endtime']) : '-'; if (empty($announce['announcementsurl'])) { $announce['url'] = geturl('action/announcement/id/' . $id); } else { sheader($announce['announcementsurl']); } $listvalue[] = $announce; $multipage = '<div class="anno_more"><a href="' . geturl('action/announcement') . '">MORE</a></div>'; } else { showmessage('not_found'); } } $title = $lang['announcement']; include template('site_announcement');
function linkmodify_action() { $updateid = $_REQUEST['updateid']; $link_mod = new common('link'); if (submitcheck('commit')) { $data['title'] = trim(strip_tags($_POST['title'])); $data['url'] = substr($_POST['url'], 0, 4) == 'http' ? trim($_POST['url']) : 'http://' . $_POST['url']; $data['dec'] = trim(strip_tags($_POST['dec'])); $data['type'] = intval($_POST['type']); if ($_FILES['thumb']['name']) { $data['thumb'] = _upload('thumb', 'data/upload/tempimg'); } if ($updateid > 0) { if ($link_mod->UpdateData($data, 'and id=' . $updateid)) { deletef('link'); sheader('index.php?con=admin&act=link', 3, '修改成功', 'redirect', true); } } else { if ($link_mod->InsertData($data)) { deletef('link'); sheader('index.php?con=admin&act=link', 3, '添加成功', 'redirect', true); } } } else { if ($updateid) { $link = $link_mod->GetOne('and id=' . $updateid); } include ROOT_PATH . '/views/admin/link_form.php'; } }