mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-08-17 21:25:47 +02:00
Since version 7.7.0, we recommend yours update python to 3.12. [+] Using nginx technology to load static files improves access speed [+] Refactor homepage, website, FTP, and database using vue3 [+] Table loading changed to skeleton screen [+] Add Website statistics-v2 professional plug-in [+] Add Home page - top 5 resource occupancy [+] Add protection for Files management (requires Tamper-proof for Enterprise 3.7) [+] Website, FTP, Databases page add program status [+] Add FTP log analysis (only supports Centos) [+] Add password-free login to phpMyAdmin [+] Add Proxy Project in Website (Supported when web service uses Nginx) [+] Add WP Toolkit (Pro version only) [+] Redesigned Docker module [+] Add WP Toolkit Protection [+] Add WP Toolkit Backup and Restore [+] Add WP Toolkit Migrated [+] Add WP Toolkit Clone site (supports new domain and subdomain) [+] Add WP Toolkit Create site from backup of other panel [+] Add WP Toolkit support for Cron automatic backup (only save Local disk) [+] Add WP Toolkit operation log [+] Add Integrity check for WP Toolkit [+] Add WP Toolkit plug-in management and themes management [*] Optimize phpMyAdmin formula access method [*] Optimize Home page PHP display problem [*] Optimize jump to the login interface after the login expires [*] Optimize automatic renewal of SSL at some times [*] Optimize Let's Encrypt to increase application success rate [-] Fix Logs Audit cannot be opened [-] Fix apache URL rewrite issue [-] Fix phpmyadmin installation problem [-] Fix the problem that some servers cannot install software [-] Fix upload file error [-] Fix left menu hiding problem [-] Fix aaPanel Mobile QR code display problem [-] Fix problem that third-party plug-ins are not displayed in the App Store [-] Fix issue where the menu bar is blank when opening new tabs [-] Fixed panel not being accessible in some cases [-] Fix the issue where Curl warning caused the inability to apply for SSL [-] Fix Quota issues for Website, FTP, Databases [-] Fix file interface display problem on mobile terminal
157 lines
4.2 KiB
PHP
157 lines
4.2 KiB
PHP
<?php
|
|
// +-------------------------------------------------------------------
|
|
// | aaPanel
|
|
// +-------------------------------------------------------------------
|
|
// | Copyright (c) 2015-2099 aaPanel(www.aapanel.com) All rights reserved.
|
|
// +-------------------------------------------------------------------
|
|
// | Author: hwliang <hwl@aapanel.com>
|
|
// +-------------------------------------------------------------------
|
|
|
|
// +-------------------------------------------------------------------
|
|
// | PHP插件前置处理模块
|
|
// +-------------------------------------------------------------------
|
|
class bt_panel_plugin
|
|
{
|
|
//启动PHP插件
|
|
public function run(){
|
|
$this->init();
|
|
return $this->plugin_main();
|
|
}
|
|
|
|
//初始化插件环境
|
|
private function init(){
|
|
//获取命令行参数
|
|
$args_arr = getopt('',array('plugin_name:','args_tmp:','fun:'));
|
|
if(!$args_arr['plugin_name']){
|
|
return_status(false,'The specified plugin does not exist!');
|
|
}
|
|
if(!$args_arr['args_tmp']){
|
|
return_status(false,'Please pass in the correct parameter location!');
|
|
}
|
|
//初始化插件配置
|
|
define('PLU_PATH', '/www/server/panel/plugin/'.trim($args_arr['plugin_name']));
|
|
define('PLU_NAME',trim($args_arr['plugin_name']));
|
|
define('PLU_ARGS_TMP', trim($args_arr['args_tmp']));
|
|
define('PLU_FUN',trim($args_arr['fun']));
|
|
|
|
//检查
|
|
if(!file_exists(PLU_PATH.'/index.php')) return_status(false,'The specified plugin does not exist!');
|
|
if(!preg_match("/^[\w-]+$/",PLU_FUN)) return_status(false,'The specified method does not exist!');
|
|
chdir(PLU_PATH);
|
|
}
|
|
|
|
//调用插件主程序
|
|
private function plugin_main(){
|
|
include_once PLU_PATH . '/index.php';
|
|
if(!class_exists('bt_main')) return_status(false,'No bt_main class found');
|
|
|
|
$plu = new bt_main();
|
|
if(!method_exists($plu, PLU_FUN)) return_status(false,'The specified method does not exist!');
|
|
return call_user_func(array($plu,PLU_FUN));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class db extends SQLite3
|
|
{
|
|
function __construct($db_file = '/www/server/panel/data/default.db')
|
|
{
|
|
$this->open($db_file);
|
|
}
|
|
|
|
public function queryute($sql){
|
|
$result = $this->query($sql);
|
|
$data = $result->fetchArray(SQLITE3_ASSOC);
|
|
return $data;
|
|
}
|
|
|
|
public function execute($sql){
|
|
$result = $this->exec($sql);
|
|
return $result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//取指安参数
|
|
function _args($_t,$key){
|
|
if(!file_exists(PLU_ARGS_TMP)) {
|
|
if($key) return null;
|
|
return array();
|
|
}
|
|
$args_tmp = json_decode(file_get_contents(PLU_ARGS_TMP),1);
|
|
if($key){
|
|
if(!array_key_exists($key, $args_tmp[$_t])) return false;
|
|
return $args_tmp[$_t][$key];
|
|
}
|
|
return $args_tmp[$_t];
|
|
}
|
|
|
|
function _version(){
|
|
$comm_body = file_get_contents('/www/server/panel/class/common.py');
|
|
preg_match("/g\.version\s*=\s*'(\d+\.\d+\.\d+)'/",$comm_body,$m_version);
|
|
return $m_version[1];
|
|
}
|
|
|
|
//取GET参数
|
|
function _get($key = null){
|
|
return _args('GET',$key);
|
|
}
|
|
|
|
//取POST参数
|
|
function _post($key=null){
|
|
return _args('POST',$key);
|
|
}
|
|
|
|
//通用返回状态
|
|
function return_status($status,$msg){
|
|
exit(json_encode(array('status'=>$status,'msg'=>$msg)));
|
|
}
|
|
|
|
//返回数据
|
|
function _return($data){
|
|
exit(json_encode($data));
|
|
}
|
|
|
|
/**
|
|
* 发起GET请求
|
|
* @param String $url 目标网填,带http://
|
|
* @return bool
|
|
*/
|
|
function _httpGet($url) {
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 6);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER,array('Accept-Encoding: gzip, deflate'));
|
|
curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
|
|
curl_setopt($ch, CURLOPT_USERAGENT, "BT-Panel for PHP-Plugin");
|
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 3);
|
|
$output = curl_exec($ch);
|
|
curl_close($ch);
|
|
return $output;
|
|
}
|
|
|
|
//发起POST请求
|
|
function _httpPost($url,$data){
|
|
$ch = curl_init();
|
|
curl_setopt($ch, CURLOPT_URL, $url);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
|
curl_setopt($ch, CURLOPT_POST, 1);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
|
curl_setopt($ch, CURLOPT_USERAGENT, "BT-Panel for PHP-Plugin");
|
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
$output = curl_exec($ch);
|
|
curl_close($ch);
|
|
return $output;
|
|
}
|
|
|
|
//启动插件
|
|
$p = new bt_panel_plugin();
|
|
_return($p->run());
|
|
?>
|