xiffy
Forum Replies Created
-
Forum: Plugins
In reply to: [JSON API Auth] But is it safe? (hint: nope)from within WordPress via javascript you could use:
jQuery.post { 'https://example.com/api/auth/generate_auth_cookie', {username: 'scott', password: 'tiger' // add unsecure: 'cool' when not using https }, function (response) { console.log (response) } }
off course, untested.
Forum: Plugins
In reply to: [JSON API Auth] But is it safe? (hint: nope)I’ve made the source available at: https://github.com/xiffy/json-api-auth
Can you explain how the current implementation supports POST? The Auth controller reads json_api->query, which holds all GET, but not POST variables. Or i’ve missed an update on the JSON-API itself (which is possible with all the versions in the wild ??
Cheers
Forum: Plugins
In reply to: [JSON API] Attachments empty@wywarren, i’ve suggested a patch for this bug in this post: https://www.ads-software.com/support/topic/modelsattachmentphp-bug-with-getting-attachments-on-folder-mulit-site-installs
Okay, forgive my hastiness on the previous post. I played around with some multisite installs, and this is what i came up with for the JSON_API_Attachment::query_images method:
function query_images() {
$sizes = array('thumbnail', 'medium', 'large', 'full');
if (function_exists('get_intermediate_image_sizes')) {
$sizes = array_merge(array('full'), get_intermediate_image_sizes());
}
$this->images = array();
$home = get_bloginfo('url');
$upload_dir = wp_upload_dir();
$basedir = $upload_dir['basedir'];
$file = get_post_meta($this->id, '_wp_attached_file', true);foreach ($sizes as $size) {
list($url, $width, $height) = wp_get_attachment_image_src($this->id, $size);
$filename = $basedir . '/' . str_replace(basename($file), basename(parse_url($url, PHP_URL_PATH)), $file);
if (file_exists($filename)) {
list($measured_width, $measured_height) = getimagesize($filename);
if ($measured_width == $width &&
$measured_height == $height) {
$this->images[$size] = (object) array(
'url' => $url,
'width' => $width,
'height' => $height
);
}
}
}
}This does get the image src correctly for all types of install, it’s not as straightforward as I hoped it should be.
Forum: Plugins
In reply to: [JSON API] Attachments emptyDo you have a multi-site install? Does this install use paths, not subdomains? I was having the same problem, and noticed that the JSON-API for attachments only works on the main blog (residing at ABSPATH)
If you donwload version 1.0.7 (2011-01-27) and use models/attachment.php from that zip, your problem will be resolved.
I will file a bug (and waited way to long to upgrade…)
hthForum: Plugins
In reply to: [OpenID] [Plugin: OpenID] Use of deprecated function get_userdatabylogin.Well, it’s a bit strange that deprecated functions give FATAL errors, usually one get’s a grace period to move to the preferred function.
Weird thing is i’ve got this problem to, in a slight variant; i post or edit a post in https://example.com/subblog/wp-admin/, edit for instance post 14 of that blog, and ater submitting, the browser get’s redirected to the main blog; https://example.com/wp-admin/
The post does not get submitted.So dumped the DB, loaded it into our accpetation, all problems resolved. Thing is, i did not (yet) uninstall, then reinstall he plugin on our production machine. It’s production blog with high traffic, so’ll wait for a not so busy opprtunity to see if re-installation of the plugin would resolve the issue for us as well.