function check_ip_with_dnsbl_deactivate() { global $db; $db->delete_query("settinggroups", "name = 'checkipwithdnsbl'"); $db->delete_query("settings", "name LIKE ('checkipwithdnsbl_%')"); rebuild_settings(); }
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 user_tagging_uninstall() { global $db; $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name IN ('user_tagging_on','user_tagging_subject','user_tagging_body')"); $db->query("DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE name='user_tagging'"); rebuild_settings(); }
/** Activate Plugin */ function rpgsuite_activate() { global $db; reverse_template_edits(); apply_template_edits(); // Add any tables for upgrading if (!$db->table_exists("otms")) { $db->write_query("CREATE TABLE " . TABLE_PREFIX . "otms (id int(11) NOT NULL AUTO_INCREMENT, name VARCHAR(500), type VARCHAR(100), value VARCHAR(2000), PRIMARY KEY(id))"); } // If we have new settings, add them! $settinggroup = $db->simple_select('settinggroups', 'gid', 'name = \'rpgsuite\''); $group = $db->fetch_array($settinggroup); $settings = build_settings($group['gid']); foreach ($settings as $setting) { $settingquery = $db->simple_select('settings', 'sid', 'name = \'' . $setting['name'] . '\''); if (!$settingquery->num_rows) { $db->insert_query('settings', $setting); } } rebuild_settings(); // If we have new templates, add them, but only if they exist! // Lonely Thread Templates require_once MYBB_ROOT . "/inc/plugins/rpg_suite/templatesets/class_LonelyThreadSet.php"; $templateset = new LonelyThreadSet($db); $templateset->create(); // OTM Templates require_once MYBB_ROOT . "/inc/plugins/rpg_suite/templatesets/class_OtmSet.php"; $templateset = new OtmSet($db); $templateset->create(); }
function smash_christmas_lights_uninstall() { global $db; $db->delete_query('settings', "name IN ('scl_lights_smashable','scl_lights_size','scl_sounds_enable')"); $db->delete_query('settinggroups', "name = 'smash_christmas_lights_settings'"); rebuild_settings(); }
function PHP_files_cleaner_deactivate() { global $db; $db->delete_query('settings', "name LIKE 'PHP\\_files\\_cleaner\\_%'"); $db->delete_query('settinggroups', "name = 'PHP_files_cleaner'"); 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='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 chatcat_deactivate() { global $db; $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name IN ('chatcat_enable','chatcat_enable_api', 'chatcat_secret','chatcat_enable_login','chatcat_enable_register','chatcat_enable_primary')"); $db->query("DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE name='chatcat'"); rebuild_settings(); }
function yuieditor_uninstall() { global $db; $groupid = $db->fetch_field($db->simple_select('settinggroups', 'gid', "name='yuieditor'"), 'gid'); $db->delete_query('settings', 'gid=' . $groupid); $db->delete_query("settinggroups", "name = 'yuieditor'"); rebuild_settings(); }
function cloudflare_uninstall() { global $db; $db->query("DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE name='cloudflare'"); $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name LIKE 'cloudflare_%'"); $db->query("DELETE FROM " . TABLE_PREFIX . "datacache WHERE title='cloudflare_calls'"); rebuild_settings(); }
function reportthread_uninstall() { global $db; $db->query("DELETE FROM `" . TABLE_PREFIX . "settinggroups` WHERE `name` = 'reportthread' LIMIT 1;"); $db->query("DELETE FROM `" . TABLE_PREFIX . "settings` WHERE `name` = 'rtt_enabled' LIMIT 1;"); $db->query("DELETE FROM `" . TABLE_PREFIX . "settings` WHERE `name` = 'rtt_fid' LIMIT 1;"); rebuild_settings(); }
function purgesoftdeleted_deactivate() { global $db, $mybb; // Remove task from task manager $db->delete_query('tasks', 'file=\'purgesoftdeleted\''); // Delete Purge soft deleted task // Rebuild settings rebuild_settings(); }
function miunashoutbox_uninstall() { global $db; //Delete Settings $groupid = $db->fetch_field($db->simple_select('settinggroups', 'gid', "name='miunashoutbox'"), 'gid'); $db->delete_query('settings', 'gid=' . $groupid); $db->delete_query("settinggroups", "name = 'miunashoutbox'"); rebuild_settings(); }
function ragtek_eventcalendar_activate() { global $db; $eventcalendar_group = array("gid" => "NULL", "name" => "eventcalendar_settings", "title" => "Eventkalender Einstellungen", "description" => "Einstellungen", "disporder" => "3", "isdefault" => "no"); $db->insert_query("settinggroups", $eventcalendar_group); $gid = $db->insert_id(); $eventcalendar_setting_1 = array("sid" => "NULL", "name" => "eventcal_id", "title" => "Mit welchem Forum soll der Kalender verbunden werden", "description" => "Geben Sie hier die Foren ID ein.", "optionscode" => "text", "value" => '', "disporder" => '1', "gid" => intval($gid)); $db->insert_query("settings", $eventcalendar_setting_1); rebuild_settings(); }
function jrs_presentation_deactivate() { global $db, $message, $lang; $lang->load('jrs_presentation'); $db->delete_query('settinggroups', "name = 'Jrs- Presentation'"); $db->delete_query('settings', "name = 'jrs_presentation_active_message'"); $db->delete_query('settings', "name = 'jrs_presentation_fid'"); $db->delete_query('settings', "name = 'jrs_presentation_message'"); $message = $lang->jrs_message_deactivate; rebuild_settings(); }
public static function uninstall() { global $db; $result = $db->simple_select('settinggroups', 'gid', "name = 'unreadPosts'"); $gid = (int) $db->fetch_field($result, "gid"); if ($gid > 0) { $db->delete_query('settings', "gid = '{$gid}'"); } $db->delete_query('settinggroups', "gid = '{$gid}'"); rebuild_settings(); }
function restfulapi_uninstall() { global $db; // propagate deactivation to the APIs, we only deactivate them ALL at uninstall restfulapi_apilist_deactivate(); $db->write_query("DROP TABLE IF EXISTS " . TABLE_PREFIX . "apisettings"); $db->write_query("DROP TABLE IF EXISTS " . TABLE_PREFIX . "apikeys"); $db->write_query("DROP TABLE IF EXISTS " . TABLE_PREFIX . "apipermissions"); $db->delete_query("settings", "name IN ('enablerestfulapi', 'apikeylength', 'apirequestmethod', 'apihttpsonly')"); $db->delete_query("settinggroups", "name='restfulapi'"); rebuild_settings(); }
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(); }
function ganalytics_deactivate() { global $db; $info = ganalytics_info(); $result = $db->simple_select('settinggroups', 'gid', 'name="' . $info['codename'] . '"', array('limit' => 1)); $group = $db->fetch_array($result); if (!empty($group['gid'])) { $db->delete_query('settinggroups', 'gid="' . $group['gid'] . '"'); $db->delete_query('settings', 'gid="' . $group['gid'] . '"'); rebuild_settings(); } }
function tags_uninstall() { global $db, $mybb; $query = $db->simple_select('settinggroups', 'gid', "name='tags'"); $gid = $db->fetch_field($query, 'gid'); $db->delete_query('templates', "title LIKE 'tags\\_%' AND sid='-1'"); $db->delete_query("settinggroups", "name = 'tags'"); $db->delete_query('settings', "gid = '{$gid}'"); if ($mybb->settings['tags_droptable']) { $db->drop_table('tags'); } rebuild_settings(); }
/** * MyBB 1.8 * Copyright 2014 MyBB Group, All Rights Reserved * * Website: http://www.mybb.com * License: http://www.mybb.com/about/license * */ function task_checktables($task) { global $db, $mybb, $lang, $plugins; // Sorry SQLite, you don't have a decent way of checking if the table is corrupted or not. if ($db->type == "sqlite") { return; } @set_time_limit(0); $ok = array("The storage engine for the table doesn't support check", "Table is already up to date", "OK"); $comma = ""; $tables_list = ""; $repaired = ""; $setting_done = false; $tables = $db->list_tables($mybb->config['database']['database'], $mybb->config['database']['table_prefix']); foreach ($tables as $key => $table) { $tables_list .= "{$comma}{$table} "; $comma = ","; } if ($tables_list) { $query = $db->query("CHECK TABLE {$tables_list}CHANGED;"); while ($table = $db->fetch_array($query)) { if (!in_array($table['Msg_text'], $ok)) { if ($table['Table'] != $mybb->config['database']['database'] . "." . TABLE_PREFIX . "settings" && $setting_done != true) { $boardclosed = $mybb->settings['boardclosed']; $boardclosed_reason = $mybb->settings['boardclosed_reason']; $db->update_query("settings", array('value' => 1), "name='boardclosed'", 1); $db->update_query("settings", array('value' => $db->escape_string($lang->error_database_repair)), "name='boardclosed_reason'", 1); rebuild_settings(); $setting_done = true; } $db->query("REPAIR TABLE {$table['Table']}"); $repaired[] = $table['Table']; } } if ($table['Table'] != $mybb->config['database']['table_prefix'] . "." . TABLE_PREFIX . "settings" && $setting_done == true) { $db->update_query("settings", array('value' => (int) $boardclosed), "name='boardclosed'", 1); $db->update_query("settings", array('value' => $db->escape_string($boardclosed_reason)), "name='boardclosed_reason'", 1); rebuild_settings(); } } if (is_object($plugins)) { $plugins->run_hooks('task_checktables', $task); } if (!empty($repaired)) { add_task_log($task, $lang->sprintf($lang->task_checktables_ran_found, implode(', ', $repaired))); } else { add_task_log($task, $lang->task_checktables_ran); } }
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(); }
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')"); }
function teamonline_install() { global $db, $mybb, $lang; $lang->load('config_teamonline'); $settingsgroup = array("gid" => "NULL", "name" => "plugin_teamonline", "title" => $lang->name, "description" => $lang->desc_set, "disporder" => "250", "isdefault" => "no"); $db->insert_query("settinggroups", $settingsgroup); $d = -1; $gid = (int) $db->insert_id(); $setting_array[] = array("sid" => "NULL", "name" => "teamonline_gid", "title" => $lang->name_set1, "description" => $lang->desc_set1, "optionscode" => "text", "value" => "4", "disporder" => ++$disporder, "gid" => $gid); $setting_array[] = array("sid" => "NULL", "name" => "teamonline_no_text", "title" => $lang->name_set2, "description" => $lang->desc_set2, "optionscode" => "text", "value" => $lang->value_set2, "disporder" => ++$disporder, "gid" => $gid); $setting_array[] = array("sid" => "NULL", "name" => "teamonline_group_color", "title" => $lang->name_set3, "description" => $lang->desc_set3, "optionscode" => "text", "value" => "#393939", "disporder" => ++$disporder, "gid" => $gid); $setting_array[] = array("sid" => "NULL", "name" => "teamonline_defaultavatar", "title" => $lang->name_set4, "description" => $lang->desc_set4, "optionscode" => "text", "value" => "images/avatars/invalid_url.gif", "disporder" => ++$disporder, "gid" => $gid); $db->insert_query("settings", $settings4); foreach ($setting_array as &$current_setting) { $current_setting['sid'] = NULL; $current_setting['disporder'] = ++$d; $current_setting['gid'] = $gid; } $db->insert_query_multiple('settings', $setting_array); rebuild_settings(); $template['teamonline'] = ' <table border="0" cellspacing="' . $theme['borderwidth'] . '" cellpadding="' . $theme['tablespace'] . '" class="tborder"> <thead> <tr> <td class="thead" colspan="2"> <strong>{$lang->title}</strong> </tr> </thead> <tbody id="teamonline_e" style="{$expdisplay}"> {$teamonline_row} {$teamonline_no} </tbody> <tr><td class="{$trowbg}" colspan="2">{$lang->online} {$membercount}</td></tr><tr><td class="{$trowbg}" colspan="2">{$lang->invisible} {$invisible}</td></tr></table> <br />'; $template['teamonline_no'] = ' <tr><td class="{$trowbg}">{$mybb->settings[\'teamonline_no_text\']}</td></tr>'; $template['teamonline_row'] = '<tr><td class="{$trowbg}"><img src="{$avatar_teamonline[\'image\']}" style="max-width: 35px; max-height: 35px; text-align:center;" /></td> <td class="{$trowbg}" style="width: 100%;"> {$online[\'profilelink\']}<br /><font color="{$mybb->settings[\'teamonline_group_color\']}">{$online[\'groupname\']}</font> </td></tr>'; foreach ($template as $title => $tname) { $tp = array('title' => $title, 'template' => $db->escape_string($tname), 'sid' => '-1', 'version' => '1612', 'dateline' => TIME_NOW); $db->insert_query("templates", $tp); } require "../inc/adminfunctions_templates.php"; find_replace_templatesets("index", '#' . preg_quote('{$forums}') . '#', '{$forums}{$teamonline}'); find_replace_templatesets("portal", '#' . preg_quote('{$welcome}') . '#', '{$welcome}{$teamonline}'); }
/** * * Plugin Activate - steamlogin_activate * - - - - - - - - - - - - - - - * @since 1.0 * @version 1.6 * */ function steamlogin_activate() { global $db, $mybb, $templates; $steamlogin_settings = array("name" => "steamlogin", "title" => "Steam Login - Settings", "description" => "Modify the settings of the Steam Login plugin.", "disporder" => "0", "isdefault" => "no"); // Create our Setting group in the database. $db->insert_query("settinggroups", $steamlogin_settings); // Our new Setting group ID. $gid = intval($db->insert_id()); $steamlogin_api_key_setting = array("name" => "steamlogin_api_key", "title" => "Steam API Key", "description" => "You can get an API key by going to the following website: http://steamcommunity.com/dev/apikey", "optionscode" => "text", "value" => "", "disporder" => 1, "gid" => $gid); $steamlogin_update_username_setting = array("name" => "steamlogin_update_username", "title" => "Update Username", "description" => "Should the plugin be allowed to update the username of the user on each login? (If a user changes their name on Steam, this will update here too.)", "optionscode" => "yesno", "value" => "no", "disporder" => 2, "gid" => $gid); $steamlogin_update_avatar_setting = array("name" => "steamlogin_update_avatar", "title" => "Update Avatar", "description" => "Should the plugin be allowed to update the avatar of the user to that of their Steam account?", "optionscode" => "yesno", "value" => "yes", "disporder" => 3, "gid" => $gid); $steamlogin_avatar_size_setting = array("name" => "steamlogin_avatar_size", "title" => "Avatar Size", "description" => "Set whether to use the small, medium or large avatar from the Steam API.", "optionscode" => "select\n 0=Small\n 1=Medium\n 2=Large", "value" => "2", "disporder" => 4, "gid" => $gid); $steamlogin_required_field_setting = array("name" => "steamlogin_required_field", "title" => "Required Field", "description" => "You can set <strong>one</strong> required field here to autofill with the Steam ID of the user. Type the ID of the custom profile field.<br><strong>Required fields are NOT supported by this plugin. It will work with one if you set it here.</strong>", "optionscode" => "text", "value" => "", "disporder" => 5, "gid" => $gid); // Insert our Settings. $db->insert_query("settings", $steamlogin_api_key_setting); $db->insert_query("settings", $steamlogin_update_username_setting); $db->insert_query("settings", $steamlogin_update_avatar_setting); $db->insert_query("settings", $steamlogin_avatar_size_setting); $db->insert_query("settings", $steamlogin_required_field_setting); // Rebuild our settings to show our new category. rebuild_settings(); /** * Perform an update to the username length. */ $update_username_length = $db->update_query("settings", array('value' => '70'), "name = 'maxnamelength'"); /** * Template Edits * - - - - - - - - - - - - - - - * Template edits required by the plugin. */ require_once MYBB_ROOT . 'inc/adminfunctions_templates.php'; // Add a Login button to the "Welcome Block"/ find_replace_templatesets('header_welcomeblock_guest', '#' . preg_quote('{$lang->welcome_register}</a>') . '#i', '{$lang->welcome_register}</a> — <a href="{$mybb->settings[\'bburl\']}/misc.php?action=steam_login"><img border="0" src="inc/plugins/steamlogin/steam_login_btn.png" alt="Login through Steam" style="vertical-align:middle"></a>'); $plugin_templates = array("tid" => NULL, "title" => 'steamlogin_profile_block', "template" => $db->escape_string('<br /><table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder"><tr><td colspan="2" class="thead"><strong>Steam Details</strong></td></tr><tr><td class="trow1" width="40%"><strong>Steam Verified</strong></td><td class="trow1">{$steam_verified}</td></tr><tr><td class="trow1" width="40%"><strong>Level</strong></td><td class="trow1">{$steam_level}</td></tr><tr><td class="trow1" width="40%"><strong>SteamID 32</strong></td><td class="trow1">{$steamid_32}</td></tr><tr><td class="trow1" width="40%"><strong>SteamID 64</strong></td><td class="trow1"><a href="http://www.steamcommunity.com/profiles/{$steamid_64}" target="_blank">http://www.steamcommunity.com/profiles/{$steamid_64}</a></td></tr><tr><td class="trow1" width="40%"><strong>SteamRep</strong></td><td class="trow1">{$steamrep_link}</td></tr><tr><td class="trow1" width="40%"><strong>Steam Status</strong></td><td class="trow1">{$steam_status}</td></tr></table><br />'), "sid" => "-1", "version" => $mybb->version + 1, "dateline" => time()); $db->insert_query("templates", $plugin_templates); $plugin_templates = array("tid" => NULL, "title" => 'steamlogin_feature_disabled', "template" => $db->escape_string('<html><head><title>{$mybb->settings[\'bbname\']}</title>{$headerinclude}</head><body>{$header}<table border="0" cellspacing="{$theme[\'borderwidth\']}" cellpadding="{$theme[\'tablespace\']}" class="tborder"><tr><td colspan="2" class="thead"><strong>Feature Disabled</strong></td></tr><tr><td class="trow1" width="40%"><strong>This feature has been disabled on your account.</td></tr></table>{$footer}</body></html>'), "sid" => "-1", "version" => $mybb->version + 1, "dateline" => time()); $db->insert_query("templates", $plugin_templates); find_replace_templatesets('member_profile', '#' . preg_quote('{$signature}') . '#i', '{$steamlogin_profile_block}{$signature}'); // This is released as Open Source. Although this notice isn't required to be kept, i'd appreciate if you could show your support by keeping it here. find_replace_templatesets('footer', '#' . preg_quote('<!-- End powered by -->') . '#i', 'Steam Login provided by <a href="http://www.calculator.tf">www.calculator.tf</a><br>Powered by <a href="http://www.steampowered.com">Steam</a>.<!-- End powered by -->'); }
public function go() { global $db, $cache; if (function_exists('wiki_is_installed') && wiki_is_installed()) { return false; } $this->buildTables(); $this->insertSettings(); rebuild_settings(); $this->insertCSS(); $this->handleMyAlerts(); $query = $db->write_query("SELECT * FROM `" . TABLE_PREFIX . "usergroups`"); $cache_arr = array(); while ($group = $db->fetch_array($query)) { // Set the default permissions $db->write_query("INSERT INTO " . TABLE_PREFIX . "wiki_perms(`gid`,`can_view`,`can_create`,`can_edit`,`can_protect`,`can_export`) VALUES('" . $group['gid'] . "','1','1','1','0','0')"); // and cache them $cache_arr['gid_' . $group['gid']] = array('can_view' => 1, 'can_create' => 1, 'can_edit' => 1, 'can_protect' => 0, 'can_export' => 0); } $cache->update('wiki_permissions', $cache_arr); $db->write_query("INSERT INTO " . TABLE_PREFIX . "wiki_categories(title, description) VALUES('Meta', 'The default Category')"); return true; }
function akismet_uninstall() { global $db; if ($db->field_exists('akismetstopped', "users")) { $db->write_query("ALTER TABLE " . TABLE_PREFIX . "users DROP akismetstopped"); } // DELETE ALL SETTINGS TO AVOID DUPLICATES $db->write_query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name IN(\r\n\t\t'akismetswitch',\r\n\t\t'akismetapikey',\r\n\t\t'akismetnumtillban',\r\n\t\t'akismetfidsignore',\r\n\t\t'akismetuidsignore',\r\n\t\t'akismetuserstoignore'\r\n\t)"); $db->delete_query("settinggroups", "name = 'akismet'"); $db->delete_query("datacache", "title = 'akismet_update_check'"); rebuild_settings(); }
static function banlist_update($new) { global $db; $db->update_query('settings', array('value' => $db->escape_string($new)), "name='dvz_sb_blocked_users'"); rebuild_settings(); }
function newpoints_shop_uninstall() { global $db; $db->write_query("ALTER TABLE `" . TABLE_PREFIX . "users` DROP `newpoints_items`;"); $db->write_query("ALTER TABLE `" . TABLE_PREFIX . "newpoints_grouprules` DROP `items_rate`;"); // delete settings newpoints_remove_settings("'newpoints_shop_sendable','newpoints_shop_sellable','newpoints_shop_lastpurchases','newpoints_shop_percent','newpoints_shop_viewothers','newpoints_shop_itemsprofile','newpoints_shop_itemspostbit'"); rebuild_settings(); if ($db->table_exists('newpoints_shop_categories')) { $db->drop_table('newpoints_shop_categories'); } if ($db->table_exists('newpoints_shop_items')) { $db->drop_table('newpoints_shop_items'); } newpoints_remove_log(array('shop_purchase', 'shop_send', 'shop_sell')); }
function firstpreview_activate() { global $db; require_once MYBB_ROOT . "/inc/adminfunctions_templates.php"; // Undo old template edits to avoid duplicate entries 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); find_replace_templatesets("private_messagebit", "#" . preg_quote('<a class="pmprev" id="{$message') . "#s", '<a class="pmprev" id="pmid_{$message', '', false); // Edit templates find_replace_templatesets("forumdisplay_thread", "#" . preg_quote('<a href="{$thread[\'lastpostlink\']}"') . '#s', "<a href=\"{\$thread['lastpostlink']}\" class=\"last_preview\" id=\"ltid_{\$inline_edit_tid}\""); find_replace_templatesets("search_results_threads_thread", "#" . preg_quote('<a href="{$thread[\'lastpostlink\']}"') . '#s', "<a href=\"{\$thread['lastpostlink']}\" class=\"last_preview\" id=\"ltid_{\$inline_edit_tid}\""); find_replace_templatesets("forumbit_depth2_forum_lastpost", "#" . preg_quote('<a href="{$lastpost_link}"') . '#s', "<a href=\"{\$lastpost_link}\" class=\"last_preview\" id=\"ltid_{\$lastpost_data['lastposttid']}\""); find_replace_templatesets("private_messagebit", "#" . preg_quote('{$msgprefix}<a') . '#s', "{\$msgprefix}<div class=\"modal_firstpost\"></div><a class=\"pmprev\" id=\"pmid_{\$message['pmid']}\""); // Upgrade to 1.1 $query = $db->simple_select("settinggroups", "gid", "name='firstpreview'"); $fpgid = $db->fetch_array($query); if ($fpgid) { $gid = $fpgid['gid']; } $query_2 = $db->simple_select("settings", "*", "name='firstpreview_last'"); $result = $db->num_rows($query_2); if (!$result) { $firstpreview_3 = array("name" => "firstpreview_last", "title" => "Last post preview", "description" => "Also show a preview of the last post in forum list and index.", "optionscode" => "yesno", "value" => 0, "disporder" => 3, "gid" => (int) $gid); $db->insert_query("settings", $firstpreview_3); } // Upgrade to 1.1.1 $query_3 = $db->simple_select("settings", "*", "name='firstpreview_bg'"); $result_2 = $db->num_rows($query_3); if (!$result_2) { $firstpreview_4 = array("name" => "firstpreview_bg", "title" => "Background color of the preview", "description" => "Background color of the preview window as Hex code without semicolon (Default: #aaaaaa)", "optionscode" => "text", "value" => '#aaaaaa', "disporder" => 4, "gid" => (int) $gid); $db->insert_query("settings", $firstpreview_4); } // Upgrade to 1.1.2 $query_4 = $db->simple_select("settings", "*", "name='firstpreview_close'"); $result_3 = $db->num_rows($query_4); if (!$result_3) { $firstpreview_5 = array("name" => "firstpreview_close", "title" => "Close Button", "description" => "Show close button in preview window", "optionscode" => "yesno", "value" => 0, "disporder" => 5, "gid" => (int) $gid); $db->insert_query("settings", $firstpreview_5); } rebuild_settings(); }