36 return "<ol class=\"breadcrumb\">
37 <li><i class=\"fa fa-globe\"></i> <a href=\"index.php?page=settings-frontend\" title=\"$lang[EDIT]\"> $lang[FRONTEND]</a></li>
38 <li><i class=\"fa fa-sign-in\"></i> <a href=\"index.php?page=settings-backend\" title=\"$lang[EDIT]\"> $lang[BACKEND]</a></li>
39 <li><i class=\"fa fa-cogs\"></i> <a href=\"index.php?page=settings-system\" title=\"$lang[EDIT]\"> $lang[SYSTEM]</a></li>
40 <li><i class=\"fa fa-envelope-o\"></i> <a href=\"index.php?page=settings-webmail\" title=\"$lang[WEBMAIL]\"> $lang[WEBMAIL]</a></li>
41 <li><i class=\"fa fa-language\"></i> <a href=\"index.php?page=settings-language\" title=\"$lang[EDIT]\"> $lang[LANGUAGES]</a></li>
42 <li><i class=\"fa fa-android\"></i> <a href=\"index.php?page=settings-robots\" title=\"$lang[EDIT]\"> $lang[ROBOTS_TXT]</a></li>
43 <li><i class=\"fa fa-puzzle-piece\"></i> <a href=\"index.php?page=settings-assets\" title=\"$lang[EDIT]\"> $lang[ASSETS]</a></li>
44 <li><i class=\"fa fa-font\"></i> <a href=\"index.php?page=settings-fonts\" title=\"$lang[EDIT]\"> $lang[FONTS]</a></li>
45 <li><i class=\"fa fa-database\"></i> <a href=\"index.php?page=settings-database\" title=\"$lang[EDIT]\"> $lang[DATABASE]</a></li>
46 <li><i class=\"fa fa-info-circle\"></i> <a href=\"index.php?page=settings-systeminfo\" title=\"$lang[EDIT]\"> $lang[SYSTEM] $lang[INFO]</a></li>
59 return "<ol class=\"breadcrumb\">
60 <li><i class=\"fa fa-home\"></i> <a href=\"index.php?page=template-overview\" title=\"$lang[EDIT]\"> $lang[OVERVIEW]</a></li>
61 <li><i class=\"fa fa-cube\"></i> <a href=\"index.php?page=template-positions\" title=\"$lang[EDIT]\"> $lang[POSITIONS]</a></li>
62 <li><i class=\"fa fa-paint-brush\"></i> <a href=\"index.php?page=template-redesign\" title=\"$lang[EDIT]\"> $lang[DESIGN]</a></li>
63 <li><i class=\"fa fa-text-height\"></i> <a href=\"index.php?page=template-typography\" title=\"$lang[EDIT]\"> $lang[TYPOGRAPHY]</a></li>
64 <li><i class=\"fa fa-css3\"></i> <a href=\"index.php?page=template-customcss\" title=\"$lang[EDIT]\"> $lang[CUSTOM_CSS]</a></li>
65 <li><i class=\"fa fa-code\"></i> <a href=\"index.php?page=template-customjs\" title=\"$lang[EDIT]\"> $lang[CUSTOM_JS]</a></li>
66 <li><i class=\"fa fa-puzzle-piece\"></i> <a href=\"index.php?page=template-assets\" title=\"$lang[EDIT]\"> $lang[ASSETS]</a></li>
67 <li><i class=\"fa fa-eye\"></i> <a href=\"index.php?page=template-preview\" title=\"$lang[WEBSITE] $lang[PREVIEW]\"> $lang[PREVIEW]</a></li>
82 $html =
"<h1>" . $title .
" <small>" .
$subtext .
"</small></h1>";
84 $html =
"<h1>" . $title .
"</h1>";
95 print
"<script type=\"text/javascript\" >
96 $(document).ready(function() {
97 $('#" .
$field .
"').focus(); });
108 print
"<script type=\"text/javascript\">
109 setTimeout(\"self.location.href='" . $location .
"'\"," . $wait .
");
112 <h1>Your Browser needs activated javascript, to render the site correctly.<br>
113 <small>Please click <a href=\"$location\">here</a> to go ahead.</small></h1>
135 <!-- optional backend FX on -->
136 <script>$(\"#content-FX\").hide(0).delay(0)." .
$type .
"(" . $time .
")</script>";
146 <!-- Content Wrapper. Contains page content -->
147 <div class=\"content-wrapper\" id=\"content-FX\">
148 <!-- Content Header (Page header) -->
149 <section class=\"content-header\">
151 <!-- Main content -->
152 <section class=\"content\">";
162 static function checkLogin(
object $db): bool
167 if (isset($_POST[
'user'])){
168 $_POST[
'user']=trim($_POST[
'user']);
171 $user = new \YAWK\user(
$db);
172 if(!empty($_POST[
'user']) && (!empty($_POST[
'password'])))
174 if($user->loginBackEnd(
$db, $_POST[
'user'],$_POST[
'password']))
176 $_SESSION[
'username'] = $_POST[
'user'];
177 $_SESSION[
'passwordFail'] = 0;
178 $user->storeLogin(
$db, 0,
"backend", $_POST[
'user'], $_POST[
'password']);
183 if (isset($_SESSION[
'passwordFail']))
185 $_SESSION[
'passwordFail']++;
189 $_SESSION[
'passwordFail'] = 1;
192 $user->storeLogin(
$db, 1,
"backend", $_POST[
'user'], $_POST[
'password']);
216 echo
"<!-- TEMPLATE SELECT -->
217 <select class=\"form-control\" id=\"selectedTemplate\" name=\"selectedTemplate\">
218 <label for id=\"selectedTemplate\">$description</label>
219 <option value=\""; echo \YAWK\template::getCurrentTemplateId(
$db); echo
"\">";
220 echo \YAWK\template::getCurrentTemplateName(
$db,
"backend", 0);
225 echo
"<option value=\"".$template[
'id'].
"\"";
226 if (isset($_POST[
'template'])) {
227 if($_POST[
'template'] === $template[
'id']){
228 echo
"selected=\"selected\"";
231 echo
">".$template[
'name'].
"</option>";
255 if (isset($_SESSION[
'passwordFail']) && ($_SESSION[
'passwordFail'] > 1))
258 $resetBtn =
"<a type=\"button\" class=\"btn btn-danger\" id=\"resetPasswordButton\" data-toggle=\"modal\" data-target=\"#myModal\"><i class=\"fa fa-question-circle\"></i> $lang[PASSWORD_FORGOTTEN]</a>";
262 $resetBtn =
" ";
266 if (isset(
$_GET[
'page']) && (!empty(
$_GET[
'page'])))
275 $form =
"<form role=\"form\" id=\"loginForm\" class=\"form-horizontal\" action=\"index.php".$redirect.
"\" method=\"post\">
276 <input required type=\"text\" class=\"form-control\" maxlength=\"128\" id=\"user\" value=\"".
$username.
"\" name=\"user\" style=\"margin-bottom:4px;\" placeholder=\"Username\">
277 <input required type=\"password\" class=\"form-control\" id=\"password\" value=\"".
$password.
"\" name=\"password\" placeholder=\"Password\"><br>
278 <button type=\"button\" class=\"btn btn-success\" id=\"loginButton\"><i class=\"fa fa-lock\"></i> ".
$lang[
'LOGIN'].
"</button>
279 ".$resetBtn.
"
281 <div id=\"captchaNode\"></div>
282 <div id=\"loginTimerNode\"></div>";
302 $modalWindow =
" <!-- Modal -->
303 <form method=\"POST\" action=\"index.php\">
304 <div class=\"modal fade\" id=\"myModal\" role=\"dialog\">
305 <div class=\"modal-dialog\">
307 <!-- Modal content-->
308 <div class=\"modal-content\">
309 <div class=\"modal-header\">
310 <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button>
311 <h4 class=\"modal-title\">$lang[PASSWORD_RESET]</h4>
313 <div class=\"modal-body\">
314 <label for=\"email\">$lang[EMAIL]</label>
315 <input type=\"text\" class=\"form-control\" id=\"email\" name=\"email\" placeholder=\"$lang[PASSWORD_RESET_HOWTO]\">
316 <div class=\"text-center\"><br><i>$lang[OR]</i><br></div>
317 <label for=\"username\">$lang[USERNAME]</label>
318 <input type=\"text\" class=\"form-control\" id=\"username\" name=\"username\" placeholder=\"$lang[USERNAME]\">
319 <input type=\"hidden\" name=\"resetPasswordRequest\" id=\"resetPasswordRequest\" value=\"true\">
321 <div class=\"modal-footer\">
322 <div class=\"form-group col-md-12\"><h3 class=\"pull-left\">Please solve this captcha:</h3></div>
323 <div class =\"form-group col-md-4\">
324 <input type=\"text\" size=\"1\" maxlength=\"2\" name=\"number1\" id=\"number1\" value=\"".rand(1,12).
"\">
326 <div class=\"form-group col-md-4\">
327 <label for=\"number2\"> + </label> <input type=\"text\" size=\"1\" maxlength=\"2\" name=\"number2\" id=\"number2\" value=\"".rand(1,12).
"\">
329 <div class=\"form-group col-md-4\">
330 <label for=\"captcha\"> = </label> <input type=\"text\" size=\"2\" maxlength=\"2\" name=\"captcha\" id=\"captcha\">
332 <button type=\"submit\" class=\"btn btn-success\"><i class=\"fa fa-check\"></i> $lang[PASSWORD_RESET]</button>
333 <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\"><i class=\"fa fa-times\"></i> $lang[CANCEL]</button>
334 <input type=\"hidden\" name=\"resetPasswordRequest\" id=\"resetPasswordRequest\" value=\"true\">
336 if (!empty($_SERVER[
'REMOTE_ADDR'])){
337 $ip = $_SERVER[
'REMOTE_ADDR'];
338 $hostname = gethostname();
339 $network = gethostbyaddr($_SERVER[
'REMOTE_ADDR']);
343 $hostname =
"unknown";
347 $modalWindow .=
"<div class=\"text-left small\"><i><small>Access from IP: $ip @ $hostname from network: $network will be logged.</small></i></div>
356 <div class=\"row\" id=\"loginbox\"><br><br>
357 <div class=\"col-md-4\"> </div>
358 <div class=\"col-md-4\">
359 <div class=\"box box-default\">
360 <div class=\"box-body\">
361 <h3>Login :: <small>" . $title .
"</small></h3><br>";
363 $loginBox .=
"<div id=\"loginTimerNode\"></div>
367 <div class=\"col-md-4\"> </div>
369 return $modalWindow.$loginBox;
379 if (empty($user->firstname))
381 $currentUser = $user->username;
383 if (empty($user->lastname))
385 $currentUser = $user->username;
387 if (!empty($user->firstname) && (empty($user->lastname)))
389 $currentUser = $user->firstname;
391 if (empty($user->firstname) && (!empty($user->lastname)))
393 $currentUser = $user->lastname;
395 if (!empty($user->firstname) && (!empty($user->lastname)))
397 $currentUser =
"$user->firstname".
" ".
"$user->lastname";
399 if (isset($currentUser))
418 if (
$res =
$db->query(
"SELECT cp.*, cg.value as gid FROM {pages} as cp
419 JOIN {user_groups} as cg on cp.gid = cg.id ORDER BY id DESC")) {
420 $pagesArray = array();
421 while ($row =
$res->fetch_assoc()){
422 $pagesArray[] = $row;
429 echo \YAWK\alert::draw(
"danger",
"Error!",
"Sorry, fetch database error: getPagesArray failed.",
"",4200);
443 if (
$res =
$db->query(
"SELECT id, name, published, (
446 WHERE menuID = {menu_names}.id
447 ) count FROM {menu_names}")) {
448 $menusArray = array();
450 $menusArray[] =
$rows;
455 die (
"Sorry, fetch database error: getMenus failed.");
468 if (
$res =
$db->query(
"SELECT id, name FROM {menu_names} WHERE published = '1'"))
470 $menusArray = array();
472 $menusArray[] =
$rows;
477 die (
"Sorry, fetch database error: getMenus failed.");
493 if (
$type ===
"Google" || (
$type ===
"google"))
495 $flag =
"&type=google";
499 $flag =
"&type=custom";
509 echo
$lang[
'FONTS_NOT_FOUND'];
510 echo
"<a href=\"#\" id=\"addFontBtn\" data-toggle=\"modal\" data-target=\"#myModal\"
511 style=\"margin-top:2px;\"><i><small> » ".$lang[
'ADD'].
"</small></i></a>";
517 echo
"<!-- draw font -->
518 <h4 style=\"font-family:'$font';\">$font<small>
519 <!-- delete font icon -->
520 <a role=\"dialog\" data-confirm=\"$lang[FONT] « ".$font.
" » $lang[DELETE_CONFIRM]\"
521 title=\"".
$lang[
'FONT_DEL'].
"\" href=\"index.php?page=settings-fonts&delete=true$flag&font=$font\">
522 <i class=\"fa fa-trash-o pull-right\" data-toggle=\"tooltip\" title=\"$lang[DELETE]\" style=\"margin-top:4px;\"></i></a> ";
525 if (
$type ===
"Google" || (
$type ===
"google"))
531 echo
"<a href=\"$folder$font\" title=\"$lang[DOWNLOAD] $font\"><i class=\"fa fa-arrow-circle-o-down pull-right\"
532 data-toggle=\"tooltip\" title=\"$lang[TO_DOWNLOAD]\" style=\"margin-top:4px;\"></i></a> ";
535 echo
"</small></h4><hr>";
556 echo
'<!-- WIDGET OVERVIEW -->
557 <div class="box box-default">
558 <div class="box-header with-border">
559 <h3 class="box-title"><i class="fa fa-tags"></i> '.$lang[
"WIDGETS"].
' <small>'.
$lang[
"WIDGETS_ON_THIS_PAGE"].
'</small></h3>
561 <div class="box-tools pull-right">
562 <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
567 <div class="box-body" style="display: block;">';
568 if (isset($widgetList) && (is_array($widgetList)))
571 foreach ($widgetList as $widget)
574 if ($widget[
'published'] == 1){ $wTextColor =
'default'; }
else { $wTextColor =
'danger'; }
577 if ($widget[
'pageID'] == 0){ $wPageInfo =
'all'; }
else { $wPageInfo =
'this'; }
580 if ((empty($widget[
'widgetTitle'])))
582 $widget[
'widgetTitle'] = $widget[
'name'];
586 echo
'<p style="float:left; margin-right:5px;"><a href="index.php?page=widget-edit&widget='.$widget[
'id'].
'" class="btn btn-xs btn-'.$wTextColor.
'" title="'.
$lang[
'EDIT'].
': '.$widget[
'name'].
' '.
$lang[
'WIDGET'].
'">
587 '.$widget[
'widgetTitle'].
' @<small> '.$wPageInfo.
' | '.$widget[
'position'].
'</small></a></p>';
591 echo
'<p>'.$lang[
'NO_WIDGET_CREATED'].
' <small><i>(<a href="index.php?page=widget-new">'.
$lang[
'CREATE'].
'</a>)</small></p>';
605 if (!empty($toolTipText))
607 return '<small><i class="fa fa-question-circle-o text-info" data-placement="auto right" data-toggle="tooltip" title="'.$toolTipText.
'"></i></small>';
610 return '<small><i class="fa fa-question-circle-o text-info" data-placement="auto right" data-toggle="tooltip" title="Tooltip fehlt leider :("></i></small>';
print $lang['FILEMAN_UPLOAD']
Backend class serves a few useful functions for the admin backend.
static getMenusArray($db)
Get Menu id name and published into an array.
static getPagesArray($db)
Get pages and user groups into an array.
static setTimeout($location, $wait)
static getFullUsername($user)
Clever function to return the username. Expects the user object as param to work correctly.
static getTitle($title, $subtext)
Header title on top of every page.
static getSettingsBreadcrumbs($lang)
Return breadcrumbs for settings pages.
static printTooltip($toolTipText)
Draw a small question mark, enabling a tooltip on hover. toolTipText must be a string and will usuall...
static drawTemplateSelectField($db, $description)
Draw a SELECT field with all templates, current active template is selected.
static setFocus($field)
Set focus to any input field on pageload.
static getTemplateBreadcrumbs($lang)
Return breadcrumbs for template pages.
static getFX($db, $time, $type)
Include Javascript FX to apply on #content-FX DOM element.
static getMenuNamesArray($db)
return all menu ids and names as array
static drawLoginForm($username, $password, $lang)
Draw a login form. If username and/or password was given, the form will be pre-filled with given valu...
static drawWidgetsOnPageBox($db, $page, $lang)
Draw a box containing all widgets that are linked with given page. Every Widget gets drawn as small b...
static drawFontList($fontArray, $folder, $type, $lang)
Draw a list with all fonts. Expects fonts as array.
static drawLoginBox($db, $lang)
Draw a login box. Basically it wraps the drawLoginForm function with an AdminLTE box.
static drawContentWrapper()
Draw the AdminLTE Content Wrapper. Useful that view dont crash in situations where the DOM is not loa...
static getSetting($db, $property)
Get and return value for property from settings database.
static getTemplateIds(object $db)
return array with all template id's + names.
This class serves methods to create backup from files.