$value) { if ($value) array_push($list_types, $key); } // checking to see if we should use a list type layout or the normal profile layout if (isset($_GET['list'])) { if (!in_array($_GET['list'], $list_types)) fallback(FUSION_SELF."?lookup=".lookup); define('currentlist', $_GET['list']); } else { define('currentlist', 'profile'); } $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='".lookup."'"); if (dbrows($result) == 1) { /* start: profile page generation when the $_GET['lookup'] is found in the users db table. */ $data = dbarray($result); $button_width = 100; opentable($locale['420']); echo "
\n\n\n\n\n\n\n\n\n"; break; case "forum_posts": $sql = "SELECT tp.*, tf.* FROM ".$db_prefix."posts tp INNER JOIN ".$db_prefix."forums tf USING(forum_id) WHERE ".groupaccess('forum_access')." AND post_author='".lookup."' ORDER BY post_datestamp DESC LIMIT "; $result1 = dbquery($sql.$maxlimit); $result2 = dbquery($sql.$rowstart.",".$limit); $colspan = 3; $title = $locale['pm400']; $norows = $locale['pm401']; $header = "\n\n\n\n\n"; break; case 'news_items': $sql = "SELECT * FROM ".$db_prefix."news WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_name='".lookup."' ORDER BY news_datestamp DESC LIMIT "; $result1 = dbquery($sql.$maxlimit); $result2 = dbquery($sql.$rowstart.",".$limit); $colspan = 2; $title = $locale['pm500']; $norows = $locale['pm501']; $header = "\n\n\n\n"; break; case 'articles': $sql = "SELECT a.*, ac.* FROM ".$db_prefix."articles a LEFT JOIN ".$db_prefix."article_cats ac ON a.article_cat=ac.article_cat_id WHERE ".groupaccess('ac.article_cat_access')." AND article_name='".lookup."' ORDER BY article_datestamp DESC LIMIT "; $result1 = dbquery($sql.$maxlimit); $result2 = dbquery($sql.$rowstart.",".$limit); $colspan = 2; $title = $locale['pm600']; $norows = $locale['pm601']; $header = "\n\n\n\n"; break; } $profile .= "
\n"; $profile = "\n\n"; # start of first cell $profile .= "\n"; # end of first cell # start of second cell $profile .= "\n"; # end of second cell $profile .= "\n
\n"; // adding user avatar if exists if ($data['user_avatar'] && file_exists(IMAGES."avatars/".$data['user_avatar'])) { if ($size = @getimagesize(IMAGES."avatars/".$data['user_avatar'])) { if ($size[0] > $button_width && currentlist == 'profile') $button_width = $size[0]; } $profile .= ""; if (currentlist == 'profile') $profile .= "
\n"; } elseif (currentlist != 'profile') $profile .= "
\n"; $button_style = "style='margin-bottom:1px;width:".$button_width."px'"; $added = false; $buttons_buffer = ""; // user email button if ($data['user_hide_email'] != 1 || iADMIN) { $added = true; $inherit = str_replace("@","@",$data['user_email']); $buttons_buffer .= ""; $buttons_buffer .= (currentlist == 'profile' ? "
" : " ")."\n"; } // user website button if ($data['user_web']) { $added = true; $inherit = (!strstr($data['user_web'], "http://") ? "http://" : "").$data['user_web']; $buttons_buffer .= ""; $buttons_buffer .= (currentlist == 'profile' ? "
" : " ")."\n"; } // user pm button if (!isset($userdata['user_id']) || $data['user_id'] != $userdata['user_id']) { $added = true; $inherit = "messages.php?msg_send=".$data['user_id']; $buttons_buffer .= ""; $buttons_buffer .= (currentlist == 'profile' ? "
" : " ")."\n"; } // making the aim, icq, msn, yahoo buttons only available in the normal profile lookup. if (currentlist == 'profile') { if ($data['user_aim'] || $data['user_icq'] || $data['user_msn'] || $data['user_yahoo']) { if ($added) $buttons_buffer .= "
\n"; $added = false; // user aim button if ($data['user_aim']) { $added = true; $buttons_buffer .= "
\n"; } // user icq button if ($data['user_icq']) { $added = true; $buttons_buffer .= "
\n"; } // user msn button if ($data['user_msn']) { $added = true; $buttons_buffer .= "
\n"; } // user yahoo button if ($data['user_yahoo']) { $added = true; $buttons_buffer .= "
\n"; } } } // user ip button if (iSUPERADMIN) { if ($added && currentlist == 'profile') $buttons_buffer .= "
\n"; $buttons_buffer .= ""; $buttons_buffer .= (currentlist == 'profile' ? "
" : " ")."\n"; } // add the buttons to the profile variable here in the normal profile lookup if (currentlist == 'profile') $profile .= $buttons_buffer."
\n"; $profile .= "
\n"; $profile .= "\n"; $profile .= "\n"; // user name, rank and rank color prefix $rank = "".getuserlevel($data['user_level']).""; $profile .= "\n"; // user online / offline status $lastvisit = (time() - $data['user_lastvisit']); if ($lastvisit < 60) $status = "".$locale['pm000'].""; elseif ($lastvisit < 300) $status = "".$locale['pm001'].""; else $status = "".$locale['pm002'].""; $profile .= "\n"; $profile .= "\n"; // divider $profile .= "\n\n\n"; if (currentlist == 'profile') { // user location $profile .= "\n\n"; // user birthday if ($data['user_birthdate'] != "0000-00-00") { $months = explode("|", $locale['months']); $user_birthdate = explode("-", $data['user_birthdate']); $birthdate = number_format($user_birthdate['2'])." ".$months[number_format($user_birthdate['1'])]." ".$user_birthdate['0']; } else { $birthdate = $locale['u048']; } $profile .= "\n\n"; // divider $profile .= "\n\n\n"; // user joined $profile .= "\n\n\n"; // user lastvisit $profile .= "\n\n\n"; // user shoutbox posts $profile .= "\n\n\n"; // user comments posted $profile .= "\n\n\n"; // user forum posts $profile .= "\n\n\n"; // user groups if ($data['user_groups']) { // divider $profile .= "\n\n\n"; $usergroups = ""; $user_groups = (strpos($data['user_groups'], ".") == 0 ? explode(".", substr($data['user_groups'], 1)) : explode(".", $data['user_groups'])); for ($i = 0;$i < count($user_groups);$i++) { $usergroups .= "".getgroupname($user_groups[$i]).""; if ($i != (count($user_groups)-1)) { $usergroups .= ","; } } $profile .= "\n\n\n"; } } else { // add the buttons to the profile variable here when not in the normal profile lookup $profile .= "\n\n\n"; } $profile .= "
".$data['user_name']."
".$rank."
".$status."


