Editor: Fix Clip Library folder nesting, misc adjustments to Clip and File lists.
This commit is contained in:
parent
0184a34ffe
commit
66bcb6e836
|
|
@ -88,7 +88,7 @@ if (count($_POST)>0) {
|
|||
echo "<table width='100%' border='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td>Name</td>";
|
||||
echo " <td><input type='text' class='txt' name='clip_name'></td>";
|
||||
echo " <td><input type='text' class='txt' name='clip_name' id='clip_name'></td>";
|
||||
echo " </tr>";
|
||||
|
||||
echo " <tr>";
|
||||
|
|
@ -125,5 +125,7 @@ if (count($_POST)>0) {
|
|||
echo " </tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo "<script>document.getElementById('clip_name').focus();</script>";
|
||||
|
||||
require_once "footer.php";
|
||||
?>
|
||||
|
|
@ -115,13 +115,13 @@ echo "\n";
|
|||
echo " }\n";
|
||||
echo "</script>";
|
||||
|
||||
echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
|
||||
//echo "// ---------------------------------------------\n";
|
||||
//echo "// --- http://www.codeproject.com/jscript/dhtml_treeview.asp\n";
|
||||
//echo "// --- Name: Easy DHTML Treeview --\n";
|
||||
//echo "// --- Author: D.D. de Kerf --\n";
|
||||
//echo "// --- Version: 0.2 Date: 13-6-2001 --\n";
|
||||
//echo "// ---------------------------------------------\n";
|
||||
echo "<script language='JavaScript'>\n";
|
||||
echo "function Toggle(node) {\n";
|
||||
echo " // Unfold the branch if it isn't visible\n";
|
||||
echo " if (node.nextSibling.style.display == 'none') {\n";
|
||||
|
|
@ -133,7 +133,7 @@ echo " node.nextSibling.style.display = 'none';\n";
|
|||
echo " }\n";
|
||||
echo "\n";
|
||||
echo "}\n";
|
||||
echo "</SCRIPT>";
|
||||
echo "</script>";
|
||||
|
||||
// keyboard shortcut bindings
|
||||
echo "<script language='JavaScript' type='text/javascript' src='".PROJECT_PATH."/resources/jquery/jquery-1.11.1.js'></script>\n";
|
||||
|
|
@ -159,80 +159,75 @@ echo " else {\n";
|
|||
echo " return true;\n";
|
||||
echo " }\n";
|
||||
echo " });\n";
|
||||
echo "</script>";
|
||||
echo "</script>\n";
|
||||
|
||||
echo "<head>";
|
||||
echo "<body style='margin: 0; padding: 5px;' onfocus='null;'>";
|
||||
echo "<div align='center' valign='1'>";
|
||||
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\" valign='top' nowrap>\n";
|
||||
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><a href='javascript:void(0);' onclick=\"window.open('clipoptions.php?id=".$row[id]."','clipwin','left=20,top=20,width=310,height=350,toolbar=0,resizable=0');\" style='text-decoration:none; cursor: pointer;' title='Manage Clips'><IMG SRC=\"resources/images/icon_gear.png\" border='0' align='absmiddle' style='margin: 0px 2px 4px 0px;'>".$text['label-clip-library']."</a><DIV style=''>\n"; //display:none
|
||||
echo "<head>\n";
|
||||
echo "<body style='margin: 0; padding: 5px;' onfocus='blur();'>\n";
|
||||
|
||||
$sql = "select * from v_clips ";
|
||||
$sql .= "order by clip_folder ";
|
||||
echo "<div style='text-align: left; padding-top: 3px;'>\n";
|
||||
echo "<div style='padding-bottom: 3px;'><a href='javascript:void(0);' onclick=\"window.open('clipoptions.php?id=".$row[id]."','clipwin','left=20,top=20,width=310,height=350,toolbar=0,resizable=0');\" style='text-decoration:none; cursor: pointer;' title=\"".$text['label-clip-library']."\"><img src='".PROJECT_PATH."resources/images/icon_gear.png' border='0' align='absmiddle' style='margin: 0px 2px 4px -1px;'>".$text['label-clip-library']."</a></div>\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 "</DIV></TD></TR></TABLE>\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 "</DIV></TD></TR></TABLE>\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 "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD style='padding-left: 16px;'><A onClick=\"Toggle(this);\" style='cursor: pointer; text-decoration: none;'><IMG SRC=\"resources/images/icon_folder.png\" border='none' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$clip_folder_name."</A><DIV style='display:none'>\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 "<a onclick='Toggle(this);' style='display: block; cursor: pointer; text-decoration: none;'><img src='resources/images/icon_folder.png' border='none' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$name."</a>";
|
||||
echo "<div style='display: none; padding-left: 16px;'>\n";
|
||||
parse_array($sub_arr);
|
||||
echo "</div>\n";
|
||||
}
|
||||
else {
|
||||
//clip
|
||||
echo "<div style='white-space: nowrap;'>\n";
|
||||
echo "<a href='javascript:void(0);' onclick=\"parent.insert_clip(document.getElementById('before_".$sub_arr['uuid']."').value, document.getElementById('after_".$sub_arr['uuid']."').value);\">";
|
||||
echo "<img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>";
|
||||
echo $sub_arr['name'];
|
||||
echo "</a>\n";
|
||||
echo "<textarea style='display: none' id='before_".$sub_arr['uuid']."'>".$sub_arr['before']."</textarea>\n";
|
||||
echo "<textarea style='display: none' id='after_".$sub_arr['uuid']."'>".$sub_arr['after']."</textarea>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_array($master_array);
|
||||
}
|
||||
|
||||
$previous_depth = $current_depth;
|
||||
$previous_folder_name = $row['clip_folder'];
|
||||
echo "</div>\n";
|
||||
|
||||
echo "<textarea style='display:none' id='clip_lib_start".$row['clip_uuid']."'>".$row['clip_text_start']."</textarea>\n";
|
||||
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
|
||||
echo "\n";
|
||||
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD align='bottom' style='padding-left: 16px;'><IMG SRC=\"resources/images/icon_file.png\" border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>";
|
||||
echo "<a href='javascript:void(0);' onclick=\"parent.insert_clip(document.getElementById('clip_lib_start".$row['clip_uuid']."').value, document.getElementById('clip_lib_end".$row['clip_uuid']."').value);\">".$row['clip_name']."</a>\n";
|
||||
echo "</TD></TR></TABLE>\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 " </DIV></TD></TR></TABLE>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
//echo "<pre>".print_r($master_array, true)."</pre>";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
?>
|
||||
|
|
@ -53,8 +53,8 @@ echo "</td>\n";
|
|||
echo "<td valign='top' style='height: 100%; padding: 0;'>";
|
||||
|
||||
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
|
||||
echo " <tr><td><input type='button' class='btn' onclick=\"window.location='clipupdate.php?id='+document.getElementById('clip_uuid').value;\" value='".$text['button-edit-clip']."'></td></tr>\n";
|
||||
echo " <tr><td><input type='button' class='btn' onclick=\"window.location='clipadd.php'\" value='".$text['button-add-clip']."'></td></tr>\n";
|
||||
echo " <tr><td><input type='button' class='btn' onclick=\"window.location='clipupdate.php?id='+document.getElementById('clip_uuid').value;\" value='".$text['button-edit-clip']."'></td></tr>\n";
|
||||
echo " <tr><td><input type='button' class='btn' onclick=\"if (confirm('".$text['message-delete-clip']."')){ window.location='clipdelete.php?id='+document.getElementById('clip_uuid').value; }\" value='".$text['button-delete']."'></td></tr>\n";
|
||||
echo " <tr><td height='100%'> </td></tr>\n";
|
||||
echo " <tr><td><input type='button' class='btn' onclick='opener.location.reload(); self.close();' value='".$text['button-close']."'></td></tr>\n";
|
||||
|
|
|
|||
|
|
@ -113,82 +113,71 @@ echo "\n";
|
|||
echo "}\n";
|
||||
echo "</SCRIPT>";
|
||||
|
||||
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "</head>\n";
|
||||
echo "<body style='margin: 0; padding: 5px;' onfocus='blur();'>\n";
|
||||
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\" valign='top' nowrap>\n";
|
||||
echo " <table border=0 cellpadding='0' cellspacing='0'><tr><td style='cursor: default;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 0px 2px 4px 0px;'> ".$text['label-clip-library']."</a><div>\n";
|
||||
echo "<div style='text-align: left;'>\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 "</div></td></tr></table>\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 "</div></td></tr></table>\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 "<table border=0 cellpadding='0' cellspacing='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td nowrap style='padding-left: 16px;'>";
|
||||
echo " <a onclick='Toggle(this);'><img src='resources/images/icon_folder.png' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$clip_folder_name."</a><div style='display:none'>";
|
||||
$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 "<a onclick='Toggle(this);' style='display: block; cursor: pointer; text-decoration: none;'><img src='resources/images/icon_folder.png' border='none' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$name."</a>";
|
||||
echo "<div style='display: none; padding-left: 16px;'>\n";
|
||||
parse_array($sub_arr);
|
||||
echo "</div>\n";
|
||||
}
|
||||
else {
|
||||
//clip
|
||||
echo "<div style='white-space: nowrap;'>\n";
|
||||
echo "<a href='javascript:void(0);' onclick=\"parent.document.getElementById('clip_uuid').value='".$sub_arr['uuid']."'; parent.document.getElementById('clip_name').value='".$sub_arr['name']."';\">";
|
||||
echo "<img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>";
|
||||
echo $sub_arr['name'];
|
||||
echO "</a>\n";
|
||||
echo "<textarea style='display: none' id='before_".$sub_arr['uuid']."'>".$sub_arr['before']."</textarea>\n";
|
||||
echo "<textarea style='display: none' id='after_".$sub_arr['uuid']."'>".$sub_arr['after']."</textarea>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_array($master_array);
|
||||
}
|
||||
|
||||
$previous_depth = $current_depth;
|
||||
$previous_folder_name = $row['clip_folder'];
|
||||
|
||||
echo "<textarea style='display:none' id='clip_lib_start".$row['clip_uuid']."'>".$row['clip_text_start']."</textarea>\n";
|
||||
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
|
||||
echo "\n";
|
||||
echo "<table border=0 cellpadding='0' cellspacing='0'>";
|
||||
echo " <tr>";
|
||||
echo " <td nowrap align='bottom' style='padding-left: 16px;'>";
|
||||
echo " <a href='javascript:void(0);' onclick=\"parent.document.getElementById('clip_uuid').value='".$row['clip_uuid']."'; parent.document.getElementById('clip_name').value='".$row['clip_name']."';\"><img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>".$row['clip_name']."</a>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>\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 " </div>";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
echo "</table>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
?>
|
||||
|
|
@ -75,28 +75,20 @@ else {
|
|||
|
||||
if (is_dir($newpath)) {
|
||||
$dirname = end($level);
|
||||
$htmldirlist .= "
|
||||
<table border=0 cellpadding='0' cellspacing='0'>
|
||||
<tr>
|
||||
<td nowrap style='padding-left: 16px;'>
|
||||
<a onclick='Toggle(this);' style='cursor: pointer;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$dirname."</a><div style='display:none'>".recur_dir($newpath)."</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>\n";
|
||||
$htmldirlist .= "<div style='white-space: nowrap; padding-left: 16px;'>\n";
|
||||
$htmldirlist .= "<a onclick='Toggle(this);' style='display: block; cursor: pointer;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$dirname."</a>";
|
||||
$htmldirlist .= "<div style='display: none;'>".recur_dir($newpath)."</div>\n";
|
||||
$htmldirlist .= "</div>\n";
|
||||
}
|
||||
else {
|
||||
$filename = end($level);
|
||||
$filesize = round(filesize($newpath)/1024, 2);
|
||||
$newpath = str_replace ('//', '/', $newpath);
|
||||
$newpath = str_replace ("\\", "/", $newpath);
|
||||
$htmlfilelist .= "
|
||||
<table border=0 cellpadding='0' cellspacing='0'>
|
||||
<tr>
|
||||
<td nowrap align='bottom' style='padding-left: 16px;'>
|
||||
<a href='javascript:void(0);' onclick=\"parent.document.getElementById('filepath').value='".$newpath."'; parent.document.getElementById('current_file').value = '".$newpath."'; makeRequest('fileread.php','file=".urlencode($newpath)."');\" title='".$newpath." ".$filesize." KB'><img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>".$filename."</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>\n";
|
||||
$htmlfilelist .= "<div style='white-space: nowrap; padding-left: 16px;'>\n";
|
||||
$htmlfilelist .= "<a href='javascript:void(0);' onclick=\"parent.document.getElementById('filepath').value='".$newpath."'; parent.document.getElementById('current_file').value = '".$newpath."'; makeRequest('fileread.php','file=".urlencode($newpath)."');\" title='".$newpath." ".$filesize." KB'>";
|
||||
$htmlfilelist .= "<img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>".$filename."</a>\n";
|
||||
$htmlfilelist .= "</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -213,68 +205,49 @@ echo " });\n";
|
|||
echo "</script>";
|
||||
|
||||
echo "</head>\n";
|
||||
echo "<body style='margin: 0px; padding: 0px;'>\n";
|
||||
echo "<body style='margin: 0px; padding: 5px;'>\n";
|
||||
|
||||
echo "<div align='center' valign='1'>";
|
||||
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo "<tr class='border'>\n";
|
||||
echo " <td align=\"left\" valign='top' nowrap>\n";
|
||||
|
||||
echo "\n";
|
||||
echo " <table border=0 cellpadding='0' cellspacing='0'><tr><td><a href='javascript:void(0);' onclick=\"window.open('fileoptions.php?folder=".urlencode($_SERVER["DOCUMENT_ROOT"])."','filewin','left=20,top=20,width=310,height=350,toolbar=0,resizable=0');\" style='text-decoration:none;' title='Manage Files'><img src='resources/images/icon_gear.png' border='0' align='absmiddle' style='margin: 0px 2px 4px 0px;'>".$text['label-files']."</a><div>\n";
|
||||
echo "<div style='text-align: left; padding-top: 3px; padding-bottom: 3px;'><a href='javascript:void(0);' onclick=\"window.open('fileoptions.php?folder=".urlencode($_SERVER["DOCUMENT_ROOT"])."','filewin','left=20,top=20,width=310,height=350,toolbar=0,resizable=0');\" style='text-decoration:none;' title='".$text['label-files']."'><img src='resources/images/icon_gear.png' border='0' align='absmiddle' style='margin: 0px 2px 4px -1px;'>".$text['label-files']."</a></div>\n";
|
||||
echo "<div style='text-align: left; margin-left: -16px;'>\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 "</div></td></tr></table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>";
|
||||
|
||||
require_once "footer.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 .= "
|
||||
<table border=0 cellpadding='0' cellspacing='0'>
|
||||
<table border=0 cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td nowrap style='padding-left: 16px;'>
|
||||
<a onclick=\"Toggle(this, '".$newpath."');\" style='cursor: pointer;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 1px 2px 3px 0px;'>".$dirname."</a><div style='display:none'>".recur_dir($newpath)."</div>
|
||||
|
|
@ -91,7 +96,7 @@ else {
|
|||
$newpath = str_replace ("\\", "/", $newpath);
|
||||
$newpath = str_replace ($filename, '', $newpath);
|
||||
$htmlfilelist .= "
|
||||
<table border=0 cellpadding='0' cellspacing='0'>
|
||||
<table border=0 cellpadding='0' cellspacing='0' width='100%'>
|
||||
<tr>
|
||||
<td nowrap align='bottom' style='padding-left: 16px;'>
|
||||
<a href='javascript:void(0);' onclick=\"parent.document.getElementById('filename').value='".$filename."'; parent.document.getElementById('folder').value='".$newpath."';\" title='".$newpath." ".$filesize." KB'><img src='resources/images/icon_file.png' border='0' align='absmiddle' style='margin: 1px 2px 3px -1px;'>".$filename."</a>
|
||||
|
|
@ -184,40 +189,33 @@ echo "\n";
|
|||
echo "}\n";
|
||||
echo "</SCRIPT>\n";
|
||||
|
||||
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align=\"left\" valign='top' nowrap>\n";
|
||||
echo " <table border=0 cellpadding='0' cellspacing='0'><tr><td style='cursor: default;'><img src='resources/images/icon_folder.png' border='0' align='absmiddle' style='margin: 0px 2px 4px 0px;'>".$text['label-files']."<div>\n";
|
||||
echo "</head>\n";
|
||||
echo "<body style='margin: 0; padding: 5px;' onfocus='blur();'>\n";
|
||||
|
||||
echo "<div style='text-align: left; margin-left: -16px;'>\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 " </div></td></tr></table>\n";
|
||||
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
require_once "footer.php";
|
||||
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
?>
|
||||
|
|
@ -282,7 +282,7 @@ else {
|
|||
if (permission_exists('script_editor_view') && file_exists($_SERVER["PROJECT_ROOT"]."/app/edit/")) {
|
||||
echo " <tr>";
|
||||
echo " <td valign='top' height='100%'>";
|
||||
echo " <iframe id='clip_list' src='".PROJECT_PATH."/app/edit/cliplist.php' style='border: none; border-top: 1px solid #ccc; height: 100%; width: calc(100% - 15px);'></iframe>\n";
|
||||
echo " <iframe id='clip_list' src='".PROJECT_PATH."/app/edit/cliplist.php' style='border: none; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; height: calc(100% - 2px); width: calc(100% - 15px);'></iframe>\n";
|
||||
echo " </td>";
|
||||
echo " </tr>";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue