Browse Source

Proof-of-concept for Twig template support

biotorrents 4 years ago
parent
commit
d08781bc91

+ 2
- 24
classes/torrent_form.class.php View File

128
     public function uploadNotice()
128
     public function uploadNotice()
129
     {
129
     {
130
         if ($this->NewTorrent) {
130
         if ($this->NewTorrent) {
131
-            $HTML = <<<HTML
132
-            <aside class="upload_notice">
133
-              <p>
134
-                Please consult the
135
-                <a href="/rules.php?p=upload">Upload Rules</a>
136
-                and the
137
-                <a href="/wiki.php?action=article&name=categories">Categories Wiki</a>
138
-                to help fill out the upload form correctly.
139
-              </p>
140
-
141
-              <p>
142
-                The site adds the Announce and Source automatically.
143
-                Just download and seed the new torrent after uploading it.
144
-
145
-              <!--
146
-              <strong>
147
-                If you never have before, be sure to read this list of
148
-                <a href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a>.
149
-              </strong>
150
-              -->
151
-              </p>
152
-            </aside>
153
-HTML;
131
+            $Twig  = Twig::go();
132
+            echo $Twig->render('torrent_form/upload_notice.html');
154
         } # fi NewTorrent
133
         } # fi NewTorrent
155
-        return $HTML;
156
     }
134
     }
157
 
135
 
158
 
136
 

+ 262
- 0
classes/twig.class.php View File

