Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit fb6506d

Browse files
committed
💅 chevereto news
1 parent 86e50ec commit fb6506d

File tree

7 files changed

+125
-15
lines changed

7 files changed

+125
-15
lines changed

app/install/installer.php

+3-7
Original file line numberDiff line numberDiff line change
@@ -292,28 +292,24 @@
292292
'1.5.0' => null,
293293
'1.5.1' => null,
294294
'1.6.0' => null,
295+
'1.6.1' => [
296+
'chevereto_news' => 'a:0:{}',
297+
],
295298
];
296-
// Settings that must be renamed from NAME to NEW NAME and DELETE old NAME
297299
$settings_rename = [];
298-
299-
// Settings that must be renamed from NAME to NEW NAME and doesn't delete old NAME
300300
$settings_switch = [];
301-
302301
$chv_initial_settings = [];
303302
foreach ($settings_updates as $k => $v) {
304303
if (is_null($v)) {
305304
continue;
306305
}
307306
$chv_initial_settings += $v;
308307
}
309-
310-
// Detect 2.X
311308
try {
312309
$is_2X = DB::get('info', ['key' => 'version']) ? true : false;
313310
} catch (Exception $e) {
314311
$is_2X = false;
315312
}
316-
317313
/* Stats query from 3.7.0 up to 3.8.13 */
318314
$stats_query_legacy = 'TRUNCATE TABLE `%table_prefix%stats`;
319315

app/lib/classes/class.settings.php

+2
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ public function __construct()
171171
'moderatecontent_block_rating' => 'a',
172172
'moderatecontent_flag_nsfw' => 'a',
173173
'moderate_uploads' => '', // ,
174+
// 3.20.13
175+
'chevereto_news' => 'a:0:{}',
174176
];
175177

176178
$device_to_columns = [

app/lib/functions.php

+12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use G;
1818
use DirectoryIterator;
1919
use Exception;
20+
use Throwable;
2021

2122
if (!defined('access') or !access) {
2223
die('This file cannot be directly accessed.');
@@ -817,6 +818,17 @@ function checkUpdates()
817818
} // Silence
818819
}
819820

821+
function updateCheveretoNews() {
822+
try {
823+
$chevereto_news = G\fetch_url('https://blog.chevereto.com/feed.json');
824+
$chevereto_news = json_decode($chevereto_news)->items;
825+
Settings::update(['chevereto_news' => serialize($chevereto_news)]);
826+
} catch(Throwable $e) {
827+
$chevereto_news = [];
828+
}
829+
return $chevereto_news;
830+
}
831+
820832
function obfuscate($string)
821833
{
822834
$len = strlen($string);

app/routes/route.dashboard.php

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@
112112
}
113113

114114
$db = CHV\DB::getInstance();
115+
116+
$chevereto_news = unserialize(CHV\Settings::get('chevereto_news'));
117+
if(!is_array($chevereto_news) || $chevereto_news === []) {
118+
$chevereto_news = CHV\updateCheveretoNews();
119+
}
120+
$handler::setVar('chevereto_news', $chevereto_news);
115121

