2008-08-20 Evi Vanoost <vanooste@rcbi.rochester.edu
* godmode/profiles/profile_list.php: HTML overhaul (close tags, put brackets and quotes in the right places. Now uses new functions instead of the old ones * include/locale.class.php: Updated and added functions. See internals for updated functions. It now allows to put a translated array of languages, countries and currency instead of the built-in english one git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1014 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b1c689f17b
commit
d25a670e5c
|
@ -1,3 +1,13 @@
|
|||
2008-08-20 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* godmode/profiles/profile_list.php: HTML overhaul (close tags, put
|
||||
brackets and quotes in the right places. Now uses new functions
|
||||
instead of the old ones
|
||||
|
||||
* include/locale.class.php: Updated and added functions. See internals
|
||||
for updated functions. It now allows to put a translated array of
|
||||
languages, countries and currency instead of the built-in english one
|
||||
|
||||
2008-08-19 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* include/locale.class.php: Fixes in Translate_Locale() to work
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
<?php
|
||||
// Pandora - The Free Monitoring System
|
||||
// This code is protected by GPL license.
|
||||
// Este codigo esta protegido por la licencia GPL.
|
||||
// Sancho Lerena <slerena@gmail.com>, 2003-2007
|
||||
// Raul Mateos <raulofpandora@gmail.com>, 2005-2007
|
||||
// Pandora FMS - the Flexible monitoring system
|
||||
// ============================================
|
||||
// Copyright (c) 2004-2008 Sancho Lerena, <slerena@gmail.com>
|
||||
// Copyright (c) 2005-2008 Artica Soluciones Tecnologicas
|
||||
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation version 2
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Global variables
|
||||
require ("include/config.php");
|
||||
|
@ -17,285 +24,267 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
|
|||
return;
|
||||
}
|
||||
|
||||
//Page title definitation. Will be overridden by Edit and Create Profile
|
||||
$page_title = __('Profiles defined in Pandora');
|
||||
|
||||
// Profile deletion
|
||||
if (isset($_GET["delete_profile"])){ // if any parameter is modified
|
||||
$id_perfil= entrada_limpia($_GET["delete_profile"]);
|
||||
if (isset ($_GET["delete_profile"])){ // if any parameter is modified
|
||||
$id_profile = safe_input ($_GET["delete_profile"]);
|
||||
|
||||
// Delete profile
|
||||
$query_del1="DELETE FROM tperfil WHERE id_perfil = '".$id_perfil."'";
|
||||
$query_del2="DELETE FROM tusuario_perfil WHERE id_perfil = '".$id_perfil."'";
|
||||
$resq1=mysql_query($query_del1);
|
||||
if (! $resq1)
|
||||
echo "<h3 class='error'>".__('There was a problem deleting profile')."</h3>";
|
||||
else
|
||||
echo "<h3 class='suc'>".__('Profile successfully deleted')."</h3>";
|
||||
$resq1=mysql_query($query_del2);
|
||||
unset($id_perfil); // forget it to show list
|
||||
}
|
||||
// Profile creation
|
||||
elseif (isset($_GET["new_profile"])){ // create a new profile
|
||||
$query = "DELETE FROM tperfil WHERE id_perfil = '".$id_profile."'";
|
||||
$ret = process_sql ($query);
|
||||
if ($ret === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem deleting the profile').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="suc">'.__('Profile successfully deleted').'</h3>';
|
||||
}
|
||||
|
||||
//Delete profile from user data
|
||||
$query = "DELETE FROM tusuario_perfil WHERE id_perfil = '".$id_profile."'";
|
||||
process_sql ($query);
|
||||
|
||||
unset($id_profile); // forget it to show list
|
||||
} elseif (isset ($_GET["new_profile"])) { // create a new profile
|
||||
$id_perfil = -1;
|
||||
$name = "";
|
||||
$incident_view = "0";
|
||||
$incident_edit = "0";
|
||||
$incident_create = "0";
|
||||
$incident_management = "0";
|
||||
$agent_view = "0";
|
||||
$agent_edit ="0";
|
||||
$alert_edit = "0";
|
||||
$user_management = "0";
|
||||
$db_management = "0";
|
||||
$alert_management = "0";
|
||||
$pandora_management = "0";
|
||||
} elseif (isset($_GET["edit_profile"])){ // Edit profile (read data to show in form)
|
||||
// Profile edit
|
||||
$id_perfil= entrada_limpia($_GET["edit_profile"]);
|
||||
$query_del1="SELECT * FROM tperfil WHERE id_perfil = '".$id_perfil."'";
|
||||
$resq1=mysql_query($query_del1);
|
||||
$rowq1=mysql_fetch_array($resq1);
|
||||
if (!$rowq1){
|
||||
echo "<h3 class='error'>".__('There was a problem loading profile')."</h3>";
|
||||
echo "</table>";
|
||||
include ("general/footer.php");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
$name = $rowq1["name"];
|
||||
$incident_view = $rowq1["incident_view"];
|
||||
$incident_edit = $rowq1["incident_edit"];
|
||||
$incident_management = $rowq1["incident_management"];
|
||||
$agent_view = $rowq1["agent_view"];
|
||||
$agent_edit =$rowq1["agent_edit"];
|
||||
$alert_edit = $rowq1["alert_edit"];
|
||||
$user_management = $rowq1["user_management"];
|
||||
$db_management = $rowq1["db_management"];
|
||||
$alert_management = $rowq1["alert_management"];
|
||||
$pandora_management = $rowq1["pandora_management"];
|
||||
} elseif (isset($_GET["update_data"])){ // Update or Create a new record (writes on DB)
|
||||
// Profile edit
|
||||
$incident_view = "0";
|
||||
$incident_edit = "0";
|
||||
$incident_create = "0";
|
||||
$incident_management = "0";
|
||||
$agent_view = "0";
|
||||
$agent_edit ="0";
|
||||
$alert_edit = "0";
|
||||
$user_management = "0";
|
||||
$db_management = "0";
|
||||
$alert_management = "0";
|
||||
$pandora_management = "0";
|
||||
$id_perfil= entrada_limpia($_POST["id_perfil"]);
|
||||
$name = entrada_limpia($_POST["name"]);
|
||||
$incident_view = 0;
|
||||
$incident_edit = 0;
|
||||
$incident_management = 0;
|
||||
$agent_view = 0;
|
||||
$agent_edit = 0;
|
||||
$alert_edit = 0;
|
||||
$user_management = 0;
|
||||
$db_management = 0;
|
||||
$alert_management = 0;
|
||||
$pandora_management = 0;
|
||||
$page_title = __('Create profile');
|
||||
} elseif (isset ($_GET["edit_profile"])) { // Edit profile (read data to show in form)
|
||||
$id_perfil = safe_input ($_GET["edit_profile"]);
|
||||
$row = get_db_row_sql("SELECT * FROM tperfil WHERE id_perfil = '".$id_perfil."'");
|
||||
|
||||
if (isset ($_POST["incident_view"]))$incident_view = entrada_limpia($_POST["incident_view"]);
|
||||
if (isset ($_POST["incident_edit"])) $incident_edit = entrada_limpia($_POST["incident_edit"]);
|
||||
if (isset ($_POST["incident_management"])) $incident_management = entrada_limpia($_POST["incident_management"]);
|
||||
if (isset ($_POST["agent_view"])) $agent_view = entrada_limpia($_POST["agent_view"]);
|
||||
if (isset ($_POST["agent_edit"])) $agent_edit =entrada_limpia($_POST["agent_edit"]);
|
||||
if (isset ($_POST["alert_edit"])) $alert_edit = entrada_limpia($_POST["alert_edit"]);
|
||||
if (isset ($_POST["user_management"])) $user_management = entrada_limpia($_POST["user_management"]);
|
||||
if (isset ($_POST["db_management"])) $db_management = entrada_limpia($_POST["db_management"]);
|
||||
if (isset ($_POST["alert_management"])) $alert_management = entrada_limpia($_POST["alert_management"]);
|
||||
if (isset ($_POST["pandora_management"])) $pandora_management = entrada_limpia($_POST["pandora_management"]);
|
||||
if ($row === false) {
|
||||
echo '<h3 class="error">'.__('There was a problem loading profile').'</h3></table>'; //Error and close open table
|
||||
include ("general/footer.php");
|
||||
exit;
|
||||
} else {
|
||||
$name = $row["name"];
|
||||
$incident_view = $row["incident_view"];
|
||||
$incident_edit = $row["incident_edit"];
|
||||
$incident_management = $row["incident_management"];
|
||||
$agent_view = $row["agent_view"];
|
||||
$agent_edit =$row["agent_edit"];
|
||||
$alert_edit = $row["alert_edit"];
|
||||
$user_management = $row["user_management"];
|
||||
$db_management = $row["db_management"];
|
||||
$alert_management = $row["alert_management"];
|
||||
$pandora_management = $row["pandora_management"];
|
||||
unset ($row); //clean up variables
|
||||
}
|
||||
|
||||
$page_title = __('Update profile');
|
||||
|
||||
} elseif (isset ($_GET["update_data"])) { // Update or Create a new record (writes on DB)
|
||||
// Profile edit
|
||||
$id_profile = (int) get_parameter_post ("id_perfil",-1);
|
||||
$name = get_parameter_post ("name");
|
||||
|
||||
$incident_view = (bool) get_parameter_post ("incident_view",0);
|
||||
$incident_edit = (bool) get_parameter_post ("incident_edit",0);
|
||||
$incident_management = (bool) get_parameter_post ("incident_management",0);
|
||||
$agent_view = (bool) get_parameter_post ("agent_view",0);
|
||||
$agent_edit = (bool) get_parameter_post ("agent_edit",0);
|
||||
$alert_edit = (bool) get_parameter_post ("alert_edit",0);
|
||||
$user_management = (bool) get_parameter_post ("user_management",0);
|
||||
$db_management = (bool) get_parameter_post ("db_management",0);
|
||||
$alert_management = (bool) get_parameter_post ("alert_management",0);
|
||||
$pandora_management = (bool) get_parameter_post ("pandora_management",0);
|
||||
|
||||
// update or insert ??
|
||||
|
||||
if ($id_perfil == -1) { // INSERT
|
||||
$query = "INSERT INTO tperfil (name,incident_view,incident_edit,incident_management, agent_view,agent_edit,alert_edit,user_management,db_management,alert_management,pandora_management) VALUES
|
||||
if ($id_profile == -1) { // INSERT
|
||||
$query = "INSERT INTO tperfil
|
||||
(name,incident_view,incident_edit,incident_management,agent_view,agent_edit,alert_edit,user_management,db_management,alert_management,pandora_management)
|
||||
VALUES
|
||||
('".$name."','".$incident_view."','".$incident_edit."','".$incident_management."','".$agent_view."','".$agent_edit."','".$alert_edit."','".$user_management."','".$db_management."','".$alert_management."','".$pandora_management."')";
|
||||
// echo "DEBUG: ".$query;
|
||||
$res = mysql_query($query);
|
||||
if ($res)
|
||||
echo "<h3 class='suc'>".__('Profile successfully created')."</h3>";
|
||||
else {
|
||||
echo "<h3 class='error'>".__('There was a problem creating profile')."</h3>";
|
||||
$ret = process_sql ($query);
|
||||
if ($ret !== false) {
|
||||
echo '<h3 class="suc">'.__('Profile successfully created').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error">'.__('There was a problem creating this profile').'</h3>';
|
||||
}
|
||||
|
||||
} else { // UPDATE
|
||||
$query ="UPDATE tperfil SET
|
||||
name = '$name',
|
||||
incident_view = $incident_view,
|
||||
incident_edit = $incident_edit,
|
||||
incident_management = $incident_management,
|
||||
agent_view = $agent_view,
|
||||
agent_edit = $agent_edit,
|
||||
alert_edit = $alert_edit,
|
||||
user_management = $user_management,
|
||||
db_management = $db_management,
|
||||
alert_management = $alert_management,
|
||||
pandora_management = $pandora_management
|
||||
WHERE id_perfil = $id_perfil ";
|
||||
$query = "UPDATE tperfil SET
|
||||
name = '".$name."',
|
||||
incident_view = '".$incident_view."',
|
||||
incident_edit = '".$incident_edit."',
|
||||
incident_management = '".$incident_management."',
|
||||
agent_view = '".$agent_view."',
|
||||
agent_edit = '".$agent_edit."',
|
||||
alert_edit = '".$alert_edit."',
|
||||
user_management = '".$user_management."',
|
||||
db_management = '".$db_management."',
|
||||
alert_management = '".$alert_management."',
|
||||
pandora_management = '".$pandora_management."'
|
||||
WHERE id_perfil = '".$id_profile."'";
|
||||
// echo "DEBUG: ".$query;
|
||||
$res=mysql_query($query);
|
||||
echo "<h3 class='suc'>".__('Profile successfully updated')."</h3>";
|
||||
$ret = process_sql ($query);
|
||||
if ($ret !== false) {
|
||||
echo '<h3 class="suc">'.__('Profile successfully updated').'</h3>';
|
||||
} else {
|
||||
echo '<h3 class="error"'.__('There was a problem updating this profile').'</h3>';
|
||||
}
|
||||
}
|
||||
unset($id_perfil);
|
||||
unset ($id_profile);
|
||||
}
|
||||
echo '<h2>'.__('Profile management').' > ';
|
||||
echo (isset($_GET["new_profile"])) ?
|
||||
(__('Create profile').'</h2>'):
|
||||
(
|
||||
(isset($_GET["edit_profile"]))?
|
||||
(__('Update profile').'></h2>'):
|
||||
(__('Profiles defined in Pandora').'</h2>')
|
||||
);
|
||||
|
||||
echo '<h2>'.__('Profile management').' > '.$page_title.'</h2>';
|
||||
|
||||
// Form to manage date
|
||||
if (isset ($id_perfil)){ // There are values defined, let's show form with data for INSERT or UPDATE
|
||||
echo "<table width='400' cellpadding='4' cellspacing='4' class='databox'>";
|
||||
echo "<tr>";
|
||||
echo "<form method='post' action='index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&update_data'>";
|
||||
echo "<input type=hidden name=id_perfil value='".$id_perfil."'>";
|
||||
echo "
|
||||
<td class=datos>".__('Profile name')."</td>
|
||||
<td class=datos>
|
||||
<input name='name' type=text size='27' value='".$name."'></td></tr>
|
||||
<tr><td class=datos2>".__('View incidents')."</td>
|
||||
<td class=datos2>
|
||||
<input name='incident_view' type=checkbox class='chk' value='1' ";
|
||||
if ($incident_view == 1) echo "checked"; echo "></td></tr>
|
||||
<tr><td class=datos>".__('Edit incidents')."</td>
|
||||
<td class=datos>
|
||||
<input name='incident_edit' type=checkbox class='chk' value='1' ";
|
||||
if ($incident_edit == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos2>".__('Manage incidents')."</td>
|
||||
<td class=datos2>
|
||||
<input name='incident_management' type=checkbox class='chk' value='1' ";
|
||||
if ($incident_management == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos>".__('View agents')."</td>
|
||||
<td class=datos>
|
||||
<input name='agent_view' type=checkbox class='chk' value='1' ";
|
||||
if ($agent_view == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos2>".__('Edit agents')."</td>
|
||||
<td class=datos2>
|
||||
<input name='agent_edit' type=checkbox class='chk' value='1' ";
|
||||
if ($agent_edit == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos>".__('Edit alerts')."</td>
|
||||
<td class=datos>
|
||||
<input name='alert_edit' type=checkbox class='chk' value='1' ";
|
||||
if ($alert_edit == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos2>".__('Manage users')."</td>
|
||||
<td class=datos2>
|
||||
<input name='user_management' class='chk' type=checkbox value='1' ";
|
||||
if ($user_management == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos>".__('Manage Database')."</td>
|
||||
<td class=datos>
|
||||
<input name='db_management' class='chk' type=checkbox value='1' ";
|
||||
if ($db_management == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos2>".__('Manage alerts')."</td>
|
||||
<td class=datos2>
|
||||
<input name='alert_management' class='chk' type=checkbox value='1' ";
|
||||
if ($alert_management == 1) echo "checked";echo "></td></tr>
|
||||
<tr><td class=datos>".__('Pandora management')."</td>
|
||||
<td class=datos>
|
||||
<input name='pandora_management' class='chk' type=checkbox value='1' ";
|
||||
if ($pandora_management == 1) echo "checked";echo "></td></tr>
|
||||
";
|
||||
echo "</table>";
|
||||
echo "<table width='400'>";
|
||||
echo "<tr><td align='right'>";
|
||||
|
||||
if (isset($_GET["new_profile"])){
|
||||
echo "
|
||||
<input name='crtbutton' type='submit' class='sub wand' value='".__('Create')."'>";
|
||||
echo '<table width="400" cellpadding="4" cellspacing="4" class="databox">
|
||||
<form method="POST" action="index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&update_data">
|
||||
<input type="hidden" name="id_perfil" value="'.$id_perfil.'" />
|
||||
<tr>
|
||||
<td class="datos">'.__('Profile name').'</td>
|
||||
<td class="datos"><input name="name" type="text" size="27" value="'.$name.'" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos2">'.__('View incidents').'</td>
|
||||
<td class="datos2"><input name="incident_view" type="checkbox" class="chk" value="1" '.(($incident_view == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos">'.__('Edit incidents').'</td>
|
||||
<td class="datos"><input name="incident_edit" type="checkbox" class="chk" value="1" '.(($incident_edit == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos2">'.__('Manage incidents').'</td>
|
||||
<td class="datos2"><input name="incident_management" type="checkbox" class="chk" value="1" '.(($incident_management == 1) ? 'checked' : '').'/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos">'.__('View agents').'</td>
|
||||
<td class="datos"><input name="agent_view" type="checkbox" class="chk" value="1" '.(($agent_view == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos2">'.__('Edit agents').'</td>
|
||||
<td class="datos2"><input name="agent_edit" type="checkbox" class="chk" value="1" '.(($agent_edit == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos">'.__('Edit alerts').'</td>
|
||||
<td class="datos"><input name="alert_edit" type="checkbox" class="chk" value="1" '.(($alert_edit == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos2">'.__('Manage users').'</td>
|
||||
<td class="datos2"><input name="user_management" class="chk" type="checkbox" value="1" '.(($user_management == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos">'.__('Manage Database').'</td>
|
||||
<td class="datos"><input name="db_management" class="chk" type="checkbox" value="1" '.(($db_management == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos2">'.__('Manage alerts').'</td>
|
||||
<td class="datos2"><input name="alert_management" class="chk" type="checkbox" value="1" '.(($alert_management == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datos">'.__('Pandora management').'</td>
|
||||
<td class="datos"><input name="pandora_management" class="chk" type="checkbox" value="1" '.(($pandora_management == 1) ? 'checked' : '').' /></td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>';
|
||||
echo '<table width="400"><tr><td align="right">';
|
||||
if (isset ($_GET["new_profile"])) {
|
||||
echo '<input name="crtbutton" type="submit" class="sub wand" value="'.__('Create').'" />';
|
||||
} elseif (isset ($_GET["edit_profile"])) {
|
||||
echo '<input name="uptbutton" type="submit" class="sub upd" value="'.__('Update').'" />';
|
||||
}
|
||||
if (isset($_GET["edit_profile"])){
|
||||
echo "
|
||||
<input name='uptbutton' type='submit' class='sub upd' value='" .__('Update')."'>";
|
||||
}
|
||||
echo "</td></tr></table>";
|
||||
|
||||
echo '</td></tr></table>';
|
||||
} else { // View list data
|
||||
echo '<table cellpadding="4" cellspacing="4" class="databox" width="750px">';
|
||||
|
||||
$result = get_db_all_rows_in_table ("tperfil");
|
||||
echo '<tr><th width="180px"><font size="1">'.__('Profiles').'</th><th width="40px">IR';
|
||||
print_help_tip (__('Read Incidents'));
|
||||
echo '</th><th width="40px">IW';
|
||||
print_help_tip (__('Create Incidents'));
|
||||
echo '</th><th width="40px">IM';
|
||||
print_help_tip (__('Manage Incidents'));
|
||||
echo '</th><th width="40px">AR';
|
||||
print_help_tip (__('Read Agent Information'));
|
||||
echo '</th><th width="40px">AW';
|
||||
print_help_tip (__('Manage Agents'));
|
||||
echo '</th><th width="40px">LW';
|
||||
print_help_tip (__('Edit Alerts'));
|
||||
echo '</th><th width="40px">UM';
|
||||
print_help_tip (__('Manage User Rights'));
|
||||
echo '</th><th width="40px">DM';
|
||||
print_help_tip (__('Database Management'));
|
||||
echo '</th><th width="40px">LM';
|
||||
print_help_tip (__('Alerts Management'));
|
||||
echo '</th><th width="40px">PM';
|
||||
print_help_tip (__('Pandora System Management'));
|
||||
echo '</th><th width="40px">'.__('Delete').'</th></tr>';
|
||||
|
||||
$color = 1;
|
||||
echo "<table cellpadding='4' cellspacing='4' class='databox' width='750px'>";
|
||||
|
||||
$sql = "SELECT * FROM tperfil";
|
||||
$result = mysql_query ($sql);
|
||||
echo "<tr>";
|
||||
echo "<th width='180px'><font size=1>".__('Profiles');
|
||||
echo "</th><th width='40px'>IR";
|
||||
print_help_tip (__('System incidents reading'));
|
||||
echo "</th><th width='40px'>IW";
|
||||
print_help_tip (__('System incidents writing'));
|
||||
echo "</th><th width='40px'>IM";
|
||||
print_help_tip (__('System incidents management'));
|
||||
echo "</th><th width='40px'>AR";
|
||||
print_help_tip (__('Agents reading'));
|
||||
echo "</th><th width='40px'>AW";
|
||||
print_help_tip (__('Agents management'));
|
||||
echo "</th><th width='40px'>LW";
|
||||
print_help_tip (__('Alerts edition'));
|
||||
echo "</th><th width='40px'>UM";
|
||||
print_help_tip (__('Users management'));
|
||||
echo "</th><th width='40px'>DM";
|
||||
print_help_tip (__('Database management'));
|
||||
echo "</th><th width='40px'>LM";
|
||||
print_help_tip (__('Alerts anagement'));
|
||||
echo "</th><th width='40px'>PM";
|
||||
print_help_tip (__('Pandora system management'));
|
||||
echo "</th><th width='40px'>".__('Delete')."</th></tr>";
|
||||
|
||||
while (profile = mysql_fetch_array ($result)) {
|
||||
$id_perfil = profile["id_perfil"];
|
||||
$nombre=profile["name"];
|
||||
$incident_view = profile["incident_view"];
|
||||
$incident_edit = profile["incident_edit"];
|
||||
$incident_management = profile["incident_management"];
|
||||
$agent_view = profile["agent_view"];
|
||||
$agent_edit =profile["agent_edit"];
|
||||
$alert_edit = profile["alert_edit"];
|
||||
$user_management = profile["user_management"];
|
||||
$db_management = profile["db_management"];
|
||||
$alert_management = profile["alert_management"];
|
||||
$pandora_management = profile["pandora_management"];
|
||||
foreach ($result as $profile) {
|
||||
$id_perfil = $profile["id_perfil"];
|
||||
$nombre = $profile["name"];
|
||||
$incident_view = $profile["incident_view"];
|
||||
$incident_edit = $profile["incident_edit"];
|
||||
$incident_management = $profile["incident_management"];
|
||||
$agent_view = $profile["agent_view"];
|
||||
$agent_edit = $profile["agent_edit"];
|
||||
$alert_edit = $profile["alert_edit"];
|
||||
$user_management = $profile["user_management"];
|
||||
$db_management = $profile["db_management"];
|
||||
$alert_management = $profile["alert_management"];
|
||||
$pandora_management = $profile["pandora_management"];
|
||||
|
||||
if ($color == 1) {
|
||||
$tdcolor = "datos";
|
||||
$color = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$tdcolor = "datos2";
|
||||
$color = 1;
|
||||
}
|
||||
echo "<td class='$tdcolor'><a href='index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&edit_profile=".$id_perfil."'><b>".$nombre."</b></a>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($incident_view == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($incident_edit == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($incident_management == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($agent_view == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($agent_edit == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($alert_edit == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($user_management == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($db_management == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "<td class='$tdcolor'>";
|
||||
if ($alert_management == 1) echo "<img src='images/ok.png' border=0>";
|
||||
|
||||
echo "</td><td class='$tdcolor'>";
|
||||
if ($pandora_management == 1) echo "<img src='images/ok.png' border=0>";
|
||||
echo "<td class='$tdcolor' align='center'><a href='index.php?sec=gagente&sec2=godmode/profiles/profile_list&delete_profile=".$id_perfil."' onClick='if (!confirm(\' ".__('Are you sure?')."\')) return false;'><img border='0' src='images/cross.png'></a></td></tr>";
|
||||
|
||||
echo '<tr>
|
||||
<td class="'.$tdcolor.'">
|
||||
<a href="index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&edit_profile='.$id_perfil.'"><b>'.$nombre.'</b></a>
|
||||
</td>
|
||||
<td class="'.$tdcolor.'">
|
||||
'.(($incident_view == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td>
|
||||
<td class="'.$tdcolor.'">
|
||||
'.(($incident_edit == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td>
|
||||
<td class="'.$tdcolor.'">
|
||||
'.(($incident_management == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($agent_view == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($agent_edit == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($alert_edit == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($user_management == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($db_management == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
<td class="'.$tdcolor.'">
|
||||
'.(($alert_management == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
</td><td class="'.$tdcolor.'">
|
||||
'.(($pandora_management == 1) ? '<img src="images/ok.png" border="0">' : '').'
|
||||
<td class="'.$tdcolor.'" align="center">
|
||||
<a href="index.php?sec=gagente&sec2=godmode/profiles/profile_list&delete_profile='.$id_perfil.'" onClick="if (!confirm(\' '.__('Are you sure?').'\')) return false;">
|
||||
<img border="0" src="images/cross.png"></a>
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
echo "</table>";
|
||||
echo '</tr></table>';
|
||||
echo '<table width="750">';
|
||||
echo '<tr><td align="right">';
|
||||
echo "<form method=post action='index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&new_profile=1'>";
|
||||
echo "<input type='submit' class='sub next' name='crt' value='".__('Create profile')."'>";
|
||||
echo "</form></table>";
|
||||
echo '</table></tr></table>
|
||||
<table width="750"><tr><td align="right">
|
||||
<form method="POST" action="index.php?sec=gperfiles&sec2=godmode/profiles/profile_list&new_profile=1">
|
||||
<input type="submit" class="sub next" name="crt" value="'.__('Create profile').'">
|
||||
</form>
|
||||
</td></tr></table>';
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -675,6 +675,8 @@ class Set_Locale {
|
|||
$backup_locale = "en_US";
|
||||
} elseif(in_array("es_ES",$this->locales)) {
|
||||
$backup_locale = "es_ES";
|
||||
} else {
|
||||
$backup_locale = "POSIX";
|
||||
}
|
||||
|
||||
if($backup_locale == "" || !in_array($backup_locale,$this->locales)) {
|
||||
|
@ -732,12 +734,73 @@ class Set_Locale {
|
|||
|
||||
function Get_Locales_SelectBox () {
|
||||
foreach ($this->locales as $iter_locale) {
|
||||
echo '<select name="'.$iter_locale.'">'.$this->Translate_Locale($iter_locale).'</select>';
|
||||
echo '<select name="'.htmlentities ($iter_locale).'">'.$this->Translate_Locale_HTML($iter_locale).'</select>';
|
||||
}
|
||||
}
|
||||
|
||||
//Input: Language code (en, es, nl) -> should be lower case to
|
||||
//distinguish from country code
|
||||
//Output: Language name
|
||||
function Get_Language_Name ($code) {
|
||||
if (array_key_exists (mb_strtolower($code),$this->lang_codes)) {
|
||||
return mb_convert_case($this->lang_codes[$code], MB_CASE_TITLE, "UTF-8");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Input: Country code (BE, NL, US) -> should be upper case to
|
||||
//distinguish from language code
|
||||
//Output: Country name
|
||||
function Get_Country_Name ($code) {
|
||||
if (array_key_exists (mb_strtoupper($code),$this->country_codes)) {
|
||||
return mb_convert_case($this->country_codes[$code], MB_CASE_TITLE, "UTF-8");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Input: Money code (USD, EUR) -> should be upper case because of
|
||||
//international standards
|
||||
//Output: Money name
|
||||
function Get_Currency_Name ($code) {
|
||||
if (array_key_exists (mb_strtoupper($code),$this->currency_codes)) {
|
||||
return $this->currency_codes[$code];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function Put_Translated_Language ($array) {
|
||||
if(!is_array ($array)) {
|
||||
return false;
|
||||
}
|
||||
$this->lang_codes = $array;
|
||||
return true;
|
||||
}
|
||||
|
||||
function Put_Translated_Country ($array) {
|
||||
if(!is_array ($array)) {
|
||||
return false;
|
||||
}
|
||||
$this->country_codes = $array;
|
||||
}
|
||||
|
||||
function Put_Translated_Currency ($array) {
|
||||
if(!is_array ($array)) {
|
||||
return false;
|
||||
}
|
||||
$this->currency_codes = $array;
|
||||
}
|
||||
|
||||
function Translate_Locale_HTML ($locale) {
|
||||
if(is_array($locale)) {
|
||||
$locale = array_walk($locale,'Translate_Locale_HTML');
|
||||
} else {
|
||||
$locale = $this->Translate_Locale ($locale);
|
||||
return htmlentities ($locale);
|
||||
}
|
||||
}
|
||||
|
||||
function Translate_Locale ($locale) {
|
||||
if($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") {
|
||||
if ($locale == "UTF-8" || $locale == "C" || $locale == "POSIX") {
|
||||
return $locale; //Pure UTF-8, C or POSIX is not localized to a country
|
||||
}
|
||||
|
||||
|
@ -748,20 +811,15 @@ class Set_Locale {
|
|||
$char = isset($country_char[1]) ? $country_char[1] : "";
|
||||
unset ($lang_country, $country_char);
|
||||
|
||||
if (in_array($lang,array_keys($this->lang_codes))) {
|
||||
$lang = $this->lang_codes[$lang];
|
||||
} else {
|
||||
// __("Unknown");
|
||||
$lang = "Unknown";
|
||||
}
|
||||
$lang = $this->Get_Language_Name ($lang);
|
||||
$cntr = $this->Get_Country_Name ($cntr);
|
||||
|
||||
if (in_array($cntr,array_keys($this->country_codes))) {
|
||||
$cntr = ucwords(strtolower($this->country_codes[$cntr]));
|
||||
} else {
|
||||
// __("Unknown");
|
||||
if($lang === false)
|
||||
$lang = "Unknown";
|
||||
|
||||
if($cntr === false)
|
||||
$cntr = "Unknown";
|
||||
}
|
||||
|
||||
|
||||
if($char != "") {
|
||||
$char = " - ".$char;
|
||||
}
|
||||
|
@ -770,12 +828,10 @@ class Set_Locale {
|
|||
}
|
||||
|
||||
function Translate_Currency ($currency) {
|
||||
$currency = trim($currency);
|
||||
|
||||
if(in_array($currency,array_keys($this->currency_codes))) {
|
||||
return $this->currency_codes[$currency];
|
||||
}
|
||||
return "Unknown";
|
||||
$currency = $this->Get_Currency_Name (trim($currency));
|
||||
if($currency === false)
|
||||
return "Unknown";
|
||||
return $currency;
|
||||
}
|
||||
|
||||
//This private function comes back with the precision of a specific
|
||||
|
@ -866,7 +922,7 @@ class Set_Locale {
|
|||
} elseif($out == "SHORT") {
|
||||
$currency = $this->MONFORMAT['currency_symbol'];
|
||||
} elseif($out == "LONG") {
|
||||
$currency = $this->Translate_Currency($currency);
|
||||
$currency = $this->Translate_Currency($this->MONFORMAT['int_curr_symbol']);
|
||||
} else {
|
||||
$currency = $this->MONFORMAT['int_curr_symbol'];
|
||||
}
|
||||
|
@ -962,5 +1018,6 @@ class Set_Locale {
|
|||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue