Results 1 to 3 of 3
  1. #1
    Join Date
    May 2011
    Posts
    8
    Plugin Contributions
    0

    Default cannot log to admin after adding language

    Hello,


    I installed fresh Zen Cart and wanted to add Polish language for the customers from this country (they are the target), but I wanted to keep English as the admin language. As there was no Polish translation to v1.50 (only to 1.39) I found Zen Cart installation in Polish v1.50, I decided to borrow Polish language folders and add them to my English installation.

    Initially everything worked perfectly:

    1. I uploaded Polish directory & polish.php file to includes/languages folder (on test site). I left English language folder and english.php there.

    2. I changed language in Admin/Localisation/Languages - bingo! I got even a little Polish flag flying.

    3. I checked my test site (herbonet.pl) and the language of the ZenCart shop was Polish. Yay!

    4. Now I have a problem: I CANNOT log into admin - I think this must be a consequence of language update/change (I do not remember if I logged off and never returned as admin until a few days later, this might have been the case). The message is: 'Remote server or file not found. Check that the address is spelled correctly, or try searching for the site.' Tried with 4 different browsers, cleared cookies and cache. Nil effect.

    5. I browsed Zen forum and found advice to check myDEBUG-adm log. And this is what I found in the log:

    [26-Jun-2012 15:21:42] PHP Warning: require(includes/languages/polish.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/renata/public_html/herbonet.pl/xadminx/includes/init_includes/init_languages.php on line 35

    [26-Jun-2012 15:21:42] PHP Warning: require(includes/languages/polish.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /home/renata/public_html/herbonet.pl/xadminx/includes/init_includes/init_languages.php on line 35

    [26-Jun-2012 15:21:42] PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/languages/polish.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/renata/public_html/herbonet.pl/xadminx/includes/init_includes/init_languages.php on line 35

    6. I checked init_languages.php file, but I am not a programmer and it's all Greek to me; besides this file ends at line 31.

    My ZenCart is v1.50. The folder with Polish language was also from v1.50. xadminx is not the real name of my admin folder.

    Any help would be highly appreciated. If any more information is needed, please let me know.


    Thanks,
    Jack

  2. #2
    Join Date
    Jun 2012
    Posts
    14
    Plugin Contributions
    0

    Default Re: cannot log to admin after adding language

    If you're file ends in "line 31", then you're init_languages.php file is corrupt or altered.

    Line #35 is:
    PHP Code:
    require(DIR_WS_LANGUAGES $_SESSION['language'] . '.php'); 
    Here is the entire xadminx/includes/init_includes/init_includes.php file:

    PHP Code:
    <?php
    /**
     * @package admin
     * @copyright Copyright 2003-2011 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: init_languages.php 18695 2011-05-04 05:24:19Z drbyte $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    // set the language
      
    if (!isset($_SESSION['language']) || isset($_GET['language'])) {

        include(
    DIR_WS_CLASSES 'language.php');
        
    $lng = new language();

        if (isset(
    $_GET['language']) && zen_not_null($_GET['language'])) {
          
    $lng->set_language($_GET['language']);
        } else {
          
    $lng->get_browser_language();
          
    $lng->set_language(DEFAULT_LANGUAGE);
        }

        
    $_SESSION['language'] = (zen_not_null($lng->language['directory']) ? $lng->language['directory'] : 'english');
        
    $_SESSION['languages_id'] = (zen_not_null($lng->language['id']) ? $lng->language['id'] : 1);
        
    $_SESSION['languages_code'] = (zen_not_null($lng->language['code']) ? $lng->language['code'] : 'en');
      }

    // temporary patch for lang override chicken/egg quirk
      
    $template_query $db->Execute("select template_dir from " TABLE_TEMPLATE_SELECT " where template_language in (" . (int)$_SESSION['languages_id'] . ', 0' ") order by template_language DESC");
      
    $template_dir $template_query->fields['template_dir'];

    // include the language translations
      
    require(DIR_WS_LANGUAGES $_SESSION['language'] . '.php');
      
    $current_page basename($PHP_SELF);
      if (
    file_exists(DIR_WS_LANGUAGES $_SESSION['language'] . '/' $current_page)) {
        include(
    DIR_WS_LANGUAGES $_SESSION['language'] . '/' $current_page);
      }

      if (
    $za_dir = @dir(DIR_WS_LANGUAGES $_SESSION['language'] . '/extra_definitions')) {
        while (
    $zv_file $za_dir->read()) {
          if (
    preg_match('/\.php$/'$zv_file) > 0) {
            require(
    DIR_WS_LANGUAGES $_SESSION['language'] . '/extra_definitions/' $zv_file);
          }
        }
        
    $za_dir->close();
      }
    Does yours look like that?

  3. #3
    Join Date
    Jun 2012
    Posts
    14
    Plugin Contributions
    0

    Default Re: cannot log to admin after adding language

    Now, we have this:

    xadminx\includes\configure.php
    PHP Code:
    Line 43:   define('DIR_WS_INCLUDES''includes/');
    Line 48:   define('DIR_WS_LANGUAGES'DIR_WS_INCLUDES 'languages/'); 
    xadminx\includes\init_includes\init_includes.php
    PHP Code:
    Line 35:   require(DIR_WS_LANGUAGES $_SESSION['language'] . '.php'); 
    So, what this tells me is that your "$_SESSION['language']" is not correct. Did you delete the contents of the "cache" folder in the root of your Zen site? Remember, cache is not stored in your browser, it's stored in the "cache" folder, or, depending on how you set it up, could be storing the cache in your database.

    Clear that cache and you should be fine.

 

 

Similar Threads

  1. v155 cannot log into admin after install
    By earmsby in forum Installing on a Linux/Unix Server
    Replies: 7
    Last Post: 26 Apr 2016, 08:26 PM
  2. v150 Cannot log in after adding www. redirect to .htaccess file
    By coreyalderin in forum General Questions
    Replies: 34
    Last Post: 19 Dec 2012, 05:23 PM
  3. v139h Cannot log in into admin after changing host
    By ekele in forum General Questions
    Replies: 2
    Last Post: 2 Sep 2012, 09:17 PM
  4. Cannot log in Admin Page after upgrade to V1.50
    By Honsan in forum Upgrading to 1.5.x
    Replies: 3
    Last Post: 9 Jan 2012, 01:49 PM
  5. cannot log in admin area after moveto new server
    By sunriseimports in forum Installing on a Linux/Unix Server
    Replies: 6
    Last Post: 16 Jun 2009, 02:57 AM

Posting Permissions

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