예제 #1
0
 function amchroot_edit($domain, $mode)
 {
     $cmd = "amh module AMChroot-1.1 admin edit,{$domain},{$mode}";
     $cmd = Functions::trim_cmd($cmd);
     exec($cmd, $tmp, $status);
     return !$status;
 }
예제 #2
0
 function module_download($name)
 {
     $cmd = "amh module download {$name}";
     $cmd = Functions::trim_cmd($cmd);
     exec($cmd, $tmp, $status);
     return !$status;
 }
예제 #3
0
파일: modules.php 프로젝트: logdns/amh-4.2
 function module_delete($name)
 {
     $cmd = "amh module {$name} delete y";
     $cmd = Functions::trim_cmd($cmd);
     exec($cmd, $tmp, $status);
     return !$status;
 }
예제 #4
0
 function IndexAction()
 {
     $this->title = 'AMH - AMWebsite';
     // 面板模板标题
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     // 面板登录检查函数
     $host_domain = isset($_GET['host_domain']) ? $_GET['host_domain'] : (isset($_POST['host_domain']) ? $_POST['host_domain'] : '');
     $product_name = isset($_GET['product_name']) ? $_GET['product_name'] : (isset($_POST['product_name']) ? $_POST['product_name'] : '');
     $host_list = $this->hosts->host_list();
     $product_list = array(array('product_id' => '1', 'product_sort' => '论坛', 'product_name' => 'Discuz-3.0.8.2', 'product_description' => 'Crossday Discuz! Board(简称 Discuz!)是北京康盛新创科技有限责任公司推出的一套通用的社区论坛软件系统。自2001年6月面世以来,Discuz!已拥有11年以上的应用历史和200多万网站用户案例,是全球成熟度最高、覆盖率最大的论坛软件系统之一。', 'product_website' => 'http://www.comsenz.com', 'logo' => 'View/images/AMWebsite/discuz.gif'), array('product_id' => '2', 'product_sort' => '论坛', 'product_name' => 'phpwind-9.0.7.2', 'product_description' => 'phpwind(简称 PW)是一个基于PHP和MySQL的开源社区程序,是国内最受欢迎的通用型论坛程序之一。phpwind第一个版本ofstar发布于2004年。目前phpwind项目品牌由阿里云计算有限公司拥有,软件全面开源免费。现已有累积超过100万的网站采用phpwind产品,其中活跃网站近10万。自2011年发布PHPWind8.x系列版本以来,phpwind围绕着提升社区内容价值和推进社区电子商务两个大方向,开发单核心多模式的产品,实现新型的社区形态。', 'product_website' => 'http://www.phpwind.com', 'logo' => 'View/images/AMWebsite/phpwind.gif', 'base_module' => 'PDO_MYSQL-1.0.2'), array('product_id' => '3', 'product_sort' => '问答', 'product_name' => 'WeCenter-2.1', 'product_description' => 'Wecenter(微中心系统软件)是一款由深圳市微客互动有限公司开发的具有完全自主知识产权的开源软件,是一个类似知乎以问答为基础的完全开源的社交网络建站程序,基于 PHP + MYSQL 应用架构,它集合了问答,digg,wiki 等多个程序的优点,帮助用户轻松搭建专业的知识库和在线问答社区。', 'product_website' => 'http://www.wecenter.com/', 'logo' => 'View/images/AMWebsite/wecenter.jpg', 'base_module' => 'PDO_MYSQL-1.0.2', 'partner' => true), array('product_id' => '4', 'product_sort' => '博客', 'product_name' => 'WordPress-3.6', 'product_description' => 'WordPress是一种使用PHP语言开发的博客平台,同时也可以把 WordPress 当作一个内容管理系统(CMS)来使用,WordPress起初是一款个人博客系统,并逐步演化成一款内容管理系统软件。WordPress功能比较强大,插件众多,易于扩充功能。安装使用都非常方便。', 'product_website' => 'http://cn.wordpress.org/', 'logo' => 'View/images/AMWebsite/wp.jpg'), array('product_id' => '5', 'product_sort' => '博客', 'product_name' => 'Typecho-0.8', 'product_description' => 'Typecho是一个简单,轻巧的博客程序。基于PHP,使用多种数据库(Mysql,PostgreSQL,SQLite)储存数据。在GPL Version 2许可证下发行,是一个开源的程序,目前使用SVN来做版本管理。', 'product_website' => 'http://www.typecho.org/', 'logo' => 'View/images/AMWebsite/typecho.gif', 'base_module' => 'AMPathinfo-1.0'), array('product_id' => '6', 'product_sort' => '商城', 'product_name' => 'ECShop-2.7.3.7.8', 'product_description' => 'ECShop是上海商派网络科技有限公司(ShopEx)旗下——B2C独立网店系统,适合企业及个人快速构建个性化网上商店。系统是基于PHP语言及MYSQL数据库构架开发的跨平台开源程序。(此安装版本为AMH改进版,改进官方源码包存在的多次错误。20130531)', 'product_website' => 'http://www.ecshop.com/', 'logo' => 'View/images/AMWebsite/ecshop.gif'), array('product_id' => '7', 'product_sort' => '博客', 'product_name' => 'emlog-5.1.2', 'product_description' => 'emlog 是 every memory log 的简称,意即:点滴记忆。是一款基于PHP和MySQL的功能强大的博客及CMS建站系统。致力于为您提供快速、稳定,且在使用上又极其简单、舒适的内容创作及站点搭建服务。', 'product_website' => 'http://www.emlog.net/', 'logo' => 'View/images/AMWebsite/emlog.gif', 'CloseAuto' => true), array('product_id' => '8', 'product_sort' => 'CMS', 'product_name' => 'EmpireCMS-7.0', 'product_description' => '《帝国网站管理系统》英文译为"Empire CMS",简称"Ecms",它是基于B/S结构,且功能强大而帝国CMS-logo易用的网站管理系统。本系统由帝国开发工作组独立开发,是一个经过完善设计的适用于Linux/windows引/Unix等环境下高效的网站解决方案。', 'product_website' => 'http://www.phome.net/', 'logo' => 'View/images/AMWebsite/EmpireCMS.gif'));
     $account_list = $this->AccountTemplets->get_account_list();
     // 选择程序安装目录位置与安装模式
     if (!empty($host_domain) && !empty($product_name)) {
         $host_root = null;
         foreach ($host_list as $key => $val) {
             if ($val['host_domain'] == $host_domain) {
                 $host_root = $val['host_root'];
                 break;
             }
         }
         if (!empty($host_root)) {
             $this->GetDirs($host_root);
         }
     }
     // 安装
     if (isset($_POST['submit_install_y'])) {
         $cn_txt = array('manual' => '手动', 'automatic' => '自动');
         $cmd = "amh module AMWebsite-2.0 admin install,{$_POST['host_domain']},{$this->dirs[$_POST['dir_id']]},{$_POST['install_model']},{$_POST['product_name']},{$_POST['account_list']}";
         $cmd = Functions::trim_cmd($cmd);
         exec($cmd, $tmp, $status);
         if (!$status) {
             $this->status = 'success';
             $this->notice = "{$_POST['host_domain']}域名:一键{$cn_txt[$_POST['install_model']]}安装{$_POST['product_name']}成功。({$this->dirs[$_POST['dir_id']]})";
             if ($_POST['install_model'] == 'automatic') {
                 // 自动安装完成后管理员相关资料
                 include "{$this->dirs[$_POST['dir_id']]}/AMWebsite_DB.php";
                 $this->install_db_info = array('DBName' => $AMWebsite_DBName, 'DBUser' => $AMWebsite_DBUser, 'DBPass' => $AMWebsite_DBPass, 'AdminUser' => $AMWebsite_AdminUser, 'AdminPass' => $AMWebsite_AdminPass, 'AdminEmail' => $AMWebsite_AdminEmail);
             }
         } else {
             $this->status = 'error';
             $this->notice = "{$_POST['host_domain']}域名:一键{$cn_txt[$_POST['install_model']]}安装{$_POST['product_name']}失败。({$this->dirs[$_POST['dir_id']]})";
         }
         $this->host_root = $this->dirs[$_POST['dir_id']];
         unset($this->dirs);
     }
     $this->indexs->log_insert($this->notice);
     $this->host_list = $host_list;
     $this->product_list = $product_list;
     $this->account_list = $account_list;
     $this->_view('AMWebsite');
     // 加载模板文件
 }
