YaWK  24.1
Yet another WebKit
AdminLTE.php
Go to the documentation of this file.
1 <?php
2 namespace YAWK\BACKEND {
3 
4  use YAWK\alert;
5  use YAWK\controller;
6  use YAWK\settings;
7  /**
8  * @details <b>Admin LTE Template Class</b>
9  *
10  * This class serves a few methods that build the Admin LTE view in the backend.<br>
11  *
12  * <p><i>Class covers backend template functionality.
13  * See Methods Summary for Details!</i></p>
14  *
15  * @author Daniel Retzl <[email protected]>
16  * @copyright 2009-2016 Daniel Retzl
17  * @license https://opensource.org/licenses/MIT
18  * @version 1.0.0/
19  * @since File available since Release 1.0.0
20  * @brief Backend class serves a few useful functions for the admin backend.
21  */
22  class AdminLTE
23  {
24  /**
25  * @brief Admin LTE Template Class
26  * @param string contains the backend skin (eg. skin-blue)*/
27  public $backendSkin;
28  /** * @param string the desired layout (eg. sidebar-mini ) */
30  /** * @paceLoader string pace loader on top of page - true or false */
31  public $paceLoader;
32 
33  /**
34  * @brief AdminLTE constructor.
35  * @param object $db Database object
36  */
37  public function __construct($db){
38  // get skin setting
39  $this->backendSkin = settings::getSetting($db, "backendSkin");
40  if (empty($this->backendSkin)){
41  $this->backendSkin = "skin-blue"; // default
42  }
43  // get layout setting
44  $this->backendLayout = settings::getSetting($db, "backendLayout");
45  if (empty($this->backendLayout)){
46  $this->backendSkin = "sidebar-mini"; // default
47  }
48  // get pace loading setting
49  if (settings::getSetting($db, "paceLoader") == "enabled")
50  {
51  $this->paceLoader = "
52  <!-- PACE JS -->
53  <script src=\"../system/engines/pace/pace.min.js\"></script>
54  <!-- PACE.css-->
55  <link rel=\"stylesheet\" href=\"../system/engines/pace/pace-minimal.css\">";
56 
57  $paceLoaderColor = "background: #". settings::getSetting($db, "paceLoaderColor").";";
58  $paceLoaderHeight = "height: ". settings::getSetting($db, "paceLoaderHeight");
59  $this->paceLoader .= "
60  <style>
61  .pace .pace-progress {
62  ".$paceLoaderColor."";
63  $this->paceLoader .= "
64  ".$paceLoaderHeight."
65  }
66  </style>";
67  }
68  else
69  {
70  $this->paceLoader = '';
71  }
72  }
73 
74  /**
75  * @brief Draw the HTML Header. Loads all .css and .js files
76  * @return null
77  */
78  function drawHtmlHead(){
79  echo "<!DOCTYPE html>
80 <html>
81  <head>
82  <meta charset=\"utf-8\">
83  <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">
84  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
85  <title>YaWK CMS AdminLTE 2 | Startseite</title>
86  <!-- Tell the browser to be responsive to screen width -->
87  <meta content=\"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no\" name=\"viewport\">
88  <!-- favicon -->
89  <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"favicon.ico\">
90  <!-- apple touch icon -->
91  <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"apple-touch-icon.png\">
92  <!-- windows tiles -->
93  <meta name=\"msapplication-TileColor\" content=\"#ff6600\">
94  <meta name=\"msapplication-TileImage\" content=\"mstile-144x144.png\">
95  <!-- jQuery 2.1.4 -->
96  <script type=\"text/javascript\" src=\"../system/engines/jquery/jquery-3.6.4.min.js\"></script>
97 
98  ".$this->paceLoader."
99 
100  <!-- Bootstrap 3.3.5 -->
101  <link rel=\"stylesheet\" href=\"../system/engines/bootstrap3/dist/css/bootstrap.min.css\">
102  <!-- Animate CSS -->
103  <link rel=\"stylesheet\" href=\"../system/engines/animateCSS/animate.min.css\">
104  <!-- Font Awesome -->
105  <link rel=\"stylesheet\" href=\"../system/engines/font-awesome/css/font-awesome.min.css\">
106  <!-- Theme style -->
107  <link rel=\"stylesheet\" href=\"../system/engines/AdminLTE/css/AdminLTE.min.css\">
108  <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
109  page. However, you can choose any other skin. Make sure you
110  apply the skin class to the body tag so the changes take effect.
111  -->
112  <!-- AdminLTE custom backend skin -->
113  <link rel=\"stylesheet\" href=\"../system/engines/AdminLTE/css/skins/$this->backendSkin.min.css\">
114 
115  <!-- include custom css -->
116  <link rel=\"stylesheet\" href=\"../system/engines/AdminLTE/css/skins/custom.css\">
117 
118  <!-- moment.js (used by datetimepicker) -->
119  <script type=\"text/javascript\" src=\"../system/engines/jquery/moment.min.js\"></script>
120 
121  <!-- jQuery 3.0.0 -->
122  <!-- <script type=\"text/javascript\" src=\"../system/engines/jquery/jquery-3.0.0.min.js\"></script> -->
123 
124  <!-- Notify JS -->
125  <script src=\"../system/engines/jquery/notify/bootstrap-notify.min.js\"></script>
126 
127  <!-- favicons
128  <link rel=\"apple-touch-icon\" sizes=\"180x180\" href=\"apple-touch-icon.png\">
129  <link rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"favicon-32x32.png\">
130  <link rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"favicon-16x16.png\">
131  -->
132  <!-- <link rel=\"manifest\" href=\"site.webmanifest\"> -->
133  <link rel=\"mask-icon\" href=\"safari-pinned-tab.svg\" color=\"#000000\">
134  <meta name=\"msapplication-TileColor\" content=\"#000000\">
135  <meta name=\"theme-color\" content=\"#ffffff\">
136 
137  <!-- inject bootstrap 4 light + dark buttons -->
138  <style>
139  .btn-light {
140  color: #212529;
141  background-color: #f8f9fa;
142  border-color: #f8f9fa;
143  }
144 
145  .btn-light:hover {
146  color: #212529;
147  background-color: #e2e6ea;
148  border-color: #dae0e5;
149  }
150 
151  .btn-light:focus, .btn-light.focus {
152  box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5);
153  }
154 
155  .btn-light.disabled, .btn-light:disabled {
156  color: #212529;
157  background-color: #f8f9fa;
158  border-color: #f8f9fa;
159  }
160 
161  .btn-light:not(:disabled):not(.disabled):active, .btn-light:not(:disabled):not(.disabled).active,
162  .show > .btn-light.dropdown-toggle {
163  color: #212529;
164  background-color: #dae0e5;
165  border-color: #d3d9df;
166  }
167 
168  .btn-light:not(:disabled):not(.disabled):active:focus, .btn-light:not(:disabled):not(.disabled).active:focus,
169  .show > .btn-light.dropdown-toggle:focus {
170  box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5);
171  }
172 
173  .btn-dark {
174  color: #fff;
175  background-color: #343a40;
176  border-color: #343a40;
177  }
178 
179  .btn-dark:hover {
180  color: #fff;
181  background-color: #23272b;
182  border-color: #1d2124;
183  }
184 
185  .btn-dark:focus, .btn-dark.focus {
186  color:#fff;
187  box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
188  }
189 
190  .btn-dark.disabled, .btn-dark:disabled {
191  color: #fff;
192  background-color: #343a40;
193  border-color: #343a40;
194  }
195 
196  .btn-dark:not(:disabled):not(.disabled):active, .btn-dark:not(:disabled):not(.disabled).active,
197  .show > .btn-dark.dropdown-toggle {
198  color: #fff;
199  background-color: #1d2124;
200  border-color: #171a1d;
201  }
202 
203  .btn-dark:not(:disabled):not(.disabled):active:focus, .btn-dark:not(:disabled):not(.disabled).active:focus,
204  .show > .btn-dark.dropdown-toggle:focus {
205  box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
206  }
207  .content-wrapper {
208  min-height: 1400px;
209  }
210  </style>
211 
212  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
213  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
214  <!--[if lt IE 9]>
215  <script src=\"https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js\"></script>
216  <script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\"></script>
217  <![endif]-->
218  </head>
219  <!--
220  BODY TAG OPTIONS:
221  =================
222  Apply one or more of the following classes to get the
223  desired effect
224  |---------------------------------------------------------|
225  | SKINS | skin-blue |
226  | | skin-black |
227  | | skin-purple |
228  | | skin-yellow |
229  | | skin-red |
230  | | skin-green |
231  |---------------------------------------------------------|
232  |LAYOUT OPTIONS | fixed |
233  | | layout-boxed |
234  | | layout-top-nav |
235  | | sidebar-collapse |
236  | | sidebar-mini |
237  |---------------------------------------------------------|
238  -->";
239  return null;
240  } // ./ drawHtmlHeader
241 
242  /**
243  * @brief Draw body and header Tag
244  * @return null
245  */
246  function drawHtmlBody(){
247  echo "
248  <body class=\"hold-transition $this->backendSkin $this->backendLayout\">
249  <div class=\"wrapper\">
250  <!-- Main Header -->
251  <header class=\"main-header\">";
252  return null;
253  }
254 
255  /**
256  * @brief Draw logo in the top left corner
257  * @param object $db database object
258  * @param object $lang language array
259  * @return null
260  */
261  function drawHtmlLogo($db, $lang)
262  { // check, if URL or personal text should be displayed...
263  if ($this->backendLayout == "layout-top-nav"){
264  return null;
265  }
266  if (settings::getSetting($db, "backendLogoUrl") == "1")
267  { // URL is requested, -> get hostname (project URL)
268  $host = settings::getSetting($db, "host");
269  $chars = (strlen($host));
270  if ($chars <= 24)
271  {
272  $logoText = "<small class=\"h4\">$host</small>";
273  }
274  else if ($chars >= 25)
275  {
276  $logoText = "<small class=\"h5\">$host</small>";
277  }
278  }
279  else
280  { // personal text requested, -> get logo text + subtext
281  $logoText = "<b>". settings::getSetting($db, "backendLogoText")."</b>";
282  $logoText .= settings::getSetting($db, "backendLogoSubText");
283  }
284  echo "<!-- Logo -->
285  <a href=\"../index.html\" class=\"logo\" title=\"$lang[GOTO_WEBSITE]\" target=\"_blank\">
286  <!-- mini logo for sidebar mini 50x50 pixels -->
287  <span class=\"logo-mini\"><b class=\"fa fa-globe\"></b></span>
288  <!-- logo for regular state and mobile devices -->
289  <span class=\"logo-lg\">$logoText</span>
290  </a>";
291  return null;
292  }
293 
294  /**
295  * @brief Draw the navbar (top)
296  * @return null
297  */
298  function drawHtmlNavbar(){
299  if ($this->backendLayout == "layout-top-nav"){
300  echo "
301  <nav class=\"navbar navbar-static-top\" role=\"navigation\">
302  <div class=\"container\">
303  <div class=\"navbar-header\">
304  <a href=\"../../index2.html\" class=\"navbar-brand\"><b>Admin</b>LTE</a>
305  <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar-collapse\">
306  <i class=\"fa fa-bars\"></i>
307  </button>
308  </div>";
309  }
310  else {
311  echo "<!-- Header Navbar -->
312  <nav class=\"navbar navbar-static-top\" role=\"navigation\">
313  <!-- Sidebar toggle button-->
314  <a href=\"#\" id=\"sidebarToggle\" class=\"sidebar-toggle\" data-toggle=\"offcanvas\" role=\"button\">
315  <span class=\"sr-only\">Toggle navigation</span>
316  </a>";
317 
318  }
319  return null;
320  }
321 
322  /**
323  * @brief Draw right navbar
324  * @return null
325  */
327  echo "<!-- Navbar Right Menu -->
328  <div class=\"navbar-custom-menu\">
329  <ul class=\"nav navbar-nav\">";
330  return null;
331  }
332 
333  /**
334  * @brief Draw backup icon on navbar top beside preview icon
335  * @param array $lang Language Array
336  * @return null
337  */
339  {
340  // set menu to active if user clicked on preview icon
341  if (isset($_GET['page']) && (!empty($_GET['page']) && ($_GET['page'] === "settings-backup")))
342  {
343  $selected = ' class="active"';
344  }
345  else { $selected = ''; }
346  echo "<li $selected>
347  <!-- preview eye icon -->
348  <a href=\"index.php?page=settings-backup\" title=\"$lang[BACKUP]\">
349  <i class=\"fa fa-hdd-o\"></i>
350  </a>
351  </li>";
352  return null;
353  }
354 
355  /**
356  * @brief Draw preview page icon on navbar top beside other notification icons
357  * @param array $lang Language Array
358  * @return null
359  */
361  {
362  // admin edit a page
363  if (isset($_GET['alias']) && (!empty($_GET['alias'])))
364  { // show this page as preview
365  $history = "&alias=$_GET[alias]";
366  }
367  // admin is configuring the userpage
368  else if (isset($_GET['plugin']) && (!empty($_GET['plugin']) && ($_GET['plugin'] === "userpage")))
369  { // load frontend user page as preview
370  $history = "&alias=welcome";
371  }
372  // admin is on plugin configuration page
373  else if (isset($_GET['plugin']) && (!empty($_GET['plugin'])))
374  { // try to load the plugin page as preview
375  $history = "&alias=$_GET[plugin]";
376  }
377  else
378  { // default: index.html
379  $history = '';
380  }
381 
382  // set menu to active if user clicked on preview icon
383  if (isset($_GET['page']) && (!empty($_GET['page']) && ($_GET['page'] === "frontend-preview")))
384  {
385  $selected = ' class="active"';
386  }
387  else { $selected = ''; }
388  echo "<li $selected>
389  <!-- preview eye icon -->
390  <a href=\"index.php?page=frontend-preview".$history."\" title=\"$lang[QUICK_PREVIEW]\">
391  <i class=\"fa fa-eye\"></i>
392  </a>
393  </li>";
394  return null;
395  }
396 
397  /**
398  * @brief Messages Menu: the small icon in the right corner of top navigation. This is a facebook-like messaging preview.
399  * @param object $db Database object
400  * @param array $lang Language array
401  * @return null
402  */
404  // count + return unread messages
405  $i = \YAWK\user::countNewMessages($db, $_SESSION['uid']);
406  if ($i === 1)
407  { // set singular
408  $msg = $lang['CHAT'];
409  $unread = $lang['UNREAD_SINGULAR'];
410  $label = "<span id=\"messaging-label\" class=\"label label-primary animated swing\">$i</span>";
411  $animated = "animated tada";
412  }
413  else
414  { // set plural correctly
415  $msg = $lang['CHATS'];
416  $unread = $lang['UNREAD_PLURAL'];
417  $label = "<span id=\"messaging-label\" class=\"label label-primary animated swing\">$i</span>";
418  $animated = "animated tada";
419  }
420  if ($i === 0)
421  {
422  // if notification available, ring bell and show label...
423  $envelope = "tada";
424  $label = '';
425  $animated = '';
426  }
427  // get all unread message data
428  $newMessages = \YAWK\user::getNewMessages($db, $_SESSION['uid']);
429 
430  echo "
431  <!-- Messages: style can be found in dropdown.less-->
432  <li class=\"dropdown messages-menu\">
433  <!-- Menu toggle button -->
434  <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">
435  <i class=\"fa fa-comment-o $animated\"></i>
436  $label
437  </a>
438  <ul class=\"dropdown-menu\">
439  <li class=\"header\">$lang[SYSLOG_YOU_HAVE] <span id=\"messagesCounterMenu\">$i</span> $unread $msg</li>
440  <li>
441  <!-- inner menu: contains the messages -->
442  <ul class=\"menu\">";
443  // loop new messages data
444  foreach ($newMessages as $message)
445  { // get sender username from ID
446 
447  $from = \YAWK\user::getUserNameFromID($db, $message['fromUID']);
448  $picture = \YAWK\user::getUserImage("backend", $from, "img-circle", 20,20);
449  $timeago = \YAWK\sys::time_ago($message['msg_date'], $lang);
450  $msg_id = $message['msg_id'];
451  // get 32 chars message preview
452  $preview = $message['msg_body'];
453  $preview = substr($preview, -80);
454  $message = substr($message['msg_body'], -30);
455  // $preview = substr($message['msg_body'], -10);
456  // $preview = $message['msg_body'];
457 
458  echo"<li><!-- start message -->
459  <a href=\"index.php?plugin=messages&pluginpage=mailbox&msg_id=".$msg_id."\" title=\"$preview\">
460  <div class=\"pull-left\">
461  <!-- User Image -->
462  $picture
463  <!-- <img src=\"../media/images/users/admin.jpg\" class=\"img-circle\" alt=\"User Image\"> -->
464  </div>
465  <!-- Message title and timestamp -->
466  <h4>
467  $from
468  <small><i class=\"fa fa-clock-o\"></i> $timeago </small>
469  </h4>
470  <!-- The message -->
471  <p>$message</p>
472  </a>
473  </li><!-- end message -->";
474  }
475  // ./ end foreach new messages
476 
477  echo "</ul><!-- /.menu -->
478  </li>
479  <li class=\"footer\"><a href=\"index.php?plugin=messages&pluginpage=mailbox\">See All Messages</a></li>
480  </ul>
481  </li><!-- /.messages-menu -->";
482  return null;
483  }
484 
485 
486  /**
487  * @brief Webmail Menu: small envelope icon in the right corner of top navigation. This is a preview of your emails (if you use webmail)
488  * @param object $db Database object
489  * @param array $lang Language array
490  * @return null
491  */
493  {
494  // count + return unread messages
495  // get imap settings
497  $server = $webmailSettings['webmail_imap_server'];
498  $port = $webmailSettings['webmail_imap_port'];
499  $encrypt = $webmailSettings['webmail_imap_encrypt'];
500  $username = $webmailSettings['webmail_imap_username'];
501  $password = $webmailSettings['webmail_imap_password'];
502  $novalidate = $webmailSettings['webmail_imap_novalidate'];
503  if (!empty($novalidate)){ $novalidate = "/".$novalidate; } else { $novalidate = ''; }
504 
505  // connect to mailbox:
506  // prepare imap mailbox string
507  $mailbox = '{'.$server.':'.$port.'/imap/'.$encrypt.''.$novalidate.'}INBOX';
508 
509  // check if imap extension is available
510  if (function_exists('imap_open'))
511  { // open new imap connection
512  $imap = @imap_open($mailbox, $username, $password);
513  // get all unseen messages
514  $emails = @imap_search($imap, 'UNSEEN');
515  }
516  else
517  { //($db, $log_category, $log_type, $message, $fromUID, $toUID, $toGID, $seen)
518  \YAWK\sys::setSyslog($db, 4, 2, "Imap Extension not activated. Try apt-get install php[x]-imap or ask your server admin.", 0, 0, 0, 0);
519  }
520 
521  // check, if any unseen emails are there
522  if (empty($emails))
523  { // nope, no unseen emails
524  $i = 0;
525  }
526  else
527  { // yep: count emails
528  $i = count ($emails);
529  }
530 
531  // one email only
532  if ($i == 1)
533  { // set singular
534  $msg = $lang['EMAIL'];
535  $unread = $lang['UNREAD_SINGULAR'];
536  $label = "<span id=\"envelope-label\" class=\"label label-success animated swing\">$i</span>";
537  $animated = "animated tada";
538  }
539  else
540  { // set plural correctly
541  $msg = $lang['EMAILS'];
542  $unread = $lang['UNREAD_PLURAL'];
543  $label = "<span id=\"envelope-label\" class=\"label label-success animated swing\">$i</span>";
544  $animated = "animated tada";
545  }
546  // no email available...
547  if ($i === 0)
548  {
549  // if notification available, ring bell and show label...
550  $envelope = "tada";
551  $label = '';
552  $animated = '';
553  }
554 
555  // get all unread message data
556 
557  echo "
558  <!-- Messages: style can be found in dropdown.less-->
559  <li class=\"dropdown messages-menu\">
560  <!-- Menu toggle button -->
561  <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">
562  <i class=\"fa fa-envelope-o $animated\"></i>
563  $label
564  </a>
565  <ul class=\"dropdown-menu\">
566  <li class=\"header\">$lang[SYSLOG_YOU_HAVE] <span id=\"emailCounterMenu\">$i</span> $unread $msg</li>
567  <li>
568  <!-- inner menu: contains the messages -->
569  <ul class=\"menu\">";
570  if(isset($emails))
571  {
572  // newest first
573  rsort($emails);
574 
575  // for every email...
576  foreach($emails as $email_number) {
577  /* get information specific to this email */
578  $overview = @imap_fetch_overview($imap,$email_number,0);
579  // $message = utf8_decode(imap_fetchbody($imap,$email_number, 1));
580 
581  // current email number
582  $email_number;
583  // get email header params
584  $overview[0]->subject;
585  $overview[0]->from;
586  $overview[0]->date;
587  $overview[0]->size;
588  $overview[0]->uid;
589 
590  // calculate huma-friendly time
591  $timeAgo = \YAWK\sys::time_ago($overview[0]->date, $lang);
592 
593  // output every email as single line
594  echo "<li>
595  <a href=\"index.php?page=webmail-message&folder=inbox&msgno=".$email_number."\">
596  <b><small>".utf8_decode(imap_utf8($overview[0]->from))."</small></b><br>
597  ".$overview[0]->subject."<br>";
598  // <small>".substr($message, 0, 64)."</small><br>
599  echo"<small><i class=\"fa fa-clock-o\"></i> ".$timeAgo."</small>
600  </a>
601  </li>";
602  }
603  }
604  // ./ end foreach new messages
605 
606  echo "</ul><!-- /.menu -->
607  </li>
608  <li class=\"footer\"><a href=\"index.php?page=webmail\">$lang[WEBMAIL_SHOW]</a></li>
609  </ul>
610  </li><!-- /.messages-menu -->";
611  return null;
612  }
613 
614  /**
615  * @brief Draw navbar notification. This tells you whats going on in your project.
616  * @param object $db Database object
617  * @param object $lang Language object
618  * @param $user
619  * @return null
620  */
622  {
623  echo "";
624 
625  $i_syslog = \YAWK\user::countNotifications($db);
626  $i_notifications = \YAWK\user::countMyNotifications($db, $_SESSION['uid']);
627  $i_total = $i_syslog + $i_notifications;
628  $notifications = \YAWK\user::getAllNotifications($db);
629  $my_notifications = \YAWK\user::getMyNotifications($db, $_SESSION['uid']);
630 
631  if ($i_total !== 0)
632  { // if notification available, ring bell and show label...
633  $bell = "swing";
634  $label = "<span id=\"bell-label\" class=\"label label-warning animated tada\">$i_total</span>";
635  // set singular
636  $notification = $lang['SYSLOG_NOTIFICATIONS'];
637  }
638  else
639  { // no notification available
640  $bell = '';
641  $label = '';
642  // set plural
643  $notification = $lang['SYSLOG_NOTIFICATIONS'];
644  }
645  if ($i_total === '1')
646  { // set singular correctly
647  $notification = $lang['SYSLOG_NOTIFICATION'];
648  }
649  echo "<script type=\"text/javascript\">
650 
651 
652  </script>
653  <!-- Notifications Menu -->
654  <li id=\"notification-dropdown\" class=\"dropdown notifications-menu\">
655  <!-- Menu toggle button -->
656  <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">
657  <i class=\"fa fa-bell-o animated $bell\"></i>
658  $label
659  </a>
660  <ul id=\"notification-dropdownlink\" class=\"dropdown-menu\">
661  <li id=\"notification-header\" class=\"header\">$lang[SYSLOG_YOU_HAVE] <span id=\"notificationsMenuCounter\">$i_total</span> $notification <small><small>(<a href=\"#\" id=\"dismiss\" data-uid=\"$_SESSION[uid]\" title=\"$lang[SYSLOG_DISMISS_ALL]\">$lang[SYSLOG_MARK_AS_READ]</a>)</small></small></li>
662  <li>
663  <!-- Inner Menu: contains the notifications -->
664  <ul id=\"notification-menu\" class=\"menu\">";
665  if (isset($my_notifications) && is_array($my_notifications))
666  { // if personal notifications are available
667  $i = 0;
668  foreach ($my_notifications as $my_note)
669  {
670  $getUsername = 0;
671  $UID = 0;
672 
673  // calculate datetime pretty
674  $timeAgo = \YAWK\sys::time_ago($my_note['log_date'], $lang);
675 
676  // PREPARE VARS FOR PERSONAL NOTIFICATIONS
677  // #user# wants to be your friend
678  if ($my_note['msg_id'] == 1)
679  { // who (from)
680  $UID = $my_note['fromUID'];
681  $getUsername = 1;
682  }
683  // #user# accepted / declined your friendship
684  if ($my_note['msg_id'] == 2 || $my_note['msg_id'] == 3)
685  { //
686  $UID = $my_note['fromUID'];
687  $getUsername = 1;
688  }
689  // #user# disconnected your friendship
690  if ($my_note['msg_id'] == 4)
691  { // find out correct user who sent the original request
692  if ($my_note['toUID'] == $_SESSION['uid'])
693  {
694  $UID = $my_note['fromUID'];
695  $getUsername = 1;
696  }
697  elseif ($my_note['fromUID'] == $_SESSION['uid'])
698  {
699  $UID = $my_note['toUID'];
700  $getUsername = 1;
701  }
702  }
703  // #users# follows you
704  if ($my_note['msg_id'] == 5 || $my_note['msg_id'] == 6)
705  {
706  $UID = $my_note['fromUID'];
707  $getUsername = 1;
708  }
709 
710  if ($getUsername == '1')
711  { // replace #username# with proper username
712  $username = \YAWK\user::getUserNameFromID($db, $UID);
713  $my_msg = str_replace('#username#', $username,$my_note['message']);
714  }
715  else
716  { // just output the plain notifiy msg from db
717  $my_msg = $my_note['message'];
718  }
719  $i++;
720 
721  echo "<li><!-- start notification -->
722  <a href=\"index.php?page=friendslist\" id=\"labelNotification\" title=\"\">
723  <div class=\"pull-left\">
724  <i id=\"label-".$i."\" class=\"$my_note[icon] $my_note[type]\"></i>&nbsp; <small><i>$my_msg</i><br>
725  </div>
726  <h4>
727  <small class=\"pull-right\"><br><i class=\"fa fa-clock-o\"></i> $timeAgo </small></small>
728  </h4>
729  </a>
730 
731  </li><!-- end notification -->";
732  }
733  }
734 
735  if (isset($notifications) && is_array($notifications))
736  { // if notifications are available
737  foreach ($notifications as $note)
738  { // loop data
739  $timeAgo = \YAWK\sys::time_ago($note['log_date'], $lang);
740 
741  echo "<li id=\"note-$note[log_id]\"><a href=\"index.php?page=syslog#$note[log_id]\" title=\"\">
742  <div class=\"pull-left\">
743  <!-- User Image -->
744  <i class=\"$note[icon] $note[type]\"></i>&nbsp; <small>$note[message]<br>
745  </div>
746  <h4>
747  <small class=\"pull-right\"><br><br><i class=\"fa fa-clock-o\"></i> $timeAgo</small></small>
748  </h4>
749  <!-- Message title and timestamp -->
750  <!-- The message -->
751 
752  </a></li>";
753  }
754  }
755  echo "</ul>
756  </li>
757  <li class=\"footer\"><a id=\"syslogLink\" data-uid=\"$_SESSION[uid]\" href=\"index.php?page=syslog\">$lang[SYSLOG_VIEW]</a></li>
758  </ul>
759  </li>";
760  return null;
761  }
762 
763  /**
764  * @brief Show your user account details. Counts your friends and connections, let you log out.
765  * @param object $db Database object
766  * @param object $user User object
767  * @return null
768  */
770  $currentuser = \YAWK\backend::getFullUsername($user);
771  $currentuser_image = \YAWK\user::getUserImage("backend", $user->username, "img-circle", 140, 140);
772  $currentuser_navbar_image = \YAWK\user::getUserImage("backend", $user->username, "user-image", '', '');
773  if (isset($user->job) && (!empty($user->job)))
774  {
775  $currentuser_job = "<i>$user->job</i>";
776  }
777  else
778  {
779  $currentuser_job = '';
780  }
781  if (isset($user->date_created) && (!empty($user->date_created)))
782  {
783  $member_since = \YAWK\sys::splitDate($user->date_created);
784  // print_r($member_since);
785  $currentuser_created = "Member since $member_since[month] $member_since[year]";
786  }
787  else
788  {
789  $currentuser_created = '';
790  }
791  if (isset($user->gid) && (!empty($user->gid)))
792  {
793  $currentuser_group = \YAWK\user::getGroupNameFromID($db, $user->gid);
794  }
795  else
796  {
797  $currentuser_group = '';
798  }
799  echo "
800  <!-- User Account Menu -->
801  <li class=\"dropdown user user-menu\">
802  <!-- Menu Toggle Button -->
803  <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">
804  <!-- The user image in the navbar-->
805  $currentuser_navbar_image
806  <!-- <img src=\"../media/images/users/admin.jpg\" class=\"user-image\" alt=\"User Image\"> -->
807  <!-- hidden-xs hides the username on small devices so only the image appears. -->
808  <span class=\"hidden-xs\">$currentuser</span>
809  </a>
810  <ul class=\"dropdown-menu\">
811  <!-- The user image in the menu -->
812  <li class=\"user-header\">
813  $currentuser_image
814  <p>
815  <b><a class=\"menuLink\" href=\"index.php?page=user-edit&user=$user->username\">$currentuser</a></b>
816  <small>$currentuser_job</small>
817  <small>$currentuser_group $currentuser_created</small>
818  </p>
819  </li>
820  <!-- Menu Body -->
821  <li class=\"user-body\">
822  <div class=\"col-xs-4 text-center\">
823  <a href=\"index.php?page=list-follower\" style=\"display: block;\">"; echo \YAWK\user::countMyFollowers($db, $user->id); echo " Followers</a>
824  </div>
825  <div class=\"col-xs-4 text-center\">
826  <a href=\"#\" style=\"display: block;\">"; echo $user->likes; echo "<br>Likes</a>
827  </div>
828  <div class=\"col-xs-4 text-center\">
829  <a href=\"index.php?page=friendslist\" style=\"display: block;\">"; echo \YAWK\user::countMyFriends($db, $user->id); echo " Friends</a>
830  </div>
831  </li>
832  <!-- Menu Footer-->
833  <li class=\"user-footer\">
834  <div class=\"pull-left\">
835  <a href=\"index.php?page=user-edit&user=$user->username\" class=\"btn btn-light\" title=\"edit $user->username profile\">Profile</a>
836  </div>
837  <div class=\"pull-right\">
838  <a href=\"index.php?page=logout\" class=\"btn btn-danger\"><i class=\"fa fa-power-off\"></i> &nbsp;Sign out</a>
839  </div>
840  </li>
841  </ul>
842  </li>";
843  return null;
844  }
845 
846  /**
847  * @brief End Navbar
848  * @return null
849  */
851  echo "
852  <!-- Control Sidebar Toggle Button -->
853  <li>
854  <a href=\"#\" data-toggle=\"control-sidebar\"><i class=\"fa fa-gears\"></i></a>
855  </li>
856  </ul>
857  </div>
858  </nav>
859  </header>";
860  return null;
861  }
862 
863  /**
864  * @brief Left sidebar navigation
865  * @param object $db Database object
866  * @param object $user User object
867  * @param object $lang Language object
868  * @return null
869  */
870  function drawHtmlLeftSidebar($db, $user, $lang){
871 
872  $currentuser = \YAWK\backend::getFullUsername($user);
873  $currentuser_image = \YAWK\user::getUserImage("backend", $user->username, "img-circle sidebar-toggle", 64, 64);
874  echo "<!-- Left side column. contains the logo and sidebar -->
875  <aside class=\"main-sidebar\">
876 
877  <!-- sidebar: style can be found in sidebar.less -->
878  <section class=\"sidebar\">
879 
880  <!-- Sidebar user panel (optional) -->
881  <div class=\"user-panel\">
882  <div class=\"pull-left image\">
883  $currentuser_image
884  </div>
885  <div class=\"pull-left info\">
886  <p><a href=\"index.php?page=user-edit&user=$user->username\" class=\"menuLink\">$currentuser</a></p>
887  <!-- Status -->
888  <a href=\"index.php?page=userlist\"><i class=\"fa fa-circle text-success\"></i> Online</a>
889  </div>
890  </div>
891 
892  <!-- search form (Optional) -->
893  <form action=\"index.php?page=search\" method=\"post\" class=\"sidebar-form\">
894  <div class=\"input-group\">
895  <input type=\"text\" name=\"searchString\" class=\"form-control\" placeholder=\"$lang[SEARCH_DOTDOTDOT]\">
896  <input type=\"hidden\" name=\"all\" value=\"true\">
897  <span class=\"input-group-btn\">
898  <button type=\"submit\" name=\"search\" id=\"search-btn\" class=\"btn btn-flat\"><i class=\"fa fa-search\"></i></button>
899  </span>
900  </div>
901  </form>
902  <!-- /.search form -->
903 
904  <!-- Sidebar Menu -->
905  <ul class=\"sidebar-menu\" data-widget=\"tree\">
906  <li class=\"header\">$lang[MAIN_NAVIGATION]</li>
907  <!-- Optionally, you can add icons to the links -->
908  <li ";echo (!isset($_GET['page'])) && (!isset($_GET['plugin'])) ? "class='active'" : ""; echo">
909  <a href=\"index.php\"><i class=\"fa fa-dashboard\"></i> <span>$lang[DASHBOARD]</span></a>
910  </li>";
911 
912  // PAGES TREEVIEW MENU
913  if (isset($_GET['page']) && (strpos($_GET['page'], 'page') !== false))
914  { $activeClass = " class=\"active\""; }
915  else { $activeClass = ''; }
916  echo "<li$activeClass>
917  <a href=\"#\">
918  <i class=\"fa fa-file-word-o\"></i>
919  <span>$lang[PAGES]</span>
920  <span class=\"pull-right-container\">
921  <i class=\"fa fa-angle-left pull-right\"></i>
922  </span>
923  </a>
924  <ul class=\"treeview-menu\">
925  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'pages') ? "class=\"active\"" : ""; echo">
926  <a href=\"index.php?page=pages\" title=\"add or edit a static .html page\"><i class=\"fa fa-file-word-o\"></i> <span>$lang[OVERVIEW]</span></a>
927  </li>
928  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'page-new') ? "class='active'" : ""; echo">
929  <a href=\"index.php?page=page-new\" title=\"add or edit a static .html page\"><i class=\"fa fa-plus\"></i> <span>$lang[PAGE_ADD]</span></a>
930  </li>
931  </ul>";
932 
933  // MENU TREEVIEW MENU
934  if (isset($_GET['page']) && (strpos($_GET['page'], 'menu') !== false))
935  { $activeClass = " class=\"active\""; }
936  else { $activeClass = ''; }
937  echo "<li$activeClass>
938  <a href=\"#\">
939  <i class=\"fa fa-bars\"></i>
940  <span>$lang[MENUS]</span>
941  <span class=\"pull-right-container\">
942  <i class=\"fa fa-angle-left pull-right\"></i>
943  </span>
944  </a>
945  <ul class=\"treeview-menu\">
946  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'menus') ? "class=\"active\"" : ""; echo">
947  <a href=\"index.php?page=menus\" title=\"view menus and entries\"><i class=\"fa fa-bars\"></i> <span>$lang[OVERVIEW]</span></a>
948  </li>
949  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'menu-new') ? "class='active'" : ""; echo">
950  <a href=\"index.php?page=menu-new\" title=\"add or edit menu entries\"><i class=\"fa fa-plus\"></i> <span>$lang[MENU_ADD]</span></a>
951  </li>
952  </ul>";
953 
954  // USER TREEVIEW MENU
955  if (isset($_GET['page']) && (strpos($_GET['page'], 'user') !== false))
956  { $activeClass = " class=\"active\""; }
957  else { $activeClass = ''; }
958  echo "<li$activeClass>
959  <a href=\"#\">
960  <i class=\"fa fa-user\"></i>
961  <span>$lang[USERS]</span>
962  <span class=\"pull-right-container\">
963  <i class=\"fa fa-angle-left pull-right\"></i></span>
964  </a>
965  <ul class=\"treeview-menu\">
966  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'users') ? "class=\"active\"" : ""; echo">
967  <a href=\"index.php?page=users\" title=\"show all users\"><i class=\"fa fa-user\"></i> <span>$lang[USERS]</span></a>
968  </li>
969  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'user-new') ? "class='active'" : ""; echo">
970  <a href=\"index.php?page=user-new\" title=\"add a new user\"><i class=\"fa fa-plus\"></i> <span>$lang[USER_ADD]</span></a>
971  </li>
972  </ul>";
973 
974  // PLUGINS TREEVIEW MENU
975  if (isset($_GET['page']) && (strpos($_GET['page'], 'plugin') !== false))
976  { $activeClass = " class=\"active\""; }
977  else { $activeClass = ''; }
978  echo "<li$activeClass>
979  <a href=\"#\">
980  <i class=\"fa fa-plug\"></i>
981  <span>$lang[PLUGINS]</span>
982  <span class=\"pull-right-container\">
983  <i class=\"fa fa-angle-left pull-right\"></i>
984  </span>
985  </a>
986  <ul class=\"treeview-menu\">
987  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'plugins') ? "class=\"active\"" : ""; echo">
988  <a href=\"index.php?page=plugins\" title=\"show plugins\"><i class=\"fa fa-plug\"></i> <span>$lang[PLUGINS]</span></a>
989  </li>
990  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'plugins-manage') ? "class='active'" : ""; echo">
991  <a href=\"index.php?page=plugins-manage\" title=\"manage plugins\"><i class=\"fa fa-wrench\"></i> <span>$lang[PLUGINS_MANAGE]</span></a>
992  </li>
993  </ul>";
994 
995  // WIDGETS TREEVIEW MENU
996  if (isset($_GET['page']) && (strpos($_GET['page'], 'widget') !== false))
997  { $activeClass = " class=\"active\""; }
998  else { $activeClass = ''; }
999  echo "<li$activeClass>
1000  <a href=\"#\">
1001  <i class=\"fa fa-tags\"></i>
1002  <span>$lang[WIDGETS]</span>
1003  <span class=\"pull-right-container\">
1004  <i class=\"fa fa-angle-left pull-right\"></i>
1005  </span>
1006  </a>
1007  <ul class=\"treeview-menu\">
1008  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'widgets') ? "class=\"active\"" : ""; echo">
1009  <a href=\"index.php?page=widgets\" title=\"show widgets\"><i class=\"fa fa-tags\"></i> <span>$lang[WIDGETS]</span></a>
1010  </li>
1011  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'widget-new') ? "class='active'" : ""; echo">
1012  <a href=\"index.php?page=widget-new\" title=\"add widget\"><i class=\"fa fa-plus\"></i> <span>$lang[WIDGET_ADD]</span></a>
1013  </li>
1014  </ul>";
1015 
1016  // FILEMANAGER TREEVIEW MENU
1017  if (isset($_GET['page']) && (strpos($_GET['page'], 'filemanager') !== false))
1018  { $activeClass = " class=\"active\""; }
1019  else { $activeClass = ''; }
1020  echo "<li$activeClass>
1021  <a href=\"#\">
1022  <i class=\"fa fa-folder-open\"></i>
1023  <span>$lang[FILEMANAGER]</span>
1024  <span class=\"pull-right-container\">
1025  <i class=\"fa fa-angle-left pull-right\"></i>
1026  </span>
1027  </a>
1028  <ul class=\"treeview-menu\">
1029  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'filemanager') ? "class=\"active\"" : ""; echo">
1030  <a href=\"index.php?page=filemanager\" title=\"show files\"><i class=\"fa fa-folder-open-o\"></i> <span>$lang[FILEMANAGER]</span></a>
1031  </li>
1032  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'filemanager-upload') ? "class='active'" : ""; echo">
1033  <a href=\"index.php?page=filemanager-upload\" title=\"upload files\"><i class=\"fa fa-plus\"></i> <span>$lang[UPLOAD]</span></a>
1034  </li>
1035  </ul>";
1036 
1037  // TEMPLATE TREEVIEW MENU
1038  if (isset($_GET['page']) && (strpos($_GET['page'], 'template') !== false))
1039  { $activeClass = " class=\"active\""; }
1040  else { $activeClass = ''; }
1041 
1042  echo "<li$activeClass>
1043  <a href=\"#\">
1044  <i class=\"fa fa-paint-brush\"></i>
1045  <span>$lang[DESIGN]</span>
1046  <span class=\"pull-right-container\">
1047  <i class=\"fa fa-angle-left pull-right\"></i>
1048  </span>
1049  </a>
1050  <ul class=\"treeview-menu\">
1051  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-overview') ? "class=\"active\"" : ""; echo">
1052  <a href=\"index.php?page=template-overview\"><i class=\"fa fa-cube\"></i> $lang[TPL]</a>
1053  </li>
1054  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-positions') ? "class=\"active\"" : ""; echo">
1055  <a href=\"index.php?page=template-positions\"><i class=\"fa fa-sitemap\"></i> $lang[POSITIONS]</a>
1056  </li>
1057  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-redesign') ? "class=\"active\"" : ""; echo">
1058  <a href=\"index.php?page=template-redesign\"><i class=\"fa fa-paint-brush\"></i>$lang[DESIGN]</a>
1059  </li>
1060  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-typography') ? "class=\"active\"" : ""; echo">
1061  <a href=\"index.php?page=template-typography\"><i class=\"fa fa-text-height\"></i> $lang[TYPOGRAPHY]</a>
1062  </li>
1063  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-customcss') ? "class=\"active\"" : ""; echo">
1064  <a href=\"index.php?page=template-customcss\"><i class=\"fa fa-css3\"></i> $lang[CUSTOM_CSS]</a>
1065  </li>
1066  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-customjs') ? "class=\"active\"" : ""; echo">
1067  <a href=\"index.php?page=template-customjs\"><i class=\"fa fa-code\"></i> $lang[CUSTOM_JS]</a>
1068  </li>
1069  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-preview') ? "class=\"active\"" : ""; echo">
1070  <a href=\"index.php?page=template-preview\"><i class=\"fa fa-eye\"></i> $lang[PREVIEW]</a>
1071  </li>
1072  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'template-assets') ? "class=\"active\"" : ""; echo">
1073  <a href=\"index.php?page=template-assets\"><i class=\"fa fa-puzzle-piece\"></i> $lang[ASSETS]</a>
1074  </li>
1075  </ul>
1076  </li>";
1077 
1078  // STATS TREEVIEW MENU
1079  if (isset($_GET['page']) && (strpos($_GET['page'], 'stats') !== false))
1080  { $activeClass = " class=\"active\""; }
1081  else { $activeClass = ''; }
1082  echo "<li$activeClass>
1083  <a href=\"#\">
1084  <i class=\"fa fa-line-chart\"></i>
1085  <span>$lang[STATS]</span>
1086  <span class=\"pull-right-container\">
1087  <i class=\"fa fa-angle-left pull-right\"></i>
1088  </span>
1089  </a>
1090  <ul class=\"treeview-menu\">
1091  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'stats') ? "class=\"active\"" : ""; echo">
1092  <a href=\"index.php?page=stats\" title=\"statistics\"><i class=\"fa fa-line-chart\"></i> <span>$lang[STATS]</span></a>
1093  </li>
1094  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'stats-24h') ? "class='active'" : ""; echo">
1095  <a href=\"index.php?page=stats&interval=24&period=HOUR\" title=\"last 24 hours\"><i class=\"fa fa-clock-o\"></i> <span>$lang[LAST24H]</span></a>
1096  </li>
1097  </ul>";
1098 
1099  // HELP / SUPPORT TREEVIEW MENU
1100  if (isset($_GET['page']) && (strpos($_GET['page'], 'help') !== false))
1101  { $activeClass = " class=\"active\""; }
1102  else { $activeClass = ''; }
1103  echo "<li$activeClass>
1104  <a href=\"#\">
1105  <i class=\"fa fa-question-circle\"></i>
1106  <span>$lang[HELP]</span>
1107  <span class=\"pull-right-container\">
1108  <i class=\"fa fa-angle-left pull-right\"></i>
1109  </span>
1110  </a>
1111  <ul class=\"treeview-menu\">
1112  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'help') ? "class='active'" : ""; echo">
1113  <a href=\"index.php?page=help\" title=\"help\"><i class=\"fa fa-question-circle-o\"></i> <span>$lang[HELP_USER_MANUAL]</span></a>
1114  </li>
1115  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'help-apigen') ? "class=\"active\"" : ""; echo">
1116  <a href=\"index.php?page=help-apigen\" title=\"API Documentation\"><i class=\"fa fa-question-circle-o\"></i> <span>$lang[HELP_APIGEN]</span></a>
1117  </li>
1118  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'help-support') ? "class=\"active\"" : ""; echo">
1119  <a href=\"index.php?page=help-support\" title=\"Support\"><i class=\"fa fa-life-saver\"></i> <span>$lang[HELP_SUPPORT]</span></a>
1120  </li>
1121  </ul>";
1122 
1123  // SETTINGS TREEVIEW MENU
1124  if (isset($_GET['page']) && (strpos($_GET['page'], 'settings') !== false))
1125  { $activeClass = " class=\"active\""; }
1126  else { $activeClass = ''; }
1127 
1128  echo"
1129  <li$activeClass>
1130  <a href=\"#\">
1131  <i class=\"fa fa-gear\"></i>
1132  <span>$lang[SETTINGS]</span>
1133  <span class=\"pull-right-container\">
1134  <i class=\"fa fa-angle-left pull-right\"></i>
1135  </span>
1136  </a>
1137  <ul class=\"treeview-menu\">
1138  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-frontend') ? "class=\"active\"" : ""; echo">
1139  <a href=\"index.php?page=settings-frontend\"><i class=\"fa fa-globe\"></i> $lang[FRONTEND]</a>
1140  </li>
1141  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-backend') ? "class=\"active\"" : ""; echo">
1142  <a href=\"index.php?page=settings-backend\"><i class=\"fa fa-sign-in\"></i> $lang[BACKEND]</a>
1143  </li>
1144  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-system') ? "class=\"active\"" : ""; echo">
1145  <a href=\"index.php?page=settings-system\"><i class=\"fa fa-gears\"></i> $lang[SYSTEM]</a>
1146  </li>
1147  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-openai') ? "class=\"active\"" : ""; echo">
1148  <a href=\"index.php?page=settings-openai\"><i class=\"fa fa-key\"></i> $lang[API_KEYS]</a>
1149  </li>
1150  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-webmail') ? "class=\"active\"" : ""; echo">
1151  <a href=\"index.php?page=settings-webmail\"><i class=\"fa fa-envelope-o\"></i> $lang[WEBMAIL]</a>
1152  </li>
1153  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-robots') ? "class=\"active\"" : ""; echo">
1154  <a href=\"index.php?page=settings-robots\"><i class=\"fa fa-android\"></i> $lang[ROBOTS_TXT]</a></li>
1155 
1156  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-language') ? "class=\"active\"" : ""; echo">
1157  <a href=\"index.php?page=settings-language\"><i class=\"fa fa-language\"></i> $lang[LANGUAGES]</a>
1158  </li>
1159  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-assets') ? "class=\"active\"" : ""; echo">
1160  <a href=\"index.php?page=settings-assets\"><i class=\"fa fa-puzzle-piece\"></i> $lang[ASSETS]</a>
1161  </li>
1162  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-fonts') ? "class=\"active\"" : ""; echo">
1163  <a href=\"index.php?page=settings-fonts\"><i class=\"fa fa-font\"></i> $lang[FONTS]</a>
1164  </li>
1165  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-database') ? "class=\"active\"" : ""; echo">
1166  <a href=\"index.php?page=settings-database\"><i class=\"fa fa-database\"></i> $lang[DATABASE]</a>
1167  </li>
1168  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-backup') ? "class=\"active\"" : ""; echo">
1169  <a href=\"index.php?page=settings-backup\"><i class=\"fa fa-hdd-o\"></i> $lang[BACKUP]</a>
1170  </li>
1171  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-update') ? "class=\"active\"" : ""; echo">
1172  <a href=\"index.php?page=settings-update\"><i class=\"fa fa-code-fork\"></i> $lang[UPDATE]</a>
1173  </li>
1174  <li ";echo (isset($_GET['page']) && $_GET['page'] == 'settings-systeminfo') ? "class=\"active\"" : ""; echo">
1175  <a href=\"index.php?page=settings-systeminfo\"><i class=\"fa fa-info-circle\"></i> $lang[SYSTEM]&nbsp;$lang[INFO]</a></li>
1176  </ul>
1177  </li>
1178  <br><br><br><br>
1179  </ul><!-- /.sidebar-menu -->
1180  </section>
1181  <!-- /.sidebar -->
1182  </aside>";
1183  return null;
1184  }
1185 
1186  /**
1187  * @brief HTML Content Header (manually written in \includes)
1188  * @param object $lang Language object
1189  * @return null
1190  */
1192  echo "";
1193  return null;
1194  }
1195 
1196  /**
1197  * @brief HTML Content Header Breadcrumbs (manually written in \includes)
1198  * @return null
1199  */
1201  echo "";
1202  return null;
1203  }
1204 
1205  /**
1206  * @brief output the html content - depending on whether it's a plugin or a static admin page
1207  * @param object $db Database object
1208  * @param object $lang Language object
1209  * @param object $user User object - not in use atm, check this!
1210  * @return null
1211  */
1212  function drawHtmlContent($db, $lang, $user)
1213  {
1214  /* check if a search q is set */
1215  if (isset($_GET['q']) && (!empty($_GET['q'])))
1216  {
1217  alert::draw("success", "Suchfeld", "Begriff: $_GET[q]", "", 2000);
1218  }
1219 
1220  if(isset($_GET['page']))
1221  { // load given page
1222  $node = "includes/".$_GET['page']."";
1223  $filename = "includes/".$_GET['page'].".php";
1224 
1225  if (is_file($filename))
1226  { // ok, include this backend filge
1227  include(controller::filterfilename($db, $lang, $node));
1229  }
1230  else
1231  { // backend page not found, throw error msg
1232  \YAWK\alert::draw("danger", $lang['ERROR'], $lang['FILE_NOT_FOUND'].": <b>".$filename."</b> <br><i>".$lang['REDIRECT_INFO']." ".$lang['TO'].": ".$lang['BACKEND']." ".$lang['HOME_PAGE']."</i>", "index.php?page=dashboard", "8400");
1233  }
1234  }
1235 
1236  else if(isset($_GET['plugin']) && (!isset($_GET['pluginpage'])))
1237  { // load given plugin
1238  $plugin = $_GET['plugin'];
1239  $plugin_name = "../system/plugins/$plugin/admin/$plugin";
1240  include(controller::filterfilename($db, $lang, $plugin_name));
1242  }
1243  else if (isset($_GET['plugin']) && (isset($_GET['pluginpage'])))
1244  { // load given pluginpage
1245  $plugin = $_GET['plugin'];
1246  $pluginPage = $_GET['pluginpage'];
1247  $plugin_name = "../system/plugins/$plugin/admin/$pluginPage";
1248  include(controller::filterfilename($db, $lang, $plugin_name));
1250  }
1251  else if (isset($_GET['pluginid']))
1252  { // get plugin name for given id from db
1253  $plugin = \YAWK\plugin::getNameById($db, $_GET['pluginid']);
1254  $plugin_name = "../system/plugins/$plugin/admin/$plugin";
1255  include(controller::filterfilename($db, $lang, $plugin_name));
1257  }
1258  else if (!isset($_GET['page']))
1259  { // no page is given, load default: dashboard
1260  echo "
1261  <!-- Content Wrapper. Contains page content -->
1262  <div class=\"content-wrapper\" id=\"content-FX\">
1263  <!-- Content Header (Page header) -->
1264  <section class=\"content-header\">";
1265  /* Title on top */
1266  $dashboard_subtext = $lang['DASHBOARD_SUBTEXT']."&nbsp;".\YAWK\user::getCurrentUserName($lang)."!";
1267  echo \YAWK\backend::getTitle($lang['DASHBOARD'], $dashboard_subtext);
1268  /* breadcrumbs */
1269  echo"<ol class=\"breadcrumb\">
1270  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
1271  <li class=\"active\"><a href=\"index.php\"> $lang[OVERVIEW]</a></li>
1272  </ol>
1273  </section>";
1274  echo"
1275  <!-- Main content -->
1276  <section class=\"content\">";
1277  include(controller::filterfilename($db, $lang, "includes/dashboard"));
1280  }
1281  return null;
1282  }
1283 
1284  /**
1285  * @brief End Content
1286  * @return null
1287  */
1289  {
1290  echo "</div>";
1291  echo "</section><!-- /.content -->";
1292  return null;
1293  }
1294 
1295  /**
1296  * @brief Draw a Footer on every backend page.
1297  * @return null
1298  */
1300  { /* @param $db \YAWK\db */
1301  $copyright = settings::getSetting($db, "backendFooterCopyright");
1302  $valueLeft = settings::getSetting($db, "backendFooterValueLeft");
1303  $valueRight = settings::getSetting($db, "backendFooterValueRight");
1304 
1305  if (isset($valueLeft) && (!empty($valueLeft)))
1306  { // left value
1307  $leftValue = $valueLeft;
1308  }
1309  else { $leftValue = ''; }
1310 
1311  if (isset($valueRight) && (!empty($valueRight)))
1312  { // right value
1313  $rightValue = $valueRight;
1314  }
1315  else { $rightValue = ''; }
1316 
1317  // check if copyright is enabled
1318  if ($copyright === "1")
1319  { // get host and display copyright information
1320  $host = settings::getSetting($db, "host");
1321  $leftValue = "<strong>Copyright &copy; ".date("Y")." <a href=\"https://github.com/YaWK/yawk-cms\" target=\"_blank\">YaWK CMS</a> </strong><small> All rights reserved. </small>";
1322  $rightValue = "Yet another Web Kit v". settings::getSetting($db, "yawkversion")."";
1323  }
1324 
1325  // output footer data
1326  echo "
1327  <!-- Main Footer -->
1328  <footer class=\"main-footer\">
1329  <!-- To the right -->
1330  <div class=\"pull-right hidden-xs\">
1331  <small>$rightValue</small>
1332  </div>
1333  <!-- Default to the left -->
1334  $leftValue
1335  </footer>";
1336  return null;
1337  }
1338 
1339 
1340  /**
1341  * @brief Draw right, collapsable sidebar
1342  * @return null
1343  */
1345  echo "
1346  <!-- Control Sidebar -->
1347  <aside class=\"control-sidebar control-sidebar-dark\">
1348  <!-- Create the tabs -->
1349  <ul class=\"nav nav-tabs nav-justified control-sidebar-tabs\">
1350  <li class=\"active\"><a href=\"#control-sidebar-home-tab\" data-toggle=\"tab\"><i class=\"fa fa-hdd-o\"></i></a></li>
1351  <li><a href=\"#control-sidebar-settings-tab\" data-toggle=\"tab\"><i class=\"fa fa-gears\"></i></a></li>
1352  </ul>
1353  <!-- Tab panes -->
1354  <div class=\"tab-content\">
1355  <!-- Home tab content -->
1356  <div class=\"tab-pane active\" id=\"control-sidebar-home-tab\">
1357  <!--
1358  <h3 class=\"control-sidebar-heading\">$ lang[BACKUP]</h3>
1359  <ul class=\"control-sidebar-menu\">
1360  <li>
1361  <a href=\"#\">
1362  <i class=\"menu-icon fa fa-hdd-o\"></i>
1363  <div class=\"menu-info\">
1364  <h4 class=\"control-sidebar-subheading\">Quick Backup</h4>
1365  <p>&nbsp;Refresh database backup</p>
1366  </div>
1367  </a>
1368  </li>
1369  <li>
1370  <a href=\"#\">
1371  <i class=\"menu-icon fa fa-hdd-o\"></i>
1372  <div class=\"menu-info\">
1373  <h4 class=\"control-sidebar-subheading\">Complete Backup</h4>
1374  <p>&nbsp;Including media folder</p>
1375  </div>
1376  </a>
1377  </li>
1378  </ul><!-- /.control-sidebar-menu -->
1379  <!--
1380  <h3 class=\"control-sidebar-heading\">Zeiterfassung</h3>
1381  <ul class=\"control-sidebar-menu\">
1382  <li>
1383  <a href=\"javascript::;\">
1384  <h4 class=\"control-sidebar-subheading\">
1385  Custom Template Design
1386  <span class=\"label label-danger pull-right\">70%</span>
1387  </h4>
1388  <div class=\"progress progress-xxs\">
1389  <div class=\"progress-bar progress-bar-danger\" style=\"width: 20%\"></div>
1390  </div>
1391  </a>
1392  </li>
1393  </ul><!-- /.control-sidebar-menu -->
1394 
1395  </div><!-- /.tab-pane -->
1396  <!-- Stats tab content -->
1397  <div class=\"tab-pane\" id=\"control-sidebar-stats-tab\">Stats Tab Content</div><!-- /.tab-pane -->
1398  <!-- Settings tab content -->
1399  <div class=\"tab-pane\" id=\"control-sidebar-settings-tab\">
1400  <!--
1401  <form method=\"post\">
1402  <h3 class=\"control-sidebar-heading\">General Settings</h3>
1403  <div class=\"form-group\">
1404  <label class=\"control-sidebar-subheading\">
1405  Report panel usage
1406  <input type=\"checkbox\" class=\"pull-right\" checked>
1407  </label>
1408  <p>
1409  Some information about this general settings option
1410  </p>
1411  </div><!-- /.form-group -- >
1412  </form>
1413  </div><!-- /.tab-pane -->
1414  </div>
1415  </aside><!-- /.control-sidebar -->
1416  <!-- Add the sidebar's background. This div must be placed
1417  immediately after the control sidebar -->
1418  <div class=\"control-sidebar-bg\"></div>
1419  </div><!-- ./wrapper -->";
1420  return null;
1421  }
1422 
1423  /**
1424  * @brief Include needed JS files
1425  * @return null
1426  */
1428  echo "
1429  <!-- REQUIRED JS SCRIPTS -->
1430  <!-- color picker -->
1431  <script type=\"text/javascript\" src=\"../system/engines/jquery/jscolor/jscolor.js\"></script>
1432  <!-- Bootstrap 3.3.5 -->
1433  <script type=\"text/javascript\" src=\"../system/engines/bootstrap3/dist/js/bootstrap.min.js\"></script>
1434  <!-- data table -->
1435  <script type=\"text/javascript\" src=\"../system/engines/jquery/jquery.dataTables.min.js\"></script>
1436  <!-- AdminLTE App -->
1437  <script type=\"text/javascript\" src=\"../system/engines/AdminLTE/js/app.min.js\"></script>
1438  <!-- YaWK Backend JS Functions -->
1439  <script type=\"text/javascript\" src=\"js/yawk-backend.js\"></script>";
1440  return null;
1441  }
1442 
1443  /**
1444  * @brief SetUp Backend FX and end html body
1445  * @param object $db Database
1446  * @return null
1447  */
1448  function drawHtmlEnd($db){
1449  global $loadingTime;
1450  /* SetUp backend effects */
1451  if(settings::getSetting($db, "backendFX") >= 1) { /* set time & type */
1452  \YAWK\backend::getFX($db, settings::getSetting($db, "backendFXtime"), settings::getSetting($db, "backendFXtype"));
1453  }
1454  /* display script running time */
1455  if (settings::getSetting($db, "loadingTime") === '1') {
1456  echo \YAWK\sys::getLoadingTime($loadingTime);
1457  }
1458 
1459  echo "
1460  </body>
1461  </html>";
1462  return null;
1463  }
1464 
1465  /**
1466  * @brief draw a simple collapse box
1467  * @param string $header
1468  * @param string $content
1469  */
1471  {
1472  return "
1473  <div class=\"box box-default\">
1474  <div class=\"box-header with-border\">
1475  <h3 class=\"box-title\">$header</h3>
1476 
1477  <div class=\"box-tools pull-right\">
1478  <button type=\"button\" class=\"btn btn-box-tool\" data-widget=\"collapse\"><i class=\"fa fa-minus\"></i>
1479  </button>
1480  </div>
1481  <!-- /.box-tools -->
1482  </div>
1483  <!-- /.box-header -->
1484  <div class=\"box-body\" style=\"display: block;\">
1485  $content
1486  </div>
1487  <!-- /.box-body -->
1488  </div>";
1489  }
1490 
1491  } // ./ class backend
1492 } // ./ namespace
$filename
Definition: actions.php:10
print $lang['FILEMAN_UPLOAD']
$loadingTime
Definition: index.php:12
$header
Definition: blog-edit.php:432
Backend class serves a few useful functions for the admin backend.
Definition: AdminLTE.php:23
drawHtmlContentClose()
End Content.
Definition: AdminLTE.php:1288
drawHtmlNavbarHeaderEnd()
End Navbar.
Definition: AdminLTE.php:850
drawHtmlContent($db, $lang, $user)
output the html content - depending on whether it's a plugin or a static admin page
Definition: AdminLTE.php:1212
drawHtmlNavbar()
Draw the navbar (top)
Definition: AdminLTE.php:298
drawHtmlNavbarMessagesMenu($db, $lang)
Messages Menu: the small icon in the right corner of top navigation. This is a facebook-like messagin...
Definition: AdminLTE.php:403
drawHtmlNavbarPreviewIcon($lang)
Draw preview page icon on navbar top beside other notification icons.
Definition: AdminLTE.php:360
drawHtmlLeftSidebar($db, $user, $lang)
Left sidebar navigation.
Definition: AdminLTE.php:870
drawHtmlEnd($db)
SetUp Backend FX and end html body.
Definition: AdminLTE.php:1448
drawHtmlNavbarUserAccountMenu($db, $user)
Show your user account details. Counts your friends and connections, let you log out.
Definition: AdminLTE.php:769
drawHtmlFooter($db)
Draw a Footer on every backend page.
Definition: AdminLTE.php:1299
drawHtmlNavbarWebmailMenu($db, $lang)
Webmail Menu: small envelope icon in the right corner of top navigation. This is a preview of your em...
Definition: AdminLTE.php:492
drawHtmlContentBreadcrumbs()
HTML Content Header Breadcrumbs (manually written in \includes)
Definition: AdminLTE.php:1200
static drawCollapsableBox($header, $content)
draw a simple collapse box
Definition: AdminLTE.php:1470
drawHtmlHead()
Draw the HTML Header. Loads all .css and .js files.
Definition: AdminLTE.php:78
drawHtmlNavbarBackupIcon($lang)
Draw backup icon on navbar top beside preview icon.
Definition: AdminLTE.php:338
drawHtmlBody()
Draw body and header Tag.
Definition: AdminLTE.php:246
drawHtmlLogo($db, $lang)
Draw logo in the top left corner.
Definition: AdminLTE.php:261
drawHtmlNavbarRightMenu()
Draw right navbar.
Definition: AdminLTE.php:326
drawHtmlJSIncludes()
Include needed JS files.
Definition: AdminLTE.php:1427
drawHtmlNavbarNotificationsMenu($db, $user, $lang)
Draw navbar notification. This tells you whats going on in your project.
Definition: AdminLTE.php:621
drawHtmlRightSidebar($lang)
Draw right, collapsable sidebar.
Definition: AdminLTE.php:1344
__construct($db)
AdminLTE constructor.
Definition: AdminLTE.php:37
$backendSkin
Admin LTE Template Class.
Definition: AdminLTE.php:27
drawHtmlContentHeader($lang)
HTML Content Header (manually written in \includes)
Definition: AdminLTE.php:1191
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Definition: alert.php:19
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static getFullUsername($user)
Clever function to return the username. Expects the user object as param to work correctly.
Definition: backend.php:377
static getFX($db, $time, $type)
Include Javascript FX to apply on #content-FX DOM element.
Definition: backend.php:123
The controller function returns filtered filename as string (or null).
Definition: controller.php:15
static filterfilename($db, $lang, $filename)
Main filter controller: checks GET params and lead to corresponding actions.
Definition: controller.php:46
static getNameById($db, $pluginId)
get requested plugin name for given plugin ID
Definition: plugin.php:130
Settings class: get and set YaWK system settings.
Definition: settings.php:9
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
static getValueSettingsArray($db, $property)
Returns an array containing property as key and values corresponding to this property where p like $p...
Definition: settings.php:41
static splitDate($date)
split a date to month, day, year and time
Definition: sys.php:1502
static time_ago($userdate, $lang)
how many time is been gone since given date
Definition: sys.php:1630
static getUserImage($location, $user, $cssClass, $w, $h)
return and output user image
Definition: user.php:1079
static getCurrentUserName($lang)
return current username
Definition: user.php:344
$server
Definition: email-send.php:133
if(!isset($db)) $msg_id
$host
Definition: page-edit.php:65
print $_GET['id']
Definition: page-edit.php:357
$plugin
print $tourdates date
$webmailSettings
$i