Compare commits
31 commits
Author | SHA1 | Date | |
---|---|---|---|
|
ecc42caf98 | ||
|
28c9ef0a2a | ||
|
2cd4637d26 | ||
|
3df3d25422 | ||
|
663ea7dd4d | ||
|
a3374a79da | ||
|
60169378f7 | ||
|
7fe0145c72 | ||
|
a7f7814e74 | ||
|
9eee69b7fc | ||
|
87929ce135 | ||
|
097726c785 | ||
|
589d349226 | ||
|
2b3178cb4e | ||
|
a3b34f5745 | ||
|
f154e90369 | ||
|
48ae5ead66 | ||
|
242662fd83 | ||
|
63cc6c5fcb | ||
|
78197bce95 | ||
|
50d96ae9f6 | ||
|
0d02973801 | ||
|
12ea496427 | ||
|
9865fd6891 | ||
|
ca2ed7ae4f | ||
|
be8350320b | ||
|
feae9a1482 | ||
|
778babe4b1 | ||
|
7a4beecbbd | ||
|
4803990aa6 | ||
|
eecaa0d673 |
707 changed files with 45434 additions and 13100 deletions
7
.editorconfig
Normal file
7
.editorconfig
Normal file
|
@ -0,0 +1,7 @@
|
|||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 300
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
.DS_Store
|
||||
Thumbs.db
|
||||
test/
|
8
.prettierrc
Normal file
8
.prettierrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"eslintIntegration": true,
|
||||
"tabWidth": 4,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 300,
|
||||
"semi": false
|
||||
}
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, doudoudzj
|
||||
Copyright (c) 2018 - present, Jackson Dou
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
40
README.md
40
README.md
|
@ -1,17 +1,18 @@
|
|||
# uiisc.com
|
||||
# UIISC
|
||||
|
||||
A simple Content Management System for Reseller of MyOwnFreeHost
|
||||
An Open Source Web Hosting Account and Support Management System for MyOwnFreeHost
|
||||
|
||||
* Official Site : [uiisc.com](http://uiisc.com "UIISC")
|
||||
* Author : [doudoudzj](https://github.com/doudoudzj "doudoudzj")
|
||||
- Demo : [demo.uiisc.com](http://demo.uiisc.com)
|
||||
- Official Site : [uiisc.org](http://uiisc.org "UIISC")
|
||||
- Author : [Jackson Dou](https://github.com/jksdou "Jackson Dou")
|
||||
|
||||
## Functions
|
||||
|
||||
### multi-language module
|
||||
|
||||
- [x] Load default language
|
||||
- [x] Load default language config (/core/language/)
|
||||
- [x] Change language
|
||||
|
||||
- [x] Load custom language config (/data/language/)
|
||||
|
||||
### ClientArea module
|
||||
|
||||
|
@ -19,46 +20,41 @@ A simple Content Management System for Reseller of MyOwnFreeHost
|
|||
- [x] Account verification
|
||||
- [x] Account cancellation
|
||||
- [x] Email verification
|
||||
- [x] Login / Logout
|
||||
- [x] Profile modification
|
||||
- [x] Forget / Reset / Change password
|
||||
- [ ] Apply for a web hosting account
|
||||
- [ ] Hosting account deletion / deactivation
|
||||
- [ ] Login to hosting control panel
|
||||
- [x] Login / Logout, Forget / Reset / Change password
|
||||
- [x] Apply for a web hosting account
|
||||
- [x] Web hosting account deletion / deactivation
|
||||
- [x] Login to web hosting control panel
|
||||
|
||||
### admin module
|
||||
### AdminArea module
|
||||
|
||||
- [x] Verify if a domain is available
|
||||
- [x] Creation of account hosting from the panel
|
||||
- [x] Creation of hosting account
|
||||
- [x] Change password to hosting account
|
||||
- [x] Deactivate or disable a hosting account
|
||||
- [x] Activate or enable hosting account
|
||||
- [x] Verify how many domain and state of the hosting account
|
||||
- [ ] Members management
|
||||
- [ ] Site configuration
|
||||
- [ ] API configuration
|
||||
- [ ] News management
|
||||
- [x] Members management
|
||||
- [x] Site configuration
|
||||
- [x] API configuration
|
||||
- [x] multi hosting provider management
|
||||
- [x] News management
|
||||
- [ ] Translation file management
|
||||
|
||||
### forum module
|
||||
|
||||
- [ ] Add/edit/delete posts
|
||||
|
||||
|
||||
## Screenshot
|
||||
|
||||
##### <u>Solution Page</u>
|
||||
|
||||
>
|
||||
> ![Solution Page](screenshot/solution.png)
|
||||
|
||||
##### <u>Login Page</u>
|
||||
|
||||
>
|
||||
> ![Login Page](screenshot/login.png)
|
||||
|
||||
##### <u>Register Page</u>
|
||||
|
||||
>
|
||||
> ![Register Page](screenshot/register.png)
|
||||
|
||||
|
|
18
SECURITY.md
Normal file
18
SECURITY.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
There is the list of supported versions of php to run UIISC
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 8.0.x | :white_check_mark: |
|
||||
| > 7.4 | :white_check_mark: |
|
||||
| 7.1.x | :white_check_mark: |
|
||||
| > 5.6.x | :white_check_mark: |
|
||||
| < 5.6 | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
In case of any error the user can report it by sending email to `admin@uiisc.org` or by contacting phone at `+86-021-51351888`.
|
||||
|
BIN
doc/logo.png
BIN
doc/logo.png
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
3
nginx.conf
Normal file
3
nginx.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
location /callback {
|
||||
rewrite ^(.*)$ /callback/index.php?s=$1 last; break;
|
||||
}
|
11
src/about.php
Normal file → Executable file
11
src/about.php
Normal file → Executable file
|
@ -1,10 +1,3 @@
|
|||
<?php
|
||||
define('IN_SYS', true);
|
||||
require_once "core.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/application.php';
|
||||
require __DIR__ . '/public/controllers/about.php';
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
session_start();
|
||||
define("IN_SYS", 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
src/admin/accounts.php
Executable file
16
src/admin/accounts.php
Executable file
|
@ -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', 'sync'))) {
|
||||
$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
src/admin/application.php
Executable file
4
src/admin/application.php
Executable file
|
@ -0,0 +1,4 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../core/application.php';
|
||||
require_once ROOT . '/core/adminarea.php';
|
16
src/admin/clients.php
Executable file
16
src/admin/clients.php
Executable file
|
@ -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';
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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;
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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;
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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;
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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"
|
||||
]
|
||||
]
|
||||
];
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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."];
|
||||
}
|
||||
}
|
||||
}
|
92
src/admin/controllers/accounts/deactivate.php
Executable file
92
src/admin/controllers/accounts/deactivate.php
Executable file
|
@ -0,0 +1,92 @@
|
|||
<?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));
|
||||
// }
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
|
||||
$AccountApiConfig = array(
|
||||
'apiUsername' => $AccountApi['api_username'],
|
||||
'apiPassword' => $AccountApi['api_password'],
|
||||
// 'apiUrl' => 'https://panel.myownfreehost.net/xml-api/',
|
||||
'plan' => $AccountApi['api_package'],
|
||||
);
|
||||
|
||||
require_once ROOT . '/modules/autoload.php';
|
||||
|
||||
use \InfinityFree\MofhClient\Client;
|
||||
|
||||
$client = Client::create($AccountApiConfig);
|
||||
$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', 'client_email, client_fname', array('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['client_fname'], $EmailContent, $EmailDescription);
|
||||
|
||||
send_mail(array(
|
||||
'to' => $ClientInfo['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
src/admin/controllers/accounts/edit.php
Executable file
9
src/admin/controllers/accounts/edit.php
Executable file
|
@ -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('client_id' => $AccountInfo['account_client_id']), null, 1);
|
||||
|
||||
$PageInfo['title'] = 'Edit Account #' . $account_id;
|
20
src/admin/controllers/accounts/goftp.php
Executable file
20
src/admin/controllers/accounts/goftp.php
Executable file
|
@ -0,0 +1,20 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
|
||||
$filemanager_url = get_filemanager_url($AccountApi['api_server_ftp_domain'], $AccountInfo['account_username'], $AccountInfo['account_password']);
|
||||
header("Location: " . $filemanager_url);
|
9
src/admin/controllers/accounts/list.php
Executable file
9
src/admin/controllers/accounts/list.php
Executable file
|
@ -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
src/admin/controllers/accounts/login.php
Executable file
17
src/admin/controllers/accounts/login.php
Executable file
|
@ -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');
|
||||
}
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
76
src/admin/controllers/accounts/password.php
Executable file
76
src/admin/controllers/accounts/password.php
Executable file
|
@ -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');
|
||||
}
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
|
||||
$AccountApiConfig = array(
|
||||
'apiUsername' => $AccountApi['api_username'],
|
||||
'apiPassword' => $AccountApi['api_password'],
|
||||
// 'apiUrl' => 'https://panel.myownfreehost.net/xml-api/',
|
||||
'plan' => $AccountApi['api_package'],
|
||||
);
|
||||
|
||||
require_once ROOT . '/modules/autoload.php';
|
||||
|
||||
use \InfinityFree\MofhClient\Client;
|
||||
|
||||
$client = Client::create($AccountApiConfig);
|
||||
$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));
|
84
src/admin/controllers/accounts/reactivate.php
Executable file
84
src/admin/controllers/accounts/reactivate.php
Executable file
|
@ -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');
|
||||
}
|
||||
|
||||
$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));
|
||||
}
|
||||
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
|
||||
$AccountApiConfig = array(
|
||||
'apiUsername' => $AccountApi['api_username'],
|
||||
'apiPassword' => $AccountApi['api_password'],
|
||||
// 'apiUrl' => 'https://panel.myownfreehost.net/xml-api/',
|
||||
'plan' => $AccountApi['api_package'],
|
||||
);
|
||||
|
||||
require_once ROOT . '/modules/autoload.php';
|
||||
|
||||
use \InfinityFree\MofhClient\Client;
|
||||
|
||||
$client = Client::create($AccountApiConfig);
|
||||
$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', 'client_email, client_fname', array('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['client_fname'], $EmailContent, $EmailDescription);
|
||||
|
||||
send_mail(array(
|
||||
"to" => $ClientInfo['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));
|
||||
}
|
51
src/admin/controllers/accounts/sync.php
Executable file
51
src/admin/controllers/accounts/sync.php
Executable file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/../../application.php';
|
||||
|
||||
$account_id = get('account_id', 0);
|
||||
|
||||
if (empty($account_id)) {
|
||||
redirect('clientarea/accounts');
|
||||
}
|
||||
|
||||
$AccountInfo = $DB->find('account', '*', array('account_id' => $account_id), null, 1);
|
||||
|
||||
if (empty($AccountInfo)) {
|
||||
setMessage('not found', 'danger');
|
||||
redirect('clientarea/accounts');
|
||||
}
|
||||
|
||||
// TODO: Change to an asynchronous request
|
||||
require_once ROOT . '/modules/autoload.php';
|
||||
|
||||
use \InfinityFree\MofhClient\Client;
|
||||
|
||||
if ($AccountInfo['account_status'] == 1) {
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
$AccountApiConfig = array(
|
||||
'apiUsername' => $AccountApi['api_username'],
|
||||
'apiPassword' => $AccountApi['api_password'],
|
||||
// 'apiUrl' => 'https://panel.myownfreehost.net/xml-api/',
|
||||
'plan' => $AccountApi['api_package'],
|
||||
);
|
||||
$client = Client::create($AccountApiConfig);
|
||||
$request = $client->getUserDomains(array('username' => $AccountInfo['account_username']));
|
||||
$response = $request->send();
|
||||
$DomainList = $response->getDomains();
|
||||
} else {
|
||||
// inactive
|
||||
$DomainList = array();
|
||||
}
|
||||
if (count($DomainList) > 0) {
|
||||
foreach($DomainList as &$item) {
|
||||
// 格式 ("abc.com",1234)
|
||||
$item = '("' . $item . '",' .$account_id . ')';
|
||||
}
|
||||
// 清理
|
||||
$result = $DB->delete('account_domain', array('domain_account_id' => $account_id));
|
||||
// 同步到本地
|
||||
// $result = $DB->insert('account_domain', $DomainList);
|
||||
$sql = "INSERT INTO `hosting_account_domain` (domain_name,domain_account_id) VALUES " . implode(',', $DomainList);
|
||||
$result = $DB->query($sql);
|
||||
}
|
||||
redirect('admin/accounts', '', array('action' => 'view', 'account_id' => $account_id));
|
23
src/admin/controllers/accounts/view.php
Executable file
23
src/admin/controllers/accounts/view.php
Executable file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$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)) {
|
||||
setMessage('not found', 'danger');
|
||||
redirect('admin/accounts');
|
||||
}
|
||||
|
||||
$PageInfo['title'] = 'View Account (#' . $account_id . ')';
|
||||
$AccountApi = $DB->find('account_api', '*', array('api_key' => $AccountInfo['account_api_key']), null, 1);
|
||||
|
||||
$AccountDomainList = $DB->findAll('account_domain', '*', array('domain_account_id' => $account_id));
|
|
@ -1,255 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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";
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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
src/admin/controllers/clients/activate.php
Executable file
19
src/admin/controllers/clients/activate.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require '../../application.php';
|
||||
|
||||
$client_id = get('client_id');
|
||||
|
||||
if (!$client_id) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$result = $DB->update('clients', array('client_status' => 1), array('client_id' => $client_id));
|
||||
|
||||
if ($result) {
|
||||
setMessage('Client activated successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/clients', '', array('action' => 'view', 'client_id' => $client_id));
|
9
src/admin/controllers/clients/list.php
Executable file
9
src/admin/controllers/clients/list.php
Executable file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('Clients List');
|
||||
|
||||
$count = $DB->count('clients');
|
||||
|
||||
if ($count > 0) {
|
||||
$rows = $DB->findAll('clients');
|
||||
}
|
22
src/admin/controllers/clients/login.php
Executable file
22
src/admin/controllers/clients/login.php
Executable file
|
@ -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('client_id' => $client_id), null, 1);
|
||||
|
||||
$key = rand(000000, 999999);
|
||||
$email = $ClientInfo['client_email'];
|
||||
$token = hash('sha256', json_encode([$email, $ClientInfo['client_key'], $key]));
|
||||
$times = 1;
|
||||
|
||||
setcookie('UIISC_MEMBER', base64_encode(gzcompress(json_encode(array('email' => $email, 'token' => $token, 'key' => $key)))), time() + $times * 86400, '/', $site_domain);
|
||||
|
||||
setMessage('Logged in as ' . $email . ' <b>successfully!</b>', 'success');
|
||||
|
||||
redirect('clientarea/index');
|
19
src/admin/controllers/clients/suspend.php
Executable file
19
src/admin/controllers/clients/suspend.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require '../../application.php';
|
||||
|
||||
$client_id = get('client_id');
|
||||
|
||||
if (!$client_id) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$result = $DB->update('clients', array('client_status' => 2), array('client_id' => $client_id));
|
||||
|
||||
if ($result) {
|
||||
setMessage('Client suspended successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/clients', '', array('action' => 'view', 'client_id' => $client_id));
|
26
src/admin/controllers/clients/view.php
Executable file
26
src/admin/controllers/clients/view.php
Executable file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
require_once ROOT . '/core/library/countries.php';
|
||||
|
||||
$client_id = get('client_id');
|
||||
|
||||
if (empty($client_id)) {
|
||||
redirect('admin/clients');
|
||||
}
|
||||
|
||||
|
||||
$ClientInfo = $DB->find('clients', '*', array('client_id' => $client_id), null, 1);
|
||||
|
||||
$CountryName = 'Not Defined';
|
||||
|
||||
foreach ($countries as $country) {
|
||||
if ($ClientInfo['client_country'] == $country['code']) {
|
||||
$CountryName = $country['name'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$PageInfo['title'] = 'View client (' . $client_id . ')';
|
||||
$count_account = $DB->count('account', array('account_client_id' => $ClientInfo['client_id']));
|
||||
$count_ssl = $DB->count('ssl', array('ssl_client_id' => $ClientInfo['client_id']));
|
||||
$count_tickets = $DB->count('tickets', array('ticket_client_id' => $ClientInfo['client_id']));
|
7
src/admin/controllers/dashboard/view.php
Executable file
7
src/admin/controllers/dashboard/view.php
Executable file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = 'Dashboard';
|
||||
$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
src/admin/controllers/domain/add.php
Executable file
37
src/admin/controllers/domain/add.php
Executable file
|
@ -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/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 {
|
||||
$result = $DB->insert('domain_extensions', $data);
|
||||
if ($result) {
|
||||
setMessage('Extension added <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage('Something went' . "'" . 's <b>wrong!</b>', 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
redirect('admin/domain');
|
38
src/admin/controllers/domain/delete.php
Executable file
38
src/admin/controllers/domain/delete.php
Executable file
|
@ -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/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/domain');
|
9
src/admin/controllers/domain/list.php
Executable file
9
src/admin/controllers/domain/list.php
Executable file
|
@ -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');
|
||||
}
|
97
src/admin/controllers/hosting/add.php
Executable file
97
src/admin/controllers/hosting/add.php
Executable file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
require '../../application.php';
|
||||
|
||||
if (!post('api_type')) {
|
||||
setMessage('need field: api_type', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_key')) {
|
||||
setMessage('need field: api_key', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_username')) {
|
||||
setMessage('need field: api_username', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_password')) {
|
||||
setMessage('need field: api_password', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_server_domain')) {
|
||||
setMessage('need field: api_server_domain', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_cpanel_url')) {
|
||||
setMessage('need field: api_cpanel_url', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_server_ip')) {
|
||||
setMessage('need field: api_server_ip', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_server_ftp_domain')) {
|
||||
setMessage('need field: api_server_ftp_domain', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_server_sql_domain')) {
|
||||
setMessage('need field: api_server_sql_domain', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_ns_1')) {
|
||||
setMessage('need field: api_ns_1', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_ns_2')) {
|
||||
setMessage('need field: api_ns_2', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_package')) {
|
||||
setMessage('need field: api_package', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_callback_token')) {
|
||||
setMessage('need field: api_callback_token', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
|
||||
$data = array(
|
||||
'api_username' => post('api_username'),
|
||||
'api_password' => post('api_password'),
|
||||
'api_type' => post('api_type'),
|
||||
'api_key' => post('api_key'),
|
||||
'api_server_domain' => post('api_server_domain'),
|
||||
'api_cpanel_url' => post('api_cpanel_url'),
|
||||
'api_server_ftp_domain' => post('api_server_ftp_domain'),
|
||||
'api_server_sql_domain' => post('api_server_sql_domain'),
|
||||
'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')
|
||||
);
|
||||
|
||||
$result = $DB->insert('account_api', $data);
|
||||
|
||||
if ($result) {
|
||||
setMessage('Hosting Provider added successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/hosting');
|
||||
}
|
113
src/admin/controllers/hosting/edit.php
Executable file
113
src/admin/controllers/hosting/edit.php
Executable file
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
require '../../application.php';
|
||||
$api_id = post('api_id');
|
||||
if (!$api_id) {
|
||||
setMessage('need field: api_id', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
|
||||
if (!post('api_type')) {
|
||||
setMessage('need field: api_type', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_key')) {
|
||||
setMessage('need field: api_key', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_username')) {
|
||||
setMessage('need field: api_username', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_password')) {
|
||||
setMessage('need field: api_password', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_server_domain')) {
|
||||
setMessage('need field: api_server_domain', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_cpanel_url')) {
|
||||
setMessage('need field: api_cpanel_url', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_server_ip')) {
|
||||
setMessage('need field: api_server_ip', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_server_ftp_domain')) {
|
||||
setMessage('need field: api_server_ftp_domain', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_server_sql_domain')) {
|
||||
setMessage('need field: api_server_sql_domain', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_ns_1')) {
|
||||
setMessage('need field: api_ns_1', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_ns_2')) {
|
||||
setMessage('need field: api_ns_2', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_package')) {
|
||||
setMessage('need field: api_package', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
if (!post('api_callback_token')) {
|
||||
setMessage('need field: api_callback_token', 'danger');
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'api_username' => post('api_username'),
|
||||
'api_password' => post('api_password'),
|
||||
'api_type' => post('api_type'),
|
||||
'api_key' => post('api_key'),
|
||||
'api_server_domain' => post('api_server_domain'),
|
||||
'api_cpanel_url' => post('api_cpanel_url'),
|
||||
'api_server_ftp_domain' => post('api_server_ftp_domain'),
|
||||
'api_server_sql_domain' => post('api_server_sql_domain'),
|
||||
'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')
|
||||
);
|
||||
|
||||
$result = $DB->update('account_api', $data, array('api_id' => $api_id));
|
||||
|
||||
if ($result) {
|
||||
setMessage('Hosting Provider updated successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/hosting', '', ['action' => 'edit', 'id' => $api_id]);
|
||||
} else {
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
$id = get('id');
|
||||
if ($id > 0) {
|
||||
$data = $DB->find('account_api', '*', array('api_id' => $id), null, 1);
|
||||
$PageInfo = ['title' => 'Edit Hosting Provider #' . $id, 'rel' => ''];
|
||||
} else {
|
||||
setMessage('need field: id', 'danger');
|
||||
redirect('admin/hosting');
|
||||
}
|
||||
}
|
10
src/admin/controllers/hosting/list.php
Normal file
10
src/admin/controllers/hosting/list.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$count = $DB->count('account_api');
|
||||
if ($count > 0) {
|
||||
$rows = $DB->findAll('account_api', '*', array(), "`api_id` DESC");
|
||||
}
|
21
src/admin/controllers/hosting/view.php
Executable file
21
src/admin/controllers/hosting/view.php
Executable file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$api_id = get('id');
|
||||
$api_key = get('api_key');
|
||||
|
||||
if ($api_id > 0) {
|
||||
$data = $DB->find('account_api', '*', array('api_id' => $api_id), null, 1);
|
||||
$api_callback_url = "{$site_url}/callback/{$data['api_key']}/{$data['api_callback_token']}";
|
||||
$PageInfo = ['title' => 'View Hosting Provider', 'rel' => ''];
|
||||
} else if (!empty($api_key)) {
|
||||
$data = $DB->find('account_api', '*', array('api_key' => $api_key), null, 1);
|
||||
$api_callback_url = "{$site_url}/callback/{$data['api_key']}/{$data['api_callback_token']}";
|
||||
$PageInfo = ['title' => 'View Hosting Provider', 'rel' => ''];
|
||||
} else {
|
||||
$PageInfo = ['title' => 'Unathorized Access', 'rel' => ''];
|
||||
$data = null;
|
||||
}
|
22
src/admin/controllers/knowledgebase/add.php
Executable file
22
src/admin/controllers/knowledgebase/add.php
Executable file
|
@ -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'),
|
||||
);
|
||||
|
||||
$result = $DB->insert('knowledgebase', $data);
|
||||
if ($result) {
|
||||
setMessage('Knowledgebase added successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
redirect('admin/knowledgebase');
|
||||
} else {
|
||||
$PageInfo = ['title' => 'New Knowledgebase', 'rel' => ''];
|
||||
$load_editor = 1;
|
||||
}
|
44
src/admin/controllers/knowledgebase/edit.php
Executable file
44
src/admin/controllers/knowledgebase/edit.php
Executable file
|
@ -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'),
|
||||
);
|
||||
$result = $DB->update('knowledgebase', $FormData, array('knowledgebase_id' => $id));
|
||||
|
||||
if ($result) {
|
||||
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
src/admin/controllers/knowledgebase/list.php
Executable file
9
src/admin/controllers/knowledgebase/list.php
Executable file
|
@ -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
src/admin/controllers/knowledgebase/view.php
Executable file
15
src/admin/controllers/knowledgebase/view.php
Executable file
|
@ -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;
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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
src/admin/controllers/login/login.php
Executable file
42
src/admin/controllers/login/login.php
Executable file
|
@ -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
src/admin/controllers/login/logout.php
Executable file
20
src/admin/controllers/login/logout.php
Executable file
|
@ -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">×</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">×</span>
|
||||
</button>
|
||||
Login to <b>continue!</b>
|
||||
</div>';
|
||||
}
|
||||
header('location: login.php');
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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");
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// exit('禁止访问');
|
||||
header("Location: ../../admin.php");
|
||||
exit;
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// exit('禁止访问');
|
||||
header("Location: ../../admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$members = [
|
||||
"total" => 10,
|
||||
"pages" => 4,
|
||||
"page" => 1,
|
||||
"list" => []
|
||||
];
|
||||
|
||||
$status_types = [
|
||||
"关闭",
|
||||
"打开"
|
||||
];
|
||||
|
||||
$members["list"] = $dbpdo->select_and("users");
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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");
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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");
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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");
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// exit('禁止访问');
|
||||
header("Location: ../../admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$news = [
|
||||
"total" => 10,
|
||||
"pages" => 4,
|
||||
"page" => 1,
|
||||
"list" => []
|
||||
];
|
||||
|
||||
$status_types = [
|
||||
"关闭",
|
||||
"打开"
|
||||
];
|
||||
|
||||
$news["list"] = $dbpdo->select_and("news");
|
29
src/admin/controllers/news/add.php
Executable file
29
src/admin/controllers/news/add.php
Executable file
|
@ -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'),
|
||||
);
|
||||
|
||||
$result = $DB->insert('news', $data);
|
||||
|
||||
if ($result) {
|
||||
setMessage('News added <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
redirect('admin/news');
|
||||
} else {
|
||||
$PageInfo['title'] = $lang->I18N('News Add');
|
||||
$status_types = array(
|
||||
"关闭",
|
||||
"打开",
|
||||
);
|
||||
|
||||
$load_editor = 1;
|
||||
}
|
49
src/admin/controllers/news/edit.php
Executable file
49
src/admin/controllers/news/edit.php
Executable file
|
@ -0,0 +1,49 @@
|
|||
<?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'),
|
||||
);
|
||||
|
||||
$result = $DB->update('news', $data, array('news_id' => $id));
|
||||
|
||||
if ($result) {
|
||||
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;
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('News Edit');
|
16
src/admin/controllers/news/list.php
Executable file
16
src/admin/controllers/news/list.php
Executable file
|
@ -0,0 +1,16 @@
|
|||
<?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(
|
||||
"关闭",
|
||||
"打开",
|
||||
);
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('News List');
|
24
src/admin/controllers/news/view.php
Executable file
24
src/admin/controllers/news/view.php
Executable file
|
@ -0,0 +1,24 @@
|
|||
<?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);
|
||||
}
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('News Details');
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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");
|
||||
}
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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
src/admin/controllers/profile/edit.php
Executable file
20
src/admin/controllers/profile/edit.php
Executable file
|
@ -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']
|
||||
);
|
||||
|
||||
$result = $DB->update('admin', $data, $where);
|
||||
if ($result) {
|
||||
setMessage('Profile updated successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
redirect('admin/profile');
|
||||
}
|
||||
|
43
src/admin/controllers/profile/forgetpassword.php
Executable file
43
src/admin/controllers/profile/forgetpassword.php
Executable file
|
@ -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
src/admin/controllers/profile/password.php
Executable file
30
src/admin/controllers/profile/password.php
Executable file
|
@ -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']) {
|
||||
$result = $DB->update('admin', array('admin_password' => $FormData['hashed_password']), array('admin_key' => $FormData['user_key']));
|
||||
if ($result) {
|
||||
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
src/admin/controllers/profile/resetpassword.php
Executable file
67
src/admin/controllers/profile/resetpassword.php
Executable file
|
@ -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" />';
|
||||
}
|
3
src/admin/controllers/profile/view.php
Executable file
3
src/admin/controllers/profile/view.php
Executable file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('My Profile');
|
33
src/admin/controllers/settings/edit.php
Executable file
33
src/admin/controllers/settings/edit.php
Executable file
|
@ -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',
|
||||
);
|
||||
|
||||
$result = $DB->update('config', $data, $where);
|
||||
|
||||
if ($result) {
|
||||
setMessage('Clientarea updated <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
redirect('admin/settings');
|
||||
}
|
8
src/admin/controllers/settings/view.php
Executable file
8
src/admin/controllers/settings/view.php
Executable file
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
$Statuses = array(
|
||||
array('name' => 'Live', 'value' => '1'),
|
||||
array('name' => 'Maintaince', 'value' => '0'),
|
||||
);
|
||||
|
||||
$PageInfo['title'] = 'System Settings';
|
25
src/admin/controllers/sitepro/edit.php
Executable file
25
src/admin/controllers/sitepro/edit.php
Executable file
|
@ -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',
|
||||
);
|
||||
|
||||
$result = $DB->update('builder_api', $data, $where);
|
||||
|
||||
if ($result) {
|
||||
setMessage('SitePro API updated <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/settings', 'sitepro');
|
9
src/admin/controllers/sitepro/view.php
Executable file
9
src/admin/controllers/sitepro/view.php
Executable file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = 'SitePro Settings';
|
||||
|
||||
$where = array(
|
||||
'builder_id' => 'SITEPRO',
|
||||
);
|
||||
|
||||
$SitePro = $DB->find('builder_api', '*', $where, null, 1);
|
28
src/admin/controllers/smtp/edit.php
Executable file
28
src/admin/controllers/smtp/edit.php
Executable file
|
@ -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',
|
||||
);
|
||||
|
||||
$result = $DB->update('smtp', $data, $where);
|
||||
|
||||
if ($result) {
|
||||
setMessage('SMTP updated <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/settings', 'smtp');
|
22
src/admin/controllers/smtp/test.php
Executable file
22
src/admin/controllers/smtp/test.php
Executable file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/../../application.php';
|
||||
|
||||
if (!isset($_POST['submit'])) {
|
||||
exit('Method Not Allowed');
|
||||
}
|
||||
|
||||
$email = post('email');
|
||||
|
||||
$result = 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 ($result) {
|
||||
setMessage('The test email has been sent <b>successfully</b> !');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/settings', 'smtp');
|
9
src/admin/controllers/smtp/view.php
Executable file
9
src/admin/controllers/smtp/view.php
Executable file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = 'SMTP Settings';
|
||||
|
||||
$where = array(
|
||||
'smtp_key' => 'SMTP',
|
||||
);
|
||||
|
||||
$SMTPInfo = $DB->find('smtp', '*', $where, null, 1);
|
25
src/admin/controllers/sslapi/edit.php
Executable file
25
src/admin/controllers/sslapi/edit.php
Executable file
|
@ -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',
|
||||
);
|
||||
|
||||
$result = $DB->update('ssl_api', $data, $where);
|
||||
|
||||
if ($result) {
|
||||
setMessage('SSL API updated <b>successfully!</b>');
|
||||
} else {
|
||||
setMessage("Something went's <b>wrong!</b>", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/settings', 'sslapi');
|
9
src/admin/controllers/sslapi/view.php
Executable file
9
src/admin/controllers/sslapi/view.php
Executable file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
$PageInfo['title'] = 'SSL API Settings';
|
||||
|
||||
$where = array(
|
||||
'api_key' => 'FREESSL'
|
||||
);
|
||||
|
||||
$SSLApi = $DB->find('ssl_api', '*', $where, null, 1);
|
18
src/admin/controllers/sslcert/list.php
Executable file
18
src/admin/controllers/sslcert/list.php
Executable file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_CRONLITE')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$PageInfo['title'] = $lang->I18N('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
src/admin/controllers/sslcert/view.php
Executable file
33
src/admin/controllers/sslcert/view.php
Executable file
|
@ -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'];
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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
src/admin/controllers/tickets/close.php
Executable file
48
src/admin/controllers/tickets/close.php
Executable file
|
@ -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, ticket_client_id', array('ticket_id' => $ticket_id), null, 1);
|
||||
|
||||
if (!$TicketInfo) {
|
||||
setMessage('Ticket Not Found !');
|
||||
redirect('admin/tickets');
|
||||
}
|
||||
|
||||
// 查找客户信息
|
||||
$ClientInfo = $DB->find('clients', 'client_email, client_fname', array('client_id' => $TicketInfo['ticket_client_id']));
|
||||
|
||||
if (!$ClientInfo) {
|
||||
setMessage('Client Not Found !');
|
||||
redirect('admin/tickets');
|
||||
}
|
||||
|
||||
$result = $DB->update('tickets', array('ticket_status' => 3), array('ticket_id' => $ticket_id));
|
||||
|
||||
if ($result) {
|
||||
$ticket_url = setURL('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id));
|
||||
$email_body = email_build_body('Ticket Closed',
|
||||
$ClientInfo['client_fname'],
|
||||
'<p>The ticket ("ID: ' . $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 ("ID: ' . $ticket_id . '")',
|
||||
));
|
||||
|
||||
setMessage('Ticket closed successfully !');
|
||||
} else {
|
||||
setMessage("Something went's wrong !", 'danger');
|
||||
}
|
||||
|
||||
redirect('admin/tickets', '', array('action' => 'view', 'ticket_id' => $ticket_id));
|
9
src/admin/controllers/tickets/list.php
Executable file
9
src/admin/controllers/tickets/list.php
Executable file
|
@ -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
src/admin/controllers/tickets/reply.php
Executable file
64
src/admin/controllers/tickets/reply.php
Executable file
|
@ -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_client_id', array('ticket_id' => $ticket_id));
|
||||
|
||||
if (!$TicketInfo) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
// update status
|
||||
$result = $DB->update('tickets', array('ticket_status' => '1'), array('ticket_id' => $ticket_id));
|
||||
|
||||
if ($result) {
|
||||
$FormData = array(
|
||||
'reply_for' => $ticket_id,
|
||||
'reply_from' => 999999,
|
||||
'reply_content' => post('content'),
|
||||
'reply_date' => date('Y-m-d H:i:s'),
|
||||
);
|
||||
$result_insert = $DB->insert('ticket_replies', $FormData);
|
||||
if ($result_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_client_id' => $TicketInfo['ticket_client_id'],
|
||||
// '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
src/admin/controllers/tickets/view.php
Executable file
16
src/admin/controllers/tickets/view.php
Executable file
|
@ -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;
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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]);
|
||||
}
|
||||
}
|
18
src/admin/domain.php
Executable file
18
src/admin/domain.php
Executable file
|
@ -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'] = 'Domain Provider ' . ucfirst($action);
|
||||
|
||||
require __DIR__ . '/controllers/domain/' . $action . '.php';
|
||||
require __DIR__ . '/views/common/header.php';
|
||||
require __DIR__ . '/views/common/navbar.php';
|
||||
require __DIR__ . '/views/common/sidebar.php';
|
||||
require __DIR__ . '/views/domain/' . $action . '.php';
|
||||
require __DIR__ . '/views/common/footer.php';
|
7
src/admin/forgetpassword.php
Executable file
7
src/admin/forgetpassword.php
Executable file
|
@ -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';
|
18
src/admin/hosting.php
Executable file
18
src/admin/hosting.php
Executable file
|
@ -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'] = 'Hosting Provider ' . ucfirst($action);
|
||||
|
||||
require __DIR__ . '/controllers/hosting/' . $action . '.php';
|
||||
require __DIR__ . '/views/common/header.php';
|
||||
require __DIR__ . '/views/common/navbar.php';
|
||||
require __DIR__ . '/views/common/sidebar.php';
|
||||
require __DIR__ . '/views/hosting/' . $action . '.php';
|
||||
require __DIR__ . '/views/common/footer.php';
|
9
src/admin/index.php
Normal file → Executable file
9
src/admin/index.php
Normal file → Executable file
|
@ -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
src/admin/knowledgebase.php
Executable file
18
src/admin/knowledgebase.php
Executable file
|
@ -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';
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
if (!defined('IN_SYS')) {
|
||||
// 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
src/admin/login.php
Executable file
14
src/admin/login.php
Executable file
|
@ -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
src/admin/logout.php
Executable file
2
src/admin/logout.php
Executable file
|
@ -0,0 +1,2 @@
|
|||
<?php
|
||||
include __DIR__ . '/controllers/login/logout.php';
|
16
src/admin/news.php
Executable file
16
src/admin/news.php
Executable file
|
@ -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/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
src/admin/profile.php
Executable file
16
src/admin/profile.php
Executable file
|
@ -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
src/admin/resetpassword.php
Executable file
7
src/admin/resetpassword.php
Executable file
|
@ -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
src/admin/settings.php
Executable file
22
src/admin/settings.php
Executable file
|
@ -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
src/admin/sslcert.php
Executable file
16
src/admin/sslcert.php
Executable file
|
@ -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';
|
19
src/admin/tickets.php
Executable file
19
src/admin/tickets.php
Executable file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . '/application.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';
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue