Results 1 to 10 of 10

Thread: Linux -> Windows Conversion to enable PopCard

  1. #1
    Join Date
    Aug 2011
    Location
    Rep Of Ireland
    Posts
    126
    Thanks
    24
    Thanked 3 Times in 1 Post

    Default Linux -> Windows Conversion to enable PopCard

    At this test position I have installed PopCard script. It needs to be altered for use on Windows.

    To progress this in respect of the location of the temp folder I have changed line 61 in config.php from
    PHP Code:
    define("POPC_TEMP_DIR","/var/tmp/"); 
    to
    PHP Code:
    define("POPC_TEMP_DIR","C:\Windows\Temp\"); 
    However this now gives me a

    Parse error: syntax error, unexpected T_STRING in C:\CustomerData\webspaces\webspace_00159712\wwwroot\newtest.webitry.net\resources\includes\popcard.config.php on line 72

    see construction of line 72 in attached image. Why might line 72 be presenting a Parse error and is there a fix?

    The following is the complete script of the config.php

    PHP Code:
    <?php 

    /*
    *
    *    PopCard 3.0
    *    Copyright 2002 - 2008 Jamie Longstaff
    *
    */

    // Prevent this script being executed outside of the PopCard scope
    if (POPCARD != "ON") { print("Direct access to this script is not allowed."); exit; }

    /*
    *
    *    This file contains all the system settings that are specific to your webserver
    *
    */

    /*
    *
    *     Initialise the configuration information array
    *    DO NOT REMOVE THESE LINES!
    *
    */
    $cfg            = array();
    $lang             = array();
    $style             = array();

    /*
    *
    *     The system path to the folder or directory containing all your scripts
    *     You should NOT need to manually set this value
    *
    */
    define("POPC_BASE_PATH",dirname(dirname(dirname(__FILE__)))."/");

    /*
    *    
    *    The length of time users have to pick and send a card
    *    Avoid making this calue longer than 1800 seconds to help prevent spam
    *    
    */
    define("POPC_TIMEOUT",600);

     
    /*
    *    
    *    Enter an e-mail address between the second pair of quote marks to send a copy of every card to:
    *
    *    e.g. define("POPC_TIMEOUT","myemail@domain.com");
    *    
    */
    define("POPC_COPY_TO","");

     
    /*
    *    
    *    Set the location of the temp folder
    *    
    */
    define("POPC_TEMP_DIR","/var/tmp/");

     
    /*
    *    
    *    Set whether you have GD 2.0+ on your server (produces better results)
    *    The variable GD2 can be either "TRUE" or "FALSE"
    *    
    */
    define("POPC_GD2",true);

    /*
    *    
    *    Choose whether or not you want to enable postcards from remote images
    *    
    *    Can be either true or false
    *    
    */
    define("POPC_REMOTE_IMAGES",true);

    /*
    *    
    *    To restrict remote image access to one URL, enter it between the two
    *    quote marks or else leave blank to allow images from any URL to be used.
    *    
    */
    define("POPC_REMOTE_URL","");

    /*
    *    
    *    Quality of the JPEG file to be displayed as a preview when the
    *    user creates their custom message.  The lowest quality setting is
    *    0, the highest quality setting, 100, will output much larger files
    *    
    */
    define("POPC_JPEG_QUALITY",90);

    /*
    *    Distance (in pixels) from top edge of card to where text box starts
    *    Adjust this value to leave space for larger or smaller postmark images
    */
    define("POPC_TEXT_OFFSET_TOP",75);

    /*
    *    
    *    You can change the language by editing this constant and replacing it with
    *    one of the language codes specified below.  If you translate PopCard into
    *    another language, why not e-mail it to info@pixaria.com to be included.
    *    
    *    de_DE        Deutsch                    German
    *    dk_DK        Dansk                    Danish
    *    en_GB        British English            
    *    es_ES        Castellano (Español)    Spanish
    *    fi_FI        Suomi                    Finnish
    *    fr_FR        Français                French
    *    id_ID        Bahasa Indonesian 
    *    nl_NL        Nederlands                Netherlands Dutch
    *    no_NO        Norsk (Nynorsk)            Norwegian - Nynorsk            
    *    pt_BR        Português                Brazilian Portuguese
    *    ro_RO        Română                    Romanian
    *    
    */
    define("POPC_LOCALISATION","en_GB");


    ?>
    Last edited by Webiter; 12-21-2011 at 03:42 PM. Reason: Fix test position link and add config.php code

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    when you enter the windows-style path
    PHP Code:
    "c:\windows\path\"; 
    the backslash (which is an escape character) causes PHP to ignore the closing double-quote. In your image, notice how the double-quote and semicolon are highlighted as if they are part of the string. Your string is actually ending halfway through the comment section, where it says ..."TRUE...

  3. #3
    Join Date
    Aug 2011
    Location
    Rep Of Ireland
    Posts
    126
    Thanks
    24
    Thanked 3 Times in 1 Post

    Default

    Not sure if I am getting the resolve to the point you are highlighting. Whatever I try leads me back to the same place.... ie when I send (test) the card to my email address the message arrives but no card!

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I might be missing something here... Did you fix the backslash issue? Are you still getting a parse error or not?
    PHP Code:
    // this is wrong
    define("POPC_TEMP_DIR","C:\Windows\Temp\"); 
    PHP Code:
    // you need to escape the backslash
    define("POPC_TEMP_DIR","C:\Windows\Temp\\"); 
    is there another problem you're encountering now?

  5. #5
    Join Date
    Aug 2011
    Location
    Rep Of Ireland
    Posts
    126
    Thanks
    24
    Thanked 3 Times in 1 Post

    Default

    Not logging any errors at the moment. Having installed your line like so:
    PHP Code:
    define("POPC_TEMP_DIR","C:\Windows\Temp\\"); 
    I no longer get the server error, but the selected card is not being held on the form fill in page?

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Wouldn't you need to escape all the backslashes? Like:

    PHP Code:
    define("POPC_TEMP_DIR","C:\\Windows\\Temp\\"); 
    And not only there, but also anywhere else you have them in strings, at least I would think. Standard practice for strings in almost any sort of code. Otherwise \W would either be just W or some special character, same with \T and so on if these appear elsewhere in strings in the code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    In PHP you only need to escape when it would specifically cause a problem. It's not the backslash that is the problem. It's the quote. In this very specific case, it ends up being the backslash, but because the backslash escapes (disables) the quote at the end. Backslashes are completely allowed in PHP except in a few cases where they make another character (or another backslash) escaped after them. So in short, no, just the backslash at the end before the quote.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  8. #8
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by jscheuer1 View Post
    Wouldn't you need to escape all the backslashes?
    [...]
    And not only there, but also anywhere else you have them in strings, at least I would think. Standard practice for strings in almost any sort of code. Otherwise \W would either be just W or some special character, same with \T and so on if these appear elsewhere in strings in the code.
    with PHP, not necessarily -- it's only required where the backslash would create an escape sequence. you could escape all of them to "play it safe," though - \ and \\ actually produce the same output:
    Quote Originally Posted by php.net/manual/en/language.types.string.php
    PHP Code:
    <?php
    // Outputs: You deleted C:\*.*?
    echo 'You deleted C:\\*.*?';

    // Outputs: You deleted C:\*.*?
    echo 'You deleted C:\*.*?';
    and, if you were to use single quotes instead of double quotes, you would only ever need to worry when the backslash precedes another single quote.
    Last edited by traq; 12-21-2011 at 11:02 PM.

  9. #9
    Join Date
    Aug 2011
    Location
    Rep Of Ireland
    Posts
    126
    Thanks
    24
    Thanked 3 Times in 1 Post

    Default

    In the demo position the additional backslash is in use as suggested as follows:
    PHP Code:
    define("POPC_TEMP_DIR","C:\Windows\Temp\\"); 
    however when a picture is selected it will not present or render on the next page of the demo?

    Is it the case that the image data is not now being kept in the temp file to facilitate the form fillout and later mailing on send?

    // -- Put image data into the temp file
    $fp = fopen(POPC_TEMP_DIR . $time, "w");
    fwrite($fp,$contents);
    fclose($fp);

  10. #10
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    have you checked that the file is being written correctly?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •