Jackson Dou 2 år sedan
förälder
incheckning
12ea496427
100 ändrade filer med 1859 tillägg och 1315 borttagningar
  1. 6 8
      src/about.php
  2. 0 42
      src/admin.php
  3. 16 0
      src/admin/accounts.php
  4. 4 0
      src/admin/application.php
  5. 16 0
      src/admin/clients.php
  6. 0 24
      src/admin/controllers/account_active.php
  7. 0 52
      src/admin/controllers/account_add.php
  8. 0 30
      src/admin/controllers/account_disable.php
  9. 0 24
      src/admin/controllers/account_domain.php
  10. 0 23
      src/admin/controllers/account_list.php
  11. 0 31
      src/admin/controllers/account_password.php
  12. 0 47
      src/admin/controllers/account_status.php
  13. 84 0
      src/admin/controllers/accounts/deactivate.php
  14. 9 0
      src/admin/controllers/accounts/edit.php
  15. 20 0
      src/admin/controllers/accounts/goftp.php
  16. 9 0
      src/admin/controllers/accounts/list.php
  17. 17 0
      src/admin/controllers/accounts/login.php
  18. 68 0
      src/admin/controllers/accounts/password.php
  19. 76 0
      src/admin/controllers/accounts/reactivate.php
  20. 22 0
      src/admin/controllers/accounts/view.php
  21. 0 255
      src/admin/controllers/admin.php
  22. 0 29
      src/admin/controllers/check_domain.php
  23. 19 0
      src/admin/controllers/clients/activate.php
  24. 9 0
      src/admin/controllers/clients/list.php
  25. 22 0
      src/admin/controllers/clients/login.php
  26. 19 0
      src/admin/controllers/clients/suspend.php
  27. 29 0
      src/admin/controllers/clients/view.php
  28. 7 0
      src/admin/controllers/dashboard/view.php
  29. 37 0
      src/admin/controllers/domain/add.php
  30. 38 0
      src/admin/controllers/domain/delete.php
  31. 9 0
      src/admin/controllers/domain/view.php
  32. 28 0
      src/admin/controllers/hosting/edit.php
  33. 6 0
      src/admin/controllers/hosting/view.php
  34. 22 0
      src/admin/controllers/knowledgebase/add.php
  35. 44 0
      src/admin/controllers/knowledgebase/edit.php
  36. 9 0
      src/admin/controllers/knowledgebase/list.php
  37. 15 0
      src/admin/controllers/knowledgebase/view.php
  38. 0 30
      src/admin/controllers/login.php
  39. 42 0
      src/admin/controllers/login/login.php
  40. 20 0
      src/admin/controllers/login/logout.php
  41. 0 11
      src/admin/controllers/logout.php
  42. 0 8
      src/admin/controllers/main.php
  43. 0 22
      src/admin/controllers/member.php
  44. 0 48
      src/admin/controllers/member_add.php
  45. 0 34
      src/admin/controllers/member_details.php
  46. 0 33
      src/admin/controllers/member_edit.php
  47. 0 22
      src/admin/controllers/news.php
  48. 29 0
      src/admin/controllers/news/add.php
  49. 47 0
      src/admin/controllers/news/edit.php
  50. 14 0
      src/admin/controllers/news/list.php
  51. 22 0
      src/admin/controllers/news/view.php
  52. 0 48
      src/admin/controllers/news_add.php
  53. 0 28
      src/admin/controllers/news_details.php
  54. 20 0
      src/admin/controllers/profile/edit.php
  55. 43 0
      src/admin/controllers/profile/forgetpassword.php
  56. 30 0
      src/admin/controllers/profile/password.php
  57. 67 0
      src/admin/controllers/profile/resetpassword.php
  58. 5 0
      src/admin/controllers/profile/view.php
  59. 33 0
      src/admin/controllers/settings/edit.php
  60. 10 0
      src/admin/controllers/settings/view.php
  61. 25 0
      src/admin/controllers/sitepro/edit.php
  62. 9 0
      src/admin/controllers/sitepro/view.php
  63. 28 0
      src/admin/controllers/smtp/edit.php
  64. 22 0
      src/admin/controllers/smtp/test.php
  65. 9 0
      src/admin/controllers/smtp/view.php
  66. 25 0
      src/admin/controllers/sslapi/edit.php
  67. 9 0
      src/admin/controllers/sslapi/view.php
  68. 18 0
      src/admin/controllers/sslcert/list.php
  69. 33 0
      src/admin/controllers/sslcert/view.php
  70. 0 26
      src/admin/controllers/tickets.php
  71. 48 0
      src/admin/controllers/tickets/close.php
  72. 9 0
      src/admin/controllers/tickets/list.php
  73. 64 0
      src/admin/controllers/tickets/reply.php
  74. 16 0
      src/admin/controllers/tickets/view.php
  75. 0 74
      src/admin/controllers/tickets_details.php
  76. 7 0
      src/admin/forgetpassword.php
  77. 8 1
      src/admin/index.php
  78. 18 0
      src/admin/knowledgebase.php
  79. 0 28
      src/admin/library.php
  80. 14 0
      src/admin/login.php
  81. 2 0
      src/admin/logout.php
  82. 18 0
      src/admin/news.php
  83. 16 0
      src/admin/profile.php
  84. 7 0
      src/admin/resetpassword.php
  85. 22 0
      src/admin/settings.php
  86. 16 0
      src/admin/sslcert.php
  87. 20 0
      src/admin/tickets.php
  88. 0 33
      src/admin/views/account_active.php
  89. 0 53
      src/admin/views/account_add.php
  90. 0 37
      src/admin/views/account_disable.php
  91. 0 33
      src/admin/views/account_domain.php
  92. 0 65
      src/admin/views/account_list.php
  93. 0 38
      src/admin/views/account_password.php
  94. 0 33
      src/admin/views/account_status.php
  95. 94 0
      src/admin/views/accounts/edit.php
  96. 57 0
      src/admin/views/accounts/list.php
  97. 25 0
      src/admin/views/accounts/login.php
  98. 127 0
      src/admin/views/accounts/view.php
  99. 0 45
      src/admin/views/check_domain.php
  100. 51 0
      src/admin/views/clients/list.php

+ 6 - 8
src/about.php

@@ -1,10 +1,8 @@
 <?php
-define('IN_CRONLITE', true);
-require_once "core.php";
+require __DIR__ . '/core/application.php';
+require __DIR__ . '/core/controllers/about.php';
 
-include("{$ROOT}/core/controllers/about.php");
-
-include("{$ROOT}/core/views/header.php");
-include("{$ROOT}/core/views/navbar.php");
-include($section_page);
-include("{$ROOT}/core/views/footer.php");
+require __DIR__ . '/core/views/common/header.php';
+require __DIR__ . '/core/views/common/navbar.php';
+require __DIR__ . '/core/views/about.php';
+require __DIR__ . '/core/views/common/footer.php';

+ 0 - 42
src/admin.php

@@ -1,42 +0,0 @@
-<?php
-
-session_start();
-define("IN_CRONLITE", true);
-require_once("core.php");
-
-include_once "{$ROOT}/library/api.php";
-include_once "{$ROOT}/admin/library.php";
-// getVersion();
-// if (!file_exists("{$ROOT}/data/installed") || !isset($config) || $config['apiUsername'] == '#getUsername#' || $config['apiPassword'] == '#getPassword#') {
-//     header('Location: ./install.php');
-// }
-// $session_name = session_name();
-// if (!isset($_COOKIE[$session_name])) {
-//     foreach ($_COOKIE as $key => $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");

+ 16 - 0
src/admin/accounts.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view', 'goftp', 'login'))) {
+    $action = 'list';
+}
+
+require __DIR__ . '/controllers/accounts/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/accounts/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 4 - 0
src/admin/application.php

@@ -0,0 +1,4 @@
+<?php
+
+require_once __DIR__ . '/../core/application.php';
+require_once ROOT . '/core/admin.php';

+ 16 - 0
src/admin/clients.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view', 'login'))) {
+    $action = 'list';
+}
+
+require __DIR__ . '/controllers/clients/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/clients/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 0 - 24
src/admin/controllers/account_active.php

@@ -1,24 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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;
-    }
-}

+ 0 - 52
src/admin/controllers/account_add.php

@@ -1,52 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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;
-    }
-}

+ 0 - 30
src/admin/controllers/account_disable.php

@@ -1,30 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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;
-    }
-}

+ 0 - 24
src/admin/controllers/account_domain.php

@@ -1,24 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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;
-    }
-}

+ 0 - 23
src/admin/controllers/account_list.php

@@ -1,23 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$member = [
-    [
-        "branch" => "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"
-        ]
-    ]
-];

+ 0 - 31
src/admin/controllers/account_password.php

@@ -1,31 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../admin.php");
-    exit;
-}
-
-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;
-    }
-}

+ 0 - 47
src/admin/controllers/account_status.php

