| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  | <?php | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |  * This Source Code Form is subject to the terms of the Mozilla Public | 
					
						
							|  |  |  |  * License, v. 2.0. If a copy of the MPL was not distributed with this | 
					
						
							|  |  |  |  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | require_once __DIR__ . '/../required.php'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | redirectifnotloggedin(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $images = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (!empty($VARS['id']) && $database->has('items', ['itemid' => $VARS['id']])) { | 
					
						
							|  |  |  |     $images = $database->select('images', ['imageid', 'imagename', 'primary'], ['itemid' => $VARS['id']]); | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     header('Location: app.php?page=items&msg=invalid_itemid'); | 
					
						
							|  |  |  |     die(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="card border-green"> | 
					
						
							| 
									
										
										
										
											2018-09-25 13:22:45 -06:00
										 |  |  |     <div class="card-header d-flex justify-content-between flex-wrap"> | 
					
						
							|  |  |  |         <h3 class="text-green my-auto"><i class="fas fa-images"></i> <?php $Strings->build("Editing images for item", ['item' => "<span id=\"name_title\">" . htmlspecialchars($database->get('items', 'name', ['itemid' => $VARS['id']])) . "</span>"]); ?></h3>
 | 
					
						
							| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  |         <div class="ml-auto my-auto"> | 
					
						
							|  |  |  |             <form action="action.php" method="POST" enctype="multipart/form-data"> | 
					
						
							| 
									
										
										
										
											2018-09-25 13:22:45 -06:00
										 |  |  |                 <div class="input-group input-group-sm"> | 
					
						
							| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  |                     <input type="text" id="uploadstatus" class="form-control" readonly /> | 
					
						
							|  |  |  |                     <div class="input-group-append"> | 
					
						
							|  |  |  |                         <span class="btn btn-primary btn-file"> | 
					
						
							|  |  |  |                             <i class="fas fa-folder-open"></i> <?php $Strings->get("Browse"); ?> <input id="fileupload" type="file" name="files[]" accept=".png,.jpg,.jpeg,.gif,.webp,image/png,image/jpeg,image/gif,image/webp" multiple required />
 | 
					
						
							|  |  |  |                         </span> | 
					
						
							|  |  |  |                         <button class="btn btn-success" type="submit"><i class="fas fa-cloud-upload-alt"></i> <?php $Strings->get("Upload"); ?></button>
 | 
					
						
							|  |  |  |                     </div> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |                 <input type="hidden" name="action" value="imageupload" /> | 
					
						
							|  |  |  |                 <input type="hidden" name="source" value="editimages" /> | 
					
						
							|  |  |  |                 <input type="hidden" name="itemid" value="<?php echo htmlspecialchars($VARS['id']); ?>" /> | 
					
						
							|  |  |  |             </form> | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2018-09-25 13:22:45 -06:00
										 |  |  |     </div> | 
					
						
							|  |  |  |     <div class="card-body"> | 
					
						
							| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  |         <div class="row"> | 
					
						
							|  |  |  |             <?php | 
					
						
							|  |  |  |             foreach ($images as $i) { | 
					
						
							|  |  |  |                 ?>
 | 
					
						
							|  |  |  |                 <div class="col-12 col-sm-6 col-md-4 col-lg-4 col-xl-3"> | 
					
						
							| 
									
										
										
										
											2018-09-22 20:18:56 -06:00
										 |  |  |                     <div class="card m-2"> | 
					
						
							| 
									
										
										
										
											2018-09-25 13:22:45 -06:00
										 |  |  |                         <img class="card-img" src="image.php?i=<?php echo $i['imagename']; ?>" alt="<?php echo $i['imagename']; ?>"> | 
					
						
							| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  |                         <div class="card-img-overlay text-right"> | 
					
						
							|  |  |  |                             <?php | 
					
						
							|  |  |  |                             if ($i['primary']) { | 
					
						
							|  |  |  |                                 ?>
 | 
					
						
							| 
									
										
										
										
											2018-09-25 13:22:45 -06:00
										 |  |  |                                 <span class="btn btn-success btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fas fa-check"></i> <?php $Strings->get("Promoted"); ?></span>
 | 
					
						
							| 
									
										
										
										
											2018-09-22 02:41:38 -06:00
										 |  |  |                                 <?php | 
					
						
							|  |  |  |                             } else { | 
					
						
							|  |  |  |                                 ?>
 | 
					
						
							|  |  |  |                                 <form action="action.php" method="POST"> | 
					
						
							|  |  |  |                                     <input type="hidden" name="action" value="promoteimage" /> | 
					
						
							|  |  |  |                                     <input type="hidden" name="itemid" value="<?php echo $VARS['id']; ?>" /> | 
					
						
							|  |  |  |                                     <input type="hidden" name="imageid" value="<?php echo $i['imageid']; ?>" /> | 
					
						
							|  |  |  |                                     <input type="hidden" name="source" value="editimages" /> | 
					
						
							|  |  |  |                                     <button type="submit" class="btn btn-primary btn-sm"><i class="fas fa-level-up-alt"></i> <?php $Strings->get("Promote"); ?></button>
 | 
					
						
							|  |  |  |                                 </form> | 
					
						
							|  |  |  |                                 <?php | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             ?>
 | 
					
						
							|  |  |  |                             <form action="action.php" method="POST"> | 
					
						
							|  |  |  |                                 <input type="hidden" name="action" value="deleteimage" /> | 
					
						
							|  |  |  |                                 <input type="hidden" name="itemid" value="<?php echo $VARS['id']; ?>" /> | 
					
						
							|  |  |  |                                 <input type="hidden" name="imageid" value="<?php echo $i['imageid']; ?>" /> | 
					
						
							|  |  |  |                                 <input type="hidden" name="source" value="editimages" /> | 
					
						
							|  |  |  |                                 <button type="submit" class="btn btn-danger btn-sm mt-1"><i class="fas fa-trash"></i> <?php $Strings->get("Delete"); ?></button>
 | 
					
						
							|  |  |  |                             </form> | 
					
						
							|  |  |  |                         </div> | 
					
						
							|  |  |  |                     </div> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |                 <?php | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             ?>
 | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     <div class="card-footer d-flex"> | 
					
						
							|  |  |  |         <a href="./app.php?page=edititem&id=<?php echo $_GET['id']; ?>" class="btn btn-success mr-auto"><i class="fas fa-arrow-left"></i> <?php $Strings->get("Back"); ?></a>
 | 
					
						
							|  |  |  |     </div> | 
					
						
							|  |  |  | </div> |