From d217c016eef3398e9830ee053197a7f3a2e35b9f Mon Sep 17 00:00:00 2001 From: esanchezm Date: Thu, 5 Mar 2009 12:52:59 +0000 Subject: [PATCH] 2009-03-05 Esteban Sanchez * godmode/reporting/map_builder_wizard.php: Style correction. Use Pandora functions instead of SQL. Force elements to have an image by removing "None". * include/functions_config.php: Added to repository. New file to manage config operations such as creation and updating values or updating the whole config array. It even sets id_user so no more usage of $_SESSION is required from outside. * include/config_process.php: Cleanup and usage of functions in functions_config.php. Updated build. * index.php: Updated to changes in config_process.php, * godmode/setup/setup.php: All config process has been moved to config_process.php which uses functions in functions_config.php. * include/styles/pandora.css: Styling for pre elements. New help class. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1515 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 22 ++ .../godmode/reporting/map_builder_wizard.php | 33 +-- pandora_console/godmode/setup/setup.php | 63 +---- pandora_console/include/config_process.php | 124 +--------- pandora_console/include/functions_config.php | 225 ++++++++++++++++++ pandora_console/include/styles/pandora.css | 7 +- pandora_console/index.php | 18 +- 7 files changed, 288 insertions(+), 204 deletions(-) create mode 100644 pandora_console/include/functions_config.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 92a719f10f..cd6c15f343 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,25 @@ +2009-03-05 Esteban Sanchez + + * godmode/reporting/map_builder_wizard.php: Style correction. Use + Pandora functions instead of SQL. Force elements to have an image by + removing "None". + + * include/functions_config.php: Added to repository. New file to + manage config operations such as creation and updating values or + updating the whole config array. It even sets id_user so no more usage + of $_SESSION is required from outside. + + * include/config_process.php: Cleanup and usage of functions in + functions_config.php. Updated build. + + * index.php: Updated to changes in config_process.php, + + * godmode/setup/setup.php: All config process has been moved to + config_process.php which uses functions in functions_config.php. + + * include/styles/pandora.css: Styling for pre elements. New help + class. + 2009-03-04 Sancho Lerena * operation/agents/tactical.php: Layout adapted to bigger event table. diff --git a/pandora_console/godmode/reporting/map_builder_wizard.php b/pandora_console/godmode/reporting/map_builder_wizard.php index e54225a6cf..593d45ffbf 100644 --- a/pandora_console/godmode/reporting/map_builder_wizard.php +++ b/pandora_console/godmode/reporting/map_builder_wizard.php @@ -26,8 +26,8 @@ if (! give_acl ($config['id_user'], 0, "AW")) { exit; } -$layout_id = get_parameter ("id_layout", 0); -$layout = get_db_row_sql ("SELECT * FROM tlayout WHERE id = $layout_id"); +$layout_id = (int) get_parameter ('id_layout'); +$layout = get_db_row ('tlayout', 'id', $layout_id); $layout_group = $layout["id_group"]; @@ -37,7 +37,6 @@ if (! give_acl ($config['id_user'], $layout_group, "AW")) { exit; } -echo '

'.__('Visual map wizard').' - '.$layout["name"].'

'; function process_wizard_add ($id_agents, $image, $id_layout, $range) { if (empty ($id_agents)) { echo '

'.__('No agents selected').'

'; @@ -50,15 +49,19 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range) { $pos_y = 10; $pos_x = 10; foreach ($id_agents as $id_agent) { - - if ($pos_x > 600){ + if ($pos_x > 600) { $pos_x = 10; $pos_y = $pos_y + $range; } - - $label = get_db_sql ("SELECT nombre FROM tagente WHERE id_agente = $id_agent"); - $sql = "INSERT INTO tlayout_data (id_layout, pos_x, pos_y, label, image, id_agent, label_color) VALUES ($id_layout, $pos_x, $pos_y, '$label', '$image', $id_agent, '#000000')"; - process_sql ($sql); + + process_sql_insert ('tlayout_data', + array ('id_layout' => $id_layout, + 'pos_x' => $pos_x, + 'pos_y' => $pos_y, + 'label' => get_agent_name ($id_agent), + 'image' => $image, + 'id_agent' => $id_agent, + 'label_color' => '#000000')); $pos_x = $pos_x + $range; } @@ -67,6 +70,9 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range) { echo '

