diff --git a/admin/application.class.php b/admin/application.class.php new file mode 100644 index 0000000..6f24cfe --- /dev/null +++ b/admin/application.class.php @@ -0,0 +1,112 @@ +ajaxurl(); + if($_M['form']['url']){ + $url = ' +
安装提示
+ '.base64_decode($_M['form']['url']).' +
'; + } + $appfile = $_M['form']['appfile']; + require $this->template('own/application'); + } + + //进行执行安装 + public function doaddapp(){ + global $_M; + $this->appfile = $_M['form']['appfile']; + $where = "m_name='{$this->appfile}'"; + $applist = $this->sqlone('applist',$where); + if($applist){ + $this->clangs = get_word($applist['appname']).' 应用已存在,请勿重复安装。'; + $this->turnover(); + } + + $file = path_relative("app/app/{$this->appfile}/admin/install.class.php"); + require_once($file); + if(get_parent_class('install')){ + $url = $_M[url][site_admin].'index.php?lang='.$_M[langset].'&n='.$this->appfile.'&c=install&a=dosql'; + $url = '【点击URL安装新应用】'.$url.''; + $this->url = urlencode(base64_encode($url)); + $this->clangs = '点击URL安装新应用'; + }else{ + $install = new install(); + $this->clangs = @$install->dosql(); + if($this->clangs){ + if($this->clangs == 'complete'){ + $this->clangs = '安装完成'; + } + }else{ + $this->clangs = '安装完成'; + } + $this->url = base64_encode($this->clangs); + } + $this->turnover(); + } + + //返回方法 + private function turnover() { + global $_M; + turnover($_M['url']['own_form'] . 'a=doindex&url='.$this->url.'&appfile='.$this->appfile, $this->clangs); + } + + //应用安装文件名检测,查看是否存在 + public function doappfile(){ + global $_M; + $file = '../app/app/'.$_M['form']['appfile']; + if(is_dir($file)){ + $file = $file.'/admin/install.class.php'; + if(file_exists($file)){ + $where = "m_name='{$_M['form']['appfile']}'"; + $applist = $this->sqlone('applist',$where); + if($applist){ + echo '0|'.get_word($applist['appname']).' 应用已存在,请勿重复安装。'; + }else{ + echo '1|'.$_M['form']['appfile'].'可以正常安装。'; + } + }else{ + echo '0|../app/app/'.$_M['form']['appfile'].'/ 下不存在install.class.php文件'; + } + }else{ + echo '0|../app/app/ 下不存在文件夹 '.$_M['form']['appfile']; + } + } +} + +?> \ No newline at end of file diff --git a/admin/install.class.php b/admin/install.class.php new file mode 100644 index 0000000..ddeb216 --- /dev/null +++ b/admin/install.class.php @@ -0,0 +1,70 @@ +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(); + echo '安装成功'; + return '安装成功'; + } + + //执行APP相关的表数据插入 + private function appsql() { + global $_M; + + //注册应用 + $updatetime = time(); + $field = "no='{$this->no}',ver='{$this->ver}',m_name='{$this->m_name}',m_class='application',m_action='doindex',appname='应用安装助手',info='应用开发必备工具!能够快速安装应用,不必每次都要拼写安装URL进行安装。',addtime='{$updatetime}'"; + $this->addsql('applist',$field); + } + + //公共查询方法 + 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 addsql($tname,$field) { + global $_M; + $table = $_M['table'][$tname]; + DB::query("INSERT INTO {$table} SET {$field}"); + } + +} +?> \ No newline at end of file diff --git a/admin/templates/application.php b/admin/templates/application.php new file mode 100644 index 0000000..13d475d --- /dev/null +++ b/admin/templates/application.php @@ -0,0 +1,50 @@ + +
+
+

注意事项:

+
+
+ 1、应用文件需要放在网站 根目录/APP/APP下 【注意】两个APP;
+ 2、根据应用安装文件的不同,会出现不同的安装页面,均属于正常;
+ 3、安装执行后,若应用未安装成功,请检测安装文件是否有错误;
+ 4、只可以安装自行开发的应用,官方应用市场下载的应用无法二次安装。 +
+
+
+
应用文件夹
+
+
+ +
+ 请保证应用文件位置正确,和安装文件代码无错误。 +
+
+ {$url} +
+
+
+ +
+
+
+
+ MetTooL 功能介绍 + | + MetTooL 更新说明 + | + 反馈QQ群:1452532 + | + Metinfo( 米拓 )应用交流 + +
+
+
+
+