Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
//application details
$apps[$x]['name'] = "Script Editor";
$apps[$x]['uuid'] = '17e628ee-ccfa-49c0-29ca-9894a0384b9b';
$apps[$x]['category'] = 'Switch';;
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en'] = 'Script Editor can be used to edit lua, javascript or other scripts.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Script Editor';
$apps[$x]['menu'][0]['uuid'] = 'f1905fec-0577-daef-6045-59d09b7d3f94';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'external';
$apps[$x]['menu'][0]['path'] = '/app/script_edit/index.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$apps[$x]['permissions'][0]['name'] = 'script_editor_view';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'script_editor_save';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
?>

126
app/script_edit/clipadd.php Normal file
View File

@@ -0,0 +1,126 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$clip_name = check_str($_POST["clip_name"]);
$clip_folder = check_str($_POST["clip_folder"]);
$clip_text_start = check_str($_POST["clip_text_start"]);
$clip_text_end = check_str($_POST["clip_text_end"]);
$clip_desc = check_str($_POST["clip_desc"]);
$clip_order = check_str($_POST["clip_order"]);
if (strlen($clip_order) == 0) { $clip_order = 0; }
$sql = "insert into v_clips ";
$sql .= "(";
$sql .= "clip_uuid, ";
$sql .= "clip_name, ";
$sql .= "clip_folder, ";
$sql .= "clip_text_start, ";
$sql .= "clip_text_end, ";
$sql .= "clip_desc, ";
$sql .= "clip_order ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$clip_name', ";
$sql .= "'$clip_folder', ";
$sql .= "'$clip_text_start', ";
$sql .= "'$clip_text_end', ";
$sql .= "'$clip_desc', ";
$sql .= "'$clip_order' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql,$db);
require_once "header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=clipoptions.php\">\n";
echo "Add Complete";
require_once "footer.php";
return;
}
//show the content
require_once "header.php";
echo "<div align='left'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
//echo "Clip Library";
//echo "<hr size='1'>";
echo "<form method='post' action=''>";
echo "<table width='100%' border='0'>";
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 colspan='2'>Before Selection:<br>";
echo " <textarea name='clip_text_start' class='txt'></textarea>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2'>After Selection:<br>";
echo " <textarea name='clip_text_end' class='txt'></textarea>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2'>Notes:<br>";
echo " <textarea name='clip_desc' class='txt'></textarea>";
echo " </td>";
echo " </tr>";
echo " <td colspan='2' align='right'><input type='submit' name='submit' value='Add'></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "footer.php";
?>

View File

@@ -0,0 +1,56 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the uuid from http values
$clip_uuid = check_str($_GET["id"]);
//delete the clip
if (strlen($_GET["id"])>0) {
$sql = "delete from v_clips ";
$sql .= "where clip_uuid = '".$clip_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql,$db);
}
//redirect the browser
require_once "header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=clipoptions.php\">\n";
echo "Delete Complete";
require_once "footer.php";
return;
?>

View File

@@ -0,0 +1,235 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//require_once "edit/header.php";
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) {
if (@filesize($filename) > 0) { return true; } else { return false; }
}
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
return $r;
}
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('Giving up :( Cannot create an XMLHTTP instance');\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 "\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 "\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 " }\n";
echo " else {\n";
echo " alert('There was a problem with the request.');\n";
echo " }\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 onfocus='null;'>";
echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\n";
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><a href='javascript:void(0);' onclick=\"window.open('clipoptions.php?id=".$row[id]."','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'> 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 ($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 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";
$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";
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
echo "\n";
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=12></TD><TD align='bottom'><IMG SRC=\"images/file.png\" border='0'> \n";
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 "</TD></TR></TABLE>\n";
echo "\n\n";
$last_folder = $row['clip_folder'];
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "\n";
echo " </DIV></TD></TR></TABLE>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo "<br><br>";
//require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
?>

View File

