File "arbo_test06.php"

Full Path: /home/analogde/www/Design/fileman/Fusion/arbo_test06.php
File size: 28.15 KB
MIME-type: text/x-php
Charset: utf-8

<?php

    session_start();

    echo " +++++++ "  .getcwd();
    echo "<br>";
    echo "<br>";
    echo "<br>";

    echo "http://" . $_SERVER['SERVER_NAME'] ."  ++++++    " .$_SERVER['REQUEST_URI']; 
    echo "<br>";
    echo "<br>";
    echo "<br>";


    //home/analogde/www/Fusion/POO

    $highlightjs_style = 'vs';
    define('FM_HIGHLIGHTJS_STYLE', $highlightjs_style);
?>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/<?php echo FM_HIGHLIGHTJS_STYLE ?>.min.css">

<?php
   // echo 'Referrer is ' . $_SERVER['HTTP_REFERER'] . '<br>';
  
  /* function goback()
{
	header("Location: {$_SERVER['HTTP_REFERER']}");
	//exit;
}

goback();*/

    ///$_SERVER['HTTP_REFERER']
    // https://www.tutorialspoint.com/how-to-stop-browser-s-back-button-using-javascript
    // How to Disable Browser Back Button using JavaScript

    $file = "pipo.html";
    $file = "GANTT";

    $file = $_SERVER['DOCUMENT_ROOT'] ."/Fusion/GANTT";
   if(is_dir($file)) {
  echo ("$file is a directory");
} else {
  echo ("$file is not a directory");
}

$file = $_SERVER['DOCUMENT_ROOT'] ."/Fusion/pipo.html";
if(is_file($file)) {
echo ("$file is a file");
} else {
echo ("$file is not a file");
}

    $root_path = $_SERVER['DOCUMENT_ROOT'];
    $dirReference = $root_path ."/Fusion";


?>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>


<style type="text/css">
    .tbl {width: 640px;}
    .tbl tr {background-color: Blue; height: 24px}
    .tbl tr:hover {background-color: Red;}
</style>



<style>

tr:hover {
          background-color: #ffff99;
        }

 .selected {
    background-color: #E30B5C;
}      

.noselected {
    background-color: #5555;
}    

.newRow
{
  color: #dd0000;
  background-color:#ffd700;
}

.blankcell {
    background: none!important; 
    border: none!important;
}



    .aligned {
      display: flex;
      align-items: center;
    }
    .aligned > img {
      margin-right: 10px;
    }

  
    a { text-decoration: none; }
 
</style>

<script type="text/javascript"> 

function disableBack()
{ window.history.forward(); }
//setTimeout("disableBack()", 0);
//window.onunload = function () { null };

  
        // JavaScript Code to Highlight any 
        // row in the given table. 
 /*       document.getElementById('table_to_highlight') 
            .addEventListener('click', function (item) { 
  
                // To get tr tag  
                // In the row where we click 
                var row = item.path[1]; 
  
                var row_value = ""; 
  
                for (var j = 0; j < row.cells.length; j++) { 
  
                    row_value += row.cells[j].innerHTML; 
                    row_value += " | "; 
                } 
  
                alert(row_value); 
  
                // Toggle the highlight 
                if (row.classList.contains('highlight')) 
                    row.classList.remove('highlight'); 
                else 
                    row.classList.add('highlight'); 
            }); 
        */    
    </script> 

<script>



function toggle(source) 
{ 
    
            let checkboxes = document.querySelectorAll('input[type="checkbox"]'); 
            for (let i = 1; i < checkboxes.length; i++) 
            { 
                if (checkboxes[i] != source) 
                {
                    checkboxes[i].checked = source.checked; 
                   // document.getElementById("table_to_highlight").rows[i].style.background = selected;
                   // document.getElementById('t2').style.backgroundColor=color3;

                    //x[i].innerHTML = "NEW CONTENT";
                   
                }    
            } 

            
            selectedRow();
} 

function plouf(element)
{
    //alert("Bingo...");

    //var x = document.getElementById("table_to_highlight").rows[element].cells;
    //                x.className = "newRow";
    //                console.log(x);

    /*if(  element.style == "selected")
    {
        element.classList.toggle("noselected");
        alert("annule");
    }
    else 
    {
                     element.classList.toggle("selected");
                     alert("flash");
    }  */               

    element.classList.toggle("selected");
}


