-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanime-ongoing.xml
187 lines (154 loc) · 7.11 KB
/
anime-ongoing.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?xml version="1.0" encoding="utf-8"?>
<dleplugin>
<name>Anime ongoing</name>
<description>API Shikimori</description>
<icon></icon>
<version></version>
<dleversion>13</dleversion>
<versioncompare>greater</versioncompare>
<upgradeurl></upgradeurl>
<filedelete>1</filedelete>
<needplugin></needplugin>
<mnotice>0</mnotice>
<mysqlinstall><![CDATA[]]></mysqlinstall>
<mysqlupgrade><![CDATA[]]></mysqlupgrade>
<mysqlenable><![CDATA[]]></mysqlenable>
<mysqldisable><![CDATA[]]></mysqldisable>
<mysqldelete><![CDATA[]]></mysqldelete>
<phpinstall><![CDATA[]]></phpinstall>
<phpupgrade><![CDATA[]]></phpupgrade>
<phpenable><![CDATA[]]></phpenable>
<phpdisable><![CDATA[]]></phpdisable>
<phpdelete><![CDATA[]]></phpdelete>
<notice><![CDATA[]]></notice>
<file name="engine/engine.php">
<operation action="after">
<searchcode><![CDATA[switch ( $do ) {]]></searchcode>
<replacecode><![CDATA[case "ongoing":
include (DLEPlugins::Check(ENGINE_DIR . '/modules/ongoing.php'));
break;]]></replacecode>
</operation>
<operation action="after">
<searchcode><![CDATA[elseif ($do == 'tags') $nam_e = stripslashes($tag);]]></searchcode>
<replacecode><![CDATA[elseif ($do == 'ongoing') $nam_e = "Календарь онгоингов";]]></replacecode>
</operation>
</file>
<file name="engine/modules/ongoing.php">
<operation action="create">
<replacecode><![CDATA[<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking attempt!" );
}
$is_change = false;
$css_array[] = "templates/{$config['skin']}/css/ongoing.css";
if (!$config['allow_cache']) { $config['allow_cache'] = 1; $is_change = true;}
$calAnime_json = get_vars( "json_anime" );
if( ! $calAnime_json ) {
$calAnime = file_get_contents('https://shikimori.one/api/calendar');
$calAnime_json = json_decode($calAnime, true);
set_vars ( "json_anime", $calAnime_json );
}
function shiki_cals() {
global $anime_info, $langdate, $arr_date, $config;
$arr_color = array(
'red',
'pink',
'blue',
'green',
'orange',
'brown',
'powderblue',
'skyblue',
'purple',
'magenta',
'brown'
);
$buffer = '<div id="ongoing-calendar">';
$buffer .= '<header class="head"><h1>Календарь онгоингов</h1><div class="notice"><p>Данный раздел отображает аниме онгоинги текущего сезона и близлежащие анонсы.</p><p>Выходы серий отслеживаются автоматически по <a href="https://shikimori.org/ongoings">API Shikimori</a>.</p></div></header>';
foreach( $anime_info as $key => $row ) {
$get_rand_color = array_rand($arr_color, 1);
$date = strtotime($row[0]['next_episode_at']);
if( $key == 'now' ) $buffer .= '<div class="block '. $arr_color[$get_rand_color] . ' clrfix"><div class="headline">УЖЕ ДОЛЖНО БЫЛО ВЫЙТИ <span class="count-ognoing">'.$arr_date[$key].'</span></div><div class="cc-entries d-cutted_covers" data-dynamic="cutted_covers" id="cutted_covers_3">';
else $buffer .= '<div class="block '. $arr_color[$get_rand_color] . ' clrfix"><div class="headline">'.$langdate[date('l', $date)].', '.date('j', $date).' '.$langdate[date('F', $date)].' <span class="count-ognoing">'.$arr_date[$key].'</span></div><div class="cc-entries d-cutted_covers" data-dynamic="cutted_covers" id="cutted_covers_3">';
foreach($row as $animes) {
$next_episode_tmp = strtotime($animes['next_episode_at']);
$date = langdate( 'j-m-Y, H:i', $next_episode_tmp );
$name = $animes['anime']['russian'] ? $animes['anime']['russian'] : $animes['anime']['name'];
if( $config['image_lazy'] ) $img = " data-src=\"https://shikimori.org{$animes['anime']['image']['preview']}\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" style=\"min-height: 224px; min-width: 160px;\"";
else $img = " src=\"https://shikimori.org{$animes['anime']['image']['preview']}\"";
$buffer .= <<<HTML
<article class="c-column b-catalog_entry c-anime" itemscope="" itemtype="http://schema.org/Movie">
<a class="cover anime-tooltip-processed" href="https://shikimori.org{$animes['anime']['url']}">
<span class="image-decor">
<span class="image-cutter">
<img alt="{$animes['anime']['name']}"{$img}>
</span>
</span>
<span class="title left_aligned" itemprop="name">
<span>{$name}</span>
</span>
<span class="misc">
<span class="right">с {$date}</span>
<span class="left">{$animes['next_episode']} эпизод</span>
</span>
</a>
<span class="c-anime-action" data-name="{$animes['anime']['name']}" onclick="ongoing_find(this); return false;">
<svg id="icon-horizontal-ellipsis" viewBox="0 0 24 24">
<path d="m12 16c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm0-2c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm0-6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z" transform="matrix(0 1 -1 0 24 0)"></path>
</svg>
</span>
</article>
HTML;
}
$buffer .= '</div></div>';
}
return $buffer . '</div>';
}
$arr_date = array();
$anime_info = array();
$anime_info['now'] = array();
foreach( $calAnime_json as $value ) {
$time = strtotime($value['next_episode_at']);
if( time() > $time ) {
if( isset($arr_date['now']) ) $arr_date['now']++;
else $arr_date['now'] = 1;
$anime_info['now'][] = $value;
} else {
if( isset($arr_date[date('j', $time)]) ) $arr_date[date('j', $time)]++;
else $arr_date[date('j', $time)] = 1;
$anime_info[date('j', $time)][] = $value;
}
}
if( !count($anime_info['now']) ) unset($anime_info['now']);
$tpl->result['content'] = shiki_cals( $this_month, $this_year, $events );
if ($is_change) $config['allow_cache'] = false;
?>]]></replacecode>
</operation>
</file>
<file name="engine/modules/cron.php">
<operation action="after">
<searchcode><![CDATA[$db->query( "DELETE FROM " . PREFIX . "_spam_log WHERE is_spammer = '0'" );]]></searchcode>
<replacecode><![CDATA[@unlink( ENGINE_DIR . '/cache/system/json_anime.php' );]]></replacecode>
</operation>
<operation action="before">
<searchcode><![CDATA[clear_cache();]]></searchcode>
<replacecode><![CDATA[@unlink( ENGINE_DIR . '/cache/system/json_anime.php' );]]></replacecode>
</operation>
</file>
<file name="engine/ajax/find_relates.php">
<operation action="after">
<searchcode><![CDATA[$mode = intval( $_POST['mode'] );]]></searchcode>
<replacecode><![CDATA[$ac_f = intval( $_POST['accuracy_find'] );]]></replacecode>
</operation>
<operation action="after">
<searchcode><![CDATA[else $where = "";]]></searchcode>
<replacecode><![CDATA[if( $ac_f ) {
$db->query( "SELECT id, title, date, category, alt_name FROM " . PREFIX . "_post WHERE (title = '{$title}' OR xfields LIKE '%{$title}%') AND approve='1'" . $where . " ORDER BY date DESC LIMIT 5" );
} else {]]></replacecode>
</operation>
<operation action="before">
<searchcode><![CDATA[while ( $related = $db->get_row() ) {]]></searchcode>
<replacecode><![CDATA[}]]></replacecode>
</operation>
</file>
</dleplugin>