2012-10-25 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_extensions.php, extensions/pandora_logs.php,
	extensions/update_manager.php, extensions/resource_registration.php,
	extensions/resource_exportation.php, extensions/module_groups.php,
	extensions/plugin_registration.php, extensions/snmp_explorer.php,
	extensions/system_info.php, operation/menu.php: cleaned source code
	style.
	
	* include/functions_menu.php: fixed the hidden icons the extensions
	in  menu.
	
	Fixes: #3568966




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7096 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-10-25 16:46:52 +00:00
parent 6f27f7ec28
commit e33cebbd8e
12 changed files with 88 additions and 71 deletions

View File

@ -1,3 +1,17 @@
2012-10-25 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_extensions.php, extensions/pandora_logs.php,
extensions/update_manager.php, extensions/resource_registration.php,
extensions/resource_exportation.php, extensions/module_groups.php,
extensions/plugin_registration.php, extensions/snmp_explorer.php,
extensions/system_info.php, operation/menu.php: cleaned source code
style.
* include/functions_menu.php: fixed the hidden icons the extensions
in menu.
Fixes: #3568966
2012-10-25 Vanessa Gil <vanessa.gil@artica.es> 2012-10-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_reporting.php * include/functions_reporting.php

View File

@ -83,9 +83,9 @@ if (is_ajax ()) {
/** /**
* Translate the array texts using gettext * Translate the array texts using gettext
*/ */
function translate(&$item, $key) { function translate(&$item, $key) {
$item = __($item); $item = __($item);
} }
/** /**
* The main function of module groups and the enter point to * The main function of module groups and the enter point to
@ -143,7 +143,7 @@ function mainModuleGroups() {
$agentGroups = users_get_groups ($config['id_user'], "AR", false); $agentGroups = users_get_groups ($config['id_user'], "AR", false);
$modelGroups = users_get_all_model_groups(); $modelGroups = users_get_all_model_groups();
if(!empty($agentGroups) && !empty($modelGroups)) { if (!empty($agentGroups) && !empty($modelGroups)) {
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
foreach ($modelGroups as $i => $n) { foreach ($modelGroups as $i => $n) {
@ -217,17 +217,17 @@ function mainModuleGroups() {
if ($fired) { if ($fired) {
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired. $color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
} }
else if (array_key_exists(1,$states)) { else if (array_key_exists(1, $states)) {
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state. $color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
$font_color = '#ffffff'; $font_color = '#ffffff';
} }
elseif (array_key_exists(2,$states)) { elseif (array_key_exists(2, $states)) {
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state. $color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
} }
elseif (array_key_exists(3,$states)) { elseif (array_key_exists(3, $states)) {
$color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state. $color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
} }
elseif (array_key_exists(0,$states)) { elseif (array_key_exists(0, $states)) {
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules. $color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
} }

View File

@ -16,7 +16,7 @@
function view_logfile ($file_name) { function view_logfile ($file_name) {
global $config; global $config;
if (!file_exists($file_name)){ if (!file_exists($file_name)){
echo "<h2 class='error'>".__("Cannot find file"). "(".$file_name; echo "<h2 class='error'>".__("Cannot find file"). "(".$file_name;
echo ")</h2>"; echo ")</h2>";
@ -26,7 +26,7 @@ function view_logfile ($file_name) {
if ($file_size > 512000) { if ($file_size > 512000) {
$data = file_get_contents ($file_name, false, NULL, $file_size - 512000); $data = file_get_contents ($file_name, false, NULL, $file_size - 512000);
echo "<h2>$file_name (".__("File is too large (> 500KB)").")</h2>"; echo "<h2>$file_name (".__("File is too large (> 500KB)").")</h2>";
echo "<textarea style='width: 98%; float:right; height: 200px; margin-bottom:20px;' name='$file_name'>"; echo "<textarea style='width: 98%; float:right; height: 200px; margin-bottom:20px;' name='$file_name'>";
echo "... "; echo "... ";
echo $data; echo $data;
@ -45,18 +45,18 @@ function view_logfile ($file_name) {
function pandoralogs_extension_main () { function pandoralogs_extension_main () {
global $config; global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management"); db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
return; return;
} }
ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" ); ui_print_page_header (__("System logfile viewer"), "images/extensions.png", false, "", true, "" );
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>"; echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
view_logfile ($config["homedir"]."/pandora_console.log"); view_logfile ($config["homedir"]."/pandora_console.log");
view_logfile ("/var/log/pandora/pandora_server.log"); view_logfile ("/var/log/pandora/pandora_server.log");
view_logfile ("/var/log/pandora/pandora_server.error"); view_logfile ("/var/log/pandora/pandora_server.error");

View File

@ -16,21 +16,21 @@
function pluginreg_extension_main () { function pluginreg_extension_main () {
global $config; global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management"); db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php"); require ("general/noaccess.php");
return; return;
} }
ui_print_page_header (__('Plugin registration'), "images/extensions.png", false, "", true, "" ); ui_print_page_header (__('Plugin registration'), "images/extensions.png", false, "", true, "" );
echo "<div class=notify>"; echo "<div class=notify>";
printf(__("This extension makes registration of server plugins more easy. Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz). Please refer to documentation on how to obtain and use Pandora FMS Server Plugins.<br><br>You can get more plugins in our <a href='%s'>Public Resource Library</a>") , "http://pandorafms.org/index.php?sec=community&sec2=repository&lng=en"); printf(__("This extension makes registration of server plugins more easy. Here you can upload a server plugin in Pandora FMS 3.x zipped format (.pspz). Please refer to documentation on how to obtain and use Pandora FMS Server Plugins.<br><br>You can get more plugins in our <a href='%s'>Public Resource Library</a>") , "http://pandorafms.org/index.php?sec=community&sec2=repository&lng=en");
echo "</div>"; echo "</div>";
echo "<br><br>"; echo "<br><br>";
if (!isset ($_FILES['plugin_upload']['tmp_name'])){ if (!isset ($_FILES['plugin_upload']['tmp_name'])){
// Upload form // Upload form
echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>"; echo "<form name='submit_plugin' method='post' enctype='multipart/form-data'>";
@ -40,11 +40,11 @@ function pluginreg_extension_main () {
echo "</form></table>"; echo "</form></table>";
return; return;
} }
$config["plugin_store"] = $config["attachment_store"] . "/plugin"; $config["plugin_store"] = $config["attachment_store"] . "/plugin";
$zip = zip_open($_FILES['plugin_upload']['tmp_name']); $zip = zip_open($_FILES['plugin_upload']['tmp_name']);
if ($zip) { if ($zip) {
while ($zip_entry = zip_read($zip)) { while ($zip_entry = zip_read($zip)) {
if (zip_entry_open($zip, $zip_entry, "r")) { if (zip_entry_open($zip, $zip_entry, "r")) {
@ -65,7 +65,7 @@ function pluginreg_extension_main () {
} }
zip_close($zip); zip_close($zip);
} }
// Parse with sections // Parse with sections
if (! $ini_array = parse_ini_file($config["attachment_store"] . "/plugin_definition.ini", true)){ if (! $ini_array = parse_ini_file($config["attachment_store"] . "/plugin_definition.ini", true)){
echo "<h2 class=error>".__("Cannot load INI file")."</h2>"; echo "<h2 class=error>".__("Cannot load INI file")."</h2>";
@ -80,13 +80,13 @@ function pluginreg_extension_main () {
if(!isset($ini_array["plugin_definition"]["execution_postcommand"])) { if(!isset($ini_array["plugin_definition"]["execution_postcommand"])) {
$ini_array["plugin_definition"]["execution_postcommand"] = ''; $ini_array["plugin_definition"]["execution_postcommand"] = '';
} }
// From Pandora 5.0 the pspz are in different format (version 2) // From Pandora 5.0 the pspz are in different format (version 2)
// If pspz is a version 1, we convert it to 2 // If pspz is a version 1, we convert it to 2
if($version == 1) { if($version == 1) {
$ini_array["plugin_definition"] = pluginreg_convert_plugin_1_to_2($ini_array["plugin_definition"]); $ini_array["plugin_definition"] = pluginreg_convert_plugin_1_to_2($ini_array["plugin_definition"]);
} }
// Build plugin_exec // Build plugin_exec
$exec_path = $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"]; $exec_path = $config["plugin_store"] . "/" . $ini_array["plugin_definition"]["filename"];
@ -116,7 +116,7 @@ function pluginreg_extension_main () {
// Build macros // Build macros
$macros = array(); $macros = array();
$n = 1; $n = 1;
while(1) { while (1) {
if(!isset($ini_array["plugin_definition"]["macro_desc_field".$n."_"])) { if(!isset($ini_array["plugin_definition"]["macro_desc_field".$n."_"])) {
break; break;
} }
@ -129,7 +129,7 @@ function pluginreg_extension_main () {
$n++; $n++;
} }
if(empty($macros)) { if (empty($macros)) {
$macros = ''; $macros = '';
} }
else { else {

View File

@ -39,7 +39,7 @@ if (isset($_GET['get_ptr'])) {
else { else {
$config['id_user'] = $_SESSION["id_usuario"]; $config['id_user'] = $_SESSION["id_usuario"];
} }
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) { if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management"); db_pandora_audit("ACL Violation", "Trying to access Setup Management");
@ -84,9 +84,9 @@ function output_xml_resource($hook_enterprise) {
function output_xml_report($id) { function output_xml_report($id) {
global $config; global $config;
require_once ($config['homedir'].'/include/functions_agents.php'); require_once ($config['homedir'].'/include/functions_agents.php');
$report = db_get_row('treport', 'id_report', $id); $report = db_get_row('treport', 'id_report', $id);
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n"; echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";

View File

@ -35,7 +35,7 @@ function insert_item_report($report_id, $values) {
foreach ($report_id as $id => $name) { foreach ($report_id as $id => $name) {
$values['id_report'] = $id; $values['id_report'] = $id;
$result = (bool)db_process_sql_insert('treport_content', $values); $result = (bool)db_process_sql_insert('treport_content', $values);
ui_print_result_message($result, ui_print_result_message($result,
sprintf(__("Success add '%s' item in report '%s'."), $values['type'], $name), sprintf(__("Success add '%s' item in report '%s'."), $values['type'], $name),
sprintf(__("Error create '%s' item in report '%s'."), $values['type'], $name)); sprintf(__("Error create '%s' item in report '%s'."), $values['type'], $name));
@ -91,7 +91,7 @@ function process_upload_xml_report($xml, $group_filter = 0) {
if (isset($reportElement->description)) if (isset($reportElement->description))
$values['description'] = $reportElement->description; $values['description'] = $reportElement->description;
$id_report = db_process_sql_insert ('treport', $values); $id_report = db_process_sql_insert ('treport', $values);
ui_print_result_message($id_report, ui_print_result_message($id_report,
@ -403,7 +403,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$posible_name = $values['name'] . " (" . (30 - $loops) . ")"; $posible_name = $values['name'] . " (" . (30 - $loops) . ")";
} }
} }
if ($exist) { if ($exist) {
ui_print_error_message( ui_print_error_message(
sprintf( sprintf(
@ -420,18 +420,18 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
$values['name'] = io_safe_input($posible_name); $values['name'] = io_safe_input($posible_name);
$id_visual_map = db_process_sql_insert('tlayout', $values); $id_visual_map = db_process_sql_insert('tlayout', $values);
ui_print_result_message((bool)$id_visual_map, ui_print_result_message((bool)$id_visual_map,
sprintf(__("Success create '%s' visual map."), $posible_name), sprintf(__("Success create '%s' visual map."), $posible_name),
sprintf(__("Error create '%s' visual map."), $posible_name)); sprintf(__("Error create '%s' visual map."), $posible_name));
if ($id_visual_map !== false) { if ($id_visual_map !== false) {
db_pandora_audit('CREATE VISUAL CONSOLE', $id_visual_map, $config['id_user']); db_pandora_audit('CREATE VISUAL CONSOLE', $id_visual_map, $config['id_user']);
} }
else { else {
break; break;
} }
$relation_other_ids = array(); $relation_other_ids = array();
foreach ($visual_map->item as $item) { foreach ($visual_map->item as $item) {
@ -533,7 +533,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
ui_print_result_message((bool)$id_item, ui_print_result_message((bool)$id_item,
sprintf(__("Success create item type '%d' visual map."), $values['type']), sprintf(__("Success create item type '%d' visual map."), $values['type']),
sprintf(__("Error create item type '%d' visual map."), $values['type'])); sprintf(__("Error create item type '%d' visual map."), $values['type']));
if ($id_item !== false) { if ($id_item !== false) {
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']);
} }
@ -552,7 +552,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
ui_print_result_message((bool)$id_item, ui_print_result_message((bool)$id_item,
sprintf(__("Success create item for agent '%s' visual map."), $agent['name']), sprintf(__("Success create item for agent '%s' visual map."), $agent['name']),
sprintf(__("Error create item for agent '%s' visual map."), $agent['name'])); sprintf(__("Error create item for agent '%s' visual map."), $agent['name']));
if ($id_item !== false) { if ($id_item !== false) {
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']);
} }
@ -567,7 +567,7 @@ function process_upload_xml_visualmap($xml, $filter_group = 0) {
ui_print_result_message((bool)$id_item, ui_print_result_message((bool)$id_item,
sprintf(__("Success create item for agent '%s' visual map."), $agent['name']), sprintf(__("Success create item for agent '%s' visual map."), $agent['name']),
sprintf(__("Error create item for agent '%s' visual map."), $agent['name'])); sprintf(__("Error create item for agent '%s' visual map."), $agent['name']));
if ($id_item !== false) { if ($id_item !== false) {
db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']); db_pandora_audit('CREATE ITEM VISUAL CONSOLE', $values['id_layout'] . " - " . $id_item, $config['id_user']);
} }

View File

@ -52,13 +52,13 @@ function snmp_explorer() {
$interfaces = array(); $interfaces = array();
if($snmpwalk) { if ($snmpwalk) {
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port);
if($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
} }
@ -252,7 +252,7 @@ function snmp_explorer() {
// Create the interface list for the interface // Create the interface list for the interface
$interfaces_list = array(); $interfaces_list = array();
foreach($interfaces as $interface){ foreach ($interfaces as $interface){
// Get the interface name, removing " " characters and avoid "blank" interfaces // Get the interface name, removing " " characters and avoid "blank" interfaces
if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){ if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){
$ifname = $interface['ifName']['value']; $ifname = $interface['ifName']['value'];
@ -344,9 +344,6 @@ function snmp_explorer() {
echo "</form>"; echo "</form>";
//echo "</tr></table>";
//echo "</form>";
if (!empty($interfaces_list)) { if (!empty($interfaces_list)) {
echo '<span id="form_interfaces">'; echo '<span id="form_interfaces">';
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>'; echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';

View File

@ -43,7 +43,7 @@ function getPandoraDiagnostic(&$systemInfo) {
$systemInfo['ttrap'] = db_get_sql("SELECT COUNT(*) FROM ttrap"); $systemInfo['ttrap'] = db_get_sql("SELECT COUNT(*) FROM ttrap");
$systemInfo['tusuario'] = db_get_sql("SELECT COUNT(*) FROM tusuario"); $systemInfo['tusuario'] = db_get_sql("SELECT COUNT(*) FROM tusuario");
$systemInfo['tsesion'] = db_get_sql("SELECT COUNT(*) FROM tsesion"); $systemInfo['tsesion'] = db_get_sql("SELECT COUNT(*) FROM tsesion");
switch ($config["dbtype"]) { switch ($config["dbtype"]) {
case "mysql": case "mysql":
$systemInfo['db_scheme_version'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'"); $systemInfo['db_scheme_version'] = db_get_sql("SELECT `value` FROM tconfig WHERE `token` = 'db_scheme_version'");
@ -146,8 +146,8 @@ function getLastLinesLog($file, $numLines = 2000) {
function show_logfile($file_name, $numLines = 2000) { function show_logfile($file_name, $numLines = 2000) {
global $config; global $config;
if (!file_exists($file_name)){ if (!file_exists($file_name)) {
echo "<h2 class=error>" . __("Cannot find file") . "(" . $file_name . echo "<h2 class=error>" . __("Cannot find file") . "(" . $file_name .
")</h2>"; ")</h2>";
} }
@ -167,7 +167,7 @@ function show_logfile($file_name, $numLines = 2000) {
function logFilesLines($file_name, $numLines) { function logFilesLines($file_name, $numLines) {
global $config; global $config;
if (!file_exists($file_name)){ if (!file_exists($file_name)){
return ''; return '';
} }
@ -260,14 +260,15 @@ function mainSystemInfo() {
echo '</div>'; echo '</div>';
echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>"; echo "<p>" . __('This tool is used just to view your Pandora FMS system logfiles directly from console') . "</p>";
echo "<form method='post' action='index.php?extension_in_menu=gsetup&sec=gextensions&sec2=extensions/system_info'>"; echo "<form method='post' action='index.php?extension_in_menu=gsetup&sec=gextensions&sec2=extensions/system_info'>";
$table = null; $table = null;
$table->width = '98%'; $table->width = '98%';
$table->align = array(); $table->align = array();
$table->align[1] = 'right'; $table->align[1] = 'right';
if ($pandora_diag) { if ($pandora_diag) {
$table->data[0][0] = '<a href="#diag_info">' . __('Pandora Diagnostic info') . "</a>"; $table->data[0][0] = '<a href="#diag_info">' .
__('Pandora Diagnostic info') . "</a>";
} }
else { else {
$table->data[0][0] = __('Pandora Diagnostic info'); $table->data[0][0] = __('Pandora Diagnostic info');
@ -291,7 +292,6 @@ function mainSystemInfo() {
$table->data[3][1] = html_print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true); $table->data[3][1] = html_print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true);
html_print_table($table); html_print_table($table);
echo "<div style='width: " . $table->width . "; text-align: right;'>"; echo "<div style='width: " . $table->width . "; text-align: right;'>";
//html_print_submit_button(__('Show'), 'show', false, 'class="sub next"');
html_print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"'); html_print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"');
echo "</div>"; echo "</div>";
echo "</form>"; echo "</form>";
@ -558,7 +558,7 @@ function consoleMode() {
fwrite($file, $output); fwrite($file, $output);
fclose($file); fclose($file);
} }
$file = fopen($tempDir . 'my.cnf', 'w'); $file = fopen($tempDir . 'my.cnf', 'w');
if ($file !== false) { if ($file !== false) {
ob_start(); ob_start();
@ -567,7 +567,7 @@ function consoleMode() {
fwrite($file, $output); fwrite($file, $output);
fclose($file); fclose($file);
} }
$file = fopen($tempDir . 'pandora_server.conf', 'w'); $file = fopen($tempDir . 'pandora_server.conf', 'w');
if ($file !== false) { if ($file !== false) {
ob_start(); ob_start();

View File

@ -46,7 +46,7 @@ if (is_ajax ()) {
$is_enteprise = enterprise_hook('license_show_info'); $is_enteprise = enterprise_hook('license_show_info');
// If Open show info // If Open show info
if ($is_enteprise === ENTERPRISE_NOT_HOOK){ if ($is_enteprise === ENTERPRISE_NOT_HOOK) {
$table->width = '98%'; $table->width = '98%';
$table->data = array (); $table->data = array ();
$table->style = array(); $table->style = array();

View File

@ -300,16 +300,20 @@ function extensions_add_operation_menu_option ($name, $fatherId = null, $icon =
global $config; global $config;
global $extension_file; global $extension_file;
/* $config['extension_file'] is set in extensions_load_extensions(), since that function must /*
be called before any function the extension call, we are sure it will $config['extension_file'] is set in extensions_load_extensions(),
be set. */ since that function must be called before any function the extension
call, we are sure it will be set.
*/
$option_menu['name'] = $name; $option_menu['name'] = $name;
$extension = &$config['extensions'][$extension_file]; $extension = &$config['extensions'][$extension_file];
$option_menu['sec2'] = $extension['dir'].'/'.mb_substr ($extension_file, 0, -4);
$option_menu['sec2'] = $extension['dir'] . '/' . mb_substr ($extension_file, 0, -4);
$option_menu['fatherId'] = $fatherId; $option_menu['fatherId'] = $fatherId;
$option_menu['icon'] = $icon; $option_menu['icon'] = $icon;
$option_menu['version'] = $version; $option_menu['version'] = $version;
$extension['operation_menu'] = $option_menu; $extension['operation_menu'] = $option_menu;
} }

