Add User::toString, get rid of unnecessary crap in User_Anon
[specialops2.git] / invites.php
blob25d53f65f2aff93567b9734cd20487d7aee5177b
1 <?php
2 /**
3 * User Invites and Points FAQ
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 $prefetch = array('`points`', '`invites`');
11 require 'con.php';
12 $page->title = 'Stuff Control Panel';
14 if ( ! ($user instanceof User_Authenticated) ) {
15 $page->errorfooter('login');
18 $user->userheader();
20 echo "<h2>User Invites</h2>\n";
22 if ( !defined('INVITE_ONLY') ) {
23 echo '<p class="info">Invites are currently disabled.</p>',"\n";
24 } else {
25 $urllist = $DB->query('SELECT `data` FROM `things` WHERE `what` = "invite" AND `userid` = @userid');
26 if ( $urllist->num_rows ) {
27 echo "<h3>Invite Links:</h3>\n<ul>\n";
29 while ( list($code) = $urllist->fetch_row() ) {
30 printf(' <li><a href="register?user=%d;code=%s">http://%s%s/register?user=%1$d;code=%2$s</a></li>'."\n",
31 $user->userid, $code, $_SERVER['HTTP_HOST'], dirname($_SERVER['REQUEST_URI']));
34 echo "</ul>\n",
35 '<p>These links are only valid for one registration, and you can only have a maximum of 5 at any time.</p>',"\n";
38 for ( $i = 0; $i <= floor(sqrt($user->points)) || $i <= $user->invites; $i++ ); // This is intentionally empty
40 echo '<p class="info">Points to next invite: ',(pow($i, 2) - $user->points),"</p>\n";
42 $userlist = $DB->query('SELECT `userid`, `alias` FROM `users` WHERE `referrer` = @userid');
43 if ( $userlist->num_rows ) {
44 echo "<h3>You have invited:</h3>\n<ol>\n";
46 while ( $user2 = $userlist->fetch_row() ) {
47 echo ' <li>',$user->namelink($user2[0], $user2[1]),"</li>\n";
50 echo "</ol>\n";
55 <h2>Points</h2>
56 <p class="info">You have <?php echo $user->points ?> points.</p>
57 <h3>Getting</h3>
58 <ul>
59 <li>Topics: +2 points each</li>
60 <li>Posts: +1 point each</li>
61 </ul>
62 <h3>Doing</h3>
63 <ul>
64 <li>1 point: You can mark messages, but it has no effect on their score.</li>
65 <li>10 points: You can mark messages up/down for 1 point each.</li>
66 <li>100 points: Message marks are now worth 2 points.</li>
67 <li>1000 points: Marks are worth 3 points.</li>
68 <li>10000 points: Marks are 4 points plus you can use HTML in posts.</li>
69 </ul>
71 <?php
72 $page->pagefooter();