- Timestamp:
- Dec 1, 2010, 2:20:46 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/extras/wp_plugin/xpressme-backup/xpressme-backup.php
r675 r677 154 154 update_option('xpressme_backup_excs', array('revisions' => $exc_revisions, 'spam' => $exc_spam)); 155 155 156 $do_euc_to_utf8 = $_POST[' euc_to_utf8'];156 $do_euc_to_utf8 = $_POST['do_euc_to_utf8']; 157 157 $do_rename_prefix = $_POST['do_rename_prefix']; 158 158 $before_prefix = $_POST['before_prefix']; … … 162 162 $after_uri = $_POST['after_uri']; 163 163 $del_active_plugin = $_POST['del_active_plugin']; 164 $set_default_role = $_POST['set_default_role']; 164 165 165 166 update_option('xpressme_backup_extras_option', … … 171 172 'before_uri' => $before_uri, 172 173 'after_uri' => $after_uri, 173 'del_active_plugin' => $del_active_plugin 174 'del_active_plugin' => $del_active_plugin, 175 'set_default_role' => $set_default_role 174 176 ) 175 177 ); … … 1079 1081 1080 1082 function backup_menu() { 1081 global $table_prefix, $wpdb ;1083 global $table_prefix, $wpdb,$wp_version; 1082 1084 $feedback = ''; 1083 1085 $whoops = false; … … 1279 1281 <ul> 1280 1282 <?php 1283 $extras_option = (array) get_option('xpressme_backup_extras_option'); 1281 1284 if(WPLANG == 'ja_EUC'){ 1282 1285 echo '<li><label for="do_euc_to_utf8">'; 1283 1286 if($this->is_mbstring()){ 1284 echo '<input type="checkbox" name="euc_to_utf8" id="euc_to_utf8" value="1" />'; 1287 if ($extras_option['do_euc_to_utf8']) $checked = 'checked'; else $checked = ''; 1288 echo '<input type="checkbox" name="do_euc_to_utf8" id="do_euc_to_utf8" value="1" ' .$checked .' />'; 1285 1289 echo __('Converte EUC-JP to UTF-8','xpressme-backup'); 1286 1290 } else { 1287 echo '<input type="checkbox" name=" euc_to_utf8" id="euc_to_utf8" value="1" disabled="1"/>';1291 echo '<input type="checkbox" name="do_euc_to_utf8" id="do_euc_to_utf8" value="0" disabled="1"/>'; 1288 1292 echo __('Converte EUC-JP to UTF-8','xpressme-backup'); 1289 1293 echo ' (<span style="color:#ff0000">' . __('The server used does not support the mb_convert_encoding() function.','xpressme-backup') . '</span>)'; … … 1291 1295 echo '</label></li>'; 1292 1296 } else { 1293 echo '<input type="hidden" name="euc_to_utf8" id="euc_to_utf8" value="0" />'; 1294 } 1297 echo '<input type="hidden" name="do_euc_to_utf8" id="do_euc_to_utf8" value="0" />'; 1298 } 1299 if($wp_version =='2.0.11-ME'){ 1300 echo '<li><label for="set_default_role">'; 1301 if ($extras_option['set_default_role']) $checked = 'checked'; else $checked = ''; 1302 echo '<input type="checkbox" name="set_default_role" id="set_default_role" value="1" '.$checked . ' />'; 1303 echo __('Changes from the user roles name of WordPressME to the user roles name of Wordpress.','xpressme-backup'); 1304 echo '</label></li>'; 1305 } else { 1306 echo '<input type="hidden" name="set_default_role" id="set_default_role" value="0" />'; 1307 } 1308 1309 echo '<li><label for="rename_prefix">'; 1310 if ($extras_option['do_rename_prefix']) $checked = 'checked'; else $checked = ''; 1311 echo '<input type="checkbox" name="do_rename_prefix" id="do_rename_prefix" value="1" '. $checked . ' />'; 1312 echo __('Rename DB Prefix','xpressme-backup'); 1313 echo '<input type="text" name="before_prefix" size="20" value="'.$table_prefix . '" readonly />'; 1314 echo __('to','xpressme-backup'); 1315 if (empty($extras_option['after_prefix'])){ 1316 echo '<input type="text" name="after_prefix" size="20" value="'. $table_prefix . '" />'; 1317 } else { 1318 echo '<input type="text" name="after_prefix" size="20" value="'. $extras_option['after_prefix'] . '" />'; 1319 } 1320 echo '</label></li>'; 1321 echo '<li><label for="change_uri">'; 1322 if ($extras_option['do_change_uri']) $checked = 'checked'; else $checked = ''; 1323 echo '<input type="checkbox" name="do_change_uri" id="do_change_uri" value="1" '. $checked . ' />'; 1324 $site_uri = get_option('siteurl'); 1325 echo __('Change URL','xpressme-backup'); 1326 echo '<div style="padding-left: 20px;">'; 1327 echo '<input type="text" name="before_uri" size="50" value="' . $site_uri . '" readonly /><br />'; 1328 echo __('to','xpressme-backup') . '<br />'; 1329 echo '<input type="text" name="after_uri" size="50" value="'. $extras_option['after_uri'] . '" />'; 1330 echo '</div>'; 1331 echo '</label></li>'; 1332 echo '<li><label for="del_active_plugin">'; 1333 if ($extras_option['del_active_plugin']) $checked = 'checked'; else $checked = ''; 1334 1335 echo '<input type="checkbox" name="del_active_plugin" id="del_active_plugin" value="1" '. $checked . ' />'; 1336 echo __('In the backup data,all plug-ins are Deactivate state.','xpressme-backup'); 1337 echo '</label></li>'; 1295 1338 ?> 1296 <li><label for="rename_prefix">1297 <input type="checkbox" name="do_rename_prefix" id="do_rename_prefix" value="1" />1298 <?php _e('Rename DB Prefix','xpressme-backup'); ?>1299 <input type="text" name="before_prefix" size="20" value="<?php echo $table_prefix; ?>" />1300 <?php _e('to','xpressme-backup'); ?>1301 <input type="text" name="after_prefix" size="20" value="<?php echo $table_prefix; ?>" />1302 </label></li>1303 <li><label for="change_uri">1304 <input type="checkbox" name="do_change_uri" id="do_change_uri" value="1" />1305 <?php $site_uri = get_option('siteurl');?>1306 <?php _e('Change URL','xpressme-backup'); ?>1307 <div style="padding-left: 20px;">1308 <input type="text" name="before_uri" size="50" value="<?php echo $site_uri; ?>" /><br />1309 <?php _e('to','xpressme-backup'); ?><br />1310 <input type="text" name="after_uri" size="50" value="<?php echo $site_uri; ?>" />1311 </div>1312 </label></li>1313 <li><label for="set_default_role">1314 <input type="checkbox" name="set_default_role" id="set_default_role" value="1" />1315 <?php _e('user_role is corrected to upgrade.','xpressme-backup'); ?>1316 </label></li>1317 <li><label for="del_active_plugin">1318 <input type="checkbox" name="del_active_plugin" id="del_active_plugin" value="1" />1319 <?php _e('In the backup data,all plug-ins are Deactivate state.','xpressme-backup'); ?>1320 </label></li>1321 1339 </ul> 1322 1340 … … 1522 1540 function extras_filter($query_line){ 1523 1541 $extras_option = get_option('xpressme_backup_extras_option'); 1542 1543 // Change EUC to UTF-8 1524 1544 if ($extras_option['do_euc_to_utf8'] && $this->is_mbstring()){ 1525 1545 $query_line = mb_convert_encoding(mb_convert_encoding($query_line,"sjis-win","EUC-JP"),"UTF-8","sjis-win"); … … 1553 1573 1554 1574 $src = '/' . $org . '/'; 1555 // $dist = '*************************************s:' . $num . '->' . $volm . '"' . $str . '"';1556 1575 $dist = 's:'. $volm . ':"' . $str . '";'; 1557 1576 if(preg_match($src,$query_line)){ … … 1568 1587 } 1569 1588 } 1589 1590 // Change Data Prefix 1570 1591 if ($extras_option['do_rename_prefix']){ 1571 1592 if (!empty($extras_option['before_prefix']) && !empty($extras_option['after_prefix'])){ … … 1577 1598 } 1578 1599 } 1600 1601 // Change User_Role_Name(WordPressME to Wordpress) 1602 if ($extras_option['set_default_role']){ 1603 $src = '/' . "(INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, '.+_user_roles', 'Y', [0-9]+, ')(a:.+}}})('.+\);)" . '/'; 1604 if(preg_match($src,$query_line)){ 1605 $patterns = array(); 1606 $patterns[0] = '/s:[0-9]+:"[^"]+ - \(Administrator\)"/'; 1607 $patterns[1] = '/s:[0-9]+:"[^"]+ - \(Editor\)"/'; 1608 $patterns[2] = '/s:[0-9]+:"[^"]+ - \(Author\)"/'; 1609 $patterns[3] = '/s:[0-9]+:"[^"]+ - \(Contributor\)"/'; 1610 $patterns[4] = '/s:[0-9]+:"[^"]+ - \(Subscriber\)"/'; 1611 $replacements = array(); 1612 $replacements[0] = 's:13:"Administrator"'; 1613 $replacements[1] = 's:6:"Editor"'; 1614 $replacements[2] = 's:6:"Author"'; 1615 $replacements[3] = 's:11:"Contributor"'; 1616 $replacements[4] = 's:10:"Subscriber"'; 1617 $ans = preg_replace($patterns,$replacements,$query_line); 1618 if (!empty($ans)) $query_line = $ans; 1619 } 1620 } 1621 1622 // Change URI Clear 1579 1623 if ($extras_option['do_change_uri']){ 1580 1624 if (!empty($extras_option['before_uri']) && !empty($extras_option['after_uri'])){ … … 1585 1629 if(preg_match($src,$query_line)){ 1586 1630 $query_line = preg_replace($src,$dist,$query_line); 1587 } 1588 } 1589 } 1590 1631 1632 } 1633 } 1634 } 1635 1636 // Active Plugin Clear 1591 1637 if ($extras_option['del_active_plugin']){ 1592 1638 $src = '/' . "(INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, 'active_plugins', 'Y', [0-9]+, ')(a:.+})('.+\);)" . '/'; … … 1599 1645 } 1600 1646 } 1647 1648 // XPressME Buckup Option Data Clear 1649 $src = '/' . "INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, 'xpressme_backup_excs'" . '/'; 1650 if(preg_match($src,$query_line)){ 1651 $query_line = "\n# Skip XPressME Buckup 'xpressme_backup_excs' Option Data\n"; 1652 } 1653 $src = '/' . "INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, 'xpressme_backup_extras_option'" . '/'; 1654 if(preg_match($src,$query_line)){ 1655 $query_line = "\n# Skip XPressME Buckup 'xpressme_backup_extras_option' Option Data\n"; 1656 } 1657 1601 1658 return $query_line; 1602 1659
Note: See TracChangeset
for help on using the changeset viewer.