"; $msg = "This is an automatic email from electrifiedForum at http://$HTTP_SERVER_VARS[HTTP_HOST]$PHP_SELF?realm=$realm\n"; $msg .= "\n\n"; $msg .= "A new reply has been posted to the $topicname at $config[title]\n"; $msg .= "You can view the topic at:\n"; $msg .= "http://$HTTP_SERVER_VARS[HTTP_HOST]$PHP_SELF?action=displaythread&forum=$forum&id=$thread&realm=$realm"; $msg .= "You requested email notifications be sent for replies to topics you post in on the forums at\n"; $msg .= "http://$HTTP_SERVER_VARS[HTTP_HOST]$PHP_SELF?realm=$realm\n"; $msg .= "\n"; $msg .= "To turn off email notifications, log in to the forums above, click profile, and uncheck the email notifications option box.\n"; $msg .= "\n"; if (is_array($users)) foreach ($users as $user) if ($user[email]) mail($user[email], $subj, $msg, "From: $from\n"); } function ForumAuth() { /* Need to take current user, entered password, verify, and if verified, allow access to this forum for duration of session */ global $forumsess,$forumpass,$forum,$realm,$config; if (db_numrows_sql("SELECT * FROM $config[ftable] WHERE fname='$forum' AND forumpassword=PASSWORD('$forumpass')") == 1) $forumsess[$realm][verified][$forum] = TRUE; else $verifyerror = "&verifyerror=1"; header("Location: index.php?action=displayforum&forum=$forum&realm=$realm$verifyerror"); } function forums_array() { /* return an array of forum names */ global $config; $result = db_select("SELECT fname FROM $config[ftable] ORDER BY fname ASC"); while($row = db_getarray($result)) { $forums[] = $row[fname]; } return $forums; } function filter($data) { global $config; $repchar = '*'; for($i=0;$i0) { print "
"; $result = db_select("SELECT cat FROM $config[ftable] GROUP BY cat"); while($cat = db_getarray($result)) { $result2 = db_select("SELECT * FROM $config[ftable] WHERE cat='$cat[cat]' ORDER BY ftitle ASC"); if (!$cat[cat]) $cat[cat] = $lang[gf]; print ""; print ""; $i = 0; while($row = db_getarray($result2)) { $i = $i + 1; if ($i % 2) $bgcolor = $config['color_b']; else $bgcolor = $config['color_a']; $date[$i] = lastdate($row[fname]); if ($date[$i]) { if ($config['24hour']) $format = "l, F j H:i"; else $format = "l, F j h:i a"; $datetext = date($format,sql_to_unix_time($date[$i])); } else { $datetext = " "; } if (sql_to_unix_time($date[$i]) > $forumsess[$realm][lastvisit]) { $icon = ""; $titletext = $row[ftitle]; } else { $titletext = $row[ftitle]; $icon = ""; } print ""; } } print "
$cat[cat]
  $lang[forum] $lang[description] $lang[topics] $lang[msgs] $lang[mr]
$icon ".$titletext." ".$row[fdesc]." ".topiccount($row[fname])." ".messagecount($row[fname])." ".$datetext."
"; } else { print "No forums available
"; } } function DisplayForum($forumname) { /* Take forumname, and get all threadnames for it... */ global $realm,$config,$forumsess,$lang,$startat,$verifyerror; if (!$startat) $startat = 0; if (!$config['topics_per_page']) $config['topics_per_page'] = 30; $foruminfo = db_getrow($config[ftable], "fname='$forumname'"); if ($foruminfo) { if ($foruminfo[options] & 2 && !$forumsess[$realm][verified][$forumname]) { /* Private forum */ print "
"; print "This forum is marked as private and requires a password to login.
"; print "Enter the password in the box below, and click verify to login.
"; if ($verifyerror) { print "
Entered Password was not correct.
"; } print "
"; print "Forum Password: "; print "
"; print "
"; } else { $sql = "SELECT m.*, MAX(d.posttime) AS ptime FROM $config[mtable] m, $config[mtable] d WHERE m.fname='$forumname' AND d.fname='$forumname' AND d.threadid=m.threadid AND m.threadindex='0' GROUP BY m.threadid ORDER BY ptime DESC"; $totalnum = db_numrows_sql($sql); if ($totalnum>0) { $result = db_select($sql." LIMIT $startat,$config[topics_per_page]"); $totalhits = db_numrows_result($result); $i = 0; $start = $startat+1; $end = $startat+$totalhits; $backto = $startat-$config['topics_per_page']; //print $totalnum."
"; $remaining = $totalnum - ($startat+$config['topics_per_page']); $totalpages = ceil($totalnum / $config['topics_per_page']); $lastpagestart = ($totalpages-1) * $config['topics_per_page']; if ($remaining > $config['topics_per_page']) $remaining = $config['topics_per_page']; if ($startat > 0) { $backtext = "<< $lang[previous] $config[topics_per_page]"; $starttext = "<<< First Page"; } if ($totalnum > ($startat+$config['topics_per_page'])) { $nexttext = "$lang[next] $remaining >>"; $endtext = "Last Page >>>"; } print "
$backtext
$starttext
Showing topics $start to $end
Total Topics: $totalnum Pages: $totalpages
$nexttext
$endtext
"; print ""; while($row = db_getarray($result)) { $i = $i + 1; if ($i % 2) $bgcolor = $config['color_b']; else $bgcolor = $config['color_a']; if ($row[icon]) $icon = ""; else $icon = ""; $date[$i] = lastthreaddate($forumname,$row[threadid]); if ($date[$i]) { if ($config['24hour']) $format = "m-d-y H:i"; else $format = "m-d-y h:i a"; $datetext = date($format,sql_to_unix_time($date[$i])); } else { $datetext = FALSE; } if (sql_to_unix_time($date[$i]) > $forumsess[$realm][lastvisit]) $titletext = "".$row[title].""; else $titletext = $row[title]; print ""; } print "
  $lang[title] $lang[poster] $lang[msgs] $lang[mr]