예제 #5
0
파일: mysqls.php 프로젝트: dudor/nginxpanel
 function get_mysql_param($param_list)
 {
     $cmd = "amh cat_my_cnf";
     $cmd = Functions::trim_cmd($cmd);
     $my_cnf = Functions::trim_result(shell_exec($cmd));
     foreach ($param_list as $key => $val) {
         preg_match("/{$val['1']} = (.*)/", $my_cnf, $param_val);
         if ($val[1] == 'InnoDB_Engine') {
             $param_val[1] = preg_match("/innodb = OFF/", $my_cnf) ? 'Off' : 'On';
         }
         $param_list[$key][3] = $param_val[1];
     }
     return $param_list;
 }
예제 #6
0
 function up_amh_config()
 {
     $data_name = array('HelpDoc', 'LoginErrorLimit', 'VerifyCode', 'AMHListen', 'AMHDomain');
     $Affected = 0;
     foreach ($data_name as $val) {
         if (isset($_POST[$val]) && $_POST[$val] != $_POST[$val . '_old']) {
             $this->_update('amh_config', array('config_value' => $_POST[$val]), " WHERE config_name = '{$val}' ");
             $Affected += $this->Affected;
             if ($val == 'AMHListen') {
                 $cmd = "amh SetParam amh amh_Listen {$_POST[$val]}";
                 $cmd = Functions::trim_cmd($cmd);
                 $result = trim(shell_exec($cmd), "\n");
             }
             if ($val == 'AMHDomain') {
                 $cmd = "amh SetParam amh amh_domain {$_POST[$val]}";
                 $cmd = Functions::trim_cmd($cmd);
                 $result = trim(shell_exec($cmd), "\n");
             }
         }
     }
     return $Affected;
 }
