diff --git a/app/edit/clipadd.php b/app/edit/clipadd.php
index f291387992..94166ef8df 100644
--- a/app/edit/clipadd.php
+++ b/app/edit/clipadd.php
@@ -88,7 +88,7 @@ if (count($_POST)>0) {
echo "
";
+ echo "";
+
require_once "footer.php";
?>
\ No newline at end of file
diff --git a/app/edit/cliplist.php b/app/edit/cliplist.php
index f92f9b98a6..a6914ad6aa 100644
--- a/app/edit/cliplist.php
+++ b/app/edit/cliplist.php
@@ -115,13 +115,13 @@ echo "\n";
echo " }\n";
echo "";
-echo "";
+echo "";
// keyboard shortcut bindings
echo "\n";
@@ -159,80 +159,75 @@ echo " else {\n";
echo " return true;\n";
echo " }\n";
echo " });\n";
-echo "";
+echo "\n";
-echo "";
-echo "";
-echo "";
-echo "
\n";
-echo "\n";
-echo " \n";
-echo " ".$text['label-clip-library']."\n"; //display:none
+echo "\n";
+echo "\n";
-$sql = "select * from v_clips ";
-$sql .= "order by clip_folder ";
+echo " \n";
+echo " \n";
+
+$sql = "select * from v_clips order by clip_folder asc, clip_name asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
-if ($result_count > 0) { //no results
- $last_folder = '';
- $tag_open = '';
- $x = 0;
- $current_depth = 0;
- $previous_depth = 0;
- foreach($result as $row) {
- $current_depth = count(explode ("/", $row['clip_folder']));
- if ($current_depth < $previous_depth) {
- $count = ($previous_depth - $current_depth);
- $i=0;
- while($i < $count){
- echo " | \n";
- $i++;
+if ($result_count > 0) {
+ $master_array = array();
+ foreach ($result as $row) {
+ $clip_folder = rtrim($row['clip_folder'], '/');
+ $clip_folder .= '/'.$row['clip_name'];
+
+ $parts = explode('/', $clip_folder);
+ $folders = array();
+ while ($bottom = array_pop($parts)) {
+ if (sizeof($folders) > 0) {
+ $folders = array($bottom => $folders);
+ }
+ else {
+ $clip['uuid'] = $row['clip_uuid'];
+ $clip['name'] = $row['clip_name'];
+ $clip['before'] = $row['clip_text_start'];
+ $clip['after'] = $row['clip_text_end'];
+ $folders = array($bottom => $clip);
}
- echo " |
\n";
}
- if ($last_folder != $row['clip_folder']) {
- $clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
- $clip_folder_name = str_replace ("/", "", $clip_folder_name);
- echo "
".$clip_folder_name."\n\n";
- $tag_open = 1;
+ $master_array = array_merge_recursive($master_array, $folders);
+ }
+
+ function parse_array($arr) {
+ if (is_array($arr)) {
+ //folder/clip
+ foreach ($arr as $name => $sub_arr) {
+ if ($name != $sub_arr['name']) {
+ //folder
+ echo " ".$name."";
+ echo " \n";
+ parse_array($sub_arr);
+ echo " \n";
+ }
+ else {
+ //clip
+ echo " \n";
+ }
+ }
}
+ }
+ parse_array($master_array);
+}
- $previous_depth = $current_depth;
- $previous_folder_name = $row['clip_folder'];
+echo " \n";
- echo "\n";
- echo "\n";
- echo "\n";
- echo "\n";
- echo "\n\n";
-
- $last_folder = $row['clip_folder'];
-
- if ($c==0) { $c=1; } else { $c=0; }
- } //end foreach
- unset($sql, $result, $row_count);
-
-} //end if results
-
-echo "\n";
-echo " |
\n";
-
-echo "\n";
-echo "\n";
-echo "\n";
-echo "
";
+//echo "".print_r($master_array, true)."
";
require_once "footer.php";
-
-unset ($result_count);
-unset ($result);
-unset ($key);
-unset ($val);
-unset ($c);
?>
\ No newline at end of file
diff --git a/app/edit/clipoptions.php b/app/edit/clipoptions.php
index 5a03eacad2..505f4a60d6 100644
--- a/app/edit/clipoptions.php
+++ b/app/edit/clipoptions.php
@@ -53,8 +53,8 @@ echo "\n";
echo "";
echo "";
-echo " | \n";
echo " | \n";
+echo " | \n";
echo " | \n";
echo " | | \n";
echo " | \n";
diff --git a/app/edit/clipoptionslist.php b/app/edit/clipoptionslist.php
index 8073cd2dc7..cd1d625391 100644
--- a/app/edit/clipoptionslist.php
+++ b/app/edit/clipoptionslist.php
@@ -113,82 +113,71 @@ echo "\n";
echo "}\n";
echo "";
-echo "\n";
+echo "\n";
+echo "\n";
-echo "\n";
-echo " \n";
-echo " ".$text['label-clip-library']."\n";
+echo " \n";
-$sql = "select * from v_clips ";
-$sql .= "order by clip_folder ";
+$sql = "select * from v_clips order by clip_folder asc, clip_name asc";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
-if ($result_count > 0) { //no results
- $last_folder = '';
- $tag_open = '';
- $x = 0;
- $current_depth = 0;
- $previous_depth = 0;
- foreach($result as $row) {
- $current_depth = count(explode("/", $row[clip_folder]));
- if ($current_depth < $previous_depth) {
- $count = ($previous_depth - $current_depth);
- $i=0;
- while($i < $count){
- echo " | \n";
- $i++;
+if ($result_count > 0) {
+ $master_array = array();
+ foreach ($result as $row) {
+ $clip_folder = rtrim($row['clip_folder'], '/');
+ $clip_folder .= '/'.$row['clip_name'];
+
+ $parts = explode('/', $clip_folder);
+ $folders = array();
+ while ($bottom = array_pop($parts)) {
+ if (sizeof($folders) > 0) {
+ $folders = array($bottom => $folders);
+ }
+ else {
+ $clip['uuid'] = $row['clip_uuid'];
+ $clip['name'] = $row['clip_name'];
+ $clip['before'] = $row['clip_text_start'];
+ $clip['after'] = $row['clip_text_end'];
+ $folders = array($bottom => $clip);
}
- echo " | \n";
-
}
- if ($last_folder != $row['clip_folder']) {
- $clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
- $clip_folder_name = str_replace ("/", "", $clip_folder_name);
- echo "";
- echo " ";
- echo " ";
- echo " ".$clip_folder_name."";
- $tag_open = 1;
+ $master_array = array_merge_recursive($master_array, $folders);
+ }
+
+ function parse_array($arr) {
+ if (is_array($arr)) {
+ //folder/clip
+ foreach ($arr as $name => $sub_arr) {
+ if ($name != $sub_arr['name']) {
+ //folder
+ echo " ".$name."";
+ echo " \n";
+ parse_array($sub_arr);
+ echo " \n";
+ }
+ else {
+ //clip
+ echo " \n";
+ }
+ }
}
+ }
+ parse_array($master_array);
+}
- $previous_depth = $current_depth;
- $previous_folder_name = $row['clip_folder'];
-
- echo " \n";
- echo " \n";
- echo "\n";
- echo " \n";
-
- $last_folder = $row['clip_folder'];
- if ($c==0) { $c=1; } else { $c=0; }
- } //end foreach
- unset($sql, $result, $row_count);
-} //end if results
-
-echo " ";
-echo " | ";
-echo " ";
-echo " \n";
-
-echo "\n";
-echo "\n";
-echo " \n";
+echo "\n";
require_once "footer.php";
-unset ($result_count);
-unset ($result);
-unset ($key);
-unset ($val);
-unset ($c);
?>
\ No newline at end of file
diff --git a/app/edit/filelist.php b/app/edit/filelist.php
index ab77644bff..07488aa228 100644
--- a/app/edit/filelist.php
+++ b/app/edit/filelist.php
@@ -75,28 +75,20 @@ else {
if (is_dir($newpath)) {
$dirname = end($level);
- $htmldirlist .= "
- \n";
+ $htmldirlist .= "\n";
+ $htmldirlist .= " ".$dirname."";
+ $htmldirlist .= " ".recur_dir($newpath)." \n";
+ $htmldirlist .= " \n";
}
else {
$filename = end($level);
$filesize = round(filesize($newpath)/1024, 2);
$newpath = str_replace ('//', '/', $newpath);
$newpath = str_replace ("\\", "/", $newpath);
- $htmlfilelist .= "
- \n";
+ $htmlfilelist .= "\n";
}
}
@@ -213,68 +205,49 @@ echo " });\n";
echo "";
echo "\n";
-echo "\n";
+echo "\n";
-echo "";
-echo " \n";
-echo "\n";
-echo " \n";
-
-echo "\n";
-echo " ".$text['label-files']."\n";
+echo " \n";
+echo " \n";
//start the session
ini_set("session.cookie_httponly", True);
session_start();
-if ($_SESSION["app"]["edit"]["dir"] == "scripts") {
- echo recur_dir($_SESSION['switch']['scripts']['dir']);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "php") {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "grammar") {
- echo recur_dir($_SESSION['switch']['grammar']['dir']);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "provision") {
-
- switch (PHP_OS) {
- case "Linux":
- if (file_exists('/etc/fusionpbx/resources/templates/provision')) {
- echo recur_dir('/etc/fusionpbx/resources/templates/provision');
- }
- else {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+switch ($_SESSION["app"]["edit"]["dir"]) {
+ case 'scripts':
+ echo recur_dir($_SESSION['switch']['scripts']['dir']);
+ break;
+ case 'php':
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH);
+ break;
+ case 'grammer':
+ echo recur_dir($_SESSION['switch']['grammar']['dir']);
+ break;
+ case 'provision':
+ switch (PHP_OS) {
+ case "Linux":
+ echo (file_exists('/etc/fusionpbx/resources/templates/provision')) ? recur_dir('/etc/fusionpbx/resources/templates/provision') : recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+ break;
+ case "FreeBSD":
+ echo (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) ? recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/") : recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+ break;
+ case "NetBSD":
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+ break;
+ case "OpenBSD":
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+ break;
+ default:
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
}
break;
- case "FreeBSD":
- //if the FreeBSD port is installed use the following paths by default.
- if (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
- }
- else {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
- }
+ case 'xml':
+ echo recur_dir($_SESSION['switch']['conf']['dir']);
break;
- case "NetBSD":
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
- break;
- case "OpenBSD":
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
- break;
- default:
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
- }
-}
-if ($_SESSION["app"]["edit"]["dir"] == "xml") {
- echo recur_dir($_SESSION['switch']['conf']['dir']);
}
-echo " | \n";
+echo "\n";
-echo " | \n";
-echo " \n";
-echo " \n";
-echo " ";
require_once "footer.php";
diff --git a/app/edit/fileoptionslist.php b/app/edit/fileoptionslist.php
index 518d620d3e..52124d2bfd 100644
--- a/app/edit/fileoptionslist.php
+++ b/app/edit/fileoptionslist.php
@@ -53,12 +53,17 @@ else {
if ($file != "." AND $file != ".."){
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
- if (substr($newpath, -4) == ".svn" ||
- substr($newpath, -4) == ".git") {
- //ignore .svn and .git dir and subdir
- }
- elseif (substr($newpath, -3) == ".db") {
- //ignore .db files
+ if (
+ substr(strtolower($newpath), -4) == ".svn" ||
+ substr(strtolower($newpath), -4) == ".git" ||
+ substr(strtolower($newpath), -3) == ".db" ||
+ substr(strtolower($newpath), -4) == ".jpg" ||
+ substr(strtolower($newpath), -4) == ".gif" ||
+ substr(strtolower($newpath), -4) == ".png" ||
+ substr(strtolower($newpath), -4) == ".ico" ||
+ substr(strtolower($newpath), -4) == ".ttf"
+ ){
+ //ignore certain files (and folders)
}
else {
$dir_array[] = $newpath;
@@ -76,7 +81,7 @@ else {
$dirname = end($level);
$newpath = str_replace ('//', '/', $newpath);
$htmldirlist .= "
-
+
".$dirname."".recur_dir($newpath)."
@@ -91,7 +96,7 @@ else {
$newpath = str_replace ("\\", "/", $newpath);
$newpath = str_replace ($filename, '', $newpath);
$htmlfilelist .= "
-
+
".$filename."
@@ -184,40 +189,33 @@ echo "\n";
echo "}\n";
echo "\n";
-echo "\n";
-echo " \n";
-echo " \n";
-echo " ".$text['label-files']."\n";
+echo "\n";
+echo "\n";
+
+echo " \n";
ini_set("session.cookie_httponly", True);
session_start();
-if ($_SESSION["app"]["edit"]["dir"] == "scripts") {
- echo recur_dir($_SESSION['switch']['scripts']['dir']);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "php") {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "grammar") {
- echo recur_dir($_SESSION['switch']['grammar']['dir']);
-}
-if ($_SESSION["app"]["edit"]["dir"] == "provision") {
- echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
-}
-if ($_SESSION["app"]["edit"]["dir"] == "xml") {
- echo recur_dir($_SESSION['switch']['conf']['dir']);
+switch ($_SESSION["app"]["edit"]["dir"]) {
+ case 'scripts':
+ echo recur_dir($_SESSION['switch']['scripts']['dir']);
+ break;
+ case 'php':
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH);
+ break;
+ case 'grammer':
+ echo recur_dir($_SESSION['switch']['grammar']['dir']);
+ break;
+ case 'provision':
+ echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/");
+ break;
+ case 'xml':
+ echo recur_dir($_SESSION['switch']['conf']['dir']);
+ break;
}
-echo " | \n";
-
-echo " | \n";
-echo " \n";
-echo " \n";
+echo "\n";
require_once "footer.php";
-unset ($result_count);
-unset ($result);
-unset ($key);
-unset ($val);
-unset ($c);
?>
\ No newline at end of file
diff --git a/app/exec/exec.php b/app/exec/exec.php
index 95fff44ebf..bb64398031 100644
--- a/app/exec/exec.php
+++ b/app/exec/exec.php
@@ -282,7 +282,7 @@ else {
if (permission_exists('script_editor_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) {
echo " | ";
echo " | ";
- echo " \n";
+ echo " \n";
echo " | ";
echo " ";
}
diff --git a/core/user_settings/user_dashboard.php b/core/user_settings/user_dashboard.php
index 101fbdc7b6..e4a6b9a746 100644
--- a/core/user_settings/user_dashboard.php
+++ b/core/user_settings/user_dashboard.php
@@ -925,10 +925,10 @@
$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
$tmp = explode(' ', $tmp);
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'] .= "".$percent." ".$text['label-disk_usage']." (%)\n";
+ if ($percent_disk_usage != '') {
+ $hud[$n]['html'] .= "".$percent_disk_usage." ".$text['label-disk_usage']." (%)\n";
}
}
@@ -1004,11 +1004,11 @@
//memory usage (for available memory, use "free | awk 'FNR == 3 {print $4/($3+$4)*100}'" instead)
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'] .= "\n";
$hud[$n]['html'] .= "| ".$text['label-memory_usage']." | \n";
- $hud[$n]['html'] .= "".$percent." | \n";
+ $hud[$n]['html'] .= "".$percent_memory."% | \n";
$hud[$n]['html'] .= " \n";
$c = ($c) ? 0 : 1;
}
@@ -1017,10 +1017,10 @@
//disk usage
if (stristr(PHP_OS, 'Linux')) {
//calculated above
- if ($percent != '') {
+ if ($percent_disk_usage != '') {
$hud[$n]['html'] .= "\n";
$hud[$n]['html'] .= "| ".$text['label-disk_usage']." | \n";
- $hud[$n]['html'] .= "".$percent."% | \n";
+ $hud[$n]['html'] .= "".$percent_disk_usage."% | \n";
$hud[$n]['html'] .= " \n";
$c = ($c) ? 0 : 1;
}
@@ -1032,11 +1032,11 @@
$tmp = explode("\n", $tmp);
$tmp = preg_replace('!\s+!', ' ', $tmp[1]); // multiple > single space
$tmp = explode(' ', trim($tmp));
- $cpu = $tmp[0];
- if ($cpu != '') {
+ $percent_cpu = $tmp[0];
+ if ($percent_cpu != '') {
$hud[$n]['html'] .= "\n";
$hud[$n]['html'] .= "| ".$text['label-processor_usage']." | \n";
- $hud[$n]['html'] .= "".$cpu."% | \n";
+ $hud[$n]['html'] .= "".$percent_cpu."% | \n";
$hud[$n]['html'] .= " \n";
$c = ($c) ? 0 : 1;
}
diff --git a/core/users/user_setting_edit.php b/core/users/user_setting_edit.php
index a2b0ca273c..8a13a8edc9 100644
--- a/core/users/user_setting_edit.php
+++ b/core/users/user_setting_edit.php
@@ -73,6 +73,7 @@ else {
//get http post variables and set them to php variables
if (count($_REQUEST) > 0) {
+ echo "".print_r($_REQUEST, true)." ";
$user_setting_category = strtolower(check_str($_REQUEST["user_setting_category"]));
$user_setting_subcategory = strtolower(check_str($_POST["user_setting_subcategory"]));
$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_label);
if ($dir_name == $row['user_setting_value']) {
- echo " \n";
+ echo " \n";
}
else {
- echo " \n";
+ echo " \n";
}
}
}
diff --git a/core/users/user_settings.php b/core/users/user_settings.php
index 6ca0c64981..824adfcd9f 100644
--- a/core/users/user_settings.php
+++ b/core/users/user_settings.php
@@ -93,8 +93,10 @@ else {
//get the list
$sql = "select * from v_user_settings ";
$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) {
$sql .= "order by user_setting_category, user_setting_subcategory, user_setting_order asc ";
}
| |