".$locale['u009']."".($data['user_location'] ? $data['user_location'] : $locale['u048'])."
".$locale['u010']."".$birthdate."


".$locale['u040']."".showdate("longdate", $data['user_joined'])."
".$locale['u044']."".($data['user_lastvisit'] != 0 ? showdate("longdate", $data['user_lastvisit']) : $locale['u049'])."
".$locale['u041']."".number_format(dbcount("(shout_id)", "shoutbox", "shout_name='".$data['user_id']."'"))."
".$locale['u042']."".number_format(dbcount("(comment_id)", "comments", "comment_name='".$data['user_id']."'"))."
".$locale['u043']."".number_format($data['user_posts'])."


".$locale['423']."".$usergroups."
".$buttons_buffer."
\n"; if (currentlist == 'profile') $profile .= "
\n"; $profile .= "
\n
\n"; if (currentlist == 'profile') { $profile .= "\n"; } $limit = (currentlist == 'profile' ? $profile_sql['normal_limit'] : $profile_sql['list_limit']); $rowstart = ((!isset($_GET['rowstart']) || !isNum($_GET['rowstart']) || currentlist == 'profile') ? 0 : $_GET['rowstart']); $maxlimit = (currentlist == 'profile' ? ($limit + 1) : $profile_sql['list_max_history']); foreach ($list_types as $list) { if (currentlist != 'profile' && $list != currentlist) continue; switch ($list) { case 'forum_threads': $sql = "SELECT tt.*, tf.* FROM ".$db_prefix."threads tt INNER JOIN ".$db_prefix."forums tf USING(forum_id) WHERE ".groupaccess('forum_access')." AND thread_author='".lookup."' ORDER BY thread_lastpost DESC LIMIT "; $result1 = dbquery($sql.$maxlimit); $result2 = dbquery($sql.$rowstart.",".$limit); $colspan = 4; $title = $locale['pm300']; $norows = $locale['pm301']; $header = "
".$locale['pm201']."".$locale['pm202']."".$locale['pm203']."".$locale['pm204']."
".$locale['pm201']."".$locale['pm205']."".$locale['pm206']."
".$locale['pm205']."".$locale['pm206']."
".$locale['pm205']."".$locale['pm206']."
\n\n"; $profile .= "\n"; $profile .= "\n
\n"; $profile .= "\n"; $profile .= "\n\n\n"; $profile .= "\n\n\n"; $profile .= "\n"; if (dbrows($result1) == 0) { $profile .= "\n\n"; } else { $profile .= $header; while ($row = dbarray($result2)) { switch ($list) { case 'forum_threads': $replies = dbcount("(thread_id)", "posts", "thread_id='".$row['thread_id']."'"); $profile .= "\n\n" ."\n" ."\n" ."\n\n"; break; case "forum_posts": $replies = dbcount("(thread_id)", "posts", "thread_id='".$row['thread_id']."'"); $rstart = ($replies > 20 ? "rowstart=".((ceil($replies / 20)-1)*20)."&" : ""); $profile .= "\n\n" ."\n" ."\n\n"; break; case 'news_items': $profile .= "\n\n" ."\n\n"; break; case 'articles': $profile .= "\n\n" ."\n"; break; } } } $profile .= "\n
"; if (currentlist == 'profile') { $profile .= "".$title." ".$data['user_name'].""; if (dbrows($result1) > $limit) $profile .= "".$locale['pm207']." "; $profile .= ""; } else { $profile .= "".$title." ".$data['user_name'].""; } $profile .= "

