コード例 #1
0
ファイル: wiki.php プロジェクト: Krytic/MyBBWiki
function wiki_uninstall()
{
    global $db, $cache;
    // Template Deletion
    $db->delete_query("templategroups", "title = 'Wiki'");
    // Table deletion
    $db->drop_table('wiki');
    $db->drop_table('wiki_edits');
    $db->drop_table('wiki_categories');
    $db->drop_table('wiki_perms');
    $db->drop_table('wiki_settings');
    $db->drop_table('wiki_templates');
    // Clear caches
    $db->delete_query("datacache", 'title="wiki_articles"');
    $db->delete_query("datacache", 'title="wiki_permissions"');
    require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
    // Stylesheet Deletion
    $query = $db->simple_select("themes", "tid");
    while ($tid = $db->fetch_field($query, "tid")) {
        $css_file = MYBB_ROOT . "cache/themes/theme{$tid}/wiki.css";
        if (file_exists($css_file)) {
            unlink($css_file);
        }
    }
    update_theme_stylesheet_list("1");
    if (class_exists('MybbStuff_MyAlerts_AlertTypeManager')) {
        $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::getInstance();
        if (!$alertTypeManager) {
            $alertTypeManager = MybbStuff_MyAlerts_AlertTypeManager::createInstance($db, $cache);
        }
        $alertTypeManager->deleteByCode('mybb_wiki_alert_code');
    }
}
コード例 #2
0
ファイル: install.php プロジェクト: Krytic/MyBBWiki
 private function insertCSS()
 {
     global $db;
     require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
     // Add stylesheet to the master template so it becomes inherited.
     $stylesheet = @file_get_contents(MYBB_ROOT . 'inc/plugins/wiki/templates/stylesheets/wiki.css');
     $wiki_stylesheet = array('name' => 'wiki.css', 'tid' => '1', 'stylesheet' => $db->escape_string($stylesheet), 'cachefile' => 'wiki.css', 'lastmodified' => TIME_NOW, 'attachedto' => 'wiki.php');
     $db->insert_query('themestylesheets', $wiki_stylesheet);
     cache_stylesheet(1, "wiki.css", $stylesheet);
     update_theme_stylesheet_list("1");
 }
