Ejemplo n.º 1
0
$new_timezone->set_default(0);
$db->alter_field('users', $new_timezone);
$archived_fld = new DBField('archived', 'TINYINT(1)');
$archived_fld->add_extra('NOT NULL');
$archived_fld->set_default(0);
$db->add_field('forums', $archived_fld, 'num_posts');
echo '<li>RV3: Updating database structure... success</li>';
//convert all old timezones (just the UTC offset) to the new technique which uses the entire PHP dictionary
//map all UTC offsets to new timezones
$mappings = array(-12 => 383, -11 => 398, -10 => 53, -9 => 94, -8 => 132, -7 => 162, -6 => 144, -5 => 151, -4 => 84, -3 => 57, -2 => 295, -1 => 8, 0 => 415, 1 => 333, 2 => 327, 3 => 340, 4 => 230, 5 => 244, 6 => 266, 7 => 220, 8 => 271, 9 => 279, 10 => 309, 11 => 399, 12 => 385, 13 => 213);
//I hate mass queries as much as anyone, but they have to be done
foreach ($mappings as $oldtime => $newtime) {
    $db->query('UPDATE `#^users` SET timezone=' . $newtime . ' WHERE timezone=' . $oldtime) or enhanced_error('Failed to update timezone', true);
}
echo '<li>RV3: Converting timezones... success</li>';
ExtensionConfig::add_page('/styles', array('file' => 'style.php', 'template' => false, 'admin' => false, 'mod' => false, 'subdirs' => true));
ExtensionConfig::remove_page('/styles/default.css');
ExtensionConfig::remove_page('/styles/default.css/');
ExtensionConfig::remove_page('/styles/embed.css');
echo '<li>RV3: Adding missing pages... success</li>';
ExtensionConfig::add_language_key('showallposts', 'Show all posts', 'English');
ExtensionConfig::add_language_key('timeformatdesc', 'The following two entries allow you to set the format used for displaying all times by the software. For items that only display the date, the date format is used, but for items that display the time, the date format and time format are joined together. The formats must follow the <a href="http://php.net/manual/en/function.date.php#refsect1-function.date-parameters">PHP guidelines</a>.', 'English');
ExtensionConfig::add_language_key('unknownerror', 'An unknown error occurred', 'English');
ExtensionConfig::add_language_key('specificnestingerror', 'The tag <b>[$1]</b> cannot be placed directly inside <b>[$2]</b>.', 'English');
ExtensionConfig::add_language_key('errorwaslocated', 'The above error was located at: ', 'English');
ExtensionConfig::add_language_key('tagwasopened', 'The <b>[$1]</b> tag was opened at the following location: ', 'English');
ExtensionConfig::add_language_key('archived', '(Archived)', 'English');
ExtensionConfig::add_language_key('dateformat', 'Date format', 'English');
ExtensionConfig::add_language_key('timeformat', 'Time format', 'English');
ExtensionConfig::add_language_key('basegroupon', 'Base new group on:', 'English');
ExtensionConfig::add_language_key('forumalreadyopen', 'You have modified a forum or already have one open for editing. Please refresh the page and then try again.', 'English');
<?php

if ($futurebb_user['language'] != 'English') {
    $error = 'This extension only works in English. Please change your language.';
    return;
}
ExtensionConfig::add_language_key('imageuploading', 'Image Uploading', 'English');
ExtensionConfig::add_page('/extensions/uploadimage', array('file' => 'uploadimage.php', 'template' => false, 'nocontentbox' => true));
if (!file_exists(FORUM_ROOT . '/static/userimages')) {
    mkdir(FORUM_ROOT . '/static/userimages');
}
ExtensionConfig::add_page('/admin/imageuploading', array('file' => 'admin/imageuploading.php', 'template' => true, 'nocontentbox' => true, 'admin' => true));
ExtensionConfig::add_admin_menu('imageuploading', 'imageuploading');
ExtensionConfig::add_page('/myimages', array('file' => 'myimages.php', 'template' => true));
set_config('user_image_maxwidth', 1024);
set_config('user_image_maxheight', 768);
set_config('user_image_maxsize', 512);
$table = new DBTable('userimages');
$new_fld = new DBField('id', 'INT');
$new_fld->add_key('PRIMARY');
$new_fld->add_extra('NOT NULL');
$new_fld->add_extra('AUTO_INCREMENT');
$table->add_field($new_fld);
$new_fld = new DBField('filename', 'VARCHAR(256)');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('user', 'INT');
$new_fld->add_extra('NOT NULL');
$table->add_field($new_fld);
$new_fld = new DBField('ip_addr', 'VARCHAR(50)');
$new_fld->add_extra('NOT NULL');