Esempio n. 1
0
<?php

define('ROOT_PATH', '');
require_once ROOT_PATH . 'functions.php';
restrictAccess('a');
//xuca
if (posted("directory")) {
    $directory = $_POST["directory"];
    if (is_dir($directory)) {
        require_class("fileToStr", "qParser");
        $f = new fileToStr();
        $qp = new qParser();
        echo "Processing directory {$directory}:<br>";
        foreach (glob($directory . '/*.*') as $file) {
            echo " " . $file . " parsed:<br><textarea>" . $qp->parse($f->convert($file, $file)) . "</textarea><br><br>";
            ob_flush();
            flush();
        }
    } else {
        echo "{$directory} is not a valid directory.";
    }
}
?>
<form action="bulk_file_process.php" method="POST">
<b>Add All Files From Directory:</b>
<input type="text" name="directory"/>
</form>
Esempio n. 2
0
         $err = "Error: " . $e->getMessage();
     }
     if ($err == '') {
         echo "Questions entered successfully, with Question-IDs <b>" . arrayToRanges($q->getQIDs()) . "</b><br><br><br>";
     } else {
         echo $err;
     }
 } else {
     require_class("qIO", "qParser");
     $qp = new qParser();
     $error = false;
     if (posted("copypaste")) {
         $unparsed = $qp->parse($_POST["copypaste"]);
     } elseif (filed("fileupload")) {
         require_class("fileToStr");
         $fs = new fileToStr();
         if (is_array($_FILES["fileupload"]["tmp_name"])) {
             //for multiple-supporting browsers
             foreach ($_FILES["fileupload"]["tmp_name"] as $ind => $tmp_name) {
                 $name = $_FILES["fileupload"]["name"][$ind];
                 echo "File <b>{$name}</b>: ";
                 if ($name == '' || $tmp_name == '') {
                     echo "No file.";
                 } else {
                     $unparsed .= $qp->parse($fs->convert($name, $tmp_name));
                 }
                 echo "<br>";
             }
         } else {
             $unparsed = $qp->parse($fs->convert($_FILES["fileupload"]["name"], $_FILES["fileupload"]["tmp_name"]));
         }