<?php
use classes\DataBase;
use classes\Donors\EroTop;
use classes\ImgConverter;
use classes\Main;
use classes\Storage;
use DiDom\Document;
require 'init.php';
if (empty($_POST['url']) OR empty($_POST['type']) OR empty($_POST['site'])) {
header("Location: /");
exit;
}
extract($_POST);
$dObject = new Document();
$db = new DataBase();
$imgConverter = new ImgConverter();
$storage = new Storage($db, $imgConverter);
switch ($site) {
case 'ero-top.info':
$donor = new EroTop($dObject);
break;
default:
header("Location: /");
exit;
}
$main = new Main($donor, $storage, $url);
switch ($type) {
case 'single':
$main->images()->save();
break;
case 'list':
$main->list()->images()->save();
break;
default:
header("Location: /");
exit;
}
header("Location: /example.php");