editUser.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /* $Id: editUser.php 2893 2007-04-14 13:20:30Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. // prevent direct invocation
  16. if ((!isset($cfg['user'])) || (isset($_REQUEST['cfg']))) {
  17. @ob_end_clean();
  18. @header("location: ../../../index.php");
  19. exit();
  20. }
  21. /******************************************************************************/
  22. $user_id = tfb_getRequestVar('user_id');
  23. // init template-instance
  24. tmplInitializeInstance($cfg["theme"], "page.admin.editUser.tmpl");
  25. // set vars
  26. $editUserImage = "themes/".$cfg['theme']."/images/user.gif";
  27. $selected_n = "selected";
  28. $selected_a = "";
  29. $hide_checked = "";
  30. $total_activity = GetActivityCount();
  31. $sql= "SELECT user_id, hits, last_visit, time_created, user_level, hide_offline, theme, language_file FROM tf_users WHERE user_id=".$db->qstr($user_id);
  32. list($user_id, $hits, $last_visit, $time_created, $user_level, $hide_offline, $theme, $language_file) = $db->GetRow($sql);
  33. $user_type = $cfg['_NORMALUSER'];
  34. if ($user_level == 1) {
  35. $user_type = $cfg['_ADMINISTRATOR'];
  36. $selected_n = "";
  37. $selected_a = "selected";
  38. $editUserImage = "themes/".$cfg['theme']."/images/admin_user.gif";
  39. }
  40. if ($user_level >= 2) {
  41. $user_type = $cfg['_SUPERADMIN'];
  42. $editUserImage = "themes/".$cfg['theme']."/images/superadmin.gif";
  43. }
  44. if ($hide_offline == 1)
  45. $hide_checked = "checked";
  46. $user_activity = GetActivityCount($user_id);
  47. $user_percent = ($user_activity != 0) ? number_format(($user_activity / $total_activity) * 100) : 0;
  48. $tmpl->setvar('editUserImage', $editUserImage);
  49. $tmpl->setvar('user_id', $user_id);
  50. $tmpl->setvar('time_created', date($cfg['_DATETIMEFORMAT'], $time_created));
  51. $tmpl->setvar('last_visit', date($cfg['_DATETIMEFORMAT'], $last_visit));
  52. $tmpl->setvar('percent1', $user_percent*2);
  53. $tmpl->setvar('percent2', (200 - ($user_percent*2)));
  54. $tmpl->setvar('user_activity', $user_activity);
  55. $tmpl->setvar('user_percent', $user_percent);
  56. $tmpl->setvar('days_to_keep', $cfg["days_to_keep"]);
  57. $tmpl->setvar('hits', $hits);
  58. $tmpl->setvar('language_file', GetLanguageFromFile($language_file));
  59. $tmpl->setvar('user_type', $user_type);
  60. $tmpl->setvar('user_level', $user_level);
  61. $tmpl->setvar('selected_n', $selected_n);
  62. $tmpl->setvar('selected_a', $selected_a);
  63. $tmpl->setvar('hide_checked', $hide_checked);
  64. $tmpl->setvar('enable_xfer', $cfg["enable_xfer"]);
  65. //
  66. $tmpl->setvar('_EDITUSER', $cfg['_EDITUSER']);
  67. $tmpl->setvar('_LASTVISIT', $cfg['_LASTVISIT']);
  68. $tmpl->setvar('_JOINED', $cfg['_JOINED']);
  69. $tmpl->setvar('_UPLOADPARTICIPATION', $cfg['_UPLOADPARTICIPATION']);
  70. $tmpl->setvar('_UPLOADS', $cfg['_UPLOADS']);
  71. $tmpl->setvar('_PERCENTPARTICIPATION', $cfg['_PERCENTPARTICIPATION']);
  72. $tmpl->setvar('_PARTICIPATIONSTATEMENT', $cfg['_PARTICIPATIONSTATEMENT']);
  73. $tmpl->setvar('_DAYS', $cfg['_DAYS']);
  74. $tmpl->setvar('_TOTALPAGEVIEWS', $cfg['_TOTALPAGEVIEWS']);
  75. $tmpl->setvar('_THEME', $cfg['_THEME']);
  76. $tmpl->setvar('_LANGUAGE', $cfg['_LANGUAGE']);
  77. $tmpl->setvar('_USERTYPE', $cfg['_USERTYPE']);
  78. $tmpl->setvar('_USERSACTIVITY', $cfg['_USERSACTIVITY']);
  79. $tmpl->setvar('_USER', $cfg['_USER']);
  80. $tmpl->setvar('_NEWPASSWORD', $cfg['_NEWPASSWORD']);
  81. $tmpl->setvar('_CONFIRMPASSWORD', $cfg['_CONFIRMPASSWORD']);
  82. $tmpl->setvar('_NORMALUSER', $cfg['_NORMALUSER']);
  83. $tmpl->setvar('_ADMINISTRATOR', $cfg['_ADMINISTRATOR']);
  84. $tmpl->setvar('_SUPERADMIN', $cfg['_SUPERADMIN']);
  85. $tmpl->setvar('_HIDEOFFLINEUSERS', $cfg['_HIDEOFFLINEUSERS']);
  86. $tmpl->setvar('_UPDATE', $cfg['_UPDATE']);
  87. $tmpl->setvar('_USERIDREQUIRED', $cfg['_USERIDREQUIRED']);
  88. $tmpl->setvar('_PASSWORDLENGTH', $cfg['_PASSWORDLENGTH']);
  89. $tmpl->setvar('_PASSWORDNOTMATCH', $cfg['_PASSWORDNOTMATCH']);
  90. $tmpl->setvar('_PLEASECHECKFOLLOWING', $cfg['_PLEASECHECKFOLLOWING']);
  91. //
  92. tmplSetTitleBar("Administration - Edit User");
  93. tmplSetAdminMenu();
  94. tmplSetUserSection();
  95. tmplSetFoot();
  96. tmplSetIidVars();
  97. // parse template
  98. $tmpl->pparse();
  99. ?>