diff --git a/app/adminer/app_defaults.php b/app/adminer/app_defaults.php new file mode 100644 index 0000000000..c22287dc70 --- /dev/null +++ b/app/adminer/app_defaults.php @@ -0,0 +1,65 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2015 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ + +//proccess this only one time +if ($domains_processed == 1) { + + //define array of settings + $x = 0; + $array[$x]['default_setting_category'] = 'adminer'; + $array[$x]['default_setting_subcategory'] = 'auto_login'; + $array[$x]['default_setting_name'] = 'boolean'; + $array[$x]['default_setting_value'] = 'true'; + $array[$x]['default_setting_enabled'] = 'false'; + $array[$x]['default_setting_description'] = 'Set whether to auto-login to Adminer, or require a username and password.'; + $x++; + + //iterate and add each, if necessary + foreach ($array as $index => $default_settings) { + //add the default setting + $sql = "select count(*) as num_rows from v_default_settings "; + $sql .= "where default_setting_category = '".$default_settings['default_setting_category']."' "; + $sql .= "and default_setting_subcategory = '".$default_settings['default_setting_subcategory']."' "; + $sql .= "and default_setting_name = '".$default_settings['default_setting_name']."' "; + $prep_statement = $db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + $row = $prep_statement->fetch(PDO::FETCH_ASSOC); + unset($prep_statement); + if ($row['num_rows'] == 0) { + $orm = new orm; + $orm->name('default_settings'); + $orm->save($array[$index]); + $message = $orm->message; + //print_r($message); + } + unset($row); + } + } + +} + +?> \ No newline at end of file diff --git a/app/adminer/app_menu.php b/app/adminer/app_menu.php index 43625e723e..33a2d3b0f8 100644 --- a/app/adminer/app_menu.php +++ b/app/adminer/app_menu.php @@ -14,7 +14,7 @@ $apps[$x]['menu'][0]['parent_uuid'] = "594d99c5-6128-9c88-ca35-4b33392cec0f"; $apps[$x]['menu'][0]['category'] = "external"; $apps[$x]['menu'][0]['icon'] = "glyphicon-new-window"; - $apps[$x]['menu'][0]['path'] = "/app/adminer/index.php".(($_SESSION['adminer']['auto_login']['boolean'] == 'true') ? '?'.$_SESSION['adminer']['database_type']['text']."=&username=auto&db=fusionpbx&ns=public" : null); + $apps[$x]['menu'][0]['path'] = "/app/adminer/index.php"; $apps[$x]['menu'][0]['groups'][] = "superadmin"; ?> \ No newline at end of file diff --git a/app/adminer/index.php b/app/adminer/index.php index 62cc96aa7e..5db32c146c 100644 --- a/app/adminer/index.php +++ b/app/adminer/index.php @@ -31,7 +31,7 @@ function adminer_object() { // custom name in title and heading return 'Adminer'; } - /* + function permanentLogin() { // key used for permanent login if ($_SESSION['adminer']['auto_login']['boolean'] == 'true') { @@ -59,7 +59,6 @@ function adminer_object() { // validate user submitted credentials return ($_SESSION['adminer']['auto_login']['boolean'] == 'true') ? true : false; } - */ } diff --git a/themes/default/template.php b/themes/default/template.php index d7172a1d3c..f3dd467227 100644 --- a/themes/default/template.php +++ b/themes/default/template.php @@ -453,13 +453,17 @@ echo "