2009-03-12 Esteban Sanchez <estebans@artica.es>

* include/auth/mysql.php: Added a cache to is_user_admin().

	* include/config_process.php: Changed build version. Load l10n tables
	before extensions.
	
	* include/functions_config.php: Fixed an error on update_config() that
	fails to update when the value has changed. Fixed style updating
	also.

	* include/functions_db.php: Added GROUP BY token to
	format_array_to_where_clause_sql().

	* include/functions_ui.php: Added a flag to debug() to allow disabling
	the backtrace output.

	* operation/agentes/tactical.php: Fixed tab. Makes percentage images a
	bit taller.

	* ChangeLog.2008: Added to repository. Stripped ChangeLog history.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1525 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2009-03-12 09:20:49 +00:00
parent acb8104832
commit 23c23988d4
8 changed files with 7183 additions and 7145 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,13 @@ function process_user_login ($login, $pass) {
* @return bool True is the user is admin
*/
function is_user_admin ($id_user) {
return (bool) get_db_value ('is_admin', 'tusuario', 'id_user', $id_user);
static $is_admin = -1;
if ($is_admin !== -1)
return $is_admin;
$is_admin = (bool) get_db_value ('is_admin', 'tusuario', 'id_user', $id_user);
return $is_admin;
}

View File

@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//Pandora Version
$build_version = 'PC090305';
$build_version = 'PC090312';
$pandora_version = 'v3.0-dev';
$config['start_time'] = microtime (true);
@ -64,6 +64,15 @@ require_once ('functions_config.php');
process_config ();
require_once ('streams.php');
require_once ('gettext.php');
$l10n = NULL;
if (file_exists ('./include/languages/'.$config["language"].'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$config["language"].'.mo'));
$l10n->load_tables();
}
if (! defined ('EXTENSIONS_DIR'))
define ('EXTENSIONS_DIR', 'extensions');
@ -74,13 +83,4 @@ require_once ('functions_extensions.php');
$config['extensions'] = get_extensions ();
require_once ('streams.php');
require_once ('gettext.php');
$l10n = NULL;
if (file_exists ('./include/languages/'.$config["language"].'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('./include/languages/'.$config["language"].'.mo'));
$l10n->load_tables();
}
?>

View File

@ -48,7 +48,7 @@ function update_config_value ($token, $value) {
return (bool) create_config_value ($token, $value);
/* If it has not changed */
if ($config[$token] != $value)
if ($config[$token] == $value)
return true;
$config[$token] = $value;
@ -78,7 +78,7 @@ function update_config () {
return;
$style = (string) get_parameter ('style', $config["style"]);
$config["style"] = substr ($style, 0, strlen ($style) - 4);
$style = substr ($style, 0, strlen ($style) - 4);
/* Workaround for ugly language and language_code missmatch */
$config['language_code'] = (string) get_parameter ('language', $config["language"]);

View File

@ -1986,6 +1986,11 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
unset ($values['order']);
}
if (isset ($values['group'])) {
$group = sprintf (' GROUP BY %s', $values['order']);
unset ($values['group']);
}
$i = 1;
$max = count ($values);
foreach ($values as $field => $value) {
@ -2022,7 +2027,7 @@ function format_array_to_where_clause_sql ($values, $join = 'AND', $prefix = fal
$i++;
}
return (! empty ($query) ? $prefix: '').$query.$order.$limit.$offset;
return (! empty ($query) ? $prefix: '').$query.$group.$order.$limit.$offset;
}
/**

View File

@ -837,8 +837,9 @@ function print_help_tip ($text, $return = false) {
* This functions need to have active $config['debug'] variable to work.
*
* @param mixed Variable name to debug
* @param bool Wheter to print the backtrace or not.
*/
function debug ($var) {
function debug ($var, $backtrace = true) {
global $config;
if (! isset ($config['debug']))
return;
@ -848,47 +849,49 @@ function debug ($var) {
$id++;
echo '<div class="debug">';
echo '<a href="#" onclick="$(\'#trace-'.$id.'\').toggle ();return false;">Backtrace</a>';
echo '<div id="trace-'.$id.'" class="backtrace invisible">';
echo '<ol>';
$traces = debug_backtrace ();
/* Ignore debug function */
unset ($traces[0]);
foreach ($traces as $trace) {
$trace_id++;
/* Many classes are used to allow better customization. Please, do not
remove them */
echo '<li>';
if (isset ($trace['class']))
echo '<span class="class">'.$trace['class'].'</span>';
if (isset ($trace['type']))
echo '<span class="type">'.$trace['type'].'</span>';
echo '<span class="function">';
echo '<a href="#" onclick="$(\'#args-'.$trace_id.'\').toggle ();return false;">'.$trace['function'].'()</a>';
echo '</span>';
if (isset ($trace['file'])) {
echo ' - <span class="filename">';
echo str_replace ($config['homedir'].'/', '', $trace['file']);
echo ':'.$trace['line'].'</span>';
} else {
echo ' - <span class="filename"><em>Unknown file</em></span>';
}
echo '<pre id="args-'.$trace_id.'" class="invisible">';
echo '<div class="parameters">Parameter values:</div>';
if ($backtrace) {
echo '<div class="debug">';
echo '<a href="#" onclick="$(\'#trace-'.$id.'\').toggle ();return false;">Backtrace</a>';
echo '<div id="trace-'.$id.'" class="backtrace invisible">';
echo '<ol>';
foreach ($trace['args'] as $arg) {
$traces = debug_backtrace ();
/* Ignore debug function */
unset ($traces[0]);
foreach ($traces as $trace) {
$trace_id++;
/* Many classes are used to allow better customization. Please, do not
remove them */
echo '<li>';
print_r ($arg);
if (isset ($trace['class']))
echo '<span class="class">'.$trace['class'].'</span>';
if (isset ($trace['type']))
echo '<span class="type">'.$trace['type'].'</span>';
echo '<span class="function">';
echo '<a href="#" onclick="$(\'#args-'.$trace_id.'\').toggle ();return false;">'.$trace['function'].'()</a>';
echo '</span>';
if (isset ($trace['file'])) {
echo ' - <span class="filename">';
echo str_replace ($config['homedir'].'/', '', $trace['file']);
echo ':'.$trace['line'].'</span>';
} else {
echo ' - <span class="filename"><em>Unknown file</em></span>';
}
echo '<pre id="args-'.$trace_id.'" class="invisible">';
echo '<div class="parameters">Parameter values:</div>';
echo '<ol>';
foreach ($trace['args'] as $arg) {
echo '<li>';
print_r ($arg);
echo '</li>';
}
echo '</ol>';
echo '</pre>';
echo '</li>';
}
echo '</ol>';
echo '</pre>';
echo '</li>';
echo '</div></div>';
}
echo '</ol>';
echo '</div></div>';
/* Actually print the variable given */
echo '<pre class="debug">';

View File

@ -173,25 +173,26 @@ if ($serverinfo) {
</tr></thead><tbody>';
foreach ($serverinfo as $server_id => $server_info) {
$data = array ();
$data[0] = $server_info["name"];
$data = array ();
$data[0] = $server_info["name"];
if ($server_info["status"] == 0){
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
$data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20));
}
if ($server_info["status"] == 0){
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
$data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20));
}
if ($server_info["modules"] > 0 && $total_modules > 0) {
$percent = $server_info["modules"] / ($total_modules / 100);
} else {
$percent = 0;
}
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$percent."&height=18&width=80", true, array ("title" => $server_info["modules"]." ".__('of')." ".$total_modules));
if ($server_info["modules"] > 0 && $total_modules > 0) {
$percent = $server_info["modules"] / ($total_modules / 100);
} else {
$percent = 0;
}
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$percent."&height=20&width=80",
true, array ("title" => $server_info["modules"]." ".__('of')." ".$total_modules));
$data[3] = $server_info["lag"]." / ".$server_info["module_lag"];
$data[3] = $server_info["lag"]." / ".$server_info["module_lag"];
array_push ($cells, $data);
array_push ($cells, $data);
}
foreach ($cells as $key => $row) {