public function deactivate() { require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; $templates = array("myprofile_buddylist", "myprofile_buddylist_buddy_count", "myprofile_buddylist_buddy", "myprofile_buddylist_row", "myprofile_buddylist_spacer"); MyProfileUtils::delete_templates($templates); find_replace_templatesets("member_profile", "#" . preg_quote('{$myprofile_buddylist}') . "#i", '', 0); }
function automedia_reapply_template_edits() { require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("usercp_nav_misc", "#" . preg_quote('</a></td></tr><tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">{$lang->av_ucp_menu}') . "#s", '', '', false); find_replace_templatesets("usercp_nav_misc", "#" . preg_quote('<tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">AutoMedia</a></td></tr>') . "#s", '', '', false); find_replace_templatesets("usercp_nav_misc", "#" . preg_quote('{$lang->ucp_nav_view_profile}') . "#i", '{$lang->ucp_nav_view_profile}</a></td></tr><tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">{$lang->av_ucp_menu}'); }
function mytwconnect_uninstall() { global $db, $PL, $cache, $lang; if (!$lang->mytwconnect) { $lang->load('mytwconnect'); } if (!file_exists(PLUGINLIBRARY)) { flash_message($lang->mytwconnect_pluginlibrary_missing, "error"); admin_redirect("index.php?module=config-plugins"); } $PL or (require_once PLUGINLIBRARY); // Drop settings $PL->settings_delete('mytwconnect'); // Delete our columns $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP `twavatar`, DROP `twbio`, DROP `twlocation`, DROP `mytw_uid`"); // Delete the plugin from cache $info = mytwconnect_info(); $shadePlugins = $cache->read('shade_plugins'); unset($shadePlugins[$info['name']]); $cache->update('shade_plugins', $shadePlugins); $PL->templates_delete('mytwconnect'); // Try to update templates require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('— <a href="{$mybb->settings[\'bburl\']}/mytwconnect.php?action=login">{$lang->mytwconnect_login}</a>') . '#i', ''); }
private function update() { global $db, $mybb, $cache, $lang; $new_settings = $drop_settings = array(); // Get the gid $query = $db->simple_select("settinggroups", "gid", "name='mytwconnect'"); $gid = (int) $db->fetch_field($query, "gid"); // 1.0.2 if (version_compare($this->old_version, '1.0.1', "<")) { require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('mytwconnect_usercp_settings', '#' . preg_quote('<input type="submit" value="{$lang->mytwconnect_settings_save}" />') . '#i', '<input type="submit" class=\\"button\\" value="{$lang->mytwconnect_settings_save}" />{$unlink}'); } // 2.0 if (version_compare($this->old_version, '2.0', "<")) { $new_settings[] = array("name" => "mytwconnect_twavatar", "title" => $db->escape_string($lang->setting_mytwconnect_twavatar), "description" => $db->escape_string($lang->setting_mytwconnect_twavatar_desc), "optionscode" => "yesno", "value" => 1, "disporder" => 30, "gid" => $gid); $new_settings[] = array("name" => "mytwconnect_tweet", "title" => $db->escape_string($lang->setting_mytwconnect_tweet), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_desc), "optionscode" => "yesno", "value" => 0, "disporder" => 31, "gid" => $gid); $new_settings[] = array("name" => "mytwconnect_tweet_message", "title" => $db->escape_string($lang->setting_mytwconnect_tweet_message), "description" => $db->escape_string($lang->setting_mytwconnect_tweet_message_desc), "optionscode" => "textarea", "value" => $lang->mytwconnect_default_tweet, "disporder" => 32, "gid" => $gid); // Let's at least try to change that, anyway, 2.0 has backward compatibility so it doesn't matter if this fails require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('twlogin') . '#i', 'login'); } if ($new_settings) { $db->insert_query_multiple('settings', $new_settings); } if ($drop_settings) { $db->delete_query('settings', "name IN ('mytwconnect_" . implode("','mytwconnect_", $drop_settings) . "')"); } rebuild_settings(); // Update the current version number and redirect $this->plugins[$this->info['name']] = array('title' => $this->info['name'], 'version' => $this->version); $cache->update('shade_plugins', $this->plugins); flash_message($lang->sprintf($lang->mytwconnect_success_updated, $this->old_version, $this->version), "success"); admin_redirect($_SERVER['HTTP_REFERER']); }
function icon_in_showthread_deactivate() { require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('showthread', '#\\s?' . preg_quote('<div style="display: inline-block; vertical-align: middle; padding: 0 3px;">{$thread_icon}</div>') . '#i', '', 0); find_replace_templatesets('printthread', '#\\s?' . preg_quote('<div style="display: inline-block; vertical-align: middle; padding: 0 3px;">{$thread_icon}</div>') . '#i', '', 0); find_replace_templatesets('newreply', '#\\s?' . preg_quote('<div style="display: inline-block; vertical-align: middle; padding: 0 3px;">{$thread_icon}</div>') . '#i', '', 0); }
function tags_activate() { global $mybb, $db; require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; // add settings $query = $db->simple_select('settinggroups', 'gid', "name='tags'"); $gid = $db->fetch_field($query, 'gid'); $i = 0; $settings = array(array("name" => "tags_enabled", "title" => "Enable Plugin", "description" => $db->escape_string('Set to "on" if you want Enable this plugin.'), "optionscode" => "onoff", "value" => tags_setting_value("tags_enabled", 1), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_droptable", "title" => $db->escape_string('Drop table?'), "description" => $db->escape_string('Do you want the "tags" table droped when you uninstall this plugin?'), "optionscode" => "yesno", "value" => tags_setting_value("tags_droptable", 1), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_seo", "title" => "SEO Friendly URL", "description" => $db->escape_string('Do you want to use SEO URLs (ex: tag-***.html) for tags?<br /> You must add these codes to ".htaccess" file before set it to "On": <pre style="background: #f7f7f7;border: 1px solid #ccc;padding: 6px;border-radius: 3px;direction: ltr;text-align: left;font-size: 12px;"> RewriteEngine <strong>on</strong> RewriteRule <strong>^tag-(.*?)\\.html$ tag.php?name=$1</strong> <em>[L,QSA]</em> RewriteRule <strong>^tag\\.html$ tag.php</strong> <em>[L,QSA]</em> </pre>'), "optionscode" => "yesno", "value" => tags_setting_value("tags_seo", 0), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_forceseo", "title" => "Force users to use seo URLs?", "description" => $db->escape_string('Do you want to force users to use SEO URLs (ex: tag-***.html) for tags?'), "optionscode" => "yesno", "value" => tags_setting_value("tags_forceseo", 0), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_urlscheme", "title" => "Tags URL scheme", "description" => $db->escape_string('Enter the Tag URL scheme. By default this is tag-{name}.html. Please note that if you change this, you will also need to add a new rewrite rule in your .htaccess file.'), "optionscode" => "text", "value" => tags_setting_value("tags_urlscheme", 'tag-{name}.html'), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_per_page", "title" => "Tags per page", "description" => $db->escape_string('How many tags shown in "Tags" page?'), "optionscode" => "text", "value" => tags_setting_value("tags_per_page", 10), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_limit", "title" => $db->escape_string('Limit Tags in "Index Page" and "Forum Display Page"'), "description" => $db->escape_string('How many tags shown in "Index Page" and "Forum Display Page" ?'), "optionscode" => "text", "value" => tags_setting_value("tags_limit", 50), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_index", "title" => $db->escape_string('Show tags in Index Page?'), "description" => $db->escape_string('Do you want tags shown in Index Page?'), "optionscode" => "yesno", "value" => tags_setting_value("tags_index", 1), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_forumdisplay", "title" => $db->escape_string('Show tags in "Forum Display" Page?'), "description" => $db->escape_string('Do you want tags shown in "Forum Display" Page?'), "optionscode" => "yesno", "value" => tags_setting_value("tags_forumdisplay", 1), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_max_thread", "title" => $db->escape_string('Maximun tags for a thread'), "description" => $db->escape_string('Please enter the maximum number of tags for threads. Set it to 0 for unlimited.'), "optionscode" => "text", "value" => tags_setting_value("tags_max_thread", 20), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_groups", "title" => $db->escape_string('Tags Moderators'), "description" => $db->escape_string('Please select the groups can edit "tags". please note who can edit tags, that can edit thread.'), "optionscode" => "groupselect", "value" => tags_setting_value("tags_groups", -1), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_bad", "title" => $db->escape_string('Bad Tags'), "description" => $db->escape_string('Please enter the bad tags, this tags don\'t shown in tags list. enter each tags in new line'), "optionscode" => "textarea", "value" => tags_setting_value("tags_bad", ''), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_maxchars", "title" => $db->escape_string('Maximum tag length'), "description" => $db->escape_string('Please enter the maximum length that a tag can have'), "optionscode" => "text", "value" => tags_setting_value("tags_maxchars", 20), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_minchars", "title" => $db->escape_string('Minimum tag length'), "description" => $db->escape_string('Please enter the minimum length that a tag can have'), "optionscode" => "text", "value" => tags_setting_value("tags_minchars", 0), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_charreplace", "title" => $db->escape_string('Character Translation'), "description" => $db->escape_string('If you want translate some characters to other characters, you can use this setting.<br /> For example if you want replace "a" to "b" and "c" to "d" use this code:<br /> <pre style="background: #f7f7f7;border: 1px solid #ccc;padding: 6px;border-radius: 3px;direction: ltr;text-align: left;font-size: 12px;"> a=>b c=>d </pre>'), "optionscode" => "textarea", "value" => tags_setting_value("tags_charreplace", ''), "disporder" => ++$i, "gid" => $gid), array("name" => "tags_disallowedforums", "title" => $db->escape_string('Disallowed forums'), "description" => $db->escape_string('Please select the forums you want "Tags" don\'t work on these.'), "optionscode" => "forumselect", "value" => tags_setting_value("tags_disallowedforums", 0), "disporder" => ++$i, "gid" => $gid)); $db->delete_query('settings', "gid = '{$gid}'"); $db->insert_query_multiple("settings", $settings); rebuild_settings(); find_replace_templatesets('newthread', '#' . preg_quote('{$posticons}') . '#', '{$tags}{$posticons}'); find_replace_templatesets('editpost', '#' . preg_quote('{$posticons}') . '#', '{$tags}{$posticons}'); find_replace_templatesets('showthread', '#' . preg_quote('{$ratethread}') . '#', '{$ratethread}{$tags}'); find_replace_templatesets('showthread', '#' . preg_quote('{$headerinclude}') . '#', '<meta name="keywords" content="{$thread[\'tags_meta\']}" />{$headerinclude}'); find_replace_templatesets('index', '#' . preg_quote('{$forums}') . '#', '{$forums}{$tags}'); find_replace_templatesets('forumdisplay', '#' . preg_quote('{$threadslist}') . '#', '{$threadslist}{$tags}'); }
function zmultigroup_deactivate() { global $db; require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; $string = '{$post[\'zmultigroup\']}'; find_replace_templatesets("postbit", "#" . preg_quote($string) . "#i", ''); find_replace_templatesets("postbit_classic", "#" . preg_quote($string) . "#i", ''); }
function youtubeminer_deactivate() { global $db, $header; require MYBB_ROOT . "inc/adminfunctions_templates.php"; require_once MYBB_ROOT . "admin/inc/functions_themes.php"; find_replace_templatesets("headerinclude", "#" . preg_quote($header) . '#', '', 0); $db->delete_query("templates", "title='youtubeminer'"); }
function cloudflare_deactivate() { global $db, $mybb; include MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets('footer', '#<!-- End powered by --><cfb>#', '<!-- End powered by -->'); $db->delete_query("templates", "title = 'cloudflare_postbit_spam'"); rebuild_settings(); }
public function deactivate() { global $db; require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; $templates = array("myprofile_member_headerinclude"); MyProfileUtils::delete_templates($templates); find_replace_templatesets("headerinclude", "#" . preg_quote('{$myprofile_headerinclude}') . "#i", '', 0); }
function tags_deactivate() { require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('newthread', '#' . preg_quote('{$tags}') . '#', ''); find_replace_templatesets('editpost', '#' . preg_quote('{$tags}') . '#', ''); find_replace_templatesets('showthread', '#' . preg_quote('{$tags}') . '#', ''); find_replace_templatesets('showthread', '#' . preg_quote('<meta name="keywords" content="{$thread[\'tags_meta\']}" />') . '#', ''); find_replace_templatesets('index', '#' . preg_quote('{$tags}') . '#', ''); find_replace_templatesets('forumdisplay', '#' . preg_quote('{$tags}') . '#', ''); }
function cloudflare_deactivate() { global $db, $mybb; include MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("postbit", "#" . preg_quote('{$post[\'cloudflare_spam\']}') . "#i", '', 0); find_replace_templatesets("postbit_classic", "#" . preg_quote('{$post[\'cloudflare_spam\']}') . "#i", '', 0); find_replace_templatesets('footer', '#<!-- End powered by --><cfb>#', '<!-- End powered by -->'); $db->delete_query("templates", "title = 'cloudflare_postbit_spam'"); change_admin_permission("cloudflare", "", -1); }
function portal_news_preview_deactivate() { global $db, $mybb; require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('portal_announcement', '#' . preg_quote('<br/><br/>{$announcement[\'link\']}') . '#', '', 0); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='isenabled'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='whichway'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='cutstring'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='characters'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='readmoremessage'"); rebuild_settings(); }
private function update() { global $db, $mybb, $cache, $lang; $new_settings = $drop_settings = array(); // Get the gid $query = $db->simple_select("settinggroups", "gid", "name='myfbconnect'"); $gid = (int) $db->fetch_field($query, "gid"); // 1.0.1 if (version_compare($this->old_version, '1.0.1', "<")) { require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('myfbconnect_register', '#' . preg_quote('<td valign="top">') . '#i', '<td valign="top">{$errors}'); } // 1.0.3 if (version_compare($this->old_version, '1.0.3', "<")) { $new_settings[] = array("name" => "myfbconnect_verifiedonly", "title" => $db->escape_string($lang->setting_myfbconnect_verifiedonly), "description" => $db->escape_string($lang->setting_myfbconnect_verifiedonly_desc), "optionscode" => "yesno", "value" => 0, "disporder" => 7, "gid" => $gid); } // 1.1 if (version_compare($this->old_version, '1.1', "<")) { $new_settings[] = array("name" => "myfbconnect_fbavatar", "title" => $db->escape_string($lang->setting_myfbconnect_fbavatar), "description" => $db->escape_string($lang->setting_myfbconnect_fbavatar_desc), "optionscode" => "yesno", "value" => 1, "disporder" => 12, "gid" => $gid); require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('myfbconnect_usercp_settings', '#' . preg_quote('<input type="submit" value="{$lang->myfbconnect_settings_save}" />') . '#i', '<input type="submit" class=\\"button\\" value="{$lang->myfbconnect_settings_save}" />{$unlink}'); } // 2.0 if (version_compare($this->old_version, '2.0', "<")) { $drop_settings[] = "requestpublishingperms"; $new_settings[] = array("name" => "myfbconnect_postonwall", "title" => $db->escape_string($lang->setting_myfbconnect_postonwall), "description" => $db->escape_string($lang->setting_myfbconnect_postonwall_desc), "optionscode" => "yesno", "value" => 0, "disporder" => 30, "gid" => $gid); $new_settings[] = array("name" => "myfbconnect_postonwall_message", "title" => $db->escape_string($lang->setting_myfbconnect_postonwall_message), "description" => $db->escape_string($lang->setting_myfbconnect_postonwall_message_desc), "optionscode" => "textarea", "value" => $lang->myfbconnect_default_postonwall_message, "disporder" => 31, "gid" => $gid); // Let's at least try to change that, anyway, 2.0 has backward compatibility so it doesn't matter if this fails require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('fblogin') . '#i', 'login'); } // 2.3 if (version_compare($this->old_version, '2.3', "<")) { // Add the report table if (!$db->table_exists('myfbconnect_reports')) { $collation = $db->build_create_table_collation(); $db->write_query("CREATE TABLE " . TABLE_PREFIX . "myfbconnect_reports(\n\t\t id INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t dateline VARCHAR(15) NOT NULL,\n\t\t code VARCHAR(10) NOT NULL,\n\t\t file TEXT,\n\t\t line INT(6) NOT NULL,\n\t\t message TEXT,\n\t\t trace TEXT\n\t\t ) ENGINE=MyISAM{$collation};"); } } if ($new_settings) { $db->insert_query_multiple('settings', $new_settings); } if ($drop_settings) { $db->delete_query('settings', "name IN ('myfbconnect_" . implode("','myfbconnect_", $drop_settings) . "')"); } rebuild_settings(); // Update the current version number and redirect $this->plugins[$this->info['name']] = array('title' => $this->info['name'], 'version' => $this->version); $cache->update('shade_plugins', $this->plugins); flash_message($lang->sprintf($lang->myfbconnect_success_updated, $this->old_version, $this->version), "success"); admin_redirect($_SERVER['HTTP_REFERER']); }
function teamonline_uninstall() { global $db; $db->delete_query('settings', "name LIKE ('teamonline\\_%')"); $db->delete_query('settinggroups', "name = 'plugin_teamonline'"); require MYBB_ROOT . '/inc/adminfunctions_templates.php'; find_replace_templatesets("index", '#' . preg_quote('{$teamonline}') . '#', ''); find_replace_templatesets("portal", '#' . preg_quote('{$teamonline}') . '#', ''); $deletetemplates = array('teamonline', 'teamonline_row', 'teamonline_no'); foreach ($deletetemplates as $title) { $db->query("DELETE FROM " . TABLE_PREFIX . "templates WHERE title='" . $title . "'"); } }
function resim_deactivate() { global $mybb, $db, $cache, $lang, $settings; require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("headerinclude", "#" . preg_quote("{\$ncode}") . "#i", "", 0); $db->query("DELETE FROM " . TABLE_PREFIX . "mycode WHERE title='Ncode1'"); $db->query("DELETE FROM " . TABLE_PREFIX . "mycode WHERE title='Ncode2'"); $cache->update_mycode(); $db->query("DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE name='resim_ayarlari'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='nmode'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='ntema'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='nyuk'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='ngen'"); rebuild_settings(); }
public static function deactivate() { global $db; self::getTpl(); for ($i = 0; $i < sizeof(self::$tpl); $i++) { $db->delete_query('templates', "title = '" . self::$tpl[$i]['title'] . "'"); } require_once MYBB_ROOT . '/inc/adminfunctions_templates.php'; find_replace_templatesets('header_welcomeblock_member', '#' . preg_quote('<!-- UNREADPOSTS_LINK -->') . '#', ''); find_replace_templatesets('postbit_posturl', '#' . preg_quote('<!-- IS_UNREAD -->') . '#', ''); find_replace_templatesets('search_results_posts', '#' . preg_quote('<!-- UNREADPOSTS_MARKALL -->') . '#', ''); find_replace_templatesets('search_results_threads', '#' . preg_quote('<!-- UNREADPOSTS_MARKALL -->') . '#', ''); find_replace_templatesets('search_results_threads_thread', '#' . preg_quote('{$thread[\'startdate\']}') . '#', ''); find_replace_templatesets('search_results_threads_thread', '#' . preg_quote('{$thread[\'unreadPosts_thread\']}') . '#', ''); find_replace_templatesets('headerinclude', '#' . preg_quote('<!-- UNREADPOSTS_CSS -->') . '#', ''); find_replace_templatesets("footer", '#' . preg_quote('<!-- UNREADPOSTS_JS -->') . '#', ''); }
function cookielaw_deactivate() { global $mybb, $db; require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; $db->delete_query("settinggroups", "name = 'cookielaw'"); $settings = array("cookielaw_method"); $settings = "'" . implode("','", $settings) . "'"; $db->delete_query("settings", "name IN ({$settings})"); rebuild_settings(); find_replace_templatesets("header", "#" . preg_quote('{$cookielaw}') . "#i", '', 0); if (substr($mybb->version, 0, 3) == '1.6') { find_replace_templatesets("footer", "#" . preg_quote(' | <a href="{$mybb->settings[\'bburl\']}/misc.php?action=cookielaw_info">{$lang->cookielaw_footer}</a>') . "#i", '', 0); } elseif (substr($mybb->version, 0, 3) == '1.8') { find_replace_templatesets("footer", "#" . preg_quote("\n\t\t\t\t" . '<li><a href="{$mybb->settings[\'bburl\']}/misc.php?action=cookielaw_info">{$lang->cookielaw_footer}</a></li>') . "#i", '', 0); } $db->delete_query("templates", "title IN ('cookielaw_info','cookielaw_header','cookielaw_buttons_notify','cookielaw_buttons_opt','cookielaw_button_more_info','cookielaw_header_no_cookies')"); }
`multival_limit` ' . xthreads_db_fielddef('int', null, true) . ' not null default 0, `inputformat` text not null, `inputvalidate` text not null, `hidefield` ' . xthreads_db_fielddef('int', null, false) . ' not null default 0 )'); $db->update_query('threadfields', array('inputformat' => '{VALUE}')); // hideedit -> hidefield transition $db->update_query('threadfields', array('hidefield' => XTHREADS_HIDE_THREAD)); $db->update_query('threadfields', array('hidefield' => XTHREADS_HIDE_INPUT | XTHREADS_HIDE_THREAD), 'hideedit != 0'); $db->write_query('ALTER TABLE `' . $db->table_prefix . 'threadfields` DROP COLUMN `hideedit`'); // fix email masks $db->update_query('threadfields', array('textmask' => $db->escape_string('^([^ "(),:;<>@\\[\\\\\\]]+)@([a-z0-9_.\\-]+)$')), 'textmask="' . $db->escape_string('^([a-z0-9_.\\-]+)@([a-z0-9_.\\-]+)$') . '"'); // we never used this, so may as well get rid of it $db->write_query('ALTER TABLE `' . $db->table_prefix . 'forums` DROP COLUMN `xthreads_wol_xtattachment`'); if (XTHREADS_MODIFY_TEMPLATES) { find_replace_templatesets('showthread', '#\\{\\$classic_header\\}#', '{$threadfields_display}{$classic_header}'); } require_once MYBB_ROOT . 'inc/xthreads/xt_install.php'; // migrate templates - surely no-one else is ending their template names with "threadfields_inputrow", right? $db->write_query('UPDATE `' . $db->table_prefix . 'templates` SET title=CONCAT(SUBSTRING(title, 0, -21), "post_threadfields_inputrow") WHERE title LIKE "%threadfields_inputrow"'); // global -> master template conversion $newtpl = xthreads_new_templates(); // WARNING: if templates change, this could get funky function xtu_normalize_template($s) { return str_replace(' />', '/>', strtr(preg_replace('~\\s+~', ' ', trim($s)), array('> ' => '>', ' <' => '<'))); } $query = $db->simple_select('templates', 'title,template', 'title IN ("editpost_first","forumdisplay_group_sep","forumdisplay_thread_null","showthread_noreplies","forumdisplay_searchforum_inline","post_threadfields_inputrow") AND sid=-1'); $rmtpl = array(); while ($tpl = $db->fetch_array($query)) { if (xtu_normalize_template($tpl['template']) == xtu_normalize_template($newtpl[$tpl['title']])) {
function newpoints_plugin_undo_template_edits() { // undo edits require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets("postbit_classic", '#' . preg_quote('{$post[\'newpoints_postbit\']}') . '#', '', 0); find_replace_templatesets("postbit", '#' . preg_quote('{$post[\'newpoints_postbit\']}') . '#', '', 0); find_replace_templatesets("member_profile", '#' . preg_quote('{$newpoints_profile}') . '#', '', 0); }
function announcement_deactivate() { require MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets("index", "#" . preg_quote('{$announcement}') . "#i", "", 0); find_replace_templatesets("forumdisplay", "#" . preg_quote('{$fdannouncement}') . "#i", "", 0); find_replace_templatesets("showthread", "#" . preg_quote('{$announcement}') . "#i", "", 0); find_replace_templatesets("header", "#" . preg_quote('{$announcement}') . "#i", "", 0); find_replace_templatesets('headerinclude', "#" . preg_quote('function dismissANN(id) { if(!$("Ann_"+id)) { return false; } if(use_xmlhttprequest != 1) { return true; } new Ajax.Request("index.php?action=ann_dismiss", {method: "post", postBody: "ajax=1&my_post_key="+my_post_key+"&id="+id}); Element.remove("Ann_"+id); return false; }') . "#i", ''); }
function xthreads_activate() { global $db, $cache, $lang, $plugins; $plugins->run_hooks('xthreads_activate_start'); $db->insert_query('tasks', array('title' => $db->escape_string($lang->xthreads_orphancleanup_name), 'description' => $db->escape_string($lang->xthreads_orphancleanup_desc), 'file' => 'xtaorphan_cleanup', 'minute' => '35', 'hour' => '10', 'day' => '*', 'month' => '*', 'weekday' => '*', 'nextrun' => TIME_NOW + 86400 * 3, 'lastrun' => 0, 'enabled' => 1, 'logging' => 1, 'locked' => 0)); $cache->update_tasks(); if (XTHREADS_MODIFY_TEMPLATES) { // prevent doubling of template edits xthreads_undo_template_edits(); // following original in the _install() function, as these variables aren't evaluated when deactivated // but putting them here has the advantage of allowing users to redo template edits with new themes require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('editpost', '#\\{\\$posticons\\}#', '{$extra_threadfields}{$posticons}'); find_replace_templatesets('newthread', '#\\{\\$posticons\\}#', '{$extra_threadfields}{$posticons}'); find_replace_templatesets('showthread', '#\\{\\$posts\\}#', '{$first_post}{$posts}'); if ($GLOBALS['mybb']->version_code >= 1700) { find_replace_templatesets('showthread', '#\\<tr\\>\\s*\\<td id\\="posts_container"\\>#', '{$threadfields_display}$0'); } else { find_replace_templatesets('showthread', '#\\{\\$classic_header\\}#', '{$threadfields_display}{$classic_header}'); } find_replace_templatesets('forumdisplay_threadlist', '#\\{\\$threads\\}#', '{$threads}{$nullthreads}'); find_replace_templatesets('forumdisplay_threadlist', '#\\<option value="subject" \\{\\$sortsel\\[\'subject\'\\]\\}\\>\\{\\$lang-\\>sort_by_subject\\}\\</option\\>#', '{$sort_by_prefix}<option value="subject" {$sortsel[\'subject\']}>{$lang->sort_by_subject}</option>'); find_replace_templatesets('forumdisplay_threadlist', '#\\<option value="views" \\{\\$sortsel\\[\'views\'\\]\\}\\>\\{\\$lang-\\>sort_by_views\\}\\</option\\>#', '<option value="views" {$sortsel[\'views\']}>{$lang->sort_by_views}</option>' . "\n" . XTHREADS_INSTALL_TPLADD_EXTRASORT); find_replace_templatesets('forumdisplay_threadlist_sortrating', '#$#', '<option value="numratings" {$sortsel[\'numratings\']}>{$lang->sort_by_numratings}</option>'); } $plugins->run_hooks('xthreads_activate_end'); }
function firstpreview_deactivate() { require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; // Remove old edits if we are upgrading find_replace_templatesets("forumdisplay_thread", "#" . preg_quote('<div id="modal_firstpost"></div>') . "#s", '', '', false); find_replace_templatesets("search_results_threads_thread", "#" . preg_quote('<div id="modal_firstpost"></div>') . "#s", '', '', false); find_replace_templatesets("private_messagebit", "#" . preg_quote('<a class="pmprev" id="{$message') . "#s", '<a class="pmprev" id="pmid_{$message', '', false); find_replace_templatesets("forumdisplay_thread", "#" . preg_quote('<div class="modal_firstpost"></div>') . "#s", '', '', false); find_replace_templatesets("search_results_threads_thread", "#" . preg_quote('<div class="modal_firstpost"></div>') . "#s", '', '', false); find_replace_templatesets("forumbit_depth2_forum", "#" . preg_quote('<div class="modal_firstpost"></div>') . "#s", '', '', false); // Undo template edits find_replace_templatesets("forumdisplay_thread", "#" . preg_quote(' class="last_preview" id="ltid_{$inline_edit_tid}"') . "#s", '', '', false); find_replace_templatesets("search_results_threads_thread", "#" . preg_quote(' class="last_preview" id="ltid_{$inline_edit_tid}"') . "#s", '', '', false); find_replace_templatesets("forumbit_depth2_forum_lastpost", "#" . preg_quote(' class="last_preview" id="ltid_{$lastpost_data[\'lastposttid\']}"') . "#s", '', '', false); find_replace_templatesets("private_messagebit", "#" . preg_quote('<div class="modal_firstpost"></div><a class="pmprev" id="pmid_{$message[\'pmid\']}"') . "#s", '<a', '', false); }
function ougc_showinportal_deactivate($rebuilt = true) { ougc_showinportal_pl_check(); // Revert template edits require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; find_replace_templatesets('newreply_modoptions', '#' . preg_quote('<!--OUGC_SHOWINPORTAL-->') . '#', '', 0); find_replace_templatesets('showthread_quickreply', '#' . preg_quote('<!--OUGC_SHOWINPORTAL-->') . '#', '', 0); find_replace_templatesets('forumdisplay_inlinemoderation', '#' . preg_quote('<!--OUGC_SHOWINPORTAL-->') . '#', '', 0); find_replace_templatesets('showthread_moderationoptions', '#' . preg_quote('<!--OUGC_SHOWINPORTAL-->') . '#', '', 0); }
public function deactivate() { require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; MyProfileUtils::delete_templates(array("myprofile_permissions")); find_replace_templatesets("usercp_profile", "#" . preg_quote('{$myprofile_permissions}') . "#i", '', 0); }
function prostats_deactivate() { global $db; require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("index", '#{\\$ps_header_index}(\\r?)\\n#', "", 0); find_replace_templatesets("index", '#{\\$ps_footer_index}(\\r?)\\n#', "", 0); find_replace_templatesets("portal", '#{\\$ps_header_portal}(\\r?)\\n#', "", 0); find_replace_templatesets("portal", '#{\\$ps_footer_portal}(\\r?)\\n#', "", 0); $db->query("DELETE FROM " . TABLE_PREFIX . "templates WHERE title='prostats'"); $db->query("DELETE FROM " . TABLE_PREFIX . "templates WHERE title LIKE 'prostats_%'"); }
function newpoints_shop_deactivate() { global $db, $mybb; newpoints_remove_templates("'newpoints_shop','newpoints_shop_category','newpoints_shop_item','newpoints_shop_no_items','newpoints_shop_no_cats','newpoints_shop_myitems','newpoints_shop_myitems_item','newpoints_shop_myitems_no_items','newpoints_shop_do_action','newpoints_shop_stats','newpoints_shop_stats_purchase','newpoints_shop_stats_nopurchase','newpoints_shop_myitems_item_empty','newpoints_shop_profile','newpoints_shop_view_item','newpoints_shop_postbit'"); // edit templates newpoints_find_replace_templatesets('newpoints_statistics', '#' . preg_quote('{$newpoints_shop_lastpurchases}') . '#', ''); //newpoints_find_replace_templatesets('newpoints_profile', '#'.preg_quote('{$newpoints_shop_profile}').'#', ''); newpoints_find_replace_templatesets('newpoints_postbit', '#' . preg_quote('{$post[\'newpoints_shop_items\']}') . '#', ''); require_once MYBB_ROOT . "inc/adminfunctions_templates.php"; find_replace_templatesets("member_profile", '#' . preg_quote('{$newpoints_shop_profile}') . '#', '', 0); find_replace_templatesets("member_profile_adminoptions", '#' . preg_quote('<li><a href="{$mybb->settings[\'bburl\']}/{$config[\'admin_dir\']}/index.php?module=newpoints-shop&action=inventory&uid={$uid}">{$lang->newpoints_shop_edit_inventory}</a></li>') . '#', '', 0); }
function automedia_deactivate() { global $db, $mybb, $cache; change_admin_permission('tools', 'automedia', -1); automedia_cache(true); /** * * Restore templates * **/ require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("usercp_nav_misc", "#" . preg_quote('</a></td></tr><tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">{$lang->av_ucp_menu}') . "#s", '', '', false); find_replace_templatesets("usercp_nav_misc", "#" . preg_quote('<tr><td class="trow1 smalltext"><a href="usercp.php?action=userautomedia" class="usercp_nav_item usercp_nav_options">AutoMedia</a></td></tr>') . "#s", '', '', false); // Delete master templates for upgrade $db->delete_query("templategroups", "prefix = 'automedia'"); $db->delete_query("templates", "title LIKE 'automedia_%' AND sid='-2'"); }
function akismet_deactivate() { global $db, $mybb; include MYBB_ROOT . "/inc/adminfunctions_templates.php"; find_replace_templatesets("postbit", "#" . preg_quote('{$post[\'button_spam\']}') . "#i", '', 0); find_replace_templatesets("postbit_classic", "#" . preg_quote('{$post[\'button_spam\']}') . "#i", '', 0); $db->delete_query("templates", "title = 'akismet_postbit_spam'"); change_admin_permission('forum', 'akismet', -1); }
function bam_deactivate() { global $db; require MYBB_ROOT . '/inc/adminfunctions_templates.php'; find_replace_templatesets('header', '#\\<!--\\sBAM\\s--\\>(.+)\\<!--\\s/BAM\\s--\\>#is', '', 0); }