A lightweight forum engine written in PHP. Repository is now obsolete and read-only. http://www.pioder.pl/uforum.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.3 KiB

  1. <?php
  2. /**
  3. * @package uForum
  4. * @file user.php
  5. * @version $Id$
  6. * @copyright 2007-2010 (c) PioDer <pioder@wp.pl>
  7. * @link http://www.pioder.pl/
  8. * @license see LICENSE.txt
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. include('./config.php');
  13. include('./includes/constants.php');
  14. include('./includes/db.php');
  15. include('./includes/errors.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. include('./includes/sessions.php');
  19. include('./includes/classes/class_user.php');
  20. include('./common.php');
  21. include('./includes/misc_functions.php');
  22. include('./includes/classes/class_forum.php');
  23. include('./includes/classes/secure.php');
  24. $default_lang = DefaultLang();
  25. include('./lngs/'.$default_lang.'/main.php');
  26. $start = TimeGeneration();
  27. $default_skin = ViewSkinName();
  28. SessDelInvalid();
  29. SessRegister();
  30. SessDeleteOld();
  31. $uid = intval($_GET['id']);
  32. //check online for user
  33. $sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE `u_id`='$uid' AND time+1250>".time()." LIMIT 1";
  34. $query = DataBase::sql_query($sql, GENERAL, 'Could not read user active.');
  35. $result = DataBase::fetch($query);
  36. if ($result['u_id']==$uid)
  37. {
  38. $active = 1;
  39. }
  40. else
  41. {
  42. $active = 0;
  43. }
  44. unset($sql, $query, $result);
  45. $userwarn = 0;
  46. $sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
  47. $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user warns information');
  48. $result = DataBase::num_rows($query);
  49. while ($result = DataBase::fetch($query))
  50. {
  51. if ($result['value']=='-')
  52. {
  53. $userwarn -=1;
  54. }
  55. else
  56. {
  57. $userwarn +=1;
  58. }
  59. }
  60. $userwarn = ($userwarn>0) ? $userwarn*10 : $userwarn;
  61. //add skin variables
  62. $sql = "SELECT * FROM `".USERS_TABLE."` WHERE u_id='$uid'";
  63. $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain user information');
  64. $user_info = DataBase::fetch($query);
  65. if ($user_info['u_id']=='')
  66. {
  67. message_forum($lng['no_user'],'index.php');
  68. }
  69. $skin = array(
  70. 'u_id'=>$_GET['id'],
  71. 'lang'=>$default_lang,
  72. 'sig'=>$user_info['sig'],
  73. 'lsig'=>$lng['sig'],
  74. 'posts'=>$user_info['posts'],
  75. 'luposts'=>$lng['posts'],
  76. 'lstat'=>$lng['stat'],
  77. 'stat'=>($active==1) ? 'online.gif' : 'offline.gif',
  78. 'prposts'=>User::PostWithForum($user_info['posts']),
  79. 'lastvisit'=>($user_info['lastvisit']!='0') ? date('d-m-Y, G:i',$user_info['lastvisit']) : $lng['never'],
  80. 'llastvisit'=>$lng['lulastvisit'],
  81. 'avatar'=>($user_info['avatar']!='') ? '<img src="'.$user_info['avatar'].'" alt="av">' : '<br><br><br><br>',
  82. 'lavatar'=>$lng['avatar'],
  83. 'regdate'=>date('d-m-Y, G:i',$user_info['regdate']),
  84. 'lpalf'=>$lng['witch_all_post_forum'],
  85. 'lregdate'=>$lng['luregister'],
  86. 'interests'=>$user_info['interests'],
  87. 'linterests'=>$lng['luinterests'],
  88. 'userrank'=>User::UserRank($user_info['rank']),
  89. 'luserrank'=>$lng['lurank'],
  90. 'lwarns'=> $lng['warns'],
  91. 'show_topics'=> $lng['view_user_topics'],
  92. 'warnlevel' => $userwarn,
  93. 'warncolor'=>($userwarn>0) ? 'red' : 'green',
  94. 'lcontact'=>$lng['contact'],
  95. 'user_gg'=>(($user_info['allow_gg'])&& ($user_info['gg']!='0')) ? '<a href="gg:'.$user_info['gg'].'"><img border="0" src="skins/'.$default_skin.'/images/gg.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/gg_active.gif\'"
  96. onMouseOut="this.src=\'skins/'.$default_skin.'/images/gg.gif\'" alt="gg"></a>' : '',
  97. 'user_email'=>($user_info['allow_email']=='1') ? '<a href="mailto:'.$user_info['email'].'"><img border="0" src="skins/'.$default_skin.'/images/email.gif" onMouseOver="this.style.cursor=\'hand\'; this.src=\'skins/'.$default_skin.'/images/email_active.gif\'"
  98. onMouseOut="this.src=\'skins/'.$default_skin.'/images/email.gif\'" alt="email"></a>' : '',
  99. );
  100. $skin = array_push_assoc($skin,GenerateHeader($lng['showprofile'].': '.$user_info['nick'], '</a>&gt; <a href="user.php?id='.$_GET['id'].'" class="navigator">'.$lng['showprofile'].': '.$user_info['nick']));
  101. //do it!
  102. include('./skins/'.$default_skin.'/overall_header.tpl');
  103. include('./skins/'.$default_skin.'/user_body.tpl');
  104. if($_SESSION['uid']>0)
  105. {
  106. if(RANK==2)
  107. {
  108. $skin['pa_link']='<a href="admin/index.php" class="fsmall"><b>'.$lng['pa_link'].'</b></a>';
  109. }
  110. else
  111. {
  112. $skin['pa_link']='';
  113. }
  114. }
  115. else
  116. {
  117. $skin['pa_link']='';
  118. }
  119. $stop = TimeGeneration();
  120. $skin['queries'] = ShowQueries($start, $stop);
  121. include('./skins/'.$default_skin.'/overall_footer.tpl');
  122. ?>