1
+<?php
2
+declare(strict_types=1);
3
+
4
+/**
5
+ * Twig class
6
+ *
7
+ * Converted to a singleton class like $ENV.
8
+ * One instance should only ever exist,
9
+ * because of its separate disk cache system.
10
+ *
11
+ * Based on OPS's useful rule set:
12
+ * https://github.com/OPSnet/Gazelle/blob/master/app/Util/Twig.php
13
+ */
14
+
15
+class Twig
16
+{
17
+    /**
18
+     * Singleton stuff
19
+     */
20
+
21
+    private static $Twig = null;
22
+
23
+    private function __construct()
24
+    {
25
+        return;
26
+    }
27
+
28
+    public function __clone()
29
+    {
30
+        return trigger_error(
31
+            'clone() not allowed',
32
+            E_USER_ERROR
33
+        );
34
+    }
35
+
36
+    public static function go()
37
+    {
38
+        return (self::$Twig === null)
39
+            ? self::$Twig = Twig::factory()
40
+            : self::$Twig;
41
+    }
42
+
43
+
44
+    /**
45
+     * factory
46
+     */
47
+
48
+    private static function factory(): \Twig\Environment
49
+    {
50
+        $ENV = ENV::go();
51
+        $twig = new \Twig\Environment(
52
+            new \Twig\Loader\FilesystemLoader("$ENV->SERVER_ROOT/templates"),
53
+            [
54
+                'auto_reload' => true,
55
+                'autoescape' => 'html',
56
+                'cache' => "$ENV->WEB_ROOT/cache/twig"
57
+                #'debug' => DEBUG_MODE,
58
+        ]
59
+        );
60
+
61
+        $twig->addFilter(new \Twig\TwigFilter(
62
+            'article',
63
+            function ($word) {
64
+                return preg_match('/^[aeiou]/i', $word) ? 'an' : 'a';
65
+            }
66
+        ));
67
+
68
+        $twig->addFilter(new \Twig\TwigFilter(
69
+            'b64',
70
+            function (string $binary) {
71
+                return base64_encode($binary);
72
+            }
73
+        ));
74
+
75
+        $twig->addFilter(new \Twig\TwigFilter(
76
+            'bb_format',
77
+            function ($text) {
78
+                return new \Twig\Markup(\Text::full_format($text), 'UTF-8');
79
+            }
80
+        ));
81
+
82
+        $twig->addFilter(new \Twig\TwigFilter(
83
+            'checked',
84
+            function ($isChecked) {
85
+                return $isChecked ? ' checked="checked"' : '';
86
+            }
87
+        ));
88
+
89
+        $twig->addFilter(new \Twig\TwigFilter(
90
+            'image',
91
+            function ($i) {
92
+                return new \Twig\Markup(\ImageTools::process($i, true), 'UTF-8');
93
+            }
94
+        ));
95
+
96
+        $twig->addFilter(new \Twig\TwigFilter(
97
+            'ipaddr',
98
+            function ($ipaddr) {
99
+                return new \Twig\Markup(\Tools::display_ip($ipaddr), 'UTF-8');
100
+            }
101
+        ));
102
+
103
+        $twig->addFilter(new \Twig\TwigFilter(
104
+            'octet_size',
105
+            function ($size, array $option = []) {
106
+                return \Format::get_size($size, empty($option) ? 2 : $option[0]);
107
+            },
108
+            ['is_variadic' => true]
109
+        ));
110
+
111
+        $twig->addFilter(new \Twig\TwigFilter(
112
+            'plural',
113
+            function ($number) {
114
+                return plural($number);
115
+            }
116
+        ));
117
+
118
+        $twig->addFilter(new \Twig\TwigFilter(
119
+            'selected',
120
+            function ($isSelected) {
121
+                return $isSelected ? ' selected="selected"' : '';
122
+            }
123
+        ));
124
+
125
+        $twig->addFilter(new \Twig\TwigFilter(
126
+            'shorten',
127
+            function (string $text, int $length) {
128
+                return shortenString($text, $length);
129
+            }
130
+        ));
131
+
132
+        $twig->addFilter(new \Twig\TwigFilter(
133
+            'time_diff',
134
+            function ($time) {
135
+                return new \Twig\Markup(time_diff($time), 'UTF-8');
136
+            }
137
+        ));
138
+
139
+        $twig->addFilter(new \Twig\TwigFilter(
140
+            'ucfirst',
141
+            function ($text) {
142
+                return ucfirst($text);
143
+            }
144
+        ));
145
+
146
+        $twig->addFilter(new \Twig\TwigFilter(
147
+            'ucfirstall',
148
+            function ($text) {
149
+                return implode(' ', array_map(function ($w) {
150
+                    return ucfirst($w);
151
+                }, explode(' ', $text)));
152
+            }
153
+        ));
154
+
155
+        $twig->addFilter(new \Twig\TwigFilter(
156
+            'user_url',
157
+            function ($userId) {
158
+                return new \Twig\Markup(\Users::format_username($userId, false, false, false), 'UTF-8');
159
+            }
160
+        ));
161
+
162
+        $twig->addFilter(new \Twig\TwigFilter(
163
+            'user_full',
164
+            function ($userId) {
165
+                return new \Twig\Markup(\Users::format_username($userId, true, true, true, true), 'UTF-8');
166
+            }
167
+        ));
168
+
169
+        $twig->addFunction(new \Twig\TwigFunction('donor_icon', function ($icon, $userId) {
170
+            return new \Twig\Markup(
171
+                \ImageTools::process($icon, false, 'donoricon', $userId),
172
+                'UTF-8'
173
+            );
174
+        }));
175
+
176
+        $twig->addFunction(new \Twig\TwigFunction('privilege', function ($default, $config, $key) {
177
+            return new \Twig\Markup(
178
+                (
179
+                    $default
180
+                    ? sprintf(
181
+                        '<input id="%s" type="checkbox" disabled="disabled"%s />&nbsp;',
182
+                        "default_$key",
183
+                        (isset($default[$key]) && $default[$key] ? ' checked="checked"' : '')
184
+                    )
185
+                    : ''
186
+                )
187
+                . sprintf(
188
+                    '<input type="checkbox" name="%s" id="%s" value="1"%s />&nbsp;<label title="%s" for="%s">%s</label><br />',
189
+                    "perm_$key",
190
+                    $key,
191
+                    (empty($config[$key]) ? '' : ' checked="checked"'),
192
+                    $key,
193
+                    $key,
194
+                    \Permissions::list()[$key] ?? "!unknown($key)!"
195
+                ),
196
+                'UTF-8'
197
+            );
198
+        }));
199
+
200
+        $twig->addFunction(new \Twig\TwigFunction('ratio', function ($up, $down) {
201
+            return new \Twig\Markup(
202
+                \Format::get_ratio_html($up, $down),
203
+                'UTF-8'
204
+            );
205
+        }));
206
+
207
+        $twig->addFunction(new \Twig\TwigFunction('resolveCountryIpv4', function ($addr) {
208
+            return new \Twig\Markup(
209
+                (function ($ip) {
210
+                    static $cache = [];
211
+                    if (!isset($cache[$ip])) {
212
+                        $Class = strtr($ip, '.', '-');
213
+                        $cache[$ip] = '<span class="cc_'.$Class.'">Resolving CC...'
214
+                            . '<script type="text/javascript">'
215
+                                . '$(document).ready(function() {'
216
+                                    . '$.get(\'tools.php?action=get_cc&ip='.$ip.'\', function(cc) {'
217
+                                        . '$(\'.cc_'.$Class.'\').html(cc);'
218
+                                    . '});'
219
+                                . '});'
220
+                            . '</script></span>';
221
+                    }
222
+                    return $cache[$ip];
223
+                })($addr),
224
+                'UTF-8'
225
+            );
226
+        }));
227
+
228
+        $twig->addFunction(new \Twig\TwigFunction('resolveIpv4', function ($addr) {
229
+            return new \Twig\Markup(
230
+                (function ($ip) {
231
+                    if (!$ip) {
232
+                        $ip = '127.0.0.1';
233
+                    }
234
+                    static $cache = [];
235
+                    if (!isset($cache[$ip])) {
236
+                        $class = strtr($ip, '.', '-');
237
+                        $cache[$ip] = '<span class="host_' . $class
238
+                            . '">Resolving host' . "\xE2\x80\xA6" . '<script type="text/javascript">$(document).ready(function() {'
239
+                            .  "\$.get('tools.php?action=get_host&ip=$ip', function(host) {\$('.host_$class').html(host)})})</script></span>";
240
+                    }
241
+                    return $cache[$ip];
242
+                })($addr),
243
+                'UTF-8'
244
+            );
245
+        }));
246
+
247
+        $twig->addFunction(new \Twig\TwigFunction('shorten', function ($text, $length) {
248
+            return new \Twig\Markup(
249
+                shortenString($text, $length),
250
+                'UTF-8'
251
+            );
252
+        }));
253
+
254
+        $twig->addTest(
255
+            new \Twig\TwigTest('numeric', function ($value) {
256
+                return is_numeric($value);
257
+            })
258
+        );
259
+
260
+        return $twig;
261
+    }
262
+}

+ 0
- 86
templates/applicant/admin.twig View File

1
-{% from 'macro/form.twig' import checked %}
2
-<div class="thin">
3
-
4
-<div class="linkbox">
5
-    <a href="/apply.php" class="brackets">Apply</a>
6
-    <a href="/apply.php?action=view" class="brackets">Current applications</a>
7
-    <a href="/apply.php?action=view&amp;status=resolved" class="brackets">Resolved applications</a>
8
-</div>
9
-
10
-<h3>Manage roles at {{ constant('SITE_NAME') }}</h3>
11
-
12
-<form method="post" action="/apply.php?action=admin">
13
-
14
-<div class="box">
15
-    <div class="head">Current Roles</div>
16
-    <div class="pad">
17
-{% if saved %}
18
-        <p>The role {{ role.title }} was {{ saved }}.</p>
19
-{% endif %}
20
-{% if not editId %}
21
-    {% for role_id, info in list %}
22
-        {% if loop.first %}
23
-        <table>
24
-        {% endif %}
25
-            <tr class="row{{ cycle(['a', 'b'], loop.index0) }}">
26
-                <td>
27
-                    <div class="head">
28
-                        <div style="float: right;">
29
-                            <input style="margin-bottom: 10px;" type="submit" name="edit-{{ role_id }}" value="Edit" />
30
-                        </div>
31
-                        <span style="font-size: medium">{{ info.title }}</span> ({% if info.published %}published{% else %}archived{% endif %})
32
-                        <br />Role created {{ info.created|time_diff }} by {{ info.user_id|user_url }}
33
-                        {% if info.modified != ino.created %}
34
-                            last modified {{ info.modified|time_diff }}
35
-                        {% endif %}
36
-                    </div>
37
-                </td>
38
-            </tr>
39
-            <tr>
40
-                <td><div class="pad">{{ info.description|bb_format }}</div></td>
41
-            </tr>
42
-        {% if loop.last %}
43
-        </table>
44
-        {% endif %}
45
-    {% else %}
46
-        <p>There are no current roles. Create one using the form below.</p>
47
-    {% endfor %}
48
-{% endif %}
49
-    </div>
50
-</div>
51
-
52
-<div class="box">
53
-    <div class="head">{% if edit_id %}Edit{% else %}New{% endif %} Role</div>
54
-    <div class="pad">
55
-
56
-    <table>
57
-        <tr>
58
-            <td class="label">Title</td>
59
-            <td><input type="text" width="100" name="title" value="{% if edit_id %}{{ role.title }}{% endif %}" /></td>
60
-        </tr>
61
-        <tr>
62
-            <td class="label">Visibility</td>
63
-            <td>
64
-                <input type="radio" name="status" value="1" id="status-pub"{{ checked(edit_id and role.isPublished) }} /><label for="status-pub">published</label><br />
65
-                <input type="radio" name="status" value="0" id="status-arch"{{ checked((not edit_id) or role.isArchived) }} /><label for="status-arch">archived</label>
66
-            </td>
67
-        </tr>
68
-        <tr>
69
-            <td class="label">Description</td>
70
-            <td>
71
-{% if edit_id %}
72
-                <input type="hidden" name="edit" value="{{ edit_id }}"/>
73
-{% endif %}
74
-                <input type="hidden" name="user_id" value="{{ user_id }}"/>
75
-                <input type="hidden" name="auth" value="{{ auth }}"/>
76
-                {{ text.emit|raw }}
77
-                <input type="submit" id="submit" value="Save Role"/>
78
-            </td>
79
-        </tr>
80
-    </table>
81
-</div>
82
-</div>
83
-
84
-</form>
85
-
86
-</div>