function selectedRow(){
                
                var index,
                table = document.getElementById("table_to_highlight");
            
                for(var i = 1; i < table.rows.length; i++)
                {
                    //table.rows[i].onclick = function()
                    //{
                         // remove the background from the previous selected row
                        //if(typeof index !== "undefined"){
                        //   table.rows[index].classList.toggle("selected");
                        //}
                        //console.log(typeof index);
                        // get the selected row index
                        var index = this.rowIndex;
                        // add class selected to the row
                        //console.log("message....");
                        //this.classList.toggle("selected");
                        //console.log(typeof index);

                        table.rows[i].classList.toggle("selected");
                     //};
                }
                
            }
function test_checkbox()
{

    console.log(" Au total : " + document.querySelectorAll('input[type="checkbox"]').length);

    let checkboxes = document.querySelectorAll('input[type="checkbox"]'); 

    console.log(checkboxes);

    for(var i=0, n=checkboxes.length;i<n;i++)
    {
        //checkboxes[i].checked = source.checked;
        if (checkboxes[i].checked == true)
        {
            console.log( i + "  " + checkboxes[i] + " OK " );
        }
        else
        {
            console.log( i + "  " + checkboxes[i] + " No " );   
        }

    }

    const checked = document.querySelectorAll('input[type="checkbox"]:checked')
    let selected = [];
    selected = Array.from(checked).map(x => x.value)

    console.log(" +++++ " + selected);

    /*var item = document.getElementById("ck1");
    if (item.checked == true)
    {
        console.log(" +++++ " + document.getElementById("ck1").value);
    }    */

}

function tutu()
{
    let checkboxes = document.querySelectorAll('input[type="checkbox"]'); 
    //let nb = checkboxes.length;

    selection_elements = [];

    for(var i=1 ; i<checkboxes.length ;i++)
    {
        let numerotation = "CK" + i;
        console.log(" ***** " + numerotation);
        var obj = document.getElementById(numerotation);  

        if (obj.checked == true )
        {
            var contenu = document.getElementById(numerotation).value;
            console.log(" Selection ---->>>> " + contenu);
            selection_elements.push(contenu);
            //console.log("\n");
        }
    }    

    /* const jsonContent = JSON.stringify(selection_elements);

    const fs = require("fs");

    fs.writeFile("./alphabet.json", jsonContent, 'utf8', function (err)
    {
        if (err)
        {
            return console.log(err);
        }

        console.log("The file was saved!");
    }); */

    /*$.ajax({
        url: "titi.php",
        type: "POST",
        dataType: 'json',
        data: JSON.stringify(selection_elements),
        success: function(response){}

       });
    */
    var tab1 = new Array();
					
	tab1.push("champ_date");
	tab1.push("champ_valeur");   

    xmlhttp = new XMLHttpRequest();
	var JsonString = JSON.stringify(tab1);

    var aze = "+";

	//xmlhttp.onreadystatechange = respond;
	xmlhttp.open("POST", "titi.php", true);
	xmlhttp.send(JsonString);

}
</script>

<?php