예제 #7
0
파일: module.php 프로젝트: dudor/nginxpanel
 function module_list()
 {
     $this->title = 'AMH - Module';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     if (isset($_GET['action']) && isset($_GET['name'])) {
         $name = $_GET['name'];
         $action = $_GET['action'];
         $action_list = array('install' => '安装', 'uninstall' => '卸载', 'delete' => '删除');
         $result = '';
         if (isset($action_list[$action])) {
             $cmd = "amh module {$name} {$action} y";
             $cmd = Functions::trim_cmd($cmd);
             $result = trim(shell_exec($cmd), "\n");
             $result = Functions::trim_result($result);
         }
         if (strpos($result, '[OK]') !== false && strpos($result, '[Error]') == false) {
             $this->status = 'success';
             $this->notice = "{$name} {$action_list[$action]}成功。";
         } else {
             $this->status = 'error';
             $this->notice = "{$name} {$action_list[$action]}失败。";
         }
     }
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $page_sum = 5;
     $get_module_list_data = $this->modules->get_module_list_data($page, $page_sum);
     $total_page = ceil($get_module_list_data['sum'] / $page_sum);
     $page_list = Functions::page('ModuleList', $get_module_list_data['sum'], $total_page, $page, 'c=module&a=module_list');
     // 分页列表
     global $Config;
     $Config['XSS'] = false;
     $this->page = $page;
     $this->total_page = $total_page;
     $this->page_list = $page_list;
     $this->module_list_data = $get_module_list_data;
     $this->indexs->log_insert($this->notice);
     $this->_view('module_list');
 }
예제 #8
0
파일: index.php 프로젝트: logdns/amh-4.2
 function IndexAction()
 {
     $this->title = '主页 - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $_SESSION['amh_version'] = '4.2';
     $m = isset($_GET['m']) ? $_GET['m'] : '';
     $g = isset($_GET['g']) ? $_GET['g'] : '';
     if (!empty($m) && !empty($g) && in_array($m, array('host', 'php', 'nginx', 'mysql')) && in_array($g, array('start', 'stop', 'reload', 'restart'))) {
         $cmd = "amh {$m} {$g}";
         $cmd = Functions::trim_cmd($cmd);
         exec($cmd, $tmp, $status);
         if (!$status) {
             $this->status = 'success';
             $this->notice = "{$m} " . $this->action_name[$g] . '成功。';
         } else {
             $this->status = 'error';
             $this->notice = "{$m} " . $this->action_name[$g] . '失败。';
         }
     }
     $this->indexs->log_insert($this->notice);
     $this->_view('index');
 }
예제 #9
0
파일: configs.php 프로젝트: logdns/amh-4.2
 function get_upgrade_notice()
 {
     $cmd = 'amh upgrade list';
     $result = shell_exec($cmd);
     $result = Functions::trim_result($result);
     $upgrade_list = explode("\n", trim($result));
     $upgrade_sum = 0;
     foreach ($upgrade_list as $key => $val) {
         if (!empty($val)) {
             // Upgrade install_status
             $cmd = "amh upgrade {$val} install_status";
             $cmd = Functions::trim_cmd($cmd);
             exec($cmd, $tmp, $status);
             if ($status) {
                 ++$upgrade_sum;
             }
         }
     }
     $sql = "UPDATE amh_config SET config_value = '{$upgrade_sum}' WHERE config_name = 'UpgradeSum' ";
     $this->_query($sql);
     $_SESSION['amh_config'] = $this->get_amh_config();
     return $upgrade_sum;
 }
예제 #10
0
파일: config.php 프로젝트: logdns/amh-4.2
 function config_upgrade()
 {
     $this->title = '在线升级 - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     if (isset($_GET['install'])) {
         set_time_limit(0);
         $UpgradeName = $_GET['install'];
         $this->UpgradeName = $UpgradeName;
         $this->_view('config_upgrade_ing');
         $cmd = "amh upgrade {$UpgradeName} install";
         $cmd = Functions::trim_cmd($cmd);
         $popen_handle = popen($cmd, 'r');
         $i = 0;
         echo '<div id="show_result">';
         while (!feof($popen_handle)) {
             $line = fgets($popen_handle);
             echo $line . '<br />';
             if ($i % 5 == 0) {
                 echo "<script>amh_cmd_ing();</script>\n";
             }
             ++$i;
         }
         $upgrade_ing_status = json_encode(pclose($popen_handle));
         $result_status = !$upgrade_ing_status ? true : false;
         echo "<script>amh_cmd_ing();upgrade_ing_status = {$upgrade_ing_status};upgrade_end();</script>{$line}</div>";
         if ($result_status) {
             $this->status = 'success';
             $this->notice = "{$UpgradeName} 升级更新成功。";
         } else {
             $this->status = 'error';
             $this->notice = "{$UpgradeName} 升级更新失败。";
         }
         $this->indexs->log_insert($this->notice);
         exit;
     }
     $upgrade_list = $this->configs->get_upgrade_list();
     $this->upgrade_list = $upgrade_list;
     $this->_view('config_upgrade');
 }
