Guest User

Postbit

a guest
Nov 16th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. <?php
  2. /**
  3. * Force Postbit Layout
  4. * Copyright 2011 Aries-Belgium
  5. *
  6. * $Id$
  7. */
  8.  
  9. // Disallow direct access to this file for security reasons
  10. if(!defined("IN_MYBB"))
  11. {
  12. die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  13. }
  14.  
  15. $plugins->add_hook('showthread_start', 'forcepostbit_force');
  16. $plugins->add_hook('postbit', 'forcepostbit_force',1000);
  17.  
  18. /**
  19. * Info function for MyBB plugin system
  20. */
  21. function forcepostbit_info()
  22. {
  23. $donate_button =
  24. '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RQNL345SN45DS" style="float:right;margin-top:-8px;padding:4px;" target="_blank"><img src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_SM.gif" /></a>';
  25.  
  26. return array(
  27. "name" => "Force Postbit Layout",
  28. "description" => $donate_button."Forces all your users to use the default postbit style.",
  29. "website" => "",
  30. "author" => "Aries-Belgium",
  31. "authorsite" => "http://community.mybb.com/user-3840.html",
  32. "version" => "1.0",
  33. "guid" => "058dbc133fe972b9848e02d6386aa3a0",
  34. "compatibility" => "16*,18*"
  35. );
  36. }
  37.  
  38. /**
  39. * The activation function for the MyBB plugin system
  40. */
  41. function forcepostbit_activate()
  42. {
  43. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  44. find_replace_templatesets("usercp_options", "#".preg_quote("id=\"classicpostbit\" value=\"1\" {\$classicpostbitcheck}")."#s", "id=\"classicpostbit\" disabled=\"disabled\"");
  45. }
  46.  
  47. /**
  48. * The deactivation function for the plugin system
  49. */
  50. function forcepostbit_deactivate()
  51. {
  52. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  53. find_replace_templatesets("usercp_options", "#".preg_quote("id=\"classicpostbit\" disabled=\"disabled\"")."#s", "id=\"classicpostbit\" value=\"1\" {\$classicpostbitcheck}", 0);
  54. }
  55.  
  56. /**
  57. * Implementation of the showthread_start hook
  58. *
  59. * Force to use the default layout style
  60. */
  61. function forcepostbit_force($post=null)
  62. {
  63. global $mybb, $db;
  64.  
  65. include MYBB_ROOT."inc/settings.php";
  66. $mybb->settings['postlayout'] = $settings['postlayout'];
  67. $mybb->user['classicpostbit'] = ($settings['postlayout'] == 'classic') ? 1 : 0;
  68. }<?php
  69. /**
  70. * Force Postbit Layout
  71. * Copyright 2011 Aries-Belgium
  72. *
  73. * $Id$
  74. */
  75.  
  76. // Disallow direct access to this file for security reasons
  77. if(!defined("IN_MYBB"))
  78. {
  79. die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
  80. }
  81.  
  82. $plugins->add_hook('showthread_start', 'forcepostbit_force');
  83. $plugins->add_hook('postbit', 'forcepostbit_force',1000);
  84.  
  85. /**
  86. * Info function for MyBB plugin system
  87. */
  88. function forcepostbit_info()
  89. {
  90. $donate_button =
  91. '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RQNL345SN45DS" style="float:right;margin-top:-8px;padding:4px;" target="_blank"><img src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_donate_SM.gif" /></a>';
  92.  
  93. return array(
  94. "name" => "Force Postbit Layout",
  95. "description" => $donate_button."Forces all your users to use the default postbit style.",
  96. "website" => "",
  97. "author" => "Aries-Belgium",
  98. "authorsite" => "http://community.mybb.com/user-3840.html",
  99. "version" => "1.0",
  100. "guid" => "058dbc133fe972b9848e02d6386aa3a0",
  101. "compatibility" => "16*,18*"
  102. );
  103. }
  104.  
  105. /**
  106. * The activation function for the MyBB plugin system
  107. */
  108. function forcepostbit_activate()
  109. {
  110. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  111. find_replace_templatesets("usercp_options", "#".preg_quote("id=\"classicpostbit\" value=\"1\" {\$classicpostbitcheck}")."#s", "id=\"classicpostbit\" disabled=\"disabled\"");
  112. }
  113.  
  114. /**
  115. * The deactivation function for the plugin system
  116. */
  117. function forcepostbit_deactivate()
  118. {
  119. include MYBB_ROOT."/inc/adminfunctions_templates.php";
  120. find_replace_templatesets("usercp_options", "#".preg_quote("id=\"classicpostbit\" disabled=\"disabled\"")."#s", "id=\"classicpostbit\" value=\"1\" {\$classicpostbitcheck}", 0);
  121. }
  122.  
  123. /**
  124. * Implementation of the showthread_start hook
  125. *
  126. * Force to use the default layout style
  127. */
  128. function forcepostbit_force($post=null)
  129. {
  130. global $mybb, $db;
  131.  
  132. include MYBB_ROOT."inc/settings.php";
  133. $mybb->settings['postlayout'] = $settings['postlayout'];
  134. $mybb->user['classicpostbit'] = ($settings['postlayout'] == 'classic') ? 1 : 0;
  135. }
Add Comment
Please, Sign In to add comment