diff --git a/src/about.php b/src/about.php old mode 100644 new mode 100755 index c4dd59c..6335b36 --- a/src/about.php +++ b/src/about.php @@ -1,10 +1,8 @@ $val) { -// $key = strtoupper($key); -// if (strpos($key, $session_name)) { -// session_id($_COOKIE[$key]); -// } -// } -// } - -$section = isAdminLoggedIn() ? (empty($_GET["s"]) ? "main" : $_GET["s"]) : "login"; -$section_page = "{$ROOT}/admin/views/{$section}.php"; -if (!is_file($section_page)) { - header("HTTP/1.1 404 Not Found"); - exit('Page Not Found!'); -} - -$message = []; - -$dbpdo = DBPDO::getInstance($dbconfig); - -$controller = "{$ROOT}/admin/controllers/{$section}.php"; -if (is_file($controller)) { - include_once $controller; -} - -include("{$ROOT}/admin/views/header.php"); -include("{$ROOT}/admin/views/navbar.php"); -include($section_page); -include("{$ROOT}/admin/views/footer.php"); diff --git a/src/admin/accounts.php b/src/admin/accounts.php new file mode 100755 index 0000000..55f7ae0 --- /dev/null +++ b/src/admin/accounts.php @@ -0,0 +1,16 @@ + setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The username is invalid (8 characters maximum)."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters.."]; - } else { - $client = Api::init($config); - $client->unsuspend(["username" => setProtect(strtolower($tsData["username"]))]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/account_add.php b/src/admin/controllers/account_add.php deleted file mode 100644 index 532a059..0000000 --- a/src/admin/controllers/account_add.php +++ /dev/null @@ -1,52 +0,0 @@ - setProtect(strtolower($_POST["username"])), - "password" => setProtect($_POST["password"]), - "domain" => setProtect(strtolower($_POST["domain"])), - "email" => setProtect(strtolower($_POST["email"])), - "plan" => setProtect($_POST["plan"]), - ]; - - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The Username is required"]; - } elseif (strlen($tsData["username"]) < 8 || strlen($tsData["username"]) > 12) { - $message = [0, "The username must be 8 characters."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) { - $message = [0, "Enter a minimum password of 6 to 35 characters."]; - } elseif (strlen($tsData["domain"]) < 4) { - $message = [0, "Enter a domain name or sub-domain."]; - } elseif (strlen($tsData["domain"]) > 35) { - $message = [0, "The domain can not exceed 35 characters."]; - } elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) { - $message = [0, "The domain does not have a valid extension. Check it."]; - } elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) { - // To not allow domains.tk - $message = [0, "Domain extension is not allowed on this server."]; - } elseif (!mb_ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $tsData["email"])) { - $message = [0, "The email does not have a valid format, check it."]; - } elseif (strlen($tsData["email"]) > 35) { - $message = [0, "The email can not exceed 35 characters."]; - } elseif (empty($tsData["plan"])) { - $message = [0, "You must select a hosting plan."]; - } else { - $client = Api::init($config); - $client->createAccount([ - "username" => $tsData["username"], // A unique, 8 character identifier of the account. - "password" => $tsData["password"], // A password to login to the control panel, FTP MySQL and cPanel. - "domain" => $tsData["domain"], // Can be a subdomain or a custom domain. - "email" => $tsData["email"], // The email address of the user. - "plan" => $tsData["plan"], // A hosting plan for the account. - ]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/account_disable.php b/src/admin/controllers/account_disable.php deleted file mode 100644 index 53067fc..0000000 --- a/src/admin/controllers/account_disable.php +++ /dev/null @@ -1,30 +0,0 @@ - setProtect(strtolower($_POST["username"])), - "reason" => setProtect($_POST["reason"]), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The Username must be 8 characters"]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The Username does not allow strange characters"]; - } elseif (strlen($tsData["reason"]) < 10 || strlen($tsData["reason"]) > 60) { - $message = [0, "You must enter a reason with a maximum of 60 characters"]; - } else { - $client = Api::init($config); - $client->suspend([ - "username" => setProtect(strtolower($tsData["username"])), - "reason" => setProtect($tsData["reason"]), - ]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/account_domain.php b/src/admin/controllers/account_domain.php deleted file mode 100644 index 2c686bd..0000000 --- a/src/admin/controllers/account_domain.php +++ /dev/null @@ -1,24 +0,0 @@ - setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) { - $message = [0, "Enter a username that is valid."]; - } elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } else { - $client = Api::init($config); - $client->getUserDomains(["username" => $tsData["username"]]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/account_list.php b/src/admin/controllers/account_list.php deleted file mode 100644 index fe9ab3e..0000000 --- a/src/admin/controllers/account_list.php +++ /dev/null @@ -1,23 +0,0 @@ - "uiisc", - "account" => "testapi", - "username" => "uii_12345678", - "email" => "usitetest@uiisc.com", - "plan" => "test_whm_api", - "domain" => ["test1.uiisc.com", "testapi.uiisc.com"], - "password" => "abcAbc123", - "nameserver" => [ - "ns1.byet.org", - "ns2.byet.org" - ] - ] -]; diff --git a/src/admin/controllers/account_password.php b/src/admin/controllers/account_password.php deleted file mode 100644 index e58b531..0000000 --- a/src/admin/controllers/account_password.php +++ /dev/null @@ -1,31 +0,0 @@ - setProtect(strtolower($_POST["username"])), - "password" => setProtect($_POST["password"]), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required"]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The username must be 8 characters."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) { - $message = [0, "Enter a minimum password of 6 to 35 characters."]; - } else { - $client = Api::init($config); - $client->password([ - "username" => $tsData["username"], - "password" => $tsData["password"], - "enabledigest" => 1, // [enabledigest] Change the password in cPanel - FTP - MySQL - ]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/account_status.php b/src/admin/controllers/account_status.php deleted file mode 100644 index a432ba3..0000000 --- a/src/admin/controllers/account_status.php +++ /dev/null @@ -1,47 +0,0 @@ - setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) { - $message = [0, "Enter a username that is valid."]; - } elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } else { - $client = Api::init($config); - $client->getUserDomains(["username" => $tsData["username"]]); - - // if ($this->data != "null" && strpos($this->response, '[[') === 0) { - // $statuses = array_unique(array_map(function ($item) { - // return strtolower($item["status"]); - // }, $this->domain)); - // // print_r($statuses); - // if (count($statuses) == 1) { - // return $statuses[0]; - // } elseif (count($statuses) > 1) { - // return "The account domains have different statuses " . $this->getUserName() . "." . $this->data; - // } else { - // return null; - // } - // } else { - // return null; - // } - if ($client->getStatus() === "active") { - $message = [1, "The account " . $tsData["username"] . " is Actived"]; - } elseif ($client->getStatus() === "suspend") { - $message = [1, "The account " . $tsData["username"] . " is Suspend"]; - } else { - "Cannot find the specified associated account"; - $message = [0, "The account " . $tsData["username"] . " does not have associated accounts."]; - } - } -} diff --git a/src/admin/controllers/accounts/deactivate.php b/src/admin/controllers/accounts/deactivate.php new file mode 100755 index 0000000..0b39195 --- /dev/null +++ b/src/admin/controllers/accounts/deactivate.php @@ -0,0 +1,84 @@ + 'edit', 'account_id' => $account_id)); +} + +$AccountInfo = $DB->find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($AccountInfo)) { + setMessage('Account not found', 'danger'); + redirect('admin/accounts'); +} + +// if ($AccountInfo['account_status'] != 1) { +// setMessage('Hosting Account is deactivated', 'danger'); +// redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id)); +// } + +require_once ROOT . '/core/handler/HostingHandler.php'; +require_once ROOT . '/modules/autoload.php'; + +use \InfinityFree\MofhClient\Client; + +$client = Client::create($HostingApiConfig); +$request = $client->suspend(array( + 'username' => $AccountInfo['account_key'], + 'reason' => $reason, +)); + +$response = $request->send(); +$Data = $response->getData(); +$Result = array( + 'status' => $Data['result']['status'], + 'message' => $Data['result']['statusmsg'], +); + +if ($Result['status'] == 0 && !is_array($Result['message'])) { + // 执行操作失败 + setMessage($Result['message'], 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); +} elseif ($Result['status'] == 1 && is_array($Result['message'])) { + // 执行操作成功 + $sql = $DB->update('account', array('account_status' => '0'), array('account_id' => $account_id)); + if ($sql) { + // 本地同步成功 + $ClientInfo = $DB->find('clients', 'hosting_client_email, hosting_client_fname', array('hosting_client_id' => $AccountInfo['account_client_id']), null, 1); + $EmailContent = '
We had a good time with you while you were with us.
'; + $EmailDescription = 'Your account(# ' . $account_id . ') have been deactivate successfully and all files and database will be deleted within 30 days.'; + $email_body = email_build_body('Hosting Account Deactivated', $ClientInfo['hosting_client_fname'], $EmailContent, $EmailDescription); + + send_mail(array( + 'to' => $ClientInfo['hosting_client_email'], + 'message' => $email_body, + 'subject' => 'Hosting Account Deactivated' + )); + + setMessage('Hosting Account deactivated successfully !', 'success'); + redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id)); + } else { + // 本地同步异常 + setMessage('Something went' . "'" . 's wrong !', 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); + } +} elseif ($Result['status'] == 0 && $Result['message'] == 0) { + // 执行操作异常 + setMessage('Something went' . "'" . 's wrong !', 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); +} diff --git a/src/admin/controllers/accounts/edit.php b/src/admin/controllers/accounts/edit.php new file mode 100755 index 0000000..424afda --- /dev/null +++ b/src/admin/controllers/accounts/edit.php @@ -0,0 +1,9 @@ +find('account', '*', array('account_id' => $account_id), null, 1); +$ClientInfo = $DB->find('clients', '*', array('hosting_client_id' => $AccountInfo['account_client_id']), null, 1); + +$PageInfo['title'] = 'Edit Account #' . $account_id; diff --git a/src/admin/controllers/accounts/goftp.php b/src/admin/controllers/accounts/goftp.php new file mode 100755 index 0000000..00997c5 --- /dev/null +++ b/src/admin/controllers/accounts/goftp.php @@ -0,0 +1,20 @@ +find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($data)) { + redirect('admin/accounts'); +} + +require_once ROOT . '/core/handler/HostingHandler.php'; + +$filemanager_url = get_filemanager_url($HostingApi['api_cpanel_url'], $data['account_username'], $data['account_password']); +header("Location: " . $filemanager_url); diff --git a/src/admin/controllers/accounts/list.php b/src/admin/controllers/accounts/list.php new file mode 100755 index 0000000..e998263 --- /dev/null +++ b/src/admin/controllers/accounts/list.php @@ -0,0 +1,9 @@ +I18N('Hosting Accounts'); + +$count = $DB->count('account', "`account_status`!=0 OR `account_status`!=2"); + +if ($count > 0) { + $rows = $DB->findAll('account', '*', "`account_status`!=0 OR `account_status`!=2", "`account_id` DESC"); +} diff --git a/src/admin/controllers/accounts/login.php b/src/admin/controllers/accounts/login.php new file mode 100755 index 0000000..aa075c6 --- /dev/null +++ b/src/admin/controllers/accounts/login.php @@ -0,0 +1,17 @@ +find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($AccountInfo)) { + redirect('admin/accounts'); +} + +require_once ROOT . '/core/handler/HostingHandler.php'; diff --git a/src/admin/controllers/accounts/password.php b/src/admin/controllers/accounts/password.php new file mode 100755 index 0000000..829a9d4 --- /dev/null +++ b/src/admin/controllers/accounts/password.php @@ -0,0 +1,68 @@ + 'edit', 'account_id' => $account_id)); +} + +$AccountInfo = $DB->find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($AccountInfo)) { + setMessage('Account not found', 'danger'); + redirect('admin/accounts'); +} + +if ($AccountInfo['account_status'] != 1) { + setMessage('Hosting Account is deactivated', 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); +} + +require_once ROOT . '/core/handler/HostingHandler.php'; +require_once ROOT . '/modules/autoload.php'; + +use \InfinityFree\MofhClient\Client; + +$client = Client::create($HostingApiConfig); +$request = $client->password([ + 'username' => $AccountInfo['account_key'], + 'password' => $new_password, + 'enabledigest' => 1, +]); +$response = $request->send(); +$Data = $response->getData(); +$Result = array( + 'status' => $Data['passwd']['status'], + 'message' => $Data['passwd']['statusmsg'] +); + +if ($Result['status'] == 0 && strlen($Result['message']) > 1) { + setMessage($Result['message'], 'danger'); +} elseif ($Result['status'] == 1 && strlen($Result['message']) > 1) { + $sql = $DB->update('account', array('account_password' => $new_password), array('account_id' => $account_id)); + if ($sql) { + setMessage('Password changed successfully !', 'success'); + } else { + setMessage("1Something went's wrong !", 'danger'); + } +} elseif ($Result['status'] == 0 && $Result['message'] == 0) { + setMessage("2Something went's wrong !", 'danger'); +} else { + setMessage("3Something went's wrong !", 'danger'); +} + +redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); diff --git a/src/admin/controllers/accounts/reactivate.php b/src/admin/controllers/accounts/reactivate.php new file mode 100755 index 0000000..46eb4ce --- /dev/null +++ b/src/admin/controllers/accounts/reactivate.php @@ -0,0 +1,76 @@ +find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($AccountInfo)) { + setMessage('Account not found', 'danger'); + redirect('admin/accounts'); +} + +if ($AccountInfo['account_status'] == 1) { + setMessage('Hosting Account is active', 'danger'); + redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id)); +} + +require_once ROOT . '/core/handler/HostingHandler.php'; +require_once ROOT . '/modules/autoload.php'; + +use \InfinityFree\MofhClient\Client; + +$client = Client::create($HostingApiConfig); +$request = $client->unsuspend(array( + 'username' => $AccountInfo['account_key'], +)); + +$response = $request->send(); +$Data = $response->getData(); +$Result = array( + 'status' => $Data['result']['status'], + 'message' => $Data['result']['statusmsg'], +); + +if ($Result['status'] == 0 && !is_array($Result['message'])) { + // 执行操作失败 + setMessage($Result['message'], 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); +} elseif ($Result['status'] == 1 && is_array($Result['message'])) { + // 执行操作成功 + $sql = $DB->update('account', array('account_status' => '1'), array('account_id' => $account_id)); + if ($sql) { + // 本地同步成功 + $ClientInfo = $DB->find('clients', 'hosting_client_email, hosting_client_fname', array('hosting_client_id' => $AccountInfo['account_client_id']), null, 1); + $EmailContent = 'Your account(# ' . $account_id . ') have been activated successfully.'; + $EmailDescription = ''; + $email_body = email_build_body('Hosting Account Activated', $ClientInfo['hosting_client_fname'], $EmailContent, $EmailDescription); + + send_mail(array( + "to" => $ClientInfo['hosting_client_email'], + "message" => $email_body, + "subject" => 'Activate Hosting Account', + )); + + setMessage('Hosting Account activated successfully !', 'success'); + redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id)); + } else { + // 本地同步异常 + setMessage('Something went' . "'" . 's wrong !', 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); + } +} elseif ($Result['status'] == 0 && $Result['message'] == 0) { + // 执行操作异常 + setMessage('Something went' . "'" . 's wrong !', 'danger'); + redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id)); +} diff --git a/src/admin/controllers/accounts/view.php b/src/admin/controllers/accounts/view.php new file mode 100755 index 0000000..9158d4d --- /dev/null +++ b/src/admin/controllers/accounts/view.php @@ -0,0 +1,22 @@ +find('account', '*', array('account_id' => $account_id), null, 1); + +if (empty($AccountInfo)) { + setMessage('not found', 'danger'); + redirect('admin/accounts'); +} diff --git a/src/admin/controllers/admin.php b/src/admin/controllers/admin.php deleted file mode 100644 index 9ed0975..0000000 --- a/src/admin/controllers/admin.php +++ /dev/null @@ -1,255 +0,0 @@ - setProtect(strtolower($_POST["domain"])), - ); - if (!isset($tsData["domain"]) || empty($tsData["domain"])) { - $message = [0, "The domain is required."]; - } elseif (strlen($tsData["domain"]) < 4) { - $message = [0, "Enter a domain name or sub-domain."]; - } elseif (strlen($tsData["domain"]) > 50) { - $message = [0, "The domain can not exceed 50 characters."]; - } elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) { - $message = [0, "The domain does not have a valid extension. Check it."]; - } elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) { - // To not allow domains.tk - $message = [0, "The domain extension is not allowed on this server."]; - } else { - $client = Api::init($config); - $client->availability(["domain" => $tsData["domain"]]); - $message = $client->message; - } - } - break; - case "account_add": - $section_title = "Account Add"; - if (isset($_POST["do_reg_account"])) { - $tsData = [ - "username" => setProtect(strtolower($_POST["username"])), - "password" => setProtect($_POST["password"]), - "domain" => setProtect(strtolower($_POST["domain"])), - "email" => setProtect(strtolower($_POST["email"])), - "plan" => setProtect($_POST["plan"]), - ]; - - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The Username is required"]; - } elseif (strlen($tsData["username"]) < 8 || strlen($tsData["username"]) > 12) { - $message = [0, "The username must be 8 characters."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) { - $message = [0, "Enter a minimum password of 6 to 35 characters."]; - } elseif (strlen($tsData["domain"]) < 4) { - $message = [0, "Enter a domain name or sub-domain."]; - } elseif (strlen($tsData["domain"]) > 35) { - $message = [0, "The domain can not exceed 35 characters."]; - } elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) { - $message = [0, "The domain does not have a valid extension. Check it."]; - } elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) { - // To not allow domains.tk - $message = [0, "Domain extension is not allowed on this server."]; - } elseif (!mb_ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $tsData["email"])) { - $message = [0, "The email does not have a valid format, check it."]; - } elseif (strlen($tsData["email"]) > 35) { - $message = [0, "The email can not exceed 35 characters."]; - } elseif (empty($tsData["plan"])) { - $message = [0, "You must select a hosting plan."]; - } else { - $client = Api::init($config); - $client->createAccount([ - "username" => $tsData["username"], // A unique, 8 character identifier of the account. - "password" => $tsData["password"], // A password to login to the control panel, FTP MySQL and cPanel. - "domain" => $tsData["domain"], // Can be a subdomain or a custom domain. - "email" => $tsData["email"], // The email address of the user. - "plan" => $tsData["plan"], // A hosting plan for the account. - ]); - $message = $client->message; - } - } - break; - case "account_password": - $section_title = "Account Password"; - if (isset($_POST["do_set_password"])) { - $tsData = array( - "username" => setProtect(strtolower($_POST["username"])), - "password" => setProtect($_POST["password"]), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required"]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The username must be 8 characters."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } elseif (strlen($tsData["password"]) < 6 || strlen($tsData["password"]) > 35) { - $message = [0, "Enter a minimum password of 6 to 35 characters."]; - } else { - $client = Api::init($config); - $client->password([ - "username" => $tsData["username"], - "password" => $tsData["password"], - "enabledigest" => 1, // [enabledigest] Change the password in cPanel - FTP - MySQL - ]); - $message = $client->message; - } - } - break; - case "account_disable": - $section_title = "Account Suspend"; - if (isset($_POST["do_disable_account"])) { - $tsData = array( - "username" => setProtect(strtolower($_POST["username"])), - "reason" => setProtect($_POST["reason"]), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The Username must be 8 characters"]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The Username does not allow strange characters"]; - } elseif (strlen($tsData["reason"]) < 10 || strlen($tsData["reason"]) > 60) { - $message = [0, "You must enter a reason with a maximum of 60 characters"]; - } else { - $client = Api::init($config); - $client->suspend([ - "username" => setProtect(strtolower($tsData["username"])), - "reason" => setProtect($tsData["reason"]), - ]); - $message = $client->message; - } - } - break; - case "account_active": - $section_title = "Account Activate"; - if (isset($_POST["do_activate_account"])) { - $tsData = array( - "username" => setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 8) { - $message = [0, "The username is invalid (8 characters maximum)."]; - } elseif (!preg_match("/^[a-zA-Z0-9]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters.."]; - } else { - $client = Api::init($config); - $client->unsuspend(["username" => setProtect(strtolower($tsData["username"]))]); - $message = $client->message; - } - } - break; - case "account_status": - $section_title = "Account Status"; - if (isset($_POST["do_check_status"])) { - $tsData = array( - "username" => setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) { - $message = [0, "Enter a username that is valid."]; - } elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } else { - $client = Api::init($config); - $client->getUserDomains(["username" => $tsData["username"]]); - - // if ($this->data != "null" && strpos($this->response, '[[') === 0) { - // $statuses = array_unique(array_map(function ($item) { - // return strtolower($item["status"]); - // }, $this->domain)); - // // print_r($statuses); - // if (count($statuses) == 1) { - // return $statuses[0]; - // } elseif (count($statuses) > 1) { - // return "The account domains have different statuses " . $this->getUserName() . "." . $this->data; - // } else { - // return null; - // } - // } else { - // return null; - // } - if ($client->getStatus() === "active") { - $message = [1, "The account " . $tsData["username"] . " is Actived"]; - } elseif ($client->getStatus() === "suspend") { - $message = [1, "The account " . $tsData["username"] . " is Suspend"]; - } else { - "Cannot find the specified associated account"; - $message = [0, "The account " . $tsData["username"] . " does not have associated accounts."]; - } - } - } - break; - case "account_domain": - $section_title = "Account Domains"; - if (isset($_POST["do_get_domains"])) { - $tsData = array( - "username" => setProtect(strtolower($_POST["username"])), - ); - if (!isset($tsData["username"]) || empty($tsData["username"])) { - $message = [0, "The username is required."]; - } elseif (strlen($tsData["username"]) < 4 || strlen($tsData["username"]) > 18) { - $message = [0, "Enter a username that is valid."]; - } elseif (!preg_match("/^[a-zA-Z0-9-_]{4,16}$/", $tsData["username"])) { - $message = [0, "The username does not allow strange characters."]; - } else { - $client = Api::init($config); - $client->getUserDomains(["username" => $tsData["username"]]); - $message = $client->message; - } - } - break; - case "account_list": - $section_title = "Account List"; - include_once $ROOT . "/data/member.php"; - break; - case "login": - $section_title = "Admin Login"; - if (isset($_POST["do_login"])) { - $username = setProtect(strtolower(trim($_POST["username"]))); - $password = setProtect(strtolower(trim($_POST["password"]))); - $captcha = setProtect(strtolower($_POST["captcha"])); - if (!isset($username) || empty($username)) { - $message = [0, "The username is required."]; - } elseif (!isset($password) || empty($password)) { - $message = [0, "The password is required."]; - } elseif (!isset($captcha) || empty($captcha)) { - $message = [0, "The captcha code is required."]; - } else { - if (!isset($_SESSION["admincaptchacode"]) || $captcha != strtolower($_SESSION["admincaptchacode"])) { - $message = [0, "The captcha code is invalid."]; - } elseif ($username == $admin["username"] && $password == $admin["password"]) { - $_SESSION["is_login"] = true; - $is_admin = true; - $message = [1, "Login successfully. 2 seconds later redirect to the main page"]; - header("refresh:2;url=admin.php"); - } else { - $is_admin = false; - $message = [0, "Login failed.Please check if the account or password is correct."]; - } - } - } - break; - case "logout": - $section_title = "Admin Logout"; - unset($_SESSION); - session_destroy(); - $message = [1, "Logout successfully. 2 seconds later redirect to the login page"]; - header("refresh:2;url=admin.php"); - break; - default: - $section_title = "Main"; -} diff --git a/src/admin/controllers/check_domain.php b/src/admin/controllers/check_domain.php deleted file mode 100644 index a777c21..0000000 --- a/src/admin/controllers/check_domain.php +++ /dev/null @@ -1,29 +0,0 @@ - setProtect(strtolower($_POST["domain"])), - ); - if (!isset($tsData["domain"]) || empty($tsData["domain"])) { - $message = [0, "The domain is required."]; - } elseif (strlen($tsData["domain"]) < 4) { - $message = [0, "Enter a domain name or sub-domain."]; - } elseif (strlen($tsData["domain"]) > 50) { - $message = [0, "The domain can not exceed 50 characters."]; - } elseif (!mb_ereg("^([a-zA-Z0-9]+).([a-zA-Z0-9-]+).([a-zA-Z]{2,4})$", $tsData["domain"])) { - $message = [0, "The domain does not have a valid extension. Check it."]; - } elseif (preg_match("/(^.*)\.(tk)$/i", $tsData["domain"])) { - // To not allow domains.tk - $message = [0, "The domain extension is not allowed on this server."]; - } else { - $client = Api::init($config); - $client->availability(["domain" => $tsData["domain"]]); - $message = $client->message; - } -} diff --git a/src/admin/controllers/clients/activate.php b/src/admin/controllers/clients/activate.php new file mode 100755 index 0000000..2a55edd --- /dev/null +++ b/src/admin/controllers/clients/activate.php @@ -0,0 +1,19 @@ +update('clients', array('hosting_client_status' => 1), array('hosting_client_id' => $client_id)); + +if ($resault) { + setMessage('Client activated successfully !'); +} else { + setMessage("Something went's wrong !", 'danger'); +} + +redirect('admin/clients', '', array('action' => 'view', 'client_id' => $client_id)); diff --git a/src/admin/controllers/clients/list.php b/src/admin/controllers/clients/list.php new file mode 100755 index 0000000..a3a2071 --- /dev/null +++ b/src/admin/controllers/clients/list.php @@ -0,0 +1,9 @@ +count('clients'); + +if ($count > 0) { + $rows = $DB->findAll('clients'); +} diff --git a/src/admin/controllers/clients/login.php b/src/admin/controllers/clients/login.php new file mode 100755 index 0000000..ef71597 --- /dev/null +++ b/src/admin/controllers/clients/login.php @@ -0,0 +1,22 @@ +find('clients', '*', array('hosting_client_id' => $client_id), null, 1); + +$key = rand(000000, 999999); +$email = $ClientInfo['hosting_client_email']; +$token = hash('sha256', json_encode([$email, $ClientInfo['hosting_client_key'], $key])); +$times = 1; + +setcookie('UIISC_MEMBER', base64_encode(gzcompress(json_encode(array('email' => $email, 'token' => $token, 'key' => $key)))), time() + $times * 86400, '/'); + +setMessage('Logged in as ' . $email . ' successfully!', 'success'); + +redirect('clientarea/index'); diff --git a/src/admin/controllers/clients/suspend.php b/src/admin/controllers/clients/suspend.php new file mode 100755 index 0000000..9cd7d96 --- /dev/null +++ b/src/admin/controllers/clients/suspend.php @@ -0,0 +1,19 @@ +update('clients', array('hosting_client_status' => 2), array('hosting_client_id' => $client_id)); + +if ($resault) { + setMessage('Client suspended successfully !'); +} else { + setMessage("Something went's wrong !", 'danger'); +} + +redirect('admin/clients', '', array('action' => 'view', 'client_id' => $client_id)); diff --git a/src/admin/controllers/clients/view.php b/src/admin/controllers/clients/view.php new file mode 100755 index 0000000..2c3dde4 --- /dev/null +++ b/src/admin/controllers/clients/view.php @@ -0,0 +1,29 @@ +find('clients', '*', array('hosting_client_id' => $client_id), null, 1); + +$CountryName = 'Not Defined'; + +foreach ($countries as $country) { + if ($ClientInfo['hosting_client_country'] == $country['code']) { + $CountryName = $country['name']; + break; + } +} + +$count_account = $DB->count('account', array('account_client_id' => $ClientInfo['hosting_client_id'])); +$count_ssl = $DB->count('ssl', array('ssl_for' => $ClientInfo['hosting_client_id'])); +$count_tickets = $DB->count('tickets', array('ticket_for' => $ClientInfo['hosting_client_id'])); diff --git a/src/admin/controllers/dashboard/view.php b/src/admin/controllers/dashboard/view.php new file mode 100755 index 0000000..5e61f92 --- /dev/null +++ b/src/admin/controllers/dashboard/view.php @@ -0,0 +1,7 @@ +count('clients', null); +$count_account = $DB->count('account', array('account_status' => 1)); +$count_ssl = $DB->count('ssl'); +$count_tickets = $DB->count('tickets', "`ticket_status`=0 OR `ticket_status`=2"); diff --git a/src/admin/controllers/domain/add.php b/src/admin/controllers/domain/add.php new file mode 100755 index 0000000..bf25f67 --- /dev/null +++ b/src/admin/controllers/domain/add.php @@ -0,0 +1,37 @@ + $domain, +); + +$has = $DB->count('domain_extensions', $data); +if ($has && $has > 0) { + setMessage('Extension aleady exsist!', 'danger'); +} else { + $resault = $DB->insert('domain_extensions', $data); + if ($resault) { + setMessage('Extension added successfully!'); + } else { + setMessage('Something went' . "'" . 's wrong!', 'danger'); + } +} + +redirect('admin/settings', 'domain'); diff --git a/src/admin/controllers/domain/delete.php b/src/admin/controllers/domain/delete.php new file mode 100755 index 0000000..6b4065b --- /dev/null +++ b/src/admin/controllers/domain/delete.php @@ -0,0 +1,38 @@ + $extension, +); + +$count = $DB->count('domain_extensions', $data); + +if (!$count > 0) { + setMessage('Extension won' . "'" . 't exsist!', 'danger'); +} else { + $result = $DB->delete('domain_extensions', $data); + if ($result) { + setMessage('Extension deleted successfully!'); + } else { + setMessage('Something went' . "'" . 's wrong!', 'danger'); + } +} + +redirect('admin/settings', 'domain'); diff --git a/src/admin/controllers/domain/view.php b/src/admin/controllers/domain/view.php new file mode 100755 index 0000000..a06256c --- /dev/null +++ b/src/admin/controllers/domain/view.php @@ -0,0 +1,9 @@ +count('domain_extensions'); + +if ($count > 0) { + $rows = $DB->findAll('domain_extensions', '*', array(), '`extension_id` ASC'); +} diff --git a/src/admin/controllers/hosting/edit.php b/src/admin/controllers/hosting/edit.php new file mode 100755 index 0000000..77d3145 --- /dev/null +++ b/src/admin/controllers/hosting/edit.php @@ -0,0 +1,28 @@ + post('api_username'), + 'api_password' => post('api_password'), + 'api_cpanel_url' => post('api_cpanel_url'), + 'api_server_ip' => post('api_server_ip'), + 'api_ns_1' => post('api_ns_1'), + 'api_ns_2' => post('api_ns_2'), + 'api_package' => post('api_package'), + 'api_callback_token' => post('api_callback_token') +); + +$resault = $DB->update('account_api', $data, array('api_key' => 'myownfreehost')); + +if ($resault) { + setMessage('Hosting Server updated successfully !'); +} else { + setMessage("Something went's wrong !", 'danger'); +} + +redirect('admin/settings', 'hosting'); diff --git a/src/admin/controllers/hosting/view.php b/src/admin/controllers/hosting/view.php new file mode 100755 index 0000000..7d6b54a --- /dev/null +++ b/src/admin/controllers/hosting/view.php @@ -0,0 +1,6 @@ + post('subject'), + 'knowledgebase_content' => post('editor'), + 'knowledgebase_date' => date('Y-m-d H:i:s'), + ); + + $resault = $DB->insert('knowledgebase', $data); + if ($resault) { + setMessage('Knowledgebase added successfully !'); + } else { + setMessage("Something went's wrong !", 'danger'); + } + redirect('admin/knowledgebase'); +} else { + $PageInfo = ['title' => 'New Knowledgebase', 'rel' => '']; + $load_editor = 1; +} diff --git a/src/admin/controllers/knowledgebase/edit.php b/src/admin/controllers/knowledgebase/edit.php new file mode 100755 index 0000000..ef1c361 --- /dev/null +++ b/src/admin/controllers/knowledgebase/edit.php @@ -0,0 +1,44 @@ + 'edit', 'id' => $id)); + } + $subject = post('subject'); + if (!$subject) { + setMessage('need field: subject', 'danger'); + redirect('admin/knowledgebase', '', array('action' => 'edit', 'id' => $id)); + } + $editor = post('editor'); + if (!$editor) { + setMessage('need field: editor', 'danger'); + redirect('admin/knowledgebase', '', array('action' => 'edit', 'id' => $id)); + } + + $FormData = array( + 'knowledgebase_subject' => $subject, + 'knowledgebase_content' => $editor, + 'knowledgebase_date' => date('Y-m-d H:i:s'), + ); + $resault = $DB->update('knowledgebase', $FormData, array('knowledgebase_id' => $id)); + + if ($resault) { + setMessage('Knowledgebase updated successfully !'); + } else { + setMessage("Something went's wrong !", 'danger'); + } + redirect('admin/knowledgebase', '', array('action' => 'edit', 'id' => $id)); +} else { + $id = get('id'); + $load_editor = 1; + if ($id > 0) { + $PageInfo = ['title' => 'Edit Knowledgebase #' . $id, 'rel' => '']; + $Knowledgebase = $DB->getRow("SELECT * FROM pre_knowledgebase WHERE knowledgebase_id='{$id}' limit 1"); + } else { + $PageInfo = ['title' => 'Unathorized Access', 'rel' => '']; + $Knowledgebase = null; + } +} diff --git a/src/admin/controllers/knowledgebase/list.php b/src/admin/controllers/knowledgebase/list.php new file mode 100755 index 0000000..c31630b --- /dev/null +++ b/src/admin/controllers/knowledgebase/list.php @@ -0,0 +1,9 @@ +count('knowledgebase'); +if ($count > 0) { + $rows = $DB->findAll('knowledgebase', '*', array(), "`knowledgebase_id` DESC"); +} diff --git a/src/admin/controllers/knowledgebase/view.php b/src/admin/controllers/knowledgebase/view.php new file mode 100755 index 0000000..1cc02cd --- /dev/null +++ b/src/admin/controllers/knowledgebase/view.php @@ -0,0 +1,15 @@ + 0) { + $PageInfo = ['title' => 'View Knowledgebase #' . $knowledgebase_id, 'rel' => '']; + $Knowledgebase = $DB->find('knowledgebase', '*', array('knowledgebase_id' => $knowledgebase_id), null, 1); +} else { + $PageInfo = ['title' => 'Unathorized Access', 'rel' => '']; + $Knowledgebase = null; +} diff --git a/src/admin/controllers/login.php b/src/admin/controllers/login.php deleted file mode 100644 index d429444..0000000 --- a/src/admin/controllers/login.php +++ /dev/null @@ -1,30 +0,0 @@ -find('admin', '*', array( + 'admin_email' => $admin_email, + 'admin_password' => $admin_password, +)); + +if (!empty($data) && is_array($data)) { + if (isset($_POST['remember'])) { + $_SESSION['UIISC_ADMIN'] = base64_encode($data['admin_key']); + } else { + $_SESSION['UIISC_ADMIN'] = base64_encode($data['admin_key']); + } + setMessage('Logged in successfully !'); + redirect('admin/index'); +} else { + setMessage('Invalid email address or password !', 'danger'); + redirect('admin/login'); +} diff --git a/src/admin/controllers/login/logout.php b/src/admin/controllers/login/logout.php new file mode 100755 index 0000000..509848a --- /dev/null +++ b/src/admin/controllers/login/logout.php @@ -0,0 +1,20 @@ + + + Logged out successfully! + '; +} else { + $_SESSION['message'] = 'You have requested a password reset.
'; + $EmailDescription = 'Your account password has been reset successfully. Please login to clientarea to use our services again.
'; + $EmailDescription = 'Click here to login.
'; + $email_body = email_build_body('Reset Password', $AdminInfo['admin_fname'], $EmailContent, $EmailDescription); + + send_mail(array( + 'to' => $AdminEmail, + 'message' => $email_body, + 'subject' => 'Reset Password', + )); + + setMessage('Password reset successfully !', 'success'); + redirect('admin/login'); + } else { + setMessage('Something went' . "'" . 's wrong !', 'danger'); + redirect('admin/resetpassword'); + } + } else { + setMessage('Invalid reset token !', 'danger'); + redirect('admin/resetpassword'); + } +} else { + $PageInfo['title'] = 'Reset Password'; + $PageInfo['rel'] = ''; +} diff --git a/src/admin/controllers/profile/view.php b/src/admin/controllers/profile/view.php new file mode 100755 index 0000000..e588a26 --- /dev/null +++ b/src/admin/controllers/profile/view.php @@ -0,0 +1,5 @@ +I18N('My Profile'); + +require_once ROOT . '/core/library/userinfo.class.php'; diff --git a/src/admin/controllers/settings/edit.php b/src/admin/controllers/settings/edit.php new file mode 100755 index 0000000..0ccad3c --- /dev/null +++ b/src/admin/controllers/settings/edit.php @@ -0,0 +1,33 @@ + post('name'), + 'site_path' => post('url'), + 'site_email' => post('email'), + 'site_phone' => post('phone'), + 'site_brand' => post('brand'), + 'site_company' => post('company'), + 'site_status' => post('status'), + 'page_title' => post('page_title'), + 'page_description' => post('page_description'), + 'page_keywords' => post('page_keywords'), + 'page_copyright' => post('page_copyright'), + 'page_author' => post('page_author'), + 'ifastnet_aff' => post('ifastnet_aff'), + ); + $where = array( + 'site_key' => 'UIISC', + ); + + $resault = $DB->update('config', $data, $where); + + if ($resault) { + setMessage('Clientarea updated successfully!'); + } else { + setMessage("Something went's wrong!", 'danger'); + } + redirect('admin/settings'); +} diff --git a/src/admin/controllers/settings/view.php b/src/admin/controllers/settings/view.php new file mode 100755 index 0000000..c5901f0 --- /dev/null +++ b/src/admin/controllers/settings/view.php @@ -0,0 +1,10 @@ + 'Live', 'value' => '1'), + array('name' => 'Maintaince', 'value' => '0'), +); + +$PageInfo['title'] = 'System Settings'; diff --git a/src/admin/controllers/sitepro/edit.php b/src/admin/controllers/sitepro/edit.php new file mode 100755 index 0000000..07de1cb --- /dev/null +++ b/src/admin/controllers/sitepro/edit.php @@ -0,0 +1,25 @@ + post('username'), + 'builder_password' => post('password') +); + +$where = array( + 'builder_id' => 'SITEPRO', +); + +$resault = $DB->update('builder_api', $data, $where); + +if ($resault) { + setMessage('SitePro API updated successfully!'); +} else { + setMessage("Something went's wrong!", 'danger'); +} + +redirect('admin/settings', 'sitepro'); diff --git a/src/admin/controllers/sitepro/view.php b/src/admin/controllers/sitepro/view.php new file mode 100755 index 0000000..9ca5ef8 --- /dev/null +++ b/src/admin/controllers/sitepro/view.php @@ -0,0 +1,9 @@ + 'SITEPRO', +); + +$SitePro = $DB->find('builder_api', '*', $where, null, 1); diff --git a/src/admin/controllers/smtp/edit.php b/src/admin/controllers/smtp/edit.php new file mode 100755 index 0000000..3a1facf --- /dev/null +++ b/src/admin/controllers/smtp/edit.php @@ -0,0 +1,28 @@ + post('host'), + 'smtp_username' => post('username'), + 'smtp_password' => post('password'), + 'smtp_port' => post('port'), + 'smtp_from' => post('from'), +); + +$where = array( + 'smtp_key' => 'SMTP', +); + +$resault = $DB->update('smtp', $data, $where); + +if ($resault) { + setMessage('SMTP updated successfully!'); +} else { + setMessage("Something went's wrong!", 'danger'); +} + +redirect('admin/settings', 'smtp'); diff --git a/src/admin/controllers/smtp/test.php b/src/admin/controllers/smtp/test.php new file mode 100755 index 0000000..7036a82 --- /dev/null +++ b/src/admin/controllers/smtp/test.php @@ -0,0 +1,22 @@ + $email, + 'message' => $lang->I18N('This test email indicates that SMTP has been configured correctly.'), + 'subject' => $lang->I18N('Send Test Email'), +)); + +if ($resault) { + setMessage('The test email has been sent successfully !'); +} else { + setMessage("Something went's wrong!", 'danger'); +} + +redirect('admin/settings', 'smtp'); diff --git a/src/admin/controllers/smtp/view.php b/src/admin/controllers/smtp/view.php new file mode 100755 index 0000000..db4a83b --- /dev/null +++ b/src/admin/controllers/smtp/view.php @@ -0,0 +1,9 @@ + 'SMTP', +); + +$SMTPInfo = $DB->find('smtp', '*', $where, null, 1); diff --git a/src/admin/controllers/sslapi/edit.php b/src/admin/controllers/sslapi/edit.php new file mode 100755 index 0000000..c8dd615 --- /dev/null +++ b/src/admin/controllers/sslapi/edit.php @@ -0,0 +1,25 @@ + post('username'), + 'api_password' => post('password'), +); + +$where = array( + 'api_key' => 'FREESSL', +); + +$resault = $DB->update('ssl_api', $data, $where); + +if ($resault) { + setMessage('SSL API updated successfully!'); +} else { + setMessage("Something went's wrong!", 'danger'); +} + +redirect('admin/settings', 'sslapi'); diff --git a/src/admin/controllers/sslapi/view.php b/src/admin/controllers/sslapi/view.php new file mode 100755 index 0000000..2366179 --- /dev/null +++ b/src/admin/controllers/sslapi/view.php @@ -0,0 +1,9 @@ + 'FREESSL' +); + +$SSLApi = $DB->find('ssl_api', '*', $where, null, 1); diff --git a/src/admin/controllers/sslcert/list.php b/src/admin/controllers/sslcert/list.php new file mode 100755 index 0000000..4df43fe --- /dev/null +++ b/src/admin/controllers/sslcert/list.php @@ -0,0 +1,18 @@ +count('ssl'); +if ($count > 0) { + $rows = $DB->findAll('ssl', '*', array(), "`ssl_id` DESC"); + + require_once ROOT . '/core/handler/SSLHandler.php'; + require_once ROOT . '/modules/GoGetSSL/GoGetSSLApi.php'; + + $apiClient = new GoGetSSLApi(); + $apiClient->auth($SSLApi['api_username'], $SSLApi['api_password']); +} diff --git a/src/admin/controllers/sslcert/view.php b/src/admin/controllers/sslcert/view.php new file mode 100755 index 0000000..90c858c --- /dev/null +++ b/src/admin/controllers/sslcert/view.php @@ -0,0 +1,33 @@ +auth($SSLApi['api_username'], $SSLApi['api_password']); + +$SSLInfo = $apiClient->getOrderStatus($ssl_id); + +if ($SSLInfo['status'] == 'processing') { + $Status = 'Processing'; +} elseif ($SSLInfo['status'] == 'active') { + $Status = 'Active'; +} elseif ($SSLInfo['status'] == 'incomplete') { + $Status = 'Incomplete'; +} elseif ($SSLInfo['status'] == 'cancelled') { + $Status = 'Cancelled'; +} elseif ($SSLInfo['status'] == 'expired') { + $Status = 'Expired'; +} else { + $Status = ''; +} + +if (empty($SSLInfo['begin_date'])) { + $Begin = '-- -- ----'; + $End = $Begin; +} else { + $Begin = $SSLInfo['begin_date']; + $End = $SSLInfo['end_date']; +} diff --git a/src/admin/controllers/tickets.php b/src/admin/controllers/tickets.php deleted file mode 100644 index 387274a..0000000 --- a/src/admin/controllers/tickets.php +++ /dev/null @@ -1,26 +0,0 @@ - 10, - "pages" => 4, - "page" => 1, - "list" => [], -]; -$ticket_types = [ - "技术支持", "销售财务", "管理员信箱" -]; -$status_types = [ - "关闭", - "打开" -]; -// $tickets["list"] = $dbpdo->select('SELECT * FROM `tickets` WHERE `user_id` = ?', [$user->id]); -$tickets["list"] = $dbpdo->select_and("tickets"); diff --git a/src/admin/controllers/tickets/close.php b/src/admin/controllers/tickets/close.php new file mode 100755 index 0000000..5486372 --- /dev/null +++ b/src/admin/controllers/tickets/close.php @@ -0,0 +1,48 @@ +find('tickets', 'ticket_email', array('ticket_id' => $ticket_id)); + +if (!$TicketInfo) { + setMessage('Not Found !'); + redirect('admin/tickets'); +} + +// 查找客户信息 +$ClientInfo = $DB->find('clients', 'hosting_client_email, hosting_client_fname', array('hosting_client_id' => $TicketInfo['ticket_for'])); + +if (!$ClientInfo) { + setMessage('Not Found !'); + redirect('admin/tickets'); +} + +$resault = $DB->update('tickets', array('ticket_status' => 3), array('ticket_id' => $ticket_id)); + +if ($resault) { + $ticket_url = setURL('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id)); + $email_body = email_build_body('Ticket Closed', + $ClientInfo['hosting_client_fname'], + 'The ticket ("' . $ticket_id . '") had been closed.
', + 'Click here for details.
' + ); + + send_mail(array( + 'to' => $TicketInfo['ticket_email'], + 'message' => $email_body, + 'subject' => 'Ticket Closed', + )); + + setMessage('Ticket closed successfully !'); +} else { + setMessage("Something went's wrong !", 'danger'); +} + +redirect('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id)); diff --git a/src/admin/controllers/tickets/list.php b/src/admin/controllers/tickets/list.php new file mode 100755 index 0000000..f098d48 --- /dev/null +++ b/src/admin/controllers/tickets/list.php @@ -0,0 +1,9 @@ +count('tickets'); +if ($count > 0) { + $rows = $DB->findAll('tickets', '*', array(), "`ticket_id` DESC"); +} diff --git a/src/admin/controllers/tickets/reply.php b/src/admin/controllers/tickets/reply.php new file mode 100755 index 0000000..2fa0d4d --- /dev/null +++ b/src/admin/controllers/tickets/reply.php @@ -0,0 +1,64 @@ +find('tickets', 'ticket_email, ticket_for', array('ticket_id' => $ticket_id)); + +if (!$TicketInfo) { + exit('Access Denied'); +} + +// update status +$resault = $DB->update('tickets', array('ticket_status' => '1'), array('ticket_id' => $ticket_id)); + +if ($resault) { + $FormData = array( + 'reply_for' => $ticket_id, + 'reply_from' => 999999, + 'reply_content' => post('content'), + 'reply_date' => date('Y-m-d H:i:s'), + ); + $resault_insert = $DB->insert('ticket_replies', $FormData); + if ($resault_insert) { + $ticket_url = setURL('clientarea/tickets', array('action' => 'view', 'ticket_id' => $ticket_id)); + + $EmailContent = 'You have received a reply from Support Staff.
'; + $EmailDescription = 'View Ticket'; + $email_body = email_build_body('Ticket Reply', 'there', $EmailContent, $EmailDescription); + + send_mail(array( + 'to' => $TicketInfo['ticket_email'], + 'subject' => 'Ticket Reply #' . $ticket_id, + 'message' => $email_body, + )); + // if (send_mail($msg_email)) { + // $email_insert = array( + // 'email_subject' => 'Ticket Reply #' . $ticket_id, + // 'email_date' => date('Y-m-d H:i:s'), + // 'email_body' => $email_body, + // 'email_for' => $TicketInfo['ticket_for'], + // 'email_read' => 0 + // ); + // print_r($email_insert); + // // exit; + // $DB->insert('emails', $email_insert); + // }; + setMessage('Reply added successfully!'); + } else { + setMessage("Something went's wrong!", 'danger'); + } +} else { + setMessage("Something went's wrong!", 'danger'); +} + +redirect('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id)); diff --git a/src/admin/controllers/tickets/view.php b/src/admin/controllers/tickets/view.php new file mode 100755 index 0000000..c4b151d --- /dev/null +++ b/src/admin/controllers/tickets/view.php @@ -0,0 +1,16 @@ + 0) { + $PageInfo['title'] = 'View Ticket #' . $ticket_id; + $TicketInfo = $DB->find('tickets', '*', array('ticket_id' => $ticket_id), null, 1); + $ReplyCount = $DB->count('ticket_replies', array('reply_for' => $ticket_id)); + $ReplyInfo = $DB->findAll('ticket_replies', '*', array('reply_for' => $ticket_id), '`reply_id` DESC'); +} else { + $PageInfo['title'] = 'Unathorized Access'; + $TicketInfo = null; +} diff --git a/src/admin/controllers/tickets_details.php b/src/admin/controllers/tickets_details.php deleted file mode 100644 index 524ce3e..0000000 --- a/src/admin/controllers/tickets_details.php +++ /dev/null @@ -1,74 +0,0 @@ -find_and('tickets', ["id" => $tickets_id]); -if ($res) { - $data = $res; -} else { - setMsg("msg_notify", "The Tickets Not Found.", "warning"); - redirect("admin", "tickets"); -} - -if (isset($_POST["do_close_tickets"])) { - if ($dbpdo->update('tickets', ["status" => 0, "lastupdated" => time()], "`id`={$tickets_id}")) { - setMsg("msg_notify", "The Tickets Closed Successfully."); - } else { - setMsg("msg_notify", "The Tickets Close Failed.", "warning"); - } - redirect("admin", "tickets_details", ["id" => $tickets_id]); -} elseif (isset($_POST["do_open_tickets"])) { - if ($dbpdo->update('tickets', ["status" => 1, "lastupdated" => time()], "`id`={$tickets_id}")) { - setMsg("msg_notify", "The Tickets Opened Successfully."); - } else { - setMsg("msg_notify", "The Tickets Open Failed.", "warning"); - } - redirect("admin", "tickets_details", ["id" => $tickets_id]); -} elseif (isset($_POST["do_comment_tickets"])) { - $comment = filter_input(INPUT_POST, "comment", FILTER_SANITIZE_SPECIAL_CHARS); - $errors = array(); - - $data = [ - "tickets_id" => $tickets_id, - "comment" => $comment - ]; - if (!count($errors)) { - $data["date"] = time(); - $data["user_type"] = "admin"; - if ($dbpdo->find_and('tickets', ["id" => $tickets_id, "user_id" => $user->id])) { - if ($dbpdo->add("tickets_comment", $data)) { - $dbpdo->update("tickets", ["lastupdated" => $data["date"]]); - setMsg("msg_notify", "Add Comment Successfully.", "success"); - } else { - setMsg("msg_notify", "Add Comment Failed.", "warning"); - } - redirect("admin", "tickets_details", ["id" => $res]); - } else { - setMsg("msg_notify", "The Tickets Not Found.", "warning"); - redirect("admin", "tickets"); - } - } else { - setMsg("form_data", $data); - setMsg("errors", $errors); - redirect("admin", "tickets_details", ["id" => $res]); - } -} diff --git a/src/admin/forgetpassword.php b/src/admin/forgetpassword.php new file mode 100755 index 0000000..8bea8b9 --- /dev/null +++ b/src/admin/forgetpassword.php @@ -0,0 +1,7 @@ +I18N('login'); +$PageInfo['rel'] = ''; + +require_once __DIR__ . '/views/common/header.php'; +require_once __DIR__ . '/views/login/login.php'; +require_once __DIR__ . '/views/common/footer.php'; diff --git a/src/admin/logout.php b/src/admin/logout.php new file mode 100755 index 0000000..b9b9399 --- /dev/null +++ b/src/admin/logout.php @@ -0,0 +1,2 @@ + - -# | -Branch | -Account | -Username | -Domain | -Plan | -Password | -Nameserver | -Operate | -|
---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - I18N('login'); ?> - - - - | -
ID | +Username | +Domain | +Deploy Date | +Status | +Action | + + + 0): ?> + +
---|---|---|---|---|---|
# | ++ | + | + | Inactive'; +} elseif ($row['account_status'] == '1') { + $btn = ['success', 'globe']; + echo 'Active'; +} elseif ($row['account_status'] == '2') { + $btn = ['danger', 'lock']; + echo 'Suspended'; +} +?> | ++ + Manage + + | +
Nothing found | +
Records Founds
+Now you are going to be redirected to the control panel. It can take upto 5 seconds based on your internet connecion speed.
+ +ID | +Name | +Date | +Status | +Action | + + + 0): ?> + +|
---|---|---|---|---|---|
# | ++ | + | + | Inactive'; +} elseif ($value['hosting_client_status'] == '1') { + $btn = ['success', 'globe']; + echo 'Active'; +} elseif ($value['hosting_client_status'] == '2') { + $btn = ['danger', 'lock']; + echo 'Suspended'; +} +?> | +Manage | +
Nothing found | +
Records Founds
+You are trying to access a page which is not allowed to be displayed to an unauthorized user.
+