@@ -1,47 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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 <b>" . $this->getUserName() . "</b>." . $this->data;
-        //     } else {
-        //         return null;
-        //     }
-        // } else {
-        //     return null;
-        // }
-        if ($client->getStatus() === "active") {
-            $message = [1, "<b>The account </b> " . $tsData["username"] . " is Actived"];
-        } elseif ($client->getStatus() === "suspend") {
-            $message = [1, "<b>The account </b> " . $tsData["username"] . " is Suspend"];
-        } else {
-            "Cannot find the specified associated account";
-            $message = [0, "The account <b>" . $tsData["username"] . "</b> does not have associated accounts."];
-        }
-    }
-}

+ 84 - 0
src/admin/controllers/accounts/deactivate.php

@@ -0,0 +1,84 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$account_id = post('account_id', '');
+
+if (empty($account_id)) {
+    setMessage('need field: account_id', 'danger');
+    redirect('admin/accounts');
+}
+
+$reason = post('reason', '');
+
+if (strlen($reason) < 8) {
+    setMessage('Reason must be at least 8 characters !', 'danger');
+    redirect('admin/accounts', '', array('action' => '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 = '<p>We had a good time with you while you were with us. </p>';
+        $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 <b>successfully</b> !', 'success');
+        redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id));
+    } else {
+        // 本地同步异常
+        setMessage('Something went' . "'" . 's <b>wrong</b> !', 'danger');
+        redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id));
+    }
+} elseif ($Result['status'] == 0 && $Result['message'] == 0) {
+    // 执行操作异常
+    setMessage('Something went' . "'" . 's <b>wrong</b> !', 'danger');
+    redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id));
+}

+ 9 - 0
src/admin/controllers/accounts/edit.php

@@ -0,0 +1,9 @@
+<?php
+
+
+$account_id = get('account_id');
+
+$AccountInfo = $DB->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;

+ 20 - 0
src/admin/controllers/accounts/goftp.php

@@ -0,0 +1,20 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+$account_id = get('id');
+
+if (empty($account_id)) {
+    redirect('admin/accounts');
+}
+
+$data = $DB->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);

+ 9 - 0
src/admin/controllers/accounts/list.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = $lang->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");
+}

+ 17 - 0
src/admin/controllers/accounts/login.php

@@ -0,0 +1,17 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+$account_id = get('account_id');
+
+if (empty($account_id)) {
+    redirect('admin/accounts');
+}
+
+$AccountInfo = $DB->find('account', '*', array('account_id' => $account_id), null, 1);
+
+if (empty($AccountInfo)) {
+    redirect('admin/accounts');
+}
+
+require_once ROOT . '/core/handler/HostingHandler.php';

+ 68 - 0
src/admin/controllers/accounts/password.php

@@ -0,0 +1,68 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$account_id = post('account_id', '');
+
+if (empty($account_id)) {
+    setMessage('need field: account_id', 'danger');
+    redirect('admin/accounts');
+}
+
+$new_password = post('new_password', '');
+
+if (empty($new_password)) {
+    setMessage('need field: new_password', 'danger');
+    redirect('admin/accounts', '', array('action' => '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 <b>successfully</b> !', 'success');
+    } else {
+        setMessage("1Something went's <b>wrong</b> !", 'danger');
+    }
+} elseif ($Result['status'] == 0 && $Result['message'] == 0) {
+    setMessage("2Something went's <b>wrong</b> !", 'danger');
+} else {
+    setMessage("3Something went's <b>wrong</b> !", 'danger');
+}
+
+redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id));

+ 76 - 0
src/admin/controllers/accounts/reactivate.php

@@ -0,0 +1,76 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$account_id = post('account_id', '');
+
+if (empty($account_id)) {
+    setMessage('need field: account_id', 'danger');
+    redirect('admin/accounts');
+}
+
+$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 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 = '<p><a href="' . setURL('clientarea/login') . '" target="_blank">Login to Clientarea</a></p>';
+        $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 <b>successfully</b> !', 'success');
+        redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id));
+    } else {
+        // 本地同步异常
+        setMessage('Something went' . "'" . 's <b>wrong</b> !', 'danger');
+        redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id));
+    }
+} elseif ($Result['status'] == 0 && $Result['message'] == 0) {
+    // 执行操作异常
+    setMessage('Something went' . "'" . 's <b>wrong</b> !', 'danger');
+    redirect('admin/accounts', '', array('action' => 'edit', 'account_id' => $account_id));
+}

+ 22 - 0
src/admin/controllers/accounts/view.php

@@ -0,0 +1,22 @@
+<?php
+
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$account_id = get('account_id');
+
+if (empty($account_id)) {
+    redirect('admin/accounts');
+}
+
+require_once ROOT . '/core/handler/HostingHandler.php';
+
+$PageInfo['title'] = 'View Account (#' . $account_id . ')';
+
+$AccountInfo = $DB->find('account', '*', array('account_id' => $account_id), null, 1);
+
+if (empty($AccountInfo)) {
+    setMessage('not found', 'danger');
+    redirect('admin/accounts');
+}

+ 0 - 255
src/admin/controllers/admin.php

@@ -1,255 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../admin.php");
-    exit;
-}
-
-switch ($section) {
-    case "main":
-        $section_title = "Main";
-        break;
-    case "check_domain":
-        $section_title = "Check domain";
-        if (isset($_POST["do_check_domain"])) {
-            $tsData = array(
-                "domain" => 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 <b>" . $this->getUserName() . "</b>." . $this->data;
-                //     } else {
-                //         return null;
-                //     }
-                // } else {
-                //     return null;
-                // }
-                if ($client->getStatus() === "active") {
-                    $message = [1, "<b>The account </b> " . $tsData["username"] . " is Actived"];
-                } elseif ($client->getStatus() === "suspend") {
-                    $message = [1, "<b>The account </b> " . $tsData["username"] . " is Suspend"];
-                } else {
-                    "Cannot find the specified associated account";
-                    $message = [0, "The account <b>" . $tsData["username"] . "</b> 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";
-}

+ 0 - 29
src/admin/controllers/check_domain.php

@@ -1,29 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-if (isset($_POST["do_check_domain"])) {
-    $tsData = array(
-        "domain" => 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;
-    }
-}

+ 19 - 0
src/admin/controllers/clients/activate.php

@@ -0,0 +1,19 @@
+<?php
+
+require '../../application.php';
+
+$client_id = get('client_id');
+
+if (!$client_id) {
+    exit('Access Denied');
+}
+
+$resault = $DB->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));

+ 9 - 0
src/admin/controllers/clients/list.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = 'My Clients';
+
+$count = $DB->count('clients');
+
+if ($count > 0) {
+    $rows = $DB->findAll('clients');
+}

+ 22 - 0
src/admin/controllers/clients/login.php

@@ -0,0 +1,22 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+$client_id = get('client_id');
+
+if (empty($client_id)) {
+    redirect('admin/clients');
+}
+
+$ClientInfo = $DB->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 . ' <b>successfully!</b>', 'success');
+
+redirect('clientarea/index');

+ 19 - 0
src/admin/controllers/clients/suspend.php

@@ -0,0 +1,19 @@
+<?php
+
+require '../../application.php';
+
+$client_id = get('client_id');
+
+if (!$client_id) {
+    exit('Access Denied');
+}
+
+$resault = $DB->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));

+ 29 - 0
src/admin/controllers/clients/view.php

@@ -0,0 +1,29 @@
+<?php
+
+require_once ROOT . '/core/handler/HostingHandler.php';
+require_once ROOT . '/core/library/userinfo.class.php';
+require_once ROOT . '/core/library/countries.php';
+
+$client_id = get('client_id');
+
+if (empty($client_id)) {
+    redirect('admin/clients');
+    exit();
+}
+
+$PageInfo['title'] = 'View client (' . $client_id . ')';
+
+$ClientInfo = $DB->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']));

+ 7 - 0
src/admin/controllers/dashboard/view.php

@@ -0,0 +1,7 @@
+<?php
+
+$PageInfo['title'] = 'Home Page';
+$count_clients = $DB->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");

+ 37 - 0
src/admin/controllers/domain/add.php

@@ -0,0 +1,37 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$domain = post('domain');
+
+if (!$domain) {
+    redirect('admin/settings', 'domain');
+}
+
+$domain = strtolower($domain);
+
+if (substr($domain, 0, 1) != '.') {
+    $domain = '.' . $domain;
+}
+
+$data = array(
+    'extension_value' => $domain,
+);
+
+$has = $DB->count('domain_extensions', $data);
+if ($has && $has > 0) {
+    setMessage('Extension aleady <b>exsist!</b>', 'danger');
+} else {
+    $resault = $DB->insert('domain_extensions', $data);
+    if ($resault) {
+        setMessage('Extension added <b>successfully!</b>');
+    } else {
+        setMessage('Something went' . "'" . 's <b>wrong!</b>', 'danger');
+    }
+}
+
+redirect('admin/settings', 'domain');

+ 38 - 0
src/admin/controllers/domain/delete.php

