about.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. $cityid = $cityid ? intval($cityid) : 0;
  15. if($action == 'dopost'){
  16. if(!$randcode = mymps_chk_randcode($checkcode)){
  17. write_msg('验证码输入错误,请返回重新输入');
  18. }
  19. $url = $url ? trim(mhtmlspecialchars($url)) : '';
  20. $webname = $webname ? trim(mhtmlspecialchars($webname)) : '';
  21. $weblogo = $weblogo ? trim(mhtmlspecialchars($weblogo)) : '';
  22. $msg = $msg ? textarea_post_change($msg) : '';
  23. $email = $email ? trim(mhtmlspecialchars($email)) : '';
  24. $typeid = $typeid ? intval($typeid) : '';
  25. if(empty($webname) || empty($url)) write_msg('网站名称和网址不能为空!');
  26. if($email && !is_email($email)) write_msg("您的email输入不正确!");
  27. $sql = "INSERT INTO `{$db_mymps}flink`(url,webname,weblogo,msg,email,typeid,createtime,ischeck,cityid)
  28. VALUES('$url','$webname','$weblogo','$msg','$email','$typeid','$timestamp','1',$cityid); ";
  29. $res = $db->query($sql);
  30. $city = get_city_caches($cityid);
  31. write_msg("链接申请提交成功,管理员审核通过后显示",Rewrite('about',array('part'=>'friendlink')));
  32. exit;
  33. }
  34. $cache = get_cache_config();
  35. require_once MYMPS_INC.'/cachepages.class.php';
  36. if($part == 'aboutus'){
  37. !$id && $id = $db -> getOne("SELECT MIN(id) FROM `{$db_mymps}about`");
  38. $cachepages = new cachepages($cache['aboutus']['time'],'aboutus_'.$id);
  39. $cachetime = $cache['aboutus']['time'] > 0 ? true : false;
  40. $cachepages->cacheCheck();
  41. $aboutus_all = get_aboutus(0);
  42. $aboutus = get_aboutus($id);
  43. $loc = get_location('aboutus','',$aboutus['typename']);
  44. $page_title = $loc['page_title'];
  45. $location = $loc['location'];
  46. } elseif($part == 'announce'){
  47. $cachepages = new cachepages($cache['announce']['time'],'announce_'.$cityid);
  48. $cachetime = $cache['announce']['time'] > 0 ? true : false;
  49. $cachepages->cacheCheck();
  50. $city = get_city_caches($cityid);
  51. $city_limit = $city['cityid'] ? " AND cityid = '$city[cityid]'" : " AND cityid = '0'";
  52. $loc = get_location('aboutus','','网站公告');
  53. $query = $db -> query("SELECT * FROM `{$db_mymps}announce` WHERE begintime<='$timestamp' AND (endtime='0' OR endtime>'$timestamp') {$city_limit} ORDER BY id DESC");
  54. while($row = $db -> fetchRow($query)){
  55. $arr['id'] = $row['id'];
  56. $arr['title'] = $row['title'];
  57. $arr['begintime'] = $row['begintime'] == 0 ? $row['pubdate'] : $row['begintime'];
  58. $arr['endtime'] = $row['endtime'];
  59. $arr['author'] = $row['author'];
  60. $arr['content'] = $row['redirecturl'] ? '<a href='.$row[redirecturl].' target=_blank>'.$row[redirecturl].'</a>' : $row['content'];
  61. $arr['uri'] = $row['redirecturl'] ? $row['redirecturl'] : Rewrite('about',array('part'=>'aboutus#'.$row['id']));
  62. $announce[] = $arr;
  63. }
  64. }elseif($part == 'faq'){
  65. !$id && $id = $db -> getOne("SELECT MIN(id) FROM `{$db_mymps}faq`");
  66. $cachepages = new cachepages($cache['faq']['time'],'faq_'.$id);
  67. $cachetime = $cache['faq']['time'] > 0 ? true : false;
  68. $cachepages->cacheCheck();
  69. $faq_type = get_faq();
  70. if(!$faq = get_faq($id)) write_msg('您指定的帮助主题不存在!');
  71. $loc = get_location('faq','',$faq['title']);
  72. } elseif($part == 'friendlink'){
  73. require MYMPS_INC."/flink.fun.php" ;
  74. $cachepages = new cachepages($cache['friendlink']['time'],'friendlink_'.$cityid);
  75. $cachetime = $cache['friendlink']['time'] > 0 ? true : false;
  76. $cachepages->cacheCheck();
  77. $city = get_city_caches($cityid);
  78. $loc = get_location('friendlink','','友情链接');
  79. $flink = get_flink();
  80. }elseif($part == 'sitemap'){
  81. $loc = get_location('','','网站地图');
  82. $cachepages = new cachepages($cache['sitemap']['time'],'sitemap_'.$cityid);
  83. $cachetime = $cache['sitemap']['time'] > 0 ? true : false;
  84. $cachepages->cacheCheck();
  85. $city = get_city_caches($cityid);
  86. $categories = get_categories_tree(0,'category');
  87. }
  88. $page_title = $loc['page_title'];
  89. $location = $loc['location'];
  90. globalassign();
  91. include mymps_tpl($part);
  92. $cachetime && $cachepages->caching();
  93. is_object($db) && $db->Close();
  94. ?>