/*************************** ACTIONS ***************************/

   
    echo "ZZZZZZZZZZZZZZZZZZOULOUUUUUUUUUUUUUUUUUU";
    echo "<br>";
    echo "<br>";


    $tableau_fichiers = array(); 
    $tableau_repertoires = array(); 

    $root_path = $_SERVER['DOCUMENT_ROOT'];

    //$path = getcwd();
    //echo " +++ " .$path ."<br>";
    //$aaa =  removeLastDir($path, 1);
    //echo " +++ " .$aaa ."<br>";

    $dirReference = $root_path ."/Fusion";
    echo "Reference " .$dirReference ."<br>";

    if (isset($_GET['pipo'])) 
    {

        // que contient  $_GET['pipo'] ?

          

        if ($_GET['pipo'] != "..")
        {
            $dirPath =  $_SESSION['dirpath'] ."/" .$_GET['pipo'];

            if( is_dir($dirPath))
            {
                echo "<br>";
                echo " Folder >>>> " . $dirPath;
                echo "<br>";

                $_SESSION['dirpath'] = $dirPath;
                if( $dirReference != $dirPath  )
                {
                    echo "==> " .$_SESSION['dirpath'] ."<br>";
                    // on doit rajouter le double point ( retour en arriére)
                    $obj = new fileObject();
                    $obj->setName("..");
                    $obj->setType('folder');
                    $tableau_repertoires[] = $obj;
                }
            }
            else
            {
                //is_file($dirPath)
                $file_path =  $_SESSION['dirpath'] ."/" .$_GET['pipo'];
                echo "<br>";
                echo " File ------->>>> " . $file_path;
                echo "<br>";

               // analyse($file_path);
                
            }    
        }

        else
        {
            //if(is_dir($_GET['pipo'])) 
            //{
              
                echo "Zoulou " .$_SESSION['dirpath'] ."<br>";
                //echo " <== " .$dirPath ."<br>";
                $chunks = explode('/',  $_SESSION['dirpath']);

                //echo "<pre>";
                //print_r($chunks);
                //echo "</pre>";

                //$toto = array_shift($chunks);
        
                for($i=0; $i< count($chunks)-1 ; $i++)
                {
                    $dirPath .= "/" .$chunks[$i];
                }

                $dirPath = substr($dirPath, 1); 

                $_SESSION['dirpath'] = $dirPath;
                echo "<== " .$_SESSION['dirpath'] ."<br>"; 
                //echo " <== " .$_SESSION['dirpath'] ."<br>";

                if( $dirReference != $dirPath  )
                {
                    //echo "<== " .$_SESSION['dirpath'] ."<br>";
                    // on doit rajouter le double point ( retour en arriére)
                    $obj = new fileObject();
                    $obj->setName("..");
                    $obj->setType('folder');
                    $tableau_repertoires[] = $obj;
                }
            //}
            //else
            //{
            //    echo "Il s'agit d'un fichier !!!!";
            //    echo "<br>";
            //}    

        }

       // echo dirname($path,2)

        //chdir('/var/www/');
        //echo realpath('./../../etc/passwd') . PHP_EOL;
        // dirname
        // basename
    }
    else
    {
        // initialisation
        $dirPath = $root_path ."/Fusion";
        $_SESSION['dirpath'] = $dirPath;
        echo "Current start " .$_SESSION['dirpath'] ."<br>";
    }


/*********************************************************************************/    
/*********************************************************************************/    

/*********************************************************************************/    
/*********************************************************************************/

    $visualisation_flag = false;

    if (isset($_GET['typefile'])) 
    {
        if( $_GET['typefile'] == "file" )
        {

            $str_to_be_replaced = "/home/analogde/www";
            $tmp = str_replace(  $str_to_be_replaced, $_SERVER['SERVER_NAME'] , $dirPath);
            $chemin = "http://" .$tmp;

            echo "Chemin du fichier ..." .$chemin;
            echo "<br>";
            echo "<br>";

            $ext = strtolower(pathinfo($chemin, PATHINFO_EXTENSION));
            echo "<br>";
            echo $ext;
            echo "<br>";
            $mime_type = get_mime_type($chemin);
            echo  $mime_type;
            echo "<br>";
?>
            <b><a href="?p=<?php echo urlencode(FM_PATH) ?>"><i class="icon-goback"></i> Back</a></b>
<?php

            if(in_array($ext, get_office_exts()) ) 
            {

                echo " Office element";
                echo "<br>";
                echo "<br>";
                
                //echo '<iframe src="https://docs.google.com/viewer?embedded=true&hl=en&url=' . $chemin . '" frameborder="no" style="width:100%;min-height:460px"></iframe>';
       
                // OK    
                //echo '   <div class="viewer doc"> ';
                //echo  ' <iframe src="//docs.google.com/viewer?embedded=true&url=http://www.snee.com/xml/xslt/sample.doc" width="600" height="780" scrolling="no" style="border: none;">
                //        </iframe>';
                //echo '</div>';    
                
                echo '   <div class="viewer doc"> ';
                echo  ' <iframe src="//docs.google.com/viewer?embedded=true&url=https://analog-design.net/Fusion/Doc2.doc" width="600" height="780" scrolling="no" style="border: none;">
                        </iframe>';
                echo '</div>';   

                   /*     echo  ' <iframe src="//docs.google.com/viewer?embedded=true&url=' .$chemin   .' width="600" height="780" scrolling="no" style="border: none;">
                            </iframe>';*/

            }

            if($ext == "pdf")
            {
                $pdfData = displayPdfFromUrl($chemin);

                $base64 = base64_encode($pdfData);
              
                echo '<iframe src="data:application/pdf;base64,' .$base64 .' " width="100%" height="600"></iframe>';
              
            }

            if(in_array($ext, get_text_exts()) ) 
            {    
                

                $is_text = true;
                $content = file_get_contents($file_path);
                //echo '<textarea class="numbered" readonly style="resize:none;" rows="4" cols="50" width="400px" height="400px">' . htmlspecialchars($content). '</textarea>';
                $hljs_class = 'lang-' . $ext;
                $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . fm_enc($content) . '</code></pre>';
                echo $content;
                $visualisation_flag = true;
            }    

        }
}



