ypt($mid.'_'.$tagid); return $this->cfg['weburl'].'index.php?tag--encrypt-'.$encrypt.$s.$_ENV['_config']['url_suffix']; break; case 3: $encrypt = hashids_encrypt($mid,$tagid); return $this->cfg['weburl'].'index.php?tag--encrypt-'.$encrypt.$s.$_ENV['_config']['url_suffix']; break; } }else{ $s = $page ? '/page_{page}' : ''; switch ($link_tag_type){ case 0: return $this->cfg['weburl'].$this->cfg['link_tag_pre'].($mid > 2 ? $mid.'_' : '').urlencode($name).$s.$this->cfg['link_tag_end']; break; case 1: return $this->cfg['weburl'].$this->cfg['link_tag_pre'].($mid > 2 ? $mid.'_' : '').$tagid.$s.$this->cfg['link_tag_end']; break; case 2: $encrypt = encrypt($mid.'_'.$tagid); return $this->cfg['weburl'] . $this->cfg['link_tag_pre'] . $encrypt.$s.$this->cfg['link_tag_end']; break; case 3: $encrypt = hashids_encrypt($mid,$tagid); return $this->cfg['weburl'] . $this->cfg['link_tag_pre'] . $encrypt.$s.$this->cfg['link_tag_end']; break; } } } // 评论链接格式化 public function comment_url($cid = 0, $id = 0, $page = FALSE) { //使用相对URL if(isset($this->cfg['url_path']) && !empty($this->cfg['url_path'])){ $this->cfg['weburl'] = $this->cfg['webdir']; } if(empty($_ENV['_config']['lecms_parseurl'])) { $s = $page ? '-page-{page}' : ''; return $this->cfg['weburl'].'index.php?comment--cid-'.$cid.'-id-'.$id.$s.$_ENV['_config']['url_suffix']; }else{ return $this->cfg['weburl'].$this->cfg['link_comment_pre'].$cid.'_'.$id.($page ? '_{page}' : '').$_ENV['_config']['url_suffix']; } } // 内容链接格式化 public function content_url(&$content, $mid = 2, $page = FALSE, $extra = array()) { $url = ''; $link_show_end = isset($this->cfg['link_show_end']) ? $this->cfg['link_show_end'] : $_ENV['_config']['url_suffix']; $id = isset($content['id']) ? (int)$content['id'] : 0; $cid = isset($content['cid']) ? (int)$content['cid'] : 0; $alias = isset($content['alias']) ? $content['alias'] : ''; empty($alias) && $alias = $cid.'_'.$id; $dateline = isset($content['dateline']) ? (int)$content['dateline'] : 0; //使用相对URL if(isset($this->cfg['url_path']) && !empty($this->cfg['url_path'])){ $this->cfg['weburl'] = $this->cfg['webdir']; } if(empty($id) || empty($cid)){ return ''; } if(empty($_ENV['_config']['lecms_parseurl'])) { $url .= $this->cfg['weburl'].'index.php?show--cid-'.$cid.'-id-'.$id.($page ? '-page-{page}' : '').$_ENV['_config']['url_suffix']; }else{ switch($this->cfg['link_show_type']) { case 1: //数字型 $url .= $this->cfg['weburl'].$cid.'/'.$id.$link_show_end; break; case 2: //推荐型 if(!isset($this->cfg['cate_arr'][$cid])){return '';} $url .= $this->cfg['weburl'].$this->cfg['cate_arr'][$cid].'/'.$id.$link_show_end; break; case 3: //别名型 $url .= $this->cfg['weburl'].$alias.$link_show_end; break; case 4: //加密型 $url .= $this->cfg['weburl'].encrypt($cid.'_'.$id).$link_show_end; break; case 8: //HashId,放前面 提高命中率 $url .= $this->cfg['weburl'].hashids_encrypt($cid,$id).$link_show_end; break; case 5: //模型ID_数字型 if($mid > 2){ $url .= $this->cfg['weburl'].$mid.'_'.$id.$link_show_end; }else{ $url .= $this->cfg['weburl'].$id.$link_show_end; } break; case 6: //分类别名+内容别名型 if(!isset($this->cfg['cate_arr'][$cid])){return '';} $url .= $this->cfg['weburl'].$this->cfg['cate_arr'][$cid].'/'.$alias.$link_show_end; break; case 7: //灵活型 $url .= $this->cfg['weburl'].strtr($this->cfg['link_show'], array( '{cid}' => $cid, '{mid}' => $mid, '{id}' => $id, '{alias}' => $alias, '{cate_alias}' => isset($this->cfg['cate_arr'][$cid]) ? $this->cfg['cate_arr'][$cid] : '', '{password}' => encrypt($cid.'_'.$id), '{ymd}' => date('Ymd', $dateline), '{y}' => date('Y', $dateline), '{m}' => date('m', $dateline), '{d}' => date('d', $dateline), '{auth_key}' => substr(md5($_ENV['_config']['auth_key']), 0, 6), '{hashids}' => hashids_encrypt($cid,$id) )); break; } if($page){ $url .= '&page={page}'; } } return $url; } //用户模块相关URL,只涉及 user-xxx 或者 my-xxx(为了兼容旧版本的插件使用该函数, 新的开发请使用 urls_model里面的该函数) public function user_url($action = 'index', $control = 'user', $page = false, $extra = array()){ //使用相对URL if(isset($this->cfg['url_path']) && !empty($this->cfg['url_path'])){ $this->cfg['weburl'] = $this->cfg['webdir']; } $allow_control = array('user', 'my'); if(!in_array($control, $allow_control)){ return ''; } $s = ''; if($page){ $s .= $page ? '-page-{page}' : ''; } // 附加参数 if($extra) { foreach ($extra as $k=>$v){ $s .= '-'.$k.'-'.$v; } } if(empty($_ENV['_config']['lecms_parseurl'])) { return $this->cfg['weburl'].'index.php?'.$control.'-'.$action.$s.$_ENV['_config']['url_suffix']; }else{ return $this->cfg['weburl'].$control.'-'.$action.$s.$_ENV['_config']['url_suffix']; } } //获取模型的自定义字段(不执行格式化) public function get_model_fields_by_mid($mid = 2){ if(!plugin_is_enable('models_filed')){ return array(); } if(isset($this->data['models_field'.$mid]) && !empty($this->data['models_field'.$mid])) { $models_field = $this->data['models_field'.$mid]; }else{ $models_field = $this->models_field->user_defined_field($mid); $this->data['models_field'.$mid] = $models_field; } return $models_field; } // 自动生成缩略图 public function auto_pic($table = 'article', $uid = 1, $id = 0, $models = array()) { $this->cms_content_attach->table = 'cms_'.$table.'_attach'; $pic_arr = $this->cms_content_attach->find_fetch(array('id'=>$id, 'uid'=>$uid, 'isimage'=>1), array(), 0, 1); if($pic_arr){ $pic_arr = current($pic_arr); $path = 'upload/'.$table.'/'.$pic_arr['filepath']; $pic = image::thumb_name($path); $src_file = ROOT_PATH.$path; $dst_file = ROOT_PATH.$pic; if( !is_file($dst_file) && $models ) { image::thumb($src_file, $dst_file, $models['width'], $models['height'], $this->cfg['thumb_type'], $this->cfg['thumb_quality']); return $path; }else{ return $path; } }else{ return ''; } } /** * 获取远程图片 * @param $table 表名 * @param $content 内容 * @param int $uid 用户ID * @param int $cid 分类ID * @param int $id 内容ID * @param int $write_db 是否写入附件表 * @return string */ public function get_remote_img($table = 'article', &$content = '', $uid = 1, $cid = 0, $id = 0, $write_db = 1) { if(empty($content)){ return ''; } function_exists('set_time_limit') && set_time_limit(0); $updir = 'upload/'.$table.'/'; $_ENV['_prc_err'] = 0; $_ENV['_prc_arg'] = array( 'hosts'=>array('127.0.0.1', 'localhost', $_SERVER['HTTP_HOST'], $this->cfg['webdomain']), 'uid'=>$uid, 'cid'=>$cid, 'id'=>$id, 'maxSize'=>10000, 'upDir'=>ROOT_PATH.$updir, 'preUri'=>$this->cfg['webdir'].$updir, //相对图片地址,绝对图片地址用 weburl 'cfg'=>$this->cfg, 'write_db'=>$write_db ); $this->cms_content_attach->table = 'cms_'.$table.'_attach'; $content = preg_replace_callback('#\]*src=["\']((?:http|https|ftp)\://[^"\']+)["\'][^\>]*\>#iU', array($this, 'img_replace'), $content); unset($_ENV['_prc_arg']); return $_ENV['_prc_err'] ? lang('isremote_failed_tip_1').$_ENV['_prc_err'].lang('isremote_failed_tip_2') : ''; } // 远程图片处理 (如果抓取失败则不替换) // $conf 用到4个参数 hosts preUri cfg upDir private function img_replace($mat) { static $uris = array(); $uri = $mat[1]; $conf = &$_ENV['_prc_arg']; if( !isset($conf['write_db']) ){ $conf['write_db'] = 1; } // 排除重复保存相同URL图片 if(isset($uris[$uri])) return str_replace($uri, $uris[$uri], $mat[0]); // 根据域名排除本站图片 $urls = parse_url($uri); if(in_array($urls['host'], $conf['hosts'])) return $mat[0]; $file = $this->cms_content_attach->remote_down($uri, $conf, (int)$conf['write_db']); if($file) { $uris[$uri] = $conf['preUri'].$file; $cfg = $conf['cfg']; // 是否添加水印 if(!empty($cfg['watermark_pos'])) { image::watermark($conf['upDir'].$file, ROOT_PATH.'static/img/watermark.png', null, $cfg['watermark_pos'], $cfg['watermark_pct']); } return str_replace($uri, $uris[$uri], $mat[0]); }else{ $_ENV['_prc_err']++; return $mat[0]; } } function le_rand_pic_do($mid = 2, $id = 0, $le_rand_pic = array()){ //为了减少数据库查询,这里把系统内置的写死 $models_arr = array( 2=>'article' ); if(isset($models_arr[$mid])){ $current_table = $models_arr[$mid]; }else{ $models = $this->models->get($mid); $current_table = $models['tablename']; } $key = $mid.'-'; $key_len = strlen($key); //当前模型开启了随机缩略图 if( isset($le_rand_pic[$current_table]) && !empty($le_rand_pic[$current_table]) ){ $pic_fixed = (int)$le_rand_pic['pic_fixed']; //是否入库 ? $updir = 'upload/rand_pic/'; $pic_images_dir = ROOT_PATH.$updir; //随机缩略图所在文件夹路径 if(!is_dir($pic_images_dir)) { mkdir($pic_images_dir, 0755, true); } $img_arr = _scandir($pic_images_dir); foreach ($img_arr as $k=>$img){ if($img == '.' || $img == '..'){ unset($img_arr[$k]); }else{ //过滤不是当前模型的图片 if( substr($img, 0 , $key_len) != $key){ unset($img_arr[$k]); } } } if($img_arr){ $rand_key = array_rand($img_arr); $rand_pic = $updir.$img_arr[$rand_key]; $rand_pic_path = $pic_images_dir.$img_arr[$rand_key]; if( is_file($rand_pic_path) ){ if($pic_fixed){ $this->update( array('id'=>$id, 'pic'=>$rand_pic ) ); } return $rand_pic; } } } return FALSE; } } Lecms 3.0.3 错误

错误信息

错误位置

基本信息

程序流程

SQL

$_GET

$_POST

$_COOKIE

包含文件

其他信息