Skip to content

Commit

Permalink
/en/controller/Ftp.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bestony committed Mar 18, 2014
1 parent 3067619 commit 1eeb4d9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 54 deletions.
46 changes: 23 additions & 23 deletions VERSION/1.0/View/header.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo isset($title) ? $title : 'AMH';?></title>
<base href="<?php echo _Http;?>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn">
<link type="text/css" rel="stylesheet" href="View/css/index.css" />
<script src="View/js/index.js"></script>
</head>
<body>
<div id="header">
<a href="index.php" class="logo"></a>
<div id="navigation">
<font>Hi,<?php echo $_SESSION['amh_user_name'];?></font>
<a href="index.php">Home</a>
<a href="index.php?c=index&a=host">Host</a>
<a href="index.php?c=index&a=mysql">MySQL</a>
<a href="index.php?c=index&a=ftp">FTP</a>
<a href="index.php?c=index&a=account">Account</a>
<a href="index.php?c=index&a=logout">Logout</a>
</div>
</div>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo isset($title) ? $title : 'AMH';?></title>
<base href="<?php echo _Http;?>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn">
<link type="text/css" rel="stylesheet" href="View/css/index.css" />
<script src="View/js/index.js"></script>
</head>
<body>
<div id="header">
<a href="index.php" class="logo"></a>
<div id="navigation">
<font>Hi,<?php echo $_SESSION['amh_user_name'];?></font>
<a href="index.php">Home</a>
<a href="index.php?c=index&a=host">Host</a>
<a href="index.php?c=index&a=mysql">MySQL</a>
<a href="index.php?c=index&a=ftp">FTP</a>
<a href="index.php?c=index&a=account">Account</a>
<a href="index.php?c=index&a=logout">Logout</a>
</div>
</div>
46 changes: 23 additions & 23 deletions en/Controller/ftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/************************************************
* Amysql Host - AMH 4.2
* Amysql.com
* @param Object ftp FTP管理控制器
* @param Object ftp FTP Controller
* Update:2013-11-01
*
*/
Expand All @@ -15,7 +15,7 @@ class ftp extends AmysqlController
public $notice = null;
public $top_notice = null;

// 载入数据模型(Model)
// Load Data Model
function AmysqlModelBase()
{
if($this -> indexs) return;
Expand All @@ -24,13 +24,13 @@ function AmysqlModelBase()
$this -> ftps = $this -> _model('ftps');
}

// 默认访问
// Default Action
function IndexAction()
{
$this -> ftp_list();
}

// FTP账号列表
// FTP UserList
function ftp_list()
{
$this -> title = 'FTP - AMH';
Expand All @@ -39,7 +39,7 @@ function ftp_list()

$this -> status = 'error';

// 删除ftp
// Del FTP Account
if (isset($_GET['del']))
{
$del_name = $_GET['del'];
Expand All @@ -52,17 +52,17 @@ function ftp_list()
if ($result[0])
{
$this -> status = 'success';
$this -> top_notice = $del_name . ' : 删除FTP账号成功。';
$this -> top_notice = $del_name . ' : Delete FTP Account Success!';
}
else
$this -> top_notice = $del_name . ' : 删除FTP账号失败。' . implode(',', $result[1]);
$this -> top_notice = $del_name . ' : Delete FTP Account Failed.' . implode(',', $result[1]);
}
else
$this -> top_notice = $del_name . ' : ssh FTP账号web端不可删除。';
$this -> top_notice = $del_name . ' : ssh FTP Account Could Not delete In Web Panel';
}
}

// 重写目录权限
// rewrite Auth
if (isset($_GET['chown']))
{
$chown_name = $_GET['chown'];
Expand All @@ -75,21 +75,21 @@ function ftp_list()
if ($this -> ftps -> ftp_chown_ssh($chown_name))
{
$this -> status = 'success';
$this -> top_notice = $chown_name . ' : 重写目录权限' . $uidname . '成功。';
$this -> top_notice = $chown_name . ' : ReWrite Auth' . $uidname . 'Success!';
}
else
$this -> top_notice = $chown_name . ' : 重写目录权限' . $uidname . '失败。';
$this -> top_notice = $chown_name . ' : ReWrite Auth' . $uidname . 'Failed.';
}
else
$this -> top_notice = $chown_name . ' : ssh FTP账号web端不可重写目录权限。';
$this -> top_notice = $chown_name . ' : ssh FTP Account Could Not ReWrite Auth In WebPanel';
}
}