/*********************************************************************************/    
/*********************************************************************************/    

    //echo " TRACE " .$dirPath ."<br>";

class fileObject
{

    public $name;
    public $type;
    public $extension;
    public $size;

    // Methodes
    function setName($name) 
    {
        $this->name = $name;
    }
    function getName() 
    {
        return $this->name;
    }
    function setType($type) 
    {
        $this->type = $type;
    }
    function getType() 
    {
        return $this->type;
    }
    function setSize($size) 
    {
        $this->size = $size;
    }
    function getSize() 
    {
        return $this->size;
    }

    function setExtension($extension) 
    {
        $this->extension = $extension;
    }
    function getExtension() 
    {
        return $this->extension;
    }
}

    /**** Répertoire exploré ****/
    echo "Search ....... " .$dirPath ."<br>";

    // 
    echo "http://" . $_SERVER['SERVER_NAME'] ."  ++++++    " .$_SERVER['REQUEST_URI']; 
    echo "<br>";
    echo "<br>";
    echo "<br>";

    // dans $dirPath on va remplacer la chaine $str_to_be_replaced par $_SERVER['SERVER_NAME']
    $str_to_be_replaced = "/home/analogde/www";

    $n = str_replace(  $str_to_be_replaced, $_SERVER['SERVER_NAME'] , $dirPath);

    $n = "http://" .$n;

    echo "Changement "  .$n;
    echo "<br>";
    echo "<br>";
    echo "<br>";


    $tableau_content = array(); 

   

    $dir = $dirPath;
    $directories = array();
    $files_list  = array();
    $files = scandir($dir);
    foreach($files as $file)
    {
        if(($file != '.') && ($file != '..'))
        {
            $obj = new fileObject();
            $obj->setName($file);

            if(is_dir($dir.'/'.$file))
            {
                $directories[]  = $file;
                $obj->setType('folder');
                $obj->setExtension("None");    
                $tableau_repertoires[] = $obj;
                //echo " ---- " .$file . " folder" ."<br>";
            }
            else
            {
                $files_list[]    = $file;
                $obj->setType('file');
                $tableau_fichiers[] = $obj;
                $obj->setSize( get_filesize(filesize( $dirPath ."/" .$file)) );
                $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
                $obj->setExtension($extension);    
            }

            $tableau_content[] = $obj;
        }
    }

                
    $tableau_concatenate = array_merge( $tableau_repertoires, $tableau_fichiers);

    //echo "<pre>";
    //echo var_dump($tableau_concatenate);
    //echo "<pre>";

    echo "<br>";
    echo "<br>";

    if( $visualisation_flag == false )
    {
            echo "<table id='table_to_highlight' border=1 cellpadding=5 cellspacing=0 class=whitelinks>";
            // la classe bloque les highlight sur la ligne des titres (header)
            echo "<tr class='blankcell'>";
            echo "<th><input type='checkbox' onclick='toggle(this);'></th>"; 
            echo "<th>Filename</th>";
            echo "<th>Filetype</th><th>Filesize</th>";
            echo "</tr>";
    
            for($index=0; $index < count($tableau_concatenate); $index++)
            {
                //if (substr("$dirArray[$index]", 0, 1) != ".")
                //{ // don't list hidden files
		        //print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");
		        // il faut faire la différence entre un répertoire et un fichier !!! 

                $numerotation = $index + 1;    
                $champ = "CK" .$numerotation;     

                $blase =  $tableau_concatenate[$index]->getName();
                //$blase = $blase . " +++ ";    
                echo " <tr onclick='plouf(this)'>";

                echo "<td>";
                echo "<input type='checkbox'  id='$champ' value = '$blase'  >";
                // onclick='abc()'
                echo "</td>";

                $typeFile = $tableau_concatenate[$index]->getType();

                if( $typeFile == "folder")
                {
                    $icon = "folder-icon.png";   
                }
                if( $typeFile == "file")
                {
                    $ext = $tableau_concatenate[$index]->getExtension();

                    if( $ext == "docx")
                    {
                        $icon = "docx-icon.png";   
                    }
                    else if( $ext == "pptx")
                    {
                        $icon = "pptx-icon.png";   
                    } 
                    else if( $ext == "xlsx")
                    {
                        $icon = "xlsx-icon.png";   
                    } 
                    else if( $ext == "pdf")
                    {
                        $icon = "pdf-icon.png";   
                    } 
                    else if( $ext == "gif"  ) 
                    {
                        $icon = "gif-icon.png";   
                    } 
                    else if( $ext == "bmp"  ) 
                    {
                        $icon = "bmp-icon.png";   
                    } 
                    else if( $ext == "png"  ) 
                    {
                        $icon = "png-icon.png";   
                    } 
                    else if( $ext == "jpg"  || $ext == "jpeg" )
                    {
                        $icon = "jpg-icon.png";   
                    } 
                    else if( $ext == "html" || $ext == "htm"  ) 
                    {
                        $icon = "html-icon.png";   
                    } 
                    else if( $ext == "php"  ) 
                    {
                        $icon = "php-icon.png";   
                    } 
                    else if( $ext == "css"  ) 
                    {
                        $icon = "css-icon.png";   
                    } 
                    else if( $ext == "js"  ) 
                    {
                        $icon = "javascript-icon.png";   
                    } 
                    else if( $ext == "py"  ) 
                    {
                        $icon = "python-icon.png";   
                    } 
                    else if( $ext == "zip"  ) 
                    {
                        $icon = "zip-icon.png";   
                    } 
                    // par défaut
                    else
                    {
                        $icon = "text-icon.png";  
                    }    
                }

                echo "<td>";
                echo "<div class=\"aligned\">";
                //echo "<img src=\"folder-icon.png\" width='24' height='24'><a href=\"arbo_test05.php?pipo=$blase&typefile=$typeFile\">$blase</a>";
                echo "<img src=\"$icon\" width='24' height='24'><a href=\"arbo_test06.php?pipo=$blase&typefile=$typeFile\">$blase</a>";
        
                //$filelink = '?p=' . urlencode(FM_PATH) . '&view=' . urlencode($f);

                echo "</div>";
                echo "</td>";

                echo "<td>";
                echo $tableau_concatenate[$index]->getType();
		        echo "</td>";

                if( $tableau_concatenate[$index]->getName() != "..")
                {
                    print("<td>");
                    echo $tableau_concatenate[$index]->getSize();
		            print("</td>");
                }
                else
                {
                    echo "<td>";
                    echo "";
		            echo "</td>";
                }

                echo "</tr>";
	    
            }

            echo "</table>\n";
    

            echo "<br>";
            echo "<br>";

            echo "<input type='button' id='btn_selection' onclick='test_checkbox()' value='Validation'>";

            echo "<br>";
            echo "<br>";

            echo "<input type='button' id='test' onclick='tutu()' value='Check'>";
    }

