Browse Source

Wikipedia style links, fix alertbar style, organize public header/footer, add about page

biotorrents 3 years ago
parent
commit
e625d03a3b

+ 27
- 2
classes/text.class.php View File

152
         )) {
152
         )) {
153
             $Parsedown = new ParsedownExtra();
153
             $Parsedown = new ParsedownExtra();
154
             $Parsedown->setSafeMode(true);
154
             $Parsedown->setSafeMode(true);
155
+
156
+            # Prepare clean escapes
155
             $Str = html_entity_decode($Str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
157
             $Str = html_entity_decode($Str, ENT_QUOTES | ENT_HTML5, 'UTF-8');
156
 
158
 
159
+            # Parse early and post-process
160
+            $Parsed = $Parsedown->text($Str);
161
+            
162
+            # Replace links to $ENV->SITE_DOMAIN
163
+            $Parsed = preg_replace(
164
+                "/<a href=\"$ENV->RESOURCE_REGEX$ENV->SITE_DOMAIN\//",
165
+                '<a href="/',
166
+                $Parsed
167
+            );
168
+                
169
+            # Replace external links and add Wikipedia-style class
170
+            $Parsed = preg_replace(
171
+                '/<a href="https?:\/\//',
172
+                '<a class="external" rel="noopener" rel="noreferrer" href="https://',
173
+                $Parsed
174
+            );
175
+
176
+            $Parsed = preg_replace(
177
+                '/<a href="ftps?:\/\//',
178
+                '<a class="external" rel="noopener" rel="noreferrer" href="ftps://',
179
+                $Parsed
180
+            );
181
+
182
+            return $Parsed;
183
+
157
             # Markdown ToC not happening yet
184
             # Markdown ToC not happening yet
158
             # Shouldn't parse_toc() output HTML
185
             # Shouldn't parse_toc() output HTML
159
             /*
186
             /*
174
             }
201
             }
175
             */
202
             */
176
 
203
 
177
-            return $P = $Parsedown->text($Str);
178
-
179
         /*
204
         /*
180
         return $P =
205
         return $P =
181
             ((self::$TOC && $OutputTOC)
206
             ((self::$TOC && $OutputTOC)

+ 2
- 3
design/privateheader.php View File

252
           <li id="nav_irc" <?=
252
           <li id="nav_irc" <?=
253
             Format::add_class($PageID, ['chat'], 'active', true)?>>
253
             Format::add_class($PageID, ['chat'], 'active', true)?>>
254
             <a href="https://join.slack.com/t/biotorrents/shared_invite/<?=$ENV->SLACK_INVITE?>"
254
             <a href="https://join.slack.com/t/biotorrents/shared_invite/<?=$ENV->SLACK_INVITE?>"
255
-              target="_blank">Slack
256
-              <img src="/static/common/symbols/external.png" style="height: 0.75em; vertical-align: center;" /></a>
255
+              target="_blank">Slack</a>
257
           </li>
256
           </li>
258
 
257
 
259
           <li id="nav_top10" <?=
258
           <li id="nav_top10" <?=
625
 if (!empty($Alerts) || !empty($ModBar)) { ?>
624
 if (!empty($Alerts) || !empty($ModBar)) { ?>
626
     <div id="alerts">
625
     <div id="alerts">
627
       <?php foreach ($Alerts as $Alert) { ?>
626
       <?php foreach ($Alerts as $Alert) { ?>
628
-      <div class="alertbar">
627
+      <div class="alertbar warning">
629
         <?=$Alert?>
628
         <?=$Alert?>
630
       </div>
629
       </div>
631
       <?php
630
       <?php

+ 2
- 2
design/publicfooter.php View File

7
 </main>
7
 </main>
8
 
8
 
9
 <footer>
9
 <footer>
10
-  <a href="https://github.com/biotorrents/gazelle" target="_blank">GitHub</a>
11
-  <a href="https://docs.biotorrents.de" target="_blank">API</a>
12
   <a href="/legal.php?p=privacy">Privacy</a>
10
   <a href="/legal.php?p=privacy">Privacy</a>
13
   <a href="/legal.php?p=dmca">DMCA</a>
11
   <a href="/legal.php?p=dmca">DMCA</a>
12
+  <a class="external" href="https://github.com/biotorrents/gazelle" target="_blank">GitHub</a>
13
+  <a class="external" href="https://patreon.com/biotorrents" target="_blank">Patreon</a>
14
 </footer>
14
 </footer>
15
 
15
 
16
 <script src="$ENV->STATIC_SERVER/functions/vendor/instantpage.js" type="module"></script>
16
 <script src="$ENV->STATIC_SERVER/functions/vendor/instantpage.js" type="module"></script>

+ 2
- 8
design/publicheader.php View File

68
     echo '<a href="register.php">Register</a>';
68
     echo '<a href="register.php">Register</a>';
69
 }
69
 }
70
 
70
 
71
-/*
72
-$Email = $ENV->HELP->Email;
73
-$Subject = $ENV->HELP->Subject;
74
-$Body = $ENV->HELP->Body;
75
-echo "<a href='mailto:$Email?subject=$Subject&body=$Body'>Support</a>";
76
-*/
77
-
78
 echo <<<HTML
71
 echo <<<HTML
79
-    <a href="https://github.com/biotorrents/gazelle/issues" target="_blank">Support</a>
72
+    <a href="/legal.php?p=about">About</a>
73
+    <a class="external" href="https://docs.torrents.bio" target="_blank">Docs</a>
80
   </header>
74
   </header>
81
 
75
 
82
 <main>
76
 <main>

+ 6
- 0
sections/legal/index.php View File

5
 $p = $_GET['p'];
5
 $p = $_GET['p'];
6
 
6
 
7
 switch ($p) {
7
 switch ($p) {
8
+    case 'about':
9
+        View::show_header('About');
10
+        echo $Twig->render('legal/about.html');
11
+        View::show_footer();
12
+        break;
13
+
8
     case 'privacy':
14
     case 'privacy':
9
         View::show_header('Privacy');
15
         View::show_header('Privacy');
10
         echo $Twig->render('legal/privacy.html');
16
         echo $Twig->render('legal/privacy.html');

+ 6
- 0
static/common/symbols/external-link-ltr-icon.svg View File

1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12">
3
+	<path fill="#fff" stroke="#36c" d="M1.5 4.518h5.982V10.5H1.5z"/>
4
+	<path fill="#36c" d="M5.765 1H11v5.39L9.427 7.937l-1.31-1.31L5.393 9.35l-2.69-2.688 2.81-2.808L4.2 2.544z"/>
5
+	<path fill="#fff" d="m9.995 2.004.022 4.885L8.2 5.07 5.32 7.95 4.09 6.723l2.882-2.88-1.85-1.852z"/>
6
+</svg>

BIN
static/common/symbols/external.png View File


+ 8
- 6
static/styles/bookish/scss/colors.scss View File

72
 }
72
 }
73
 
73
 
74
 .alertbar {
74
 .alertbar {
75
-    @include alertbar(silver);
76
-    /* @include alertbar($lb100); */
75
+    &.modbar {
76
+        @include alertbar(silver);
77
+        /* @include alertbar($lb100); */
78
+    }
77
 
79
 
78
-    .warning {
79
-        background: orange;
80
+    &.warning {
81
+        @include alertbar(orange);
80
         /* background: #ffe0b2; */
82
         /* background: #ffe0b2; */
81
     }
83
     }
82
 
84
 
83
-    .error {
84
-        background: red;
85
+    &.error {
86
+        @include alertbar(red);
85
         /* background: #ffcdd2; */
87
         /* background: #ffcdd2; */
86
     }
88
     }
87
 }
89
 }

+ 8
- 0
static/styles/global/scss/fonts.scss View File

3
     line-height: 1.6;
3
     line-height: 1.6;
4
 }
4
 }
