Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: profile.php

Parašė And2s· 2009 Lie. 4 11:07:08
#2

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
/*--------------------------------------------+
| Profile Page MOD for PHP-Fusion v6      |
|---------------------------------------------|
| author: UworldIRC - Riadi © 2006            |
| web: http://www.uworldirc.com/              |
| email: riadi@gcinet.org                     |
|---------------------------------------------|
| Released under the terms and conditions of  |
| the GNU General Public License (Version 2)  |
+--------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include LOCALE.LOCALESET."members-profile.php";

include LOCALE.LOCALESET."user_fields.php";

//profile.php settings
# max items for Threads/Posts/News on the normal profile page
$profile_index_limit = 5;
# max items for the profile page Threads/Posts/News listing
$profile_list_limit = 20;
# width of the profile
$profile_width = 600;
# include the right side panels, set to true or 1 if you want include the right side
$profile_include_rightside = false;

if ((isset($lookup)) && (!isset($group_id)) && (isNum($lookup))) {
   if ((isset($list)) && ($list != 'threads') && ($list != 'posts') && ($list != 'news')) redirect("index.php");
   if (!isset($list)) $list = "profile";

   $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='$lookup'");
   if (dbrows($result)) $data = dbarray($result);
   else redirect("index.php");

   if ($list == 'profile') {
      echo "<script language='javascript' type='text/javascript'>\n"
      ."function expandcollaps(img, id) {"
      ."var currentstatus = img.src.indexOf('_on') == -1 ? '_on' : '_off';"
      ."var newstatus = currentstatus == '_on' ? '_off' : '_on';"
      ."document.getElementById(id).style.display = newstatus == '_on' ? '' : 'none';"
      ."img.src = img.src.replace(newstatus, currentstatus);"
      ."img.alt = newstatus == '_off' ? img.alt.replace('".$locale['pe207']."', '".$locale['pe206']."') : img.alt.replace('".$locale['pe206']."', '".$locale['pe207']."');"
      ."img.title = newstatus == '_off' ? img.title.replace('".$locale['pe207']."', '".$locale['pe206']."') : img.title.replace('".$locale['pe206']."', '".$locale['pe207']."');"
      ."}"
      ."</script>\n";
   }

   opentable($locale['420']);
   echo "<table align='center' cellpadding='0' cellspacing='0' width='$profile_width' id='profile'>\n<tr>\n<td>\n<br>\n";

   // Start of Profile
   echo "<table cellpadding='0' cellspacing='1' class='tbl-border' width='100%'>\n"
   ."<tr>\n<td align='center' class='tbl1' style='white-space:nowrap;' width='100' valign='top'>\n";
   if ($list == 'profile') {
      echo ($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$locale['u017']."'><br><br>\n<hr>\n" : "")
      .($data['user_hide_email'] != 1 || iADMIN ? "<button class='button' onclick=\"window.location = 'mailto:".str_replace("@","&#64;",$data['user_email'])."';\" style='margin-bottom:1px;width:100px;' title='".str_replace("@","&#64;",$data['user_email'])."'>".$locale['u051']."</button><br>\n" : "")
      .($data['user_web'] ? "<button class='button' onclick=\"window.open('".(!strstr($data['user_web'], "http://") ? "http://" : "").$data['user_web']."');\" style='margin-bottom:1px;width:100px;' title='".(!strstr($data['user_web'], "http://") ? "http://" : "").$data['user_web']."'>".$locale['u052']."</button><br>\n" : "")
      .(!isset($userdata['user_id']) || $data['user_id'] != $userdata['user_id'] ? "<button class='button' onclick=\"window.location = 'messages.php?msg_send=".$data['user_id']."';\" style='margin-bottom:1px;width:100px;' title='".$locale['u060']."'>".$locale['u053']."</button><br>\n" : "")
      .($data['user_aim'] || $data['user_icq'] || $data['user_msn'] || $data['user_yahoo'] ? "<br><hr>\n" : "")
      .($data['user_aim'] ? "<button class='button' onclick=\"alert('".$data['user_aim']."');\" style='margin-bottom:1px;width:100px;' title='".$data['user_aim']."'>".$locale['pe040']."</button><br>\n" : "")
      .($data['user_icq'] ? "<button class='button' onclick=\"alert('".$data['user_icq']."');\" style='margin-bottom:1px;width:100px;' title='".$data['user_icq']."'>".$locale['pe041']."</button><br>\n" : "")
      .($data['user_msn'] ? "<button class='button' onclick=\"alert('".$data['user_msn']."');\" style='margin-bottom:1px;width:100px;' title='".$data['user_msn']."'>".$locale['pe042']."</button><br>\n" : "")
      .($data['user_yahoo'] ? "<button class='button' onclick=\"alert('".$data['user_yahoo']."');\" style='margin-bottom:1px;width:100px;' title='".$data['user_yahoo']."'>".$locale['pe043']."</button><br>\n" : "")
      .(iSUPERADMIN ? "<br>\n<hr>\n<button class='button' onclick=\"alert('".$data['user_ip']."');\" style='margin-bottom:1px;width:100px;' title='".$data['user_ip']."'>".$locale['pe044']."</button><br>\n" : "");
   } else {
      echo ($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$locale['u017']."'>" : "&nbsp;");
   }
   echo "</td>\n<td class='tbl1' style='white-space:nowrap;' valign='top'>\n"
   ."<strong>".$data['user_name']."</strong><br>\n"
   ."<span style='float:left;'>";
   if ($data['user_level'] == 103) $color = "CC0000";
   elseif ($data['user_level'] == 102) $color = "006600";
   else $color = "006600";
   echo "<font color='#$color'>".getuserlevel($data['user_level'])."</font>";
   echo "</span>\n<span style='float:right;'>";
   $lvisit = time() - $data['user_lastvisit'];
   if ($lvisit < 60) echo "<span style='color:#006600;font-weight:normal;'>".$locale['pe000']."</span>";
   elseif ($lvisit < 300) echo "<span style='color:#006600;font-weight:normal;'>".$locale['pe001']."</span>";
   else echo "<span style='color:#AA0000;font-weight:normal;'>".$locale['pe002']."</span>";
   echo "</span>\n"
   ."<br style='clear:both;'><br>\n";
   if ($list == 'profile') {
      echo "<hr>\n<table cellpadding='0' cellspacing='0' width='100%'>\n"
      ."<tr><td class='small' width='30%'>".$locale['u009']."</td><td class='small2'>".($data['user_location'] ? $data['user_location'] : $locale['u048'])."</td></tr>\n"
      ."<tr><td class='small' width='30%'>".$locale['u010']."</td><td class='small2'>";
      if ($data['user_birthdate'] != "0000-00-00") {
         $months = explode("|", $locale['months']);
         $user_birthdate = explode("-", $data['user_birthdate']);
         echo $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0'];
      } else {
         echo $locale['u048'];
      }
      echo "</td>\n</tr>\n"
      ."</table>\n<br>\n"
      ."<hr>\n<table cellpadding='0' cellspacing='0' width='100%'>\n"
      ."<tr><td class='small' width='30%'>".$locale['u040']."</td><td class='small2'>".showdate("longdate", $data['user_joined'])."</td></tr>\n"
      ."<tr><td class='small' width='30%'>".$locale['u044']."</td><td class='small2'>".($data['user_lastvisit'] != 0 ? showdate("longdate", $data['user_lastvisit']) : $locale['u049'])."</td></tr>\n"
      ."<tr><td class='small' width='30%'>".$locale['u041']."</td><td class='small2'>".number_format(dbcount("(shout_id)", "shoutbox", "shout_name='".$data['user_id']."'"))."</td></tr>\n"
      ."<tr><td class='small' width='30%'>".$locale['u042']."</td><td class='small2'>".number_format(dbcount("(comment_id)", "comments", "comment_name='".$data['user_id']."'"))."</td></tr>\n"
      ."<tr><td class='small' width='30%'>".$locale['u043']."</td><td class='small2'>".number_format($data['user_posts'])."</td></tr>\n"
      ."</table>\n<br>\n";
      if ($data['user_groups']) {
         echo "<hr>\n<table cellpadding='0' cellspacing='0' width='100%'>\n"
         ."<tr><td class='small' width='30%' valign='top'>".$locale['423'].":</td>"
         ."<td>";
         $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++) {
            echo "<a class='small2' href='".FUSION_SELF."?group_id=".$user_groups[$i]."'><strong>".getgroupname($user_groups[$i])."</strong></a>";
            if ($i != (count($user_groups)-1)) { echo ","; }
         }
         echo "</td></tr>\n"
         ."</table>\n<br>\n";
      }   
   } else {
      echo "<hr>\n"
      .($data['user_hide_email'] != 1 || iADMIN ? "<button class='button' onclick=\"window.location = 'mailto:".str_replace("@","&#64;",$data['user_email'])."';\" style='width:100px;' title='".str_replace("@","&#64;",$data['user_email'])."'>".$locale['u051']."</button>&nbsp;\n" : "")
      .($data['user_web'] ? "<button class='button' onclick=\"window.open('".(!strstr($data['user_web'], "http://") ? "http://" : "").$data['user_web']."');\" style='width:100px;' title='".(!strstr($data['user_web'], "http://") ? "http://" : "").$data['user_web']."'>".$locale['u052']."</button>&nbsp;\n" : "")
      .(!isset($userdata['user_id']) || $data['user_id'] != $userdata['user_id'] ? "<button class='button' onclick=\"window.location = 'messages.php?msg_send=".$data['user_id']."';\" style='width:100px;' title='".$locale['u060']."'>".$locale['u053']."</button>&nbsp;\n" : "")
      .(iSUPERADMIN ? "<button class='button' onclick=\"alert('".$data['user_ip']."');\" style='width:100px;' title='".$data['user_ip']."'>".$locale['pe044']."</button><br>\n" : "");
   }
   echo "</td>\n</tr>\n</table>\n<br>\n";
   // End of Profile
   

   }     
   echo "</td>\n</tr>\n</table>\n";
   closetable();
     
} elseif ((isset($group_id)) && (!isset($lookup)) && (isNum($group_id))) {
   $profile_include_rightside = true;
   $result = dbquery("SELECT * FROM ".$db_prefix."user_groups WHERE group_id='$group_id'");
   if (dbrows($result)) {
      $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 "<table align='center' cellpadding='0' cellspacing='0' width='100%' id='profile'>\n<tr>\n<td>\n<br>\n";
      echo "<table cellpadding='0' cellspacing='1' class='tbl-border' width='100%'>\n"
      ."<tr>\n<td class='tbl1' style='white-space:nowrap;' width='100%'>"
      ."<span style='float:left;'><strong>".$data['group_name']."</strong></span>"
      ."<span class='small2' style='float:right;'>(".sprintf((dbrows($result)==1?$locale['411']:$locale['412']), dbrows($result)).")</span><br><br><hr>\n"
      ."<table cellpadding='0' cellspacing='0' width='100%'>\n";
      while ($data = dbarray($result)) {
         echo "<tr><td width='75%'><a href='".FUSION_SELF."?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>"
         ."<td align='center' nowrap='nowrap'>".getuserlevel($data['user_level'])."</td></tr>\n";
      }
      echo "</table>\n";
      echo "</td>\n</tr>\n</table>\n<br>\n";
      echo "</td>\n</tr>\n</table>\n";
      closetable();
   } else {
      fallback(BASEDIR."index.php");
   }
} else fallback("index.php");

if ($profile_include_rightside) require_once "side_right.php";
else echo "</td>\n";
require_once "footer.php";
?>