Browse Source

Staff blog redux

biotorrents 4 years ago
parent
commit
e2e4695d72
3 changed files with 182 additions and 302 deletions
  1. 0
    42
      classes/notificationsmanager.class.php
  2. 0
    36
      design/privateheader.php
  3. 182
    224
      sections/index/private.php

+ 0
- 42
classes/notificationsmanager.class.php View File

24
     // Types. These names must correspond to column names in users_notifications_settings
24
     // Types. These names must correspond to column names in users_notifications_settings
25
     const NEWS = 'News';
25
     const NEWS = 'News';
26
     const BLOG = 'Blog';
26
     const BLOG = 'Blog';
27
-    const STAFFBLOG = 'StaffBlog';
28
     const STAFFPM = 'StaffPM';
27
     const STAFFPM = 'StaffPM';
29
     const INBOX = 'Inbox';
28
     const INBOX = 'Inbox';
30
     const QUOTES = 'Quotes';
29
     const QUOTES = 'Quotes';
85
                 $this->load_blog();
84
                 $this->load_blog();
86
             }
85
             }
87
 
86
 
88
-            // if (!isset($this->Skipped[self::STAFFBLOG])) {
89
-            //   $this->load_staff_blog();
90
-            // }
91
-
92
             if (!isset($this->Skipped[self::STAFFPM])) {
87
             if (!isset($this->Skipped[self::STAFFPM])) {
93
                 $this->load_staff_pms();
88
                 $this->load_staff_pms();
94
             }
89
             }
313
         }
308
         }
314
     }
309
     }
315
 
310
 