+ 0
- 76
templates/applicant/apply.twig View File

1
-{% from 'macro/form.twig' import selected %}
2
-<div class="thin">
3
-    <div class="header">
4
-        <h3>Apply for a role at {{ constant('SITE_NAME') }}</h3>
5
-{% if is_admin or is_applicant %}
6
-        <div class="linkbox">
7
-    {% if is_admin %}
8
-            <a href="/apply.php?action=view" class="brackets">Current applications</a>
9
-            <a href="/apply.php?action=view&amp;status=resolved" class="brackets">Resolved applications</a>
10
-            <a href="/apply.php?action=admin" class="brackets">Manage roles</a>
11
-    {% else %}
12
-            <a href="/apply.php?action=view" class="brackets">View your application</a>
13
-    {% endif %}
14
-        </div>
15
-{% endif %}
16
-    </div>
17
-
18
-{% for role_id, role in list %}
19
-    {% if loop.first %}
20
-    <div class="box">
21
-        <div class="head">Open Roles</div>
22
-        <div class="pad">
23
-            <table>
24
-    {% endif %}
25
-                <tr>
26
-                    <td><div class="head">{{ role.title }}</div></td>
27
-                </tr>
28
-                <tr>
29
-                    <td><div class="pad">{{ role.description|bb_format }}</div></td>
30
-                </tr>
31
-    {% if loop.last %}
32
-            </table>
33
-        </div>
34
-    </div>
35
-    {% endif %}
36
-{% else %}
37
-    <div class="box pad">
38
-    <p>Thanks for your interest in helping {{ constant('SITE_NAME') }}! There are
39
-    no openings at the moment. Keep an eye on the front page
40
-    or the forum for announcements in the future.</p>
41
-    </div>
42
-{% endfor %}
43
-
44
-{% if list %}
45
-    {% if error %}
46
-<div class="important">{{ error }}</div>
47
-    {% endif %}
48
-<form class="send_form" id="applicationform" name="apply" action="/apply.php?action=save" method="post">
49
-    <div class="box">
50
-        <div id="quickpost">
51
-            <div class="head">Your Role at {{ constant('SITE_NAME') }}</div>
52
-            <div class="pad">
53
-                <div>Choose a role from the following list:</div>
54
-                <select name="role">
55
-                    <option value="">---</option>
56
-{% for role in list %}
57
-                    <option value="{{ role.role_id }}"{{ selected(role.title == title) }}>{{ role.title }}</option>
58
-{% endfor %}
59
-                </select>
60
-            </div>
61
-            <div class="head">Your cover letter</div>
62
-            <div class="pad">Give us least 80 characters to convince us!
63
-            {{ body.emit|raw }}
64
-            </div>
65
-        </div>
66
-
67
-        <div class="pad preview_submit">
68
-            <input type="hidden" name="auth" value="{{ auth }}" />
69
-            {{ body.button|raw }}
70
-            <input type="submit" value="Send Application" />
71
-        </div>
72
-    </div>
73
-</form>
74
-{% endif %}
75
-</div>
76
-

+ 0
- 136
templates/applicant/view.twig View File