5
 
5
 
6
+/* Wikipedia-style external links */
7
+a.external {
8
+    background-image: url(/static/common/symbols/external-link-ltr-icon.svg);
9
+    background-position: center right;
10
+    background-repeat: no-repeat;
11
+    padding-right: 13px;
12
+}
13
+
6
 /*
14
 /*
7
  * Spacing classes
15
  * Spacing classes
8
  */
16
  */

+ 2
- 2
static/styles/public/scss/public.scss View File

226
 
226
 
227
 /* Legal */
227
 /* Legal */
228
 .tldr {
228
 .tldr {
229
-    width: 200%;
229
+    max-width: 1000%;
230
     height: 500px;
230
     height: 500px;
231
-    margin-left: -50%;
231
+    margin: auto;
232
     overflow-y: scroll;
232
     overflow-y: scroll;
233
 }
233
 }

+ 19
- 0
templates/legal/about.html View File

1
+<h2>About BioTorrents.de</h2>
2
+
3
+<section class="tldr">
4
+  <p>
5
+    BioTorrents.de is a functional experiment in convenient data distribution.
6
+  </p>
7
+
8
+  <p>
9
+    <strong> Email </strong>
10
+    <br />
11
+    help at biotorrents dot de
12
+  </p>
13
+
14
+  <p>
15
+    Please use
16
+    <a href="/sections/legal/pubkey.txt">GPG A1D095A5DEC74A8B</a>
17
+    if you wish.
18
+  </p>
19
+</section>

+ 3
- 3
templates/legal/dmca.html View File

74
 
74
 
75
   <p>
75
   <p>
76
     Remember that under
76
     Remember that under
77
-    <a href="https://www.law.cornell.edu/uscode/text/17/512">17 USC 512(f)</a>,
77
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/512">17 USC 512(f)</a>,
78
     anyone who knowingly materially misrepresents infringement may be subject to liability.
78
     anyone who knowingly materially misrepresents infringement may be subject to liability.
79
     Also see
79
     Also see
80
-    <a href="https://www.law.cornell.edu/uscode/text/17/107">17 USC 107</a> and
81
-    <a href="https://www.law.cornell.edu/uscode/text/17/108">17 USC 108</a>.
80
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/107">17 USC 107</a> and
81
+    <a class="external" href="https://www.law.cornell.edu/uscode/text/17/108">17 USC 108</a>.
82
   </p>
