1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
<?php
//////////////////////////////////////////////
/* Author: Janota */
//////////////////////////////////////////////
/* Plugin: Default Signature Size */
//////////////////////////////////////////////
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
////////////////////////////////////////////////////////////////////// Functions ///////////////////////////////////////////////////////////////////////
function default_sigsize_info()
{
return array(
"name" => "Default Signature Size",
"description" => "<div style=\"margin-top: 5px;\"><img src=\"/images/plugin.ico\" style=\"margin-right: 8px;\" align=\"left\">Allows admins to set the a default size for signatures</div>",
"website" => "http://www.mybbextras.com",
"author" => "Janota",
"authorsite" => "http://www.mybbextras.com",
"version" => "1.0",
"compatibility" => "16*"
);
}
function default_sigsize_activate()
{
global $db, $mybb;
$default_sigsize_group = array(
"gid" => "NULL",
"name" => "default_sigsize",
"title" => "Default Signature Size",
"description" => "Settings",
"disporder" => "1",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $default_sigsize_group);
$gid = $db->insert_id();
$default_sigsize_setting_1 = array(
"sid" => "NULL",
"name" => "default_sigsize_1",
"title" => "Default Signature Height",
"description" => "Set you default height here (Default is 150)",
"optionscode" => "text",
"value" => '150',
"disporder" => '2',
"gid" => intval($gid),
);
$gid = $db->insert_id();
$default_sigsize_setting_2 = array(
"sid" => "NULL",
"name" => "default_sigsize_2",
"title" => "Default Signature Width",
"description" => "Set you default width here (Default is 500)",
"optionscode" => "text",
"value" => '500',
"disporder" => '2',
"gid" => intval($gid),
);
$db->insert_query("settings", $default_sigsize_setting_1);
$db->insert_query("settings", $default_sigsize_setting_2);
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", "#".preg_quote('{$post[\'signature\']}')."#i",'<style type="text/css">
.signature img {
max-height: {$mybb->settings[\'default_sigsize_1\']}px;
max-width: {$mybb->settings[\'default_sigsize_2\']}px;
}
</style>
<div class="signature">
{$post[\'signature\']}
</div>');
find_replace_templatesets("postbit_classic", "#".preg_quote('{$post[\'signature\']}')."#i",'<style type="text/css">
.signature img {
max-height: {$mybb->settings[\'default_sigsize_1\']}px;
max-width: {$mybb->settings[\'default_sigsize_2\']}px;
}
</style>
<div class="signature">
{$post[\'signature\']}
</div>');
// Rebuilding settings
rebuild_settings();
}
function default_sigsize_deactivate()
{
global $db, $mybb;
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='default_sigsize'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='default_sigsize_1'");
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='default_sigsize_2'");
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", "#".preg_quote('<style type="text/css">
.signature img {
max-height: {$mybb->settings[\'default_sigsize_1\']}px;
max-width: {$mybb->settings[\'default_sigsize_2\']}px;
}
</style>
<div class="signature">
{$post[\'signature\']}
</div>')."#i", '{$post[\'signature\']}', 0);
find_replace_templatesets("postbit_classic", "#".preg_quote('<style type="text/css">
.signature img {
max-height: {$mybb->settings[\'default_sigsize_1\']}px;
max-width: {$mybb->settings[\'default_sigsize_2\']}px;
}
</style>
<div class="signature">
{$post[\'signature\']}
</div>')."#i", '{$post[\'signature\']}', 0);
// Rebuilding settings
rebuild_settings();
}
?>
|