bugfix_updateArticle_missingID & updateArticle Leerzeichen im content #28
+1
-1
@@ -19,7 +19,7 @@
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</DataSourceFromHistory>
|
||||
<DataSourceFromHistory isRemovedFromProject="true">
|
||||
<DataSourceFromHistory isRemovedFromProject="false">
|
||||
<data-source source="LOCAL" name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
|
||||
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
|
||||
<identifier-quote-string>"</identifier-quote-string>
|
||||
|
||||
@@ -53,9 +53,8 @@ if (!isset($_SESSION["user"])) {
|
||||
<input type="text" id="title" name="title"
|
||||
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
|
||||
placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||
<?php echo htmlspecialchars($_SESSION['old_content'] ?? ''); unset($_SESSION['old_content']); ?>
|
||||
</textarea>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."><?php if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){echo htmlspecialchars($_SESSION['old_content']); unset($_SESSION['old_content']);}elseif (isset($content) && !empty($content)){echo htmlspecialchars($content);}?></textarea>
|
||||
|
||||
</main>
|
||||
|
||||
<!-- Seitenleiste -->
|
||||
|
||||
@@ -68,23 +68,17 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
?>
|
||||
<input type="text" id="title" name="title"
|
||||
value="<?php
|
||||
if (isset($title) && !empty($title)){echo htmlspecialchars($title);
|
||||
}elseif (isset($_SESSION['old_title']) && !empty($_SESSION['old_title'])){
|
||||
if (isset($_SESSION['old_title']) && !empty($_SESSION['old_title'])){
|
||||
echo htmlspecialchars($_SESSION['old_title']);
|
||||
unset($_SESSION['old_title']);
|
||||
}elseif (isset($title) && !empty($title)){
|
||||
echo htmlspecialchars($title);
|
||||
}
|
||||
|
||||
?>"
|
||||
placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||
<?php
|
||||
if (isset($content) && !empty($content)){echo htmlspecialchars($content);
|
||||
}elseif (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){
|
||||
echo htmlspecialchars($_SESSION['old_content']);
|
||||
unset($_SESSION['old_content']);
|
||||
}
|
||||
?>
|
||||
</textarea>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."><?php if (isset($_SESSION['old_content']) && !empty($_SESSION['old_content'])){echo htmlspecialchars($_SESSION['old_content']); unset($_SESSION['old_content']);}elseif (isset($content) && !empty($content)){echo htmlspecialchars($content);}?></textarea>
|
||||
|
||||
</main>
|
||||
|
||||
<!-- Seitenleiste -->
|
||||
@@ -143,10 +137,11 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
<label for="tags">Schlagwörter</label>
|
||||
<input type="text" id="tags" name="tags"
|
||||
value="<?php
|
||||
if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);
|
||||
} elseif (isset($_SESSION['old_tags']) && !empty($_SESSION['old_tags'])){
|
||||
if (isset($_SESSION['old_tags']) && !empty($_SESSION['old_tags'])){
|
||||
echo htmlspecialchars($_SESSION['old_tags']);
|
||||
unset($_SESSION['old_tags']);
|
||||
} elseif (isset($tags) && !empty($tags)){
|
||||
echo htmlspecialchars($tags);
|
||||
}
|
||||
?>"
|
||||
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
|
||||
@@ -21,7 +21,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
|
||||
if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}else{
|
||||
$title = $_POST["title"];
|
||||
@@ -33,31 +33,31 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
// -------------------------------- Validierung der Daten: -------------------------
|
||||
if (!articleAuthorValidator($author)) {
|
||||
$_SESSION["message"] = "author_not_valid";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTitleValidator($title)) {
|
||||
$_SESSION["message"] = "invalid_title";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleContentValidator($content)) {
|
||||
$_SESSION["message"] = "invalid_content";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleCategoryValidator($category)) {
|
||||
$_SESSION["message"] = "invalid_category";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!articleTagValidator($tags)) {
|
||||
$_SESSION["message"] = "invalid_tags";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
} else {
|
||||
$cleanedTags = [];
|
||||
@@ -83,7 +83,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$articleManager->updateArticle($id ,$article, $author);
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = $e->getMessage();
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
header("location: ../../index.php?pfad=updateArticle&id=$id");
|
||||
exit();
|
||||
}
|
||||
$_SESSION["message"] = "article_updated";
|
||||
|
||||
Reference in New Issue
Block a user