gettext() support

Hi,

Zenphoto newbie here. I installed for the 1st time today and ran the setup and got the warning that:

PHP gettext() support [is not present]

I've spoken to my host and they will enable this in the 'next couple of days'.

I've got a few issues when viewing my gallery (using the default theme).

Clicking on 'Image Info' doesn't do anything (I know the uploaded images have EXIF).
Clicking on 'Admin Toolbox' doesn't do anything. (I have to navigate to domain/zenphoto/admin).

What I am really trying to work out is the lack of gettext() support the cause of the problems and really going to cause me many more problems. Am I best off waiting until this is switched on before I continue working with Zenphoto?

Thanks in advance.

Mark F

Comments

  • acrylian Administrator, Developer
    Actually not having gettext() support should do nothing except that you don't have support for other languages (mostly on the admin backend).

    If the image info and admin toolbox do nothing either something went wrong with the install or your browser has javascript disabled.
  • Hi acrylian,

    Thanks for the quick reply.

    I've completely redone the install. I deleted the database and the zenphoto file structure and then copied the files back up to the server (I downloaded and extracted the zip to my local PC and then used Filezilla to FTP all of the files to my host). And then created a new database.

    I have exactly the same problems. Image Info and Admin Toolbox links don't do anything.

    Javascript is enabled. Usually I am using Firefox 3.0.10 but I also browsed using IE8. In this case I could see an error:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
    Timestamp: Sat, 23 May 2009 16:16:33 UTC

    Message: Unterminated string constant
    Line: 8
    Char: 18
    Code: 0
    URI: http://freester.co.uk/zenphoto/zp-core/js/zenphoto.js.php

    Is this any clue as to what the problem is?

    Thanks again

    Mark F
  • Please install version 1.2.5_RC1. This is most likely caused by your site not having gettext() support although there are some other obscure configuration issues that might be the cause.
  • Thanks again for the quick reply. I upgraded to 1.2.5_RC1 but still have the same problems.

    Do you think it is best to wait for my host to enable gettext() support or is there anything else I can try?

    Thanks for your support

    Mark F
  • Please review the CGI error logs from your site. There must be an error occuring that is causing this problem. We will need to know what that error is.
  • Is this the correct error logs? Looks like gettext() is the culprit. Not sure why I am getting the other errors? Should I be creating these files that are missing?

    Sat May 23 18:03:34 2009] [error] PHP Fatal error: Call to undefined function: gettext() in /home/freester/public_html/zenphoto/zp-core/functions-basic.php on line 42
    [Sat May 23 17:48:11 2009] [error] [client 66.74.138.101] File does not exist: /home/freester/public_html/404.shtml
    [Sat May 23 17:48:11 2009] [error] [client 66.74.138.101] File does not exist: /home/freester/public_html/favicon.ico
    [Sat May 23 17:48:09 2009] [error] PHP Fatal error: Call to undefined function: gettext() in /home/freester/public_html/zenphoto/zp-core/js/zenphoto.js.php on line 22
    [Sat May 23 17:47:29 2009] [error] PHP Fatal error: Call to undefined function: gettext() in /home/freester/public_html/zenphoto/zp-core/js/zenphoto.js.php on line 22
  • I note that setup is giving you a warning about the zp-config.php.source file.

    Is there a reason that this file would not be from the release? Have you made any modifications to this file or to zp-copnfig.php?

    Also, the line numbers on your error messages do not seem to correspond to the RC1 release. At least there are no calls on gettext() at those lines.

    At this point I think there has been some problems with your upload of the Zenphoto files. I suggest you delete all the Zenphoto script files and upload again. Possibly also delete the zp-copnfig.php file, but if you do that, be sure to note your MySQL user, password, etc. information.
  • Hi,

    Thanks for the reply. I have made no modifications to the zp-config.php file apart from change for the mysql settings.

    I'll try the whole reinstall again... Download 1.5RC1. Delete all from server and the database also.

    I'll update you!

    Thanks again.
  • OK. Thanks for the last reply. It pointed me in the right direction I think.

    I think I realised a mistake during installation. I realised when I was doing the install I should make a COPY of zp-config.php.source renamed to zp-config.php and edit this file for my SQL database settings. NOT simply rename

    This got rid of a warning during setup.

    I've still got the same problem with the 'Image Info' and 'Admin Toolbox' not working but at least the error on my server log has changed!

    I've still got the same error when running IE8:

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30618)
    Timestamp: Sat, 23 May 2009 21:43:38 UTC

    Message: Unterminated string constant
    Line: 8
    Char: 18
    Code: 0
    URI: http://freester.co.uk/zenphoto/zp-core/js/zenphoto.js.php

    But the errors on my server log have changed to:

    [Sat May 23 22:39:41 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:39:30 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:38:06 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:17:35 2009] [error] PHP Fatal error: Call to undefined function: json_encode() in /home/freester/public_html/zenphoto/zp-core/admin-uploadify/check.php on line 13
    [Sat May 23 22:17:17 2009] [error] PHP Fatal error: Call to undefined function: json_encode() in /home/freester/public_html/zenphoto/zp-core/admin-uploadify/check.php on line 13
    [Sat May 23 22:12:20 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:10:26 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:08:58 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/404.shtml
    [Sat May 23 22:08:58 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/favicon.ico

    Any further suggestions?

    Thanks in advance!

    Mark F
  • Ok, I think we are making progress. Please install the nightly build. Most of these errors are caused by a PHP version difference which is now fixed. I do not know about the json_encode() error, but I am hoping that if we clean up the other issues it will go away.

    Also, can you please post the code of the `zp-core/js/zenphoto.js.php` file? You are still getting an error of an `undefined gettext()` function. (Not sure why that is not showing up in the log.) But the proper version of that file should have defined that function.
  • OK - here is the latest after upgrade to the 22/05/09 nightly build. Again I deleted the DB and did the entire installation and upload of a couple of pictures from scratch.

    I am still getting the problems with the admin toolbox and image info.

    I think the two most recent lines are the only errors since...

    [Sat May 23 23:58:53 2009] [error] PHP Fatal error: Call to undefined function: gettext() in /home/freester/public_html/zenphoto/zp-core/functions-db.php on line 36
    [Sat May 23 22:52:30 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903

    [Sat May 23 22:39:41 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:39:30 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:38:06 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:17:35 2009] [error] PHP Fatal error: Call to undefined function: json_encode() in /home/freester/public_html/zenphoto/zp-core/admin-uploadify/check.php on line 13
    [Sat May 23 22:17:17 2009] [error] PHP Fatal error: Call to undefined function: json_encode() in /home/freester/public_html/zenphoto/zp-core/admin-uploadify/check.php on line 13
    [Sat May 23 22:12:20 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:10:26 2009] [error] PHP Notice: Undefined variable: _zp_server_timezone in /home/freester/public_html/zenphoto/zp-core/admin-options.php on line 903
    [Sat May 23 22:08:58 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/404.shtml
    [Sat May 23 22:08:58 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/favicon.ico

    Here is the contents of zp-core/js/zenphoto.js.php

    <?php
    header("Last-Modified: " . gmdate("D, d M Y H:i:s", time()-3600*24*30) . " GMT"); // Date in the past
    header("Expires: " . gmdate("D, d M Y H:i:s", time()+3600*24*60) . " GMT"); // Don't expire for 60 days
    header("Cache-Control: max-age=86400, s-maxage=86400, proxy-revalidate, must-revalidate");
    header("Content-Type: application/x-javascript");

    require_once(dirname(dirname(__FILE__)).'/zp-config.php'); // in case the defines are enabled!

    if (!defined('WEBPATH')) {
    $const_webpath = dirname(dirname(dirname($_SERVER['SCRIPT_NAME'])));
    $const_webpath = str_replace("\\", '/', $const_webpath);
    if ($const_webpath == '/') $const_webpath = '';
    define('WEBPATH', $const_webpath);
    }
    if (!defined('ZENFOLDER')) { define('ZENFOLDER', 'zp-core'); }

    if(!function_exists("gettext")) {
    // load the drop-in replacement library
    require_once(dirname(dirname(__FILE__)).'/lib-gettext/gettext.inc');
    }
    ?>

    /* Common javascripts and localized strings for Zenphoto */

    var zppath = "<?php echo WEBPATH.'/'.ZENFOLDER; ?>";

    var zpstrings = {
    /* Used in jquery.editinplace.js */
    'Save' : "<?php echo gettext('Save'); ?>",
    'Cancel' : "<?php echo gettext('Cancel'); ?>",
    'Saving' : "<?php echo gettext('Saving'); ?>",
    'ClickToEdit' : "<?php echo gettext('Click to edit...'); ?>",
    /* Used in thickbox.js */
    'Test' : "<?php echo gettext('Test'); ?>",
    'Close' : "<?php echo gettext('Close'); ?>",
    'close' : "<?php echo gettext('close'); ?>",
    'orEscKey' : "<?php echo gettext('or Esc Key'); ?>",
    'Next' : "<?php echo gettext('Next'); ?>",
    'Prev' : "<?php echo gettext('Prev'); ?>",
    'Image' : "<?php echo gettext('Image'); ?>",
    'of' : "<?php echo gettext('of'); ?>"
    };

    // Toggle element display
    function toggle(x) {
    jQuery('#'+x).toggle();
    }

    function confirmDeleteAlbum(url, message1, message2) {
    if (confirm(message1)) {
    if (confirm(message2)) {
    window.location = url;
    }
    }
    }

    function confirmDeleteImage(url, message) {
    if (confirm(message)) {
    window.location = url;
    }
    }

    The nightly build seems to have lost the global admin setting to hide comments also?

    Thanks again...
  • Can you clear out the CGI log and re-run so we can be sure of what is still an error?

    The line number admin-options.php 903 can't be correct for the nightly build.
  • Regarding the golbal comment setting. That has not changed. It should still be in the Theme options tab, custom theme options section.
  • Another thing you might try is to make changes to the lines in zenphoto.js.php that currently read
    `
    if(!function_exists("gettext")) {
    // load the drop-in replacement library
    require_once(dirname(dirname(__FILE__)).'/lib-gettext/gettext.inc');
    }
    `
    Change them so that they read only
    `
    // load the drop-in replacement library
    require(dirname(dirname(__FILE__)).'/lib-gettext/gettext.inc');
    `
    Again, clear out the CGI log before testing this.
  • OK I carried out the tests in the order above.

    First I cleared the log. I only got the following errors:

    [Sun May 24 08:02:02 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/404.shtml
    [Sun May 24 08:02:02 2009] [error] [client 82.69.84.53] File does not exist: /home/freester/public_html/favicon.ico

    My mistake with the 'global comment' checkbox. I found it. A little late and frustration settting in I guess.

    Making the code change you suggest WORKS! Thanks. Photo EXIF and Admin Toolbox are displayed.

    No errors in the CGI log to give you. Thanks.

    So what is the way forward? Will I have to make the change when I get a nightly build or will there be a code change in a release to remedy this.

    Thanks for your support. Do you guys ever sleep?!
  • acrylian Administrator, Developer
    The two errors you still got are not Zenphoto related. There is no 404.shtml file. The favicon error is nothing really bad.

    To the general fix we will check on that.

    Do you guys ever sleep?!
    Well, we are in different time zones apart nearly a day so it just looks like that..:-)
  • Thanks alot guys!
  • Well, the change should NOT actually fix the problem, but then go figure. What all this is saying is that the detection of whether `gettext()` support exists on your server is failing. That is, we test for the existence of the function `gettext` and the answer is `YES` but when we try to use the function the answer is `NO`.

    I'm glad the above fix works for you, but unfortunately we have nothing that can be used as a general fix for your situation. So, until your server has `gettext()` support you will have to keep applying this change to Zenphoto updates.
  • OK sbillard.

    I'm a little confused. The setup procedure indicates that gettext() isn't supported, but you are saying when Zenphoto runs it tests for the existence of it and gets the answer "yes"? Why the difference between the setup and when browsing the gallery?
  • acrylian Administrator, Developer
    That is the mystery we currently have no idea about.
  • OK. Understood!
Sign In or Register to comment.