예제 #11
0
파일: backup.php 프로젝트: logdns/amh-4.2
 function backup_revert()
 {
     $this->title = '一键还原 - 备份 - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $this->status = 'error';
     $revert_id = isset($_GET['revert_id']) ? (int) $_GET['revert_id'] : '';
     if (!empty($revert_id)) {
         $revert = $this->backups->get_backup($revert_id);
     }
     $this->revert = $revert;
     if (isset($_POST['revert_submit'])) {
         set_time_limit(0);
         $backup_file = $revert['backup_file'];
         $backup_password = empty($_POST['backup_password']) ? 'n' : $_POST['backup_password'];
         $this->category = $category;
         $this->_view('backup_revert_ing');
         $cmd = "amh revert {$backup_file} {$backup_password} noreload";
         $cmd = Functions::trim_cmd($cmd);
         $popen_handle = popen($cmd, 'r');
         $i = 0;
         $_i = 50;
         echo '<div id="show_result">';
         while (!feof($popen_handle)) {
             $line = fgets($popen_handle);
             echo $line . '<br />';
             if ($i % 200 == 0) {
                 ++$_i;
             }
             if ($i % $_i == 0) {
                 echo "<script>amh_cmd_ing();</script>\n";
             }
             ++$i;
             if (!empty($line)) {
                 $result = $line;
             }
         }
         $revert_ing_status = json_encode(pclose($popen_handle));
         $result_status = !$revert_ing_status ? true : false;
         if ($result_status) {
             $this->status = 'success';
             $this->notice = $backup_file . ' 数据一键还原成功。';
             $_POST = array();
         } else {
             $this->status = 'error';
             $this->notice = $result . $backup_file . ' 一键还原失败。';
         }
         $notice = json_encode($this->notice);
         echo "<script>amh_cmd_ing();revert_ing_status = {$revert_ing_status}; revert_result = {$notice}; revert_end();</script>{$line}</div>";
         $this->indexs->log_insert($this->notice);
         exit;
     }
     $this->indexs->log_insert($this->notice);
     $this->_view('backup_revert');
 }
