Compare commits
9 Commits
dev/robert
...
dev/m4_rob
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
67a26f6684 | ||
|
|
96079ebc6d | ||
|
|
070945c4a5 | ||
|
|
c69ffd7aa2 | ||
|
|
b2acdfe783 | ||
|
|
3206c60ce2 | ||
|
|
644248d1ff | ||
|
|
b8d937d110 | ||
|
|
9c61333473 |
1940
.idea/dataSources/a1d1df29-b94a-4ad6-bd6f-a458b97a6c0c.xml
generated
2
.idea/dataSources/a1d1df29-b94a-4ad6-bd6f-a458b97a6c0c/storage_v2/_src_/schema/mysql.osA4Bg.meta
generated
Normal file
@@ -0,0 +1,2 @@
|
||||
#n:mysql
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
||||
@@ -0,0 +1,2 @@
|
||||
#n:performance_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
||||
22
.idea/php.xml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.4">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
33
.idea/workspace.xml
generated
@@ -5,7 +5,18 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="6dcbe3e4-9d68-41d8-8c39-5cfbe5cd4a21" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/M3/M3.md" beforeDir="false" afterPath="$PROJECT_DIR$/M3/M3.md" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/controllers/MainController.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/models/gerichte_main.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/public/css/style.css" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/public/img/fh-logo.jpg" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/public/img/mensa21.jpg" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/views/layouts/main_layout.blade.php" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/M4/emensa/views/main/index.blade.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M4/emensa/models/gerichte_self.php" beforeDir="false" afterPath="$PROJECT_DIR$/M4/emensa/models/gerichte_self.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M4/emensa/routes/web.php" beforeDir="false" afterPath="$PROJECT_DIR$/M4/emensa/routes/web.php" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M4/emensa/storage/cache/.layouts.m4_7d_layout_ecc36cbad49aa38782cc08cc5e9ca6c7ae3590d0.bladec" beforeDir="false" afterPath="$PROJECT_DIR$/M4/emensa/storage/cache/.layouts.m4_7d_layout_ecc36cbad49aa38782cc08cc5e9ca6c7ae3590d0.bladec" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/M4/emensa/views/layouts/m4_7d_layout.blade.php" beforeDir="false" afterPath="$PROJECT_DIR$/M4/emensa/views/layouts/m4_7d_layout.blade.php" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -27,10 +38,10 @@
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="PhpWorkspaceProjectConfiguration" interpreter_name="Xampp" />
|
||||
<component name="ProjectColorInfo"><![CDATA[{
|
||||
"customColor": "",
|
||||
"associatedIndex": 0
|
||||
}]]></component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"customColor": "",
|
||||
"associatedIndex": 0
|
||||
}</component>
|
||||
<component name="ProjectId" id="2YZcMNXBUidjAecPVKM66b1DdlE" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
@@ -42,12 +53,13 @@
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"database.data.extractors.current.export.id": "Comma-separated (CSV)_id",
|
||||
"git-widget-placeholder": "dev/robert__m3",
|
||||
"last_opened_file_path": "C:/Users/rober/Documents/GitHub/DBWT-Praktika/M3/werbeseite_daten.sql",
|
||||
"git-widget-placeholder": "dev/m4__robert",
|
||||
"last_opened_file_path": "C:/Users/rober/Documents/GitHub/DBWT-Praktika/M4/emensa/public/img",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
},
|
||||
@@ -57,6 +69,12 @@
|
||||
]
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\rober\Documents\GitHub\DBWT-Praktika\M4\emensa\public\img" />
|
||||
<recent name="C:\Users\rober\Documents\GitHub\DBWT-Praktika\M4\emensa\public\css" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
@@ -66,6 +84,7 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1700736495450</updated>
|
||||
<workItem from="1700736497007" duration="15223000" />
|
||||
<workItem from="1702027267170" duration="12429000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -223,7 +223,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="grid">
|
||||
@@ -261,36 +260,43 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
$tabelle = "<table class=\"speisen\"><tr class=\"speisen\"> <td>Gerichte</td><td>Preis intern</td><td>Preis extern</td><td>Bild</td></tr>";
|
||||
|
||||
$verwendete_allergene = [];
|
||||
$verwendete_allergene_code = [];
|
||||
$verwendete_allergene_string = "";
|
||||
|
||||
while ($row_gerichte = mysqli_fetch_assoc($result_sql_gerichte)) {
|
||||
|
||||
// Abfrage der vorhandenen Allergene im aktuellen Gericht
|
||||
|
||||
$sql_gericht_hat_allergene = "SELECT * FROM gericht_hat_allergen WHERE gericht_id=" . $row_gerichte['id'];
|
||||
$result_sql_gericht_hat_allergene = mysqli_query($link, $sql_gericht_hat_allergene);
|
||||
$allergene = "";
|
||||
while ($row_allergene = mysqli_fetch_assoc($result_sql_gericht_hat_allergene)) {
|
||||
$allergene .= $row_allergene['code'] . ", ";
|
||||
|
||||
if (!in_array($row_allergene['code'], $verwendete_allergene)) {
|
||||
$verwendete_allergene[] = $row_allergene['code'];
|
||||
if (!in_array($row_allergene['code'], $verwendete_allergene_code)) {
|
||||
$verwendete_allergene_code[] = $row_allergene['code'];
|
||||
}
|
||||
}
|
||||
|
||||
// Preise in EUR
|
||||
|
||||
$preisintern = number_format($row_gerichte['preisintern'], 2, ',', '.');
|
||||
$preisextern = number_format($row_gerichte['preisextern'], 2, ',', '.');
|
||||
|
||||
// Ausgabe des aktuellen Gerichts
|
||||
|
||||
$tabelle .= "<tr class=\"speisen\"><td>" . $row_gerichte['name'] . " <sup>" . $allergene . "</sup></td><td>" . $preisintern . "€</td><td>" . $preisextern . "€</td><td>Kein Bild in der Datenbank </td></tr>";
|
||||
}
|
||||
$tabelle .= "</table>";
|
||||
echo $tabelle;
|
||||
|
||||
// Abfrage der Allergen Code und Name
|
||||
|
||||
$sql_allergen = "SELECT code, name FROM allergen";
|
||||
$result_sql_allergen = mysqli_query($link, $sql_allergen);
|
||||
|
||||
while ($row_allergen = mysqli_fetch_assoc($result_sql_allergen)){
|
||||
if (in_array($row_allergen['code'], $verwendete_allergene)){
|
||||
if (in_array($row_allergen['code'], $verwendete_allergene_code)){
|
||||
$verwendete_allergene_string .= "<sup>".$row_allergen['code']."</sup> ". $row_allergen['name']. ", ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
1
|
||||
2
|
||||
@@ -1 +1 @@
|
||||
[{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Ro","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Robert","email":"robert-joel@web.de","language":"deutsch","terms":"on"}]
|
||||
[{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Ro","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Robert","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"}]
|
||||
8
M4/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
8
M4/.idea/M4.iml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
12
M4/.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="emensawerbeseite" uuid="0a2c3473-febe-491a-b3f1-82e9ba5b153f">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://localhost:3306</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
8
M4/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/M4.iml" filepath="$PROJECT_DIR$/.idea/M4.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
20
M4/.idea/php.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
6
M4/.idea/sqldialects.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="PROJECT" dialect="MariaDB" />
|
||||
</component>
|
||||
</project>
|
||||
6
M4/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
19
M4/Dossier/.$Aufgabe1.drawio.bkp
Normal file
@@ -0,0 +1,19 @@
|
||||
<mxfile host="Electron" modified="2023-12-01T15:21:01.688Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.1.2 Chrome/114.0.5735.289 Electron/25.9.4 Safari/537.36" etag="78gUQK1TRnweegfurtHK" version="22.1.2" type="device">
|
||||
<diagram name="Seite-1" id="jhCbnHoXzx65MXILfqUJ">
|
||||
<mxGraphModel dx="1050" dy="725" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-1" value="" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="320" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-2" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="80" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-3" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||
<mxGeometry x="560" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
91
M4/Dossier/.$Aufgabe1.drawio.dtmp
Normal file
@@ -0,0 +1,91 @@
|
||||
<mxfile host="Electron" modified="2023-12-02T22:05:22.197Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.1.2 Chrome/114.0.5735.289 Electron/25.9.4 Safari/537.36" etag="rtvPorWLK5CfuI4500ka" version="22.1.2" type="device">
|
||||
<diagram name="Seite-1" id="jhCbnHoXzx65MXILfqUJ">
|
||||
<mxGraphModel dx="1048" dy="722" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-1" value="erstellt" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-2" value="Wunschgericht" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="560" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-3" value="Ersteller" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="80" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-4" value="Name" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="560" y="140" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-5" value="Beschreibung" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="680" y="140" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-6" value="Erstellungs-datum" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="500" y="180" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-7" value="ID" style="ellipse;whiteSpace=wrap;html=1;fontStyle=4" parent="1" vertex="1">
|
||||
<mxGeometry x="620" y="180" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-12" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" target="8l75yZ3mhxg1qXRySu_G-5" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="700" y="240" as="sourcePoint" />
|
||||
<mxPoint x="750" y="190" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-13" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.621;entryY=0.005;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-7" target="8l75yZ3mhxg1qXRySu_G-2" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="730" y="280" as="sourcePoint" />
|
||||
<mxPoint x="780" y="230" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-14" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" target="8l75yZ3mhxg1qXRySu_G-4" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="600" y="240" as="sourcePoint" />
|
||||
<mxPoint x="628" y="154" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-15" value="" style="endArrow=none;html=1;rounded=0;entryX=1;entryY=1;entryDx=0;entryDy=0;exitX=0.15;exitY=0.003;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-2" target="8l75yZ3mhxg1qXRySu_G-6" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="610" y="250" as="sourcePoint" />
|
||||
<mxPoint x="610" y="170" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-17" value="" style="endArrow=none;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="480" y="279.66" as="sourcePoint" />
|
||||
<mxPoint x="560" y="279.66" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-18" value="Name" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="80" y="160" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-19" value="<u>E-Mail</u>" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="170" y="160" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-20" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-3" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="100" y="260" as="sourcePoint" />
|
||||
<mxPoint x="120" y="200" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-21" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="209.65999999999997" y="240" as="sourcePoint" />
|
||||
<mxPoint x="209.65999999999997" y="200" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-22" value="N" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="530" y="250" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-23" value="1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="250" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-24" value="" style="endArrow=none;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="240" y="280" as="sourcePoint" />
|
||||
<mxPoint x="320" y="280" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
91
M4/Dossier/Aufgabe1.drawio
Normal file
@@ -0,0 +1,91 @@
|
||||
<mxfile host="Electron" modified="2023-12-02T22:05:19.234Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/22.1.2 Chrome/114.0.5735.289 Electron/25.9.4 Safari/537.36" etag="UqWXQEsGpaBe1QuKew26" version="22.1.2" type="device">
|
||||
<diagram name="Seite-1" id="jhCbnHoXzx65MXILfqUJ">
|
||||
<mxGraphModel dx="1048" dy="722" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0" />
|
||||
<mxCell id="1" parent="0" />
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-1" value="erstellt" style="rhombus;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="320" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-2" value="Wunschgericht" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="560" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-3" value="Ersteller" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="80" y="240" width="160" height="80" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-4" value="Name" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="560" y="140" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-5" value="Beschreibung" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="680" y="140" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-6" value="Erstellungs-datum" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="500" y="180" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-7" value="ID" style="ellipse;whiteSpace=wrap;html=1;fontStyle=4" parent="1" vertex="1">
|
||||
<mxGeometry x="620" y="180" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-12" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" target="8l75yZ3mhxg1qXRySu_G-5" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="700" y="240" as="sourcePoint" />
|
||||
<mxPoint x="750" y="190" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-13" value="" style="endArrow=none;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.621;entryY=0.005;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-7" target="8l75yZ3mhxg1qXRySu_G-2" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="730" y="280" as="sourcePoint" />
|
||||
<mxPoint x="780" y="230" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-14" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" target="8l75yZ3mhxg1qXRySu_G-4" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="600" y="240" as="sourcePoint" />
|
||||
<mxPoint x="628" y="154" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-15" value="" style="endArrow=none;html=1;rounded=0;entryX=1;entryY=1;entryDx=0;entryDy=0;exitX=0.15;exitY=0.003;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-2" target="8l75yZ3mhxg1qXRySu_G-6" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="610" y="250" as="sourcePoint" />
|
||||
<mxPoint x="610" y="170" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-17" value="" style="endArrow=none;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="480" y="279.66" as="sourcePoint" />
|
||||
<mxPoint x="560" y="279.66" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-18" value="Name" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="80" y="160" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-19" value="<u>E-Mail</u>" style="ellipse;whiteSpace=wrap;html=1;" parent="1" vertex="1">
|
||||
<mxGeometry x="170" y="160" width="80" height="40" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-20" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;" parent="1" source="8l75yZ3mhxg1qXRySu_G-3" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="100" y="260" as="sourcePoint" />
|
||||
<mxPoint x="120" y="200" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-21" value="" style="endArrow=none;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0.25;exitY=0;exitDx=0;exitDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="209.65999999999997" y="240" as="sourcePoint" />
|
||||
<mxPoint x="209.65999999999997" y="200" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-22" value="N" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="530" y="250" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-23" value="1" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
|
||||
<mxGeometry x="240" y="250" width="30" height="30" as="geometry" />
|
||||
</mxCell>
|
||||
<mxCell id="8l75yZ3mhxg1qXRySu_G-24" value="" style="endArrow=none;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" edge="1">
|
||||
<mxGeometry width="50" height="50" relative="1" as="geometry">
|
||||
<mxPoint x="240" y="280" as="sourcePoint" />
|
||||
<mxPoint x="320" y="280" as="targetPoint" />
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
||||
BIN
M4/Dossier/ERD M4-1-1.png
Normal file
|
After Width: | Height: | Size: 56 KiB |
153
M4/Dossier/M4.md
Normal file
@@ -0,0 +1,153 @@
|
||||
# Aufgabe 1
|
||||
> Dauer: 2 h
|
||||
## 1)
|
||||

|
||||
## 2) Datenbankentwurf in Relationenschreibweise
|
||||
```sql
|
||||
use emensawerbeseite;
|
||||
|
||||
-- Tabelle 'Ersteller' erstellen
|
||||
CREATE TABLE IF NOT EXISTS Ersteller (
|
||||
EMail VARCHAR(255) PRIMARY KEY,
|
||||
Name VARCHAR(255) DEFAULT 'anonym'
|
||||
);
|
||||
|
||||
-- Tabelle 'Wunschgericht' erstellen
|
||||
CREATE TABLE IF NOT EXISTS Wunschgericht (
|
||||
ID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
Name VARCHAR(255) NOT NULL,
|
||||
Beschreibung TEXT,
|
||||
Erstellungsdatum DATE NOT NULL,
|
||||
Ersteller_EMail VARCHAR(255) NOT NULL,
|
||||
FOREIGN KEY (Ersteller_EMail) REFERENCES Ersteller(EMail)
|
||||
);
|
||||
```
|
||||
## 6)
|
||||
### a)
|
||||
````sql
|
||||
select * from wunschgericht order by Erstellungsdatum desc limit 5;
|
||||
````
|
||||
### b)
|
||||
````sql
|
||||
-- basierend auf M3 6) 4)
|
||||
select ersteller.Name,
|
||||
count(Ersteller_EMail) as anzahl from wunschgericht, ersteller where ersteller.EMail = wunschgericht.Ersteller_EMail
|
||||
group by Ersteller_EMail
|
||||
order by anzahl desc ;
|
||||
````
|
||||
---
|
||||
# Aufgabe 2
|
||||
> Dauer: 2h
|
||||
|
||||
Bei der Übergabe von Daten in die DB müssen diese geprüft werden.
|
||||
Bei der Ausgabe von Daten aus der DB im HTML Code müssen diese Maskiert werden.
|
||||
````php
|
||||
// wunschgericht.php
|
||||
// Zeile 33
|
||||
$sql_ersteller_exists = "SELECT * FROM ersteller WHERE EMail = '" . $ersteller_email . "'";
|
||||
$sql_ersteller_exists = "SELECT * FROM ersteller WHERE EMail = '" . mysqli_real_escape_string($link, $ersteller_email) . "'";
|
||||
|
||||
// Zeile 36
|
||||
$sql_ersteller = "INSERT INTO ersteller(EMail, Name) VALUES ('" . $ersteller_email . "','" . $ersteller_name . "')";
|
||||
$sql_ersteller = "INSERT INTO ersteller(EMail, Name) VALUES ('" . mysqli_real_escape_string($link, $ersteller_email) . "','" . mysqli_real_escape_string($link, $ersteller_name) . "')";
|
||||
|
||||
// Zeile 42
|
||||
$sql = "INSERT INTO wunschgericht(Name, Beschreibung, Erstellungsdatum, Ersteller_EMail) VALUES ('" . $gericht_name . "','" . $gericht_beschreibung . "','". $date ."','" . $ersteller_email . "')";
|
||||
$sql = "INSERT INTO wunschgericht(Name, Beschreibung, Erstellungsdatum, Ersteller_EMail) VALUES ('" . mysqli_real_escape_string($link, $gericht_name) . "','" . mysqli_real_escape_string($link, $gericht_beschreibung) . "','".$date."','" . mysqli_real_escape_string($link, $ersteller_email) . "')";
|
||||
?>
|
||||
````
|
||||
|
||||
````php
|
||||
// index.php
|
||||
// Zeile 43
|
||||
$sql_besucher = "UPDATE besucher_counter SET besucher =".$besucherCount;
|
||||
$sql_besucher = "UPDATE besucher_counter SET besucher =". mysqli_real_escape_string($link, $besucherCount);
|
||||
|
||||
// Zeile 190
|
||||
$tabelle .= "<tr class=\"speisen\"><td>" . $row_gerichte['name'] . " <sup>" . $allergene . "</sup></td><td>" . $preisintern . "€</td><td>" . $preisextern . "€</td><td>Kein Bild in der Datenbank </td></tr>";
|
||||
$tabelle .= "<tr class=\"speisen\"><td>" . htmlspecialchars($row_gerichte['name']) . " <sup>" . htmlspecialchars($allergene) . "</sup></td><td>" . htmlspecialchars($preisintern) . "€</td><td>" . htmlspecialchars($preisextern) . "€</td><td>Kein Bild in der Datenbank </td></tr>";
|
||||
|
||||
|
||||
// Zeile 202
|
||||
$verwendete_allergene_string .= "<sup>".$row_allergen['code']."</sup> ". $row_allergen['name']. ", ";
|
||||
$verwendete_allergene_string .= "<sup>". htmlspecialchars($row_allergen['code']) ."</sup> ". htmlspecialchars($row_allergen['name']) . ", ";
|
||||
|
||||
// Zeile 214f
|
||||
echo $besucherCount;
|
||||
echo $newletterCount;
|
||||
|
||||
echo htmlspecialchars($besucherCount);
|
||||
echo htmlspecialchars($newletterCount);
|
||||
|
||||
// Zeile 220
|
||||
echo $ausgabe["COUNT(id)"];
|
||||
echo htmlspecialchars($ausgabe["COUNT(id)"]);
|
||||
````
|
||||
Bei der Newsletteranmeldung sollte man sich auch ggf. überlegen, wie man die Eingaben prüft un zu vermeiden, das schadhafter Code gespeichert und später abgerufen wird.
|
||||
|
||||
# Aufgabe 4
|
||||
> Dauer 1,5 h
|
||||
1. Eindeutigkeit für die Kombination aus Gericht und Kategorie sicherstellen
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_kategorie
|
||||
ADD CONSTRAINT gericht_kategorie_unique UNIQUE (gericht_id, kategorie_id);
|
||||
````
|
||||
2. In der Tabelle gericht soll eine Abfrage nach Name beschleunigt werden.
|
||||
````sql
|
||||
ALTER TABLE gericht
|
||||
ADD INDEX idx_name (name);
|
||||
````
|
||||
3. Bei Löschung eines Gerichts sollen
|
||||
1) die zugehörigen Zuordnungen zu einer Kategorie sowie
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_kategorie
|
||||
DROP FOREIGN KEY gericht_hat_kategorie_ibfk_1, -- (gericht_id) -> gericht(id)
|
||||
ADD CONSTRAINT gericht_hat_kategorie_ibfk_1_new
|
||||
FOREIGN KEY (gericht_id) REFERENCES gericht(id)
|
||||
ON DELETE CASCADE;
|
||||
````
|
||||
2) die zugehörigen Zuordnungen zu Allergenen automatisch mit gelöscht werden.
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_allergen
|
||||
DROP FOREIGN KEY gericht_hat_allergen_ibfk_2, -- (gericht_id) -> gericht(id)
|
||||
ADD CONSTRAINT gericht_hat_allergen_ibfk_2_new
|
||||
FOREIGN KEY (gericht_id) REFERENCES gericht(id)
|
||||
ON DELETE CASCADE;
|
||||
````
|
||||
4. Eine Kategorie kann nur dann gelöscht werden, wenn
|
||||
1) dieser keine Gerichte zugeordnet sind und
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_kategorie
|
||||
ADD CONSTRAINT fk_gericht_hat_kategorie_kategorie_id
|
||||
FOREIGN KEY (kategorie_id) REFERENCES kategorie(id)
|
||||
ON DELETE RESTRICT;
|
||||
````
|
||||
2) diese keine Kindkategorien besitzt.
|
||||
````sql
|
||||
ALTER TABLE kategorie
|
||||
ADD CONSTRAINT fk_kategorie_eltern_id
|
||||
FOREIGN KEY (eltern_id) REFERENCES kategorie(id)
|
||||
ON DELETE RESTRICT;
|
||||
````
|
||||
5. Wird der Code eines Allergens verändert, so ändert sich dieser Code automatisch in den referenzierenden Datensätzen.
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_allergen
|
||||
DROP FOREIGN KEY gericht_hat_allergen_ibfk_1, -- (code) -> allergen(code)
|
||||
ADD CONSTRAINT gericht_hat_allergen_ibfk_1_new
|
||||
FOREIGN KEY (code) REFERENCES allergen(code)
|
||||
ON UPDATE CASCADE;
|
||||
````
|
||||
6. Eine Kombination aus ``gericht_id`` und ``kategorie_id`` in ``gericht_hat_kategorie`` soll als Primärschlüssel dienen.
|
||||
````sql
|
||||
ALTER TABLE gericht_hat_kategorie
|
||||
ADD PRIMARY KEY (gericht_id, kategorie_id);
|
||||
````
|
||||
|
||||
# Aufgabe 6
|
||||
> Dauer 20 min
|
||||
|
||||
# Aufgabe 7
|
||||
> Dauer 2,5 h
|
||||
|
||||
# Aufgabe 8
|
||||
> Dauer 1 h
|
||||
1
M4/Werbeseite/besucher.txt
Normal file
@@ -0,0 +1 @@
|
||||
218
|
||||
BIN
M4/Werbeseite/fh-logo.jpg
Normal file
|
After Width: | Height: | Size: 64 KiB |
31
M4/Werbeseite/gerichte.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
|
||||
$gerichte = [
|
||||
1 => ['name' => 'Rindfleich mit Bambus, Kaiserschoten und roter Paprika, dazu Mie Nudeln',
|
||||
'priceint' => 3.50,
|
||||
"priceex" => 6.20,
|
||||
"img" =>"img/bambus.jpg"
|
||||
],
|
||||
2 => ['name' => 'Spinatrisotto mit kleinen Samosateigecken und gemischter Salat',
|
||||
'priceint' => 2.90,
|
||||
"priceex" => 5.30,
|
||||
"img" =>"img/risotto.jpg"
|
||||
],
|
||||
3 => ['name' => 'Spaghetti Bolognese',
|
||||
'priceint' => 3,
|
||||
"priceex" => 5,
|
||||
"img" =>"img/bolo.jpg"
|
||||
],
|
||||
4 => ['name' => 'Spaghetti Carbonara',
|
||||
'priceint' => 3,
|
||||
"priceex" => 5,
|
||||
"img" =>"img/carbonara.jpg"
|
||||
]
|
||||
]
|
||||
?>
|
||||
BIN
M4/Werbeseite/img/bambus.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
BIN
M4/Werbeseite/img/bolo.jpg
Normal file
|
After Width: | Height: | Size: 1.1 MiB |
BIN
M4/Werbeseite/img/carbonara.jpg
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
M4/Werbeseite/img/risotto.jpg
Normal file
|
After Width: | Height: | Size: 103 KiB |
274
M4/Werbeseite/index.php
Normal file
@@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
include "gerichte.php";
|
||||
|
||||
$besucherCount = 0;
|
||||
$newletterCount = 0;
|
||||
|
||||
// Datenbankanbindung
|
||||
//$link = mysqli_connect(
|
||||
//"127.0.0.1", // Host der Datenbank
|
||||
//"root", // Benutzername zur Anmeldung
|
||||
//"wm#32", // Passwort
|
||||
//"emensawerbeseite" // Auswahl der Datenbanken (bzw. des Schemas)
|
||||
//);
|
||||
|
||||
$link = mysqli_connect(
|
||||
"127.0.0.1", // Host der Datenbank
|
||||
"root", // Benutzername zur Anmeldung
|
||||
"admin", // Passwort
|
||||
"emensawerbeseite" // Auswahl der Datenbanken (bzw. des Schemas)
|
||||
);
|
||||
|
||||
if (!$link) {
|
||||
echo "Verbindung fehlgeschlagen: ", mysqli_connect_error();
|
||||
exit();
|
||||
}
|
||||
|
||||
//Besucher counter
|
||||
|
||||
//Aktuelle Besucher Zahl
|
||||
$sql_besucher = "SELECT besucher FROM besucher_counter WHERE id=1";
|
||||
$result_sql_besucher = mysqli_query($link, $sql_besucher);
|
||||
$besucher = mysqli_fetch_assoc($result_sql_besucher);
|
||||
|
||||
//Updatet Besucher Zahl
|
||||
$besucherCount = $besucher["besucher"] + 1;
|
||||
$sql_besucher = "UPDATE besucher_counter SET besucher =". mysqli_real_escape_string($link, $besucherCount);
|
||||
$result_sql_besucher = mysqli_query($link, $sql_besucher);
|
||||
|
||||
//Newletter counter
|
||||
if (file_exists("newletter.txt")) {
|
||||
$newsFile = fopen("newletter.txt", "r");
|
||||
$newletterCount = fgets($newsFile);
|
||||
fclose($newsFile);
|
||||
} else {
|
||||
$newsFile = fopen("newletter.txt", "w");
|
||||
fwrite($newsFile, 0);
|
||||
fclose($newsFile);
|
||||
}
|
||||
|
||||
//Newletter Anmeldung
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$language = $_POST['language'];
|
||||
$terms = $_POST['terms'];
|
||||
|
||||
$errors = array();
|
||||
//Error handling
|
||||
if (empty(trim($name))) {
|
||||
$errors[] = "Bitte geben Sie einen Namen ein.";
|
||||
}
|
||||
|
||||
if (!isset($terms)) {
|
||||
$errors[] = "Bitte stimmen Sie den Datenschutzbestimmungen zu.";
|
||||
}
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors[] = "Bitte geben Sie eine gültige E-Mail-Adresse ein.";
|
||||
}
|
||||
|
||||
$spam_domains = array("rcpt.at", "damnthespam.at", "wegwerfmail.de", "trashmail");
|
||||
|
||||
foreach ($spam_domains as $domain) {
|
||||
if (str_contains($email, $domain)) {
|
||||
$errors[] = "Bitte geben Sie eine gültige E-Mail-Adresse ein, keine Wegwerf- oder Spam-E-Mail-Adresse.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$data = array(
|
||||
"name" => $name,
|
||||
"email" => $email,
|
||||
"language" => $language,
|
||||
"terms" => $terms
|
||||
);
|
||||
//File writing
|
||||
$file = "subscriptions.json";
|
||||
$current_data = file_exists($file) ? json_decode(file_get_contents($file), true) : array();
|
||||
$current_data[] = $data;
|
||||
|
||||
if (file_put_contents($file, json_encode($current_data))) {
|
||||
echo '<script type="text/javascript"> alert("Vielen Dank für Ihre Anmeldung zum Newsletter.");</script>';
|
||||
|
||||
//Newsletter counter
|
||||
$newletterCount++;
|
||||
$newsFile = fopen("newletter.txt", "w");
|
||||
fwrite($newsFile, $newletterCount);
|
||||
fclose($newsFile);
|
||||
} else {
|
||||
echo '<script type="text/javascript">alert("Es gab einen Fehler bei Ihrer Anmeldung. Bitte versuchen Sie es erneut.");</script>';
|
||||
}
|
||||
} else {
|
||||
$error_string = "";
|
||||
foreach ($errors as $error) {
|
||||
$error_string .= $error . '\n';
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">alert("' . $error_string . '");</script>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ihre E-Mensa</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<img src="fh-logo.jpg" alt="FH-Logo">
|
||||
</div>
|
||||
<div>
|
||||
<a href="#ankündigung">Ankündigung</a>
|
||||
<a href="#speisen">Speisen</a>
|
||||
<a href="#zahlen">Zahlen</a>
|
||||
<a href="#kontakt">Kontakt</a>
|
||||
<a href="#wichtig">Wichtig für uns</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div></div>
|
||||
<div>
|
||||
<img src="mensa21.jpg" alt="Essen">
|
||||
<h1 id="ankündigung">Bald gibt es auch Essen online ;)</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
|
||||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
|
||||
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
|
||||
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
|
||||
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
|
||||
sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
|
||||
<h1 id="speisen">Köstlichkeiten die Sie erwarten</h1>
|
||||
|
||||
<!-- Speisekarte -->
|
||||
<?php
|
||||
//Gerichte aus Datenbank
|
||||
$sql_gerichte = "SELECT * FROM gericht ORDER BY RAND() LIMIT 5";
|
||||
$result_sql_gerichte = mysqli_query($link, $sql_gerichte);
|
||||
|
||||
$tabelle = "<table class=\"speisen\"><tr class=\"speisen\"> <td>Gerichte</td><td>Preis intern</td><td>Preis extern</td><td>Bild</td></tr>";
|
||||
|
||||
$verwendete_allergene_code = [];
|
||||
$verwendete_allergene_string = "";
|
||||
|
||||
while ($row_gerichte = mysqli_fetch_assoc($result_sql_gerichte)) {
|
||||
|
||||
// Abfrage der vorhandenen Allergene im aktuellen Gericht
|
||||
|
||||
$sql_gericht_hat_allergene = "SELECT * FROM gericht_hat_allergen WHERE gericht_id=" . $row_gerichte['id'];
|
||||
$result_sql_gericht_hat_allergene = mysqli_query($link, $sql_gericht_hat_allergene);
|
||||
$allergene = "";
|
||||
while ($row_allergene = mysqli_fetch_assoc($result_sql_gericht_hat_allergene)) {
|
||||
$allergene .= $row_allergene['code'] . ", ";
|
||||
|
||||
if (!in_array($row_allergene['code'], $verwendete_allergene_code)) {
|
||||
$verwendete_allergene_code[] = $row_allergene['code'];
|
||||
}
|
||||
}
|
||||
|
||||
// Preise in EUR
|
||||
|
||||
$preisintern = number_format($row_gerichte['preisintern'], 2, ',', '.');
|
||||
$preisextern = number_format($row_gerichte['preisextern'], 2, ',', '.');
|
||||
|
||||
// Ausgabe des aktuellen Gerichts
|
||||
|
||||
$tabelle .= "<tr class=\"speisen\"><td>" . htmlspecialchars($row_gerichte['name']) . " <sup>" . htmlspecialchars($allergene) . "</sup></td><td>" . htmlspecialchars($preisintern) . "€</td><td>" . htmlspecialchars($preisextern) . "€</td><td>Kein Bild in der Datenbank </td></tr>";
|
||||
}
|
||||
$tabelle .= "</table>";
|
||||
echo $tabelle;
|
||||
|
||||
// Abfrage der Allergen Code und Name
|
||||
|
||||
$sql_allergen = "SELECT code, name FROM allergen";
|
||||
$result_sql_allergen = mysqli_query($link, $sql_allergen);
|
||||
|
||||
while ($row_allergen = mysqli_fetch_assoc($result_sql_allergen)){
|
||||
if (in_array($row_allergen['code'], $verwendete_allergene_code)){
|
||||
$verwendete_allergene_string .= "<sup>". htmlspecialchars($row_allergen['code']) ."</sup> ". htmlspecialchars($row_allergen['name']) . ", ";
|
||||
}
|
||||
}
|
||||
|
||||
echo $verwendete_allergene_string;
|
||||
?>
|
||||
|
||||
<h1>Für Sie nichts dabei? <a href="../Werbeseite/wunschgericht.php">Wunschgericht erfassen</a></h1>
|
||||
|
||||
|
||||
<h1 id="zahlen">E-Mensa in Zahlen</h1>
|
||||
<div class="zahlen">
|
||||
<p><?php echo htmlspecialchars($besucherCount); ?> Besuche</p>
|
||||
<p><?php echo htmlspecialchars($newletterCount); ?> Anmeldungen zum Newsletter</p><p>
|
||||
<?php
|
||||
$sql_gerichte = "SELECT COUNT(id) FROM gericht";
|
||||
$result_sql_gerichte = mysqli_query($link, $sql_gerichte);
|
||||
$ausgabe = mysqli_fetch_assoc($result_sql_gerichte);
|
||||
echo htmlspecialchars($ausgabe["COUNT(id)"]);
|
||||
?>
|
||||
Speisen
|
||||
</p>
|
||||
</div>
|
||||
<h1 id="kontakt">Interesse geweckt? Wir informieren</h1>
|
||||
|
||||
<form method="post">
|
||||
<div class="formular">
|
||||
<div>
|
||||
<label for="name">Name:</label> <br>
|
||||
<input type="text" name="name" id="name" placeholder="Bitte geben Sie Ihren Namen ein">
|
||||
</div>
|
||||
<div>
|
||||
<label for="email">E-Mail:</label> <br>
|
||||
<input type="email" name="email" id="email" placeholder="Bitte geben Sie Ihre E-Mail ein">
|
||||
</div>
|
||||
<div>
|
||||
<label for="language">Newsletter bitte in:</label> <br>
|
||||
<select name="language" id="language">
|
||||
<option value="deutsch">Deutsch</option>
|
||||
<option value="englisch">Englisch</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<input required type="checkbox" name="terms" id="terms">
|
||||
<label for="terms">Den Datenschutzbestimmungen stimme ich zu</label>
|
||||
<button type="submit">Zum Newsletter anmelden</button>
|
||||
</form>
|
||||
|
||||
|
||||
<h1 id="wichtig">Das ist uns wichtig</h1>
|
||||
<div class="wichtig">
|
||||
<ul class="wichtigListe">
|
||||
<li>Beste frische saisonale Zutaten</li>
|
||||
<li>Ausgewogen abwechslungsreiche Gerichte</li>
|
||||
<li>Sauberkeit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 class="freude">Wir freuen uns auf Ihren Besuch!</h1>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<table class="fusszeile">
|
||||
<tr>
|
||||
<td>(c) E-Mensa GmbH</td>
|
||||
<td>Şafak Hazinedar & Robert Joel</td>
|
||||
<td><a href="">Impressum</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
M4/Werbeseite/mensa21.jpg
Normal file
|
After Width: | Height: | Size: 153 KiB |
1
M4/Werbeseite/newletter.txt
Normal file
@@ -0,0 +1 @@
|
||||
2
|
||||
90
M4/Werbeseite/style.css
Normal file
@@ -0,0 +1,90 @@
|
||||
* {
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 200px auto 200px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.speisen {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.speisen td {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.speisen td:not(:first-of-type) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.zahlen {
|
||||
list-style-type: none;
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.zahlen p {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.formular {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
justify-content: start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wichtig {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wichtigListe {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.freude {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid;
|
||||
}
|
||||
|
||||
.fusszeile {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.fusszeile td:first-child {
|
||||
border-left: none;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.fusszeile td {
|
||||
border-left: 3px solid;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
1
M4/Werbeseite/subscriptions.json
Normal file
@@ -0,0 +1 @@
|
||||
[{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Ro","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Robert","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"}]
|
||||
104
M4/Werbeseite/wunschgericht.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$gericht_name = $_POST['gericht_name'];
|
||||
$gericht_beschreibung = $_POST['gericht_beschreibung'];
|
||||
$ersteller_name = $_POST['ersteller_name'];
|
||||
$ersteller_email = $_POST['ersteller_email'];
|
||||
|
||||
// Datenbankverbindung
|
||||
$link = mysqli_connect(
|
||||
"127.0.0.1",
|
||||
"root",
|
||||
"wm#32",
|
||||
"emensawerbeseite"
|
||||
);
|
||||
if (!$link) {
|
||||
echo "Verbindung fehlgeschlagen: ", mysqli_connect_error();
|
||||
exit();
|
||||
}
|
||||
|
||||
$error_count = 0;
|
||||
$spam_domains = array("rcpt.at", "damnthespam.at", "wegwerfmail.de", "trashmail");
|
||||
|
||||
foreach ($spam_domains as $domain) {
|
||||
if (str_contains($ersteller_email, $domain)) {
|
||||
echo '<script type="text/javascript"> alert("Fehler bei den übermittelten Daten");</script>';
|
||||
$error_count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$error_count){
|
||||
// Ersteller in DB eintragen
|
||||
$sql_ersteller_exists = "SELECT * FROM ersteller WHERE EMail = '" . mysqli_real_escape_string($link, $ersteller_email) . "'";
|
||||
$result_ersteller_exists = mysqli_query($link,$sql_ersteller_exists);
|
||||
if(mysqli_num_rows($result_ersteller_exists) == 0){
|
||||
$sql_ersteller = "INSERT INTO ersteller(EMail, Name) VALUES ('" . mysqli_real_escape_string($link, $ersteller_email) . "','" . mysqli_real_escape_string($link, $ersteller_name) . "')";
|
||||
$result_ersteller = mysqli_query($link,$sql_ersteller);
|
||||
}
|
||||
|
||||
// Gericht in die DB eintragen
|
||||
$date = date("Y-m-d");
|
||||
$sql = "INSERT INTO wunschgericht(Name, Beschreibung, Erstellungsdatum, Ersteller_EMail)
|
||||
VALUES ('" . mysqli_real_escape_string($link, $gericht_name) . "','" . mysqli_real_escape_string($link, $gericht_beschreibung) . "','".$date."','" . mysqli_real_escape_string($link, $ersteller_email) . "')";
|
||||
$result = mysqli_query($link, $sql);
|
||||
|
||||
if ($result) {
|
||||
echo '<script type="text/javascript"> alert("Ihr Wunschgericht wurde erfolgreich gespeichert!");</script>';
|
||||
}
|
||||
else {
|
||||
echo '<script type="text/javascript"> alert("Es gab einen Fehler: "' . mysqli_error($link) . '</script>';
|
||||
}
|
||||
}
|
||||
|
||||
mysqli_close($link);
|
||||
}
|
||||
?>
|
||||
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ihre E-Mensa</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<img src="fh-logo.jpg" alt="FH-Logo">
|
||||
</div>
|
||||
<div>
|
||||
<a href="index.php#ankündigung">Ankündigung</a>
|
||||
<a href="index.php#speisen">Speisen</a>
|
||||
<a href="index.php#zahlen">Zahlen</a>
|
||||
<a href="index.php#kontakt">Kontakt</a>
|
||||
<a href="index.php#wichtig">Wichtig für uns</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<form method="post" action="wunschgericht.php">
|
||||
<div class="formular">
|
||||
<label for="gericht_name">Name des Gerichts:</label>
|
||||
<input type="text" name="gericht_name" id="gericht_name" required>
|
||||
<br>
|
||||
<label for="gericht_beschreibung">Beschreibung des Gerichts:</label>
|
||||
<textarea name="gericht_beschreibung" id="gericht_beschreibung" required></textarea>
|
||||
<br>
|
||||
<label for="ersteller_name">Ihr Name:</label>
|
||||
<input type="text" name="ersteller_name" id="ersteller_name">
|
||||
<br>
|
||||
<label for="ersteller_email">Ihre E-Mail Adresse:</label>
|
||||
<input type="text" name="ersteller_email" id="ersteller_email" required>
|
||||
<input type="submit" value="Wunsch abschicken">
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
<footer>
|
||||
<table class="fusszeile">
|
||||
<tr>
|
||||
<td>(c) E-Mensa GmbH</td>
|
||||
<td>Şafak Hazinedar & Robert Joel</td>
|
||||
<td><a href="">Impressum</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</footer>
|
||||
</html>
|
||||
22
M4/emensa/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Routingscript MVC
|
||||
|
||||
little routing script for use in DBWT
|
||||
|
||||
intended to run with only one dependency (bladeone).
|
||||
|
||||
## usage
|
||||
|
||||
* start this script by either executing `start_server.bat` or running `php -S 127.0.0.1:9000 -t public` in a shell from the project´s root directory.
|
||||
|
||||
* [open the website](http://127.0.0.1:9000/)
|
||||
|
||||
## folder overview
|
||||
|
||||
* `bin/` is only necessary if you need to use composer and dont have it installed already
|
||||
* `config/` holds configuration files
|
||||
* `controllers/` contains all Controller Classes
|
||||
* `models/` contains the Model Classes
|
||||
* `public/` is the web root for your http server and contains the routing script itself, next to resources that will be accessible by http clients (css, js, images, etc.)
|
||||
* `storage/` is necessary to hold Blade Cache Files
|
||||
* `views/` holds all View Files
|
||||
|
||||
BIN
M4/emensa/bin/composer.phar
Normal file
9
M4/emensa/composer.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "emensa/mvc",
|
||||
"description": "routing script for module Datenbanken und Webtechnologien MVC",
|
||||
"license": "proprietary",
|
||||
"require": {
|
||||
"eftec/bladeone": "^4.1",
|
||||
"ext-mysqli": "*"
|
||||
}
|
||||
}
|
||||
80
M4/emensa/composer.lock
generated
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "0a19be8f09bdc5d4e2b07ba9e95a5801",
|
||||
"packages": [
|
||||
{
|
||||
"name": "eftec/bladeone",
|
||||
"version": "4.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EFTEC/BladeOne.git",
|
||||
"reference": "019036c226086fbe7591360d260067c5d82400ca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/EFTEC/BladeOne/zipball/019036c226086fbe7591360d260067c5d82400ca",
|
||||
"reference": "019036c226086fbe7591360d260067c5d82400ca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.23"
|
||||
},
|
||||
"suggest": {
|
||||
"eftec/bladeonehtml": "Extension to create forms",
|
||||
"ext-mbstring": "This extension is used if it's active"
|
||||
},
|
||||
"bin": [
|
||||
"lib/bladeonecli"
|
||||
],
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"eftec\\bladeone\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jorge Patricio Castro Castillo",
|
||||
"email": "jcastro@eftec.cl"
|
||||
}
|
||||
],
|
||||
"description": "The standalone version Blade Template Engine from Laravel in a single php file",
|
||||
"homepage": "https://github.com/EFTEC/BladeOne",
|
||||
"keywords": [
|
||||
"blade",
|
||||
"php",
|
||||
"template",
|
||||
"templating",
|
||||
"view"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/EFTEC/BladeOne/issues",
|
||||
"source": "https://github.com/EFTEC/BladeOne/tree/4.9"
|
||||
},
|
||||
"time": "2023-05-01T12:48:42+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"ext-mysqli": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
9
M4/emensa/config/db.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return [
|
||||
'host' => 'localhost', // 'localhost' or '127.0.0.1'
|
||||
'user' => 'root', // '<yourusername>'
|
||||
'password' => 'admin', // '<yourpassword>'
|
||||
'database' => 'emensawerbeseite',
|
||||
// optionally: set port below if it differs from the default 3306
|
||||
// 'port' => 13306 // !! this is not your webserver port, but the mariadb port
|
||||
];
|
||||
36
M4/emensa/controllers/DemoController.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gericht.php');
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/kategorie.php');
|
||||
|
||||
class DemoController
|
||||
{
|
||||
public function dbconnect() {
|
||||
$data = db_gericht_select_all();
|
||||
// Frage Daten aus kategorie ab:
|
||||
// $data = db_kategorie_select_all();
|
||||
return view('demo.dbdata', ['data' => $data]);
|
||||
}
|
||||
|
||||
public function demo(RequestData $rd) {
|
||||
$vars = [
|
||||
'bgcolor' => $rd->query['bgcolor'] ?? 'ffffff',
|
||||
'name' => $rd->query['name'] ?? 'Dich',
|
||||
'rd' => $rd
|
||||
];
|
||||
return view('demo.demo', $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* error action for debug purposes
|
||||
* @throws Exception
|
||||
* @noinspection PhpUnusedLocalVariableInspection
|
||||
*/
|
||||
public function error(RequestData $rd) {
|
||||
$test = $rd;
|
||||
throw new Exception("Not implemented");
|
||||
}
|
||||
|
||||
public function requestdata(RequestData $rd) {
|
||||
return view('demo.requestdata', ['rd' => $rd]);
|
||||
}
|
||||
}
|
||||
47
M4/emensa/controllers/ExampleController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/kategorie.php');
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gerichte_self.php');
|
||||
|
||||
class ExampleController
|
||||
{
|
||||
public function m4_6a_queryparameter(RequestData $rd) {
|
||||
/*
|
||||
Wenn Sie hier landen:
|
||||
bearbeiten Sie diese Action,
|
||||
so dass Sie die Aufgabe löst
|
||||
*/
|
||||
$rd = $rd->query['name'] ?? 'Kein Name angegeben';
|
||||
|
||||
return view('examples.m4_7a_queryparameter', [
|
||||
'request'=>$rd,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function m4_7b_kategorie() {
|
||||
$data = db_kategorie_select_all();
|
||||
|
||||
return view('examples.m4_7b_kategorie', [
|
||||
'data'=>$data,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function m4_7c_gerichte() {
|
||||
$data = db_gericht_select_intern();
|
||||
|
||||
return view('examples.m4_7c_gerichte', [
|
||||
'data'=>$data,
|
||||
]);
|
||||
}
|
||||
|
||||
public function m4_7d(RequestData $rd) {
|
||||
|
||||
$rd = $rd->query['no'] ?? 1;
|
||||
if ($rd == 1)
|
||||
return view('examples.pages.m4_7d_page_1', []);
|
||||
elseif ($rd == 2)
|
||||
return view('examples.pages.m4_7d_page_2', []);
|
||||
}
|
||||
}
|
||||
14
M4/emensa/controllers/HomeController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gericht.php');
|
||||
|
||||
/* Datei: controllers/HomeController.php */
|
||||
class HomeController
|
||||
{
|
||||
public function index(RequestData $request) {
|
||||
return view('home', ['rd' => $request ]);
|
||||
}
|
||||
|
||||
public function debug(RequestData $request) {
|
||||
return view('debug');
|
||||
}
|
||||
}
|
||||
21
M4/emensa/controllers/MainController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/../models/gerichte_main.php');
|
||||
|
||||
class MainController
|
||||
{
|
||||
public function index() {
|
||||
/*
|
||||
Wenn Sie hier landen:
|
||||
bearbeiten Sie diese Action,
|
||||
so dass Sie die Aufgabe löst
|
||||
*/
|
||||
|
||||
$data = db_gericht_select_karte();
|
||||
|
||||
return view('main.index', [
|
||||
'data'=>$data,
|
||||
'url' => 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
27
M4/emensa/models/gericht.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Diese Datei enthält alle SQL Statements für die Tabelle "gerichte"
|
||||
*/
|
||||
function db_gericht_select_all() {
|
||||
try {
|
||||
$link = connectdb();
|
||||
|
||||
$sql = 'SELECT id, name, beschreibung FROM gericht ORDER BY name';
|
||||
$result = mysqli_query($link, $sql);
|
||||
|
||||
$data = mysqli_fetch_all($result, MYSQLI_BOTH);
|
||||
|
||||
mysqli_close($link);
|
||||
}
|
||||
catch (Exception $ex) {
|
||||
$data = array(
|
||||
'id'=>'-1',
|
||||
'error'=>true,
|
||||
'name' => 'Datenbankfehler '.$ex->getCode(),
|
||||
'beschreibung' => $ex->getMessage());
|
||||
}
|
||||
finally {
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
75
M4/emensa/models/gerichte_main.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
function db_gericht_select_karte()
|
||||
{
|
||||
try {
|
||||
|
||||
$link = connectdb();
|
||||
|
||||
|
||||
$sql_gerichte = "SELECT * FROM gericht ORDER BY RAND() LIMIT 5";
|
||||
$result_sql_gerichte = mysqli_query($link, $sql_gerichte);
|
||||
|
||||
$tabelle = "<table class=\"speisen\"><tr class=\"speisen\"> <td>Gerichte</td><td>Preis intern</td><td>Preis extern</td><td>Bild</td></tr>";
|
||||
|
||||
$verwendete_allergene_code = [];
|
||||
$verwendete_allergene_string = "";
|
||||
|
||||
while ($row_gerichte = mysqli_fetch_assoc($result_sql_gerichte)) {
|
||||
|
||||
// Abfrage der vorhandenen Allergene im aktuellen Gericht
|
||||
|
||||
$sql_gericht_hat_allergene = "SELECT * FROM gericht_hat_allergen WHERE gericht_id=" . $row_gerichte['id'];
|
||||
$result_sql_gericht_hat_allergene = mysqli_query($link, $sql_gericht_hat_allergene);
|
||||
$allergene = "";
|
||||
while ($row_allergene = mysqli_fetch_assoc($result_sql_gericht_hat_allergene)) {
|
||||
$allergene .= $row_allergene['code'] . ", ";
|
||||
|
||||
if (!in_array($row_allergene['code'], $verwendete_allergene_code)) {
|
||||
$verwendete_allergene_code[] = $row_allergene['code'];
|
||||
}
|
||||
}
|
||||
|
||||
// Preise in EUR
|
||||
|
||||
$preisintern = number_format($row_gerichte['preisintern'], 2, ',', '.');
|
||||
$preisextern = number_format($row_gerichte['preisextern'], 2, ',', '.');
|
||||
|
||||
// Ausgabe des aktuellen Gerichts
|
||||
|
||||
$tabelle .= "<tr class=\"speisen\"><td>" . htmlspecialchars($row_gerichte['name']) . " <sup>" . htmlspecialchars($allergene) . "</sup></td><td>" . htmlspecialchars($preisintern) . "€</td><td>" . htmlspecialchars($preisextern) . "€</td><td>Kein Bild in der Datenbank </td></tr>";
|
||||
}
|
||||
$tabelle .= "</table>";
|
||||
|
||||
// Abfrage der Allergen Code und Name
|
||||
|
||||
$sql_allergen = "SELECT code, name FROM allergen";
|
||||
$result_sql_allergen = mysqli_query($link, $sql_allergen);
|
||||
|
||||
while ($row_allergen = mysqli_fetch_assoc($result_sql_allergen)){
|
||||
if (in_array($row_allergen['code'], $verwendete_allergene_code)){
|
||||
$verwendete_allergene_string .= "<sup>". htmlspecialchars($row_allergen['code']) ."</sup> ". htmlspecialchars($row_allergen['name']) . ", ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
"gericht" => $tabelle,
|
||||
"allergene" => $verwendete_allergene_string
|
||||
];
|
||||
|
||||
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
|
||||
} catch (Exception $ex) {
|
||||
$data = array(
|
||||
'id' => '-1',
|
||||
'error' => true,
|
||||
'name' => 'Datenbankfehler ' . $ex->getCode(),
|
||||
'beschreibung' => $ex->getMessage());
|
||||
} finally {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
23
M4/emensa/models/gerichte_self.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
function db_gericht_select_intern()
|
||||
{
|
||||
try {
|
||||
$link = connectdb();
|
||||
|
||||
$sql = 'SELECT name, preisintern FROM gericht WHERE preisintern > 2 ORDER BY name DESC';
|
||||
$result = mysqli_query($link, $sql);
|
||||
|
||||
$data = mysqli_fetch_all($result, MYSQLI_BOTH);
|
||||
|
||||
mysqli_close($link);
|
||||
} catch (Exception $ex) {
|
||||
$data = array(
|
||||
'id' => '-1',
|
||||
'error' => true,
|
||||
'name' => 'Datenbankfehler ' . $ex->getCode(),
|
||||
'beschreibung' => $ex->getMessage());
|
||||
} finally {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
15
M4/emensa/models/kategorie.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Diese Datei enthält alle SQL Statements für die Tabelle "kategorie"
|
||||
*/
|
||||
function db_kategorie_select_all() {
|
||||
$link = connectdb();
|
||||
|
||||
$sql = "SELECT * FROM kategorie ORDER BY name ASC";
|
||||
$result = mysqli_query($link, $sql);
|
||||
|
||||
$data = mysqli_fetch_all($result, MYSQLI_BOTH);
|
||||
|
||||
mysqli_close($link);
|
||||
return $data;
|
||||
}
|
||||
6
M4/emensa/public/css/default.min.css
vendored
Normal file
90
M4/emensa/public/css/style.css
Normal file
@@ -0,0 +1,90 @@
|
||||
* {
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 200px auto 200px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.speisen {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.speisen td {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.speisen td:not(:first-of-type) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.zahlen {
|
||||
list-style-type: none;
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.zahlen p {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.formular {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
justify-content: start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wichtig {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wichtigListe {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.freude {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid;
|
||||
}
|
||||
|
||||
.fusszeile {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.fusszeile td:first-child {
|
||||
border-left: none;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.fusszeile td {
|
||||
border-left: 3px solid;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
BIN
M4/emensa/public/favicon.ico
Normal file
|
After Width: | Height: | Size: 151 B |
BIN
M4/emensa/public/img/fh-logo.jpg
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
M4/emensa/public/img/mensa21.jpg
Normal file
|
After Width: | Height: | Size: 153 KiB |
BIN
M4/emensa/public/img/test.jpg
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
337
M4/emensa/public/index.php
Normal file
@@ -0,0 +1,337 @@
|
||||
<?php
|
||||
const VERBOSITY = 0;
|
||||
const PUBLIC_DIRNAME = "public";
|
||||
const CONFIG_WEBROUTES = "/../routes/web.php"; // like in laravel
|
||||
const CONFIG_DB = "/../config/db.php";
|
||||
const ROUTER_VERSION = '0.8.2';
|
||||
|
||||
assert_php_version('8.2.0');
|
||||
assert_path();
|
||||
|
||||
try {
|
||||
if (!file_exists(realpath($_SERVER['DOCUMENT_ROOT'] . "/../vendor/autoload.php"))) {
|
||||
echo "<h1>Abhängigkeiten nicht gefunden</h1><pre>DOCUMENT_ROOT: {$_SERVER['DOCUMENT_ROOT']}</pre><br><p>Datei nicht gefunden: <strong>{$_SERVER['DOCUMENT_ROOT']}/../vendor/autoload.php</strong></p>";
|
||||
echo "<p>Häufigste Ursache</p><ul>
|
||||
<li>Das Verzeichnis <code>public/</code> ist <em>nicht</em> als Wurzelverzeichnis verwendet worden.</li>
|
||||
<li>Die Abhängigkeiten wurden nicht mit <code>composer update</code> installiert.</code></li>
|
||||
</ul>";
|
||||
exit(1);
|
||||
}
|
||||
// file exists
|
||||
require_once realpath($_SERVER['DOCUMENT_ROOT'] . "/../vendor/autoload.php");
|
||||
|
||||
} catch (Exception $ex) {
|
||||
echo "<code>DOCUMENT_ROOT</code><br><pre>{$_SERVER['DOCUMENT_ROOT']}</pre><code>Error</code><br><pre>" . $ex->getMessage() . "</pre>";
|
||||
}
|
||||
|
||||
use eftec\bladeone\BladeOne;
|
||||
|
||||
/* Routing Script for PHP Dev Server */
|
||||
$verbosity = VERBOSITY;
|
||||
if (preg_match('/\.(?:css|js|png|jpg|jpeg|gif)$/', $_SERVER["REQUEST_URI"])) {
|
||||
return false;
|
||||
} else {
|
||||
if ($verbosity > 1) {
|
||||
echo
|
||||
"<pre>Verbosity-Level: <strong>{$verbosity}</strong></pre>" .
|
||||
"<pre>" . print_r($_SERVER, 1) . "</pre><hr>";
|
||||
}
|
||||
FrontController::handleRequest("$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]", $_SERVER['REQUEST_METHOD'], VERBOSITY);
|
||||
}
|
||||
|
||||
class RequestData
|
||||
{
|
||||
/**
|
||||
* @var array Request Querystring, broken down to key-value pairs
|
||||
*/
|
||||
public array $query;
|
||||
/**
|
||||
* @var array Request arguments from path, after cutting two segments out for controller and action names
|
||||
*/
|
||||
public array $args;
|
||||
/**
|
||||
* @var string HTTP Verb used
|
||||
*/
|
||||
public string $method;
|
||||
|
||||
public function getData()
|
||||
{
|
||||
return array_merge($_GET, $_POST);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPostData()
|
||||
{
|
||||
return $_POST;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getGetData()
|
||||
{
|
||||
return $_GET;
|
||||
}
|
||||
|
||||
/**
|
||||
* RequestData is the way the Router will provide information, use it in your Action methods.
|
||||
* @param $method string Verb used
|
||||
* @param $args array Arguments
|
||||
* @param $query array Key-Value Pairs
|
||||
*/
|
||||
public function __construct($method, $args, $query)
|
||||
{
|
||||
$this->query = $query;
|
||||
$this->args = $args;
|
||||
$this->method = $method;
|
||||
}
|
||||
}
|
||||
|
||||
class FrontController
|
||||
{
|
||||
|
||||
public static function handleRequest($url, $method = 'GET', $verbosity = 0, $configPath = CONFIG_WEBROUTES)
|
||||
{
|
||||
assert_blade(); // check if the class is found
|
||||
|
||||
if (!str_contains($url, ':')) $url = $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];
|
||||
|
||||
$scriptPath = dirname(__FILE__, 2) . '/';
|
||||
$controllerDirectory = $scriptPath . 'controllers/';
|
||||
|
||||
// get a router/web-like config array to override filebased convention
|
||||
$config = FrontController::getConfig($configPath);
|
||||
|
||||
// /Impressum/ --> ImpressumController->index()
|
||||
$request = parse_url($url);
|
||||
$ctrlName = $request['path'];
|
||||
$actionName = 'index';
|
||||
$args = array();
|
||||
$query = array();
|
||||
parse_str($request['query'] ?? "", $query);
|
||||
|
||||
// provide POST data
|
||||
if ($method != 'GET')
|
||||
$query = array_merge($query, $_REQUEST);
|
||||
|
||||
|
||||
// check, if route has two levels
|
||||
if (strpos($ctrlName, '/', 1) > 0) {
|
||||
$path = explode('/', $request['path']); // Werbeseite/Speise/1/mobile?pretty=true&user=marcel
|
||||
array_shift($path); // skip once
|
||||
$ctrlName = array_shift($path); // Werbeseite
|
||||
$actionName = array_shift($path); // Speise
|
||||
$args = $path; // remainder of path-parts // [1][mobile]
|
||||
if ($verbosity > 1) {
|
||||
echo "<pre>Request\n", print_r($request), "</pre>";
|
||||
echo "<pre>Path\n", print_r($path), "</pre>";
|
||||
echo "<pre>Query\n", print_r($query), "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
// fix: trim slashes
|
||||
$ctrlName = trim($ctrlName, '/');
|
||||
$actionName = trim($actionName, '/');
|
||||
|
||||
// $config based renaming of Controller/Action, precedes filebased convention
|
||||
// $config values must use syntax <ClassController>@<actionname>
|
||||
if (array_key_exists('/' . $ctrlName . '/' . $actionName, $config)) {
|
||||
$routingConfig = explode('@', $config['/' . $ctrlName . '/' . $actionName]);
|
||||
if ($verbosity > 0) {
|
||||
echo "<p>Routing Config matched request for <code>/" . $ctrlName . "/" . $actionName . "</code>:</p><p>routing config is</p><pre>" . print_r($routingConfig, 1) . '</pre>';
|
||||
}
|
||||
// important: overwriting controller and action name
|
||||
$ctrlClass = $routingConfig[0];
|
||||
$actionName = $routingConfig[1];
|
||||
} elseif (array_key_exists($request['path'], $config)) {
|
||||
// exact match on full path, this also means "/"
|
||||
$routingConfig = explode('@', $config[$request['path']]);
|
||||
if ($verbosity > 0) {
|
||||
echo "<p>Routing Config matched for full path <code>" . $request['path'] . "</code>:</p><p>routing config is</p><pre>" . print_r($routingConfig, 1) . '</pre>';
|
||||
}
|
||||
// important: overwriting controller and action name
|
||||
$ctrlClass = $routingConfig[0];
|
||||
$actionName = $routingConfig[1];
|
||||
} else {
|
||||
if ($verbosity > 0) {
|
||||
echo "Request $ctrlName/$actionName was not in \$config.";
|
||||
}
|
||||
|
||||
// fall back to filebased convention: match controller classes in directory
|
||||
$ctrlClass = ucfirst($ctrlName . 'Controller');
|
||||
}
|
||||
|
||||
$ctrlFile = ($ctrlClass . '.php');
|
||||
$validControllers = FrontController::getValidControllers($controllerDirectory);
|
||||
if (!in_array($controllerDirectory . $ctrlFile, $validControllers)) {
|
||||
if ($verbosity > 0) {
|
||||
echo "<div><p>Controller: $ctrlFile not found in</p><pre>" . print_r($validControllers, 1) . "</pre><p>Config Array:</p><pre>" . print_r($config, 1) . "</pre></div>";
|
||||
}
|
||||
// #ERROR
|
||||
FrontController::showErrorMessage("<h1>Web Software Error</h1><img alt='shrug' src='https://c.tenor.com/9TEDud6eP2UAAAAC/woody-woodpecker-shrug-shoulders.gif'>" .
|
||||
"<p>Keine entspreche Zuordnung der Route für {$ctrlName}::{$actionName} gefunden. Tippfehler in der Route?" .
|
||||
"<p>Es konnte keine Klasse <abbr title='Gesucht im Verzeichnis {$controllerDirectory}'>" . $ctrlFile . "</abbr> gefunden werden! Request fehlgeschlagen.</p>" .
|
||||
"<p> Prüfen Sie die Einträge in der Datei <code>config/web.php</code> und gleichen Sie den getätigten Aufruf damit ab.</p>");
|
||||
}
|
||||
|
||||
// a file matching has been found, now try to load the class
|
||||
try {
|
||||
require_once $controllerDirectory . $ctrlFile;
|
||||
// instantiate the controller
|
||||
|
||||
$controller = new $ctrlClass();
|
||||
$rd = new RequestData($method, $args, $query);
|
||||
|
||||
if ($verbosity > 0) {
|
||||
var_dump($controller, $rd);
|
||||
}
|
||||
// the controller will load model and view and return some html
|
||||
print call_user_func_array(array($controller, $actionName), array($rd));
|
||||
} catch (Exception $ex) {
|
||||
// #ERROR
|
||||
FrontController::showErrorMessage(
|
||||
"<h2>Fehler in Controller " . get_class($controller) . "!</h2><p>Stellen Sie sicher, dass die Action/der Controller existiert.</p>
|
||||
<p>Das Routing Config-Array hat " . count($config) . " Einträge.</p>
|
||||
<p><strong>Exception text</strong><br>" . $ex->getMessage() . "</p>");
|
||||
}
|
||||
}
|
||||
|
||||
public static function showErrorMessage($text, $severity = 3, $die = true)
|
||||
{
|
||||
$styles = array(0 => "background-color: #F08170; border: 2px solid lightgray; padding: 2em; margin: 5em; width: 50%; box-shadow: 0em 0em 1em #F08170;",
|
||||
1 => "background-color: #F08170; border: 2px solid lightgray; padding: 2em; margin: 5em; width: 50%; box-shadow: 0em 0em 1em #F08170;",
|
||||
2 => "background-color: #F08170; border: 2px solid lightgray; padding: 2em; margin: 5em; width: 50%; box-shadow: 0em 0em 1em #F08170;",
|
||||
3 => "background-color: #F08170; border: 2px solid lightgray; padding: 2em; margin: 5em; width: 50%; box-shadow: 0em 0em 1em #F08170;");
|
||||
print("<div style=\"{$styles[$severity]}\">{$text}</div>");
|
||||
if ($die) exit($severity);
|
||||
}
|
||||
|
||||
public static function getConfig($configPath)
|
||||
{
|
||||
try {
|
||||
// load the $config Array from a file given in $configPath
|
||||
$path_to_config = realpath($_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . $configPath);
|
||||
// print("Path to config " . $path_to_config);
|
||||
$config = include $path_to_config;
|
||||
} catch (Exception $e) {
|
||||
print_r($e);
|
||||
$config = array('/' => 'HomeController@index');
|
||||
} finally {
|
||||
return $config;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getValidControllers($path = '')
|
||||
{
|
||||
if ($path == '') {
|
||||
$path = getcwd() . DIRECTORY_SEPARATOR . 'controllers' . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
return glob($path . '*Controller.php');
|
||||
}
|
||||
}
|
||||
|
||||
function connectdb()
|
||||
{
|
||||
$path_to_config_db = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . CONFIG_DB;
|
||||
$config = include $path_to_config_db;
|
||||
$link = mysqli_connect( // Daten aus config/db.php
|
||||
$config['host'],
|
||||
$config['user'],
|
||||
$config['password'],
|
||||
$config['database'], // Auswahl der Datenbank
|
||||
$config['port'] ?? 3306);
|
||||
if (!$link) {
|
||||
FrontController::showErrorMessage("<h1>Verbindung mit der Datenbank nicht möglich</h1>
|
||||
<p style='margin-bottom: 2em;'>Verbindung fehlgeschlagen: <code>" . mysqli_connect_error() . "</code>.</p>
|
||||
<h2>Prüfen Sie</h2><ol><li>die Angaben in der Datei <code>config/db.php</code>:
|
||||
( ist Benutzer <code>{$config['user']}</code> an Datenbank <code>{$config['database']}</code> auf Server <code>{$config['host']}</code> korrekt?)<br>
|
||||
</li><li>ob Ihre Datenbank unter der oben gezeigten Adresse läuft </li></ol>");
|
||||
exit(1);
|
||||
}
|
||||
if (mysqli_connect_errno()) {
|
||||
FrontController::showErrorMessage("<h1>Verbindung mit der Datenbank nicht möglich</h1>
|
||||
<code>Fehlermeldung</code><pre>" . mysqli_connect_error() . "</pre>", 2, true);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
function view($viewname, $viewargs = array())
|
||||
{
|
||||
$views = dirname(__DIR__) . '/views';
|
||||
$cache = dirname(__DIR__) . '/storage/cache';
|
||||
$blade = new BladeOne($views, $cache, BladeOne::MODE_DEBUG);
|
||||
|
||||
return $blade->run($viewname, $viewargs);
|
||||
}
|
||||
|
||||
/**
|
||||
* let the script die if the php minimum version is not met.
|
||||
* @param $minversion
|
||||
* @return void
|
||||
*/
|
||||
function assert_php_version($minversion = '8.0.0')
|
||||
{
|
||||
$version_too_low = 0;
|
||||
$minver = explode('.', $minversion);
|
||||
$version = explode('.', phpversion());
|
||||
|
||||
if (intval($minver[0]) > intval($version[0])) {
|
||||
$version_too_low = 1;
|
||||
} elseif (intval($minver[1]) > intval($version[1])) {
|
||||
$version_too_low = 1;
|
||||
} elseif (intval($minver[2]) > intval($version[2])) {
|
||||
$version_too_low = 1;
|
||||
}
|
||||
|
||||
if ($version_too_low) {
|
||||
FrontController::showErrorMessage("Diese PHP-Version wird nicht unterstützt: <strong>Minimum PHP Version " . $minversion . "</strong><br>Sie betreiben gerade PHP Version " . phpversion());
|
||||
exit(1);
|
||||
}
|
||||
// version is okay, go on.
|
||||
}
|
||||
|
||||
/**
|
||||
* let the script die if the path contains problematic characters.
|
||||
* @return void
|
||||
*/
|
||||
function assert_path(): void
|
||||
{
|
||||
static $chars = array("[", "]", "{", "}");
|
||||
$charsfound = 0;
|
||||
str_ireplace($chars, '', $_SERVER['DOCUMENT_ROOT'], $charsfound);
|
||||
if ($charsfound > 0) {
|
||||
FrontController::showErrorMessage("<h1>Bitte verwenden Sie einen anderen Ordner für das Projekt!</h1>
|
||||
<p>Der Pfad <strong>" . $_SERVER['DOCUMENT_ROOT'] . "</strong> enthält <code>" . $charsfound . "</code> problematische Zeichen, die die korrekte Ausführung verhindern.</p>>
|
||||
<p>Bekannte problematische Zeichen sind</p>
|
||||
<pre> " . implode(" ", $chars) . " </pre>");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function assert_blade(): void
|
||||
{
|
||||
if (!class_exists('eftec\bladeone\BladeOne')) {
|
||||
// #ERROR
|
||||
FrontController::showErrorMessage("
|
||||
<h1>Fehler: Blade wurde nicht gefunden</h1>
|
||||
<p>Tipps für die Lösung:</p>
|
||||
<ul>
|
||||
<li><p>führen Sie im Terminal folgende Zeilen aus.</p>
|
||||
<ol>
|
||||
<li><code>php bin/composer.phar update</code> oder <code>php bin/composer.phar reinstall eftec/bladeone</code></li>
|
||||
<li><code>php bin/composer.phar dump-autoload</code></li>
|
||||
</ol>
|
||||
<li><p>Prüfen Sie im Anschluss: befindet sich in dem Ordner <code>vendor/eftec/bladeone/lib/</code> die Datei <code>BladeOne.php</code> ?</p></li>
|
||||
<li><p>Starten Sie dann den Webserver neu.</p></li>
|
||||
<li><p>Befragen Sie gerne auch das Forum in Ilias.</p></li>
|
||||
</ul>
|
||||
|
||||
</div>");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
593
M4/emensa/public/js/highlight.min.js
vendored
Normal file
24
M4/emensa/routes/web.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Mapping of paths to controllers.
|
||||
* Note, that the path only supports one level of directory depth:
|
||||
* /demo is ok,
|
||||
* /demo/subpage will not work as expected
|
||||
*/
|
||||
|
||||
return array(
|
||||
'/' => "MainController@index",
|
||||
"/demo" => "DemoController@demo",
|
||||
'/dbconnect' => 'DemoController@dbconnect',
|
||||
'/debug' => 'HomeController@debug',
|
||||
'/error' => 'DemoController@error',
|
||||
'/requestdata' => 'DemoController@requestdata',
|
||||
|
||||
// Erstes Beispiel:
|
||||
'/m4_6a_queryparameter' => 'ExampleController@m4_6a_queryparameter',
|
||||
'/m4' => 'ExampleController@m4_6a_queryparameter',
|
||||
'/m4_7b_kategorie' => 'ExampleController@m4_7b_kategorie',
|
||||
'/m4_7c_gerichte' => 'ExampleController@m4_7c_gerichte',
|
||||
'/m4_7d' => 'ExampleController@m4_7d'
|
||||
|
||||
);
|
||||
23
M4/emensa/storage/cache/.layouts.layout_7b6f1811f474eb66a51163e3ee689e7d001c551d.bladec
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="DE">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>E-Mensa Routing Script</title>
|
||||
<meta name="description" content="unused">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/default.min.css">
|
||||
<?php echo $this->yieldContent("cssextra"); ?>
|
||||
<meta name="theme-color" content="#dadada">
|
||||
<!-- good developers check the markup ;) -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php echo $this->yieldContent("content"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo $this->yieldContent("jsextra"); ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
21
M4/emensa/storage/cache/.layouts.m4_7d_layout_ecc36cbad49aa38782cc08cc5e9ca6c7ae3590d0.bladec
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="DE">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title><?php echo \htmlentities($title??'', ENT_QUOTES, 'UTF-8', false); ?></title>
|
||||
|
||||
<?php echo $this->yieldContent("header"); ?>
|
||||
|
||||
<!-- good developers check the markup ;) -->
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $this->yieldContent("body"); ?>
|
||||
|
||||
<footer>
|
||||
<table class="fusszeile">
|
||||
<?php echo $this->yieldContent("footer"); ?>
|
||||
</table>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
6
M4/emensa/storage/cache/debug_1cfaf3bc805922afe3272185b5787ee3e27fa4ad.bladec
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>This is a blade view showing phpinfo();</h1>
|
||||
<p><a href="/">go back</a>.</p>
|
||||
|
||||
<?php
|
||||
phpinfo();
|
||||
?>
|
||||
32
M4/emensa/storage/cache/demo.dbdata_371b3aba36aa73bbc6704e7ce839ac185b43f3a9.bladec
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<?php if(isset($data['error'])): ?>
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> <?php echo \htmlentities($data['beschreibung']??'', ENT_QUOTES, 'UTF-8', false); ?></pre>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Gerichte</h1>
|
||||
<p>Der Controller inkludiert das benötigte Model (gerichte.php in diesem Fall)
|
||||
und ruft die benötigte Funktion <code>db_gerichte_select_all()</code> zum Laden der Daten auf</p>
|
||||
<ul>
|
||||
<?php $__empty_1 = true; foreach($data as $a): $__empty_1 = false; ?>
|
||||
<li><?php echo \htmlentities($a['name']??'', ENT_QUOTES, 'UTF-8', false); ?></li>
|
||||
<?php endforeach; if ($__empty_1): ?>
|
||||
<li>Keine Daten vorhanden.</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
</html>
|
||||
94
M4/emensa/storage/cache/demo.demo_ce8d2fe4373603a01d84973e3d70c715b31a9f25.bladec
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php $_shouldextend[1]=1; ?>
|
||||
|
||||
<?php $this->startSection("content"); ?>
|
||||
<div>
|
||||
<h1>Demo für <?php echo \htmlentities($name??'', ENT_QUOTES, 'UTF-8', false); ?></h1>
|
||||
<p>Kurze Übersicht, wie die Arbeit mit dem Router und der Blade View-Engine funktioniert.</p>
|
||||
|
||||
<h2>Router</h2>
|
||||
<p>Der Router nimmt den Request entgegen und zerlegt ihn in die einzelnen Teile der URI. Wichtig ist hier vor
|
||||
allem der Pfad und der Querystring.</p>
|
||||
<p>Wenn der Pfad in der Routenkonfiguration (<code>\$config</code> Array aus der Datei
|
||||
<code>routes/web.php</code>) gefunden wird, lädt der Router die angegebene Klasse.</p>
|
||||
|
||||
<h3>Funktionsweise</h3>
|
||||
<p>Im vorliegenden Beispiel sehen Sie diese Seite ... </p>
|
||||
<ol>
|
||||
<li>weil der Pfad in der Routenkonfiguration gefunden wurde</li>
|
||||
<li>und dort <span class="code">'DemoController@howto'</span> hinterlegt ist</li>
|
||||
<li>und im Ordner <span class="code">controllers/</span> die Datei <code class="language-php">DemoController.php</code> gefunden werden konnte
|
||||
</li>
|
||||
<li>und mit ihr ein Objekt des Typs <span class="code">DemoController</span> instanziiert werden konnte</li>
|
||||
<li>und dieses Objekt die Funktion (Action) <span class="code">howto()</span> ausgeführt hat</li>
|
||||
</ol>
|
||||
<p>Sie sehen: da muss einiges stimmen und vieles davon ist Konvention.</p>
|
||||
<h3>Querystrings und Pfadsegmente</h3>
|
||||
<p>Die Actions in den Controller-Klassen sollen per Konvention immer ein <span class="code">RequestData</span> Objekt
|
||||
entgegennehmen. Beispiel: <code class="language-php">howto(RequestData \$rd)</code></p>
|
||||
<p>Dieses RequestData Objekt wird durch den Router befüllt, wenn Daten in der URL extrahiert werden konnten.</p>
|
||||
<p>Daten finden sich URLs...</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
<strong>im Querystring</strong><br>Beispiel: rufen Sie diese mit
|
||||
<code class="language-http"><?php echo \htmlentities(strtolower(explode('/',$_SERVER["SERVER_PROTOCOL"])[0])??'', ENT_QUOTES, 'UTF-8', false); ?>://<?php echo \htmlentities($_SERVER["HTTP_HOST"]??'', ENT_QUOTES, 'UTF-8', false); ?>/demo?<strong>bgcolor=fefbd8&name=Remmy</strong></code>
|
||||
auf, werden <span class="language-php">bgcolor</span> und <code class="language-php">name</code> mitsamt Werten als Query Array
|
||||
<code class="language-php">$rd->query</code>) übergeben
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Probieren Sie es aus ;)</p>
|
||||
<?php if(count($rd->args)): ?>
|
||||
<p><strong>Argumente dieses Aufrufs:</strong></p>
|
||||
|
||||
<?php $__empty_1 = true; foreach($rd->args as $a): $__empty_1 = false; ?>
|
||||
<div><span class="code"><?php echo \htmlentities($a??'', ENT_QUOTES, 'UTF-8', false); ?></span></div>
|
||||
<?php endforeach; if ($__empty_1): ?>
|
||||
<p>Keine weiteren Argumente im Request</p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if(count($rd->query)): ?>
|
||||
<p><strong>Daten aus der Query dieses Aufrufs:</strong></p>
|
||||
<pre><code class="language-php">
|
||||
<?php $__empty_1 = true; foreach($rd->query as $k => $v): $__empty_1 = false; ?>
|
||||
$rd->query['<?php echo \htmlentities($k??'', ENT_QUOTES, 'UTF-8', false); ?>']=<?php echo \htmlentities($v??'', ENT_QUOTES, 'UTF-8', false); ?>
|
||||
|
||||
<?php endforeach; if ($__empty_1): ?>
|
||||
<p>Keine Querydaten</p>
|
||||
<?php endif; ?>
|
||||
</code></pre>
|
||||
<?php endif; ?>
|
||||
<h2>Blade</h2>
|
||||
<p>Blade <a href="https://github.com/EFTEC/BladeOne#install-pick-one-of-the-next-one">muss installiert</a> sein.
|
||||
Die Installation ist bereits geschehen und die Bibliothek liegt unter /vendor.
|
||||
</p>
|
||||
<h3>Daten übergeben und View rendern</h3>
|
||||
<p>Bei der Verwendung der View-Engine gelten einige Konventionen:
|
||||
Die Dateien müssen <code class="language-php"><viewname>.blade.php</code> heißen und im Ordner <code class="language-php">views</code> liegen.
|
||||
</p>
|
||||
<p>Sie können der View dann Daten mitgeben, indem Sie alle Daten in ein Array schreiben und dieses dann
|
||||
übergeben.</p>
|
||||
<p>Beispiel:</p>
|
||||
<pre><code class="language-php">
|
||||
view("viewtest",
|
||||
array(
|
||||
"texts"=>$textArray,
|
||||
"persona"=>$persona,
|
||||
"rd"=>$rd
|
||||
)); // öffnet ../views/viewtest.blade.php
|
||||
</code></pre>
|
||||
</div>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("cssextra"); ?>
|
||||
<style>
|
||||
body > div {background-color: <?php echo \htmlentities('#' . $bgcolor??'', ENT_QUOTES, 'UTF-8', false); ?>; }
|
||||
</style>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("jsextra"); ?>
|
||||
<script src="/js/highlight.min.js"></script><script>hljs.highlightAll();</script>
|
||||
<?php $this->stopSection(); ?>
|
||||
<?php if (isset($_shouldextend[1])) { echo $this->runChild(".layouts.layout"); } ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>7a</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Der Wert von name lautet: <?php echo \htmlentities($request??'', ENT_QUOTES, 'UTF-8', false); ?>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
41
M4/emensa/storage/cache/examples.m4_7b_kategorie_c59dd864b2a765e6d956c6e0068f677059df2848.bladec
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
font-weight: 300;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php if(isset($data['error'])): ?>
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> <?php echo \htmlentities($data['beschreibung']??'', ENT_QUOTES, 'UTF-8', false); ?></pre>
|
||||
|
||||
<?php else: ?>
|
||||
<?php
|
||||
$zweites = false; ?>
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Kategorien</h1>
|
||||
|
||||
<ul>
|
||||
<?php $__empty_1 = true; foreach($data as $a): $__empty_1 = false; ?>
|
||||
<?php if($zweites): ?> <h1><li><?php echo \htmlentities($a['name']??'', ENT_QUOTES, 'UTF-8', false); ?></li></h1> <?php $zweites = false; ?>
|
||||
<?php else: ?>
|
||||
<li><?php echo \htmlentities($a['name']??'', ENT_QUOTES, 'UTF-8', false); ?></li> <?php $zweites = true; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; if ($__empty_1): ?>
|
||||
<li>Keine Daten vorhanden.</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
34
M4/emensa/storage/cache/examples.m4_7c_gerichte_f6e172e91bf4a8eefe847109a3dadc12c05eac5d.bladec
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php if(isset($data['error'])): ?>
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> <?php echo \htmlentities($data['beschreibung']??'', ENT_QUOTES, 'UTF-8', false); ?></pre>
|
||||
|
||||
<?php else: ?>
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Kategorien</h1>
|
||||
|
||||
<ul>
|
||||
<?php $__empty_1 = true; foreach($data as $a): $__empty_1 = false; ?>
|
||||
<?php if(!empty($a['name'])): ?>
|
||||
<li><?php echo \htmlentities($a['name']??'', ENT_QUOTES, 'UTF-8', false); ?></li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endforeach; if ($__empty_1): ?>
|
||||
<li>Es sind keine Gerichte vorhanden</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php $_shouldextend[1]=1; ?>
|
||||
|
||||
<?php $this->startSection("header"); ?>
|
||||
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("body"); ?>
|
||||
<p>Page 1</p>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("footer"); ?>
|
||||
<p>Footer of Page 1</p>
|
||||
<?php $this->stopSection(); ?>
|
||||
<?php if (isset($_shouldextend[1])) { echo $this->runChild(".layouts.m4_7d_layout",['title' => "Page 1"]); } ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php $_shouldextend[1]=1; ?>
|
||||
|
||||
<?php $this->startSection("header"); ?>
|
||||
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("body"); ?>
|
||||
<p>Page 2</p>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("footer"); ?>
|
||||
<p>Footer of Page 2</p>
|
||||
<?php $this->stopSection(); ?>
|
||||
<?php if (isset($_shouldextend[1])) { echo $this->runChild(".layouts.m4_7d_layout",['title' => "Page 2"]); } ?>
|
||||
36
M4/emensa/storage/cache/home_be3f101c28919ade210629435b0b22d1f6f23f27.bladec
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php $_shouldextend[1]=1; ?>
|
||||
|
||||
<?php $this->startSection("content"); ?>
|
||||
<header class="mt-5">
|
||||
<h1>Hauptseite E-Mensa</h1>
|
||||
<img src="/img/test.jpg"
|
||||
alt="Testbild von https://cdn.pixabay.com/photo/2014/06/03/19/38/road-sign-361513_960_720.jpg">
|
||||
</header>
|
||||
<nav class="mt-5">
|
||||
<strong>Navigation</strong>
|
||||
<ul>
|
||||
<li><a href="/demo">Demo</a></li>
|
||||
<li><a href="/dbconnect">Datenbank: Gerichte</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="/debug"><code class="language-php">phpinfo();</code></a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<footer>
|
||||
© Team-Name DBWT
|
||||
</footer>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("cssextra"); ?>
|
||||
<style>
|
||||
body > div {
|
||||
background-color: <?php echo \htmlentities($rd->query['bgcolor'] ?? 'ffffff'??'', ENT_QUOTES, 'UTF-8', false); ?>
|
||||
|
||||
}
|
||||
</style>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("jsextra"); ?>
|
||||
<script src="/js/highlight.min.js"></script><script>hljs.highlightAll();</script>
|
||||
<?php $this->stopSection(); ?>
|
||||
<?php if (isset($_shouldextend[1])) { echo $this->runChild("layouts.layout"); } ?>
|
||||
23
M4/emensa/storage/cache/layouts.layout_2f0f79205058eeea097745ed1e89073738d8b7f7.bladec
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="DE">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>E-Mensa Routing Script</title>
|
||||
<meta name="description" content="unused">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="css/default.min.css">
|
||||
<?php echo $this->yieldContent("cssextra"); ?>
|
||||
<meta name="theme-color" content="#dadada">
|
||||
<!-- good developers check the markup ;) -->
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<?php echo $this->yieldContent("content"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo $this->yieldContent("jsextra"); ?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
30
M4/emensa/storage/cache/layouts.main_layout_ff0dbbbcc8c331f06acac2bd395c317de615c9d1.bladec
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<!doctype html>
|
||||
<html class="no-js" lang="DE">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title><?php echo \htmlentities($title??'', ENT_QUOTES, 'UTF-8', false); ?></title>
|
||||
|
||||
<?php echo $this->yieldContent("header"); ?>
|
||||
|
||||
<!-- good developers check the markup ;) -->
|
||||
</head>
|
||||
<body>
|
||||
<?php echo $this->yieldContent("nav"); ?>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div></div>
|
||||
<div>
|
||||
<?php echo $this->yieldContent("text"); ?>
|
||||
|
||||
<?php echo $this->yieldContent("gerichte"); ?>
|
||||
</div>
|
||||
<div></div>
|
||||
</div>
|
||||
<footer>
|
||||
<table class="fusszeile">
|
||||
<?php echo $this->yieldContent("footer"); ?>
|
||||
</table>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
62
M4/emensa/storage/cache/main.index_f9ba54cc63d68ab97f296301b5ce3ed3926b073a.bladec
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php $_shouldextend[1]=1; ?>
|
||||
|
||||
<?php $this->startSection("header"); ?>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("nav"); ?>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<img src="/img/fh-logo.jpg" alt="FH-Logo">
|
||||
</div>
|
||||
<div>
|
||||
<a href="#ankündigung">Ankündigung</a>
|
||||
<a href="#speisen">Speisen</a>
|
||||
<a href="#zahlen">Zahlen</a>
|
||||
<a href="#kontakt">Kontakt</a>
|
||||
<a href="#wichtig">Wichtig für uns</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("text"); ?>
|
||||
|
||||
<img src="/img/mensa21.jpg" alt="Essen">
|
||||
<h1 id="ankündigung">Bald gibt es auch Essen online ;)</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
|
||||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
|
||||
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
|
||||
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
|
||||
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
|
||||
sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
|
||||
<h1 id="speisen">Köstlichkeiten die Sie erwarten</h1>
|
||||
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("gerichte"); ?>
|
||||
|
||||
<?php if(isset($data['error'])): ?>
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> <?php echo \htmlentities($data['beschreibung']??'', ENT_QUOTES, 'UTF-8', false); ?></pre>
|
||||
|
||||
<?php else: ?>
|
||||
<?php
|
||||
echo $data["gericht"];
|
||||
echo $data["allergene"];
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $this->stopSection(); ?>
|
||||
|
||||
<?php $this->startSection("footer"); ?>
|
||||
|
||||
<tr>
|
||||
<td>(c) E-Mensa GmbH</td>
|
||||
<td>Şafak Hazinedar & Robert Joel</td>
|
||||
<td><a href="">Impressum</a></td>
|
||||
</tr>
|
||||
|
||||
<?php $this->stopSection(); ?>
|
||||
<?php if (isset($_shouldextend[1])) { echo $this->runChild("layouts.main_layout", ['title' => "E-Mensa"]); } ?>
|
||||
25
M4/emensa/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
if (PHP_VERSION_ID < 50600) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, $err);
|
||||
} elseif (!headers_sent()) {
|
||||
echo $err;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
$err,
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit0a19be8f09bdc5d4e2b07ba9e95a5801::getLoader();
|
||||
18
M4/emensa/vendor/bin/bladeonecli
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Proxy PHP file generated by Composer
|
||||
*
|
||||
* This file includes the referenced bin path (../eftec/bladeone/lib/bladeonecli)
|
||||
*
|
||||
* @generated
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
$GLOBALS['_composer_bin_dir'] = __DIR__;
|
||||
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
|
||||
|
||||
|
||||
return include __DIR__ . '/..'.'/eftec/bladeone/lib/bladeonecli';
|
||||
579
M4/emensa/vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,579 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see https://www.php-fig.org/psr/psr-0/
|
||||
* @see https://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
/** @var \Closure(string):void */
|
||||
private static $includeFile;
|
||||
|
||||
/** @var string|null */
|
||||
private $vendorDir;
|
||||
|
||||
// PSR-4
|
||||
/**
|
||||
* @var array<string, array<string, int>>
|
||||
*/
|
||||
private $prefixLengthsPsr4 = array();
|
||||
/**
|
||||
* @var array<string, list<string>>
|
||||
*/
|
||||
private $prefixDirsPsr4 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
/**
|
||||
* List of PSR-0 prefixes
|
||||
*
|
||||
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
|
||||
*
|
||||
* @var array<string, array<string, list<string>>>
|
||||
*/
|
||||
private $prefixesPsr0 = array();
|
||||
/**
|
||||
* @var list<string>
|
||||
*/
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
/** @var bool */
|
||||
private $useIncludePath = false;
|
||||
|
||||
/**
|
||||
* @var array<string, string>
|
||||
*/
|
||||
private $classMap = array();
|
||||
|
||||
/** @var bool */
|
||||
private $classMapAuthoritative = false;
|
||||
|
||||
/**
|
||||
* @var array<string, bool>
|
||||
*/
|
||||
private $missingClasses = array();
|
||||
|
||||
/** @var string|null */
|
||||
private $apcuPrefix;
|
||||
|
||||
/**
|
||||
* @var array<string, self>
|
||||
*/
|
||||
private static $registeredLoaders = array();
|
||||
|
||||
/**
|
||||
* @param string|null $vendorDir
|
||||
*/
|
||||
public function __construct($vendorDir = null)
|
||||
{
|
||||
$this->vendorDir = $vendorDir;
|
||||
self::initializeIncludeClosure();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, list<string>>
|
||||
*/
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string> Array of classname => path
|
||||
*/
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, string> $classMap Class to filename map
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
$paths = (array) $paths;
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
$paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
$paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param list<string>|string $paths The PSR-0 base directories
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param list<string>|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
|
||||
if (null === $this->vendorDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($prepend) {
|
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
||||
} else {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
self::$registeredLoaders[$this->vendorDir] = $this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
|
||||
if (null !== $this->vendorDir) {
|
||||
unset(self::$registeredLoaders[$this->vendorDir]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return true|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
$includeFile = self::$includeFile;
|
||||
$includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the currently registered loaders keyed by their corresponding vendor directories.
|
||||
*
|
||||
* @return array<string, self>
|
||||
*/
|
||||
public static function getRegisteredLoaders()
|
||||
{
|
||||
return self::$registeredLoaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param string $ext
|
||||
* @return string|false
|
||||
*/
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath . '\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private static function initializeIncludeClosure()
|
||||
{
|
||||
if (self::$includeFile !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
self::$includeFile = \Closure::bind(static function($file) {
|
||||
include $file;
|
||||
}, null, null);
|
||||
}
|
||||
}
|
||||
359
M4/emensa/vendor/composer/InstalledVersions.php
vendored
Normal file
@@ -0,0 +1,359 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use Composer\Semver\VersionParser;
|
||||
|
||||
/**
|
||||
* This class is copied in every Composer installed project and available to all
|
||||
*
|
||||
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
||||
*
|
||||
* To require its presence, you can require `composer-runtime-api ^2.0`
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class InstalledVersions
|
||||
{
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
|
||||
*/
|
||||
private static $installed;
|
||||
|
||||
/**
|
||||
* @var bool|null
|
||||
*/
|
||||
private static $canGetVendors;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static $installedByVendor = array();
|
||||
|
||||
/**
|
||||
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
||||
*
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackages()
|
||||
{
|
||||
$packages = array();
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
$packages[] = array_keys($installed['versions']);
|
||||
}
|
||||
|
||||
if (1 === \count($packages)) {
|
||||
return $packages[0];
|
||||
}
|
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all package names with a specific type e.g. 'library'
|
||||
*
|
||||
* @param string $type
|
||||
* @return string[]
|
||||
* @psalm-return list<string>
|
||||
*/
|
||||
public static function getInstalledPackagesByType($type)
|
||||
{
|
||||
$packagesByType = array();
|
||||
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
foreach ($installed['versions'] as $name => $package) {
|
||||
if (isset($package['type']) && $package['type'] === $type) {
|
||||
$packagesByType[] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $packagesByType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package is installed
|
||||
*
|
||||
* This also returns true if the package name is provided or replaced by another package
|
||||
*
|
||||
* @param string $packageName
|
||||
* @param bool $includeDevRequirements
|
||||
* @return bool
|
||||
*/
|
||||
public static function isInstalled($packageName, $includeDevRequirements = true)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (isset($installed['versions'][$packageName])) {
|
||||
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given package satisfies a version constraint
|
||||
*
|
||||
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
||||
*
|
||||
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
||||
*
|
||||
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
||||
* @param string $packageName
|
||||
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
||||
* @return bool
|
||||
*/
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
||||
{
|
||||
$constraint = $parser->parseConstraints((string) $constraint);
|
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
||||
|
||||
return $provided->matches($constraint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version constraint representing all the range(s) which are installed for a given package
|
||||
*
|
||||
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
||||
* whether a given version of a package is installed, and not just whether it exists
|
||||
*
|
||||
* @param string $packageName
|
||||
* @return string Version constraint usable with composer/semver
|
||||
*/
|
||||
public static function getVersionRanges($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$ranges = array();
|
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
||||
}
|
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
||||
}
|
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
||||
}
|
||||
|
||||
return implode(' || ', $ranges);
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
||||
*/
|
||||
public static function getPrettyVersion($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['pretty_version'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
||||
*/
|
||||
public static function getReference($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $installed['versions'][$packageName]['reference'];
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $packageName
|
||||
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
||||
*/
|
||||
public static function getInstallPath($packageName)
|
||||
{
|
||||
foreach (self::getInstalled() as $installed) {
|
||||
if (!isset($installed['versions'][$packageName])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
||||
}
|
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
|
||||
*/
|
||||
public static function getRootPackage()
|
||||
{
|
||||
$installed = self::getInstalled();
|
||||
|
||||
return $installed[0]['root'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw installed.php data for custom implementations
|
||||
*
|
||||
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
||||
* @return array[]
|
||||
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
|
||||
*/
|
||||
public static function getRawData()
|
||||
{
|
||||
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
self::$installed = include __DIR__ . '/installed.php';
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
return self::$installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
||||
*
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
public static function getAllRawData()
|
||||
{
|
||||
return self::getInstalled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets you reload the static array from another file
|
||||
*
|
||||
* This is only useful for complex integrations in which a project needs to use
|
||||
* this class but then also needs to execute another project's autoloader in process,
|
||||
* and wants to ensure both projects have access to their version of installed.php.
|
||||
*
|
||||
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
||||
* the data it needs from this class, then call reload() with
|
||||
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
||||
* the project in which it runs can then also use this class safely, without
|
||||
* interference between PHPUnit's dependencies and the project's dependencies.
|
||||
*
|
||||
* @param array[] $data A vendor/composer/installed.php data set
|
||||
* @return void
|
||||
*
|
||||
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
|
||||
*/
|
||||
public static function reload($data)
|
||||
{
|
||||
self::$installed = $data;
|
||||
self::$installedByVendor = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
|
||||
*/
|
||||
private static function getInstalled()
|
||||
{
|
||||
if (null === self::$canGetVendors) {
|
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
||||
}
|
||||
|
||||
$installed = array();
|
||||
|
||||
if (self::$canGetVendors) {
|
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
||||
if (isset(self::$installedByVendor[$vendorDir])) {
|
||||
$installed[] = self::$installedByVendor[$vendorDir];
|
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require $vendorDir.'/composer/installed.php';
|
||||
$installed[] = self::$installedByVendor[$vendorDir] = $required;
|
||||
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
||||
self::$installed = $installed[count($installed) - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null === self::$installed) {
|
||||
// only require the installed.php file if this file is loaded from its dumped location,
|
||||
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
||||
if (substr(__DIR__, -8, 1) !== 'C') {
|
||||
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
|
||||
$required = require __DIR__ . '/installed.php';
|
||||
self::$installed = $required;
|
||||
} else {
|
||||
self::$installed = array();
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$installed !== array()) {
|
||||
$installed[] = self::$installed;
|
||||
}
|
||||
|
||||
return $installed;
|
||||
}
|
||||
}
|
||||
21
M4/emensa/vendor/composer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
10
M4/emensa/vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
);
|
||||
9
M4/emensa/vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
10
M4/emensa/vendor/composer/autoload_psr4.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(__DIR__);
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'eftec\\bladeone\\' => array($vendorDir . '/eftec/bladeone/lib'),
|
||||
);
|
||||
38
M4/emensa/vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit0a19be8f09bdc5d4e2b07ba9e95a5801
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Composer\Autoload\ClassLoader
|
||||
*/
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
require __DIR__ . '/platform_check.php';
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit0a19be8f09bdc5d4e2b07ba9e95a5801', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit0a19be8f09bdc5d4e2b07ba9e95a5801', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit0a19be8f09bdc5d4e2b07ba9e95a5801::getInitializer($loader));
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
36
M4/emensa/vendor/composer/autoload_static.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit0a19be8f09bdc5d4e2b07ba9e95a5801
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'e' =>
|
||||
array (
|
||||
'eftec\\bladeone\\' => 15,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'eftec\\bladeone\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/eftec/bladeone/lib',
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit0a19be8f09bdc5d4e2b07ba9e95a5801::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit0a19be8f09bdc5d4e2b07ba9e95a5801::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit0a19be8f09bdc5d4e2b07ba9e95a5801::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
68
M4/emensa/vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"name": "eftec/bladeone",
|
||||
"version": "4.9",
|
||||
"version_normalized": "4.9.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EFTEC/BladeOne.git",
|
||||
"reference": "019036c226086fbe7591360d260067c5d82400ca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/EFTEC/BladeOne/zipball/019036c226086fbe7591360d260067c5d82400ca",
|
||||
"reference": "019036c226086fbe7591360d260067c5d82400ca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.23"
|
||||
},
|
||||
"suggest": {
|
||||
"eftec/bladeonehtml": "Extension to create forms",
|
||||
"ext-mbstring": "This extension is used if it's active"
|
||||
},
|
||||
"time": "2023-05-01T12:48:42+00:00",
|
||||
"bin": [
|
||||
"lib/bladeonecli"
|
||||
],
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"eftec\\bladeone\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jorge Patricio Castro Castillo",
|
||||
"email": "jcastro@eftec.cl"
|
||||
}
|
||||
],
|
||||
"description": "The standalone version Blade Template Engine from Laravel in a single php file",
|
||||
"homepage": "https://github.com/EFTEC/BladeOne",
|
||||
"keywords": [
|
||||
"blade",
|
||||
"php",
|
||||
"template",
|
||||
"templating",
|
||||
"view"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/EFTEC/BladeOne/issues",
|
||||
"source": "https://github.com/EFTEC/BladeOne/tree/4.9"
|
||||
},
|
||||
"install-path": "../eftec/bladeone"
|
||||
}
|
||||
],
|
||||
"dev": true,
|
||||
"dev-package-names": []
|
||||
}
|
||||
32
M4/emensa/vendor/composer/installed.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php return array(
|
||||
'root' => array(
|
||||
'name' => 'emensa/mvc',
|
||||
'pretty_version' => 'dev-ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'version' => 'dev-ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'reference' => 'ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
'eftec/bladeone' => array(
|
||||
'pretty_version' => '4.9',
|
||||
'version' => '4.9.0.0',
|
||||
'reference' => '019036c226086fbe7591360d260067c5d82400ca',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../eftec/bladeone',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'emensa/mvc' => array(
|
||||
'pretty_version' => 'dev-ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'version' => 'dev-ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'reference' => 'ac3eb12ab743c0c1f7fa1538586ff366402d472a',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
),
|
||||
);
|
||||
26
M4/emensa/vendor/composer/platform_check.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
// platform_check.php @generated by Composer
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70205)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
if (!headers_sent()) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
}
|
||||
if (!ini_get('display_errors')) {
|
||||
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
||||
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
||||
} elseif (!headers_sent()) {
|
||||
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
||||
}
|
||||
}
|
||||
trigger_error(
|
||||
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
||||
E_USER_ERROR
|
||||
);
|
||||
}
|
||||
39
M4/emensa/vendor/eftec/bladeone/.github/workflows/php.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: PHP Composer
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Validate composer.json and composer.lock
|
||||
run: composer validate --strict
|
||||
|
||||
- name: Cache Composer packages
|
||||
id: composer-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: vendor
|
||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-php-
|
||||
|
||||
- name: Install dependencies
|
||||
run: composer install --prefer-dist --no-progress
|
||||
|
||||
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
|
||||
# Docs: https://getcomposer.org/doc/articles/scripts.md
|
||||
|
||||
# - name: Run test suite
|
||||
# run: composer run-script test
|
||||
21
M4/emensa/vendor/eftec/bladeone/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Jorge Patricio Castro Castillo
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice, other copyright notices and this permission notice
|
||||
shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
49
M4/emensa/vendor/eftec/bladeone/composer.json
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "eftec/bladeone",
|
||||
"description": "The standalone version Blade Template Engine from Laravel in a single php file",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"blade",
|
||||
"template",
|
||||
"view",
|
||||
"php",
|
||||
"templating"
|
||||
],
|
||||
"homepage": "https://github.com/EFTEC/BladeOne",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jorge Patricio Castro Castillo",
|
||||
"email": "jcastro@eftec.cl"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"ext-json": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "This extension is used if it's active",
|
||||
"eftec/bladeonehtml": "Extension to create forms"
|
||||
},
|
||||
"archive": {
|
||||
"exclude": [
|
||||
"/examples"
|
||||
]
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"eftec\\bladeone\\": "lib/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"eftec\\tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"bin": [
|
||||
"lib/bladeonecli"
|
||||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^8.5.23"
|
||||
}
|
||||
}
|
||||
4315
M4/emensa/vendor/eftec/bladeone/lib/BladeOne.php
vendored
Normal file
328
M4/emensa/vendor/eftec/bladeone/lib/BladeOneCache.php
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
<?php /** @noinspection UnknownInspectionInspection */
|
||||
|
||||
|
||||
|
||||
/** @noinspection TypeUnsafeComparisonInspection */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace eftec\bladeone;
|
||||
|
||||
use Exception;
|
||||
use function fclose;
|
||||
use function file_put_contents;
|
||||
use function filemtime;
|
||||
use function filesize;
|
||||
use function fopen;
|
||||
use function fwrite;
|
||||
use function is_array;
|
||||
use function is_object;
|
||||
use function ob_get_contents;
|
||||
use function print_r;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use function time;
|
||||
|
||||
/**
|
||||
* trait BladeOneCache
|
||||
* Copyright (c) 2016 Jorge Patricio Castro Castillo MIT License. Don't delete this comment, its part of the license.
|
||||
* Extends the tags of the class BladeOne. Its optional
|
||||
* It adds the next tags to the template
|
||||
* <code>
|
||||
* @ cache([cacheid],[duration=86400]). The id is optional. The duration of the cache is in seconds
|
||||
* // content here
|
||||
* @ endcache()
|
||||
* </code>
|
||||
* It also adds a new function (optional) to the business or logic layer
|
||||
* <code>
|
||||
* if ($blade->cacheExpired('hellocache',1,5)) { //'helloonecache' =template, =1 id cache, 5=duration (seconds)
|
||||
* // cache expired, so we should do some stuff (such as read from the database)
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @package BladeOneCache
|
||||
* @version 3.42 2020-04-25
|
||||
* @link https://github.com/EFTEC/BladeOne
|
||||
* @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
|
||||
*/
|
||||
trait BladeOneCache
|
||||
{
|
||||
protected $curCacheId = 0;
|
||||
protected $curCacheDuration = 0;
|
||||
protected $curCachePosition = 0;
|
||||
protected $cacheRunning = false;
|
||||
protected $cachePageRunning = false;
|
||||
protected $cacheLog;
|
||||
/**
|
||||
* @var array avoids comparing the file different times. It also avoids race conditions.
|
||||
*/
|
||||
private $cacheExpired = [];
|
||||
/**
|
||||
* @var string=['get','post','getpost','request',null][$i]
|
||||
*/
|
||||
private $cacheStrategy;
|
||||
/** @var array|null */
|
||||
private $cacheStrategyIndex;
|
||||
|
||||
/**
|
||||
* @return null|string $cacheStrategy=['get','post','getpost','request',null][$i]
|
||||
*/
|
||||
public function getCacheStrategy(): ?string
|
||||
{
|
||||
return $this->cacheStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* It sets the cache log. If not cache log then it does not generate a log file<br>
|
||||
* The cache log stores each time a template is creates or expired.<br>
|
||||
*
|
||||
* @param string $file
|
||||
*/
|
||||
public function setCacheLog($file): void
|
||||
{
|
||||
$this->cacheLog=$file;
|
||||
}
|
||||
|
||||
public function writeCacheLog($txt, $nivel): void
|
||||
{
|
||||
if (!$this->cacheLog) {
|
||||
return; // if there is not a file assigned then it skips saving.
|
||||
}
|
||||
$fz = @filesize($this->cacheLog);
|
||||
if (is_object($txt) || is_array($txt)) {
|
||||
$txt = print_r($txt, true);
|
||||
}
|
||||
// Rewrite file if more than 100000 bytes
|
||||
$mode=($fz > 100000) ? 'w':'a';
|
||||
$fp = fopen($this->cacheLog, $mode);
|
||||
if ($fp === false) {
|
||||
return;
|
||||
}
|
||||
switch ($nivel) {
|
||||
case 1:
|
||||
$txtNivel='expired';
|
||||
break;
|
||||
case 2:
|
||||
$txtNivel='new';
|
||||
break;
|
||||
default:
|
||||
$txtNivel='other';
|
||||
}
|
||||
$txtarg=json_encode($this->cacheUniqueGUID(false));
|
||||
fwrite($fp, date('c') . "\t$txt\t$txtNivel\t$txtarg\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* It sets the strategy of the cache page.
|
||||
*
|
||||
* @param null|string $cacheStrategy =['get','post','getpost','request',null][$i]
|
||||
* @param array|null $index if null then it reads all indexes. If not, it reads an indexes.
|
||||
*/
|
||||
public function setCacheStrategy($cacheStrategy, $index = null): void
|
||||
{
|
||||
$this->cacheStrategy = $cacheStrategy;
|
||||
$this->cacheStrategyIndex = $index;
|
||||
}
|
||||
|
||||
/**
|
||||
* It obtains a unique GUID based in:<br>
|
||||
* <b>get</b>= parameters from the url<br>
|
||||
* <b>post</b>= parameters sends via post<br>
|
||||
* <b>getpost</b> = a mix between get and post<br>
|
||||
* <b>request</b> = get, post and cookies (including sessions)<br>
|
||||
* MD5 could generate colisions (2^64 = 18,446,744,073,709,551,616) but the end hash is the sum of the hash of
|
||||
* the page + this GUID.
|
||||
*
|
||||
* @param bool $serialize if true then it serializes using md5
|
||||
* @return string|null
|
||||
*/
|
||||
private function cacheUniqueGUID($serialize = true): ?string
|
||||
{
|
||||
switch ($this->cacheStrategy) {
|
||||
case 'get':
|
||||
$r = $_GET;
|
||||
break;
|
||||
case 'post':
|
||||
$r = $_POST;
|
||||
break;
|
||||
case 'getpost':
|
||||
$arr = array_merge($_GET, $_POST);
|
||||
$r = $arr;
|
||||
break;
|
||||
case 'request':
|
||||
$r = $_REQUEST;
|
||||
break;
|
||||
default:
|
||||
$r = null;
|
||||
}
|
||||
if ($this->cacheStrategyIndex === null || !is_array($r)) {
|
||||
$r= serialize($r);
|
||||
} else {
|
||||
$copy=[];
|
||||
foreach ($r as $key => $item) {
|
||||
if (in_array($key, $this->cacheStrategyIndex, true)) {
|
||||
$copy[$key]=$item;
|
||||
}
|
||||
}
|
||||
$r=serialize($copy);
|
||||
}
|
||||
return $serialize===true ? md5($r): $r;
|
||||
}
|
||||
|
||||
public function compileCache($expression): string
|
||||
{
|
||||
// get id of template
|
||||
// if the file exists then
|
||||
// compare date.
|
||||
// if the date is too old then re-save.
|
||||
// else
|
||||
// save for the first time.
|
||||
|
||||
return $this->phpTag . "echo \$this->cacheStart$expression; if(!\$this->cacheRunning) { ?>";
|
||||
}
|
||||
|
||||
public function compileEndCache($expression): string
|
||||
{
|
||||
return $this->phpTag . "} // if cacheRunning\necho \$this->cacheEnd$expression; ?>";
|
||||
}
|
||||
|
||||
/**
|
||||
* It gets the filename of the compiled file (cached). If cache is not enabled, then it
|
||||
* returns the regular file.
|
||||
*
|
||||
* @param string $view
|
||||
* @return string The full filename
|
||||
*/
|
||||
private function getCompiledFileCache($view): string
|
||||
{
|
||||
$id = $this->cacheUniqueGUID();
|
||||
if ($id !== null) {
|
||||
return str_replace($this->compileExtension, '_cache' . $id
|
||||
. $this->compileExtension, $this->getCompiledFile($view));
|
||||
}
|
||||
return $this->getCompiledFile($view);
|
||||
}
|
||||
|
||||
/**
|
||||
* run the blade engine. It returns the result of the code.
|
||||
*
|
||||
* @param string $view The name of the cache. Ex: "folder.folder.view" ("/folder/folder/view.blade")
|
||||
* @param array $variables An associative arrays with the values to display.
|
||||
* @param int $ttl time to live (in second).
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
public function runCache($view, $variables = [], $ttl = 86400): string
|
||||
{
|
||||
$this->cachePageRunning = true;
|
||||
$cacheStatus=$this->cachePageExpired($view, $ttl);
|
||||
if ($cacheStatus!==0) {
|
||||
$this->writeCacheLog($view, $cacheStatus);
|
||||
$this->cacheStart('_page_', $ttl);
|
||||
$content = $this->run($view, $variables); // if no cache, then it runs normally.
|
||||
$this->fileName = $view; // sometimes the filename is replaced (@include), so we restore it
|
||||
$this->cacheEnd($content); // and it stores as a cache paged.
|
||||
} else {
|
||||
$content = $this->getFile($this->getCompiledFileCache($view));
|
||||
}
|
||||
$this->cachePageRunning = false;
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the block cache expired (or doesn't exist), otherwise false.
|
||||
*
|
||||
* @param string $templateName name of the template to use (such hello for template hello.blade.php)
|
||||
* @param string $id (id of cache, optional, if not id then it adds automatically a number)
|
||||
* @param int $cacheDuration (duration of the cache in seconds)
|
||||
* @return int 0=cache exists, 1= cache expired, 2=not exists, string= the cache file (if any)
|
||||
*/
|
||||
public function cacheExpired($templateName, $id, $cacheDuration): int
|
||||
{
|
||||
if ($this->getMode() & 1) {
|
||||
return 2; // forced mode, hence it always expires. (fast mode is ignored).
|
||||
}
|
||||
$compiledFile = $this->getCompiledFile($templateName) . '_cache' . $id;
|
||||
return $this->cacheExpiredInt($compiledFile, $cacheDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* It returns true if the whole page expired.
|
||||
*
|
||||
* @param string $templateName
|
||||
* @param int $cacheDuration is seconds.
|
||||
* @return int 0=cache exists, 1= cache expired, 2=not exists, string= the cache content (if any)
|
||||
*/
|
||||
public function cachePageExpired($templateName, $cacheDuration): int
|
||||
{
|
||||
if ($this->getMode() & 1) {
|
||||
return 2; // forced mode, hence it always expires. (fast mode is ignored).
|
||||
}
|
||||
$compiledFile = $this->getCompiledFileCache($templateName);
|
||||
return $this->CacheExpiredInt($compiledFile, $cacheDuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used by cacheExpired() and cachePageExpired()
|
||||
*
|
||||
* @param string $compiledFile
|
||||
* @param int $cacheDuration is seconds.
|
||||
* @return int|mixed 0=cache exists, 1= cache expired, 2=not exists, string= the cache content (if any)
|
||||
*/
|
||||
private function cacheExpiredInt($compiledFile, $cacheDuration)
|
||||
{
|
||||
if (isset($this->cacheExpired[$compiledFile])) {
|
||||
// if the information is already in the array then returns it.
|
||||
return $this->cacheExpired[$compiledFile];
|
||||
}
|
||||
$date = @filemtime($compiledFile);
|
||||
if ($date) {
|
||||
if ($date + $cacheDuration < time()) {
|
||||
$this->cacheExpired[$compiledFile] = 1;
|
||||
return 2; // time-out.
|
||||
}
|
||||
} else {
|
||||
$this->cacheExpired[$compiledFile] = 2;
|
||||
return 1; // no file
|
||||
}
|
||||
$this->cacheExpired[$compiledFile] = 0;
|
||||
return 0; // cache active.
|
||||
}
|
||||
|
||||
public function cacheStart($id = '', $cacheDuration = 86400): void
|
||||
{
|
||||
$this->curCacheId = ($id == '') ? ($this->curCacheId + 1) : $id;
|
||||
$this->curCacheDuration = $cacheDuration;
|
||||
$this->curCachePosition = strlen(ob_get_contents());
|
||||
if ($this->cachePageRunning) {
|
||||
$compiledFile = $this->getCompiledFileCache($this->fileName);
|
||||
} else {
|
||||
$compiledFile = $this->getCompiledFile() . '_cache' . $this->curCacheId;
|
||||
}
|
||||
|
||||
if ($this->cacheExpired('', $id, $cacheDuration) !==0) {
|
||||
$this->cacheRunning = false;
|
||||
} else {
|
||||
$this->cacheRunning = true;
|
||||
$content = $this->getFile($compiledFile);
|
||||
echo $content;
|
||||
}
|
||||
}
|
||||
|
||||
public function cacheEnd($txt = null): void
|
||||
{
|
||||
if (!$this->cacheRunning) {
|
||||
$txt = $txt ?? substr(ob_get_contents(), $this->curCachePosition);
|
||||
if ($this->cachePageRunning) {
|
||||
$compiledFile = $this->getCompiledFileCache($this->fileName);
|
||||
} else {
|
||||
$compiledFile = $this->getCompiledFile() . '_cache' . $this->curCacheId;
|
||||
}
|
||||
file_put_contents($compiledFile, $txt);
|
||||
}
|
||||
$this->cacheRunning = false;
|
||||
}
|
||||
}
|
||||
160
M4/emensa/vendor/eftec/bladeone/lib/BladeOneCacheRedis.php
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace eftec\bladeone;
|
||||
|
||||
use Redis;
|
||||
use function class_exists;
|
||||
use function file_put_contents;
|
||||
use function filemtime;
|
||||
use function ob_get_contents;
|
||||
use function strlen;
|
||||
use function substr;
|
||||
use function time;
|
||||
|
||||
/**
|
||||
* trait BladeOneCacheRedis
|
||||
* Copyright (c) 2016 Jorge Patricio Castro Castillo MIT License. Don't delete this comment, its part of the license.
|
||||
* Extends the tags of the class BladeOne. Its optional
|
||||
* It adds the next tags to the template
|
||||
* <code>
|
||||
* @ cache([cacheid],[duration=86400]). The id is optional. The duration of the cache is in seconds
|
||||
* // content here
|
||||
* @ endcache()
|
||||
* </code>
|
||||
* It also adds a new function (optional) to the business or logic layer
|
||||
* <code>
|
||||
* if ($blade->cacheExpired('hellocache',1,5)) { //'helloonecache' =template, =1 id cache, 5=duration (seconds)
|
||||
* // cache expired, so we should do some stuff (such as read from the database)
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @package BladeOneCacheRedis
|
||||
* @version 0.1 2017-12-15 NOT YET IMPLEMENTED, ITS A WIP!!!!!!!!
|
||||
* @link https://github.com/EFTEC/BladeOne
|
||||
* @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
|
||||
*/
|
||||
const CACHEREDIS_SCOPEURL = 1;
|
||||
|
||||
trait BladeOneCacheRedis
|
||||
{
|
||||
protected $curCacheId = 0;
|
||||
protected $curCacheDuration = "";
|
||||
protected $curCachePosition = 0;
|
||||
protected $cacheRunning = false;
|
||||
/** @var \Redis $redis */
|
||||
protected $redis;
|
||||
protected $redisIP = '127.0.0.1';
|
||||
protected $redisPort = 6379;
|
||||
protected $redisTimeOut = 2.5;
|
||||
protected $redisConnected = false;
|
||||
protected $redisNamespace = 'bladeonecache:';
|
||||
protected $redisBase = 0;
|
||||
private $cacheExpired = []; // avoids to compare the file different times.
|
||||
|
||||
//<editor-fold desc="compile">
|
||||
public function compileCache($expression)
|
||||
{
|
||||
// get id of template
|
||||
// if the file exists then
|
||||
// compare date.
|
||||
// if the date is too old then re-save.
|
||||
// else
|
||||
// save for the first time.
|
||||
|
||||
return $this->phpTag . "echo \$this->cacheStart{$expression}; if(!\$this->cacheRunning) { ?>";
|
||||
}
|
||||
|
||||
public function compileEndCache($expression)
|
||||
{
|
||||
return $this->phpTag . "} // if cacheRunning\necho \$this->cacheEnd{$expression}; ?>";
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
public function connect($redisIP = null, $redisPort = null, $redisTimeOut = null)
|
||||
{
|
||||
if ($this->redisConnected) {
|
||||
return true;
|
||||
}
|
||||
if (!class_exists('Redis')) {
|
||||
return false; // it requires redis.
|
||||
}
|
||||
if ($redisIP !== null) {
|
||||
$this->redisIP = $redisIP;
|
||||
$this->redisPort = $redisPort;
|
||||
$this->redisTimeOut = $redisTimeOut;
|
||||
}
|
||||
$this->redis = new Redis();
|
||||
// 2.5 sec timeout.
|
||||
$this->redisConnected = $this->redis->connect($this->redisIP, $this->redisPort, $this->redisTimeOut);
|
||||
|
||||
return $this->redisConnected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the cache expired (or doesn't exist), otherwise false.
|
||||
*
|
||||
* @param string $templateName name of the template to use (such hello for template hello.blade.php)
|
||||
* @param string $id (id of cache, optional, if not id then it adds automatically a number)
|
||||
* @param int $scope scope of the cache.
|
||||
* @param int $cacheDuration (duration of the cache in seconds)
|
||||
* @return bool (return if the cache expired)
|
||||
*/
|
||||
public function cacheExpired($templateName, $id, $scope, $cacheDuration)
|
||||
{
|
||||
if ($this->getMode() & 1) {
|
||||
return true; // forced mode, hence it always expires. (fast mode is ignored).
|
||||
}
|
||||
$compiledFile = $this->getCompiledFile($templateName) . '_cache' . $id;
|
||||
if (isset($this->cacheExpired[$compiledFile])) {
|
||||
// if the information is already in the array then returns it.
|
||||
return $this->cacheExpired[$compiledFile];
|
||||
}
|
||||
$date = @filemtime($compiledFile);
|
||||
if ($date) {
|
||||
if ($date + $cacheDuration < time()) {
|
||||
$this->cacheExpired[$compiledFile] = true;
|
||||
return true; // time-out.
|
||||
}
|
||||
} else {
|
||||
$this->cacheExpired[$compiledFile] = true;
|
||||
return true; // no file
|
||||
}
|
||||
$this->cacheExpired[$compiledFile] = false;
|
||||
return false; // cache active.
|
||||
}
|
||||
|
||||
public function cacheStart($id = "", $cacheDuration = 86400)
|
||||
{
|
||||
$this->curCacheId = ($id == "") ? ($this->curCacheId + 1) : $id;
|
||||
$this->curCacheDuration = $cacheDuration;
|
||||
$this->curCachePosition = strlen(ob_get_contents());
|
||||
$compiledFile = $this->getCompiledFile() . '_cache' . $this->curCacheId;
|
||||
if ($this->cacheExpired('', $id, $cacheDuration)) {
|
||||
$this->cacheRunning = false;
|
||||
} else {
|
||||
$this->cacheRunning = true;
|
||||
$content = $this->getFile($compiledFile);
|
||||
echo $content;
|
||||
}
|
||||
// getFile($fileName)
|
||||
}
|
||||
|
||||
public function cacheEnd()
|
||||
{
|
||||
if (!$this->cacheRunning) {
|
||||
$txt = substr(ob_get_contents(), $this->curCachePosition);
|
||||
$compiledFile = $this->getCompiledFile() . '_cache' . $this->curCacheId;
|
||||
file_put_contents($compiledFile, $txt);
|
||||
}
|
||||
$this->cacheRunning = false;
|
||||
}
|
||||
|
||||
private function keyByScope($scope)
|
||||
{
|
||||
$key = '';
|
||||
if ($scope && CACHEREDIS_SCOPEURL) {
|
||||
$key .= $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
|
||||
}
|
||||
}
|
||||
}
|
||||
59
M4/emensa/vendor/eftec/bladeone/lib/BladeOneCustom.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php /** @noinspection ReturnTypeCanBeDeclaredInspection */
|
||||
/** @noinspection PhpMissingReturnTypeInspection */
|
||||
/** @noinspection UnknownInspectionInspection */
|
||||
|
||||
/** @noinspection PhpUnused */
|
||||
|
||||
namespace eftec\bladeone;
|
||||
|
||||
/*
|
||||
* It's an example of a custom set of functions for bladeone.
|
||||
* in examples/TestCustom.php there is a working example
|
||||
*/
|
||||
|
||||
use function array_pop;
|
||||
|
||||
trait BladeOneCustom
|
||||
{
|
||||
private $customItem = []; // indicates the type of the current tag. such as select/selectgroup/etc.
|
||||
|
||||
//<editor-fold desc="compile function">
|
||||
/**
|
||||
* Usage @panel('title',true,true).....@endpanel()
|
||||
*
|
||||
* @param $expression
|
||||
* @return string
|
||||
*/
|
||||
protected function compilePanel($expression)
|
||||
{
|
||||
$this->customItem[] = 'Panel';
|
||||
return $this->phpTag . "echo \$this->panel$expression; ?>";
|
||||
}
|
||||
|
||||
protected function compileEndPanel()
|
||||
{
|
||||
$r = @array_pop($this->customItem);
|
||||
if ($r === null) {
|
||||
$this->showError('@endpanel', 'Missing @compilepanel or so many @compilepanel', true);
|
||||
}
|
||||
return ' </div></section><!-- end panel -->'; // we don't need to create a function for this.
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold desc="used function">
|
||||
protected function panel($title = '', $toggle = true, $dismiss = true)
|
||||
{
|
||||
return "<section class='panel'>
|
||||
<header class='panel-heading'>
|
||||
<div class='panel-actions'>
|
||||
" . (($toggle) ? "<a href='#' class='panel-action panel-action-toggle' data-panel-toggle></a>" : '') . '
|
||||
' . (($dismiss) ? "<a href='#' class='panel-action panel-action-dismiss' data-panel-dismiss></a>" : '') . "
|
||||
</div>
|
||||
|
||||
<h2 class='panel-title'>$title</h2>
|
||||
</header>
|
||||
<div class='panel-body'>";
|
||||
}
|
||||
//</editor-fold>
|
||||
}
|
||||
29
M4/emensa/vendor/eftec/bladeone/lib/bladeonecli
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace eftec;
|
||||
|
||||
// this code only runs on CLI but only if bladeonecli.php is called directly and via command line.
|
||||
use eftec\bladeone\BladeOne;
|
||||
|
||||
if (!defined('PHPUNIT_COMPOSER_INSTALL') && !defined('__PHPUNIT_PHAR__')
|
||||
&& isset($_SERVER['PHP_SELF']) &&
|
||||
!http_response_code() &&
|
||||
(basename($_SERVER['PHP_SELF']) === 'bladeonecli.php' || basename($_SERVER['PHP_SELF']) === 'bladeonecli')
|
||||
) {
|
||||
// we also excluded it if it is called by phpunit.
|
||||
include_once __DIR__ . '/BladeOne.php';
|
||||
|
||||
$compilepath = BladeOne::getParameterCli('compilepath', null);
|
||||
$templatepath = BladeOne::getParameterCli('templatepath', null);
|
||||
if (!BladeOne::isAbsolutePath($compilepath)) {
|
||||
$compilepath = getcwd() . '/' . $compilepath;
|
||||
}
|
||||
if (!BladeOne::isAbsolutePath($templatepath)) {
|
||||
$templatepath = getcwd() . '/' . $templatepath;
|
||||
}
|
||||
$inst = new BladeOne($templatepath, $compilepath);
|
||||
$inst->cliEngine();
|
||||
} else {
|
||||
@http_response_code(404);
|
||||
}
|
||||
|
||||
6
M4/emensa/views/debug.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>This is a blade view showing phpinfo();</h1>
|
||||
<p><a href="/">go back</a>.</p>
|
||||
|
||||
@php
|
||||
phpinfo();
|
||||
@endphp
|
||||
32
M4/emensa/views/demo/dbdata.blade.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
@if (isset($data['error']))
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> {{$data['beschreibung']}}</pre>
|
||||
|
||||
@else
|
||||
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Gerichte</h1>
|
||||
<p>Der Controller inkludiert das benötigte Model (gerichte.php in diesem Fall)
|
||||
und ruft die benötigte Funktion <code>db_gerichte_select_all()</code> zum Laden der Daten auf</p>
|
||||
<ul>
|
||||
@forelse($data as $a)
|
||||
<li>{{$a['name']}}</li>
|
||||
@empty
|
||||
<li>Keine Daten vorhanden.</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</article>
|
||||
@endif
|
||||
</body>
|
||||
</html>
|
||||
92
M4/emensa/views/demo/demo.blade.php
Normal file
@@ -0,0 +1,92 @@
|
||||
@extends(".layouts.layout")
|
||||
|
||||
@section("content")
|
||||
<div>
|
||||
<h1>Demo für {{ $name }}</h1>
|
||||
<p>Kurze Übersicht, wie die Arbeit mit dem Router und der Blade View-Engine funktioniert.</p>
|
||||
|
||||
<h2>Router</h2>
|
||||
<p>Der Router nimmt den Request entgegen und zerlegt ihn in die einzelnen Teile der URI. Wichtig ist hier vor
|
||||
allem der Pfad und der Querystring.</p>
|
||||
<p>Wenn der Pfad in der Routenkonfiguration (<code>\$config</code> Array aus der Datei
|
||||
<code>routes/web.php</code>) gefunden wird, lädt der Router die angegebene Klasse.</p>
|
||||
|
||||
<h3>Funktionsweise</h3>
|
||||
<p>Im vorliegenden Beispiel sehen Sie diese Seite ... </p>
|
||||
<ol>
|
||||
<li>weil der Pfad in der Routenkonfiguration gefunden wurde</li>
|
||||
<li>und dort <span class="code">'DemoController@howto'</span> hinterlegt ist</li>
|
||||
<li>und im Ordner <span class="code">controllers/</span> die Datei <code class="language-php">DemoController.php</code> gefunden werden konnte
|
||||
</li>
|
||||
<li>und mit ihr ein Objekt des Typs <span class="code">DemoController</span> instanziiert werden konnte</li>
|
||||
<li>und dieses Objekt die Funktion (Action) <span class="code">howto()</span> ausgeführt hat</li>
|
||||
</ol>
|
||||
<p>Sie sehen: da muss einiges stimmen und vieles davon ist Konvention.</p>
|
||||
<h3>Querystrings und Pfadsegmente</h3>
|
||||
<p>Die Actions in den Controller-Klassen sollen per Konvention immer ein <span class="code">RequestData</span> Objekt
|
||||
entgegennehmen. Beispiel: <code class="language-php">howto(RequestData \$rd)</code></p>
|
||||
<p>Dieses RequestData Objekt wird durch den Router befüllt, wenn Daten in der URL extrahiert werden konnten.</p>
|
||||
<p>Daten finden sich URLs...</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
<strong>im Querystring</strong><br>Beispiel: rufen Sie diese mit
|
||||
<code class="language-http">{{strtolower(explode('/',$_SERVER["SERVER_PROTOCOL"])[0])}}://{{$_SERVER["HTTP_HOST"]}}/demo?<strong>bgcolor=fefbd8&name=Remmy</strong></code>
|
||||
auf, werden <span class="language-php">bgcolor</span> und <code class="language-php">name</code> mitsamt Werten als Query Array
|
||||
<code class="language-php">$rd->query</code>) übergeben
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>Probieren Sie es aus ;)</p>
|
||||
@if(count($rd->args))
|
||||
<p><strong>Argumente dieses Aufrufs:</strong></p>
|
||||
|
||||
@forelse($rd->args as $a)
|
||||
<div><span class="code">{{$a}}</span></div>
|
||||
@empty
|
||||
<p>Keine weiteren Argumente im Request</p>
|
||||
@endforelse
|
||||
@endif
|
||||
@if(count($rd->query))
|
||||
<p><strong>Daten aus der Query dieses Aufrufs:</strong></p>
|
||||
<pre><code class="language-php">
|
||||
@forelse($rd->query as $k => $v)
|
||||
$rd->query['{{$k}}']={{$v}}
|
||||
@empty
|
||||
<p>Keine Querydaten</p>
|
||||
@endforelse
|
||||
</code></pre>
|
||||
@endif
|
||||
<h2>Blade</h2>
|
||||
<p>Blade <a href="https://github.com/EFTEC/BladeOne#install-pick-one-of-the-next-one">muss installiert</a> sein.
|
||||
Die Installation ist bereits geschehen und die Bibliothek liegt unter /vendor.
|
||||
</p>
|
||||
<h3>Daten übergeben und View rendern</h3>
|
||||
<p>Bei der Verwendung der View-Engine gelten einige Konventionen:
|
||||
Die Dateien müssen <code class="language-php"><viewname>.blade.php</code> heißen und im Ordner <code class="language-php">views</code> liegen.
|
||||
</p>
|
||||
<p>Sie können der View dann Daten mitgeben, indem Sie alle Daten in ein Array schreiben und dieses dann
|
||||
übergeben.</p>
|
||||
<p>Beispiel:</p>
|
||||
<pre><code class="language-php">
|
||||
view("viewtest",
|
||||
array(
|
||||
"texts"=>$textArray,
|
||||
"persona"=>$persona,
|
||||
"rd"=>$rd
|
||||
)); // öffnet ../views/viewtest.blade.php
|
||||
</code></pre>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section("cssextra")
|
||||
<style>
|
||||
body > div {background-color: {{ '#' . $bgcolor }}; }
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section("jsextra")
|
||||
<script src="/js/highlight.min.js"></script><script>hljs.highlightAll();</script>
|
||||
@endsection
|
||||
24
M4/emensa/views/demo/requestdata.blade.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>RequestData</h1>
|
||||
|
||||
@if(count($rd->getData()))
|
||||
<p>combined request data</p>
|
||||
<pre>
|
||||
{{print_r($rd->getData(),1)}}
|
||||
</pre>
|
||||
@else
|
||||
<p>this request contained zero parameters</p>
|
||||
@endif
|
||||
|
||||
@if(count($rd->getGetData()))
|
||||
<p><code>GET</code> request data</p>
|
||||
<pre>
|
||||
{{print_r($rd->getGetData(),1)}}
|
||||
</pre>
|
||||
@endif
|
||||
|
||||
@if(count($rd->getPostData()))
|
||||
<p><code>POST</code> request data</p>
|
||||
<pre>
|
||||
{{print_r($rd->getPostData(),1)}}
|
||||
</pre>
|
||||
@endif
|
||||
13
M4/emensa/views/examples/m4_7a_queryparameter.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>7a</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Der Wert von name lautet: {{$request}}
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
41
M4/emensa/views/examples/m4_7b_kategorie.blade.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
|
||||
<style>
|
||||
h1 {
|
||||
font-weight: 300;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@if (isset($data['error']))
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> {{$data['beschreibung']}}</pre>
|
||||
|
||||
@else
|
||||
<?php
|
||||
$zweites = false; ?>
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Kategorien</h1>
|
||||
|
||||
<ul>
|
||||
@forelse($data as $a)
|
||||
@if($zweites) <h1><li>{{$a['name']}}</li></h1> <?php $zweites = false; ?>
|
||||
@else
|
||||
<li>{{$a['name']}}</li> <?php $zweites = true; ?>
|
||||
@endif
|
||||
@empty
|
||||
<li>Keine Daten vorhanden.</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</article>
|
||||
@endif
|
||||
|
||||
</body>
|
||||
</html>
|
||||
34
M4/emensa/views/examples/m4_7c_gerichte.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Beispiel: Daten aus der Datenbank</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@if (isset($data['error']))
|
||||
<h1>Es gab ein Problem mit der Datenbankverbindung</h1>
|
||||
<p>Fehlermeldung</p>
|
||||
<pre> {{$data['beschreibung']}}</pre>
|
||||
|
||||
@else
|
||||
|
||||
<article>
|
||||
<h1>Daten aus der Datenbank der Tabelle: Kategorien</h1>
|
||||
|
||||
<ul>
|
||||
@forelse($data as $a)
|
||||
@if(!empty($a['name']))
|
||||
<li>{{$a['name']}}</li>
|
||||
@endif
|
||||
|
||||
@empty
|
||||
<li>Es sind keine Gerichte vorhanden</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</article>
|
||||
@endif
|
||||
|
||||
</body>
|
||||
</html>
|
||||
13
M4/emensa/views/examples/pages/m4_7d_page_1.blade.php
Normal file
@@ -0,0 +1,13 @@
|
||||
@extends(".layouts.m4_7d_layout",['title' => "Page 1"])
|
||||
|
||||
@section("header")
|
||||
|
||||
@endsection
|
||||
|
||||
@section("body")
|
||||
<p>Page 1</p>
|
||||
@endsection
|
||||
|
||||
@section("footer")
|
||||
<p>Footer of Page 1</p>
|
||||
@endsection
|
||||