summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/profiles.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-03-11 11:21:34 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-03-11 11:21:34 +0000
commit419b228afeba243106a8757543cde23bbdd03189 (patch)
tree331a7c47e32f2ca254ca261e6bf650b596c54383 /frontends/php/include/profiles.inc.php
parent9b1c6e98efe2a2a793b959df384db1a337a212ff (diff)
downloadzabbix-419b228afeba243106a8757543cde23bbdd03189.tar.gz
zabbix-419b228afeba243106a8757543cde23bbdd03189.tar.xz
zabbix-419b228afeba243106a8757543cde23bbdd03189.zip
- Zabbix1.5.b commit (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5468 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/profiles.inc.php')
-rw-r--r--frontends/php/include/profiles.inc.php39
1 files changed, 21 insertions, 18 deletions
diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php
index 889b09dc..dfd913a1 100644
--- a/frontends/php/include/profiles.inc.php
+++ b/frontends/php/include/profiles.inc.php
@@ -25,31 +25,34 @@
function get_profile($idx,$default_value=null,$type=PROFILE_TYPE_UNKNOWN){
global $USER_DETAILS;
- $result = array();
-// $result = $default_value;
+ $result = $default_value;
if($USER_DETAILS["alias"]!=ZBX_GUEST_USER){
$db_profiles = DBselect('SELECT * FROM profiles WHERE userid='.$USER_DETAILS["userid"].' AND idx='.zbx_dbstr($idx));
- while($profile=DBfetch($db_profiles)){
- if($type==PROFILE_TYPE_UNKNOWN) $type = $profile["valuetype"];
-
- switch($type){
- case PROFILE_TYPE_INT:
- $result[] = intval($profile["value"]);
- break;
- case PROFILE_TYPE_STR:
- default:
- $result[] = strval($profile["value"]);
+ if($profile=DBfetch($db_profiles)){
+
+ if(PROFILE_TYPE_UNKNOWN == $type) $type = $profile["valuetype"];
+
+ if(PROFILE_TYPE_ARRAY == $type){
+ $result[] = $profile['value'];
+ while($profile=DBfetch($db_profiles)){
+ $result[] = $profile['value'];
+ }
+ }
+ else{
+ switch($type){
+ case PROFILE_TYPE_INT:
+ $result = intval($profile["value"]);
+ break;
+ case PROFILE_TYPE_STR:
+ default:
+ $result = strval($profile["value"]);
+ }
}
}
}
- $result = array_filter($result, "not_empty");
-
- if(isset($result[0]) && (PROFILE_TYPE_ARRAY != $type)) $result = $result[0];
- if(empty($result)) $result = $default_value;
-
return $result;
}
@@ -145,6 +148,7 @@ function add_user_history($page){
$curr = 0;
$profile = array();
for($i = 0; $i < ZBX_HISTORY_COUNT; $i++){
+ $history = get_profile('web.history.'.$i,false);
if($history = get_profile('web.history.'.$i,false)){
if($history[0] != $title){
$profile[$curr] = $history;
@@ -154,7 +158,6 @@ function add_user_history($page){
}
$history = array($title,$url);
-
if($curr < ZBX_HISTORY_COUNT){
for($i = 0; $i < $curr; $i++){
update_profile('web.history.'.$i,$profile[$i],PROFILE_TYPE_ARRAY);