From 8930aea3bcb1b2feb29cee8f3c26dc02a5e49aa7 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Mon, 25 Jan 2021 01:23:28 +0800 Subject: [PATCH] add_staffpanel_lang --- include/core.php | 5 ++- include/database/class_db.php | 14 +++++-- include/functions.php | 10 +++-- lang/chs/lang_staffpanel.php | 72 +++++++++++++++++++++++++++++++++++ lang/cht/lang_catmanage.php | 2 +- lang/cht/lang_staffpanel.php | 72 +++++++++++++++++++++++++++++++++++ public/catmanage.php | 2 +- public/location.php | 4 +- public/staffpanel.php | 32 +++++++++------- 9 files changed, 187 insertions(+), 26 deletions(-) create mode 100644 lang/chs/lang_staffpanel.php create mode 100644 lang/cht/lang_staffpanel.php diff --git a/include/core.php b/include/core.php index eec26184..420e3a76 100644 --- a/include/core.php +++ b/include/core.php @@ -3,14 +3,14 @@ if(!defined('IN_TRACKER')) { die('Hacking attempt!'); } error_reporting(E_ALL); -ini_set('display_errors', 0); +ini_set('display_errors', 1); if (!empty($_SERVER['HTTP_X_REQUEST_ID'])) { define('REQUEST_ID', $_SERVER['HTTP_X_REQUEST_ID']); } else { define('REQUEST_ID', intval(NEXUS_START * 10000)); } define('ROOT_PATH', $rootpath); -define('VERSION', '1.6.0'); +define('VERSION_NUMBER', '1.6.0'); define('IS_ANNOUNCE', (basename($_SERVER['SCRIPT_FILENAME']) == 'announce.php')); require $rootpath . 'include/database/interface_db.php'; @@ -28,6 +28,7 @@ if (!IS_ANNOUNCE) { $Cache = new RedisCache(); //Load the caching class $Cache->setLanguageFolderArray(get_langfolder_list()); define('TIMENOW', time()); +define('TIMENOW_STRING', date('Y-m-d H:i:s')); $USERUPDATESET = array(); $query_name=array(); diff --git a/include/database/class_db.php b/include/database/class_db.php index 315f76fe..69df470c 100644 --- a/include/database/class_db.php +++ b/include/database/class_db.php @@ -119,8 +119,16 @@ class DB return $this->isConnected; } - - - + public static function insert($table, $data) + { + if (empty($table) || empty($data) || !is_array($data)) { + throw new DatabaseException("require table and data(array)."); + } + $fields = array_map(function ($value) {return "`$value`";}, array_keys($data)); + $values = array_map(function ($value) {return sqlesc($value);}, array_values($data)); + $sql = sprintf("insert into `%s` (%s) values (%s)", $table, implode(', ', $fields), implode(', ', $values)); + sql_query($sql); + return mysql_insert_id(); + } } \ No newline at end of file diff --git a/include/functions.php b/include/functions.php index cb9e04bd..4af12027 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2691,10 +2691,14 @@ function get_protocol_prefix() } } -function get_langid_from_langcookie() +function get_langid_from_langcookie($lang = '') { - global $CURLANGDIR; - $row = mysql_fetch_array(sql_query("SELECT id FROM language WHERE site_lang = 1 AND site_lang_folder = " . sqlesc($CURLANGDIR) . "ORDER BY id ASC")) or sqlerr(__FILE__, __LINE__); + if (empty($lang)) { + global $CURLANGDIR; + $lang = $CURLANGDIR; + } + + $row = mysql_fetch_array(sql_query("SELECT id FROM language WHERE site_lang = 1 AND site_lang_folder = " . sqlesc($lang) . "ORDER BY id ASC")) or sqlerr(__FILE__, __LINE__); return $row['id']; } diff --git a/lang/chs/lang_staffpanel.php b/lang/chs/lang_staffpanel.php new file mode 100644 index 00000000..a42b9a26 --- /dev/null +++ b/lang/chs/lang_staffpanel.php @@ -0,0 +1,72 @@ + '管理组面板', + 'For SysOp Only' => '对系统管理员开放', + 'Option Name' => '选项名称', + 'Info' => '说明', + 'Delete disabled users' => '删除被禁用户', + 'Delete all disabled users' => '删除所有被禁用的用户', + 'Manage tracker forum' => '管理论坛', + 'Edit/Delete forum' => '编辑/删除论坛版块', + 'MySQL Stats' => 'Mysql 状态', + 'See MySql stats' => '查看 Mysql 状态', + 'Mass mailer' => '批量邮件', + 'Send e-mail to all users on the tracker' => '发送邮件给全部用户', + 'Do cleanup' => '做清理', + 'Do cleanup functions' => '运行清理函数', + 'Ban System' => '禁止系统', + 'Ban / Unban IP' => '禁止/取消禁止 IP', + 'Failed Logins' => '失败登录', + 'Show Failed Login Attempts' => '查看失败的登录尝试', + 'Bitbucket' => 'Bitbucket', + 'Bitbucket Log' => 'Bitbucket Log', + 'Ban EMAIL address' => '禁止邮件地址', + 'Ban EMAILs stop registration.' => '禁止邮件地址注册', + 'Allow EMAIL address' => '允许邮件地址', + 'Allow EMAIL registration.' => '允许邮件地址注册', + 'Location' => '位置', + 'Manage location and location speed' => '管理地址及地址速度', + 'Add Upload' => '增加上传', + 'Add upload to certain classes' => '为特定等级用户增加上传量', + + 'For Administrator Only' => '对管理员开放', + 'Add user' => '添加用户', + 'Create new user account' => '添加新的用户账号', + 'Reset Users Password' => '重置用户密码', + 'Rest lost Passwords' => '重置丢失的密码', + 'Mass PM' => '批量私信', + 'Send PM to all users' => '发送站内私信给全部用户', + 'Poll overview' => '投票', + 'View poll votes' => '查看全部投票', + 'Warned users' => '警告用户', + 'See all warned users on tracker' => '查看全部被警告的用户', + 'FreeLeech' => '免费下载', + 'Set ALL Torrents At Special State.' => '设定全部种子为某种状态', + 'FAQ Management' => '常见问题管理', + 'Edit/Add/Delete FAQ Page' => '编辑/增加/删除 常见问题', + 'Rules Management' => '规则管理', + 'Edit/Add/Delete RULES Page' => '编辑/增加/删除 规则', + 'Category Manage' => '分类管理', + 'Manage torrents categories at your site' => '管理种子分类模式', + + 'For Moderator Only' => '针对版主开放', + 'Abnormal Upload Speed Detector' => '异常上传速度探测', + 'See cheaters' => '查看作弊者', + 'Duplicate IP Check' => '重复 IP 检测', + 'Check for Duplicate IP Users' => '查看相同 IP 用户', + 'All Clients (currently)' => '全部客户端(当前)', + 'Show All Clients (currently downloading/uploading/seeding)' => '查看全部客户端(当前下载中/上传中/做种中)', + 'Ad management' => '广告管理', + 'Manage ads at your site' => '管理网站上的广告', + 'Uploaders' => '上传者', + 'See uploaders stats' => '查看上传者状态', + 'Stats' => '统计', + 'Tracker Stats' => '服务器相关数据统计', + 'IP Test' => 'IP 测试', + 'Test if IP is banned' => '测试 IP 是否被禁止', + 'Add Bonus Points' => '增加魔力', + 'Add Bonus Points to one or All Users.' => '为某个或全部用户增加魔力', + 'Clear cache' => '清除缓存', + 'Clear cache of memcached' => '清除缓存的数据' +]; \ No newline at end of file diff --git a/lang/cht/lang_catmanage.php b/lang/cht/lang_catmanage.php index f2f65e9a..94952c2f 100644 --- a/lang/cht/lang_catmanage.php +++ b/lang/cht/lang_catmanage.php @@ -75,7 +75,7 @@ $lang_catmanage = array 'std_missing_form_data' => "有必填項目未填寫。", 'std_invalid_character_in_filename' => "此檔名包含不合法字元:", 'std_must_define_one_selection' => "你必須至少指定一個選取!", - 'std_invalid_mode_id' => "無效的型態id。" + 'std_invalid_mode_id' => "無效的型態id。", ); ?> diff --git a/lang/cht/lang_staffpanel.php b/lang/cht/lang_staffpanel.php new file mode 100644 index 00000000..59454673 --- /dev/null +++ b/lang/cht/lang_staffpanel.php @@ -0,0 +1,72 @@ + '管理組面板', + 'For SysOp Only' => '對系統管理員開放', + 'Option Name' => '選項名稱', + 'Info' => '說明', + 'Delete disabled users' => '刪除被禁用戶', + 'Delete all disabled users' => '刪除所有被禁用的用戶', + 'Manage tracker forum' => '管理論壇', + 'Edit/Delete forum' => '編輯/刪除論壇版塊', + 'MySQL Stats' => 'Mysql 狀態', + 'See MySql stats' => '查看 Mysql 狀態', + 'Mass mailer' => '批量郵件', + 'Send e-mail to all users on the tracker' => '發送郵件給全部用戶', + 'Do cleanup' => '做清理', + 'Do cleanup functions' => '運行清理函數', + 'Ban System' => '禁止系統', + 'Ban / Unban IP' => '禁止/取消禁止 IP', + 'Failed Logins' => '失敗登錄', + 'Show Failed Login Attempts' => '查看失敗的登錄嘗試', + 'Bitbucket' => 'Bitbucket', + 'Bitbucket Log' => 'Bitbucket Log', + 'Ban EMAIL address' => '禁止郵件地址', + 'Ban EMAILs stop registration.' => '禁止郵件地址註冊', + 'Allow EMAIL address' => '允許郵件地址', + 'Allow EMAIL registration.' => '允許郵件地址註冊', + 'Location' => '位置', + 'Manage location and location speed' => '管理地址及地址速度', + 'Add Upload' => '增加上傳', + 'Add upload to certain classes' => '為特定等級用戶增加上傳量', + + 'For Administrator Only' => '對管理員開放', + 'Add user' => '添加用戶', + 'Create new user account' => '添加新的用戶賬號', + 'Reset Users Password' => '重置用戶密碼', + 'Rest lost Passwords' => '重置丟失的密碼', + 'Mass PM' => '批量私信', + 'Send PM to all users' => '發送站內私信給全部用戶', + 'Poll overview' => '投票', + 'View poll votes' => '查看全部投票', + 'Warned users' => '警告用戶', + 'See all warned users on tracker' => '查看全部被警告的用戶', + 'FreeLeech' => '免費下載', + 'Set ALL Torrents At Special State.' => '設定全部種子為某種狀態', + 'FAQ Management' => '常見問題管理', + 'Edit/Add/Delete FAQ Page' => '編輯/增加/刪除 常見問題', + 'Rules Management' => '規則管理', + 'Edit/Add/Delete RULES Page' => '編輯/增加/刪除 規則', + 'Category Manage' => '分類管理', + 'Manage torrents categories at your site' => '管理種子分類模式', + + 'For Moderator Only' => '針對版主開放', + 'Abnormal Upload Speed Detector' => '異常上傳速度探測', + 'See cheaters' => '查看作弊者', + 'Duplicate IP Check' => '重復 IP 檢測', + 'Check for Duplicate IP Users' => '查看相同 IP 用戶', + 'All Clients (currently)' => '全部客戶端(當前)', + 'Show All Clients (currently downloading/uploading/seeding)' => '查看全部客戶端(當前下載中/上傳中/做種中)', + 'Ad management' => '廣告管理', + 'Manage ads at your site' => '管理網站上的廣告', + 'Uploaders' => '上傳者', + 'See uploaders stats' => '查看上傳者狀態', + 'Stats' => '統計', + 'Tracker Stats' => '服務器相關數據統計', + 'IP Test' => 'IP 測試', + 'Test if IP is banned' => '測試 IP 是否被禁止', + 'Add Bonus Points' => '增加魔力', + 'Add Bonus Points to one or All Users.' => '為某個或全部用戶增加魔力', + 'Clear cache' => '清除緩存', + 'Clear cache of memcached' => '清除緩存的數據' +]; \ No newline at end of file diff --git a/public/catmanage.php b/public/catmanage.php index 63a00fd2..ab57fc19 100644 --- a/public/catmanage.php +++ b/public/catmanage.php @@ -616,7 +616,7 @@ elseif($action == 'edit') else { $typename=return_type_name($type); - stdhead($lang_catmanage['head_edit']." - ".$typename); + stdhead($typename); print("
"); print(""); print(""); diff --git a/public/location.php b/public/location.php index 8bb9fe25..bdffd2cf 100644 --- a/public/location.php +++ b/public/location.php @@ -6,8 +6,8 @@ loggedinorreturn(); if (get_user_class() < UC_SYSOP) { die("access denied."); } -mysql_connect($mysql_host,$mysql_user,$mysql_pass, $BASIC['mysql_db'], $BASIC['mysql_port']); -mysql_select_db($mysql_db); +$config = config('database.mysql'); +mysql_connect($config['host'],$config['username'],$config['password'], $config['database'], $config['port']); stdhead("Manage Locations"); begin_main_frame("",false,100); begin_frame("Manage Locations",true,10,"100%","center"); diff --git a/public/staffpanel.php b/public/staffpanel.php index 0bd65ba0..9f2daa8b 100644 --- a/public/staffpanel.php +++ b/public/staffpanel.php @@ -3,8 +3,12 @@ ob_start(); require_once("../include/bittorrent.php"); dbconn(); loggedinorreturn(); -stdhead("Administration"); -print("

Administration

"); +$langFile = ROOT_PATH . get_langfile_path(); +if (file_exists($langFile)) { + require $langFile; +} +stdhead($lang_staffpanel["Administration"] ?? 'Administration'); +print("

" . ($lang_staffpanel["Administration"] ?? 'Administration') . "

"); if (get_user_class() < UC_MODERATOR) { stdmsg("Error", "Access denied!!!"); @@ -15,18 +19,18 @@ begin_main_frame(); ///////////////////// SysOp Only \\\\\\\\\\\\\\\\\\\\\\\\\\\\ if (get_user_class() >= UC_SYSOP) { - echo("

..:: For SysOp Only ::..

"); + echo("

..:: " . ($lang_staffpanel["For SysOp Only"] ?? 'For SysOp Only') . " ::..

"); print("
"); print("
"); print(""); - echo(""); + echo(""); $query = "SELECT * FROM sysoppanel"; $sql = sql_query($query); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; - $name = $row['name']; + $name = $lang_staffpanel[$row['name']] ?? $row['name']; $url = $row['url']; - $info = $row['info']; + $info = $lang_staffpanel[$row['info']] ?? $row['info']; echo(""); } @@ -36,18 +40,18 @@ if (get_user_class() >= UC_SYSOP) { } ///////////////////// Admin Only \\\\\\\\\\\\\\\\\\\\\\\\\\\\ if (get_user_class() >= UC_ADMINISTRATOR) { - echo("

..:: For Administrator Only :..

"); + echo("

..:: " . ($lang_staffpanel["For Administrator Only"] ?? 'For Administrator Only') . " :..

"); print("
"); print("
"); print("
Option NameInfo" . ($lang_staffpanel["Option Name"] ?? 'Option Name') . "" . ($lang_staffpanel["Info"] ?? 'Info') . "
$name $info
"); - echo(""); + echo(""); $query = "SELECT * FROM adminpanel"; $sql = sql_query($query); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; - $name = $row['name']; + $name = $lang_staffpanel[$row['name']] ?? $row['name']; $url = $row['url']; - $info = $row['info']; + $info = $lang_staffpanel[$row['info']] ?? $row['info']; echo(""); } @@ -57,18 +61,18 @@ if (get_user_class() >= UC_ADMINISTRATOR) { } ///////////////////// Moderator Only \\\\\\\\\\\\\\\\\\\\\\\\\\\\ if (get_user_class() >= UC_MODERATOR) { - echo("

..:: For Moderator Only ::..

"); + echo("

..:: " . ($lang_staffpanel["For Moderator Only"] ?? 'For Moderator Only') . " ::..

"); print("
"); print("
"); print("
Option NameInfo" . ($lang_staffpanel["Option Name"] ?? 'Option Name') . "" . ($lang_staffpanel["Info"] ?? 'Info') . "
$name $info
"); - echo(""); + echo(""); $query = "SELECT * FROM modpanel"; $sql = sql_query($query); while ($row = mysql_fetch_array($sql)) { $id = $row['id']; - $name = $row['name']; + $name = $lang_staffpanel[$row['name']] ?? $row['name']; $url = $row['url']; - $info = $row['info']; + $info = $lang_staffpanel[$row['info']] ?? $row['info']; echo(""); }
Option NameInfo" . ($lang_staffpanel["Option Name"] ?? 'Option Name') . "" . ($lang_staffpanel["Info"] ?? 'Info') . "
$name $info