public function launch() { $filetype = getRequest('filetype', ''); $error = ''; if ($filetype == 'upload') { if ($_FILES['data']['error'] == UPLOAD_ERR_OK) { $_SESSION['import_file'] = $_FILES['data']['tmp_name'] . '-mlinvoice-import'; move_uploaded_file($_FILES['data']['tmp_name'], $_SESSION['import_file']); $this->show_setup_form(); return; } $error = $GLOBALS['locErrFileUploadFailed']; } elseif ($this->allowServerFile && $filetype == 'server_file') { if (_IMPORT_FILE_ && file_exists(_IMPORT_FILE_)) { $_SESSION['import_file'] = _IMPORT_FILE_; $this->show_setup_form(); return; } $error = $GLOBALS['locErrImportFileNotFound']; } $importMode = getRequest('import', ''); if ($importMode == 'import' || $importMode == 'preview') { $this->import_file($importMode); return; } unset($_SESSION['import_file']); $maxUploadSize = getMaxUploadSize(); $maxFileSize = fileSizeToHumanReadable($maxUploadSize); ?> <div class="form_container"> <?php if ($error) { echo "<div class=\"error\">{$error}</div>\n"; } ?> <h1><?php echo $GLOBALS['locImportFileSelection']; ?> </h1> <span id="imessage" style="display: none"></span> <span id="spinner" style="visibility: hidden"><img src="images/spinner.gif" alt=""></span> <form id="form_import" enctype="multipart/form-data" method="POST"> <input type="hidden" name="func" value="<?php echo htmlentities(getRequest('func', '')); ?> "> <input type="hidden" name="operation" value="import"> <div class="label" style="clear: both; margin-top: 10px; margin-bottom: 4px"> <input type="radio" id="ft_upload" name="filetype" value="upload" checked="checked"><label for="ft_upload"><?php printf($GLOBALS['locImportUploadFile'], $maxFileSize); ?> </label> </div> <div class="long"><input name="data" type="file"></div> <?php if ($this->allowServerFile) { ?> <div class="label" style="clear: both; margin-top: 10px"> <input type="radio" id="ft_server" name="filetype" value="server_file"><label for="ft_server"><?php echo $GLOBALS['locImportUseServerFile']; ?> </label> </div> <?php } ?> <div class="form_buttons" style="clear: both"> <input type="submit" value="<?php echo $GLOBALS['locImportNext']; ?> "> </div> </form> </div> <?php }
if (isset($row['logo_filename']) && isset($row['logo_filesize']) && isset($row['logo_filetype']) && isset($row['logo_filedata'])) { header('Content-length: ' . $row['logo_filesize']); header('Content-type: ' . $row['logo_filetype']); header('Content-Disposition: inline; filename=' . $row['logo_filename']); echo $row['logo_filedata']; } } exit; } $maxUploadSize = getMaxUploadSize(); $row = mysqli_fetch_array(mysqli_query_check('SELECT @@max_allowed_packet')); $maxPacket = $row[0]; if ($maxPacket < $maxUploadSize) { $maxFileSize = fileSizeToHumanReadable($maxPacket) . ' ' . $GLOBALS['locBaseLogoSizeDBLimited']; } else { $maxFileSize = fileSizeToHumanReadable($maxUploadSize); } echo htmlPageStart(_PAGE_TITLE_); ?> <div class="form"> <div class="message"><?php echo $messages; ?> </div> <div class="form_container ui-widget-content"> <div style="margin-bottom: 10px"> <img class="image" src="?func=view&id=<?php echo $baseId; ?> ">