예제 #12
0
파일: backup.php 프로젝트: dudor/nginxpanel
 function backup_list()
 {
     $this->title = 'AMH - Backup';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $this->status = 'error';
     $category = isset($_GET['category']) ? $_GET['category'] : 'backup_list';
     $category_array = array('backup_list', 'backup_remote', 'backup_now', 'backup_revert');
     if (!in_array($category, $category_array)) {
         $category = 'backup_list';
     }
     $input_item = array('remote_type', 'remote_status', 'remote_ip', 'remote_path', 'remote_user', 'remote_password');
     if ($category == 'backup_list') {
         $this->title = 'AMH - Backup - 备份列表';
         if (isset($_GET['del'])) {
             $del_id = (int) $_GET['del'];
             $del_info = $this->backups->get_backup($del_id);
             if (isset($del_info['backup_file'])) {
                 $file = str_replace('.amh', '', $del_info['backup_file']);
                 $cmd = "amh rm_backup {$file}";
                 $cmd = Functions::trim_cmd($cmd);
                 $result = shell_exec($cmd);
                 $this->status = 'success';
                 $this->notice = "删除备份文件({$file}.amh)执行完成。";
             }
         }
         $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
         $page_sum = 20;
         $this->backups->backup_list_update();
         $backup_list = $this->backups->get_backup_list($page, $page_sum);
         $total_page = ceil($backup_list['sum'] / $page_sum);
         $page_list = Functions::page('BackupList', $backup_list['sum'], $total_page, $page, 'c=backup&a=backup_list&category=backup_list');
         // 分页列表
         global $Config;
         $Config['XSS'] = false;
         $this->page = $page;
         $this->total_page = $total_page;
         $this->backup_list = $backup_list;
         $this->page_list = $page_list;
     } elseif ($category == 'backup_remote') {
         $this->title = 'AMH - Backup - 远程设置';
         // 连接测试
         if (isset($_GET['check'])) {
             $id = (int) $_GET['check'];
             $data = $this->backups->get_backup_remote($id);
             if ($data['remote_type'] == 'FTP') {
                 $cmd = "amh BRftp check {$id}";
             } else {
                 $cmd = "amh BRssh check {$id}";
             }
             $cmd = Functions::trim_cmd($cmd);
             $result = shell_exec($cmd);
             $result = trim(Functions::trim_result($result), "\n ");
             echo $result;
             exit;
         }
         // 保存远程配置
         if (isset($_POST['save'])) {
             $save = true;
             foreach ($input_item as $val) {
                 if (empty($_POST[$val])) {
                     $this->notice = '新增远程备份配置失败,请填写完整数据,*号为必填项。';
                     $save = false;
                 }
             }
             if ($save) {
                 $id = $this->backups->backup_remote_insert();
                 if ($id) {
                     $this->status = 'success';
                     $this->notice = 'ID:' . $id . ' 新增远程备份配置成功。';
                     $_POST = array();
                 } else {
                     $this->notice = ' 新增远程备份配置失败。';
                 }
             }
         }
         // 删除远程配置
         if (isset($_GET['del'])) {
             $id = (int) $_GET['del'];
             if (!empty($id)) {
                 $result = $this->backups->backup_remote_del($id);
                 if ($result) {
                     $this->status = 'success';
                     $this->notice = 'ID:' . $id . ' 删除远程备份配置成功。';
                 } else {
                     $this->notice = 'ID:' . $id . ' 删除远程备份配置失败。';
                 }
             }
         }
         // 编辑远程配置
         if (isset($_GET['edit'])) {
             $id = (int) $_GET['edit'];
             $_POST = $this->backups->get_backup_remote($id);
             if ($_POST['remote_id']) {
                 $this->edit_remote = true;
             }
         }
         // 保存编辑远程配置
         if (isset($_POST['save_edit'])) {
             $id = $_POST['remote_id'] = (int) $_POST['save_edit'];
             $save = true;
             foreach ($input_item as $val) {
                 if (empty($_POST[$val]) && $val != 'remote_password') {
                     $this->notice = 'ID:' . $id . ' 编辑远程备份配置失败。*号为必填项。';
                     $save = false;
                     $this->edit_remote = true;
                 }
             }
             if ($save) {
                 $result = $this->backups->backup_remote_update();
                 if ($result) {
                     $this->status = 'success';
                     $this->notice = 'ID:' . $id . ' 编辑远程备份配置成功。';
                     $_POST = array();
                 } else {
                     $this->notice = 'ID:' . $id . ' 编辑远程备份配置失败。';
                     $this->edit_remote = true;
                 }
             }
         }
         $this->remote_list = $this->backups->backup_remote_list();
     } elseif ($category == 'backup_now') {
         $this->title = 'AMH - Backup - 即时备份';
         if (isset($_POST['backup_now'])) {
             $backup_retemo = $_POST['backup_retemo'] == 'on' ? 'y' : 'n';
             $backup_password = !empty($_POST['backup_password']) ? $_POST['backup_password'] : '******';
             $backup_comment = !empty($_POST['backup_comment']) ? $_POST['backup_comment'] : '';
             if ((!empty($_POST['backup_password2']) || !empty($_POST['backup_password'])) && $_POST['backup_password'] != $_POST['backup_password2']) {
                 $this->notice = ' 两次密码不一致,请确认。';
             } else {
                 $cmd = "amh backup {$backup_retemo} {$backup_password} {$backup_comment}";
                 $cmd = Functions::trim_cmd($cmd);
                 $result = shell_exec($cmd);
                 $result = trim(Functions::trim_result($result), "\n ");
                 if (strpos($result, '[OK]') !== false) {
                     $this->status = 'success';
                     $this->notice = $result . ' 已成功创建备份文件。';
                     $_POST = array();
                 } else {
                     $this->notice = $result . ' 备份文件创建失败';
                 }
             }
         }
     } elseif ($category == 'backup_revert') {
         $this->title = 'AMH - Backup - 一键还原';
         $this->notice = ' 还原失败!';
         //			$revert_id = isset($_GET['revert_id']) ? (int)$_GET['revert_id'] : '';
         //			if (!empty($revert_id))
         //				$revert = $this -> backups -> get_backup($revert_id);
         //
         //			if (isset($_POST['revert_submit']))
         //			{
         //				$backup_file = $revert['backup_file'];
         //				$backup_password = empty($_POST['backup_password']) ? 'n' : $_POST['backup_password'];
         //				$cmd = "amh revert $backup_file $backup_password noreload";
         //				$cmd = Functions::trim_cmd($cmd);
         //				$result = shell_exec($cmd);
         //				$result = trim(Functions::trim_result($result), "\n ");
         //				if (strpos($result, '[OK]') !== false)
         //				{
         //					$this -> status = 'success';
         //					$this -> notice = $backup_file . ' 数据还原成功。';
         //				}
         //				else
         //					$this -> notice = $result . ' ' . $backup_file . ' 还原失败。' ;
         //
         //			}
         //			$this -> revert = $revert;
     }
     $this->indexs->log_insert($this->notice);
     $this->category = $category;
     $this->_view('backup');
 }
