diff --git a/web/config.php.template b/web/config.php.template
index feea8220b..bee502ea0 100644
--- a/web/config.php.template
+++ b/web/config.php.template
@@ -41,6 +41,3 @@ define('STEAMAPIKEY', ''); // Steam API Key for Shizz
define('SB_WP_URL', ''); //URL of SourceBans Site
define('SB_EMAIL', '');
define('SB_NEW_SALT', '$5$'); //Salt for passwords
-
-//define('DEVELOPER_MODE', true); // Use if you want to show debugmessages
-//define('SB_MEM', '128M'); // Override php memory limit, if isn't enough
diff --git a/web/configs/permissions/sourcemod.json b/web/configs/permissions/sourcemod.json
new file mode 100644
index 000000000..a62218fa4
--- /dev/null
+++ b/web/configs/permissions/sourcemod.json
@@ -0,0 +1,106 @@
+{
+ "SM_RESERVED_SLOT": {
+ "value": "a",
+ "display": "Reserved Slot"
+ },
+
+ "SM_GENERIC": {
+ "value": "b",
+ "display": "Generic Admin"
+ },
+
+ "SM_KICK": {
+ "value": "c",
+ "display": "Kick"
+ },
+
+ "SM_BAN": {
+ "value": "d",
+ "display": "Ban"
+ },
+
+ "SM_UNBAN": {
+ "value": "e",
+ "display": "Unban"
+ },
+
+ "SM_SLAY": {
+ "value": "f",
+ "display": "Slay"
+ },
+
+ "SM_MAP": {
+ "value": "g",
+ "display": "Map Change"
+ },
+
+ "SM_CVAR": {
+ "value": "h",
+ "display": "Change ConVars"
+ },
+
+ "SM_CONFIG": {
+ "value": "i",
+ "display": "Run Configs"
+ },
+
+ "SM_CHAT": {
+ "value": "j",
+ "display": "Admin Chat"
+ },
+
+ "SM_VOTE": {
+ "value": "k",
+ "display": "Start Votes"
+ },
+
+ "SM_PASSWORD": {
+ "value": "l",
+ "display": "Password Server"
+ },
+
+ "SM_RCON": {
+ "value": "m",
+ "display": "RCON"
+ },
+
+ "SM_CHEATS": {
+ "value": "n",
+ "display": "Enable Cheats"
+ },
+
+ "SM_ROOT": {
+ "value": "z",
+ "display": "Full Admin"
+ },
+
+ "SM_CUSTOM1": {
+ "value": "o",
+ "display": "Custom Flag 1"
+ },
+
+ "SM_CUSTOM2": {
+ "value": "p",
+ "display": "Custom Flag 2"
+ },
+
+ "SM_CUSTOM3": {
+ "value": "q",
+ "display": "Custom Flag 3"
+ },
+
+ "SM_CUSTOM4": {
+ "value": "r",
+ "display": "Custom flag 4"
+ },
+
+ "SM_CUSTOM5": {
+ "value": "s",
+ "display": "Custom Flag 5"
+ },
+
+ "SM_CUSTOM6": {
+ "value": "t",
+ "display": "Custom Flag 6"
+ }
+}
diff --git a/web/configs/permissions/web.json b/web/configs/permissions/web.json
new file mode 100644
index 000000000..c5f40f422
--- /dev/null
+++ b/web/configs/permissions/web.json
@@ -0,0 +1,161 @@
+{
+ "ADMIN_LIST_ADMINS": {
+ "value": 1,
+ "display": "View Admins"
+ },
+
+ "ADMIN_ADD_ADMINS": {
+ "value": 2,
+ "display": "Add Admins"
+ },
+
+ "ADMIN_EDIT_ADMINS": {
+ "value": 4,
+ "display": "Edit Admins"
+ },
+
+ "ADMIN_DELETE_ADMINS": {
+ "value": 8,
+ "display": "Delete Admins"
+ },
+
+ "ADMIN_LIST_SERVERS": {
+ "value": 16,
+ "display": "View Servers"
+ },
+
+ "ADMIN_ADD_SERVER": {
+ "value": 32,
+ "display": "Add Servers"
+ },
+
+ "ADMIN_EDIT_SERVERS": {
+ "value": 64,
+ "display": "Edit Servers"
+ },
+
+ "ADMIN_DELETE_SERVERS": {
+ "value": 128,
+ "display": "Delete Servers"
+ },
+
+ "ADMIN_ADD_BAN": {
+ "value": 256,
+ "display": "Add Bans"
+ },
+
+ "ADMIN_EDIT_OWN_BANS": {
+ "value": 1024,
+ "display": "Edit Own Bans"
+ },
+
+ "ADMIN_EDIT_GROUP_BANS": {
+ "value": 2048,
+ "display": "Edit Group Bans"
+ },
+
+ "ADMIN_EDIT_ALL_BANS": {
+ "value": 4096,
+ "display": "Edit All Bans"
+ },
+
+ "ADMIN_BAN_PROTESTS": {
+ "value": 8192,
+ "display": "Ban Appeals"
+ },
+
+ "ADMIN_BAN_SUBMISSIONS": {
+ "value": 16384,
+ "display": "Ban Reports"
+ },
+
+ "ADMIN_DELETE_BAN": {
+ "value": 33554432,
+ "display": "Delete All Bans"
+ },
+
+ "ADMIN_UNBAN": {
+ "value": 67108864,
+ "display": "Unban All Bans"
+ },
+
+ "ADMIN_BAN_IMPORT": {
+ "value": 134217728,
+ "display": "Import Bans"
+ },
+
+ "ADMIN_UNBAN_OWN_BANS": {
+ "value": 1073741824,
+ "display": "Unban Own Bans"
+ },
+
+ "ADMIN_UNBAN_GROUP_BANS": {
+ "value": 2147483648,
+ "display": "Unban Group Bans"
+ },
+
+ "ADMIN_LIST_GROUPS": {
+ "value": 32768,
+ "display": "View Groups"
+ },
+
+ "ADMIN_ADD_GROUP": {
+ "value": 65536,
+ "display": "Add Groups"
+ },
+
+ "ADMIN_EDIT_GROUPS": {
+ "value": 131072,
+ "display": "Edit Groups"
+ },
+
+ "ADMIN_DELETE_GROUPS": {
+ "value": 262144,
+ "display": "Delete Groups"
+ },
+
+ "ADMIN_WEB_SETTINGS": {
+ "value": 524288,
+ "display": "Web Settings"
+ },
+
+ "ADMIN_LIST_MODS": {
+ "value": 1048576,
+ "display": "View Mods"
+ },
+
+ "ADMIN_ADD_MODS": {
+ "value": 2097152,
+ "display": "Add Mods"
+ },
+
+ "ADMIN_EDIT_MODS": {
+ "value": 4194304,
+ "display": "Edit Mods"
+ },
+
+ "ADMIN_DELETE_MODS": {
+ "value": 8388608,
+ "display": "Delete Mods"
+ },
+
+ "ADMIN_NOTIFY_SUB": {
+ "value": 268435456,
+ "display": "Ban Report Email Notifications"
+ },
+
+ "ADMIN_NOTIFY_PROTEST": {
+ "value": 536870912,
+ "display": "Ban Appeal Email Notifications"
+ },
+
+ "ADMIN_OWNER": {
+ "value": 16777216,
+ "display": "Owner"
+ },
+
+ "ALL_WEB": {
+ "value": 4294966783,
+ "display": "All Web Permissions"
+ }
+}
diff --git a/web/configs/quotes.json b/web/configs/quotes.json
new file mode 100644
index 000000000..c5aaff798
--- /dev/null
+++ b/web/configs/quotes.json
@@ -0,0 +1,134 @@
+[
+ {
+ "author": "Viper",
+ "quote": "Buy a new PC!"
+ },
+ {
+ "author": "Brizad",
+ "quote": "I'm not lazy! I just utilize technical resources!"
+ },
+ {
+ "author": "sslice",
+ "quote": "I need to mow the lawn"
+ },
+ {
+ "author": "Viper",
+ "quote": "You're a Noob and You Know It!"
+ },
+ {
+ "author": "Viper",
+ "quote": "Like A Glove!"
+ },
+ {
+ "author": "Viper",
+ "quote": "Get your ass ingame."
+ },
+ {
+ "author": "Viper",
+ "quote": "Mother F***ing Peices of Sh**"
+ },
+ {
+ "author": "[Everyone]",
+ "quote": "Shut up Bam"
+ },
+ {
+ "author": "Viper",
+ "quote": "Hi OllyBunch"
+ },
+ {
+ "author": "[Unknown]",
+ "quote": "Procrastination is like masturbation. Sure it feels good, but in the end you're only F***ing yourself!"
+ },
+ {
+ "author": "SteamFriend",
+ "quote": "Rave's momma so fat she sat on the beach and Greenpeace threw her in"
+ },
+ {
+ "author": "Faith",
+ "quote": "Im just getting a beer"
+ },
+ {
+ "author": "Viper",
+ "quote": "To be honest..., I DON'T CARE!"
+ },
+ {
+ "author": "teame06",
+ "quote": "Yams"
+ },
+ {
+ "author": "gdogg",
+ "quote": "built in cheat 1.6 - my friend told me theres a cheat where u can buy a car door and run around and it makes u invincible...."
+ },
+ {
+ "author": "BAILOPAN",
+ "quote": "I just join conversation when i see a chance to tell people they might be wrong, then i quickly leave, LIKE A BAT"
+ },
+ {
+ "author": "[Everyone]",
+ "quote": "Let's just blame it on FlyingMongoose"
+ },
+ {
+ "author": "Recon",
+ "quote": "Don't step on that boom... mine..."
+ },
+ {
+ "author": "Recon",
+ "quote": "Looks through sniper scope... Sit ;)"
+ },
+ {
+ "author": "Recon",
+ "quote": "That plugin looks like something you found in a junk yard."
+ },
+ {
+ "author": "Recon",
+ "quote": "That's exactly what I asked you not to do."
+ },
+ {
+ "author": "Recon",
+ "quote": "Why are you wasting your time looking at this?"
+ },
+ {
+ "author": "Recon",
+ "quote": "You must have better things to do with your time"
+ },
+ {
+ "author": "Mr. T",
+ "quote": "I pity da fool"
+ },
+ {
+ "author": "Tsunami",
+ "quote": "you grew a 3rd head?"
+ },
+ {
+ "author": "devicenull",
+ "quote": "I dont think you want to know..."
+ },
+ {
+ "author": "Brizad",
+ "quote": "Sheep sex isn't baaaaaa...aad"
+ },
+ {
+ "author": "Brizad",
+ "quote": "Oh wow, he's got skillz spelled with an 's'"
+ },
+ {
+ "author": "Brizad",
+ "quote": "I'll get to it this weekend... I promise"
+ },
+ {
+ "author": "Marge Simpson",
+ "quote": "People do crazy things all the time... Like eat a Arby's"
+ },
+ {
+ "author": "SirTiger",
+ "quote": "I wish my lawn was emo, so it would cut itself"
+ },
+ {
+ "author": "Olly",
+ "quote": "Oh no! I've overflowed my balls!"
+ },
+ {
+ "author": "ISSUE_TEMPLATE.md",
+ "quote": "Pump me full of your precious information, Senpai!"
+ }
+]
diff --git a/web/configs/version.json b/web/configs/version.json
new file mode 100644
index 000000000..d6bb3b3e5
--- /dev/null
+++ b/web/configs/version.json
@@ -0,0 +1,5 @@
+{
+ "version": "1.7.0",
+ "git": "784",
+ "dev": true
+}
diff --git a/web/exportbans.php b/web/exportbans.php
index 50cc28cb0..143a93e28 100644
--- a/web/exportbans.php
+++ b/web/exportbans.php
@@ -1,7 +1,6 @@
HasAccess(ADMIN_OWNER) && !$exportpublic) {
+if (!$userbank->HasAccess(ADMIN_OWNER) && !Config::getBool('config.exportpublic')) {
echo "Don't have access to this feature.";
} else if (!isset($_GET['type'])) {
echo "You have to specify the type. Only follow links!";
diff --git a/web/includes/CUserManager.php b/web/includes/CUserManager.php
index 7d30689ec..7bab81978 100644
--- a/web/includes/CUserManager.php
+++ b/web/includes/CUserManager.php
@@ -242,7 +242,7 @@ public function login($aid, $password, $save = true)
* @param $password password to encrypt.
* @return string.
*/
- public function encrypt_password($password, $salt = SB_SALT)
+ public function encrypt_password($password, $salt = 'SourceBans')
{
return sha1(sha1($salt . $password));
}
diff --git a/web/includes/Config.php b/web/includes/Config.php
new file mode 100644
index 000000000..81d6d016e
--- /dev/null
+++ b/web/includes/Config.php
@@ -0,0 +1,32 @@
+query("SELECT * FROM `:prefix_settings`");
+ foreach(self::$dbh->resultset() as $data) {
+ $config[$data['setting']] = $data['value'];
+ }
+ return $config;
+ }
+}
diff --git a/web/includes/admin.php b/web/includes/admin.php
index 981230f1e..2740fd020 100644
--- a/web/includes/admin.php
+++ b/web/includes/admin.php
@@ -255,7 +255,7 @@
$banTabMenu = new CTabsMenu();
if ($userbank->HasAccess(ADMIN_OWNER|ADMIN_ADD_BAN)) {
$banTabMenu->addMenuItem("Add a ban", 0);
- if ($GLOBALS['config']['config.enablegroupbanning']==1) {
+ if (Config::getBool('config.enablegroupbanning')) {
$banTabMenu->addMenuItem("Group ban", 4);
}
}
diff --git a/web/includes/page-builder.php b/web/includes/page-builder.php
index 9915ab44a..dea61ae67 100644
--- a/web/includes/page-builder.php
+++ b/web/includes/page-builder.php
@@ -76,7 +76,7 @@
$page = TEMPLATES_PATH . "/page.home.php";
break;
default:
- switch ($GLOBALS['config']['config.defaultpage']) {
+ switch (Config::get('config.defaultpage')) {
case 1:
RewritePageTitle("Ban List");
$page = TEMPLATES_PATH . "/page.banlist.php";
diff --git a/web/includes/sb-callback.php b/web/includes/sb-callback.php
index a8a7a395f..557a5c378 100644
--- a/web/includes/sb-callback.php
+++ b/web/includes/sb-callback.php
@@ -30,7 +30,7 @@
include_once('system-functions.php');
$xajax = new xajax();
//$xajax->debugOn();
-$xajax->setRequestURI(XAJAX_REQUEST_URI);
+$xajax->setRequestURI('./index.php');
global $userbank;
if (\SessionManager::checkSession()) {
@@ -155,7 +155,7 @@ function LostPassword($email)
$message .= "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "?p=lostpassword&email=". $email . "&validation=" . $validation;
- $headers = 'From: ' . $GLOBALS['sb-email'] . "\n" .
+ $headers = 'From: ' . SB_EMAIL . "\n" .
'X-Mailer: PHP/' . phpversion();
$m = mail($email, "SourceBans Password Reset", $message, $headers);
@@ -360,7 +360,7 @@ function RemoveGroup($gid, $type)
$query0 = $GLOBALS['db']->Execute("DELETE FROM `" . DB_PREFIX . "_srvgroups_overrides` WHERE group_id = $gid");
}
- if(isset($GLOBALS['config']['config.enableadminrehashing']) && $GLOBALS['config']['config.enableadminrehashing'] == 1)
+ if(Config::getBool('config.enableadminrehashing'))
{
// rehash the settings out of the database on all servers
$serveraccessq = $GLOBALS['db']->GetAll("SELECT sid FROM ".DB_PREFIX."_servers WHERE enabled = 1;");
@@ -586,7 +586,7 @@ function RemoveAdmin($aid)
$delquery = $GLOBALS['db']->Execute(sprintf("DELETE FROM `%s_admins` WHERE aid = %d LIMIT 1", DB_PREFIX, $aid));
if($delquery) {
- if(isset($GLOBALS['config']['config.enableadminrehashing']) && $GLOBALS['config']['config.enableadminrehashing'] == 1)
+ if(Config::getBool('config.enableadminrehashing'))
{
// rehash the admins for the servers where this admin was on
$serveraccessq = $GLOBALS['db']->GetAll("SELECT s.sid FROM `".DB_PREFIX."_servers` s
@@ -1173,7 +1173,7 @@ function AddAdmin($mask, $srv_mask, $a_name, $a_steam, $a_email, $a_password, $a
if(!empty($server))
$GLOBALS['db']->Execute($addtosrv,array($aid, $server_admin_group_int, '-1', substr($server, 1)));
}
- if(isset($GLOBALS['config']['config.enableadminrehashing']) && $GLOBALS['config']['config.enableadminrehashing'] == 1)
+ if(Config::getBool('config.enableadminrehashing'))
{
// rehash the admins on the servers
$serveraccessq = $GLOBALS['db']->GetAll("SELECT s.sid FROM `".DB_PREFIX."_servers` s
@@ -1770,7 +1770,7 @@ function AddBan($nickname, $type, $steam, $ip, $length, $dfile, $dname, $reason,
$GLOBALS['db']->Execute("UPDATE `".DB_PREFIX."_submissions` SET archiv = '3', archivedby = '".$userbank->GetAid()."' WHERE SteamId = ?;", array($steam));
- $kickit = isset($GLOBALS['config']['config.enablekickit']) && $GLOBALS['config']['config.enablekickit'] == "1";
+ $kickit = Config::getBool('config.enablekickit');
if ($kickit) {
$objResponse->addScript("ShowKickBox('".((int)$type==0?$steam:$ip)."', '".(int)$type."');");
} else {
@@ -1999,7 +1999,7 @@ function EditAdminPerms($aid, $web_flags, $srv_flags)
// Update server stuff
$GLOBALS['db']->Execute("UPDATE `".DB_PREFIX."_admins` SET `srv_flags` = ?, `immunity` = ? WHERE `aid` = $aid", array($srv_flags, $immunity));
- if(isset($GLOBALS['config']['config.enableadminrehashing']) && $GLOBALS['config']['config.enableadminrehashing'] == 1)
+ if(Config::getBool('config.enableadminrehashing'))
{
// rehash the admins on the servers
$serveraccessq = $GLOBALS['db']->GetAll("SELECT s.sid FROM `".DB_PREFIX."_servers` s
@@ -2118,7 +2118,7 @@ function EditGroup($gid, $web_flags, $srv_flags, $type, $name, $overrides, $newO
}
}
- if(isset($GLOBALS['config']['config.enableadminrehashing']) && $GLOBALS['config']['config.enableadminrehashing'] == 1)
+ if(Config::getBool('config.enableadminrehashing'))
{
// rehash the settings out of the database on all servers
$serveraccessq = $GLOBALS['db']->GetAll("SELECT sid FROM ".DB_PREFIX."_servers WHERE enabled = 1;");
@@ -2613,7 +2613,7 @@ function RehashAdmins($server, $do=0)
function GroupBan($groupuri, $isgrpurl="no", $queue="no", $reason="", $last="")
{
$objResponse = new xajaxResponse();
- if($GLOBALS['config']['config.enablegroupbanning']==0)
+ if(!Config::getBool('config.enablegroupbanning'))
return $objResponse;
global $userbank, $username;
if(!$userbank->HasAccess(ADMIN_OWNER|ADMIN_ADD_BAN))
@@ -2653,7 +2653,7 @@ function BanMemberOfGroup($grpurl, $queue, $reason, $last)
{
set_time_limit(0);
$objResponse = new xajaxResponse();
- if ($GLOBALS['config']['config.enablegroupbanning'] == 0 || !defined('STEAMAPIKEY') || STEAMAPIKEY == '') {
+ if (!Config::getBool('config.enablegroupbanning') || !defined('STEAMAPIKEY') || STEAMAPIKEY == '') {
return $objResponse;
}
global $userbank, $username;
@@ -2746,7 +2746,7 @@ function GetGroups($friendid)
{
set_time_limit(0);
$objResponse = new xajaxResponse();
- if($GLOBALS['config']['config.enablegroupbanning']==0 || !is_numeric($friendid))
+ if(!Config::getBool('config.enablegroupbanning') || !is_numeric($friendid))
return $objResponse;
global $userbank, $username;
if(!$userbank->HasAccess(ADMIN_OWNER|ADMIN_ADD_BAN))
@@ -2825,7 +2825,7 @@ function BanFriends($friendid, $name)
global $userbank, $username;
$objResponse = new xajaxResponse();
$name = filter_var($name, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
- if ($GLOBALS['config']['config.enablefriendsbanning'] == 0 || !is_numeric($friendid)) {
+ if (!Config::getBool('config.enablefriendsbanning') || !is_numeric($friendid)) {
return $objResponse;
}
diff --git a/web/includes/system-functions.php b/web/includes/system-functions.php
index 5a585e61e..1d28542cb 100644
--- a/web/includes/system-functions.php
+++ b/web/includes/system-functions.php
@@ -86,7 +86,7 @@ function AddTab($title, $url, $desc, $active=false)
$tabs['title'] = $title;
$tabs['url'] = $url;
$tabs['desc'] = $desc;
- if ($_GET['p'] == "default" && $title == $tab_arr[intval($GLOBALS['config']['config.defaultpage'])]) {
+ if ($_GET['p'] == "default" && $title == $tab_arr[intval(Config::get('config.defaultpage'))]) {
$tabs['active'] = true;
$GLOBALS['pagetitle'] = $title;
} else {
@@ -111,13 +111,13 @@ function BuildPageTabs()
AddTab("Dashboard", "index.php?p=home", "This page shows an overview of your bans and servers.");
AddTab("Servers", "index.php?p=servers", "All of your servers and their status can be viewed here");
AddTab("Bans", "index.php?p=banlist", "All of the bans in the database can be viewed from here.");
- if ($GLOBALS['config']['config.enablecomms'] == "1") {
+ if (Config::getBool('config.enablecomms')) {
AddTab("Comms", "index.php?p=commslist", "All of the communication bans (such as chat gags and voice mutes) in the database can be viewed from here.");
}
- if ($GLOBALS['config']['config.enablesubmit']=="1") {
+ if (Config::getBool('config.enablesubmit')) {
AddTab("Report a Player", "index.php?p=submit", "You can submit a demo or screenshot of a suspected cheater here. It will then be up for review by one of the admins");
}
- if ($GLOBALS['config']['config.enableprotest']=="1") {
+ if (Config::getBool('config.enableprotest')) {
AddTab("Appeal a Ban", "index.php?p=protest", "Here you can appeal your ban. And prove your case as to why you should be unbanned.");
}
if ($userbank->is_admin()) {
@@ -244,226 +244,41 @@ function RewritePageTitle($title)
$GLOBALS['TitleRewrite'] = $title;
}
-/**
- * Build sub-menu
- *
- * @param array $el The array of elements for the menu
- * @return noreturn
- */
-function SubMenu($el)
+function BitToString($mask)
{
- $output = "";
- $first = true;
- foreach ($el as $e) {
- preg_match('/.*?&c=(.*)/', html_entity_decode($e['url']), $matches);
- if (!empty($matches[1])) {
- $c = $matches[1];
- }
+ $perms = json_decode(file_get_contents(ROOT.'/configs/permissions/web.json'), true);
- $output .= "" . $e['title']. "";
- $first = false;
- }
- $GLOBALS['NavRewrite'] = $output;
-}
-
-/**
- * Converts a flag bitmask into a string
- *
- * @param integer $mask The mask to convert
- * @return string
- */
-function BitToString($mask, $masktype=0, $head=true)
-{
- $string = "";
- if ($head) {
- $string .= "Web Permissions
";
- }
if ($mask == 0) {
- $string .= "None";
- return $string;
- }
- if (($mask & ADMIN_LIST_ADMINS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• View Admins
";
- }
- if (($mask & ADMIN_ADD_ADMINS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Add Admins
";
- }
- if (($mask & ADMIN_EDIT_ADMINS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Edit Admins
";
- }
- if (($mask & ADMIN_DELETE_ADMINS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Delete Admins
";
- }
-
- if (($mask & ADMIN_LIST_SERVERS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• View Servers
";
- }
- if (($mask & ADMIN_ADD_SERVER) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Add Servers
";
- }
- if (($mask & ADMIN_EDIT_SERVERS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Edit Servers
";
- }
- if (($mask & ADMIN_DELETE_SERVERS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Delete Servers
";
- }
-
- if (($mask & ADMIN_ADD_BAN) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Add Bans
";
- }
- if (($mask & ADMIN_EDIT_OWN_BANS) !=0 && ($mask & ADMIN_EDIT_ALL_BANS) ==0) {
- $string .="• Edit Own Bans
";
- }
- if (($mask & ADMIN_EDIT_GROUP_BANS) !=0 && ($mask & ADMIN_EDIT_ALL_BANS) ==0) {
- $string .= "• Edit Group Bans
";
- }
- if (($mask & ADMIN_EDIT_ALL_BANS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Edit All Bans
";
- }
- if (($mask & ADMIN_BAN_PROTESTS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Ban Appeals
";
- }
- if (($mask & ADMIN_BAN_SUBMISSIONS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Ban Reports
";
- }
-
- if (($mask & ADMIN_UNBAN_OWN_BANS) !=0 && ($mask & ADMIN_UNBAN) ==0) {
- $string .= "• Unban Own Bans
";
- }
- if (($mask & ADMIN_UNBAN_GROUP_BANS) !=0 && ($mask & ADMIN_UNBAN) ==0) {
- $string .= "• Unban Group Bans
";
- }
- if (($mask & ADMIN_UNBAN) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Unban All Bans
";
- }
- if (($mask & ADMIN_DELETE_BAN) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Delete All Bans
";
- }
- if (($mask & ADMIN_BAN_IMPORT) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Import Bans
";
- }
-
- if (($mask & ADMIN_LIST_GROUPS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• View Groups
";
- }
- if (($mask & ADMIN_ADD_GROUP) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Add Groups
";
- }
- if (($mask & ADMIN_EDIT_GROUPS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Edit Groups
";
- }
- if (($mask & ADMIN_DELETE_GROUPS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Delete Groups
";
- }
-
- if (($mask & ADMIN_NOTIFY_SUB) !=0 || ($mask & ADMIN_NOTIFY_SUB) !=0) {
- $string .= "• Ban Report Email Notifications
";
- }
- if (($mask & ADMIN_NOTIFY_PROTEST) !=0 || ($mask & ADMIN_NOTIFY_PROTEST) !=0) {
- $string .= "• Ban Appeal Email Notifications
";
- }
-
- if (($mask & ADMIN_WEB_SETTINGS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Web Settings
";
- }
-
- if (($mask & ADMIN_LIST_MODS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• View Mods
";
- }
- if (($mask & ADMIN_ADD_MODS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Add Mods
";
- }
- if (($mask & ADMIN_EDIT_MODS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Edit Mods
";
- }
- if (($mask & ADMIN_DELETE_MODS) !=0 || ($mask & ADMIN_OWNER) !=0) {
- $string .= "• Delete Mods
";
+ return false;
}
- if (($mask & ADMIN_OWNER) !=0) {
- $string .= "• Owner
";
+ foreach ($perms as $perm) {
+ if (($mask & $perm['value']) != 0 || ($mask & ADMIN_OWNER) != 0) {
+ if ($perm['value'] != ALL_WEB) {
+ $out[] = $perm['display'];
+ }
+ }
}
- return $string;
+ return $out;
}
-function SmFlagsToSb($flagstring, $head=true)
+function SmFlagsToSb($flagstring)
{
- $string = "";
- if ($head) {
- $string .= "Server Permissions
";
- }
+ $flags = json_decode(file_get_contents(ROOT.'/configs/permissions/sourcemod.json'), true);
+
if (empty($flagstring)) {
- $string .= "None";
- return $string;
- }
- if ((strstr($flagstring, "a") || strstr($flagstring, "z"))) {
- $string .= "• Reserved Slot
";
- }
- if ((strstr($flagstring, "b") || strstr($flagstring, "z"))) {
- $string .= "• Generic Admin
";
- }
- if ((strstr($flagstring, "c") || strstr($flagstring, "z"))) {
- $string .= "• Kick
";
- }
- if ((strstr($flagstring, "d") || strstr($flagstring, "z"))) {
- $string .= "• Ban
";
- }
- if ((strstr($flagstring, "e") || strstr($flagstring, "z"))) {
- $string .= "• Unban
";
- }
- if ((strstr($flagstring, "f") || strstr($flagstring, "z"))) {
- $string .= "• Slay
";
- }
- if ((strstr($flagstring, "g") || strstr($flagstring, "z"))) {
- $string .= "• Map Change
";
- }
- if ((strstr($flagstring, "h") || strstr($flagstring, "z"))) {
- $string .= "• Change CVars
";
- }
- if ((strstr($flagstring, "i") || strstr($flagstring, "z"))) {
- $string .= "• Run Configs
";
- }
- if ((strstr($flagstring, "j") || strstr($flagstring, "z"))) {
- $string .= "• Admin Chat
";
- }
- if ((strstr($flagstring, "k") || strstr($flagstring, "z"))) {
- $string .="• Start Votes
";
- }
- if ((strstr($flagstring, "l") || strstr($flagstring, "z"))) {
- $string .="• Password Server
";
- }
- if ((strstr($flagstring, "m") || strstr($flagstring, "z"))) {
- $string .="• RCON
";
- }
- if ((strstr($flagstring, "n") || strstr($flagstring, "z"))) {
- $string .="• Enable Cheats
";
- }
- if ((strstr($flagstring, "z"))) {
- $string .="• Full Admin
";
+ return false;
}
- if ((strstr($flagstring, "o") || strstr($flagstring, "z"))) {
- $string .="• Custom Flag 1
";
- }
- if ((strstr($flagstring, "p") || strstr($flagstring, "z"))) {
- $string .="• Custom Flag 2
";
- }
- if ((strstr($flagstring, "q") || strstr($flagstring, "z"))) {
- $string .="• Custom Flag 3
";
- }
- if ((strstr($flagstring, "r") || strstr($flagstring, "z"))) {
- $string .="• Custom flag 4
";
- }
- if ((strstr($flagstring, "s") || strstr($flagstring, "z"))) {
- $string .="• Custom Flag 5
";
- }
- if ((strstr($flagstring, "t") || strstr($flagstring, "z"))) {
- $string .="• Custom Flag 6
";
+ foreach ($flags as $flag) {
+ if (strstr($flagstring, $flag['value']) || strstr($flagstring, 'z')) {
+ $out[] = $flag['display'];
+ }
}
- return $string;
+ return $out;
}
function NextSid()
@@ -493,44 +308,9 @@ function trunc($text, $len, $byword=true)
function CreateQuote()
{
- global $userbank;
- $quote = array(
- array("Buy a new PC!", "Viper"),
- array("I'm not lazy! I just utilize technical resources!", "Brizad"),
- array("I need to mow the lawn", "sslice"),
- array("Like A Glove!", "Viper"),
- array("Your a Noob and You Know It!", "Viper"),
- array("Get your ass ingame", "Viper"),
- array("Mother F***ing Peices of Sh**", "Viper"),
- array("Shut up Bam", "[Everyone]"),
- array("Hi OllyBunch", "Viper"),
- array("Procrastination is like masturbation. Sure it feels good, but in the end you're only F***ing yourself!", "[Unknown]"),
- array("Rave's momma so fat she sat on the beach and Greenpeace threw her in", "SteamFriend"),
- array("Im just getting a beer", "Faith"),
- array("To be honest " . ($userbank->is_logged_in()?$userbank->getProperty('user'):'...') . ", I DONT CARE!", "Viper"),
- array("Yams", "teame06"),
- array("built in cheat 1.6 - my friend told me theres a cheat where u can buy a car door and run around and it makes u invincible....", "gdogg"),
- array("i just join conversation when i see a chance to tell people they might be wrong, then i quickly leave, LIKE A BAT", "BAILOPAN"),
- array("Lets just blame it on FlyingMongoose", "[Everyone]"),
- array("Don't step on that boom... mine...", "Recon"),
- array("Looks through sniper scope... Sit ;)", "Recon"),
- array("That plugin looks like something you found in a junk yard.", "Recon"),
- array("That's exactly what I asked you not to do.", "Recon"),
- array("Why are you wasting your time looking at this?", "Recon"),
- array("You must have better things to do with your time", "Recon"),
- array("I pity da fool", "Mr. T"),
- array("you grew a 3rd head?", "Tsunami"),
- array("I dont think you want to know...", "devicenull"),
- array("Sheep sex isn't baaaaaa...aad", "Brizad"),
- array("Oh wow, he's got skillz spelled with an 's'", "Brizad"),
- array("I'll get to it this weekend... I promise", "Brizad"),
- array("People do crazy things all the time... Like eat a Arby's", "Marge Simpson"),
- array("I wish my lawn was emo, so it would cut itself", "SirTiger"),
- array("Oh no! I've overflowed my balls!", "Olly"),
- array("Pump me full of your precious information, Senpai!", "ISSUE_TEMPLATE.md")
- );
- $num = rand(0, sizeof($quote)-1);
- return '"' . $quote[$num][0] . '" - ' . $quote[$num][1] . '';
+ $quotes = json_decode(file_get_contents('configs/quotes.json'), true);
+ $num = rand(0, count($quotes) - 1);
+ return '"'.$quotes[$num]['quote'].'" - '.$quotes[$num]['author'].'';
}
function CheckAdminAccess($mask)
diff --git a/web/init.php b/web/init.php
index ec2ef0041..4c585b7a7 100644
--- a/web/init.php
+++ b/web/init.php
@@ -52,31 +52,13 @@
define('SB_THEMES_COMPILE', ROOT . 'themes_c/');
define('IN_SB', true);
-define('XAJAX_REQUEST_URI', './index.php');
require_once(INCLUDES_PATH.'/SessionManager.php');
include_once(INCLUDES_PATH . "/CUserManager.php");
\SessionManager::sessionStart('SourceBans');
-// ---------------------------------------------------
-// Fix some $_SERVER vars
-// ---------------------------------------------------
-// Fix for IIS, which doesn't set REQUEST_URI
-if (!isset($_SERVER['REQUEST_URI']) || trim($_SERVER['REQUEST_URI']) == '') {
- $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
- if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
- $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
- }
-}
-// Fix for Dreamhost and other PHP as CGI hosts
-if (strstr($_SERVER['SCRIPT_NAME'], 'php.cgi')) {
- unset($_SERVER['PATH_INFO']);
-}
-
-if (trim($_SERVER['PHP_SELF']) == '') {
- $_SERVER['PHP_SELF'] = preg_replace("/(\?.*)?$/", '', $_SERVER["REQUEST_URI"]);
-}
+require_once(INCLUDES_PATH.'/SourceQuery/bootstrap.php');
// ---------------------------------------------------
// Are we installed?
@@ -105,24 +87,10 @@
// ---------------------------------------------------
// Initial setup
// ---------------------------------------------------
-define('SB_GIT', true);
-if (!defined('SB_VERSION')) {
- if (file_exists('version.json')) {
- $json = json_decode(file_get_contents('version.json'), true);
- define('SB_VERSION', $json['version']);
- define('SB_GITREV', $json['git']);
- define('SB_DEV', $json['dev']);
- } else {
- define('SB_VERSION', 'N/A');
- define('SB_GITREV', '0');
- define('SB_DEV', false);
- }
-}
-define('LOGIN_COOKIE_LIFETIME', (60*60*24*7)*2);
-define('COOKIE_PATH', '/');
-define('COOKIE_DOMAIN', '');
-define('COOKIE_SECURE', false);
-define('SB_SALT', 'SourceBans');
+$version = @json_decode(file_get_contents('configs/version.json'), true);
+define('SB_VERSION', isset($version['version']) ? $version['version'] : 'N/A');
+define('SB_GITREV', isset($version['git']) ? $version['git'] : 0);
+define('SB_DEV', isset($version['dev']) ? $version['dev'] : false);
// ---------------------------------------------------
// Setup PHP
@@ -153,7 +121,6 @@
require_once(INCLUDES_PATH.'/Database.php');
$GLOBALS['db'] = ADONewConnection("mysqli://".DB_USER.':'.urlencode(DB_PASS).'@'.DB_HOST.':'.DB_PORT.'/'.DB_NAME);
$GLOBALS['PDO'] = new Database(DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASS, DB_PREFIX, DB_CHARSET);
-$GLOBALS['sb-email'] = SB_EMAIL;
if (!is_object($GLOBALS['db'])) {
die();
@@ -161,20 +128,15 @@
$GLOBALS['db']->Execute("SET NAMES ".DB_CHARSET.";");
-$mysql_server_info = $GLOBALS['db']->ServerInfo();
-$GLOBALS['db_version'] = $mysql_server_info['version'];
-
-$debug = $GLOBALS['db']->Execute("SELECT value FROM `".DB_PREFIX."_settings` WHERE setting = 'config.debug';");
-if ($debug->fields['value']=="1") {
- define("DEVELOPER_MODE", true);
-}
-
require_once(INCLUDES_PATH.'/SteamID/bootstrap.php');
\SteamID\SteamID::init($GLOBALS['PDO']);
require_once(INCLUDES_PATH.'/Log.php');
Log::init($GLOBALS['PDO']);
+require_once(INCLUDES_PATH.'/Config.php');
+Config::init($GLOBALS['PDO']);
+
// ---------------------------------------------------
// Setup our custom error handler
// ---------------------------------------------------
@@ -183,127 +145,37 @@ function sbError($errno, $errstr, $errfile, $errline)
{
switch ($errno) {
case E_USER_ERROR:
- $msg = "[$errno] $errstr
\n";
- $msg .= "Fatal error on line $errline in file $errfile";
- Log::add("e", "PHP Error", $msg);
- exit(1);
- break;
-
+ Log::add('e', 'PHP Error', "[$errno] $errstr\nFatal Error on line $errline in file $errfile");
+ return true;
case E_USER_WARNING:
- $msg = "[$errno] $errstr
\n";
- $msg .= "Error on line $errline in file $errfile";
- Log::add("w", "PHP Warning", $msg);
- break;
-
+ Log::add('w', 'PHP Warning', "[$errno] $errstr\nError on line $errline in file $errfile");
+ return true;
case E_USER_NOTICE:
- $msg = "[$errno] $errstr
\n";
- $msg .= "Notice on line $errline in file $errfile";
- Log::add("m", "PHP Notice", $msg);
- break;
-
+ Log::add('m', 'PHP Notice', "[$errno] $errstr\nNotice on line $errline in file $errfile");
+ return true;
default:
return false;
- break;
}
-
- /* Don't execute PHP internal error handler */
- return true;
}
// ---------------------------------------------------
// Some defs
// ---------------------------------------------------
-define('EMAIL_FORMAT', "/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/");
-define('URL_FORMAT', "/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}((:[0-9]{1,5})?\/.*)?$/i");
-define('STEAM_FORMAT', "/^STEAM_[0-9]:[0-9]:[0-9]+$/");
define('STATUS_PARSE', '/#.* +([0-9]+) +"(.+)" +(STEAM_[0-9]:[0-9]:[0-9]+|\[U:[0-9]:[0-9]+\]) +([0-9:]+) +([0-9]+) +([0-9]+) +([a-zA-Z]+).* +([0-9.:]+)/');
-define('IP_FORMAT', '/\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/');
-define('SERVER_QUERY', 'http://www.sourcebans.net/public/query/');
-
-// Web admin-flags
-define('ADMIN_LIST_ADMINS', (1<<0));
-define('ADMIN_ADD_ADMINS', (1<<1));
-define('ADMIN_EDIT_ADMINS', (1<<2));
-define('ADMIN_DELETE_ADMINS', (1<<3));
-
-define('ADMIN_LIST_SERVERS', (1<<4));
-define('ADMIN_ADD_SERVER', (1<<5));
-define('ADMIN_EDIT_SERVERS', (1<<6));
-define('ADMIN_DELETE_SERVERS', (1<<7));
-
-define('ADMIN_ADD_BAN', (1<<8));
-define('ADMIN_EDIT_OWN_BANS', (1<<10));
-define('ADMIN_EDIT_GROUP_BANS', (1<<11));
-define('ADMIN_EDIT_ALL_BANS', (1<<12));
-define('ADMIN_BAN_PROTESTS', (1<<13));
-define('ADMIN_BAN_SUBMISSIONS', (1<<14));
-define('ADMIN_DELETE_BAN', (1<<25));
-define('ADMIN_UNBAN', (1<<26));
-define('ADMIN_BAN_IMPORT', (1<<27));
-define('ADMIN_UNBAN_OWN_BANS', (1<<30));
-define('ADMIN_UNBAN_GROUP_BANS', (1<<31));
-
-define('ADMIN_LIST_GROUPS', (1<<15));
-define('ADMIN_ADD_GROUP', (1<<16));
-define('ADMIN_EDIT_GROUPS', (1<<17));
-define('ADMIN_DELETE_GROUPS', (1<<18));
-
-define('ADMIN_WEB_SETTINGS', (1<<19));
-
-define('ADMIN_LIST_MODS', (1<<20));
-define('ADMIN_ADD_MODS', (1<<21));
-define('ADMIN_EDIT_MODS', (1<<22));
-define('ADMIN_DELETE_MODS', (1<<23));
-
-define('ADMIN_NOTIFY_SUB', (1<<28));
-define('ADMIN_NOTIFY_PROTEST', (1<<29));
-
-define('ADMIN_OWNER', (1<<24));
-
-// Server admin-flags
-define('SM_RESERVED_SLOT', "a");
-define('SM_GENERIC', "b");
-define('SM_KICK', "c");
-define('SM_BAN', "d");
-define('SM_UNBAN', "e");
-define('SM_SLAY', "f");
-define('SM_MAP', "g");
-define('SM_CVAR', "h");
-define('SM_CONFIG', "i");
-define('SM_CHAT', "j");
-define('SM_VOTE', "k");
-define('SM_PASSWORD', "l");
-define('SM_RCON', "m");
-define('SM_CHEATS', "n");
-define('SM_ROOT', "z");
-
-define('SM_CUSTOM1', "o");
-define('SM_CUSTOM2', "p");
-define('SM_CUSTOM3', "q");
-define('SM_CUSTOM4', "r");
-define('SM_CUSTOM5', "s");
-define('SM_CUSTOM6', "t");
-
-
-define('ALL_WEB', ADMIN_LIST_ADMINS|ADMIN_ADD_ADMINS|ADMIN_EDIT_ADMINS|ADMIN_DELETE_ADMINS|ADMIN_LIST_SERVERS|ADMIN_ADD_SERVER|
- ADMIN_EDIT_SERVERS|ADMIN_DELETE_SERVERS|ADMIN_ADD_BAN|ADMIN_EDIT_OWN_BANS|ADMIN_EDIT_GROUP_BANS|
- ADMIN_EDIT_ALL_BANS|ADMIN_BAN_PROTESTS|ADMIN_BAN_SUBMISSIONS|ADMIN_LIST_GROUPS|ADMIN_ADD_GROUP|ADMIN_EDIT_GROUPS|
- ADMIN_DELETE_GROUPS|ADMIN_WEB_SETTINGS|ADMIN_LIST_MODS|ADMIN_ADD_MODS|ADMIN_EDIT_MODS|ADMIN_DELETE_MODS|ADMIN_OWNER|
- ADMIN_DELETE_BAN|ADMIN_UNBAN|ADMIN_BAN_IMPORT|ADMIN_UNBAN_OWN_BANS|ADMIN_UNBAN_GROUP_BANS|ADMIN_NOTIFY_SUB|ADMIN_NOTIFY_PROTEST);
-
-define('ALL_SERVER', SM_RESERVED_SLOT.SM_GENERIC.SM_KICK.SM_BAN.SM_UNBAN.SM_SLAY.SM_MAP.SM_CVAR.SM_CONFIG.SM_VOTE.SM_PASSWORD.SM_RCON.
- SM_CHEATS.SM_CUSTOM1.SM_CUSTOM2.SM_CUSTOM3. SM_CUSTOM4.SM_CUSTOM5.SM_CUSTOM6.SM_ROOT);
-
-$res = $GLOBALS['db']->Execute("SELECT * FROM ".DB_PREFIX."_settings GROUP BY `setting`, `value`");
-$GLOBALS['config'] = array();
-while (!$res->EOF) {
- $setting = array($res->fields['setting'] => $res->fields['value']);
- $GLOBALS['config'] = array_merge_recursive($GLOBALS['config'], $setting);
- $res->MoveNext();
+
+$webflags = json_decode(file_get_contents(ROOT.'/configs/permissions/web.json'), true);
+foreach ($webflags as $flag => $perm) {
+ define($flag, $perm['value']);
}
+$smflags = json_decode(file_get_contents(ROOT.'/configs/permissions/sourcemod.json'), true);
+foreach ($smflags as $flag => $perm) {
+ define($flag, $perm['value']);
+}
+
+define("DEVELOPER_MODE", Config::getBool('config.debug'));
+define('SB_BANS_PER_PAGE', Config::get('banlist.bansperpage'));
+define('MIN_PASS_LENGTH', Config::get('config.password.minlength'));
-define('SB_BANS_PER_PAGE', $GLOBALS['config']['banlist.bansperpage']);
-define('MIN_PASS_LENGTH', $GLOBALS['config']['config.password.minlength']);
-$dateformat = !empty($GLOBALS['config']['config.dateformat'])?$GLOBALS['config']['config.dateformat']:"m-d-y H:i";
+$dateformat = (Config::getBool('config.dateformat')) ? Config::get('config.dateformat') : 'm-d-y H:i';
// ---------------------------------------------------
// Setup our templater
@@ -312,7 +184,7 @@ function sbError($errno, $errstr, $errfile, $errline)
global $theme, $userbank;
-$theme_name = isset($GLOBALS['config']['config.theme'])?$GLOBALS['config']['config.theme']:'default';
+$theme_name = (Config::getBool('config.theme')) ? Config::get('config.theme') : 'default';
if (defined("IS_UPDATE")) {
$theme_name = "default";
}
diff --git a/web/install/includes/converter.inc.php b/web/install/includes/converter.inc.php
index f90cbe134..a60ce68d4 100644
--- a/web/install/includes/converter.inc.php
+++ b/web/install/includes/converter.inc.php
@@ -66,78 +66,4 @@ function convertAmxbans($oldDB, $newDB)
$newDB->execute();
}
echo "OK
";
- /*
- echo "Converting ".$fromprefix."_banhistory... ";
- ob_flush();
- $res = $olddb->Execute("SELECT player_ip, player_id, player_nick, ban_created, ban_length, ban_reason, admin_ip, admin_id, admin_nick
- ,server_ip, server_name, unban_created FROM ".$fromprefix."_banhistory");
- $ins = $newdb->Prepare("INSERT INTO ".$toprefix."_banhistory(Type,ip,authid,name,created,ends,length,reason,adminIp,Adminid,RemovedOn,RemovedBy) VALUES ('U',?,?,?,?,?,?,?,?,?,?,?)");
- while (!$res->EOF)
- {
- $vals = array($res->fields[0],$res->fields[1],$res->fields[2],$res->fields[3],($res->fields[4] == 0 ? 0 : $res->fields[3]+$res->fields[4])
- ,$res->fields[4],$res->fields[5],$res->fields[6],$res->fields[7],$res->fields[8],$res->fields[7]);
-
- foreach ($vals as $ind=>$cur)
- {
- if (is_null($cur))
- {
- $vals[$ind] = '';
- }
- }
- $newdb->Execute($ins,$vals);
- $res->MoveNext();
- }
- echo "OK
";
-
- echo "Converting ".$fromprefix."_levels... ";
- ob_flush();
- $res = $olddb->Execute("SELECT level, bans_add, bans_edit, bans_delete, bans_unban, bans_import, bans_export, amxadmins_view, amxadmins_edit
- , webadmins_view, webadmins_edit, permissions_edit, servers_edit FROM ".$fromprefix."_levels");
- $ins = $newdb->Prepare("INSERT INTO ".$toprefix."_groups(type,name,flags) VALUES (1,?,?)");
- $levelconvert = array();
- while (!$res->EOF)
- {
- $acc = 0;
- if ($res->fields[1] == 'yes' || $res->fields[2] == 'yes' || $res->fields[3] == 'yes' || $res->fields[4] == 'yes')
- {
- $acc |= ADMIN_WEB_BANS;
- }
- // amxadmins_view is ignored
- if ($res->fields[6] == 'yes')
- {
- $acc |= ADMIN_SERVER_ADMINS;
- }
- // webadmins_view is ignored
- if ($res->fields[8] == 'yes')
- {
- $acc |= ADMIN_WEB_AGROUPS;
- }
- if ($res->fields[9] == 'yes')
- {
- $acc |= ADMIN_WEB_AGROUPS | ADMIN_SERVER_AGROUPS;
- }
- if ($res->fields[10] == 'yes')
- {
- $acc |= ADMIN_SERVER_ADD | ADMIN_SERVER_REMOVE | ADMIN_SERVER_GROUPS;
- }
- if ($res->fields[0] == '1')
- {
- $acc |= ADMIN_OWNER;
- }
- $newdb->Execute($ins,array("AMXBANS_".$res->fields[0],$acc));
- $levelconvert[$res->fields[0]] = $newdb->Insert_ID();
- $res->MoveNext();
- }
- echo "OK
";
-
- echo "Converting ".$fromprefix."_admins... ";
- ob_flush();
- $res = $olddb->Execute("SELECT username, level FROM ".$fromprefix."_webadmins");
- $ins = $newdb->Prepare("INSERT INTO ".$toprefix."_admins(user,name,gid) VALUES (?,?,?)");
- while (!$res->EOF)
- {
- $newdb->Execute($ins,array($res->fields[0],$res->fields[0],$levelconvert[$res->fields[1]]));
- $res->MoveNext();
- }
- echo "OK
"; */
- }
+}
diff --git a/web/install/includes/data.sql b/web/install/includes/data.sql
index b992722d4..9e6aec7e2 100644
--- a/web/install/includes/data.sql
+++ b/web/install/includes/data.sql
@@ -1,43 +1,41 @@
INSERT INTO `{prefix}_mods` (`mid`, `name`, `icon`, `modfolder`, `steam_universe`) VALUES
-(1, 'Web', 'web.png', 'NULL', '0'),
-(2, 'Half-Life 2 Deathmatch', 'hl2dm.png', 'hl2mp', '0'),
-(3, 'Counter-Strike: Source', 'csource.png', 'cstrike', '0'),
-(4, 'Day of Defeat: Source', 'dods.png', 'dod', '0'),
-(5, 'Insurgency: Source', 'ins.png', 'insurgency', '0'),
-(6, 'Dystopia', 'dys.png', 'dystopia_v1', '0'),
-(7, 'Hidden: Source', 'hidden.png', 'hidden', '0'),
-(8, 'Half-Life 2 Capture the Flag', 'hl2ctf.png', 'hl2ctf', '0'),
-(9, 'Pirates Vikings and Knights II', 'pvkii.png', 'pvkii', '0'),
-(10, 'Perfect Dark: Source', 'pdark.png', 'pdark', '0'),
-(11, 'The Ship', 'ship.png', 'ship', '0'),
-(12, 'Fortress Forever', 'hl2-fortressforever.png', 'FortressForever', '0'),
-(13, 'Team Fortress 2', 'tf2.png', 'tf', '0'),
-(14, 'Zombie Panic', 'zps.png', 'zps', '0'),
-(15, "Garry's Mod", 'gmod.png', 'garrysmod', '0'),
-(16, "Left 4 Dead", 'l4d.png', 'left4dead', '1'),
-(17, "Left 4 Dead 2", 'l4d2.png', 'left4dead2', '1'),
-(18, "CSPromod", 'cspromod.png', 'cspromod', '0'),
-(19, "Alien Swarm", 'alienswarm.png', 'alienswarm', '0'),
-(20, "E.Y.E: Divine Cybermancy", 'eye.png', 'eye', '0'),
-(21, "Nuclear Dawn", 'nucleardawn.png', 'nucleardawn', '0'),
-(22, "Counter-Strike: Global Offensive", 'csgo.png', 'csgo', '1'),
-(23, 'Synergy', 'synergy.png', 'synergy', '0');
-
-UPDATE `{prefix}_mods` SET `mid` = '0' WHERE `name` = 'Web';
+(0, 'Web', 'web.png', 'NULL', '0'),
+(1, 'Half-Life 2 Deathmatch', 'hl2dm.png', 'hl2mp', '0'),
+(2, 'Counter-Strike: Source', 'csource.png', 'cstrike', '0'),
+(3, 'Day of Defeat: Source', 'dods.png', 'dod', '0'),
+(4, 'Insurgency: Source', 'ins.png', 'insurgency', '0'),
+(5, 'Dystopia', 'dys.png', 'dystopia_v1', '0'),
+(6, 'Hidden: Source', 'hidden.png', 'hidden', '0'),
+(7, 'Half-Life 2 Capture the Flag', 'hl2ctf.png', 'hl2ctf', '0'),
+(8, 'Pirates Vikings and Knights II', 'pvkii.png', 'pvkii', '0'),
+(9, 'Perfect Dark: Source', 'pdark.png', 'pdark', '0'),
+(10, 'The Ship', 'ship.png', 'ship', '0'),
+(11, 'Fortress Forever', 'hl2-fortressforever.png', 'FortressForever', '0'),
+(12, 'Team Fortress 2', 'tf2.png', 'tf', '0'),
+(13, 'Zombie Panic', 'zps.png', 'zps', '0'),
+(14, "Garry's Mod", 'gmod.png', 'garrysmod', '0'),
+(15, "Left 4 Dead", 'l4d.png', 'left4dead', '1'),
+(16, "Left 4 Dead 2", 'l4d2.png', 'left4dead2', '1'),
+(17, "CSPromod", 'cspromod.png', 'cspromod', '0'),
+(18, "Alien Swarm", 'alienswarm.png', 'alienswarm', '0'),
+(19, "E.Y.E: Divine Cybermancy", 'eye.png', 'eye', '0'),
+(20, "Nuclear Dawn", 'nucleardawn.png', 'nucleardawn', '0'),
+(21, "Counter-Strike: Global Offensive", 'csgo.png', 'csgo', '1'),
+(22, 'Synergy', 'synergy.png', 'synergy', '0');
INSERT INTO `{prefix}_settings` (`setting`, `value`) VALUES
-('dash.intro.text', '
Your new SourceBans install
SourceBans successfully installed!
Your new SourceBans install
SourceBans++ successfully installed!
"; - print_r($array); - echo ""; -} - -function NextGid() -{ - $gid = $GLOBALS['db']->GetRow("SELECT MAX(gid) AS next_gid FROM `" . DB_PREFIX . "_groups`"); - return ($gid['next_gid']+1); -} -function NextSGid() -{ - $gid = $GLOBALS['db']->GetRow("SELECT MAX(id) AS next_id FROM `" . DB_PREFIX . "_srvgroups`"); - return ($gid['next_id']+1); -} -function NextSid() -{ - $sid = $GLOBALS['db']->GetRow("SELECT MAX(sid) AS next_sid FROM `" . DB_PREFIX . "_servers`"); - return ($sid['next_sid']+1); -} -function NextAid() -{ - $aid = $GLOBALS['db']->GetRow("SELECT MAX(aid) AS next_aid FROM `" . DB_PREFIX . "_admins`"); - return ($aid['next_aid']+1); -} - -function trunc($text, $len, $byword=true) -{ - if(strlen($text) <= $len) - return $text; - $text = $text." "; - $text = substr($text,0,$len); - if($byword) - $text = substr($text,0,strrpos($text,' ')); - $text = $text."..."; - return $text; -} - -function CreateRedBox($title, $content) -{ - $text = '