| [ Index ] |
PHP Cross Reference of MyBB 1.8.40 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * MyBB 1.8 4 * Copyright 2014 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.22 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 upgrade50_dbchanges() 22 { 23 global $output, $cache, $db, $mybb; 24 25 $output->print_header("Updating Database"); 26 27 echo "<p>Updating cache...</p>"; 28 29 $cache->delete("banned"); 30 31 // Moved PM wrong folder correction 32 $db->update_query("privatemessages", array('folder' => 1), "folder='0'"); 33 34 // PM folder structure conversion 35 $db->update_query('users', array('pmfolders' => "0**$%%$1**$%%$2**$%%$3**$%%$4**"), "pmfolders = ''"); 36 switch($db->type) 37 { 38 case "pgsql": 39 case "sqlite": 40 $update = "'0**$%%$' || pmfolders"; 41 break; 42 default: 43 $update = "CONCAT('0**$%%$', pmfolders)"; 44 } 45 $db->write_query("UPDATE ".TABLE_PREFIX."users SET pmfolders=".$update." WHERE pmfolders NOT LIKE '0%'"); 46 47 $db->update_query('settings', array('value' => 1), "name='nocacheheaders'"); 48 49 // Add hCaptcha support 50 echo "<p>Updating settings...</p>"; 51 $db->update_query("settings", array('name' => 'recaptchapublickey'), "name='captchapublickey'"); 52 $db->update_query("settings", array('name' => 'recaptchaprivatekey'), "name='captchaprivatekey'"); 53 $db->update_query("settings", array('optionscode' => 'select\r\n0=No CAPTCHA\r\n1=MyBB Default CAPTCHA\r\n2=reCAPTCHA\r\n3=NoCAPTCHA reCAPTCHA\r\n4=reCAPTCHA invisible\r\n5=hCAPTCHA\r\n6=hCAPTCHA invisible\r\n7=reCAPTCHA v3'), "name='captchaimage'"); 54 55 // If using fulltext then enforce minimum word length given by database 56 if($mybb->settings['minsearchword'] > 0 && $mybb->settings['searchtype'] == "fulltext" && $db->supports_fulltext_boolean("posts") && $db->supports_fulltext("threads")) 57 { 58 // Attempt to determine minimum word length from MySQL for fulltext searches 59 $query = $db->query("SHOW VARIABLES LIKE 'ft_min_word_len';"); 60 $min_length = $db->fetch_field($query, 'Value'); 61 if(is_numeric($min_length) && $mybb->settings['minsearchword'] < $min_length) 62 { 63 $min_length = (int) $min_length; 64 $old_min_length = (int) $mybb->settings['minsearchword']; 65 echo "<p>Updating Minimum Search Word Length setting to match the database system configuration (was {$old_min_length}, now {$min_length})</p>"; 66 $db->update_query("settings", array('value' => $min_length), "name='minsearchword'"); 67 } 68 } 69 70 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 71 $output->print_footer("50_verify_email"); 72 } 73 74 function upgrade50_verify_email() 75 { 76 global $output, $mybb, $errors, $checked; 77 78 $output->print_header("Admin Email"); 79 80 if(!is_array($errors)) 81 { 82 echo "<p>Checking if Admin Email setting is set correctly...</p>"; 83 flush(); 84 } 85 86 if(empty($mybb->settings['adminemail'])) 87 { 88 if(is_array($errors)) 89 { 90 $error_list = "<ul>\n"; 91 foreach($errors as $error) 92 { 93 $error_list .= "<li>{$error}</li>\n"; 94 } 95 $error_list .= "</ul>\n"; 96 echo '<div class="error"> 97 <h3>Error</h3> 98 <p>There seems to be one or more errors with the configuration you supplied:</p> 99 '.$error_list.' 100 <p>Once the above are corrected, continue with the upgrade.</p> 101 </div>'; 102 } 103 else 104 { 105 $checked = array(); 106 } 107 108 echo ' 109 <div class="border_wrapper"> 110 <div class="title">Admin Email</div> 111 112 <table class="general" cellspacing="0"> 113 <thead> 114 <tr> 115 <th colspan="2" class="first last">Please select an option to use for the board\'s outgoing email address.</th> 116 </tr> 117 </thead> 118 <tr class="first" id="userpresetemail_row"> 119 <td class="first"><label for="usepresetemail">Select an option:</label></td> 120 <td class="alt_col last" width="70%"> 121 <input type="radio" name="usepresetemail" value="current_user"'.$checked['current_user'].' />Use current user email: '.htmlspecialchars_uni($mybb->user['email']).'<br />'; 122 123 if($mybb->settings['mail_handler'] == 'smtp' && !empty($mybb->settings['smtp_user']) && filter_var($mybb->settings['smtp_user'], FILTER_VALIDATE_EMAIL) !== false) 124 { 125 echo ' 126 <input type="radio" name="usepresetemail" value="smtp"'.$checked['smtp'].' />Use SMTP username: '.htmlspecialchars_uni($mybb->settings['smtp_user']).'<br />'; 127 } 128 129 echo ' 130 <input type="radio" name="usepresetemail" value="custom"'.$checked['custom'].' />Use custom 131 </td> 132 </tr> 133 <tr class="last" id="custom_adminemail"> 134 <td class="first"><label for="adminemail">Custom Email Address:</label></td> 135 <td class="alt_col last"><input type="text" class="text_input" name="adminemail" id="adminemail" value="'.htmlspecialchars_uni($mybb->input['adminemail']).'" /></td> 136 </tr> 137 </table> 138 </div> 139 <script type="text/javascript"> 140 $("#userpresetemail_row input").change(function() 141 { 142 if(this.checked && this.value == "custom") 143 { 144 $("#custom_adminemail").show(); 145 $("#userpresetemail_row").removeClass("last"); 146 } 147 else 148 { 149 $("#custom_adminemail").hide(); 150 $("#userpresetemail_row").addClass("last"); 151 } 152 }); 153 </script> 154 <p>Once you\'ve correctly entered the details above and are ready to proceed, click Next.</p>'; 155 156 $output->print_footer("50_submit_email"); 157 } 158 else 159 { 160 echo "<p>Admin email verified success...</p>"; 161 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 162 $output->print_footer("50_done"); 163 } 164 } 165 166 function upgrade50_submit_email() 167 { 168 global $output, $db, $mybb, $cache, $errors, $checked; 169 170 if(empty($mybb->input['usepresetemail']) || !in_array($mybb->input['usepresetemail'], array('current_user', 'smtp', 'custom'))) 171 { 172 $errors[] = "Please select an option for the admin email."; 173 } 174 175 if($mybb->input['usepresetemail'] == 'smtp' && !($mybb->settings['mail_handler'] == 'smtp' && !empty($mybb->settings['smtp_user']))) 176 { 177 $errors[] = "Please select a different option. SMTP user setting is not configured."; 178 } 179 180 switch ($mybb->input['usepresetemail']) 181 { 182 case 'current_user': 183 $email = $mybb->user['email']; 184 break; 185 case 'smtp': 186 $email = $mybb->settings['smtp_user']; 187 break; 188 case 'custom': 189 $email = $mybb->input['adminemail']; 190 break; 191 } 192 193 $checked = array( 194 $mybb->input['usepresetemail'] => ' checked="checked"' 195 ); 196 197 if(empty($errors) && filter_var($email, FILTER_VALIDATE_EMAIL) === false) 198 { 199 $errors[] = "The email address given was invalid. Please enter a valid email address."; 200 } 201 202 if(!empty($errors)) 203 { 204 upgrade50_verify_email(); 205 return; 206 } 207 208 $output->print_header("Updating Database"); 209 210 echo "<p>Performing necessary upgrade queries...</p>"; 211 flush(); 212 213 $db->update_query('settings', array('value' => $db->escape_string($email)), "name='adminemail'"); 214 215 $output->print_contents("<p>Click next to continue with the upgrade process.</p>"); 216 $output->print_footer("50_done"); 217 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| 2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup | Cross-referenced by PHPXref |