2008-09-03 Esteban Sanchez <estebans@artica.es>

* include/config_process.php: Checks in homeurl config variable. Style 
        corrections.

        * include/help/en/help_date_format.php: Points to oficial PHP manual 
        on php.net.

        * godmode/agentes/modificar_agente.php: Escape quotes which was
        causing SQL errors.

        * godmode/reporting/map_builder.php: Fixed divs and tables widths.

        * include/functions.php, operation/agentes/datos_agente.php: Style 
        corrections.

        * include/functions_db.php: Style corrections. Added comments for 
        translators.

        * operation/extensions.php: Added login checking.

        * operation/reporting/reporting_viewer.php: Minor bug that was causing
        javascript failures.

        * operation/users/user.php: Use print_help_tip() to show contextual
        help.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1073 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
esanchezm 2008-09-03 12:01:46 +00:00
parent f3876f11ea
commit a11e7b89c6
11 changed files with 94 additions and 56 deletions

View File

@ -1,3 +1,30 @@
2008-09-03 Esteban Sanchez <estebans@artica.es>
* include/config_process.php: Checks in homeurl config variable. Style
corrections.
* include/help/en/help_date_format.php: Points to oficial PHP manual
on php.net.
* godmode/agentes/modificar_agente.php: Escape quotes which was
causing SQL errors.
* godmode/reporting/map_builder.php: Fixed divs and tables widths.
* include/functions.php, operation/agentes/datos_agente.php: Style
corrections.
* include/functions_db.php: Style corrections. Added comments for
translators.
* operation/extensions.php: Added login checking.
* operation/reporting/reporting_viewer.php: Minor bug that was causing
javascript failures.
* operation/users/user.php: Use print_help_tip() to show contextual
help.
2008-09-02 Evi Vanoost <vanooste@rcbi.rochester.edu> 2008-09-02 Evi Vanoost <vanooste@rcbi.rochester.edu>
* reporting/fgraph.php: SQL passed wasn't being processed, so the graph * reporting/fgraph.php: SQL passed wasn't being processed, so the graph

View File

@ -111,7 +111,7 @@ if (isset($_GET["borrar_agente"])){ // if delete agent
} }
unset ($sql_delete, $del_error); //Clean up unset ($sql_delete, $del_error); //Clean up
process_sql ("SET AUTOCOMMIT=1;"); process_sql ("SET AUTOCOMMIT=1;");
audit_db($config["id_user"],$REMOTE_ADDR, "Agent '$agent_name' deleted", "Agent Management"); audit_db($config["id_user"],$REMOTE_ADDR, "Agent \'$agent_name\' deleted", "Agent Management");
// Delete remote configuration // Delete remote configuration
$agent_md5 = md5($agent_name, FALSE); $agent_md5 = md5($agent_name, FALSE);
@ -123,8 +123,8 @@ if (isset($_GET["borrar_agente"])){ // if delete agent
unlink ($file_name); unlink ($file_name);
} }
} else { // NO permissions. } else { // NO permissions.
audit_db($config["id_user"],$REMOTE_ADDR, "ACL Violation", audit_db ($config["id_user"],$REMOTE_ADDR, "ACL Violation",
"Trying to delete agent '$agent_name'"); "Trying to delete agent \'$agent_name\'");
require ("general/noaccess.php"); require ("general/noaccess.php");
exit; exit;
} }

View File