1
-<div class="thin">
2
-
3
-<div class="linkbox">
4
-    <a href="/apply.php" class="brackets">Apply</a>
5
-{% if id and not is_staff %}
6
-    <a href="/apply.php?action=view" class="brackets">View your applications</a>
7
-{% endif %}
8
-{% if is_staff %}
9
-    {% if resolved or (id and not resolved) %}
10
-    <a href="/apply.php?action=view" class="brackets">Current applications</a>
11
-    {% endif %}
12
-    {% if not resolved %}
13
-    <a href="/apply.php?action=view&status=resolved" class="brackets">Resolved applications</a>
14
-    {% endif %}
15
-    <a href="/apply.php?action=admin" class="brackets">Manage roles</a>
16
-{% endif %}
17
-</div>
18
-
19
-{% if id %}
20
-<div class="box">
21
-    <div class="head"{% if app.isResolved %} style="font-style: italic;"{% endif %}>{{ app.roleTitle }}
22
-    {% if is_staff %}
23
-        <div style="float: right;">
24
-            <form name="role_resolve" method="POST" action="/apply.php?action=view&amp;id={{ id }}">
25
-                <input type="submit" name="resolve" value="{% if app.isResolved %}Reopen{% else %}Resolve{% endif %}" />
26
-                <input type="hidden" name="id" value="{{ id }}"/>
27
-                <input type="hidden" name="auth" value="{{ auth }}"/>
28
-            </form>
29
-        </div>
30
-        <br />Application received from {{ app.userId|user_full }} received {{ app.created|time_diff }}.
31
-    {% endif %}
32
-    </div>
33
-
34
-    <div class="pad">
35
-        <p>{{ app.body|bb_format }}</p>
36
-    {% if not app.isResolved %}
37
-        <form id="thread_note_reply" name="thread_note_replay" method="POST" action="/apply.php?action=view&amp;id={{ id }}">
38
-    {% endif %}
39
-        <table class="forum_post wrap_overflow box vertical_margin">
40
-    {% for note in app.story(is_staff) %}
41
-            <tr class="colhead_dark">
42
-                <td colspan="2">
43
-                    <div style="float: left; padding-top: 10px;">{{ note.user_id|user_url }} - {{ note.created|time_diff }}</div>
44
-                </td>
45
-            </tr>
46
-            <tr>
47
-                <td colspan="2" style="border: 2px solid
48
-                    {%- if not is_staff -%}
49
-                        #808080
50
-                    {%- else -%}
51
-                        {%- if note.visibility == 'staff' -%}
52
-                            #FF8017
53
-                        {%- else -%}
54
-                            #347235
55
-                        {%- endif -%}
56
-                    {%- endif -%}
57
-                    ;">
58
-                    <div style="margin: 5px 4px 20px 4px">
59
-                        {{ note.body|bb_format }}
60
-                    </div>
61
-        {% if is_staff and not app.isResolved %}
62
-                    <div style="float: right; padding-top: 10px 0; margin-bottom: 6px;">
63
-                        <input type="submit" name="note-delete-{{ note.id }}" value="delete" style="height: 20px; padding: 0 3px;"/>
64
-                    </div>
65
-        {% endif %}
66
-                </td>
67
-            </tr>
68
-    {% endfor %}
69
-    {% if not app.isResolved %}
70
-        {% if is_staff %}
71
-            <tr>
72
-                <td class="label">Visibility</td>
73
-                <td>
74
-                    <div>
75
-                        <input type="radio" name="visibility" value="public" /><label for="public">public <span style="color: #347235">(member will see this reply)</span></label><br />
76
-                        <input type="radio" name="visibility" value="staff" checked /><label for="staff">staff <span style="color: #FF8017">(only staff will see this reply)</span></label><br />
77
-                    </div>
78
-                <td>
79
-            </tr>
80
-        {% endif %}
81
-            <tr>
82
-                <td class="label">Reply</td>
83
-                <td>
84
-                    {{ note.preview|raw }}
85
-                    {{ note.field|raw }}
86
-                </td>
87
-            </tr>
88
-            <tr>
89
-                <td colspan="2">
90
-                    <div style="text-align: center;">
91
-                        <input type="hidden" name="id" value="{{ id }}"/>
92
-                        <input type="hidden" name="auth" value="{{ auth }}"/>
93
-                        {{ note.button|raw }}
94
-                        <input type="submit" id="submit" value="Save" />
95
-                    </div>
96
-                </td>
97
-            </tr>
98
-    {% endif %}
99
-        </table>
100
-        </form>
101
-    </div>
102
-</div>
103
-{% else %}
104
-    <h3>{% if resolved %}Resolved{% else %}Current{% endif %} Applications</h3>
105
-    {% for a in list %}
106
-        {% if loop.first %}
107
-    <table>
108
-        <tr class="colhead">
109
-            <td>Role</td>
110
-            {% if is_staff %}
111
-            <td>Applicant</td>
112
-            {% endif %}
113
-            <td>Date Created</td>
114
-            <td>Comments</td>
115
-            <td>Last comment from</td>
116
-            <td>Last comment added</td>
117
-        </tr>
118
-        {% endif %}
119
-        <tr>
120
-            <td><a href="/apply.php?action=view&amp;id={{ a.ID }}">{{ a.Role }}</a></td>
121
-        {% if is_staff %}
122
-            <td><a href="/user.php?id={{ a.UserID }}">{{ a.Username }}</a></td>
123
-        {% endif %}
124
-            <td>{{ a.Created|time_diff }}</td>
125
-            <td>{{ a.nr_notes|number_format }}</td>
126
-            <td><a href="/user.php?id={{ a.last_UserID }}">{{ a.last_Username }}</a></td>
127
-            <td>{% if a.last_Created %}{{ a.last_Created|time_diff }}{% endif %}</td>
128
-        </tr>
129
-        {% if loop.last %}
130
-    </table>
131
-        {% endif %}
132
-    {% else %}
133
-<div class="box pad">The cupboard is empty. There are no applications to show.</div>
134
-    {% endfor %}
135
-{% endif %}
136
-</div>

