1. Database field improvement
2. fixed #4, fixed #7, fixed #8
This commit is contained in:
Jackson Dou 2023-05-22 02:03:15 +08:00
parent 87929ce135
commit 9eee69b7fc
13 changed files with 56 additions and 36 deletions

View file

@ -25,5 +25,5 @@ foreach ($countries as $country) {
} }
$count_account = $DB->count('account', array('account_client_id' => $ClientInfo['client_id'])); $count_account = $DB->count('account', array('account_client_id' => $ClientInfo['client_id']));
$count_ssl = $DB->count('ssl', array('ssl_for' => $ClientInfo['client_id'])); $count_ssl = $DB->count('ssl', array('ssl_client_id' => $ClientInfo['client_id']));
$count_tickets = $DB->count('tickets', array('ticket_for' => $ClientInfo['client_id'])); $count_tickets = $DB->count('tickets', array('ticket_client_id' => $ClientInfo['client_id']));

View file

@ -9,7 +9,7 @@ if (!$ticket_id) {
} }
// 查找工单信息 // 查找工单信息
$TicketInfo = $DB->find('tickets', 'ticket_email, ticket_for', array('ticket_id' => $ticket_id), null, 1); $TicketInfo = $DB->find('tickets', 'ticket_email, ticket_client_id', array('ticket_id' => $ticket_id), null, 1);
if (!$TicketInfo) { if (!$TicketInfo) {
setMessage('Ticket Not Found !'); setMessage('Ticket Not Found !');
@ -17,7 +17,7 @@ if (!$TicketInfo) {
} }
// 查找客户信息 // 查找客户信息
$ClientInfo = $DB->find('clients', 'client_email, client_fname', array('client_id' => $TicketInfo['ticket_for'])); $ClientInfo = $DB->find('clients', 'client_email, client_fname', array('client_id' => $TicketInfo['ticket_client_id']));
if (!$ClientInfo) { if (!$ClientInfo) {
setMessage('Client Not Found !'); setMessage('Client Not Found !');

View file

@ -12,7 +12,7 @@ if (!$ticket_id) {
exit('Access Denied'); exit('Access Denied');
} }
$TicketInfo = $DB->find('tickets', 'ticket_email, ticket_for', array('ticket_id' => $ticket_id)); $TicketInfo = $DB->find('tickets', 'ticket_email, ticket_client_id', array('ticket_id' => $ticket_id));
if (!$TicketInfo) { if (!$TicketInfo) {
exit('Access Denied'); exit('Access Denied');
@ -46,7 +46,7 @@ if ($resault) {
// 'email_subject' => 'Ticket Reply #' . $ticket_id, // 'email_subject' => 'Ticket Reply #' . $ticket_id,
// 'email_date' => date('Y-m-d H:i:s'), // 'email_date' => date('Y-m-d H:i:s'),
// 'email_body' => $email_body, // 'email_body' => $email_body,
// 'email_for' => $TicketInfo['ticket_for'], // 'email_client_id' => $TicketInfo['ticket_client_id'],
// 'email_read' => 0 // 'email_read' => 0
// ); // );
// print_r($email_insert); // print_r($email_insert);

View file

@ -1,12 +1,12 @@
<?php <?php
$count_acc = $DB->count('account', array('account_client_id' => $ClientInfo['client_id'], 'account_status' => 1)); $count_acc = $DB->count('account', array('account_client_id' => $ClientInfo['client_id'], 'account_status' => 1));
$count_ssl = $DB->count('ssl', array('ssl_for' => $ClientInfo['client_id'])); $count_ssl = $DB->count('ssl', array('ssl_client_id' => $ClientInfo['client_id']));
// $count_tic1 = $DB->count('tickets', array('ticket_for' => $ClientInfo['client_id'], 'ticket_status' => 0)); // $count_tic1 = $DB->count('tickets', array('ticket_client_id' => $ClientInfo['client_id'], 'ticket_status' => 0));
// $count_tic2 = $DB->count('tickets', array('ticket_for' => $ClientInfo['client_id'], 'ticket_status' => 1)); // $count_tic2 = $DB->count('tickets', array('ticket_client_id' => $ClientInfo['client_id'], 'ticket_status' => 1));
// $count_tic = $count_tic1 + $count_tic2; // $count_tic = $count_tic1 + $count_tic2;
$count_tic = $DB->getColumn("SELECT COUNT(*) FROM `pre_tickets` WHERE `ticket_for`='" . $ClientInfo['client_id'] . "' AND `ticket_status`=0 OR `ticket_for`='" . $ClientInfo['client_id'] . "' AND `ticket_status`=1"); $count_tic = $DB->getColumn("SELECT COUNT(*) FROM `pre_tickets` WHERE `ticket_client_id`='" . $ClientInfo['client_id'] . "' AND `ticket_status`=0 OR `ticket_client_id`='" . $ClientInfo['client_id'] . "' AND `ticket_status`=1");
$PageInfo['title'] = 'Dashboard'; $PageInfo['title'] = 'Dashboard';

View file

@ -2,10 +2,10 @@
require ROOT . '/core/library/userinfo.class.php'; require ROOT . '/core/library/userinfo.class.php';
$count = $DB->count('ssl', array('ssl_for' => $ClientInfo['client_id'])); $count = $DB->count('ssl', array('ssl_client_id' => $ClientInfo['client_id']));
if ($count > 0) { if ($count > 0) {
$rows = $DB->findAll('ssl', '*', array('ssl_for' => $ClientInfo['client_id']), "`ssl_id` DESC"); $rows = $DB->findAll('ssl', '*', array('ssl_client_id' => $ClientInfo['client_id']), "`ssl_id` DESC");
require_once ROOT . '/core/handler/SSLHandler.php'; require_once ROOT . '/core/handler/SSLHandler.php';
require_once ROOT . '/modules/GoGetSSL/GoGetSSLApi.php'; require_once ROOT . '/modules/GoGetSSL/GoGetSSLApi.php';

View file

@ -78,7 +78,7 @@ $result = $apiClient->addSSLOrder($FormData);
if (count($result) > 4) { if (count($result) > 4) {
$data = array( $data = array(
'ssl_key' => $result['order_id'], 'ssl_key' => $result['order_id'],
'ssl_for' => $ClientInfo['client_id'], 'ssl_client_id' => $ClientInfo['client_id'],
); );
$res = $DB->insert('ssl', $data); $res = $DB->insert('ssl', $data);

View file

@ -8,7 +8,7 @@ if (isset($_POST['submit'])) {
'ticket_email' => post('email'), 'ticket_email' => post('email'),
'ticket_content' => post('editor'), 'ticket_content' => post('editor'),
'ticket_department' => post('department'), 'ticket_department' => post('department'),
'ticket_for' => $ClientInfo['client_id'], 'ticket_client_id' => $ClientInfo['client_id'],
'ticket_date' => date('Y-m-d H:i:s'), 'ticket_date' => date('Y-m-d H:i:s'),
'ticket_status' => 0, 'ticket_status' => 0,
); );

View file

@ -4,8 +4,8 @@ $PageInfo['title'] = $lang->I18N('My Tickets');
require_once ROOT . '/core/library/userinfo.class.php'; require_once ROOT . '/core/library/userinfo.class.php';
$count = $DB->count('tickets', array('ticket_for' => $ClientInfo['client_id'])); $count = $DB->count('tickets', array('ticket_client_id' => $ClientInfo['client_id']));
if ($count > 0) { if ($count > 0) {
$rows = $DB->findAll('tickets', '*', array('ticket_for' => $ClientInfo['client_id']), "`ticket_id` DESC"); $rows = $DB->findAll('tickets', '*', array('ticket_client_id' => $ClientInfo['client_id']), "`ticket_id` DESC");
} }

View file

@ -11,7 +11,7 @@ if (!$ticket_id) {
$where = array( $where = array(
'ticket_id' => $ticket_id, 'ticket_id' => $ticket_id,
'ticket_for' => $ClientInfo['client_id'], 'ticket_client_id' => $ClientInfo['client_id'],
); );
$TicketInfo = $DB->find('tickets', '*', $where, null, 1); $TicketInfo = $DB->find('tickets', '*', $where, null, 1);

View file

@ -18,9 +18,11 @@ date_default_timezone_set('Asia/Shanghai');
session_start(); session_start();
define('IN_CRONLITE', true); define('IN_CRONLITE', true);
define('APP_VERSION', '1.1.0'); define('APP_MODE', 'prod'); // prod, demo
define('DB_VERSION', '2020'); define('APP_VERSION', '2.0.3');
define('DB_VERSION', '2021');
define('APP_BRAND', 'UIISC'); define('APP_BRAND', 'UIISC');
define('APP_DEBUG', false);
define('APP_ROOT', dirname(__FILE__) . '/'); define('APP_ROOT', dirname(__FILE__) . '/');
define('ROOT', dirname(APP_ROOT)); define('ROOT', dirname(APP_ROOT));
@ -65,7 +67,8 @@ define('DB_PREFIX', $dbconfig['prefix']);
// Detect installation status 1 // Detect installation status 1
if (!$dbconfig['username'] || !$dbconfig['password'] || !$dbconfig['dbname']) { if (!$dbconfig['username'] || !$dbconfig['password'] || !$dbconfig['dbname']) {
header('Content-type:text/html;charset=utf-8'); header('Content-type:text/html;charset=utf-8');
exit('The system is not installed !<a href="/install/">Click to Install</a>'); echo '<p>The system is not installed ! (error code: 1002)</p><p><a href="/install/">Click to Install</a></p>';
exit();
} }
$DB = new \lib\PdoHelper($dbconfig); $DB = new \lib\PdoHelper($dbconfig);
@ -73,7 +76,8 @@ $DB = new \lib\PdoHelper($dbconfig);
// Detect installation status 2 // Detect installation status 2
if ($DB->query("SELECT * FROM `pre_admin` WHERE 1") == false) { if ($DB->query("SELECT * FROM `pre_admin` WHERE 1") == false) {
header('Content-type:text/html;charset=utf-8'); header('Content-type:text/html;charset=utf-8');
exit(`The system is not installed !<a href="/install/">Click to Install</a>`); echo '<p>The system is not installed ! (error code: 1003)</p><p><a href="/install/">Click to Install</a></p>';
exit();
} }
$PageInfo = array('title' => 'UIISC', 'rel' => ''); $PageInfo = array('title' => 'UIISC', 'rel' => '');
@ -98,7 +102,8 @@ $PageInfo = array('title' => 'UIISC', 'rel' => '');
// include_once APP_ROOT . 'member.php'; // include_once APP_ROOT . 'member.php';
if (!file_exists(ROOT . '/data/install.lock') && file_exists(ROOT . '/install/index.php')) { if (!file_exists(ROOT . '/data/install.lock') && file_exists(ROOT . '/install/index.php')) {
exit('<h2>检测到无 /data/install.lock 文件</h2><ul><li><font size="4">如果您尚未安装本程序,请<a href="/install/">前往安装</a></font></li><li><font size="4">如果您已经安装本程序,请手动放置一个空的 install.lock 文件到 /data 文件夹下,<b>为了您站点安全,在您完成它之前我们不会工作。</b></font></li></ul><br/><h4>为什么必须建立 install.lock 文件?</h4>它是安装保护文件,如果检测不到它,就会认为站点还没安装,此时任何人都可以安装/重装你的网站。<br/><br/>'); echo '<h2>检测到无 /data/install.lock 文件</h2><ul><li><font size="4">如果您尚未安装本程序,请<a href="/install/">前往安装</a></font></li><li><font size="4">如果您已经安装本程序,请手动放置一个空的 install.lock 文件到 /data 文件夹下,<b>为了您站点安全,在您完成它之前我们不会工作。</b></font></li></ul><br/><h4>为什么必须建立 install.lock 文件?</h4>它是安装保护文件,如果检测不到它,就会认为站点还没安装,此时任何人都可以安装/重装你的网站。<br/><br/>';
exit();
} }
// if ($conf['cdnpublic'] == 1) { // if ($conf['cdnpublic'] == 1) {

View file

@ -1,12 +1,13 @@
<?php <?php
$sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_account` ( $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_account` (
`account_id` INT(11) NOT NULL AUTO_INCREMENT, `account_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT "主机账号ID",
`account_client_id` INT(11) NOT NULL, `account_client_id` INT(11) NOT NULL COMMENT "所属客户ID",
`account_key` VARCHAR(8) NOT NULL,
`account_api_key` varchar(20) NOT NULL COMMENT "主机提供商标识",
`account_username` VARCHAR(22) NOT NULL, `account_username` VARCHAR(22) NOT NULL,
`account_password` VARCHAR(16) NOT NULL, `account_password` VARCHAR(16) NOT NULL,
`account_domain` VARCHAR(70) NOT NULL, `account_domain` VARCHAR(70) NOT NULL,
`account_sql` VARCHAR(8) NOT NULL, `account_sql` VARCHAR(8) NOT NULL,
`account_key` VARCHAR(8) NOT NULL,
`account_status` INT(1) NOT NULL, `account_status` INT(1) NOT NULL,
`account_date` VARCHAR(20) NOT NULL, `account_date` VARCHAR(20) NOT NULL,
PRIMARY KEY (`account_id`) PRIMARY KEY (`account_id`)
@ -14,25 +15,35 @@ $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_account` (
$sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_account_api` ( $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_account_api` (
`api_id` INT(11) unsigned NOT NULL AUTO_INCREMENT, `api_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`api_key` varchar(30) NOT NULL,
`api_username` VARCHAR(256) NOT NULL, `api_username` VARCHAR(256) NOT NULL,
`api_password` VARCHAR(256) NOT NULL, `api_password` VARCHAR(256) NOT NULL,
`api_cpanel_url` VARCHAR(100) NOT NULL, `api_cpanel_url` VARCHAR(100) NOT NULL,
`api_server_ip` VARCHAR(15) NOT NULL, `api_server_ip` VARCHAR(15) NOT NULL,
`api_ns_1` VARCHAR(30) NOT NULL, `api_ns_1` VARCHAR(30) NOT NULL,
`api_ns_2` VARCHAR(30) NOT NULL, `api_ns_2` VARCHAR(30) NOT NULL,
`api_ns_3` varchar(30) NOT NULL,
`api_package` VARCHAR(20) NOT NULL, `api_package` VARCHAR(20) NOT NULL,
`api_callback_token` varchar(32) NOT NULL,
PRIMARY KEY (`api_id`) PRIMARY KEY (`api_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;'); ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;');
$sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_config` ( $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_config` (
`site_id` INT(11) unsigned NOT NULL AUTO_INCREMENT, `site_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`site_key` VARCHAR(10) NOT NULL, `site_key` varchar(20) NOT NULL,
`site_status` INT(2) NOT NULL, `site_status` int(2) NOT NULL,
`site_name` VARCHAR(30) NOT NULL, `site_name` varchar(30) NOT NULL,
`site_brand` VARCHAR(30) NOT NULL, `site_brand` varchar(30) NOT NULL,
`site_company` VARCHAR(30) NOT NULL, `site_company` varchar(30) NOT NULL,
`site_path` VARCHAR(70) NOT NULL, `site_path` varchar(70) NOT NULL,
`site_email` VARCHAR(50) NOT NULL, `site_phone` varchar(30) NOT NULL,
`site_email` varchar(50) NOT NULL,
`page_title` varchar(80) NOT NULL,
`page_description` varchar(200) NOT NULL,
`page_keywords` varchar(100) NOT NULL,
`page_copyright` varchar(100) NOT NULL,
`page_author` varchar(30) NOT NULL,
`ifastnet_aff` int(11) DEFAULT NULL,
PRIMARY KEY (`site_id`) PRIMARY KEY (`site_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;'); ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;');
@ -82,8 +93,8 @@ $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_smtp` (
$sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_ssl` ( $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_ssl` (
`ssl_id` INT(11) unsigned NOT NULL AUTO_INCREMENT, `ssl_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`ssl_client_id` INT(11) NOT NULL COMMENT "所属客户ID",
`ssl_key` INT(12) NOT NULL, `ssl_key` INT(12) NOT NULL,
`ssl_for` INT(11) NOT NULL,
PRIMARY KEY (`ssl_id`) PRIMARY KEY (`ssl_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4;'); ) ENGINE=MyISAM AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8mb4;');
@ -97,7 +108,7 @@ $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_ssl_api` (
$sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_tickets` ( $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_tickets` (
`ticket_id` INT(11) unsigned NOT NULL AUTO_INCREMENT, `ticket_id` INT(11) unsigned NOT NULL AUTO_INCREMENT,
`ticket_for` INT(11) NOT NULL, `ticket_client_id` INT(11) NOT NULL COMMENT "所属客户ID",
`ticket_subject` VARCHAR(50) NOT NULL, `ticket_subject` VARCHAR(50) NOT NULL,
`ticket_email` VARCHAR(100) NOT NULL, `ticket_email` VARCHAR(100) NOT NULL,
`ticket_department` VARCHAR(10) NOT NULL, `ticket_department` VARCHAR(10) NOT NULL,
@ -156,7 +167,7 @@ $sql = mysqli_query($connect, 'CREATE TABLE IF NOT EXISTS `hosting_news`(
$sql = mysqli_query($connect, "CREATE TABLE IF NOT EXISTS `hosting_emails`( $sql = mysqli_query($connect, "CREATE TABLE IF NOT EXISTS `hosting_emails`(
`email_id` INT(11) NOT NULL AUTO_INCREMENT, `email_id` INT(11) NOT NULL AUTO_INCREMENT,
`email_for` INT(11) NOT NULL, `email_client_id` INT(11) NOT NULL COMMENT '所属客户ID',
`email_date` VARCHAR(255) NOT NULL, `email_date` VARCHAR(255) NOT NULL,
`email_subject` VARCHAR(255) NOT NULL, `email_subject` VARCHAR(255) NOT NULL,
`email_body` VARCHAR(5000) NOT NULL, `email_body` VARCHAR(5000) NOT NULL,

View file

@ -11,7 +11,7 @@ $username = $_POST['username'];
$password = $_POST['password']; $password = $_POST['password'];
$dbname = $_POST['dbname']; $dbname = $_POST['dbname'];
$dbport = !empty($_POST['dbport']) ? $_POST['dbport'] : 3306; $dbport = !empty($_POST['dbport']) ? $_POST['dbport'] : 3306;
$prefix = isset($_POST['prefix']) ? $_POST['prefix'] : 'uiisc'; $prefix = isset($_POST['prefix']) ? $_POST['prefix'] : 'hosting';
@file_put_contents(CONFIG_FILE, "<?php @file_put_contents(CONFIG_FILE, "<?php
\$dbconfig = array( \$dbconfig = array(

View file

@ -34,6 +34,10 @@ require __DIR__ . '/header.php';
<label class="form-label">Database Port</label> <label class="form-label">Database Port</label>
<input type="text" name="dbport" class="form-control" placeholder="Enter database port here(default:3306)"> <input type="text" name="dbport" class="form-control" placeholder="Enter database port here(default:3306)">
</div> </div>
<div class="mb-5">
<label class="form-label">Database prefix</label>
<input type="text" name="prefix" class="form-control" placeholder="Enter database prefix here(default:hosting)">
</div>
<div class="mt-15"> <div class="mt-15">
<input type="submit" name="submit" class="btn btn-primary" value="Validate"> <input type="submit" name="submit" class="btn btn-primary" value="Validate">
</div> </div>