Browse Source

删除 'README.md'

master 1.0
IQ 4 years ago
parent
commit
10a16b190e
7 changed files with 334 additions and 0 deletions
  1. +26
    -0
      admin/index.class.php
  2. +108
    -0
      admin/install.class.php
  3. +19
    -0
      admin/templates/index.php
  4. +6
    -0
      admin/templates/js/own.js
  5. +160
    -0
      admin/uninstall.class.php
  6. BIN
      icon.png
  7. +15
    -0
      lang/cleaner.sql

+ 26
- 0
admin/index.class.php View File

@ -0,0 +1,26 @@
<?php
defined('IN_MET') or exit ('No permission');
load::sys_class('admin');
class index extends admin {
public function __construct() {
global $_M;
parent::__construct();
}
//应用后台入口
public function doindex() {
global $_M;
require $this->template('own/index');
}
//处理
public function dohandle(){
global $_M;
load::sys_func('file');
$str = deldir(PATH_WEB.'cache/',1)?$_M['word']['cleaner_yw002']:$_M['word']['cleaner_yw003'];
turnover($_M['url']['own_form'].'a=doindex',$str);
}
}
?>

+ 108
- 0
admin/install.class.php View File

@ -0,0 +1,108 @@
<?php
defined('IN_MET') or exit ('No permission');
load::sys_class('admin');
load::sys_class('nav.class.php');
load::sys_func('file');
//手动安装时,或者发给客户自己手动安装时请将标记 ① ② 的注释去掉
class install //extends admin //标记①
{
private $no; //应用NO值
private $m_name = 'cleaner'; //应用文件
private $ver = '1.0'; //应用版本号
public function __construct() {
global $_M;
//parent::__construct(); //标记②
}
//安装主方法
public function dosql() {
global $_M;
$where = "m_name='{$this->m_name}'";
if($this->sqlone('applist',$where) != false){
echo '请勿重复安装';
return '请勿重复安装';
exit;
}
do{
$this->no = mt_rand(2001,9999);
$stall = $this->sqlone('applist');
} while ($stall != false);
//开始执行程序[需要的东西可以在下面执行了]
$this->appsql();
//再执行自定义的一些表SQL
//$this->zdysql();
//安装其他
$this->mydefault();
echo '安装成功';
return '安装成功';
}
//自定义SQL
private function zdysql() {
global $_M;
}
//执行APP相关的表数据插入
private function appsql() {
global $_M;
//注册应用
$field = "no='{$this->no}',ver='{$this->ver}',m_name='{$this->m_name}',m_class='index',m_action='doindex',appname='\$_M[''word''][''cleaner_name'']',info='\$_M[''word''][''cleaner_info'']',addtime='1473590889',updatetime=''";
$this->addsql('applist',$field);
}
//全局默认参数
private function mydefault() {
global $_M;
//安装语言包
$cl = $this->langsql();
}
//公共查询方法
private function sqlone($tname,$where = '') {
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->no}'";
}
return DB::get_one("select * from {$table} where {$where}");
}
//公共查询方法
private function sqlall($tname,$where = '') {
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->no}'";
}
return DB::get_all("select * from {$table} where {$where}");
}
//公共写入方法
private function addsql($tname,$field = '') {
global $_M;
$table = $_M['table'][$tname];
DB::query("INSERT INTO {$table} SET {$field}");
}
#云网开发工具生成
private function langsql() {
global $_M;
$file = PATH_ALL_APP.$this->m_name.'/lang/'.$this->m_name.'.sql';
$_sql = file_get_contents($file);
$_arr = explode("#;#;", $_sql);
foreach ($_arr as $val) {
$val = str_replace("{\$_M['config']['tablepre']}", $_M['config']['tablepre'], $val);
$val = str_replace("{\$this->no}", $this->no, $val);
DB::query($val);
}
}
}
?>

+ 19
- 0
admin/templates/index.php View File

@ -0,0 +1,19 @@
<!--<?php
defined('IN_MET') or exit('No permission');
require $this->template('ui/head');
echo <<<EOT
-->
<form method="POST" class="ui-from" name="myform" action="{$_M['url']['own_form']}a=dohandle" target="_self">
<div class="v52fmbx">
<h3 class="v52fmbx_hr">{$_M['word']['cleaner_info']}</h3>
<dl class="noborder">
<dd>
<input type="submit" name="submit" value="{$_M['word']['cleaner_yw001']}" class="submit">
</dd>
</dl>
</div>
</form>
<!--
EOT;
require $this->template('ui/foot');
?>

+ 6
- 0
admin/templates/js/own.js View File

@ -0,0 +1,6 @@
define(function (require, exports, module) {
var common = require('common'); //加载公共函数文件(语言文字获取等)
var langtxt = common.langtxt(); //获取语言文字
});

+ 160
- 0
admin/uninstall.class.php View File

