Portions created by the Initial Developer are Copyright (C) 2008-2012 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ include "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; if (permission_exists('script_editor_view')) { //access granted } else { echo "access denied"; exit; } //add css and javascript require_once "header.php"; //define function recure_dir function recur_dir($dir) { clearstatcache(); $htmldirlist = ''; $htmlfilelist = ''; $dirlist = opendir($dir); $dir_array = array(); if($dirlist !== false) while (false !== ($file = readdir($dirlist))) { if ($file != "." AND $file != ".."){ $newpath = $dir.'/'.$file; $level = explode('/',$newpath); if ( substr(strtolower($newpath), -4) == ".svn" || substr(strtolower($newpath), -4) == ".git" || substr(strtolower($newpath), -3) == ".db" || substr(strtolower($newpath), -4) == ".jpg" || substr(strtolower($newpath), -4) == ".gif" || substr(strtolower($newpath), -4) == ".png" || substr(strtolower($newpath), -4) == ".ico" || substr(strtolower($newpath), -4) == ".ttf" ) { //ignore certain files (and folders) } else { $dir_array[] = $newpath; } if ($x > 1000) { break; }; $x++; } } asort($dir_array); foreach ($dir_array as $newpath){ $level = explode('/',$newpath); if (is_dir($newpath)) { $dirname = end($level); $htmldirlist .= "
\n"; $htmldirlist .= "".$dirname.""; $htmldirlist .= "
".recur_dir($newpath)."
\n"; $htmldirlist .= "
\n"; } else { $filename = end($level); $filesize = round(filesize($newpath)/1024, 2); $newpath = str_replace ('//', '/', $newpath); $newpath = str_replace ("\\", "/", $newpath); $htmlfilelist .= "
\n"; $htmlfilelist .= ""; $htmlfilelist .= "".$filename."\n"; $htmlfilelist .= "
\n"; } } closedir($dirlist); return $htmldirlist ."\n". $htmlfilelist; } echo ""; echo ""; // keyboard shortcut bindings echo "\n"; //save file key_press('ctrl+s', 'down', 'window', null, null, "parent.$('form#frm_edit').submit(); return false;", true); //open file manager/clip library pane key_press('ctrl+q', 'down', 'window', null, null, 'parent.toggle_sidebar(); parent.focus_editor(); return false;', true); //prevent backspace (browser history back) key_press('backspace', 'down', 'window', null, null, 'return false;', true); echo "\n"; echo "\n"; echo "
".$text['label-files']."
\n"; echo "
\n"; //start the session ini_set("session.cookie_httponly", True); if (!isset($_SESSION)) { session_start(); } switch ($_SESSION["app"]["edit"]["dir"]) { case 'scripts': echo recur_dir($_SESSION['switch']['scripts']['dir']); break; case 'php': echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH); break; case 'grammer': echo recur_dir($_SESSION['switch']['grammar']['dir']); break; case 'provision': switch (PHP_OS) { case "Linux": echo (file_exists('/etc/fusionpbx/resources/templates/provision')) ? recur_dir('/etc/fusionpbx/resources/templates/provision') : recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; case "FreeBSD": echo (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) ? recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/") : recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; case "NetBSD": echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; case "OpenBSD": echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; default: echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); } break; case 'xml': echo recur_dir($_SESSION['switch']['conf']['dir']); break; } echo "
\n"; require_once "footer.php"; unset ($result_count); unset ($result); unset ($key); unset ($val); unset ($c); ?>