[ Index ]

PHP Cross Reference of MyBB

title

Body

[close]

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

   1  <?php
   2  /**
   3   * MyBB 1.6
   4   * Copyright 2010 MyBB Group, All Rights Reserved
   5   *
   6   * Website: http://www.mybboard.com
   7   * License: http://mybb.com/about/license
   8   *
   9   * $Id$
  10   */
  11  
  12  /**
  13   * Upgrade Script: 1.2.10 or 1.2.11
  14   */
  15  
  16  
  17  $upgrade_detail = array(
  18      "revert_all_templates" => 0,
  19      "revert_all_themes" => 0,
  20      "revert_all_settings" => 0
  21  );
  22  
  23  @set_time_limit(0);
  24  
  25  function upgrade11_dbchanges()
  26  {
  27      global $db, $output, $mybb;
  28  
  29      $output->print_header("Performing Queries");
  30  
  31      echo "<p>Performing necessary upgrade queries..</p>";
  32  
  33      $query = $db->simple_select("templates", "*", "title IN ('showthread_inlinemoderation','showthread_ratethread','editpost','newreply','usercp_drafts','newthread','usercp_options','forumdisplay_inlinemoderation','report','private_empty','usercp_profile','usercp_attachments','usercp_usergroups_joingroup','usercp_avatar','usercp_avatar_gallery','usercp_usergroups_memberof','managegroup','managegroup_adduser','managegroup_joinrequests','private_send','polls_editpoll','private_archive','calendar_addevent','moderation_inline_deleteposts','private_tracking','moderation_threadnotes','showthread_quickreply','member_emailuser','moderation_reports','member_login','index_loginform','moderation_deletethread','moderation_mergeposts','polls_newpoll','member_register_agreement','usercp_password','usercp_email','reputation_add','moderation_deletepoll','usercp_changeavatar','usercp_notepad','member_resetpassword','member_lostpw','usercp_changename','moderation_deleteposts','moderation_split','sendthread','usercp_editsig','private_read','error_nopermission','private_folders','moderation_move','moderation_merge','member_activate','usercp_editlists','calendar_editevent','member_resendactivation','moderation_inline_deletethreads','moderation_inline_movethreads','moderation_inline_mergeposts','moderation_inline_splitposts','member_register','showthread_moderationoptions','headerinclude','private','forumdisplay_threadlist_inlineedit_js')");
  34      while($template = $db->fetch_array($query))
  35      {
  36          if($template['title'] == "private_read")
  37          {
  38              $template['template'] = str_replace("private.php?action=delete&amp;pmid={\$pm['pmid']}", "private.php?action=delete&amp;pmid={\$pm['pmid']}&amp;my_post_key={\$mybb->post_code}", $template['template']);
  39          }
  40          elseif($template['title'] == "showthread_moderationoptions")
  41          {
  42              $template['template'] = str_replace('<input type="hidden" name="modtype" value="thread" />', '<input type="hidden" name="my_post_key" value="{$mybb->post_code}" />
  43  <input type="hidden" name="modtype" value="thread" />', $template['template']);
  44              
  45              $template['template'] = str_replace('moderation.php?action=\'+this.options[this.selectedIndex].value+\'&amp;tid={$tid}&amp;modtype=thread', 'moderation.php?action=\'+this.options[this.selectedIndex].value+\'&amp;tid={$tid}&amp;modtype=thread&amp;my_post_key={$mybb->post_code}', $template['template']);
  46          }
  47          elseif($template['title'] == "headerinclude")
  48          {
  49              $template['template'] = str_replace('var cookieDomain = "{$mybb->settings[\'cookiedomain\']}";', 'var my_post_key = \'{$mybb->post_code}\';
  50  var cookieDomain = "{$mybb->settings[\'cookiedomain\']}";', $template['template']);
  51          }
  52          elseif($template['title'] == "forumdisplay_threadlist_inlineedit_js")
  53          {
  54              $template['template'] = str_replace('"xmlhttp.php?action=edit_subject"', '"xmlhttp.php?action=edit_subject&my_post_key="+my_post_key', $template['template']);
  55          }
  56          else
  57          {
  58              // Remove any duplicates
  59              $template['template'] = str_replace("<input type=\"hidden\" name=\"my_post_key\" value=\"{\$mybb->post_code}\" />", "", $template['template']);
  60              
  61              $template['template'] = preg_replace("#<form(.*?)method\=\\\"post\\\"(.*?)>#i", "<form$1method=\"post\"$2>\n<input type=\"hidden\" name=\"my_post_key\" value=\"{\$mybb->post_code}\" />", $template['template']);
  62          }
  63          
  64          // Update MyBB Javascript versions (to clear cache)
  65          $template['template'] = str_replace("?ver=121", "?ver=1212", $template['template']);
  66          
  67          $db->update_query("templates", array('template' => $db->escape_string($template['template']), 'version' => '1212'), "tid='{$template['tid']}'", 1);
  68      }
  69  
  70      $contents .= "Click next to continue with the upgrade process.</p>";
  71      $output->print_contents($contents);
  72      $output->print_footer("11_done");
  73  }
  74  
  75  ?>


Generated: Tue Oct 8 19:19:50 2013 Cross-referenced by PHPXref 0.7.1