zenphoto forums » Bug Discussion

xp_publish.php broken by 1.1.5 (for sure)!

(18 posts)
  • Started 6 years ago by zhoujianfu
  • Latest reply from Chilifrei64
  1. zhoujianfu

    Junior
    Joined: Mar '08
    Posts: 7

    It looks like 1.1.5 broke the most recent xp_publish.php.. it used:

    $albumlist = array();
    genAlbumList($albumlist);

    which looks like it's been deprecated by:

    $albumlist = getManagedAlbumList();

    Unfortunately, that function doesn't just work, because you don't have a $_zp_current_admin['id'] from the way xp_publish.php currently handles authentication (old-school style):

    function process_login() {
    if (isset($_POST['user']) && isset($_POST['pass'])) {
    $user = $_POST['user'];
    $pass = $_POST['pass'];

    $check_auth = md5($user . $pass);
    if ($user == getOption('adminuser') && $check_auth == getOption("adminpass")) {
    setcookie("zenphoto_wizard", md5($user . $check_auth), time()+5184000, $cookiepath);
    $_zp_loggedin = true;
    } else {
    setcookie("zenphoto_wizard", "", time()-368000, $cookiepath);
    }
    }
    if ($_zp_loggedin) {
    $this->form_album();
    } else {
    $this->form_login('The username or password you entered are not correct');
    }
    }

    Now it looks like it has to do something more along the lines of?

    foreach (getAdministrators() as $user) {
    if ($user['user'] == $user && $user['pass'] == $pass) {
    $_zp_current_admin = $user;
    setcookie("zenphoto_wizard", md5($user . $check_auth), time()+5184000, $cookiepath);
    $_zp_loggedin = true;
    $this->form_album();
    break;
    }
    }

    if (!$_zp_loggedin) {
    setcookie("zenphoto_wizard", "", time()-368000, $cookiepath);
    $this->form_login('The username or password you entered are not correct');
    }

    But that's not working for me either, I think because getAdministrators() isn't returning anything? At this point it's getting a little too involved for me!

    Do you think somebody could check it out and make the necessary fixes to the xp_publish.php authentication?

    Also, what to people think about just including xp_publish.php as part of the standard distribution, and then there could be a link to it on the upload tab even as an alternate method?

    P.S. there's also another bug at the end of xp_publish.php as far as I can tell; believe it or not:

    \CurrentVersion\Explorer\PublishingWizard\Providers

    should actually be:

    \CurrentVersion\Explorer\PublishingWizard\PublishingWizard\Providers

    !

    Posted 6 years ago #
  2. Zenphoto development team
    trisweb

    Project Manager
    Joined: Sep '05
    Posts: 1,843

    How about a bug report at http://www.zenphoto.org/trac/newticket ? We will certainly get on it.

    Posted 6 years ago #
  3. zhoujianfu

    Junior
    Joined: Mar '08
    Posts: 7

    Hmm.. I'd like to but I get "FORBIDDEN"! And then when I try and register in Trac I get "access denied"?

    Zurg!

    Posted 6 years ago #
  4. Zenphoto development team
    trisweb

    Project Manager
    Joined: Sep '05
    Posts: 1,843

    Hmm.... for Trac registration, if you can see the field that's labeled "Name (required):" don't put anything in it. Its supposed to be hidden.

    Posted 6 years ago #
  5. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    It is always a risk to use internal zenphoto functions in external applications. In this case, genAlbumList() was admin support function (in admin-functions.php). With the implementation of multiple Administrators with differing rights in 1.1.5 this function no longer did what was necessary.

    The function you mention--getManagesAlbumList() is quite different and probably does not do what xp_publish needs. I suggest you replicate the old function, listed below, in xp_publish.

    function genAlbumList(&$list, $curAlbum=NULL) {
    global $gallery;
    if (is_null($curAlbum)) {
    $albums = $gallery->getAlbums(0);
    } else {
    $albums = $curAlbum->getSubAlbums(0);
    }
    foreach ($albums as $folder) {
    $album = new Album($gallery, $folder);
    $list[$album->getFolder()] = $album->getTitle();
    genAlbumList($list, $album); /* generate for subalbums */
    }
    }

    Posted 6 years ago #
  6. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    I have looked at xp_publish.php. It is broken much more than you think by v1.1.5. The whole admin bit has changed, including log-in and where the autorization information is stored. I'm afraid it will not work with zenphoto 1.1.5 without some work by its author.

    Posted 6 years ago #
  7. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    Is there any docs on how to use this wizard? I have done the regedit, but Now What. If I might be able to update this to 1.1.5 if I knew how to use it.

    Posted 6 years ago #
  8. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    Sucks I just spent all that time fixing it up for 1.0.14 and 1.0.15 breaks is.. dangit.

    From XP, after you run the reg, then, select a picture in explorer and on the left hand side of explorer there is a "Publish to web" link, Choose the gallery and from there you follow the wizard.

    If you wanted to test the scripts, you have to use a browser, but there are no buttons (because the publishing wizard takes care of the buttons(thats where all the javascript comes in)).. first you need an active cookie, so log into your zenphoto session from your browser.(If you try to debug in the publishing wizard it wont throw php errors back at ya)
    then you have
    http://url.com/zenphoto/xp_publish.php?cmd=publish
    from there you should be able to troubleshoot

    I can see if I can take a look at it tomorrow sometime since I am already familiar with it too if you dont figure it out by then. I havent installed 1.1.5 yet so I havent had a chance to take a look at the changes but when I updated the wizard from the previous version to the current, I just took the admin page upload function from zenphoto and worked it into the wizard if that helps you at all. I wouldnt imagine you still wouldnt be able to do the same.. but like i said.. i havent taken a look at it yet.

    Posted 6 years ago #
  9. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    I have no "Publish to web" link, so I guess it is up to you on the changes. Maybe I am missing something other than the reg edits. Anyway, here are the changes I think are needed. When You get this working, we should include it as part of the core so it does not get overlooked in future changes.

    --- C:Junkxp_publish.php 2008-01-13 17:01:00.000000000 -0800
    +++ O:testalbumhtdocsxp_publish.php 2008-03-02 09:55:54.000000000 -0800
    @@ -167,14 +167,13 @@
    }
    function form_album($message = '') {
    global $gallery;
    $gallery = new Gallery();
    - $albumlist = array();
    - genAlbumList($albumlist);
    + $albumlist = genAlbumUploadList($albumlist);
    $this->header();
    echo '<script language="javascript" type="text/javascript">';
    echo 'window.totalinputs = 5;';
    @@ -268,13 +267,13 @@
    function process_login() {
    if (isset($_POST['user']) && isset($_POST['pass'])) {
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $check_auth = md5($user . $pass);
    - if ($user == getOption('adminuser') && $check_auth == getOption("adminpass")) {
    + if (checkAuthorization($check_auth)) {
    setcookie("zenphoto_wizard", md5($user . $check_auth), time()+5184000, $cookiepath);
    - $_zp_loggedin = true;
    } else {
    setcookie("zenphoto_wizard", "", time()-368000, $cookiepath);
    }
    }

    Posted 6 years ago #
  10. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    alright.. well i think i made a little progress. not enough though. I have gotten it to log in and I have the code changed for the upload form and it all looks correct so far. Just having a problem with authorization

    I dont think checkAuthorization() is returning anything or is returning no rights.
    if I leave the
    $_zp_loggedin = true;
    in the process login, it takes me to the upload form but it doesn't show me any folders.
    If I open zenphoto in another tab and go to my admin url and log in, then go back to my wizard tab I can get the album list to populate. at that point if I make a new folder, it will create the folder but it wont upload the picture. that might be another problem but I want to make sure the authorization is correct before go further into that..

    sbillard:
    after importing the regedits:

    In XP you need to have to folder task turned on in Windows explorer. This is the blue task bar on the left. Then if you go to a folder with pictures it in, if you select a folder it will say "Publish this folder to the web" and if you select a picture it will say "Publish this file to the web"

    In Vista you need to open Windows photo Gallery and choose Order Prints and select your gallery.

    Any help is appreciated. Any other ideas as to why i might not be getting the authorization I am supposed to be getting? I have been in front of this for about 5 hours now.. I need to step away for a while and come back to it.. I am not thinking straight anymore.

    Posted 6 years ago #
  11. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    Alright.. maybe I am just getting tired but I kept going real quick.. if I set process login to:

    function process_login() {
    global $_zp_loggedin;
    if (isset($_POST['user']) && isset($_POST['pass'])) {
    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $check_auth = md5($user . $pass);
    $_zp_loggedin = checkAuthorization($check_auth);
    if (!$_zp_loggedin) {
    zp_setcookie("zenphoto_wizard", "", time()-368000, $cookiepath);
    } else {
    zp_setcookie("zenphoto_wizard", md5($user . $check_auth), time()+5184000, $cookiepath);
    }
    }
    if ($_zp_loggedin) {
    $this->form_album();
    } else {
    $this->form_login('The username or password you entered are not correct');
    }
    }

    It logs me in (and yes I cleared all my cookies and browser cache to make sure everything was fresh and clean)but it logs me in and I can see my folders. but after I select my folder and hit next, it takes me back to a logon screen.. I am tired.. and it is not obvious to me.. maybe someone can pick out why it doesnt hold my credentials.

    Posted 6 years ago #
  12. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    The problem is that we missed the authorize function in xp_publish. Also, we should be testing if the user is authorized for uploads.

    function authorize() {
    global $_zp_loggedin;
    if (isset($_COOKIE['zenphoto_wizard'])) {
    $saved_auth = $_COOKIE['zenphoto_wizard'];
    if ((!$_zp_loggedin = checkAuthorization($saved_auth)) & UPLOAD_RIGHTS) {
    setcookie("zenphoto_wizard", "");
    }
    }
    }

    The & UPLOAD_RIGHTS should also go on the if ($_zp_loggedin) lines if ($_zp_logged_in & UPLOAD_RIGHTS) and the login message should be $this->form_login('The username or password you entered are not correct or you do not have upload rights');

    But, I am wondering why we are not letting the auth-zp-php file handle the login and authorization. Then there would be no need of the extra cookie. All that should be need is to add
    echo "n <input type=\"hidden\" name=\"login\" value=\"1\" />";
    echo "n <input type=\"hidden\" name=\"redirect\" value=\"$redirect\" />";

    to the xp_publish login form. The auth-zp will process the login. $redirect should be set to the url for xp_publish.

    If we do this, all that is needed is to check $_zp_loggedin to see if we are logged in with appropriate rights.

    I found the publish to web. (I never run with the folder tasks visible!). But, All that I have is the MSN stuff for a place to publish. The zenphoto album does not show up.

    Posted 6 years ago #
  13. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    I have created http://www.zenphoto.org/trac/ticket/410 as a place where we can exchange files. I have uploaded my version of these changes.

    Posted 6 years ago #
  14. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    if its not one thing its another. I have gotten past the logging in part but now I am having problems with newer upload form and its toggle javascript(almost done) but there are a few other things I notice with stuff like the ability to change the album directory in zenphoto that this script references /albums/ and other little quirky things like that.

    On top of it all, my computer crapped on me yesterday(power supply), just got myself back up and working. I am gonna keep working on this but like sbillard said "Its broken much more than you think by v1.1.5"

    Posted 6 years ago #
  15. sbillard

    Contributor
    Joined: May '07
    Posts: 10,426

    For the album folder, use the getAlbumFolder() function.

    Also note that the newer file upload uses the lib-soe.php function seoFriendlyURL() function to cleanse "bad" characters from the filename before the upload.

    Sorry about your commputer. Let me know if there is anything else I can help with. (Just wish I knew how to get the publish wizard to recognize the zenphoto album.)

    Posted 6 years ago #
  16. crankygeek

    Apprentice
    Joined: Feb '07
    Posts: 3

    Has there been any progress on fixing xp_publish for 1.1.5?

    It's kind of funny, but I've been practically pulling my hair out trying to get this to work after upgrading figuring I'd done something wrong (and my wife was going to kill me). Is it politically correct to be thankful this is actually a coding problem? :)

    Not sure what help, if any, I can offer on coding front, but if there's anything I could do to assist, I'd be glad to.

    Posted 6 years ago #
  17. ttripp

    Apprentice
    Joined: Mar '08
    Posts: 3

    The .REG added the key in the wrong place for me:

    wrong:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\Providers
    right:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\PublishingWizard\PublishingWizard\Providers

    Putting the key in the correct area gives me the server in the list, but my login/password don't work.

    Posted 6 years ago #
  18. Chilifrei64

    Contributor
    Joined: Dec '05
    Posts: 541

    There is quite a bit broken with this latest version of zenphoto. Many many things need to be fixed and really just updated to support the features since it was created back from version .9 It has always just been updated to "Just work". I have started on it and have made progress but 2 weeks ago my computer died (mobo, possibly cpu) and I am yet to get it fixed. I too use this plugin a lot and really want to get it working but I am a programmer by hobby and without a computer it makes things hard.

    My latest status is:
    I am pretty confident I have everything updated and working properly, the photo's just dont upload, but it spits no errors(because xp/vista publishing wizards hide the errors) Once I get my computer running i dont suspect it will take much longer, just hasnt been a real priority.

    If anyone else wants to take a look at it I can see pull out my HD and pull the files and post them.

    Posted 6 years ago #

RSS feed for this topic

Reply

You must log in to post.