@@ -0,0 +1,38 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$extension = post('extension');
+
+if (!$extension) {
+    redirect('admin/settings', 'domain');
+}
+
+$extension = strtolower($extension);
+
+if (substr($extension, 0, 1) != '.') {
+    $extension = '.' . $extension;
+}
+
+$data = array(
+    'extension_value' => $extension,
+);
+
+$count = $DB->count('domain_extensions', $data);
+
+if (!$count > 0) {
+    setMessage('Extension won' . "'" . 't <b>exsist!</b>', 'danger');
+} else {
+    $result = $DB->delete('domain_extensions', $data);
+    if ($result) {
+        setMessage('Extension deleted <b>successfully!</b>');
+    } else {
+        setMessage('Something went' . "'" . 's <b>wrong!</b>', 'danger');
+    }
+}
+
+redirect('admin/settings', 'domain');

+ 9 - 0
src/admin/controllers/domain/view.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = 'Domain Extensions';
+
+$count = $DB->count('domain_extensions');
+
+if ($count > 0) {
+    $rows = $DB->findAll('domain_extensions', '*', array(), '`extension_id` ASC');
+}

+ 28 - 0
src/admin/controllers/hosting/edit.php

@@ -0,0 +1,28 @@
+<?php
+
+require '../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Access Denied');
+}
+
+$data = array(
+    'api_username' => 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');

+ 6 - 0
src/admin/controllers/hosting/view.php

@@ -0,0 +1,6 @@
+<?php
+
+require_once ROOT . '/core/library/userinfo.class.php';
+require_once ROOT . '/core/handler/HostingHandler.php';
+
+$PageInfo['title'] = 'Hosting Settings';

+ 22 - 0
src/admin/controllers/knowledgebase/add.php

@@ -0,0 +1,22 @@
+<?php
+
+if (isset($_POST['submit'])) {
+    require '../../application.php';
+
+    $data = array(
+        'knowledgebase_subject' => 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;
+}

+ 44 - 0
src/admin/controllers/knowledgebase/edit.php

@@ -0,0 +1,44 @@
+<?php
+
+if (isset($_POST['submit'])) {
+    require '../../application.php';
+    $id = post('id');
+    if (!$id) {
+        setMessage('need field: id', 'danger');
+        redirect('admin/knowledgebase', '', array('action' => '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;
+    }
+}

+ 9 - 0
src/admin/controllers/knowledgebase/list.php

@@ -0,0 +1,9 @@
+<?php
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$count = $DB->count('knowledgebase');
+if ($count > 0) {
+    $rows = $DB->findAll('knowledgebase', '*', array(), "`knowledgebase_id` DESC");
+}

+ 15 - 0
src/admin/controllers/knowledgebase/view.php

@@ -0,0 +1,15 @@
+<?php
+
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$knowledgebase_id = get('id');
+
+if ($knowledgebase_id > 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;
+}

+ 0 - 30
src/admin/controllers/login.php

@@ -1,30 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-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["adminloggedin"] = true;
-            $message = [1, "Login successfully. 2 seconds later redirect to the main page"];
-            header("refresh:2;url=admin.php");
-        } else {
-            $message = [0, "Login failed.Please check if the account or password is correct."];
-        }
-    }
-}

+ 42 - 0
src/admin/controllers/login/login.php

@@ -0,0 +1,42 @@
+<?php
+
+require_once __DIR__ . '/../../../core/application.php';
+
+if (!isset($_POST['login'])) {
+    redirect('admin/login');
+    exit();
+}
+
+$admin_email = post('email');
+
+if (empty($admin_email)) {
+    setMessage('Email address is required !', 'danger');
+    redirect('admin/login');
+}
+
+$admin_password = post('password');
+
+if (empty($admin_password)) {
+    setMessage('Password is required !', 'danger');
+    redirect('admin/login');
+}
+
+$admin_password = hash('sha256', post('password'));
+
+$data = $DB->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');
+}

+ 20 - 0
src/admin/controllers/login/logout.php

@@ -0,0 +1,20 @@
+<?php
+ob_start();
+session_start();
+if (isset($_SESSION['UIISC_ADMIN'])) {
+    unset($_SESSION['UIISC_ADMIN']);
+    $_SESSION['message'] = '<div class="alert alert-success" role="alert">
+        <button class="close" data-dismiss="alert" type="button" aria-label="Close">
+        <span aria-hidden="true">&times;</span>
+        </button>
+        Logged out <b>successfully!</b>
+    </div>';
+} else {
+    $_SESSION['message'] = '<div class="alert alert-danger" role="alert">
+        <button class="close" data-dismiss="alert" type="button" aria-label="Close">
+        <span aria-hidden="true">&times;</span>
+        </button>
+        Login to <b>continue!</b>
+    </div>';
+}
+header('location: login.php');

+ 0 - 11
src/admin/controllers/logout.php

@@ -1,11 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-adminLogout();
-setMsg("msg", "Logout successfully. 2 seconds later redirect to the login page.");
-header("refresh:2;url=admin.php");

+ 0 - 8
src/admin/controllers/main.php

@@ -1,8 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-

+ 0 - 22
src/admin/controllers/member.php

@@ -1,22 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-
-$members = [
-    "total" => 10,
-    "pages" => 4,
-    "page" => 1,
-    "list" => []
-];
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$members["list"] = $dbpdo->select_and("users");

+ 0 - 48
src/admin/controllers/member_add.php

@@ -1,48 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-$data = getMsg("form_data");
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$load_editor = true;
-
-if (isset($_POST["do_add_member"])) {
-    $title = filter_input(INPUT_POST, "title", FILTER_SANITIZE_STRING);
-    $status = filter_input(INPUT_POST, "status", FILTER_SANITIZE_STRING);
-    $content = filter_input(INPUT_POST, "content", FILTER_SANITIZE_SPECIAL_CHARS);
-    $errors = array();
-
-    $data = [
-        "title" => $title,
-        "status" => $status,
-        "content" => $content
-    ];
-    if (!count($errors)) {
-        $data["date"] = time();
-        $data["lastupdated"] = "";
-        $res = $dbpdo->add("member", $data);
-        print_r($res);
-        if ($res) {
-            setMsg("msg_notify", "Add Member successfully.", "success");
-            redirect("admin", "member_details", ["id" => $res]);
-        } else {
-            setMsg("form_data", $data);
-            setMsg("msg_notify", "Add Member failed.", "warning");
-            redirect("admin", "member_add");
-        }
-    } else {
-        setMsg("form_data", $data);
-        setMsg("errors", $errors);
-        redirect("admin", "member");
-    }
-}

+ 0 - 34
src/admin/controllers/member_details.php

@@ -1,34 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-
-if (empty($_GET["id"])) {
-    redirect("admin", "member");
-}
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$member_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING);
-
-if (empty($member_id)) {
-    setMsg("msg_notify", "The Member Not Found.", "error");
-    redirect("admin", "member");
-}
-
-$member = $dbpdo->find_and('users', ["id" => $member_id]);
-if ($member) {
-    $member_avatar = (!empty($member['image'])) ? '/clientarea/images/' . $member['image'] : "http://via.placeholder.com/150x150";
-    $member_reg_date = cTime($member['created_at']);
-} else {
-    setMsg("msg_notify", "The Member Not Found.", "warning");
-    redirect("admin", "member");
-}

+ 0 - 33
src/admin/controllers/member_edit.php

@@ -1,33 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-
-if (empty($_GET["id"])) {
-    redirect("admin", "member");
-}
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$member_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING);
-
-if (empty($member_id)) {
-    setMsg("msg_notify", "The Member Not Found.", "error");
-    redirect("admin", "member");
-}
-
-$member = $dbpdo->find_and('users', ["id" => $member_id]);
-if ($member) {
-    $member_avatar = (!empty($member['image'])) ? '/clientarea/images/' . $member['image'] : "http://via.placeholder.com/150x150";
-} else {
-    setMsg("msg_notify", "The Member Not Found.", "warning");
-    redirect("admin", "member");
-}

+ 0 - 22
src/admin/controllers/news.php

@@ -1,22 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-
-$news = [
-    "total" => 10,
-    "pages" => 4,
-    "page" => 1,
-    "list" => []
-];
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$news["list"] = $dbpdo->select_and("news");

+ 29 - 0
src/admin/controllers/news/add.php

@@ -0,0 +1,29 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (isset($_POST['submit'])) {
+    $data = array(
+        'news_subject' => post('subject'),
+        'news_content' => post('content'),
+        'news_status' => post('status'),
+        'news_date' => date('Y-m-d H:i:s'),
+    );
+
+    $resault = $DB->insert('news', $data);
+
+    if ($resault) {
+        setMessage('News added <b>successfully!</b>');
+    } else {
+        setMessage("Something went's <b>wrong!</b>", 'danger');
+    }
+    redirect('admin/news');
+} else {
+    $PageInfo['title'] = 'Add News';
+    $status_types = array(
+        "关闭",
+        "打开",
+    );
+
+    $load_editor = 1;
+}