function listing()   
{
    $dir = $dirPath;
    $directories = array();
    $files_list  = array();
    $files = scandir($dir);
    foreach($files as $file)
    {
        if(($file != '.') && ($file != '..'))
        {
            if(is_dir($dir.'/'.$file))
            {
                $directories[]  = $file;
            }
            else
            {
                $files_list[]    = $file;
            }
        }
    }

    foreach($directories as $directory)
    {
        echo '<li class="folder">'.$directory.'</li>';
    }

    echo "<br>";
    echo "<br>";
    echo "<br>";

    foreach($files_list as $file_list)
    {
        echo '<li class="file">'.$file_list.'</li>';
    }

}

function get_filesize($size)
{
    if ($size < 1000) {
        return sprintf('%s B', $size);
    } elseif (($size / 1024) < 1000) {
        return sprintf('%s KiB', round(($size / 1024), 2));
    } elseif (($size / 1024 / 1024) < 1000) {
        return sprintf('%s MiB', round(($size / 1024 / 1024), 2));
    } elseif (($size / 1024 / 1024 / 1024) < 1000) {
        return sprintf('%s GiB', round(($size / 1024 / 1024 / 1024), 2));
    } else {
        return sprintf('%s TiB', round(($size / 1024 / 1024 / 1024 / 1024), 2));
    }
}

