Skip to content

Commit

Permalink
(chore) Upgrade Smarty to v5
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackmastr committed Jun 1, 2024
1 parent 3da2c17 commit 2b017e8
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 49 deletions.
1 change: 0 additions & 1 deletion web/cache/.gitkeep

This file was deleted.

2 changes: 1 addition & 1 deletion web/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"lcobucci/jwt": "5.3.0",
"maxmind-db/reader": "~1.0",
"smarty/smarty": "~v4.5.3",
"smarty/smarty": "~v5.3.0",
"xpaw/php-source-query-class": "dev-master",
"adodb/adodb-php": "5.22.7",
"symfony/mailer": "^6.0",
Expand Down
30 changes: 17 additions & 13 deletions web/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions web/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
Page: <http://www.sourcebans.net/> - <http://www.gameconnect.net/>
*************************************************************************/
//Hotfix for dash_intro_text
use Smarty\Smarty;

if (isset($_POST['dash_intro_text'])) {
$dash_intro_text = $_POST['dash_intro_text'];
}
Expand Down Expand Up @@ -194,9 +196,9 @@ function sbError($errno, $errstr, $errfile, $errline)
require_once(INCLUDES_PATH.'/SmartyCustomFunctions.php');

$theme = new Smarty();
$theme->error_reporting = E_ALL;
$theme->use_sub_dirs = false;
$theme->compile_id = $theme_name;
$theme->setErrorReporting(E_ALL);
$theme->setUseSubDirs(false);
$theme->setCompileId($theme_name);
$theme->setCaching(Smarty::CACHING_OFF);
$theme->setTemplateDir(SB_THEMES . $theme_name);
$theme->setCacheDir(SB_CACHE);
Expand All @@ -207,5 +209,5 @@ function sbError($errno, $errstr, $errfile, $errline)
$theme->registerPlugin('modifier', 'smarty_htmlspecialchars', 'smarty_htmlspecialchars');

if ((isset($_GET['debug']) && $_GET['debug'] == 1) || DEBUG_MODE) {
$theme->force_compile = true;
$theme->setForceCompile(true);
}
12 changes: 8 additions & 4 deletions web/pages/admin.blockit.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ function BlockPlayer($check, int $sid, $num, $type, int $length)
return $objResponse;
}

// $GLOBALS['PDO']->query("SELECT ip, port FROM `:prefix_servers` WHERE sid = :sid");
// $GLOBALS['PDO']->bind(':sid', $sid);
// $sdata = $GLOBALS['PDO']->single();

// show hostname instead of the ip, but leave the ip in the title
$hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
$hostname = trunc(htmlspecialchars($hostname[1][0]), 25);
Expand Down Expand Up @@ -124,8 +128,8 @@ function BlockPlayer($check, int $sid, $num, $type, int $length)
$theme->assign('type', $_GET['type']);
$theme->assign('length', $_GET['length']);

$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');
$theme->display('page_blockit.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');
8 changes: 4 additions & 4 deletions web/pages/admin.edit.ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@
$theme->assign('ban_demo', (!empty($res['dname']) ? "Uploaded: <b>" . $res['dname'] . "</b>" : ""));
$theme->assign('customreason', (Config::getBool('bans.customreasons')) ? unserialize(Config::get('bans.customreasons')) : false);

$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');
$theme->display('page_admin_edit_ban.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');
?>
<script type="text/javascript">window.addEvent('domready', function(){
<?=$errorScript?>
Expand Down
8 changes: 4 additions & 4 deletions web/pages/admin.edit.comms.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@
$theme->assign('ban_authid', trim($res['authid']));
$theme->assign('customreason', (Config::getBool('bans.customreasons')) ? unserialize(Config::get('bans.customreasons')) : false);

$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');
$theme->display('page_admin_edit_comms.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');
?>
<script type="text/javascript">window.addEvent('domready', function(){
<?=$errorScript?>
Expand Down
12 changes: 8 additions & 4 deletions web/pages/admin.kickit.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function KickPlayer($check, int $sid, $num, $type)
return $objResponse;
}

// $GLOBALS['PDO']->query("SELECT ip, port FROM `:prefix_servers` WHERE sid = :sid");
// $GLOBALS['PDO']->bind(':sid', $sid);
// $sdata = $GLOBALS['PDO']->single();

// show hostname instead of the ip, but leave the ip in the title
$hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
$hostname = trunc(htmlspecialchars($hostname[1][0]), 25);
Expand Down Expand Up @@ -142,8 +146,8 @@ function KickPlayer($check, int $sid, $num, $type)
$theme->assign('check', $_GET["check"]); // steamid or ip address
$theme->assign('type', $_GET['type']);

$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');
$theme->display('page_kickit.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');
8 changes: 4 additions & 4 deletions web/pages/admin.rcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@

$theme->assign('id', $sid);
$theme->assign('permission_rcon', ($access && $userbank->HasAccess(SM_RCON . SM_ROOT)));
$theme->left_delimiter = '-{';
$theme->right_delimiter = '}-';
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');

$theme->display('page_admin_servers_rcon.tpl');

$theme->left_delimiter = '{';
$theme->right_delimiter = '}';
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');
10 changes: 4 additions & 6 deletions web/pages/page.login.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,12 @@
HTML;
break;
}


}

$theme->assign('steamlogin_show', Config::getBool('config.enablesteamlogin'));
$theme->assign('redir', "DoLogin('');");
$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter("-{");
$theme->setRightDelimiter("}-");
$theme->display('page_login.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter("{");
$theme->setRightDelimiter("}");
8 changes: 4 additions & 4 deletions web/pages/page.youraccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
$theme->assign('server_permissions', SmFlagsToSb($userbank->GetProperty("srv_flags")));
$theme->assign('min_pass_len', MIN_PASS_LENGTH);

$theme->left_delimiter = "-{";
$theme->right_delimiter = "}-";
$theme->setLeftDelimiter('-{');
$theme->setRightDelimiter('}-');
$theme->display('page_youraccount.tpl');
$theme->left_delimiter = "{";
$theme->right_delimiter = "}";
$theme->setLeftDelimiter('{');
$theme->setRightDelimiter('}');

0 comments on commit 2b017e8

Please sign in to comment.