@@ -0,0 +1,71 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "header.php";
echo "<div align='left'>";
echo "<table border='0' style=\"height: 100%; width: 100%;\">\n";
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 "</form>";
echo "<tr>\n";
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 " <!-- Clip List: Requires IFRAME support -->\n";
echo " </IFRAME>";
echo "</td>\n";
echo "<td valign='top' style=\"height: 100%;\">";
echo " <table width='' class='border'>";
//echo " <tr><td colspan='1'><img src='images/spacer.gif' width='100%' height='1' style='background-color: #BBBBBB;'></td></tr>\n";
//echo " <tr><th>Options</th></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' name='' onclick=\"window.location='clipupdate.php?id='+document.getElementById('clip_uuid').value;\" value='Edit Clip'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='clipadd.php'\" value='Add Clip'></td></tr>\n";
//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('Are you sure you want to delete the selected clip?')){ window.location='clipdelete.php?id='+document.getElementById('clip_uuid').value; }\" value=' 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=' Close '></td></tr>\n";
echo " </table>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
require_once "footer.php";
?>

View File

@@ -0,0 +1,228 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('php_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
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) {
if (@filesize($filename) > 0) { return true; } else { return false; }
}
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
return $r;
}
//show the content
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('Giving up :( Cannot create an XMLHTTP instance');\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('There was a problem with the request.');\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'> 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 ($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";
echo "<textarea style='display:none' id='clip_lib_end".$row['clip_uuid']."'>".$row['clip_text_end']."</textarea>\n";
echo "\n";
echo "<TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD WIDTH=12></TD><TD align='bottom'><IMG SRC=\"images/file.png\" border='0'> \n";
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 "</TD></TR></TABLE>\n";
echo "\n\n";
$last_folder = $row['clip_folder'];
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "\n";
echo " </div></td></tr></table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo "<br><br>";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
?>

View File

@@ -0,0 +1,180 @@
<?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>
*/
include "root.php";
require_once "includes/checkauth.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
?>

View File

@@ -0,0 +1,138 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
if (count($_POST)>0) {
$clip_uuid = check_str($_POST["id"]);
$clip_name = check_str($_POST["clip_name"]);
$clip_folder = check_str($_POST["clip_folder"]);
$clip_text_start = check_str($_POST["clip_text_start"]);
$clip_text_end = check_str($_POST["clip_text_end"]);
$clip_desc = check_str($_POST["clip_desc"]);
$clip_order = check_str($_POST["clip_order"]);
//sql update
$sql = "update v_clips set ";
$sql .= "clip_name = '$clip_name', ";
$sql .= "clip_folder = '$clip_folder', ";
$sql .= "clip_text_start = '$clip_text_start', ";
$sql .= "clip_text_end = '$clip_text_end', ";
$sql .= "clip_desc = '$clip_desc', ";
$sql .= "clip_order = '$clip_order' ";
$sql .= "where clip_uuid = '$clip_uuid' ";
$count = $db->exec(check_sql($sql));
//echo "affected rows: ".$count;
//redirect the browser
require_once "header.php";
echo "<meta http-equiv=\"refresh\" content=\"1;url=clipoptions.php\">\n";
echo "Update Complete";
require_once "footer.php";
return;
}
else {
//get the uuid from http values
$clip_uuid = check_str($_GET["id"]);
//get the clip
$sql = "select * from v_clips ";
$sql .= "where clip_uuid = '$clip_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$clip_name = $row["clip_name"];
$clip_folder = $row["clip_folder"];
$clip_text_start = $row["clip_text_start"];
$clip_text_end = $row["clip_text_end"];
$clip_desc = $row["clip_desc"];
$clip_order = $row["clip_order"];
break; //limit to 1 row
}
}
//show the content
require_once "header.php";
echo "<div align='left'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo "<form method='post' action=''>";
echo "<table border='0' width='100%'>";
echo " <tr>";
echo " <td>Name:</td>";
echo " <td><input type='text' class='txt' name='clip_name' value='$clip_name'></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Folder:</td>";
echo " <td><input type='text' class='txt' name='clip_folder' value='$clip_folder'></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2'>Before Selection:<br>";
echo " <textarea class='txt' name='clip_text_start'>$clip_text_start</textarea>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2'>After Selection:<br>";
echo " <textarea class='txt' name='clip_text_end'>$clip_text_end</textarea>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2'>Notes:<br>";
echo " <textarea class='txt' name='clip_desc'>$clip_desc</textarea>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='2' align='right'>";
echo " <input type='hidden' name='id' value='$clip_uuid'>";
echo " <input type='submit' name='submit' value='Update'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "footer.php";
?>

