- Timestamp:
- Nov 30, 2010, 4:02:23 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/extras/wp_plugin/xpressme-backup/xpressme-backup.php
r666 r673 6 6 Author: toemon 7 7 Author URI: http://ja.xpressme.info 8 Version: 1. 08 Version: 1.2 9 9 10 10 Originally modified from Austin Matzko's WordPress Database Backup(http://www.ilfilosofo.com/blog/wp-db-backup) plugin. … … 161 161 $before_uri = $_POST['before_uri']; 162 162 $after_uri = $_POST['after_uri']; 163 163 $set_default_role = $_POST['set_default_role']; 164 $del_active_plugin = $_POST['del_active_plugin']; 165 164 166 update_option('xpressme_backup_extras_option', 165 167 array('do_euc_to_utf8' => $do_euc_to_utf8, … … 169 171 'do_change_uri' => $do_change_uri, 170 172 'before_uri' => $before_uri, 171 'after_uri' => $after_uri 173 'after_uri' => $after_uri, 174 'set_default_role' => $set_default_role, 175 'del_active_plugin' => $del_active_plugin 172 176 ) 173 177 ); … … 1274 1278 </label></li> 1275 1279 </ul> 1276 <p><?php _e(' Backup Ditaile Options','xpressme-backup'); ?></p>1280 <p><?php _e('Data conversion option.','xpressme-backup'); ?></p> 1277 1281 <ul> 1278 1282 <?php … … 1309 1313 </div> 1310 1314 </label></li> 1315 <li><label for="set_default_role"> 1316 <input type="checkbox" name="set_default_role" id="set_default_role" value="1" /> 1317 <?php _e('user_role is corrected to upgrade.','xpressme-backup'); ?> 1318 </label></li> 1319 <li><label for="del_active_plugin"> 1320 <input type="checkbox" name="del_active_plugin" id="del_active_plugin" value="1" /> 1321 <?php _e('In the backup data,all plug-ins are Deactivate state.','xpressme-backup'); ?> 1322 </label></li> 1311 1323 </ul> 1324 1312 1325 <?php if ( ! $whoops ) : ?> 1313 1326 <input type="hidden" name="do_backup" id="do_backup" value="backup" /> … … 1543 1556 $src = '/' . $org . '/'; 1544 1557 // $dist = '*************************************s:' . $num . '->' . $volm . '"' . $str . '"'; 1545 $dist = 's:'. $volm . ' "' . $str . '"';1558 $dist = 's:'. $volm . ':"' . $str . '"'; 1546 1559 if(preg_match($src,$query_line)){ 1547 1560 $query_line = preg_replace($src,$dist,$query_line); … … 1549 1562 } 1550 1563 } 1564 } 1565 $seach = "/'blog_charset'.*'EUC-JP'/"; 1566 $src = "/'EUC-JP'/"; 1567 $dist = "'UTF-8'"; 1568 if(preg_match($seach,$query_line)){ 1569 $query_line = preg_replace($src,$dist,$query_line); 1551 1570 } 1552 1571 } … … 1571 1590 } 1572 1591 } 1573 $seach = "/'blog_charset'.*'EUC-JP'/"; 1574 $src = "/'EUC-JP'/"; 1575 $dist = "'UTF-8'"; 1576 if(preg_match($seach,$query_line)){ 1577 $query_line = preg_replace($src,$dist,$query_line); 1592 if ($extras_option['set_default_role']){ 1593 $src = '/' . "(INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, '.+_user_roles', 'Y', [0-9]+, ')(a:.+}}})('.+\);)" . '/'; 1594 if(preg_match($src,$query_line,$matches)){ 1595 $query_line = "\n" . $matches[1] . $this->get_default_usr_role() . $matches[3]; 1596 } 1597 } 1598 if ($extras_option['del_active_plugin']){ 1599 $src = '/' . "(INSERT INTO `.+_options` VALUES \([0-9]+, [0-9]+, 'active_plugins', 'Y', [0-9]+, ')(a:.+})('.+\);)" . '/'; 1600 if(preg_match($src,$query_line,$matches)){ 1601 if(preg_match('/xpressme\/xpressme.php/',$matches[2])){ 1602 $query_line = "\n" . $matches[1] . 'a:1:{i:0;s:21:"xpressme/xpressme.php";}' . $matches[3]; 1603 } else { 1604 $query_line = "\n" . $matches[1] . 'a:0:{}' . $matches[3]; 1605 } 1606 } 1578 1607 } 1579 1608 return $query_line; 1609 1580 1610 } 1581 1611 function is_mbstring(){ 1582 1612 return function_exists('mb_convert_encoding'); 1583 1613 } 1584 1614 function get_default_usr_role(){ 1615 $role = 'a:5:{s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:62:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;s:11:"update_core";b:1;s:10:"list_users";b:1;s:12:"remove_users";b:1;s:9:"add_users";b:1;s:13:"promote_users";b:1;s:18:"edit_theme_options";b:1;s:13:"delete_themes";b:1;s:6:"export";b:1;}}s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}'; 1616 return $role; 1617 } 1585 1618 1586 1619 }
Note: See TracChangeset
for help on using the changeset viewer.