+ 47 - 0
src/admin/controllers/news/edit.php

@@ -0,0 +1,47 @@
+<?php
+if (isset($_POST['submit'])) {
+    require '../../application.php';
+    $id = post('id');
+    if (!$id) {
+        setMessage('need field: id', 'danger');
+        redirect('admin/news');
+    }
+    $data = array(
+        'news_subject' => post('subject'),
+        'news_content' => post('content'),
+        'news_status' => post('status'),
+        'news_lastupdated' => date('Y-m-d H:i:s'),
+    );
+
+    $resault = $DB->update('news', $data, array('news_id' => $id));
+
+    if ($resault) {
+        setMessage('News update <b>successfully!</b>');
+    } else {
+        setMessage("Something went's <b>wrong!</b>", 'danger');
+    }
+    redirect('admin/news', '', array());
+}
+
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$id = get('id');
+
+if (empty($id)) {
+    redirect('admin/news');
+    exit();
+}
+
+$status_types = array(
+    '关闭',
+    '打开',
+);
+
+$news = null;
+
+if ($id > 0) {
+    $news = $DB->find('news', '*', array('news_id' => $id), null, 1);
+}
+$load_editor = 1;

+ 14 - 0
src/admin/controllers/news/list.php

@@ -0,0 +1,14 @@
+<?php
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$count = $DB->count('news');
+if ($count > 0) {
+    $rows = $DB->findAll('news', '*', array(), "`news_id` DESC");
+}
+
+$status_types = array(
+    "关闭",
+    "打开",
+);

+ 22 - 0
src/admin/controllers/news/view.php

@@ -0,0 +1,22 @@
+<?php
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$id = get('id');
+
+if (empty($id)) {
+    redirect('admin/news');
+    exit();
+}
+
+$status_types = array(
+    '关闭',
+    '打开',
+);
+
+$data = null;
+
+if ($id > 0) {
+    $data = $DB->find('news', '*', array('news_id' => $id), null, 1);
+}

+ 0 - 48
src/admin/controllers/news_add.php

@@ -1,48 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-$data = getMsg("form_data");
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$load_editor = true;
-
-if (isset($_POST["do_add_news"])) {
-    $title = filter_input(INPUT_POST, "title", FILTER_SANITIZE_STRING);
-    $status = filter_input(INPUT_POST, "status", FILTER_SANITIZE_STRING);
-    $content = filter_input(INPUT_POST, "content", FILTER_SANITIZE_SPECIAL_CHARS);
-    $errors = array();
-
-    $data = [
-        "title" => $title,
-        "status" => $status,
-        "content" => $content
-    ];
-    if (!count($errors)) {
-        $data["date"] = time();
-        $data["lastupdated"] = "";
-        $res = $dbpdo->add("news", $data);
-        print_r($res);
-        if ($res) {
-            setMsg("msg_notify", "Add News successfully.", "success");
-            redirect("admin", "news_details", ["id" => $res]);
-        } else {
-            setMsg("form_data", $data);
-            setMsg("msg_notify", "Add News failed.", "warning");
-            redirect("admin", "news_add");
-        }
-    } else {
-        setMsg("form_data", $data);
-        setMsg("errors", $errors);
-        redirect("admin", "news");
-    }
-}

+ 0 - 28
src/admin/controllers/news_details.php

@@ -1,28 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-$data = getMsg("form_data");
-
-if (empty($_GET["id"])) {
-    redirect("admin", "news");
-}
-
-$status_types = [
-    "关闭",
-    "打开"
-];
-
-$news_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING);
-$res = $dbpdo->find_and('news', ["id" => $news_id]);
-if ($res) {
-    $data = $res;
-} else {
-    setMsg("msg_notify", "The News Not found.", "warning");
-    redirect("admin", "news");
-}

+ 20 - 0
src/admin/controllers/profile/edit.php

@@ -0,0 +1,20 @@
+<?php
+if (isset($_POST['submit'])) {
+    require '../../application.php';
+    $data = array(
+        'admin_fname' => post('fname'),
+        'admin_lname' => post('lname')
+    );
+    $where = array(
+        'admin_key' => $AdminInfo['admin_key']
+    );
+
+    $resault = $DB->update('admin', $data, $where);
+    if ($resault) {
+        setMessage('Profile updated successfully !');
+    } else {
+        setMessage("Something went's wrong !", 'danger');
+    }
+    redirect('admin/profile');
+}
+

+ 43 - 0
src/admin/controllers/profile/forgetpassword.php

@@ -0,0 +1,43 @@
+<?php
+
+require_once __DIR__ . '/../../../core/application.php';
+
+if (isset($_SESSION['UIISC_ADMIN']) && $_SESSION['UIISC_ADMIN'] != 'NULL') {
+    setMessage('Your has been logged !', 'danger');
+    redirect('admin/index');
+}
+
+if (isset($_POST['reset'])) {
+    $post_mail = post('email');
+    if (empty($post_mail)) {
+        setMessage('need field: <b>email</b> !', 'danger');
+        redirect('admin/forgetpassword');
+    }
+
+    $AdminInfo = $DB->find('admin', 'admin_key, admin_fname', array('admin_email' => $post_mail), null, 1);
+    if ($AdminInfo) {
+        $TokenId = password_hash($AdminInfo['admin_key'], PASSWORD_DEFAULT);
+        $TokenData = [['token' => str_replace('$2y$10$', '', $TokenId), 'email' => $post_mail]];
+        $Token = base64_encode(json_encode($TokenData));
+
+        $EmailContent = '<p>You have requested a password reset.</p>';
+        $EmailDescription = '<div style="padding:1rem;background:#e6e6e6;overflow-x:auto;">' . $Token . '</div>';
+        $EmailDescription .= '<p><a href="' . setURL('admin/resetpassword') . '" target="_blank">Reset Password</a></p>';
+        $email_body = email_build_body('Reset Password', $AdminInfo['admin_fname'], $EmailContent, $EmailDescription);
+
+        send_mail(array(
+            'to' => $post_mail,
+            'message' => $email_body,
+            'subject' => 'Forget Password',
+        ));
+
+        setMessage('Email sent <b>successfully</b> !', 'success');
+        redirect('admin/resetpassword');
+    } else {
+        setMessage('Invalid <b>email</b> !', 'danger');
+    }
+    redirect('admin/forgetpassword');
+}
+
+$PageInfo['title'] = 'Forget Password';
+$PageInfo['rel'] = '<link href="' . $site_url . '/assets/css/login.css" rel="stylesheet" />';

+ 30 - 0
src/admin/controllers/profile/password.php

@@ -0,0 +1,30 @@
+<?php
+
+require '../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('405 / Method Not Allowed');
+}
+
+$FormData = array(
+    'old_password' => post('old_password'),
+    'new_password' => post('new_password'),
+    'hashed_password' => hash('sha256', post('new_password')),
+    'user_key' => $AdminInfo['admin_key'],
+    'user_password' => $AdminInfo['admin_password'],
+);
+
+if (hash('sha256', $FormData['old_password']) == $FormData['user_password']) {
+    $resault = $DB->update('admin', array('admin_password' => $FormData['hashed_password']), array('admin_key' => $FormData['user_key']));
+    if ($resault) {
+        setMessage('Password changed successfully !');
+        unset($_SESSION['UIISC_ADMIN']);
+        redirect('admin/login');
+    } else {
+        setMessage("Something went's wrong !", 'danger');
+        redirect('admin/settings');
+    }
+} else {
+    setMessage('Invalid user password !', 'danger');
+    redirect('admin/settings');
+}

+ 67 - 0
src/admin/controllers/profile/resetpassword.php

@@ -0,0 +1,67 @@
+<?php
+
+require_once __DIR__ . '/../../../core/application.php';
+
+if (isset($_SESSION['UIISC_ADMIN']) && $_SESSION['UIISC_ADMIN'] != 'NULL') {
+    setMessage('Your has been logged !', 'danger');
+    redirect('admin/index');
+}
+
+if (isset($_POST['reset'])) {
+    $post_token = post('token');
+    if (!$post_token) {
+        setMessage('Invalid reset <b>token</b> !', 'danger');
+        redirect('admin/resetpassword');
+    }
+    $new_password = post('password');
+    if (!$new_password) {
+        setMessage('Invalid <b>password</b> !', 'danger');
+        redirect('admin/resetpassword');
+    }
+
+    try {
+        $TokenInfo = json_decode(base64_decode($post_token));
+    } catch (Exception $e) {
+        setMessage('Invalid reset <b>token</b> !', 'danger');
+        redirect('admin/resetpassword');
+    }
+
+    $AdminEmail = $TokenInfo[0]->email;
+
+    $AdminInfo = $DB->find('admin', 'admin_key, admin_fname', array('admin_email' => $AdminEmail), null, 1);
+
+    if (!$AdminInfo) {
+        setMessage('Invalid reset <b>token</b> !', 'danger');
+        redirect('admin/resetpassword');
+    }
+
+    $Key = '$2y$10$' . $TokenInfo[0]->token;
+
+    if (password_verify($AdminInfo['admin_key'], $Key)) {
+        $hashed_password = hash('sha256', $new_password);
+        $result = $DB->update('admin', array('admin_password' => $hashed_password), array('admin_email' => $AdminEmail));
+        if ($result) {
+            $EmailContent = '<p>Your account password has been reset successfully. Please login to clientarea to use our services again.</p>';
+            $EmailDescription = '<p>Click <a href="' . setURL('admin/login') . '">here</a> to login.</p>';
+            $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 <b>successfully</b> !', 'success');
+            redirect('admin/login');
+        } else {
+            setMessage('Something went' . "'" . 's <b>wrong</b> !', 'danger');
+            redirect('admin/resetpassword');
+        }
+    } else {
+        setMessage('Invalid reset <b>token</b> !', 'danger');
+        redirect('admin/resetpassword');
+    }
+} else {
+    $PageInfo['title'] = 'Reset Password';
+    $PageInfo['rel'] = '<link href="' . $site_url . '/assets/css/login.css" rel="stylesheet" />';
+}