'.__('Map builder').'

'; } + +echo '

'.__('Visual map wizard').' - '.$layout["name"].'

'; + $id_agents = get_parameter ('id_agents'); $image = get_parameter ('image'); $add = (bool) get_parameter ('add', false); @@ -83,11 +89,8 @@ $table->style = array (); $table->style[0] = 'font-weight: bold; vertical-align:top'; $table->style[2] = 'font-weight: bold'; $table->size = array (); - $table->data = array (); -// CRAP HERE - $images_list = array (); $all_images = list_files ('images/console/icons/', "png", 1, 0); foreach ($all_images as $image_file) { @@ -96,18 +99,17 @@ foreach ($all_images as $image_file) { if (strpos ($image_file, "_ok")) continue; if (strpos ($image_file, "_warning")) - continue; + continue; $image_file = substr ($image_file, 0, strlen ($image_file) - 4); $images_list[$image_file] = $image_file; } $table->data[0][0] = __('Image'); -$table->data[0][1] = print_select ($images_list, 'image', '', '', 'None', '', true); +$table->data[0][1] = print_select ($images_list, 'image', '', '', '', '', true); $table->data[1][0] = __('Image range (px)'); $table->data[1][1] = print_input_text ('range', $range, '', 5, 5, true); - $table->data[2][0] = __('Agents'); $table->data[2][1] = print_select (get_group_agents ($layout_group, false, "none"), 'id_agents[]', 0, false, '', '', true, true); @@ -123,6 +125,5 @@ echo ''; echo ''; echo ''; - ?> diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 3b77d39ca9..5ceca6011c 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -30,54 +30,14 @@ if (! give_acl ($config['id_user'], 0, "PM") || ! is_user_admin ($config['id_use // Load enterprise extensions enterprise_include ('godmode/setup/setup.php'); -$update_settings = (bool) get_parameter ('update_settings'); - -if ($update_settings) { - $config["block_size"] = (int) get_parameter ('block_size', $config["block_size"]); - $config["language"] = (string) get_parameter ('language_code', $config["language"]); - $config["days_compact"] = (int) get_parameter ('days_compact', $config["days_compact"]); - $config["days_purge"] = (int) get_parameter ('days_purge', $config["days_purge"]); - $config["graph_res"] = (int) get_parameter ('graph_res', $config["graph_res"]); - $config["step_compact"] = (int) get_parameter ('step_compact', $config["step_compact"]); - $config["style"] = (string) get_parameter ('style', $config["style"]); - $config["remote_config"] = (string) get_parameter ('remote_config', $config["remote_config"]); - $config["graph_color1"] = (string) get_parameter ('graph_color1', $config["graph_color1"]); - $config["graph_color2"] = (string) get_parameter ('graph_color2', $config["graph_color2"]); - $config["graph_color3"] = (string) get_parameter ('graph_color3', $config["graph_color3"]); - $config["sla_period"] = (int) get_parameter ('sla_period', $config["sla_period"]); - $config["date_format"] = (string) get_parameter ('date_format', $config["date_format"]); - $config["trap2agent"] = (string) get_parameter ('trap2agent', 0); - $config["autoupdate"] = (bool) get_parameter ('autoupdate', 0); //If not passed, it's 0 - $config["prominent_time"] = (string) get_parameter ('prominent_time', $config["prominent_time"]); - $config["loginhash_pwd"] = (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"]); - $config["timesource"] = (string) get_parameter ('timesource', $config["timesource"]); - $config["event_view_hr"] = (int) get_parameter ('event_view_hr', $config["event_view_hr"]); - $config["style"] = substr ($config["style"], 0, strlen ($config["style"]) - 4); - $config["https"] = (bool) get_parameter ('https', 0); //If value not passed (unchecked), it's 0 - $config["compact_header"] = (bool) get_parameter ('compact_header', 0); - - process_sql ("UPDATE tconfig SET VALUE='".$config["remote_config"]."' WHERE token = 'remote_config'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["block_size"]."' WHERE token = 'block_size'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["language"]."' WHERE token = 'language_code'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["days_purge"]."' WHERE token = 'days_purge'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["days_compact"]." ' WHERE token = 'days_compact'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["graph_res"]."' WHERE token = 'graph_res'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["step_compact"]."' WHERE token = 'step_compact'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["style"]."' WHERE token = 'style'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color1"]."' WHERE token = 'graph_color1'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color2"]."' WHERE token = 'graph_color2'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["graph_color3"]."' WHERE token = 'graph_color3'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["sla_period"]."' WHERE token = 'sla_period'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["date_format"]."' WHERE token = 'date_format'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["trap2agent"]."' WHERE token = 'trap2agent'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["autoupdate"]."' WHERE token = 'autoupdate'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["prominent_time"]."' WHERE token = 'prominent_time'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["timesource"]."' WHERE token = 'timesource'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["event_view_hr"]."' WHERE token = 'event_view_hr'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["loginhash_pwd"]."' WHERE token = 'loginhash_pwd'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["https"]."' WHERE token = 'https'"); - process_sql ("UPDATE tconfig SET VALUE='".$config["compact_header"]."' WHERE token = 'compact_header'"); -} +/* + NOTICE FOR DEVELOPERS: + + Update operation is done in config_process.php + This is done in that way so the user can see the changes inmediatly. + If you added a new token, please check update_config() in functions_config.php + to add it there. +*/ require_once ('include/functions_themes.php'); @@ -87,7 +47,8 @@ echo __('General configuration').""; $table->width = '90%'; $table->data = array (); $table->data[0][0] = __('Language code for Pandora'); -$table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', 'language_code', $config["language"], '', '', '', true); +$table->data[0][1] = print_select_from_sql ('SELECT id_language, name FROM tlanguage', + 'language', $config["language"], '', '', '', true); $table->data[1][0] = __('Date format string') . pandora_help("date_format", true); $table->data[1][1] = ''.__('Example').' '.date ($config["date_format"]); @@ -124,7 +85,7 @@ $table->data[11][0] = __('Auto login (Hash) password'); $table->data[11][1] = print_input_text ('loginhash_pwd', $config["loginhash_pwd"], '', 15, 15, true); $table->data[13][0] = __('Style template'); -$table->data[13][1] = print_select (get_css_themes (), 'style', $config["style"], '', '', '', true); +$table->data[13][1] = print_select (get_css_themes (), 'style', $config["style"].'.css', '', '', '', true); $table->data[14][0] = __('Block size for pagination'); $table->data[14][1] = print_input_text ('block_size', $config["block_size"], '', 5, 5, true); @@ -155,7 +116,7 @@ $table->data[20][1] = print_checkbox ('compact_header', 1, $config["compact_head enterprise_hook ('load_snmpforward_enterprise'); echo '
'; -print_input_hidden ('update_settings', 1); +print_input_hidden ('update_config', 1); print_table ($table); echo '
'; print_submit_button (__('Update'), 'update_button', false, 'class="sub upd"'); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b87bbb718d..3e850fc135 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //Pandora Version -$build_version = 'PC090303'; +$build_version = 'PC090305'; $pandora_version = 'v3.0-dev'; $config['start_time'] = microtime (true); @@ -58,64 +58,11 @@ if (! mysql_connect ($config["dbhost"], $config["dbuser"], $config["dbpass"])) { } mysql_select_db ($config["dbname"]); +require_once ('functions.php'); require_once ('functions_db.php'); -$configs = get_db_all_rows_in_table ('tconfig'); +require_once ('functions_config.php'); -if (empty ($configs)) { - exit (' - Pandora FMS Error - -
-
-
- logo -
-
-