View File

@ -27,20 +27,20 @@
function menu_print_menu (&$menu) { function menu_print_menu (&$menu) {
global $config; global $config;
static $idcounter = 0; static $idcounter = 0;
echo '<div class="menu">'; echo '<div class="menu">';
$sec = (string) get_parameter ('sec'); $sec = (string) get_parameter ('sec');
$sec2 = (string) get_parameter ('sec2'); $sec2 = (string) get_parameter ('sec2');
$allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']); $allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']);
if(isset($allsec2[1])) { if (isset($allsec2[1])) {
$allsec2 = $allsec2[1]; $allsec2 = $allsec2[1];
} }
else { else {
$allsec2 = $sec2; $allsec2 = $sec2;
} }
echo '<ul'.(isset ($menu['class']) ? ' class="'.$menu['class'].'"' : '').'>'; echo '<ul'.(isset ($menu['class']) ? ' class="'.$menu['class'].'"' : '').'>';
foreach ($menu as $mainsec => $main) { foreach ($menu as $mainsec => $main) {
@ -200,8 +200,10 @@ function menu_print_menu (&$menu) {
//Ini Add icon extension //Ini Add icon extension
$secExtension = null; $secExtension = null;
if (array_key_exists('extension',$sub)) $secExtensionBool = $sub["extension"]; if (array_key_exists('extension',$sub))
else $secExtensionBool = false; $secExtensionBool = $sub["extension"];
else
$secExtensionBool = false;
if ($secExtensionBool) { if ($secExtensionBool) {
$imageIconDefault = 'images/extensions.png'; $imageIconDefault = 'images/extensions.png';
@ -224,8 +226,8 @@ function menu_print_menu (&$menu) {
else { else {
$imageIcon = $imageIconDefault; $imageIcon = $imageIconDefault;
} }
//Delete extension Icon before the was a style with background: url('.$imageIcon.') no-repeat;
$submenu_output .= '<div style="width: 16px; height: 16px; float: left; margin: 5px 0px 0px 3px;">&nbsp;</div>'; $submenu_output .= '<div style="background: url('.$imageIcon.') no-repeat; width: 16px; height: 16px; float: left; margin: 5px 0px 0px 3px;">&nbsp;</div>';
} }
@ -395,8 +397,8 @@ function menu_add_extras(&$menu) {
$menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text']; $menu_extra[$mm['sec']]['sub'][$kk]['text'] = $mm['text'];
} }
} }
} }
$menu = array_merge_recursive($menu, $menu_extra); $menu = array_merge_recursive($menu, $menu_extra);
} }
@ -404,7 +406,7 @@ function menu_add_extras(&$menu) {
* Get the sec list built in menu * Get the sec list built in menu
* *
* @param bool If true, the array returned will have the structure * @param bool If true, the array returned will have the structure
* to combo categories (optgroup) * to combo categories (optgroup)
* *
* @return array Sections list * @return array Sections list
*/ */

View File

@ -319,7 +319,7 @@ if (check_acl ($config['id_user'], 0, "IR") == 1) {
} }
if (check_acl ($config['id_user'], 0, "AR")) { if (check_acl ($config['id_user'], 0, "AR")) {
// Messages // Messages
$sub["operation/messages/message_list"]["text"] = __('Messages'); $sub["operation/messages/message_list"]["text"] = __('Messages');
$sub["operation/messages/message_list"]["refr"] = 0; $sub["operation/messages/message_list"]["refr"] = 0;