ekarray[date("w", strtotime("+2 day"))]; $_show['info'] = $shengshi."气象局{$ri}日(星期{$week}) {$shi}时预计,{$Ab}后天{$ri1}(星期{$week1})天气".$today_weather['tq'].",最低气温".$today_weather['min_degree']."℃,最高气温".$today_weather['max_degree']."℃,".$today_weather['day_wind_direction'].$today_weather['day_wind_direction_code']."级,_cfg['webdir']."\" title=\"".$run->_cfg['webname']."\">".$run->_cfg['webname']."提醒您密切关注".$Ab.$dateName.",天有不测风云,查询结果偶有误差,仅供参考!"; } $ret['today'] = $today_weather; $ret['area'] = $_show; $ret['shengshi'] = $shengshi; //7天 $days7 = array(); for($i=0;$i<7;$i++){ $this_weather = $Weather['Weather'][$i]; $run->tianqi_weather->format_weather($this_weather); $days7[] = array( 'date' => date("Y年m月d日", strtotime("+{$i} day")), 'week' => $weekarray[date("w", strtotime("+{$i} day"))], 'img0'=>$this_weather['img0'], 'img1'=>$this_weather['img1'], 'tq'=>$this_weather['tq'], 'wendu0'=>$this_weather['min_degree'], 'wendu1'=>$this_weather['max_degree'], 'feng'=>$this_weather['day_wind_direction'], 'fengli'=>$this_weather['day_wind_direction_code'].'级', ); } $ret['days7'] = $days7; //30天 $days30 = array(); if($_date == '40tian'){ $d = 40; }elseif($_date == '60tian'){ $d = 60; }else{ $d = 30; } for($i=7;$i<$d;$i++){ if($i==7 || $i==14 || $i==21 || $i==28){ $j = 3; }elseif($i==8 || $i==15 || $i==22 || $i==29){ $j = 4; }elseif($i==9 || $i==16 || $i==23){ $j = 5; }elseif($i==10 || $i==17 || $i==24){ $j = 6; }elseif($i==11 || $i==18 || $i==25){ $j = 0; }elseif($i==12 || $i==19 || $i==26){ $j = 1; }elseif($i==13 || $i==20 || $i==27){ $j = 2; } if($d > 30){ if($i==14 || $i==21 || $i==28){ $j = 3; }elseif($i==15 || $i==22 || $i==29){ $j = 4; }elseif($i==16 || $i==23 || $i==30){ $j = 5; }elseif($i==17 || $i==24 || $i==31){ $j = 6; }elseif($i==18 || $i==25 || $i==32){ $j = 0; }elseif($i==19 || $i==26 || $i==33){ $j = 1; }elseif($i==20 || $i==27 || $i==34){ $j = 2; }elseif($i==21 || $i==28 || $i==35){ $j = 3; }elseif($i==36 || $i==43 || $i==50){ $j = 4; }elseif($i==37 || $i==44 || $i==51){ $j = 5; }elseif($i==38 || $i==45 || $i==52){ $j = 6; }elseif($i==39 || $i==46 || $i==53){ $j = 0; }elseif($i==40 || $i==47 || $i==54){ $j = 1; }elseif($i==41 || $i==48 || $i==55){ $j = 2; }elseif($i==42 || $i==49 || $i==56){ $j = 3; }elseif($i==43 || $i==50 || $i==57){ $j = 4; }elseif($i==44 || $i==51 || $i==58){ $j = 5; }elseif($i==45 || $i==52 || $i==59){ $j = 6; } } $this_weather = $Weather['Weather'][$j]; $run->tianqi_weather->format_weather($this_weather); $days30[] = array( 'date' => date("Y年m月d日", strtotime("+{$i} day")), 'week' => $weekarray[date("w", strtotime("+{$i} day"))], 'img0'=>$this_weather['img0'], 'img1'=>$this_weather['img1'], 'tq'=>$this_weather['tq'], 'wendu0'=>$this_weather['min_degree'], 'wendu1'=>$this_weather['max_degree'], 'feng'=>$this_weather['day_wind_direction'], 'fengli'=>$this_weather['day_wind_direction_code'].'级', ); } $ret['days30'] = $days30; // for($t=0;$t<3;$t++){ // if(isset($Weather['Weather'][3][$t]) && $Weather['Weather'][3][$t]){ // $Weather['Weather'][3][$t] = $run->_cfg['tpl'].substr($Weather['Weather'][3][$t], 1); // } // if(isset($Weather['Weather'][9][$t]) && $Weather['Weather'][9][$t]){ // $Weather['Weather'][9][$t] = $run->_cfg['tpl'].substr($Weather['Weather'][9][$t], 1); // } // } $ret['weather'] = $Weather; if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } $gdata = block_global_tianqi_area_city(array ( )); function block_tianqi_area_by_pinyin($conf) { global $run; $life = isset($conf['life']) ? (int)$conf['life'] : (isset($run->_cfg['life']) ? (int)$run->_cfg['life'] : 0); $pinyin = empty($conf['pinyin']) ? '' : $conf['pinyin']; //多个用,隔开 $_date = isset($_GET['date']) ? $_GET['date'] : $run->_cfg['le_tianqi_default_day']; if(!$pinyin){ $pinyin = $run->_cfg['le_tianqi_hot_city']; } $cache_params = array($pinyin, $_date); //优先从缓存表读取。加前缀,避免不同的block,相同的cache_params,导致缓存数据错乱 $cache_key = $life ? md5('tianqi_area_by_pinyin'.serialize($cache_params)) : ''; if($cache_key){ $cache_data = $run->runtime->get_block_data_cache($cache_key); if($cache_data){ return $cache_data; } } $pinyin_arr = explode(',',$pinyin); $where = array('pinyin'=>array('IN'=> $pinyin_arr)); $le_tianqi_days = $run->_cfg['le_tianqi_days']; if(!isset($le_tianqi_days[$_date])){ core::error404(); } $ret['dateName'] = $le_tianqi_days[$_date]['name']; $ret['list'] = $run->tianqi_area->find_fetch($where); foreach($ret['list'] as &$v){ $v['url'] = $run->tianqi_area->_url($v['pinyin'], $_date); $v['title'] = $v['Ab'].$ret['dateName']; } if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } function block_tianqi_searchtq($conf) { global $run; $life = isset($conf['life']) ? (int)$conf['life'] : (isset($run->_cfg['life']) ? (int)$run->_cfg['life'] : 0); $orderby = isset($conf['orderby']) && in_array($conf['orderby'], array('id', 'orderby')) ? $conf['orderby'] : 'id'; $orderway = isset($conf['orderway']) && $conf['orderway'] == 1 ? 1 : -1; $start = _int($conf, 'start'); $limit = _int($conf, 'limit', 100); $cache_params = array($orderby, $orderway, $start, $limit); //优先从缓存表读取。加前缀,避免不同的block,相同的cache_params,导致缓存数据错乱 $cache_key = $life ? md5('tianqi_searchtq'.serialize($cache_params)) : ''; if($cache_key){ $cache_data = $run->runtime->get_block_data_cache($cache_key); if($cache_data){ return $cache_data; } } $ret['list'] = $run->tianqi_area->Getone_pArea(0, $orderby, $orderway, $start, $limit); if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } function block_tianqi_area_rand($conf) { global $run; $life = isset($conf['life']) ? (int)$conf['life'] : (isset($run->_cfg['life']) ? (int)$run->_cfg['life'] : 0); $_date = isset($_GET['date']) ? $_GET['date'] : ''; $limit = _int($conf, 'limit', 20); $cache_params = array($limit, $_date); //优先从缓存表读取。加前缀,避免不同的block,相同的cache_params,导致缓存数据错乱 $cache_key = $life ? md5('tianqi_area_rand'.serialize($cache_params)) : ''; if($cache_key){ $cache_data = $run->runtime->get_block_data_cache($cache_key); if($cache_data){ return $cache_data; } } $le_tianqi_days = $run->_cfg['le_tianqi_days']; $table_prefix = $_ENV['_config']['db']['master']['tablepre']; $table_full = $table_prefix.'tianqi_weather'; //tianqi_weather条数2069 $max = 2069-$limit; $rand = rand(1, $max); $sql = 'SELECT areaid FROM ' . $table_full . ' LIMIT '.$rand.','. $limit; $arr = $run->db->fetch_all($sql); $keys = array(); foreach($arr as $v){ $keys[] = $v['areaid']; } if($_date){ if(!isset($le_tianqi_days[$_date])){ core::error404(); } $ret['dateName'] = $le_tianqi_days[$_date]['name']; }else{ $ret['dateName'] = '天气30天'; } $ret['list'] = $run->tianqi_area->mget($keys); foreach($ret['list'] as $k=>&$v){ if(!isset($v['pinyin']) || empty($v['pinyin'])){ unset($ret['list'][$k]); continue; } $v['url'] = $run->tianqi_area->_url($v['pinyin'], $_date); $v['title'] = $v['Ab'].$ret['dateName']; } if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } /** * 内容列表模块(增加根据字段读取,较少使用) * @param int cid 分类ID 如果不填:自动识别 (不推荐用于读取频道分类,影响性能) * @param string cids 分类ID串 (必须是同一个模型下的) * @param int mid 模型ID (当cid为0时,设置mid才能生效,否则程序自动识别) * @param string dateformat 时间格式 * @param int titlenum 标题长度 * @param int intronum 简介长度 * @param string orderby 排序方式 * @param int orderway 降序(-1),升序(1) * @param int start 开始位置 * @param int limit 显示几条 * @param int showcate 是否显示分类信息 * @param int showviews 是否显示内容浏览量信息 * @param int field_format 是否格式化主表自定义字段内容(主要是单选框、多选框、下拉框、图集等) * @param int life 缓存时间 * @param string field 字段名 * @param string field_val 字段值(单个) * @param string field_match 匹配方式,默认为=,也可以是LIKE,只对单字段值有效 * @param string field_vals 字段值(多个),优先级高于单字段值 * @param string field_vals_sep 多个字段值分隔符,默认为, * @return array */ function block_list_by_field($conf) { global $run; $cid = isset($conf['cid']) ? intval($conf['cid']) : (isset($_GET['cid']) ? intval($_GET['cid']) : 0); $cids = empty($conf['cids']) ? '' : $conf['cids']; //多个cid 用,隔开 $mid = isset($conf['mid']) ? max(2, intval($conf['mid'])) : (isset($_GET['mid']) ? max(2, intval($_GET['mid'])) : 2); $dateformat = empty($conf['dateformat']) ? 'Y-m-d H:i:s' : $conf['dateformat']; $titlenum = _int($conf, 'titlenum'); $intronum = _int($conf, 'intronum'); $orderby = isset($conf['orderby']) && in_array($conf['orderby'], array('id', 'dateline', 'lasttime', 'comments')) ? $conf['orderby'] : 'id'; $orderway = isset($conf['orderway']) && $conf['orderway'] == 1 ? 1 : -1; $start = _int($conf, 'start', 0); $limit = _int($conf, 'limit', 10); $showcate = _int($conf, 'showcate', 0); $showviews = _int($conf, 'showviews', 0); $field_format = _int($conf, 'field_format', 0); $life = isset($conf['life']) ? (int)$conf['life'] : (isset($run->_cfg['life']) ? (int)$run->_cfg['life'] : 0); $field = isset($conf['field']) ? $conf['field'] : 'title'; $field_val = isset($conf['field_val']) ? $conf['field_val'] : ''; $field_vals = isset($conf['field_vals']) ? $conf['field_vals'] : ''; $field_vals_sep = isset($conf['field_vals_sep']) ? $conf['field_vals_sep'] : ','; //内容页 field_val为某个变量? if(!$field_val && isset($GLOBALS['_show'][$field])){ $field_val = $GLOBALS['_show'][$field]; } $field_match = isset($conf['field_match']) ? $conf['field_match'] : '='; $extra = array('block_name'=>'block_list_by_field'); $cache_params = array($cid, $cids, $mid, $dateformat, $titlenum, $intronum, $orderby, $orderway, $start, $limit, $showcate, $showviews, $field_format, $field, $field_val, $field_vals, $field_vals_sep, $field_match); //优先从缓存表读取。加前缀,避免不同的block,相同的cache_params,导致缓存数据错乱 $cache_key = $life ? md5('list_by_field'.serialize($cache_params)) : ''; if($cache_key){ $cache_data = $run->runtime->get_block_data_cache($cache_key); if($cache_data){ return $cache_data; } } // 读取分类内容 if ($cids){ $cid_arr = explode(',', $cids); $where = array('cid' => array("IN" => $cid_arr)); // 影响数据库性能 $cate_name = 'No Title'; $cate_url = 'javascript:;'; $table_arr = &$run->_cfg['table_arr']; $table = isset($table_arr[$mid]) ? $table_arr[$mid] : 'article'; }else{ if($cid == 0) { $cate_name = 'No Title'; $cate_url = 'javascript:;'; $table_arr = &$run->_cfg['table_arr']; $table = isset($table_arr[$mid]) ? $table_arr[$mid] : 'article'; $where = array(); }else{ $cate_arr = $run->category->get_cache($cid); if(empty($cate_arr)) return; $cate_name = $cate_arr['name']; $cate_url = $run->category->category_url($cate_arr); $table = &$cate_arr['table']; $mid = $cate_arr['mid']; if(!empty($cate_arr['son_cids']) && is_array($cate_arr['son_cids'])) { $where = array('cid' => array("IN" => $cate_arr['son_cids'])); // 影响数据库性能 }else{ $where = array('cid' => $cid); } } } //过滤单页模型 if($table == 'page'){ return array(); } //字段条件 if($field){ if($field_vals){ $where[$field] = array("IN" => explode($field_vals_sep, $field_vals)); }else{ switch ($field_match){ case 'LIKE': $where[$field] = array('LIKE'=>$field_val); break; default: $where[$field] = $field_val; } } } if($showcate){ $allcategorys = $run->category->get_category_db(); }else{ $allcategorys = array(); } // 初始模型表名 $run->cms_content->table = 'cms_'.$table; // 读取内容列表 $list_arr = $run->cms_content->list_arr($where, $orderby, $orderway, $start, $limit, $limit, $extra); if($showviews && $list_arr){ $run->cms_content_views->table = 'cms_'.$table.'_views'; $keys = array(); foreach($list_arr as $v) { $keys[] = $v['id']; } $views_list_arr = $run->cms_content_views->mget($keys); $views_key = 'cms_'.$table.'_views-id-'; }else{ $views_key = ''; $views_list_arr = array(); } $xuhao = 1; foreach($list_arr as &$v) { $run->cms_content->format($v, $mid, $dateformat, $titlenum, $intronum, $field_format); if($showcate && $allcategorys){ $cate = isset($allcategorys[$v['cid']]) ? $allcategorys[$v['cid']] : array(); $run->category->getCategoryInfoByList($v, $cate); } if($showviews && $views_list_arr){ $v['views'] = isset($views_list_arr[$views_key.$v['id']]['views']) ? (int)$views_list_arr[$views_key.$v['id']]['views'] : 0; } $v['xuhao'] = $xuhao; $xuhao++; } $ret = array('cate_name'=> $cate_name, 'cate_url'=> $cate_url, 'list'=> $list_arr); if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } /** * 内容列表模块 * @param int cid 分类ID 如果不填:自动识别 (不推荐用于读取频道分类,影响性能) * @param string cids 分类ID串 (必须是同一个模型下的) * @param int mid 模型ID (当cid为0时,设置mid才能生效,否则程序自动识别) * @param string dateformat 时间格式 * @param int titlenum 标题长度 * @param int intronum 简介长度 * @param string orderby 排序方式 * @param int orderway 降序(-1),升序(1) * @param int start 开始位置 * @param int limit 显示几条 * @param int showcate 是否显示分类信息 * @param int showviews 是否显示内容浏览量信息 * @param int showsoncate 是否显示子分类信息(传递的cid有子级分类才有效) * @param int field_format 是否格式化主表自定义字段内容(主要是单选框、多选框、下拉框、图集等) * @param int life 缓存时间 * @return array */ function block_list($conf) { global $run; $cid = isset($conf['cid']) ? intval($conf['cid']) : (isset($_GET['cid']) ? intval($_GET['cid']) : 0); $cids = empty($conf['cids']) ? '' : $conf['cids']; //多个cid 用,隔开 $mid = isset($conf['mid']) ? max(2, intval($conf['mid'])) : (isset($_GET['mid']) ? max(2, intval($_GET['mid'])) : 2); $dateformat = empty($conf['dateformat']) ? 'Y-m-d H:i:s' : $conf['dateformat']; $titlenum = _int($conf, 'titlenum'); $intronum = _int($conf, 'intronum'); $orderby = isset($conf['orderby']) && in_array($conf['orderby'], array('id', 'dateline', 'lasttime', 'comments')) ? $conf['orderby'] : 'id'; $orderway = isset($conf['orderway']) && $conf['orderway'] == 1 ? 1 : -1; $start = _int($conf, 'start', 0); $limit = _int($conf, 'limit', 10); $showcate = _int($conf, 'showcate', 0); $showviews = _int($conf, 'showviews', 0); $showsoncate = _int($conf, 'showsoncate', 0); $field_format = _int($conf, 'field_format', 0); $life = isset($conf['life']) ? (int)$conf['life'] : (isset($run->_cfg['life']) ? (int)$run->_cfg['life'] : 0); $extra = array('block_name'=>'block_list'); $cache_params = array($cid, $cids, $mid, $dateformat, $titlenum, $intronum, $orderby, $orderway, $start, $limit, $showcate, $showviews, $showsoncate, $field_format); $ret = array('cate_name'=> '', 'cate_url'=> '', 'list'=> array()); //优先从缓存表读取。加前缀,避免不同的block,相同的cache_params,导致缓存数据错乱 $cache_key = $life ? md5('list'.serialize($cache_params)) : ''; if($cache_key){ $cache_data = $run->runtime->get_block_data_cache($cache_key); if($cache_data){ return $cache_data; } } // 读取分类内容 if ($cids){ $cid_arr = explode(',', $cids); $where = array('cid' => array("IN" => $cid_arr)); // 影响数据库性能 $cate_name = 'No Title'; $cate_url = 'javascript:;'; $table_arr = &$run->_cfg['table_arr']; $table = isset($table_arr[$mid]) ? $table_arr[$mid] : 'article'; }else{ if($cid == 0) { $cate_name = 'No Title'; $cate_url = 'javascript:;'; $table_arr = &$run->_cfg['table_arr']; $table = isset($table_arr[$mid]) ? $table_arr[$mid] : 'article'; $where = array(); }else{ $cate_arr = $run->category->get_cache($cid); if(empty($cate_arr)) return $ret; $cate_name = $cate_arr['name']; $cate_url = $run->category->category_url($cate_arr); $table = &$cate_arr['table']; $mid = $cate_arr['mid']; if(!empty($cate_arr['son_cids']) && is_array($cate_arr['son_cids'])) { $where = array('cid' => array("IN" => $cate_arr['son_cids'])); // 影响数据库性能 if($showsoncate){ $soncatelist = $run->category->mget($cate_arr['son_cids']); $xuhao = 1; foreach($soncatelist as &$soncate){ $run->category->format($soncate); $soncate['xuhao'] = $xuhao; $xuhao++; } } }else{ $where = array('cid' => $cid); } } } //过滤单页模型 if($table == 'page'){ return $ret; } if($showcate){ $allcategorys = $run->category->get_category_db(); }else{ $allcategorys = array(); } // 初始模型表名 $run->cms_content->table = 'cms_'.$table; // 读取内容列表 $list_arr = $run->cms_content->list_arr($where, $orderby, $orderway, $start, $limit, $limit, $extra); if($showviews && $list_arr){ $run->cms_content_views->table = 'cms_'.$table.'_views'; $keys = array(); foreach($list_arr as $v) { $keys[] = $v['id']; } $views_list_arr = $run->cms_content_views->mget($keys); $views_key = 'cms_'.$table.'_views-id-'; }else{ $views_key = ''; $views_list_arr = array(); } $xuhao = 1; foreach($list_arr as &$v) { $run->cms_content->format($v, $mid, $dateformat, $titlenum, $intronum, $field_format); if($showcate && $allcategorys){ $cate = isset($allcategorys[$v['cid']]) ? $allcategorys[$v['cid']] : array(); $run->category->getCategoryInfoByList($v, $cate); } if($showviews && $views_list_arr){ $v['views'] = isset($views_list_arr[$views_key.$v['id']]['views']) ? (int)$views_list_arr[$views_key.$v['id']]['views'] : 0; } $v['xuhao'] = $xuhao; $xuhao++; } $ret['cate_name'] = $cate_name; $ret['cate_url'] = $cate_url; $ret['list'] = $list_arr; if(isset($soncatelist)){ $ret['soncate'] = $soncatelist; } if($cache_key){ $run->runtime->set_block_data_cache($cache_key, $ret, $life); } return $ret; } /** * 友情链接插件 * @param string cate 分类 * @param string orderby 排序方式 * @param int orderway 降序(-1),升序(1) * @param int start 开始位置 * @param int limit 显示几条 * @return array */ function block_links($conf) { global $run; // 兼容旧版表结构:确保 expire / position 字段存在 static $field_checked = false; if(!$field_checked) { $field_checked = true; $tablepre = $run->db->tablepre; $cols = $run->db->fetch_all("SHOW COLUMNS FROM {$tablepre}links"); $fields = array(); foreach($cols as $c) { $fields[$c['Field']] = 1; } if(!isset($fields['expire'])) { $run->db->query("ALTER TABLE {$tablepre}links ADD COLUMN expire int(10) unsigned NOT NULL DEFAULT '0' COMMENT '到期时间戳(0为永久)'"); } if(!isset($fields['position'])) { $run->db->query("ALTER TABLE {$tablepre}links ADD COLUMN position tinyint(3) unsigned NOT NULL DEFAULT '15' COMMENT '显示位置位掩码:1=PC首页2=PC内页4=手机首页8=手机内页15=全部'"); } } // 计算当前页面的位置 bitmask // 1=PC首页 2=PC内页 4=手机首页 8=手机内页 $cur_pos = 0; $is_mobile = is_mobile(); $uri = isset($_SERVER['REQUEST_URI']) ? ltrim(strtok($_SERVER['REQUEST_URI'], '?'), '/') : ''; $is_home = ($uri === '' || $uri === 'index.php'); if($is_mobile) { $cur_pos = $is_home ? 4 : 8; } else { $cur_pos = $is_home ? 1 : 2; } $where = array(); $orderby = isset($conf['orderby']) && in_array($conf['orderby'], array('id', 'orderby')) ? $conf['orderby'] : 'id'; $orderway = isset($conf['orderway']) && $conf['orderway'] == 1 ? 1 : -1; $start = _int($conf, 'start'); $limit = _int($conf, 'limit', 10); $arr = $run->links->find_fetch($where, array($orderby => $orderway), $start, $limit); // 已过期的友情链接自动删除 (同时从前台输出中剔除) $time = $_ENV['_time']; foreach($arr as $k => $v) { if(!empty($v['expire']) && $v['expire'] < $time) { $run->links->delete($v['id']); unset($arr[$k]); continue; } // 按显示位置过滤 $link_pos = isset($v['position']) ? (int)$v['position'] : 15; if($link_pos != 15 && !($link_pos & $cur_pos)) { unset($arr[$k]); } } return $arr; } ?> 【潼关天气预报30天(一个月)查询】潼关30天天气预报-潼关30天的天气情况-天气号
Lecms 3.0.3 错误

错误信息

错误位置

基本信息

程序流程

SQL

$_GET

$_POST

$_COOKIE

包含文件

其他信息