If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / cannot log to admin after adding language

cannot log to admin after adding language

Started by jaca on 30 Jun 2012, 9:40 AM · Views: 796

Results 1 to 3 of 3
30 Jun 2012, 9:40 AM
#1
jaca avatar

jaca

New Zenner

Join Date:
May 2011
Posts:
8
Plugin Contributions:
0

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

  1. 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 Jul 2012, 1:57 AM
#2
xwielder avatar

xwielder

New Zenner

Join Date:
Jun 2012
Posts:
14
Plugin Contributions:
0

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:

require(DIR_WS_LANGUAGES . $_SESSION['language'] . '.php');

Here is the entire xadminx/includes/init_includes/init_includes.php file:

<?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?

2 Jul 2012, 2:07 AM
#3
xwielder avatar

xwielder

New Zenner

Join Date:
Jun 2012
Posts:
14
Plugin Contributions:
0

Re: cannot log to admin after adding language

Now, we have this:

xadminx\includes\configure.php

Line 43:   define('DIR_WS_INCLUDES', 'includes/');
Line 48:   define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

xadminx\includes\init_includes\init_includes.php

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.