82
   </p>
83
 
83
 
84
   <p>
84
   <p>

+ 5
- 5
templates/legal/privacy.html View File

41
   <p>
41
   <p>
42
     We don't collect cross-origin data.
42
     We don't collect cross-origin data.
43
     Also, we don't access
43
     Also, we don't access
44
-    <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy#directives">browser features</a>
44
+    <a class="external" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy#directives">browser features</a>
45
     such as camera, microphone, and sensors.
45
     such as camera, microphone, and sensors.
46
   </p>
46
   </p>
47
 
47
 
102
   </h3>
102
   </h3>
103
 
103
 
104
   <p>
104
   <p>
105
-    <a href="https://gdpr-info.eu/art-14-gdpr/">Art. 14 GDPR ¶ 5(a) and (b)</a>, and
106
-    <a href="https://gdpr-info.eu/art-27-gdpr/">Art. 27 ¶ 2</a> apply.
105
+    <a class="external" href="https://gdpr-info.eu/art-14-gdpr/">Art. 14 GDPR ¶ 5(a) and (b)</a>, and
106
+    <a class="external" href="https://gdpr-info.eu/art-27-gdpr/">Art. 27 ¶ 2</a> apply.
107
     Accordingly, we haven't designated an EU representative.
107
     Accordingly, we haven't designated an EU representative.
108
     Generally, we don't collect any personal data as defined in
108
     Generally, we don't collect any personal data as defined in
109
-    <a href="https://gdpr-info.eu/art-4-gdpr/">Art. 4</a>
109
+    <a class="external" href="https://gdpr-info.eu/art-4-gdpr/">Art. 4</a>
110
     except what you voluntarily provide us.
110
     except what you voluntarily provide us.
111
   </p>
111
   </p>
112
 
112
 
124
 
124
 
125
   <p>
125
   <p>
126
     We're exempt from the California Consumer Privacy Act pursuant to
126
     We're exempt from the California Consumer Privacy Act pursuant to
127
-    <a href="https://ccpa-info.com/home/1798-140-definitions/">CIV 1798.140(c)(1)(A)</a>.
127
+    <a class="external" href="https://ccpa-info.com/home/1798-140-definitions/">CIV 1798.140(c)(1)(A)</a>.
128
     Nonetheless, we'll be happy to delete your information
128
     Nonetheless, we'll be happy to delete your information
129
     to the extent you don't enter into a business relationship with us.
129
     to the extent you don't enter into a business relationship with us.
130
   </p>
130
   </p>

+ 0
- 29
templates/staffblog/edit.twig View File

1
-<div class="box box2 thin">
2
-    <div class="head">
3
-        {{ verb|ucfirst }} a staff blog post
4
-        <span style="float: right;">
5
-            <a href="#" onclick="$('#postform').gtoggle(); this.innerHTML = (this.innerHTML == 'Hide' ? 'Show' : 'Hide'); return false;" class="brackets">{{
6
-                show_form ? 'Show' : 'Hide' }}</a>
7
-        </span>
8
-    </div>
9
-    <form class="{{ verb }}_form" name="blog_post" action="staffblog.php" method="post">
10
-        <div id="postform" class="pad{{ show_form ? ' hidden' : '' }}">
11
-            <input type="hidden" name="action" value="{{ verb == 'create' ? 'takenewblog' : 'takeeditblog' }}" />
12
-            <input type="hidden" name="auth" value="{{ auth }}" />
13
-{% if verb == 'edit' %}
14
-            <input type="hidden" name="blogid" value="{{ blog.blogId }}" />
15
-{% endif %}
16
-            <div class="field_div">
17
-                <h3>Title</h3>
18
-                <input type="text" name="title" size="95" value="{{ blog.title }}" />
19
-            </div>
20
-            <div class="field_div">
21
-                <h3>Body</h3>
22
-                <textarea name="body" cols="95" rows="15">{{ blog.body }}</textarea> <br />
23
-            </div>
24
-            <div class="submit_div center">
25
-                <input type="submit" value="{{ verb|ucfirst }} blog post" />
26
-            </div>
27
-        </div>
28
-    </form>
29
-</div>

+ 0
- 16
templates/staffblog/list.twig View File

1
-<div class="thin">
2
-{% for entry in list %}
3
-    <div id="blog{{ entry.id }}" class="box box2 blog_post">
4
-        <div class="head">
5
-            <strong>{{ entry.title }}</strong> - posted {{ entry.created|time_diff }} by {{ entry.author }}
6
-    {% if editor %}
7
-            - <a href="staffblog.php?action=editblog&amp;id={{ entry.id }}" class="brackets">Edit</a>
8
-            <a href="staffblog.php?action=deleteblog&amp;id={{ entry.id }}&amp;auth={{ auth }}" onclick="return confirm('Do you want to delete this?');" class="brackets">Delete</a>
9
-    {% endif %}
10
-        </div>
11
-        <div class="pad">
12
-            {{ entry.body|bb_format }}
13
-        </div>
14
-    </div>
15
-{% endfor %}
16
-</div>

Loading…
Cancel
Save