예제 #13
0
파일: host.php 프로젝트: dudor/nginxpanel
 function php_setparam()
 {
     $this->title = 'AMH - Host - PHPSetParam';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $param_list = array(array('设置PHP时区', 'date.timezone', 'Asia/Hong_Kong'), array('是否显示PHP错误信息', 'display_errors', 'On / Off'), array('PHP运行内存限制', 'memory_limit', '68M'), array('POST数据最大限制', 'post_max_size', '4M'), array('上传文件最大限制', 'upload_max_filesize', '2M'), array('上传文件个数限制', 'max_file_uploads', '10'), array('脚本超时时间', 'max_execution_time', '20'), array('socket超时时间', 'default_socket_timeout', '60'), array('SESSION过期时间', 'session.cache_expire', '180'), array('是否开启短标签', 'short_open_tag', 'On / Off'), array('是否开启自动字符串转义', 'magic_quotes_gpc', 'On / Off'), array('是否外部字符串自动转义', 'magic_quotes_runtime', 'On / Off'));
     if (isset($_POST['submit'])) {
         foreach ($param_list as $key => $val) {
             $post_keyname = str_replace('.', '_', $val[1]);
             $cmd = "amh SetParam php {$val['1']} {$_POST[$post_keyname]}";
             $cmd = Functions::trim_cmd($cmd . ' noreload');
             // 只更改参数不重启
             $result = Functions::trim_result(shell_exec($cmd));
         }
         if (strpos($result, '[OK]') !== false) {
             $this->status = 'success';
             $this->notice = 'PHP配置更改成功。';
         } else {
             $this->status = 'error';
             $this->notice = 'PHP配置更改失败。';
         }
     }
     $param_list = $this->hosts->get_php_param($param_list);
     $this->param_list = $param_list;
     $this->_view('host_php_setparam');
 }
예제 #14
0
파일: module.php 프로젝트: logdns/amh-4.2
 function module_list()
 {
     $this->title = '模块扩展 - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     // 分数提交
     if (isset($_GET['fraction'])) {
         $timeout = array('http' => array('method' => "GET", 'timeout' => 8));
         $context = stream_context_create($timeout);
         echo file_get_contents("http://amysql.com/AMH.htm?module_fraction={$_GET['fraction']}&val={$_GET['val']}", false, $context);
         exit;
     }
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $page_sum = 6;
     if (isset($_GET['action']) && isset($_GET['name'])) {
         $name = $_GET['name'];
         $action = $_GET['action'];
         $action_list = array('install' => '安装', 'uninstall' => '卸载', 'delete' => '删除');
         // 安装与卸载实时进程 ************************************
         $un_install = in_array($action, array('install', 'uninstall')) ? true : false;
         if ($un_install) {
             set_time_limit(0);
             $actionName = isset($_GET['actionName']) ? $_GET['actionName'] : $action_list[$action];
             $this->module_ing_name = $name;
             $this->module_ing_actionName = $actionName;
             $this->page = $page;
             $this->_view('module_ing');
             $cmd = "amh module {$name} {$action} y";
             $cmd = Functions::trim_cmd($cmd);
             $popen_handle = popen($cmd, 'r');
             $i = 0;
             echo '<div id="show_result">';
             while (!feof($popen_handle)) {
                 $line = fgets($popen_handle);
                 echo $line . '<br />';
                 if ($i % 5 == 0) {
                     echo "<script>amh_cmd_ing();</script>\n";
                 }
                 ++$i;
             }
             $module_ing_status = json_encode(pclose($popen_handle));
             $result_status = !$module_ing_status ? true : false;
             echo "<script>amh_cmd_ing();module_ing_status = {$module_ing_status};module_end();</script>{$line}</div>";
         }
         // ***************************************************
         // 删除模块
         if ($action == 'delete') {
             $actionName = $action_list[$action];
             $result_status = $this->modules->module_delete($name);
         }
         if ($result_status) {
             $this->status = 'success';
             $this->notice = "{$name} {$actionName}成功。";
         } else {
             $this->status = 'error';
             $this->notice = "{$name} {$actionName}失败。";
         }
         $this->indexs->log_insert($this->notice);
         if ($un_install) {
             exit;
         }
     }
     $get_module_list_data = $this->modules->get_module_list_data($page, $page_sum);
     $total_page = ceil($get_module_list_data['sum'] / $page_sum);
     $page_list = Functions::page('ModuleList', $get_module_list_data['sum'], $total_page, $page, 'c=module&a=module_list');
     // 分页列表
     $this->page = $page;
     $this->total_page = $total_page;
     $this->page_list = $page_list;
     $this->module_list_data = $get_module_list_data;
     $this->_view('module_list');
 }
