corporation.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. define('IN_SMT', true);
  3. define('CURSCRIPT', 'corp');
  4. define('IN_MYMPS', true);
  5. require_once dirname(__FILE__) . '/data/config.php';
  6. require_once dirname(__FILE__) . '/include/global.php';
  7. require_once MYMPS_DATA . '/config.db.php';
  8. require_once MYMPS_INC . '/db.class.php';
  9. ifsiteopen();
  10. $catid = isset($catid) ? intval($catid) : '';
  11. $areaid = isset($areaid) ? intval($areaid) : '';
  12. $Catid = isset($Catid) ? checkhtml($Catid) : '';
  13. $seo = get_seoset();
  14. $rewrite = $seo['seo_force_yp'];
  15. if ($rewrite != 'active') {
  16. $mayimobile = get_mobile_settings();
  17. $mayimobile['mobiledomain'] = $mayimobile['mobiledomain'] ? $mayimobile['mobiledomain'] : $mymps_global['SiteUrl'] . '/m';
  18. $mayimobile['mobileuri'] = $mayimobile['mobiledomain'] . ($_SERVER['HTTP_X_ORIGINAL_URL'] ? $_SERVER['HTTP_X_ORIGINAL_URL'] : $_SERVER['REQUEST_URI']);
  19. if ($ifmobile) {
  20. write_msg('', $mayimobile['mobileuri']);
  21. exit();
  22. }
  23. }
  24. if ($Catid && $rewrite == 'rewrite') {
  25. $detail = explode('-', $Catid);
  26. if ($detail[0] && in_array($detail[0], array('catid', 'areaid', 'page'))) {
  27. $detail[1] = intval($detail[1]);
  28. for ($i = 0; $i < count($detail); $i++) {
  29. $_GET[$detail[$i]] = ${$detail[$i]} = str_replace(array('#@#', '#!#'), array('-', '/'), $detail[++$i]);
  30. }
  31. extract($_GET);
  32. }
  33. $Catid = $detail = NULL;
  34. }
  35. if ($catid && !($cur = $db->getRow('SELECT parentid,corpname FROM `' . $db_mymps . 'corp` WHERE corpid = \'' . $catid . '\''))) {
  36. write_msg('当前商家分类不存在或者未被启用!');
  37. }
  38. $cate_limit = !empty($catid) ? ' AND b.catid IN(' . get_corp_children($catid) . ') ' : '';
  39. $city_limit .= !$areaid ? '' : ' AND a.areaid = \'' . $areaid . '\'';
  40. $level_limit = ' AND a.status = \'1\' AND a.if_corp = \'1\'';
  41. $sql = empty($cate_limit) ? 'SELECT a.* FROM `' . $db_mymps . 'member` AS a WHERE 1 ' . $level_limit . ' ' . $cate_limit . $city_limit . ' ORDER BY a.levelid DESC,a.jointime DESC' : 'SELECT a.* FROM `' . $db_mymps . 'member` AS a LEFT JOIN `' . $db_mymps . 'member_category` AS b ON a.userid = b.userid WHERE 1 ' . $level_limit . ' ' . $cate_limit . $city_limit . ' ORDER BY a.levelid DESC,a.jointime DESC';
  42. $count_sql = empty($cate_limit) ? 'SELECT COUNT(a.id) FROM `' . $db_mymps . 'member` AS a WHERE 1 ' . $level_limit . $city_limit : 'SELECT COUNT(b.id) FROM `' . $db_mymps . 'member` AS a LEFT JOIN ' . $db_mymps . 'member_category AS b ON a.userid = b.userid WHERE 1 ' . $level_limit . $cate_limit . $city_limit;
  43. $rows_num = $db->getOne($count_sql);
  44. $param = setParam(array('catid', 'areaid'), $rewrite, 'corporation-');
  45. if (is_array($res = page1($sql, $mymps_global['cfg_list_page_line'] ? $mymps_global['cfg_list_page_line'] : 10))) {
  46. foreach ($res as $key => $val) {
  47. $arr['userid'] = $val['userid'];
  48. $arr['per_certify'] = $val['per_certify'];
  49. $arr['com_certify'] = $val['com_certify'];
  50. $arr['jointime'] = $val['jointime'];
  51. $arr['credits'] = $val['credits'];
  52. $arr['credit'] = $val['credit'];
  53. $val['prelogo'] = $val['prelogo'] ? $val['prelogo'] : '/images/nophoto.jpg';
  54. $arr['prelogo'] = !strstr($val['prelogo'], 'http') ? $mymps_global['SiteUrl'] . $val['prelogo'] : $val['prelogo'];
  55. $arr['tname'] = HighLight($val['tname'] ? $val['tname'] : $val['userid'], $keywords);
  56. $arr['uri'] = Rewrite('store', array('uid' => $val['id']));
  57. $arr['uri_comment'] = Rewrite('store', array('uid' => $val['id'], 'part' => 'comment'));
  58. $arr['uri_contactus'] = Rewrite('store', array('uid' => $val['id'], 'part' => 'contactus'));
  59. $arr['uri_album'] = Rewrite('store', array('uid' => $val['id'], 'part' => 'album'));
  60. $arr['address'] = $val['address'] ? $val['address'] : ($val['busway'] ? $val['busway'] : '暂无地址');
  61. $arr['levelid'] = $val['levelid'];
  62. $arr['tel'] = $val['tel'] ? $val['tel'] : '暂无电话';
  63. $member[] = $arr;
  64. }
  65. }
  66. $ypcategory = get_corp_tree(empty($cur['parentid']) ? $catid : $cur['parentid'], 'corp');
  67. $area_list = cat_list('area', 0, 0, false, 1);
  68. if (is_array($area_list)) {
  69. $area_list = array_merge(array(
  70. array('areaid' => '', 'areaname' => '不限地区')
  71. ), $area_list);
  72. if (is_array($area_list)) {
  73. foreach ($area_list as $areakey => $areaval) {
  74. $area_list[$areakey]['uri'] = Rewrite('corp', array('catid' => $catid, 'areaid' => $areaval['areaid']));
  75. $area_list[$areakey]['select'] = $areaval['areaid'] == $areaid ? '1' : 0;
  76. }
  77. }
  78. }
  79. $loc = get_location('corp', $catid);
  80. $page_title = $loc['page_title'];
  81. $location = $loc['location'];
  82. $advertisement = get_advertisement('other');
  83. $adveritems = $advertisement['items'];
  84. $advertisement = $advertisement['all'];
  85. $pageview = page2($rewrite);
  86. $certifymember = mymps_get_members(10, 1, NULL, 1, 1);
  87. $totalnum = $rows_num;
  88. globalassign();
  89. include mymps_tpl(CURSCRIPT);
  90. is_object($db) && $db->Close();
  91. ?>