mirror of
https://github.com/openvk/openvk
synced 2025-03-04 00:29:57 +03:00
fix(phpstan): most of the things and stupid lines of code
This commit is contained in:
parent
f672e5001a
commit
92e741aeea
30 changed files with 140 additions and 122 deletions
|
@ -9,6 +9,7 @@ use Nette\Utils\ImageException;
|
|||
use openvk\Web\Models\Entities\{Photo, Album, Comment};
|
||||
use openvk\Web\Models\Repositories\Albums;
|
||||
use openvk\Web\Models\Repositories\Photos as PhotosRepo;
|
||||
use openvk\Web\Models\Repositories\Videos as VideosRepo;
|
||||
use openvk\Web\Models\Repositories\Clubs;
|
||||
use openvk\Web\Models\Repositories\Users as UsersRepo;
|
||||
use openvk\Web\Models\Repositories\Comments as CommentsRepo;
|
||||
|
|
|
@ -292,14 +292,14 @@ final class Users extends VKAPIRequestHandler
|
|||
break;
|
||||
case 'blacklisted_by_me':
|
||||
if (!$authuser) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
$response[$i]->blacklisted_by_me = (int) $usr->isBlacklistedBy($this->getUser());
|
||||
break;
|
||||
case 'blacklisted':
|
||||
if (!$authuser) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
$response[$i]->blacklisted = (int) $this->getUser()->isBlacklistedBy($usr);
|
||||
|
@ -383,7 +383,8 @@ final class Users extends VKAPIRequestHandler
|
|||
string $fav_music = "",
|
||||
string $fav_films = "",
|
||||
string $fav_shows = "",
|
||||
string $fav_books = ""
|
||||
string $fav_books = "",
|
||||
string $interests = ""
|
||||
) {
|
||||
if ($count > 100) {
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: count should be less or equal to 100");
|
||||
|
|
|
@ -53,7 +53,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$this->fail(15, "Access denied: wall is disabled");
|
||||
} // Don't search for logic here pls
|
||||
|
||||
$iteratorv;
|
||||
$iteratorv = null;
|
||||
|
||||
switch ($filter) {
|
||||
case "all":
|
||||
|
@ -722,7 +722,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$post->attach($attachment);
|
||||
}
|
||||
|
||||
if ($wall > 0 && $wall !== $this->user->identity->getId()) {
|
||||
if ($owner_id > 0 && $owner_id !== $this->user->identity->getId()) {
|
||||
(new WallPostNotification($wallOwner, $post, $this->user->identity))->emit();
|
||||
}
|
||||
|
||||
|
@ -734,7 +734,7 @@ final class Wall extends VKAPIRequestHandler
|
|||
$this->requireUser();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
$postArray;
|
||||
$postArray = [];
|
||||
if (preg_match('/(wall|video|photo)((?:-?)[0-9]+)_([0-9]+)/', $object, $postArray) == 0) {
|
||||
$this->fail(100, "One of the parameters specified was missing or invalid: object is incorrect");
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ class Document extends Media
|
|||
return $this->getRecord()->owner;
|
||||
}
|
||||
|
||||
public function toApiPreview(): object
|
||||
public function toApiPreview(): ?object
|
||||
{
|
||||
$preview = $this->getPreview();
|
||||
if ($preview instanceof Photo) {
|
||||
|
@ -360,6 +360,8 @@ class Document extends Media
|
|||
"sizes" => array_values($preview->getVkApiSizes()),
|
||||
],
|
||||
];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ class Gift extends RowModel
|
|||
|
||||
public function setImage(string $file): bool
|
||||
{
|
||||
$imgBlob;
|
||||
try {
|
||||
$image = Image::fromFile($file);
|
||||
$image->resize(512, 512, Image::SHRINK_ONLY);
|
||||
|
|
|
@ -33,6 +33,8 @@ class Message extends RowModel
|
|||
return (new Users())->get($this->getRecord()->sender_id);
|
||||
} elseif ($this->getRecord()->sender_type === 'openvk\Web\Models\Entities\Club') {
|
||||
return (new Clubs())->get($this->getRecord()->sender_id);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +51,8 @@ class Message extends RowModel
|
|||
return (new Users())->get($this->getRecord()->recipient_id);
|
||||
} elseif ($this->getRecord()->recipient_type === 'openvk\Web\Models\Entities\Club') {
|
||||
return (new Clubs())->get($this->getRecord()->recipient_id);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +151,7 @@ class Message extends RowModel
|
|||
"id" => $author->getId(),
|
||||
"link" => $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['HTTP_HOST'] . $author->getURL(),
|
||||
"avatar" => $author->getAvatarUrl(),
|
||||
"name" => $author->getFirstName() . $unreadmsg,
|
||||
"name" => $author->getFirstName(),
|
||||
],
|
||||
"timing" => [
|
||||
"sent" => (string) $this->getSendTimeHumanized(),
|
||||
|
|
|
@ -64,13 +64,15 @@ class Notification
|
|||
return $this->recipient;
|
||||
}
|
||||
|
||||
public function getModel(int $index): RowModel
|
||||
public function getModel(int $index): ?RowModel
|
||||
{
|
||||
switch ($index) {
|
||||
case 0:
|
||||
return $this->originModel;
|
||||
case 1:
|
||||
return $this->targetModel;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ class Photo extends Media
|
|||
}
|
||||
}
|
||||
|
||||
public static function fastMake(int $owner, string $description = "", array $file, ?Album $album = null, bool $anon = false): Photo
|
||||
public static function fastMake(int $owner, string $description, array $file, ?Album $album = null, bool $anon = false): Photo
|
||||
{
|
||||
$photo = new static();
|
||||
$photo->setOwner($owner);
|
||||
|
|
|
@ -45,11 +45,7 @@ class Report extends RowModel
|
|||
|
||||
public function isDeleted(): bool
|
||||
{
|
||||
if ($this->getRecord()->deleted === 0) {
|
||||
return false;
|
||||
} elseif ($this->getRecord()->deleted === 1) {
|
||||
return true;
|
||||
}
|
||||
return $this->getRecord()->deleted === 1;
|
||||
}
|
||||
|
||||
public function authorId(): int
|
||||
|
|
|
@ -932,6 +932,7 @@ class User extends RowModel
|
|||
case 1:
|
||||
return tr('female');
|
||||
case 2:
|
||||
default:
|
||||
return tr('neutral');
|
||||
}
|
||||
}
|
||||
|
@ -1559,14 +1560,14 @@ class User extends RowModel
|
|||
break;
|
||||
case "blacklisted_by_me":
|
||||
if (!$user) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
$res->blacklisted_by_me = (int) $this->isBlacklistedBy($user);
|
||||
break;
|
||||
case "blacklisted":
|
||||
if (!$user) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
$res->blacklisted = (int) $user->isBlacklistedBy($this);
|
||||
|
|
|
@ -9,12 +9,13 @@ use openvk\Web\Util\Shell\Exceptions\{ShellUnavailableException, UnknownCommandE
|
|||
use openvk\Web\Models\VideoDrivers\VideoDriver;
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
define("VIDEOS_FRIENDLY_ERROR", "Uploads are disabled on this instance :<", false);
|
||||
define("VIDEOS_FRIENDLY_ERROR", "Uploads are disabled on this instance :<");
|
||||
|
||||
class Video extends Media
|
||||
{
|
||||
public const TYPE_DIRECT = 0;
|
||||
public const TYPE_EMBED = 1;
|
||||
public const TYPE_DIRECT = 0;
|
||||
public const TYPE_EMBED = 1;
|
||||
public const TYPE_UNKNOWN = -1;
|
||||
|
||||
protected $tableName = "videos";
|
||||
protected $fileExtension = "mp4";
|
||||
|
@ -108,6 +109,7 @@ class Video extends Media
|
|||
} elseif (!is_null($this->getRecord()->link)) {
|
||||
return Video::TYPE_EMBED;
|
||||
}
|
||||
return VIDEO::TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
public function getVideoDriver(): ?VideoDriver
|
||||
|
@ -269,7 +271,7 @@ class Video extends Media
|
|||
return false;
|
||||
}
|
||||
|
||||
$streams = Shell::ffprobe("-i", $path, "-show_streams", "-select_streams v", "-loglevel error")->execute($error);
|
||||
$streams = Shell::ffprobe("-i", $path, "-show_streams", "-select_streams v", "-loglevel error")->execute();
|
||||
$durations = [];
|
||||
preg_match_all('%duration=([0-9\.]++)%', $streams, $durations);
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ class ChandlerGroups
|
|||
{
|
||||
private $context;
|
||||
private $groups;
|
||||
private $members;
|
||||
private $perms;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ class Clubs
|
|||
return (clone $this->clubs)->count('*');
|
||||
}
|
||||
|
||||
public function getPopularClubs(): \Traversable
|
||||
public function getPopularClubs(): ?\Traversable
|
||||
{
|
||||
// TODO rewrite
|
||||
|
||||
|
@ -106,6 +106,8 @@ class Clubs
|
|||
"subscriptions" => $entry["subscriptions"],
|
||||
];
|
||||
*/
|
||||
trigger_error("Clubs::getPopularClubs() is currently commented out and returns null", E_USER_WARNING);
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getWriteableClubs(int $id): \Traversable
|
||||
|
|
|
@ -152,7 +152,7 @@ class Documents
|
|||
switch ($paramName) {
|
||||
case "type":
|
||||
if ($paramValue < 1 || $paramValue > 8) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
$result->where("type", $paramValue);
|
||||
break;
|
||||
|
|
|
@ -11,7 +11,7 @@ use openvk\Web\Models\Entities\{User, SupportAgent};
|
|||
class SupportAgents
|
||||
{
|
||||
private $context;
|
||||
private $tickets;
|
||||
private $agents;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ class Tickets
|
|||
{
|
||||
$requests = $this->tickets->where(["id" => $requestId])->fetch();
|
||||
if (!is_null($requests)) {
|
||||
return new Req($requests);
|
||||
return new Ticket($requests);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ final class AdminPresenter extends OpenVKPresenter
|
|||
{
|
||||
$this->warnIfNoCommerce();
|
||||
|
||||
$cat;
|
||||
$cat = null;
|
||||
$gen = false;
|
||||
if ($id !== 0) {
|
||||
$cat = $this->gifts->getCat($id);
|
||||
|
|
|
@ -34,7 +34,8 @@ final class BlobPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
if (isset($_SERVER["HTTP_IF_NONE_MATCH"])) {
|
||||
exit(header("HTTP/1.1 304 Not Modified"));
|
||||
header("HTTP/1.1 304 Not Modified");
|
||||
exit();
|
||||
}
|
||||
|
||||
header("Content-Type: " . mime_content_type($path));
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace openvk\Web\Presenters;
|
|||
use openvk\Web\Models\Entities\{Comment, Notifications\MentionNotification, Photo, Video, User, Topic, Post};
|
||||
use openvk\Web\Models\Entities\Notifications\CommentNotification;
|
||||
use openvk\Web\Models\Repositories\{Comments, Clubs, Videos, Photos, Audios};
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
final class CommentPresenter extends OpenVKPresenter
|
||||
{
|
||||
|
|
|
@ -18,7 +18,7 @@ final class ContentSearchPresenter extends OpenVKPresenter
|
|||
public function renderIndex(): void
|
||||
{
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$this->template->results = $repo->find([
|
||||
$this->template->results = $this->$repo->find([
|
||||
"query" => $this->postParam("query"),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use Nette\InvalidStateException;
|
|||
use openvk\Web\Models\Entities\Notifications\ClubModeratorNotification;
|
||||
use openvk\Web\Models\Repositories\{Clubs, Users, Albums, Managers, Topics, Audios, Posts, Documents};
|
||||
use Chandler\Security\Authenticator;
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
final class GroupPresenter extends OpenVKPresenter
|
||||
{
|
||||
|
@ -288,7 +289,6 @@ final class GroupPresenter extends OpenVKPresenter
|
|||
|
||||
(new Albums())->getClubAvatarAlbum($club)->addPhoto($photo);
|
||||
} catch (ISE $ex) {
|
||||
$name = $album->getName();
|
||||
$this->flashFail("err", tr("error"), tr("error_when_uploading_photo"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,11 @@ final class MessengerPresenter extends OpenVKPresenter
|
|||
header("Content-Type: application/json");
|
||||
|
||||
if ($this->queryParam("act") !== "a_check") {
|
||||
exit(header("HTTP/1.1 400 Bad Request"));
|
||||
header("HTTP/1.1 400 Bad Request");
|
||||
exit();
|
||||
} elseif (!$this->queryParam("key")) {
|
||||
exit(header("HTTP/1.1 403 Forbidden"));
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
exit();
|
||||
}
|
||||
|
||||
$key = $this->queryParam("key");
|
||||
|
@ -158,7 +160,8 @@ final class MessengerPresenter extends OpenVKPresenter
|
|||
|
||||
$sel = $this->getCorrespondent($sel);
|
||||
if ($sel->getId() !== $this->user->id && !$sel->getPrivacyPermission('messages.write', $this->user->identity)) {
|
||||
exit(header("HTTP/1.1 403 Forbidden"));
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
exit();
|
||||
}
|
||||
|
||||
$cor = new Correspondence($this->user->identity, $sel);
|
||||
|
|
|
@ -151,77 +151,6 @@ final class NoSpamPresenter extends OpenVKPresenter
|
|||
$this->assertNoCSRF();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
function searchByAdditionalParams(?string $table = null, ?string $where = null, ?string $ip = null, ?string $useragent = null, ?int $ts = null, ?int $te = null, $user = null)
|
||||
{
|
||||
$db = DatabaseConnection::i()->getContext();
|
||||
if ($table && ($ip || $useragent || $ts || $te || $user)) {
|
||||
$conditions = [];
|
||||
|
||||
if ($ip) {
|
||||
$conditions[] = "`ip` REGEXP '$ip'";
|
||||
}
|
||||
if ($useragent) {
|
||||
$conditions[] = "`useragent` REGEXP '$useragent'";
|
||||
}
|
||||
if ($ts) {
|
||||
$conditions[] = "`ts` < $ts";
|
||||
}
|
||||
if ($te) {
|
||||
$conditions[] = "`ts` > $te";
|
||||
}
|
||||
if ($user) {
|
||||
$users = new Users();
|
||||
|
||||
$_user = $users->getByChandlerUser((new ChandlerUsers())->getById($user))
|
||||
?? $users->get((int) $user)
|
||||
?? $users->getByAddress($user)
|
||||
?? null;
|
||||
|
||||
if ($_user) {
|
||||
$conditions[] = "`user` = '" . $_user->getChandlerGUID() . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$whereStart = "WHERE `object_table` = '$table'";
|
||||
if ($table === "profiles") {
|
||||
$whereStart .= "AND `type` = 0";
|
||||
}
|
||||
|
||||
$conditions = count($conditions) > 0 ? "AND (" . implode(" AND ", $conditions) . ")" : "";
|
||||
$response = [];
|
||||
|
||||
if ($conditions) {
|
||||
$logs = $db->query("SELECT * FROM `ChandlerLogs` $whereStart $conditions GROUP BY `object_id`, `object_model`");
|
||||
|
||||
foreach ($logs as $log) {
|
||||
$log = (new Logs())->get($log->id);
|
||||
$object = $log->getObject()->unwrap();
|
||||
|
||||
if (!$object) {
|
||||
continue;
|
||||
}
|
||||
if ($where) {
|
||||
if (str_starts_with($where, " AND")) {
|
||||
$where = substr_replace($where, "", 0, strlen(" AND"));
|
||||
}
|
||||
|
||||
$a = $db->query("SELECT * FROM `$table` WHERE $where")->fetchAll();
|
||||
foreach ($a as $o) {
|
||||
if ($object->id == $o["id"]) {
|
||||
$response[] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$response[] = $object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$response = [];
|
||||
$processed = 0;
|
||||
|
@ -290,7 +219,7 @@ final class NoSpamPresenter extends OpenVKPresenter
|
|||
}
|
||||
|
||||
if ($ip || $useragent || $ts || $te || $user) {
|
||||
$rows = searchByAdditionalParams($table, $where, $ip, $useragent, $ts, $te, $user);
|
||||
$rows = $this->searchByAdditionalParams($table, $where, $ip, $useragent, $ts, $te, $user);
|
||||
} else {
|
||||
if (!$where) {
|
||||
$rows = [];
|
||||
|
@ -408,4 +337,75 @@ final class NoSpamPresenter extends OpenVKPresenter
|
|||
$this->returnJson(["success" => false, "error" => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
private function searchByAdditionalParams(?string $table = null, ?string $where = null, ?string $ip = null, ?string $useragent = null, ?int $ts = null, ?int $te = null, $user = null)
|
||||
{
|
||||
$db = DatabaseConnection::i()->getContext();
|
||||
if ($table && ($ip || $useragent || $ts || $te || $user)) {
|
||||
$conditions = [];
|
||||
|
||||
if ($ip) {
|
||||
$conditions[] = "`ip` REGEXP '$ip'";
|
||||
}
|
||||
if ($useragent) {
|
||||
$conditions[] = "`useragent` REGEXP '$useragent'";
|
||||
}
|
||||
if ($ts) {
|
||||
$conditions[] = "`ts` < $ts";
|
||||
}
|
||||
if ($te) {
|
||||
$conditions[] = "`ts` > $te";
|
||||
}
|
||||
if ($user) {
|
||||
$users = new Users();
|
||||
|
||||
$_user = $users->getByChandlerUser((new ChandlerUsers())->getById($user))
|
||||
?? $users->get((int) $user)
|
||||
?? $users->getByAddress($user)
|
||||
?? null;
|
||||
|
||||
if ($_user) {
|
||||
$conditions[] = "`user` = '" . $_user->getChandlerGUID() . "'";
|
||||
}
|
||||
}
|
||||
|
||||
$whereStart = "WHERE `object_table` = '$table'";
|
||||
if ($table === "profiles") {
|
||||
$whereStart .= "AND `type` = 0";
|
||||
}
|
||||
|
||||
$conditions = count($conditions) > 0 ? "AND (" . implode(" AND ", $conditions) . ")" : "";
|
||||
$response = [];
|
||||
|
||||
if ($conditions) {
|
||||
$logs = $db->query("SELECT * FROM `ChandlerLogs` $whereStart $conditions GROUP BY `object_id`, `object_model`");
|
||||
|
||||
foreach ($logs as $log) {
|
||||
$log = (new Logs())->get($log->id);
|
||||
$object = $log->getObject()->unwrap();
|
||||
|
||||
if (!$object) {
|
||||
continue;
|
||||
}
|
||||
if ($where) {
|
||||
if (str_starts_with($where, " AND")) {
|
||||
$where = substr_replace($where, "", 0, strlen(" AND"));
|
||||
}
|
||||
|
||||
$a = $db->query("SELECT * FROM `$table` WHERE $where")->fetchAll();
|
||||
foreach ($a as $o) {
|
||||
if ($object->id == $o["id"]) {
|
||||
$response[] = $object;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$response[] = $object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,6 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
protected function logInUserWithToken(): void
|
||||
{
|
||||
$header = $_SERVER["HTTP_AUTHORIZATION"] ?? "";
|
||||
$token;
|
||||
|
||||
preg_match("%Bearer (.*)$%", $header, $matches);
|
||||
$token = $matches[1] ?? "";
|
||||
|
|
|
@ -70,7 +70,7 @@ final class SearchPresenter extends OpenVKPresenter
|
|||
case 'marital_status':
|
||||
case 'polit_views':
|
||||
if ((int) $param_value == 0) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
$parameters[$param_name] = $param_value;
|
||||
|
||||
|
@ -96,7 +96,7 @@ final class SearchPresenter extends OpenVKPresenter
|
|||
# дай бог работал этот case
|
||||
case 'from_me':
|
||||
if ((int) $param_value != 1) {
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
$parameters['from_me'] = $this->user->id;
|
||||
|
||||
|
|
|
@ -314,17 +314,20 @@ final class SupportPresenter extends OpenVKPresenter
|
|||
$comment = $this->comments->get($id);
|
||||
|
||||
if ($this->user->id !== $comment->getTicket()->getUser()->getId()) {
|
||||
exit(header("HTTP/1.1 403 Forbidden"));
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if ($mark !== 1 && $mark !== 2) {
|
||||
exit(header("HTTP/1.1 400 Bad Request"));
|
||||
header("HTTP/1.1 400 Bad Request");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$comment->setMark($mark);
|
||||
$comment->save();
|
||||
|
||||
exit(header("HTTP/1.1 200 OK"));
|
||||
|
||||
header("HTTP/1.1 200 OK");
|
||||
exit();
|
||||
}
|
||||
|
||||
public function renderQuickBanInSupport(int $id): void
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace openvk\Web\Presenters;
|
|||
|
||||
use openvk\Web\Models\Entities\{Topic, Club, Comment, Photo, Video};
|
||||
use openvk\Web\Models\Repositories\{Topics, Clubs};
|
||||
use Nette\InvalidStateException as ISE;
|
||||
|
||||
final class TopicsPresenter extends OpenVKPresenter
|
||||
{
|
||||
|
@ -112,9 +113,6 @@ final class TopicsPresenter extends OpenVKPresenter
|
|||
$video = null;
|
||||
if ($_FILES["_pic_attachment"]["error"] === UPLOAD_ERR_OK) {
|
||||
$album = null;
|
||||
if ($wall > 0 && $wall === $this->user->id) {
|
||||
$album = (new Albums())->getUserWallAlbum($wallOwner);
|
||||
}
|
||||
|
||||
$photo = Photo::fastMake($this->user->id, $this->postParam("text"), $_FILES["_pic_attachment"], $album);
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
}
|
||||
}
|
||||
|
||||
define("VKAPI_DECL_VER", $this->requestParam("v") ?? "4.100", false);
|
||||
define("VKAPI_DECL_VER", $this->requestParam("v") ?? "4.100");
|
||||
|
||||
try {
|
||||
$res = $handler->{$method}(...$params);
|
||||
|
|
|
@ -66,6 +66,7 @@ class DateTime
|
|||
case static::RELATIVE_FORMAT_LOWER:
|
||||
return $this->zmdate();
|
||||
case static::RELATIVE_FORMAT_SHORT:
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,9 +188,9 @@ class Makima
|
|||
|
||||
$tries = [];
|
||||
|
||||
$firstLine;
|
||||
$secondLine;
|
||||
$thirdLine;
|
||||
$firstLine = null;
|
||||
$secondLine = null;
|
||||
$thirdLine = null;
|
||||
|
||||
# Try one line:
|
||||
$tries[$firstLine = $count] = [$this->calculateMultiThumbsHeight($ratiosCropped, $maxWidth, $marginWidth)];
|
||||
|
@ -234,7 +234,7 @@ class Makima
|
|||
}
|
||||
}
|
||||
|
||||
if (!$optimalConfiguration || $confDigff < $optimalDifference) {
|
||||
if (!$optimalConfiguration || $confDiff < $optimalDifference) {
|
||||
$optimalConfiguration = $config;
|
||||
$optimalDifference = $confDiff;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue