Browse Source

Give new users 2 freeleech tokens each

pjc 5 years ago
parent
commit
39d18022b4
5 changed files with 619 additions and 528 deletions
  1. 188
    163
      classes/charts.class.php
  2. 139
    72
      classes/rules.class.php
  3. 135
    126
      classes/view.class.php
  4. 156
    166
      sections/register/index.php
  5. 1
    1
      sections/rules/upload.php

+ 188
- 163
classes/charts.class.php View File

@@ -1,193 +1,218 @@
1
-<?
2
-class GOOGLE_CHARTS {
3
-  protected $URL = 'https://chart.googleapis.com/chart';
4
-  protected $Labels = [];
5
-  protected $Data = [];
6
-  protected $Options = [];
7
-
8
-  public function __construct($Type, $Width, $Height, $Options) {
9
-    if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
10
-      trigger_error('Tried to make chart too large.');
1
+<?php
2
+class GOOGLE_CHARTS
3
+{
4
+    protected $URL = 'https://chart.googleapis.com/chart';
5
+    protected $Labels = [];
6
+    protected $Data = [];
7
+    protected $Options = [];
8
+
9
+    public function __construct($Type, $Width, $Height, $Options)
10
+    {
11
+        if ($Width * $Height > 300000 || $Height > 1000 || $Width > 1000) {
12
+            trigger_error('Tried to make chart too large.');
13
+        }
14
+        $this->URL .= "?cht=$Type&amp;chs={$Width}x$Height";
15
+        $this->Options = $Options;
11 16
     }
12
-    $this->URL .= "?cht=$Type&amp;chs={$Width}x$Height";
13
-    $this->Options = $Options;
14
-  }
15 17
 
16
-  protected function encode($Number) {
17
-    if ($Number == -1) {
18
-      return '__';
18
+    protected function encode($Number)
19
+    {
20
+        if ($Number === -1) {
21
+            return '__';
22
+        }
23
+        $CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
24
+        return $CharKey[floor($Number / 64)].$CharKey[floor($Number % 64)];
19 25
     }
20
-    $CharKey = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';
21
-    return $CharKey[floor($Number / 64)].$CharKey[floor($Number % 64)];
22
-  }
23
-
24
-  public function color($Colors) {
25
-    $this->URL .= '&amp;chco='.$Colors;
26
-  }
27 26
 
28
-  public function lines($Thickness, $Solid = 1, $Blank = 0) {
29
-    $this->URL .= "&amp;chls=$Thickness,$Solid,$Blank";
30
-  }
27
+    public function color($Colors)
28
+    {
29
+        $this->URL .= '&amp;chco='.$Colors;
30
+    }
31 31
 
32
-  public function title($Title, $Color = '', $Size = '') {
33
-    $this->URL .= '&amp;chtt='.str_replace(array(' ', "\n"), array('+', '|'), $Title);
34
-    if (!empty($Color)) {
35
-      $this->URL .= '&amp;chts='.$Color;
32
+    public function lines($Thickness, $Solid = 1, $Blank = 0)
33
+    {
34
+        $this->URL .= "&amp;chls=$Thickness,$Solid,$Blank";
36 35
     }
37
-    if (!empty($Size)) {
38
-      $this->URL .= ','.$Size;
36
+
37
+    public function title($Title, $Color = '', $Size = '')
38
+    {
39
+        $this->URL .= '&amp;chtt='.str_replace(array(' ', "\n"), array('+', '|'), $Title);
40
+        if (!empty($Color)) {
41
+            $this->URL .= '&amp;chts='.$Color;
42
+        }
43
+        if (!empty($Size)) {
44
+            $this->URL .= ','.$Size;
45
+        }
39 46
     }
40
-  }
41 47
 
42
-  public function legend($Items, $Placement = '') {
43
-    $this->URL .= '&amp;chdl='.str_replace(' ', '+', implode('|', $Items));
44
-    if (!empty($Placement)) {
45
-      if (!in_array($Placement, array('b', 't', 'r', 'l', 'bv', 'tv'))) {
46
-        trigger_error('Invalid legend placement.');
47
-      }
48
-      $this->URL .= '&amp;chdlp='.$Placement;
48
+    public function legend($Items, $Placement = '')
49
+    {
50
+        $this->URL .= '&amp;chdl='.str_replace(' ', '+', implode('|', $Items));
51
+        if (!empty($Placement)) {
52
+            if (!in_array($Placement, array('b', 't', 'r', 'l', 'bv', 'tv'))) {
53
+                trigger_error('Invalid legend placement.');
54
+            }
55
+            $this->URL .= '&amp;chdlp='.$Placement;
56
+        }
49 57
     }
50
-  }
51 58
 
52
-  public function add($Label, $Data) {
53
-    if ($Label !== false) {
54
-      $this->Labels[] = $Label;
59
+    public function add($Label, $Data)
60
+    {
61
+        if ($Label !== false) {
62
+            $this->Labels[] = $Label;
63
+        }
64
+        $this->Data[] = $Data;
55 65
     }
56
-    $this->Data[] = $Data;
57
-  }
58 66
 
59
-  public function grid_lines($SpacingX = 0, $SpacingY = -1, $Solid = 1, $Blank = 1) {
60
-    //Can take 2 more parameters for offset, but we're not bothering with that right now
61
-    $this->URL .= "&amp;chg=$SpacingX,$SpacingY,$Solid,$Blank";
62
-  }
67
+    public function grid_lines($SpacingX = 0, $SpacingY = -1, $Solid = 1, $Blank = 1)
68
+    {
69
+        // Can take 2 more parameters for offset, but we're not bothering with that right now
70
+        $this->URL .= "&amp;chg=$SpacingX,$SpacingY,$Solid,$Blank";
71
+    }
63 72
 
64
-  public function transparent() {
65
-    $this->URL .= '&amp;chf=bg,s,FFFFFF00';
66
-  }
73
+    public function transparent()
74
+    {
75
+        $this->URL .= '&amp;chf=bg,s,FFFFFF00';
76
+    }
67 77
 
68 78
 
69
-  public function url() {
70
-    return $this->URL;
71
-  }
79
+    public function url()
80
+    {
81
+        return $this->URL;
82
+    }
72 83
 }
73 84
 
74
-class AREA_GRAPH extends GOOGLE_CHARTS {
75
-  public function __construct ($Width, $Height, $Options = []) {
76
-    parent::__construct('lc', $Width, $Height, $Options);
77
-  }
85
+class AREA_GRAPH extends GOOGLE_CHARTS
86
+{
87
+    public function __construct($Width, $Height, $Options = [])
88
+    {
89
+        parent::__construct('lc', $Width, $Height, $Options);
90
+    }
78 91
 
79
-  public function color ($Color) {
80
-    $this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
81
-  }
92
+    public function color($Color)
93
+    {
94
+        $this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
95
+    }
82 96
 
83
-  public function generate() {
84
-    $Max = max($this->Data);
85
-    $Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
86
-    $Data = [];
87
-    foreach ($this->Data as $Value) {
88
-      $Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
97
+    public function generate()
98
+    {
99
+        $Max = max($this->Data);
100
+        $Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
101
+        $Data = [];
102
+        foreach ($this->Data as $Value) {
103
+            $Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
104
+        }
105
+        $this->URL .= "&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|".implode('|', $this->Labels).'&amp;chxr=0,'.$Min.','.($Max - $Min).'&amp;chd=e:'.implode('', $Data);
89 106
     }
90
-    $this->URL .= "&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|".implode('|', $this->Labels).'&amp;chxr=0,'.$Min.','.($Max - $Min).'&amp;chd=e:'.implode('', $Data);
91
-  }
92 107
 }
93 108
 
94
-class PIE_CHART extends GOOGLE_CHARTS {
95
-  public function __construct ($Width, $Height, $Options = []) {
96
-    $Type = ((isset($this->Options['3D'])) ? 'p3' : 'p');
97
-    parent::__construct($Type, $Width, $Height, $Options);
98
-  }
99
-
100
-  public function generate() {
101
-    $Sum = array_sum($this->Data);
102
-    $Other = isset($this->Options['Other']);
103
-    $Sort = isset($this->Options['Sort']);
104
-    $LabelPercent = isset($this->Options['Percentage']);
105
-
106
-    if ($Sort && !empty($this->Labels)) {
107
-      array_multisort($this->Data, SORT_DESC, $this->Labels);
108
-    } elseif ($Sort) {
109
-      sort($this->Data);
110
-      $this->Data = array_reverse($this->Data);
111
-    }
112
-
113
-    $Data = [];
114
-    $Labels = $this->Labels;
115
-    $OtherPercentage = 0.00;
116
-    $OtherData = 0;
117
-
118
-    foreach ($this->Data as $Key => $Value) {
119
-      $ThisPercentage = number_format(($Value / $Sum) * 100, 2);
120
-      $ThisData = ($Value / $Sum) * 4095;
121
-      if ($Other && $ThisPercentage < 1) {
122
-        $OtherPercentage += $ThisPercentage;
123
-        $OtherData += $ThisData;
124
-        unset($Data[$Key]);
125
-        unset($Labels[$Key]);
126
-        continue;
127
-      }
128
-      if ($LabelPercent) {
129
-        $Labels[$Key] .= ' ('.$ThisPercentage.'%)';
130
-      }
131
-      $Data[] = $this->encode($ThisData);
132
-    }
133
-    if ($OtherPercentage > 0) {
134
-      $OtherLabel = 'Other';
135
-      if ($LabelPercent) {
136
-        $OtherLabel .= ' ('.$OtherPercentage.'%)';
137
-      }
138
-      $Labels[] = $OtherLabel;
139
-      $Data[] = $this->encode($OtherData);
140
-    }
141
-    $this->URL .= "&amp;chl=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
142
-  }
143
-}
109
+class PIE_CHART extends GOOGLE_CHARTS
110
+{
111
+    public function __construct($Width, $Height, $Options = [])
112
+    {
113
+        $Type = ((isset($this->Options['3D'])) ? 'p3' : 'p');
114
+        parent::__construct($Type, $Width, $Height, $Options);
115
+    }
144 116
 
117
+    public function generate()
118
+    {
119
+        $Sum = array_sum($this->Data);
120
+        $Other = isset($this->Options['Other']);
121
+        $Sort = isset($this->Options['Sort']);
122
+        $LabelPercent = isset($this->Options['Percentage']);
123
+
124
+        if ($Sort && !empty($this->Labels)) {
125
+            array_multisort($this->Data, SORT_DESC, $this->Labels);
126
+        } elseif ($Sort) {
127
+            sort($this->Data);
128
+            $this->Data = array_reverse($this->Data);
129
+        }
130
+
131
+        $Data = [];
132
+        $Labels = $this->Labels;
133
+        $OtherPercentage = 0.00;
134
+        $OtherData = 0;
135
+
136
+        foreach ($this->Data as $Key => $Value) {
137
+            $ThisPercentage = number_format(($Value / $Sum) * 100, 2);
138
+            $ThisData = ($Value / $Sum) * 4095;
139
+            if ($Other && $ThisPercentage < 1) {
140
+                $OtherPercentage += $ThisPercentage;
141
+                $OtherData += $ThisData;
142
+                unset($Data[$Key]);
143
+                unset($Labels[$Key]);
144
+                continue;
145
+            }
146
+            if ($LabelPercent) {
147
+                $Labels[$Key] .= ' ('.$ThisPercentage.'%)';
148
+            }
149
+            $Data[] = $this->encode($ThisData);
150
+        }
151
+        if ($OtherPercentage > 0) {
152
+            $OtherLabel = 'Other';
153
+            if ($LabelPercent) {
154
+                $OtherLabel .= ' ('.$OtherPercentage.'%)';
155
+            }
156
+            $Labels[] = $OtherLabel;
157
+            $Data[] = $this->encode($OtherData);
158
+        }
159
+        $this->URL .= "&amp;chl=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
160
+    }
161
+}
145 162
 
146
-class LOG_BAR_GRAPH extends GOOGLE_CHARTS {
147
-  // todo: Finish
148
-  public function __construct ($Base, $Width, $Height, $Options = []) {
149
-    parent::__construct('lc', $Width, $Height, $Options);
150
-  }
163
+class LOG_BAR_GRAPH extends GOOGLE_CHARTS
164
+{
165
+    // todo: Finish
166
+    public function __construct($Base, $Width, $Height, $Options = [])
167
+    {
168
+        parent::__construct('lc', $Width, $Height, $Options);
169
+    }
151 170
 
152
-  public function color ($Color) {
153
-    $this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
154
-  }
171
+    public function color($Color)
172
+    {
173
+        $this->URL .= '&amp;chco='.$Color.'&amp;chm=B,'.$Color.'50,0,0,0';
174
+    }
155 175
 
156
-  public function generate() {
157
-    $Max = max($this->Data);
158
-    $Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
159
-    $Data = [];
160
-    foreach ($this->Data as $Value) {
161
-      $Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
176
+    public function generate()
177
+    {
178
+        $Max = max($this->Data);
179
+        $Min = ((isset($this->Options['Break'])) ? $Min = min($this->Data) : 0);
180
+        $Data = [];
181
+        foreach ($this->Data as $Value) {
182
+            $Data[] = $this->encode((($Value - $Min) / ($Max - $Min)) * 4095);
183
+        }
184
+        $this->URL .= "&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|".implode('|', $this->Labels).'&amp;chxr=0,'.$Min.','.($Max-$Min).'&amp;chd=e:'.implode('', $Data);
162 185
     }
163
-    $this->URL .= "&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|".implode('|', $this->Labels).'&amp;chxr=0,'.$Min.','.($Max-$Min).'&amp;chd=e:'.implode('', $Data);
164
-  }
165 186
 }
166 187
 
167
-class POLL_GRAPH extends GOOGLE_CHARTS {
168
-  public function __construct () {
169
-    $this->URL .= '?cht=bhg';
170
-  }
171
-
172
-  public function add($Label, $Data) {
173
-    if ($Label !== false) {
174
-      $this->Labels[] = Format::cut_string($Label, 35);
175
-    }
176
-    $this->Data[] = $Data;
177
-  }
178
-
179
-  public function generate() {
180
-    $Count = count($this->Data);
181
-    $Height = (30 * $Count) + 20;
182
-    $Max = max($this->Data);
183
-    $Sum = array_sum($this->Data);
184
-    $Increment = ($Max / $Sum) * 25; // * 100% / 4divisions
185
-    $Data = [];
186
-    $Labels = [];
187
-    foreach ($this->Data as $Key => $Value) {
188
-      $Data[] = $this->encode(($Value / $Max) * 4095);
189
-      $Labels[] = '@t'.str_replace(array(' ', ','),array('+', '\,'), $this->Labels[$Key]).',000000,1,'.round((($Key + 1) / $Count) - (12 / $Height), 2).':0,12';
190
-    }
191
-    $this->URL .= "&amp;chbh=25,0,5&amp;chs=214x$Height&amp;chl=0%|".round($Increment, 1)."%|".round($Increment * 2, 1)."%|".round($Increment * 3, 1)."%|".round($Increment * 4, 1)."%&amp;chm=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
192
-  }
188
+class POLL_GRAPH extends GOOGLE_CHARTS
189
+{
190
+    public function __construct()
191
+    {
192
+        $this->URL .= '?cht=bhg';
193
+    }
194
+
195
+    public function add($Label, $Data)
196
+    {
197
+        if ($Label !== false) {
198
+            $this->Labels[] = Format::cut_string($Label, 35);
199
+        }
200
+        $this->Data[] = $Data;
201
+    }
202
+
203
+    public function generate()
204
+    {
205
+        $Count = count($this->Data);
206
+        $Height = (30 * $Count) + 20;
207
+        $Max = max($this->Data);
208
+        $Sum = array_sum($this->Data);
209
+        $Increment = ($Max / $Sum) * 25; // * 100% / 4divisions
210
+        $Data = [];
211
+        $Labels = [];
212
+        foreach ($this->Data as $Key => $Value) {
213
+            $Data[] = $this->encode(($Value / $Max) * 4095);
214
+            $Labels[] = '@t'.str_replace(array(' ', ','), array('+', '\,'), $this->Labels[$Key]).',000000,1,'.round((($Key + 1) / $Count) - (12 / $Height), 2).':0,12';
215
+        }
216
+        $this->URL .= "&amp;chbh=25,0,5&amp;chs=214x$Height&amp;chl=0%|".round($Increment, 1)."%|".round($Increment * 2, 1)."%|".round($Increment * 3, 1)."%|".round($Increment * 4, 1)."%&amp;chm=".implode('|', $Labels).'&amp;chd=e:'.implode('', $Data);
217
+    }
193 218
 }

+ 139
- 72
classes/rules.class.php View File

@@ -1,51 +1,79 @@
1 1
 <?php
2
-class Rules {
2
+class Rules
3
+{
3 4
 
4 5
   /**
5 6
    * Displays the site's "Golden Rules".
6 7
    *
7 8
    */
8
-  public static function display_golden_rules() {
9
-    ?>
10
-    <ul>
11
-      <li>Staff can do anything to anyone for any reason (or no reason). If you take issue with a decision, you must do so privately with the staff member who issued the decision or with an administrator of the site.</li>
12
-      <li>One account per person per lifetime.</li>
13
-      <li>Follow proper private BitTorrent practices. Torrent files you download from this site are unique to you and should not be shared with others. Torrent files from this site should not be modified by adding additional trackers or enabling DHT or PEX under any circumstances.</li>
14
-      <li>Buying <?=SITE_NAME?> invites is not allowed. If staff discover you have purchased an invite, you will be banned for life. You will be given amnesty if you approach us before you are caught and reveal who your seller was. Waiting until after you are caught will get you nothing.</li>
15
-      <li>Accessing the site from any IP address is permitted, but your account will be linked with other accounts that have accessed the site from the same IP as you. As such, it is <em>recommended</em> that you don't use public networks, proxies, or VPNs to access the site.</li>
16
-      <li>Attempting to find a bug in the site code is allowed and sometimes even rewarded. Follow proper disclosure procedures by contacting staff about the issue well before disclosing it publicly. Do not misuse any bugs you may discover. Do not attempt to portray abuse as a bug in the hopes of a reward.</li>
17
-      <li>Don't reveal the criteria for hidden badges or events.</li>
18
-    </ul>
19
-<?
20
-  }
9
+    public static function display_golden_rules()
10
+    {
11
+        ?>
12
+<ul>
13
+  <li>Staff can do anything to anyone for any reason (or no reason). If you take issue with a decision, you must do so
14
+    privately with the staff member who issued the decision or with an administrator of the site.</li>
21 15
 
22
-  /**
23
-   * Displays the site's rules for tags.
24
-   *
25
-   * @param boolean $OnUpload - whether it's being displayed on a torrent upload form
26
-   */
27
-  public static function display_site_tag_rules($OnUpload = false) {
28
-    ?>
29
-    <ul>
30
-      <li><strong>Please use the <strong class="important_text_alt">vanity.house</strong> tag for sequences that you or your lab produced.</strong> This helps us promote the DIYbio community's original contributions.</li>
16
+  <li>One account per person per lifetime.</li>
31 17
 
32
-      <li>Tags should be comma-separated, and you should use a period to separate words inside a tag, e.g., <strong class="important_text_alt">gram.negative</strong>.</li>
18
+  <li>Follow proper private BitTorrent practices. Torrent files you download from this site are unique to you and should
19
+    not be shared with others. Torrent files from this site should not be modified by adding additional trackers or
20
+    enabling DHT or PEX under any circumstances.</li>
33 21
 
34
-      <li>There is a list of official tags <?=($OnUpload ? 'to the left of the text box' : 'on <a href="upload.php">the torrent upload page</a>')?>. Please use these tags instead of "unofficial" tags, e.g., use the official <strong class="important_text_alt">fungi</strong> tag instead of an unofficial <strong class="important_text">mushrooms</strong> tag.</li>
22
+  <li>Buying <?=SITE_NAME?> invites is not allowed. If staff discover
23
+    you have purchased an invite, you will be banned for life. You will be given amnesty if you approach us before you
24
+    are caught and reveal who your seller was. Waiting until after you are caught will get you nothing.</li>
35 25
 
36
-      <li>Avoid using multiple synonymous tags. Using both <strong class="important_text">cyanobacteria</strong> and <strong class="important_text_alt">bacteria</strong> is redundant and stupid &mdash; just use the official <strong class="important_text_alt">bacteria</strong>.</li>
26
+  <li>Accessing the site from any IP address is permitted, but your account will be linked with other accounts that have
27
+    accessed the site from the same IP as you. As such, it is <em>recommended</em> that you don't use public networks,
28
+    proxies, or VPNs to access the site.</li>
37 29
 
38
-      <li>Don't add useless tags that are already covered by other metadata. If a torrent is in the DNA category, please don't tag it <strong class="important_text">dna</strong>.</li>
30
+  <li>Attempting to find a bug in the site code is allowed and sometimes even rewarded. Follow proper disclosure
31
+    procedures by contacting staff about the issue well before disclosing it publicly. Do not misuse any bugs you may
32
+    discover. Do not attempt to portray abuse as a bug in the hopes of a reward.</li>
39 33
 
40
-      <li>Only tag information related to the group itself &mdash; <strong>not the individual release</strong>. Tags such as <strong class="important_text">apollo.100</strong>, <strong class="important_text">hiseq.2500</strong>, etc., are strictly forbidden. Remember that these tags will be used for other releases in the same group.</li>
34
+  <li>Don't reveal the criteria for hidden badges or events.</li>
35
+</ul>
36
+<?php
37
+    }
41 38
 
42
-      <li><strong>Certain tags are strongly encouraged for appropriate uploads:</strong> <strong class="important_text_alt">archaea</strong>, <strong class="important_text_alt">bacteria</strong>, <strong class="important_text_alt">fungi</strong>, <strong class="important_text_alt">animals</strong>, <strong class="important_text_alt">plants</strong>, <strong class="important_text_alt">plasmids</strong>. People search for these kinds of things specifically, so tagging them properly will get you more snatches.</li>
39
+    /**
40
+     * Displays the site's rules for tags.
41
+     *
42
+     * @param boolean $OnUpload - whether it's being displayed on a torrent upload form
43
+     */
44
+    public static function display_site_tag_rules($OnUpload = false)
45
+    {
46
+        ?>
47
+<ul>
48
+  <li><strong>Please use the <strong class="important_text_alt">vanity.house</strong> tag for sequences that you or your
49
+      lab produced.</strong> This helps us promote the DIYbio community's original contributions.</li>
43 50
 
44
-      <!--
45
-      <li><strong>Certain tags are <strong class="important_text">required</strong> for appropriate uploads:</strong>"<strong class="important_text_alt">lolicon</strong>", "<strong class="important_text_alt">shotacon</strong>", "<strong class="important_text_alt">toddlercon</strong>". Failure to use these tags may result in punishment.</li>
46
-      -->
51
+  <li>Tags should be comma-separated, and you should use a period to separate words inside a tag, e.g., <strong
52
+      class="important_text_alt">gram.negative</strong>.</li>
53
+
54
+  <li>There is a list of official tags <?=($OnUpload ? 'to the left of the text box' : 'on <a href="upload.php">the torrent upload page</a>')?>.
55
+    Please use these tags instead of "unofficial" tags, e.g., use the official <strong
56
+      class="important_text_alt">fungi</strong> tag instead of an unofficial <strong
57
+      class="important_text">mushrooms</strong> tag.</li>
58
+
59
+  <li>Avoid using multiple synonymous tags. Using both <strong class="important_text">cyanobacteria</strong> and <strong
60
+      class="important_text_alt">bacteria</strong> is redundant and stupid &mdash; just use the official <strong
61
+      class="important_text_alt">bacteria</strong>.</li>
62
+
63
+  <li>Don't add useless tags that are already covered by other metadata. If a torrent is in the DNA category, please
64
+    don't tag it <strong class="important_text">dna</strong>.</li>
65
+
66
+  <li>Only tag information related to the group itself &mdash; <strong>not the individual release</strong>. Tags such as
67
+    <strong class="important_text">apollo.100</strong>, <strong class="important_text">hiseq.2500</strong>, etc., are
68
+    strictly forbidden. Remember that these tags will be used for other releases in the same group.</li>
47 69
 
48
-      <!--
70
+  <li><strong>Certain tags are strongly encouraged for appropriate uploads:</strong> <strong
71
+      class="important_text_alt">archaea</strong>, <strong class="important_text_alt">bacteria</strong>, <strong
72
+      class="important_text_alt">fungi</strong>, <strong class="important_text_alt">animals</strong>, <strong
73
+      class="important_text_alt">plants</strong>, <strong class="important_text_alt">plasmids</strong>. People search
74
+    for these kinds of things specifically, so tagging them properly will get you more snatches.</li>
75
+
76
+  <!--
49 77
       <li><strong>Use tag namespaces when appropriate.</strong> BioTorrents.de allows for tag namespaces to aid with searching. For example, you may want to use the tags "<strong class="important_text_alt">masturbation:male</strong>" or "<strong class="important_text_alt">masturbation:female</strong>" instead of just "<strong class="important_text">masturbation</strong>". They can be used to make search queries more specific. Searching for "<strong class="important_texti_alt">masturbation</strong>" will show all torrents tagged with "<strong class="important_text_alt">masturbation</strong>", "<strong class="important_text_alt">masturbation:male</strong>", or "<strong class="important_text_alt">masturbation:female</strong>". However, searching for "<strong class="important_text_alt">masturbation:female</strong>" will ONLY show torrents with that tag. Tags with namespaces will appear differently depending on the namespace used, which include:
50 78
         <ul>
51 79
           <li><strong>:parody</strong> - Used to denote a parodied work: <strong class="tag_parody">touhou</strong>, <strong class="tag_parody">kantai.collection</strong></li>
@@ -56,46 +84,85 @@ class Rules {
56 84
       </li>
57 85
       -->
58 86
 
59
-      <li><strong>All uploads require a minimum of 5 tags.</strong> Please don't add unrelated tags just to meet the 5 tag requirement. If you can't think of 5 tags for your content, study it again until you can.</li>
87
+  <li><strong>All uploads require a minimum of 5 tags.</strong> Please don't add unrelated tags just to meet the 5 tag
88
+    requirement. If you can't think of 5 tags for your content, study it again until you can.</li>
60 89
 
61
-      <li><strong>You should be able to build up a list of tags using only the official tags <?=($OnUpload ? 'to the left of the text box' : 'on <a href="upload.php">the torrent upload page</a>')?>.</strong> If you doubt whether or not a tag is acceptable, please omit it for now and send a staff PM to request a new official tag or an approved alias.</li>
62
-    </ul>
63
-<?
64
-  }
90
+  <li><strong>You should be able to build up a list of tags using only the official tags <?=($OnUpload ? 'to the left of the text box' : 'on <a href="upload.php">the torrent upload page</a>')?>.</strong>
91
+    If you doubt whether or not a tag is acceptable, please omit it for now and send a staff PM to request a new
92
+    official tag or an approved alias.</li>
93
+</ul>
94
+<?php
95
+    }
65 96
 
66
-  /**
67
-   * Displays the site's rules for the forum
68
-   *
69
-   */
70
-  public static function display_forum_rules() {
71
-    ?>
72
-        <ul>
73
-      <li>Let's treat the biology boards like how the Shroomery used to be: each thread a set of resourceful diverse wisdom worth using permalinks to. It's okay if the boards are slow, that's why there are only a few of them.</li>
74
-      <li>Please discuss site news in the corresponding Announcements thread instead of making a new General thread. Discussing science-related news in General is highly encouraged, but discussing political news is much less so. Thank you.</li>
75
-      <li>No advertising, referrals, affiliate links, cryptocurrency pumps, or calls to action that involve using a financial instrument. You'll be banned on the spot. The exceptions: cryptocurrencies that derive their value from work performed on distributed science computation networks, e.g., Curecoin, FoldingCoin, and Gridcoin.</li>
76
-      <li>Feel free to post announcements for your own projects, even and especially if they're commercial ones, in the General board. Limit all discussion of trading biomaterials, including bulk giveaways, to the Marketplace forum available to Power Users.</li>
77
-      <li>Please be modest when talking about your uploads. It's unnecessary to announce your uploads because Gazelle logs everything (at least one this is encrypted). If someone asks for help on his project and your upload fits the bill, go write a post!</li>
78
-      <li>Use descriptive and specific subject lines. This helps others decide whether your particular words of "wisdom" relate to a topic they care about.</li>
79
-      <li>Don't post comments that don't add anything to the discussion, such as "I agree" or "haha." Bottle the trained dopamine response to social media because comment reactions are an unlikely feature.</li>
80
-      <li>Please refrain from quoting excessively. When quoting someone, use only the necessary parts of the quote. Avoid quoting more than 3 levels deep.</li>
81
-      <li>Don't post potentially malicious links without sufficient warning, or post pictures > 2 MiB. Please only speak English as stated in the Upload rules.</li>
82
-    </ul>
83
-<?
84
-  }
97
+    /**
98
+     * Displays the site's rules for the forum
99
+     *
100
+     */
101
+    public static function display_forum_rules()
102
+    {
103
+        ?>
104
+<ul>
105
+  <li>Let's treat the biology boards like how the Shroomery used to be: each thread a set of resourceful diverse wisdom
106
+    worth using permalinks to. It's okay if the boards are slow, that's why there are only a few of them.</li>
85 107
 
86
-  /**
87
-   * Displays the site's rules for conversing on its IRC network
88
-   *
89
-   */
90
-  public static function display_irc_chat_rules() {
91
-    ?>
92
-      <li>BioTorrents.de's Slack channels are just are another quiet hangout you can stack your app with so you look cool at conferences.</li>
93
-      <li>Please use <code>#general</code> for the usual chit-chat, <code>#development</code> for questions about the Gazelle software, and <code>#disabled</code> to get help recovering your account.</li>
94
-      <li>Don't send mass alerts with <code>@channel</code>, <code>@everyone</code>, or <code>@here</code>. It's obnoxious and you should handle anything genuinely important on the boards.</li>
95
-      <li>Flooding is irritating and you'll get kicked for it. This includes "now playing" scripts, large amounts of irrelevant text such as lorem ipsum, and unfunny non sequiturs.</li>
96
-      <li>Impersonating other members &mdash; particularly staff members &mdash; will not go unpunished. Please remember that the Slack channels are publicly accessible.</li>
97
-      <li>Please use the threaded conversations feature in Slack and avoid replying to threads with new messages or crossposting replies to the main channel.</li>
98
-      <li>Announce and bot channels are in development, as standard IRC instead of Slack for obvious reasons. Any IRC bots you have must authenticate with your own username and IRC key, and set the <code>+B</code> usermode on themselves.</li>
99
-<?
100
-  }
108
+  <li>Please discuss site news in the corresponding Announcements thread instead of making a new General thread.
109
+    Discussing science-related news in General is highly encouraged, but discussing political news is much less so.
110
+    Thank you.</li>
111
+
112
+  <li>No advertising, referrals, affiliate links, cryptocurrency pumps, or calls to action that involve using a
113
+    financial instrument. You'll be banned on the spot. The exceptions: cryptocurrencies that derive their value from
114
+    work performed on distributed science computation networks, i.e., Curecoin, FoldingCoin, and Gridcoin.</li>
115
+
116
+  <li>Feel free to post announcements for your own projects, even and especially if they're commercial ones, in the
117
+    General board. Limit all discussion of trading biomaterials, including bulk giveaways, to the Marketplace forum
118
+    available to Power Users.</li>
119
+
120
+  <li>Please be modest when talking about your uploads. It's unnecessary to announce your uploads because Gazelle logs
121
+    everything (at least this installation's database is encrypted). If someone asks for help on his project and your
122
+    upload fits the bill, go write a post!</li>
123
+
124
+  <li>Use descriptive and specific subject lines. This helps others decide whether your particular words of "wisdom"
125
+    relate to a topic they care about.</li>
126
+
127
+  <li>Don't post comments that don't add anything to the discussion, such as "I agree" or "haha." Bottle the trained
128
+    dopamine response to social media because comment reactions are an unlikely feature.</li>
129
+
130
+  <li>Please refrain from quoting excessively. When quoting someone, use only the necessary parts of the quote. Avoid
131
+    quoting more than 3 levels deep.</li>
132
+
133
+  <li>Don't post potentially malicious links without sufficient warning, or post pictures > 2 MiB. Please only speak
134
+    English as stated in the Upload rules.</li>
135
+</ul>
136
+<?php
137
+    }
138
+
139
+    /**
140
+     * Displays the site's rules for conversing on its IRC network
141
+     *
142
+     */
143
+    public static function display_irc_chat_rules()
144
+    {
145
+        ?>
146
+<li>BioTorrents.de's Slack channels are just are another quiet hangout you can stack your app with so you look cool at
147
+  conferences.</li>
148
+
149
+<li>Please use <code>#general</code> for the usual chit-chat, <code>#development</code> for questions about the Gazelle
150
+  software, and <code>#disabled</code> to get help recovering your account.</li>
151
+
152
+<li>Don't send mass alerts with <code>@channel</code>, <code>@everyone</code>, or <code>@here</code>. It's obnoxious and
153
+  you should handle anything genuinely important on the boards.</li>
154
+
155
+<li>Flooding is irritating and you'll get kicked for it. This includes "now playing" scripts, large amounts of
156
+  irrelevant text such as lorem ipsum, and unfunny non sequiturs.</li>
157
+
158
+<li>Impersonating other members &mdash; particularly staff members &mdash; will not go unpunished. Please remember that
159
+  the Slack channels are publicly accessible.</li>
160
+
161
+<li>Please use the threaded conversations feature in Slack and avoid replying to threads with new messages or
162
+  crossposting replies to the main channel.</li>
163
+
164
+<li>Announce and bot channels are in development, as standard IRC instead of Slack for obvious reasons. Any IRC bots you
165
+  have must authenticate with your own username and IRC key, and set the <code>+B</code> usermode on themselves.</li>
166
+<?php
167
+    }
101 168
 }

+ 135
- 126
classes/view.class.php View File

@@ -1,142 +1,151 @@
1
-<?
2
-class View {
3
-  /**
4
-   * @var string Path relative to where (P)HTML templates reside
5
-   */
6
-  const IncludePath = './design/views/';
1
+<?php
2
+class View
3
+{
4
+    /**
5
+     * @var string Path relative to where (P)HTML templates reside
6
+     */
7
+    const IncludePath = './design/views/';
7 8
 
8
-  /**
9
-   * This function is to include the header file on a page.
10
-   *
11
-   * @param $PageTitle the title of the page
12
-   * @param $JSIncludes is a comma-separated list of JS files to be included on
13
-   *                    the page. ONLY PUT THE RELATIVE LOCATION WITHOUT '.js'
14
-   *                    example: 'somefile,somedir/somefile'
15
-   */
16
-  public static function show_header($PageTitle = '', $JSIncludes = '', $CSSIncludes = '') {
17
-    global $Document, $Mobile, $Classes;
9
+    /**
10
+     * This function is to include the header file on a page.
11
+     *
12
+     * @param $PageTitle the title of the page
13
+     * @param $JSIncludes is a comma-separated list of JS files to be included on
14
+     *                    the page. ONLY PUT THE RELATIVE LOCATION WITHOUT '.js'
15
+     *                    example: 'somefile,somedir/somefile'
16
+     */
17
+    public static function show_header($PageTitle = '', $JSIncludes = '', $CSSIncludes = '')
18
+    {
19
+        global $Document, $Mobile, $Classes;
18 20
 
19
-    if ($PageTitle != '') {
20
-      $PageTitle .= ' :: ';
21
-    }
22
-    $PageTitle .= SITE_NAME;
23
-    $PageID = array(
21
+        if ($PageTitle !== '') {
22
+            $PageTitle .= ' :: ';
23
+        }
24
+        $PageTitle .= SITE_NAME;
25
+        $PageID = array(
24 26
       $Document, // Document
25 27
       empty($_REQUEST['action']) ? false : $_REQUEST['action'], // Action
26 28
       empty($_REQUEST['type']) ? false : $_REQUEST['type'] // Type
27 29
     );
28 30
 
29
-    if (!is_array(G::$LoggedUser) || empty(G::$LoggedUser['ID']) || $PageTitle == 'Recover Password :: ' . SITE_NAME) {
30
-      require(SERVER_ROOT.'/design/publicheader.php');
31
-    } else {
32
-      // HTTP/2 Server Push headers for cloudflare
33
-      $Scripts = array_merge(['jquery', 'global', 'ajax.class', 'jquery.autocomplete', 'autocomplete', 'tooltipster'], explode(',', $JSIncludes));
34
-      $Styles = array_merge(['tooltipster'], explode(',', $CSSIncludes));
35
-      foreach ($Scripts as $Script) {
36
-        if (trim($Script) == '') { continue; }
37
-        header('Link: <'.STATIC_SERVER.'functions/'.$Script.'.js?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'functions/'.$Script.'.js').'>; rel=preload; as=script;', false);
38
-      }
39
-      header('Link: <'.STATIC_SERVER.'styles/global.css?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'styles/global.css').'>; rel=preload; as=style', false);
40
-      foreach ($Styles as $Style) {
41
-        if (trim($Style) == '') { continue; }
42
-        header('Link: <'.STATIC_SERVER.'styles/'.$Style.'/style.css?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.$Style.'/style.css').'>; rel=preload; as=style;', false);
43
-      }
44
-      require(SERVER_ROOT.'/design/privateheader.php');
31
+        if (!is_array(G::$LoggedUser) || empty(G::$LoggedUser['ID']) || $PageTitle === 'Recover Password :: ' . SITE_NAME) {
32
+            require(SERVER_ROOT.'/design/publicheader.php');
33
+        } else {
34
+            // HTTP/2 Server Push headers for cloudflare
35
+            $Scripts = array_merge(['jquery', 'global', 'ajax.class', 'jquery.autocomplete', 'autocomplete', 'tooltipster'], explode(',', $JSIncludes));
36
+            $Styles = array_merge(['tooltipster'], explode(',', $CSSIncludes));
37
+            foreach ($Scripts as $Script) {
38
+                if (trim($Script) === '') {
39
+                    continue;
40
+                }
41
+                header('Link: <'.STATIC_SERVER.'functions/'.$Script.'.js?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'functions/'.$Script.'.js').'>; rel=preload; as=script;', false);
42
+            }
43
+            header('Link: <'.STATIC_SERVER.'styles/global.css?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'styles/global.css').'>; rel=preload; as=style', false);
44
+            foreach ($Styles as $Style) {
45
+                if (trim($Style) === '') {
46
+                    continue;
47
+                }
48
+                header('Link: <'.STATIC_SERVER.'styles/'.$Style.'/style.css?v='.filemtime(SERVER_ROOT.STATIC_SERVER.'styles/'.$Style.'/style.css').'>; rel=preload; as=style;', false);
49
+            }
50
+            require(SERVER_ROOT.'/design/privateheader.php');
51
+        }
45 52
     }
46
-  }
47 53
 
48
-  /**
49
-   * This function is to include the footer file on a page.
50
-   *
51
-   * @param $Options an optional array that you can pass information to the
52
-   *                 header through as well as setup certain limitations
53
-   *                 Here is a list of parameters that work in the $Options array:
54
-   *                 ['disclaimer'] = [boolean] (False) Displays the disclaimer in the footer
55
-   */
56
-  public static function show_footer($Options = []) {
57
-    global $ScriptStartTime, $SessionID, $UserSessions, $Debug, $Time, $Mobile;
58
-    if (!is_array(G::$LoggedUser) || (isset($Options['recover']) && $Options['recover'] === true)) {
59
-      require(SERVER_ROOT.'/design/publicfooter.php');
60
-    } else {
61
-      require(SERVER_ROOT.'/design/privatefooter.php');
54
+    /**
55
+     * This function is to include the footer file on a page.
56
+     *
57
+     * @param $Options an optional array that you can pass information to the
58
+     *                 header through as well as setup certain limitations
59
+     *                 Here is a list of parameters that work in the $Options array:
60
+     *                 ['disclaimer'] = [boolean] (False) Displays the disclaimer in the footer
61
+     */
62
+    public static function show_footer($Options = [])
63
+    {
64
+        global $ScriptStartTime, $SessionID, $UserSessions, $Debug, $Time, $Mobile;
65
+        if (!is_array(G::$LoggedUser) || (isset($Options['recover']) && $Options['recover'] === true)) {
66
+            require(SERVER_ROOT.'/design/publicfooter.php');
67
+        } else {
68
+            require(SERVER_ROOT.'/design/privatefooter.php');
69
+        }
62 70
     }
63
-  }
64 71
 
65
-  /**
66
-   * This is a generic function to load a template fromm /design and render it.
67
-   * The template should be in /design/my_template_name.php, and have a class
68
-   * in it called MyTemplateNameTemplate (my_template_name transformed to
69
-   * MixedCase, with the word 'Template' appended).
70
-   * This class should have a public static function render($Args), where
71
-   * $Args is an associative array of the template variables.
72
-   * You should note that by "Template", we mean "php file that outputs stuff".
73
-   *
74
-   * This function loads /design/$TemplateName.php, and then calls
75
-   * render($Args) on the class.
76
-   *
77
-   * @param string $TemplateName The name of the template, in underscore_format
78
-   * @param array $Args the arguments passed to the template.
79
-   */
80
-  public static function render_template($TemplateName, $Args) {
81
-    static $LoadedTemplates; // Keep track of templates we've already loaded.
82
-    $ClassName = '';
83
-    if (isset($LoadedTemplates[$TemplateName])) {
84
-      $ClassName = $LoadedTemplates[$TemplateName];
85
-    } else {
86
-      include(SERVER_ROOT.'/design/' . $TemplateName . '.php');
72
+    /**
73
+     * This is a generic function to load a template fromm /design and render it.
74
+     * The template should be in /design/my_template_name.php, and have a class
75
+     * in it called MyTemplateNameTemplate (my_template_name transformed to
76
+     * MixedCase, with the word 'Template' appended).
77
+     * This class should have a public static function render($Args), where
78
+     * $Args is an associative array of the template variables.
79
+     * You should note that by "Template", we mean "php file that outputs stuff".
80
+     *
81
+     * This function loads /design/$TemplateName.php, and then calls
82
+     * render($Args) on the class.
83
+     *
84
+     * @param string $TemplateName The name of the template, in underscore_format
85
+     * @param array $Args the arguments passed to the template.
86
+     */
87
+    public static function render_template($TemplateName, $Args)
88
+    {
89
+        static $LoadedTemplates; // Keep track of templates we've already loaded.
90
+        $ClassName = '';
91
+        if (isset($LoadedTemplates[$TemplateName])) {
92
+            $ClassName = $LoadedTemplates[$TemplateName];
93
+        } else {
94
+            include(SERVER_ROOT.'/design/' . $TemplateName . '.php');
87 95
 
88
-      // Turn template_name into TemplateName
89
-      $ClassNameParts = explode('_', $TemplateName);
90
-      foreach ($ClassNameParts as $Index => $Part) {
91
-        $ClassNameParts[$Index] = ucfirst($Part);
92
-      }
93
-      $ClassName = implode($ClassNameParts). 'Template';
94
-      $LoadedTemplates[$TemplateName] = $ClassName;
96
+            // Turn template_name into TemplateName
97
+            $ClassNameParts = explode('_', $TemplateName);
98
+            foreach ($ClassNameParts as $Index => $Part) {
99
+                $ClassNameParts[$Index] = ucfirst($Part);
100
+            }
101
+            $ClassName = implode($ClassNameParts). 'Template';
102
+            $LoadedTemplates[$TemplateName] = $ClassName;
103
+        }
104
+        $ClassName::render($Args);
95 105
     }
96
-    $ClassName::render($Args);
97
-  }
98 106
 
99
-  /**
100
-   * This method is similar to render_template, but does not require a
101
-   * template class.
102
-   *
103
-   * Instead, this method simply renders a PHP file (PHTML) with the supplied
104
-   * variables.
105
-   *
106
-   * All files must be placed within {self::IncludePath}. Create and organize
107
-   * new paths and files. (e.g.: /design/views/artist/, design/view/forums/, etc.)
108
-   *
109
-   * @static
110
-   * @param string  $TemplateFile A relative path to a PHTML file
111
-   * @param array   $Variables Assoc. array of variables to extract for the template
112
-   * @param boolean $Buffer enables Output Buffer
113
-   * @return boolean|string
114
-   *
115
-   * @example <pre><?php
116
-   *  // box.phtml
117
-   *  <p id="<?=$id?>">Data</p>
118
-   *
119
-   *  // The variable $id within box.phtml will be filled by $some_id
120
-   *  View::parse('section/box.phtml', array('id' => $some_id));
121
-   *
122
-   *  // Parse a template without outputing it
123
-   *  $SavedTemplate = View::parse('sec/tion/eg.php', $DataArray, true);
124
-   *  // later . . .
125
-   *  echo $SavedTemplate; // Output the buffer
126
-   * </pre>
127
-   */
128
-  public static function parse($TemplateFile, array $Variables = [], $Buffer = false) {
129
-    $Template = self::IncludePath . $TemplateFile;
130
-    if (file_exists($Template)) {
131
-      extract($Variables);
132
-      if ($Buffer) {
133
-        ob_start();
134
-        include $Template;
135
-        $Content = ob_get_contents();
136
-        ob_end_clean();
137
-        return $Content;
138
-      }
139
-      return include $Template;
107
+    /**
108
+     * This method is similar to render_template, but does not require a
109
+     * template class.
110
+     *
111
+     * Instead, this method simply renders a PHP file (PHTML) with the supplied
112
+     * variables.
113
+     *
114
+     * All files must be placed within {self::IncludePath}. Create and organize
115
+     * new paths and files. (e.g.: /design/views/artist/, design/view/forums/, etc.)
116
+     *
117
+     * @static
118
+     * @param string  $TemplateFile A relative path to a PHTML file
119
+     * @param array   $Variables Assoc. array of variables to extract for the template
120
+     * @param boolean $Buffer enables Output Buffer
121
+     * @return boolean|string
122
+     *
123
+     * @example <pre><?php
124
+     *  // box.phtml
125
+     *  <p id="<?=$id?>">Data</p>
126
+     *
127
+     *  // The variable $id within box.phtml will be filled by $some_id
128
+     *  View::parse('section/box.phtml', array('id' => $some_id));
129
+     *
130
+     *  // Parse a template without outputing it
131
+     *  $SavedTemplate = View::parse('sec/tion/eg.php', $DataArray, true);
132
+     *  // later . . .
133
+     *  echo $SavedTemplate; // Output the buffer
134
+     * </pre>
135
+     */
136
+    public static function parse($TemplateFile, array $Variables = [], $Buffer = false)
137
+    {
138
+        $Template = self::IncludePath . $TemplateFile;
139
+        if (file_exists($Template)) {
140
+            extract($Variables);
141
+            if ($Buffer) {
142
+                ob_start();
143
+                include $Template;
144
+                $Content = ob_get_contents();
145
+                ob_end_clean();
146
+                return $Content;
147
+            }
148
+            return include $Template;
149
+        }
140 150
     }
141
-  }
142 151
 }

+ 156
- 166
sections/register/index.php View File

@@ -1,4 +1,4 @@
1
-<?
1
+<?php
2 2
 
3 3
 /*
4 4
 if (isset($LoggedUser)) {
@@ -11,195 +11,189 @@ if (isset($LoggedUser)) {
11 11
 
12 12
 include(SERVER_ROOT.'/classes/validate.class.php');
13 13
 
14
-$Val = NEW Validate;
14
+$Val = new Validate;
15 15
 
16 16
 if (!empty($_REQUEST['confirm'])) {
17
-  // Confirm registration
18
-  $DB->query("
17
+    // Confirm registration
18
+    $DB->query("
19 19
     SELECT ID
20 20
     FROM users_main
21 21
     WHERE torrent_pass = '".db_string($_REQUEST['confirm'])."'
22 22
       AND Enabled = '0'");
23
-  list($UserID) = $DB->next_record();
23
+    list($UserID) = $DB->next_record();
24 24
 
25
-  if ($UserID) {
26
-    $DB->query("
25
+    if ($UserID) {
26
+        $DB->query("
27 27
       UPDATE users_main
28 28
       SET Enabled = '1'
29 29
       WHERE ID = '$UserID'");
30
-    $Cache->increment('stats_user_count');
31
-    include('step2.php');
32
-  }
33
-
30
+        $Cache->increment('stats_user_count');
31
+        include('step2.php');
32
+    }
34 33
 } elseif (OPEN_REGISTRATION || !empty($_REQUEST['invite'])) {
35
-  $Val->SetFields('username', true, 'regex', 'You did not enter a valid username.', array('regex' => USERNAME_REGEX));
36
-  $Val->SetFields('email', true, 'email', 'You did not enter a valid email address.');
37
-  $Val->SetFields('password', true, 'regex', 'Your password must be at least 6 characters long.', array('regex'=>'/(?=^.{6,}$).*$/'));
38
-  $Val->SetFields('confirm_password', true, 'compare', 'Your passwords do not match.', array('comparefield' => 'password'));
39
-  $Val->SetFields('readrules', true, 'checkbox', 'You did not select the box that says you will read the rules.');
40
-  $Val->SetFields('readwiki', true, 'checkbox', 'You did not select the box that says you will read the wiki.');
41
-  $Val->SetFields('agereq', true, 'checkbox', 'You did not select the box that says you are 18 years of age or older.');
42
-  //$Val->SetFields('captcha', true, 'string', 'You did not enter a captcha code.', array('minlength' => 6, 'maxlength' => 6));
43
-
44
-  if (!apcu_exists('DBKEY')) {
45
-    $Err = "Registration temporarily disabled due to degraded database access (security measure)";
46
-  }
47
-
48
-  if (!empty($_POST['submit'])) {
49
-    // User has submitted registration form
50
-    $Err = $Val->ValidateForm($_REQUEST);
51
-    /*
52
-    if (!$Err && strtolower($_SESSION['captcha']) != strtolower($_REQUEST['captcha'])) {
53
-      $Err = 'You did not enter the correct captcha code.';
34
+    $Val->SetFields('username', true, 'regex', 'You did not enter a valid username.', array('regex' => USERNAME_REGEX));
35
+    $Val->SetFields('email', true, 'email', 'You did not enter a valid email address.');
36
+    $Val->SetFields('password', true, 'regex', 'Your password must be at least 6 characters long.', array('regex'=>'/(?=^.{6,}$).*$/'));
37
+    $Val->SetFields('confirm_password', true, 'compare', 'Your passwords do not match.', array('comparefield' => 'password'));
38
+    $Val->SetFields('readrules', true, 'checkbox', 'You did not select the box that says you will read the rules.');
39
+    $Val->SetFields('readwiki', true, 'checkbox', 'You did not select the box that says you will read the wiki.');
40
+    $Val->SetFields('agereq', true, 'checkbox', 'You did not select the box that says you are 18 years of age or older.');
41
+    //$Val->SetFields('captcha', true, 'string', 'You did not enter a captcha code.', array('minlength' => 6, 'maxlength' => 6));
42
+
43
+    if (!apcu_exists('DBKEY')) {
44
+        $Err = "Registration temporarily disabled due to degraded database access (security measure).";
54 45
     }
55
-    */
56
-    if (!$Err) {
57
-      // Don't allow a username of "0" or "1" due to PHP's type juggling
58
-      if (trim($_POST['username']) == '0' || trim($_POST['username']) == '1') {
59
-        $Err = 'You cannot have a username of "0" or "1".';
60
-      }
61
-
62
-      $DB->query("
46
+
47
+    if (!empty($_POST['submit'])) {
48
+        // User has submitted registration form
49
+        $Err = $Val->ValidateForm($_REQUEST);
50
+        /*
51
+        if (!$Err && strtolower($_SESSION['captcha']) !== strtolower($_REQUEST['captcha'])) {
52
+          $Err = 'You did not enter the correct captcha code.';
53
+        }
54
+        */
55
+        if (!$Err) {
56
+            // Don't allow a username of "0" or "1" due to PHP's type juggling
57
+            if (trim($_POST['username']) === '0' || trim($_POST['username']) === '1') {
58
+                $Err = 'You cannot have a username of "0" or "1."';
59
+            }
60
+
61
+            $DB->query("
63 62
         SELECT COUNT(ID)
64 63
         FROM users_main
65 64
         WHERE Username LIKE '".db_string(trim($_POST['username']))."'");
66
-      list($UserCount) = $DB->next_record();
65
+            list($UserCount) = $DB->next_record();
67 66
 
68
-      if ($UserCount) {
69
-        $Err = 'There is already someone registered with that username.';
70
-        $_REQUEST['username'] = '';
71
-      }
67
+            if ($UserCount) {
68
+                $Err = 'There is already someone registered with that username.';
69
+                $_REQUEST['username'] = '';
70
+            }
72 71
 
73
-      if ($_REQUEST['invite']) {
74
-        $DB->query("
72
+            if ($_REQUEST['invite']) {
73
+                $DB->query("
75 74
           SELECT InviterID, Email, Reason
76 75
           FROM invites
77 76
           WHERE InviteKey = '".db_string($_REQUEST['invite'])."'");
78
-        if (!$DB->has_results()) {
79
-          $Err = 'Invite does not exist.';
80
-          $InviterID = 0;
81
-        } else {
82
-          list($InviterID, $InviteEmail, $InviteReason) = $DB->next_record(MYSQLI_NUM, false);
83
-          $InviteEmail = Crypto::decrypt($InviteEmail);
77
+                if (!$DB->has_results()) {
78
+                    $Err = 'Invite does not exist.';
79
+                    $InviterID = 0;
80
+                } else {
81
+                    list($InviterID, $InviteEmail, $InviteReason) = $DB->next_record(MYSQLI_NUM, false);
82
+                    $InviteEmail = Crypto::decrypt($InviteEmail);
83
+                }
84
+            } else {
85
+                $InviterID = 0;
86
+                $InviteEmail = $_REQUEST['email'];
87
+                $InviteReason = '';
88
+            }
84 89
         }
85
-      } else {
86
-        $InviterID = 0;
87
-        $InviteEmail = $_REQUEST['email'];
88
-        $InviteReason = '';
89
-      }
90
-    }
91 90
 
92
-    if (!$Err) {
93
-      $torrent_pass = Users::make_secret();
91
+        if (!$Err) {
92
+            $torrent_pass = Users::make_secret();
94 93
 
95
-      // Previously SELECT COUNT(ID) FROM users_main, which is a lot slower.
96
-      $DB->query("
94
+            // Previously SELECT COUNT(ID) FROM users_main, which is a lot slower
95
+            $DB->query("
97 96
         SELECT ID
98 97
         FROM users_main
99 98
         LIMIT 1");
100
-      $UserCount = $DB->record_count();
101
-      if ($UserCount == 0) {
102
-        $NewInstall = true;
103
-        $Class = SYSOP;
104
-        $Enabled = '1';
105
-      } else {
106
-        $NewInstall = false;
107
-        $Class = USER;
108
-        $Enabled = '0';
109
-      }
110
-
111
-      $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']);
112
-
113
-      $DB->query("
99
+            $UserCount = $DB->record_count();
100
+            if ($UserCount =0= 0) {
101
+                $NewInstall = true;
102
+                $Class = SYSOP;
103
+                $Enabled = '1';
104
+            } else {
105
+                $NewInstall = false;
106
+                $Class = USER;
107
+                $Enabled = '0';
108
+            }
109
+
110
+            $IPcc = Tools::geoip($_SERVER['REMOTE_ADDR']);
111
+
112
+            $DB->query("
114 113
         INSERT INTO users_main
115
-          (Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, Uploaded, ipcc)
114
+          (Username, Email, PassHash, torrent_pass, IP, PermissionID, Enabled, Invites, FLTokens, Uploaded, ipcc)
116 115
         VALUES
117
-          ('".db_string(trim($_POST['username']))."', '".Crypto::encrypt($_POST['email'])."', '".db_string(Users::make_sec_hash($_POST['password']))."', '".db_string($torrent_pass)."', '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', '$Class', '$Enabled', '".STARTING_INVITES."', '".STARTING_UPLOAD."', '$IPcc')");
116
+          ('".db_string(trim($_POST['username']))."', '".Crypto::encrypt($_POST['email'])."', '".db_string(Users::make_sec_hash($_POST['password']))."', '".db_string($torrent_pass)."', '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', '$Class', '$Enabled', '".STARTING_INVITES."', '".STARTING_TOKENS."', '".STARTING_UPLOAD."', '$IPcc')");
118 117
 
119
-      $UserID = $DB->inserted_id();
118
+            $UserID = $DB->inserted_id();
120 119
 
121
-
122
-      // User created, delete invite. If things break after this point, then it's better to have a broken account to fix than a 'free' invite floating around that can be reused
123
-      $DB->query("
120
+            // User created, delete invite. If things break after this point, then it's better to have a broken account to fix than a 'free' invite floating around that can be reused
121
+            $DB->query("
124 122
         DELETE FROM invites
125 123
         WHERE InviteKey = '".db_string($_REQUEST['invite'])."'");
126 124
 
127
-      // Award invite badge to inviter if they don't have it
128
-      if (Badges::award_badge($InviterID, 136)) {
129
-        Misc::send_pm($InviterID, 0, 'You have received a badge!', "You have received a badge for inviting a user to the site.\n\nIt can be enabled from your user settings.");
130
-        $Cache->delete_value('user_badges_'.$InviterID);
131
-      }
125
+            // Award invite badge to inviter if they don't have it
126
+            if (Badges::award_badge($InviterID, 136)) {
127
+                Misc::send_pm($InviterID, 0, 'You have received a badge!', "You have received a badge for inviting a user to the site.\n\nIt can be enabled from your user settings.");
128
+                $Cache->delete_value('user_badges_'.$InviterID);
129
+            }
132 130
 
133
-      $DB->query("
131
+            $DB->query("
134 132
         SELECT ID
135 133
         FROM stylesheets
136 134
         WHERE `Default` = '1'");
137
-      list($StyleID) = $DB->next_record();
138
-      $AuthKey = Users::make_secret();
135
+            list($StyleID) = $DB->next_record();
136
+            $AuthKey = Users::make_secret();
139 137
 
140
-      if ($InviteReason !== '') {
141
-        $InviteReason = db_string(sqltime()." - $InviteReason");
142
-      }
143
-      $DB->query("
138
+            if ($InviteReason !== '') {
139
+                $InviteReason = db_string(sqltime()." - $InviteReason");
140
+            }
141
+            $DB->query("
144 142
         INSERT INTO users_info
145 143
           (UserID, StyleID, AuthKey, Inviter, JoinDate, AdminComment)
146 144
         VALUES
147 145
           ('$UserID', '$StyleID', '".db_string($AuthKey)."', '$InviterID', NOW(), '$InviteReason')");
148 146
 
149
-      $DB->query("
147
+            $DB->query("
150 148
         INSERT INTO users_history_ips
151 149
           (UserID, IP, StartTime)
152 150
         VALUES
153 151
           ('$UserID', '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."', NOW())");
154
-      $DB->query("
152
+            $DB->query("
155 153
         INSERT INTO users_notifications_settings
156 154
           (UserID)
157 155
         VALUES
158 156
           ('$UserID')");
159 157
 
160
-
161
-      $DB->query("
158
+            $DB->query("
162 159
         INSERT INTO users_history_emails
163 160
           (UserID, Email, Time, IP)
164 161
         VALUES
165 162
           ('$UserID', '".Crypto::encrypt($_REQUEST['email'])."', NULL, '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
166 163
 
167
-      if ($_REQUEST['email'] != $InviteEmail) {
168
-        $DB->query("
164
+            if ($_REQUEST['email'] != $InviteEmail) {
165
+                $DB->query("
169 166
           INSERT INTO users_history_emails
170 167
             (UserID, Email, Time, IP)
171 168
           VALUES
172 169
             ('$UserID', '".Crypto::encrypt($InviteEmail)."', NOW(), '".Crypto::encrypt($_SERVER['REMOTE_ADDR'])."')");
173
-      }
174
-
175
-
170
+            }
176 171
 
177
-      // Manage invite trees, delete invite
178
-
179
-      if ($InviterID !== null && $InviterID !== 0) {
180
-        $DB->query("
172
+            // Manage invite trees, delete invite
173
+            if ($InviterID !== null && $InviterID !== 0) {
174
+                $DB->query("
181 175
           SELECT TreePosition, TreeID, TreeLevel
182 176
           FROM invite_tree
183 177
           WHERE UserID = '$InviterID'");
184
-        list($InviterTreePosition, $TreeID, $TreeLevel) = $DB->next_record();
178
+                list($InviterTreePosition, $TreeID, $TreeLevel) = $DB->next_record();
185 179
 
186
-        // If the inviter doesn't have an invite tree
187
-        // Note: This should never happen unless you've transferred from another database, like What.CD did
188
-        if (!$DB->has_results()) {
189
-          $DB->query("
180
+                // If the inviter doesn't have an invite tree
181
+                // Note: This should never happen unless you've transferred from another database, like What.CD did
182
+                if (!$DB->has_results()) {
183
+                    $DB->query("
190 184
             SELECT MAX(TreeID) + 1
191 185
             FROM invite_tree");
192
-          list($TreeID) = $DB->next_record();
186
+                    list($TreeID) = $DB->next_record();
193 187
 
194
-          $DB->query("
188
+                    $DB->query("
195 189
             INSERT INTO invite_tree
196 190
               (UserID, InviterID, TreePosition, TreeID, TreeLevel)
197 191
             VALUES ('$InviterID', '0', '1', '$TreeID', '1')");
198 192
 
199
-          $TreePosition = 2;
200
-          $TreeLevel = 2;
201
-        } else {
202
-          $DB->query("
193
+                    $TreePosition = 2;
194
+                    $TreeLevel = 2;
195
+                } else {
196
+                    $DB->query("
203 197
             SELECT TreePosition
204 198
             FROM invite_tree
205 199
             WHERE TreePosition > '$InviterTreePosition'
@@ -207,76 +201,72 @@ if (!empty($_REQUEST['confirm'])) {
207 201
               AND TreeID = '$TreeID'
208 202
             ORDER BY TreePosition
209 203
             LIMIT 1");
210
-          list($TreePosition) = $DB->next_record();
204
+                    list($TreePosition) = $DB->next_record();
211 205
 
212
-          if ($TreePosition) {
213
-            $DB->query("
206
+                    if ($TreePosition) {
207
+                        $DB->query("
214 208
               UPDATE invite_tree
215 209
               SET TreePosition = TreePosition + 1
216 210
               WHERE TreeID = '$TreeID'
217 211
                 AND TreePosition >= '$TreePosition'");
218
-          } else {
219
-            $DB->query("
212
+                    } else {
213
+                        $DB->query("
220 214
               SELECT TreePosition + 1
221 215
               FROM invite_tree
222 216
               WHERE TreeID = '$TreeID'
223 217
               ORDER BY TreePosition DESC
224 218
               LIMIT 1");
225
-            list($TreePosition) = $DB->next_record();
226
-          }
227
-          $TreeLevel++;
219
+                        list($TreePosition) = $DB->next_record();
220
+                    }
221
+                    $TreeLevel++;
228 222
 
229
-          // Create invite tree record
230
-          $DB->query("
223
+                    // Create invite tree record
224
+                    $DB->query("
231 225
             INSERT INTO invite_tree
232 226
               (UserID, InviterID, TreePosition, TreeID, TreeLevel)
233 227
             VALUES
234 228
               ('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')");
235
-        }
236
-      } else { // No inviter (open registration)
237
-        $DB->query("
229
+                }
230
+            } else { // No inviter (open registration)
231
+                $DB->query("
238 232
           SELECT MAX(TreeID)
239 233
           FROM invite_tree");
240
-        list($TreeID) = $DB->next_record();
241
-        $TreeID++;
242
-        $InviterID = 0;
243
-        $TreePosition = 1;
244
-        $TreeLevel = 1;
245
-      }
246
-
247
-      include(SERVER_ROOT.'/classes/templates.class.php');
248
-      $TPL = NEW TEMPLATE;
249
-      $TPL->open(SERVER_ROOT.'/templates/new_registration.tpl');
250
-
251
-      $TPL->set('Username', $_REQUEST['username']);
252
-      $TPL->set('TorrentKey', $torrent_pass);
253
-      $TPL->set('SITE_NAME', SITE_NAME);
254
-      $TPL->set('SITE_DOMAIN', SITE_DOMAIN);
255
-
256
-      Misc::send_email($_REQUEST['email'], 'New account confirmation at '.SITE_NAME, $TPL->get(), 'noreply');
257
-      Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
258
-      $Sent = 1;
259
-
260
-
261
-    }
262
-  } elseif ($_GET['invite']) {
263
-    // If they haven't submitted the form, check to see if their invite is good
264
-    $DB->query("
234
+                list($TreeID) = $DB->next_record();
235
+                $TreeID++;
236
+                $InviterID = 0;
237
+                $TreePosition = 1;
238
+                $TreeLevel = 1;
239
+            }
240
+
241
+            include(SERVER_ROOT.'/classes/templates.class.php');
242
+            $TPL = new TEMPLATE;
243
+            $TPL->open(SERVER_ROOT.'/templates/new_registration.tpl');
244
+
245
+            $TPL->set('Username', $_REQUEST['username']);
246
+            $TPL->set('TorrentKey', $torrent_pass);
247
+            $TPL->set('SITE_NAME', SITE_NAME);
248
+            $TPL->set('SITE_DOMAIN', SITE_DOMAIN);
249
+
250
+            Misc::send_email($_REQUEST['email'], 'New account confirmation at '.SITE_NAME, $TPL->get(), 'noreply');
251
+            Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $torrent_pass));
252
+            $Sent = 1;
253
+        }
254
+    } elseif ($_GET['invite']) {
255
+        // If they haven't submitted the form, check to see if their invite is good
256
+        $DB->query("
265 257
       SELECT InviteKey
266 258
       FROM invites
267 259
       WHERE InviteKey = '".db_string($_GET['invite'])."'");
268
-    if (!$DB->has_results()) {
269
-      error('Invite not found!');
260
+        if (!$DB->has_results()) {
261
+            error('Invite not found!');
262
+        }
270 263
     }
271
-  }
272
-
273
-  include('step1.php');
274 264
 
265
+    include('step1.php');
275 266
 } elseif (!OPEN_REGISTRATION) {
276
-  if (isset($_GET['welcome'])) {
277
-    include('code.php');
278
-  } else {
279
-    include('closed.php');
280
-  }
267
+    if (isset($_GET['welcome'])) {
268
+        include('code.php');
269
+    } else {
270
+        include('closed.php');
271
+    }
281 272
 }
282
-?>

+ 1
- 1
sections/rules/upload.php View File

@@ -417,7 +417,7 @@ View::show_header('Uploading Rules', 'rules');
417 417
           <strong>Torrent Description.</strong>
418 418
           Specific info about the protocols and equipment relevant to <em>this</em> data.
419 419
           This text is hidden by default.
420
-          It displays when you click the Torrent Title next to [ DL | PL ].
420
+          It displays when you click the Torrent Title next to [ DL | RP ].
421 421
           Please discuss materials and methods here.
422 422
           <br /><br />
423 423
         </li>

Loading…
Cancel
Save