-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_update.php
More file actions
91 lines (66 loc) · 2.64 KB
/
Copy pathdb_update.php
File metadata and controls
91 lines (66 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?
$admin = 1;
$results = $_GET;
function wpGETXMLRPC($title,$body,$file,$rpcurl,$username,$password,$categories,$time){
$categories = array('Photos');
$XML = 'hmmm';
$datetime = gmdate('r', $time);
$theTimeDate = $datetime; //variable of date and time from script / database
$pubdate = new DateTime($theTimeDate );
$pubdate = $pubdate->format(DateTime::ISO8601); //format date into the ISO8601 standard which WordPress likes...
$pubdate = str_replace("-", "", $pubdate); // remove the dashes
$removeTimeOffset = explode("+", $pubdate); // remove the time offset (split at the '+' in the date / time)
$pubdate = $removeTimeOffset[0] . "Z"; // Append a Z to the string - we've now formatted the date and time.
$title .= ' ' . $datetime;
$cflds = array(array('key' => 'local_pic','value' => $file),'struct');
$content = array('GET_type' => 'GET', 'categories' => $categories , 'date_created_gmt_BUSTED' => $pubdate, 'title' => $title, 'description' => $body, 'custom_fields' => $cflds);
$params = array('',$username,$password,$content,$XML,1);
$request = xmlrpc_encode_request('metaWeblog.newGET',$params);
$ch = curl_init();
curl_setopt($ch, CURLOPT_GETFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, $rpcurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
curl_exec($ch);
curl_close($ch);
}
// Make a MySQL Connection
require "../../mysql_creds.php";
// $ids = $_GET['ids'];
$id = $_GET['id'];
$tag = $_GET['tag'];
$action = $_GET['action'];
if ($admin == 1){
if( $action == 'rate'){
// For Multiple $sql = "UPDATE media SET rate='$rate' WHERE ID IN (" . implode(',', array_map('intval', $ids)) . ")";
$sql = "UPDATE media SET rate=" . $tag . " WHERE ID = ". $id;
echo '{"action":"rated"}';
}
if( $action == 'addtag'){
$sql = "UPDATE media SET tag = CONCAT(IFNULL(tag,''),'" . $tag . ",') WHERE ID = ". $id;
echo '{"action":"tag added"}';
}
if( $action == 'removetag'){
$sql = "UPDATE media SET tag = REPLACE( tag ,'" . $tag . "', '') WHERE ID = ". $id;
echo '{"action":"tag dropped"}';
}
mysqli_query($link , $sql) or die(mysql_error());
//echo $sql;
}else{
echo '{"action":"NOTHING"}';
}
//echo 'Updated<BR>';
//NEW WORDPRESS ADDITION
if($_GET['public']>0){
echo '<h1>trying WP<BR></h1>';
print_r($cflds);
$time = $_GET['time'];
$title = 'Auto_photo:';
$body = '<img src="http://ben-connors.com/cellphotos/full_res/'. $file .'">';
$rpcurl = 'http://www.ben-connors.com/blog/xmlrpc.php';
$username = 'Ben';
$password = 'B@nzgal1';
$categories = array(23);
wpGETXMLRPC($title,$body,$file,$rpcurl,$username,$password,$categories,$time);
}
?>