316
-    public function load_staff_blog()
317
-    {
318
-        if (check_perms('users_mod')) {
319
-            global $SBlogReadTime, $LatestSBlogTime;
320
-            if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_' . G::$LoggedUser['ID'])) === false) {
321
-                $QueryID = G::$DB->get_query_id();
322
-                G::$DB->query("
323
-                SELECT Time
324
-                FROM staff_blog_visits
325
-                  WHERE UserID = " . G::$LoggedUser['ID']);
326
-                if (list($SBlogReadTime) = G::$DB->next_record()) {
327
-                    $SBlogReadTime = strtotime($SBlogReadTime);
328
-                } else {
329
-                    $SBlogReadTime = 0;
330
-                }
331
-                G::$DB->set_query_id($QueryID);
332
-                G::$Cache->cache_value('staff_blog_read_' . G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
333
-            }
334
-            if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
335
-                $QueryID = G::$DB->get_query_id();
336
-                G::$DB->query('
337
-                SELECT MAX(Time)
338
-                FROM staff_blog');
339
-                if (list($LatestSBlogTime) = G::$DB->next_record()) {
340
-                    $LatestSBlogTime = strtotime($LatestSBlogTime);
341
-                } else {
342
-                    $LatestSBlogTime = 0;
343
-                }
344
-                G::$DB->set_query_id($QueryID);
345
-                G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
346
-            }
347
-            if ($SBlogReadTime < $LatestSBlogTime) {
348
-                $this->create_notification(self::STAFFBLOG, 0, 'New Staff Blog Post!', 'staffblog.php', self::IMPORTANT);
349
-            }
350
-        }
351
-    }
352
-
353
     public function load_staff_pms()
311
     public function load_staff_pms()
354
     {
312
     {
355
         $NewStaffPMs = G::$Cache->get_value('staff_pm_new_' . G::$LoggedUser['ID']);
313
         $NewStaffPMs = G::$Cache->get_value('staff_pm_new_' . G::$LoggedUser['ID']);

+ 0
- 36
design/privateheader.php View File

471
 $Alerts = [];
471
 $Alerts = [];
472
 $ModBar = [];
472
 $ModBar = [];
473
 
473
 
474
-// Staff blog
475
-if (check_perms('users_mod')) {
476
-    global $SBlogReadTime, $LatestSBlogTime;
477
-    if (!$SBlogReadTime && ($SBlogReadTime = G::$Cache->get_value('staff_blog_read_'.G::$LoggedUser['ID'])) === false) {
478
-        G::$DB->query("
479
-          SELECT Time
480
-          FROM staff_blog_visits
481
-          WHERE UserID = ".G::$LoggedUser['ID']);
482
-
483
-        if (list($SBlogReadTime) = G::$DB->next_record()) {
484
-            $SBlogReadTime = strtotime($SBlogReadTime);
485
-        } else {
486
-            $SBlogReadTime = 0;
487
-        }
488
-        G::$Cache->cache_value('staff_blog_read_'.G::$LoggedUser['ID'], $SBlogReadTime, 1209600);
489
-    }
490
-
491
-    if (!$LatestSBlogTime && ($LatestSBlogTime = G::$Cache->get_value('staff_blog_latest_time')) === false) {
492
-        G::$DB->query("
493
-          SELECT MAX(Time)
494
-          FROM staff_blog");
495
-        list($LatestSBlogTime) = G::$DB->next_record();
496
-
497
-        if ($LatestSBlogTime) {
498
-            $LatestSBlogTime = strtotime($LatestSBlogTime);
499
-        } else {
500
-            $LatestSBlogTime = 0;
501
-        }
502
-        G::$Cache->cache_value('staff_blog_latest_time', $LatestSBlogTime, 1209600);
503
-    }
504
-
505
-    if ($SBlogReadTime < $LatestSBlogTime) {
506
-        $Alerts[] = '<a href="staffblog.php">New staff blog post!</a>';
507
-    }
508
-}
509
-
510
 // Inbox
474
 // Inbox
511
 if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
475
 if ($NotificationsManager->is_traditional(NotificationsManager::INBOX)) {
512
     $NotificationsManager->load_inbox();
476
     $NotificationsManager->load_inbox();

+ 182
- 224
sections/index/private.php View File

35
 }
35
 }
36
 
36
 
37
 View::show_header('News', 'news_ajax');
37
 View::show_header('News', 'news_ajax');
38
-#View::show_header('News', 'bbcode,news_ajax');
39
 ?>
38
 ?>
40
-<div>
41
-  <div class="sidebar">
42
-    <?php #include 'connect.php';?>
43
 
39
 
40
+<div class="sidebar">
41
+  <?php #include 'connect.php';?>
42
+
43
+  <ul class="stats nobullet">
44
     <?php
44
     <?php
45
-    # Staff blog
46
-if (check_perms('users_mod')) { ?>
47
-    <div class="box">
48
-      <div class="head colhead_dark">
49
-        <strong><a href="staffblog.php">Latest staff blog posts</a></strong>
50
-      </div>
51
-      <?php
52
-if (($Blog = $Cache->get_value('staff_blog')) === false) {
53
-    $DB->query("
54
-    SELECT
55
-      b.ID,
56
-      um.Username,
57
-      b.Title,
58
-      b.Body,
59
-      b.Time
60
-    FROM staff_blog AS b
61
-      LEFT JOIN users_main AS um ON b.UserID = um.ID
62
-    ORDER BY Time DESC");
63
-    $Blog = $DB->to_array(false, MYSQLI_NUM);
64
-    $Cache->cache_value('staff_blog', $Blog, 1209600);
65
-}
66
-    if (($SBlogReadTime = $Cache->get_value('staff_blog_read_'.$LoggedUser['ID'])) === false) {
67
-        $DB->query("
68
-    SELECT Time
69
-    FROM staff_blog_visits
70
-    WHERE UserID = ".$LoggedUser['ID']);
71
-        if (list($SBlogReadTime) = $DB->next_record()) {
72
-            $SBlogReadTime = strtotime($SBlogReadTime);
73
-        } else {
74
-            $SBlogReadTime = 0;
75
-        }
76
-        $Cache->cache_value('staff_blog_read_'.$LoggedUser['ID'], $SBlogReadTime, 1209600);
77
-    } ?>
78
-      <ul class="stats nobullet">
79
-        <?php
80
 $End = min(count($Blog), 5);
45
 $End = min(count($Blog), 5);
81
     for ($i = 0; $i < $End; $i++) {
46
     for ($i = 0; $i < $End; $i++) {
82
         list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
47
         list($BlogID, $Author, $Title, $Body, $BlogTime) = $Blog[$i];
83
         $BlogTime = strtotime($BlogTime); ?>
48
         $BlogTime = strtotime($BlogTime); ?>
84
-        <li>
85
-          <?=$SBlogReadTime < $BlogTime ? '<strong>' : ''?><?=($i + 1)?>.
86
-          <a href="staffblog.php#blog<?=$BlogID?>"><?=$Title?></a>
87
-          <?=$SBlogReadTime < $BlogTime ? '</strong>' : ''?>
88
-        </li>
89
-        <?php
49
+    <?php
90
     } ?>
50
     } ?>
91
-      </ul>
92
-    </div>
51
+  </ul>
52
+
53
+  <div class="box">
54
+    <div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
93
     <?php
55
     <?php
94
-} ?>
95
-    <div class="box">
96
-      <div class="head colhead_dark"><strong><a href="blog.php">Latest blog posts</a></strong></div>
97
-      <?php
98
 if (($Blog = $Cache->get_value('blog')) === false) {
56
 if (($Blog = $Cache->get_value('blog')) === false) {
99
         $DB->query("
57
         $DB->query("
100
     SELECT
58
     SELECT
113
         $Cache->cache_value('blog', $Blog, 1209600);
71
         $Cache->cache_value('blog', $Blog, 1209600);
114
     }
72
     }
115
 ?>
73
 ?>
116
-      <ul class="stats nobullet">
117
-        <?php
74
+    <ul class="stats nobullet">
75
+      <?php
118
 if (count($Blog) < 5) {
76
 if (count($Blog) < 5) {
119
     $Limit = count($Blog);
77
     $Limit = count($Blog);
120
 } else {
78
 } else {
122
 }
80
 }
123
 for ($i = 0; $i < $Limit; $i++) {
81
 for ($i = 0; $i < $Limit; $i++) {
124
     list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; ?>
82
     list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $Blog[$i]; ?>
125
-        <li>
126
-          <?=($i + 1)?>. <a
127
-            href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
128
-        </li>
129
-        <?php
83
+      <li>
84
+        <?=($i + 1)?>. <a
85
+          href="blog.php#blog<?=$BlogID?>"><?=$Title?></a>
86
+      </li>
87
+      <?php
130
 }
88
 }
131
 ?>
89
 ?>
132
-      </ul>
133
-    </div>
134
-    <?php
90
+    </ul>
91
+  </div>
92
+  <?php
135
 if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
93
 if (($Freeleeches = $Cache->get_value('shop_freeleech_list')) === false) {
136
     $DB->query("
94
     $DB->query("
137
     SELECT
95
     SELECT
149
 }
107
 }
150
 if (count($Freeleeches)) {
108
 if (count($Freeleeches)) {
151
     ?>
109
     ?>
152
-    <div class="box">
153
-      <div class="head colhead_dark"><strong><a
154
-            href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
155
-      <ul class="stats nobullet">
156
-        <?php
110
+  <div class="box">
111
+    <div class="head colhead_dark"><strong><a
112
+          href="torrents.php?freetorrent=1&order_by=seeders&order_way=asc">Freeleeches</a></strong></div>
113
+    <ul class="stats nobullet">
114
+      <?php
157
   for ($i = 0; $i < count($Freeleeches); $i++) {
115
   for ($i = 0; $i < count($Freeleeches); $i++) {
158
       list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
116
       list($ID, $ExpiryTime, $Name, $Image) = $Freeleeches[$i];
159
       if ($ExpiryTime < time()) {
117
       if ($ExpiryTime < time()) {
165
           $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
123
           $DisplayName .= ' data-cover="'.ImageTools::process($Image, 'thumb').'"';
166
       }
124
       }
167
       $DisplayName .= '>'.$Name.'</a>'; ?>
125
       $DisplayName .= '>'.$Name.'</a>'; ?>
168
-        <li>
169
-          <strong class="fl_time"><?=$DisplayTime?></strong>
170
-          <?=$DisplayName?>
171
-        </li>
172
-        <?php
126
+      <li>
127
+        <strong class="fl_time"><?=$DisplayTime?></strong>
128
+        <?=$DisplayName?>
129
+      </li>
130
+      <?php
173
   } ?>
131
   } ?>
174
-      </ul>
175
-    </div>
176
-    <?php
132
+    </ul>
133
+  </div>
134
+  <?php
177
 }
135
 }
178
 ?>
136
 ?>
179
 
137
 
180
-    <!-- Stats -->
181
-    <div class="box">
182
-      <div class="head colhead_dark"><strong>Stats</strong></div>
183
-      <ul class="stats nobullet">
184
-        <?php if (USER_LIMIT > 0) { ?>
185
-        <li>Maximum users: <?=number_format(USER_LIMIT) ?>
186
-        </li>
187
-        <?php
138
+  <!-- Stats -->
139
+  <div class="box">
140
+    <div class="head colhead_dark"><strong>Stats</strong></div>
141
+    <ul class="stats nobullet">
142
+      <?php if (USER_LIMIT > 0) { ?>
143
+      <li>Maximum users: <?=number_format(USER_LIMIT) ?>
144
+      </li>
145
+      <?php
188
 }
146
 }
189
 
147
 
190
 if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
148
 if (($UserCount = $Cache->get_value('stats_user_count')) === false) {
197
 }
155
 }
198
 $UserCount = (int)$UserCount;
156
 $UserCount = (int)$UserCount;
199
 ?>
157
 ?>
200
-        <li>
201
-          Enabled users: <?=number_format($UserCount)?>
202
-          <a href="stats.php?action=users" class="brackets">Details</a>
203
-        </li>
204
-        <?php
158
+      <li>
159
+        Enabled users: <?=number_format($UserCount)?>
160
+        <a href="stats.php?action=users" class="brackets">Details</a>
161
+      </li>
162
+      <?php
205
 
163
 
206
 if (($UserStats = $Cache->get_value('stats_users')) === false) {
164
 if (($UserStats = $Cache->get_value('stats_users')) === false) {
207
     $DB->query("
165
     $DB->query("
228
     $Cache->cache_value('stats_users', $UserStats, 0);
186
     $Cache->cache_value('stats_users', $UserStats, 0);
229
 }
187
 }
230
 ?>
188
 ?>
231
-        <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)
232
-        </li>
233
-        <li>Users active this week: <?=number_format($UserStats['Week'])?>
234
-          (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)
235
-        </li>
236
-        <li>Users active this month: <?=number_format($UserStats['Month'])?>
237
-          (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)
238
-        </li>
239
-        <?php
189
+      <li>Users active today: <?=number_format($UserStats['Day'])?> (<?=number_format($UserStats['Day'] / $UserCount * 100, 2)?>%)
190
+      </li>
191
+      <li>Users active this week: <?=number_format($UserStats['Week'])?>
192
+        (<?=number_format($UserStats['Week'] / $UserCount * 100, 2)?>%)
193
+      </li>
194
+      <li>Users active this month: <?=number_format($UserStats['Month'])?>
195
+        (<?=number_format($UserStats['Month'] / $UserCount * 100, 2)?>%)
196
+      </li>
197
+      <?php
240
 
198
 
241
 if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
199
 if (($TorrentCount = $Cache->get_value('stats_torrent_count')) === false) {
242
     $DB->query("
200
     $DB->query("
262
     $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
220
     $Cache->cache_value('stats_torrent_size_total', $TorrentSizeTotal, 86400); // 1 day cache
263
 }
221
 }
264
 ?>
222
 ?>
265
-        <li>
266
-          Total size of torrents:
267
-          <?=Format::get_size($TorrentSizeTotal)?>
268
-        </li>
223
+      <li>
224
+        Total size of torrents:
225
+        <?=Format::get_size($TorrentSizeTotal)?>
226
+      </li>
269
 
227
 
270
-        <?php
228
+      <?php
271
 if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
229
 if (($ArtistCount = $Cache->get_value('stats_artist_count')) === false) {
272
     $DB->query("
230
     $DB->query("
273
     SELECT COUNT(ArtistID)
231
     SELECT COUNT(ArtistID)
277
 }
235
 }
278
 
236
 
279
 ?>
237
 ?>
280
-        <li>
281
-          Torrents:
282
-          <?=number_format($TorrentCount)?>
283
-          <a href="stats.php?action=torrents" class="brackets">Details</a>
284
-        </li>
285
-
286
-        <li>Torrent Groups: <?=number_format($GroupCount)?>
287
-        </li>
288
-        <li>Artists: <?=number_format($ArtistCount)?>
289
-        </li>
290
-        <?php
238
+      <li>
239
+        Torrents:
240
+        <?=number_format($TorrentCount)?>
241
+        <a href="stats.php?action=torrents" class="brackets">Details</a>
242
+      </li>
243
+
244
+      <li>Torrent Groups: <?=number_format($GroupCount)?>
245
+      </li>
246
+      <li>Artists: <?=number_format($ArtistCount)?>
247
+      </li>
248
+      <?php
291
 // End Torrent Stats
249
 // End Torrent Stats
292
 
250
 
293
 if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
251
 if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
313
 }
271
 }
314
 
272
 
315
 ?>
273
 ?>
316
-        <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
317
-        <?php
274
+      <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
275
+      <?php
318
 
276
 
319
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {
277
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {
320
     ?>
278
     ?>
321
-        <li>Snatches: <?=number_format($SnatchStats)?>
322
-        </li>
323
-        <?php
279
+      <li>Snatches: <?=number_format($SnatchStats)?>
280
+      </li>
281
+      <?php
324
 }
282
 }
325
 
283
 
326
 if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
284
 if (($PeerStats = $Cache->get_value('stats_peers')) === false) {
353
     $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
311
     $PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
354
 }
312
 }
355
 ?>
313
 ?>
356
-        <li>Peers: <?=$PeerCount?>
357
-        </li>
358
-        <li>Seeders: <?=$SeederCount?>
359
-        </li>
360
-        <li>Leechers: <?=$LeecherCount?>
361
-        </li>
362
-        <li>Seeder/leecher ratio: <?=$Ratio?>
363
-        </li>
364
-      </ul>
365
-    </div>
314
+      <li>Peers: <?=$PeerCount?>
315
+      </li>
316
+      <li>Seeders: <?=$SeederCount?>
317
+      </li>
318
+      <li>Leechers: <?=$LeecherCount?>
319
+      </li>
320
+      <li>Seeder/leecher ratio: <?=$Ratio?>
321
+      </li>
322
+    </ul>
323
+  </div>
366
 
324
 
367
-    <!-- Polls -->
368
-    <?php
325
+  <!-- Polls -->
326
+  <?php
369
 if (($TopicID = $Cache->get_value('polls_featured')) === false) {
327
 if (($TopicID = $Cache->get_value('polls_featured')) === false) {
370
     $DB->query("
328
     $DB->query("
371
     SELECT TopicID
329
     SELECT TopicID
422
       AND TopicID = '$TopicID'");
380
       AND TopicID = '$TopicID'");
423
     list($UserResponse) = $DB->next_record(); ?>
381
     list($UserResponse) = $DB->next_record(); ?>
424
 
382
 
425
-    <div class="box">
426
-      <div class="head colhead_dark"><strong>Poll<?php if ($Closed) {
383
+  <div class="box">
384
+    <div class="head colhead_dark"><strong>Poll<?php if ($Closed) {
427
         echo ' [Closed]';
385
         echo ' [Closed]';
428
     } ?>
386
     } ?>
429
-        </strong>
430
-      </div>
431
-      <div class="pad">
432
-        <p><strong><?=display_str($Question)?></strong></p>
433
-        <?php if ($UserResponse !== null || $Closed) { ?>
434
-        <ul class="poll nobullet">
435
-          <?php foreach ($Answers as $i => $Answer) {
387
+      </strong>
388
+    </div>
389
+    <div class="pad">
390
+      <p><strong><?=display_str($Question)?></strong></p>
391
+      <?php if ($UserResponse !== null || $Closed) { ?>
392
+      <ul class="poll nobullet">
393
+        <?php foreach ($Answers as $i => $Answer) {
436
         if ($TotalVotes > 0) {
394
         if ($TotalVotes > 0) {
437
             $Ratio = $Votes[$i] / $MaxVotes;
395
             $Ratio = $Votes[$i] / $MaxVotes;
438
             $Percent = $Votes[$i] / $TotalVotes;
396
             $Percent = $Votes[$i] / $TotalVotes;
440
             $Ratio = 0;
398
             $Ratio = 0;
441
             $Percent = 0;
399
             $Percent = 0;
442
         } ?>
400
         } ?>
443
-          <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
444
-            <li class="graph">
445
-              <span class="center_poll"
446
-                style="width: <?=round($Ratio * 140)?>px;"></span>
447
-              <br />
448
-            </li>
449
-            <?php
401
+        <li<?=((!empty($UserResponse) && ($UserResponse == $i))?' class="poll_your_answer"':'')?>><?=display_str($Answers[$i])?> (<?=number_format($Percent * 100, 2)?>%)</li>
402
+          <li class="graph">
403
+            <span class="center_poll"
404
+              style="width: <?=round($Ratio * 140)?>px;"></span>
405
+            <br />
406
+          </li>
407
+          <?php
450
     } ?>
408
     } ?>
451
-        </ul>
452
-        <strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
453
-        <?php } else { ?>
454
-        <div id="poll_container">
455
-          <form class="vote_form" name="poll" id="poll" action="">
456
-            <input type="hidden" name="action" value="poll" />
457
-            <input type="hidden" name="auth"
458
-              value="<?=$LoggedUser['AuthKey']?>" />
459
-            <input type="hidden" name="topicid"
460
-              value="<?=$TopicID?>" />
461
-            <?php foreach ($Answers as $i => $Answer) { ?>
462
-            <input type="radio" name="vote" id="answer_<?=$i?>"
463
-              value="<?=$i?>" />
464
-            <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
465
-            <?php } ?>
466
-            <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
467
-              for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
468
-            <input type="button"
469
-              onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );"
470
-              value="Vote" />
471
-          </form>
472
-        </div>
473
-        <?php } ?>
474
-        <br /><strong>Topic:</strong> <a
475
-          href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>">Visit</a>
409
+      </ul>
410
+      <strong>Votes:</strong> <?=number_format($TotalVotes)?><br />
411
+      <?php } else { ?>
412
+      <div id="poll_container">
413
+        <form class="vote_form" name="poll" id="poll" action="">
414
+          <input type="hidden" name="action" value="poll" />
415
+          <input type="hidden" name="auth"
416
+            value="<?=$LoggedUser['AuthKey']?>" />
417
+          <input type="hidden" name="topicid"
418
+            value="<?=$TopicID?>" />
419
+          <?php foreach ($Answers as $i => $Answer) { ?>
420
+          <input type="radio" name="vote" id="answer_<?=$i?>"
421
+            value="<?=$i?>" />
422
+          <label for="answer_<?=$i?>"><?=display_str($Answers[$i])?></label><br />
423
+          <?php } ?>
424
+          <br /><input type="radio" name="vote" id="answer_0" value="0" /> <label
425
+            for="answer_0">Blank&#8202;&mdash;&#8202;Show the results!</label><br /><br />
426
+          <input type="button"
427
+            onclick="ajax.post('index.php', 'poll', function(response) { $('#poll_container').raw().innerHTML = response } );"
428
+            value="Vote" />
429
+        </form>
476
       </div>
430
       </div>
431
+      <?php } ?>
432
+      <br /><strong>Topic:</strong> <a
433
+        href="forums.php?action=viewthread&amp;threadid=<?=$TopicID?>">Visit</a>
477
     </div>
434
     </div>
478
-    <?php
435
+  </div>
436
+  <?php
479
 }
437
 }
480
 // polls();
438
 // polls();
481
 ?>
439
 ?>
482
-  </div>
483
-  <div class="main_column">
484
-    <?php
440
+</div>
441
+<div class="main_column">
442
+  <?php
485
 
443
 
486
 $Recommend = $Cache->get_value('recommend');
444
 $Recommend = $Cache->get_value('recommend');
487
 $Recommend_artists = $Cache->get_value('recommend_artists');
445
 $Recommend_artists = $Cache->get_value('recommend_artists');
508
 
466
 
509
 if (count($Recommend) >= 4) {
467
 if (count($Recommend) >= 4) {
510
     $Cache->increment('usage_index'); ?>
468
     $Cache->increment('usage_index'); ?>
511
-    <div class="box" id="recommended">
512
-      <div class="head colhead_dark">
513
-        <strong>Latest Vanity House additions</strong>
514
-        <a data-toggle-target="#vanityhouse" , data-toggle-replace="Hide" class="brackets">Show</a>
515
-      </div>
469
+  <div class="box" id="recommended">
470
+    <div class="head colhead_dark">
471
+      <strong>Latest Vanity House additions</strong>
472
+      <a data-toggle-target="#vanityhouse" , data-toggle-replace="Hide" class="brackets">Show</a>
473
+    </div>
516
 
474
 
517
-      <table class="torrent_table hidden" id="vanityhouse">
518
-        <?php
475
+    <table class="torrent_table hidden" id="vanityhouse">
476
+      <?php
519
   foreach ($Recommend as $Recommendations) {
477
   foreach ($Recommend as $Recommendations) {
520
       list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
478
       list($GroupID, $UserID, $Username, $GroupName, $TagList) = $Recommendations;
521
       $TagsStr = '';
479
       $TagsStr = '';
531
           }
489
           }
532
           $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
490
           $TagStr = "<br />\n<div class=\"tags\">".implode(', ', $TagLinks).'</div>';
533
       } ?>
491
       } ?>
534
-        <tr>
535
-          <td>
536
-            <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
537
-            <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
538
-            <?=$TagStr?>
539
-          </td>
540
-        </tr>
541
-        <?php
492
+      <tr>
493
+        <td>
494
+          <?=Artists::display_artists($Recommend_artists[$GroupID]) ?>
495
+          <a href="torrents.php?id=<?=$GroupID?>"><?=$GroupName?></a> (by <?=Users::format_username($UserID, false, false, false)?>)
496
+          <?=$TagStr?>
497
+        </td>
498
+      </tr>
499
+      <?php
542
   } ?>
500
   } ?>
543
-      </table>
544
-    </div>
545
-    <!-- END recommendations section -->
546
-    <?php
501
+    </table>
502
+  </div>
503
+  <!-- END recommendations section -->
504
+  <?php
547
 }
505
 }
548
 
506
 
549
 $Count = 0;
507
 $Count = 0;
552
     if (strtotime($NewsTime) > time()) {
510
     if (strtotime($NewsTime) > time()) {
553
         continue;
511
         continue;
554
     } ?>
512
     } ?>
555
-    <div id="news<?=$NewsID?>" class="box news_post">
556
-      <div class="head">
557
-        <strong>
558
-          <?=$Title?>
559
-        </strong>
560
-
561
-        <?=time_diff($NewsTime)?>
562
-
563
-        <?php if (check_perms('admin_manage_news')) { ?>
564
-        &ndash;
565
-        <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>"
566
-          class="brackets">Edit</a>
567
-        <?php } ?>
568
-
569
-        <span class="float_right">
570
-          <a data-toggle-target="#newsbody<?=$NewsID?>"
571
-            data-toggle-replace="Show" class="brackets">Hide</a>
572
-        </span>
573
-      </div>
513
+  <div id="news<?=$NewsID?>" class="box news_post">
514
+    <div class="head">
515
+      <strong>
516
+        <?=$Title?>
517
+      </strong>
518
+
519
+      <?=time_diff($NewsTime)?>
520
+
521
+      <?php if (check_perms('admin_manage_news')) { ?>
522
+      &ndash;
523
+      <a href="tools.php?action=editnews&amp;id=<?=$NewsID?>"
524
+        class="brackets">Edit</a>
525
+      <?php } ?>
526
+
527
+      <span class="float_right">
528
+        <a data-toggle-target="#newsbody<?=$NewsID?>"
529
+          data-toggle-replace="Show" class="brackets">Hide</a>
530
+      </span>
531
+    </div>
574
 
532
 
575
-      <div id="newsbody<?=$NewsID?>" class="pad">
576
-        <?=Text::full_format($Body)?>
577
-      </div>
533
+    <div id="newsbody<?=$NewsID?>" class="pad">
534
+      <?=Text::full_format($Body)?>
578
     </div>
535
     </div>
536
+  </div>
579
 
537
 
580
-    <?php
538
+  <?php
581
   if (++$Count > ($NewsCount - 1)) {
539
   if (++$Count > ($NewsCount - 1)) {
582
       break;
540
       break;
583
   }
541
   }
584
 }
542
 }
585
 ?>
543
 ?>
586
-    <div id="more_news" class="box">
587
-      <div class="head">
588
-        <em><span><a href="#"
589
-              onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click
590
-              to load more news</a>.</span> To browse old news posts, <a
591
-            href="forums.php?action=viewforum&amp;forumid=<?=$ENV->ANNOUNCEMENT_FORUM?>">click
592
-            here</a>.</em>
593
-      </div>
544
+  <div id="more_news" class="box">
545
+    <div class="head">
546
+      <em><span><a href="#"
547
+            onclick="news_ajax(event, 3, <?=$NewsCount?>, <?=check_perms('admin_manage_news') ? 1 : 0; ?>); return false;">Click
548
+            to load more news</a>.</span> To browse old news posts, <a
549
+          href="forums.php?action=viewforum&amp;forumid=<?=$ENV->ANNOUNCEMENT_FORUM?>">click
550
+          here</a>.</em>
594
     </div>
551
     </div>
595
   </div>
552
   </div>
596
 </div>
553
 </div>
554
+</div>
597
 <?php
555
 <?php
598
 View::show_footer(array('disclaimer'=>true));
556
 View::show_footer(array('disclaimer'=>true));
599
 
557
 

Loading…
Cancel
Save