+ 0
- 41
templates/logchecker/report.twig View File

1
-{% if not logfile.checksum() %}
2
-    <blockquote>
3
-    {% if pasted is not defined or pasted == false %}
4
-        <strong>Trumpable For:</strong>
5
-        <br /><br />
6
-        {% if logfile.checksumState() == 'checksum_missing' %}
7
-                No Checksum(s)
8
-        {% elseif logfile.checksumState() == 'checksum_invalid' %}
9
-                Invalid Checksum(s)
10
-        {% endif %}
11
-    {% else %}
12
-            Checksums of pasted log files cannot be verified, as the character encoding can change during copy-pasting.
13
-    {% endif %}
14
-    </blockquote>
15
-{% endif %}
16
-
17
-{% if logfile.score() == 100 %}
18
-{%    set color = '#418B00' %}
19
-{% elseif logfile.score()  >  90 %}
20
-{%     set color = '#74C42E' %}
21
-{% elseif logfile.score()  >  75 %}
22
-{%     set color = '#FFAA00' %}
23
-{% elseif logfile.score()  >  50 %}
24
-{%     set color = '#FF5E00' %}
25
-{% else %}
26
-{%     set color = '#FF0000' %}
27
-{% endif %}
28
-    <blockquote>
29
-        <strong>Score:</strong> <span style="color:{{ color }}">{{ logfile.score() }}</span> (out of 100)
30
-    </blockquote>
31
-    <blockquote>
32
-        <h3>Log validation report:</h3>
33
-        <ul>
34
-{% for detail in logfile.details() %}
35
-            <li>{{ detail }}</li>
36
-{% endfor %}
37
-        </ul>
38
-    </blockquote>
39
-    <blockquote>
40
-        <pre>{{ logfile.text()|raw }}</pre>
41
-    </blockquote>

+ 0
- 44
templates/logchecker/test.twig View File

1
-<div class="linkbox">
2
-    <a href="logchecker.php?action=upload" class="brackets">Upload Missing Logs</a>
3
-    <a href="logchecker.php?action=update" class="brackets">Update Uploaded Logs</a>
4
-</div>
5
-<div class="thin">
6
-    <h2 class="center">Orpheus Logchecker</h2>
7
-    <div class="box pad">
8
-        <p>
9
-        Use this page to test our logchecker. You can either upload a file or paste the contents
10
-        into the text box below. This will then run the file/text against our logchecker displaying
11
-        to you what it would look like on our site. To verify the checksum of a log file, you will
12
-        need to upload it.
13
-        </p>
14
-        <table class="forum_post vertical_margin">
15
-            <tr class="colhead">
16
-                <td colspan="2">Upload file</td>
17
-            </tr>
18
-            <tr>
19
-                <td>
20
-                    <form action="" method="post" enctype="multipart/form-data">
21
-                        <input type="hidden" name="action" value="take_test" />
22
-                        <input type="file" accept="{{ accepted }}" name="log" size="40" />
23
-                        <input type="submit" value="Upload log" name="submit" />
24
-                    </form>
25
-                </td>
26
-            </tr>
27
-        </table>
28
-        <table class="forum_post vertical_margin">
29
-            <tr class="colhead">
30
-                <td colspan="2">Paste log (No checksum verification)</td>
31
-            </tr>
32
-            <tr>
33
-                <td>
34
-                    <form action="" method="post">
35
-                        <input type="hidden" name="action" value="take_test" />
36
-                        <textarea rows="20" style="width: 99%" name="pastelog" wrap="soft"></textarea>
37
-                        <br /><br />
38
-                        <input type="submit" value="Upload log" name="submit" />
39
-                    </form>
40
-                </td>
41
-            </tr>
42
-        </table>
43
-    </div>
44
-</div>