116122
$chv_version = [
117123
'files' => G\get_app_version(),

app/themes/Peafowl/style.css

+73
Original file line numberDiff line numberDiff line change
@@ -2390,4 +2390,77 @@ body.full--wh {
23902390

23912391
body#index.landing [data-action=top-bar-tone] {
23922392
display: none;
2393+
}
2394+
2395+
.card-wrapper {
2396+
height: 175px;
2397+
overflow-y: hidden;
2398+
overflow-x: auto;
2399+
}
2400+
2401+
.card-slider {
2402+
width: calc(310px * 8);
2403+
}
2404+
2405+
.card-container {
2406+
width: 300px;
2407+
height: 200px;
2408+
display: block;
2409+
float: left;
2410+
margin: 0 5px;
2411+
}
2412+
2413+
.card-container:first-child {
2414+
margin-left: 0;
2415+
}
2416+
2417+
.card-container:last-child {
2418+
margin-right: 0;
2419+
}
2420+
2421+
.card {
2422+
width: 100%;
2423+
position: relative;
2424+
}
2425+
2426+
.card a {
2427+
text-decoration: none;
2428+
}
2429+
2430+
.card-header-image {
2431+
width: 100%;
2432+
height: 150px;
2433+
overflow: hidden;
2434+
border-radius: 1em;
2435+
display: block;
2436+
background-size: cover;
2437+
background-position: center;
2438+
}
2439+
2440+
.card-header-image-mask {
2441+
width: 100%;
2442+
height: 100%;
2443+
display: block;
2444+
background-color: rgba(0, 0, 0, 0);
2445+
}
2446+
2447+
.card-header-image:hover .card-header-image-mask {
2448+
background-color: rgba(35, 168, 224, .8);
2449+
}
2450+
2451+
.card-text {
2452+
color: #FFF;
2453+
text-align: center;
2454+
position: absolute;
2455+
top: 50%;
2456+
left: 50%;
2457+
transform: translate(-50%, -50%);
2458+
width: 80%;
2459+
text-shadow: 2px 2px 4px rgba(0, 0, 0, .35);
2460+
}
2461+
2462+
.card-text h3 {
2463+
font-weight: bold;
2464+
font-size: 1.6em;
2465+
margin-bottom: 5px;
23932466
}

app/themes/Peafowl/style.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/themes/Peafowl/views/dashboard.php

+28-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function get_docs_link($key, $subject)
3939
<p><?php _se("Make sure that you address this issue as the system relies on accurate IP detections to provide basic functionalities and to protect against spam, flooding, and brute force attacks."); ?></p>
4040
</div>
4141
<div class="dashboard-group">
42-
<div class="overflow-auto text-align-center margin-top-20">
42+
<div class="overflow-auto text-align-center margin-top-20 margin-bottom-40">
4343
<a href="<?php echo G\get_base_url('dashboard/images'); ?>" class="stats-block c6 fluid-column display-inline-block" <?php if (get_totals()['images'] > 999999) {
4444
echo ' rel="tooltip" data-tipTip="top" title="' . number_format(get_totals()['images']) . '"';
4545
} ?>>
@@ -72,19 +72,40 @@ function get_docs_link($key, $subject)
7272
</div>
7373
</div>
7474

75+
<div class="header header-tabs no-select">
76+
<h2><i class="icon icon-rss"></i> <?php _se('%s News', 'Chevereto'); ?></h2>
77+
</div>
78+
79+
<div class="card-wrapper margin-bottom-40">
80+
<div class="card-slider">
81+
<?php foreach(array_slice(get_chevereto_news(), 0, 8) as $k => $v) {
82+
echo strtr('<article class="card-container">
83+
<div class="card">
84+
<a class="card-header-image" href="%url%" target="_blank" style="background-image: url(%image%);">
85+
<span class="animate card-header-image-mask"></span>
86+
<span class="card-text">
87+
<h3>%title%</h3>
88+
<span>%summary%</span>
89+
</span>
90+
</a>
91+
</div>
92+
</article>' . "\n", [
93+
'%url%' => $v->url,
94+
'%image%' => $v->image,
95+
'%title%' => $v->title,
96+
'%summary%' => $v->summary,
97+
]);
98+
} ?>
99+
</div>
100+
</div>
101+
75102
<ul class="tabbed-content-list table-li margin-top-20">
76103
<li>
77104
<span class="c6 display-table-cell padding-right-10">GitHub<span style="opacity: 0;">:</span></span>
78105
<span class="display-table-cell vertical-align-middle" style="line-height: 1;">
79106
<a class="github-button" href="https://github.com/rodber/chevereto-free/subscription" data-icon="octicon-eye" data-size="large" data-show-count="true" aria-label="Watch rodber/chevereto-free on GitHub">Watch</a>
80107
<a class="github-button" href="https://github.com/rodber/chevereto-free" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star rodber/chevereto-free on GitHub">Star</a>
81108
</span>
82-
<div class="highlight padding-5 margin-top-10 margin-bottom-10">Chevereto-Free project ownership will be <b>transferred</b> to <a href="https://github.com/rodber" target="_blank">rodber</a> on <b>2021-10</b>.
83-
<ul class="list-style-type-disc padding-left-20">
84-
<li>The Chevereto organization won't be longer involved with the development of this project.</li>
85-
<li>The project repository will be available at <a href="https://github.com/rodber/chevereto-free" target="_blank">rodber/chevereto-free</a>.</li>
86-
</ul>
87-
</div>
88109
</li>
89110
<?php
90111
foreach (get_system_values() as $v) {

0 commit comments

Comments
 (0)