zenphoto forums » General Zenphoto Discussion

Problems with Lightroom plug-in

(17 posts)
  • Started 1 year ago by misterteddy
  • Latest reply from jasonized
  1. misterteddy

    Apprentice
    Joined: Feb '12
    Posts: 2

    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!

    Posted 1 year ago #
  2. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,367

    Sure it is the right place. I cannot help though. Hopefully the plugin's developer still visits this forum.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  3. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    The problem occurs with our move to PHP5 and proper use of objects. The checkLogon() function should not be called from outside the Zenphoto_Authority object and with PHP5 this is enforced.

    But how this is fixed would depend on what the plugin is doing, which I have not investigated.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  4. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Okay, if you're not allowed to call checkLogon from outside, exactly how is it supposed to be used? Here is the code doing the checking.. it's being called by a zp_authority instance, so in theory it should work, right? But we still get the "protected method" error...

    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']);
    }

    Posted 1 year ago #
  5. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    Well, it is used exactly as Zenphoto uses it of course.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  6. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Good to see a cry for help is taken so seriously...

    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.

    Posted 1 year ago #
  7. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    Well, of course you have never actually asked for help on what you want to do. Just for using a protected method of an object. Protected methods CANNOT be referenced anywhere except within the object that declares them or within objects that are decendents.

    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.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  8. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Hmm... I suppose in the absolute terms I did not, in fact, ask for explicit help. I just continued the help request from the previous person.. Sorry, my mistake.

    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,

    Posted 1 year ago #
  9. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    You can check if a user is logged in by testing zp_loggedin(<rights>); <rights> is the permissions required.

    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.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  10. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Hmm.. Okay, I'll browse through to find out what <rights> should be. See if I can get anything working. :}

    Thanks!

    Posted 1 year ago #
  11. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    I took pity on you and downloaded the plugin. The changes you need to do to make it "functional" are:

    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('<code>user</code>=' => $args['loginUsername'], '<code>pass</code>=' => $hash, '<code>valid</code>=' => 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 <code> 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.

    Don't forget to read the Forum rules and usage resources
    Posted 1 year ago #
  12. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Wow! Thank you!

    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!

    Posted 1 year ago #
  13. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    Great! Tried out your code, and it does validate properly now (i.e., I give it junk, I get an error. Good, get passed).

    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!

    Posted 1 year ago #
  14. jphilbert

    Senior
    Joined: Jun '12
    Posts: 114

    I am a lua programmer (kinda) and if there is enough interest I will take over the plugin development.
    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...

    Posted 11 months ago #
  15. Zenphoto development team
    sbillard

    Chief Developer
    Joined: May '07
    Posts: 9,771

    Good to hear. Please ask if you have questions on how Zenphoto works. Note that there are debug logging functions that may help you. debugLog(), debugLogBacktrace(), and debugLogVar(). These are what I use typically when trying to see what is happening.

    Don't forget to read the Forum rules and usage resources
    Posted 11 months ago #
  16. Zenphoto development team
    acrylian

    Developer
    Joined: Jul '07
    Posts: 13,367

    That's always very welcome. If you haven't please read here, too:
    http://www.zenphoto.org/news/general-contributor-guidelines#themes-and-plugins
    Let us know when you are ready and we update the extension entry.

    Don't forget to read the Forum rules and usage resources
    Posted 11 months ago #
  17. jasonized

    Member
    Joined: Oct '10
    Posts: 20

    It would be good to have a developer actually working on it... I haven't had any time to learn lua, so am useless at this point.

    So yes, if you'd like to take it over, please do!

    Posted 11 months ago #

RSS feed for this topic

Reply

You must log in to post.