+ 5 - 0
src/admin/controllers/profile/view.php

@@ -0,0 +1,5 @@
+<?php
+
+$PageInfo['title'] = $lang->I18N('My Profile');
+
+require_once ROOT . '/core/library/userinfo.class.php';

+ 33 - 0
src/admin/controllers/settings/edit.php

@@ -0,0 +1,33 @@
+<?php
+
+require_once __DIR__ . '/../../application.php';
+
+if (isset($_POST['submit'])) {
+    $data = array(
+        'site_name' => 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 <b>successfully!</b>');
+    } else {
+        setMessage("Something went's <b>wrong!</b>", 'danger');
+    }
+    redirect('admin/settings');
+}

+ 10 - 0
src/admin/controllers/settings/view.php

@@ -0,0 +1,10 @@
+<?php
+
+// require_once ROOT . '/library/userinfo.class.php';
+
+$Statuses = array(
+    array('name' => 'Live', 'value' => '1'),
+    array('name' => 'Maintaince', 'value' => '0'),
+);
+
+$PageInfo['title'] = 'System Settings';

+ 25 - 0
src/admin/controllers/sitepro/edit.php

@@ -0,0 +1,25 @@
+<?php
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$data = array(
+    'builder_username' => post('username'),
+    'builder_password' => post('password')
+);
+
+$where = array(
+    'builder_id' => 'SITEPRO',
+);
+
+$resault = $DB->update('builder_api', $data, $where);
+
+if ($resault) {
+    setMessage('SitePro API updated <b>successfully!</b>');
+} else {
+    setMessage("Something went's <b>wrong!</b>", 'danger');
+}
+
+redirect('admin/settings', 'sitepro');

+ 9 - 0
src/admin/controllers/sitepro/view.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = 'SitePro Settings';
+
+$where = array(
+    'builder_id' => 'SITEPRO',
+);
+
+$SitePro = $DB->find('builder_api', '*', $where, null, 1);

+ 28 - 0
src/admin/controllers/smtp/edit.php

@@ -0,0 +1,28 @@
+<?php
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$data = array(
+    'smtp_host' => 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 <b>successfully!</b>');
+} else {
+    setMessage("Something went's <b>wrong!</b>", 'danger');
+}
+
+redirect('admin/settings', 'smtp');

+ 22 - 0
src/admin/controllers/smtp/test.php

@@ -0,0 +1,22 @@
+<?php
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$email = post('email');
+
+$resault = send_mail(array(
+    'to' => $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 <b>successfully</b> !');
+} else {
+    setMessage("Something went's <b>wrong!</b>", 'danger');
+}
+
+redirect('admin/settings', 'smtp');

+ 9 - 0
src/admin/controllers/smtp/view.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = 'SMTP Settings';
+
+$where = array(
+    'smtp_key' => 'SMTP',
+);
+
+$SMTPInfo = $DB->find('smtp', '*', $where, null, 1);

+ 25 - 0
src/admin/controllers/sslapi/edit.php

@@ -0,0 +1,25 @@
+<?php
+require_once __DIR__ . '/../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Method Not Allowed');
+}
+
+$data = array(
+    'api_username' => post('username'),
+    'api_password' => post('password'),
+);
+
+$where = array(
+    'api_key' => 'FREESSL',
+);
+
+$resault = $DB->update('ssl_api', $data, $where);
+
+if ($resault) {
+    setMessage('SSL API updated <b>successfully!</b>');
+} else {
+    setMessage("Something went's <b>wrong!</b>", 'danger');
+}
+
+redirect('admin/settings', 'sslapi');

+ 9 - 0
src/admin/controllers/sslapi/view.php

@@ -0,0 +1,9 @@
+<?php
+
+$PageInfo['title'] = 'SSL API Settings';
+
+$where = array(
+    'api_key' => 'FREESSL'
+);
+
+$SSLApi = $DB->find('ssl_api', '*', $where, null, 1);

+ 18 - 0
src/admin/controllers/sslcert/list.php

@@ -0,0 +1,18 @@
+<?php
+
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$PageInfo['title'] = 'SSL Certificates';
+
+$count = $DB->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']);
+}

+ 33 - 0
src/admin/controllers/sslcert/view.php

@@ -0,0 +1,33 @@
+<?php
+
+$ssl_id = get('ssl_id');
+
+require_once ROOT . '/core/handler/SSLHandler.php';
+require_once ROOT . '/modules/GoGetSSL/GoGetSSLApi.php';
+
+$apiClient = new GoGetSSLApi();
+$token = $apiClient->auth($SSLApi['api_username'], $SSLApi['api_password']);
+
+$SSLInfo = $apiClient->getOrderStatus($ssl_id);
+
+if ($SSLInfo['status'] == 'processing') {
+    $Status = '<span class="badge bg-primary">Processing</span>';
+} elseif ($SSLInfo['status'] == 'active') {
+    $Status = '<span class="badge bg-success">Active</span>';
+} elseif ($SSLInfo['status'] == 'incomplete') {
+    $Status = '<span class="badge bg-danger">Incomplete</span>';
+} elseif ($SSLInfo['status'] == 'cancelled') {
+    $Status = '<span class="badge bg-">Cancelled</span>';
+} elseif ($SSLInfo['status'] == 'expired') {
+    $Status = '<span class="badge bg-danger">Expired</span>';
+} else {
+    $Status = '';
+}
+
+if (empty($SSLInfo['begin_date'])) {
+    $Begin = '-- -- ----';
+    $End = $Begin;
+} else {
+    $Begin = $SSLInfo['begin_date'];
+    $End = $SSLInfo['end_date'];
+}

+ 0 - 26
src/admin/controllers/tickets.php

@@ -1,26 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-$data = getMsg("form_data");
-
-$tickets = [
-    "total" => 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");

+ 48 - 0
src/admin/controllers/tickets/close.php

@@ -0,0 +1,48 @@
+<?php
+
+require __DIR__ . '/../../application.php';
+
+$ticket_id = get('ticket_id');
+
+if (!$ticket_id) {
+    exit('Access Denied');
+}
+
+// 查找工单信息
+$TicketInfo = $DB->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'],
+        '<p>The ticket ("' . $ticket_id . '") had been closed.</p>',
+        '<p>Click <a href="' . $ticket_url . '" target="_blank">here</a> for details.</p>'
+    );
+
+    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));

+ 9 - 0
src/admin/controllers/tickets/list.php

@@ -0,0 +1,9 @@
+<?php
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$count = $DB->count('tickets');
+if ($count > 0) {
+    $rows = $DB->findAll('tickets', '*', array(), "`ticket_id` DESC");
+}

+ 64 - 0
src/admin/controllers/tickets/reply.php

@@ -0,0 +1,64 @@
+<?php
+
+require '../../application.php';
+
+if (!isset($_POST['submit'])) {
+    exit('Access Denied');
+}
+
+$ticket_id = post('ticket_id');
+
+if (!$ticket_id) {
+    exit('Access Denied');
+}
+
+$TicketInfo = $DB->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 = '<p>You have received a reply from Support Staff.</p>';
+        $EmailDescription = '<a href="' . $ticket_url . '" target="_blank">View Ticket</a>';
+        $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 <b>successfully!</b>');
+    } else {
+        setMessage("Something went's <b>wrong!</b>", 'danger');
+    }
+} else {
+    setMessage("Something went's <b>wrong!</b>", 'danger');
+}
+
+redirect('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id));

+ 16 - 0
src/admin/controllers/tickets/view.php

@@ -0,0 +1,16 @@
+<?php
+if (!defined('IN_CRONLITE')) {
+    exit('Access Denied');
+}
+
+$ticket_id = get('ticket_id', 0);
+
+if ($ticket_id > 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;
+}

+ 0 - 74
src/admin/controllers/tickets_details.php

@@ -1,74 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-
-$err = getMsg("errors");
-$data = getMsg("form_data");
-$load_editor = true;
-$ticket_types = [
-    "技术支持", "销售财务", "管理员信箱"
-];
-$status_types = [
-    "关闭",
-    "打开"
-];
-if (empty($_GET["id"])) {
-    redirect("admin", "tickets");
-}
-$tickets_id = filter_input(INPUT_GET, "id", FILTER_SANITIZE_STRING);
-
-$res = $dbpdo->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]);
-    }
-}