Pandora FMS Console Error DB-002

- Cannot load configuration variables from database. Please check your database setup in the - include/config.php file or read the documentation on how to setup Pandora FMS.

- Most likely your database schema has been created but there are is no data in it, you have a problem with the database access credentials or your schema is out of date. -

-
-
'); -} - -/* Compatibility fix */ -foreach ($configs as $c) { - switch ($c["token"]) { - case "language_code": - $config['language'] = $c['value']; - break; - case "auth": - exit (' - - - Pandora FMS Error - - - -
-
-
- logo -
-
-

Pandora FMS Console Error DB-003

- Cannot override authorization variables from the config database. Remove them from your database by executing: - DELETE FROM tconfig WHERE token = "auth"; -
-
-
'); - default: - $config[$c['token']] = $c['value']; - } -} - -if ($config['language'] == 'ast_es') { - $help_code = 'ast'; -} else { - $help_code = substr ($config["language"], 0, 2); -} +process_config (); if (! defined ('EXTENSIONS_DIR')) define ('EXTENSIONS_DIR', 'extensions'); @@ -136,67 +83,4 @@ if (file_exists ('./include/languages/'.$config["language"].'.mo')) { $l10n->load_tables(); } -if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { - $config['homeurl'] = '/'.$config['homeurl']; -} - -if (!isset ($config['date_format'])) { - $config['date_format'] = 'F j, Y, g:i a'; - process_sql_insert ('tconfig', array ('token' => 'date_format', - 'value' => $config['date_format'])); -} - -if (! isset ($config['event_view_hr'])) { - $config['event_view_hr'] = 8; - process_sql_insert ('tconfig', array ('token' => 'event_view_hr', - 'value' => $config['event_view_hr'])); -} - -if (! isset ($config['loginhash_pwd'])) { - $config['loginhash_pwd'] = rand (0, 1000) * rand (0, 1000)."pandorahash"; - process_sql_insert ('tconfig', array ('token' => 'loginhash_pwd', - 'value' => $config["loginhash_pwd"])); -} - -if (!isset($config["trap2agent"])){ - $config["trap2agent"] = 0; - process_sql_insert ('tconfig', array ('token' => 'trap2agent', - 'value' => $config['trap2agent'])); -} - -if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) { - // Default period (in secs) for auto SLA calculation (for monitors) - $config["sla_period"] = 604800; - process_sql_insert ('tconfig', array ('token' => 'sla_period', - 'value' => $config['sla_period'])); -} - -if (!isset ($config["prominent_time"])) { - // Prominent time tells us what to show prominently when a timestamp is - // displayed. The comparation (... days ago) or the timestamp (full date) - $config["prominent_time"] = "comparation"; - process_sql_insert ('tconfig', array ('token' => 'prominent_time', - 'value' => $config['prominent_time'])); -} - -if (!isset ($config["timesource"])) { - // Timesource says where time comes from (system or mysql) - $config["timesource"] = "system"; - process_sql_insert ('tconfig', array ('token' => 'timesource', - 'value' => $config['timesource'])); -} - -if (!isset ($config["https"])) { - // Sets whether or not we want to enforce https. We don't want to go to a - // potentially unexisting config by default - $config["https"] = false; - process_sql_insert ('tconfig', array ('token' => 'https', - 'value' => $config["https"])); -} - -if (!isset ($config["compact_header"])) { - $config["compact_header"] = false; - process_sql_insert ('tconfig', array ('token' => 'compact_header', - 'value' => $config["compact_header"])); -} ?> diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php new file mode 100644 index 0000000000..a74b60aa3a --- /dev/null +++ b/pandora_console/include/functions_config.php @@ -0,0 +1,225 @@ + $value, + 'token' => $token)); +} + +/** + * Update a single config value in the database. + * + * If the config token doesn't exists, it's created. + * + * @param string Config token to update. + * @param string New value to set. + * + * @return bool True if success. False on failure. + */ +function update_config_value ($token, $value) { + global $config; + + if (!isset ($config[$token])) + return (bool) create_config_value ($token, $value); + + /* If it has not changed */ + if ($config[$token] != $value) + return true; + + $config[$token] = $value; + + return (bool) process_sql_update ('tconfig', + array ('value' => $value), + array ('token' => $token)); +} + +/** + * Updates all config values if . + * + * + */ +function update_config () { + global $config; + + /* If user is not even log it, don't try this */ + if (! isset ($config['id_user'])) + return false; + + if (! give_acl ($config['id_user'], 0, "PM") || ! is_user_admin ($config['id_user'])) + return false; + + $update_config = (bool) get_parameter ('update_config'); + if (! $update_config) + return; + + $style = (string) get_parameter ('style', $config["style"]); + $config["style"] = substr ($style, 0, strlen ($style) - 4); + + /* Workaround for ugly language and language_code missmatch */ + $config['language_code'] = (string) get_parameter ('language', $config["language"]); + update_config_value ('language_code', $config['language_code']); + $config["language"] = $config['language_code']; + + update_config_value ('remote_config', (string) get_parameter ('remote_config', $config["remote_config"])); + update_config_value ('block_size', (int) get_parameter ('block_size', $config["block_size"])); + update_config_value ('days_purge', (int) get_parameter ('days_purge', $config["days_purge"])); + update_config_value ('days_compact', (int) get_parameter ('days_compact', $config["days_compact"])); + update_config_value ('graph_res', (int) get_parameter ('graph_res', $config["graph_res"])); + update_config_value ('step_compact', (int) get_parameter ('step_compact', $config["step_compact"])); + update_config_value ('style', $style); + update_config_value ('graph_color1', (string) get_parameter ('graph_color1', $config["graph_color1"])); + update_config_value ('graph_color2', (string) get_parameter ('graph_color2', $config["graph_color2"])); + update_config_value ('graph_color3', (string) get_parameter ('graph_color3', $config["graph_color3"])); + update_config_value ('sla_period', (int) get_parameter ('sla_period', $config["sla_period"])); + update_config_value ('date_format', (string) get_parameter ('date_format', $config["date_format"])); + update_config_value ('trap2agent', (string) get_parameter ('trap2agent', 0)); + update_config_value ('autoupdate', (bool) get_parameter ('autoupdate')); + update_config_value ('prominent_time', (string) get_parameter ('prominent_time', $config["prominent_time"])); + update_config_value ('timesource', (string) get_parameter ('timesource', $config["timesource"])); + update_config_value ('event_view_hr', (int) get_parameter ('event_view_hr', $config["event_view_hr"])); + update_config_value ('loginhash_pwd', (string) get_parameter ('loginhash_pwd', $config["loginhash_pwd"])); + update_config_value ('https', (bool) get_parameter ('https')); + update_config_value ('compact_header', (bool) get_parameter ('compact_header')); +} + +/** + * + */ +function process_config () { + global $config; + + $configs = get_db_all_rows_in_table ('tconfig'); + + if (empty ($configs)) { + exit (' + Pandora FMS Error + +
+
+
+ logo +
+
+