コード例 #3
0
function portal_news_preview_uninstall()
{
    global $db;
    require_once MYBB_ROOT . "admin/inc/functions_themes.php";
    $query = $db->simple_select("themes", "tid");
    while ($tid = $db->fetch_field($query, "tid")) {
        $css_file = MYBB_ROOT . "cache/themes/theme{$tid}/readmore.css";
        $mincss_file = MYBB_ROOT . "cache/themes/theme{$tid}/readmore.min.css";
        if (file_exists($css_file)) {
            unlink($css_file);
            unlink($mincss_file);
        }
    }
    $db->delete_query("themestylesheets", "name = 'readmore.css'");
    require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
    $query = $db->simple_select("themes", "tid");
    while ($theme = $db->fetch_array($query)) {
        update_theme_stylesheet_list($theme['tid']);
    }
}
コード例 #4
0
ファイル: themes.php プロジェクト: mainhan1804/xomvanphong
                if ($mybb->input['attach'] == 2) {
                    if (!is_array($mybb->input['color'])) {
                        $errors[] = $lang->error_no_color_picked;
                    } else {
                        $attached = $mybb->input['color'];
                    }
                }
            }
            // Add Stylesheet
            $insert_array = array('name' => $db->escape_string($mybb->input['name']), 'tid' => $mybb->get_input('tid', MyBB::INPUT_INT), 'attachedto' => implode('|', array_map(array($db, "escape_string"), $attached)), 'stylesheet' => $db->escape_string($stylesheet), 'cachefile' => $db->escape_string(str_replace('/', '', $mybb->input['name'])), 'lastmodified' => TIME_NOW);
            $sid = $db->insert_query("themestylesheets", $insert_array);
            if (!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $stylesheet)) {
                $db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
            }
            // Update the CSS file list for this theme
            update_theme_stylesheet_list($theme['tid'], $theme, true);
            $plugins->run_hooks("admin_style_themes_add_stylesheet_commit");
            // Log admin action
            log_admin_action($sid, $mybb->input['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));
            flash_message($lang->success_stylesheet_added, 'success');
            admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&sid={$sid}&file=" . urlencode($mybb->input['name']));
        }
    }
    if ($admin_options['codepress'] != 0) {
        $page->extra_header .= '
<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css?ver=1804" rel="stylesheet">
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/lib/codemirror.js"></script>
<script src="./jscripts/codemirror/mode/css/css.js"></script>
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
コード例 #5
0
ファイル: pluginlibrary.php プロジェクト: WhiteNeo/MyAlerts
 /**
  * Update stylesheet metadata.
  *
  */
 function _update_themes_stylesheets($stylesheet = false)
 {
     global $mybb;
     $tid = 1;
     // MyBB Master Style
     require_once MYBB_ROOT . $mybb->config['admin_dir'] . '/inc/functions_themes.php';
     if ($stylesheet) {
         cache_stylesheet($stylesheet['tid'], $stylesheet['cachefile'], $stylesheet['stylesheet']);
     }
     update_theme_stylesheet_list($tid);
     // includes all children
 }
コード例 #6
0
ファイル: themes.php プロジェクト: GeorgeLVP/mybb
                        }
                        if ($actions_list) {
                            $attached_to = $attached_to . "?" . $actions_list;
                        }
                        $attached[] = $attached_to;
                    }
                }
            }
            // Add Stylesheet
            $insert_array = array('name' => $db->escape_string($mybb->input['name']), 'tid' => intval($mybb->input['tid']), 'attachedto' => implode('|', array_map(array($db, "escape_string"), $attached)), 'stylesheet' => $db->escape_string($stylesheet), 'cachefile' => $db->escape_string(str_replace('/', '', $mybb->input['name'])), 'lastmodified' => TIME_NOW);
            $sid = $db->insert_query("themestylesheets", $insert_array);
            if (!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $stylesheet)) {
                $db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
            }
            // Update the CSS file list for this theme
            update_theme_stylesheet_list($theme['tid']);
            $plugins->run_hooks("admin_style_themes_add_stylesheet_commit");
            // Log admin action
            log_admin_action($sid, $mybb->input['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));
            flash_message($lang->success_stylesheet_added, 'success');
            admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&sid={$sid}&file=" . urlencode($mybb->input['name']));
        }
    }
    if ($admin_options['codepress'] != 0) {
        $page->extra_header .= '
	<link type="text/css" href="./jscripts/codepress/languages/css.css" rel="stylesheet" id="cp-lang-style" />
	<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
	<script type="text/javascript">
		CodePress.language = \'css\';
	</script>';
    }
