diff --git a/application/config/development/constants.php b/application/config/development/constants.php index 88d6f95cb1cc95902be2f7133cc071dfd5666cf4..e78926200b25831f59a4db465c2f3c12a1368f8c 100644 --- a/application/config/development/constants.php +++ b/application/config/development/constants.php @@ -1,8 +1,6 @@ db->query ( getwheresql ( 'user', " expert=1 " . $orderwhere , $this->db->dbprefix ) )->row_array () ) : returnarraynum ( $this->db->query ( getwheresql ( 'user', " expert=1 " . $orderwhere . "and uid IN (SELECT uid FROM " . $this->db->dbprefix . "user_category WHERE cid=$cid)" , $this->db->dbprefix ) )->row_array () ); $expertlist = $this->expert_model->get_list ( 1, $startindex, $pagesize, $cid, $status ); $departstr = page ( $rownum, $pagesize, $page, "expert/default/$cid/$status" ); - $questionlist = $this->expert_model->get_solves ( 0, 15 ); + include template ( 'expert' ); } diff --git a/system/helpers/public_helper.php b/system/helpers/public_helper.php index ab315012067f660616b6397f3a512026f83b3dc1..3b5627b50bda6052e7c1fc1c6e9af6e335b5920f 100644 --- a/system/helpers/public_helper.php +++ b/system/helpers/public_helper.php @@ -319,6 +319,19 @@ function getcaturl($catid, $url, $userdir = true) { function url($var, $url = '') { global $setting; $_fix = ''; + //文章id转加密 +// if (strstr ( $var, 'topic/getone' )) { +// $_urlparms=explode('/', $var); +// if(is_array($_urlparms)){ +// $_aid=intval($_urlparms[2]); +// if($_aid){ +// $var="topic/getone/".endecodeID($_urlparms[2]); +// } + +// //runlog('url', $var."--".$_urlparms[2]."--".endecodeID($_urlparms[2])."--".endecodeID("52AA7C63A15026736486F2",'decode')); +// } + +// } if (strstr ( $var, 'seo/index' ) || strstr ( $var, 'ask/index' ) || strstr ( $var, 'category/view' ) || strstr ( $var, 'topic/catlist' )) { // 去掉文章栏目和问题栏目的url尾巴 } else { @@ -336,7 +349,7 @@ function url($var, $url = '') { } $location = urlmap ( $location, 2 ); - if (strstr ( trim ( config_item ( 'mobile_domain' ) ), $_SERVER ['SERVER_NAME'] )) { + if (strstr ( trim ( config_item ( 'mobile_domain' ) ),$_SERVER ['HTTP_HOST'] )) { if (config_item ( 'mobile_domain' )) { return config_item ( 'mobile_domain' ) . $location; @@ -358,6 +371,7 @@ if (! function_exists ( 'updateinfo' )) { */ function updateinfo($user) { global $setting; + defined('P_VERSION') OR define('P_VERSION', 'null'); $CI = & get_instance (); $sitename = $setting ['site_name']; $siturl = $_SERVER ['HTTP_HOST']; @@ -365,7 +379,7 @@ if (! function_exists ( 'updateinfo' )) { 'sitename' => $sitename, 'siteurl' => $siturl, 'email' => $user ['email'], - 'version' => ASK2_VERSION, + 'version' => P_VERSION.ASK2_VERSION, 'release' => ASK2_RELEASE, 'phpos' => PHP_OS, 'phpversion' => phpversion (), @@ -375,7 +389,7 @@ if (! function_exists ( 'updateinfo' )) { 'phone' => urlencode ( $user ['phone'] ) ); $data = http_build_query ( $pars ); - return 'https://www.ask2.cn/updatesite.php?' . $data; + return 'https://wenda.whatsns.com/updatesite.php?' . $data; } } /* @@ -519,7 +533,7 @@ function clearhtml($miaosu, $len = '200') { } function generate_key() { $random = random ( 20 ); - $info = md5 ( $_SERVER ['SERVER_SOFTWARE'] . $_SERVER ['SERVER_NAME'] . $_SERVER ['SERVER_ADDR'] . $_SERVER ['SERVER_PORT'] . $_SERVER ['HTTP_USER_AGENT'] . time () ); + $info = md5 ( $_SERVER ['SERVER_SOFTWARE'] . $_SERVER ['HTTP_HOST'] . $_SERVER ['SERVER_ADDR'] . $_SERVER ['SERVER_PORT'] . $_SERVER ['HTTP_USER_AGENT'] . time () ); $return = ''; for($i = 0; $i < 64; $i ++) { $p = intval ( $i / 2 ); @@ -799,8 +813,8 @@ if (! function_exists ( 'template' )) { if ($tpldir == '') $tpl_dir = $setting ['tpl_dir']; } - // if (! empty ( config_item ( 'mobile_domain' ) ) && $_SERVER ['SERVER_NAME']) { - if (strstr ( trim ( config_item ( 'mobile_domain' ) ), $_SERVER ['SERVER_NAME'] )) { + // if (! empty ( config_item ( 'mobile_domain' ) ) && $_SERVER ['HTTP_HOST']) { + if (strstr ( trim ( config_item ( 'mobile_domain' ) ),$_SERVER ['HTTP_HOST'] )) { $tpldir = $setting ['tpl_wapdir']; } // } @@ -808,6 +822,11 @@ if (! function_exists ( 'template' )) { if (strstr ( $setting ['tpl_dir'], 'responsive_' )) { $tpldir = $setting ['tpl_dir']; } + if ($_SESSION ['themename'] && ! is_mobile ()) { + + $tpldir = $_SESSION ['themename']; + } + $querystring = isset ( $_SERVER ['REQUEST_URI'] ) ? $_SERVER ['REQUEST_URI'] : ''; $querystring = str_replace ( '.html', '', $querystring ); $querystring = str_replace ( '/?', '', $querystring ); @@ -1009,6 +1028,34 @@ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { return $keyc . str_replace ( '=', '', base64_encode ( $result ) ); } } + +/** + * 加密解密id, + * @param unknown $string + * @param string $action encode|decode + * @return string + */ +function endecodeID($string, $action = 'encode') { + $startLen = 13; + $endLen = 8; + + $coderes = ''; + #TOD 暂设定uid字符长度最大到9 + if ($action=='encode') { + $uidlen = strlen($string); + $salt = 'whatsns'; + $codestr = $string.$salt; + $encodestr = hash('md4', $codestr); + $coderes = $uidlen.substr($encodestr, 5,$startLen-$uidlen).$string.substr($encodestr, -12,$endLen); + + }elseif($action=='decode'){ + $string=strtoupper($string); + $strlen = strlen($string); + $uidlen = $string[0]; + $coderes = substr($string, $startLen-$uidlen+1,$uidlen); + } + return $coderes; +} function encode($string = '', $skey = 'mishen') { $strArr = str_split ( base64_encode ( $string ) ); $strCount = count ( $strArr );