예제 #15
0
 function get_module_available()
 {
     // if (isset($_SESSION['module_available'])) Return;
     $cmd = 'amh ls_modules';
     $result = trim(shell_exec($cmd), "\n");
     if (empty($result)) {
         return array();
     }
     $data = array();
     $run_list = explode("\n", $result);
     foreach ($run_list as $key => $val) {
         // Module Status
         $cmd = "amh module {$val} status";
         $cmd = Functions::trim_cmd($cmd);
         exec($cmd, $tmp, $status);
         if (!$status) {
             // Module Info
             $cmd = "amh module {$val} info";
             $cmd = Functions::trim_cmd($cmd);
             $result = trim(shell_exec($cmd), "\n");
             $result = Functions::trim_result($result);
             preg_match("/AMH-ModuleAdmin:(.*)/", $result, $ModuleAdmin);
             // preg_match("/AMH-ModuleIco:(.*)/", $result, $ModuleIco);
             $ModuleID = explode('-', $val);
             $data[] = array('ModuleID' => $ModuleID[0], 'ModuleName' => $val, 'ModuleAdmin' => $ModuleAdmin[1]);
         }
     }
     $_SESSION['module_available'] = $data;
 }
예제 #16
0
파일: host.php 프로젝트: logdns/amh-4.2
 function php_setparam()
 {
     $this->title = 'PHP参数设置 - 虚拟主机 - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $param_list = array(array('设置PHP时区', 'date.timezone', 'Asia/Hong_Kong'), array('是否显示PHP错误信息', 'display_errors', 'On / Off'), array('PHP运行内存限制', 'memory_limit', '68M'), array('POST数据最大限制', 'post_max_size', '4M'), array('上传文件最大限制', 'upload_max_filesize', '2M'), array('上传文件个数限制', 'max_file_uploads', '10'), array('脚本超时时间', 'max_execution_time', '20'), array('socket超时时间', 'default_socket_timeout', '60'), array('SESSION过期时间', 'session.cache_expire', '180'), array('是否开启短标签', 'short_open_tag', 'On / Off'));
     if (isset($_POST['submit'])) {
         foreach ($param_list as $key => $val) {
             $post_keyname = str_replace('.', '_', $val[1]);
             $cmd = "amh SetParam php {$val['1']} {$_POST[$post_keyname]}";
             $cmd = Functions::trim_cmd($cmd . ' noreload');
             // 只更改参数不重启
             exec($cmd, $tmp, $status);
         }
         if (!$status) {
             $this->status = 'success';
             $this->notice = 'PHP配置更改成功。';
         } else {
             $this->status = 'error';
             $this->notice = 'PHP配置更改失败。';
         }
     }
     $param_list = $this->hosts->get_php_param($param_list);
     $this->param_list = $param_list;
     $this->indexs->log_insert($this->top_notice . $this->notice);
     $this->_view('host_php_setparam');
 }
예제 #17
0
파일: hosts.php 프로젝트: dudor/nginxpanel
 function get_php_param($param_list)
 {
     $cmd = "amh cat_php_ini";
     $cmd = Functions::trim_cmd($cmd);
     $php_ini = Functions::trim_result(shell_exec($cmd));
     foreach ($param_list as $key => $val) {
         preg_match("/{$val['1']} = (.*)/", $php_ini, $param_val);
         $param_list[$key][3] = $param_val[1];
     }
     return $param_list;
 }
예제 #18
0
파일: ftps.php 프로젝트: logdns/amh-4.2
 function ftp_chown_ssh($chown_name)
 {
     $cmd = "amh ftp chown {$chown_name} y";
     $cmd = Functions::trim_cmd($cmd);
     exec($cmd, $tmp, $status);
     return !$status;
 }
예제 #19
0
파일: ftps.php 프로젝트: dudor/nginxpanel
 function ftp_del_ssh($del_name)
 {
     $cmd = "amh ftp del {$del_name}";
     $cmd = Functions::trim_cmd($cmd);
     return Functions::trim_result(shell_exec($cmd));
 }
