From 65771a11f3de55678a56a452e4f5bdea49f347bd Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 26 Mar 2016 22:29:45 +0800 Subject: [PATCH] renamed Config class to Option --- admin/admin_ajax.php | 4 +- admin/customize.php | 8 ++-- admin/options.php | 38 +++++++++---------- ajax.php | 8 ++-- get.php | 4 +- index.php | 20 +++++----- libraries/Database/AdaptedDatabase.class.php | 10 ++--- .../{Config.class.php => Option.class.php} | 4 +- libraries/User.class.php | 4 +- templates/admin/header.tpl.php | 10 ++--- templates/footer.tpl.php | 2 +- templates/header.tpl.php | 10 ++--- user/index.php | 4 +- user/profile.php | 4 +- 14 files changed, 65 insertions(+), 65 deletions(-) rename libraries/{Config.class.php => Option.class.php} (95%) diff --git a/admin/admin_ajax.php b/admin/admin_ajax.php index 640dcb55..e63c3392 100644 --- a/admin/admin_ajax.php +++ b/admin/admin_ajax.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-02-04 13:53:55 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:48 + * @Last Modified time: 2016-03-26 22:28:22 */ require "../libraries/session.inc.php"; @@ -67,7 +67,7 @@ if (isset($_GET['action'])) { } else if ($action == "color") { if (isset($_POST['color_scheme'])) { $color_scheme = str_replace('_', '-', $_POST['color_scheme']); - Config::set('color_scheme', $color_scheme); + Option::set('color_scheme', $color_scheme); $json['errno'] = 0; $json['msg'] = "修改配色成功。"; } else { diff --git a/admin/customize.php b/admin/customize.php index c1944e6c..b8fc6bdb 100644 --- a/admin/customize.php +++ b/admin/customize.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-03-19 14:34:21 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 21:44:27 + * @Last Modified time: 2016-03-26 22:28:23 */ require "../libraries/session.inc.php"; if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); @@ -108,7 +108,7 @@ $db = new Database\Database();
设置已保存。
'; } ?> @@ -116,7 +116,7 @@ $db = new Database\Database(); @@ -135,7 +135,7 @@ $db = new Database\Database(); // Skin switcher diff --git a/admin/options.php b/admin/options.php index 7ae0bb58..b55d59d5 100644 --- a/admin/options.php +++ b/admin/options.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-03-18 22:50:25 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:49 + * @Last Modified time: 2016-03-26 22:28:23 */ require "../libraries/session.inc.php"; if (!$user->is_admin) header('Location: ../index.php?msg=看起来你并不是管理员'); @@ -37,7 +37,7 @@ $db = new Database\Database(); if (!isset($_POST['user_can_register'])) $_POST['user_can_register'] = '0'; foreach ($_POST as $key => $value) { if ($key != "option" && $key != "submit") { - Config::set($key, $value); + Option::set($key, $value); // echo $key."=".$value."
"; } } @@ -48,48 +48,48 @@ $db = new Database\Database(); @@ -114,7 +114,7 @@ $db = new Database\Database(); if (isset($_POST['option']) && ($_POST['option'] == "adapter")) { foreach ($_POST as $key => $value) { if ($key != "option" && $key != "submit") { - Config::set($key, $value); + Option::set($key, $value); //echo $key."=".$value."
"; } } @@ -128,35 +128,35 @@ $db = new Database\Database(); diff --git a/ajax.php b/ajax.php index 23902156..97f8ecf9 100644 --- a/ajax.php +++ b/ajax.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-16 23:01:33 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 22:01:59 + * @Last Modified time: 2016-03-26 22:28:22 * * - login, register, logout * - upload, change, delete @@ -55,7 +55,7 @@ if ($action == "login") { } else if ($action == "register") { if (checkPost('register')) { if (!$user->is_registered) { - if (Config::get('user_can_register') == 1) { + if (Option::get('user_can_register') == 1) { if (User::checkValidPwd($_POST['passwd'])) { if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; @@ -66,7 +66,7 @@ if ($action == "login") { } // If amount of registered accounts of IP is more than allowed mounts, // then reject the registration. - if ($user->db->getNumRows('ip', $ip) < Config::get('regs_per_ip')) { + if ($user->db->getNumRows('ip', $ip) < Option::get('regs_per_ip')) { // use once md5 to encrypt password if ($user->register($_POST['passwd'], $ip)) { $json['errno'] = 0; @@ -77,7 +77,7 @@ if ($action == "login") { } } else { $json['errno'] = 1; - $json['msg'] = "你最多只能注册 ".Config::get('regs_per_ip')." 个账户哦"; + $json['msg'] = "你最多只能注册 ".Option::get('regs_per_ip')." 个账户哦"; } } } else { diff --git a/get.php b/get.php index 14561ee8..3a3920b4 100644 --- a/get.php +++ b/get.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-02-02 20:56:42 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 20:33:02 + * @Last Modified time: 2016-03-26 22:28:22 * * All textures requests of legacy link will be handle here. */ @@ -39,7 +39,7 @@ if (isset($_GET['type']) && isset($_GET['uname'])) { if (isset($_GET['api'])) { echo $user->getJsonProfile(($_GET['api'] == 'csl') ? 0 : 1); } else { - echo $user->getJsonProfile(Config::get('api_type')); + echo $user->getJsonProfile(Option::get('api_type')); } } else if ($_GET['type'] == "avatar") { $size = (isset($_GET['size']) && $_GET['size'] != "") ? (int)$_GET['size'] : 128; diff --git a/index.php b/index.php index 48224e39..d091e130 100755 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-17 13:55:20 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:48 + * @Last Modified time: 2016-03-26 22:28:22 */ session_start(); $dir = dirname(__FILE__); @@ -24,7 +24,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) { - <?php echo Config::get('site_name'); ?> + <?php echo Option::get('site_name'); ?> @@ -35,7 +35,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) { @@ -43,8 +43,8 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
- - + +
  • @@ -52,7 +52,7 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) { 欢迎,|登出? - +
  • @@ -67,13 +67,13 @@ if (isset($_COOKIE['uname']) && isset($_COOKIE['token'])) {
    -

    +

    - +

    + if (Option::get('user_can_register') == 1): ?>

    - +

    注册

    diff --git a/libraries/Database/AdaptedDatabase.class.php b/libraries/Database/AdaptedDatabase.class.php index b28ee091..cb6ffee5 100644 --- a/libraries/Database/AdaptedDatabase.class.php +++ b/libraries/Database/AdaptedDatabase.class.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-03-18 16:53:55 * @Last Modified by: printempw - * @Last Modified time: 2016-03-18 17:33:58 + * @Last Modified time: 2016-03-26 22:28:23 */ namespace Database; @@ -22,10 +22,10 @@ class AdaptedDatabase extends Database implements EncryptInterface, SyncInterfac function __construct() { parent::__construct(); - $this->table_name = Config::get('data_table_name'); - $this->column_uname = Config::get('data_column_uname'); - $this->column_passwd = Config::get('data_column_passwd'); - $this->column_ip = Config::get('data_column_ip'); + $this->table_name = Option::get('data_table_name'); + $this->column_uname = Option::get('data_column_uname'); + $this->column_passwd = Option::get('data_column_passwd'); + $this->column_ip = Option::get('data_column_ip'); } public function createRecord($username, $password, $ip) { diff --git a/libraries/Config.class.php b/libraries/Option.class.php similarity index 95% rename from libraries/Config.class.php rename to libraries/Option.class.php index 5a597bfb..a0119644 100644 --- a/libraries/Config.class.php +++ b/libraries/Option.class.php @@ -3,12 +3,12 @@ * @Author: printempw * @Date: 2016-03-18 14:02:12 * @Last Modified by: printempw - * @Last Modified time: 2016-03-19 11:25:06 + * @Last Modified time: 2016-03-26 22:27:36 */ use Database\Database; -class Config +class Option { public static function get($key) { $conn = Database::checkConfig(); diff --git a/libraries/User.class.php b/libraries/User.class.php index 4557b00b..5e521edc 100644 --- a/libraries/User.class.php +++ b/libraries/User.class.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-16 23:01:33 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 21:41:40 + * @Last Modified time: 2016-03-26 22:28:23 */ use Database\Database; @@ -20,7 +20,7 @@ class User function __construct($uname) { $this->uname = Utils::convertString($uname); - $class_name = "Database\\".Config::get('data_adapter')."Database"; + $class_name = "Database\\".Option::get('data_adapter')."Database"; $this->db = new $class_name(); if ($this->db->sync($this->uname)) { diff --git a/templates/admin/header.tpl.php b/templates/admin/header.tpl.php index 101cb9f3..1ab4b751 100644 --- a/templates/admin/header.tpl.php +++ b/templates/admin/header.tpl.php @@ -3,30 +3,30 @@ - <?php echo $data['page_title']." - ".Config::get('site_name'); ?> + <?php echo $data['page_title']." - ".Option::get('site_name'); ?> - + - +
    - diff --git a/templates/footer.tpl.php b/templates/footer.tpl.php index 3e3384cc..236d0ee8 100644 --- a/templates/footer.tpl.php +++ b/templates/footer.tpl.php @@ -5,7 +5,7 @@ Powered with ❤ by Blessing Skin Server.
    - Copyright © 2016 . All rights reserved. + Copyright © 2016 . All rights reserved.
    diff --git a/templates/header.tpl.php b/templates/header.tpl.php index 2cbb8253..71913185 100644 --- a/templates/header.tpl.php +++ b/templates/header.tpl.php @@ -3,29 +3,29 @@ - <?php echo $data['page_title']." - ".Config::get('site_name'); ?> + <?php echo $data['page_title']." - ".Option::get('site_name'); ?> - + - +
    - diff --git a/user/index.php b/user/index.php index 8ff150e9..d0174752 100644 --- a/user/index.php +++ b/user/index.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-01-21 13:56:40 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 18:47:50 + * @Last Modified time: 2016-03-26 22:28:24 */ require "../libraries/session.inc.php"; $data['style'] = <<< 'EOT' @@ -32,7 +32,7 @@ View::show('header', $data);

    公告

    - +
    diff --git a/user/profile.php b/user/profile.php index 0068ada5..489efe65 100644 --- a/user/profile.php +++ b/user/profile.php @@ -3,7 +3,7 @@ * @Author: printempw * @Date: 2016-02-03 16:12:45 * @Last Modified by: printempw - * @Last Modified time: 2016-03-26 21:59:57 + * @Last Modified time: 2016-03-26 22:28:24 */ require "../libraries/session.inc.php"; $data['style'] = <<< 'EOT' @@ -69,7 +69,7 @@ View::show('header', $data);
is_admin): ?> -

确定要删除你在 上的账号吗?

+

确定要删除你在 上的账号吗?

此操作不可恢复!我们不提供任何备份,或者神奇的撤销按钮。

我们警告过你了,确定要这样做吗?

首页图片地址 - +
站点标题 - +
站点描述 - +
站点地址(URL) - +
开放注册
每个 IP 限制注册数 - +
首选 JSON API
站点公告 - +
数据对接适配器
对接数据表名 - +
对接数据表用户名字段 - +
对接数据表密码字段 - +
对接数据表 IP 字段 - +