瀏覽代碼

Merge branch 'master' of https://github.com/fusionpbx/fusionpbx

markjcrane 9 年之前
父節點
當前提交
0d393d8274
共有 3 個文件被更改,包括 18 次插入15 次删除
  1. 11 11
      core/user_settings/user_dashboard.php
  2. 3 2
      core/users/user_setting_edit.php
  3. 4 2
      core/users/user_settings.php

+ 11 - 11
core/user_settings/user_dashboard.php

@@ -925,10 +925,10 @@
 				$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
 				$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
 				$tmp = explode(' ', $tmp);
 				$tmp = explode(' ', $tmp);
 				foreach ($tmp as $stat) {
 				foreach ($tmp as $stat) {
-					if (substr_count($stat, '%') > 0) { $percent = rtrim($stat,'%'); break; }
+					if (substr_count($stat, '%') > 0) { $percent_disk_usage = rtrim($stat,'%'); break; }
 				}
 				}
-				if ($percent != '') {
-					$hud[$n]['html'] .= "<span class='hud_stat' style='cursor: default;'>".$percent."<br><span class='hud_stat_title' style='cursor: default;'>".$text['label-disk_usage']." (%)</span></span>\n";
+				if ($percent_disk_usage != '') {
+					$hud[$n]['html'] .= "<span class='hud_stat' style='cursor: default;'>".$percent_disk_usage."<br><span class='hud_stat_title' style='cursor: default;'>".$text['label-disk_usage']." (%)</span></span>\n";
 				}
 				}
 			}
 			}
 
 
@@ -1004,11 +1004,11 @@
 
 
 			//memory usage (for available memory, use "free | awk 'FNR == 3 {print $4/($3+$4)*100}'" instead)
 			//memory usage (for available memory, use "free | awk 'FNR == 3 {print $4/($3+$4)*100}'" instead)
 				if (stristr(PHP_OS, 'Linux')) {
 				if (stristr(PHP_OS, 'Linux')) {
-					$percent = round(shell_exec("free | awk 'FNR == 3 {print $3/($3+$4)*100}'"), 1).'%';
-					if ($percent != '') {
+					$percent_memory = round(shell_exec("free | awk 'FNR == 3 {print $3/($3+$4)*100}'"), 1);
+					if ($percent_memory != '') {
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_usage']."</td>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-memory_usage']."</td>\n";
-						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$percent."</td>\n";
+						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$percent_memory."%</td>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$c = ($c) ? 0 : 1;
 						$c = ($c) ? 0 : 1;
 					}
 					}
@@ -1017,10 +1017,10 @@
 			//disk usage
 			//disk usage
 				if (stristr(PHP_OS, 'Linux')) {
 				if (stristr(PHP_OS, 'Linux')) {
 					//calculated above
 					//calculated above
-					if ($percent != '') {
+					if ($percent_disk_usage != '') {
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-disk_usage']."</td>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-disk_usage']."</td>\n";
-						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$percent."%</td>\n";
+						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$percent_disk_usage."%</td>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$c = ($c) ? 0 : 1;
 						$c = ($c) ? 0 : 1;
 					}
 					}
@@ -1032,11 +1032,11 @@
 					$tmp = explode("\n", $tmp);
 					$tmp = explode("\n", $tmp);
 					$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
 					$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
 					$tmp = explode(' ', trim($tmp));
 					$tmp = explode(' ', trim($tmp));
-					$cpu = $tmp[0];
-					if ($cpu != '') {
+					$percent_cpu = $tmp[0];
+					if ($percent_cpu != '') {
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<tr>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-processor_usage']."</td>\n";
 						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text'>".$text['label-processor_usage']."</td>\n";
-						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$cpu."%</td>\n";
+						$hud[$n]['html'] .= "<td valign='top' class='".$row_style[$c]." hud_text' style='text-align: right; white-space: nowrap;'>".$percent_cpu."%</td>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$hud[$n]['html'] .= "</tr>\n";
 						$c = ($c) ? 0 : 1;
 						$c = ($c) ? 0 : 1;
 					}
 					}

+ 3 - 2
core/users/user_setting_edit.php

@@ -73,6 +73,7 @@ else {
 
 
 //get http post variables and set them to php variables
 //get http post variables and set them to php variables
 	if (count($_REQUEST) > 0) {
 	if (count($_REQUEST) > 0) {
+		echo "<pre>".print_r($_REQUEST, true)."</pre>";
 		$user_setting_category = strtolower(check_str($_REQUEST["user_setting_category"]));
 		$user_setting_category = strtolower(check_str($_REQUEST["user_setting_category"]));
 		$user_setting_subcategory = strtolower(check_str($_POST["user_setting_subcategory"]));
 		$user_setting_subcategory = strtolower(check_str($_POST["user_setting_subcategory"]));
 		$user_setting_name = strtolower(check_str($_POST["user_setting_name"]));
 		$user_setting_name = strtolower(check_str($_POST["user_setting_name"]));
@@ -470,10 +471,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 					$dir_label = str_replace('_', ' ', $dir_name);
 					$dir_label = str_replace('_', ' ', $dir_name);
 					$dir_label = str_replace('-', ' ', $dir_label);
 					$dir_label = str_replace('-', ' ', $dir_label);
 					if ($dir_name == $row['user_setting_value']) {
 					if ($dir_name == $row['user_setting_value']) {
-						echo "		<option value='$dir_name' selected='selected'>$dir_label</option>\n";
+						echo "		<option value='$dir_name' selected='selected'>".ucwords($dir_label)."</option>\n";
 					}
 					}
 					else {
 					else {
-						echo "		<option value='$dir_name'>$dir_label</option>\n";
+						echo "		<option value='$dir_name'>".ucwords($dir_label)."</option>\n";
 					}
 					}
 				}
 				}
 			}
 			}

+ 4 - 2
core/users/user_settings.php

@@ -93,8 +93,10 @@ else {
 //get the list
 //get the list
 	$sql = "select * from v_user_settings ";
 	$sql = "select * from v_user_settings ";
 	$sql .= "where user_uuid = '$user_uuid' ";
 	$sql .= "where user_uuid = '$user_uuid' ";
-	$sql .= "and (user_setting_category <> 'domain' and user_setting_subcategory <> 'language') ";
-	$sql .= "and (user_setting_category <> 'domain' and user_setting_subcategory <> 'time_zone') ";
+	$sql .= "and not ( ";
+	$sql .= "(user_setting_category = 'domain' and user_setting_subcategory = 'language') ";
+	$sql .= "or (user_setting_category = 'domain' and user_setting_subcategory = 'time_zone') ";
+	$sql .= ") ";
 	if (strlen($order_by) == 0) {
 	if (strlen($order_by) == 0) {
 		$sql .= "order by user_setting_category, user_setting_subcategory, user_setting_order asc ";
 		$sql .= "order by user_setting_category, user_setting_subcategory, user_setting_order asc ";
 	}
 	}