+ 7 - 0
src/admin/forgetpassword.php

@@ -0,0 +1,7 @@
+<?php
+
+require_once __DIR__ . '/../core/application.php';
+require_once __DIR__ . '/controllers/profile/forgetpassword.php';
+require_once __DIR__ . '/views/common/header.php';
+require_once __DIR__ . '/views/profile/forgetpassword.php';
+require_once __DIR__ . '/views/common/footer.php';

+ 8 - 1
src/admin/index.php

@@ -1,2 +1,9 @@
 <?php
-header("Location: ../admin.php");
+
+require_once __DIR__ . '/application.php';
+require_once __DIR__ . '/controllers/dashboard/view.php';
+require_once __DIR__ . '/views/common/header.php';
+require_once __DIR__ . '/views/common/navbar.php';
+require_once __DIR__ . '/views/common/sidebar.php';
+require_once __DIR__ . '/views/dashboard/view.php';
+require_once __DIR__ . '/views/common/footer.php';

+ 18 - 0
src/admin/knowledgebase.php

@@ -0,0 +1,18 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view'))) {
+    $action = 'list';
+}
+
+$PageInfo['title'] = 'Knowledgebase ' . ucfirst($action);
+
+require __DIR__ . '/controllers/knowledgebase/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/knowledgebase/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 0 - 28
src/admin/library.php

@@ -1,28 +0,0 @@
-<?php
-
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../admin.php");
-    exit;
-}
-
-function isAdminLoggedIn()
-{
-    if (isset($_SESSION["adminloggedin"]) && $_SESSION["adminloggedin"] == true) {
-        return true;
-    } else {
-        return false;
-    }
-}
-
-function adminLogout()
-{
-    if (isset($_COOKIE["adminloggedin"])) {
-        setcookie("adminloggedin", "", time() - (86400 * 30), "/");
-    }
-
-    if (isset($_SESSION["adminloggedin"])) {
-        unset($_SESSION["adminloggedin"]);
-    }
-    // session_destroy();
-}

+ 14 - 0
src/admin/login.php

@@ -0,0 +1,14 @@
+<?php
+
+require_once __DIR__ . '/../core/application.php';
+
+if (isset($_SESSION['UIISC_ADMIN'])) {
+    header('location: index.php');
+}
+
+$PageInfo['title'] = $lang->I18N('login');
+$PageInfo['rel'] = '<link href="' . $site_url . '/assets/css/login.css" rel="stylesheet" />';
+
+require_once __DIR__ . '/views/common/header.php';
+require_once __DIR__ . '/views/login/login.php';
+require_once __DIR__ . '/views/common/footer.php';

+ 2 - 0
src/admin/logout.php

@@ -0,0 +1,2 @@
+<?php
+include __DIR__ . '/controllers/login/logout.php';

+ 18 - 0
src/admin/news.php

@@ -0,0 +1,18 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view'))) {
+    $action = 'list';
+}
+
+$PageInfo['title'] = 'News ' . ucfirst($action);
+
+require __DIR__ . '/controllers/news/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/news/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 16 - 0
src/admin/profile.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'view');
+
+if (!in_array($action, array('edit', 'view'))) {
+    $action = 'view';
+}
+
+require __DIR__ . '/controllers/profile/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/profile/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 7 - 0
src/admin/resetpassword.php

@@ -0,0 +1,7 @@
+<?php
+
+require_once __DIR__ . '/../core/application.php';
+require_once __DIR__ . '/controllers/profile/resetpassword.php';
+require_once __DIR__ . '/views/common/header.php';
+require_once __DIR__ . '/views/profile/resetpassword.php';
+require_once __DIR__ . '/views/common/footer.php';

+ 22 - 0
src/admin/settings.php

@@ -0,0 +1,22 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$section = get('s', 'settings');
+$action = get('action', 'view');
+
+if (!in_array($section, array('settings', 'hosting', 'domain', 'sslapi', 'smtp', 'sitepro'))) {
+    $section = 'settings';
+}
+
+if (!in_array($action, array('edit', 'view'))) {
+    $action = 'view';
+}
+
+require __DIR__ . '/controllers/' . $section . '/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/settings/menu.php';
+require __DIR__ . '/views/' . $section . '/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 16 - 0
src/admin/sslcert.php

@@ -0,0 +1,16 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view'))) {
+    $action = 'list';
+}
+
+require __DIR__ . '/controllers/sslcert/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/sslcert/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 20 - 0
src/admin/tickets.php

@@ -0,0 +1,20 @@
+<?php
+
+require_once __DIR__ . '/application.php';
+require_once ROOT . '/core/library/userinfo.class.php';
+require_once ROOT . '/core/library/tickets.php';
+
+$action = get('action', 'list');
+
+if (!in_array($action, array('list', 'add', 'edit', 'view'))) {
+    $action = 'list';
+}
+
+$PageInfo['title'] = 'Tckets ' . ucfirst($action);
+
+require __DIR__ . '/controllers/tickets/' . $action . '.php';
+require __DIR__ . '/views/common/header.php';
+require __DIR__ . '/views/common/navbar.php';
+require __DIR__ . '/views/common/sidebar.php';
+require __DIR__ . '/views/tickets/' . $action . '.php';
+require __DIR__ . '/views/common/footer.php';

+ 0 - 33
src/admin/views/account_active.php

@@ -1,33 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Activate</h2>
-            <form action="" method="POST">
-                <label>
-                    <span>Account: <small>(It is the 8 characters)</small></span>
-                    <input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
-                </label>
-                <button type="submit" name="do_activate_account" class="btn btn-primary">Save Settings</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 53
src/admin/views/account_add.php

@@ -1,53 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Add</h2>
-            <form action="" method="POST">
-                <label>
-                    <span>Account:</span>
-                    <input type="text" name="username" value="" class="form-control" maxlength="8" placeholder="Account of 8 characters">
-                </label>
-                <label>
-                    <span>Password:</span>
-                    <input type="password" name="password" value="" class="form-control" maxlength="35" placeholder="Password">
-                </label>
-                <label>
-                    <span>Domain or Sub-domain:</span>
-                    <input type="text" name="domain" value="" class="form-control" maxlength="35" placeholder="example.com">
-                </label>
-                <label>
-                    <span>Email Address:</span>
-                    <input type="text" name="email" value="" class="form-control" maxlength="35" placeholder="email@example.com">
-                </label>
-                <label>
-                    <span>Select a Hosting Plan:</span>
-                    <select name="plan" class="form-control">
-                        <?php foreach ($config['plan'] as $key => $value) { ?>
-                            <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
-                        <?php } ?>
-                    </select>
-                </label>
-                <button type="submit" name="do_reg_account" class="btn btn-primary">Register Account</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 37
src/admin/views/account_disable.php

@@ -1,37 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Suspend</h2>
-            <form action="" method="POST">
-                <label>
-                    <span>Account: <small>(It is the 8 characters)</small></span>
-                    <input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
-                </label>
-                <label>
-                    <span>Reason for deactivation:</span>
-                    <input type="text" name="reason" class="form-control" maxlength="60" placeholder="Reason or some message">
-                </label>
-                <button type="submit" name="do_disable_account" class="btn btn-primary">Save Settings</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 33
src/admin/views/account_domain.php

@@ -1,33 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Domains</h2>
-            <form action="" method="POST">
-                <label>
-                    <span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
-                    <input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
-                </label>
-                <button type="submit" name="do_get_domains" class="btn btn-primary">View Domain</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 65
src/admin/views/account_list.php

@@ -1,65 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account List</h2>
-            <div class="table-responsive">
-                <table class="table table-bordered table-hover">
-                    <thead>
-                        <tr>
-                            <th>#</th>
-                            <th>Branch</th>
-                            <th>Account</th>
-                            <th>Username</th>
-                            <th>Email</th>
-                            <th>Domain</th>
-                            <th>Plan</th>
-                            <th>Password</th>
-                            <th>Nameserver</th>
-                            <th>Operate</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <?php foreach ($member as $key => $value) { ?>
-                            <tr>
-                                <th><?php echo $key + 1; ?></th>
-                                <td><?php echo $value["branch"]; ?></td>
-                                <td><?php echo $value["account"]; ?></td>
-                                <td><?php echo $value["username"]; ?></td>
-                                <td><?php echo $value["email"]; ?></td>
-                                <td><?php echo implode(",", $value["domain"]); ?></td>
-                                <td><?php echo $value["plan"]; ?></td>
-                                <td><?php echo $value["password"]; ?></td>
-                                <td><?php echo implode(",", $value["nameserver"]); ?></td>
-                                <td style="width: 206px;">
-                                    <a class="btn btn-default btn-xs" href="#" role="button"><?php echo $lang->I18N('login'); ?></a>
-                                    <button class="btn btn-default btn-xs" type="submit">View</button>
-                                    <button class="btn btn-default btn-xs" type="submit">Active</button>
-                                    <button class="btn btn-default btn-xs" type="submit">Disable</button>
-                                </td>
-                            </tr>
-                        <?php } ?>
-                    </tbody>
-                </table>
-            </div>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 38
src/admin/views/account_password.php

