From 765e614c237c2327df6e65591d5c364f896a8597 Mon Sep 17 00:00:00 2001
From: botanic
Date: Sat, 13 Sep 2014 10:30:58 -0700
Subject: [PATCH] Fix #122
--HG--
branch : develop
---
code/web/private_php/ams/autoload/dblayer.php | 2 +-
code/web/private_php/ams/autoload/helpers.php | 12 ++++-
.../ams/ingame_templates/register.tpl | 4 ++
code/web/public_php/ams/css/custom.css | 4 ++
code/web/public_php/ams/inc/register.php | 1 +
code/web/public_php/ams/inc/settings.php | 12 ++++-
code/web/public_php/ams/templates/login.tpl | 7 ++-
.../web/public_php/ams/templates/register.tpl | 4 ++
.../web/public_php/ams/templates/settings.tpl | 51 +++++++++++++++++++
9 files changed, 92 insertions(+), 5 deletions(-)
diff --git a/code/web/private_php/ams/autoload/dblayer.php b/code/web/private_php/ams/autoload/dblayer.php
index d14e48e84..f7871ebcb 100644
--- a/code/web/private_php/ams/autoload/dblayer.php
+++ b/code/web/private_php/ams/autoload/dblayer.php
@@ -214,7 +214,7 @@ class DBLayer {
}
$field_option_values = ltrim($field_option_values, ',');
try {
- $sth = $this->PDO->prepare("UPDATE $tb_name SET $field_option_values WHERE $where ");
+ $sth = $this->PDO->prepare("UPDATE `$tb_name` SET $field_option_values WHERE $where ");
foreach ($data as $key => $value) {
$sth->bindValue(":$key", $value);
diff --git a/code/web/private_php/ams/autoload/helpers.php b/code/web/private_php/ams/autoload/helpers.php
index 0ebc6d8fc..bcfde1c02 100644
--- a/code/web/private_php/ams/autoload/helpers.php
+++ b/code/web/private_php/ams/autoload/helpers.php
@@ -23,7 +23,7 @@ class Helpers {
global $AMS_TRANS;
global $INGAME_LAYOUT;
global $AMS_CACHEDIR;
- global $AMS_PLUGINS;
+ global $AMS_PLUGINS;
// define('SMARTY_SPL_AUTOLOAD',1);
require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
@@ -34,7 +34,7 @@ class Helpers {
$smarty -> setCacheDir( $AMS_CACHEDIR );
$smarty -> setConfigDir( $SITEBASE . '/configs/' );
// turn smarty debugging on/off
- $smarty -> debugging = false;
+ $smarty -> debugging = true;
// caching must be disabled for multi-language support
$smarty -> caching = false;
$smarty -> cache_lifetime = 300;
@@ -89,6 +89,14 @@ class Helpers {
$id = session_id();
$smarty -> assign( "sessionid", $id );
+
+ $dbl = new DBLayer("lib");
+ $statement = $dbl->executeWithoutParams("SELECT * FROM settings");
+ $rows = $statement->fetchAll();
+
+ foreach ($rows as &$value) {
+ $smarty -> assign( $value['Setting'], $value['Value'] );
+ }
// smarty inheritance for loading the matching wrapper layout (with the matching menu bar)
if ( isset( $vars['permission'] ) && $vars['permission'] == 3 ) {
diff --git a/code/web/private_php/ams/ingame_templates/register.tpl b/code/web/private_php/ams/ingame_templates/register.tpl
index 9fa8fef32..7f34e8639 100644
--- a/code/web/private_php/ams/ingame_templates/register.tpl
+++ b/code/web/private_php/ams/ingame_templates/register.tpl
@@ -7,6 +7,8 @@
{$welcome_message}
+ {if $userRegistration == '0'|| $userRegistration == '1'}
+
+
+ {/if}
{/block}
diff --git a/code/web/public_php/ams/templates/register.tpl b/code/web/public_php/ams/templates/register.tpl
index b5ea3980d..24aac42a2 100644
--- a/code/web/public_php/ams/templates/register.tpl
+++ b/code/web/public_php/ams/templates/register.tpl
@@ -12,6 +12,7 @@
{$welcome_message}
+ {if $userRegistration == '0'|| $userRegistration == '2'}
+ {else}
+ Registration Disabled!
+ {/if}
diff --git a/code/web/public_php/ams/templates/settings.tpl b/code/web/public_php/ams/templates/settings.tpl
index 4ee9f2c6a..94883c9de 100644
--- a/code/web/public_php/ams/templates/settings.tpl
+++ b/code/web/public_php/ams/templates/settings.tpl
@@ -323,6 +323,57 @@
+
+ {if $permission == '3'}
+
+
+
+ User Registration
+
+
+
+
+ {/if}
+