mirror of
https://github.com/openvk/openvk
synced 2024-12-22 16:42:32 +03:00
Compare commits
6 commits
0bf4ec5680
...
86e50a0add
Author | SHA1 | Date | |
---|---|---|---|
|
86e50a0add | ||
|
b9687b1fb2 | ||
|
4046c992f9 | ||
|
96d48efbaf | ||
|
803831917c | ||
|
f575b71bb0 |
12 changed files with 216 additions and 93 deletions
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
|
@ -53,9 +53,6 @@
|
|||
<table class="row">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<img src="pictures/lock.jpeg" align="center" class="float-center" width=128 height=128 />
|
||||
</center>
|
||||
|
||||
<table class="spacer">
|
||||
<tr>
|
||||
|
@ -94,7 +91,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={rawurlencode($key)}" align="center" class="float-center">Подтвердить Email!</a>
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/settings/change_email?key={rawurlencode($key)}" align="center" class="float-center">Подтвердить Email!</a>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -118,8 +115,8 @@
|
|||
<table class="callout">
|
||||
<tr>
|
||||
<th class="callout-inner primary">
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key}" style="color: #000; text-decoration: none;">
|
||||
http://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key}
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key}" style="color: #000; text-decoration: none;">
|
||||
https://{$_SERVER['HTTP_HOST']}/settings/change_email?key={$key}
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -130,7 +127,7 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседам, любимым девушкам)</li>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседям, любимым девушкам)</li>
|
||||
<li>Использовать, если прошло более двух дней с её генерации</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<tr>
|
||||
<td class="float-center" align="center" valign="top">
|
||||
<center>
|
||||
Добро пожаловать в OpenVK! Приятного времяприпровождения, надеюсь вам понравится.<br><br>Если появились вопросы, касаемые нашего сайта, пишите <a href="https://ovk.to/support?act=new">сюда</a>
|
||||
Добро пожаловать в OpenVK! Приятного времяприпровождения, надеюсь вам понравится.<br><br>Если появились вопросы, касаемые нашего сайта, пишите <a href="https://{$_SERVER['HTTP_HOST']}/support?act=new">сюда</a>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -53,9 +53,6 @@
|
|||
<table class="row">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<img src="pictures/lock.jpeg" align="center" class="float-center" width=128 height=128 />
|
||||
</center>
|
||||
|
||||
<table class="spacer">
|
||||
<tr>
|
||||
|
@ -94,7 +91,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={rawurlencode($key)}" align="center" class="float-center">Сбросить пароль!</a>
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={rawurlencode($key)}" align="center" class="float-center">Сбросить пароль!</a>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -118,8 +115,8 @@
|
|||
<table class="callout">
|
||||
<tr>
|
||||
<th class="callout-inner primary">
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={$key}" style="color: #000; text-decoration: none;">
|
||||
http://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={$key}
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={$key}" style="color: #000; text-decoration: none;">
|
||||
https://{$_SERVER['HTTP_HOST']}/restore?act=finish&key={$key}
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -130,7 +127,7 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседам, любимым девушкам)</li>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседям, любимым девушкам)</li>
|
||||
<li>Использовать, если прошло более двух дней с её генерации</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -53,9 +53,6 @@
|
|||
<table class="row">
|
||||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<img src="pictures/lock.jpeg" align="center" class="float-center" width=128 height=128 />
|
||||
</center>
|
||||
|
||||
<table class="spacer">
|
||||
<tr>
|
||||
|
@ -94,7 +91,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<center>
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/regFinish?key={rawurlencode($key)}" align="center" class="float-center">Подтвердить Email!</a>
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/regFinish?key={rawurlencode($key)}" align="center" class="float-center">Подтвердить Email!</a>
|
||||
</center>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -118,8 +115,8 @@
|
|||
<table class="callout">
|
||||
<tr>
|
||||
<th class="callout-inner primary">
|
||||
<a href="http://{$_SERVER['HTTP_HOST']}/regFinish?key={$key}" style="color: #000; text-decoration: none;">
|
||||
http://{$_SERVER['HTTP_HOST']}/regFinish?key={$key}
|
||||
<a href="https://{$_SERVER['HTTP_HOST']}/regFinish?key={$key}" style="color: #000; text-decoration: none;">
|
||||
https://{$_SERVER['HTTP_HOST']}/regFinish?key={$key}
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
|
@ -130,7 +127,7 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседам, любимым девушкам)</li>
|
||||
<li>Передавать другим людям (даже друзьям, питомцам, соседям, любимым девушкам)</li>
|
||||
<li>Использовать, если прошло более двух дней с её генерации</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -190,4 +190,42 @@ final class Account extends VKAPIRequestHandler
|
|||
|
||||
return $settings_list;
|
||||
}
|
||||
|
||||
function sendVotes(int $receiver, int $value, string $message = ""): object
|
||||
{
|
||||
$this->requireUser();
|
||||
$this->willExecuteWriteAction();
|
||||
|
||||
if(!OPENVK_ROOT_CONF["openvk"]["preferences"]["commerce"])
|
||||
$this->fail(-105, "Commerce is disabled on this instance");
|
||||
|
||||
if($receiver < 0)
|
||||
$this->fail(-248, "Invalid receiver id");
|
||||
|
||||
if($value < 1)
|
||||
$this->fail(-248, "Invalid value");
|
||||
|
||||
if(iconv_strlen($message) > 255)
|
||||
$this->fail(-249, "Message is too long");
|
||||
|
||||
if($this->getUser()->getCoins() < $value)
|
||||
$this->fail(-252, "Not enough votes");
|
||||
|
||||
$receiver_entity = (new \openvk\Web\Models\Repositories\Users)->get($receiver);
|
||||
if(!$receiver_entity || $receiver_entity->isDeleted())
|
||||
$this->fail(-250, "Invalid receiver");
|
||||
|
||||
if($receiver_entity->getId() === $this->getUser()->getId())
|
||||
$this->fail(-251, "Can't transfer votes to yourself");
|
||||
|
||||
$this->getUser()->setCoins($this->getUser()->getCoins() - $value);
|
||||
$this->getUser()->save();
|
||||
|
||||
$receiver_entity->setCoins($receiver_entity->getCoins() + $value);
|
||||
$receiver_entity->save();
|
||||
|
||||
(new \openvk\Web\Models\Entities\Notifications\CoinsTransferNotification($receiver_entity, $this->getUser(), $value, $message))->emit();
|
||||
|
||||
return (object) ['votes' => $this->getUser()->getCoins()];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ final class Newsfeed extends VKAPIRequestHandler
|
|||
return $response;
|
||||
}
|
||||
|
||||
function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0)
|
||||
function getGlobal(string $fields = "", int $start_from = 0, int $start_time = 0, int $end_time = 0, int $offset = 0, int $count = 30, int $extended = 0, int $rss = 0)
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
|
@ -74,6 +74,25 @@ final class Newsfeed extends VKAPIRequestHandler
|
|||
|
||||
$rposts = [];
|
||||
$ids = [];
|
||||
if($rss == 1) {
|
||||
$channel = new \Bhaktaraz\RSSGenerator\Channel();
|
||||
$channel->title("Global Feed — " . OPENVK_ROOT_CONF['openvk']['appearance']['name'])
|
||||
->description('OVK Global feed')
|
||||
->url(ovk_scheme(true) . $_SERVER["HTTP_HOST"] . "/feed/all");
|
||||
|
||||
foreach($posts as $item) {
|
||||
$post = (new PostsRepo)->get($item->id);
|
||||
if(!$post || $post->isDeleted()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$output = $post->toRss();
|
||||
$output->appendTo($channel);
|
||||
}
|
||||
|
||||
return $channel;
|
||||
}
|
||||
|
||||
foreach($posts as $post) {
|
||||
$rposts[] = (new PostsRepo)->get($post->id)->getPrettyId();
|
||||
$ids[] = $post->id;
|
||||
|
|
|
@ -20,7 +20,7 @@ use openvk\Web\Models\Repositories\Audios as AudiosRepo;
|
|||
|
||||
final class Wall extends VKAPIRequestHandler
|
||||
{
|
||||
function get(int $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0, string $filter = "all"): object
|
||||
function get(int $owner_id, string $domain = "", int $offset = 0, int $count = 30, int $extended = 0, string $filter = "all", int $rss = 0): object
|
||||
{
|
||||
$this->requireUser();
|
||||
|
||||
|
@ -86,6 +86,8 @@ final class Wall extends VKAPIRequestHandler
|
|||
break;
|
||||
}
|
||||
|
||||
$iteratorv = iterator_to_array($iteratorv);
|
||||
|
||||
foreach($iteratorv as $post) {
|
||||
$from_id = get_class($post->getOwner()) == "openvk\Web\Models\Entities\Club" ? $post->getOwner()->getId() * (-1) : $post->getOwner()->getId();
|
||||
|
||||
|
@ -217,6 +219,20 @@ final class Wall extends VKAPIRequestHandler
|
|||
$attachments = NULL; # free attachments so it will not clone everythingg
|
||||
}
|
||||
|
||||
if($rss == 1) {
|
||||
$channel = new \Bhaktaraz\RSSGenerator\Channel();
|
||||
$channel->title($wallOnwer->getCanonicalName() . " — " . OPENVK_ROOT_CONF['openvk']['appearance']['name'])
|
||||
->description('Wall of ' . $wallOnwer->getCanonicalName())
|
||||
->url(ovk_scheme(true) . $_SERVER["HTTP_HOST"] . "/wall" . $wallOnwer->getRealId());
|
||||
|
||||
foreach($iteratorv as $item) {
|
||||
$output = $item->toRss();
|
||||
$output->appendTo($channel);
|
||||
}
|
||||
|
||||
return $channel;
|
||||
}
|
||||
|
||||
if($extended == 1) {
|
||||
$profiles = array_unique($profiles);
|
||||
$groups = array_unique($groups);
|
||||
|
|
|
@ -374,5 +374,46 @@ class Post extends Postable
|
|||
return $user->getId() == $this->getOwner(false)->getId();
|
||||
}
|
||||
|
||||
function toRss(): \Bhaktaraz\RSSGenerator\Item
|
||||
{
|
||||
$domain = ovk_scheme(true).$_SERVER["HTTP_HOST"];
|
||||
$description = $this->getText(false);
|
||||
$description_html = $description;
|
||||
$url = $domain."/wall".$this->getPrettyId();
|
||||
|
||||
$author = $this->getOwner();
|
||||
$author_name = htmlspecialchars($author->getCanonicalName(), ENT_DISALLOWED | ENT_XHTML);
|
||||
if($this->isExplicit())
|
||||
$description_html .= "<br /><b>".tr('contains_nsfw').".</b><br />";
|
||||
|
||||
foreach($this->getChildren() as $child) {
|
||||
if($child instanceof Photo) {
|
||||
$child_page = $domain.$child->getPageURL();
|
||||
$child_url = $child->getURLBySizeId('large');
|
||||
$description_html .= "<br /><a href='$child_page'><img src='$child_url'></a>";
|
||||
} elseif($child instanceof Video) {
|
||||
$child_page = $domain.'/video'.$child->getPrettyId();
|
||||
$description_html .= "<br /><a href='$child_page'>Video</a>";
|
||||
} elseif($child instanceof Audio) {
|
||||
$description_html .= "<br />Audio";
|
||||
}
|
||||
}
|
||||
|
||||
$description_html .= "<br />".tr('author').": <img width='15px' src='".$author->getAvatarURL()."'><a href='".$author->getURL()."'>" . $author_name . "</a>";
|
||||
if($this->hasSource()) {
|
||||
$description_html .= "<br />".tr('source').": ".htmlspecialchars($this->getSource(), ENT_DISALLOWED | ENT_XHTML);
|
||||
}
|
||||
|
||||
$item = new \Bhaktaraz\RSSGenerator\Item();
|
||||
$item->title(str_replace("\n", "", ovk_proc_strtr($description, 79)))
|
||||
->url($url)
|
||||
->guid($url)
|
||||
->creator($author_name)
|
||||
->pubDate($this->getPublicationTime()->timestamp())
|
||||
->content(str_replace("\n", "<br />", $description_html));
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
use Traits\TRichText;
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ abstract class OpenVKPresenter extends SimplePresenter
|
|||
|
||||
$userValidated = 1;
|
||||
$cacheTime = 0; # Force no cache
|
||||
if($this->user->identity->onlineStatus() == 0 && !($this->user->identity->isDeleted() || $this->user->identity->isBanned())) {
|
||||
if(!property_exists($this, 'silent') && $this->user->identity->onlineStatus() == 0 && !($this->user->identity->isDeleted() || $this->user->identity->isBanned())) {
|
||||
$this->user->identity->setOnline(time());
|
||||
$this->user->identity->setClient_name(NULL);
|
||||
$this->user->identity->save(false);
|
||||
|
|
|
@ -10,6 +10,7 @@ use WhichBrowser;
|
|||
|
||||
final class VKAPIPresenter extends OpenVKPresenter
|
||||
{
|
||||
protected $silent = true;
|
||||
private function logRequest(string $object, string $method): void
|
||||
{
|
||||
$date = date(DATE_COOKIE);
|
||||
|
@ -222,9 +223,13 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
if(!is_callable([$handler, $method]))
|
||||
$this->badMethod($object, $method);
|
||||
|
||||
$has_rss = false;
|
||||
$route = new \ReflectionMethod($handler, $method);
|
||||
$params = [];
|
||||
foreach($route->getParameters() as $parameter) {
|
||||
if($parameter->getName() == 'rss')
|
||||
$has_rss = true;
|
||||
|
||||
$val = $this->requestParam($parameter->getName());
|
||||
if(is_null($val)) {
|
||||
if($parameter->allowsNull())
|
||||
|
@ -260,6 +265,16 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
$this->fail($ex->getCode(), $ex->getMessage(), $object, $method);
|
||||
}
|
||||
|
||||
$result = NULL;
|
||||
|
||||
if($this->queryParam("rss") == '1' && $has_rss) {
|
||||
$feed = new \Bhaktaraz\RSSGenerator\Feed();
|
||||
$res->appendTo($feed);
|
||||
|
||||
$result = strval($feed);
|
||||
|
||||
header("Content-Type: application/rss+xml;charset=UTF-8");
|
||||
} else {
|
||||
$result = json_encode([
|
||||
"response" => $res,
|
||||
]);
|
||||
|
@ -267,8 +282,10 @@ final class VKAPIPresenter extends OpenVKPresenter
|
|||
if($callback) {
|
||||
$result = $callback . '(' . $result . ')';
|
||||
header('Content-Type: application/javascript');
|
||||
} else
|
||||
} else {
|
||||
header("Content-Type: application/json");
|
||||
}
|
||||
}
|
||||
|
||||
$size = strlen($result);
|
||||
header("Content-Length: $size");
|
||||
|
|
|
@ -58,6 +58,7 @@ openvk:
|
|||
enable: false
|
||||
account: 100
|
||||
postSizes:
|
||||
maxAttachments: 10
|
||||
maxSize: 60000
|
||||
processingLimit: 3000
|
||||
emojiProcessingLimit: 1000
|
||||
|
|
Loading…
Reference in a new issue