Esempio n. 1
0
function kkb_backup_insert_post()
{
    $result = array();
    $data = array('ID' => sanitize_text_field($_POST['ID']), 'post_author' => sanitize_text_field($_POST['post_author']), 'post_date' => sanitize_text_field($_POST['post_date']), 'post_date_gmt' => sanitize_text_field($_POST['post_date_gmt']), 'post_content' => sanitize_text_field($_POST['post_content']), 'post_title' => sanitize_text_field($_POST['post_title']), 'post_excerpt' => sanitize_text_field($_POST['post_excerpt']), 'post_status' => sanitize_text_field($_POST['post_status']), 'comment_status' => sanitize_text_field($_POST['comment_status']), 'ping_status' => sanitize_text_field($_POST['ping_status']), 'post_password' => sanitize_text_field($_POST['post_password']), 'post_name' => sanitize_text_field($_POST['post_name']), 'to_ping' => sanitize_text_field($_POST['to_ping']), 'pinged' => sanitize_text_field($_POST['pinged']), 'post_modified' => sanitize_text_field($_POST['post_modified']), 'post_modified_gmt' => sanitize_text_field($_POST['post_modified_gmt']), 'post_content_filtered' => sanitize_text_field($_POST['post_content_filtered']), 'post_parent' => sanitize_text_field($_POST['post_parent']), 'guid' => sanitize_text_field($_POST['guid']), 'menu_order' => sanitize_text_field($_POST['menu_order']), 'post_type' => sanitize_text_field($_POST['post_type']), 'post_mime_type' => sanitize_text_field($_POST['post_mime_type']), 'comment_count' => sanitize_text_field($_POST['comment_count']));
    include KINGKONGBOARD_ABSPATH . '/class/class.KKB_Backup.php';
    $result = array();
    $Recovery = new KKB_Backup();
    $status = $Recovery->importPosts($data);
    if ($status) {
        $result['status'] = 'success';
    } else {
        $result['status'] = 'failed';
    }
    header("Content-Type: application/json");
    echo json_encode($result);
    //echo $result;
    exit;
}
Esempio n. 2
0
<?php

list($path) = explode(DIRECTORY_SEPARATOR . 'wp-content', dirname(__FILE__) . DIRECTORY_SEPARATOR);
include $path . DIRECTORY_SEPARATOR . 'wp-load.php';
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
//header("Content-Type: text/html; charset=UTF-8");
if (!stristr($referer, $host)) {
    wp_die('KINGKONG BOARD : ' . __('지금 페이지는 외부 접근이 차단되어 있습니다.', 'kingkongboard'));
}
if (!current_user_can('activate_plugins')) {
    wp_die('KINGKONG BOARD : ' . __('백업할 권한이 없습니다.', 'kingkongboard'));
}
include KINGKONGBOARD_ABSPATH . '/class/class.KKB_Backup.php';
$backup = new KKB_Backup();
$tables = $backup->getTables();
$data = '';
foreach ($tables as $key => $value) {
    $data .= $backup->getXml($value);
}
$backup->download($data, 'xml');