Esempio n. 1
0
$backUrl = documentBackLink($uploadPath);

if ($can_upload) {
    $navigation[] = array('url' => $backUrl, 'name' => $pageName);
    $pendingCloudUpload = CloudDriveManager::getFileUploadPending();

    if ($pendingCloudUpload) {
        $group_hidden_input .= "<input type='hidden' name='ext' value='true'>";
        $pageName = $langDownloadFile;
        $fileinput = "
        <div class='form-group'>
          <label for='fileCloudName' class='col-sm-2 control-label'>$langCloudFile</label>
          <div class='col-sm-10'>
            <input type='hidden' class='form-control' id='fileCloudInfo' name='fileCloudInfo' value='".q($pendingCloudUpload)."'>
            <input type='text' class='form-control' name='fileCloudName' value='" . q(CloudFile::fromJSON($pendingCloudUpload)->name()) . "' readonly>
          </div>
        </div>";
    } else if (isset($_GET['ext'])) {
        $group_hidden_input .= "<input type='hidden' name='ext' value='true'>";
        $pageName = $langExternalFile;
        $fileinput = "
        <div class='form-group'>
          <label for='fileURL' class='col-sm-2 control-label'>$langExternalFileInfo:</label>
          <div class='col-sm-10'>
            <input type='text' class='form-control' id='fileURL' name='fileURL'>
          </div>
        </div>";
    } else {
        $pageName = $langDownloadFile;
        $fileinput = "
Esempio n. 2
0
        $result = Database::get()->querySingle("SELECT id FROM document
                        WHERE $group_sql AND path = ?s LIMIT 1", $uploadPath);
        if (!$result or !$result->id) {
            $error = $langImpossible;
        }
    }

    /* ******************************************************************** *
      UPLOAD FILE
     * ******************************************************************** */

    $action_message = $dialogBox = '';
    $extra_path = '';
    if (isset($_POST['fileCloudInfo']) or isset($_FILES['userFile'])) {
        if (isset($_POST['fileCloudInfo'])) { // upload cloud file
            $cloudfile = CloudFile::fromJSON($_POST['fileCloudInfo']);
            $uploaded = true;
            $fileName = $cloudfile->name();
        } else if (isset($_FILES['userFile']) and is_uploaded_file($_FILES['userFile']['tmp_name'])) { // upload local file
            $fileName = $_FILES['userFile']['name'];     
            $userFile = $_FILES['userFile']['tmp_name'];
        }
        validateUploadedFile($fileName, $menuTypeID); // check file type
        // check for disk quotas
        if ($diskUsed + @$_FILES['userFile']['size'] > $diskQuotaDocument) {
            Session::Messages($langNoSpace, 'alert-danger');
            redirect_to_current_dir();
        } elseif (isset($_POST['uncompress']) and $_POST['uncompress'] == 1 and preg_match('/\.zip$/i', $fileName)) {
            /* ** Unzipping stage ** */            
            $zipFile = new pclZip($userFile);
            validateUploadedZipFile($zipFile->listContent(), $menuTypeID);