Move public files to /public subdirectory
phpcs-errors:221 phpunit-status:successful phpstan-errors:0
This commit is contained in:
parent
00f1c4f423
commit
d56601b0cc
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
@ -5,7 +5,7 @@
|
|||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
|
@ -31,7 +31,7 @@ if (!empty($_POST) and !empty($_POST['selectedFields'])) {
|
|||
}
|
||||
else $selectionActive = false;
|
||||
|
||||
require __DIR__ . "/values/availableFields.php";
|
||||
require __DIR__ . "/../values/availableFields.php";
|
||||
|
||||
$line1 = $line2 = $line3 = $line4 = [];
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
|
@ -57,7 +57,7 @@ echo '
|
|||
</div>
|
||||
';
|
||||
|
||||
require __DIR__ . "/values/availableFields.php";
|
||||
require __DIR__ . "/../values/availableFields.php";
|
||||
|
||||
$tooltips = [];
|
||||
foreach ($availableFields as $headline => $fields) {
|
|
@ -1,6 +1,6 @@
|
|||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
|
@ -21,11 +21,11 @@ else if (!isset($_SESSION['lang'])) {
|
|||
$lang = $_SESSION['lang'];
|
||||
|
||||
$filename = $_GET['fnam'];
|
||||
$csv_datei = 'csv/' . $filename;
|
||||
$csv_datei = MD_STD::realpath(__DIR__ . '/../csv/' . $filename);
|
||||
|
||||
// Get allowed values * $fieldNoMultiplicator
|
||||
$fieldNoMultiplicator = 10;
|
||||
require __DIR__ . "/values/availableFields.php";
|
||||
require __DIR__ . "/../values/availableFields.php";
|
||||
|
||||
$allowed = $eventpart = $eventpartsure = $fieldsWithDependency = $fieldsWithAllowedValueSet = [];
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
|
@ -24,14 +24,10 @@ if (empty($filename = trim($_GET['fnam'], " ,./"))) {
|
|||
echo "Error: Invalid file name";
|
||||
exit;
|
||||
}
|
||||
$csv_datei = __DIR__ . '/csv/' . $filename;
|
||||
if (!file_exists($csv_datei)) {
|
||||
echo "Error: The CSV file does not exist.";
|
||||
exit;
|
||||
}
|
||||
$csv_datei = MD_STD::realpath(__DIR__ . '/../csv/' . $filename);
|
||||
|
||||
if (is_dir(__DIR__ . "/xml")) rrmdir(__DIR__ . '/xml');
|
||||
mkdir(__DIR__ . "/xml", 0755);
|
||||
if (is_dir(__DIR__ . "/../xml")) rrmdir(__DIR__ . '/../xml');
|
||||
mkdir(__DIR__ . "/../xml", 0755);
|
||||
|
||||
if (!($fp = fopen($csv_datei, 'r'))) {
|
||||
throw new MDmainEntityNotExistentException("Failed opening file");
|
|
@ -1,8 +1,8 @@
|
|||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
$target = "csv/" . basename($_FILES['uploaded']['name']);
|
||||
$target = __DIR__ . "/../csv/" . basename($_FILES['uploaded']['name']);
|
||||
$targetpart = basename($_FILES['uploaded']['name']);
|
||||
|
||||
if (session_status() != PHP_SESSION_ACTIVE) {
|
|
@ -1,10 +1,9 @@
|
|||
<?PHP
|
||||
require_once "inc/zip.php";
|
||||
|
||||
require_once __DIR__ . "/functions/functions.php";
|
||||
require_once __DIR__ . "/../inc/zip.php";
|
||||
require_once __DIR__ . "/../functions/functions.php";
|
||||
|
||||
$fileTime = date("D, d M Y H:i:s T");
|
||||
$fileDir = 'xml/';
|
||||
$fileDir = __DIR__ . '/../xml/';
|
||||
|
||||
$zip = new Zip();
|
||||
//$zip->setComment("Example Zip file.\nCreated on " . date('l jS \of F Y h:i:s A'));
|
||||
|
@ -40,5 +39,5 @@ header("Content-Transfer-Encoding: binary");
|
|||
header("Content-Length: " . $length);
|
||||
echo $zipData;
|
||||
|
||||
rrmdir(__DIR__ . '/xml');
|
||||
rrmdir(__DIR__ . '/../xml');
|
||||
|
33
tests/csvTest.php
Normal file
33
tests/csvTest.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?PHP
|
||||
/**
|
||||
* This script contains tests for the home page.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@jrenslin.de>
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
|
||||
// phpcs:disable
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test class for the start page.
|
||||
*/
|
||||
final class CsvTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test for HTML output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testHTMLOutput():void {
|
||||
|
||||
include __DIR__ . "/../public/csv.php";
|
||||
$output = $this->getActualOutput();
|
||||
|
||||
self::assertIsString($output);
|
||||
ob_clean();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -10,18 +10,22 @@ declare(strict_types=1);
|
|||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Test class for the start page.
|
||||
*/
|
||||
final class StartPageTest extends TestCase {
|
||||
|
||||
/**
|
||||
* Test for HTML output.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testHTMLOutput():void {
|
||||
|
||||
include __DIR__ . "/../index.php";
|
||||
include __DIR__ . "/../public/index.php";
|
||||
$output = $this->getActualOutput();
|
||||
|
||||
self::assertEquals(
|
||||
true,
|
||||
is_string($output)
|
||||
);
|
||||
|
||||
self::assertIsString($output);
|
||||
ob_clean();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user