// 保存ftp
// Save ftp Account
if (isset($_POST['save']))
{
if (empty($_POST['ftp_name']) || empty($_POST['ftp_password']) || empty($_POST['ftp_root']) || empty($_POST['ftp_uid_name']))
$this -> notice = '账号密码与根目录与权限用户不能为空。';
$this -> notice = 'Username,Password,Auth Group Could not Empty.';
else
{
$_POST['ftp_name'] = substr($_POST['ftp_name'], 0, 20);
Expand All @@ -98,15 +98,15 @@ function ftp_list()
{
$this -> ftps -> ftp_insert($_POST);
$this -> status = 'success';
$this -> notice = $_POST['ftp_name'] . ' : 新增FTP账号成功。';
$this -> notice = $_POST['ftp_name'] . ' : Add FTP Account Success!';
$_POST = array();
}
else
$this -> notice = $_POST['ftp_name'] . ' : 新增FTP账号失败。' . implode(',', $result[1]);
$this -> notice = $_POST['ftp_name'] . ' : Add Account Failed.' . implode(',', $result[1]);
}
}

// 编辑ftp
// Edit Account
if (isset($_GET['edit']))
{
$edit_name = $_GET['edit'];
Expand All @@ -121,12 +121,12 @@ function ftp_list()
}
else
{
$this -> top_notice = $edit_name . ' : ssh FTP账号web端不可编辑。';
$this -> top_notice = $edit_name . ' : ssh FTP Account Could Not Edit On Web Panel.';
$_POST = array();
}
}

// 保存编辑ftp
// Save Edit ftp
if (isset($_POST['save_edit']))
{
$_POST['ftp_name'] = $ftp_name = $_POST['save_edit'];
Expand All @@ -138,25 +138,25 @@ function ftp_list()
if ($result[0])
{
$status = true;
$top_notice = $ftp_name . ' : 编辑FTP账号成功。';
$top_notice = $ftp_name . ' : Edit FTP Account Success!';
}
else
{
$this -> status = 'error';
$top_notice = $ftp_name . ' : 编辑FTP账号失败。' . $result[0];
$top_notice = $ftp_name . ' : Edit FTP Account Failed.' . $result[0];
}

if (!empty($_POST['ftp_password']))
{
if ($result[1])
{
$status = true;
$top_notice .= $ftp_name . ' : 更改FTP密码成功。';
$top_notice .= $ftp_name . ' : Change FTP Password Success!';
}
else
{
$this -> status = 'error';
$top_notice .= $ftp_name . ' 更改FTP密码失败。' . $result[1];
$top_notice .= $ftp_name . ' Change FTP Password failed.' . $result[1];
}
}
if(isset($status))
Expand Down
16 changes: 8 additions & 8 deletions en/Controller/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/************************************************
* Amysql Host - AMH 4.2
* Amysql.com
* @param Object index 面板前台&主页控制器
* @param Object index Controller
* Update:2013-11-01
*
*/
Expand All @@ -12,11 +12,11 @@ class index extends AmysqlController
{
public $indexs = null;
public $configs = null;
public $action_name = array('start' => '启动' , 'stop' => '停止' , 'reload' => '重载', 'restart' => '重启');
public $action_name = array('start' => 'Start' , 'stop' => 'Stop' , 'reload' => 'ReLoad', 'restart' => 'ReStart');
public $notice = null;
public $top_notice = null;

// 载入数据模型(Model)
// Load Data Model
function AmysqlModelBase()
{
if($this -> indexs) return;
Expand All @@ -26,31 +26,31 @@ function AmysqlModelBase()
}


// 面板登录
// Panel Login
function login()
{
$this -> title = '登录 - AMH';
$this -> title = 'Login - AMH';
$this -> AmysqlModelBase();
$amh_config = $this -> configs -> get_amh_config();

if (isset($_POST['login']))
{
$login_allow = $this -> indexs -> login_allow($amh_config);

// 允许登录
// Login Permitted
if($login_allow['status'])
{
$user = $_POST['user'];
$password = $_POST['password'];
$VerifyCode = $_POST['VerifyCode'];
if ($amh_config['VerifyCode']['config_value'] == 'on' && strtolower($VerifyCode) != $_SESSION['VerifyCode'])
{
$this -> LoginError = '验证码错误,请重新输入。';
$this -> LoginError = 'VerifyCode Not Matched.Please Retype';
}
else
{
if(empty($user) || empty($password))
$this -> LoginError = '请输入用户名与密码。';
$this -> LoginError = 'Please Input Username & Password';
else
{
$user_id = $this -> indexs -> logins($user, $password);
Expand Down

0 comments on commit 1eeb4d9

Please sign in to comment.