\n"; $profile .= "
\n
\n"; if (currentlist != 'profile') { $profile .= "" ."
".$locale['pm208']."".(dbrows($result1) > $limit ? makePageNav($rowstart,$limit,dbrows($result1),3,FUSION_SELF."?lookup=".lookup."&list=".$list."&") : " ")."
\n
\n"; } } echo $profile; echo "\n\n\n
\n"; closetable(); /* end: profile page generation when the $_GET['lookup'] is found in the users db table. */ } else { /* start: profile page generation when the $_GET['lookup'] is not found in the users db table. */ opentable($locale['420']." - ".$locale['pm200']); echo "
\n\n\n\n\n
\n"; echo str_replace("{LOOKUP}", "".lookup."", $locale['pm209'])."\n"; echo "
\n
\n"; closetable(); /* end: profile page generation when the $_GET['lookup'] is not found in the users db table. */ } } elseif (defined('group_id') && !defined('lookup')) { $result = dbquery("SELECT * FROM ".$db_prefix."user_groups WHERE group_id='".group_id."'"); if (dbrows($result)) { /* start: user group page generation when the $_GET['group_id'] is found in the user_goups db table. */ $data = dbarray($result); $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_groups REGEXP('^\\\.".group_id."$|\\\.".group_id."\\\.|\\\.".group_id."$') ORDER BY user_level DESC, user_name"); opentable($locale['410']); echo "
\n\n\n\n\n
\n"; echo "\n"; echo "\n\n" ."\n\n"; echo "\n\n\n"; while ($data = dbarray($result)) { echo "\n" ."\n\n"; } echo "
".$data['group_name']."( ".sprintf((dbrows($result) == 1 ? $locale['411'] : $locale['412']), dbrows($result))." )

".$data['user_name']."".getuserlevel($data['user_level'])."
\n"; echo "
\n
\n"; closetable(); /* end: user group page generation when the $_GET['group_id'] is found in the user_goups db table. */ } else { /* start: user group page generation when the $_GET['group_id'] is not found in the user_goups db table. */ opentable($locale['410']." - ".$locale['pm200']); echo "
\n\n\n\n\n
\n"; echo str_replace("{GROUP_ID}", "".group_id."", $locale['pm210'])."\n"; echo "
\n
\n"; closetable(); /* end: user group page generation when the $_GET['group_id'] is not found in the user_goups db table. */ } } else { redirect(BASEDIR."index.php"); } if ($profile_include_sideright) require_once "side_right.php"; else echo "\n"; require_once "footer.php"; ?>