Skip to content

Commit b31a050

Browse files
authored
Merge pull request #293 from ZerBytes/v1.x
Convert JS objects to JSON for easier handling
2 parents d14eb4e + 9aba7b0 commit b31a050

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
### [![GitHub release](https://img.shields.io/github/release/sbpp/sourcebans-pp.svg?style=flat-square)](https://github.com/sbpp/sourcebans-pp/releases/tag/1.5.4.7) [![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat-square)](https://raw.githubusercontent.com/sbpp/sourcebans-pp/v1.x/SOURCEMOD-LICENSE.txt) [![GitHub license](https://img.shields.io/badge/license-CC_BY--NC--SA_3.0-blue.svg?style=flat-square)](https://creativecommons.org/licenses/by-nc-sa/3.0/) [![GitHub forks](https://img.shields.io/github/forks/sbpp/sourcebans-pp.svg?style=flat-square)](https://github.com/sbpp/sourcebans-pp/network) [![GitHub stars](https://img.shields.io/github/stars/sbpp/sourcebans-pp.svg?style=flat-square)](https://github.com/sbpp/sourcebans-pp/stargazers) [![GitHub issues](https://img.shields.io/github/issues/sbpp/sourcebans-pp.svg?style=flat-square)](https://github.com/sbpp/sourcebans-pp/issues) [![Travis](https://img.shields.io/travis/sbpp/sourcebans-pp.svg?style=flat-square)](https://travis-ci.org/sbpp/sourcebans-pp) [![Codacy](https://img.shields.io/codacy/grade/1fc9e40bde8e40dca8680e4b2d51256b.svg?style=flat-square)](https://www.codacy.com/app/sbpp/sourcebans-pp)
55
Global admin, ban, and communication management system for the Source engine
66

7+
### Issues
8+
If you have an issue you can report it [here](https://github.com/sbpp/sourcebans-pp/issues/new).
9+
To solve your problems as fast as possible fill out the **issue template** provided
10+
or read how to report issues effectively [here](https://coenjacobs.me/2013/12/06/effective-bug-reports-on-github/).
11+
712
### Useful Links
813

914
* Website: [SourceBans++](https://sbpp.github.io/)

web/includes/Database.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ class Database
44
{
55
private $prefix;
66
private $dbh;
7-
private $error;
87
private $stmt;
98

109
public function __construct($host, $port, $dbname, $user, $password, $prefix)
@@ -19,7 +18,7 @@ public function __construct($host, $port, $dbname, $user, $password, $prefix)
1918
try {
2019
$this->dbh = new \PDO($dsn, $user, $password, $options);
2120
} catch (PDOException $e) {
22-
$this->error = $e->getMessage();
21+
die($e->getMessage());
2322
}
2423
}
2524

web/includes/sb-callback.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2106,6 +2106,9 @@ function EditGroup($gid, $web_flags, $srv_flags, $type, $name, $overrides, $newO
21062106
$GLOBALS['db']->Execute("UPDATE `".DB_PREFIX."_admins` SET `srv_group` = ? WHERE `aid` = '" . (int)$o['aid'] . "'", array($name));
21072107
}
21082108

2109+
$overrides = json_decode(html_entity_decode($overrides, ENT_QUOTES), true);
2110+
$newOverride = json_decode(html_entity_decode($newOverride, ENT_QUOTES), true);
2111+
21092112
// Update group overrides
21102113
if(!empty($overrides))
21112114
{
@@ -2136,12 +2139,6 @@ function EditGroup($gid, $web_flags, $srv_flags, $type, $name, $overrides, $newO
21362139
}
21372140
}
21382141

2139-
$newOverride = explode(';', $newOverride);
2140-
foreach ($newOverride as $input) {
2141-
$input = explode('::', $input);
2142-
$newOverride[$input[0]] = $input[1];
2143-
}
2144-
21452142
// Add a new override
21462143
if(!empty($newOverride))
21472144
{

web/scripts/sourcebans.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,18 +755,18 @@ function ProcessEditGroup(type, name)
755755
if($type(override_access) == "element")
756756
override_access = [override_access];
757757

758-
overrides = new Array(override_id.length);
758+
overrides = {};
759759

760760
for(var i=0;i<override_id.length;i++)
761761
{
762762
overrides[i] = {'id': override_id[i].value, 'type': override_type[i][override_type[i].selectedIndex].value, 'name': override_name[i].value, 'access': override_access[i][override_access[i].selectedIndex].value};
763763
}
764764
}
765765

766-
new_override = {'type::': $('new_override_type')[$('new_override_type').selectedIndex].value, ';name::': $('new_override_name').value, ';access::': $('new_override_access')[$('new_override_access').selectedIndex].value};
766+
new_override = {'type': $('new_override_type')[$('new_override_type').selectedIndex].value, 'name': $('new_override_name').value, 'access': $('new_override_access')[$('new_override_access').selectedIndex].value};
767767
}
768768

769-
xajax_EditGroup(group, Mask, srvMask, type, name, overrides, new_override);
769+
xajax_EditGroup(group, Mask, srvMask, type, name, JSON.stringify(overrides), JSON.stringify(new_override));
770770
}
771771

772772
function update_server()

web/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"version": "1.6.1",
3-
"git": "489"
3+
"git": "493"
44
}

0 commit comments

Comments
 (0)