Support Forums | Demo Gallery [1.x] [2.x] | Downloads | News | Site Map ]
Nuked Gallery
  Create a FREE account or Login   As a guest, you don't have access to our FULL navigation system.
 Forum FAQForum FAQ   StatisticsStatistics   SearchSearch   UsergroupsUsergroups   FavoritesFavorites  

language preference not pulled from phpbb2

 
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB2 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic
Author Message
dari

Site Admin
Site Admin


Joined: Mar 03, 2003
Posts: 6284
Location: Washington Township, NJ, USA

PostPosted: Tue Nov 06, 2007 7:50 am    Post subject: language preference not pulled from phpbb2 Reply with quote

jettyrat-
i've got a user who noticed that when users are created, their language pref from phpbb2 is not pulled over. in g2helper.inc, in the createUser function, the $newUserData array doesn't include their language.

unfortunately, phpbb2 doesn't use standard en_US notation for language. rather, they say just "english".

the phpnuke integration has a "conversion" array to handle this, maybe this change should be made to the phpbb2 integration as well...

how does your phpbb3 integration handle the language?
_________________
Back to top
Offline View user's profile Send private message Visit poster's website
AdBot
   Post subject: language preference not pulled from phpbb2  

Back to top
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1139

PostPosted: Tue Nov 06, 2007 10:53 am    Post subject: Re: language preference not pulled from phpbb2 Reply with quote

Yep, I just looked at the phpBB2 g2helper 0.5.8 and the code that calls _createUser doesn't include the language.
Code: › $this->_createUser($userdata['user_id'], $userdata['user_level'], array(
   'username' => $userdata['username'],
   'hashedpassword' => $userdata['user_password'],
   'hashmethod' => 'md5',
   'email' => $userdata['user_email'],
   'fullname' => $userdata['username'])
);

Apparently I did that because of the discrepancy in the language naming schemes between phpBB2 and Gallery and didn't know what to do about it. If you have conversion code that can be put in, I will certainly add it on the next iteration of the phpBB2 integration. Smile

In the phpBB3 integration the same code that calls _createUser looks like this.
Code: › $this->_createUser($user->data['user_id'], $user->data['group_id'], array(
   'username' => $user->data['username'],
   'hashedpassword' => $user->data['user_password'],
   'email' => $user->data['user_email'],
   'fullname' => $user->data['username'],
   'language' => $user->data['user_lang'],
   'creationtimestamp' => time(),
   'hashmethod' => 'md5')
);

They used standard naming schemes in phpBB3. I just verified in phpBB3 the language is pulled over to Gallery when a new user is added...yay!
Back to top
Offline View user's profile Send private message
jettyrat

Moderator
Moderator


Joined: Nov 28, 2005
Posts: 1139

PostPosted: Fri Nov 16, 2007 5:54 pm    Post subject: Re: language preference not pulled from phpbb2 Reply with quote

Here is a fix that I will add to the phpBB2 integration. (edit the var $_langArray all you want for other languages)

Save this as lang_convert.class in the phpBB2 root directory:
Code: › <?php

class langConvert {

