mirror of https://gitee.com/zorlan/skycaiji
2.3.1
parent
19e77d03c8
commit
b4c3931960
|
@ -21,11 +21,9 @@ class Init{
|
|||
|
||||
$httpOrigin=strtolower($_SERVER['HTTP_ORIGIN']);
|
||||
$httpOrigin=rtrim($httpOrigin,'/');
|
||||
|
||||
$allowOrigins=array('http://www.skycaiji.com','https://www.skycaiji.com');
|
||||
|
||||
|
||||
$allowOrigin='';
|
||||
if(in_array($httpOrigin,$allowOrigins)){
|
||||
if(in_array($httpOrigin,config('allow_origins'))){
|
||||
|
||||
$allowOrigin=$httpOrigin;
|
||||
}else{
|
||||
|
|
|
@ -86,7 +86,7 @@ function is_collecting(){
|
|||
return false;
|
||||
}
|
||||
}
|
||||
/*移除自动采集》正在采集状态*/
|
||||
/*移除自动采集»正在采集状态*/
|
||||
function remove_auto_collecting(){
|
||||
\skycaiji\admin\model\CacheModel::getInstance()->db()->where('cname','auto_collecting')->delete();
|
||||
}
|
||||
|
|
|
@ -832,6 +832,98 @@ EOF;
|
|||
}
|
||||
}
|
||||
|
||||
/*保存到云端*/
|
||||
public function save2storeAction(){
|
||||
$type=input('type');
|
||||
$app=input('app');
|
||||
$pluginData=$this->_get_plugin_data($type,$app);
|
||||
$this->assign('pluginData',$pluginData);
|
||||
return $this->fetch();
|
||||
}
|
||||
/*导出插件*/
|
||||
public function exportAction(){
|
||||
$type=input('type');
|
||||
$app=input('app');
|
||||
$pluginData=$this->_get_plugin_data($type,$app);
|
||||
|
||||
set_time_limit(600);
|
||||
$txt='/*skycaiji-plugin-start*/'.base64_encode(serialize($pluginData)).'/*skycaiji-plugin-end*/';
|
||||
$name=$pluginData['app'];
|
||||
ob_start();
|
||||
header("Expires: 0" );
|
||||
header("Pragma:public" );
|
||||
header("Cache-Control:must-revalidate,post-check=0,pre-check=0" );
|
||||
header("Cache-Control:public");
|
||||
header("Content-Type:application/octet-stream" );
|
||||
|
||||
header("Content-transfer-encoding: binary");
|
||||
header("Accept-Length: " .mb_strlen($txt));
|
||||
if (preg_match("/MSIE/i", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
header('Content-Disposition: attachment; filename="'.urlencode($name).'.skycaiji"');
|
||||
}else{
|
||||
header('Content-Disposition: attachment; filename="'.$name.'.skycaiji"');
|
||||
}
|
||||
echo $txt;
|
||||
ob_end_flush();
|
||||
}
|
||||
protected function _get_plugin_data($type,$app){
|
||||
$mapp=null;
|
||||
if($type=='release'){
|
||||
$mapp=model('ReleaseApp');
|
||||
}elseif($type=='func'){
|
||||
$mapp=model('FuncApp');
|
||||
}else{
|
||||
$this->error('类型错误');
|
||||
}
|
||||
if(empty($app)){
|
||||
$this->error('app标识错误');
|
||||
}
|
||||
$pluginDb=$mapp->where('app',$app)->find();
|
||||
if(empty($pluginDb)){
|
||||
$this->error('插件不存在');
|
||||
}
|
||||
|
||||
$pluginData=array(
|
||||
'app'=>$pluginDb['app'],
|
||||
'name'=>$pluginDb['name'],
|
||||
'type'=>$type,
|
||||
'module'=>$pluginDb['module'],
|
||||
'uptime'=>$pluginDb['uptime'],
|
||||
'store_url'=>''
|
||||
);
|
||||
|
||||
if(!empty($pluginDb['provider_id'])){
|
||||
|
||||
$provData=model('Provider')->where('id',$pluginDb['provider_id'])->find();
|
||||
$pluginData['store_url']=$provData['url'].'/client/plugin/detail?app='.$pluginDb['app'];
|
||||
}
|
||||
|
||||
if(empty($pluginData['name'])){
|
||||
$this->error('插件名称为空');
|
||||
}
|
||||
if(empty($pluginData['module'])){
|
||||
$this->error('插件模块为空');
|
||||
}
|
||||
$appFile=config('plugin_path').'/'.$type.'/'.$pluginDb['module'].'/'.$pluginData['app'].'.php';
|
||||
if($type=='release'){
|
||||
$appTpl=config('plugin_path').'/'.$type.'/view/'.$pluginDb['module'].'/'.$pluginData['app'].'.html';
|
||||
if(file_exists($appTpl)){
|
||||
|
||||
$appTpl=file_get_contents($appTpl);
|
||||
$pluginData['tpl']=base64_encode($appTpl);
|
||||
}
|
||||
}
|
||||
if(file_exists($appFile)){
|
||||
|
||||
$appFile=file_get_contents($appFile);
|
||||
$pluginData['code']=base64_encode($appFile);
|
||||
}
|
||||
if(empty($pluginData['code'])){
|
||||
$this->error('插件文件不存在');
|
||||
}
|
||||
return $pluginData;
|
||||
}
|
||||
|
||||
public function _format_array($arr,$headStr=''){
|
||||
if(is_array($arr)){
|
||||
$arr=var_export($arr,true);
|
||||
|
|
|
@ -223,13 +223,15 @@ class Mystore extends BaseController {
|
|||
$mapp=model('ReleaseApp');
|
||||
if($op=='delete'){
|
||||
|
||||
$mapp->where(array('id'=>$id))->delete();
|
||||
$this->_deleteReleaseApp($id);
|
||||
$this->success(lang('delete_success'));
|
||||
}elseif($op=='deleteall'){
|
||||
|
||||
$ids=input('ids/a');
|
||||
if(is_array($ids)&&count($ids)>0){
|
||||
$mapp->where(array('id'=>array('in',$ids)))->delete();
|
||||
foreach ($ids as $idv){
|
||||
$this->_deleteReleaseApp($idv);
|
||||
}
|
||||
}
|
||||
$this->success(lang('op_success'),'Mystore/ReleaseApp');
|
||||
}elseif($op=='auto_check'){
|
||||
|
@ -248,6 +250,27 @@ class Mystore extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function _deleteReleaseApp($id){
|
||||
if($id>0){
|
||||
$mapp=model('ReleaseApp');
|
||||
$pluginPath=config('plugin_path').'/release';
|
||||
$appData=$mapp->where('id',$id)->find();
|
||||
if(!empty($appData)){
|
||||
$appFile=$pluginPath.'/'.strtolower($appData['module']).'/'.ucfirst($appData['app']).'.php';
|
||||
$appTpl=$pluginPath.'/view/'.strtolower($appData['module']).'/'.ucfirst($appData['app']).'.html';
|
||||
if(file_exists($appFile)){
|
||||
|
||||
unlink($appFile);
|
||||
}
|
||||
if(file_exists($appTpl)){
|
||||
|
||||
unlink($appTpl);
|
||||
}
|
||||
$mapp->where('id',$id)->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*应用程序列表*/
|
||||
public function appAction(){
|
||||
|
@ -501,7 +524,19 @@ class Mystore extends BaseController {
|
|||
|
||||
$ids=input('ids/a');
|
||||
if(is_array($ids)&&count($ids)>0){
|
||||
$mfuncApp->where(array('id'=>array('in',$ids)))->delete();
|
||||
|
||||
foreach ($ids as $idv){
|
||||
$vAppData=$mfuncApp->where('id',$idv)->find();
|
||||
if(!empty($vAppData)){
|
||||
if(!empty($vAppData['module'])&&!empty($vAppData['app'])){
|
||||
$filename=$mfuncApp->filename($vAppData['module'], $vAppData['app']);
|
||||
if(file_exists($filename)){
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
$mfuncApp->where('id',$vAppData['id'])->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->success(lang('op_success'),'Mystore/funcApp');
|
||||
}elseif($op=='auto_check'){
|
||||
|
@ -520,6 +555,62 @@ class Mystore extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*导入插件*/
|
||||
public function uploadAction(){
|
||||
if(request()->isPost()){
|
||||
if(!check_usertoken()){
|
||||
$this->error(lang('usertoken_error'));
|
||||
}
|
||||
if($GLOBALS['_sc']['c']['site']['verifycode']){
|
||||
|
||||
$verifycode=trim(input('verifycode'));
|
||||
$check=check_verify($verifycode);
|
||||
if(!$check['success']){
|
||||
$this->error($check['msg']);
|
||||
}
|
||||
}
|
||||
$file=$_FILES['plugin_file'];
|
||||
if(empty($file)||empty($file['tmp_name'])){
|
||||
$this->error('请选择插件文件');
|
||||
}
|
||||
$fileTxt=file_get_contents($file['tmp_name']);
|
||||
$pluginData=null;
|
||||
if(preg_match('/\/\*skycaiji-plugin-start\*\/(?P<plugin>[\s\S]+?)\/\*skycaiji-plugin-end\*\//i',$fileTxt,$pluginMatch)){
|
||||
$pluginData=unserialize(base64_decode(trim($pluginMatch['plugin'])));
|
||||
}
|
||||
if(empty($pluginData)){
|
||||
$this->error('不是插件文件');
|
||||
}
|
||||
$mapp=null;
|
||||
if($pluginData['type']=='release'){
|
||||
$mapp=model('ReleaseApp');
|
||||
}elseif($pluginData['type']=='func'){
|
||||
$mapp=model('FuncApp');
|
||||
}else{
|
||||
$this->error('分类错误');
|
||||
}
|
||||
|
||||
if(!input('replace')){
|
||||
|
||||
$pluginDb=$mapp->where('app',$pluginData['app'])->find();
|
||||
if(!empty($pluginDb)){
|
||||
|
||||
$this->error('插件已存在',null,array('js'=>"confirmRight('插件已存在,是否替换?',win_submit_replace)"));
|
||||
}
|
||||
}
|
||||
|
||||
$result=controller('admin/Store')->_installPlugin($pluginData);
|
||||
|
||||
if($result['success']){
|
||||
$this->success('成功导入插件:'.$pluginData['app'],'Mystore/'.$pluginData['type'].'App');
|
||||
}else{
|
||||
$this->error($result['msg']);
|
||||
}
|
||||
|
||||
}else{
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
/*插件设置自动检测*/
|
||||
public function _auto_check_plugin(){
|
||||
$auto=input('auto/d');
|
||||
|
|
|
@ -54,6 +54,8 @@ class Store extends BaseController {
|
|||
}
|
||||
/*安装规则*/
|
||||
public function installRuleAction(){
|
||||
$this->_checkOrigin();
|
||||
|
||||
$mrule=model('Rule');
|
||||
$rule=json_decode(base64_decode(input('post.rule')),true);
|
||||
|
||||
|
@ -96,48 +98,17 @@ class Store extends BaseController {
|
|||
}
|
||||
/*安装插件*/
|
||||
public function installPluginAction(){
|
||||
$this->_checkOrigin();
|
||||
|
||||
$plugin=json_decode(base64_decode(input('post.plugin')),true);
|
||||
$plugin['code']=base64_decode($plugin['code']);
|
||||
if(empty($plugin['app'])){
|
||||
$this->dispatchJump(false,'标识错误');
|
||||
}
|
||||
if(empty($plugin['name'])){
|
||||
$this->dispatchJump(false,'名称错误');
|
||||
}
|
||||
if(empty($plugin['type'])){
|
||||
$this->dispatchJump(false,'类型错误');
|
||||
}
|
||||
if(empty($plugin['module'])){
|
||||
$this->dispatchJump(false,'模块错误');
|
||||
}
|
||||
if(empty($plugin['code'])){
|
||||
$this->dispatchJump(false,'不是可用的程序');
|
||||
}
|
||||
if(!empty($plugin['tpl'])){
|
||||
|
||||
$plugin['tpl']=base64_decode($plugin['tpl']);
|
||||
}
|
||||
|
||||
$newData=array('app'=>$plugin['app'],'name'=>$plugin['name'],'desc'=>$plugin['desc'],'uptime'=>$plugin['uptime']);
|
||||
|
||||
|
||||
$newData['provider_id']=$this->_getStoreProvid($plugin['store_url']);
|
||||
|
||||
if($plugin['type']=='release'){
|
||||
|
||||
model('ReleaseApp')->addCms($newData,$plugin['code'],$plugin['tpl']);
|
||||
$this->dispatchJump(true);
|
||||
}elseif($plugin['type']=='func'){
|
||||
|
||||
$newData['module']=$plugin['module'];
|
||||
model('FuncApp')->addFunc($newData,$plugin['code']);
|
||||
$this->dispatchJump(true);
|
||||
}else{
|
||||
$this->dispatchJump(false);
|
||||
}
|
||||
$result=$this->_installPlugin($plugin);
|
||||
|
||||
$this->dispatchJump($result['success'],$result['msg']);
|
||||
}
|
||||
/*安装应用程序*/
|
||||
public function installAppAction(){
|
||||
$this->_checkOrigin();
|
||||
|
||||
$app=json_decode(base64_decode(input('post.app')),true);
|
||||
if(empty($app['app'])){
|
||||
$this->dispatchJump(false,'app标识错误');
|
||||
|
@ -281,13 +252,86 @@ class Store extends BaseController {
|
|||
$this->dispatchJump(false,'操作错误!');
|
||||
}
|
||||
}
|
||||
|
||||
public function _installPlugin($plugin){
|
||||
$result=array('success'=>false,'msg'=>'');
|
||||
|
||||
$plugin['code']=base64_decode($plugin['code']);
|
||||
if(empty($plugin['app'])){
|
||||
$result['msg']='标识错误';
|
||||
return $result;
|
||||
}
|
||||
if(empty($plugin['name'])){
|
||||
$result['msg']='名称错误';
|
||||
return $result;
|
||||
}
|
||||
if(empty($plugin['type'])){
|
||||
$result['msg']='类型错误';
|
||||
return $result;
|
||||
}
|
||||
if(empty($plugin['module'])){
|
||||
$result['msg']='模块错误';
|
||||
return $result;
|
||||
}
|
||||
if(empty($plugin['code'])){
|
||||
$result['msg']='插件文件错误';
|
||||
return $result;
|
||||
}
|
||||
if(!empty($plugin['tpl'])){
|
||||
|
||||
$plugin['tpl']=base64_decode($plugin['tpl']);
|
||||
}
|
||||
|
||||
$newData=array('app'=>$plugin['app'],'name'=>$plugin['name'],'desc'=>$plugin['desc'],'uptime'=>$plugin['uptime']);
|
||||
|
||||
|
||||
$newData['provider_id']=$this->_getStoreProvid($plugin['store_url']);
|
||||
|
||||
if($plugin['type']=='release'){
|
||||
|
||||
$success=model('ReleaseApp')->addCms($newData,$plugin['code'],$plugin['tpl']);
|
||||
$result['success']=$success?true:false;
|
||||
$result['msg']=$result['success']?'成功':'无效的插件';
|
||||
}elseif($plugin['type']=='func'){
|
||||
|
||||
$newData['module']=$plugin['module'];
|
||||
$success=model('FuncApp')->addFunc($newData,$plugin['code']);
|
||||
$result['success']=$success?true:false;
|
||||
$result['msg']=$result['success']?'成功':'无效的插件';
|
||||
}else{
|
||||
$result['msg']='类型错误';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/*获取平台域名Id*/
|
||||
protected function _getStoreProvid($storeUrl=null){
|
||||
$referer=request()->server('HTTP_REFERER');
|
||||
if(!empty($referer)){
|
||||
$storeUrl=$referer;
|
||||
if(empty($storeUrl)){
|
||||
$referer=request()->server('HTTP_REFERER');
|
||||
if(!empty($referer)){
|
||||
$storeUrl=$referer;
|
||||
}
|
||||
}
|
||||
$provId=model('Provider')->getIdByUrl($storeUrl);
|
||||
return $provId;
|
||||
}
|
||||
/*检测下载来源*/
|
||||
protected function _checkOrigin(){
|
||||
if(!request()->isAjax()){
|
||||
|
||||
$origin=strtolower($_SERVER['HTTP_ORIGIN']);
|
||||
$origin=rtrim($origin,'/');
|
||||
if(empty($origin)){
|
||||
$this->dispatchJump(false,'未知来源');
|
||||
}
|
||||
if(!in_array($origin, config('allow_origins'))){
|
||||
|
||||
$provData=model('Provider')->where(array('domain'=>$origin))->find();
|
||||
if(empty($provData)){
|
||||
$this->dispatchJump(false,'未知的第三方来源:'.$origin);
|
||||
}elseif($provData['enable']!=1){
|
||||
$this->dispatchJump(false,'未受信任的第三方来源:'.$origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1263,7 +1263,7 @@ class CpatternBase extends Collector{
|
|||
return $tags;
|
||||
}
|
||||
/**
|
||||
* 执行数据处理》使用函数
|
||||
* 执行数据处理»使用函数
|
||||
* @param string $module 模块
|
||||
* @param string $funcName 函数/方法
|
||||
* @param string $fieldVal 字段值
|
||||
|
@ -1282,7 +1282,7 @@ class CpatternBase extends Collector{
|
|||
'extend'=>'EXTEND_PROCESS_FUNC',
|
||||
),
|
||||
'processIf' => array (
|
||||
'name' => '条件判断》使用函数',
|
||||
'name' => '条件判断»使用函数',
|
||||
'config'=>'allow_process_if',
|
||||
'extend'=>'EXTEND_PROCESS_IF',
|
||||
)
|
||||
|
@ -1298,10 +1298,10 @@ class CpatternBase extends Collector{
|
|||
|
||||
if(!function_exists($funcName)){
|
||||
|
||||
$this->error('数据处理》'.$options['name'].'》无效的函数:'.$funcName);
|
||||
$this->error('数据处理»'.$options['name'].'»无效的函数:'.$funcName);
|
||||
}elseif(!array_key_exists($funcName, config($options['config']))&&!array_key_exists($funcName, config($options['extend']))){
|
||||
|
||||
$this->error('数据处理》'.$options['name'].'》未配置函数:'.$funcName);
|
||||
$this->error('数据处理»'.$options['name'].'»未配置函数:'.$funcName);
|
||||
}else{
|
||||
$success=true;
|
||||
}
|
||||
|
@ -1329,12 +1329,12 @@ class CpatternBase extends Collector{
|
|||
if(is_object($class_list[$className])){
|
||||
|
||||
if(!method_exists($class_list[$className], $methodName)){
|
||||
$this->error('数据处理》'.$options['name'].'》不存在方法:'.$className.'->'.$methodName);
|
||||
$this->error('数据处理»'.$options['name'].'»不存在方法:'.$className.'->'.$methodName);
|
||||
}else{
|
||||
$success=true;
|
||||
}
|
||||
}else{
|
||||
$msg='数据处理》'.$options['name'].'》';
|
||||
$msg='数据处理»'.$options['name'].'»';
|
||||
if($class_list[$className]==1){
|
||||
$msg.='不存在插件:';
|
||||
}elseif($class_list[$className]==2){
|
||||
|
|
|
@ -17,11 +17,11 @@ class FuncApp extends BaseModel{
|
|||
public $funcModules=array(
|
||||
'process'=>array (
|
||||
'name'=>'数据处理',
|
||||
'loc'=>'数据处理》使用函数'
|
||||
'loc'=>'数据处理»使用函数'
|
||||
),
|
||||
'processIf'=>array(
|
||||
'name'=>'条件判断',
|
||||
'loc'=>'数据处理》条件判断》使用函数'
|
||||
'loc'=>'数据处理»条件判断»使用函数'
|
||||
)
|
||||
);
|
||||
public function __construct($data = []){
|
||||
|
@ -79,7 +79,25 @@ class FuncApp extends BaseModel{
|
|||
return false;
|
||||
}
|
||||
$func['module']=$this->format_module($func['module']);
|
||||
if(!$this->right_module($func['module'])){
|
||||
return false;
|
||||
}
|
||||
|
||||
$func['uptime']=$func['uptime']>0?$func['uptime']:time();
|
||||
|
||||
if(!preg_match('/^([A-Z][a-z0-9]*){2}$/',$func['app'])){
|
||||
|
||||
return false;
|
||||
}
|
||||
if(!preg_match('/^\s*namespace\s+plugin\\\func\b/im',$code)){
|
||||
|
||||
return false;
|
||||
}
|
||||
if(!preg_match('/class\s+'.$func['app'].'\b/i',$code)){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$funcData=$this->where('app',$func['app'])->find();
|
||||
$success=false;
|
||||
|
||||
|
|
|
@ -22,6 +22,20 @@ class ReleaseApp extends BaseModel{
|
|||
|
||||
$cms['module']='cms';
|
||||
$cms['uptime']=$cms['uptime']>0?$cms['uptime']:NOW_TIME;
|
||||
|
||||
if(!preg_match('/^([A-Z][a-z0-9]*){3}$/',$cms['app'])){
|
||||
|
||||
return false;
|
||||
}
|
||||
if(!preg_match('/^\s*namespace\s+plugin\\\release\b/im',$code)){
|
||||
|
||||
return false;
|
||||
}
|
||||
if(!preg_match('/class\s+'.$cms['app'].'\b/i',$code)){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmsData=$this->where('app',$cms['app'])->find();
|
||||
$success=false;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{if condition="!empty($collData)"}
|
||||
<script src="__PUBLIC__/static/js/admin/store.js?{$Think.config.html_v}"></script>
|
||||
<div>
|
||||
<form id="win_form_save2store" action="https://www.skycaiji.com/store/client/upload" method="post" target="myModalIframe">
|
||||
<form id="win_form_save2store" action="https://www.skycaiji.com/client/rule/upload" method="post" target="myModalIframe">
|
||||
<input type="hidden" name="rule" value="{:base64_encode(serialize($collData))}" />
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{$html}
|
||||
<!-- 以下为蓝天采集器代码 -->
|
||||
<link rel="stylesheet" href="__PUBLIC__/static/css/cpattern_browser.css?{$Think.config.html_v}">
|
||||
<script type="text/javascript" src="__PUBLIC__/jquery/jquery.min.js?{$Think.config.html_v}"></script>
|
||||
<script type="text/javascript" src="__PUBLIC__/static/js/admin/cpattern_browser.js?{$Think.config.html_v}"></script>
|
||||
<link rel="stylesheet" href="{:config('root_website')}/public/static/css/cpattern_browser.css?{$Think.config.html_v}">
|
||||
<script type="text/javascript" src="{:config('root_website')}/public/jquery/jquery.min.js?{$Think.config.html_v}"></script>
|
||||
<script type="text/javascript" src="{:config('root_website')}/public/static/js/admin/cpattern_browser.js?{$Think.config.html_v}"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
window.skycaijiCB.init({$config|json_encode});
|
||||
|
|
|
@ -12,6 +12,15 @@
|
|||
<div class="alert alert-warning">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
请在 {$funcClass['filename']} 文件中编辑代码
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">插件另存为 <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu" style="width:100%;text-align:center;background:#f4f4f4;">
|
||||
<li><a href="{:url('Admin/Develop/export?type=func&app='.$funcClass['app'])}" target="_blank">导出至本地</a></li>
|
||||
<li><a href="{:url('Admin/Develop/save2store?type=func&app='.$funcClass['app'])}" title="云端存储,保存插件更方便!" onclick="windowModal('保存到云端',$(this).attr('href'));return false;">上传至云端</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
|
|
|
@ -16,6 +16,15 @@
|
|||
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
请在 {$config['app_file']} 文件中编辑代码
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">插件另存为 <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu" style="width:100%;text-align:center;background:#f4f4f4;">
|
||||
<li><a href="{:url('Admin/Develop/export?type=release&app='.$config['app'])}" target="_blank">导出至本地</a></li>
|
||||
<li><a href="{:url('Admin/Develop/save2store?type=release&app='.$config['app'])}" title="云端存储,保存插件更方便!" onclick="windowModal('保存到云端',$(this).attr('href'));return false;">上传至云端</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<input type="hidden" name="edit" value="1" />
|
||||
<input type="hidden" name="app" value="{$config['app']}" />
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{if condition="!empty($pluginData)"}
|
||||
<script src="__PUBLIC__/static/js/admin/store.js?{$Think.config.html_v}"></script>
|
||||
<div>
|
||||
<form id="win_form_save2store" action="https://www.skycaiji.com/client/plugin/upload" method="post" target="myModalIframe">
|
||||
<input type="hidden" name="plugin" value="{:base64_encode(serialize($pluginData))}" />
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
/*利用iframe+form post提交*/
|
||||
var formhtml=$('#win_form_save2store').prop("outerHTML")+'<script type="text\/javascript">$("#win_form_save2store").submit()<\/script>';
|
||||
windowStore('正在上传...','',{addonBody:formhtml});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
{else /}
|
||||
插件不存在
|
||||
{/if}
|
|
@ -10,9 +10,13 @@
|
|||
<li><a href="{:url('Mystore/rule')}">采集规则</a></li>
|
||||
<li><a href="{:url('Mystore/releaseApp')}">发布插件</a></li>
|
||||
<li class="active"><a href="{:url('Mystore/funcApp')}">函数插件</a></li>
|
||||
<li class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_funcapp_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_plugin'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
<li class="nav-tab-right">
|
||||
<div class="nav-upload"><a href="{:url('Mystore/upload')}" onclick="windowModal('导入插件',$(this).attr('href'));return false;">导入插件</a></div>
|
||||
<span class="nav-sep">|</span>
|
||||
<div class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_funcapp_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_plugin'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
<li><a href="{:url('Mystore/rule')}">采集规则</a></li>
|
||||
<li class="active"><a href="{:url('Mystore/releaseApp')}">发布插件</a></li>
|
||||
<li><a href="{:url('Mystore/funcApp')}">函数插件</a></li>
|
||||
<li class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_releaseapp_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_plugin'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
<li class="nav-tab-right">
|
||||
<div class="nav-upload"><a href="{:url('Mystore/upload')}" onclick="windowModal('导入插件',$(this).attr('href'));return false;">导入插件</a></div>
|
||||
<span class="nav-sep">|</span>
|
||||
<div class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_releaseapp_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_plugin'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
|
|
@ -10,9 +10,11 @@
|
|||
<li class="active"><a href="{:url('Mystore/rule')}">采集规则</a></li>
|
||||
<li><a href="{:url('Mystore/releaseApp')}">发布插件</a></li>
|
||||
<li><a href="{:url('Mystore/funcApp')}">函数插件</a></li>
|
||||
<li class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_rules_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_rule'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
<li class="nav-tab-right">
|
||||
<div class="nav-check-update">
|
||||
<a href="javascript:;" onclick="check_rules_update()">检测更新</a>
|
||||
<input type="checkbox" id="auto_check" {:empty($GLOBALS['_sc']['c']['store_auto_check_rule'])?'':'checked="checked"'} value="1" title="刷新页面时自动检测" />
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<form id="win_form_upload" method="post" enctype="multipart/form-data" action="{:url('Mystore/upload')}">
|
||||
<input name="replace" type="hidden" value="" />
|
||||
{:html_usertoken()}
|
||||
<div class="form-group">
|
||||
<label>插件文件</label>
|
||||
<input type="file" name="plugin_file" class="form-control" style="padding:4px 0 0 4px; background:#efefef;">
|
||||
</div>
|
||||
{if condition="$GLOBALS['_sc']['c']['site']['verifycode']"}
|
||||
<div class="form-group">
|
||||
<label>{$Think.lang.verifycode}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="verifycode" class="form-control" />
|
||||
<div class="input-group-btn"><img src="{:url('Admin/Index/verify')}" class="verify-img" onclick="refreshVerify(this)" /></div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary btn-block">{$Think.lang.submit}</button>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
ajaxFormFile('#win_form_upload');
|
||||
function win_submit_replace(){
|
||||
//替换插件
|
||||
$('#win_form_upload').find('[name="replace"]').val(1);
|
||||
$('#win_form_upload').submit();
|
||||
}
|
||||
</script>
|
|
@ -54,6 +54,7 @@
|
|||
<label class="radio-inline"><input type="radio" name="closelog" value="1">{$Think.lang.yes}</label>
|
||||
<label class="radio-inline"><input type="radio" name="closelog" value="0">{$Think.lang.no}</label>
|
||||
</div>
|
||||
<p class="help-block">日志文件会占用磁盘空间,非运维人员建议关闭</p>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-primary">{$Think.lang.save}</button>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
*/
|
||||
|
||||
|
||||
define('SKYCAIJI_VERSION', '2.3');
|
||||
define('SKYCAIJI_VERSION', '2.3.1');
|
||||
define('NOW_TIME', time());
|
||||
\think\Loader::addNamespace('plugin', realpath(ROOT_PATH.'plugin'));
|
||||
\think\Loader::addNamespace('util',realpath(APP_PATH.'extend/util'));
|
||||
|
|
|
@ -245,7 +245,7 @@ return [
|
|||
/**********************************自定义配置*********************************************/
|
||||
'cli_cache_config'=>array('view_replace_str','root_path','app_path','apps_path','plugin_path','root_url','root_website'),//cli模式下需要缓存的配置,否则会失效引起程序bug
|
||||
|
||||
'html_v'=>'20190901',//css和js版本
|
||||
'html_v'=>'20200101',//css和js版本
|
||||
|
||||
'root_path'=>realpath(ROOT_PATH),//根目录
|
||||
'app_path'=>realpath(APP_PATH),//skycaijiApp目录
|
||||
|
@ -258,6 +258,8 @@ return [
|
|||
'release_modules'=>array('cms','db','file','toapi','api','diy'),//发布模块
|
||||
'yzm_expire'=>1200, //邮箱验证码过期时间(秒)
|
||||
|
||||
'allow_origins'=>array('http://www.skycaiji.com','https://www.skycaiji.com'),//默认允许的平台网址
|
||||
|
||||
'allow_process_func'=>array(
|
||||
'strtotime'=>'日期转时间戳',
|
||||
'strtolower'=>'全部小写',
|
||||
|
|
|
@ -36,7 +36,7 @@ class Upgrade extends BaseController{
|
|||
$this->error($result['msg'],url('Admin/Index/index'));
|
||||
}
|
||||
}
|
||||
/*延续后台升级操作》升级数据库*/
|
||||
/*延续后台升级操作»升级数据库*/
|
||||
public function adminAction(){
|
||||
$updb=new UpgradeDb();
|
||||
$result=$updb->upgrade();
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,5 @@
|
|||
#注意:如果蓝天采集器安装在子目录中,请将“子目录”替换为相应目录的名称,否则删除文字“/子目录”
|
||||
if (!-e $request_filename) {
|
||||
rewrite ^/app/(\w+)/(.*)$ /app/$1/index.php?s=/$2 last;
|
||||
rewrite ^/(.*)$ /index.php?s=/$1 last;
|
||||
rewrite ^/子目录/app/(\w+)/(.*)$ /子目录/app/$1/index.php?s=/$2 last;
|
||||
rewrite ^/子目录/(.*)$ /子目录/index.php?s=/$1 last;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
deny from all
|
|
@ -314,9 +314,12 @@ table.datatable thead .sorting_desc:after {
|
|||
.nav-tabs-color li.active{border-top-color:#3c8dbc!important;}
|
||||
.nav-tabs-color{background:#F8F8F8!important;}
|
||||
|
||||
.nav-check-update{float:right!important;padding:10px 15px}
|
||||
.nav-check-update a{display:inline!important;padding:0!important;}
|
||||
.nav-check-update img{width:14px;}
|
||||
.nav-tab-right{float:right!important;padding:10px 15px;}
|
||||
.nav-tab-right a{color:#555;}
|
||||
.nav-tab-right .nav-sep{color:#999;font-size:90%;}
|
||||
.nav-tab-right .nav-upload{display:inline;}
|
||||
.nav-tab-right .nav-check-update{display:inline;}
|
||||
.nav-tab-right .nav-check-update img{width:14px;}
|
||||
/*设置*/
|
||||
.proxy-ip-iframe{
|
||||
width:100%;
|
||||
|
|
|
@ -29,7 +29,7 @@ function cpWildcard(toObj,options){if(!options){options={}}
|
|||
var wildcard=window.tpl_lang.sign_wildcard;if(options.only){if($(toObj).val().indexOf(wildcard)<0){insertAtCaret($(toObj),wildcard)}}else{insertAtCaret($(toObj),wildcard)}}
|
||||
function windowStore(title,url,options){if(!options){options={}}
|
||||
options.bodyStyle=' style="padding:0;overflow:hidden;"';options.lg=1;var height=parseInt($(window).height());if(url){if((/^\w+\:\/\/([\w\-]+\.)*skycaiji\.com/i).test(url)){url=url.replace(/^\w+\:\/\//,'//')}
|
||||
url=url+(url.indexOf('?')>-1?'&':'?')+'_iframe=1'}
|
||||
url=url+(url.indexOf('?')>-1?'&':'?')+'_iframe=1';if(url.indexOf('clientinfo=')<0&&window.site_config.clientinfo){url+=(url.indexOf('?')>-1?'&':'?')+'clientinfo='+encodeURIComponent(window.site_config.clientinfo)}}
|
||||
var addonBody='';if(options.addonBody){addonBody=options.addonBody;options.addonBody=null}
|
||||
modal(title,'<img src="'+window.site_config.pub+'/static/images/loading.gif" class="loading-iframe" style="margin:15px;" />'+'<iframe id="myModalIframe" name="myModalIframe" '+(url?' src="'+url+'" ':'')+' frameborder="0" style="display:none;" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>'+addonBody,options);height=height-parseInt($('#myModal .modal-body').offset().top-$(document).scrollTop())*2;height=height+$('#myModal .modal-header').outerHeight();$('#myModalIframe').bind('load',function(){$('#myModal .loading-iframe').remove();$('#myModal .modal-header').hide();$('#myModal .modal-body').css('height',height);$('#myModalIframe').show()})}
|
||||
function eleExchange(box,up,down,ele){$(box).on('click',up,function(){var obj=$(this).parents(ele).eq(0);var prev=obj.prev(ele);if(prev.length>0){prev.before(obj)}});$(box).on('click',down,function(){var obj=$(this).parents(ele).eq(0);var next=obj.next(ele);if(next.length>0){next.after(obj)}})}
|
||||
|
|
|
@ -19,7 +19,7 @@ propVal=propVal.replace(/\s*class\s*=\s*[\'\"]\s*[\'\"]/ig,'')}else if(prop=='te
|
|||
propVal=propVal?propVal:'';propVals[prop]=propVal}
|
||||
$.each($(csspath)[0].attributes,function(){if(typeof(propVals[this.name])=='undefined'||propVals[this.name]==null){propVals[this.name]=this.value?this.value:''}});if(propVals){var html='';for(var i in propVals){if(propVals[i]){html+='<tr><td width="100px;">'+i+'</td><td><textarea rowspan="2">'+propVals[i]+'</textarea></td></tr>'}}
|
||||
if(html){html='<table>'+html+'</table>'}
|
||||
if(html){$_o.tips(html,3000,'skycaiji_tips_html',1)}else{$_o.tips('没有属性',1500)}}}});$('body').append($('#skycaiji_tpl').val());$('#skycaiji_wrapper').show();var configSetting={'charset':{name:'网页编码',val:'',loc:'采集器设置》网站编码'},'url_complete':{name:'自动补全网址',val:'',loc:'采集器设置》自动补全网址'},'page_render':{name:'页面渲染',val:'',loc:'采集器设置》页面渲染'},'useragent':{name:'浏览器标识',val:'',loc:'采集器设置》请求头信息》浏览器标识'},'cookie':{name:'cookie数据',val:'',loc:'采集器设置》请求头信息》Cookie 缓存数据'},};var configSetted={};var configUnset={};var cCharset={name:'网页编码',val:'',loc:'采集器设置》网站编码',}
|
||||
if(html){$_o.tips(html,3000,'skycaiji_tips_html',1)}else{$_o.tips('没有属性',1500)}}}});$('body').append($('#skycaiji_tpl').val());$('#skycaiji_wrapper').show();var configSetting={'charset':{name:'网页编码',val:'',loc:'采集器设置»网站编码'},'url_complete':{name:'自动补全网址',val:'',loc:'采集器设置»自动补全网址'},'page_render':{name:'页面渲染',val:'',loc:'采集器设置»页面渲染'},'useragent':{name:'浏览器标识',val:'',loc:'采集器设置»请求头信息»浏览器标识'},'cookie':{name:'cookie数据',val:'',loc:'采集器设置»请求头信息»Cookie 缓存数据'},};var configSetted={};var configUnset={};var cCharset={name:'网页编码',val:'',loc:'采集器设置»网站编码',}
|
||||
if(!config.url_complete){configUnset.url_complete=configSetting.url_complete}
|
||||
if(config.charset!='auto'&&config.charset!=''){configSetting.charset.val=config.charset;configSetted.charset=configSetting.charset}
|
||||
if(config.request_headers&&config.request_headers.open==1){if(config.request_headers.useragent){configSetting.useragent.val=config.request_headers.useragent;configSetted.useragent=configSetting.useragent}
|
||||
|
|
|
@ -20,5 +20,5 @@ if(ip_list){$('[name="ip_list"]').val(JSON.stringify(ip_list))}
|
|||
if(user_list){$('[name="user_list"]').val(JSON.stringify(user_list))}
|
||||
if(pwd_list){$('[name="pwd_list"]').val(JSON.stringify(pwd_list))}
|
||||
if(type_list){$('[name="type_list"]').val(JSON.stringify(type_list))}
|
||||
$('#form_list').submit()})})},init_add:function(){var $_o=this;var formid='#win_form_proxy_add';$(formid+' .proxy-ip-list').attr('data-tpl','<tr>'+$(formid+' .tpl-proxy-ip').html()+'</tr>');$(formid+' .tpl-proxy-ip').remove();$(formid+' .add-proxy-ip').bind('click',function(){$(formid+' .proxy-ip-list tbody').append($(formid+' .proxy-ip-list').attr('data-tpl'))});$(formid).bind('submit',function(){$.ajax({type:'post',dataType:'json',url:$(this).attr('action'),data:$(this).serialize(),success:function(data){if(data.code==1){$_o.reload_iframe('添加成功')}else{toastr.error(data.msg)}}});return!1})},init_batch:function(){var $_o=this;var formid='#win_form_proxy_batch';$(formid+' .format a').bind('click',function(){var obj=$('#win_form_proxy_batch input[name="format"]');insertAtCaret(obj,$(this).text())});$(formid+' .btn-test').bind('click',function(){$(formid).find('[name="is_test"]').val(1);$.ajax({type:'POST',dataType:'json',url:$(formid).attr('action'),data:$(formid).serialize(),success:function(data){if(data.code==1){$(formid+' .test-result').show();$(formid+' .test-result').find('textarea').val(data.msg)}else{toastr.error(data.msg)}}})});$(formid).bind('submit',function(){$(formid).find('[name="is_test"]').val('');$.ajax({type:'POST',dataType:'json',url:$(this).attr('action'),data:$(this).serialize(),success:function(data){if(data.code==1){$_o.reload_iframe('添加成功')}else{toastr.error(data.msg)}},});return!1})},}
|
||||
$('#form_list').submit()})})},init_add:function(){var $_o=this;var formid='#win_form_proxy_add';$(formid+' .proxy-ip-list').attr('data-tpl','<tr>'+$(formid+' .tpl-proxy-ip').html()+'</tr>');$(formid+' .tpl-proxy-ip').remove();$(formid+' .add-proxy-ip').bind('click',function(){$(formid+' .proxy-ip-list tbody').append($(formid+' .proxy-ip-list').attr('data-tpl'))});$(formid).on('click','.op-delete',function(){$(this).parents('tr').eq(0).remove()});$(formid).bind('submit',function(){$.ajax({type:'post',dataType:'json',url:$(this).attr('action'),data:$(this).serialize(),success:function(data){if(data.code==1){$_o.reload_iframe('添加成功')}else{toastr.error(data.msg)}}});return!1})},init_batch:function(){var $_o=this;var formid='#win_form_proxy_batch';$(formid+' .format a').bind('click',function(){var obj=$('#win_form_proxy_batch input[name="format"]');insertAtCaret(obj,$(this).text())});$(formid+' .btn-test').bind('click',function(){$(formid).find('[name="is_test"]').val(1);$.ajax({type:'POST',dataType:'json',url:$(formid).attr('action'),data:$(formid).serialize(),success:function(data){if(data.code==1){$(formid+' .test-result').show();$(formid+' .test-result').find('textarea').val(data.msg)}else{toastr.error(data.msg)}}})});$(formid).bind('submit',function(){$(formid).find('[name="is_test"]').val('');$.ajax({type:'POST',dataType:'json',url:$(this).attr('action'),data:$(this).serialize(),success:function(data){if(data.code==1){$_o.reload_iframe('添加成功')}else{toastr.error(data.msg)}},});return!1})},}
|
||||
var proxyClass=new ProxyClass()
|
|
@ -9,7 +9,10 @@
|
|||
*/
|
||||
'use strict';$(document).ready(function(){toastr.options={"closeButton":!1,"debug":!1,"newestOnTop":!1,"progressBar":!1,"positionClass":"toast-top-center","preventDuplicates":!1,"onclick":null,"showDuration":"300","hideDuration":"1000","timeOut":"3000","extendedTimeOut":"1000","showEasing":"swing","hideEasing":"linear","showMethod":"fadeIn","hideMethod":"fadeOut"};$('body').on('submit','form[ajax-submit="true"]',function(){var $_o=$(this);$_o.find('button[type="submit"]').attr('disabled',!0);$.ajax({type:'POST',dataType:'json',url:$(this).attr('action'),data:$(this).serialize(),success:function(data){if(data.url){setTimeout("window.location.href='"+data.url+"';",2000)}else{$_o.find('button[type="submit"]').removeAttr('disabled')}
|
||||
if(data.code==1){toastr.success(data.msg);$_o.find('.verify-img').trigger('click')}else{toastr.error(data.msg)}
|
||||
if(data.data&&data.data.js){eval(data.data.js)}},error:function(data){$_o.find('button[type="submit"]').removeAttr('disabled');toastr.error(data)}});return!1})});function htmlspecialchars(str){str=str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');return str}
|
||||
if(data.data&&data.data.js){eval(data.data.js)}},error:function(data){$_o.find('button[type="submit"]').removeAttr('disabled');toastr.error(data)}});return!1})});function ajaxFormFile(obj){$(obj).bind('submit',function(){var $_o=$(this);$_o.find('button[type="submit"]').attr('disabled',!0);$.ajax({type:'POST',dataType:'json',url:$_o.attr('action'),contentType:!1,processData:!1,data:(new FormData($_o[0])),success:function(data){if(data.url){setTimeout("window.location.href='"+data.url+"';",2000)}else{$_o.find('button[type="submit"]').removeAttr('disabled')}
|
||||
if(data.code==1){toastr.success(data.msg);$_o.find('.verify-img').trigger('click')}else{toastr.error(data.msg)}
|
||||
if(data.data&&data.data.js){eval(data.data.js)}},error:function(data){$_o.find('button[type="submit"]').removeAttr('disabled');toastr.error(data)}});return!1})}
|
||||
function htmlspecialchars(str){str=str.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');return str}
|
||||
function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString())+';path='+(window.site_config?(window.site_config.root?window.site_config.root:'/'):'/')}
|
||||
function getCookie(c_name){if(document.cookie.length>0){var c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;var c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end))}}
|
||||
return""}
|
||||
|
|
Loading…
Reference in New Issue