Commit 776dcde4 authored by natrak's avatar natrak
Browse files

Hopefully this will not break anything *prays*

;)
parent 05d91014
This diff is collapsed.
......@@ -9,10 +9,8 @@
if ($save) {
cookiedecode($user);
mysql_query("UPDATE users SET umode='$mode', uorder='$order', thold='$thold' where uid='$cookie[0]'");
getusrinfo($user);
$info = base64_encode("$userinfo[uid]:$userinfo[uname]:$userinfo[pass]:$userinfo[storynum]:$userinfo[umode]:$userinfo[uorder]:$userinfo[thold]:$userinfo[noscore]");
setcookie("user","$info",time() + 15552000);
mysql_query("UPDATE testusers SET umode='$mode', uorder='$order', thold='$thold' where id='$user->id'");
$user->update();
}
if($op == "reply") Header("Location: comments.php?op=reply&pid=0&sid=$sid&mode=$mode&order=$order&thold=$thold");
......
......@@ -21,7 +21,7 @@ function moderate_3($sid, $mode, $order, $thold = 0) {
}
function displayKids ($tid, $mode, $order = 0, $thold = 0, $level = 0, $dummy = 0) {
global $user, $cookie, $theme;
global $user, $theme;
include "config.inc";
$comments = 0;
cookiedecode($user);
......@@ -66,7 +66,7 @@ function displayKids ($tid, $mode, $order = 0, $thold = 0, $level = 0, $dummy =
}
function displayBabies ($tid, $level = 0, $dummy = 0, $thread) {
global $datetime, $theme, $user, $cookie;
global $datetime, $theme, $user;
include "config.inc";
......@@ -87,9 +87,9 @@ function displayBabies ($tid, $level = 0, $dummy = 0, $thread) {
if ($user) {
### Make sure to respect the user preferences:
$thread .= "<LI><A HREF=\"comments.php?op=showreply&tid=$r_tid&pid=$r_pid&sid=$r_sid";
if (isset($cookie[4])) { $thread .= "&mode=$cookie[4]"; } else { $thread .= "&mode=threaded"; }
if (isset($cookie[5])) { $thread .= "&order=$cookie[5]"; } else { $thread .= "&order=0"; }
if (isset($cookie[6])) { $thread .= "&thold=$cookie[6]"; } else { $thread .= "&thold=0"; }
if (isset($user->umode)) { $thread .= "&mode=$user->umode"; } else { $thread .= "&mode=threaded"; }
if (isset($user->uorder)) { $thread .= "&order=$user->uorder"; } else { $thread .= "&order=0"; }
if (isset($user->thold)) { $thread .= "&thold=$user->thold"; } else { $thread .= "&thold=0"; }
$thread .= "\">$r_subject</A> by $r_name <FONT SIZE=\"2\">(". formatTimestamp($r_date) .")</FONT></LI>";
}
else {
......@@ -106,7 +106,7 @@ function displayBabies ($tid, $level = 0, $dummy = 0, $thread) {
}
function displayTopic ($sid, $pid = 0, $tid = 0, $mode = "threaded", $order = 0, $thold = 0, $level = 0, $nokids = 0) {
global $user, $cookie, $theme, $functions;
global $user, $theme, $functions;
### include required files:
if ($functions) {
......@@ -187,7 +187,7 @@ function reply($pid, $sid, $mode, $order, $thold) {
include "functions.inc";
include "theme.inc";
global $user, $cookie;
global $user;
dbconnect();
$theme->header();
......@@ -228,7 +228,7 @@ function reply($pid, $sid, $mode, $order, $thold) {
echo "<B>Your name:</B><BR> ";
if ($user) {
cookiedecode($user);
echo "<A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
echo "<A HREF=\"account.php\">$user->userid</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
}
else {
echo "$anonymous";
......@@ -270,7 +270,7 @@ function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, $order,
include "functions.inc";
include "theme.inc" ;
global $user, $cookie, $bgcolor1, $bgcolor2;
global $user, $bgcolor1, $bgcolor2;
cookiedecode($user);
$subject = stripslashes($subject);
......@@ -281,7 +281,7 @@ function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, $order,
### Display preview:
echo "<TABLE WIDTH=\"100%\" BORDER=\"0\">";
if ($user) {
echo " <TR BGCOLOR=\"$bgcolor1\"><TD><B>$subject</B><BR>by $cookie[1].</TD></TR>";
echo " <TR BGCOLOR=\"$bgcolor1\"><TD><B>$subject</B><BR>by $user->userid.</TD></TR>";
}
else {
echo " <TR BGCOLOR=\"$bgcolor1\"><TD><B>$subject</B><BR>by $anonymous.</TD></TR>";
......@@ -304,7 +304,7 @@ function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, $order,
echo "<B>Your name:</B><BR> ";
if ($user) {
cookiedecode($user);
echo "<A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
echo "<A HREF=\"account.php\">$user->userid</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
} else {
echo "$anonymous";
$postanon = 2;
......@@ -348,7 +348,7 @@ function replyPreview ($pid, $sid, $subject, $comment, $postanon, $mode, $order,
}
function postComment($postanon, $subject, $comment, $pid, $sid, $host_name, $mode, $order, $thold, $posttype) {
global $user, $userinfo, $cookie;
global $user, $userinfo;
include "functions.inc";
include "config.inc";
dbconnect();
......@@ -401,9 +401,9 @@ function postComment($postanon, $subject, $comment, $pid, $sid, $host_name, $mod
### Compose header:
if ($user) {
$header = "article.php?sid=$sid";
if (isset($cookie[4])) { $header .= "&mode=$cookie[4]"; } else { $header .= "&mode=threaded"; }
if (isset($cookie[5])) { $header .= "&order=$cookie[5]"; } else { $header .= "&order=0"; }
if (isset($cookie[6])) { $header .= "&thold=$cookie[6]"; } else { $header .= "&thold=1"; }
if (isset($user->umode)) { $header .= "&mode=$user->umode"; } else { $header .= "&mode=threaded"; }
if (isset($user->uorder)) { $header .= "&order=$user->uorder"; } else { $header .= "&order=0"; }
if (isset($user->thold)) { $header .= "&thold=$user->thold"; } else { $header .= "&thold=1"; }
}
else {
$header .= "article.php?sid=$sid&mode=threaded&order=1&thold=0";
......
......@@ -66,6 +66,6 @@
# Set to '1' if you are using Windows so the engine won't try
# to send out mails and such. When using Unix or Linux, set
# to '0'
$system = 0;
$system = 1;
?>
\ No newline at end of file
<?
include("user.class.php");
session_start();
$user->theme = "Jeroen";
include "config.inc";
$functions = 1;
function dbconnect() {
include "config.inc";
mysql_pconnect($dbhost, $dbuname, $dbpass);
@mysql_select_db("$dbname") or die ("Unable to select database");
mysql_pconnect($dbhost, $dbuname, $dbpass) or die(mysql_Error());
mysql_select_db("$dbname") or die ("Unable to select database");
}
function counter() {
......@@ -14,27 +17,6 @@ function counter() {
mysql_query("UPDATE vars SET value=value+1 where name='totalhits'");
}
function cookiedecode($user) {
global $cookie;
$user = base64_decode($user);
$cookie = explode(":", $user);
return $cookie;
}
function getusrinfo($user) {
global $userinfo;
$user2 = base64_decode($user);
dbconnect();
$user3 = explode(":", $user2);
$result = mysql_query("SELECT uid, name, uname, email, femail, url, pass, storynum, umode, uorder, thold, noscore, bio, ublockon, ublock, theme, signature FROM users WHERE uname = '$user3[1]' AND pass = '$user3[2]'");
if(mysql_num_rows($result)==1) {
$userinfo = mysql_fetch_array($result);
} else {
echo "<b>A problem occured</b><br>";
}
return $userinfo;
}
function FixQuotes ($what = "") {
$what = ereg_replace("'","''",$what);
while (eregi("\\\\'", $what)) {
......@@ -103,9 +85,9 @@ function displayRelatedLinks($theme, $sid = 0) {
}
function displayOldHeadlines($theme) {
global $user, $cookie;
global $user;
if ($cookie[3]) $result = mysql_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT $cookie[3], 10");
if ($user->storynum) $result = mysql_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT $user->storynum, 10");
else $result = mysql_query("SELECT sid, subject, time FROM stories ORDER BY time DESC LIMIT 10, 10");
while ($story = mysql_fetch_object($result)) {
......@@ -117,9 +99,9 @@ function displayOldHeadlines($theme) {
if ($user) {
$content .= "<LI><A HREF=\"article.php?sid=$story->sid";
if (isset($cookie[4])) { $content .= "&mode=$cookie[4]"; } else { $content .= "&mode=threaded"; }
if (isset($cookie[5])) { $content .= "&order=$cookie[5]"; } else { $content .= "&order=0"; }
if (isset($cookie[6])) { $content .= "&thold=$cookie[6]"; } else { $content .= "&thold=0"; }
if (isset($user->umode)) { $content .= "&mode=$user->umode"; } else { $content .= "&mode=threaded"; }
if (isset($user->uorder)) { $content .= "&order=$user->uorder"; } else { $content .= "&order=0"; }
if (isset($user->thold)) { $content .= "&thold=$user->thold"; } else { $content .= "&thold=0"; }
$content .= "\">$story->subject</A></LI>";
}
else {
......@@ -132,7 +114,7 @@ function displayOldHeadlines($theme) {
}
function displayNewHeadlines($theme, $num = 10) {
global $user, $cookie;
global $user;
dbconnect();
......@@ -141,9 +123,9 @@ function displayNewHeadlines($theme, $num = 10) {
while(list($sid, $subject) = mysql_fetch_row($result)) {
if ($user) {
$content .= "<LI><A HREF=\"article.php?sid=$sid";
if (isset($cookie[4])) { $content .= "&mode=$cookie[4]"; } else { $content .= "&mode=threaded"; }
if (isset($cookie[5])) { $content .= "&order=$cookie[5]"; } else { $content .= "&order=0"; }
if (isset($cookie[6])) { $content .= "&thold=$cookie[6]"; } else { $content .= "&thold=0"; }
if (isset($user->umode)) { $content .= "&mode=$user->umode"; } else { $content .= "&mode=threaded"; }
if (isset($user->uorder)) { $content .= "&order=$user->uorder"; } else { $content .= "&order=0"; }
if (isset($user->thold)) { $content .= "&thold=$user->thold"; } else { $content .= "&thold=0"; }
$content .= "\">$subject</A></LI>";
}
else {
......@@ -162,25 +144,28 @@ function displayAdminblock($theme) {
}
function displayUserblock($theme) {
global $cookie;
global $user;
dbconnect();
if ($cookie[8]) {
$block = mysql_query("SELECT ublock FROM users WHERE uid = '$cookie[0]'");
list($content) = mysql_fetch_row($block);
if ($user->ublockon) {
$content .= "<P ALIGN=\"right\">[ <A HREF=\"account.php?op=edithome\"><FONT COLOR=\"$theme->hlcolor2\">edit</FONT></A> | <A HREF=\"account.php?op=logout\"><FONT COLOR=\"$theme->hlcolor2\">logout</FONT></A> ]</P>";
$theme->box("$cookie[1]'s box", $content);
$theme->box("$user->userid's box", $user->content);
}
}
function displayAccount($theme) {
global $user, $cookie;
global $user;
if ($user) {
### Display userblock if any:
displayUserblock();
}
else {
$content = "<CENTER><FORM METHOD=\"post\" ACTION=\"account.php\">\n <P>Username:<BR><INPUT TYPE=\"text\" NAME=\"uname\" MAXLENGTH=\"50\" SIZE=\"12\"></P>\n<P>Password:<BR> <INPUT TYPE=\"password\" NAME=\"pass\" MAXLENGTH=\"25\" SIZE=\"12\"></P>\n<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Login\">\n</FORM>\n<P><A HREF=\"account.php\">Register</A> as new user.<BR><A HREF=\"account.php\">Forgot</A> your password?</P></CENTER>";
$content = "<CENTER><FORM METHOD=\"post\" ACTION=\"account.php\">\n";
$content .= "<P>Username:<BR><INPUT NAME=userid MAXLENGTH=50 SIZE=12></P>\n";
$content .= "<P>Password:<BR> <INPUT TYPE=password NAME=passwd MAXLENGTH=25 SIZE=12></P>\n";
$content .= "<INPUT TYPE=submit NAME=act VALUE=\"Login\">\n";
$content .= "</FORM>\n";
$content .= "<P><A HREF=\"account.php?act=new\">Register</A> as new user.<BR><A HREF=\"account.php?act=forgot\">Forgot</A> your password?</P></CENTER>";
$theme->box("Login", $content);
}
}
......@@ -191,16 +176,12 @@ function displayAccountSettings($theme) {
if ($user) {
### Display account settings:
$content .= "<LI><A HREF=\"account.php\">User info</A></LI>";
$content .= "<LI><A HREF=\"account.php?op=edituser\">Edit user info</A></LI>";
$content .= "<LI><A HREF=\"account.php?op=edithome\">Customize homepage</A></LI>";
$content .= "<LI><A HREF=\"account.php?op=editcomm\">Customize comments</A></LI>";
$content .= "<LI><A HREF=\"account.php?op=logout\">Logout</A></LI>";
### Decode user cookie to extract name:
$cookie = cookiedecode($user);
$content = "<LI><A HREF=\"account.php\">User info</A></LI>";
$content .= "<LI><A HREF=\"account.php?act=edituser\">Edit user info</A></LI>";
$content .= "<LI><A HREF=\"account.php?act=editpage\">Customize page</A></LI>";
$content .= "<LI><A HREF=\"account.php?act=logout\">Logout</A></LI>";
$theme->box("$cookie[1]'s acount", "$content");
$theme->box("$user->userid's account", "$content");
}
}
......
......@@ -71,9 +71,9 @@
if ($user) {
$link = "<A HREF=\"article.php?sid=$sid";
if (isset($cookie[4])) { $link .= "&mode=$cookie[4]"; } else { $link .= "&mode=threaded"; }
if (isset($cookie[5])) { $link .= "&order=$cookie[5]"; } else { $link .= "&order=0"; }
if (isset($cookie[6])) { $link .= "&thold=$cookie[6]"; } else { $link .= "&thold=0"; }
if (isset($user->umode)) { $link .= "&mode=$user->umode"; } else { $link .= "&mode=threaded"; }
if (isset($user->uorder)) { $link .= "&order=$user->uorder"; } else { $link .= "&order=0"; }
if (isset($user->thold)) { $link .= "&thold=$user->thold"; } else { $link .= "&thold=0"; }
$link .= "\">$subject</A>";
}
else {
......
......@@ -5,7 +5,7 @@ function defaultDisplay() {
include "theme.inc";
$theme->header();
global $user, $cookie;
global $user;
if (isset($user)) getusrinfo($user);
print "<FORM ACTION=\"submit.php\" METHOD=\"post\">";
......@@ -13,7 +13,7 @@ function defaultDisplay() {
print "<P>\n <B>Your name:</B><BR>";
if ($user) {
cookiedecode($user);
echo " <A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
echo " <A HREF=\"account.php\">$user->userid</A> &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
} else {
echo "$anonymous &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"account.php\">login</A> | <A HREF=\"account.php\">create an account</A> ]</FONT>";
}
......@@ -61,19 +61,19 @@ function defaultDisplay() {
}
function PreviewStory($name, $address, $subject, $abstract, $story, $category) {
global $user, $cookie;
global $user;
include "functions.inc";
include "theme.inc";
$theme->header();
print "<B>Preview:</B><BR>";
$theme->preview("", $cookie[1], date("l, F d, Y - H:i A", time()), stripslashes($subject), "we-hate-typoes", stripslashes($abstract), "", stripslashes($story));
$theme->preview("", $user->userid, date("l, F d, Y - H:i A", time()), stripslashes($subject), "we-hate-typoes", stripslashes($abstract), "", stripslashes($story));
print "<FORM ACTION=\"submit.php\" METHOD=\"post\">";
print "<P>\n <B>Your name:</B><BR>";
if ($user) {
cookiedecode($user);
echo " <A HREF=\"account.php\">$cookie[1]</A> &nbsp; &nbsp; <FONT SIZE=\"2\"> [ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
echo " <A HREF=\"account.php\">$user->userid</A> &nbsp; &nbsp; <FONT SIZE=\"2\"> [ <A HREF=\"account.php?op=logout\">logout</A> ]</FONT>";
} else {
echo "$anonymous &nbsp; &nbsp; <FONT SIZE=\"2\">[ <A HREF=\"$account.php\">login</A> | <A HREF=\"account.php\">create an account</A> ]</FONT>";
}
......@@ -123,7 +123,7 @@ function PreviewStory($name, $address, $subject, $abstract, $story, $category) {
}
function submitStory($name, $address, $subject, $abstract, $article, $category) {
global $user, $cookie;
global $user;
include "functions.inc";
### Display confirmation message:
......@@ -136,8 +136,8 @@ function submitStory($name, $address, $subject, $abstract, $article, $category)
dbconnect();
if ($user) {
cookiedecode($user);
$uid = $cookie[0];
$name = $cookie[1];
$uid = $user->id;
$name = $user->userid;
}
else {
$uid = -1;
......
<?
global $user;
global $user;
### Verify theme:
if (isset($user->theme) && file_exists("themes/$user->theme/theme.class")) {
include "themes/$user->theme/theme.class";
}
else include "themes/default/theme.class";
### Decode user cookie:
if (isset($user)) $cookie = explode(":", base64_decode($user));
### Verify theme:
if (isset($cookie[9])) {
if (file_exists("themes/$cookie[9]/theme.class")) {
include "themes/$cookie[9]/theme.class";
}
else include "themes/default/theme.class";
}
else include "themes/default/theme.class";
$theme = new Theme();
$theme = new Theme();
?>
\ No newline at end of file
......@@ -481,9 +481,9 @@ function expireThread($expire, $number = 40) {
function displayForm($id = "0") {
global $anonymous, $login, $support, $subscribe, $bgcolor2, $bgcolor3, $cookie;
global $anonymous, $login, $support, $subscribe, $bgcolor2, $bgcolor3, $user;
if ($cookie[1]) printForm($id, $cookie[1]);
if ($user->userid) printForm($id, $user->userid);
else printForm($id, $anonymous);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment