Merge branch 'develop' into add-email-support

This commit is contained in:
Jay Trees 2022-03-01 09:47:19 +01:00
commit 435d893b4e
6 changed files with 240 additions and 82 deletions

View file

@ -0,0 +1,22 @@
name: Deploy to dev.wishthis.online
on:
push:
branches:
- 'develop'
jobs:
web-deploy:
name: 🎉 Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v2
- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@4.3.0
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
protocol: ftp
port: 21
server-dir: ${{ secrets.DEV_FTP_DIR }}

22
.github/workflows/ftp-deploy-stable.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Deploy to wishthis.online
on:
push:
branches:
- 'stable'
jobs:
web-deploy:
name: 🎉 Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v2
- name: 📂 Sync files
uses: SamKirkland/FTP-Deploy-Action@4.3.0
with:
server: ${{ secrets.FTP_HOST }}
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
protocol: ftp
port: 21
server-dir: ${{ secrets.FTP_DIR }}

View file

@ -218,6 +218,7 @@ p .ui.horizontal.label {
.pusher {
min-height: 100vh;
}
.pusher .menu.toggle {
display: none;
}

View file

@ -71,28 +71,29 @@ class EmbedCache
$info_simplified->url = $this->url;
if ($generateCache) {
try {
$info = $embed->get($this->url);
$info = $embed->get($this->url);
$info_simplified->authorName = (string) $info->authorName;
$info_simplified->authorUrl = (string) $info->authorUrl;
$info_simplified->cms = (string) $info->cms;
$info_simplified->code = (string) $info->code;
$info_simplified->description = (string) $info->description;
$info_simplified->favicon = (string) $info->favicon;
$info_simplified->feeds = (array) $info->feeds;
$info_simplified->icon = (string) $info->icon;
$info_simplified->image = (string) $info->image;
$info_simplified->keywords = (array) $info->keywords;
$info_simplified->language = (string) $info->language;
$info_simplified->languages = (array) $info->languages;
$info_simplified->license = (string) $info->license;
$info_simplified->providerName = (string) $info->providerName;
$info_simplified->providerUrl = (string) $info->providerUrl;
$info_simplified->publishedTime = $info->publishedTime ? $info->publishedTime->format('d.m.Y') : '';
$info_simplified->redirect = (string) $info->redirect;
$info_simplified->title = (string) $info->title;
$info_simplified->url = (string) $info->url;
$info_simplified->authorName = (string) $info->authorName;
$info_simplified->authorUrl = (string) $info->authorUrl;
$info_simplified->cms = (string) $info->cms;
$info_simplified->code = (string) $info->code;
$info_simplified->description = (string) $info->description;
$info_simplified->favicon = (string) $info->favicon;
$info_simplified->feeds = (array) $info->feeds;
$info_simplified->icon = (string) $info->icon;
$info_simplified->image = $info->image ? (string) $info->image : $this->noImage;
$info_simplified->keywords = (array) $info->keywords;
$info_simplified->language = (string) $info->language;
$info_simplified->languages = (array) $info->languages;
$info_simplified->license = (string) $info->license;
$info_simplified->providerName = (string) $info->providerName;
$info_simplified->providerUrl = (string) $info->providerUrl;
$info_simplified->publishedTime = $info->publishedTime ? $info->publishedTime->format('d.m.Y') : '';
$info_simplified->redirect = (string) $info->redirect;
$info_simplified->title = (string) $info->title;
$info_simplified->url = (string) $info->url;
try {
} catch (\Throwable $ex) {
$generateCache = false;

View file

@ -233,31 +233,73 @@ class Page
{
$user = new User();
$pagesAccount = array();
$pages = array(
'wishlists' => array(
'text' => 'Wishlists',
'alignment' => 'left',
'items' => array(
array(
'url' => '/?page=wishlists',
'text' => 'My lists',
'icon' => 'list',
)
),
),
'system' => array(
'text' => 'System',
'icon' => 'wrench',
'alignment' => 'right',
'items' => array(
array(
'url' => '/?page=settings',
'text' => 'Settings',
'icon' => 'cog',
),
),
),
'account' => array(
'text' => 'Account',
'icon' => 'user circle',
'alignment' => 'right',
'items' => array(),
),
);
if ($user && $user->isLoggedIn()) {
if (100 === $user->power) {
$pagesAccount[] = array(
$pages['account']['items'][] = array(
'url' => '/?page=login-as',
'icon' => 'sign out alternate',
'text' => 'Login as',
'icon' => 'sign out alternate',
);
}
$pagesAccount[] = array(
$pages['account']['items'][] = array(
'url' => '/?page=logout',
'icon' => 'sign out alternate',
'text' => 'Logout',
'icon' => 'sign out alternate',
);
} else {
$pagesAccount[] = array(
$pages['account']['items'][] = array(
'url' => '/?page=login',
'icon' => 'sign in alternate',
'text' => 'Login',
'icon' => 'sign in alternate',
);
$pagesAccount[] = array(
$pages['account']['items'][] = array(
'url' => '/?page=register',
'icon' => 'user plus alternate',
'text' => 'Register',
'icon' => 'user plus alternate',
);
}
global $options;
if ($options->updateAvailable && $user && 100 === $user->power) {
$pages['system']['items'][] = array(
array(
'url' => '/?page=update',
'text' => 'Update',
'icon' => 'upload',
),
);
}
?>
@ -268,30 +310,16 @@ class Page
<a class="item home" href="/?page=home">
<img src="/src/assets/img/logo.svg" alt="wishthis logo" />
</a>
<a class="item" href="/?page=wishlists">
<i class="list icon"></i>
My lists
</a>
<?php global $options; ?>
<?php if ($options->updateAvailable && $user && 100 === $user->power) { ?>
<a class="item" href="/?page=update">
<i class="upload icon"></i> Update
</a>
<?php foreach ($pages as $page) { ?>
<?php foreach ($page['items'] as $item) { ?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php } ?>
<?php } ?>
<?php
foreach ($pagesAccount as $item) {
?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php
}
?>
</div>
<?= $this->footer() ?>
@ -303,45 +331,70 @@ class Page
<a class="item home" href="/?page=home">
<img src="/src/assets/img/logo.svg" />
</a>
<a class="item" href="/?page=wishlists">
<i class="list icon"></i>
My lists
</a>
<div class="right menu">
<?php global $options; ?>
<?php foreach ($pages as $page) { ?>
<?php if ('left' === $page['alignment']) { ?>
<?php if (count($page['items']) > 1) { ?>
<div class="ui simple dropdown item">
<?php if (isset($page['icon'])) { ?>
<i class="<?= $page['icon'] ?> icon"></i>
<?php } ?>
<?php if ($options->updateAvailable && $user && 100 === $user->power) { ?>
<a class="item" href="/?page=update">
<i class="upload icon"></i> Update
</a>
<?php } ?>
<?= $page['text'] ?>
<?php if (count($pagesAccount) === 1) { ?>
<a class="item" href="<?= $pagesAccount[0]['url'] ?>">
<i class="<?= $pagesAccount[0]['icon'] ?> icon"></i>
<?= $pagesAccount[0]['text'] ?>
</a>
<?php } elseif (count($pagesAccount) >= 2) { ?>
<div class="ui simple dropdown item">
<i class="user circle icon"></i>
Account
<i class="dropdown icon"></i>
<div class="menu">
<?php
if (count($pagesAccount) >= 2) {
foreach ($pagesAccount as $item) {
?>
<i class="dropdown icon"></i>
<div class="menu">
<?php foreach ($page['items'] as $item) { ?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php
}
}
?>
<?php } ?>
</div>
</div>
</div>
<?php } else { ?>
<?php foreach ($page['items'] as $item) { ?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<div class="right menu">
<?php foreach ($pages as $page) { ?>
<?php if ('right' === $page['alignment']) { ?>
<?php if (count($page['items']) > 1) { ?>
<div class="ui simple dropdown item">
<?php if (isset($page['icon'])) { ?>
<i class="<?= $page['icon'] ?> icon"></i>
<?php } ?>
<?= $page['text'] ?>
<i class="dropdown icon"></i>
<div class="menu">
<?php foreach ($page['items'] as $item) { ?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php } ?>
</div>
</div>
<?php } else { ?>
<?php foreach ($page['items'] as $item) { ?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>

59
src/pages/settings.php Normal file
View file

@ -0,0 +1,59 @@
<?php
/**
* The settings page.
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
use wishthis\Page;
$page = new page(__FILE__, 'Settings');
$page->header();
$page->bodyStart();
$page->navigation();
if (isset($_POST['mjml_api'], $_POST['api_key'], $_POST['api_secret'])) {
$options->setOption('mjml_api_key', $_POST['api_key']);
$options->setOption('mjml_api_secret', $_POST['api_secret']);
}
?>
<main>
<div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1>
<div class="ui segment">
<h2 class="ui header">MJML</h2>
<p>MJML is required for sending emails. Visit <a href="https://mjml.io/api" target="_blank">https://mjml.io/api</a> to request API access.</p>
<h3 class="ui header">API</h3>
<form class="ui form" method="POST">
<div class="field">
<label>Key</label>
<input type="text"
name="api_key"
placeholder="01234567-89ab-cdef-0123-456789abcdef"
value="<?= $options->getOption('mjml_api_key'); ?>"
/>
</div>
<div class="field">
<label>Secret</label>
<input type="text"
name="api_secret"
placeholder="01234567-89ab-cdef-0123-456789abcdef"
value="<?= $options->getOption('mjml_api_secret'); ?>"
/>
</div>
<input class="ui primary button" type="submit" name="mjml_api" value="Save" />
</form>
</div>
</div>
</main>
<?php
$page->footer();
$page->bodyEnd();
?>