From e44cd3d40e4fe4d75b8a270eb6cd40960dd983bf Mon Sep 17 00:00:00 2001 From: botanic Date: Wed, 3 Sep 2014 01:28:27 -0700 Subject: [PATCH] updating plugins --- .../API_key_management/API_key_management.php | 18 +++++++++++------- .../setup/sql/nel_ams_lib_00001.sql | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/code/web/private_php/ams/plugins/API_key_management/API_key_management.php b/code/web/private_php/ams/plugins/API_key_management/API_key_management.php index cbe7fca6a..8f2e6158b 100644 --- a/code/web/private_php/ams/plugins/API_key_management/API_key_management.php +++ b/code/web/private_php/ams/plugins/API_key_management/API_key_management.php @@ -157,12 +157,12 @@ function api_key_management_hook_load_db() global $var_set; global $return_set; - $db = new DBLayer( 'lib' ); + $dbl = new DBLayer("lib"); if ( isset( $_SESSION['user'] ) ) { // returns the registered keys - $sth = $db -> select( 'ams_api_keys', array( 'user' => $_SESSION['user'] ), 'User = :user' ); + $sth = $dbl -> select( 'ams_api_keys', array( 'user' => $_SESSION['user'] ), 'User = :user' ); $row = $sth -> fetchAll(); $return_set['api_keys'] = $row; @@ -170,12 +170,16 @@ function api_key_management_hook_load_db() $com = array_column( $return_set['api_keys'], 'UserCharacter' ); // returns the characters with respect to the user id in the ring_tool->characters - $db = new DBLayer( 'ring' ); - $sth = $db -> selectWithParameter( 'char_name', 'characters' , array(), '1' ); - $row = $sth -> fetch(); + try { + $dbl = new DBLayer( 'ring' ); + $sth = $dbl -> selectWithParameter( 'char_name', 'characters' , array(), '1' ); + $row = $sth -> fetch(); - // loop through the character list and remove the character if already have an api key - $return_set['characters'] = array_diff( $row, $com ); + // loop through the character list and remove the character if already have an api key + $return_set['characters'] = array_diff( $row, $com ); + }catch( PDOException $e ) { + error_log($e->getMessage()); +} } } diff --git a/code/web/private_php/setup/sql/nel_ams_lib_00001.sql b/code/web/private_php/setup/sql/nel_ams_lib_00001.sql index 685d04ffc..3c9b259b3 100644 --- a/code/web/private_php/setup/sql/nel_ams_lib_00001.sql +++ b/code/web/private_php/setup/sql/nel_ams_lib_00001.sql @@ -119,8 +119,8 @@ CREATE TABLE IF NOT EXISTS `plugins` ( -- INSERT INTO `plugins` (`Id`, `FileName`, `Name`, `Type`, `Owner`, `Permission`, `Status`, `Weight`, `Info`) VALUES -(1, 'API_key_management', 'API_key_management', 'automatic', '', 'admin', 0, 0, '{"PluginName":"API Key Management","Description":"Provides public access to the API''s by generating access tokens.","Version":"1.0.0","Type":"automatic","TemplatePath":"..\\/..\\/..\\/private_php/ams\\/plugins\\/API_key_management\\/templates\\/index.tpl","":null}'), -(2, 'Achievements', 'Achievements', 'Manual', '', 'admin', 0, 0, '{"PluginName":"Achievements","Description":"Returns the achivements of a user with respect to the character =.","Version":"1.0.0","TemplatePath":"..\\/..\\/..\\/private_php/ams\\/plugins\\/Achievements\\/templates\\/index.tpl","Type":"Manual","":null}'); +(1, 'API_key_management', 'API_key_management', 'automatic', '', 'admin', 0, 0, '{"PluginName":"API Key Management","Description":"Provides public access to the API''s by generating access tokens.","Version":"1.0.0","Type":"automatic","TemplatePath":"..\\/..\\/..\\/private_php\\/ams\\/plugins\\/API_key_management\\/templates\\/index.tpl","":null}'), +(2, 'Achievements', 'Achievements', 'Manual', '', 'admin', 0, 0, '{"PluginName":"Achievements","Description":"Returns the achivements of a user with respect to the character =.","Version":"1.0.0","TemplatePath":"..\\/..\\/..\\/private_php\\/ams\\/plugins\\/Achievements\\/templates\\/index.tpl","Type":"Manual","":null}'); -- --------------------------------------------------------