@ -0,0 +1,160 @@
<?php
defined('IN_MET') or exit ('No permission');
load::sys_class('admin');
load::sys_class('nav.class.php');
load::sys_func('file');
class uninstall extends admin {
private $no; //应用NO值
private $m_name; //应用文件夹
private $file = ''; //前台入口文件
public function __construct() {
global $_M;
parent::__construct();
$this->no = $_M['form']['no'];
$this->firstsql();
}
public function dodel() {
global $_M;
//删除一些提前删除的内容
//删除自定义表
// $this->zdysql();
//删除固定的app表
$this->appsql();
//删除应用文件
$this->delfile();
}
//优先执行代码[推荐]
private function firstsql() {
global $_M;
//查询应用的文件夹
$mname = $this->sqlone('applist');
$this->m_name = $mname['m_name'];
//查询应用是否使用栏目
$where = "module='{$this->no}'";
$file = $this->sqlone('column',$where);
if($file){
$this->file = $file['foldername'];
}
}
//删除自定义表
private function zdysql() {
global $_M;
$zdy = array();
foreach ($zdy as $val){
$zdys[] = $this->m_name.'_'.$val;
}
//删除云配置文件//cloud_config
$zdys[] = $this->cloud();
//删除自定义表
foreach ($zdys as $val){
$this->deltablesql($val);
}
//删除配置文件
foreach ($zdys as $val){
$zdyc .= $val;
}
del_table($zdyc);
}
//删除固定的app表
private function appsql() {
global $_M;
//删除栏目接口表
$this->delsql('ifcolumn');
//删除应用生成文件所调用事件的信息表
$this->delsql('ifcolumn_addfile');
//删除会员侧导航信息表
$this->delsql('ifmember_left');
//删除应用插件表
$this->delsql('app_plugin');
//删除网站后台栏目信息表
$where = "field='{$this->no}'";
$this->delsql('admin_column',$where);
//删除网站栏目信息表
$where = "module='{$this->no}'";
$this->delsql('column',$where);
//删除语言表
$where = "app='{$this->no}'";
$this->delsql('language',$where);
//删除应用注册表
$this->delsql('applist');
}
//删除应用文件夹
private function delfile() {
if($this->file){
deldir('../'.$this->file);
}
if($this->m_name){
deldir('../app/app/'.$this->m_name);
}
}
//对公用配置表卸载处理
private function cloud() {
global $_M;
$where = "m_name='{$this->m_name}'";
if($this->sqlcounter('cloud_config',$where) > 0){
$this->delsql('cloud_config',$where);
}
if($this->sqlcounter('cloud_config') == 0){
return 'cloud_config';
}
}
//公共查询方法
private function sqlone($tname,$where = '') {
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->no}'";
}
return DB::get_one("select * from {$table} where {$where}");
}
//公共查询方法
private function sqlcounter($tname,$where = '') {
global $_M;
$table = $_M['table'][$tname];
if($where){
$where = 'WHERE '.$where;
}
return DB::counter("{$table} {$where}");
}
//公共删除数据
private function delsql($tname,$where = '') {
global $_M;
$table = $_M['table'][$tname];
if(!$where){
$where = "no='{$this->no}'";
}
DB::query("DELETE FROM {$table} WHERE {$where}");
}
//公共删除表
private function deltablesql($tname) {
global $_M;
$table = $_M['table'][$tname];
DB::query("DROP TABLE `{$table}`");
}
}
?>

BIN
icon.png View File

Before After
Width: 300  |  Height: 300  |  Size: 30 KiB

+ 15
- 0
lang/cleaner.sql View File

@ -0,0 +1,15 @@
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_name',value='清理程序缓存',site='1',no_order='0',array='0',lang='cn',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw002',value='清理成功',site='1',no_order='0',array='0',lang='cn',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw003',value='清理失败',site='1',no_order='0',array='0',lang='cn',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_info',value='清理程序缓存文件,解决程序升级更新后因为缓存出现的各种问题。',site='1',no_order='0',array='0',lang='cn',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw001',value='清理缓存',site='1',no_order='0',array='0',lang='cn',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_name',value='Cleanup program cache',site='1',no_order='0',array='0',lang='en',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw001',value='Clear cache',site='1',no_order='0',array='0',lang='en',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw002',value='Clean up success',site='1',no_order='0',array='0',lang='en',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw003',value='Cleanup failed',site='1',no_order='0',array='0',lang='en',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_info',value='Clean up the program cache files, to solve the problem after the upgrade because the cache cache.',site='1',no_order='0',array='0',lang='en',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw003',value='清理失敗',site='1',no_order='0',array='0',lang='tc',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw002',value='清理成功',site='1',no_order='0',array='0',lang='tc',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_yw001',value='清理緩存',site='1',no_order='0',array='0',lang='tc',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_info',value='清理程式緩存檔案,解决程式陞級更新後因為緩存出現的各種問題。',site='1',no_order='0',array='0',lang='tc',app = '{$this->no}' #;#;
INSERT INTO {$_M['config']['tablepre']}language SET name='cleaner_name',value='清理程式緩存',site='1',no_order='0',array='0',lang='tc',app = '{$this->no}'

Loading…
Cancel
Save