Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Bartelio Klausimai

Parašė DEMO_user· 2010 Geg. 27 19:05:20
#26

.htaccess kelk į root.
o dėl to profile naudok if (iADMIN)
pameginsiu uždėti:

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Vartotojo perziuros + suvestine
| Copyright © 2009 Dragelis
| https://webdnd.com
+----------------------------------------------------+
| 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
+----------------------------------------------------*/
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";

if (!isset($group_id)) {
   if (!isset($lookup) || !isNum($lookup)) fallback("index.php");
   $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='$lookup'");
   if (dbrows($result)) { $data = dbarray($result); } else { redirect("index.php"); }
   
/* Dragelio papildymas */
$no_avatar_url = IMAGES."avatars/noav.gif";

if ($_GET['lookup'] != $userdata['user_id']) {

if (iAdmin("(admin_id)", "users", "user_id = '".$_GET['lookup']."' AND profile_last_viewer_ip = '".USER_IP."' AND profile_last_view_datestamp > ".(time()-2000))) $result = dbquery("UPDATE ".$db_prefix."users SET profile_views = profile_views+1, profile_last_viewer_ip = '".USER_IP."', profile_last_view_datestamp = '".time()."' WHERE user_id = '".$_GET['lookup']."' LIMIT 1");

if (!dbcount("(profile_visit_id)", "profile_visits", "profile_visit_user = '".$_GET['lookup']."' AND ".(iGUEST ? "profile_visit_ip = '".USER_IP."'" : "profile_visiter = '".$userdata['user_id']."'"))) {
   $result = dbquery("INSERT INTO ".$db_prefix."profile_visits (profile_visit_user, profile_visiter, profile_visit_datestamp, profile_visit_ip) VALUES ('".$_GET['lookup']."', '".(iGUEST ? 0 : $userdata['user_id'])."', '".time()."', '".USER_IP."');");
} else {
   $result = dbquery("UPDATE ".$db_prefix."profile_visits SET profile_visit_datestamp = '".time()."', profile_visit_ip = '".USER_IP."' WHERE profile_visit_user = '".$_GET['lookup']."' AND ".(iGUEST ? "profile_visit_ip = '".USER_IP."'" : "profile_visiter = '".$userdata['user_id']."'")." LIMIT 1");
}

}

if (isset($_GET['act'])) {
   $act = $_GET['act'];
   if ($act == "delete_views") {
      if ($_GET['lookup'] == $userdata['user_id'] || (iADMIN && checkrights("M"))) {
         $result = dbquery("UPDATE ".$db_prefix."users SET profile_views = '0', profile_last_viewer_ip = '0.0.0.0', profile_last_view_datestamp = '0' WHERE user_id = '".$_GET['lookup']."' LIMIT 1");
         $result = dbquery("DELETE FROM ".$db_prefix."profile_visits WHERE profile_visit_user = '".$_GET['lookup']."'");
         if ($result) fallback(FUSION_SELF."?lookup=".$_GET['lookup']."&status=ok");
      } else {
         fallback(FUSION_SELF."?lookup=".$_GET['lookup']."&status=no");
      }
   }
}

   if ($data['user_birthdate'] != "0000-00-00") {
      $months = explode("|", $locale['months']);
      $user_birthdate = explode("-", $data['user_birthdate']);
      $user_birthdate = $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0'];
   } else {
      $user_birthdate = $locale['u048'];
   }

   opentable($locale['420']);
   echo "<table align='center' cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
   <tr>
  <td align='center' width='160' rowspan='7' class='tbl2'>
   ".($data['user_avatar'] ? "<img src='".IMAGES."avatars/".$data['user_avatar']."' alt='".$locale['u017']."'>" : "<img src='$no_avatar_url' alt=''>")."</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>Vartotojo vardas:</b></td>
  <td class='tbl2'>".$data['user_name']."</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>Pareigos:</b></td>
  <td class='tbl2'>".getuserlevel($data['user_level'])."</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u009']."</b></td>
  <td class='tbl2'>".($data['user_location'] ? $data['user_location'] : $locale['u048'])."</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u010']."</b></td>
  <td class='tbl2'>$user_birthdate</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u052'].":</b></td>
  <td class='tbl2'>".($data['user_web'] != '' ? "<a href='".(!strstr($data['user_web'], "http://") ? "http://" : '').$data['user_web']."' target='_blank'>U&#382;eiti</a>" : $locale['u048'])."</td>
  </tr>
  <tr>
  <td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u051'].":</b></td>
  <td class='tbl2'>".($data['user_hide_email'] != 1 || iADMIN ? "<a href='mailto:".str_replace("@", "&#64;", $data['user_email'])."'>&#381;i&#363;r&#279;ti</a>" : 'Nerodomas visiems')."</td>
  </tr>
  <tr>
  <td class='tbl2' colspan='3'>&#352;is narys komentuotas: <b>".number_format(dbcount("(comment_id)", "comments", "comment_type = 'U' AND comment_item_id = '".$_GET['lookup']."'"))."</b> kartus(-&#371;) ir per&#382;i&#363;r&#279;tas <b>".$data['profile_views']."</b> kartus(-&#371;). ".(iADMIN || $_GET['lookup'] == $userdata['user_id'] ? "<a href='".FUSION_SELF."?lookup=".$_GET['lookup']."&act=delete_views' title='Valyti per&#382;i&#363;ras'>[Valyti per&#382;i&#363;ras]</a>" : '')."</td>
  </tr>
  ".(iMEMBER && $data['user_id'] != $userdata['user_id'] ? "<tr>
  <td align='center' colspan='3' class='tbl2'><img src='".IMAGES."icons/pm.png' alt=''> <a href='messages.php?msg_send=".$data['user_id']."' title='Si&#371;sti asmenin&#281; &#382;inut&#281;'>Si&#371;sti asmenin&#281; &#382;inut&#281;</a></td>
  </tr>" : '')."
  </table>\n";
 
  tablebreak();
 
   echo "<table align='center' cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
   <tr>
  <td class='tbl2' colspan='2'><b>Kontaktin&#279; informacija</b></td>
  </tr>
   <tr>
  <td width='10%' class='tbl2' style='white-space:nowrap'><b>".$locale['u021']."</b></td>
  <td class='tbl2'>".($data['user_aim'] ? $data['user_aim'] : $locale['u048'])."</td>
  </tr>
  <tr>
  <td width='10%' class='tbl2' style='white-space:nowrap'><b>".$locale['u011']."</b></td>
  <td class='tbl2'>".($data['user_icq'] ? $data['user_icq'] : $locale['u048'])."</td>
  </tr>
  <tr>
  <td width='10%' class='tbl2' style='white-space:nowrap'><b>".$locale['u012']."</b></td>
  <td class='tbl2'>".($data['user_msn'] ? $data['user_msn'] : $locale['u048'])."</td>
  </tr>
  <tr>
  <td width='10%' class='tbl2' style='white-space:nowrap'><b>".$locale['u013']."</b></td>
  <td class='tbl2'>".($data['user_yahoo'] ? $data['user_yahoo'] : $locale['u048'])."</td>
  </tr>
  </table>\n";

  tablebreak();
 
  /* Dragelio papildymas baigtas */
   
   echo "<table align='center' cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>
<tr>
<td class='tbl2' colspan='2'><b>".$locale['422']."</b></td>
</tr>
<tr>
<td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u040']."</b></td>
<td class='tbl2'>".showdate("longdate", $data['user_joined'])."</td>
</tr>
<tr>
<td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u044']."</b></td>
<td class='tbl2'>".($data['user_lastvisit'] != 0 ? showdate("longdate", $data['user_lastvisit']) : $locale['u049'])."</td>
</tr>
<tr>
<td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u041']."</b></td>
<td class='tbl2'>".number_format(dbcount("(shout_id)", "shoutbox", "shout_name='".$data['user_id']."'"))."</td>
</tr>
<tr>
<td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u042']."</b></td>
<td class='tbl2'>".number_format(dbcount("(comment_id)", "comments", "comment_name='".$data['user_id']."'"))."</td>
</tr>
<tr>
<td width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['u043']."</b></td>
<td class='tbl2'>".number_format($data['user_posts'])."</td>
</tr>
</table>\n";

   if ($data['user_groups']) {
      tablebreak();
      echo "<table align='center' cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n";
      echo "<tr>\n<td class='tbl2'><b>".$locale['423']."</b></td>\n\n</tr>\n<tr>\n<td class='tbl1'>\n";
      $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 href='".FUSION_SELF."?group_id=".$user_groups[$i]."'>".getgroupname($user_groups[$i])."</a>";
         if ($i != (count($user_groups)-1)) { echo ",\n"; } else { echo "\n"; }
      }
      echo "</td>\n</tr>\n</table>\n";
   }

   
   /* Dragelio papildymas */
   
   tablebreak();
   echo "<table align='center' cellspacing='1' width='100%' class='tbl-border'>
  <tr>
  <td class='tbl2' colspan='3'><b>".$data['user_name']." sukurtos temos forume</b></td>
  </tr>\n";
   
   $thread_result = dbquery("
   SELECT thread_subject, forum_id, thread_views, thread_id FROM ".$db_prefix."threads
   WHERE thread_author = '".$data['user_id']."'
   ORDER BY thread_lastpost
   DESC LIMIT 5
  ");

  if (dbrows($thread_result)) {
  echo "<tr>
  <td class='tbl2'><b>Tema</b></td>
  <td class='tbl2'><b>&#381;i&#363;r&#279;jo</b></td>
  <td class='tbl2'><b>Atsakym&#371;</b></td>
  </tr>\n";
   while ($thread_data = dbarray($thread_result)) {
   echo "<tr>
   <td class='tbl2'><a href='".FORUM."viewthread.php?forum_id=".$thread_data['forum_id']."&amp;thread_id=".$thread_data['thread_id']."'>".trimlink($thread_data['thread_subject'], 40)."</a></td>
   <td class='tbl2'>".$thread_data['thread_views']."</td>
   <td class='tbl2'>".(dbcount("(post_id)", "posts", "thread_id = '".$thread_data['thread_id']."'") - 1)."</td>
   </tr>\n";
   }
  } else {
   echo "<tr>
   <td class='tbl2' colspan='3'>Vartotojas ".$data['user_name']." tem&#371; forume nesuk&#363;r&#279;!</td>
   </tr>\n";
  }
 
  echo "</table>\n";
 
  tablebreak();
   echo "<table align='center' cellspacing='1' width='100%' class='tbl-border'>
  <tr>
  <td class='tbl2' colspan='3'><b>".$data['user_name']." para&#353;ytos &#382;inut&#279;s forume</b></td>
  </tr>\n";
 
  $post_result = dbquery("
   SELECT post_subject, post_datestamp, thread_id, forum_id, post_id FROM ".$db_prefix."posts
   WHERE post_author = '".$data['user_id']."'
   ORDER BY post_datestamp
   DESC LIMIT 5
  ");
 
  if (dbrows($post_result)) {
  echo "<tr>
  <td class='tbl2'><b>Pavadinimas</b></td>
  <td class='tbl2'><b>Data</b></td>
  </tr>\n";
   while ($post_data = dbarray($post_result)) {
   $rows = dbcount("(post_id)", "posts", "thread_id = '".$post_data['thread_id']."' AND post_datestamp < ".$post_data['post_datestamp']);
   echo "<tr>
   <td class='tbl2'><a href='".FORUM."viewthread.php?forum_id=".$post_data['forum_id']."&amp;thread_id=".$post_data['thread_id']."&rowstart=".($rows < 10 ? 0 : ($rows-$rows%10))."#post_".$post_data['post_id']."'>".trimlink($post_data['post_subject'], 40)."</a></td>
   <td class='tbl2'>".showdate("%Y-%m-%d %H:%M", $post_data['post_datestamp'])."</td>
   </tr>\n";
   }
  } else {
   echo "<tr>
   <td class='tbl2' colspan='3'>Vartotojas ".$data['user_name']." prane&#353;im&#371; forume nera&#353;&#279;!</td>
   </tr>\n";
  }
 
  echo "</table>\n";
  closetable();
   
   if (isset($_GET['status']) && $_GET['status'] == "ok" || $_GET['status'] == "no") {
   tablebreak();
   opentable("Informacij&#261; apie per&#382;i&#363;ri&#371; trinim&#261;");
   echo "<center><b>".($_GET['status'] == "ok" ? "Per&#382;i&#363;ros buvo s&#279;kmingai i&#353;trintos!" : '').
   ($_GET['status'] == "no" ? "J&#363;s neturite privilegij&#371;, norint atlikti &#353;ita veiksm&#261;!" : '')."</center></b>\n";
   closetable();
   }
   
   if (iADMIN && checkrights("M") || $_GET['lookup'] == $userdata['user_id']) {
   tablebreak();
   opentable($_GET['lookup'] == $userdata['user_id'] ? "Mano profilio lankytojai" : "Vartotojo ".$data['user_name']." profilio lankytojai");
   
         $result = dbquery("
            SELECT user_id, user_name, user_avatar, profile_visit_datestamp, profile_visit_ip, profile_visiter FROM ".$db_prefix."profile_visits
            LEFT JOIN ".$db_prefix."users ON profile_visiter = user_id
            WHERE profile_visit_user = '".$_GET['lookup']."'".(!iADMIN && !checkrights("M") ? " AND profile_visiter <> 1" : '')."
            ORDER BY profile_visit_datestamp
            DESC LIMIT 5
         ");
         
   if (dbrows($result)) {
         echo "<table align='center' cellspacing='1' width='100%' class='tbl-border'>
         <tr>\n";
         while ($profile_data = dbarray($result)) {
            echo "<td align='center' class='tbl2'><span title='Lank&#279;si: ".showdate("%Y-%m-%d %H:%M:%S", $profile_data['profile_visit_datestamp']).(iADMIN && checkrights("M") || $profile_data['profile_visiter'] == 0 ? ", Lankytojo IP: ".$profile_data['profile_visit_ip'] : '')."'>".($profile_data['user_avatar'] != '' && file_exists(IMAGES."avatars/".$profile_data['user_avatar']) && $profile_data['profile_visiter'] != 0 ? "<img src='".IMAGES."avatars/".$profile_data['user_avatar']."' weight='60' height='60' alt=''>" : "<img src='$no_avatar_url' alt=''>")."</span><br>
            <img src='".THEME."images/bullet.gif' alt=''> ".($profile_data['profile_visiter'] != 0 ? "<a href='".FUSION_SELF."?lookup=".$profile_data['user_id']."'>".$profile_data['user_name']."</a>" : "<b>Sve&#269;ias</b>")."</td>\n";
         }
         echo "</tr>
         ".(dbrows($result) > 5 ? "<tr>
        <td align='center' colspan='5' class='tbl2'><a href='".BASEDIR."profile_visits.php?lookup=".$_GET['lookup']."'>Rodyti visus lankytojus</a></td>
         </tr>" : '')."
      </table>\n";
   } else {
      echo "<center><b>&#352;io profilio dar niekas neaplank&#279;!</b></center>\n";
   }
   closetable();
   tablebreak();
}
 
  include INCLUDES."comments_include.php";
   showcomments("U", "users", "user_id", $_GET['lookup'], FUSION_SELF."?lookup=".$_GET['lookup']);
   
   /* Dragelio papildymas baigtas */
   
} else {
   if (!isNum($group_id)) fallback("index.php");
   $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='1' width='100%' class='tbl-border'>
<tr>
<td align='center' colspan='2' class='tbl1'><b>".$data['group_name']."</b> (".sprintf((dbrows($result)==1?$locale['411']:$locale['412']), dbrows($result)).")</td>
</tr>
<tr>
<td class='tbl2'><b>".$locale['401']."</b></td>
<td align='center' width='1%' class='tbl2' style='white-space:nowrap'><b>".$locale['402']."</b></td>
</tr>\n";
      while ($data = dbarray($result)) {
         $cell_color = ($i % 2 == 0 ? "tbl1" : "tbl2"); $i++;
         echo "<tr>\n<td class='$cell_color'>\n<a href='profile.php?lookup=".$data['user_id']."'>".$data['user_name']."</a></td>\n";
         echo "<td align='center' width='1%' class='$cell_color' style='white-space:nowrap'>".getuserlevel($data['user_level'])."</td>\n</tr>";
      }
      echo "</table>\n";
      closetable();
   } else {
      fallback(BASEDIR."index.php");
   }
}

require_once "side_right.php";
require_once "footer.php";
?>