2 namespace YAWK\PLUGINS\BLOG {
65 public $date_unpublish;
85 public $comment_author;
87 public $comment_email;
131 public $meta_keywords;
135 public $itemcomments;
139 public $frontendIcon;
141 public $limitEntries;
143 public $showTotalVotes;
152 public function injectLanguageTags(
$lang, $language)
158 if (!isset(
$lang) || (empty(
$lang) || (!is_array(
$lang) || (!isset($language) || (empty($language))))))
161 if (!isset($language))
163 require_once
'../system/classes/language.php';
165 $language = new \YAWK\language();
168 $language->init(
$db,
"backend");
170 $lang = (array) $language->lang;
173 return $lang = $language->inject(
$lang,
"../system/plugins/blog/language/");
184 static function getBlogTitle($title,
$subtext, $icon)
188 print
"<h1><i class=\"fa " . $icon .
"\"></i> " . $title .
" <small>" .
$subtext .
"</small></h1>";
190 else if (empty($icon))
192 print
"<h1>" . $title .
" <small>" .
$subtext .
"</small></h1>";
204 static function getLatestEntrySubtitle(
$db,
$blogid)
206 if (
$res =
$db->query(
"SELECT subtitle FROM {blog_items} WHERE blogid = " .
$blogid .
" ORDER BY id DESC LIMIT 1")) {
226 $showTitle = self::getBlogProperty(
$db,
$blogid,
"showtitle");
227 $showDesc = self::getBlogProperty(
$db,
$blogid,
"showdesc");
228 $description = self::getBlogProperty(
$db,
$blogid,
"description");
230 $icon = self::getBlogProperty(
$db,
$blogid,
"icon");
231 $frontendIcon = self::getBlogProperty(
$db,
$blogid,
"frontendIcon");
235 if ($frontendIcon == 1)
239 $icon =
"<i class=\"fa $icon\"></i> ";
251 if ($showTitle && $showDesc == 1) {
252 print
"<div class=\"container-fluid\">";
253 print
"<h1>$icon".
"$name <small>$description</small></h1><br>";
255 else if ($showTitle == 1 && $showDesc == 0) {
256 print
"<div class=\"container-fluid\">";
257 print
"<h1>$icon".
"$name</h1><br>";
259 else if ($showTitle == 0 && $showDesc == 1) {
260 print
"<div class=\"container-fluid\">";
261 print
"<h1>$icon".
"$description</h1><br>";
265 print
"<div class=\"container-fluid\">";
277 function toggleOffline(
$db,
$id, $published)
281 if (
$res =
$db->query(
"UPDATE {blog}
282 SET published = '" . $published .
"'
283 WHERE id = '" .
$id .
"'")
298 function toggleItemOffline(
$db,
$id, $published)
302 if (
$db->query(
"UPDATE {blog_items}
303 SET published = '" . $published .
"'
304 WHERE id = '" .
$id .
"'"))
323 function toggleCommentOffline(
$db,
$id, $published)
327 if (
$res =
$db->query(
"UPDATE {blog_comments}
328 SET published = '" . $published .
"'
329 WHERE id = '" .
$id .
"'")
344 function toggleRole(
$db, $itemgid,
$id)
348 if (
$db->query(
"UPDATE {blog_items}
349 SET itemgid = '" . $itemgid .
"'
350 WHERE id = '" .
$id .
"'"))
379 $blog_gid = self::getBlogProperty(
$db,
$blogid,
"gid");
385 $orderBy =
"date_publish";
404 $limitSql =
"LIMIT $limit";
412 $res =
$db->query(
"SELECT * FROM {blog_items}
413 WHERE blogid = '$blogid' " .
$sql .
"
415 ORDER BY " . $orderBy .
" " . $this->
sortation .
"
418 while ($row = mysqli_fetch_array(
$res))
420 $this->
itemid = $row[
'id'];
421 $this->uid = $row[
'uid'];
422 $this->
gid = $row[
'uid'];
423 $this->
pageid = $row[
'pageid'];
424 $this->
title = $row[
'title'];
425 $this->subtitle = $row[
'subtitle'];
428 $this->
gid = $row[
'itemgid'];
431 $this->date_created = $row[
'date_created'];
432 $this->date_changed = $row[
'date_changed'];
433 $this->author = $row[
'author'];
434 $this->
blogid = $row[
'blogid'];
437 $this->weblink = $row[
'weblink'];
438 $this->voteUp = $row[
'voteUp'];
439 $this->voteDown = $row[
'voteDown'];
440 $this->itemlayout = $row[
'itemlayout'];
441 $this->itemcomments = $row[
'itemcomments'];
445 if ($this->itemlayout !==
"-1")
448 $this->
layout = $this->itemlayout;
457 $year = $splitDate[
'year'];
458 $day = $splitDate[
'day'];
459 $month = $splitDate[
'month'];
460 $time = $splitDate[
'time'];
466 $prettydate =
"$weekday, $day. $month $year, $time";
467 $prettydate = trim($prettydate);
477 $page = new \YAWK\page();
479 $this->
permaLink =
"share this URL: <a href=\"$host/$alias.html\">$host/$alias.html</a>";
483 $page = new \YAWK\page();
490 $author =
"by <strong>$this->author</strong>";
497 if ($this->
voting ===
'1')
499 $voting = self::drawVotingBox(
$db, $this->voteUp, $this->voteDown);
507 $atm =
date(
"Y-m-d G:i:s");
514 if (isset($_SESSION[
'gid']))
516 $session_gid = $_SESSION[
'gid'];
523 if ($this->date_unpublish < $atm XOR $this->
date_unpublish === NULL)
527 else if ($atm > $this->date_publish && $session_gid >= $this->
gid && $session_gid >= $blog_gid)
533 if (isset($full_view) && ($full_view === 1))
535 $blogtextHtml = $this->blogtext;
542 $showAllButton =
"<a class=\"btn btn-default\" role=\"button\" href=\"$alias.html\"><i class=\"fa fa-bars\"></i> alles anzeigen</a>";
558 if ($this->
layout ===
'0')
560 $this->html .=
"<small class=\"pull-right\"><i>$this->permaLink$prettydate " . $author .
"</i></small>";
561 $this->html .=
"<h2>$this->title <small>$this->subtitle</small></h2>$this->teasertext" . $blogtextHtml .
"";
565 if (isset($full_view) && ($full_view === 1))
567 $this->html .= self::draw_commentbox(
$db,
$lang);
571 $this->html .=
"<br><a class='btn btn-default' role='button' href=\"$alias.html\"><i class='fa fa-bars'></i> anzeigen</a>";
576 $this->html .= $showAllButton;
578 if ($this->
spacer ===
'1')
580 $this->html .=
"<hr><br><br>";
584 $this->html .=
"<br><br>";
588 if ($this->
layout ===
'1')
590 if (!empty($this->
thumbnail)) $imgHtml =
"<br><img src=\"" . $this->
thumbnail .
"\" class=\"img-thumbnail img-lefty-less protected\">";
else $imgHtml =
'';
593 <div class=\"col-md-4 text-center\">
596 <div class=\"col-md-8\">
597 <small class=\"pull-right\"><i>$this->permaLink$prettydate $author</i></small>
598 <h2>$this->title <small>$this->subtitle</small></h2>$this->teasertext" . $blogtextHtml .
"";
602 if (isset($full_view) && ($full_view === 1))
604 $this->html .= self::draw_commentbox(
$db);
608 $this->html .=
"<br><a class='btn btn-default' href=\"$alias.html\"><i class='fa fa-bars'></i> anzeigen</a>";
613 $this->html .= $showAllButton;
616 if ($this->
spacer ===
'1')
618 $this->html .=
"<hr>";
620 $this->html .=
"</div>
624 if ($this->
layout ===
'2')
629 $imgHtml =
"<br><a href=\"$alias.html\"><img src=\"" . $this->
thumbnail .
"\" class=\"img-thumbnail img-righty-less hvr-grow\"></a><br><br>";
639 <div class=\"col-md-12 col-sm-12 col-lg-8 text-right\">
640 <small class=\"pull-right\"><i>$this->permaLink$prettydate $author</i></small><br>
641 <h2>$this->title <small>$this->subtitle</small></h2>$this->teasertext ".$blogtextHtml .
"";
646 if (isset($full_view) && ($full_view === 1))
648 $this->html .= self::draw_commentbox(
$db);
653 $this->html .=
"<br><a class=\"btn btn-dark hvr-grow\" href=\"$alias.html\"><i class='fa fa-bars'></i> Show more</a><br><br>";
658 $this->html .= $showAllButton;
661 if ($this->
spacer ===
'1')
663 $this->html .=
"<hr>";
665 $this->html .=
"</div>
666 <div class=\"col-md-12 col-sm-12 col-lg-4\">
671 if ($this->
layout ===
'3')
673 if (!empty($this->
thumbnail)) $imgHtml =
"<img src=\"" . $this->
thumbnail .
"\" class=\"thumbnail img-responsive\">";
else $imgHtml =
'';
674 $this->html .=
"<div class=\"row\">
675 <div class=\"col-xs-6 col-md-4\"><br>advertising space</div>
676 <div class=\"col-xs-6 col-md-4\">
677 <small class=\"pull-right\"><i>$this->permaLink$prettydate $author</i></small>
678 <h2>$this->title <small>$this->subtitle</small></h2>$imgHtml $this->teasertext" . $blogtextHtml .
"
683 if (isset($full_view) && ($full_view === 1))
685 $this->html .= self::draw_commentbox(
$db);
689 $this->html .=
"<a href=\"$alias.html\"><i class='btn btn-info'>comments anzeigen</i></a>";
694 $this->html .= $showAllButton;
697 if ($this->
spacer ===
'1')
699 $this->html .=
"<hr>";
701 $this->html .=
"</div>
702 <div class=\"col-xs-6 col-md-4\"><br>advertising space
706 if ($this->
layout ===
'4') {
708 $prettydate = substr($prettydate, 0, -7);
710 $this->html .=
"<small class=\"pull-right\"><i>$this->permaLink$prettydate $author</i></small>";
711 $this->html .=
"<h2>$this->title <small>$this->subtitle</small></h2>
712 <div class=\"embed-container\">
713 <iframe src=\"$this->youtubeUrl\" frameborder=\"0\" allowfullscreen></iframe>
715 $this->html .=
"$this->teasertext";
716 $this->html .=
"<br>$voting";
717 $this->html .=
"$blogtextHtml";
721 if (isset($full_view) && ($full_view === 1)) {
722 $this->html .= self::draw_commentbox(
$db);
724 $this->html .=
"<a class='btn btn-default' role='button' href=\"$alias.html\"><i class='fa fa-bars'></i> anzeigen</a><br><br><br>";
727 $this->html .= $showAllButton;
730 if ($this->
spacer ===
'1')
732 $this->html .=
"<hr><br><br>";
736 $this->html .=
"<br><br>";
757 if ($this->
voting ===
'1')
761 if ($totalVotes === 0)
763 $totalText =
"<b>Be the first to vote!</b>";
769 $totalText =
"<b>Total Votes:</b> <span id=\"totalVotesText\">$totalVotes</span>";
776 $votingBox =
"<div class=\"mx-auto d-block\"><h3>Vote this</h3><br><h5><small>$totalText
777 <span id=\"voteUp\" class=\"hvr-grow\" style=\"cursor:pointer;\"><i class=\"fa fa-thumbs-o-up fa-3x\" id=\"voteUpIcon\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"LIKE this\"></i> (<span id=\"voteUpText\"><small>$voteUp</small></span>)</span>
779 <span id=\"voteDown\" class=\"hvr-grow\" style=\"cursor:pointer;\"><i class=\"fa fa-thumbs-o-down fa-3x\" id=\"voteDownIcon\" data-toggle=\"tooltip\" data-placement=\"top\" title=\"Dislike this\"></i> (<span id=\"voteDownText\"><small>$voteDown</small></span>)</span><br></small></h5></div>";
798 static function getBlogProperty(
$db,
$blogid, $property)
801 if (
$res =
$db->query(
"SELECT $property FROM {blog} WHERE id = '" .
$blogid .
"'"))
803 if ($row = mysqli_fetch_row(
$res))
831 if (
$res =
$db->query(
"SELECT * FROM {blog} WHERE id = '" .
$blogid .
"'"))
833 if ($row = mysqli_fetch_array(
$res))
835 $this->
id = $row[
'id'];
836 $this->sort = $row[
'sort'];
838 $this->
name = $row[
'name'];
840 $this->
icon = $row[
'icon'];
846 $this->sortation = $row[
'sortation'];
847 $this->footer = $row[
'footer'];
849 $this->
gid = $row[
'gid'];
851 $this->
layout = $row[
'layout'];
852 $this->
preview = $row[
'preview'];
853 $this->
voting = $row[
'voting'];
854 $this->
spacer = $row[
'spacer'];
881 if (
$res =
$db->query(
"SELECT * FROM {blog_items}
882 WHERE blogid = '" .
$blogid .
"'
885 if ($row = mysqli_fetch_array(
$res)) {
886 $this->
blogid = $row[
'blogid'];
887 $this->
itemid = $row[
'id'];
888 $this->uid = $row[
'uid'];
889 $this->
pageid = $row[
'pageid'];
890 $this->sort = $row[
'sort'];
892 $this->itemgid = $row[
'itemgid'];
893 $this->teaser = $row[
'teaser'];
895 $this->filename = $row[
'filename'];
896 $this->subtitle = $row[
'subtitle'];
897 $this->date_created = $row[
'date_created'];
898 $this->date_changed = $row[
'date_changed'];
899 $this->date_publish = $row[
'date_publish'];
903 $this->author = $row[
'author'];
906 $this->weblink = $row[
'weblink'];
907 $this->itemlayout = $row[
'itemlayout'];
908 $this->itemcomments = $row[
'itemcomments'];
935 if (empty($this->sort)){ $this->sort = 1; }
937 $date_changed =
date(
"Y-m-d G:i:s");
940 $this->filename = mb_strtolower($this->filename);
941 $this->filename = str_replace(
" ",
"-", $this->filename);
943 $umlaute = array(
"/ä/",
"/ü/",
"/ö/",
"/Ä/",
"/Ü/",
"/Ö/",
"/ß/");
944 $ersetze = array(
"ae",
"ue",
"oe",
"ae",
"ue",
"oe",
"ss");
945 $this->filename = preg_replace($umlaute, $ersetze, $this->filename);
946 $this->filename = preg_replace(
"/[^a-z0-9\-\/]/i",
"", $this->filename);
949 $res =
$db->query(
"SELECT alias FROM {pages} WHERE id = '" . $this->
pageid .
"'");
950 $row = mysqli_fetch_row(
$res);
951 $alias_old = $row[0];
952 $filename_old =
"../content/pages/" . $alias_old .
".php";
953 $filename =
"../content/pages/" . $this->filename .
".php";
955 $content =
"<?php \$blog_id = $this->blogid; \$item_id = $this->itemid; \$full_view = 1; include 'system/plugins/blog/blog.php'; ?>";
956 if (file_exists($filename_old))
964 \YAWK\alert::draw(
"danger",
"Error",
"could not write file: $filename",
"",
"4200");
975 \YAWK\alert::draw(
"danger",
"Error",
"could not create file: $filename",
"",
"4200");
980 if (!empty($this->
title)) {
983 if (!empty($this->subtitle)){
984 $this->subtitle = htmlentities($this->subtitle);
990 if (
$res =
$db->query(
"UPDATE {pages} SET
991 alias = '" . $this->filename .
"',
992 title = '" . $this->blogtitle .
"',
993 meta_local = '" . $this->meta_local .
"',
994 meta_keywords = '" . $this->meta_keywords .
"'
995 WHERE id = '" . $this->pageid .
"'"))
1002 if (
$res =
$db->query(
"UPDATE {blog_items} SET
1003 published = '" . $this->published .
"',
1004 itemgid = '" . $this->itemgid .
"',
1005 sort = '" . $this->sort .
"',
1006 teaser = '" . $this->teaser .
"',
1007 title = '" . $this->blogtitle .
"',
1008 filename = '" . $this->filename .
"',
1009 subtitle = '" . $this->subtitle .
"',
1010 date_changed = '" . $date_changed .
"',
1011 date_publish = '" . $this->date_publish .
"',
1012 date_unpublish = NULL,
1013 teasertext = '" . $this->teasertext .
"',
1014 blogtext = '" . $this->blogtext .
"',
1015 thumbnail = '" . $this->thumbnail .
"',
1016 youtubeUrl = '" . $this->youtubeUrl .
"',
1017 weblink = '" . $this->weblink .
"',
1018 itemlayout = '" . $this->itemlayout .
"',
1019 itemcomments = '" . $this->itemcomments .
"'
1020 WHERE id = '" . $this->itemid .
"'
1021 AND blogid = '" . $this->blogid .
"'"))
1033 if (
$res =
$db->query(
"UPDATE {blog_items} SET
1034 published = '" . $this->published .
"',
1035 itemgid = '" . $this->itemgid .
"',
1036 sort = '" . $this->sort .
"',
1037 teaser = '" . $this->teaser .
"',
1038 title = '" . $this->blogtitle .
"',
1039 filename = '" . $this->filename .
"',
1040 subtitle = '" . $this->subtitle .
"',
1041 date_changed = '" . $date_changed .
"',
1042 date_publish = '" . $this->date_publish .
"',
1043 date_unpublish = '" . $this->date_unpublish .
"',
1044 teasertext = '" . $this->teasertext .
"',
1045 blogtext = '" . $this->blogtext .
"',
1046 thumbnail = '" . $this->thumbnail .
"',
1047 youtubeUrl = '" . $this->youtubeUrl .
"',
1048 weblink = '" . $this->weblink .
"',
1049 itemlayout = '" . $this->itemlayout .
"',
1050 itemcomments = '" . $this->itemcomments .
"'
1051 WHERE id = '" . $this->itemid .
"'
1052 AND blogid = '" . $this->blogid .
"'"))
1083 if (
$db->query(
"UPDATE {blog} SET
1084 name = '" . $this->name .
"',
1085 description = '" . $this->description .
"',
1086 icon = '" . $this->icon .
"',
1087 showtitle = '" . $this->showTitle .
"',
1088 showdesc = '" . $this->showDesc .
"',
1089 showdate = '" . $this->showDate .
"',
1090 showauthor = '" . $this->showAuthor .
"',
1091 sequence = '" . $this->sequence .
"',
1092 sortation = '" . $this->sortation .
"',
1093 comments = '" . $this->comments .
"',
1094 permalink = '" . $this->permaLink .
"',
1095 preview = '" . $this->preview .
"',
1096 voting = '" . $this->voting .
"',
1097 layout = '" . $this->layout .
"',
1098 gid = '" . $this->gid .
"',
1099 spacer = '" . $this->spacer .
"',
1100 limitEntries = '" . $this->limitEntries.
"',
1101 showTotalVotes = '" . $this->showTotalVotes.
"'
1102 WHERE id = '" . $this->blogid .
"'"))
1119 function getFooter(
$db)
1122 $this->year_created =
date(
"Y");
1124 return $this->html .=
"<small><i class='pull-right'>Copyright (C) $this->year_created $hostURL</i></small>";
1158 $prettydate =
"$date[day]. $date[month] $date[year] um $date[time]";
1161 if (isset($row[
'email']) && (!empty($row[
'email']))) {
1163 $emailUrl =
"<a href=\"mailto:" . $row[
'email'] .
"\" class=\"text-black\">" . $row[
'name'] .
"</a>";
1165 $emailUrl =
"<span class=\"text-grey\">" . $row[
'name'] .
"</span>";
1169 if ($row[
'uid'] ===
'0' || $row[
'gid'] ===
'0') {
1172 $VipStyle =
"h4 style=\"color: #912F40;\" data-toggle=\"tooltip\" data-placement=\"left\" title=\"VIP User\"";
1177 if ($sql_replies =
$db->query(
"SELECT id FROM {blog_comments} WHERE parentID = '" . $row[
'id'] .
"' AND published = '1'")) {
1178 while (
$res = mysqli_fetch_assoc($sql_replies)) {
1184 $replyLink =
"<small class=\"pull-right\"><a href='#replyBox$row[id]' data-toggle=\"collapse\" aria-expanded=\"false\" aria-controls=\"replyBox\" id='" . $row[
'id'] .
"'>Kommentare ($replies)</a></small>";
1186 $replyLink =
"<small class=\"pull-right\"><a href='#form' data-toggle=\"collapse\" aria-expanded=\"false\" aria-controls=\"form\" id='" . $row[
'id'] .
"'>antworten</a></small>";
1189 if ($row[
'parentID'] == 0) {
1192 if ($replyCount <= 2) {
1193 $replyForm =
"<form role='form' method='post'>
1194 <input type='text' name='name' class='form-control'>
1195 <textarea class='form-control' name='comment'></textarea>
1202 $this->html .=
"$replyForm";
1203 $this->html .=
"<i><$VipStyle>" . $emailUrl .
" <small>am $prettydate</small></i></h5>";
1204 $this->html .=
"<p>" . $row[
'comment'] .
"</p>$replyLink";
1207 if (
$res =
$db->query(
"SELECT * FROM {blog_comments}
1208 WHERE blogid='" .
$blogid .
"' AND itemid='" .
$itemid .
"' AND parentID = '" . $row[
'id'] .
"'")
1210 if (mysqli_num_rows(
$res) > 0)
1212 $this->html .=
"<div class=\"collapse\" id=\"replyBox$row[id]\"><blockquote>";
1213 while ($row = mysqli_fetch_assoc(
$res)) {
1217 $this->html .=
"</blockquote></div>";
1220 $this->html .=
"<br>";
1237 $this->html .=
"<div id=\comment_thread\">";
1240 $res =
$db->query(
"SELECT * FROM {blog_comments} WHERE blogid = '" .
$blogid .
"' AND itemid = '" .
$itemid .
"' ORDER BY date_created DESC");
1241 while ($row = mysqli_fetch_assoc(
$res)) {
1245 $this->html .=
"</div>";
1264 if ($_SESSION[
'gid'] >=5)
1267 $sql =
$db->query(
"SELECT * FROM {blog_comments} WHERE blogid = '".
$blogid.
"'");
1268 while($row = mysqli_fetch_row(
$sql))
1270 $sql2 =
$db->query(
"SELECT username FROM {users} WHERE id = '".$row[0].
"'");
1271 while($row2 = mysqli_fetch_row($sql2))
1274 $this->
comments .=
"<i>von: <strong>$row2[0]</i></strong><br> $row[1]<br><br>";
1281 $comment_replies = 0;
1283 $padding =
"padding-left: 0.3em;";
1285 $this->html .=
"<div id=\"comment_thread\">";
1286 if (
$res =
$db->query(
"SELECT * FROM {blog_comments}
1287 WHERE blogid = '" .
$blogid .
"'
1288 AND itemid = '" .
$itemid .
"'
1290 ORDER BY date_created DESC"))
1292 while ($row = mysqli_fetch_assoc(
$res))
1294 $comment_id = $row[
'id'];
1298 $name = $row[
'name'];
1300 $date_created = $row[
'date_created'];
1301 $isParent = $row[
'isParent'];
1302 $isChild = $row[
'isChild'];
1303 $parentID = $row[
'parentID'];
1306 $prettydate =
"$date[day]. $date[month] $date[year] um $date[time]";
1309 if ($isParent ===
'0')
1312 if ($isChild !==
'1')
1315 $padding =
"padding-left: 0.3em;";
1317 $collapseFooter =
"";
1319 $reply_link =
"<small><a href=\"#replyBox\" class=\"pull-right small\"><i>antworten... </i><i class=\"fa fa-chevron-down\"></i></a></small>";
1324 $indent =
" ";
1325 $padding =
"padding-left: 2.5em;";
1326 $collapse =
"<div class=\"collapse\" id=\"replyBox\"><blockquote>";
1327 $collapseFooter =
"</blockquote></div>";
1333 $sql_replies =
$db->query(
"SELECT * FROM {blog_comments} WHERE parentID = '" . $comment_id .
"' AND published = '1'");
1334 while ($row = mysqli_fetch_assoc($sql_replies))
1338 $collapse =
"<div class=\"collapse\" id=\"replyBox\"><blockquote>";
1339 $collapseFooter =
"</blockquote></div>";
1341 $reply_link =
"<small><a href=\"#replyBox\" data-toggle=\"collapse\" aria-expanded=\"true\" aria-controls=\"replyBox\" class=\"pull-right small\"><i>Kommentare ($comment_replies) </i><i class=\"fa fa-chevron-down\"></i></a></small>";
1351 $emailLink =
"<a href=\"mailto:$email\" class=\"text-black\">$name</a>";
1355 $emailLink =
"<span class=\"text-grey\">$name</span>";
1360 $this->html .=
"<p><i><h5><strong>" . $emailLink .
"</strong> <small>am " . $prettydate .
"</small></h5></i>" .
$comment .
"
1371 $emailLink =
"<a href=\"mailto:$email\">$name</a>";
1373 $emailLink =
"<span>$name</span>";
1376 $sql2 =
$db->query(
"SELECT username FROM {users} WHERE id = '" .
$uid .
"'");
1377 while ($row2 = mysqli_fetch_row($sql2)) {
1380 $this->html .=
"<p<i><h5><strong>" . $emailLink .
"</strong> <small>am " . $prettydate .
"</small></h5></i>" .
$comment .
"
1389 $this->html =
'Failed to query comments database.';
1391 $this->html .=
"</div>";
1408 if (
$res =
$db->query(
"SELECT COUNT(id) FROM {blog_comments}
1409 WHERE blogid = " .
$blogid .
"
1410 AND itemid=" .
$itemid .
" AND published = '1' ")
1427 function draw_commentbox(
$db)
1430 if (isset($_SESSION[
'logged_in']) && ($_SESSION[
'logged_in'] ==
true)) {
1432 if (isset($_SESSION[
'uid']) && (isset($_SESSION[
'gid']))) {
1433 if (isset($_SESSION[
'username'])) {
1440 $hidden_uid = $_SESSION[
'uid'];
1441 $hidden_gid = $_SESSION[
'gid'];
1445 <div id=\"comments\" class=\"col-md-8\">
1446 <h4>Comments, please! <!-- <small>Give your mustard (:</small> --></h4>
1447 <div class=\"form-group\">
1448 <input class=\"form-control\" type=\"text\" id=\"nameplaceholder\" disabled title=\"Du bist als $username eingeloggt.\" placeholder=\"$username [Du bist eingeloggt]\">
1449 <textarea class=\"form-control\" id=\"comment\" placeholder=\"Deine Nachricht \" rows=\"3\"></textarea>
1450 <input type=\"button\" class=\"btn btn-success\" id=\"submit_post\" name=\"save_comment\" value=\"absenden\" style=\"\">
1451 <input type=\"hidden\" id=\"uid\" name=\"uid\" value=\"" . $hidden_uid .
"\">
1452 <input type=\"hidden\" id=\"gid\" name=\"gid\" value=\"" . $hidden_gid .
"\">
1453 <input type=\"hidden\" id=\"itemid\" name=\"itemid\" value=\"" . $this->
itemid .
"\">
1454 <input type=\"hidden\" id=\"blogid\" name=\"blogid\" value=\"" . $this->
blogid .
"\">
1455 <input type=\"hidden\" id=\"name\" name=\"name\" value=\"$username\">
1459 $this->html .=
"</div>
1460 <div class=\"col-md-4 mx-auto d-block\">";
1461 $this->html .= self::drawVotingBox(
$db, $this->voteUp, $this->voteDown);
1462 $this->html .=
"</div>
1469 echo \YAWK\alert::draw(
"danger",
"Error!",
"Cannot detect User Status. Obviously you are not correctly logged-in. Please try to re-login.",
"",
"4200");
1481 <div id=\"comments\" class=\"col-md-8\">
1482 <h4>Comments, please! <!-- <small>Give your mustard (:</small> --></h4>
1483 <div class=\"form-group\">
1484 <input type=\"text\" name=\"name\" id=\"name\" class=\"form-control\" placeholder=\"Dein Name\">
1485 <input type=\"text\" name=\"email\" id=\"email\" class=\"form-control\" placeholder=\"Emailadresse [optional]\">
1486 <textarea class=\"form-control\" id=\"comment\" placeholder=\"Deine Nachricht \" rows=\"3\"></textarea>
1487 <input type=\"button\" class=\"btn btn-success\" id=\"submit_post\" name=\"save_comment\" value=\"absenden\" style=\"\">
1488 <input type=\"hidden\" id=\"uid\" name=\"uid\" value=\"" . $hidden_uid .
"\">
1489 <input type=\"hidden\" id=\"gid\" name=\"gid\" value=\"" . $hidden_gid .
"\">
1490 <input type=\"hidden\" id=\"itemid\" name=\"itemid\" value=\"" . $this->
itemid .
"\">
1491 <input type=\"hidden\" id=\"blogid\" name=\"blogid\" value=\"" . $this->
blogid .
"\">
1494 $this->html .=
"</div>
1495 <div class=\"col-md-4 mx-auto d-block\">";
1496 $this->html .= self::drawVotingBox(
$db, $this->voteUp, $this->voteDown);
1497 $this->html .=
"</div>
1515 if (
$res =
$db->query(
"SELECT " . $property .
" WHERE id = '" .
$itemid .
" AND blogid = '" .
$blogid .
"'")) {
1516 while ($row = mysqli_fetch_row(
$res)) {
1535 if (
$res =
$db->query(
"SELECT alias FROM {pages} WHERE blogid = '" .
$blogid .
"'")) {
1537 while ($row = mysqli_fetch_row(
$res)) {
1540 $filename =
"../content/pages/" . $alias .
".php";
1543 \YAWK\alert::draw(
"success",
"Success!",
"Blog file $filename deleted.",
"", 2800);
1547 \YAWK\alert::draw(
"danger",
"Could not delete file!",
"Blog file $filename not deleted.",
"", 6800);
1556 if (
$db->query(
"DELETE FROM {pages} WHERE blogid = '" .
$blogid .
"'")) {
1557 \YAWK\alert::draw(
"success",
"Deleted Blog",
"Blog $filename deleted successfully.",
"", 2800);
1562 \YAWK\alert::draw(
"danger",
"Could not get alias from pages!",
"File could not be deleted.",
"", 5800);
1564 if (
$res =
$db->query(
"DELETE FROM {menu} WHERE blogid = '" .
$blogid .
"'")) {
1567 if (
$res =
$db->query(
"DELETE FROM {blog} WHERE id = '" .
$blogid .
"'")) {
1570 if (
$res =
$db->query(
"DELETE FROM {blog_items} WHERE blogid = '" .
$blogid .
"'")) {
1573 if (
$res =
$db->query(
"DELETE FROM {blog_comments} WHERE blogid = '" .
$blogid .
"'")) {
1590 if (
$res =
$db->query(
"SELECT alias FROM {pages} WHERE id = '" . $pageid .
"'")) {
1591 if ($row = mysqli_fetch_array(
$res)) {
1592 $alias = $row[
'alias'];
1594 if (
$res =
$db->query(
"DELETE FROM {pages} WHERE id = '" . $pageid .
"'")) {
1595 $filename =
"../content/pages/" . $alias .
".php";
1598 if (
$res =
$db->query(
"DELETE FROM {blog_items} WHERE blogid = '" .
$blogid .
"' AND id = '" .
$itemid .
"'")) {
1599 \YAWK\alert::draw(
"success",
"Blog item deleted ",
"Blog item deleted from database!",
"",
"2200");
1601 if (
$res =
$db->query(
"DELETE FROM {blog_comments} WHERE blogid = '" .
$blogid .
"' AND itemid = '" .
$itemid .
"'")) {
1602 \YAWK\alert::draw(
"success",
"Blog comments deleted",
"Blog comments deleted from database!",
"",
"2200");
1634 if (
$res =
$db->query(
"DELETE FROM {blog_comments} WHERE blogid = '" .
$blogid .
"' AND itemid = '" .
$itemid .
"' AND id = '" . $commentid .
"'")) {
1635 \YAWK\alert::draw(
"success",
"Success!",
"Comment deleted from database!",
"",
"2000");
1651 function create(
$db,
$name, $description, $menuID, $icon)
1658 $description = htmlentities($description);
1660 $description =
$db->quote($description);
1664 if (
$db->query(
"INSERT INTO {blog} (sort, published, name, description, icon)
1666 '" . $published .
"',
1668 '" . $description .
"',
1672 if (!$res_blog =
$db->query(
"SELECT MAX(id), MAX(sort) FROM {blog}"))
1678 $row = mysqli_fetch_row($res_blog);
1679 if (!isset($row[0])) {
1682 $blogId = $row[0]++;
1686 if ($row =
$db->query(
"SELECT blogid FROM {pages} WHERE blogid = '" . $blogId .
"' LIMIT 1"))
1688 $res = mysqli_fetch_row($row);
1689 }
else {
$res =
null; }
1690 if (
$res != $blogId)
1695 $page = new \YAWK\page();
1697 if (
$page->create(
$db,
$name, $menuID, $locked, $blogId, 0) ===
true)
1703 \YAWK\alert::draw(
"danger",
"Error: ",
"Could not create blog page! Please enter all fields.",
"",
"2200");
1711 \YAWK\alert::draw(
"danger",
"Error: ",
"Could not create blog page database entry - please try it again.",
"",
"3800");
1732 function createItem(
$db,
$blogid, $title, $subtitle, $published, $teasertext, $blogtext, $date_publish, $date_unpublish, $thumbnail, $youtubeUrl, $weblink, $meta_local, $meta_keywords)
1736 $date_created =
date(
"Y-m-d G:i:s");
1739 $alias = mb_strtolower($alias);
1740 $alias = str_replace(
" ",
"-", $alias);
1742 $umlaute = array(
"/ä/",
"/ü/",
"/ö/",
"/Ä/",
"/Ü/",
"/Ö/",
"/ß/");
1743 $ersetze = array(
"ae",
"ue",
"oe",
"ae",
"ue",
"oe",
"ss");
1744 $alias = preg_replace($umlaute, $ersetze, $alias);
1745 $alias = preg_replace(
"/[^a-z0-9\-\/]/i",
"", $alias);
1748 if (
$res =
$db->query(
"SELECT MAX(id) FROM {pages}"))
1750 $row = mysqli_fetch_row(
$res);
1751 $page_id = $row[0] + 1;
1755 $title = htmlentities($title);
1756 if (!
$res =
$db->query(
"INSERT INTO {pages} (id,published,date_created,date_publish,alias,title,locked,blogid,meta_local,meta_keywords)
1757 VALUES ('" . $page_id .
"',
1758 '" . $published .
"',
1759 '" . $date_created .
"',
1760 '" . $date_created .
"',
1764 '" . $this->blogid .
"',
1765 '" . $this->meta_local .
"',
1766 '" . $this->meta_keywords .
"')")
1769 \YAWK\sys::setSyslog(
$db, 7, 1,
"failed to insert blog page $alias into database", 0, 0, 0, 0);
1775 if ($res_blog =
$db->query(
"SELECT MAX(id), MAX(sort) FROM {blog_items}"))
1777 $row = mysqli_fetch_row($res_blog);
1786 $sort = $row[1] + 1;
1789 $sort = $row[1] + 1;
1793 $subtitle = htmlentities($subtitle);
1799 if ($date_unpublish ==
"0000-00-00 00:00:00" || (empty($date_unpublish)))
1802 $res =
$db->query(
"INSERT INTO {blog_items}
1803 (blogid,id,uid,pageid,sort,published,title,filename,subtitle,date_created,date_publish,date_unpublish,teasertext,blogtext,thumbnail,youtubeUrl,author,weblink)
1804 VALUES('" . $this->
blogid .
"',
1806 '" . $_SESSION[
'uid'] .
"',
1809 '" . $published .
"',
1812 '" . $subtitle .
"',
1813 '" . $date_created .
"',
1814 '" . $date_publish .
"',
1816 '" . $teasertext .
"',
1817 '" . $blogtext .
"',
1818 '" . $thumbnail .
"',
1819 '" . $youtubeUrl .
"',
1820 '" . $_SESSION[
'username'] .
"',
1821 '" . $weblink .
"')");
1826 $res =
$db->query(
"INSERT INTO {blog_items}
1827 (blogid,id,uid,pageid,sort,published,title,filename,subtitle,date_created,date_publish,date_unpublish,teasertext,blogtext,thumbnail,youtubeUrl,author,weblink)
1828 VALUES('" . $this->
blogid .
"',
1830 '" . $_SESSION[
'uid'] .
"',
1833 '" . $published .
"',
1836 '" . $subtitle .
"',
1837 '" . $date_created .
"',
1838 '" . $date_publish .
"',
1839 '" . $date_unpublish .
"',
1840 '" . $teasertext .
"',
1841 '" . $blogtext .
"',
1842 '" . $thumbnail .
"',
1843 '" . $youtubeUrl .
"',
1844 '" . $_SESSION[
'username'] .
"',
1845 '" . $weblink .
"')");
1851 $content =
"<?php \$blog_id = $blogid; \$item_id = $id; \$full_view = 1; include 'system/plugins/blog/blog.php'; ?>";
1853 $filename =
"../content/pages/" . $alias .
".php";
1863 \YAWK\sys::setSyslog(
$db, 7, 1,
"failed to insert blog item to db, affected: ID: $id \"$alias\" into blog ID: $blogid", 0, 0, 0, 0);
1869 \YAWK\sys::setSyslog(
$db, 7, 1,
"failed to get MAX ID from pages database", 0, 0, 0, 0);
1880 function copyItem(
$db)
1883 $gid =
"$this->itemgid";
1884 $alias =
"$this->filename-kopie";
1885 $title_new =
"$this->filename-kopie";
1887 $date_created =
date(
"Y-m-d G:i:s");
1891 \YAWK\alert::draw(
"warning",
"Warning: ",
"Alias not set. Please reload the page and try again.",
"",
"5600");
1894 if (!
$res =
$db->query(
"SELECT MAX(id) FROM {pages}"))
1896 \YAWK\alert::draw(
"warning",
"Warning: ",
"Cannot get MAX id from pages database.",
"",
"3600");
1900 $row = mysqli_fetch_row(
$res);
1901 $pageid = $row[0] + 1;
1907 if (
$res =
$db->query(
"INSERT INTO {pages} (id,gid,published,date_created,date_publish,alias,title,locked,blogid,meta_local,meta_keywords)
1908 VALUES ('" . $pageid .
"',
1910 '" . $published .
"',
1911 '" . $date_created .
"',
1912 '" . $date_created .
"',
1914 '" . $this->blogtitle .
"',
1916 '" . $this->blogid .
"',
1917 '" . $this->meta_local .
"',
1918 '" . $this->meta_keywords .
"')"))
1920 if (
$res =
$db->query(
"SELECT MAX(id) FROM {blog_items}"))
1922 $row = mysqli_fetch_row(
$res);
1929 if (
$res =
$db->query(
"INSERT INTO {blog_items} (blogid,id,uid,pageid,sort,published,itemgid,title,filename,subtitle,date_created,date_changed,date_publish,date_unpublish,teasertext,blogtext,author,youtubeUrl,weblink, thumbnail)
1930 VALUES ('" . $this->blogid .
"',
1932 '" . $this->uid .
"',
1934 '" . $this->sort .
"',
1935 '" . $this->published .
"',
1936 '" . $this->itemgid .
"',
1937 '" . $this->blogtitle .
"',
1939 '" . $this->subtitle .
"',
1940 '" . $this->date_created .
"',
1941 '" . $this->date_changed .
"',
1942 '" . $this->date_publish .
"',
1944 '" . $this->teasertext .
"',
1945 '" . $this->blogtext .
"',
1946 '" . $this->author .
"',
1947 '" . $this->youtubeUrl .
"',
1948 '" . $this->weblink .
"',
1949 '" . $this->thumbnail .
"')"))
1952 $desc =
"description";
1956 if (!
$res =
$db->query(
"INSERT INTO {meta_local} (name,page,content)
1957 VALUES ('" . $desc .
"', '" .
$id .
"', '" . $this->blogtitle .
"')"))
1961 if (!
$res =
$db->query(
"INSERT INTO {meta_local} (name,page,content)
1962 VALUES ('" . $keyw .
"','" .
$id .
"','" . $words .
"')"))
1967 $content =
"<?php \$blog_id = $this->blogid; \$item_id = $id; \$full_view = 1; include 'system/plugins/blog/blog.php'; ?>";
1969 $filename =
"../content/pages/" . $alias .
".php";
1978 \YAWK\alert::draw(
"error",
"Error: ",
"Could not create loading file $filename",
"",
"3800");
1989 if (
$res =
$db->query(
"INSERT INTO {blog_items} (blogid,id,uid,pageid,sort,published,itemgid,title,filename,subtitle,date_created,date_changed,date_publish,date_unpublish,teasertext,blogtext,author,youtubeUrl,weblink,thumbnail)
1990 VALUES ('" . $this->blogid .
"',
1992 '" . $this->uid .
"',
1994 '" . $this->sort .
"',
1995 '" . $this->published .
"',
1996 '" . $this->itemgid .
"',
1997 '" . $this->blogtitle .
"',
1999 '" . $this->subtitle .
"',
2000 '" . $this->date_created .
"',
2001 '" . $this->date_changed .
"',
2002 '" . $this->date_publish .
"',
2003 '" . $this->date_unpublish .
"',
2004 '" . $this->teasertext .
"',
2005 '" . $this->blogtext .
"',
2006 '" . $this->author .
"',
2007 '" . $this->youtubeUrl .
"',
2008 '" . $this->weblink .
"',
2009 '" . $this->thumbnail .
"')"))
2013 $content =
"<?php \$blog_id = $this->blogid; \$item_id = $id; \$full_view = 1; include 'system/plugins/blog/blog.php'; ?>";
2015 $filename =
"../content/pages/" . $alias .
".php";
2024 \YAWK\alert::draw(
"error",
"Error: ",
"Could not create loading file $filename",
"",
"3800");
2037 \YAWK\alert::draw(
"danger",
"Error: ",
"Insert pages database failed.",
"",
"3600");
if(!isset($blog)) if(!isset($language)||(!isset($lang))) if(!isset($db)) $blog published
static draw($type, $title, $text, $redirect, $delay)
static getMetaTags($db, $id, $type)
get and return meta tags for requested page
static getSetting($db, $property)
Get and return value for property from settings database.
static splitDate($date)
split a date to month, day, year and time
static getWeekday($date, $lang)
return weekday from given date
static encodeChars($string)
convert german special chars and vowels into legal html
print $page meta_keywords
print $page date_unpublish
if(isset($_POST['sent'])) $layout