Edit: Revamp using Ace editor (ace.c9.io).

This commit is contained in:
reliberate
2016-02-24 12:28:35 -07:00
parent cda89cd03c
commit 5ddd647875
41 changed files with 611 additions and 936 deletions
+19 -4
View File
@@ -26,6 +26,16 @@
Philippe Rioual <bhouba@gmail.com> Philippe Rioual <bhouba@gmail.com>
*/ */
$text['title-manage-files']['en-us'] = "Manage Files";
$text['title-manage-files']['es-cl'] = "Gestión de Archivos";
$text['title-manage-files']['pt-pt'] = "Gerenciar Arquivos";
$text['title-manage-files']['fr-fr'] = "Gérer les Fichiers";
$text['title-manage-clips']['en-us'] = "Manage Clips";
$text['title-manage-clips']['es-cl'] = "Gestión de Clips";
$text['title-manage-clips']['pt-pt'] = "Gerir Clipes";
$text['title-manage-clips']['fr-fr'] = "Gérer Clips";
$text['label-folder']['en-us'] = "Folder:"; $text['label-folder']['en-us'] = "Folder:";
$text['label-folder']['es-cl'] = "Carpeta:"; $text['label-folder']['es-cl'] = "Carpeta:";
$text['label-folder']['pt-pt'] = "Ficheiro:"; $text['label-folder']['pt-pt'] = "Ficheiro:";
@@ -61,6 +71,11 @@ $text['label-clip-library']['es-cl'] = "Librería de Clips";
$text['label-clip-library']['pt-pt'] = "Biblioteca de Clips"; $text['label-clip-library']['pt-pt'] = "Biblioteca de Clips";
$text['label-clip-library']['fr-fr'] = "Clip Libraries"; $text['label-clip-library']['fr-fr'] = "Clip Libraries";
$text['label-selected-clip']['en-us'] = "Selected Clip";
$text['label-selected-clip']['es-cl'] = "Clip Seleccionado";
$text['label-selected-clip']['pt-pt'] = "Clipe Selecionado";
$text['label-selected-clip']['fr-fr'] = "Clip Sélectionné";
$text['button-edit-clip']['en-us'] = "Edit Clip"; $text['button-edit-clip']['en-us'] = "Edit Clip";
$text['button-edit-clip']['es-cl'] = "Editar Clip"; $text['button-edit-clip']['es-cl'] = "Editar Clip";
$text['button-edit-clip']['pt-pt'] = "Editar Clip"; $text['button-edit-clip']['pt-pt'] = "Editar Clip";
@@ -76,10 +91,10 @@ $text['message-delete-clip']['es-cl'] = "¿Realmente desea eliminar el clip sele
$text['message-delete-clip']['pt-pt'] = "Tem a certeza que pretende remover o clip seleccionado?"; $text['message-delete-clip']['pt-pt'] = "Tem a certeza que pretende remover o clip seleccionado?";
$text['message-delete-clip']['fr-fr'] = "Etes-vous sûr de vouloir supprimer le CLIP sélectionné?"; $text['message-delete-clip']['fr-fr'] = "Etes-vous sûr de vouloir supprimer le CLIP sélectionné?";
$text['button-close']['en-us'] = " Close "; $text['button-close']['en-us'] = "Close";
$text['button-close']['es-cl'] = " Cerrar "; $text['button-close']['es-cl'] = "Cerrar";
$text['button-close']['pt-pt'] = " Fechar "; $text['button-close']['pt-pt'] = "Fechar";
$text['button-close']['fr-fr'] = " Fermé "; $text['button-close']['fr-fr'] = "Fermé";
$text['label-path']['en-us'] = "Path:"; $text['label-path']['en-us'] = "Path:";
$text['label-path']['es-cl'] = "Ruta:"; $text['label-path']['es-cl'] = "Ruta:";
+4 -6
View File
@@ -80,13 +80,10 @@ if (count($_POST)>0) {
//show the content //show the content
require_once "header.php"; require_once "header.php";
echo "<div align='left'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n"; echo "<tr>\n";
echo " <td align=\"left\">\n"; echo " <td align=\"left\">\n";
//echo "Clip Library";
//echo "<hr size='1'>";
echo "<form method='post' action=''>"; echo "<form method='post' action=''>";
echo "<table width='100%' border='0'>"; echo "<table width='100%' border='0'>";
echo " <tr>"; echo " <tr>";
@@ -117,7 +114,9 @@ if (count($_POST)>0) {
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' value='".$text['button-add']."'></td>"; echo " <tr>";
echo " <td align='left'><input type='button' value='".$text['button-back']."' onclick='history.back()'></td>";
echo " <td align='right'><input type='submit' name='submit' value='".$text['button-add']."'></td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
echo "</form>"; echo "</form>";
@@ -125,7 +124,6 @@ if (count($_POST)>0) {
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
echo "</div>";
require_once "footer.php"; require_once "footer.php";
?> ?>
+1 -5
View File
@@ -52,10 +52,6 @@ else {
} }
//redirect the browser //redirect the browser
require_once "header.php"; header("Location: clipoptions.php");
echo "<meta http-equiv=\"refresh\" content=\"1;url=clipoptions.php\">\n";
echo $text['message-delete'];
require_once "footer.php";
return;
?> ?>
+34 -37
View File
@@ -35,24 +35,14 @@ else {
echo "access denied"; echo "access denied";
exit; exit;
} }
//require_once "edit/header.php";
require_once "header.php";
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
echo "<html>";
echo "<head>";
echo "<style>\n";
echo "TD {\n";
echo " font-size: 11.5px;\n";
echo "}\n";
echo "A {\n";
echo " text-decoration:none\n";
echo "}\n";
echo "</style>";
function isfile($filename) { function isfile($filename) {
if (@filesize($filename) > 0) { return true; } else { return false; } if (@filesize($filename) > 0) { return true; } else { return false; }
} }
@@ -135,37 +125,49 @@ echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
echo "function Toggle(node) {\n"; echo "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n"; echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n"; echo " if (node.nextSibling.style.display == 'none') {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/minus.gif\";\n";
echo " }\n";
echo " }\n";
echo " \n";
echo " node.nextSibling.style.display = 'block';\n"; echo " node.nextSibling.style.display = 'block';\n";
echo " }\n"; echo " }\n";
echo " // Collapse the branch if it IS visible\n"; echo " // Collapse the branch if it IS visible\n";
echo " else {\n"; echo " else {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/plus.gif\";\n";
echo " }\n";
echo " }\n";
echo " node.nextSibling.style.display = 'none';\n"; echo " node.nextSibling.style.display = 'none';\n";
echo " }\n"; echo " }\n";
echo "\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";
echo "<script>\n";
echo " $(window).keypress(function(event) {\n";
echo " //save file [Ctrl+S]\n";
echo " if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.$('form#frm_edit').submit();\n";
echo " return false;\n";
echo " }\n";
echo " //open file manager/clip library pane [Ctrl+Q]\n";
echo " else if ((event.which == 113 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.toggle_sidebar();\n";
echo " parent.focus_editor();\n";
echo " return false;\n";
echo " }\n";
echo " //block backspace\n";
echo " else if (event.which == 8) {\n";
echo " return false;\n";
echo " }\n";
echo " //otherwise, default action\n";
echo " else {\n";
echo " return true;\n";
echo " }\n";
echo " });\n";
echo "</script>";
echo "<head>"; echo "<head>";
echo "<body onfocus='null;'>"; echo "<body style='margin: 0; padding: 5px;' onfocus='null;'>";
echo "<div align='center' valign='1'>"; echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n"; echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n"; echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\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]."','null','left=20,top=20,width=310,height=300,toolbar=0,resizable=0');\" style='text-decoration:none;' title=''><IMG SRC=\"images/folder.gif\" border='0'> ".$text['label-clip-library']."</a><DIV style=''>\n"; //display:none 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
$sql = "select * from v_clips "; $sql = "select * from v_clips ";
$sql .= "order by clip_folder "; $sql .= "order by clip_folder ";
@@ -195,7 +197,7 @@ if ($result_count > 0) { //no results
if ($last_folder != $row['clip_folder']) { if ($last_folder != $row['clip_folder']) {
$clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']); $clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
$clip_folder_name = str_replace ("/", "", $clip_folder_name); $clip_folder_name = str_replace ("/", "", $clip_folder_name);
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=10></TD><TD><A href='javascript:void(0);' onClick=\"Toggle(this);\"><IMG SRC=\"images/plus.gif\" border='none'> <IMG SRC=\"images/folder.gif\" border='none'> &nbsp;".$clip_folder_name." &nbsp; </A><DIV style='display:none'>\n\n"; 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; $tag_open = 1;
} }
@@ -205,8 +207,8 @@ if ($result_count > 0) { //no results
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_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 "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
echo "\n"; echo "\n";
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=12></TD><TD align='bottom'><IMG SRC=\"images/file.png\" border='0'> \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.editAreaLoader.insertTags('edit1', document.getElementById('clip_lib_start".$row['clip_uuid']."').value, document.getElementById('clip_lib_end".$row['clip_uuid']."').value);\">".$row['clip_name']."</a>\n"; 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 "</TD></TR></TABLE>\n";
echo "\n\n"; echo "\n\n";
@@ -226,16 +228,11 @@ echo "</tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "</div>"; echo "</div>";
echo "<br><br>"; require_once "footer.php";
//require_once "resources/footer.php";
unset ($result_count); unset ($result_count);
unset ($result); unset ($result);
unset ($key); unset ($key);
unset ($val); unset ($val);
unset ($c); unset ($c);
echo "</body>";
echo "</html>";
?> ?>
+12 -21
View File
@@ -39,39 +39,30 @@ else {
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
$title = $text['title-manage-clips'];
require_once "header.php"; require_once "header.php";
echo "<div align='left'>"; echo "<table cellpadding='0' cellspacing='0' border='0' style='height: 100%; width: 100%;'>\n";
echo "<table border='0' style=\"height: 100%; width: 100%;\">\n";
echo "<form method='post' name='frm' action=''>"; echo "<form method='post' name='frm' action=''>";
echo "<tr><td colspan='2'><div id='selectedclip'>Selected Clip: <input type='text' name='clip_name' id='clip_name' value=''><input type='hidden' name='clip_uuid' id='clip_uuid' value=''></div></td></tr>\n"; echo "<tr><td colspan='2' style='padding-bottom: 3px;'><div id='selectedclip'>".$text['label-selected-clip']." <input type='text' name='clip_name' id='clip_name' value=''><input type='hidden' name='clip_uuid' id='clip_uuid' value=''></div></td></tr>\n";
echo "</form>"; echo "</form>";
echo "<tr>\n"; echo "<tr>\n";
echo "<td valign='top' width='200' nowrap>"; echo "<td valign='top' width='200' nowrap>";
echo " <IFRAME SRC='clipoptionslist.php' style='border: solid 1px #CCCCCC; height: 100%; width: 100%;' WIDTH='100%' TITLE=''>\n"; echo " <iframe src='clipoptionslist.php' style='border: solid 1px #ccc; height: calc(100% - 3px); width: calc(100% - 4px);'></iframe>";
echo " <!-- Clip List: Requires IFRAME support -->\n";
echo " </IFRAME>";
echo "</td>\n"; echo "</td>\n";
echo "<td valign='top' style=\"height: 100%;\">"; echo "<td valign='top' style='height: 100%; padding: 0;'>";
echo " <table width='' class='border'>"; echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
//echo " <tr><td colspan='1'><img src='images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></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><th>Options</th></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 colspan='1'><img src='images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></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%'>&nbsp;</td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' 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='opener.location.reload(); self.close();' value='".$text['button-close']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='clipadd.php'\" value='".$text['button-add-clip']."'></td></tr>\n"; echo "</table>";
//echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='clipadd.php'\" value=' Search '></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' 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><br><br><br><br><br><br><br><br><br><br><br></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick='javascript:self.close();' value='".$text['button-close']."'></td></tr>\n";
echo " </table>";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "</table>"; echo "</table>";
echo "</div>";
require_once "footer.php"; require_once "footer.php";
?> ?>
+136 -175
View File
@@ -39,195 +39,156 @@ else {
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
echo "<html>"; //include
echo "<head>"; require_once "header.php";
echo "<style>\n"; echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo "TD {\n"; echo " function makeRequest(url, strpost) {\n";
echo " font-size: 11.5px;\n"; echo " var http_request = false;\n";
echo "\n";
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n";
echo " http_request = new XMLHttpRequest();\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/xml');\n";
echo " // See note below about this line\n";
echo " }\n";
echo " } else if (window.ActiveXObject) { // IE\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");\n";
echo " } catch (e) {\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " } catch (e) {}\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " if (!http_request) {\n";
echo " alert('".$text['message-give-up']."');\n";
echo " return false;\n";
echo " }\n";
echo " http_request.onreadystatechange = function() { returnContent(http_request); };\n";
echo " http_request.overrideMimeType('text/html');\n";
echo " http_request.open('POST', url, true);\n";
echo "\n";
echo " if (strpost.length == 0) {\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
echo " http_request.send(strpost);\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " function returnContent(http_request) {\n";
echo "\n";
echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
echo " }\n";
echo " else {\n";
echo " alert('".$text['message-problem']."');\n";
echo " }\n";
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 "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n";
echo " // Collapse the branch if it IS visible\n";
echo " else {\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n";
echo "\n";
echo "}\n"; echo "}\n";
echo "A {\n"; echo "</SCRIPT>";
echo " text-decoration:none\n";
echo "}\n";
echo "</style>";
function isfile($filename) { echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
if (@filesize($filename) > 0) { return true; } else { return false; }
}
function space($count) { echo "<tr class='border'>\n";
$r=''; $i=0; echo " <td align=\"left\" valign='top' nowrap>\n";
while($i < $count) { 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";
$r .= ' ';
$i++;
}
return $r;
}
//show the content $sql = "select * from v_clips ";
echo "<script type=\"text/javascript\" language=\"javascript\">\n"; $sql .= "order by clip_folder ";
echo " function makeRequest(url, strpost) {\n"; $prep_statement = $db->prepare(check_sql($sql));
echo " var http_request = false;\n"; $prep_statement->execute();
echo "\n"; $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n"; $result_count = count($result);
echo " http_request = new XMLHttpRequest();\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/xml');\n";
echo " // See note below about this line\n";
echo " }\n";
echo " } else if (window.ActiveXObject) { // IE\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");\n";
echo " } catch (e) {\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " } catch (e) {}\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " if (!http_request) {\n";
echo " alert('".$text['message-give-up']."');\n";
echo " return false;\n";
echo " }\n";
echo " http_request.onreadystatechange = function() { returnContent(http_request); };\n";
echo " http_request.overrideMimeType('text/html');\n";
echo " http_request.open('POST', url, true);\n";
echo "\n";
echo " if (strpost.length == 0) {\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
echo " http_request.send(strpost);\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " function returnContent(http_request) {\n";
echo "\n";
echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
echo " }\n";
echo " else {\n";
echo " alert('".$text['message-problem']."');\n";
echo " }\n";
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 "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/minus.gif\";\n";
echo " }\n";
echo " }\n";
echo " \n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n";
echo " // Collapse the branch if it IS visible\n";
echo " else {\n";
echo " // Change the image (if there is an image)\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/plus.gif\";\n";
echo " }\n";
echo " }\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n";
echo "\n";
echo "}\n";
echo "</SCRIPT>";
echo "<head>";
echo "<body>";
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 onclick=\"window.open('clipoptions.php','Clip Options','left=20,top=20,width=500,height=500,toolbar=0,resizable=0');\" style='text-decoration:none;' title=''><IMG SRC=\"images/folder.gif\" border='0'> ".$text['label-clip-library']."</a><DIV style=''>\n"; //display:none
$sql = "select * from v_clips ";
$sql .= "order by clip_folder ";
$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++;
}
echo "</DIV></TD></TR></TABLE>\n";
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++;
} }
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 WIDTH=10></TD><TD><A onClick=\"Toggle(this);\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\"> &nbsp;".$clip_folder_name." &nbsp; </A><DIV style='display:none'>\n\n";
$tag_open = 1;
}
$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"; if ($last_folder != $row['clip_folder']) {
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n"; $clip_folder_name = str_replace ($previous_folder_name, "", $row['clip_folder']);
echo "\n"; $clip_folder_name = str_replace ("/", "", $clip_folder_name);
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=12></TD><TD align='bottom'><IMG SRC=\"images/file.png\" border='0'> \n"; echo "<table border=0 cellpadding='0' cellspacing='0'>";
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']."';\">".$row['clip_name']."</a>\n"; 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;
}
echo "</TD></TR></TABLE>\n"; $previous_depth = $current_depth;
echo "\n\n"; $previous_folder_name = $row['clip_folder'];
$last_folder = $row['clip_folder']; echo "<textarea style='display:none' id='clip_lib_start".$row['clip_uuid']."'>".$row['clip_text_start']."</textarea>\n";
if ($c==0) { $c=1; } else { $c=0; } echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
} //end foreach echo "\n";
unset($sql, $result, $row_count); echo "<table border=0 cellpadding='0' cellspacing='0'>";
} //end if results 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";
echo "\n"; $last_folder = $row['clip_folder'];
echo " </div></td></tr></table>\n"; if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</td>\n"; echo " </div>";
echo "</tr>\n"; echo " </td>";
echo "</table>\n"; echo " </tr>";
echo "</div>"; echo "</table>\n";
echo "<br><br>"; echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
unset ($result_count); require_once "footer.php";
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?> ?>
-181
View File
@@ -1,181 +0,0 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/check_auth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$clip_uuid = $_POST["id"];
$clip_name = $_POST["clip_name"];
$clip_folder = $_POST["clip_folder"];
$clip_text_start = $_POST["clip_text_start"];
$clip_text_end = $_POST["clip_text_end"];
$clip_desc = $_POST["clip_desc"];
$clip_order = $_POST["clip_order"];
require_once "header.php";
echo "<div align='left'>";
echo "<table width='175' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$sql .= "select * from v_clips ";
$sql .= "where ";
if (strlen($clip_uuid) > 0) { $sql .= "and id = '$clip_uuid' "; }
if (strlen($clip_name) > 0) { $sql .= "and clip_name like '%$clip_name%' "; }
if (strlen($clip_folder) > 0) { $sql .= "and clip_folder like '%$clip_folder%' "; }
if (strlen($clip_text_start) > 0) { $sql .= "and clip_text_start like '%$clip_text_start%' "; }
if (strlen($clip_text_end) > 0) { $sql .= "and clip_text_end like '%$clip_text_end%' "; }
if (strlen($clip_desc) > 0) { $sql .= "and clip_desc like '%$clip_desc%' "; }
if (strlen($clip_order) > 0) { $sql .= "and clip_order like '%$clip_order%' "; }
$sql = trim($sql);
if (substr($sql, -5) == "where"){ $sql = substr($sql, 0, (strlen($sql)-5)); }
$sql = str_replace ("where and", "where", $sql);
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<div align='left'>\n";
echo "<table border='0' cellpadding='1' cellspacing='1'>\n";
echo "<tr><td colspan='1'><img src='/edit/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) {
//no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
//echo "<th nowrap>&nbsp; &nbsp; Id&nbsp; &nbsp; </th>";
echo "<th nowrap>&nbsp; &nbsp; clip_name Search &nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_folder&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_text_start&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_text_end&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_desc&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_order&nbsp; &nbsp; </th>";
echo "</tr>";
echo "<tr><td colspan='1'><img src='images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
//print_r( $row );
echo "<tr style='".$row_style[$c]."'>\n";
//echo "<td valign='top'><a href='update.php?id=".$row[id]."'>".$row[id]."</a></td>";
echo "<td valign='top'><a href='clipupdate.php?id=".$row[id]."'>".$row[clip_name]."</a></td>";
//echo "<td valign='top'>".$row[clip_folder]."</td>";
//echo "<td valign='top'>".$row[clip_text_start]."</td>";
//echo "<td valign='top'>".$row[clip_text_end]."</td>";
//echo "<td valign='top'>".$row[clip_desc]."</td>";
//echo "<td valign='top'>".$row[clip_order]."</td>";
echo "</tr>";
echo "<tr><td colspan='1'><img src='images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " <br><br>";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
}
else {
//show the content
require_once "header.php";
echo "<div align='left'>";
echo "<table with='175' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Name</td>";
echo " <td><input type='text' class='txt' name='clip_name'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Folder</td>";
echo " <td><input type='text' class='txt' name='clip_folder'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Start</td>";
echo " <td><input type='text' class='txt' name='clip_text_start'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>End</td>";
echo " <td><input type='text' class='txt' name='clip_text_end'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Desc</td>";
echo " <td><input type='text' class='txt' name='clip_desc'></td>";
echo " </tr>";
//echo " <tr>";
//echo " <td>clip_order</td>";
//echo " <td><input type='text' class='txt' name='clip_order'></td>";
//echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' value='Search'></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "footer.php";
} //end if not post
?>
+5 -7
View File
@@ -57,7 +57,6 @@ if (count($_POST)>0) {
$sql .= "clip_order = '$clip_order' "; $sql .= "clip_order = '$clip_order' ";
$sql .= "where clip_uuid = '$clip_uuid' "; $sql .= "where clip_uuid = '$clip_uuid' ";
$count = $db->exec(check_sql($sql)); $count = $db->exec(check_sql($sql));
//echo "affected rows: ".$count;
//redirect the browser //redirect the browser
require_once "header.php"; require_once "header.php";
@@ -89,9 +88,8 @@ else {
//show the content //show the content
require_once "header.php"; require_once "header.php";
echo "<div align='left'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n"; echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n"; echo "<tr>\n";
echo " <td align=\"left\">\n"; echo " <td align=\"left\">\n";
echo "<form method='post' action=''>"; echo "<form method='post' action=''>";
@@ -125,9 +123,10 @@ else {
echo " </tr>"; echo " </tr>";
echo " <tr>"; echo " <tr>";
echo " <td colspan='2' align='right'>"; echo " <td align='left'><input type='button' value='".$text['button-back']."' onclick='history.back()'></td>";
echo " <input type='hidden' name='id' value='$clip_uuid'>"; echo " <td align='right'>";
echo " <input type='submit' name='submit' value='Update'>"; echo " <input type='hidden' name='id' value='$clip_uuid'>";
echo " <input type='submit' name='submit' value='Update'>";
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
@@ -136,7 +135,6 @@ else {
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
echo "</div>";
require_once "footer.php"; require_once "footer.php";
?> ?>
+69 -84
View File
@@ -38,16 +38,6 @@ else {
//add css and javascript //add css and javascript
require_once "header.php"; require_once "header.php";
//define function space
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
return $r;
}
//define function recure_dir //define function recure_dir
function recur_dir($dir) { function recur_dir($dir) {
clearstatcache(); clearstatcache();
@@ -59,12 +49,17 @@ else {
if ($file != "." AND $file != ".."){ if ($file != "." AND $file != ".."){
$newpath = $dir.'/'.$file; $newpath = $dir.'/'.$file;
$level = explode('/',$newpath); $level = explode('/',$newpath);
if (substr($newpath, -4) == ".svn" || if (
substr($newpath, -4) == ".git") { substr(strtolower($newpath), -4) == ".svn" ||
//ignore .svn and .git dir and subdir substr(strtolower($newpath), -4) == ".git" ||
} substr(strtolower($newpath), -3) == ".db" ||
elseif (substr($newpath, -3) == ".db") { substr(strtolower($newpath), -4) == ".jpg" ||
//ignore .db files 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 { else {
$dir_array[] = $newpath; $dir_array[] = $newpath;
@@ -79,45 +74,32 @@ else {
$level = explode('/',$newpath); $level = explode('/',$newpath);
if (is_dir($newpath)) { if (is_dir($newpath)) {
//$mod_array[] = array(
//'level'=>count($level)-1,
//'path'=>$newpath,
//'name'=>end($level),
//'type'=>'dir',
//'mod_time'=>filemtime($newpath),
//'size'=>'');
//$mod_array[] = recur_dir($newpath);
$dirname = end($level); $dirname = end($level);
$htmldirlist .= space(count($level))."<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><a onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\" border='0'> $dirname </a><DIV style='display:none'>\n"; $htmldirlist .= "
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/gear.png\"> Tools </A><DIV style='display:none'>\n"; <table border=0 cellpadding='0' cellspacing='0'>
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='foldernew.php?folder=".urlencode($newpath)."' title=''>New Folder </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."' <tr>
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n"; <td nowrap style='padding-left: 16px;'>
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='filenew.php?folder=".urlencode($newpath)."' title=''>New File </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."' <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>
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n"; </td>
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n"; </tr>
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/gear.png\"><a href='fileoptions.php?folder=".urlencode($newpath)."' title=''>Options </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."' </table>\n";
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n";
$htmldirlist .= recur_dir($newpath);
$htmldirlist .= space(count($level))."</DIV></TD></TR></TABLE>\n";
} }
else { else {
//$mod_array[] = array(
// 'level'=>count($level)-1,
// 'path'=>$newpath,
// 'name'=>end($level),
// 'type'=>'file',
// 'mod_time'=>filemtime($newpath),
// 'size'=>filesize($newpath));
$filename = end($level); $filename = end($level);
$filesize = round(filesize($newpath)/1024, 2); $filesize = round(filesize($newpath)/1024, 2);
$htmlfilelist .= space(count($level))."<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><a href='javascript:void(0);' onclick=\"parent.document.title='".$newpath."';parent.document.getElementById('file').value='".urlencode($newpath)."'; parent.window.frames['frame_'+'edit1'].editArea.previous= new Array(); parent.window.frames['frame_'+'edit1'].editArea.switchClassSticky(document.getElementById('undo'), 'editAreaButtonDisabled', true); makeRequest('fileread.php','file=".urlencode($newpath)."'); window.setTimeout('parent.my_setSelectionRange(\'edit1\')','100');\" title='$filesize KB'><IMG SRC=\"images/file.png\" border='none'> $filename </a><DIV style='display:none'>\n"; $newpath = str_replace ('//', '/', $newpath);
$htmlfilelist .= space(count($level))."</DIV></TD></TR></TABLE>\n"; $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." &#10; ".$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";
} }
} }
closedir($dirlist); closedir($dirlist);
return $htmldirlist ."\n". $htmlfilelist; return $htmldirlist ."\n". $htmlfilelist;
} }
@@ -154,14 +136,11 @@ echo " http_request.open('POST', url, true);\n";
echo "\n"; echo "\n";
echo "\n"; echo "\n";
echo " if (strpost.length == 0) {\n"; echo " if (strpost.length == 0) {\n";
//echo " alert('none');\n";
echo " //http_request.send(null);\n"; echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n"; echo " http_request.send('name=value&foo=bar');\n";
echo " }\n"; echo " }\n";
echo " else {\n"; echo " else {\n";
//echo " alert(strpost);\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n"; echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
//echo " http_request.send('name=value&foo=bar');\n";
echo " http_request.send(strpost);\n"; echo " http_request.send(strpost);\n";
echo " }\n"; echo " }\n";
echo "\n"; echo "\n";
@@ -171,15 +150,12 @@ echo " function returnContent(http_request) {\n";
echo "\n"; echo "\n";
echo " if (http_request.readyState == 4) {\n"; echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n"; echo " if (http_request.status == 200) {\n";
echo " parent.document.getElementById('editor_source').value=http_request.responseText;";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n"; echo " parent.editor.getSession().setValue(parent.document.getElementById('editor_source').value);";
//echo " alert(http_request.responseText);\n"; echo " parent.editor.gotoLine(1);";
echo " parent.editor.scrollToLine(1, true, true, function() {});";
echo " parent.editor.focus();";
echo "\n"; echo "\n";
//echo " //var xmldoc = http_request.responseXML;\n";
//echo " //var root_node = xmldoc.getElementsByTagName('doc').item(0);\n";
//echo " //alert(xmldoc.getElementByID('fr1').value);\n";
//echo " //alert(root_node.firstChild.data);\n";
//echo "\n";
echo " }\n"; echo " }\n";
echo " else {\n"; echo " else {\n";
echo " alert('".$text['message-problem']."');\n"; echo " alert('".$text['message-problem']."');\n";
@@ -199,39 +175,53 @@ echo "<SCRIPT LANGUAGE=\"JavaScript\">\n";
//echo "// ---------------------------------------------\n"; //echo "// ---------------------------------------------\n";
echo "function Toggle(node) {\n"; echo "function Toggle(node) {\n";
echo " // Unfold the branch if it isn't visible\n"; echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n"; echo " if (node.nextSibling.style.display == 'none') {\n";
echo " // Change the image (if there is an image)\n"; echo " node.nextSibling.style.display = 'block';\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/minus.gif\";\n";
echo " }\n";
echo " }\n";
echo " \n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n"; echo " }\n";
echo " // Collapse the branch if it IS visible\n"; echo " // Collapse the branch if it IS visible\n";
echo " else {\n"; echo " else {\n";
echo " // Change the image (if there is an image)\n"; echo " node.nextSibling.style.display = 'none';\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/plus.gif\";\n";
echo " }\n";
echo " }\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n"; echo " }\n";
echo "\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";
echo "<script>\n";
echo " $(window).keypress(function(event) {\n";
echo " //save file [Ctrl+S]\n";
echo " if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.$('form#frm_edit').submit();\n";
echo " return false;\n";
echo " }\n";
echo " //open file manager/clip library pane [Ctrl+Q]\n";
echo " else if ((event.which == 113 && event.ctrlKey) || (event.which == 19)) {\n";
echo " parent.toggle_sidebar();\n";
echo " parent.focus_editor();\n";
echo " return false;\n";
echo " }\n";
echo " //block backspace\n";
echo " else if (event.which == 8) {\n";
echo " return false;\n";
echo " }\n";
echo " //otherwise, default action\n";
echo " else {\n";
echo " return true;\n";
echo " }\n";
echo " });\n";
echo "</script>";
echo "</head>\n";
echo "<body style='margin: 0px; padding: 0px;'>\n";
echo "<div align='center' valign='1'>"; echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n"; echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n"; echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\n"; echo " <td align=\"left\" valign='top' nowrap>\n";
//echo " <br>";
echo "\n"; echo "\n";
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><a href='javascript:void(0);' onclick=\"if (typeof(clipwin)!='undefined') { clipwin.close(); } clipwin = window.open('fileoptions.php?folder=".urlencode($_SERVER["DOCUMENT_ROOT"])."','null','left=20,top=20,width=310,height=300,toolbar=0,resizable=0');\" style='text-decoration:none;' title=''><IMG SRC=\"images/folder.gif\" border='0'> ".$text['label-files']." </a><DIV style=''>\n"; //display:none 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 " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><A onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\"> Files </A><DIV style=''>\n"; //display:none
//start the session //start the session
ini_set("session.cookie_httponly", True); ini_set("session.cookie_httponly", True);
@@ -286,7 +276,6 @@ echo "</tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "</div>"; echo "</div>";
echo "<br><br>";
require_once "footer.php"; require_once "footer.php";
unset ($result_count); unset ($result_count);
@@ -294,8 +283,4 @@ unset ($result);
unset ($key); unset ($key);
unset ($val); unset ($val);
unset ($c); unset ($c);
echo "</body>";
echo "</html>";
?> ?>
+2 -2
View File
@@ -61,7 +61,7 @@ else {
echo "<table>"; echo "<table>";
echo " <tr>"; echo " <tr>";
echo " <td>Path:</td>"; echo " <td>Path:</td>";
echo " </tr>"; echo " </tr>";
echo " <tr>"; echo " <tr>";
echo " <td>".$folder.$file."</td>"; echo " <td>".$folder.$file."</td>";
echo " </tr>"; echo " </tr>";
@@ -81,7 +81,7 @@ else {
echo " <tr>"; echo " <tr>";
echo " <td colspan='1' align='right'>"; echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>"; echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='submit' value='".$text['button-new-file']."'>"; echo " <input type='button' value='".$text['button-back']."' onclick='history.back()'><input type='submit' value='".$text['button-new-file']."'>";
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
+16 -20
View File
@@ -36,8 +36,10 @@ else {
} }
//add multi-lingual support //add multi-lingual support
// included in the header.php file below $language = new text;
$text = $language->get();
$title = $text['title-manage-files'];
require_once "header.php"; require_once "header.php";
$file = $_GET["file"]; $file = $_GET["file"];
@@ -46,15 +48,14 @@ $folder = $_GET["folder"];
$folder = str_replace ($file, "", $folder); $folder = str_replace ($file, "", $folder);
$urlpath = str_replace ($_SERVER["DOCUMENT_ROOT"], "", $folder); $urlpath = str_replace ($_SERVER["DOCUMENT_ROOT"], "", $folder);
echo "<div align='left'>"; echo "<table cellpadding='0' cellspacing='0' border='0' style='height: 100%; width: 100%;'>\n";
echo "<table border='0' style=\"height: 100%; width: 100%;\">\n";
echo "<tr>"; echo "<tr>";
echo "<td colspan='2'>"; echo "<td colspan='2'>";
echo "<table border='0'>"; echo "<table border='0'>";
echo "<form method='post' name='frm' action=''>"; echo "<form method='post' name='frm' action=''>";
echo "<tr><td>".$text['label-path']."</td><td width='95%'><input type='text' name='folder' id='folder' style=\"width: 100%;\" value=''></td><tr>\n"; echo "<tr><td align='right'>".$text['label-path']."</td><td width='95%'><input type='text' name='folder' id='folder' style=\"width: 100%;\" value=''></td><tr>\n";
echo "<tr><td>".$text['label-file']."</td><td width='95%' style=\"width: 60%;\"><input type='text' name='filename' id='filename' style=\"width: 100%;\" value=''></div></td></tr>\n"; echo "<tr><td align='right'>".$text['label-file']."</td><td width='95%' style=\"width: 60%;\"><input type='text' name='filename' id='filename' style=\"width: 100%;\" value=''></div></td></tr>\n";
echo "</form>"; echo "</form>";
echo "</table>"; echo "</table>";
@@ -63,28 +64,23 @@ echo "</tr>\n";
echo "<tr>\n"; echo "<tr>\n";
echo "<td valign='top' width='200' nowrap>"; echo "<td valign='top' width='200' nowrap>";
echo " <IFRAME SRC='fileoptionslist.php' style='border: solid 1px #CCCCCC; height: 100%; width: 100%;' TITLE=''>\n"; echo " <iframe src='fileoptionslist.php' style='border: solid 1px #ccc; height: calc(100% - 3px); width: calc(100% - 4px);'></iframe>";
echo " <!-- Clip List: Requires IFRAME support -->\n";
echo " </IFRAME>";
echo "</td>\n"; echo "</td>\n";
echo "<td valign='top' style=\"height: 100%;\">"; echo "<td valign='top' style='height: 100%; padding: 0;'>";
echo "<div align='left'>"; echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' height='100%'>";
echo "<table width='100%' class='border'>"; echo " <tr><td><input type='button' class='btn' onclick=\"window.location='filenew.php?folder='+document.getElementById('folder').value;\" value='".$text['button-add-file']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='filenew.php?folder='+document.getElementById('folder').value;\" value='".$text['button-add-file']."'></td></tr>\n"; echo " <tr><td><input type='button' class='btn' onclick=\"window.location='foldernew.php?folder='+document.getElementById('folder').value;\" value='".$text['button-add-dir']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='foldernew.php?folder='+document.getElementById('folder').value;\" value='".$text['button-add-dir']."'></td></tr>\n"; echo " <tr><td><input type='button' class='btn' onclick=\"window.location='filerename.php?folder='+document.getElementById('folder').value+'&filename='+document.getElementById('filename').value;\" value='".$text['button-rename-file']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='filerename.php?folder='+document.getElementById('folder').value+'&filename='+document.getElementById('filename').value;\" value='".$text['button-rename-file']."'></td></tr>\n"; echo " <tr><td><input type='button' class='btn' onclick=\"if (confirm('".$text['message-delete-file']."')){ window.location='filedelete.php?folder='+document.getElementById('folder').value+'&file='+document.getElementById('filename').value; }\" value='".$text['button-del-file']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"if (confirm('".$text['message-delete-file']."')){ window.location='filedelete.php?folder='+document.getElementById('folder').value+'&file='+document.getElementById('filename').value; }\" value='".$text['button-del-file']."'></td></tr>\n"; echo " <tr><td><input type='button' class='btn' onclick=\"if (confirm('".$text['message-delete-folder']."')){ window.location='folderdelete.php?folder='+document.getElementById('folder').value; }\" value='".$text['button-del-dir']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"if (confirm('".$text['message-delete-folder']."')){ window.location='folderdelete.php?folder='+document.getElementById('folder').value; }\" value='".$text['button-del-dir']."'></td></tr>\n"; echo " <tr><td height='100%'>&nbsp;</td></tr>\n";
echo " <tr><td><br><br><br><br><br></td></tr>\n"; echo " <tr><td><input type='button' class='btn' onclick='opener.location.reload(); self.close();' value='".$text['button-close']."'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick='javascript:self.close();' value='".$text['button-close']."'></td></tr>\n";
echo "</table>"; echo "</table>";
echo "</div>";
echo "</td>\n"; echo "</td>\n";
echo "</tr>\n"; echo "</tr>\n";
echo "</table>"; echo "</table>";
echo "</div>";
require_once "footer.php"; require_once "footer.php";
?> ?>
+70 -116
View File
@@ -42,77 +42,71 @@ else {
//include //include
require_once "header.php"; require_once "header.php";
function isfile($filename) { //define function recure_dir
if (@filesize($filename) > 0) { return true; } else { return false; } function recur_dir($dir) {
} clearstatcache();
$htmldirlist = '';
$htmlfilelist = '';
$dirlist = opendir($dir);
$dir_array = array();
while (false !== ($file = readdir($dirlist))) {
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
}
else {
$dir_array[] = $newpath;
}
if ($x > 1000) { break; };
$x++;
}
}
function space($count) { asort($dir_array);
$r=''; $i=0; foreach ($dir_array as $newpath){
while($i < $count) { $level = explode('/',$newpath);
$r .= ' ';
$i++; if (is_dir($newpath)) {
$dirname = end($level);
$newpath = str_replace ('//', '/', $newpath);
$htmldirlist .= "
<table border=0 cellpadding='0' cellspacing='0'>
<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>
</td>
</tr>
</table>\n";
}
else {
$filename = end($level);
$filesize = round(filesize($newpath)/1024, 2);
$newpath = str_replace ('//', '/', $newpath);
$newpath = str_replace ("\\", "/", $newpath);
$newpath = str_replace ($filename, '', $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('filename').value='".$filename."'; parent.document.getElementById('folder').value='".$newpath."';\" title='".$newpath." &#10; ".$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";
}
}
closedir($dirlist);
return $htmldirlist ."\n". $htmlfilelist;
} }
return $r;
}
function recur_dir($dir) {
clearstatcache();
$htmldirlist = '';
$htmlfilelist = '';
$dirlist = opendir($dir);
while ($file = readdir ($dirlist)) {
if ($file != '.' && $file != '..') {
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
if (is_dir($newpath)) {
/*$mod_array[] = array(
'level'=>count($level)-1,
'path'=>$newpath,
'name'=>end($level),
'type'=>'dir',
'mod_time'=>filemtime($newpath),
'size'=>'');
$mod_array[] = recur_dir($newpath);
*/
$dirname = end($level);
$htmldirlist .= space(count($level))."<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this, '".$newpath."');\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\" border='0'> $dirname </a><DIV style='display:none'>\n";
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this)\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/gear.png\"> Tools </A><DIV style='display:none'>\n";
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='foldernew.php?folder=".urlencode($newpath)."' title=''>New Folder </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n";
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='filenew.php?folder=".urlencode($newpath)."' title=''>New File </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n";
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n";
//$htmldirlist .= space(count($level))." <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/gear.png\"><a href='fileoptions.php?folder=".urlencode($newpath)."' title=''>Options </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
//$htmldirlist .= space(count($level))." </DIV></TD></TR></TABLE>\n";
$htmldirlist .= recur_dir($newpath);
$htmldirlist .= space(count($level))."</DIV></TD></TR></TABLE>\n";
}
else {
/*$mod_array[] = array(
'level'=>count($level)-1,
'path'=>$newpath,
'name'=>end($level),
'type'=>'file',
'mod_time'=>filemtime($newpath),
'size'=>filesize($newpath));
*/
$filename = end($level);
$filesize = round(filesize($newpath)/1024, 2);
$newpath = str_replace ($filename, "", $newpath);
$htmlfilelist .= space(count($level))."<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><a href='javascript:void(0);' onclick=\"parent.document.getElementById('filename').value='".$filename."'; parent.document.getElementById('folder').value='".$newpath."';\" title='$filesize KB'><IMG SRC=\"images/file.png\" border='none'>$filename</a><DIV style='display:none'>\n";
$htmlfilelist .= space(count($level))."</DIV></TD></TR></TABLE>\n";
}
}
}
closedir($dirlist);
return $htmldirlist ."\n". $htmlfilelist;
}
echo "<script type=\"text/javascript\" language=\"javascript\">\n"; echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " function makeRequest(url, strpost) {\n"; echo " function makeRequest(url, strpost) {\n";
//echo " alert(url); \n";
echo " var http_request = false;\n"; echo " var http_request = false;\n";
echo "\n"; echo "\n";
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n"; echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n";
@@ -141,14 +135,11 @@ echo " http_request.open('POST', url, true);\n";
echo "\n"; echo "\n";
echo "\n"; echo "\n";
echo " if (strpost.length == 0) {\n"; echo " if (strpost.length == 0) {\n";
//echo " alert('none');\n";
echo " //http_request.send(null);\n"; echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n"; echo " http_request.send('name=value&foo=bar');\n";
echo " }\n"; echo " }\n";
echo " else {\n"; echo " else {\n";
//echo " alert(strpost);\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n"; echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
//echo " http_request.send('name=value&foo=bar');\n";
echo " http_request.send(strpost);\n"; echo " http_request.send(strpost);\n";
echo " }\n"; echo " }\n";
echo "\n"; echo "\n";
@@ -160,13 +151,7 @@ echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n"; echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n"; echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
//echo " alert(http_request.responseText);\n";
echo "\n"; echo "\n";
//echo " //var xmldoc = http_request.responseXML;\n";
//echo " //var root_node = xmldoc.getElementsByTagName('doc').item(0);\n";
//echo " //alert(xmldoc.getElementByID('fr1').value);\n";
//echo " //alert(root_node.firstChild.data);\n";
//echo "\n";
echo " }\n"; echo " }\n";
echo " else {\n"; echo " else {\n";
echo " alert('".$text['message-problem']."');\n"; echo " alert('".$text['message-problem']."');\n";
@@ -188,45 +173,21 @@ echo " parent.document.getElementById('folder').value=path; \n";
echo " parent.document.getElementById('filename').value='';\n"; echo " parent.document.getElementById('filename').value='';\n";
echo " parent.document.getElementById('folder').focus();\n"; echo " parent.document.getElementById('folder').focus();\n";
echo " // Unfold the branch if it isn't visible\n"; echo " // Unfold the branch if it isn't visible\n";
echo " if (node.nextSibling.style.display == 'none') {\n"; echo " if (node.nextSibling.style.display == 'none') {\n";
echo " // Change the image (if there is an image)\n"; echo " node.nextSibling.style.display = 'block';\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/minus.gif\";\n";
echo " }\n";
echo " }\n";
echo " \n";
echo " node.nextSibling.style.display = 'block';\n";
echo " }\n"; echo " }\n";
echo " // Collapse the branch if it IS visible\n"; echo " // Collapse the branch if it IS visible\n";
echo " else {\n"; echo " else {\n";
echo " // Change the image (if there is an image)\n"; echo " node.nextSibling.style.display = 'none';\n";
echo " if (node.childNodes.length > 0) {\n";
echo " if (node.childNodes.item(0).nodeName == \"IMG\") {\n";
echo " node.childNodes.item(0).src = \"images/plus.gif\";\n";
echo " }\n";
echo " }\n";
echo " node.nextSibling.style.display = 'none';\n";
echo " }\n"; echo " }\n";
echo "\n"; echo "\n";
echo "}\n"; echo "}\n";
echo "</SCRIPT>\n"; echo "</SCRIPT>\n";
echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n"; echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo " <tr>\n";
echo "<tr class='border'>\n"; echo " <td align=\"left\" valign='top' nowrap>\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 "\n";
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><IMG SRC=\"images/folder.gif\" border='0'> ".$text['label-files']." <DIV style=''>\n"; //display:none
//echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><A onClick=\"Toggle(this, '')\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/folder.gif\"> Files </A><DIV style=''>\n"; //display:none
//echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap><A onClick=\"Toggle(this, '')\"><IMG SRC=\"images/plus.gif\"> <IMG SRC=\"images/gear.png\"> Tools </A><DIV style='display:none'>\n";
//echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='foldernew.php?folder=".urlencode($_SERVER["DOCUMENT_ROOT"])."' title=''>New Folder </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
//echo "</DIV></TD></TR></TABLE>\n";
//echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD nowrap WIDTH=12></TD><TD nowrap align='bottom'><IMG SRC=\"images/file.png\"><a href='filenew.php?folder=".urlencode($_SERVER["DOCUMENT_ROOT"])."' title=''>New File </a><DIV style='display:none'>\n"; //parent.document.getElementById('file').value='".urlencode($newpath)."'
//echo "</DIV></TD></TR></TABLE>\n";
//echo "</DIV></TD></TR></TABLE>\n";
ini_set("session.cookie_httponly", True); ini_set("session.cookie_httponly", True);
session_start(); session_start();
@@ -246,15 +207,12 @@ if ($_SESSION["app"]["edit"]["dir"] == "xml") {
echo recur_dir($_SESSION['switch']['conf']['dir']); echo recur_dir($_SESSION['switch']['conf']['dir']);
} }
echo "</DIV></TD></TR></TABLE>\n"; echo " </div></td></tr></table>\n";
echo " </td>\n";
echo "</td>\n"; echo " </tr>\n";
echo "</tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "footer.php"; require_once "footer.php";
unset ($result_count); unset ($result_count);
@@ -262,8 +220,4 @@ unset ($result);
unset ($key); unset ($key);
unset ($val); unset ($val);
unset ($c); unset ($c);
echo "</body>";
echo "</html>";
?> ?>
+1 -1
View File
@@ -93,7 +93,7 @@ else { //display form
echo " <td colspan='1' align='right'>"; echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>"; echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='hidden' name='filename' value='$filename'>"; echo " <input type='hidden' name='filename' value='$filename'>";
echo " <input type='submit' value='".$text['button-rename-file']."'>"; echo " <input type='button' value='".$text['button-back']."' onclick='history.back()'><input type='submit' value='".$text['button-rename-file']."'>";
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
+26 -9
View File
@@ -39,17 +39,34 @@ else {
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
$filename = $_POST["file"]; //filename with the path $filepath = $_POST["filepath"];
$filename = str_replace ("\\", "/", $filename); if ($filepath != '') {
$content = $_POST["content"];
$handle = fopen($filename, 'wb') or die($text['message-error']); try {
fwrite($handle, $content); //save file content
fclose($handle); $filepath = realpath($filepath); //filepath
$filepath = str_replace ('//', '/', $filepath);
$filepath = str_replace ("\\", "/", $filepath);
$content = $_POST["content"];
//set the reload_xml value to true $handle = fopen($filepath, 'wb');
$_SESSION["reload_xml"] = true; if (!$handle) {
throw new Exception('Write Failed - Check File Owner & Permissions');
}
fwrite($handle, $content);
fclose($handle);
echo $content; //set the reload_xml value to true
$_SESSION["reload_xml"] = true;
//alert user of success
echo "<script>alert('Changes Saved'); parent.focus_editor();</script>";
}
catch(Exception $e) {
//alert error
echo "<script>alert('".$e->getMessage()."'); parent.focus_editor();</script>";
}
}
?> ?>
+2 -2
View File
@@ -56,7 +56,7 @@ else { //display form
echo "<table>"; echo "<table>";
echo " <tr>"; echo " <tr>";
echo " <td>".$text['label-path']."</td>"; echo " <td>".$text['label-path']."</td>";
echo " </tr>"; echo " </tr>";
echo " <tr>"; echo " <tr>";
echo " <td>".$folder."</td>"; echo " <td>".$folder."</td>";
echo " </tr>"; echo " </tr>";
@@ -76,7 +76,7 @@ else { //display form
echo " <tr>"; echo " <tr>";
echo " <td colspan='1' align='right'>"; echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>"; echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='submit' value='".$text['button-new-folder']."'>"; echo " <input type='button' value='".$text['button-back']."' onclick='history.back()'><input type='submit' value='".$text['button-new-folder']."'>";
echo " </td>"; echo " </td>";
echo " </tr>"; echo " </tr>";
echo "</table>"; echo "</table>";
+2 -2
View File
@@ -31,7 +31,7 @@
echo "<html>"; echo "<html>";
echo "<head>"; echo "<head>";
echo "<title></title>"; echo "<title>".$title."</title>";
//echo "<link href='style.css' rel='stylesheet' type='text/css'>"; //echo "<link href='style.css' rel='stylesheet' type='text/css'>";
echo "<style type='text/css'>"; echo "<style type='text/css'>";
echo "<!--\n"; echo "<!--\n";
@@ -82,7 +82,7 @@ echo "}\n";
echo "//-->\n"; echo "//-->\n";
echo "</SCRIPT>"; echo "</SCRIPT>";
echo "</head>"; echo "</head>";
echo "<body>"; echo "<body style='margin: 0; padding: 5px;'>";
echo "<div align='center'>"; echo "<div align='center'>";
?> ?>
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 B

Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

+206 -145
View File
@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012 Portions created by the Initial Developer are Copyright (C) 2008-2016
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -41,169 +41,230 @@ else {
//set the directory //set the directory
$_SESSION["app"]["edit"]["dir"] = $_GET["dir"]; $_SESSION["app"]["edit"]["dir"] = $_GET["dir"];
$title = strtoupper($_GET["dir"]);
unset($mode);
switch ($_GET["dir"]) {
case 'xml': $mode['xml'] = 'selected'; break;
case 'provision': $mode['xml'] = 'selected'; break;
case 'php': $mode['php'] = 'selected'; break;
case 'scripts': $mode['lua'] = 'selected'; break;
case 'grammar': //use default
default: $mode['text'] = 'selected';
}
?>
echo "<html>\n"; <html>
echo "<head>\n"; <head>
echo " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
echo " <title></title>"; <title><?=$title?></title>
<script language="JavaScript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-1.11.1.js"></script>
echo "<script type=\"text/javascript\" language=\"javascript\">\n"; <script language="JavaScript" type="text/javascript">
echo "// Replaces all instances of the given substring.\n"; function submit_check() {
echo "String.prototype.replaceall = function(\n"; if (document.getElementById('filepath').value != '') {
echo "strTarget, \n"; // The substring you want to replace document.getElementById('editor_source').value = editor.getSession().getValue();
echo "strSubString \n"; // The string you want to replace in return true;
echo ")\n"; }
echo "{\n"; focus_editor();
echo " var strText = this;\n"; return false;
echo " var intIndexOfMatch = strText.indexOf( strTarget );\n";
echo " \n";
echo " // Keep looping while an instance of the target string\n";
echo " // still exists in the string.\n";
echo " while (intIndexOfMatch != -1){\n";
echo " // Relace out the current instance.\n";
echo " strText = strText.replace( strTarget, strSubString )\n";
echo " \n";
echo " // Get the index of any next matching substring.\n";
echo " intIndexOfMatch = strText.indexOf( strTarget );\n";
echo "}\n";
echo "return( strText );\n";
echo "}\n";
echo "function urlencode(str) {\n";
echo " str=escape(str); \n"; //Escape does not encode '/' and '+' character
echo " str=str.replaceall(\"+\", \"%2B\");\n";
echo " str=str.replaceall(\"/\", \"%2F\");\n";
echo " return str;\n";
echo "}";
echo "</script>\n";
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " function makeRequest(url, strpost) {\n";
echo " var http_request = false;\n";
echo "\n";
echo " if (window.XMLHttpRequest) { // Mozilla, Safari, ...\n";
echo " http_request = new XMLHttpRequest();\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/xml');\n";
echo " // See note below about this line\n";
echo " }\n";
echo " } else if (window.ActiveXObject) { // IE\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Msxml2.XMLHTTP\");\n";
echo " } catch (e) {\n";
echo " try {\n";
echo " http_request = new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
echo " } catch (e) {}\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " if (!http_request) {\n";
echo " alert('".$text['message-give-up']."');\n";
echo " return false;\n";
echo " }\n";
echo " http_request.onreadystatechange = function() { returnContent(http_request); };\n";
echo " if (http_request.overrideMimeType) {\n";
echo " http_request.overrideMimeType('text/html');\n";
echo " }\n";
echo " http_request.open('POST', url, true);\n";
echo "\n";
echo " if (strpost.length == 0) {\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
echo " http_request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');\n";
echo " http_request.send(strpost);\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " function returnContent(http_request) {\n";
echo " if (http_request.readyState == 4) {\n";
echo " if (http_request.status == 200) {\n";
echo " parent.editAreaLoader.setValue('edit1', http_request.responseText); \n";
echo " }\n";
echo " else {\n";
echo " alert('".$text['message-problem']."');\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>";
?>
<script language="Javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/edit_area/edit_area_full.js"></script>
<script language="Javascript" type="text/javascript">
// initialisation
editAreaLoader.init({
id: "edit1" // id of the textarea to transform
,start_highlight: false
,allow_toggle: false
,word_wrap: false
,language: "en"
,syntax: "xml"
,toolbar: "save, |, search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help"
,syntax_selection_allow: "css,html,js,php,xml,c,cpp,sql"
,show_line_colors: true
,load_callback: "my_load"
,save_callback: "my_save"
});
// callback functions
function my_save(id, content){
makeRequest('filesave.php','file='+document.getElementById('file').value+'&content='+urlencode(content));
parent.document.title=''+unescape(document.getElementById('file').value)+' :: Saved';
} }
function my_load(elem){ function preview_theme(opt) {
elem.value="The content is loaded from the load_callback function into EditArea"; editor.setTheme('ace/theme/' + opt.value);
} }
function my_setSelectionRange(id){ function toggle_option(opt) {
editAreaLoader.setSelectionRange(id, 0, 0); switch (opt) {
case 'numbering': toggle_option_do('showGutter'); break;
case 'invisibles': toggle_option_do('showInvisibles'); break;
case 'indenting': toggle_option_do('displayIndentGuides'); break;
}
focus_editor();
} }
function test_setSelectionRange(id){ function toggle_option_do(opt_name) {
editAreaLoader.setSelectionRange(id, 0, 0); var opt_val = editor.getOption(opt_name);
editor.setOption(opt_name, ((opt_val) ? false : true));
} }
function test_getSelectionRange(id){ function toggle_sidebar() {
var sel =editAreaLoader.getSelectionRange(id); var td_sidebar = document.getElementById('sidebar');
alert("start: "+sel["start"]+"\nend: "+sel["end"]); td_sidebar.style.display = (td_sidebar.style.display == '') ? 'none' : '';
focus_editor();
} }
function test_setSelectedText(id){ function insert_clip(before, after) {
text= "[REPLACED SELECTION]"; var selected_text = editor.session.getTextRange(editor.getSelectionRange());
editAreaLoader.setSelectedText(id, text); editor.insert(before + selected_text + after);
focus_editor();
} }
function test_getSelectedText(id){ function focus_editor() {
alert(editAreaLoader.getSelectedText(id)); editor.focus();
} }
</script> </script>
<style>
img.control {
cursor: pointer;
width: auto;
height: 23px;
border: none;
opacity: 0.5;
}
img.control:hover {
opacity: 1.0;
}
div#editor {
box-shadow: 0 5px 15px #333;
}
</style>
</head> </head>
<table border='0' style="height: 100%; width: 100%;"> <body style='padding: 0; margin: 0; overflow: hidden;'>
<table id='frame' cellpadding='0' cellspacing='0' border='0' style="height: 100%; width: 100%;">
<tr> <tr>
<td id='toolbar' valign='top' width='200' style="width: 200;" height='100%' nowrap> <td id='sidebar' valign='top' style="width: 300px; height: 100%;">
<IFRAME SRC='filelist.php' style='border: solid 1px #CCCCCC; height: 50%; width: 100%;' TITLE=''> <iframe id='file_list' src='filelist.php' style='border: none; height: 65%; width: 100%;'></iframe><br>
<!-- File List: Requires IFRAME support --> <iframe id='clip_list' src='cliplist.php' style='border: none; border-top: 1px solid #ccc; height: calc(35% - 1px); width: 100%;'></iframe>
</IFRAME>
<IFRAME SRC='cliplist.php' style='border: solid 1px #CCCCCC; height: 50%; width: 100%;' TITLE=''>
<!-- Clip List: Requires IFRAME support -->
</IFRAME>
</td> </td>
<td valign='top' width="100%" height='100%' style="height: 100%;"> <td align='right' valign='top' style='height: 100%;'>
<?php <form style='margin: 0;' name='frm_edit' id='frm_edit' method='post' target='proc' action='filesave.php' onsubmit="return submit_check();">
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) { <textarea name='content' id='editor_source' style='display: none;'></textarea>
//IE doesn't work with the 100% width with the IFRAME <input type='hidden' name='filepath' id='filepath' value=''>
echo "<textarea id='edit1' style='height: 100%; width: 800px;' name=''>\n"; <table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>
echo "</textarea>\n"; <tr>
} <td valign='middle'><img src='resources/images/icon_save.png' title='Save Changes [Ctrl+S]' class='control' onclick="$('form#frm_edit').submit();";></td>
else { <td align='left' valign='middle' width='100%' style='padding: 0 4px 0 6px;'><input id='current_file' type='text' disabled='disabled' style='height: 23px; width: 100%; color: #000;'></td>
echo "<textarea id='edit1' style='height: 100%; width: 100%;' name=''>\n"; <td style='padding: 0;'><img src='resources/images/blank.gif' style='width: 1px; height: 30px; border: none;'></td>
echo "</textarea>\n"; <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_sidebar.png' title='Toggle Side Bar [Ctrl+Q]' class='control' onclick="toggle_sidebar();"></td>
} <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_numbering.png' title='Toggle Line Numbers' class='control' onclick="toggle_option('numbering');"></td>
?> <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_invisibles.png' title='Toggle Invisibles' class='control' onclick="toggle_option('invisibles');"></td>
<input type='hidden' id='file' name='file' value='' /> <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_indenting.png' title='Toggle Indent Guides' class='control' onclick="toggle_option('indenting');"></td>
<td valign='middle' style='padding-left: 10px;'>
<select id='mode' style='height: 23px;' onchange="editor.getSession().setMode('ace/mode/' + this.options[this.selectedIndex].value); focus_editor();">
<option value='php' <?=$mode['php']?>>PHP</option>
<option value='css'>CSS</option>
<option value='html'>HTML</option>
<option value='javascript'>JS</option>
<option value='json'>JSON</option>
<option value='ini'>Conf</option>
<option value='lua' <?=$mode['lua']?>>Lua</option>
<option value='text' <?=$mode['text']?>>Text</option>
<option value='xml' <?=$mode['xml']?>>XML</option>
<option value='sql'>SQL</option>
</select>
</td>
<td valign='middle' style='padding-left: 4px;'>
<select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
<option value='9px'>9px</option>
<option value='10px'>10px</option>
<option value='11px'>11px</option>
<option value='12px' selected>12px</option>
<option value='14px'>14px</option>
<option value='16px'>16px</option>
<option value='18px'>18px</option>
<option value='20px'>20px</option>
</select>
</td>
<td valign='middle' style='padding-left: 4px; padding-right: 4px;'>
<select id='theme' style='height: 23px;' onchange="editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();">
<optgroup label="Bright">
<option value="chrome" onmouseover="preview_theme(this);">Chrome</option>
<option value="clouds" onmouseover="preview_theme(this);">Clouds</option>
<option value="crimson_editor" onmouseover="preview_theme(this);">Crimson Editor</option>
<option value="dawn" onmouseover="preview_theme(this);">Dawn</option>
<option value="dreamweaver" onmouseover="preview_theme(this);">Dreamweaver</option>
<option value="eclipse" onmouseover="preview_theme(this);">Eclipse</option>
<option value="github" onmouseover="preview_theme(this);">GitHub</option>
<option value="iplastic" onmouseover="preview_theme(this);">IPlastic</option>
<option value="solarized_light" onmouseover="preview_theme(this);">Solarized Light</option>
<option value="textmate" onmouseover="preview_theme(this);">TextMate</option>
<option value="tomorrow" onmouseover="preview_theme(this);">Tomorrow</option>
<option value="xcode" onmouseover="preview_theme(this);">XCode</option>
<option value="kuroir" onmouseover="preview_theme(this);">Kuroir</option>
<option value="katzenmilch" onmouseover="preview_theme(this);">KatzenMilch</option>
<option value="sqlserver" onmouseover="preview_theme(this);">SQL Server</option>
</optgroup>
<optgroup label="Dark">
<option value="ambiance" onmouseover="preview_theme(this);">Ambiance</option>
<option value="chaos" onmouseover="preview_theme(this);">Chaos</option>
<option value="clouds_midnight" onmouseover="preview_theme(this);">Clouds Midnight</option>
<option value="cobalt" onmouseover="preview_theme(this);" selected>Cobalt</option>
<option value="idle_fingers" onmouseover="preview_theme(this);">idle Fingers</option>
<option value="kr_theme" onmouseover="preview_theme(this);">krTheme</option>
<option value="merbivore" onmouseover="preview_theme(this);">Merbivore</option>
<option value="merbivore_soft" onmouseover="preview_theme(this);">Merbivore Soft</option>
<option value="mono_industrial" onmouseover="preview_theme(this);">Mono Industrial</option>
<option value="monokai" onmouseover="preview_theme(this);">Monokai</option>
<option value="pastel_on_dark" onmouseover="preview_theme(this);">Pastel on dark</option>
<option value="solarized_dark" onmouseover="preview_theme(this);">Solarized Dark</option>
<option value="terminal" onmouseover="preview_theme(this);">Terminal</option>
<option value="tomorrow_night" onmouseover="preview_theme(this);">Tomorrow Night</option>
<option value="tomorrow_night_blue" onmouseover="preview_theme(this);">Tomorrow Night Blue</option>
<option value="tomorrow_night_bright" onmouseover="preview_theme(this);">Tomorrow Night Bright</option>
<option value="tomorrow_night_eighties" onmouseover="preview_theme(this);">Tomorrow Night 80s</option>
<option value="twilight" onmouseover="preview_theme(this);">Twilight</option>
<option value="vibrant_ink" onmouseover="preview_theme(this);">Vibrant Ink</option>
</optgroup>
</select>
</td>
</tr>
</table>
</form>
<div id='editor' style="text-align: left; width: 100%; height: calc(100% - 30px); font-size: 12px;"></div>
<iframe id='proc' name='proc' src='#' style='display: none;'></iframe>
</td> </td>
</tr> </tr>
</table> </table>
<script type="text/javascript" src="/resources/ace_mnc/ace.js" charset="utf-8"></script>
<script type="text/javascript">
//load ace editor
var editor = ace.edit("editor");
editor.setOptions({
<?php
foreach ($mode as $lang => $meh) {
if ($meh == 'selected') { echo "mode: 'ace/mode/".$lang."',\n"; break; }
}
?>
theme: 'ace/theme/cobalt',
selectionStyle: 'text',
cursorStyle: 'smooth',
showInvisibles: false,
displayIndentGuides: true,
showLineNumbers: true,
showGutter: true,
scrollPastEnd: true,
fadeFoldWidgets: true,
showPrintMargin: false,
highlightGutterLine: false,
useSoftTabs: false
});
focus_editor();
//keyboard shortcut to save file
$(window).keypress(function(event) {
//save file [Ctrl+S]
if ((event.which == 115 && event.ctrlKey) || (event.which == 19)) {
$('form#frm_edit').submit();
return false;
}
//open file manager/clip library pane [Ctrl+Q]
else if ((event.which == 113 && event.ctrlKey) || (event.which == 19)) {
toggle_sidebar();
return false;
}
//otherwise, default action
else {
return true;
}
});
//remove certain keyboard shortcuts
editor.commands.bindKey("Ctrl-T", null);
</script>
</body> </body>
</html> </html>
-113
View File
@@ -1,113 +0,0 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
include "root.php";
require_once "resources/check_auth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
require_once "admin/edit/header.php";
echo "<div align='left'>";
echo "<table width='175' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
$sql = "select * from v_clips ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
$c = 0;
$row_style["0"] = "background-color: #F5F5DC;";
$row_style["1"] = "background-color: #FFFFFF;";
echo "<div align='left'>\n";
echo "<table width='100%' border='0' cellpadding='1' cellspacing='1'>\n";
echo "<tr><td colspan='1'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>";
if ($result_count == 0) { //no results
echo "<tr><td>&nbsp;</td></tr>";
}
else { //received results
echo "<tr>";
echo "<th nowrap>&nbsp; &nbsp; clip name &nbsp;</th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_folder&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_text_start&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_text_end&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_desc&nbsp; &nbsp; </th>";
//echo "<th nowrap>&nbsp; &nbsp; clip_order&nbsp; &nbsp; </th>";
echo "</tr>";
echo "<tr><td colspan='1'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
foreach($result as $row) {
echo "<tr style='".$row_style[$c]."'>\n";
//echo "<td valign='top'><a href='update.php?id=".$row[id]."'>".$row['clip_uuid']."</a></td>";
echo "<td valign='top'><a href='/edit/update.php?id=".$row['clip_uuid']."'>".$row['clip_name']."</a></td>";
//echo "<td valign='top'>".$row[clip_folder]."</td>";
//echo "<td valign='top'>".$row[clip_text_start]."</td>";
//echo "<td valign='top'>".$row[clip_text_end]."</td>";
//echo "<td valign='top'>".$row[clip_desc]."</td>";
//echo "<td valign='top'>".$row[clip_order]."</td>";
echo "</tr>";
echo "<tr><td colspan='1'><img src='/images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
echo "</table>\n";
echo "</div>\n";
echo " </td>\n";
echo "</tr>\n";
} //end if results
echo "</table>\n";
echo "<table width='175'><tr><td align='right'>\n";
echo "<input type='button' class='btn' name='' onclick=\"window.location='clipsearch.php'\" value='".$text['button-search']."'>&nbsp; &nbsp;\n";
echo "<input type='button' class='btn' name='' onclick=\"window.location='clipadd.php'\" value='".$text['button-add']."'>&nbsp; &nbsp;\n";
echo "</td></tr><table>\n";
echo "</div>";
echo "<br><br>";
require_once "admin/edit/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

+6 -6
View File
@@ -39,14 +39,14 @@
chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)); chdir(pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) { if (file_exists('/.project.ROOT')) {
$path = '/'; $path = '/';
} else { } else {
$i = 1; $i = 1;
$path = ''; $path = '';
while ($i < count($dirs)) { while ($i < count($dirs)) {
$path .= '/' . $dirs[$i]; $path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) { if (file_exists($path. '/.project.ROOT')) {
break; break;
} }
$i++; $i++;
@@ -61,7 +61,7 @@
if (!defined('PROJECT_PATH')) { if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx'); define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) { } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/.project.ROOT')) {
define('PROJECT_PATH', ''); define('PROJECT_PATH', '');
} else { } else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
@@ -69,13 +69,13 @@
$path = $_SERVER["DOCUMENT_ROOT"]; $path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) { while ($i < count($dirs)) {
$path .= '/' . $dirs[$i]; $path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) { if (file_exists($path. '/.project.ROOT')) {
break; break;
} }
$i++; $i++;
} }
if(!file_exists($path. '/project_root.php')){ if(!file_exists($path. '/.project.ROOT')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance"); die("Failed to locate the Project Root by searching for .project.ROOT please contact support for assistance");
} }
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path); define('PROJECT_PATH', $project_path);