[ Index ]

PHP Cross Reference of MyBB 1.8.40

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  function upgrade43_dbchanges()
  22  {
  23      global $output, $mybb, $db, $cache;
  24  
  25      $output->print_header("Updating Database");
  26      echo "<p>Performing necessary upgrade queries...</p>";
  27      flush();
  28      
  29      if($mybb->settings['captchaimage'] == 2)
  30      {
  31          $db->update_query('settings', array('value' => 1), "name='captchaimage'"); // Reset CAPTCHA to MyBB Default
  32          $db->update_query('settings', array('value' => ''), 'name IN (\'captchapublickey\', \'captchaprivatekey\')'); // Clean out stored credential keys
  33      }
  34      
  35      if($db->field_exists('aim', 'users'))
  36      {
  37          $db->drop_column('users', 'aim');
  38      }
  39      $db->delete_query("settings", "name='allowaimfield'");
  40  
  41      if($db->field_exists('regex', 'badwords'))
  42      {
  43          $db->drop_column('badwords', 'regex');
  44      }
  45  
  46      switch($db->type)
  47      {
  48          case "pgsql":
  49              $db->add_column("badwords", "regex", "smallint NOT NULL default '0'");
  50              break;
  51          default:
  52              $db->add_column("badwords", "regex", "tinyint(1) NOT NULL default '0'");
  53              break;
  54      }
  55  
  56      $cache->delete("mybb_credits");
  57  
  58      // Add lockout column
  59      if(!$db->field_exists("loginlockoutexpiry", "users"))
  60      {
  61          $db->add_column("users", "loginlockoutexpiry", "int NOT NULL default '0'");
  62      }
  63  
  64      // Unescape last 1000 admin logs
  65      $query = $db->simple_select('adminlog', 'uid, ipaddress, dateline, data', "", array(
  66          "order_by" => 'dateline',
  67          "order_dir" => 'DESC',
  68          "limit" => 1000
  69      ));
  70      while($row = $db->fetch_array($query))
  71      {
  72          $original = $row['data'];
  73          $unescaped = htmlspecialchars_decode($original);
  74  
  75          $uid = (int) $row['uid'];
  76          $ip_address = $db->escape_binary($row['ip_address']);
  77          $dateline = (int) $row['dateline'];
  78  
  79          if ($unescaped !== $original) {
  80              $db->update_query('adminlog', array(
  81                  'data' => $db->escape_string($unescaped),
  82              ), "uid = '".$uid."' AND dateline = '".$dateline."' AND ipaddress = ".$ip_address);
  83          }
  84      }
  85  
  86      $output->print_contents("<p>Click next to continue with the upgrade process.</p>");
  87      $output->print_footer("43_done");
  88  }


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