Merge branch 'develop' into add-email-support
This commit is contained in:
commit
435d893b4e
6 changed files with 240 additions and 82 deletions
22
.github/workflows/ftp-deploy-develop.yml
vendored
Normal file
22
.github/workflows/ftp-deploy-develop.yml
vendored
Normal 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
22
.github/workflows/ftp-deploy-stable.yml
vendored
Normal 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 }}
|
|
@ -218,6 +218,7 @@ p .ui.horizontal.label {
|
|||
.pusher {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.pusher .menu.toggle {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ class EmbedCache
|
|||
$info_simplified->url = $this->url;
|
||||
|
||||
if ($generateCache) {
|
||||
try {
|
||||
$info = $embed->get($this->url);
|
||||
|
||||
$info_simplified->authorName = (string) $info->authorName;
|
||||
|
@ -82,7 +81,7 @@ class EmbedCache
|
|||
$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->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;
|
||||
|
@ -93,6 +92,8 @@ class EmbedCache
|
|||
$info_simplified->redirect = (string) $info->redirect;
|
||||
$info_simplified->title = (string) $info->title;
|
||||
$info_simplified->url = (string) $info->url;
|
||||
|
||||
try {
|
||||
} catch (\Throwable $ex) {
|
||||
$generateCache = false;
|
||||
|
||||
|
|
|
@ -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,29 +310,15 @@ 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 } ?>
|
||||
|
||||
<?php
|
||||
foreach ($pagesAccount as $item) {
|
||||
?>
|
||||
<?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 } ?>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -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 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 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 (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
|
||||
<?= $page['text'] ?>
|
||||
|
||||
<i class="dropdown icon"></i>
|
||||
|
||||
<div class="menu">
|
||||
<?php
|
||||
if (count($pagesAccount) >= 2) {
|
||||
foreach ($pagesAccount as $item) {
|
||||
?>
|
||||
<?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>
|
||||
<?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
59
src/pages/settings.php
Normal 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();
|
||||
?>
|
Loading…
Reference in a new issue