+ 0
- 54
templates/logchecker/upload.twig View File

1
-<div class="linkbox">
2
-    <a href="logchecker.php?action=test" class="brackets">Test Logchecker</a>
3
-    <a href="logchecker.php?action=update" class="brackets">Update Logs</a>
4
-</div>
5
-<div class="thin">
6
-    <h2 class="center">Upload Missing Logs</h2>
7
-    <div class="box pad">
8
-        <p>These torrents are your uploads that state that there are logs within the torrent, but none were
9
-        uploaded to the site. To fix this, please select a torrent and then some torrents to upload below.
10
-        <br /><br />
11
-        If you'd like to upload new logs for your uploaded torrents that have been scored, please go
12
-        <a href="logchecker.php?action=update">here</a>.
13
-        Additionally, you can report any torrent to staff for them to be manually rescored by staff.</p>
14
-        <br />
15
-        <form action="" method="post" enctype="multipart/form-data">
16
-            <input type="hidden" name="action" value="take_upload" />
17
-            <input type="hidden" name="from_action" value="upload" />
18
-            <table class="form_post vertical_margin">
19
-                <tr class="colhead">
20
-                    <td colspan="2">Select a Torrent</td>
21
-                </tr>
22
-{% if list is empty %}
23
-                <tr>
24
-                    <td colspan='2'>No uploads found.</td>
25
-                </tr>
26
-{% else %}
27
-    {% for id, name in list %}
28
-                <tr>
29
-                    <td style="width: 5%;"><input type="radio" name="torrentid" value="{{ id }}"></td><td>{{ name|raw }}}</td>
30
-                </tr>
31
-    {% endfor %}
32
-                <tr class="colhead">
33
-                    <td colspan="2">Upload Logs for This Torrent</td>
34
-                </tr>
35
-                <tr>
36
-                    <td colspan="2" id="logfields">
37
-                        Check your log files before uploading <a href="logchecker.php" target="_blank">here</a>.
38
-                        <br />
39
-                        <a href="javascript:;" onclick="AddLogField();" class="brackets">+</a>
40
-                        <a href="javascript:;" onclick="RemoveLogField();" class="brackets">&minus;</a>
41
-                        Add or remove additional logfiles for multi-disc releases.<br />
42
-                        <input id="file" type="file" accept="{{ accepted }}" name="logfiles[]" size="50" required />
43
-                    </td>
44
-                </tr>
45
-                <tr>
46
-                    <td colspan="2">
47
-                        <input type="submit" value="Upload Logs!" name="logsubmit" />
48
-                    </td>
49
-                </tr>
50
-{% endif %}
51
-            </table>
52
-        </form>
53
-    </div>
54
-</div>

+ 21
- 0
templates/torrent_form/upload_notice.html View File

1
+<aside class="upload_notice">
2
+  <p>
3
+    Please consult the
4
+    <a href="/rules.php?p=upload">Upload Rules</a>
5
+    and the
6
+    <a href="/wiki.php?action=article&name=categories">Categories Wiki</a>
7
+    to help fill out the upload form correctly.
8
+  </p>
9
+
10
+  <p>
11
+    The site adds the Announce and Source automatically. Just download and seed
12
+    the new torrent after uploading it.
13
+
14
+    <!--
15
+    <strong>
16
+      If you never have before, be sure to read this list of
17
+      <a href="wiki.php?action=article&name=uploadingpitfalls">uploading pitfalls</a>.
18
+    </strong>
19
+    -->
20
+  </p>
21
+</aside>

Loading…
Cancel
Save