[ Index ]

PHP Cross Reference of MyBB 1.8.37

title

Body

[close]

/install/resources/ -> upgrade43.php (source)

   1  <?php
   2  /**
   3   * MyBB 1.8
   4   * Copyright 2018 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybb.com
   7   * License: http://www.mybb.com/about/license
   8   *
   9   */
  10  
  11  /**
  12   * Upgrade Script: 1.8.15
  13   */
  14  
  15  $upgrade_detail = array(
  16      "revert_all_templates" => 0,
  17      "revert_all_themes" => 0,
  18      "revert_all_settings" => 0
  19  );
  20  
  21  @set_time_limit(0);
  22  
  23  function upgrade43_dbchanges()
  24  {
  25      global $output, $mybb, $db, $cache;
  26  
  27      $output->print_header("Updating Database");
  28      echo "<p>Performing necessary upgrade queries...</p>";
  29      flush();
  30      
  31      if($mybb->settings['captchaimage'] == 2)
  32      {
  33          $db->update_query('settings', array('value' => 1), "name='captchaimage'"); // Reset CAPTCHA to MyBB Default
  34          $db->update_query('settings', array('value' => ''), 'name IN (\'captchapublickey\', \'captchaprivatekey\')'); // Clean out stored credential keys
  35      }
  36      
  37      if($db->field_exists('aim', 'users'))
  38      {
  39          $db->drop_column('users', 'aim');
  40      }
  41      $db->delete_query("settings", "name='allowaimfield'");
  42  
  43      if($db->field_exists('regex', 'badwords'))
  44      {
  45          $db->drop_column('badwords', 'regex');
  46      }
  47  
  48      switch($db->type)
  49      {
  50          case "pgsql":
  51              $db->add_column("badwords", "regex", "smallint NOT NULL default '0'");
  52              break;
  53          default:
  54              $db->add_column("badwords", "regex", "tinyint(1) NOT NULL default '0'");
  55              break;
  56      }
  57  
  58      $cache->delete("mybb_credits");
  59  
  60      // Add lockout column
  61      if(!$db->field_exists("loginlockoutexpiry", "users"))
  62      {
  63          $db->add_column("users", "loginlockoutexpiry", "int NOT NULL default '0'");
  64      }
  65  
  66      // Unescape last 1000 admin logs
  67      $query = $db->simple_select('adminlog', 'uid, ipaddress, dateline, data', "", array(
  68          "order_by" => 'dateline',
  69          "order_dir" => 'DESC',
  70          "limit" => 1000
  71      ));
  72      while($row = $db->fetch_array($query))
  73      {
  74          $original = $row['data'];
  75          $unescaped = htmlspecialchars_decode($original);
  76  
  77          $uid = (int) $row['uid'];
  78          $ip_address = $db->escape_binary($row['ip_address']);
  79          $dateline = (int) $row['dateline'];
  80  
  81          if ($unescaped !== $original) {
  82              $db->update_query('adminlog', array(
  83                  'data' => $db->escape_string($unescaped),
  84              ), "uid = '".$uid."' AND dateline = '".$dateline."' AND ipaddress = ".$ip_address);
  85          }
  86      }
  87  
  88      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  89      $output->print_footer("43_done");
  90  }


2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref