Portions created by the Initial Developer are Copyright (C) 2008-2023 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane James Rose */ //includes files require_once dirname(__DIR__, 2) . "/resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('edit_view')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support $language = new text; $text = $language->get(); //include require_once "header.php"; //define function recure_dir function recur_dir($dir) { clearstatcache(); $htmldirlist = ''; $htmlfilelist = ''; $dirlist = opendir($dir); $dir_array = array(); if($dirlist !== false) { $x = 0; 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); $newpath = str_replace ('//', '/', $newpath); $htmldirlist .= "
".$dirname."
".recur_dir($newpath)."
\n"; } else { $filename = end($level); $filesize = round(filesize($newpath)/1024, 2); $newpath = str_replace ('//', '/', $newpath); $newpath = str_replace ("\\", "/", $newpath); $newpath = str_replace ($filename, '', $newpath); $htmlfilelist .= "
".$filename."
\n"; } } closedir($dirlist); return $htmldirlist ."\n". $htmlfilelist; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; if (!isset($_SESSION)) { session_start(); } //get the directory if (!isset($_SESSION)) { session_start(); } switch ($_SESSION["app"]["edit"]["dir"]) { case 'scripts': $edit_directory = $_SESSION['switch']['scripts']['dir']; break; case 'php': $edit_directory = $_SERVER["DOCUMENT_ROOT"].'/'.PROJECT_PATH; break; case 'grammar': $edit_directory = $_SESSION['switch']['grammar']['dir']; break; case 'provision': switch (PHP_OS) { case "Linux": if (file_exists('/usr/share/fusionpbx/templates/provision')) { $edit_directory = '/usr/share/fusionpbx/templates/provision'; } elseif (file_exists('/etc/fusionpbx/resources/templates/provision')) { $edit_directory = '/etc/fusionpbx/resources/templates/provision'; } else { $edit_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision"; } break; case "FreeBSD": if (file_exists('/usr/local/share/fusionpbx/templates/provision')) { $edit_directory = '/usr/share/fusionpbx/templates/provision'; } elseif (file_exists('/usr/local/etc/fusionpbx/resources/templates/provision')) { $edit_directory = '/usr/local/etc/fusionpbx/resources/templates/provision'; } else { $edit_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision"; } break; case "NetBSD": if (file_exists('/usr/local/share/fusionpbx/templates/provision')) { $edit_directory = '/usr/share/fusionpbx/templates/provision'; } else { $edit_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision"; } break; case "OpenBSD": if (file_exists('/usr/local/share/fusionpbx/templates/provision')) { $edit_directory = '/usr/share/fusionpbx/templates/provision'; } else { $edit_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision"; } break; default: $edit_directory = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/resources/templates/provision/"; } break; case 'xml': $edit_directory = $_SESSION['switch']['conf']['dir']; break; } if (file_exists($edit_directory)) { echo recur_dir($edit_directory); } echo "
\n"; require_once "footer.php";