$icon $titletext $row[poster] ".threadcount($forumname,$row[threadid])." $datetext
$backtext
$starttext
Showing topics $start to $end
Total Topics: $totalnum Pages: $totalpages
$nexttext
$endtext
"; print "
"; } else { print "No messages available for this forum. Post one!
"; } print ""; } } else { print "$lang[error]- No forum with id of $forumname available
"; } } function DisplayThread($forumname,$threadid) { global $config,$realm,$forumsess,$lang,$startat; if (!$startat) $startat = 0; if (!$config['posts_per_page']) $config['posts_per_page'] = 30; if (!$config[icondir]) $config[icondir] = "art/icons"; $open = is_thread_open($forumname,$threadid); $sql = "SELECT p.id AS id, p.posttime AS posttime, p.content AS content, u.username AS poster, u.options AS useropts, u.gender AS gender, u.birthday AS birthday, u.sig AS sig, u.votes AS votes, u.rank AS rank, u.location AS location, p.icon AS icon, p.title AS title, p.ip AS ip, u.email AS email, u.homepage AS homepage, u.aim AS aim, u.yahoo AS yahoo, u.icq AS icq FROM $config[mtable] p, $config[utable] u WHERE p.fname='$forumname' AND p.threadid='$threadid' AND u.username=p.poster ORDER BY p.threadindex ASC"; if (verifythread($forumname,$threadid)) { $totalnum = db_numrows_sql($sql); $result = db_select($sql." LIMIT $startat,$config[posts_per_page]"); $totalhits = db_numrows_result($result); $i = 0; $start = $startat+1; $end = $startat+$totalhits; $backto = $startat-$config['posts_per_page']; //print $totalnum."
"; $remaining = $totalnum - ($startat+$config['posts_per_page']); $totalpages = ceil($totalnum / $config['posts_per_page']); $lastpagestart = ($totalpages-1) * $config['posts_per_page']; if ($remaining > $config['posts_per_page']) $remaining = $config['posts_per_page']; if ($startat > 0) { $backtext = "<< $lang[previous] $config[topics_per_page]"; $starttext = "<<< First Page"; } if ($totalnum > ($startat+$config['posts_per_page'])) { $nexttext = "$lang[next] $remaining >>"; $endtext = "Last Page >>>"; } print "
$backtext
$starttext
Showing posts $start to $end
Total Posts: $totalnum Pages: $totalpages
$nexttext
$endtext

"; print "
"; while($row = db_getarray($result)) { $i = $i + 1; $options = $row[useropts]; if ($i % 2) $bgcolor = $config['color_b']; else $bgcolor = $config['color_a']; if (($row[rank])&&($row[votes])) { $score = $row[rank]/$row[votes]; $rank = round($score, 0); $score = round($score, 2); } else { $rank = FALSE; } if ($config['24hour']) $format = "l, F j Y H:i"; else $format = "l, F j Y h:i A"; $datetext = date($format,sql_to_unix_time($row[posttime])); ?>
Poster Topic