assignInclude( "listings", "./$skindir/listings.tpl" ); else $tpl->assignInclude( "listings", "./default_tpls/listings.tpl" ); $tpl->assignInclude( "header", "./$skindir/header.tpl" ); $tpl->assignInclude( "footer", "./$skindir/footer.tpl" ); if(file_exists("$skindir/profile.tpl")) $tpl->assignInclude("profile", "$skindir/profile.tpl"); else $tpl->assignInclude("profile", "./default_tpls/profile.tpl"); include("includes/pagesetup.php"); // If uid isn't a number kill the script with an error message. The only way this happens is a hacker. if(empty($uid)) { if(!isMEMBER) accessDenied( ); else $uid = USERUID; } if($displayprofile) include("user/profile.php"); else if(isADMIN && uLEVEL < 3) { $result2 = dbquery("SELECT * FROM "._AUTHORTABLE." LEFT JOIN ".TABLEPREFIX."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1"); $userinfo = dbassoc($result2); $adminopts = "
"._ADMINOPTIONS.": ".(isset($userinfo['validated']) && $userinfo['validated'] ? "["._REVOKEVAL."] " : "["._VALIDATE."] ")."["._EDIT."] ["._DELETE."]"; $adminopts .= " ["._UNLOCKMEM : "lock=".$userinfo['uid']."\" class=\"vuadmin\">"._LOCKMEM)."]"; $adminopts .= " [ 0 ? "revoke=$uid\" class=\"vuadmin\">"._REVOKEADMIN."] ["._EDITADMIN : "do=new&uid=$uid\" class=\"vuadmin\">"._MAKEADMIN)."]
"; $tpl->assign("adminoptions", $adminopts); } $infoquery = dbquery("SELECT "._PENNAMEFIELD." as penname FROM "._AUTHORTABLE." WHERE "._UIDFIELD." = '$uid' LIMIT 1"); list($penname) = dbrow($infoquery); $tpl->assign("pagetitle", "
$penname
"); $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE ".($action ? "panel_name = '$action' AND (panel_type = 'P' OR panel_type = 'F')" : "panel_type = 'P' AND panel_hidden = 0 ORDER BY panel_order ASC")." LIMIT 1"); if($panelquery) { $panel = dbassoc($panelquery); if(!empty($panel['panel_url']) && file_exists(_BASEDIR.$panel['panel_url'])) include(_BASEDIR.$panel['panel_url']); else if(file_exists("user/".$panel['panel_name'].".php")) include("user/".$panel['panel_name'].".php"); else $output .= write_error(_ERROR); } else if($action) $output .= write_error(_ERROR); $tpl->gotoBlock("_ROOT"); $panelquery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_panels WHERE panel_hidden != '1' AND panel_level = '0' AND (panel_type = 'P'".($favorites ? " OR panel_type = 'F'" : "").") ORDER BY panel_type DESC, panel_order ASC, panel_title ASC"); $numtabs = dbnumrows($panelquery); $tabwidth = floor(100 / $numtabs); if(!$panelquery) $output .= write_error(_ERROR); // Special tab counts $codequery = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_codeblocks WHERE code_type = 'userTabs'"); while($code = dbassoc($codequery)) { eval($code['code_text']); } while($panel = dbassoc($panelquery)) { $panellink = ""; if(substr($panel['panel_name'], -2, 2) == "by") { $itemcount = 0; if($panel['panel_name'] == "storiesby") { $count = dbquery("SELECT stories FROM ".TABLEPREFIX."fanfiction_authorprefs WHERE uid = '$uid'"); } else { if(substr($panel['panel_name'], 0, 3) == "val") { $table = substr($panel['panel_name'], 3); $table = substr($table, 0, strlen($table) - 2); $valid = 1; } else { $table = $panel['panel_name']; if(substr($panel['panel_name'], 0, strlen($panel['panel_name']) - 2) == "stories") $valid = 1; else $valid = 0; } $count = dbquery("SELECT COUNT(uid) FROM ".TABLEPREFIX."fanfiction_".substr($table, 0, strlen($panel['panel_name']) - 2)." WHERE (uid = '$uid'".($panel['panel_name'] == "storiesby" ? " OR FIND_IN_SET($uid, coauthors) > 0" : "").")".($valid ? " AND validated > 0" : "").($panel['panel_name'] == "reviewsby" ? " AND review != 'No Review'" : "")); } list($itemcount) = dbrow($count); } if(substr($panel['panel_name'], 0, 3) == "fav" && $type = substr($panel['panel_name'], 3)) { $itemcount = 0; $countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid' AND type = '$type'"); list($itemcount) = dbrow($countquery); } if($panel['panel_name'] == "favlist") { $itemcount = 0; $countquery = dbquery("SELECT COUNT(item) FROM ".TABLEPREFIX."fanfiction_favorites WHERE uid = '$uid'"); list($itemcount) = dbrow($countquery); } if(!empty($tabCounts[$panel['panel_name']])) $itemcount = $tabCounts[$panel['panel_name']]; $panellinkplus = "".preg_replace("<\{author\}>", $penname, stripslashes($panel['panel_title'])).(isset($itemcount) ? " [$itemcount]" : "")."\n"; $panellink = "".preg_replace("<\{author\}>", $penname, stripslashes($panel['panel_title']))."\n"; $tpl->newBlock("paneltabs"); $tpl->assign("tabwidth", $tabwidth); $tpl->assign("class", $action == $panel['panel_name'] || (empty($action) && $panel['panel_order'] == 1 && $panel['panel_type'] == "P") ? "id='active'" : ""); $tpl->assign("link", $panellink); $tpl->assign("linkcount", $panellinkplus); $tpl->assign("count", (isset($itemcount) ? " [$itemcount]" : "")); unset($panellink, $panellinkplus, $itemcount); } $tpl->gotoBlock("_ROOT"); $tpl->assign( "output", $output ); $tpl->printToScreen(); dbclose( ); ?>