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(); 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 .= "
".$dirname."
".recur_dir($newpath)."
\n"; } else { $filename = end($level); $filesize = round(filesize($newpath)/1024, 2); $newpath = str_replace ('//', '/', $newpath); $newpath = str_replace ("\\", "/", $newpath); $htmlfilelist .= "
".$filename."
\n"; } } closedir($dirlist); return $htmldirlist ."\n". $htmlfilelist; } echo ""; echo ""; // keyboard shortcut bindings echo "\n"; echo ""; echo "\n"; echo "\n"; echo "
"; echo "\n"; echo "\n"; echo " \n"; echo "\n"; echo "
\n"; echo "\n"; echo "
".$text['label-files']."
\n"; //start the session ini_set("session.cookie_httponly", True); session_start(); if ($_SESSION["app"]["edit"]["dir"] == "scripts") { echo recur_dir($_SESSION['switch']['scripts']['dir']); } if ($_SESSION["app"]["edit"]["dir"] == "php") { echo recur_dir($_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH); } if ($_SESSION["app"]["edit"]["dir"] == "grammar") { echo recur_dir($_SESSION['switch']['grammar']['dir']); } if ($_SESSION["app"]["edit"]["dir"] == "provision") { switch (PHP_OS) { case "Linux": if (file_exists('/etc/fusionpbx/resources/templates/provision')) { echo recur_dir('/etc/fusionpbx/resources/templates/provision'); } else { echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); } break; case "FreeBSD": //if the FreeBSD port is installed use the following paths by default. if (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) { echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); } else { echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); } break; case "NetBSD": echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; case "OpenBSD": echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); break; default: echo recur_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"); } } if ($_SESSION["app"]["edit"]["dir"] == "xml") { echo recur_dir($_SESSION['switch']['conf']['dir']); } echo "
\n"; echo "
\n"; echo "
"; require_once "footer.php"; unset ($result_count); unset ($result); unset ($key); unset ($val); unset ($c); ?>