@@ -1,38 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Password</h2>
-            <form action="" method="POST">
-                <!-- Reset Password -->
-                <label>
-                    <span>Account: <small>(It is the 8 characters)</small></span>
-                    <input type="text" name="username" class="form-control" maxlength="8" placeholder="Account: (It is the 8 characters)">
-                </label>
-                <label>
-                    <span>New Password:</span>
-                    <input type="password" name="password" class="form-control" maxlength="35" placeholder="Password">
-                </label>
-                <button type="submit" name="do_set_password" class="btn btn-primary">Set Password</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 0 - 33
src/admin/views/account_status.php

@@ -1,33 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <h2>Account Status</h2>
-            <form action="" method="POST">
-                <label>
-                    <span>VistaPanel Username: <small>(Example: uii_12345678)</small></span>
-                    <input type="text" name="username" class="form-control" maxlength="18" placeholder="VPanel Username (Example: uii_12345678)">
-                </label>
-                <button type="submit" name="do_check_status" class="btn btn-primary">Check Status</button>
-            </form>
-            <?php if ($message) { ?>
-                <hr />
-                <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                    <p><?php echo $message[1]; ?></p>
-                    <?php if (isset($message[2]) && ($message[2])) {
-                        echo "<p>response data:</p><pre>";
-                        print_r($message[2]);
-                        echo "</pre>";
-                    } ?>
-                </div>
-            <?php } ?>
-        </div>
-    </div>
-</div>

+ 94 - 0
src/admin/views/accounts/edit.php

@@ -0,0 +1,94 @@
+<div class="container-fluid">
+    <div class="card py-0">
+        <div class="d-flex justify-content-between align-items-center pt-15">
+            <h5 class="m-0">Hosting Account Settings</h5>
+            <a href="accounts.php?action=view&account_id=<?php echo $account_id; ?>" class="btn btn-danger btn-sm">
+                <i class="fa fa-backward"></i> <?php echo $lang->I18N('Return'); ?>
+            </a>
+        </div>
+        <hr>
+        <div class="mb-15">
+            <div class="row">
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label required">Name</label>
+                        <input type="text" value="<?php echo $ClientInfo['hosting_client_fname'] . ' ' . $ClientInfo['hosting_client_lname']; ?>" class="form-control disabled" readonly>
+                    </div>
+                </div>
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label required">Email</label>
+                        <input type="text" value="<?php echo $ClientInfo['hosting_client_email']; ?>" class="form-control disabled" readonly>
+                    </div>
+                </div>
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label required">Phone Number</label>
+                        <input type="text" value="<?php echo $ClientInfo['hosting_client_phone']; ?>" class="form-control disabled" readonly>
+                    </div>
+                </div>
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label required">Billing Address</label>
+                        <input type="text" value="<?php echo $ClientInfo['hosting_client_address']; ?>" class="form-control disabled" readonly>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-12"><hr></div>
+        <?php if ($AccountInfo['account_status'] == '1'): ?>
+            <form class="row" action="controllers/accounts/password.php" method="post">
+                <input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label required">New Password</label>
+                        <input type="password" name="new_password" placeholder="New password here..." class="form-control">
+                    </div>
+                </div>
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label">&nbsp;</label>
+                        <button type="submit" name="submit" class="form-control btn btn-primary btn-sm text-white">Change Password</button>
+                    </div>
+                </div>
+                <!-- <div class="col-md-12">
+                    <div class="mb-10 px-10">
+                        <input type="submit" name="submit" value="Change Password" class="btn btn-primary btn-sm text-white">
+                    </div>
+                </div> -->
+            </form>
+            <hr>
+            <form
+                action="controllers/accounts/deactivate.php"
+                method="post"
+                onsubmit="
+                    var reason = document.getElementsByName('reason')[0].value;
+                    if (reason.length < 8) {
+                        alert('Reason must be 8 characters long...');
+                        return false;
+                    }
+                    return true;
+            ">
+                <div class="mb-10 px-10">
+                    <label class="form-label required">Deacivation Reason</label>
+                    <textarea name="reason" placeholder="Deactivation reason here..." class="form-control" id="reason"></textarea>
+                    <div class="text-muted my-10 alert alert-secondary">Your account will be deleted after 30 days of your account deactivation and all of the account data will be removed completely(This action cannot be undo).</div>
+                    <input type="hidden" name="account_id" value="<?php echo $AccountInfo['account_id']; ?>">
+                </div>
+                <div class="mb-10 px-10">
+                    <input type="submit" name="submit" value="Deactivate Account" class="btn btn-danger btn-sm text-white">
+                </div>
+            </form>
+        <?php else: ?>
+            <form class="row" action="controllers/accounts/reactivate.php" method="post">
+                <input type="hidden" name="account_id" value="<?php echo $account_id; ?>">
+                <div class="col-md-6">
+                    <div class="mb-10 px-10">
+                        <label class="form-label">Activate Account</label>
+                        <button type="submit" name="submit" class="btn btn-success text-white btn-block my-5 btn-rounded">Activate Account</button>
+                    </div>
+                </div>
+            </form>
+        <?php endif;?>
+        </div>
+    </div>
+</div>

+ 57 - 0
src/admin/views/accounts/list.php

@@ -0,0 +1,57 @@
+<div class="container-fluid">
+    <div class="card py-0">
+        <div class="d-flex justify-content-between align-items-center pt-15">
+            <h5 class="m-0"><?php echo $PageInfo['title']; ?></h5>
+            <a href="index.php" class="btn text-white btn-danger btn-sm">
+                <i class="fa fa-backward"></i> <?php echo $lang->I18N('Return'); ?>
+            </a>
+        </div>
+        <hr />
+        <div class="table-responsive">
+            <table class="table table-stripped">
+                <thead>
+                    <th width="5%">ID</th>
+                    <th width="40%">Username</th>
+                    <th width="30%">Domain</th>
+                    <th width="5%">Deploy Date</th>
+                    <th width="5%">Status</th>
+                    <th width="5%">Action</th>
+                </thead>
+                <tbody>
+<?php if ($count > 0): ?>
+    <?php foreach ($rows as $row): ?>
+                    <tr>
+                        <td># <?php $row['account_id'];?></td>
+                        <td><?php echo $row['account_username']; ?></td>
+                        <td><?php echo $row['account_domain']; ?></td>
+                        <td><?php echo $row['account_date']; ?></td>
+                        <td><?php
+if ($row['account_status'] == '0') {
+    $btn = ['danger', 'lock'];
+    echo '<span class="badge bg-danger text-white border-0">Inactive</span>';
+} elseif ($row['account_status'] == '1') {
+    $btn = ['success', 'globe'];
+    echo '<span class="badge bg-success border-0 text-white">Active</span>';
+} elseif ($row['account_status'] == '2') {
+    $btn = ['danger', 'lock'];
+    echo '<span class="badge bg-danger text-white border-0">Suspended</span>';
+}
+?></td>
+                        <td>
+                            <a href="accounts.php?action=view&account_id=<?php echo $row['account_id']; ?>" class="btn btn-sm btn-<?php echo $btn[0]; ?> btn-rounded">
+                                <i class="fa fa-<?php echo $btn[1]; ?>"></i> Manage
+                            </a>
+                        </td>
+                    </tr>
+    <?php endforeach;?>
+<?php else: ?>
+                    <tr>
+                        <td colspan="6" class="text-center">Nothing found</td>
+                    </tr>
+<?php endif;?>
+                </tbody>
+            </table>
+        </div>
+        <p class="pb-10"><?php echo $count; ?> Records Founds</p>
+    </div>
+</div>

+ 25 - 0
src/admin/views/accounts/login.php

@@ -0,0 +1,25 @@
+<div class="container-fluid">
+    <div class="card py-0">
+        <div class="d-flex justify-content-between align-items-center pt-15">
+            <h5 class="m-0">cPanel Login</h5>
+            <a href="accounts.php?action=view&account_id=<?php echo $account_id; ?>" class="btn btn-danger btn-sm">
+                <i class="fa fa-backward"></i> <?php echo $lang->I18N('Return'); ?>
+            </a>
+        </div>
+        <hr>
+        <div class="mb-15">
+            <p>Now you are going to be redirected to the control panel. It can take upto 5 seconds based on your internet connecion speed.</p>
+            <form name="login" action="https://<?php echo $HostingApi['api_cpanel_url'] ?>/login.php" id="account_ogin" method="post">
+                <input type="hidden" name="uname" value="<?php echo $AccountInfo['account_username']; ?>">
+                <input type="hidden" name="passwd" value="<?php echo $AccountInfo['account_password']; ?>">
+                <input type="hidden" name="language" value="<?php echo $lang->get_language_value(); ?>">
+                <div class="text-center">
+                    <input type="submit" name="Submit" value="Click here to Redirect" class="btn btn-primary btn-sm text-white">
+                </div>
+            </form>
+        </div>
+    </div>
+</div>
+<script type="text/javascript">
+    document.getElementById('account_ogin').submit(); // SUBMIT FORM
+</script>