View File

@@ -0,0 +1,84 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$folder = $_GET["folder"];
$folder = str_replace ("\\", "/", $folder);
if (substr($folder, -1) != "/") { $folder = $folder.'/'; }
$file = $_GET["file"];
if (strlen($folder) > 0 && strlen($file) > 0) {
unlink($folder.$file);
header("Location: fileoptions.php");
}
else {
//display form
require_once "header.php";
echo "<br>";
echo "<div align='left'>";
echo "<form method='get' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Path:</td>";
echo " </tr>";
echo " <tr>";
echo " <td>".$folder.$file."</td>";
echo " </tr>";
echo "</table>";
echo "<br />";
echo "<table>";
echo " <tr>";
echo " <td>File Name:</td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type='text' name='file' value=''></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='submit' value='New File'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</div>";
require_once "footer.php";
}
?>

View File

@@ -0,0 +1,254 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "header.php";
function isfile($filename) {
//if (@filesize($filename) > 0) { return true; } else { return false; }
}
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
return $r;
}
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") {
//ignore .svn dir and subdir
}
elseif (substr($newpath, -3) == ".db") {
//ignore .db files
}
else {
$dir_array[] = $newpath;
}
if ($x > 1000) { break; };
$x++;
}
}
asort($dir_array);
foreach ($dir_array as $newpath){
$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)\"><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);
$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";
$htmlfilelist .= space(count($level))."</DIV></TD></TR></TABLE>\n";
}
}
closedir($dirlist);
return $htmldirlist ."\n". $htmlfilelist;
}
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo " function makeRequest(url, strpost) {\n";
//echo " alert(url); \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('Giving up :( Cannot create an XMLHTTP instance');\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 "\n";
echo " if (strpost.length == 0) {\n";
//echo " alert('none');\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
//echo " alert(strpost);\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 " }\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 " alert(http_request.responseText);\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 " else {\n";
echo " alert('There was a problem with the request.');\n";
echo " }\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 "<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 " <br>";
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'> Files </a><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 recur_dir($_SESSION['switch']['scripts']['dir']);
echo "</div></td></tr></table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
?>

View File

@@ -0,0 +1,88 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$folder = $_GET["folder"];
$folder = str_replace ("\\", "/", $folder);
if (substr($folder, -1) != "/") { $folder = $folder.'/'; }
$file = $_GET["file"];
if (strlen($folder) > 0 && strlen($file) > 0) {
//create new file
$handle = fopen($folder.$file, 'wb') or die("Error!!");
$content = "<?php\n\n?>";
fwrite($handle, $content);
fclose($handle);
header("Location: fileoptions.php");
}
else {
require_once "header.php";
echo "<br>";
echo "<div align='left'>";
echo "<form method='get' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Path:</td>";
echo " </tr>";
echo " <tr>";
echo " <td>".$folder.$file."</td>";
echo " </tr>";
echo "</table>";
echo "<br />";
echo "<table>";
echo " <tr>";
echo " <td>File Name:</td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type='text' name='file' value=''></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='submit' value='New File'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</div>";
require_once "footer.php";
}
?>

View File

@@ -0,0 +1,85 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "header.php";
$file = $_GET["file"];
$file = str_replace ("\\", "/", $file);
$folder = $_GET["folder"];
$folder = str_replace ($file, "", $folder);
$urlpath = str_replace ($_SERVER["DOCUMENT_ROOT"], "", $folder);
echo "<div align='left'>";
echo "<table border='0' style=\"height: 100%; width: 100%;\">\n";
echo "<tr>";
echo "<td colspan='2'>";
echo "<table border='0'>";
echo "<form method='post' name='frm' action=''>";
echo "<tr><td>Path:</td><td width='95%'><input type='text' name='folder' id='folder' style=\"width: 100%;\" value=''></td><tr>\n";
echo "<tr><td>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 "</table>";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td valign='top' width='200' nowrap>";
echo " <IFRAME SRC='fileoptionslist.php' style='border: solid 1px #CCCCCC; height: 100%; width: 100%;' TITLE=''>\n";
echo " <!-- Clip List: Requires IFRAME support -->\n";
echo " </IFRAME>";
echo "</td>\n";
echo "<td valign='top' style=\"height: 100%;\">";
echo "<div align='left'>";
echo "<table width='100%' class='border'>";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='filenew.php?folder='+document.getElementById('folder').value;\" value='Add File'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"window.location='foldernew.php?folder='+document.getElementById('folder').value;\" value='Add Dir'></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='Rename File'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"if (confirm('Are you sure you want to delete the selected file?')){ window.location='filedelete.php?folder='+document.getElementById('folder').value+'&file='+document.getElementById('filename').value; }\" value='Delete File'></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick=\"if (confirm('Are you sure you want to delete the selected folder?')){ window.location='folderdelete.php?folder='+document.getElementById('folder').value; }\" value='Delete Dir'></td></tr>\n";
echo " <tr><td><br><br><br><br><br></td></tr>\n";
echo " <tr><td><input type='button' class='btn' name='' onclick='javascript:self.close();' value='Close'></td></tr>\n";
echo "</table>";
echo "</div>";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
require_once "footer.php";
?>

View File

@@ -0,0 +1,246 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "header.php";
function isfile($filename) {
if (@filesize($filename) > 0) { return true; } else { return false; }
}
function space($count) {
$r=''; $i=0;
while($i < $count) {
$r .= ' ';
$i++;
}
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 " function makeRequest(url, strpost) {\n";
//echo " alert(url); \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('Giving up :( Cannot create an XMLHTTP instance');\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 "\n";
echo " if (strpost.length == 0) {\n";
//echo " alert('none');\n";
echo " //http_request.send(null);\n";
echo " http_request.send('name=value&foo=bar');\n";
echo " }\n";
echo " else {\n";
//echo " alert(strpost);\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 " }\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 " alert(http_request.responseText);\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 " else {\n";
echo " alert('There was a problem with the request.');\n";
echo " }\n";
echo " }\n";
echo "\n";
echo " }\n";
echo "</script>\n";
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, path) {\n";
echo " parent.document.getElementById('folder').value=path; \n";
echo " parent.document.getElementById('filename').value='';\n";
echo " parent.document.getElementById('folder').focus();\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>\n";
echo "<div align='center' valign='1'>";
echo "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\" valign='top' nowrap>\n";
echo "\n";
echo " <TABLE BORDER=0 cellpadding='0' cellspacing='0'><TR><TD><IMG SRC=\"images/folder.gif\" border='0'> 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";
echo recur_dir($_SESSION['switch']['scripts']['dir']);
echo "</DIV></TD></TR></TABLE>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>";
echo "<br><br>";
require_once "footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
echo "</body>";
echo "</html>";
?>

View File

@@ -0,0 +1,49 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
$filename = $_POST["file"];
$filename = str_replace ("\\", "/", $filename);
$handle = fopen($filename, "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
echo $buffer;
}
fclose($handle);
}
?>

View File

@@ -0,0 +1,102 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$folder = $_GET["folder"];
//$folder = str_replace ("\\", "/", $folder);
//if (substr($folder, -1) != "/") { $folder = $folder.'/'; }
$newfilename = $_GET["newfilename"];
$filename = $_GET["filename"];
//echo $folder.$file;
if (strlen($folder) > 0 && strlen($newfilename) > 0) {
//echo "new file: ".$newfilename."<br>";
//echo "folder: ".$folder."<br>";
//echo "orig filename: ".$filename."<br>";;
rename($folder.$filename, $folder.$newfilename);
header("Location: fileoptions.php");
}
else { //display form
require_once "header.php";
echo "<br>";
echo "<div align='left'>";
echo "<form method='get' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Path:</td>";
echo " </tr>";
echo " <tr>";
echo " <td>".$folder.$filename."</td>";
echo " </tr>";
echo " <tr>";
echo " <td><br></td>";
echo " </tr>";
echo " <tr>";
echo " <td>Original file name:</td>";
echo " </tr>";
echo " <tr>";
echo " <td>".$filename."</td>";
echo " </tr>";
echo "</table>";
echo "<br />";
echo "<table>";
echo " <tr>";
echo " <td>Rename file to:</td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type='text' name='newfilename' value=''></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='hidden' name='filename' value='$filename'>";
echo " <input type='submit' value='Rename File'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</div>";
require_once "footer.php";
}
?>

View File

@@ -0,0 +1,50 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$filename = $_POST["file"]; //filename with the path
$filename = str_replace ("\\", "/", $filename);
$content = $_POST["content"];
$handle = fopen($filename, 'wb') or die("Error!!");
fwrite($handle, $content);
fclose($handle);
//set the reload_xml value to true
$_SESSION["reload_xml"] = true;
echo $content;
?>

View File

@@ -0,0 +1,46 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$folder = $_GET["folder"];
$folder = str_replace ("\\", "/", $folder);
if (strlen($folder) > 0) {
//delete the folder
rmdir($folder); //, 0700
header("Location: fileoptions.php");
}
?>

View File

@@ -0,0 +1,83 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_save')) {
//access granted
}
else {
echo "access denied";
exit;
}
$folder = $_GET["folder"];
$folder = str_replace ("\\", "/", $folder);
$foldername = $_GET["foldername"];
if (strlen($folder) > 0 && strlen($foldername) > 0) {
//create new folder
mkdir($folder.'/'.$foldername); //, 0700
header("Location: fileoptions.php");
}
else { //display form
require_once "header.php";
echo "<br>";
echo "<div align='left'>";
echo "<form method='get' action=''>";
echo "<table>";
echo " <tr>";
echo " <td>Path:</td>";
echo " </tr>";
echo " <tr>";
echo " <td>".$folder."</td>";
echo " </tr>";
echo "</table>";
echo "<br />";
echo "<table>";
echo " <tr>";
echo " <td>Folder Name:</td>";
echo " </tr>";
echo " <tr>";
echo " <td><input type='text' name='foldername' value=''></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan='1' align='right'>";
echo " <input type='hidden' name='folder' value='$folder'>";
echo " <input type='submit' value='New Folder'>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "</div>";
require_once "footer.php";
}
?>

View File

@@ -0,0 +1,43 @@
<?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>
*/
/*
echo "<br><br>";
echo "</td></tr></table>";
echo "<span class='smalltext'>";
echo "fusionpbx ";
echo "&nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href='http://fusionpbx.com'>http://fusionpbx.com</a>";
echo "&nbsp; &nbsp; &nbsp; &nbsp; ";
echo "Author: Mark J. Crane ";
echo "</span>";
*/
echo "<div>";
echo "</body>";
echo "</html>";
?>

View File

@@ -0,0 +1,83 @@
<?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>
*/
echo "<html>";
echo "<head>";
echo "<title></title>";
//echo "<link href='style.css' rel='stylesheet' type='text/css'>";
echo "<style type='text/css'>";
echo "<!--\n";
echo "th {\n";
echo " color: #5f5f5f;\n";
echo " font-size: 12px;\n";
echo " font-family: arial;\n";
echo " font-weight: bold;\n";
echo " background-color: #EFEFEF;\n";
echo "}\n";
echo "BODY {\n";
echo " font-size: 11px;\n";
echo " font-family: arial;\n";
echo "}\n";
echo "TD {\n";
echo " font-size: 11px;\n";
echo " font-family: arial;\n";
echo "}\n";
echo "INPUT, SELECT, TEXTAREA {\n";
echo " font-size: 11px;\n";
echo " }\n";
echo ".btn {\n";
echo " width: 100%;\n";
echo "}\n";
echo ".txt {\n";
echo " width: 100%;\n";
echo "}\n";
echo "//-->\n";
echo "</style>";
echo "<SCRIPT language=\"JavaScript\">\n";
echo "<!--\n";
echo "function confirmdelete(url)\n";
echo "{\n";
echo " var confirmed = confirm(\"Are you sure want to delete this.\");\n";
echo " if (confirmed == true) {\n";
echo " window.location=url;\n";
echo " }\n";
echo "}\n";
echo "//-->\n";
echo "</SCRIPT>";
echo "</head>";
echo "<body>";
echo "<div align='center'>";
?>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 B

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

200
app/script_edit/index.php Normal file
View File

@@ -0,0 +1,200 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
echo "<html>\n";
echo "<head>\n";
echo " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
echo " <title></title>";
echo "<script type=\"text/javascript\" language=\"javascript\">\n";
echo "// Replaces all instances of the given substring.\n";
echo "String.prototype.replaceall = function(\n";
echo "strTarget, \n"; // The substring you want to replace
echo "strSubString \n"; // The string you want to replace in
echo ")\n";
echo "{\n";
echo " var strText = this;\n";
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('Giving up :( Cannot create an XMLHTTP instance');\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('There was a problem with the request.');\n";
echo " }\n";
echo " }\n";
echo " }\n";
echo "</script>";
?>
<script language="Javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/includes/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){
elem.value="The content is loaded from the load_callback function into EditArea";
}
function my_setSelectionRange(id){
editAreaLoader.setSelectionRange(id, 0, 0);
}
function test_setSelectionRange(id){
editAreaLoader.setSelectionRange(id, 0, 0);
}
function test_getSelectionRange(id){
var sel =editAreaLoader.getSelectionRange(id);
alert("start: "+sel["start"]+"\nend: "+sel["end"]);
}
function test_setSelectedText(id){
text= "[REPLACED SELECTION]";
editAreaLoader.setSelectedText(id, text);
}
function test_getSelectedText(id){
alert(editAreaLoader.getSelectedText(id));
}
</script>
</head>
<table border='0' style="height: 100%; width: 100%;">
<tr>
<td id='toolbar' valign='top' width='200' style="width: 200;" height='100%' nowrap>
<IFRAME SRC='filelist.php' style='border: solid 1px #CCCCCC; height: 50%; width: 100%;' TITLE=''>
<!-- File List: Requires IFRAME support -->
</IFRAME>
<IFRAME SRC='cliplist.php' style='border: solid 1px #CCCCCC; height: 50%; width: 100%;' TITLE=''>
<!-- Clip List: Requires IFRAME support -->
</IFRAME>
</td>
<td valign='top' width="100%" height='100%' style="height: 100%;">
<?php
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
//IE doesn't work with the 100% width with the IFRAME
echo "<textarea id='edit1' style='height: 100%; width: 800px;' name=''>\n";
echo "</textarea>\n";
}
else {
echo "<textarea id='edit1' style='height: 100%; width: 100%;' name=''>\n";
echo "</textarea>\n";
}
?>
<input type='hidden' id='file' name='file' value='' />
</td>
</tr>
</table>
</body>
</html>

107
app/script_edit/list.php Normal file
View File

@@ -0,0 +1,107 @@
<?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>
*/
include "root.php";
require_once "includes/checkauth.php";
if (permission_exists('script_editor_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
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='Search'>&nbsp; &nbsp;\n";
echo "<input type='button' class='btn' name='' onclick=\"window.location='clipadd.php'\" value='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);
?>

View File

@@ -0,0 +1,7 @@
Notes
IFrame
http://www.quirksmode.org/js/iframe.html
Tree View
http://www.dddekerf.dds.nl/DHTML_Treeview/DHTML_Treeview.htm

50
app/script_edit/root.php Normal file
View File

@@ -0,0 +1,50 @@
<?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>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>