Esempio n. 1
0
/**
 * Install our theme
 */
function insert_templates()
{
    global $mybb, $output, $cache, $db, $lang;
    require MYBB_ROOT . 'inc/config.php';
    $db = db_connection($config);
    require_once MYBB_ROOT . 'inc/class_datacache.php';
    $cache = new datacache();
    $output->print_header($lang->theme_installation, 'theme');
    echo $lang->theme_step_importing;
    $db->delete_query("themes");
    $db->delete_query("templates");
    $db->delete_query("themestylesheets");
    my_rmdir_recursive(MYBB_ROOT . "cache/themes", array(MYBB_ROOT . "cache/themes/index.html"));
    $insert_array = array('title' => 'Default Templates');
    $templateset = $db->insert_query("templatesets", $insert_array);
    $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
    if (!empty($mybb->config['admin_dir']) && file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) {
        require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions.php";
        require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php";
    } elseif (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) {
        require_once MYBB_ROOT . "admin/inc/functions.php";
        require_once MYBB_ROOT . "admin/inc/functions_themes.php";
    } else {
        $output->print_error("Please make sure your admin directory is uploaded correctly.");
    }
    $theme_id = import_theme_xml($contents, array("templateset" => -2, "version_compat" => 1));
    $tid = build_new_theme("Default", null, $theme_id);
    // Update our properties template set to the correct one
    $query = $db->simple_select("themes", "stylesheets, properties", "tid='{$tid}'", array('limit' => 1));
    $theme = $db->fetch_array($query);
    $properties = my_unserialize($theme['properties']);
    $stylesheets = my_unserialize($theme['stylesheets']);
    $properties['templateset'] = $templateset;
    unset($properties['inherited']['templateset']);
    // 1.8: Stylesheet Colors
    $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme_colors.xml');
    require_once MYBB_ROOT . "inc/class_xml.php";
    $parser = new XMLParser($contents);
    $tree = $parser->get_tree();
    if (is_array($tree) && is_array($tree['colors'])) {
        if (is_array($tree['colors']['scheme'])) {
            foreach ($tree['colors']['scheme'] as $tag => $value) {
                $exp = explode("=", $value['value']);
                $properties['colors'][$exp[0]] = $exp[1];
            }
        }
        if (is_array($tree['colors']['stylesheets'])) {
            $count = count($properties['disporder']) + 1;
            foreach ($tree['colors']['stylesheets']['stylesheet'] as $stylesheet) {
                $new_stylesheet = array("name" => $db->escape_string($stylesheet['attributes']['name']), "tid" => $tid, "attachedto" => $db->escape_string($stylesheet['attributes']['attachedto']), "stylesheet" => $db->escape_string($stylesheet['value']), "lastmodified" => TIME_NOW, "cachefile" => $db->escape_string($stylesheet['attributes']['name']));
                $sid = $db->insert_query("themestylesheets", $new_stylesheet);
                $css_url = "css.php?stylesheet={$sid}";
                $cached = cache_stylesheet($tid, $stylesheet['attributes']['name'], $stylesheet['value']);
                if ($cached) {
                    $css_url = $cached;
                }
                // Add to display and stylesheet list
                $properties['disporder'][$stylesheet['attributes']['name']] = $count;
                $stylesheets[$stylesheet['attributes']['attachedto']]['global'][] = $css_url;
                ++$count;
            }
        }
    }
    $db->update_query("themes", array("def" => 1, "properties" => $db->escape_string(my_serialize($properties)), "stylesheets" => $db->escape_string(my_serialize($stylesheets))), "tid = '{$tid}'");
    echo $lang->theme_step_imported;
    $output->print_footer('configuration');
}
function insert_templates()
{
    global $output, $cache, $db, $lang;
    require MYBB_ROOT . 'inc/config.php';
    $db = db_connection($config);
    require_once MYBB_ROOT . 'inc/class_datacache.php';
    $cache = new datacache();
    $output->print_header($lang->theme_installation, 'theme');
    echo $lang->theme_step_importing;
    $db->delete_query("themes");
    $db->delete_query("templates");
    $db->delete_query("themestylesheets");
    my_rmdir_recursive(MYBB_ROOT . "cache/themes", array(MYBB_ROOT . "cache/themes/index.html"));
    $insert_array = array('title' => 'Default Templates');
    $templateset = $db->insert_query("templatesets", $insert_array);
    $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
    if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) {
        require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions.php";
        require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php";
    } elseif (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) {
        require_once MYBB_ROOT . "admin/inc/functions.php";
        require_once MYBB_ROOT . "admin/inc/functions_themes.php";
    } else {
        $output->print_error("Please make sure your admin directory is uploaded correctly.");
    }
    $theme_id = import_theme_xml($contents, array("templateset" => -2, "version_compat" => 1));
    $tid = build_new_theme("Default", null, $theme_id);
    // Update our properties template set to the correct one
    $query = $db->simple_select("themes", "properties", "tid='{$tid}'", array('limit' => 1));
    $properties = unserialize($db->fetch_field($query, "properties"));
    $properties['templateset'] = $templateset;
    unset($properties['inherited']['templateset']);
    $db->update_query("themes", array("def" => 1, "properties" => $db->escape_string(serialize($properties))), "tid='{$tid}'");
    echo $lang->theme_step_imported;
    $output->print_footer('configuration');
}
Esempio n. 3
0
     }
 } else {
     if (!empty($mybb->input['url'])) {
         // Get the contents
         $contents = @fetch_remote_file($mybb->input['url']);
         if (!$contents) {
             $errors[] = $lang->error_local_file;
         }
     } else {
         // UPLOAD_ERR_NO_FILE
         $errors[] = $lang->error_uploadfailed_php4;
     }
 }
 if (!$errors) {
     $options = array('no_stylesheets' => $mybb->input['import_stylesheets'] ? 0 : 1, 'no_templates' => $mybb->input['import_templates'] ? 0 : 1, 'version_compat' => $mybb->get_input('version_compat', MyBB::INPUT_INT), 'parent' => $mybb->get_input('tid', MyBB::INPUT_INT), 'force_name_check' => true);
     $theme_id = import_theme_xml($contents, $options);
     if ($theme_id > -1) {
         $plugins->run_hooks("admin_style_themes_import_commit");
         // Log admin action
         log_admin_action($theme_id);
         flash_message($lang->success_imported_theme, 'success');
         admin_redirect("index.php?module=style-themes&action=edit&tid=" . $theme_id);
     } else {
         switch ($theme_id) {
             case -1:
                 $errors[] = $lang->error_uploadfailed_nocontents;
                 break;
             case -2:
                 $errors[] = $lang->error_invalid_version;
                 break;
             case -3:
Esempio n. 4
0
function upgrade12_redothemes()
{
    global $db, $output, $config, $mybb;
    $output->print_header("Converting themes");
    if (!@is_dir(MYBB_ROOT . 'cache/')) {
        @mkdir(MYBB_ROOT . 'cache/', 077);
        // Add in empty index.html!
        $fp = @fopen(MYBB_ROOT . "cache/index.html", "w");
        @fwrite($fp, "");
        @fclose($fp);
    }
    $cachewritable = @fopen(MYBB_ROOT . 'cache/test.write', 'w');
    if (!$cachewritable) {
        $not_writable = true;
        @fclose($cachewritable);
    } else {
        @fclose($cachewritable);
        @my_chmod(MYBB_ROOT . 'cache', '0777');
        @my_chmod(MYBB_ROOT . 'cache/test.write', '0777');
        @unlink(MYBB_ROOT . 'cache/test.write');
    }
    if ($not_writable) {
        echo "<p><span style=\"color: red; font-weight: bold;\">Unable to write to the cache/ directory.</span><br />Before the upgrade process can continue you need to make sure this directory exists and is writable (chmod 777)</p>";
        $output->print_footer("12_redothemes");
        exit;
    }
    $not_writable = false;
    if (!@is_dir(MYBB_ROOT . 'cache/themes/')) {
        @mkdir(MYBB_ROOT . 'cache/themes/', 077);
        // Add in empty index.html!
        $fp = @fopen(MYBB_ROOT . "cache/themes/index.html", "w");
        @fwrite($fp, "");
        @fclose($fp);
    }
    $themewritable = @fopen(MYBB_ROOT . 'cache/themes/test.write', 'w');
    if (!$themewritable) {
        $not_writable = true;
        @fclose($themewritable);
    } else {
        @fclose($themewritable);
        @my_chmod(MYBB_ROOT . 'cache/themes', '0777');
        @my_chmod(MYBB_ROOT . 'cache/themes/test.write', '0777');
        @unlink(MYBB_ROOT . 'cache/themes/test.write');
    }
    if ($not_writable) {
        echo "<p><span style=\"color: red; font-weight: bold;\">Unable to write to the cache/themes/ directory.</span><br />Before the upgrade process can continue you need to make sure this directory exists and is writable (chmod 777)</p>";
        $output->print_footer("12_redothemes");
        exit;
    }
    if ($db->field_exists('themebits', "themes") && !$db->field_exists('properties', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes CHANGE themebits properties text NOT NULL");
    }
    if ($db->field_exists('cssbits', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes DROP cssbits");
    }
    if ($db->field_exists('csscached', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes DROP csscached");
    }
    if ($db->field_exists('stylesheets', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes DROP stylesheets");
    }
    $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes ADD stylesheets text NOT NULL AFTER properties");
    if ($db->table_exists("themestylesheets")) {
        $db->drop_table("themestylesheets");
    }
    $db->write_query("CREATE TABLE " . TABLE_PREFIX . "themestylesheets(\n\t\tsid int unsigned NOT NULL auto_increment,\n\t\tname varchar(30) NOT NULL default '',\n\t\ttid int unsigned NOT NULL default '0',\n\t\tattachedto text NOT NULL,\n\t\tstylesheet text NOT NULL,\n\t\tcachefile varchar(100) NOT NULL default '',\n\t\tlastmodified bigint(30) NOT NULL default '0',\n\t\tPRIMARY KEY(sid)\n\t) ENGINE=MyISAM{$collation};");
    // Define our default stylesheets - MyBB 1.4 contains additional stylesheets that our converted themes will also need
    $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
    if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) {
        require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php";
    } else {
        if (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) {
            require_once MYBB_ROOT . "admin/inc/functions_themes.php";
        } else {
            $output->print_error("Please make sure your admin directory is uploaded correctly.");
        }
    }
    // Import master theme
    if (import_theme_xml($contents, array("tid" => 1, "no_templates" => 1, "version_compat" => 1)) === -1) {
        $output->print_error("Please make sure your install/resources/mybb_theme.xml file is uploaded correctly.");
    }
    // Fetch out default stylesheets from master
    $query = $db->simple_select("themes", "*", "tid=1");
    $master_theme = $db->fetch_array($query);
    $master_stylesheets = unserialize($master_theme['stylesheets']);
    if (is_array($master_stylesheets)) {
        // Note: 1.4 only ships with one global|global stylesheet
        foreach ($master_stylesheets as $location => $sheets) {
            foreach ($sheets as $action => $sheets) {
                foreach ($sheets as $stylesheet) {
                    if ($location == "global" && $action == "global") {
                        continue;
                        // Skip global
                    }
                    $default_stylesheets[$location][$action][] = $stylesheet;
                    $default_stylesheets['inherited']["{$location}_{$action}"][$stylesheet] = 1;
                    // This stylesheet is inherited from the master
                }
            }
        }
    }
    $query = $db->simple_select("themes");
    while ($theme = $db->fetch_array($query)) {
        if (!$theme['css']) {
            continue;
        }
        $theme['css'] .= "\n\n" . $theme['extracss'];
        $theme['css'] = upgrade_css_120_to_140($theme['css']);
        // Create stylesheets
        $cache_file = cache_stylesheet($theme['tid'], "global.css", $theme['css']);
        $new_stylesheet = array("tid" => $theme['tid'], "name" => "global.css", "attachedto" => "", "stylesheet" => $db->escape_string($theme['css']), "cachefile" => "global.css", "lastmodified" => TIME_NOW);
        $sid = $db->insert_query("themestylesheets", $new_stylesheet);
        $css_url = "css.php?stylesheet={$sid}";
        if ($cache_file) {
            $css_url = $cache_file;
        }
        // Now we go and update the stylesheets column for this theme
        $stylesheets = $default_stylesheets;
        // Add in our local for this theme
        $stylesheets['global']['global'][] = $css_url;
        // Update the theme
        $db->update_query("themes", array("stylesheets" => $db->escape_string(serialize($stylesheets))), "tid='{$theme['tid']}'");
    }
    if ($db->field_exists('css', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes DROP css");
    }
    if ($db->field_exists('extracss', "themes")) {
        $db->write_query("ALTER TABLE " . TABLE_PREFIX . "themes DROP extracss");
    }
    // We need to replace this for our themes css to show up
    // <link rel="stylesheet" type="text/css" href="{$theme['css_url']}" /> must be present in the old template (it usually is)
    $query = $db->simple_select("templates", "tid,template", "title='headerinclude'");
    while ($template = $db->fetch_array($query)) {
        $template['template'] = str_replace('<link rel="stylesheet" type="text/css" href="{$theme[\'css_url\']}" />', '{$stylesheets}', $template['template']);
        $db->update_query("templates", array('template' => $db->escape_string($template['template'])), "tid='{$template['tid']}'");
    }
    echo "<p>Your themes have successfully been converted to the new theme system.</p>";
    echo "<p>Click next to continue with the upgrade process.</p>";
    global $footer_extra;
    //$footer_extra = "<script type=\"text/javascript\">window.onload = function() { var button = $$('.submit_button'); if(button[0]) { button[0].value = 'Automatically Redirecting...'; button[0].disabled = true; button[0].style.color = '#aaa'; button[0].style.borderColor = '#aaa'; document.forms[0].submit(); }}</script>";
    $output->print_footer("12_done");
}
Esempio n. 5
0
function upgradethemes()
{
    global $output, $db, $system_upgrade_detail, $lang, $mybb;
    $output->print_header($lang->upgrade_templates_reverted);
    $charset = $db->build_create_table_collation();
    if ($system_upgrade_detail['revert_all_templates'] > 0) {
        $db->drop_table("templates");
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "templates (\n\t\t  tid int unsigned NOT NULL auto_increment,\n\t\t  title varchar(120) NOT NULL default '',\n\t\t  template text NOT NULL,\n\t\t  sid int(10) NOT NULL default '0',\n\t\t  version varchar(20) NOT NULL default '0',\n\t\t  status varchar(10) NOT NULL default '',\n\t\t  dateline int(10) NOT NULL default '0',\n\t\t  PRIMARY KEY  (tid)\n\t\t) ENGINE=MyISAM{$charset};");
    }
    if ($system_upgrade_detail['revert_all_themes'] > 0) {
        $db->drop_table("themes");
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "themes (\n\t\t tid smallint unsigned NOT NULL auto_increment,\n\t\t name varchar(100) NOT NULL default '',\n\t\t pid smallint unsigned NOT NULL default '0',\n\t\t def smallint(1) NOT NULL default '0',\n\t\t properties text NOT NULL,\n\t\t stylesheets text NOT NULL,\n\t\t allowedgroups text NOT NULL,\n\t\t PRIMARY KEY (tid)\n\t\t) ENGINE=MyISAM{$charset};");
        $db->drop_table("themestylesheets");
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "themestylesheets(\n\t\t\tsid int unsigned NOT NULL auto_increment,\n\t\t\tname varchar(30) NOT NULL default '',\n\t\t\ttid int unsigned NOT NULL default '0',\n\t\t\tattachedto text NOT NULL,\n\t\t\tstylesheet text NOT NULL,\n\t\t\tcachefile varchar(100) NOT NULL default '',\n\t\t\tlastmodified bigint(30) NOT NULL default '0',\n\t\t\tPRIMARY KEY(sid)\n\t\t) ENGINE=MyISAM{$charset};");
        $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
        if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) {
            require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions.php";
            require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php";
        } else {
            if (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) {
                require_once MYBB_ROOT . "admin/inc/functions.php";
                require_once MYBB_ROOT . "admin/inc/functions_themes.php";
            } else {
                $output->print_error("Upewnij się, że katalog /admin został poprawnie załadowany na serwer.");
            }
        }
        import_theme_xml($contents, array("templateset" => -2, "no_templates" => 1, "version_compat" => 1));
        $tid = build_new_theme("Default", null, 1);
        $db->update_query("themes", array("def" => 1), "tid='{$tid}'");
        $db->update_query("users", array('style' => $tid));
        $db->update_query("forums", array('style' => 0));
        $db->drop_table("templatesets");
        $db->write_query("CREATE TABLE " . TABLE_PREFIX . "templatesets (\n\t\t  sid smallint unsigned NOT NULL auto_increment,\n\t\t  title varchar(120) NOT NULL default '',\n\t\t  PRIMARY KEY  (sid)\n\t\t) ENGINE=MyISAM{$charset};");
        $db->insert_query("templatesets", array('title' => 'Default Templates'));
    } else {
        // Re-import master
        $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
        if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) {
            require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php";
        } else {
            if (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) {
                require_once MYBB_ROOT . "admin/inc/functions_themes.php";
            } else {
                $output->print_error();
            }
        }
        // Import master theme
        import_theme_xml($contents, array("tid" => 1, "no_templates" => 1, "version_compat" => 1));
    }
    $sid = -2;
    // Now deal with the master templates
    $contents = @file_get_contents(INSTALL_ROOT . 'resources/mybb_theme.xml');
    $parser = new XMLParser($contents);
    $tree = $parser->get_tree();
    $theme = $tree['theme'];
    if (is_array($theme['templates'])) {
        $templates = $theme['templates']['template'];
        foreach ($templates as $template) {
            $templatename = $db->escape_string($template['attributes']['name']);
            $templateversion = intval($template['attributes']['version']);
            $templatevalue = $db->escape_string($template['value']);
            $time = TIME_NOW;
            $query = $db->simple_select("templates", "tid", "sid='-2' AND title='" . $db->escape_string($templatename) . "'");
            $oldtemp = $db->fetch_array($query);
            if ($oldtemp['tid']) {
                $update_array = array('template' => $templatevalue, 'version' => $templateversion, 'dateline' => $time);
                $db->update_query("templates", $update_array, "title='" . $db->escape_string($templatename) . "' AND sid='-2'");
            } else {
                $insert_array = array('title' => $templatename, 'template' => $templatevalue, 'sid' => $sid, 'version' => $templateversion, 'dateline' => $time);
                $db->insert_query("templates", $insert_array);
                ++$newcount;
            }
        }
    }
    $output->print_contents($lang->upgrade_templates_reverted_success);
    $output->print_footer("rebuildsettings");
}
Esempio n. 6
0
function gomobile_install()
{
    global $db, $mybb;
    // Clean up the database before installing
    // MyBB tables cleanup
    if ($db->field_exists("mobile", "posts")) {
        $db->query("ALTER TABLE " . TABLE_PREFIX . "posts DROP COLUMN mobile");
    }
    if ($db->field_exists("mobile", "threads")) {
        $db->query("ALTER TABLE " . TABLE_PREFIX . "threads DROP COLUMN mobile");
    }
    if ($db->field_exists("usemobileversion", "users")) {
        $db->query("ALTER TABLE " . TABLE_PREFIX . "users DROP COLUMN usemobileversion");
    }
    // Settings cleanup
    $db->query("DELETE FROM " . TABLE_PREFIX . "settinggroups WHERE name='gomobile'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_header_text'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_theme_id'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_permstoggle'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_homename'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_homelink'");
    $db->query("DELETE FROM " . TABLE_PREFIX . "settings WHERE name='gomobile_strings'");
    // Add a column to the posts & threads tables for tracking mobile posts
    $db->query("ALTER TABLE " . TABLE_PREFIX . "posts ADD mobile int NOT NULL default '0'");
    $db->query("ALTER TABLE " . TABLE_PREFIX . "threads ADD mobile int NOT NULL default '0'");
    // And another to the users table for options
    $db->query("ALTER TABLE " . TABLE_PREFIX . "users ADD usemobileversion int NOT NULL default '1'");
    // First, check that our theme doesn't already exist
    $query = $db->simple_select("themes", "tid", "LOWER(name) LIKE '%mybb gomobile%'");
    if ($db->num_rows($query)) {
        // Theme is already installed
        $theme = $db->fetch_field($query, "tid");
    } else {
        // Import the theme for our users
        $theme = MYBB_ROOT . "inc/plugins/gomobile_theme.xml";
        if (!file_exists($theme)) {
            flash_message("Upload the GoMobile Theme XML to the plugin directory (./inc/plugins/) before continuing.", "error");
            admin_redirect("index.php?module=config/plugins");
        }
        $contents = @file_get_contents($theme);
        if ($contents) {
            $options = array('no_stylesheets' => 0, 'no_templates' => 0, 'version_compat' => 1, 'parent' => 1, 'force_name_check' => true);
            require_once MYBB_ADMIN_DIR . "inc/functions_themes.php";
            $theme = import_theme_xml($contents, $options);
        }
    }
    // Default strings
    $strings = "\niPhone\niPod\niPhone\niPad\nMobile\nAndroid\nPresto\nOpera Mini\nOpera Mobi\nIEMobile\nWindows Phone\nHTC\nNokia\nNetfront\nSmartPhone\nSymbian\nSonyEricsson\nAvantGo\nDoCoMo\nPre/\nUP.Browser\nPlaystation Vita\nBlazer\nBolt\nDoris\nDorothy";
    // Edit existing templates (shows when posts are from GoMobile)
    require_once MYBB_ROOT . "inc/adminfunctions_templates.php";
    find_replace_templatesets("postbit_posturl", '#' . preg_quote('<span') . '#', '<img src="{$mybb->settings[\'bburl\']}/images/mobile/posted_{$post[\'mobile\']}.gif" alt="" width="{$post[\'mobile\']}8" height="{$post[\'mobile\']}8" title="{$lang->gomobile_posted_from}" style="vertical-align: middle;" /> ' . '<span');
    // Prepare to insert the settings
    $setting_group = array("gid" => 0, "name" => "gomobile", "title" => "GoMobile Settings", "description" => "Options, settings and strings used by MyBB GoMobile.", "disporder" => 1, "isdefault" => 0);
    $gid = $db->insert_query("settinggroups", $setting_group);
    $dispnum = 0;
    global $lang;
    $lang->load("../gomobile");
    $settings = array("gomobile_mobile_name" => array("title" => $lang->gomobile_settings_mobile_name_title, "description" => $lang->gomobile_settings_mobile_name, "optionscode" => "text", "value" => $db->escape_string($mybb->settings['bbname']), "disporder" => ++$dispnum), "gomobile_theme_id" => array("title" => $lang->gomobile_settings_theme_id_title, "description" => $lang->gomobile_settings_theme_id, "optionscode" => "text", "value" => $theme, "disporder" => ++$dispnum), "gomobile_permstoggle" => array("title" => $lang->gomobile_settings_permstoggle_title, "description" => $lang->gomobile_settings_permstoggle, "optionscode" => "yesno", "value" => 0, "disporder" => ++$dispnum), "gomobile_homename" => array("title" => $lang->gomobile_settings_homename_title, "description" => $lang->gomobile_settings_homename, "optionscode" => "text", "value" => $db->escape_string($mybb->settings['homename']), "disporder" => ++$dispnum), "gomobile_homelink" => array("title" => $lang->gomobile_settings_homelink_title, "description" => $lang->gomobile_settings_homelink, "optionscode" => "text", "value" => $db->escape_string($mybb->settings['homeurl']), "disporder" => ++$dispnum), "gomobile_strings" => array("title" => $lang->gomobile_settings_strings_title, "description" => $lang->gomobile_settings_strings, "optionscode" => "textarea", "value" => $db->escape_string($strings), "disporder" => ++$dispnum));
    // Insert the settings listed above
    foreach ($settings as $name => $setting) {
        $setting['gid'] = $gid;
        $setting['name'] = $name;
        $db->insert_query("settings", $setting);
    }
    rebuild_settings();
}