Skip to content

Commit

Permalink
Merge pull request #293 from ZerBytes/v1.x
Browse files Browse the repository at this point in the history
Convert JS objects to JSON for easier handling
  • Loading branch information
Groruk authored May 7, 2017
2 parents d14eb4e + 9aba7b0 commit b31a050
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
### [![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)
Global admin, ban, and communication management system for the Source engine

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

### Useful Links

* Website: [SourceBans++](https://sbpp.github.io/)
Expand Down
3 changes: 1 addition & 2 deletions web/includes/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Database
{
private $prefix;
private $dbh;
private $error;
private $stmt;

public function __construct($host, $port, $dbname, $user, $password, $prefix)
Expand All @@ -19,7 +18,7 @@ public function __construct($host, $port, $dbname, $user, $password, $prefix)
try {
$this->dbh = new \PDO($dsn, $user, $password, $options);
} catch (PDOException $e) {
$this->error = $e->getMessage();
die($e->getMessage());
}
}

Expand Down
9 changes: 3 additions & 6 deletions web/includes/sb-callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -2106,6 +2106,9 @@ function EditGroup($gid, $web_flags, $srv_flags, $type, $name, $overrides, $newO
$GLOBALS['db']->Execute("UPDATE `".DB_PREFIX."_admins` SET `srv_group` = ? WHERE `aid` = '" . (int)$o['aid'] . "'", array($name));
}

$overrides = json_decode(html_entity_decode($overrides, ENT_QUOTES), true);
$newOverride = json_decode(html_entity_decode($newOverride, ENT_QUOTES), true);

// Update group overrides
if(!empty($overrides))
{
Expand Down Expand Up @@ -2136,12 +2139,6 @@ function EditGroup($gid, $web_flags, $srv_flags, $type, $name, $overrides, $newO
}
}

$newOverride = explode(';', $newOverride);
foreach ($newOverride as $input) {
$input = explode('::', $input);
$newOverride[$input[0]] = $input[1];
}

// Add a new override
if(!empty($newOverride))
{
Expand Down
6 changes: 3 additions & 3 deletions web/scripts/sourcebans.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,18 +755,18 @@ function ProcessEditGroup(type, name)
if($type(override_access) == "element")
override_access = [override_access];

overrides = new Array(override_id.length);
overrides = {};

for(var i=0;i<override_id.length;i++)
{
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};
}
}

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};
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};
}

xajax_EditGroup(group, Mask, srvMask, type, name, overrides, new_override);
xajax_EditGroup(group, Mask, srvMask, type, name, JSON.stringify(overrides), JSON.stringify(new_override));
}

function update_server()
Expand Down
2 changes: 1 addition & 1 deletion web/version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "1.6.1",
"git": "489"
"git": "493"
}

0 comments on commit b31a050

Please sign in to comment.