Advertisement
Guest User

signature.php

a guest
Apr 19th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. <?php
  2.  
  3. define("IN_MYBB", 1);
  4. define('THIS_SCRIPT', 'signature.php');
  5.  
  6. $nosession['avatar'] = 1;
  7. $templatelist = "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_invalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_registered,member_register_hiddencaptcha";
  8. $templatelist .= ",redirect_loggedout,login,redirect_loggedin,error_invalidusername,error_invalidpassword,member_profile_email,member_profile_offline,member_profile_reputation,member_profile_warn,member_profile_warninglevel,member_profile_customfields_field,member_profile_customfields,member_profile_adminoptions,member_profile,member_login,member_profile_online,member_profile_modoptions,member_profile_signature,member_profile_groupimage,member_profile_referrals";
  9. require_once "./global.php";
  10.  
  11. require_once MYBB_ROOT."inc/functions_post.php";
  12. require_once MYBB_ROOT."inc/functions_user.php";
  13. require_once MYBB_ROOT."inc/class_parser.php";
  14. $parser = new postParser;
  15.  
  16. // Load global language phrases
  17. $lang->load("member");
  18.  
  19. if($mybb->input['uid'] == "lastposter")
  20. {
  21. if($mybb->input['tid'])
  22. {
  23. $query = $db->simple_select("posts", "uid", "tid='".intval($mybb->input['tid'])."' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
  24. $post = $db->fetch_array($query);
  25. $uid = $post['uid'];
  26. }
  27. elseif($mybb->input['fid'])
  28. {
  29. $flist = '';
  30. switch($db->type)
  31. {
  32. case "pgsql":
  33. case "sqlite":
  34. $query = $db->simple_select("forums", "fid", "INSTR(','||parentlist||',',',".intval($mybb->input['fid']).",') > 0");
  35. break;
  36. default:
  37. $query = $db->simple_select("forums", "fid", "INSTR(CONCAT(',',parentlist,','),',".intval($mybb->input['fid']).",') > 0");
  38. }
  39.  
  40. while($forum = $db->fetch_array($query))
  41. {
  42. if($forum['fid'] == $mybb->input['fid'])
  43. {
  44. $theforum = $forum;
  45. }
  46. $flist .= ",".$forum['fid'];
  47. }
  48. $query = $db->simple_select("threads", "tid", "fid IN (0$flist) AND visible = 1", array('order_by' => 'lastpost', 'order_dir' => 'DESC', 'limit' => '1'));
  49. $thread = $db->fetch_array($query);
  50. $tid = $thread['tid'];
  51. $query = $db->simple_select("posts", "uid", "tid='$tid' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
  52. $post = $db->fetch_array($query);
  53. $uid = $post['uid'];
  54. }
  55. }
  56. else
  57. {
  58. if($mybb->input['uid'])
  59. {
  60. $uid = intval($mybb->input['uid']);
  61. }
  62. else
  63. {
  64. $uid = $mybb->user['uid'];
  65. }
  66. }
  67.  
  68. if($mybb->user['uid'] != $uid)
  69. {
  70. $memprofile = get_user($uid);
  71. }
  72. else
  73. {
  74. $memprofile = $mybb->user;
  75. }
  76.  
  77. $lang->profile = $lang->sprintf($lang->profile, $memprofile['username']);
  78. $nemakorisnika = 'ID korisnika koji ste unijeli je neispravan ili ne postoji u na&#353;oj bazi.';
  79. if(!$memprofile['uid'])
  80. {
  81. error($nemakorisnika);
  82. }
  83. if(!$memprofile['displaygroup'])
  84. {
  85. $memprofile['displaygroup'] = $memprofile['usergroup'];
  86. }
  87. $displaygroup = usergroup_displaygroup($memprofile['displaygroup']);
  88. unset($usertitle);
  89. if(trim($memprofile['usertitle']) != '')
  90. {
  91. // User has custom user title
  92. $usertitle = $memprofile['usertitle'];
  93. }
  94. elseif(trim($displaygroup['usertitle']) != '')
  95. {
  96. // User has group title
  97. $usertitle = $displaygroup['usertitle'];
  98. }
  99. else
  100. {
  101. // No usergroup title so get a default one
  102. $usertitles = $cache->read('usertitles');
  103.  
  104. if(is_array($usertitles))
  105. {
  106. foreach($usertitles as $title)
  107. {
  108. if($memprofile['postnum'] >= $title['posts'])
  109. {
  110. $usertitle = $title['title'];
  111. }
  112. }
  113. }
  114. }
  115. $name = $memprofile['username'];
  116. $postcount = $memprofile['postnum'];
  117. $timeonline = nice_time($memprofile['timeonline']);
  118. $reputation = $memprofile['reputation'];
  119. $memlastvisitdate = my_date($mybb->settings['dateformat'], $memprofile['lastactive']);
  120. $memlastvisittime = my_date($mybb->settings['timeformat'], $memprofile['lastactive']);
  121.  
  122. $my_img = imagecreatefrompng('sigbg.png');
  123. $avatar = $memprofile['avatar'];
  124. $avput = imagecreatefrompng($avatar);
  125. $background = imagecolorallocate( $my_img, 0, 0, 0 );
  126. $text_colour = imagecolorallocate( $my_img, 255, 255, 255 );
  127. imagestring( $my_img, 2, 25, 25, $name,
  128. $text_colour );
  129. imagestring( $my_img, 2, 25, 38, $usertitle,
  130. $text_colour );
  131. imagestring( $my_img, 2, 25, 51, $postcount,
  132. $text_colour );
  133. imagestring( $my_img, 2, 25, 64, $reputation,
  134. $text_colour );
  135. imagestring( $my_img, 2, 25, 77, $timeonline,
  136. $text_colour );
  137. imagestring( $my_img, 2, 25, 90,"$memlastvisitdate, $memlastvisittime",
  138. $text_colour );
  139. imagecopy($my_img, $avput, 260, 35, 0, 0, 80, 80);
  140. header( "Content-type: image/png" );
  141. imagepng( $my_img );
  142. imagecolordeallocate( $line_color );
  143. imagecolordeallocate( $text_color );
  144. imagecolordeallocate( $background );
  145. imagedestroy( $my_img );
  146. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement