YaWK  24.1
Yet another WebKit
template-overview.php
Go to the documentation of this file.
1 <script>
2  function setCopyTplSettings(newTplName)
3  {
4  // store input field
5  inputField = $("#newTplName");
6  // when rename modal is shown
7  $('#myModal').on('shown.bs.modal', function () {
8  // set focus on input field and select it
9  $(inputField).focus().select();
10  });
11  // add the current itemName to var
12  inputField.val(newTplName+'-copy');
13  // set text of heading span
14  // $("#tplHeading").text(newTplName);
15  }
16 
17  $(document).ready(function() {
18 
19  // store all elements in vars
20  uploadModal = $("#uploadModal");
21  savebutton = $("#savebutton");
22  savebuttonIcon = $("#savebuttonIcon");
23  savebuttonText = $("#savebuttonText");
24  cancelButton = $("#cancelButton");
25  dismissButton = $("#dismissButton");
26  loadingText = $(savebutton).attr("data-loadingText");
27 
28  // following code will be executed when modal upload window is shown
29  $(uploadModal).on('shown.bs.modal', function () {
30 
31  // indicate loading state by click on upload button
32  $(savebutton).click(function() {
33 
34  // disable close on outer click
35  $(uploadModal).attr('data-backdrop', 'static');
36  // disable close on keyboard (ESC key)
37  $(uploadModal).attr('data-keyboard', 'false');
38 
39  // change color of button
40  $(savebutton).removeClass('btn btn-success').addClass('btn btn-warning');
41  // add loading indicator (spinning icon)
42  $(savebuttonIcon).removeClass('fa fa-check').addClass('fa fa-spinner fa-spin fa-fw');
43  // hide times icon in upper right corner
44  $(dismissButton).fadeOut();
45  // load add loading indicator text to upload btn
46  $(savebuttonText).html(loadingText);
47 
48  // disable buttons to avoid interrupt by user
49  $(cancelButton).prop("disabled", true);
50  $(savebutton).attr("disabled", true);
51  // submit the form - upload template
52  $('form#uploadForm').submit();
53  });
54  });
55 
56  // make template table sortable
57  $('#table-sort').dataTable( {
58  "bPaginate": false,
59  "bLengthChange": false,
60  "bFilter": true,
61  "bSort": false,
62  "bInfo": true,
63  "bAutoWidth": false
64  } );
65  } );
66 </script>
67 <?php
68 // check if param is requested
69 if (isset($_GET) && (!empty($_GET)))
70 {
71  // ACTION: download
72  if (isset($_GET['action']) && ($_GET['action']) === "download")
73  { // check if template folder is set
74  if (isset($_GET['folder']) && (!empty($_GET['folder'])))
75  {
76  // strip html and js tags from folder
77  $templateFolder = strip_tags($_GET['folder']);
78  // strip html and js tags from folder
79  $templateID = strip_tags($_GET['id']);
80  // create new tpl object
81  $template = new \YAWK\template();
82  // call download template method
83  if ($template->downloadTemplate($db, $templateFolder, $templateID, $user) === true)
84  { // success
85  \YAWK\alert::draw("success", $lang['TPL_ZIP_CREATED_TITLE'], $lang['TPL_ZIP_CREATED_MSG'], "", 2400);
86  }
87  else
88  { // ERROR: generating download package failed
89  \YAWK\alert::draw("danger", $lang['TPL_ZIP_FAILED_TITLE'], $lang['TPL_ZIP_FAILED_MSG'], "", 8600);
90  }
91  }
92  else
93  { // no template folder set
94  die ('no folder sent');
95  }
96  }
97  // ACTION: upload
98  if (isset($_GET['action']) && ($_GET['action']) === "upload")
99  { // check if post data is set
100  if (isset($_POST) && (!empty($_POST)))
101  {
102  // create new template object
103  $template = new \YAWK\template();
104  // call download template method
105  if ($template->uploadTemplate($db, $_POST, $_FILES, $lang) === true)
106  { // success
107  \YAWK\alert::draw("success", $lang['TPL_UPLOAD_SUCCESS_TITLE'], $lang['TPL_UPLOAD_SUCCESS_MSG'], "", 2400);
108  }
109  else
110  { // ERROR: generating download package failed
111  \YAWK\alert::draw("danger", $lang['TPL_UPLOAD_FAILED_TITLE'], $lang['TPL_UPLOAD_FAILED_MSG'], "", 8600);
112  }
113  }
114  else
115  { // no post data set - throw error
116  \YAWK\alert::draw("danger", $lang['ERROR'], $lang['UPLOAD_FAILED'], "", 8600);
117  }
118  }
119 }
120 ?>
121 
122 <?php
123 // check if template obj is set and create if not exists
124 if (!isset($template)) { $template = new \YAWK\template(); }
125 // new user obj if not exists
126 if (!isset($user)) { $user = new \YAWK\user($db); }
127 
128 
129 // TOGGLE TEMPLATE
130 // set selectedTemplate online/offline (visible for everybody)
131 if (isset($_GET['toggle']) && ($_GET['toggle'] === "1"))
132 {
133  if (isset($_GET['templateID']) && (is_numeric($_GET['templateID'])))
134  { // escape chars
135  $_GET['templateID'] = $db->quote($_GET['templateID']);
136  if (\YAWK\settings::setSetting($db, "selectedTemplate", $_GET['templateID'], $lang))
137  { // additional: set this template as active in template database
138  \YAWK\template::setTemplateActive($db, $_GET['templateID']);
139  $user->setUserTemplate($db, 0, $_GET['templateID'], $user->id);
140  $user->overrideTemplate = 0;
141 
142  // load properties to make sure to view the latest active template properties
143  $template->loadProperties($db, $_GET['templateID']);
144  }
145  else
146  {
147  \YAWK\alert::draw("warning", "$lang[TPL_SWITCH_FAILED]", "$lang[TPL_SWITCH_FAILED_SUBTEXT]", "page=template-manage", 3000);
148  }
149  }
150 }
151 
152 
153 // DELETE TEMPLATE
154 if (isset($_GET['delete']) && ($_GET['delete'] === "1"))
155 { // check, if the given ID is correct
156  if (isset($_GET['templateID']) && (is_numeric($_GET['templateID'])))
157  { // escape chars
158  $_GET['templateID'] = $db->quote($_GET['templateID']);
159  if (\YAWK\template::deleteTemplate($db, $_GET['templateID']))
160  { // delete success msg
161  \YAWK\alert::draw("success", "<i class=\"fa fa-trash-o\"></i> $lang[TPL] $lang[DELETED]", "$lang[SUCCESS]", "", 3000);
162  }
163  else
164  { // failed to delete template
165  \YAWK\alert::draw("danger", "$lang[TPL_FAILED_TO_DELETE] $_GET[templateID]", "$lang[PLEASE_TRY_AGAIN]", "", 3000);
166  }
167  }
168 }
169 
170 // COPY TEMPLATE
171 if (isset($_POST['savenewtheme']) && (!empty($_POST['savenewtheme']))
172  || (isset($_GET['savenewtheme']) && (!empty($_GET['savenewtheme']))))
173 {
174  if (isset($_POST['id']) && (!empty($_POST['id'])))
175  {
176  $template->id = $db->quote($_POST['id']);
177  }
178 
179  if (isset($_POST['name']) && (!empty($_POST['name'])))
180  {
181  $template->name = $db->quote($_POST['name']);
182  }
183 
184  if (isset($_POST['newTplName']) && (!empty($_POST['newTplName'])))
185  {
186  $template->newTplName = $db->quote($_POST['newTplName']);
187  }
188  else if (isset($_GET['newthemename']) && (!empty($_GET['newthemename'])))
189  {
190  $template->newTplName = $db->quote($_GET['newthemename']);
191  }
192 
193  if (isset($_POST['newTplDescription']) && (!empty($_POST['newTplDescription'])))
194  { // set new tpl description
195  $template->description = $db->quote($_POST['newTplDescription']);
196  }
197  else if (isset($_GET['description']) && (!empty($_GET['description'])))
198  { // set new tpl description
199  $template->description = $db->quote($_GET['description']);
200  }
201  else
202  { // new description not set, default value instead:
203  $template->description = "Template Description";
204  }
205 
206  if (isset($_POST['newTplAuthor']) && (!empty($_POST['newTplAuthor'])))
207  { // set new tpl author
208  $template->author = $db->quote($_POST['newTplAuthor']);
209  }
210  else { $template->author = ''; }
211 
212  if (isset($_POST['newTplAuthorUrl']) && (!empty($_POST['newTplAuthorUrl'])))
213  { // set new tpl author URL
214  $template->authorUrl = $db->quote($_POST['newTplAuthorUrl']);
215  }
216  else { $template->authorUrl = ''; }
217 
218  if (isset($_POST['newTplWeblink']) && (!empty($_POST['newTplWeblink'])))
219  { // set new tpl weblink
220  $template->weblink = $db->quote($_POST['newTplWeblink']);
221  }
222  else { $template->weblink = ''; }
223 
224  if (isset($_POST['newTplVersion']) && (!empty($_POST['newTplVersion'])))
225  { // set new tpl weblink
226  $template->version = $db->quote($_POST['newTplVersion']);
227  }
228  else { $template->version = "1.0"; }
229 
230  if (isset($_POST['newTplFramework']) && (!empty($_POST['newTplFramework'])))
231  { // set new tpl weblink
232  $template->framework = $db->quote($_POST['newTplFramework']);
233  }
234  else { $template->version = "1.0"; }
235 
236  if (isset($_POST['newTplLicense']) && (!empty($_POST['newTplLicense'])))
237  { // set new tpl license
238  $template->license = $db->quote($_POST['newTplLicense']);
239  }
240  else { $template->license = ''; }
241 
242  // get new template id
243  $template->newId = \YAWK\template::getMaxId($db);
244  $template->newId++;
245 
246  // SAVE AS new theme
247  $template->saveAs($db);
248  // set the new theme active in template
249  \YAWK\template::setTemplateActive($db, $template->newId);
250  // copy the template settings into the new template
251  \YAWK\template::copyTemplateSettings($db, $template->id, $template->newId);
252  // copy assets
253  \YAWK\template::copyAssets($db, $template->id, $template->newId);
254 }
255 
256 // OVERRIDE TEMPLATE
257 // check if call comes from template-manage or template-edit form
258 if (isset($_GET['id']) && (is_numeric($_GET['id']) || (isset($_POST['id']) && (is_numeric($_POST['id'])))))
259 {
260  $getID = '';
261  if (empty($_GET['id']) || (!empty($_POST['id']))) { $getID = $_POST['id']; }
262  else if (!empty($_GET['id']) || (empty($_POST['id']))) { $getID = $_GET['id']; }
263  else { $getID = \YAWK\settings::getSetting($db, "selectedTemplate"); }
264 
265  if ($user->isTemplateEqual($db, $getID))
266  { // user template equals selectedTemplate
267  // update template in user table row
268  $user->setUserTemplate($db, 0, $getID, $user->id);
269  $user->overrideTemplate = 0;
270  // info badge to inform user that this is visible to everyone
271  $infoBadge = "<span class=\"label label-success\"><i class=\"fa fa-check\"></i>&nbsp;&nbsp;$lang[VISIBLE_TO_EVERYONE]</span>";
272  // info button on top
273  $previewButton = "";
274  }
275  else
276  { // show preview button and set template active for this user
277  $user->setUserTemplate($db, 1, $getID, $user->id);
278  $user->overrideTemplate = 1;
279  // info badge to inform user that this is HIS preview
280  $infoBadge = "<span class=\"label label-success\"><i class=\"fa fa-eye\"></i>&nbsp;&nbsp;$lang[TPL_PREVIEW_VISIBLE_TO_YOU]</span>";
281  // close preview button on top
282  $previewButton = "<a class=\"btn btn-danger\" href=\"index.php?page=template-manage&overrideTemplate=0&id=$getID\"><i class=\"fa fa-times\"></i>&nbsp;&nbsp;$lang[CLOSE_PREVIEW]</a>";
283  }
284 
285  // check if user/admin is allowed to override the template
286  if ($user->isAllowedToOverrideTemplate($db, $user->id) === true)
287  { // ok, user is allowed to override: set tpl from user database
288  if (isset($_GET['overrideTemplate']) && ($_GET['overrideTemplate'] === "1"))
289  {
290  $user->setUserTemplate($db, 1, $getID, $user->id);
291  $user->overrideTemplate = 1;
292  $template->loadProperties($db, $getID);
293  }
294  else
295  {
296  $user->setUserTemplate($db, 0, $getID, $user->id);
297  $user->overrideTemplate = 0;
298  $template->loadProperties($db, $getID);
299  }
300 
301  // $userTemplateID = \YAWK\user::getUserTemplateID($db, $user->id);
302  // load template properties for userTemplateID
303  // $template->loadProperties($db, $getID);
304  }
305  else
306  { // user is not allowed to override, so we load the default (global) selectedTemplate settings
307  // $template->loadProperties($db, YAWK\settings::getSetting($db, "selectedTemplate"));
308  $template->loadProperties($db, $getID);
309  }
310 }
311 else {
312  $previewButton = "";
313  $infoBadge = "<span class=\"label label-success\"><i class=\"fa fa-check\"></i>&nbsp;&nbsp;$lang[VISIBLE_TO_EVERYONE]</span>";
314 }
315 
316 // load all template settings into array
317 // $templateSettings = \YAWK\template::getAllSettingsIntoArray($db, $user);
318 
319 // check template wrapper
320 // \YAWK\template::checkWrapper($lang, $lang['TPL'], $lang['OVERVIEW']);
321 
322 // get ID of current active template
323 $getID = \YAWK\settings::getSetting($db, "selectedTemplate");
324 // load properties of current active template
325 $template->loadProperties($db, $getID);
326 // previewButton is an empty string - why? this should be checked
328 
329 // TEMPLATE WRAPPER - HEADER & breadcrumbs
330 echo "
331  <!-- Content Wrapper. Contains page content -->
332  <div class=\"content-wrapper\" id=\"content-FX\">
333  <!-- Content Header (Page header) -->
334  <section class=\"content-header\">";
335 // draw Title on top
336 echo \YAWK\backend::getTitle($lang['TPL'], $lang['OVERVIEW']);
337 echo \YAWK\backend::getTemplateBreadcrumbs($lang);
338 echo"</section><!-- Main content -->
339  <section class=\"content\">";
340 /* page content start here */
341 ?>
342 <!-- title header -->
343 <div class="box">
344  <div class="box-body">
345  <div class="col-md-12">
346  <?php echo "<h4><i class=\"fa fa-home\"></i> &nbsp;$lang[OVERVIEW] <small>$template->name</small></h4>"; ?>
347  </div>
348  </div>
349 </div>
350 <!-- OVERVIEW -->
351 <!-- list TEMPLATE HOME PAGE (DETAILS) -->
352 <div class="row animated fadeIn">
353  <div class="col-md-5">
354  <div class="box">
355  <div class="box-header with-border">
356  <h3 class="box-title"><?php echo "$lang[DETAILS] <small>$lang[OF_CURRENT_ACTIVE_THEME]"; ?></small></h3>
357  </div>
358  <div class="box-body">
359  <dl class="dl-horizontal">
360  <?php
361  // PREPARE TEMPLATE DETAILS VARS
362  // author URL
363  if (isset($template->authorUrl) && (!empty($template->authorUrl)))
364  { // set author's link
365  $authorUrl = "<small>&nbsp;<a href=\"$template->authorUrl\" target=\"_blank\" title=\"$lang[AUTHORS_WEBLINK_DESC]\"
366  <i class=\"fa fa-external-link\"></i></a></small>";
367  }
368  else { $authorUrl = ""; }
369 
370  // author
371  if (isset($template->author) && (!empty($template->author)))
372  { // set author
373  $author = "<dt>$lang[AUTHOR]</dt><dd>$template->author&nbsp;$authorUrl</dd>";
374  }
375  else { $author = ""; }
376 
377  // weblink
378  if (isset($template->weblink) && (!empty($template->weblink)))
379  { // set author's link
380  $weblink = "<dt>$lang[WEBLINK]</dt><dd><a href=\"$template->weblink\" target=\"_blank\" title=\"$lang[PROJECT_WEBLINK_DESC]\">$template->weblink</a></dd>";
381  }
382  else { $weblink= ""; }
383 
384  // modifyDate
385  if (isset($template->modifyDate) && ($template->modifyDate !== NULL))
386  { // set modifyDate
387  $modifyDate = "<dt>$lang[MODIFIED]</dt><dd>$template->modifyDate</dd>";
388  }
389  else { $modifyDate = ''; }
390 
391  // releaseDate
392  if (isset($template->releaseDate) && ($template->releaseDate !== NULL))
393  { // set release date
394  $releaseDate = "<dt>$lang[RELEASED]</dt><dd>$template->releaseDate</dd>";
395  }
396  else { $releaseDate = ''; }
397 
398  // description
399  if (isset($template->description) && (!empty($template->description)))
400  { // set author
401  $description = "<dt>$lang[DESCRIPTION]</dt><dd>$template->description</dd>";
402  }
403  else { $description = ""; }
404 
405  // version
406  if (isset($template->version) && (!empty($template->version)))
407  { // set author
408  $version = "<dt>$lang[VERSION]</dt><dd>$template->version</dd>";
409  }
410  else { $version = ""; }
411 
412  if (isset($template->subAuthorUrl) && (!empty($template->subAuthorUrl)))
413  { // set author's link
414  $subauthorurl = "<small>&nbsp;<a href=\"$template->subAuthorUrl\" target=\"_blank\" title=\"$lang[MODIFIED_BY_LINKDESC]\"
415  <i class=\"fa fa-external-link\"></i></a></small>";
416  }
417  else { $subauthorurl = ""; }
418 
419  // subAuthor
420  if (isset($template->subAuthor) && (!empty($template->subAuthor)))
421  { // set subAuthor
422  $subauthor = "<dt>$lang[MODIFIED_BY]</dt><dd>$template->subAuthor&nbsp;$subauthorurl</dd>";
423  }
424  else { $subauthor = ""; }
425 
426  // required framework
427  if (isset($template->framework) && (!empty($template->framework)))
428  { // set required framework markup
429  $framework = "<dt>$lang[FRAMEWORK]</dt><dd>$template->framework</dd>";
430  }
431  else { $framework = ""; }
432 
433  // license
434  if (isset($template->license) && (!empty($template->license)))
435  { // set license markup
436  $license = "<dt>$lang[LICENSE]</dt><dd>$template->license</dd>";
437  }
438  else { $license = ""; }
439 
440  $settings = "<dt>$lang[SETTINGS]</dt>
441  <dd>".$template->countTemplateSettings($db, $template->id)."</dd>";
442 
443  ?>
444  <dt><?php echo "$lang[TEMPLATE] $lang[NAME]"; ?></dt>
445  <dd><b><?php echo $template->name; ?></b></dd>
446  <dt><?php echo $lang['STATUS']; ?></dt>
447  <dd><b><?php echo $infoBadge; ?></b></dd>
448 
449  <?php echo $description.$author.$weblink.$framework.$license.$version.$releaseDate.$settings."<br>".$subauthor.$modifyDate; ?>
450 
451  <dt>&nbsp;</dt>
452  <dd>&nbsp;</dd>
453 
454  <dt><?php echo $lang['ASSETS']; ?></dt>
455  <dd>
456  <?php echo $lang['ASSETS_USED']; ?><br>
457  <?php \YAWK\template::drawAssetsTitles($db, $template->id, $lang); ?>
458  </dd>
459  <dt>&nbsp;</dt>
460  <dd>&nbsp;</dd>
461  </dl>
462  </div>
463  </div>
464  </div>
465  <div class="col-md-7">
466  <div class="box">
467  <div class="box-header">
468  <h3 class="box-title"><?php echo $lang['TPL_MANAGE']; ?></h3>
469  </div>
470  <div class="box-body">
471 
472  <a href="#" data-toggle="modal" data-target="#uploadModal" class="btn btn-success pull-right"><?php echo $lang['TPL_UPLOAD']; ?></a>
473  <table style="width:100%;" id="table-sort" class="table table-striped table-hover table-responsive">
474  <thead>
475  <tr>
476  <td class="text-center"><strong><?php echo $lang['STATUS']; ?></strong></td>
477  <td><strong><?php echo $lang['PREVIEW']; ?></strong></td>
478  <td><strong><?php echo $lang['ID']; ?></strong></td>
479  <td><strong><i class="fa fa-caret-down"></i> <?php print $lang['TEMPLATE']; ?></strong></td>
480  <td><strong><?php print $lang['SCREENSHOT']; ?></strong></td>
481  <td class="text-center"><strong><?php print $lang['ACTIONS']; ?></strong></td>
482  </tr>
483  </thead>
484  <tbody>
485 
486  <?php
487  $activeBoldStart = ''; // indicate active template (make it bold)
488  $activeBoldEnd = ''; // indicate active template (end bold)
489  $statusText = ''; // online/offline tooltip
490  // get active tpl name
491  $activeTemplate = \YAWK\template::getCurrentTemplateName($db, "backend", 0);
493  if ($res = $db->query("SELECT * FROM {templates} ORDER BY active DESC"))
494  {
495  // fetch templates and draw a tbl row in a while loop
496  while($row = mysqli_fetch_assoc($res))
497  { // get active template id
498  $activeTemplateId = \YAWK\settings::getSetting($db, "selectedTemplate");
499 
500  // set copy icon
501  $tplCopyName = $row['name']."-copy";
502  $tplName = $row['name'];
503 
504  if ($row['id'] === $activeTemplateId)
505  { // set published online
506  $pub = "success"; $pubtext="$lang[ONLINE]";
507  $statusText = "$lang[TPL_ON]";
508  // do not allow to delete current active template
509  $deleteIcon = "<i class=\"fa fa-ban\" title=\"$lang[TPL_DEL_FAILED_DUE_ACTIVE]\"></i>";
510  $copyIcon = "<a title=\"$lang[COPY]\" onclick=\"setCopyTplSettings('$tplName');\" href=\"#\" data-toggle=\"modal\" data-target=\"#myModal\" data-tplName=\"$row[name]\"><i class=\"fa fa-copy\"></i></a>";
511  }
512  else if ($row['id'] === "1" && ($activeTemplateId !== $row['id']))
513  { // do not allow to delete default template
514  $pub = "danger"; $pubtext = "$lang[OFFLINE]";
515  $statusText = "$lang[TPL_OFF]";
516  $deleteIcon = "<i class=\"fa fa-ban\" title=\"$lang[TPL_DEL_DEFAULT_FAILED]\"></i>";
517  $copyIcon = "<span title=\"$lang[COPY_ONLY_ACTIVE_TPL]\" href=\"#\"<i class=\"fa fa-copy text-muted\"></i></span>";
518  }
519  else
520  { // set published offline
521  $pub = "danger"; $pubtext = "$lang[OFFLINE]";
522  $statusText = "$lang[TPL_OFF]";
523  // delete template button
524  $deleteIcon = "<a class=\"fa fa-trash-o\" role=\"dialog\" data-confirm=\"$lang[TPL_DEL_CONFIRM] &laquo;".$row['name']." ID: ".$row['id']."&raquo;\"
525  title=\"".$lang['TEMPLATE']."&nbsp;".$lang['DELETE']."\" href=\"index.php?page=template-overview&delete=1&templateID=".$row['id']."\"></a>";
526  $previewLabel = '';
527  $copyIcon = "<span title=\"$lang[COPY_ONLY_ACTIVE_TPL]\" href=\"#\"<i class=\"fa fa-copy text-muted\"></i></span>";
528  }
529  if ($row['id'] == ($userTemplateID) && ($row['id'] == $activeTemplateId))
530  {
531  $previewLabel = "<a href=\"index.php?page=template-overview&overrideTemplate=1&id=".$row['id']."\" data-toggle=\"tooltip\" title=\"$lang[TPL_CURRENTLY_ACTIVE]\">
532  <span class=\"label label-success\"><i class=\"fa fa-eye\"></i> &nbsp;&nbsp;$lang[ACTIVE]</span></a>";
533  $activeBoldStart = "<b>";
534  $activeBoldEnd = "</b>";
535  }
536  else if ($row['id'] == ($userTemplateID))
537  {
538  $previewLabel = "<a href=\"index.php?page=template-overview&overrideTemplate=1&id=".$row['id']."\" data-toggle=\"tooltip\" title=\"$lang[TPL_ENABLE_PREVIEW]\">
539  <span class=\"label label-success\"><i class=\"fa fa-eye-slash\"></i> &nbsp;&nbsp;$lang[PREVIEW] $lang[ACTIVE]</span></a>";
540  $activeBoldStart = "<b>";
541  $activeBoldEnd = "</b>";
542  }
543  else
544  {
545  $previewLabel = "<a href=\"index.php?page=template-overview&overrideTemplate=1&id=".$row['id']."\" data-toggle=\"tooltip\" title=\"$lang[TPL_ENABLE_PREVIEW]\">
546  <span class=\"label label-default\"><i class=\"fa fa-eye-slash\"></i> &nbsp;&nbsp;$lang[PREVIEW]</span></a>";
547  $activeBoldStart = "";
548  $activeBoldEnd = "";
549  }
550 
551  // set template image (screenshot)
552  $screenshot = "../system/templates/".$row['name']."/images/screenshot.jpg";
553  if (!file_exists($screenshot))
554  { // sorry, no screenshot available
555  $screenshot = "$lang[NO_SCREENSHOT]";
556  // $screenshot = "<img src=\"http://placehold.it/220x150\" class=\"img-responsive img-rounded\">";
557  }
558  else
559  { // screenshot found, display
560  $screenshot = "<img src=\"../system/templates/".$row['name']."/images/screenshot.jpg\" width=\"200\" class=\"img-rounded\">";
561  }
562 
563  $description = "copy of: ".$row['name']."";
564  $downloadIcon = "<a id=\"downloadTemplateLink-$row[id]\" title=\"$lang[TPL_DOWNLOAD]\" href=\"index.php?page=template-overview&action=download&folder=$tplName&id=$row[id]\" data-tplName=\"$tplName\"><i id=\"downloadTemplateIcon-$row[id]\" class=\"fa fa-file-zip-o\"></i></a>";
565 
566  echo "<tr>
567  <td class=\"text-center\">
568  <a data-toggle=\"tooltip\" title=\"$statusText\" href=\"index.php?page=template-overview&toggle=1&templateID=".$row['id']."\">
569  <span class=\"label label-$pub\">$pubtext</span></a>&nbsp;</td>
570  <td>".$previewLabel."</td>
571  <td>".$row['id']."</td>
572  <td>".$activeBoldStart."<a href=\"index.php?page=template-positions&id=".$row['id']."\"><div style=\"width:100%\">".$row['name']."</div></a>".$row['description']."".$activeBoldEnd."</td>
573  <td><a href=\"index.php?page=template-positions&id=".$row['id']."\" title=\"$lang[EDIT]: ".$row['name']."\">".$screenshot."</a></td>
574  <td class=\"text-center\">
575  $downloadIcon &nbsp;
576  $copyIcon &nbsp;
577  $deleteIcon
578  </td>
579  </tr>";
580  }
581  }
582  ?>
583  </tbody>
584  </table>
585  </div>
586  </div>
587  </div>
588 </div>
589 
590 <!-- Modal ==COPY TEMPLATE== -->
591 <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal2Label" aria-hidden="true">
592  <div class="modal-dialog">
593  <div class="modal-content">
594  <form enctype="multipart/form-data" action="index.php?page=template-overview&savenewtheme=true" method="POST">
595  <div class="modal-header">
596  <!-- modal header with close controls -->
597  <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> </button>
598  <br>
599  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-copy"></i></h3></div>
600  <div class="col-md-11"><h3 class="modal-title"><?php echo $lang['SAVE_NEW_THEME_AS']; ?> <!-- gets filled via JS setRenameFieldState--></h3></div>
601  </div>
602 
603  <!-- modal body -->
604  <div class="modal-body">
605  <!-- save to... folder select options -->
606  <label id="newTplNameLabel" for="newTplName"><?php echo $lang['TPL_NEW_NAME']; ?></label>
607  <input id="newTplName" class="form-control" name="newTplName">
608  <input id="name" type="hidden" name="name" value="<?php echo $template->name; ?>">
609  <input id="id" type="hidden" name="id" value="<?php echo $template->id; ?>">
610  <label for="newTplDescription"><?php echo $lang['DESCRIPTION']; ?></label>
611  <textarea id="newTplDescription" class="form-control" name="newTplDescription" placeholder="<?php echo $lang['SHORT_DESCRIPTION_PH']; ?>"></textarea>
612  <label id="newTplAuthorLAbel" for="newTplAuthor"><?php echo $lang['AUTHOR']; ?></label>
613  <input id="newTplAuthor" class="form-control" name="newTplAuthor" placeholder="<?php echo $lang['AUTHOR_PH']; ?>">
614  <label id="newTplAuthorUrlLabel" for="newTplAuthorUrl"><?php echo $lang['AUTHOR']."&nbsp;".$lang['URL']; ?></label>
615  <input id="newTplAuthorUrl" class="form-control" name="newTplAuthorUrl" placeholder="https://">
616  <label id="newTplWeblinkLabel" for="newTplWeblink"><?php echo $lang['WEBLINK']; ?></label>
617  <input id="newTplWeblink" class="form-control" name="newTplWeblink" placeholder="https://">
618  <label id="newTplVersionLabel" for="newTplVersion"><?php echo $lang['VERSION']; ?></label>
619  <input id="newTplVersion" class="form-control" name="newTplVersion" placeholder="1.0">
620  <label id="newTplFrameworkLabel" for="newTplFramework"><?php echo $lang['FRAMEWORK']; ?></label>
621  <select id="newTplFramework" class="form-control" name="newTplFramework">
622  <?php if ($template->framework == "bootstrap4") { $bs4Selected = " selected"; } else { $bs4Selected = ''; } ?>
623  <?php if ($template->framework == "bootstrap3") { $bs3Selected = " selected"; } else { $bs3Selected = ''; } ?>
624  <option value="bootstrap4"<?php echo $bs4Selected;?>>Bootstrap 4</option>
625  <option value="bootstrap3"<?php echo $bs3Selected;?>>Bootstrap 3</option>
626  </select>
627  <label id="newTplLicenseLabel" for="newTplLicense"><?php echo $lang['LICENSE']; ?></label>
628  <select id="newTplLicense" class="form-control" name="newTplLicense">
629  <option value=""><?php echo $lang['PLEASE_SELECT']; ?></option>
630  <option value="MIT">MIT License</option>
631  <option value="GPL-2.0">GPL 2.0 License</option>
632  <option value="GPL-3.0">GPL 3.0 License</option>
633  <option value="LGPL-2.0">Lesser GPL 2.0</option>
634  <option value="LGPL-2.1">Lesser GPL 2.1</option>
635  </select>
636  </div>
637 
638  <!-- modal footer /w submit btn -->
639  <div class="modal-footer">
640  <input class="btn btn-large btn-success" type="submit" value="<?php echo $lang['SAVE_NEW_THEME_AS']; ?>">
641  <br><br>
642  </div>
643  </form>
644  </div> <!-- modal content -->
645  </div> <!-- modal dialog -->
646 </div>
647 
648 
649 <!-- Modal ==UPLOAD MODAL== -->
650 <div class="modal fade" id="uploadModal" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-labelledby="uploadModalLabel" aria-hidden="true">
651  <div class="modal-dialog">
652  <div class="modal-content">
653  <form enctype="multipart/form-data" id="uploadForm" action="index.php?page=template-overview&action=upload" method="POST">
654  <div class="modal-header">
655  <!-- modal header with close controls -->
656  <button id="dismissButton" type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> </button>
657  <br>
658  <div class="col-md-1"><h3 class="modal-title"><i class="fa fa-download"></i></h3></div>
659  <div class="col-md-11"><h3 class="modal-title"><?php echo $lang['TPL_INSTALL']; ?> <!-- gets filled via JS setRenameFieldState--></h3></div>
660  </div>
661 
662  <!-- modal body -->
663  <div class="modal-body">
664  <!-- template upload field -->
665  <input type="hidden" name="MAX_FILE_SIZE" value="67108864">
666  <input type="file" name="templateFile" id="templateFile" title="<?php echo $lang['TPL_SELECT_FILE']; ?>" class="btn btn-lg btn-default" style="width: 100%;">
667  <label for="templateFile"><?php echo $lang['POST_MAX_SIZE']; echo \YAWK\filemanager::getPostMaxSize();
668  echo " &nbsp; / &nbsp; ".$lang['UPLOAD_MAX_SIZE']; echo \YAWK\filemanager::getUploadMaxFilesize(); ?>
669  &nbsp;<i class="fa fa-question-circle-o text-info" data-placement="auto right" data-toggle="tooltip" title="" data-original-title="<?php echo $lang['UPLOAD_MAX_PHP']; ?>"></i>
670  </label>
671  <hr>
672  <i class="fa fa-exclamation-triangle animated tada"></i> &nbsp;<?php echo $lang['TPL_UPLOAD_HELP']; ?>
673  <?php echo $lang['TPL_UPLOAD_TIP']; ?>
674 
675  </div>
676 
677  <!-- modal footer /w submit btn -->
678  <div class="modal-footer">
679  <input id="cancelButton" class="btn btn-large btn-default" data-dismiss="modal" aria-hidden="true" type="submit" value="<?php echo $lang['CANCEL']; ?>">
680  <button id="savebutton" data-loadingText="<?php echo $lang['TPL_LOADING']; ?>" class="btn btn-success" type="submit"><i id="savebuttonIcon" class="fa fa-check"></i> &nbsp;&nbsp;<span id="savebuttonText"><?php echo $lang['TPL_UPLOAD']; ?></span></button>
681  <br><br>
682  </div>
683  </form>
684  </div> <!-- modal content -->
685  </div> <!-- modal dialog -->
686 </div>
die
Definition: block-user.php:27
$templateID
Definition: blog.php:9
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static getSetting($db, $property)
Get and return value for property from settings database.
Definition: settings.php:470
static getMaxId($db)
return biggest ID from template database
Definition: template.php:779
static getUserTemplateID($db, $uid)
template ID for given user ID
Definition: user.php:421
FuckAdBlock prototype on
Definition: fuckAdBlock.js:227
function b(a)
Definition: browser.js:14
function a
Definition: browser.js:14
type
Definition: menu-new.php:35
This class serves methods to create backup from files.
Definition: AdminLTE.php:2
print $page title
Definition: page-edit.php:377
print $_GET['id']
Definition: page-edit.php:357
function i(e, t)
Definition: plyr.js:1
function w(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name
$userTemplateID
$activeBoldEnd
print $lang['TEMPLATE']
$previewButton
$activeBoldStart
$activeTemplate
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L &ouml;schen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})