   // 2 Letter language abbreviations from ISO-639
   var   $_langArray = array(
         'aa' => 'afar',
         'ab' => 'abkhazian',
         'af' => 'afrikaans',
         'am' => 'amharic',
         'ar' => 'arabic',
         'as' => 'assamese',
         'ay' => 'aymara',
         'az' => 'azerbaijani',
         'ba' => 'bashkir',
         'be' => 'byelorussian',
         'bg' => 'bulgarian',
         'bh' => 'bihari',
         'bi' => 'bislama',
         'bn' => array('bengali', 'bangla'),
         'bo' => 'tibetan',
         'br' => 'breton',
         'ca' => 'catalan',
         'co' => 'corsican',
         'cs' => 'czech',
         'cy' => 'welsh',
         'da' => 'danish',
         'de' => 'german',
         'dz' => 'bhutani',
         'el' => 'greek',
         'en' => array('english', 'american'),
         'eo' => 'esperanto',
         'es' => 'spanish',
         'et' => 'estonian',
         'eu' => 'basque',
         'fa' => 'persian',
         'fi' => 'finnish',
         'fj' => 'fiji',
         'fo' => 'faeroese',
         'fr' => 'french',
         'fy' => 'frisian',
         'ga' => 'irish',
         'gd' => array('gaelic', 'scots gaelic'),
         'gl' => 'galician',
         'gn' => 'guarani',
         'gu' => 'gujarati',
         'ha' => 'hausa',
         'hi' => 'hindi',
         'hr' => 'croatian',
         'hu' => 'hungarian',
         'hy' => 'armenian',
         'ia' => 'interlingua',
         'ie' => 'interlingue',
         'ik' => 'inupiak',
         'in' => 'indonesian',
         'is' => 'icelandic',
         'it' => 'italian',
         'iw' => 'hebrew',
         'ja' => 'japanese',
         'ji' => 'yiddish',
         'jw' => 'javanese',
         'ka' => 'georgian',
         'kk' => 'kazakh',
         'kl' => 'greenlandic',
         'km' => 'cambodian',
         'kn' => 'kannada',
         'ko' => 'korean',
         'ks' => 'kashmiri',
         'ku' => 'kurdish',
         'ky' => 'kirghiz',
         'la' => 'latin',
         'ln' => 'lingala',
         'lo' => 'laothian',
         'lt' => 'lithuanian',
         'lv' => array('latvian', 'lettish'),
         'mg' => 'malagasy',
         'mi' => 'maori',
         'mk' => 'macedonian',
         'ml' => 'malayalam',
         'mn' => 'mongolian',
         'mo' => 'moldavian',
         'mr' => 'marathi',
         'ms' => 'malay',
         'mt' => 'maltese',
         'my' => 'burmese',
         'na' => 'nauru',
         'ne' => 'nepali',
         'nl' => 'dutch',
         'no' => 'norwegian',
         'oc' => 'occitan',
         'om' => array('oromo', 'afan'),
         'or' => 'oriya',
         'pa' => 'punjabi',
         'pl' => 'polish',
         'ps' => array('pashto', 'pushto'),
         'pt' => 'portuguese',
         'qu' => 'quechua',
         'rm' => 'rhaeto-romance',
         'rn' => 'kirundi',
         'ro' => 'romanian',
         'ru' => 'russian',
         'rw' => 'kinyarwanda',
         'sa' => 'sanskrit',
         'sd' => 'sindhi',
         'sg' => 'sangro',
         'sh' => 'serbo-croatian',
         'si' => 'singhalese',
         'sk' => 'slovak',
         'sl' => 'slovenian',
         'sm' => 'samoan',
         'sn' => 'shona',
         'so' => 'somali',
         'sq' => 'albanian',
         'sr' => 'serbian',
         'ss' => 'siswati',
         'st' => 'sesotho',
         'su' => 'sudanese',
         'sv' => 'swedish',
         'sw' => 'swahili',
         'ta' => 'tamil',
         'te' => 'tegulu',
         'tg' => 'tajik',
         'th' => 'thai',
         'ti' => 'tigrinya',
         'tk' => 'turkmen',
         'tl' => 'tagalog',
         'tn' => 'setswana',
         'to' => 'tonga',
         'tr' => 'turkish',
         'ts' => 'tsonga',
         'tt' => 'tatar',
         'tw' => 'twi',
         'uk' => 'ukrainian',
         'ur' => 'urdu',
         'uz' => 'uzbek',
         'vi' => 'vietnamese',
         'vo' => 'volapuk',
         'wo' => 'wolof',
         'xh' => 'xhosa',
         'yo' => 'yoruba',
         'zh' => 'chinese',
         'zu' => 'zulu',
      );

   function convert($language) {
      $notFound = true;
      $language = strtolower($language);

      foreach ($this->_langArray as $key => $value) {
         if (is_array($value)) {
            foreach ($value as $altValue) {
               if ($language == $altValue) {
                  $notFound = false;
                  break 2;
               }
            }
         }
         elseif ($language == $value) {
            $notFound = false;
            break;
         }
      }

      return (empty($notFound)) ? $key : '';
   }

}

?>


Open g2helper.inc and find:
Code: ›             $this->_createUser($userdata['user_id'], $userdata['user_level'], array(
               'username' => $userdata['username'],
               'hashedpassword' => $userdata['user_password'],
               'hashmethod' => 'md5',
               'email' => $userdata['user_email'],
               'fullname' => $userdata['username'])
            );

Replace with:
Code: ›             require('./lang_convert.class');
            $lang_convert = new langConvert();

            $this->_createUser($userdata['user_id'], $userdata['user_level'], array(
               'username' => $userdata['username'],
               'hashedpassword' => $userdata['user_password'],
               'hashmethod' => 'md5',
               'email' => $userdata['user_email'],
               'language' => $lang_convert->convert($userdata['user_lang']),
               'fullname' => $userdata['username'])
            );

Open admin/gallery2_export.php and find:
Code: › require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);

After, add:
Code: › require($phpbb_root_path . 'lang_convert.class');
$lang_convert = new langConvert();

Find:
Code: ›    $user_id = $row['user_id'];
   $args['fullname'] = $args['username'] = $g2h_admin->utf8Translate($row['username']);
   $args['hashedpassword'] = $row['user_password'];
   $args['hashmethod'] = 'md5';
   $args['email'] = $row['user_email'];
   $args['creationtimestamp'] = $row['user_regdate'];

Replace with:
Code: ›    $user_id = $row['user_id'];
   $args['fullname'] = $args['username'] = $g2h_admin->utf8Translate($row['username']);
   $args['hashedpassword'] = $row['user_password'];
   $args['hashmethod'] = 'md5';
   $args['email'] = $row['user_email'];
   $args['language'] = $lang_convert->convert($row['user_lang']);
   $args['creationtimestamp'] = $row['user_regdate'];
Back to top
Offline View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NukedGallery.net Forum Index » phpBB Integration » phpBB2 / Gallery 2 Integration View previous topicPrinter friendly versionView next topic

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours

Powered by phpBB © phpBB Group



Sponsors: Web HostingDedicated ServersDomain NamesDomain Name RegistrationDedicated Web HostingSEO Search Engine OptimisationSEOWeb Design New YorkSEO Web DesignWeb hosting AustraliaCheap Web Design

6th year online! 2003-2009
Legal • Use of this site consitutes agreement to the Acceptable Use Policy
Hosted by Implosion WorksSourceForge.net Logo • Theme by TonicMedia