mirror of
https://github.com/openvk/openvk
synced 2025-03-03 16:20:04 +03:00
fix(stan): all errors are gone now =3
This commit is contained in:
parent
16ca685727
commit
b1111101b5
6 changed files with 8 additions and 80 deletions
|
@ -387,7 +387,7 @@ class Photo extends Media
|
|||
|
||||
public static function fastMake(int $owner, string $description, array $file, ?Album $album = null, bool $anon = false): Photo
|
||||
{
|
||||
$photo = new static();
|
||||
$photo = new Photo();
|
||||
$photo->setOwner($owner);
|
||||
$photo->setDescription(iconv_substr($description, 0, 36) . "...");
|
||||
$photo->setAnonymous($anon);
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace openvk\Web\Models\Repositories;
|
||||
|
||||
use openvk\Web\Models\Entities\{Messages as M, User};
|
||||
use Chandler\Database\DatabaseConnection as DB;
|
||||
use Nette\Database\Table\ActiveRow;
|
||||
|
||||
class Conversations
|
||||
{
|
||||
private $context;
|
||||
private $convos;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->context = DB::i()->getContext();
|
||||
$this->convos = $this->context->table("conversations");
|
||||
}
|
||||
|
||||
private function toConversation(?ActiveRow $ar): ?M\AbstractConversation
|
||||
{
|
||||
if (is_null($ar)) {
|
||||
return null;
|
||||
} elseif ($ar->is_pm) {
|
||||
return new M\PrivateConversation($ar);
|
||||
} else {
|
||||
return new M\Conversation($ar);
|
||||
}
|
||||
}
|
||||
|
||||
public function get(int $id): ?M\AbstractConversation
|
||||
{
|
||||
return $this->toConversation($this->convos->get($id));
|
||||
}
|
||||
|
||||
public function getConversationsByUser(User $user, int $page = 1, ?int $perPage = null): \Traversable
|
||||
{
|
||||
$rels = $this->context->table("conversation_members")->where([
|
||||
"deleted" => false,
|
||||
"user" => $user->getId(),
|
||||
])->page($page, $perPage ?? OPENVK_DEFAULT_PER_PAGE);
|
||||
foreach ($rels as $rel) {
|
||||
yield $this->get($rel->conversation);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPrivateConversation(User $user, int $peer): M\PrivateConversation
|
||||
{
|
||||
;
|
||||
}
|
||||
}
|
|
@ -8,17 +8,17 @@ use openvk\Web\Models\Repositories\ContentSearchRepository;
|
|||
|
||||
final class ContentSearchPresenter extends OpenVKPresenter
|
||||
{
|
||||
private $repo;
|
||||
protected $repo;
|
||||
|
||||
public function __construct(ContentSearchRepository $repo)
|
||||
public function __construct(ContentSearchRepository $repository)
|
||||
{
|
||||
$this->repo = $repo;
|
||||
$this->repo = $repository;
|
||||
}
|
||||
|
||||
public function renderIndex(): void
|
||||
{
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$this->template->results = $this->$repo->find([
|
||||
$this->template->results = $this->repo->find([
|
||||
"query" => $this->postParam("query"),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -128,6 +128,6 @@ class Themepack
|
|||
throw new Exceptions\IncompatibleThemeException("Theme is built for newer OVK (themeEngine" . $manifest->openvk_version . ")");
|
||||
}
|
||||
|
||||
return new static($manifest->id, $manifest->version, (bool) ($manifest->inherit_master ?? true), (bool) ($manifest->override_templates ?? false), (bool) ($manifest->enabled ?? true), (object) $manifest->metadata);
|
||||
return new Themepack($manifest->id, $manifest->version, (bool) ($manifest->inherit_master ?? true), (bool) ($manifest->override_templates ?? false), (bool) ($manifest->enabled ?? true), (object) $manifest->metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,25 +88,6 @@ class Themepacks implements \ArrayAccess
|
|||
|
||||
/* /ArrayAccess */
|
||||
|
||||
public function install(string $archivePath): bool
|
||||
{
|
||||
if (!file_exists($archivePath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$tmpDir = mkdir(tempnam(OPENVK_ROOT . "/tmp/themepack_artifacts/", "themex_"));
|
||||
try {
|
||||
$archive = new \CabArchive($archivePath);
|
||||
$archive->extract($tmpDir);
|
||||
|
||||
return $this->installUnpacked($tmpDir);
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
} finally {
|
||||
rmdir($tmpDir);
|
||||
}
|
||||
}
|
||||
|
||||
public function uninstall(string $id): bool
|
||||
{
|
||||
if (!isset($loadedThemepacks[$id])) {
|
||||
|
|
|
@ -78,7 +78,7 @@ class Bitmask
|
|||
} elseif (gettype($key) === "int") {
|
||||
$this->setByOffset($key, $data);
|
||||
} else {
|
||||
throw new TypeError("Key must be either offset (int) or a string index");
|
||||
throw new \TypeError("Key must be either offset (int) or a string index");
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -89,7 +89,7 @@ class Bitmask
|
|||
if (gettype($key) === "string") {
|
||||
$key = $this->getOffsetByKey($key);
|
||||
} elseif (gettype($key) !== "int") {
|
||||
throw new TypeError("Key must be either offset (int) or a string index");
|
||||
throw new \TypeError("Key must be either offset (int) or a string index");
|
||||
}
|
||||
|
||||
return $this->length === 1 ? $this->getBoolByOffset($key) : $this->getNumberByOffset($key);
|
||||
|
|
Loading…
Reference in a new issue