Adminer: Fix and simplify previous auto-login feature (controlled by Default Setting).
This commit is contained in:
parent
57bbc8f7f7
commit
75717d1d60
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/*
|
||||
FusionPBX
|
||||
Version: MPL 1.1
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License Version
|
||||
1.1 (the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
for the specific language governing rights and limitations under the
|
||||
License.
|
||||
|
||||
The Original Code is FusionPBX
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2015
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
*/
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -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'] = "<!--{project_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";
|
||||
|
||||
?>
|
||||
|
|
@ -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;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -453,13 +453,17 @@
|
|||
echo "<ul class='dropdown-menu'>\n";
|
||||
foreach ($menu_parent['menu_items'] as $index_sub => $menu_sub) {
|
||||
$mod_a_2 = $menu_sub['menu_item_link'];
|
||||
if($mod_a_2 == ''){
|
||||
if ($mod_a_2 == '') {
|
||||
$mod_a_2 = '#';
|
||||
}
|
||||
else if (($menu_sub['menu_item_category'] == 'internal') ||
|
||||
(($menu_sub['menu_item_category'] == 'external') && substr($mod_a_2, 0,1) == "/"))
|
||||
{
|
||||
$mod_a_2 = PROJECT_PATH . $mod_a_2;
|
||||
else if (($menu_sub['menu_item_category'] == 'internal') || (($menu_sub['menu_item_category'] == 'external') && substr($mod_a_2,0,1) == '/')) {
|
||||
// accomodate adminer auto-login, if enabled
|
||||
if (substr($mod_a_2,0,22) == '/app/adminer/index.php') {
|
||||
global $db_type;
|
||||
$mod_a_2 .= '?'.(($db_type == 'mysql') ? 'server' : $db_type).'&db=fusionpbx&ns=public';
|
||||
$mod_a_2 .= ($_SESSION['adminer']['auto_login']['boolean'] == 'true') ? "&username=auto" : null;
|
||||
}
|
||||
$mod_a_2 = PROJECT_PATH.$mod_a_2;
|
||||
}
|
||||
$mod_a_3 = ($menu_sub['menu_item_category'] == 'external') ? "target='_blank' " : null;
|
||||
if ($_SESSION['theme']['menu_sub_icons']['boolean'] != 'false') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue