rendered paste bodyecho '<tr><th colspan="5">User Extension Editor</th></tr><tr><td>'
form_open
form_action 'editor'
#form_submit 'Enter Here'
form_close
echo '</td></tr>'
table_close
echo '</td>'
echo '</tr>'
table_close
#if [ "$action" = "sip_peers" ]; then
# asterisk_header="SIP Peers"
# asterisk_command="sip show peers"
#el
#if [ "$action" = "editor" ]; then
if ( [ "$content" != "" ] && [ -f "$path/$file" ] ) ; then
echo "$content" > "$path/$file"
fi
header ''
echo '<p>'
echo '<table style="width: 14em; text-align: left;" border="0" cellpadding="2" cellspacing="2">'
ls -1 $path/. | awk -F'\n' '
{
file_path = path "/" $0
if ((system("test -f " file_path) == 0) && ((getline sample < file_path) >= 0)) {
close(file_path)
print "<tr><td align=\"right\">"
print "<form action=\"'$script_name'\" method=\"post\">"$0
print "<input name=\"action\" type=\"hidden\" value=\"edit\">"
print "<input name=\"file\" type=\"hidden\" value=\""$0"\">"
print " "
print "<input type=\"submit\" value=\"Edit\">"
print "</form></td></tr>"
}
}' path="$path" script_name="$script_name" -
table_close
if [ "$action" = "edit" ]; then
header "File: $file"
echo '<p>'
if [ -f "$path/$file" ]; then
content=$(cat "$path/$file" | sed -e 's/\&/\&/g; s/</\</g; s/>/\>/g')
table_open
echo '<tr><td>'
form_open
textarea 'content' '27' '90'
echo -n "$content"
textarea_close
form_hidden_field 'file' "$file"
form_action 'editor'
echo '<br>'
form_submit 'Save'
form_close
echo '</td></tr>'
table_close
else
echo "<pre>The $path/$file file doesn't exist.</pre>"
fi