function removeLastDir($path, $level)
{
    if (is_int($level) && $level > 0) {
        $path = preg_replace('#\/[^/]*$#', '', $path);

        return $this->removeLastDir($path, (int)$level - 1);
    }

    return $path;
}

function analyse($file_path)
{

    $ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
    echo "<br>";
    echo $ext;
    echo "<br>";
    $mime_type = get_mime_type($file_path);
    echo  $mime_type;
    echo "<br>";

    $is_zip = false;
    $is_image = false;
    $is_audio = false;
    $is_video = false;
    $is_text = false;

    if (in_array($ext, get_image_exts()))
     {
        $is_image = true;
        $view_title = 'Image';
        echo $is_image ." " .$view_title;

        //$image = 'http://www.google.com/doodle4google/images/d4g_logo_global.jpg';
        $imageData = base64_encode(file_get_contents($file_path));
        echo '<img src="data:image/jpeg;base64,'.$imageData.'">';

        // header('Content-type: image/jpeg');
        //echo file_get_contents($file_path);

        //header('Content-Type: image/jpeg');
        //readfile($file_path);

    }
    if(in_array($ext, get_text_exts()) ) //|| substr($mime_type, 0, 4) == 'text' || in_array($mime_type, fm_get_text_mimes())) {
    {    $is_text = true;
         $content = file_get_contents($file_path);

       echo '<textarea class="numbered" readonly style="resize:none;" rows="4" cols="50" width="400px" height="400px">' . htmlspecialchars($content). '</textarea>';

       $content = '<pre class="with-hljs"><code class="' . $hljs_class . '">' . $content . '</code></pre>';

        echo $content;
        

    }    

    footer();

    exit();

}

function get_mime_type($file_path)
{
    if (function_exists('finfo_open')) 
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $mime = finfo_file($finfo, $file_path);
        finfo_close($finfo);
        return $mime;
    } 
    elseif (function_exists('mime_content_type')) 
    {
        return mime_content_type($file_path);
    } 
    elseif (!stristr(ini_get('disable_functions'), 'shell_exec')) 
    {
        $file = escapeshellarg($file_path);
        $mime = shell_exec('file -bi ' . $file);
        return $mime;
    } 
    else 
    {
        return '--';
    }
}

function get_image_exts()
{
    return array('ico', 'gif', 'jpg', 'jpeg', 'jpc', 'jp2', 'jpx', 'xbm', 'wbmp', 'png', 'bmp', 'tif', 'tiff', 'psd');
}

function get_text_exts()
{
    return array(
        'txt', 'css', 'ini', 'conf', 'log', 'htaccess', 'passwd', 'ftpquota', 'sql', 'js', 'json', 'sh', 'config',
        'php', 'php4', 'php5', 'phps', 'phtml', 'htm', 'html', 'shtml', 'xhtml', 'xml', 'xsl', 'm3u', 'm3u8', 'pls', 'cue',
        'eml', 'msg', 'csv', 'bat', 'twig', 'tpl', 'md', 'gitignore', 'less', 'sass', 'scss', 'c', 'cpp', 'cs', 'py',
        'map', 'lock', 'dtd', 'svg',
    );
}

function get_office_exts()
{
    return array(   'doc', 'docx', 'xls', 'xlsx', "ppt", "pptx"  );
}

function displayPdfFromUrl($url) {
    // Initialize cURL session
    $ch = curl_init();
  
    // Set cURL options
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
    // Execute cURL request
    $data = curl_exec($ch);
  
    // Close cURL session
    curl_close($ch);
  
    // Return PDF file content
    return $data;
  }


function footer()
{
?>    
<p class="center"><small><a href="https://github.com/alexantr/filemanager" target="_blank">PHP File Manager</a></small></p>
</div>

<?php
   

}

function fm_enc($text)
{
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
}
?>


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Patoche</title>

<style>
  
  code,pre{display:block;margin-bottom:10px;font:13px/16px Consolas,'Courier New',Courier,monospace;border:1px dashed #ccc;padding:5px;overflow:auto}
pre.with-hljs{padding:0}
pre.with-hljs code{margin:0;border:0;overflow:visible}

</style>    


</head>
<body>
<div id="wrapper">
</body>    
</html>