I'm not sure if it's the right place to put this post but I'd just give it a try.
I've installed Zenphoto Lightroom plugin and could login to the site last month from the plugin last month.
However, I cannot login to the site from the plugin now after updating the Zenphoto to version 1.4.2. The lightroom plugin shows this message:
"Server could not be connected! Please make sure that an Internet connection is established and that the web service is running".
Error log from my zen photo site shows this:
[18-Feb-2012 00:56:16] PHP Fatal error: Call to protected method Zenphoto_Authority::checkLogon() from context '' in /home/mist/public_html/zenphoto/zp-lightroom/xmlrpc.php on line 135
Does anyone know how can I solve the problem?
Thanks in advance!
Comments
But how this is fixed would depend on what the plugin is doing, which I have not investigated.
Thanks,
/**
* first authorize
**/
function authorize($args) {
global $_zp_authority;
$args = decode64($args);
if (!preg_match('#^1.4#', ($version = getVersion())))
return new IXR_Error(-2, 'Zenphoto version '.$version.' but v1.3.x required!');
$_zp_authority = new Zenphoto_Authority();
if ($_zp_authority->checkLogon($args['loginUsername'], $args['loginPassword'], true))
return true;
else
return new IXR_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPass
word']);
}
Ah well, I suppose the easiest answer is just remove the 'protected' attribute... see if that works. Because it looks to me (granting I'm not a PHP programmer) that it is being used the same way...
Sigh.
The reason for protected methods is that the designer does not intend their functionality to be generally available. There are many reasons for that, but the bottom line is the same--that function CANNOT be used outside of the object.
You can, of course remove the protected attribute. Zenphoto is after all open source. But you do so at your own risk and peril. We do not proport to keep functionality of protected methods constant throughout the evolution of Zenphoto--one of the reason for making them protect in the first place.
To make it explicit then, seeing the code that I posted first, what would be the correct way to actually use the zen photo login checking in a plugin?
The actual plugin developer has decided he has too much to do, and so put the source in the public domain. I'm just trying to get my site working again, since otherwise I'll have to find another solution (when I had a nice one already working, until I upgraded).
Thanks,
If there is no user logged in (or the user has insufficient rights) and you wish him to log in then you would like to present a login for you use the template fuction `printPasswordForm()`. In neither case is the `Zenphoto_autority` object directly required.
Thanks!
`
function authorize($args) {
global $_zp_authority;
$args = decode64($args);
if (!preg_match('#^1.3#', ($version = getVersion())))
return new IXR_Error(-2, 'Zenphoto version '.$version.' but v1.3.x required!');
$_zp_authority = new Zenphoto_Authority();
$hash = $_zp_authority->passwordHash($args['loginUsername'], $args['loginPassword']);
$userobj = $_zp_authority->getAnAdmin(array('
user
=' => $args['loginUsername'], 'pass
=' => $hash, 'valid
=' => 1));if ($userobj)
return true;
else
return new IXR_Error(-1, 'Incorrect username or password '.$args['loginUsername'].' '.$args['loginPassword']);
}
`
NOTE: by some quirk of the forum editor the strings `
` in the above should be `backticks`. BUT, be aware that all this does is tell you if the user/password are valid. It does not tell you anything about what the user might be allowed to do. There appears to be no code to check if the user should even be allowed to use this facility, much less if he can perform any specific action on any particular album. In short, no Zenphoto security seems to be applied.
By a strange quirk of fate, I just tried commenting the check out.. it "lets me" login, which gets the first part working.. obviously I have to actually have the user/pass properly to do anything.
Here's the strange part... I can create albums, and upload images.. but can't delete or update images, and can't delete albums. I guess I'll have to either learn LUA or hopefully the person who took over the plugin will do something with it.
Thank you, I'll put your code in and see if it (hopefully) makes a difference!
Cheers!
Thank you for your help, that's a great start at getting it functional again.
Now, to find someone who knows LUA to fix delete.. <grin>
Cheers!
I already created a plugin and I started to you Zenphoto for a proofs site .converting from gallery3.
First things I will do is add debug code and some other needed stuff then get on bugs and enhancements...
http://www.zenphoto.org/news/general-contributor-guidelines#themes-and-plugins
Let us know when you are ready and we update the extension entry.
So yes, if you'd like to take it over, please do!