Pandora FMS Console Error DB-002

+ Cannot load configuration variables from database. Please check your database setup in the + include/config.php file or read the documentation on how to setup Pandora FMS.

+ Most likely your database schema has been created but there are is no data in it, you have a problem with the database access credentials or your schema is out of date. +

+
+
'); + } + + /* Compatibility fix */ + foreach ($configs as $c) { + switch ($c["token"]) { + case "language_code": + $config['language'] = $c['value']; + break; + case "auth": + exit (' + + + Pandora FMS Error + + + +
+
+
+ logo +
+
+

Pandora FMS Console Error DB-003

+ Cannot override authorization variables from the config database. Remove them from your database by executing: + DELETE FROM tconfig WHERE token = "auth"; +
+
+
'); + default: + $config[$c['token']] = $c['value']; + } + } + + if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') { + $config['homeurl'] = '/'.$config['homeurl']; + } + + if (! isset ($config['date_format'])) { + update_config_value ('date_format', 'F j, Y, g:i a'); + } + + if (! isset ($config['event_view_hr'])) { + update_config_value ('event_view_hr', 8); + } + + if (! isset ($config['loginhash_pwd'])) { + update_config_value ('loginhash_pwd', rand (0, 1000) * rand (0, 1000)."pandorahash"); + } + + if (!isset($config["trap2agent"])) { + update_config_value ('trap2agent', 0); + } + + if (!isset ($config["sla_period"]) || empty ($config["sla_period"])) { + update_config_value ('sla_period', 604800); + } + + if (!isset ($config["prominent_time"])) { + // Prominent time tells us what to show prominently when a timestamp is + // displayed. The comparation (... days ago) or the timestamp (full date) + update_config_value ('prominent_time', 'comparation'); + } + + if (!isset ($config["timesource"])) { + // Timesource says where time comes from (system or mysql) + update_config_value ('timesource', 'system'); + } + + if (!isset ($config["https"])) { + // Sets whether or not we want to enforce https. We don't want to go to a + // potentially unexisting config by default + update_config_value ('https', false); + } + + if (!isset ($config["compact_header"])) { + update_config_value ('compact_header', false); + } + + if (isset ($_SESSION['id_usuario'])) + $config["id_user"] = $_SESSION["id_usuario"]; + + if (!isset ($config["auth"])) { + require_once ("include/auth/mysql.php"); + } else { + require_once ("include/auth/".$config["auth"]["scheme"].".php"); + } + + /* Finally, check if any value was overwritten in a form */ + update_config (); +} +?> diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 65c0ea23d0..52ee82070e 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -349,7 +349,7 @@ td.datos_id { color: #fff; text-align: center; } -.suc, .error { +.suc, .error, .help { padding: 4px 1px 6px 30px; } .suc { @@ -359,6 +359,9 @@ td.datos_id { .error { background: url(../../images/err.png) no-repeat; } +.help { + background: url(../../images/help.png) no-repeat; +} .red, .redb, .redi, .error { color: #f00; } @@ -733,7 +736,7 @@ ul { span.actions { margin-left: 30px; } -code { +code, pre { font-family: courier, serif; } select#template, select#action { diff --git a/pandora_console/index.php b/pandora_console/index.php index 67733b4c27..248b6c777b 100644 --- a/pandora_console/index.php +++ b/pandora_console/index.php @@ -61,14 +61,6 @@ if ((! file_exists ("include/config.php")) || (! is_readable ("include/config.ph // Real start session_start (); require_once ("include/config.php"); -require_once ("include/functions.php"); -require_once ("include/functions_db.php"); - -if (!isset ($config["auth"])) { - require_once ("include/auth/mysql.php"); -} else { - require_once ("include/auth/".$config["auth"]["scheme"].".php"); -} /* Enterprise support */ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) { @@ -77,7 +69,6 @@ if (file_exists (ENTERPRISE_DIR."/load_enterprise.php")) { load_extensions ($config['extensions']); - if (!empty ($config["https"]) && empty ($_SERVER['HTTPS'])) { $query = 'https://' . $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; if (sizeof ($_REQUEST)) @@ -127,7 +118,7 @@ $sec = get_parameter_get ('sec'); $sec = safe_url_extraclean ($sec); // Hash login process -if (! isset ($_SESSION['id_usuario']) && isset ($_GET["loginhash"])) { +if (! isset ($config['id_user']) && isset ($_GET["loginhash"])) { $loginhash_data = get_parameter("loginhash_data", ""); $loginhash_user = get_parameter("loginhash_user", ""); @@ -141,7 +132,7 @@ if (! isset ($_SESSION['id_usuario']) && isset ($_GET["loginhash"])) { while (@ob_end_flush ()); exit (""); } -} elseif (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) { +} elseif (! isset ($config['id_user']) && isset ($_GET["login"])) { // Login process $config["auth_error"] = ""; //Set this to the error message from the authorization mechanism @@ -170,14 +161,11 @@ if (! isset ($_SESSION['id_usuario']) && isset ($_GET["loginhash"])) { while (@ob_end_flush ()); exit (""); } -} elseif (! isset ($_SESSION['id_usuario'])) { +} elseif (! isset ($config['id_user'])) { // There is no user connected require_once ('general/login_page.php'); while (@ob_end_flush ()); exit (""); -} else { - // There is session for id_usuario - $config["id_user"] = $_SESSION["id_usuario"]; } // Log off