YaWK  24.1
Yet another WebKit
edit.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['id']) && (is_numeric($_GET['id']) && (!isset($_GET['edit']))))
17  { // load gallery properties
18  $gallery->loadProperties($db, $_GET['id']);
19  }
20  if (isset($_GET['edit']) && ($_GET['edit'] === "1") && (isset($_GET['id']) && (is_numeric($_GET['id']))))
21  {
22  $gallery->edit($db, $_GET['id']);
23  }
24 
25  // RESCAN GALLERY
26  if (isset($_GET['refresh']) && ($_GET['refresh'] === "1"))
27  { // re-scan folder an re-write database
28  if ($gallery->reScanFolder($db, $_GET['id']))
29  { // deletion successfull
30  \YAWK\alert::draw("success", "$lang[SUCCESS]", "$lang[GALLERY_REFRESH_OK] $_GET[folder] $lang[UPDATED]", "", 5800);
31  }
32  else
33  { // could not re-scan gallery
34  \YAWK\alert::draw("danger", "$lang[ERROR]", "$lang[GALLERY_REFRESH_FAILED]", "", 5800);
35  }
36  }
37 }
38 ?>
39 <link href="../system/engines/jquery/lightbox2/css/lightbox.min.css" rel="stylesheet">
40 <script src="../system/engines/jquery/lightbox2/js/lightbox.min.js"></script>
41 <script type="text/javascript">
42  lightbox.option({
43  'albumLabel': "<?php echo $lang['IMAGE']; ?> %1 <?php echo $lang['OF']; ?> %2 - <?php echo $lang['GALLERY_SAVE_INFO']; ?>",
44  'wrapAround': true
45  });
46 </script>
47 <?php
48 // TEMPLATE WRAPPER - HEADER & breadcrumbs
49 echo "
50  <!-- Content Wrapper. Contains page content -->
51  <div class=\"content-wrapper\" id=\"content-FX\">
52  <!-- Content Header (Page header) -->
53  <section class=\"content-header\">";
54 /* draw Title on top */
55 echo \YAWK\backend::getTitle($lang['GALLERY'], $lang['GALLERY_SUBTEXT']);
56 echo"<ol class=\"breadcrumb\">
57  <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
58  <li><a href=\"index.php?page=plugins\" title=\"$lang[PLUGINS]\"> $lang[PLUGINS]</a></li>
59  <li><a href=\"index.php?plugin=gallery\" title=\"$lang[GALLERY]\"> $lang[GALLERY]</a></li>
60  <li class=\"active\"><a href=\"index.php?plugin=gallery&pluginpage=edit&id=$gallery->id\" title=\"$lang[REFRESH]\"> $lang[GALLERY_REFRESH]</a></li>
61  </ol>
62  </section>
63  <!-- Main content -->
64  <section class=\"content\">";
65 /* page content start here */
66 ?>
67 
68 <form action="index.php?plugin=gallery&pluginpage=edit&edit=1&id=<?php echo $gallery->id; ?>" role="form" method="POST">
69  <div class="row">
70  <div class="col-md-8">
71  <div class="box box-default">
72  <div class="box-header">
73  <h3 class="box-title"><i class="fa fa-edit text-muted"></i> &nbsp;edit <i><?php echo $gallery->title; ?></i></h3>
74  </div>
75  <div class="box-body">
76  <?php echo $gallery->getEditableImages($db, $lang, $gallery->id); ?>
77  </div>
78  </div>
79  </div>
80  <div class="col-md-4">
81  <div class="box box-default">
82  <div class="box-header">
83  <h3 class="box-title"><?php echo $lang['GALLERY_EDIT']; ?></h3>
84  </div>
85  <div class="box-body">
86 
87  <label for="folder"><?php echo $lang['SELECT_FOLDER']; ?></label>
88  <?php echo $gallery->drawFolderSelectFromGallery("media/images/", "$gallery->folder")?>
89  <label for="customFolder"><?php echo $lang['OR_SET_DIFFERENT_FOLDER']; ?></label>
90  <input id="customFolder"
91  name="customFolder"
92  type="text"
93  placeholder="media/images/your-images-folder"
94  class="form-control">
95  <label for="title"><?php echo $lang['GALLERY_TITLE']; ?></label>
96  <input id="title"
97  name="title"
98  type="text"
99  placeholder="<?php echo $lang['GALLERY_ABOUT']; ?>"
100  value="<?php echo $gallery->title; ?>"
101  class="form-control">
102  <label for="description"><?php echo $lang['GALLERY_DESC']; ?><small> <?php echo $lang['OPTIONAL']; ?></small></label>
103  <input id="description"
104  name="description"
105  type="text"
106  placeholder="<?php echo $lang['GALLERY_DESC_PLACEHOLDER']; ?>"
107  value="<?php echo $gallery->description; ?>"
108  class="form-control"><br>
109  <!-- SAVE BUTTON -->
110  <button type="submit"
111  id="savebutton"
112  name="save"
113  class="btn btn-success pull-right">
114  <i id="savebuttonIcon" class="fa fa-check"></i>&nbsp; <?php print $lang['GALLERY_EDIT']; ?>
115  </button>
116  </div>
117  </div>
118 
119  <div class="box box-default">
120  <div class="box-header">
121  <h3 class="box-title"><i class="fa fa-wrench text-muted"></i>&nbsp; <?php echo $lang['THUMBNAILS']; ?> <small><?php echo $lang['GALLERY_IMG_RESIZE']; ?></small></h3>
122  </div>
123  <div class="box-body">
124  <input type="hidden" value="0" name="createThumbnails">
125  <?php
126  if ($gallery->createThumbnails === "1")
127  {
128  $createThumbnailsChecked = "checked";
129  }
130  else
131  {
132  $createThumbnailsChecked = "";
133  }
134 
135  if ($gallery->resizeImages === '1')
136  {
137  $resizeImagesChecked = "checked";
138  }
139  else
140  {
141  $resizeImagesChecked = '';
142  }
143  ?>
144  <input type="checkbox" value="1" id="createThumbnails" name="createThumbnails" <?php echo $createThumbnailsChecked; ?>>
145  <label for="createThumbnails"><?php echo $lang['CREATE_THUMBNAILS']; ?></label>
146  <br>
147  <label for="thumbnailWidth"><?php echo $lang['THUMBNAIL_WIDTH_PX']; ?></label>
148  <input type="text" id="thumbnailWidth" maxlength="11" name="thumbnailWidth" class="form-control" placeholder="200px" value="<?php echo $gallery->thumbnailWidth; ?>">
149  <input type="hidden" id="thumbnailWidth-old" maxlength="11" name="thumbnailWidth-old" class="form-control" value="<?php echo $gallery->thumbnailWidth; ?>">
150 
151  <br>
152  <input type="hidden" value="0" name="resizeImages">
153  <input type="checkbox" value="1" id="resizeImages" name="resizeImages" <?php echo $resizeImagesChecked; ?>>
154  <label for="resizeImages"><?php echo $lang['RESIZE_ALL_IMAGES']; ?></label>
155  <br>
156  <label for="imageWidth"><?php echo $lang['FULLSCREEN_WIDTH']; ?></label>
157  <?php if ($gallery->imageWidth === '0') $gallery->imageWidth = ''; ?>
158  <input type="text" id="imageWidth" maxlength="11" name="imageWidth" class="form-control" placeholder="eg. 1024px" value="<?php echo $gallery->imageWidth; ?>">
159  <input type="hidden" id="imageWidth-old" maxlength="11" name="imageWidth-old" class="form-control" value="<?php echo $gallery->imageWidth; ?>">
160 
161  <label for="imageHeight"><?php echo $lang['FULLSCREEN_HEIGHT']; ?></label>
162  <?php if ($gallery->imageHeight === '0') $gallery->imageHeight = ''; ?>
163  <input type="text" id="imageHeight" maxlength="11" name="imageHeight" class="form-control" placeholder="eg. 1024px" value="<?php echo $gallery->imageHeight; ?>">
164  <input type="hidden" id="imageHeight-old" maxlength="11" name="imageHeight-old" class="form-control" value="<?php echo $gallery->imageHeight; ?>">
165 
166  <label for="resizeType"><?php echo $lang['RESIZE_TYPE']; ?></label>
167  <select class="form-control" id="resizeType" name="resizeType">
168  <?php
169  $resizeTypes = array("fit_to_width", "fit_to_height", "thumbnail", "resize");
170  foreach ($resizeTypes as $type)
171  { // if type is not set or empty
172  if (!isset($gallery->resizeType) && empty($gallery->resizeType))
173  { // set default value
174  $gallery->resizeType = "fit_to_width";
175  }
176  if ($type === "$gallery->resizeType")
177  { // selected value
178  echo "<option value=\"$type\" selected aria-selected=\"true\">$type</option>";
179  }
180  else
181  { // all others
182  echo "<option value=\"$type\">$type</option>";
183  }
184  }
185  ?>
186  </select>
187  </div>
188  </div>
189 
190  <div class="box box-default">
191  <div class="box-header">
192  <h3 class="box-title"><i class="fa fa-copyright text-muted"></i> <?php echo "$lang[WATERMARK] <small>$lang[AND_COPYRIGHT_SETTINGS]</small>"; ?></h3>
193  </div>
194  <div class="box-body">
195  <input type="hidden" value="0" name="watermarkEnable">
196 
197  <?php
198  if ($gallery->watermarkEnabled === '1')
199  {
200  $watermarkEnabledChecked = "checked";
201  }
202  else
203  {
204  $watermarkEnabledChecked = '';
205  }
206  ?>
207  <input type="hidden" value="0" name="watermarkEnabled">
208  <input type="checkbox" value="1" id="watermarkEnabled" name="watermarkEnabled" <?php echo $watermarkEnabledChecked; ?>>
209  <label for="watermarkEnabled"><?php echo $lang['WATERMARK_ENABLE']; ?></label>
210  <br>
211  <label for="watermark"><?php echo $lang['WATERMARK_FROM_CUSTOM_TEXT']; ?></label>
212  <input type="text" id="watermark" name="watermark" class="form-control" placeholder="(C) <?php echo date("Y")." photographer"; ?>" value="<?php echo $gallery->watermark; ?>">
213  <input type="hidden" id="watermark-old" name="watermark-old" class="form-control" value="<?php echo $gallery->watermark; ?>">
214  <label for="watermarkImage"><?php echo $lang['OR_FROM_ANY_IMG']; ?></label>
215  <input type="text" id="watermarkImage" name="watermarkImage" class="form-control" placeholder="media/images/yourfile.png" value="<?php echo $gallery->watermarkImage; ?>">
216  <input type="hidden" id="watermarkImage-old" name="watermarkImage-old" class="form-control" value="<?php echo $gallery->watermarkImage; ?>">
217  <label for="watermarkOpacity"><?php echo $lang['OVERLAY_OPACITY']; ?></label>
218  <select id="watermarkOpacity" name="watermarkOpacity" class="form-control">
219 
220  <option value="<?php echo $gallery->watermarkOpacity; ?>" aria-selected="true" selected><?php echo $gallery->watermarkOpacity; ?></option>
221  <option value=".1">10%</option>
222  <option value=".2">20%</option>
223  <option value=".3">30%</option>
224  <option value=".4">40%</option>
225  <option value=".5">50%</option>
226  <option value=".6">60%</option>
227  <option value=".7">70%</option>
228  <option value=".8">80%</option>
229  <option value=".9">90%</option>
230  <option value="1">100%</option>
231  </select>
232  <label for="watermarkPosition"><?php echo $lang['WATERMARK_POSITION']; ?></label>
233  <select id="watermarkPosition" name="watermarkPosition" class="form-control">
234  <option value="<?php echo $gallery->watermarkPosition; ?>"><?php echo $gallery->watermarkPosition; ?></option>
235  <option value="bottom right"><?php echo $lang['BOTTOM_RIGHT']; ?></option>
236  <option value="bottom left"><?php echo $lang['BOTTOM_LEFT']; ?></option>
237  <option value="top left"><?php echo $lang['TOP_LEFT']; ?></option>
238  <option value="top right"><?php echo $lang['TOP_RIGHT']; ?></option>
239  <option value="bottom"><?php echo $lang['BOTTOM']; ?></option>
240  <option value="center"><?php echo $lang['CENTER']; ?></option>
241  <option value="top"><?php echo $lang['TOP']; ?></option>
242  </select>
243  <label for="offsetX"><?php echo $lang['OFFSET_X_AXIS']; ?></label>
244  <input type="text" id="offsetX" name="offsetX" class="form-control" placeholder="-12" value="<?php echo $gallery->offsetX; ?>">
245  <label for="offsetY"><?php echo $lang['OFFSET_Y_AXIS']; ?></label>
246  <input type="text" id="offsetY" name="offsetY" class="form-control" placeholder="-12" value="<?php echo $gallery->offsetY; ?>">
247  <label for="watermarkFont"><?php echo $lang['WATERMARK_FONT']; ?></label>
248  <select id="watermarkFont" name="watermarkFont" class="form-control">
249  <option value="<?php echo $gallery->watermarkFont; ?>"><?php echo $gallery->watermarkFont; ?></option>
250  <?php
251  echo $gallery->scanFonts("../system/fonts/");
252  ?>
253  </select>
254 
255  <label for="watermarkTextSize"><?php echo $lang['WATERMARK_TEXT_SIZE']; ?></label>
256  <select id="watermarkTextSize" name="watermarkTextSize" class="form-control">
257  <?php
258  $i = 0;
259  while ($i < 201)
260  { // get 120 option fields in while loop
261  if ($i == $gallery->watermarkTextSize) { $selected = "selected"; } else { $selected = ''; }
262  echo "<option value=\"$i\" $selected>$i px</option>";
263  $i++;
264  }
265 
266  ?>
267  </select>
268  <label for="watermarkColor"><?php echo $lang['WATERMARK_TEXT_COLOR']; ?></label>
269  <input type="text" id="watermarkColor" name="watermarkColor" class="form-control color" placeholder="pick a color or leave blank" value="<?php echo $gallery->watermarkColor; ?>">
270  <label for="watermarkBorderColor"><?php echo $lang['WATERMARK_TEXT_BORDERCOLOR']; ?></label>
271  <input type="text" id="watermarkBorderColor" name="watermarkBorderColor" class="form-control color" placeholder="pick a color or leave blank" value="<?php echo $gallery->watermarkBorderColor; ?>">
272  <label for="watermarkBorder"><?php echo $lang['WATERMARK_BORDER_THICKNESS']; ?></label>
273  <select id="watermarkBorder" name="watermarkBorder" class="form-control">
274  <?php
275  $i = 0;
276  while ($i < 201)
277  { // get 120 option fields in while loop
278  if ($i == $gallery->watermarkBorder) { $selected = "selected"; } else { $selected = ''; }
279  echo "<option value=\"$i\" $selected>$i px</option>";
280  $i++;
281  }
282 
283  ?>
284  </select>
285 
286  <label for="author"><?php echo $lang['PHOTOGRAPHER']; ?></label>
287  <input type="text" id="author" name="author" class="form-control" value="<?php echo $gallery->author; ?>" placeholder="<?php echo $lang['PHOTOGRAPHER_PLACEHOLDER']; ?>">
288  <label for="author"><?php echo $lang['PHOTOGRAPHER_URL']; ?></label>
289  <input type="text" id="authorUrl" name="authorUrl" class="form-control" value="<?php echo $gallery->authorUrl; ?>" placeholder="http://">
290 
291  </div>
292  </div>
293  </div>
294  </div>
295 </form>
296 
297 
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
print $lang['GALLERY_EDIT']
Definition: edit.php:43
$i
Definition: edit.php:258
$resizeTypes
Definition: edit.php:169
type
Definition: menu-new.php:35
$type
print $_GET['id']
Definition: page-edit.php:357
$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