Revert "Merge tag 'v2.10.6'"
This reverts commit122ea4ab9e
, reversing changes made toc54a11e250
.
This commit is contained in:
@@ -34,7 +34,7 @@ class Tips extends Extension
|
||||
/** @var TipsTheme */
|
||||
protected Themelet $theme;
|
||||
|
||||
public function onDatabaseUpgrade(DatabaseUpgradeEvent $event): void
|
||||
public function onDatabaseUpgrade(DatabaseUpgradeEvent $event)
|
||||
{
|
||||
global $database;
|
||||
|
||||
@@ -50,7 +50,7 @@ class Tips extends Extension
|
||||
"
|
||||
INSERT INTO tips (enable, image, text)
|
||||
VALUES (:enable, :image, :text)",
|
||||
["enable" => true, "image" => "coins.png", "text" => "Do you like this extension? Please support us for developing new ones. <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8235933\" target=\"_blank\">Donate through paypal</a>."]
|
||||
["enable"=>true, "image"=>"coins.png", "text"=>"Do you like this extension? Please support us for developing new ones. <a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8235933\" target=\"_blank\">Donate through paypal</a>."]
|
||||
);
|
||||
|
||||
$this->set_version("ext_tips_version", 2);
|
||||
@@ -61,7 +61,7 @@ class Tips extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
public function onPageRequest(PageRequestEvent $event): void
|
||||
public function onPageRequest(PageRequestEvent $event)
|
||||
{
|
||||
global $page, $user;
|
||||
|
||||
@@ -98,17 +98,17 @@ class Tips extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event): void
|
||||
public function onPageSubNavBuilding(PageSubNavBuildingEvent $event)
|
||||
{
|
||||
global $user;
|
||||
if ($event->parent === "system") {
|
||||
if ($event->parent==="system") {
|
||||
if ($user->can(Permissions::TIPS_ADMIN)) {
|
||||
$event->add_nav_link("tips", new Link('tips/list'), "Tips Editor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function onUserBlockBuilding(UserBlockBuildingEvent $event): void
|
||||
public function onUserBlockBuilding(UserBlockBuildingEvent $event)
|
||||
{
|
||||
global $user;
|
||||
if ($user->can(Permissions::TIPS_ADMIN)) {
|
||||
@@ -116,12 +116,12 @@ class Tips extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
private function manageTips(): void
|
||||
private function manageTips()
|
||||
{
|
||||
$data_href = get_base_href();
|
||||
$url = $data_href."/ext/tips/images/";
|
||||
|
||||
$dirPath = dir_ex('./ext/tips/images');
|
||||
$dirPath = dir('./ext/tips/images');
|
||||
$images = [];
|
||||
while (($file = $dirPath->read()) !== false) {
|
||||
if ($file[0] != ".") {
|
||||
@@ -134,18 +134,18 @@ class Tips extends Extension
|
||||
$this->theme->manageTips($url, $images);
|
||||
}
|
||||
|
||||
public function onCreateTip(CreateTipEvent $event): void
|
||||
public function onCreateTip(CreateTipEvent $event)
|
||||
{
|
||||
global $database;
|
||||
$database->execute(
|
||||
"
|
||||
INSERT INTO tips (enable, image, text)
|
||||
VALUES (:enable, :image, :text)",
|
||||
["enable" => $event->enable, "image" => $event->image, "text" => $event->text]
|
||||
["enable"=>$event->enable, "image"=>$event->image, "text"=>$event->text]
|
||||
);
|
||||
}
|
||||
|
||||
private function getTip(): void
|
||||
private function getTip()
|
||||
{
|
||||
global $database;
|
||||
|
||||
@@ -158,14 +158,14 @@ class Tips extends Extension
|
||||
WHERE enable = :true
|
||||
ORDER BY RAND()
|
||||
LIMIT 1
|
||||
", ["true" => true]);
|
||||
", ["true"=>true]);
|
||||
|
||||
if ($tip) {
|
||||
$this->theme->showTip($url, $tip);
|
||||
}
|
||||
}
|
||||
|
||||
private function getAll(): void
|
||||
private function getAll()
|
||||
{
|
||||
global $database;
|
||||
|
||||
@@ -177,20 +177,20 @@ class Tips extends Extension
|
||||
$this->theme->showAll($url, $tips);
|
||||
}
|
||||
|
||||
private function setStatus(int $tipID): void
|
||||
private function setStatus(int $tipID)
|
||||
{
|
||||
global $database;
|
||||
|
||||
$tip = $database->get_row("SELECT * FROM tips WHERE id = :id ", ["id" => $tipID]);
|
||||
$tip = $database->get_row("SELECT * FROM tips WHERE id = :id ", ["id"=>$tipID]);
|
||||
|
||||
$enable = bool_escape($tip['enable']);
|
||||
|
||||
$database->execute("UPDATE tips SET enable = :enable WHERE id = :id", ["enable" => $enable, "id" => $tipID]);
|
||||
$database->execute("UPDATE tips SET enable = :enable WHERE id = :id", ["enable"=>$enable, "id"=>$tipID]);
|
||||
}
|
||||
|
||||
public function onDeleteTip(DeleteTipEvent $event): void
|
||||
public function onDeleteTip(DeleteTipEvent $event)
|
||||
{
|
||||
global $database;
|
||||
$database->execute("DELETE FROM tips WHERE id = :id", ["id" => $event->tip_id]);
|
||||
$database->execute("DELETE FROM tips WHERE id = :id", ["id"=>$event->tip_id]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user