YaWK  24.1
Yet another WebKit
gallery.php
Go to the documentation of this file.
1 <?php
2 // check if language is set
3 if (!isset($language) || (!isset($lang)))
4 { // inject (add) language tags to core $lang array
5  $lang = \YAWK\language::inject($lang, "../system/plugins/gallery/language/");
6 }
7 require_once '../system/plugins/gallery/classes/gallery.php';
8 /** GALLERY PLUGIN */
9 if (!isset($gallery))
10 {
11  $gallery = new \YAWK\PLUGINS\GALLERY\gallery();
12 }
13 if (isset($_POST))
14 {
15  // EDIT GALLERY
16  if (isset($_GET['edit']) && ($_GET['edit'] === "1"))
17  {
18  // .... edit page....
19  }
20  // DELETE GALLERY
21  if (isset($_GET['delete']) && ($_GET['delete'] === "1"))
22  { // delete a gallery from database
23  if ($gallery->delete($db) == true)
24  { // deletion successfull
25  \YAWK\alert::draw("success", "$lang[SUCCESS]", "$lang[GALLERY_DEL_OK] $lang[FILES_NOT_AFFECTED]", "", 1200);
26  }
27  }
28  // ADD NEW GALLERY
29  if (isset($_GET['add']) && ($_GET['add'] === "1"))
30  { // add a new gallery to database
31  $gallery->add($db);
32  }
33  // RESCAN GALLERY
34  if (isset($_GET['refresh']) && ($_GET['refresh'] === "1"))
35  { // re-scan folder an re-write database
36  if ($gallery->reScanFolder($db, $_GET['folder']) == true)
37  { // deletion successfull
38  \YAWK\alert::draw("success", "$lang[SUCCESS]", "$lang[REFRESH] $lang[OF] $_GET[folder] $lang[SUCCESSFUL]", "", 2000);
39  }
40  }
41 }
42 ?>
43 <script type="text/javascript">
44  $(document).ready(function () {
45  $('#table-sort').dataTable({
46  "bPaginate": false,
47  "bLengthChange": false,
48  "bFilter": true,
49  "bSort": true,
50  "bInfo": true,
51  "bAutoWidth": false
52  });
53  });
54 </script>
55 <?php
56 // TEMPLATE WRAPPER - HEADER & breadcrumbs
57 echo "
58  <!-- Content Wrapper. Contains page content -->
59  <div class=\"content-wrapper\" id=\"content-FX\">
60  <!-- Content Header (Page header) -->
61  <section class=\"content-header\">";
62 /* draw Title on top */
63 echo \YAWK\backend::getTitle($lang['GALLERY'], $lang['GALLERY_SUBTEXT']);
64 echo"<ol class=\"breadcrumb\">
65  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
66  <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
67  <li class=\"active\"><a href=\"index.php?plugin=gallery\" title=\"$lang[GALLERY]\"> $lang[GALLERY]</a></li>
68  </ol>
69  </section>
70  <!-- Main content -->
71  <section class=\"content\">";
72 /* page content start here */
73 ?>
74 
75 <form action="index.php?plugin=gallery&pluginpage=gallery&add=1" role="form" method="POST">
76 <div class="row">
77  <div class="col-md-6">
78  <div class="box box-default">
79  <div class="box-header">
80  <h3 class="box-title"><i class="fa fa-plus-circle text-muted"></i> &nbsp;<?php echo $lang['GALLERY_ADD_NEW']; ?></h3>
81  </div>
82  <div class="box-body">
83  <label for="folder"><?php echo $lang['SELECT_FOLDER_LABEL']; ?></label>
84  <?php $gallery->drawFolderSelect($lang, "media/images/")?>
85  <label for="customFolder"><?php echo $lang['OR_SET_DIFFERENT_FOLDER']; ?></label>
86  <input id="customFolder"
87  name="customFolder"
88  type="text"
89  placeholder="media/images/your-images-folder"
90  class="form-control">
91  <label for="title"><?php echo $lang['GALLERY_TITLE']; ?></label>
92  <input id="title"
93  name="title"
94  type="text"
95  placeholder="<?php echo $lang['GALLERY_ABOUT']; ?>"
96  class="form-control">
97  <label for="description"><?php echo $lang['GALLERY_DESC']; ?><small> <?php echo $lang['OPTIONAL']; ?></small></label>
98  <input id="description"
99  name="description"
100  type="text"
101  placeholder="<?php echo $lang['GALLERY_DESC_PLACEHOLDER']; ?>"
102  class="form-control"><br>
103  <!-- SAVE BUTTON -->
104  <button type="submit"
105  id="savebutton"
106  name="save"
107  class="btn btn-success pull-right">
108  <i id="savebuttonIcon" class="fa fa-check"></i>&nbsp; <?php print $lang['GALLERY_ADD']; ?>
109  </button>
110  <br><h4><i class="fa fa-wrench text-muted"></i>&nbsp; <?php echo $lang['ADDITIONAL_SETTINGS']; ?></h4>
111  <input type="hidden" value="0" name="createThumbnails">
112  <input type="checkbox" value="1" id="createThumbnails" name="createThumbnails">
113  <label for="createThumbnails"><?php echo $lang['CREATE_THUMBNAILS']; ?></label>
114  <br>
115  <label for="thumbnailWidth"><?php echo $lang['THUMBNAIL_WIDTH_PX']; ?></label>
116  <input type="text" id="thumbnailWidth" maxlength="12" name="thumbnailWidth" class="form-control" placeholder="200px">
117 
118  <h4><i class="fa fa-copyright text-muted"></i> <?php echo $lang['WATERMARK_SETTINGS']; ?></h4>
119  <label for="watermark"><?php echo $lang['WATERMARK_FROM_CUSTOM_TEXT']; ?></label>
120  <input type="text" id="watermark" name="watermark" class="form-control" placeholder="<?php echo "$lang[COPYRIGHT_C] "; echo date("Y")." $lang[PHOTOGRAPHER]"; ?>">
121  <label for="watermarkImage"><?php echo $lang['OR_FROM_ANY_IMG']; ?></label>
122  <input type="text" id="watermarkImage" name="watermarkImage" class="form-control" placeholder="media/images/yourfile.png">
123  <label for="watermarkOpacity"><?php echo $lang['OVERLAY_OPACITY']; ?></label>
124  <select id="watermarkOpacity" name="watermarkOpacity" class="form-control">
125  <option value=".1">10%</option>
126  <option value=".2">20%</option>
127  <option value=".3">30%</option>
128  <option value=".4">40%</option>
129  <option value=".5" aria-selected="true" selected>50%</option>
130  <option value=".6">60%</option>
131  <option value=".7">70%</option>
132  <option value=".8">80%</option>
133  <option value=".9">90%</option>
134  <option value="1">100%</option>
135  </select>
136  <label for="watermarkPosition"><?php echo $lang['WATERMARK_POSITION']; ?></label>
137  <select id="watermarkPosition" name="watermarkPosition" class="form-control">
138  <option value="---"><?php echo $lang['WATERMARK_POSITION_PLACEHOLDER']; ?></option>
139  <option value="bottom right"><?php echo $lang['BOTTOM_RIGHT']; ?></option>
140  <option value="bottom left"><?php echo $lang['BOTTOM_LEFT']; ?></option>
141  <option value="top left"><?php echo $lang['TOP_LEFT']; ?></option>
142  <option value="top right"><?php echo $lang['TOP_RIGHT']; ?></option>
143  <option value="bottom"><?php echo $lang['BOTTOM']; ?></option>
144  <option value="center"><?php echo $lang['CENTER']; ?></option>
145  <option value="top"><?php echo $lang['TOP']; ?></option>
146  </select>
147  <label for="offsetX"><?php echo $lang['OFFSET_X_AXIS']; ?></label>
148  <input type="text" id="offsetX" name="offsetX" class="form-control" placeholder="-12" value="-12">
149  <label for="offsetY"><?php echo $lang['OFFSET_Y_AXIS']; ?></label>
150  <input type="text" id="offsetY" name="offsetY" class="form-control" placeholder="-12" value="-12">
151  <label for="watermarkFont"><?php echo $lang['WATERMARK_FONT']; ?></label>
152  <select id="watermarkFont" name="watermarkFont" class="form-control">
153  <?php
154  echo $gallery->scanFonts("../system/fonts/");
155  ?>
156  </select>
157 
158  <label for="watermarkTextSize"><?php echo $lang['WATERMARK_TEXT_SIZE']; ?></label>
159  <select id="watermarkTextSize" name="watermarkTextSize" class="form-control">
160  <?php
161  $i = 0;
162  while ($i < 201)
163  { // get 120 option fields in while loop
164  if ($i == 24) { $selected = "selected"; } else { $selected = ''; }
165  echo "<option value=\"$i\" $selected>$i px</option>";
166  $i++;
167  }
168 
169  ?>
170  </select>
171  <label for="watermarkColor"><?php echo $lang['WATERMARK_TEXT_COLOR']; ?></label>
172  <input type="text" id="watermarkColor" name="watermarkColor" class="form-control color" placeholder="pick a color or leave blank" value="e8e8e8">
173  <label for="watermarkBorderColor"><?php echo $lang['WATERMARK_TEXT_BORDERCOLOR']; ?></label>
174  <input type="text" id="watermarkBorderColor" name="watermarkBorderColor" class="form-control color" placeholder="pick a color or leave blank" value="424242">
175  <label for="watermarkBorder"><?php echo $lang['WATERMARK_BORDER_THICKNESS']; ?></label>
176  <select id="watermarkBorder" name="watermarkBorder" class="form-control">
177  <?php
178  $i = 0;
179  while ($i < 201)
180  { // get 120 option fields in while loop
181  if ($i == 1) { $selected = "selected"; } else { $selected = ''; }
182  echo "<option value=\"$i\" $selected>$i px</option>";
183  $i++;
184  }
185 
186  ?>
187  </select>
188 
189  <label for="author"><?php echo $lang['PHOTOGRAPHER']; ?></label>
190  <input type="text" id="author" name="author" class="form-control" placeholder="<?php echo $lang['PHOTOGRAPHER_PLACEHOLDER']; ?>">
191  <label for="author"><?php echo $lang['PHOTOGRAPHER_URL']; ?></label>
192  <input type="text" id="authorUrl" name="authorUrl" class="form-control" placeholder="http://">
193 
194  </div>
195  </div>
196  </div>
197  <div class="col-md-6">
198  <div class="box box-default">
199  <div class="box-header">
200  <h3 class="box-title"><?php echo $lang['EXISTING_GALLERIES']; ?></h3>
201  </div>
202  <div class="box-body">
203  <?php echo $gallery->getPreview($db, $lang); ?>
204  </div>
205  </div>
206  </div>
207 </div>
208 </form>
209 
210 
static draw($type, $title, $text, $redirect, $delay)
Definition: alert.php:30
static inject(array $lang, string $pathToFile)
allow plugins to inject language tags to $lang array
Definition: language.php:439
type
Definition: menu-new.php:35
print $_GET['id']
Definition: page-edit.php:357
$i
Definition: gallery.php:161
print $lang['GALLERY_ADD']
Definition: gallery.php:91
$gallery
Definition: gallery.php:3
function i(e, t)
Definition: plyr.js:1
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
$template name
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);});})