+ 127 - 0
src/admin/views/accounts/view.php

@@ -0,0 +1,127 @@
+<div class="container-fluid">
+    <div class="card py-0">
+        <div class="d-flex justify-content-between align-items-center pt-15">
+            <h5 class="m-0">Viewing Account (# <?php echo $account_id; ?>)</h5>
+            <a href="accounts.php" class="btn btn-sm btn-danger">
+                <i class="fa fa-backward"></i> <?php echo $lang->I18N('Return'); ?>
+            </a>
+        </div>
+        <hr>
+    <?php if ($AccountInfo['account_status'] == '0'): ?>
+        <div class="alert alert-secondary col-md-12">This account is inactive.</div>
+    <?php elseif ($AccountInfo['account_status'] == '2'): ?>
+        <div class="alert alert-secondary col-md-12">This account has been suspended.</div>
+    <?php endif;?>
+        <div class="row pb-10">
+            <div class="col-md-12">
+                <div class="row">
+                    <div class="col-md-4 px-5 text-center py-15">
+                        <i class="fa fa-laptop fa-10x"></i>
+                    </div>
+                    <div class="col-md-4 offset-md-4 px-20 py-5 text-center text-md-right">
+                    <?php if ($AccountInfo['account_status'] == '1'): ?>
+                        <a href="accounts.php?action=login&account_id=<?php echo $account_id; ?>" target="_blank" class="btn btn-success text-white btn-block my-5 btn-rounded">Control Panel</a>
+                        <a href="accounts.php?action=goftp&account_id=<?php echo $account_id; ?>" target="_blank" class="btn btn-primary text-white btn-block my-5 btn-rounded">File Manager</a>
+                    <?php else: ?>
+                        <button class="btn btn-success text-white btn-block my-5 btn-rounded disabled">Control Panel</button>
+                        <button class="btn btn-primary text-white btn-block my-5 btn-rounded disabled">File Manager</button>
+                    <?php endif;?>
+                        <a href="accounts.php?action=edit&account_id=<?php echo $account_id; ?>" class="btn btn-secondary btn-block my-5 btn-rounded">Edit Settings</a>
+                    </div>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Cpanel Username:</b>
+                    <span><?php echo $AccountInfo['account_username']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Cpanel Password:</b>
+                    <span><kbd><?php echo $AccountInfo['account_password']; ?></kbd></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Main Domain:</b>
+                    <span><?php echo $AccountInfo['account_domain']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Cpanel Domain:</b>
+                    <span><?php echo $HostingApi['api_cpanel_url']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Status:</b>
+                    <span>
+                        <?php if ($AccountInfo['account_status'] == '0') {
+    echo '<span class="badge bg-secondary">Inactive</span>';
+} elseif ($AccountInfo['account_status'] == '1') {
+    echo '<span class="badge bg-success">Active</span>';
+} elseif ($AccountInfo['account_status'] == '2') {
+    echo '<span class="badge bg-danger">Suspend</span>';
+}?>
+                    </span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Creation Date:</b>
+                    <span><?php echo $AccountInfo['account_date']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Server IP:</b>
+                    <span><?php echo $HostingApi['api_server_ip']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Your IP:</b>
+                    <span><?php echo UserInfo::get_ip() ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>FTP Hostname:</b>
+                    <span><?php echo str_replace('cpanel', 'ftp', $HostingApi['api_cpanel_url']) ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>FTP Port:</b>
+                    <span>21</span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>MySQL Hostname:</b>
+                    <span><?php echo str_replace('cpanel', 'sqlxxx', $HostingApi['api_cpanel_url']) ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Mysql Port:</b>
+                    <span>3306</span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Nameserver 1:</b>
+                    <span><?php echo $HostingApi['api_ns_1']; ?></span>
+                </div>
+            </div>
+            <div class="col-md-6">
+                <div class="d-flex justify-content-between align-items-center m-5">
+                    <b>Nameserver 2:</b>
+                    <span><?php echo $HostingApi['api_ns_2']; ?></span>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 0 - 45
src/admin/views/check_domain.php

@@ -1,45 +0,0 @@
-<?php
-if (!defined('IN_CRONLITE')) {
-    // exit('禁止访问');
-    header("Location: ../../admin.php");
-    exit;
-}
-?>
-<?php echo getMsg("msg_notify"); ?>
-<div class="container">
-    <div class="row">
-        <div class="col-md-12 col-sm-12">
-            <div class="panel panel-default">
-                <div class="panel-heading">
-                    <h3 class="panel-title">Check Domain</h3>
-                </div>
-                <div class="panel-body">
-                    <h2>Check Domain</h2>
-                    <form action="" method="POST">
-                        <p>Verify the domain is available for registration</p>
-                        <label>
-                            <!-- <span>Account:</span> -->
-                            <input type="text" name="domain" class="form-control" maxlength="50" placeholder="Enter a domain or sub-domain">
-                        </label>
-                        <button type="submit" name="do_check_domain" class="btn btn-primary">Verify domain</button>
-                    </form>
-                    <?php if ($message) { ?>
-                        <hr />
-                        <div class="alert <?php echo empty($message[0]) ? 'alert-danger' : 'alert-success'; ?>">
-                            <p><?php echo $message[1]; ?></p>
-                            <?php if (isset($message[2]) && ($message[2])) {
-                                echo "<p>response data:</p><pre>";
-                                print_r($message[2]);
-                                echo "</pre>";
-                            } ?>
-                        </div>
-                    <?php } ?>
-                </div>
-                <div class="panel-footer">
-                    <a href="<?php echo setRouter('clientarea', 'forget_password'); ?>" class="btn btn-link"><?php echo $lang->I18N('password_lost'); ?></a>
-                    <a href="<?php echo setRouter('clientarea', 'register'); ?>" class="btn btn-link">No account? Register</a>
-                </div>
-            </div>
-        </div>
-    </div>
-</div>

+ 51 - 0
src/admin/views/clients/list.php

@@ -0,0 +1,51 @@
+<div class="container-fluid">
+    <div class="card py-0">
+        <div class="d-flex justify-content-between align-items-center pt-15">
+            <h5 class="m-0">My Clients</h5>
+            <a href="index.php" class="btn text-white btn-danger btn-sm"><i class="fa fa-backward"></i> <?php echo $lang->I18N('Return'); ?></a>
+        </div>
+        <hr>
+        <div class="table-responsive">
+            <table class="table table-stripped">
+                <thead>
+                    <th width="5%">ID</th>
+                    <th width="10%">Name</th>
+                    <th width="40%">Email</th>
+                    <th width="10%">Date</th>
+                    <th width="10%">Status</th>
+                    <th width="10%">Action</th>
+                </thead>
+                <tbody>
+<?php if ($count > 0): ?>
+    <?php foreach ($rows as $value): ?>
+                    <tr>
+                        <td># <?php echo $value['hosting_client_id']; ?></td>
+                        <td><?php echo $value['hosting_client_fname'] . " " . $value['hosting_client_lname']; ?></td>
+                        <td><?php echo $value['hosting_client_email']; ?></td>
+                        <td><?php echo $value['hosting_client_date']; ?></td>
+                        <td><?php
+if ($value['hosting_client_status'] == '0') {
+    $btn = ['secondary', 'cog'];
+    echo '<span class="badge bg-secondary badge-pill">Inactive</span>';
+} elseif ($value['hosting_client_status'] == '1') {
+    $btn = ['success', 'globe'];
+    echo '<span class="badge bg-success badge-pill">Active</span>';
+} elseif ($value['hosting_client_status'] == '2') {
+    $btn = ['danger', 'lock'];
+    echo '<span class="badge bg-danger badge-pill">Suspended</span>';
+}
+?></td>
+                        <td><a href="clients.php?action=view&client_id=<?php echo $value['hosting_client_id']; ?>" class="btn btn-sm btn-<?php echo $btn[0] ?> btn-rounded"><i class="fa fa-<?php echo $btn[1]; ?>"></i> Manage</a></td>
+                    </tr>
+    <?php endforeach;?>
+<?php else: ?>
+                    <tr>
+                        <td colspan="6" class="text-center">Nothing found</td>
+                    </tr>
+<?php endif;?>
+                </tbody>
+            </table>
+        </div>
+        <p class="pb-10"><?php echo $count; ?> Records Founds</p>
+    </div>
+</div>

Vissa filer visades inte eftersom för många filer har ändrats