xiaoz 6 years ago
parent
commit
cdf26da132
  1. 8
      application/controllers/Home.php
  2. 6
      application/controllers/Img.php
  3. 28
      application/libraries/Basic.php
  4. 2
      application/views/user/home.php
  5. 2
      application/views/user/img.php
  6. 7
      data/json/config.simple.js
  7. 0
      data/json/index.html
  8. 2
      data/version.txt

8
application/controllers/Home.php

@ -21,11 +21,17 @@
//加载数据库模型 //加载数据库模型
$this->load->model('query','',TRUE); $this->load->model('query','',TRUE);
$siteinfo = $this->query->site_setting(); $siteinfo = $this->query->site_setting();
//读取配置文件内容
$this->load->library("basic");
$conf = $this->basic->conf("info");
$siteinfo = json_decode($siteinfo->values); $siteinfo = json_decode($siteinfo->values);
$siteinfo->info = $conf->index_info;
//echo $siteinfo->title; //echo $siteinfo->title;
//$data['title'] = '图片上传'; //$data['title'] = '图片上传';
$this->load->view('user/header.php',$siteinfo); $this->load->view('user/header.php',$siteinfo);
$this->load->view('user/home.php'); $this->load->view('user/home.php',$siteinfo);
$this->load->view('user/footer.php'); $this->load->view('user/footer.php');
} }
//首页多图上传 //首页多图上传

6
application/controllers/Img.php

@ -8,6 +8,11 @@
$siteinfo = $this->query->site_setting(); $siteinfo = $this->query->site_setting();
$siteinfo = json_decode($siteinfo->values); $siteinfo = json_decode($siteinfo->values);
//加载常用基本类库
$this->load->library("basic");
//获取配置文件信息的内容
$conf = $this->basic->conf("info");
//var_dump($conf->img_info);
//过滤imgid //过滤imgid
$imgid = strip_tags($imgid); $imgid = strip_tags($imgid);
//计算imgid长度 //计算imgid长度
@ -60,6 +65,7 @@
"size" => $size "size" => $size
); );
$datas['img_info'] = $conf->img_info;
// $data['title'] = '图片浏览'; // $data['title'] = '图片浏览';
// $data['url'] = $domain.$imginfo->path; // $data['url'] = $domain.$imginfo->path;
// $data['date'] = $imginfo->date; // $data['date'] = $imginfo->date;

28
application/libraries/Basic.php

@ -106,5 +106,33 @@
return $data; return $data;
} }
//读取站点配置文件
public function conf($arg = ''){
//检查配置文件是否存在,并读取对应内容
if(is_file(FCPATH."data/json/config.js")){
$conf_path = FCPATH."data/json/config.js";
}
//配置文件不存在,读取默认配置
else{
$conf_path = FCPATH."data/json/config.simple.js";
}
$conf_path = str_replace("\\","/",$conf_path);
//echo $conf_path;
//读取配置文件内容
$content = json_decode(file_get_contents($conf_path));
//根据传入的参数来返回不同的数据
switch ($arg) {
case 'alert':
return $content->alert;
break;
case 'info':
return $content->info;
break;
default:
return $content;
break;
}
}
} }
?> ?>

2
application/views/user/home.php

@ -5,7 +5,7 @@
<div id="main"> <div id="main">
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<span class="alert-inner--icon"><i class="layui-icon"></i></span> <span class="alert-inner--icon"><i class="layui-icon"></i></span>
<span class="alert-inner--text"><strong>注意:</strong>游客限制每日上传10张,单张图片不能超过5M,上传的图片将公开显示,使用之前请先阅读《<a href="/page/use">使用协议</a></span> <span class="alert-inner--text"><strong>注意:</strong><?php echo $info; ?></span>
</div> </div>
<!-- 选择按钮 --> <!-- 选择按钮 -->
<!-- 上传地址 --> <!-- 上传地址 -->

2
application/views/user/img.php

@ -17,7 +17,7 @@
<span><a href="<?php echo $url; ?>" download = ""><i class="fa fa-cloud-download"></i> 下载</a></span> <span><a href="<?php echo $url; ?>" download = ""><i class="fa fa-cloud-download"></i> 下载</a></span>
</p> </p>
<div class = "statement"> <div class = "statement">
<i class="fa fa-warning"></i> 此图片来自网友上传,不代表本站立场,若有侵权,请联系管理员删除!(QQ:337003006) <i class="fa fa-warning"></i> <?php echo $img_info; ?>
</div> </div>
</div> </div>
<!-- 评论按钮 --> <!-- 评论按钮 -->

7
data/json/config.simple.js

@ -0,0 +1,7 @@
{
"alert": "ImgURL配置文件,请使用json格式,修改后建议使用http://www.bejson.com/ 进行校验,以免出现异常。",
"info": {
"index_info": "游客限制每日上传10张,单张图片不能超过5M,上传的图片将公开显示,使用之前请先阅读《<a href = \"/page/use\">使用协议<\/a>》",
"img_info": "此图片来自网友上传,不代表本站立场,若有侵权,请联系管理员删除!"
}
}

0
data/json/index.html

2
data/version.txt

@ -1 +1 @@
v2.1.2-20190406 v2.1.3-20190407
Loading…
Cancel
Save