if($wbbuserdata['userid'] && $user_info['usegb'] == 1) {
if($_POST['gbentrysend'] == "send") {
$db->query("UPDATE bb".$n."_users SET gbentries=gbentries+1 WHERE userid=$userid;");
$db->query("INSERT INTO bb".$n."_users_gb (date,foruser,fromuser,message,ip,browser) VALUES (".time().", ".intval($_POST['userid']).", $wbbuserdata[userid], '".addslashes($_POST['message'])."', '".addslashes(getIpAddress())."', '".addslashes(wbb_substr($_SERVER['HTTP_USER_AGENT'], 0, 200))."')");
// Mail, PN oder gar nix - Abfragen -> senden
$mail_subject = $lang->get("LANG_MEMBERS_PROFILE_GB_NOTIFICATION_SUBJECT", array('$master_board_name' => $master_board_name));
$mail_text = $lang->get("LANG_MEMBERS_PROFILE_GB_NOTIFICATION_MESSAGE", array('$username' => $user_info['username'], '$from' => $wbbuserdata['username'], '$userid' => $userid, '$url2board' => $url2board, '$master_board_name' => $master_board_name));
require "./acp/lib/class_parsecode.php";
if(!isset($parse)) $parse = new parse($docensor,75,1,"",$usecode);
if($user_info['notifygb'] == 1) {
sendPrivateMessage(array($userid => $user_info['username']), array(), $mail_subject, parseURL($mail_text));
} elseif($user_info['notifygb'] == 2) {
mailer($user_info['email'], $mail_subject, $mail_text);
}
header("Location: profile.php?userid=".intval($_POST['userid'])."&msg=thx");
exit;
} else {
if($_GET['action'] == "delete" && intval($_GET['gbentryid'])) {
$id = intval($_GET['gbentryid']);
$temp = $db->query_first("SELECT entryid, foruser FROM bb".$n."_users_gb WHERE entryid=$id;");
if(!$temp['entryid'] || (($temp['foruser'] != $wbbuserdata['userid']) && !$wbbuserdata['a_can_use_acp'])) access_error();
else {
// löschen
$db->query("DELETE FROM bb".$n."_users_gb WHERE entryid=$id;");
$db->query("UPDATE bb".$n."_users SET gbentries=gbentries-1 WHERE userid=$userid;");
header("Location: profile.php?userid=$userid&msg=del");
exit;
}
} else {
if(!intval($_GET['page']) || intval($_GET['page']) < 1) $page = 1;
else $page = intval($_GET['page']);
$pages = ceil($user_info['gbentries']/$gb_perpage);
if ($pages > 1) $pagelink = makePageLink("profile.php?userid=".$userid.$SID_ARG_2ND, $page, $pages, $showpagelinks - 1);
else $pagelink = ' ';
$startat = ($page-1)*$gb_perpage;
$endat = $page*$gb_perpage;
$res = $db->query("SELECT
gb.*,
fromu.username, fromu.receivepm,
fromu.userid, av.avatarid, av.avatarextension, av.width, av.height
FROM bb".$n."_users_gb AS gb
LEFT JOIN bb".$n."_users AS fromu ON (gb.fromuser=fromu.userid)
LEFT JOIN bb".$n."_avatars AS av ON (fromu.avatarid=av.avatarid)
WHERE foruser=$userid ORDER BY date DESC LIMIT $startat, $endat;");
$i = 0;
unset($msgs, $row);
while($row = $db->fetch_array($res)) {
unset($gbava);
$i++;
$tdclass = getone($i, "tablea", "tableb");
$time = formatdate($wbbuserdata['dateformat'], $row['date'],1);
$time .= " <span class=\"time\">".formatdate($wbbuserdata['timeformat'], $row['date'])."</span>";
$username = htmlconverter($row['username']);
if ($row['avatarid'] && $showavatar == 1 && $wbbuserdata['showavatars'] == 1) {
$avatarname = "images/avatars/avatar-$row[avatarid].".htmlconverter($row['avatarextension']);
$avatarwidth = $row['width'];
$avatarheight = $row['height'];
if ($row['avatarextension'] == "swf" && $allowflashavatar == 1) eval("\$gbava = \"".$tpl->get("avatar_flash")."\";");
eval("\$gbava = \"".$tpl->get("avatar_image")."\";");
}
if(!isset($parse)) $parse = new parse($docensor,75,1,"",$usecode);
$message = $parse->doparse($row['message'],1,0,1,1);
eval("\$msgs .= \"".$tpl->get("profile_gb_entrybit")."\";");
}
if($_GET['msg'] != "thx") {
$gb_bbcode_nessarry = "1";
eval ("\$headinclude .= \"".$tpl->get("bbcode_script")."\";");
$bbcode_buttons = getcodebuttons();
$bbcode_smilies = getclickysmilies($smilie_table_cols,$smilie_table_rows);
eval("\$addentry = \"".$tpl->get("profile_gb_addentry")."\";");
}
}
eval("\$guestbook = \"".$tpl->get("profile_gb")."\";");
}
}
// *************************** Guestbook in Profile by rellek