about.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. define('IN_SMT', true);
  3. define('CURSCRIPT', 'about');
  4. define('IN_MYMPS', true);
  5. require_once dirname(__FILE__) . '/include/global.php';
  6. require_once dirname(__FILE__) . '/data/config.php';
  7. require_once MYMPS_DATA . '/config.db.php';
  8. require_once MYMPS_INC . '/db.class.php';
  9. ifsiteopen();
  10. (!$part || !in_array($part, array('aboutus', 'friendlink', 'faq', 'announce', 'sitemap', 'googlemap'))) && ($part = 'aboutus');
  11. $id = isset($id) ? intval($id) : '';
  12. $page = isset($page) ? intval($page) : '';
  13. $action = isset($action) ? trim($action) : '';
  14. if ($action == 'dopost') {
  15. if (!($randcode = mymps_chk_randcode($checkcode))) {
  16. write_msg('验证码输入错误,请返回重新输入');
  17. }
  18. $url = $url ? trim(mhtmlspecialchars($url)) : '';
  19. $webname = $webname ? trim(mhtmlspecialchars($webname)) : '';
  20. $weblogo = $weblogo ? trim(mhtmlspecialchars($weblogo)) : '';
  21. $msg = $msg ? textarea_post_change($msg) : '';
  22. $email = $email ? trim(mhtmlspecialchars($email)) : '';
  23. $typeid = $typeid ? intval($typeid) : '';
  24. if (empty($webname) || empty($url)) {
  25. write_msg('网站名称和网址不能为空!');
  26. }
  27. if ($email && !is_email($email)) {
  28. write_msg('您的email输入不正确!');
  29. }
  30. $sql = 'INSERT INTO `' . $db_mymps . 'flink`(url,webname,weblogo,msg,email,typeid,createtime,ischeck)
  31. VALUES(\'' . $url . '\',\'' . $webname . '\',\'' . $weblogo . '\',\'' . $msg . '\',\'' . $email . '\',\'' . $typeid . '\',\'' . $timestamp . '\',\'1\'); ';
  32. $res = $db->query($sql);
  33. write_msg('链接申请提交成功,管理员审核通过后显示', Rewrite('about', array('part' => 'friendlink')));
  34. exit();
  35. }
  36. $cache = get_cache_config();
  37. require_once MYMPS_INC . '/cachepages.class.php';
  38. if ($part == 'aboutus') {
  39. $seo = $seo ? $seo : get_seoset();
  40. $rewrite = $seo['seo_force_category'];
  41. if ($rewrite != 'active') {
  42. $mayimobile = get_mobile_settings();
  43. $mayimobile['mobiledomain'] = $mayimobile['mobiledomain'] ? $mayimobile['mobiledomain'] : $mymps_global['SiteUrl'] . '/m';
  44. $mayimobile['mobileuri'] = $mayimobile['mobiledomain'] . ($_SERVER['HTTP_X_ORIGINAL_URL'] ? $_SERVER['HTTP_X_ORIGINAL_URL'] : $_SERVER['REQUEST_URI']);
  45. if ($ifmobile) {
  46. write_msg('', $mayimobile['mobileuri']);
  47. exit();
  48. }
  49. }
  50. !$id && ($id = $db->getOne('SELECT MIN(id) FROM `' . $db_mymps . 'about`'));
  51. $cachepages = new cachepages($cache['aboutus']['time'], 'aboutus_' . $id);
  52. $cachetime = 0 < $cache['aboutus']['time'] ? true : false;
  53. $cachepages->cacheCheck();
  54. $aboutus_all = get_aboutus(0);
  55. $aboutus = get_aboutus($id);
  56. $loc = get_location('aboutus', '', $aboutus['typename']);
  57. $page_title = $loc['page_title'];
  58. $location = $loc['location'];
  59. }
  60. else if ($part == 'announce') {
  61. $cachepages = new cachepages($cache['announce']['time'], 'announce');
  62. $cachetime = 0 < $cache['announce']['time'] ? true : false;
  63. $cachepages->cacheCheck();
  64. $loc = get_location('aboutus', '', '网站公告');
  65. $query = $db->query('SELECT * FROM `' . $db_mymps . 'announce` WHERE begintime<=\'' . $timestamp . '\' AND (endtime=\'0\' OR endtime>\'' . $timestamp . '\') ORDER BY id DESC');
  66. while ($row = $db->fetchRow($query)) {
  67. $arr['id'] = $row['id'];
  68. $arr['title'] = $row['title'];
  69. $arr['begintime'] = $row['begintime'] == 0 ? $row['pubdate'] : $row['begintime'];
  70. $arr['endtime'] = $row['endtime'];
  71. $arr['author'] = $row['author'];
  72. $arr['content'] = $row['redirecturl'] ? '<a href=' . $row[redirecturl] . ' target=_blank>' . $row[redirecturl] . '</a>' : $row['content'];
  73. $arr['uri'] = $row['redirecturl'] ? $row['redirecturl'] : Rewrite('about', array('part' => 'aboutus#' . $row['id']));
  74. $announce[] = $arr;
  75. }
  76. }
  77. else if ($part == 'faq') {
  78. !$id && ($id = $db->getOne('SELECT MIN(id) FROM `' . $db_mymps . 'faq`'));
  79. $cachepages = new cachepages($cache['faq']['time'], 'faq_' . $id);
  80. $cachetime = 0 < $cache['faq']['time'] ? true : false;
  81. $cachepages->cacheCheck();
  82. $faq_type = get_faq();
  83. if (!($faq = get_faq($id))) {
  84. write_msg('您指定的帮助主题不存在!');
  85. }
  86. $loc = get_location('faq', '', $faq['title']);
  87. }
  88. else if ($part == 'friendlink') {
  89. require MYMPS_INC . '/flink.fun.php';
  90. $cachepages = new cachepages($cache['friendlink']['time'], 'friendlink');
  91. $cachetime = 0 < $cache['friendlink']['time'] ? true : false;
  92. $cachepages->cacheCheck();
  93. $loc = get_location('friendlink', '', '友情链接');
  94. $flink = get_flink();
  95. }
  96. else if ($part == 'sitemap') {
  97. $loc = get_location('', '', '网站地图');
  98. $cachepages = new cachepages($cache['sitemap']['time'], 'sitemap');
  99. $cachetime = 0 < $cache['sitemap']['time'] ? true : false;
  100. $cachepages->cacheCheck();
  101. $categories = get_categories_tree(0, 'category');
  102. }
  103. $page_title = $loc['page_title'];
  104. $location = $loc['location'];
  105. $about = array();
  106. $about['aboutus_uri'] = Rewrite('about', array('part' => 'aboutus'));
  107. $about['news_uri'] = Rewrite('news', array('part' => 'index'));
  108. $about['faq_uri'] = Rewrite('about', array('part' => 'faq'));
  109. $about['yp_uri'] = Rewrite('corp', array('part' => 'index'));
  110. $about['friendlink_uri'] = Rewrite('about', array('part' => 'friendlink'));
  111. $about['announce_uri'] = Rewrite('about', array('part' => 'announce'));
  112. $about['sitemap_uri'] = Rewrite('about', array('part' => 'sitemap'));
  113. include mymps_tpl($part);
  114. $cachetime && $cachepages->caching();
  115. is_object($db) && $db->Close();
  116. ?>