@ -282,7 +282,7 @@ if (! $edit_layout && ! $id_layout) {
print_table ($table); print_table ($table);
} }
echo '<div class="action-buttons" style="width: 500px">'; echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form action="index.php?sec=greporting&sec2=godmode/reporting/map_builder" method="post">'; echo '<form action="index.php?sec=greporting&sec2=godmode/reporting/map_builder" method="post">';
print_input_hidden ('edit_layout', 1); print_input_hidden ('edit_layout', 1);
print_submit_button (__('Create'), '', false, 'class="sub wand"'); print_submit_button (__('Create'), '', false, 'class="sub wand"');
@ -298,7 +298,7 @@ if (! $edit_layout && ! $id_layout) {
$backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0)); $backgrounds_list = array_merge ($backgrounds_list, list_files ('images/console/background/', "png", 1, 0));
$groups = get_user_groups ($config['id_user']); $groups = get_user_groups ($config['id_user']);
$table->width = '300px'; $table->width = '340px';
$table->data = array (); $table->data = array ();
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true); $table->data[0][1] = print_input_text ('name', $name, '', 15, 50, true);
@ -316,7 +316,7 @@ if (! $edit_layout && ! $id_layout) {
echo '<form action="index.php?sec=greporting&sec2=godmode/reporting/map_builder" method="post">'; echo '<form action="index.php?sec=greporting&sec2=godmode/reporting/map_builder" method="post">';
print_table ($table); print_table ($table);
echo '<div style="width: 340px" class="action-buttons">'; echo '<div style="width: '.$table->width.'" class="action-buttons">';
if ($id_layout) { if ($id_layout) {
print_submit_button (__('Update'), 'update_layout', false, 'class="sub upd"'); print_submit_button (__('Update'), 'update_layout', false, 'class="sub upd"');
print_input_hidden ('update_layout', 1); print_input_hidden ('update_layout', 1);
@ -439,7 +439,6 @@ if (! $edit_layout && ! $id_layout) {
<link rel="stylesheet" href="include/styles/color-picker.css" type="text/css" /> <link rel="stylesheet" href="include/styles/color-picker.css" type="text/css" />
<script type="text/javascript" src="include/javascript/jquery.js"></script> <script type="text/javascript" src="include/javascript/jquery.js"></script>
<script type="text/javascript" src="include/javascript/pandora_visual_console.js"></script> <script type="text/javascript" src="include/javascript/pandora_visual_console.js"></script>
<script type="text/javascript" src="include/javascript/pandora_visual_console.js"></script>
<script type="text/javascript" src="include/javascript/jquery.ui.core.js"></script> <script type="text/javascript" src="include/javascript/jquery.ui.core.js"></script>
<script type="text/javascript" src="include/javascript/jquery.ui.draggable.js"></script> <script type="text/javascript" src="include/javascript/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="include/javascript/jquery.ui.droppable.js"></script> <script type="text/javascript" src="include/javascript/jquery.ui.droppable.js"></script>

View File

@ -114,9 +114,12 @@ if (file_exists ('./include/languages/'.$config["language"].'.mo')) {
$l10n->load_tables(); $l10n->load_tables();
} }
if (!isset($config["date_format"])) { if (! isset ($config['date_format'])) {
$config["date_format"] = "F j, Y, g:i a"; $config['date_format'] = 'F j, Y, g:i a';
} }
if (isset ($config['homeurl']) && $config['homeurl'][0] != '/') {
$config['homeurl'] = '/'.$config['homeurl'];
}
?> ?>

View File

@ -47,7 +47,7 @@ function safe_input ($value) {
if (is_numeric ($value)) if (is_numeric ($value))
return $value; return $value;
if (is_array ($value)) { if (is_array ($value)) {
array_walk ($value,'safe_input'); array_walk ($value, 'safe_input');
return $value; return $value;
} }
return htmlentities (utf8_decode ($value), ENT_QUOTES); return htmlentities (utf8_decode ($value), ENT_QUOTES);
@ -83,7 +83,8 @@ function salida_limpia ($string) {
$trans[chr(38)] = '&'; $trans[chr(38)] = '&';
} }
// after the initial translation, _do_ map standalone "&" into "&#38;" // after the initial translation, _do_ map standalone "&" into "&#38;"
return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&#38;" , strtr($string, $trans)); return preg_replace ("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&#38;",
strtr ($string, $trans));
} }
/** /**
@ -412,15 +413,18 @@ function format_datetime ($timestamp, $alt_format = "") {
* *
* @param number Number to be rendered * @param number Number to be rendered
* @param decimals Number of decimals to be shown. Default value: 1 * @param decimals Number of decimals to be shown. Default value: 1
* @param dec_point Decimal separator string. Default value: .
* @param thousands_sep Thousands separator string. Default value: ,
* *
* @return * @return
*/ */
function format_numeric ($number, $decimals = 1, $dec_point = ".", $thousands_sep = ",") { function format_numeric ($number, $decimals = 1) {
if ($number == 0) if ($number == 0)
return 0; return 0;
// Translators: This is separator of decimal point
$dec_point = __(".");
// Translators: This is separator of decimal point
$thousands_sep = __(",");
/* If has decimals */ /* If has decimals */
if (fmod ($number , 1) > 0) if (fmod ($number , 1) > 0)
return number_format ($number, $decimals, $dec_point, $thousands_sep); return number_format ($number, $decimals, $dec_point, $thousands_sep);
@ -504,12 +508,12 @@ function human_time_comparation ($timestamp) {
function human_time_description_raw ($seconds) { function human_time_description_raw ($seconds) {
global $lang_label; global $lang_label;
if ($seconds < 3600) if ($seconds < 3600)
return format_numeric($seconds/60,2)." ".__('minutes'); return format_numeric ($seconds / 60, 2)." ".__('minutes');
if ($seconds >= 3600 && $seconds < 86400) if ($seconds >= 3600 && $seconds < 86400)
return format_numeric ($seconds/3600,2)." ".__('hours'); return format_numeric ($seconds / 3600, 2)." ".__('hours');
return format_numeric ($seconds/86400,2)." ".__('days'); return format_numeric ($seconds / 86400, 2)." ".__('days');
} }
/** /**

View File

@ -1257,7 +1257,6 @@ $sql_cache = array ('saved' => 0);
* @return Value of first column of the first row. False if there were no row. * @return Value of first column of the first row. False if there were no row.
*/ */
function get_db_value ($field, $table, $field_search = 1, $condition = 1) { function get_db_value ($field, $table, $field_search = 1, $condition = 1) {
if (is_int ($condition)) { if (is_int ($condition)) {
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1", $sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1",
$field, $table, $field_search, $condition); $field, $table, $field_search, $condition);
@ -1270,7 +1269,7 @@ function get_db_value ($field, $table, $field_search = 1, $condition = 1) {
} }
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
if($result === false) if ($result === false)
return false; return false;
return $result[0][$field]; return $result[0][$field];
@ -1370,7 +1369,7 @@ function get_db_all_rows_sql ($sql) {
* *
* @return An array with the rows, columns and values in a multidimensional array * @return An array with the rows, columns and values in a multidimensional array
*/ */
function process_sql ($sql,$rettype = "affected_rows") { function process_sql ($sql, $rettype = "affected_rows") {
global $config; global $config;
global $sql_cache; global $sql_cache;
$retval = array(); $retval = array();
@ -1795,19 +1794,23 @@ function check_server_status () {
*/ */
function show_alert_row_mini ($id_combined_alert) { function show_alert_row_mini ($id_combined_alert) {
$color=1; $color=1;
$sql = sprintf("SELECT talerta_agente_modulo.*, tcompound_alert.operation FROM talerta_agente_modulo, tcompound_alert $sql = sprintf ("SELECT talerta_agente_modulo.*,tcompound_alert.operation
WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam AND tcompound_alert.id = %d",$id_combined_alert); FROM talerta_agente_modulo, tcompound_alert
WHERE tcompound_alert.id_aam = talerta_agente_modulo.id_aam
AND tcompound_alert.id = %d", $id_combined_alert);
$result = get_db_all_rows_sql ($sql); $result = get_db_all_rows_sql ($sql);
if (!$result) if ($result === false)
return; return;
echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>"; echo "<table width=400 cellpadding=2 cellspacing=2 class='databox'>";
echo "<th>".__('Name')."</th>"; echo "<th>".__('Name')."</th>";
echo "<th>".__('Oper')."</th>"; echo "<th>".__('Oper')."</th>";
/* Translators: Abbrevation for Time threshold */
echo "<th>".__('Tt')."</th>"; echo "<th>".__('Tt')."</th>";
echo "<th>".__('Firing')."</th>"; echo "<th>".__('Firing')."</th>";
echo "<th>".__('Time')."</th>"; echo "<th>".__('Time')."</th>";
/* Translators: Abbrevation for Description */
echo "<th>".__('Desc')."</th>"; echo "<th>".__('Desc')."</th>";
echo "<th>".__('Recovery')."</th>"; echo "<th>".__('Recovery')."</th>";
echo "<th>".__('MinMax.Al')."</th>"; echo "<th>".__('MinMax.Al')."</th>";

View File

@ -326,7 +326,7 @@
<tr valign="middle"> <tr valign="middle">
<td colspan="1" rowspan="1" align="left"><i>U</i></td> <td colspan="1" rowspan="1" align="left"><i>U</i></td>
<td colspan="1" rowspan="1" align="left">Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)</td> <td colspan="1" rowspan="1" align="left">Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)</td>
<td colspan="1" rowspan="1" align="left">See also <a href="function.time.php" class="function">time()</a></td> <td colspan="1" rowspan="1" align="left">See also <a href="http://es.php.net/manual/en/function.time.php" class="function">time()</a></td>
</tr> </tr>

View File

@ -23,7 +23,7 @@ require ("include/config.php");
check_login(); check_login();
if (give_acl ($config['id_user'], 0, "AR")!=1) { if (! give_acl ($config['id_user'], 0, "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access Agent Data view"); "Trying to access Agent Data view");
require ("general/noaccess.php"); require ("general/noaccess.php");

View File

@ -16,6 +16,8 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
check_login ();
if (! give_acl ($config['id_user'], 0, "AR")) { if (! give_acl ($config['id_user'], 0, "AR")) {
audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation", audit_db ($config['id_user'], $REMOTE_ADDR, "ACL Violation",
"Trying to access extensions list"); "Trying to access extensions list");

View File

@ -89,9 +89,9 @@ echo '</div>';
<script type="text/javascript" src="include/javascript/jquery.js"></script> <script type="text/javascript" src="include/javascript/jquery.js"></script>
<script src="include/javascript/jquery.ui.core.js"></script> <script src="include/javascript/jquery.ui.core.js"></script>
<script src="include/javascript/jquery.ui.datepicker.js"></script> <script src="include/javascript/jquery.ui.datepicker.js"></script>
<script src="include/javascript/jquery.timeentry.js"></script>
<script src="include/languages/date_<?= $config['language'] ?>.js"></script> <script src="include/languages/date_<?= $config['language'] ?>.js"></script>
<script src="include/languages/time_<?= $config['language'] ?>.js"></script> <script src="include/languages/time_<?= $config['language'] ?>.js"></script>
<script src="include/javascript/jquery.timeentry.js"></script>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">

View File

@ -98,36 +98,36 @@ echo "</table><br>";
echo "<tr>"; echo "<tr>";
echo "<th width='180px'> echo "<th width='180px'>
<font size=1>".__('Profiles')."</th>"; <font size=1>".__('Profiles')."</th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>IR";
<font size=1>IR<a href='#' class='tipp'>&nbsp;<span>".__("IR")."</span></a> print_help_tip (__('System incidents reading'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>IW";
<font size=1>IW<a href='#' class='tipp'>&nbsp;<span>".__("IW")."</span></a> print_help_tip (__('System incidents writing'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>IM";
<font size=1>IM<a href='#' class='tipp'>&nbsp;<span>".__("IM")."</span></a> print_help_tip (__('System incidents management'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>AR";
<font size=1>AR<a href='#' class='tipp'>&nbsp;<span>".__("AR")."</span></a> print_help_tip (__('Agents reading'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>AW";
<font size=1>AW<a href='#' class='tipp'>&nbsp;<span>".__("AW")."</span></a> print_help_tip (__('Agents management'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>LW";
<font size=1>LW<a href='#' class='tipp'>&nbsp;<span>".("LW")."</span></a> print_help_tip (__('Alerts edition'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>UM";
<font size=1>UM<a href='#' class='tipp'>&nbsp;<span>".__("UM")."</span></a> print_help_tip (__('Users management'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>DM";
<font size=1>DM<a href='#' class='tipp'>&nbsp;<span>".__("DM")."</span></a> print_help_tip (__('Database management'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>LM";
<font size=1>LM<a href='#' class='tipp'>&nbsp;<span>".__("LM")."</span></a> print_help_tip (__('Alerts anagement'));
</font></th>"; echo "</font></th>";
echo "<th width='40px'> echo "<th width='40px'><font size=1>PM";
<font size=1>PM<a href='#' class='tipp'>&nbsp;<span>".__("PM")."</span></a> print_help_tip (__('Pandora system management'));
</font></th>"; echo "</font></th>";
$color = 1; $color = 1;
while ($rowdup=mysql_fetch_array($resq1)){ while ($rowdup=mysql_fetch_array($resq1)){
$id_perfil = $rowdup["id_perfil"]; $id_perfil = $rowdup["id_perfil"];