コード例 #7
0
ファイル: functions_themes.php プロジェクト: KasaiDot/mybb
function update_theme_stylesheet_list($tid)
{
    global $db;
    $stylesheets = array();
    $child_list = make_child_theme_list($tid);
    $parent_list = make_parent_theme_list($tid);
    if (!is_array($parent_list)) {
        return false;
    }
    $tid_list = implode(',', $parent_list);
    // Get our list of stylesheets
    $query = $db->simple_select("themestylesheets", "sid,cachefile,attachedto,tid,lastmodified,name", "tid IN ({$tid_list})", array('order_by' => 'tid', 'order_dir' => 'desc'));
    while ($stylesheet = $db->fetch_array($query)) {
        if (!$stylesheets[$stylesheet['name']]) {
            if ($stylesheet['tid'] != $tid) {
                $stylesheet['inherited'] = $stylesheet['tid'];
            }
            $stylesheets[$stylesheet['name']] = $stylesheet;
        }
    }
    foreach ($stylesheets as $name => $stylesheet) {
        $sid = $stylesheet['sid'];
        $css_url = "css.php?stylesheet={$sid}";
        foreach ($parent_list as $theme_id) {
            if (file_exists(MYBB_ROOT . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(MYBB_ROOT . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") >= $stylesheet['lastmodified']) {
                $css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}";
                break;
            }
        }
        $attachedto = $stylesheet['attachedto'];
        if (!$attachedto) {
            $attachedto = "global";
        }
        // private.php?compose,folders|usercp.php,global|global
        $attachedto = explode("|", $attachedto);
        foreach ($attachedto as $attached_file) {
            $attached_actions = array();
            if (strpos($attached_file, '?') !== false) {
                $attached_file = explode('?', $attached_file);
                $attached_actions = explode(",", $attached_file[1]);
                $attached_file = $attached_file[0];
            }
            if (count($attached_actions) == 0) {
                $attached_actions = array("global");
            }
            foreach ($attached_actions as $action) {
                $theme_stylesheets[$attached_file][$action][] = $css_url;
                if ($stylesheet['inherited']) {
                    $theme_stylesheets['inherited']["{$attached_file}_{$action}"][$css_url] = $stylesheet['inherited'];
                }
            }
        }
    }
    // Now we have our list of built stylesheets, save them
    $updated_theme = array("stylesheets" => $db->escape_string(serialize($theme_stylesheets)));
    $db->update_query("themes", $updated_theme, "tid='{$tid}'");
    // Do we have any children themes that need updating too?
    if (count($child_list) > 0) {
        foreach ($child_list as $id) {
            update_theme_stylesheet_list($id);
        }
    }
    return true;
}
コード例 #8
0
ファイル: install.php プロジェクト: Sama34/MySteam-Powered
function mysteam_uninstall()
{
    global $db, $theme;
    // Make sure ASB module is uninstalled before continuing.
    if (file_exists(MYBB_ROOT . 'inc/plugins/asb/modules/mysteamlist.php')) {
        flash_message('The Steam Status module for Advanced Sidebox is still installed. Please delete it from within the Advanced Sidebox menu before uninstalling this plugin.', 'error');
        admin_redirect('index.php?module=config-plugins');
    }
    // Delete Steam ID database field
    $db->write_query("ALTER TABLE " . TABLE_PREFIX . "users DROP steamid");
    // Delete settings
    $db->delete_query("settinggroups", "name LIKE 'mysteam_%'");
    $db->delete_query("settings", "name LIKE 'mysteam_%'");
    $db->delete_query("templategroups", "prefix = 'mysteam'");
    // Remove stylesheet from theme cache directories if present.
    require_once MYBB_ADMIN_DIR . 'inc/functions_themes.php';
    $query = $db->simple_select("themes", "tid, name", "name='mysteam.css'");
    while ($stylesheet = $db->fetch_array($query)) {
        @unlink(MYBB_ROOT . "cache/themes/{$stylesheet['tid']}_{$stylesheet['name']}");
        @unlink(MYBB_ROOT . "cache/themes/theme{$stylesheet['tid']}/{$stylesheet['name']}");
    }
    $db->delete_query("themestylesheets", "name='mysteam.css'");
    update_theme_stylesheet_list(1);
}
コード例 #9
0
ファイル: mysupport.php プロジェクト: myWebDev/MySupport
function mysupport_stylesheet($action = 0)
{
    global $db;
    $stylesheet = ".mysupport_status_solved {\r\n\tcolor: green;\r\n}\r\n\r\n.mysupport_status_notsolved {\r\n\tcolor: red;\r\n}\r\n\r\n.mysupport_status_technical {\r\n\tcolor: blue;\r\n}\r\n\r\n.mysupport_status_onhold {\r\n\tcolor: yellow;\r\n}\r\n\r\n.mysupport_tabs {\r\n\tmargin: 20px auto;\r\n}\r\n\r\n.mysupport_tab {\r\n\ttext-align: center;\r\n\tpadding: 5px;\r\n\tdisplay: inline;\r\n}\r\n\r\n.mysupport_tab_solved {\r\n\tbackground: #D6ECA6;\r\n\tborder: 2px solid #009900;\r\n\tcolor: #009900;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_solved a {\r\n\tcolor: #009900;\r\n}\r\n\r\n.mysupport_tab_not_solved {\r\n\tbackground: #FFE4E1;\r\n\tborder: 2px solid #CD0000;\r\n\tcolor: #CD0000;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_not_solved a {\r\n\tcolor: #CD0000;\r\n}\r\n\r\n.mysupport_tab_technical {\r\n\tbackground: #ADCBE7;\r\n\tborder: 2px solid #0F5C8E;\r\n\tcolor: #0F5C8E;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_technical a {\r\n\tcolor: #0F5C8E;\r\n}\r\n\r\n.mysupport_tab_hold {\r\n\tbackground: #FFF6BF;\r\n\tborder: 2px solid #FFB90F;\r\n\tcolor: #FFB90F;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_hold a {\r\n\tcolor: #FFB90F;\r\n}\r\n\r\n.mysupport_tab_best_answer {\r\n\tbackground: #D6ECA6;\r\n\tborder: 2px solid #8DC93E;\r\n\tcolor: #8DC93E;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_best_answer a {\r\n\tcolor: #8DC93E;\r\n}\r\n\r\n.mysupport_tab_misc {\r\n\tbackground: #EFEFEF;\r\n\tborder: 2px solid #555555;\r\n\tcolor: #555555;\r\n\tfont-weight: bold;\r\n}\r\n\r\n.mysupport_tab_misc a {\r\n\tcolor: #555555;\r\n}\r\n\r\n.mysupport_showthread_more_box {\r\n\twidth: 250px;\r\n\tposition: fixed;\r\n\ttop: 25%;\r\n\tleft: 50%;\r\n\tmargin-left: -125px;\r\n\tz-index: 1000;\r\n}\r\n\r\n.mysupport_bar_solved {\r\n\tbackground: green;\r\n\theight: 10px;\r\n}\r\n\r\n.mysupport_bar_notsolved {\r\n\tbackground: red;\r\n\theight: 10px;\r\n}\r\n\r\n.mysupport_bar_technical {\r\n\tbackground: blue;\r\n\theight: 10px;\r\n}\r\n\r\n.mysupport_bestanswer_highlight {\r\n\tbackground: #D6ECA6;\r\n}\r\n\r\n.mysupport_staff_highlight {\r\n\tbackground: #E6E8FA;\r\n}\r\n\r\n.usercp_nav_support_threads {\r\n\tbackground: url(images/usercp/mysupport_support.png) no-repeat left center;\r\n}\r\n\r\n.usercp_nav_assigned_threads {\r\n\tbackground: url(images/usercp/mysupport_assigned.png) no-repeat left center;\r\n}\r\n\r\n.modcp_nav_tech_threads {\r\n\tbackground: url(images/modcp/mysupport_technical.png) no-repeat left center;\r\n}\r\n\r\n.modcp_nav_deny_support {\r\n\tbackground: url(images/mysupport_no_support.gif) no-repeat left center;\r\n}";
    if ($action == 1) {
        $insert = array("name" => "mysupport.css", "tid" => 1, "attachedto" => "showthread.php|forumdisplay.php|usercp.php|usercp2.php|modcp.php", "stylesheet" => $stylesheet, "lastmodified" => TIME_NOW);
        $sid = $db->insert_query("themestylesheets", $insert);
        $update = array("cachefile" => "css.php?stylesheet=" . intval($sid));
        $db->update_query("themestylesheets", $update, "sid = '{$sid}'");
    } elseif ($action == 2) {
        $query = $db->simple_select("themestylesheets", "sid", "name = 'mysupport.css' AND tid = '1'");
        $sid = $db->fetch_field($query, "sid");
        $update = array("stylesheet" => $stylesheet, "lastmodified" => TIME_NOW);
        $db->update_query("themestylesheets", $update, "sid = '" . intval($sid) . "'");
    } elseif ($action == -1) {
        $db->delete_query("themestylesheets", "name = 'mysupport.css'");
    }
    if ($action == 1 || $action == -1) {
        $query = $db->simple_select("themes", "tid");
        require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
        while ($tid = $db->fetch_field($query, "tid")) {
            update_theme_stylesheet_list($tid);
        }
    }
}
コード例 #10
0
ファイル: myalerts.php プロジェクト: harrygg/MyAlerts
function myalerts_deactivate()
{
    global $PL, $db, $lang, $plugins;
    if (!isset($lang->myalerts)) {
        $lang->load('myalerts');
    }
    if (!file_exists(PLUGINLIBRARY)) {
        flash_message($lang->myalerts_pluginlibrary_missing, 'error');
        admin_redirect('index.php?module=config-plugins');
    }
    isset($PL) or (require_once PLUGINLIBRARY);
    $plugins->run_hooks('myalerts_deactivate');
    $PL->stylesheet_deactivate('alerts.css');
    // remove usercp.css from alerts.php
    $query = $db->simple_select('themestylesheets', 'sid,attachedto,tid', "name = 'usercp.css'");
    while ($userCpStylesheet = $db->fetch_array($query)) {
        $sid = (int) $userCpStylesheet['sid'];
        $attachedTo = str_replace('|alerts.php', '', $userCpStylesheet['attachedto']);
        $db->update_query('themestylesheets', array('attachedto' => $db->escape_string($attachedTo)), "sid = {$sid}");
        update_theme_stylesheet_list((int) $userCpStylesheet['tid']);
    }
    require_once MYBB_ROOT . "/inc/adminfunctions_templates.php";
    find_replace_templatesets('headerinclude', "#" . preg_quote('{$myalerts_js}') . "#i", '');
    find_replace_templatesets('header_welcomeblock_member', "#" . preg_quote('{$myalerts_headericon}') . "#i", '');
    find_replace_templatesets('footer', "#" . preg_quote('{$myalerts_modal}') . "#i", '');
    $db->update_query('tasks', array('enabled' => 0), 'file = \'myalerts\'');
}
コード例 #11
0
/**
 * @param int $tid
 * @param bool|array $theme
 * @param bool $update_disporders
 *
 * @return bool
 */
function update_theme_stylesheet_list($tid, $theme = false, $update_disporders = true)
{
    global $mybb, $db, $cache, $plugins;
    $stylesheets = array();
    $child_list = make_child_theme_list($tid);
    $parent_list = make_parent_theme_list($tid);
    if (!is_array($parent_list)) {
        return false;
    }
    $tid_list = implode(',', $parent_list);
    // Get our list of stylesheets
    $query = $db->simple_select("themestylesheets", "*", "tid IN ({$tid_list})", array('order_by' => 'tid', 'order_dir' => 'desc'));
    while ($stylesheet = $db->fetch_array($query)) {
        if (empty($stylesheets[$stylesheet['name']])) {
            if ($stylesheet['tid'] != $tid) {
                $stylesheet['inherited'] = $stylesheet['tid'];
            }
            $stylesheets[$stylesheet['name']] = $stylesheet;
        }
    }
    $theme_stylesheets = array();
    foreach ($stylesheets as $name => $stylesheet) {
        $sid = $stylesheet['sid'];
        $css_url = "css.php?stylesheet={$sid}";
        foreach ($parent_list as $theme_id) {
            if ($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath'])) {
                $cdnpath = rtrim($mybb->settings['cdnpath'], '/\\') . '/';
                if (file_exists($cdnpath . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime($cdnpath . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") >= $stylesheet['lastmodified']) {
                    $css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}";
                    break;
                }
            } else {
                if (file_exists(MYBB_ROOT . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(MYBB_ROOT . "cache/themes/theme{$theme_id}/{$stylesheet['name']}") >= $stylesheet['lastmodified']) {
                    $css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}";
                    break;
                }
            }
        }
        if (is_object($plugins)) {
            $plugins->run_hooks('update_theme_stylesheet_list_set_css_url', $css_url);
        }
        $attachedto = $stylesheet['attachedto'];
        if (!$attachedto) {
            $attachedto = "global";
        }
        // private.php?compose,folders|usercp.php,global|global
        $attachedto = explode("|", $attachedto);
        foreach ($attachedto as $attached_file) {
            $attached_actions = array();
            if (strpos($attached_file, '?') !== false) {
                $attached_file = explode('?', $attached_file);
                $attached_actions = explode(",", $attached_file[1]);
                $attached_file = $attached_file[0];
            }
            if (count($attached_actions) == 0) {
                $attached_actions = array("global");
            }
            foreach ($attached_actions as $action) {
                $theme_stylesheets[$attached_file][$action][] = $css_url;
                if (!empty($stylesheet['inherited'])) {
                    $theme_stylesheets['inherited']["{$attached_file}_{$action}"][$css_url] = $stylesheet['inherited'];
                }
            }
        }
    }
    // Now we have our list of built stylesheets, save them
    $updated_theme = array("stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)));
    // Do we have a theme present? If so, update the stylesheet display orders
    if ($update_disporders) {
        if (!is_array($theme) || !$theme) {
            $theme_cache = cache_themes();
            $theme = $theme_cache[$tid];
        }
        $orders = $orphaned_stylesheets = array();
        $properties = $theme['properties'];
        if (!is_array($properties)) {
            $properties = my_unserialize($theme['properties']);
        }
        $max_disporder = 0;
        foreach ($stylesheets as $stylesheet) {
            if (!isset($properties['disporder'][$stylesheet['name']])) {
                $orphaned_stylesheets[] = $stylesheet['name'];
                continue;
            }
            if ($properties['disporder'][$stylesheet['name']] > $max_disporder) {
                $max_disporder = $properties['disporder'][$stylesheet['name']];
            }
            $orders[$stylesheet['name']] = $properties['disporder'][$stylesheet['name']];
        }
        if (!empty($orphaned_stylesheets)) {
            $loop = $max_disporder + 1;
            $max_disporder = $loop;
            foreach ($orphaned_stylesheets as $stylesheet) {
                $orders[$stylesheet] = $loop;
                ++$loop;
            }
        }
        asort($orders);
        $properties['disporder'] = $orders;
        $updated_theme['properties'] = $db->escape_string(my_serialize($properties));
    }
    $db->update_query("themes", $updated_theme, "tid = '{$tid}'");
    // Do we have any children themes that need updating too?
    if (count($child_list) > 0) {
        foreach ($child_list as $id) {
            update_theme_stylesheet_list($id, false, $update_disporders);
        }
    }
    $cache->update_default_theme();
    return true;
}
コード例 #12
0
function thankyoulike_uninstall()
{
    global $mybb, $db;
    $codename = basename(__FILE__, ".php");
    $prefix = 'g33k_' . $codename . '_';
    if ($mybb->request_method != 'post') {
        global $page, $lang;
        $lang->load('config_thankyoulike');
        $page->output_confirm_action('index.php?module=config-plugins&action=deactivate&uninstall=1&plugin=thankyoulike', $lang->tyl_uninstall_message, $lang->tyl_uninstall);
    }
    // Remove templates
    $templatearray = array("thankyoulike", "thankyoulike_classic", "thankyoulike_expcollapse", "thankyoulike_button_add", "thankyoulike_button_del", "thankyoulike_users", "thankyoulike_postbit", "thankyoulike_memprofile");
    $deltemplates = implode("','", $templatearray);
    $db->delete_query("templates", "title in ('{$deltemplates}')");
    $db->delete_query("templategroups", "prefix in ('thankyoulike')");
    // Remove CSS rules for g33k_thankyoulike
    require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
    $db->delete_query("themestylesheets", "name = 'g33k_thankyoulike.css'");
    $query = $db->simple_select("themes", "tid");
    while ($theme = $db->fetch_array($query)) {
        update_theme_stylesheet_list($theme['tid']);
    }
    // This part will remove the database tables
    if (!isset($mybb->input['no'])) {
        if ($db->field_exists('tyl_unumtyls', 'users')) {
            $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP column `tyl_unumtyls`");
        }
        if ($db->field_exists('tyl_unumrcvtyls', 'users')) {
            $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP column `tyl_unumrcvtyls`");
        }
        if ($db->field_exists('tyl_unumptyls', 'users')) {
            $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP column `tyl_unumptyls`");
        }
        if ($db->field_exists('tyl_pnumtyls', 'posts')) {
            $db->query("ALTER TABLE " . TABLE_PREFIX . "posts DROP column `tyl_pnumtyls`");
        }
        if ($db->field_exists('tyl_tnumtyls', 'threads')) {
            $db->query("ALTER TABLE " . TABLE_PREFIX . "threads DROP column `tyl_tnumtyls`");
        }
        if ($db->table_exists($prefix . 'thankyoulike')) {
            $db->drop_table($prefix . 'thankyoulike');
        }
        if ($db->table_exists($prefix . 'stats')) {
            $db->drop_table($prefix . 'stats');
        }
        // Remove ThankYou/Like Promotions Tables Fields
        if ($db->field_exists("thankyoulike", "promotions")) {
            $db->drop_column("promotions", "thankyoulike");
        }
        if ($db->field_exists("thankyouliketype", "promotions")) {
            $db->drop_column("promotions", "thankyouliketype");
        }
    }
}
コード例 #13
0
function latestposts_uninstall()
{
    global $db;
    $query = $db->simple_select("settinggroups", "gid", "name='latestposts'");
    $gid = $db->fetch_field($query, "gid");
    if (!$gid) {
        return;
    }
    $db->delete_query("settinggroups", "name='latestposts'");
    $db->delete_query("settings", "gid={$gid}");
    rebuild_settings();
    require_once MYBB_ROOT . "admin/inc/functions_themes.php";
    // Remove latestposts.css from the theme cache directories if it exists
    $query = $db->simple_select("themes", "tid");
    while ($tid = $db->fetch_field($query, "tid")) {
        $css_file = MYBB_ROOT . "cache/themes/theme{$tid}/latestposts.css";
        if (file_exists($css_file)) {
            unlink($css_file);
        }
    }
    update_theme_stylesheet_list("1", false, true);
}
コード例 #14
0
ファイル: avatarep.php プロジェクト: ambsalinas/anima
function avatarep_deactivate()
{
    //Variables que vamos a utilizar
    global $mybb, $cache, $db;
    // Borrar el grupo de opciones
    $query = $db->simple_select("settinggroups", "gid", "name = 'avatarep'");
    $rows = $db->fetch_field($query, "gid");
    if ($rows) {
        //Eliminamos el grupo de opciones
        $db->delete_query("settinggroups", "gid = {$rows}");
        // Borrar las opciones
        $db->delete_query("settings", "gid = {$rows}");
        $db->delete_query('datacache', "title = 'anno_cache'");
    }
    rebuild_settings();
    //Eliminamos la hoja de estilo creada...
    $db->delete_query('themestylesheets', "name='avatarep.css'");
    $query = $db->simple_select('themes', 'tid');
    while ($theme = $db->fetch_array($query)) {
        require_once MYBB_ADMIN_DIR . 'inc/functions_themes.php';
        update_theme_stylesheet_list($theme['tid']);
    }
    //Archivo requerido para reemplazo de templates
    require MYBB_ROOT . 'inc/adminfunctions_templates.php';
    //Reemplazos que vamos a hacer en las plantillas 1.- Platilla 2.- Contenido a Reemplazar 3.- Contenido que reemplaza lo anterior
    find_replace_templatesets("headerinclude", '#' . preg_quote('<script type="text/javascript" src="{$mybb->settings[\'bburl\']}/images/avatarep/avatarep.js"></script>') . '#', '', 0);
    find_replace_templatesets("forumdisplay_thread", '#' . preg_quote('{$avatarep_avatar[\'avatarep\']}') . '#', '', 0);
    find_replace_templatesets("forumdisplay_thread", '#' . preg_quote('{$avatarep_lastpost[\'avatarep\']}') . '#', '', 0);
    find_replace_templatesets("forumbit_depth2_forum_lastpost", '#^(.*)$#s', '<span class="smalltext">
<a href="{$lastpost_link}" title="{$full_lastpost_subject}"><strong>{$lastpost_subject}</strong></a>
<br />{$lastpost_date}<br />{$lang->by} {$lastpost_profilelink}</span>');
    find_replace_templatesets("forumdisplay_announcements_announcement", '#' . preg_quote('{$anno_avatar[\'avatarep\']}') . '#', '', 0);
    find_replace_templatesets("search_results_threads_thread", '#' . preg_quote('{$avatarep_avatar[\'avatarep\']}') . '#', '', 0);
    find_replace_templatesets("search_results_threads_thread", '#' . preg_quote('{$avatarep_lastpost[\'avatarep\']}') . '#', '', 0);
    find_replace_templatesets("search_results_posts_post", '#' . preg_quote('{$avatarep_avatar[\'avatarep\']}') . '#', '', 0);
    //Delete templates
    $db->delete_query("templates", "title='avatarep_popup'");
    //Se actualiza la info de las plantillas
    $cache->update_forums();
    return true;
}