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.4 KiB

  1. <?php
  2. /**
  3. * @package Dynamic Script Forum
  4. * @file user.php
  5. * @version 1.0.x, 12-07-2007, 19:35
  6. * @copyright 2008(c) PioDer <pioder@wp.pl>
  7. * @link http://pioder.gim2przemysl.int.pl/dsf.html
  8. * @license GNU GPL v3
  9. **/
  10. define('IN_uF', true);
  11. //include files
  12. include('./config.php');
  13. include('./includes/constants.php');
  14. include('./includes/class_db.php');
  15. include('./includes/class_error.php');
  16. //connect to database
  17. DataBase::db_connect();
  18. include('./includes/sessions.php');
  19. include('./includes/class_user.php');
  20. include('./common.php');
  21. include('./includes/class_overall.php');
  22. include('./includes/class_forum.php');
  23. include('./includes/classes/secure.php');
  24. $default_lang = Over::DefaultLang();
  25. include('./lngs/'.$default_lang.'/main.php');
  26. $start = Over::TimeGeneration();
  27. $default_skin = Over::ViewSkinName();
  28. sess_del_invalid($_SESSION['uid']);
  29. sess_register($_SESSION['uid']);
  30. sess_delete_old();
  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 = @mysql_fetch_array($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 = mysql_num_rows($query);
  49. while ($result = @mysql_fetch_array($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 = @mysql_fetch_array($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_associative($skin,Over::generate_header($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 = Over::TimeGeneration();
  120. $skin['queries'] = Over::ShowQueries($start, $stop);
  121. include('./skins/'.$default_skin.'/overall_footer.tpl');
  122. ?>