38 lines
998 B
PHP
38 lines
998 B
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Soshot\GetThumb;
|
|
use App\Soshot\GetFav;
|
|
use App\Soshot\GetOg;
|
|
use App\Utils\Error;
|
|
|
|
class Result {
|
|
|
|
public function index($params, $conf) {
|
|
if (
|
|
!isset($params->type) ||
|
|
!isset($params->hmac) ||
|
|
!isset($params->url)
|
|
) {
|
|
$error = new Error();
|
|
$error->index((object)['status' => 400, 'message' => 'Missing parameters']);
|
|
}
|
|
|
|
if (!in_array($params->type, $conf->permitType)) {
|
|
$error = new Error();
|
|
$error->index((object)['status' => 400, 'message' => 'Wrong type']);
|
|
}
|
|
|
|
if ($params->type === 'fav') {
|
|
$favicon = new GetFav($params, $conf);
|
|
$favicon->show();
|
|
} elseif ($params->type === 'og') {
|
|
$favicon = new GetOg($params, $conf);
|
|
$favicon->show();
|
|
} else {
|
|
$result = new GetThumb($params, $conf);
|
|
$result->show();
|
|
}
|
|
}
|
|
}
|