예제 #20
0
파일: tasks.php 프로젝트: logdns/amh-4.2
 function save_task($id)
 {
     $task = $this->get_task($id);
     if (!isset($task['crontab_id']) || $task['crontab_type'] == 'ssh') {
         return false;
     }
     $crontab_ssh = trim(Functions::trim_cmd($_POST['crontab_ssh']));
     if (substr($crontab_ssh, 0, 3) != 'amh') {
         return false;
     }
     $crontab_minute = $this->get_task_value('minute');
     $crontab_hour = $this->get_task_value('hour');
     $crontab_day = $this->get_task_value('day');
     $crontab_month = $this->get_task_value('month');
     $crontab_week = $this->get_task_value('week');
     $crontab_type = 'web';
     $crontab_md5 = md5($crontab_minute . $crontab_hour . $crontab_day . $crontab_month . $crontab_week . $crontab_ssh);
     if ($this->del_task($id)) {
         $this->_update('amh_crontab', array('crontab_minute' => $crontab_minute, 'crontab_hour' => $crontab_hour, 'crontab_day' => $crontab_day, 'crontab_month' => $crontab_month, 'crontab_week' => $crontab_week, 'crontab_ssh' => $crontab_ssh, 'crontab_type' => $crontab_type, 'crontab_md5' => $crontab_md5), " WHERE crontab_id = '{$id}' ");
         $cmd = $crontab_minute . ' ' . $crontab_hour . ' ' . $crontab_day . ' ' . $crontab_month . ' ' . $crontab_week . ' ' . $crontab_ssh;
         $cmd = str_replace('*', '\\\\*', $cmd);
         $cmd = str_replace('>', "'\\>'", $cmd);
         $cmd = "amh crontab add {$cmd}";
         $cmd = Functions::trim_cmd($cmd);
         exec($cmd, $tmp, $status);
         return !$status;
     }
     return false;
 }
예제 #21
0
파일: tasks.php 프로젝트: dudor/nginxpanel
 function save_task($id)
 {
     $task = $this->get_task($id);
     if (!isset($task['crontab_id']) || $task['crontab_type'] == 'ssh') {
         return false;
     }
     $crontab_ssh = trim($_POST['crontab_ssh']);
     if (substr($crontab_ssh, 0, 3) != 'amh') {
         return false;
     }
     $crontab_ssh = Functions::trim_cmd($crontab_ssh);
     $crontab_minute = $this->get_task_value('minute');
     $crontab_hour = $this->get_task_value('hour');
     $crontab_day = $this->get_task_value('day');
     $crontab_month = $this->get_task_value('month');
     $crontab_week = $this->get_task_value('week');
     $crontab_type = 'web';
     $crontab_md5 = md5($crontab_minute . $crontab_hour . $crontab_day . $crontab_month . $crontab_week . $crontab_ssh);
     $this->_update('amh_crontab', array('crontab_minute' => $crontab_minute, 'crontab_hour' => $crontab_hour, 'crontab_day' => $crontab_day, 'crontab_month' => $crontab_month, 'crontab_week' => $crontab_week, 'crontab_ssh' => $crontab_ssh, 'crontab_type' => $crontab_type, 'crontab_md5' => $crontab_md5), " WHERE crontab_id = '{$id}' ");
     $this->del_task(null, $task['crontab_md5']);
     $crontab_tmp = '/home/wwwroot/index/tmp/crontab.tmp';
     $cmd = "amh crontab -l > {$crontab_tmp}";
     $result = shell_exec($cmd);
     $crontab_content = file_get_contents($crontab_tmp) . $crontab_minute . ' ' . $crontab_hour . ' ' . $crontab_day . ' ' . $crontab_month . ' ' . $crontab_week . ' ' . $crontab_ssh . "\n";
     file_put_contents($crontab_tmp, $crontab_content, LOCK_EX);
     $cmd = "amh crontab {$crontab_tmp}";
     $result = shell_exec($cmd);
     return true;
 }
예제 #22
0
파일: mysql.php 프로젝트: logdns/amh-4.2
 function mysql_setparam()
 {
     $this->title = '设置参数 - MySQL - AMH';
     $this->AmysqlModelBase();
     Functions::CheckLogin();
     $param_list = array(array('设置是否开启InnoDB引擎', 'InnoDB_Engine', 'On / Off'), array('是否开启MySQL二进制日志', 'log_bin', 'On / Off'), array('MyISAM索引缓冲区大小', 'key_buffer_size', '16M'), array('客户端/服务器之间通信缓存区最大值', 'max_allowed_packet', '1M'), array('设置打开表数目最大缓存值', 'table_open_cache', '64'), array('设置每一个连接缓存一次性分配的内存', 'sort_buffer_size', '512K'), array('TCP/IP和套接字通信缓冲区大小', 'net_buffer_length', '8K'));
     if (isset($_POST['submit'])) {
         foreach ($param_list as $key => $val) {
             $post_keyname = str_replace('.', '_', $val[1]);
             $cmd = "amh SetParam mysql {$val['1']} {$_POST[$post_keyname]}";
             $cmd = Functions::trim_cmd($cmd . ' noreload');
             // 只更改参数不重启
             exec($cmd, $tmp, $status);
         }
         if (!$status) {
             $this->status = 'success';
             $this->notice = 'MySQL配置更改成功。';
         } else {
             $this->status = 'error';
             $this->notice = 'MySQL配置更改失败。';
         }
     }
     $param_list = $this->mysqls->get_mysql_param($param_list);
     $this->param_list = $param_list;
     $this->indexs->log_insert($this->top_notice . $this->notice);
     $this->_view('mysql_setparam');
 }