Exemplo n.º 1
0
<?php

require VIEWS . '_layout/header.php';
?>
<div class="content">

  <div class="multimedia imagenes">
    <div id="accordion" style="width:100%">
    <?php 
foreach ($dirs as $i => $dir) {
    $path = !$i ? $dir : $dirs[0] . DIRECTORY_SEPARATOR . $dir;
    $gallery_imgs = scandir(PUBLICO . $path, 1);
    $cat = $dir == $dirs[0] ? 'índice' : $dir;
    echo "<h3>{$cat}</h3>";
    echo "<div>";
    foreach ($gallery_imgs as $id => $img) {
        $url = PUBLICO . $path . DIRECTORY_SEPARATOR . $img;
        if (isImageValid($url)) {
            $urlimg = URL . $path . DIRECTORY_SEPARATOR . $img;
            showImage($id, $urlimg);
        }
    }
    echo "</div>";
}
?>
          <!-- </div> -->
    </div>
  </div>
</div>
<?php 
require VIEWS . '_layout/footer.php';
Exemplo n.º 2
0
     break;
 }
 $torrent = @mysqli_fetch_all($result, MYSQLI_ASSOC)[0];
 mysqli_free_result($result);
 if (isset($_POST['newdescription']) && $_POST['newdescription'] != file_get_contents(unserialize(_CONFIG)['descriptions']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'])) {
     $handle = fopen(unserialize(_CONFIG)['descriptions']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'], 'w');
     fwrite($handle, htmlspecialchars($_POST['newdescription']));
     fclose($handle);
 }
 if (isset($_FILES['newartwork']) && !empty($_FILES['newartwork'])) {
     $artwork_extension = imagetypeToString(exif_imagetype($_FILES['newartwork']['tmp_name']));
     if (!in_array($artwork_extension, unserialize(_CONFIG)['artwork']['filetypes'])) {
         array_push($errors, 'Invalid artwork file extension!');
         break;
     }
     if (!isImageValid(CONF_STORE_ARTWORK_DIR . DIRECTORY_SEPARATOR . $torrent['filename'])) {
         array_push($errors, 'Artwork must be at most ' . unserialize(_CONFIG)['artwork']['width_max'] . 'x' . unserialize(_CONFIG)['artwork']['height_max'] . 'px.');
         break;
     }
     $artwork_dimensions = getimagesize($_FILES['newartwork']['tmp_name']);
     $artwork_scale = $artwork_dimensions[0] / $artwork_dimensions[1];
     $artwork_width = $artwork_scale > 1 ? unserialize(_CONFIG)['artwork']['output_max'] : (int) unserialize(_CONFIG)['artwork']['output_max'] * $artwork_scale;
     $artwork_height = $artwork_scale > 1 ? unserialize(_CONFIG)['artwork']['output_max'] / $artwork_scale : (int) unserialize(_CONFIG)['artwork']['output_max'];
     $artwork_fin = imagecreatetruecolor($artwork_width, $artwork_height);
     imagecopyresampled($artwork_fin, imagecreatefromstring(file_get_contents($_FILES['newartwork']['tmp_name'])), 0, 0, 0, 0, $artwork_width, $artwork_height, $artwork_dimensions[0], $artwork_dimensions[1]);
     $artwork_destination = unserialize(_CONFIG)['artwork']['dir'] . DIRECTORY_SEPARATOR . $torrent['filename'];
     unlink($artwork_destination);
     switch (imagetypeToString(exif_imagetype($_FILES['newartwork']['tmp_name']))) {
         case 'gif':
             imagegif($artwork_fin, $artwork_destination);
             break;
Exemplo n.º 3
0
 if (getFileExtension($_FILES['torrent']['name']) != 'torrent') {
     print_error('Torrent file does not have .torrent file extension!');
     break;
 }
 $filename = hash_file('sha256', $_FILES['torrent']['tmp_name']);
 if (file_exists(unserialize(_CONFIG)['torrents']['dir'] . DIRECTORY_SEPARATOR . $filename . '.torrent')) {
     print_error('Torrent already exists!');
     break;
 }
 if (!empty($_FILES['artwork']) && $_FILES['artwork'][0] != null) {
     $artwork_extension = imagetypeToString(exif_imagetype($_FILES['artwork']['tmp_name']));
     if (!in_array($artwork_extension, unserialize(_CONFIG)['artwork']['filetypes'])) {
         print_error('Invalid artwork file extension!');
         break;
     }
     if (!isImageValid(unserialize(_CONFIG)['artwork']['dir'] . DIRECTORY_SEPARATOR . $filename, (int) unserialize(_CONFIG)['artwork']['height_max'], (int) unserialize(_CONFIG)['artwork']['width_max'])) {
         print_error('Artwork must be at most ' . unserialize(_CONFIG)['artwork']['width_max'] . 'x' . unserialize(_CONFIG)['artwork']['height_max'] . 'px.');
         break;
     }
 }
 if (!($link = db_init(true))) {
     break;
 }
 $result = mysqli_query($link, 'SELECT `id` FROM `torrents` ORDER BY `id` DESC LIMIT 1;');
 if (!$result) {
     print_error('MySQL error | ' . mysqli_error($link) . '<br>');
     break;
 }
 $id = (int) mysqli_fetch_all($result, MYSQLI_ASSOC)[0]['id'] + 1;
 mysqli_free_result($result);
 if (strlen($_POST['description']) == 0) {