4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on March 15, 2005, 12:38:45 AM

Title: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on March 15, 2005, 12:38:45 AM
Finaly u can add multilanguage support not only for the interface ( http://www.4homepages.de/forum/index.php?topic=4743.0 ) but also for any text, such as image names, description, anything. Since this is not "real" MOD, I will only show an example how to add this support to image names and description. (basicaly this is more for developers and who know little bit PHP and 4images code structure)

Q: How it works?
A: In the text u'll need add [language] (i.e. [english] or [deutsch]).
Yes, that's it, no [/language] tag requered.
- Everything that is followed after [language] will be used when this language was selected.
- If a text starts with something other then [language] tag and no [language] tag was matched with current language, then the text that can be found before FIRST [language] tag will be showed.
- If a text starts with a [language] tag, and none of the [language] tags are matching with current language, the script will try find [language] tag with 4images default language, if none was found, it will show text as is, with all [] tags.
- If u add [/language] (closing tag) and then add some text after it, that text will be ignored.

Try and see diffirent situations that could be and how this script handle them: http://gallery.vano.org/multilang.php

Here (http://gallery.vano.org/c3) is a little example.

Updated on 08-07-03 2:50PM (EST)

-------- [ Installation ] ----------
Step 1
Open global.php
Find:
Code: [Select]
$config['language_dir_default'] = $config['language_dir'];

Insert below:
Code: [Select]
$handle = opendir(ROOT_PATH."lang");
$config['language_list_array'] = array();
while ($folder = @readdir($handle)) {
  if (@is_dir(ROOT_PATH."lang/$folder") && $folder != "." && $folder != "..") {
    $config['language_list_array'][] = $folder;
  }
}
closedir($handle);
$config['language_list'] = "(".implode("|", $config['language_list_array']).")";



Step 2
Open includes/functions.php
Insert at the end, above closing ?>
Code: [Select]
function multilang($text, $show_first = 0, $remove = 0){
  global $config;
  preg_match("#\[".$config['language_dir']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#\[".$config['language_dir_default']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  if ($show_first) {
    preg_match("#\[".$config['language_list']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
    if (!empty($match[2])) {
      return $match[2];
    }
  }
  if ($remove) {
    return preg_replace("#\[".$config['language_list']."\](.*)#iDs", "", $text);
  }
  return $text;
}

function multilang_tag_remove($text){
  global $config;
  return preg_replace("#\[\/?".$config['language_list']."\]#iDUs", " ", $text);
}


Added 05-11-2005
Step 3 (optional)
With this step you'll be able add multilanguage support in date format.
Open global.php
Find:
Code: [Select]
include(ROOT_PATH.'includes/functions.php');Insert below:
Code: [Select]
$config['date_format'] = multilang($config['date_format']);
$config['time_format'] = multilang($config['time_format']);

Step 3.1
Open includes/functions.php
Find:
Code: [Select]
  return date($format, $timestamp + (3600 * $timezone_offset));Insert above:
Code: [Select]
  global $lang;
  if (isset($lang['date_translate']) && !empty($lang['date_translate']))
    return strtr(date($format, $timestamp + (3600 * $timezone_offset)), $lang['date_translate']);

Step 3.1 (optional, needed only if you want use names of month/weekday)
Open lang/<your language>/main.php
At the end, above closing ?> insert:
Code: [Select]
$lang['date_translate'] = array(
  "Monday" => "Понедельник",
  "Tuesday" => "Вторник",
  "Wednesday" => "Среда",
  "Thursday" => "Четверг",
  "Friday" => "Пятница",
  "Saturday" => "Суббота",
  "Sunday" => "Воскресенье",
  "Mon" => "Пон",
  "Tue" => "Втр",
  "Wed" => "Срд",
  "Thr" => "Чтв",
  "Fri" => "Птн",
  "Sat" => "Суб",
  "Sun" => "Вос",
  "January" => "Января",
  "February" => "Февраля",
  "March" => "Марта",
  "April" => "Апреля",
  "May" => "Мая",
  "June" => "Июня",
  "July" => "Июля",
  "August" => "Августа",
  "September" => "Сентября",
  "October" => "Октября",
  "November" => "Ноября",
  "December" => "Декабря",
  "Jan" => "Янв",
  "Feb" => "Фев",
  "Mar" => "Мар",
  "Apr" => "Апр",
  "May" => "Май",
  "Jun" => "Июн",
  "Jul" => "Июл",
  "Aug" => "Авг",
  "Sep" => "Сен",
  "Oct" => "Окт",
  "Nov" => "Ноя",
  "Dec" => "Дек",
  "AM" => "AM",
  "PM" => "PM",
  "am" => "am",
  "pm" => "pm",
);
Translate right side of the array (after =>) to your langauge. DO NOT TOUCH LEFT PART, WHICH MUST STAY IN ENGLISH

Step 3.3
Go to you ACP (Admin Control Panel) -> Settings and add [<your langauge>] tags to "Date" and "Time" format field.
For example in USA the date format is: month, day, year, (10.25.2005) in Europe is day, month, year (25.10.2005) so, the string in "Date" field should be:
Quote
[english]m.d.Y[russian]d.m.Y
For more info about the language tags, read below. And for more info about date format you can find here (http://php.net/manual/en/function.date.php)

This is it.
Now, let me show u how to use it:

You'll need send your text through multilang() function (i.e. echo multilang($text); this will print result after processing text from $text  variable)
Added two keys: multilang($text, $show_first, $remove)
$show_first = 1 would use first matching [language] as default, instead of showing entire text (case 4 and 5 in the example)
$remove = 1 would remove everything, instead of showing entire text (case 4 and 5 in the example)

Practical example:
-------- Image name and description ------------
Open includes/functions.php
Find:
Code: [Select]
    "image_name" => $image_row['image_name'],
    "image_description" => $description,


Replace with:
Code: [Select]
    "image_name" => multilang($image_row['image_name']),
    "image_description" => multilang($description),



Important! this is MUST do, otherwise your keywords will be messed up!

Open admin/images.php
Find:
Code: [Select]
          $search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);

Replace with:
Code: [Select]
          $search_words[$image_column] = multilang_tag_remove(stripslashes($HTTP_POST_VARS[$image_column]));


Find:
Code: [Select]
              $search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column.'_'.$i]);

Replace with:
Code: [Select]
              $search_words[$image_column] = multilang_tag_remove(stripslashes($HTTP_POST_VARS[$image_column.'_'.$i]));



Open member.php
Find TWO (2) times:
Code: [Select]
          $search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column]);

Replace BOTH with:
Code: [Select]
          $search_words[$image_column] = multilang_tag_remove(stripslashes($HTTP_POST_VARS[$image_column]));



P.S. I will updating this post if I think of something else ;)

P.P.S. in the attached file is provided saved google cached page of the original post with a few replys and some extra code.
Title: Re: [MOD] Multi-Language support for any text
Post by: abdoh2010 on April 04, 2005, 11:30:50 AM
is this like to write discribtion two time for english languge and the other languge ?
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on April 04, 2005, 02:06:54 PM
yes
Title: Re: [MOD] Multi-Language support for any text
Post by: abdoh2010 on April 04, 2005, 02:41:09 PM
that is great and usefal for a website that is just start using 4images but if we are talking about a website witch have more that 1000 item in his gallary than that will need to thing twice before using it
becouse he is ovisly will rewrite all the discribtion for all the items he have and that is had work even if it woth it

for me, i am planing to rewite all the discribtion for my 4images becuse my old discrbtion is not usefal and that is good time for me to use your MOD

thank you for doing what you do for us and for 4images
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on April 04, 2005, 02:56:39 PM
that is great and usefal for a website that is just start using 4images but if we are talking about a website witch have more that 1000 item in his gallary than that will need to thing twice before using it
no, u dont have to, unless u want use two or more languages.
Title: Re: [MOD] Multi-Language support for any text
Post by: abdoh2010 on April 04, 2005, 03:06:49 PM
Yes, I am orady using two languages, Arabic and English

I want to say another thing
Your MOD will increase the SEO for any 4images using your MOD
Double description and double keywords for the search engine
That's cool
Title: Re: [MOD] Multi-Language support for any text
Post by: om6acw on April 17, 2005, 05:19:57 AM
Hi Vano,
I did install your mode Multilang support for any text. Everything works fine, but I would like to use also for Simple News Publishing and that’s why I have changed the code in news.php (see below)

Code: [Select]
$site_template->register_vars(array(
    "news_title" => "<b>".multilang($news_row[$i]['news_title'])."</b>".sprintf($lang['news_posted_by'], $news_row[$i]['user_name'], format_date($config['date_format']." ".$config['time_format'], $news_row[$i]['news_date'])),
"news_text" =>multilang(format_text($news_row[$i]['news_text'], ((isset($config['news_html']))?$config['news_html']:0), 0, ((isset($config['news_bbcode']))?$config['news_bbcode']:1), ((isset($config['news_bbcodeimg']))?$config['news_bbcodeimg']:1))),
"admin_links" => $admin_links,
));

mode multilang works, but bbcode and html code stopped working. It appears as text only. Where did I make the mistake? Could someone please help me out so I can get them both working (bbcode and htmlcode)???
Thanks!
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on April 17, 2005, 05:31:19 AM
and what if u exchange possitions of miltilang and format_text:
instead of
Quote
multilang(format_text(
do it this way:
Quote
format_text(multilang(
Title: Re: [MOD] Multi-Language support for any text
Post by: om6acw on April 17, 2005, 05:45:26 AM
and what if u exchange possitions of miltilang and format_text:
instead of
Quote
multilang(format_text(
do it this way:
Quote
format_text(multilang(

I am trying now but no change  :cry:
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on April 17, 2005, 05:47:09 AM
ok, how bbcode doesnt work? do u see the tags or u dont?
Title: Re: [MOD] Multi-Language support for any text
Post by: om6acw on April 17, 2005, 05:52:30 AM
ok, how bbcode doesnt work? do u see the tags or u dont?

I have problem with hyperlink and image bbcode.
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on April 17, 2005, 05:57:24 AM
WHAT PROBLEM? would u describe it please? I'm not a psychic to read you mind.
Title: Re: [MOD] Multi-Language support for any text
Post by: om6acw on April 17, 2005, 06:14:34 AM
WHAT PROBLEM? would u describe it please? I'm not a psychic to read you mind.

I want too add picture into text but picture doesn't show in text and the same with hyperlink.
Title: Re: [MOD] Multi-Language support for any text
Post by: demontech on April 22, 2005, 06:00:34 PM
Hello Vano,

maybe i'm stupid but i don't understand in witch file and how i shoud write to explain for the gallery that
lattvia=lettland in swedish. And in this case is for my catigories i want to change to the swedish name when someone choose "swedish" on www.demontech.net
Title: Re: [MOD] Multi-Language support for any text
Post by: Sheon on June 05, 2005, 01:14:07 PM
How use multi-lang with categories names and description??? I try change categories.php, but it dont work.
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on June 05, 2005, 04:45:54 PM
Sheon
cat_name
cat_description
 :wink:



Hi V@no,

tnx for that modification - but I can't find out what to change to have the category name shown in the right language in the admin category list...
a simple change of
Code: [Select]
$category_list .= ">".$lang['after']." ".multilang($cat_cache[$val]['cat_name'])."</option>\n";did not help and the result is still not what I expect :(

Title: Re: [MOD] Multi-Language support for any text
Post by: demontech on June 05, 2005, 07:08:30 PM
http://www.4homepages.de/forum/index.php?topic=6749.0
can anyone help me?
look @ the buttom of the page...

//Demon
Title: Re: [MOD] Multi-Language support for any text
Post by: demontech on June 05, 2005, 07:55:39 PM
Okey i can even donate a few $
to 4images crew if they help me with this
as free help feels out on this one.
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on June 05, 2005, 08:14:53 PM
Hello Vano,

maybe i'm stupid but i don't understand in witch file and how i shoud write to explain for the gallery that
lattvia=lettland in swedish. And in this case is for my catigories i want to change to the swedish name when someone choose "swedish" on www.demontech.net
\me has no idea what do u mean....
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on June 05, 2005, 09:52:02 PM
tnx for that modification - but I can't find out what to change to have the category name shown in the right language in the admin category list...
a simple change of
Code: [Select]
$category_list .= ">".$lang['after']." ".multilang($cat_cache[$val]['cat_name'])."</option>\n";did not help and the result is still not what I expect :(


I'm confused..."admin category list"? what is it? in ACP? the screenshot u showed is dropdown on "regular" page...

for the categories names, u'll need search in files (mostly in includes/functions.php) for ['cat_name'] (which is only a part of a variable)
for example the full variable could look like: $cat_cache[$category_id]['cat_name'] or $cat_cache[$cat_id]['cat_name']
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on June 06, 2005, 06:51:33 PM
yep - if you edit a category in the ACP, you may choose if to change the cat into a subcategory - and the screenshot was this list.

I solved it - I missed to change cat_name variable in the get_category_dropdown_bits function in includes/functions.php
because I thought it will be somewhere in the admin-files  :roll:

TNX
Title: Re: [MOD] Multi-Language support for any text
Post by: demontech on June 15, 2005, 03:02:52 PM
Hello Vano,

maybe i'm stupid but i don't understand in witch file and how i shoud write to explain for the gallery that
lattvia=lettland in swedish. And in this case is for my catigories i want to change to the swedish name when someone choose "swedish" on www.demontech.net
\me has no idea what do u mean....


Well I mean as you have on your site http://gallery.vano.org
When i change the language to russian your catigories change to russian.
I have add all phpcode to all files functions.php and so on. But i don't know what todo next to proceed.
and get it work.
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on June 15, 2005, 03:13:09 PM
next, u'll need rename your categories, image names, etc
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on June 17, 2005, 02:34:55 PM
nice thing - there's a lot to change, to have this feature working flawless :)

But there's one little problem I could not solve on my own:


If you have a category and you set sorting by image name - it will absolutely mess up the sorting in there, if you rename some of the pictures to support more languages...
See here: http://photo.overlord.cz/categories.php?cat_id=38

How would it be possible to sort the images by the shown image name, not by the "whole image name" containing [czech] etc.?
Title: Re: [MOD] Multi-Language support for any text
Post by: V@no on June 18, 2005, 12:18:07 AM
that actualy a side effect of this method...the sorting being made directly in mysql, but the language select is in php...I have no sollution for this...by the way this affects anything sorted by name with multilang support...
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on June 18, 2005, 08:59:51 PM
that's a pitty... the feature itself is great, but this is the only little flaw...
 :(
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on August 02, 2005, 12:10:45 AM
Quote

but I can't find out what to change to have the category name shown in the right language in the admin category list


Is your objective to change the following method - from admin/categories.php file :

Quote

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">$cats['cat_name']."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";


to this :

Code: [Select]

echo "<img src=\"".ROOT_PATH."admin/images/folder.gif\" alt=\"\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?cat_id=".$cats['cat_id'])."\" target=\"_blank\">".multilang($cats['cat_name'])."</a>\n</b>&nbsp;&nbsp;&nbsp;&nbsp;";


Then, at the : "savecat" action :

Quote

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


to :

Code: [Select]

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


Then :

Quote

show_input_row($lang['field_category_name'], "cat_name", "", $textinput_size);
show_textarea_row($lang['field_description_ext'], "cat_description", "", $textarea_size);


to :

Code: [Select]

show_input_row($lang['field_category_name'], multilang("cat_name"), "", $textinput_size);
show_textarea_row($lang['field_description_ext'], multilang("cat_description"), "", $textarea_size);


Then, at the : "updatecat" action :

Quote

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


to :

Code: [Select]

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


Then :

Quote

show_input_row($lang['field_category_name'], "cat_name", $result['cat_name'], $textinput_size);
show_textarea_row($lang['field_description_ext'], "cat_description", $result['cat_description'], $textarea_size);


to :

Code: [Select]

show_input_row($lang['field_category_name'], multilang("cat_name"), multilang($result['cat_name']), $textinput_size);
show_textarea_row($lang['field_description_ext'], multilang("cat_description"), multilang($result['cat_description']), $textarea_size);


?

If not, then my apologize in advance. However, it works great for me. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on August 02, 2005, 12:22:41 PM
I get a strange error, since I've implemented this MOD...

When I upload a picture and add a quite long description in 3 languages (or just edit a long image description), I get this:
Quote
Processing image [czech]Hláška[english]MessageDialog[deutsch]Dialogfenster, ID 3333 ...
DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 1, 0, 0 FROM 4images_wordlist WHERE word_text = 'dne'
Duplicate entry '3333-10029' for key 1

DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 0, 1, 0 FROM 4images_wordlist WHERE word_text = 'take'
Duplicate entry '3333-9486' for key 1

DB Error: Bad SQL Query: INSERT INTO 4images_wordmatch (image_id, word_id, name_match, desc_match, keys_match) SELECT DISTINCT 3333, word_id, 0, 1, 0 FROM 4images_wordlist WHERE word_text = 'schön'
Duplicate entry '3333-10824' for key 1

Maybe it is just the case, when the image-description gets toooo long.
The description is saved without problems - so it seems to be an error somewhere 'round the search-index...
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on August 02, 2005, 02:15:49 PM
Strange. I can't reproduce this error. It doesn't even seem to be related with this addition. :|

Replace back :

Quote

$cat_name = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name'])));
$cat_description = multilang(un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description'])));


to :

Code: [Select]

$cat_name = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_name']));
$cat_description = un_htmlspecialchars(trim($HTTP_POST_VARS['cat_description']));


Will it work ?

There's also a line I forgot to comment out - in your admin/home.php file :

find :

Quote

".$row['cat_name']."


replace with :

Code: [Select]

".multilang($row['cat_name'])."

Title: Re: [MOD] Multi-Language support for any text
Post by: Alex01 on September 01, 2005, 10:15:41 PM
What can I do that I can add texts in more languages to the picture when I upload it?

GER - PIC NAME
-----TEXT BOX------

ENG - PIC NAME
-----TEXT BOX------


Thanks
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 02, 2005, 12:01:58 AM
Quote

What can I do that I can add texts in more languages to the picture when I upload it?


That would be in your lang/<your_lang>/main.php file.

Then, you need to register each strings you've added into your includes/page_header.php file. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Xyu BAM on September 02, 2005, 12:57:57 AM
What can I do that I can add texts in more languages to the picture when I upload it?

GER - PIC NAME
-----TEXT BOX------

ENG - PIC NAME
-----TEXT BOX------


Thanks
I guess just add more languages to the string (text)...


@martrix:
if I'm not misstaken, you also need add multilang to the code that handles keywords...dont know where exactly though, sorry.
Let me know if you find it, I need it too :)
Title: Re: [MOD] Multi-Language support for any text
Post by: Alex01 on September 02, 2005, 10:27:40 PM
Can you send me pleas an example...  :oops:
In witch file must I what add  :oops:


Thanks
Title: Re: [MOD] Multi-Language support for any text
Post by: martrix on September 09, 2005, 10:56:31 AM
Can you send me pleas an example... :oops:
In witch file must I what add :oops:
Please see the practical example in V@no's original posting! That should give you a hint, what to do. A complete step-by-step tutorial, what to do would be veeery long - because everybody has a different need to implement this and there are many variables on many places to be changed.

If I'm not misstaken, you also need add multilang to the code that handles keywords...dont know where exactly though, sorry.
Let me know if you find it, I need it too :)
I'm not sure at the moment if I need it - my first thought was to show only the keywords of the actual language, but then I decided that I will (in far future) hide the keyword-overview on the search form.
But if you'll find out a nice solution - let me know ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: donpedro on September 10, 2005, 11:43:07 AM
TheOracle

Hi,
I think thats a really great MOD.
I only want to have my categories and subcategories in multilang mode, is this the right way ?

---> your post from  August 02, 2005, 12:10:45 AM

(I only want to be shure to do the correct changes)

regards
dp
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 11:57:36 AM
Quote

I only want to have my categories and subcategories in multilang mode, is this the right way ?


From which page exacly would you like to make those changes ?
Title: Re: [MOD] Multi-Language support for any text
Post by: donpedro on September 10, 2005, 12:05:51 PM
Hi,
I am not shure if Iunderstand your question

I am running my 4images with 6 languages and the only thing I am missing is the possibility to have my categories named and displayed in the several languages.

e.g.  "Strassen & Plätze"  in german = "Streets" in english = "Calles" in spanish and so on

http://www.badenfotos.com

thx
dp
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 12:10:31 PM
If you mean - generally speaking ; you'd need to find all :

Quote

"image_name" => $image_row['image_name'],


and change each of them to :

Code: [Select]

"image_name" => multilang($image_row['image_name']),


(and that includes the admin's content).
Title: Re: [MOD] Multi-Language support for any text
Post by: donpedro on September 10, 2005, 12:17:02 PM
only the cat names would be neough
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 12:21:40 PM
Would be this one, for all files, then :

Quote

"cat_name" => $image_row['cat_name'],


into :

Code: [Select]

"cat_name" => multilang($image_row['cat_name']),

Title: Re: [MOD] Multi-Language support for any text
Post by: donpedro on September 10, 2005, 12:31:36 PM
o.k. I will try it,

thx, have a nice weekend

dp
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 10, 2005, 03:45:36 PM
I have problems with the image_name in the clickstream on the detailview.
Example: http://www.gpaed.de/bildergalerie/details.php?image_id=40
Do I habe to change the code in the details.php.
When 'yes', what do I habe do change?

Thank you
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 03:48:43 PM
Quote

I have problems with the image_name in the clickstream on the detailview.


Not too sure it has anything to do with this MOD but assure that you have the following context in your details.php file :

Code: [Select]

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if ($mode == "lightbox" && $in_mode) {
  $page_url = "";
  if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
    if (!empty($regs[1]) && $regs[1] != 1) {
      $page_url = "?".URL_PAGE."=".$regs[1];
    }
  }
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
}
elseif ($mode == "search" && $in_mode) {
  $page_url = "";
  if (preg_match("/".URL_PAGE."=([0-9]+)/", $url, $regs)) {
    if (!empty($regs[1]) && $regs[1] != 1) {
      $page_url = "&amp;".URL_PAGE."=".$regs[1];
    }
  }
  $clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
  $clickstream .= get_category_path($cat_id, 1).$config['category_separator'];
}
$clickstream .= multilang($image_name)."</span>";

Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 10, 2005, 03:53:33 PM
Hi TheOracle,
I must have been blind.

It was this line in details.php
Code: [Select]
$image_name = htmlspecialchars($image_row['image_name']);
I've changed it to
Code: [Select]
$image_name = multilang(htmlspecialchars($image_row['image_name']));
Thank you for the fast answer
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 03:56:33 PM
Excellent. Thanks for posting this.

In the mean time, don't forget this part :

Quote

$clickstream .= $image_name."</span>";


with :

Code: [Select]

$clickstream .= multilang($image_name)."</span>";

Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 10, 2005, 04:42:01 PM
Code: [Select]
$clickstream .= $image_name."</span>";
Hm I tryed this line first an it had no effect, so I didnt change it.
Everything works without the change.
What is changed with this code
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 10, 2005, 04:57:21 PM
Right. Sorry, I thought it was the $image_row['image_name'] string and not the $image_name. Leave it behind then. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 11, 2005, 02:05:43 AM
Has anybody an idea, how to apply the
Mod "random image"
http://www.4homepages.de/forum/index.php?topic=1020.0

and the
Mod "Include NEWEST in some other page PLUG-IN" with Multi-Language support
http://www.4homepages.de/forum/index.php?topic=6816.0

The both mods print out image name without multilanguage support
The image name shows "Bild [english]picture"

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 13, 2005, 09:32:09 PM
Has anybody an idea, how to apply the
Mod "random image"
http://www.4homepages.de/forum/index.php?topic=1020.0

and the
Mod "Include NEWEST in some other page PLUG-IN" with Multi-Language support
http://www.4homepages.de/forum/index.php?topic=6816.0

The both mods print out image name without multilanguage support
The image name shows "Bild [english]picture"

Matthias

When I'm trying to change the code from the Mod "Include NEWEST in some other page PLUG-IN"
like this => changed line see below in the code: $image_name = multilang($row['image_name']);
in the original code it's: $image_name = $row['image_name'];

Code: [Select]
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('SCRIPT_URL''/********/bildergalerie/');
define('ROOT_PATH''/*******/bildergalerie/');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');
$site_db = new Db($db_host$db_user$db_password$db_name);
function 
is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}
$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_hits
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat="
.AUTH_ALL."
        AND b.auth_viewimage="
.AUTH_ALL."
        ORDER BY image_date DESC
        LIMIT 3"
;
$result $site_db->query($sql);
while (
$row $site_db->fetch_array($result)) {
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_hits $row['image_hits'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo 
"<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=_parent><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo 
"<br><b>$image_name</b><br>\n";
echo 
"Hits: $image_hits<br><br>\n";
}
?>


I get the following error
Quote
Fatal error: Call to undefined function: multilang()


Any ideas what's going wrong?
Matthias

Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 14, 2005, 12:01:41 AM
These codings involves unsafed methods and unglobalized detections towards 4images. Which is why, you actually encounter difficulties loading your quoted MOD.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 14, 2005, 02:39:26 PM
Hi TheOracle,

so the only solution ist to take out this part 
Code: [Select]
$image_name = multilang($row['image_name']);
  :cry:

Or do you have another solution?

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: Xyu BAM on September 14, 2005, 02:46:13 PM
These codings involves unsafed methods and unglobalized detections towards 4images. Which is why, you actually encounter difficulties loading your quoted MOD.
o my o my...sometimes its better not to reply at all if you have no answer, instead of replying with something only you could possibly understand...

@Matthias70:
add below
Code: [Select]
include(ROOT_PATH.'includes/constants.php');this line:
Code: [Select]
include(ROOT_PATH.'includes/functions.php');
If it will give you some warnings or error messages, then add the new functions (that you've inserted in functions.php) under that line.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 14, 2005, 03:49:21 PM
These codings involves unsafed methods and unglobalized detections towards 4images. Which is why, you actually encounter difficulties loading your quoted MOD.
o my o my...sometimes its better not to reply at all if you have no answer, instead of replying with something only you could possibly understand...

@Matthias70:
add below
Code: [Select]
include(ROOT_PATH.'includes/constants.php');this line:
Code: [Select]
include(ROOT_PATH.'includes/functions.php');
If it will give you some warnings or error messages, then add the new functions (that you've inserted in functions.php) under that line.

Thank you for your answer Xyu BAM,
but now I get the following error
Quote
Fatal error: Cannot redeclare is_remote() (previously declared in /www/htdocs/****/neue4images.php:10) in /www/htdocs/****/bildergalerie/includes/functions.php on line 38

And I don't know what to change in includes.php. The mulitlang Mod is aleready installed.
The only problem is the image_name outside 4images on my homepage.
Outside 4images the image_name is shown without multilang Mod, that means the image name shows something like this Wasser[english]Water ?

Do you understand the problem?
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 12:12:44 AM
@Matthias70:

Quote

Fatal error: Cannot redeclare is_remote() (previously declared in /www/htdocs/****/neue4images.php:10) in /www/htdocs/****/bildergalerie/includes/functions.php on line 38


Remove this part from your file :

Code: [Select]

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}


as it is already been initialized by includes/functions.php file. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 12:22:08 AM
Quote

o my o my...sometimes its better not to reply at all if you have no answer, instead of replying with something only you could possibly understand...


Oh my, oh my, oh my. Sometimes it's better to post some MODs like I do for these users rather than critisizing...
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 03:17:44 PM
Thank you TheOracle,
now the code for the new.php outside of 4imaes looks like this (see below)
I'm getting no error anymore, but the image_name still prints out somthing like Wasser[english]water ???
Multilang Imagenames and and Multilang Description on my whole 4images page is O.K.
But the random image an the newest on homepage are still not working.

What else can I do?
Thanks
Matthias

Code: [Select]
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('SCRIPT_URL''http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH''/www/htdocs/******/bildergalerie/');
include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');
include(
ROOT_PATH.'includes/functions.php');
$site_db = new Db($db_host$db_user$db_password$db_name);
$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_hits
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat="
.AUTH_ALL."
        AND b.auth_viewimage="
.AUTH_ALL."
        ORDER BY image_date DESC
        LIMIT 3"
;
$result $site_db->query($sql);
while (
$row $site_db->fetch_array($result)) {
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_hits $row['image_hits'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo 
"<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=_parent><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo 
"<br><b>$image_name</b><br>\n";
echo 
"Hits: $image_hits<br><br>\n";
}
?>
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 05:13:20 PM
Well, first -

replace :

Quote

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
include(ROOT_PATH.'includes/functions.php');
$site_db = new Db($db_host, $db_user, $db_password, $db_name);


with :

Code: [Select]

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


(Note: Still respecting your ROOT_PATH folder).

However, regarding your SCRIPT_URL, I think you forgot to mask it before posting the quote on the topic.  :mrgreen:

Then, replace this block :

Quote

echo "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=_parent><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>$image_name</b><br>\n";
echo "Hits: $image_hits<br><br>\n";


with this one :

Code: [Select]

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


Tell me how it goes from there. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 05:38:06 PM
Quote
However, regarding your SCRIPT_URL, I think you forgot to mask it before posting the quote on the topic. 
That's no problem. Come and visit my site  8)

I get the following error...

Quote
Parse error: parse error, unexpected ';' in /www/htdocs/******/neue4images.php on line 26

The error is in this line
Code: [Select]
echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id."\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
Did not know that it would be so difficult
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 05:44:56 PM
Quote

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id."\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";


I always forget a ")" when using $site_sess don't I ?  :mrgreen:

Ok, replace it with :

Code: [Select]

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";


Should work now. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 06:22:36 PM
Wow TheOracle,
it works
thank you very much.

I don't dare to ask  :oops:
What about the Mod "random image" outside 4images
http://www.4homepages.de/forum/index.php?topic=1020.0

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 06:25:39 PM
Quote

What about the Mod


Yes ... what about it ?

Quote

But the random image an the newest on homepage are still not working.


Specifics please.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 06:33:39 PM
First, just one small problem with the link to details.php in the mod newest picture on homepage

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";

The URL to the details page is wrong.
The URL is like  root_path/script url/details.php
root_path or script url one is enough.

My problem with the random image Mod outside 4images is the same as with the newest images Mod
The multilang image_name is not shown in the right way but like this  Wasser[english]water

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 06:49:14 PM
Quote

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";


Correct. Which is why, you must

replace :

Quote

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


with :

Code: [Select]

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


and use the SCRIPT_URL from your includes/constants.php file since the definition is already detected from your global.php file since global.php is included in this file as well. ;)

Quote

The multilang image_name is not shown in the right way but like this  Wasser[english]water


Ah ! now I see.

Ok, so let's do this.

Code: [Select]

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('ROOT_PATH''/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;

$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";

$row $site_db->query_firstrow($sql);

$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo 
"<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"".$image_name."\"></a>\n"
echo "<b>".$image_name."</b><br>\n";
echo 
$lang['comments'] . REPLACE_EMPTY $image_comments."<br>\n";
unset (
$number);

?>


Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 07:03:28 PM
Correct. Which is why, you must

replace :

Quote

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('SCRIPT_URL', 'http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


with :

Code: [Select]

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES', 1);
define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();


and use the SCRIPT_URL from your includes/constants.php file since the definition is already detected from your global.php file since global.php is included in this file as well. ;)

That did not work.
I changed in the path to details php the ROOT_PATH with the SCRIPT_PATH
so my php-file Newest Image outside 4images looks like this

Code: [Select]
<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('SCRIPT_URL''http://www.gpaed.de/bildergalerie/');
define('ROOT_PATH''/www/htdocs/v030672/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_hits
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat="
.AUTH_ALL."
        AND b.auth_viewimage="
.AUTH_ALL."
        ORDER BY image_date DESC
        LIMIT 3"
;
$result $site_db->query($sql);
while (
$row $site_db->fetch_array($result)) {
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_hits $row['image_hits'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo 
"<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo 
"<br><b>".$image_name."</b><br>\n";
echo 
$lang['hits'] . REPLACE_EMPTY $image_hits."<br><br>\n";
}
?>

Again, Thank you very much for your help, TheOracle
Now I'm trying your code suggestion for random image
Matthias



Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 07:09:21 PM
Quote

Now I'm trying your code suggestion for random image


Sure, let me know how it goes. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 07:10:42 PM
Hm your code suggestion for random image sent me back the following error

Quote
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in /www/htdocs/******/random.php on line 66

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 07:26:05 PM
Uncomment this line :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


to see if the error will show again. If not, then I might have the answer on why it returns a T_ECHO error message.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 07:30:14 PM
Uncomment this line :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


to see if the error will show again. If not, then I might have the answer on why it returns a T_ECHO error message.


The error is the same
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 07:36:09 PM
Ok, then,

replace :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


with :

Code: [Select]

$msg = $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";

Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 07:52:58 PM
Ok, then,

replace :

Quote

echo $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


with :

Code: [Select]

$msg = $lang['comments'] . REPLACE_EMPTY . $image_comments."<br>\n";


There is still this error
Quote
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in /www/htdocs/******/random.php on line 66

 :(
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 07:54:36 PM
Are you sure you're working on the same file ?

If so,

change :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


replace with :

Code: [Select]

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/

Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 08:02:17 PM
Are you sure you're working on the same file ?

If so,

change :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


replace with :

Code: [Select]

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/


Now that's the error message
Quote
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/******/index.php:4) in /www/htdocs/******/bildergalerie/includes/sessions.php on line 79

my file looks now like this
Code: [Select]
<?php
/**************************************************************************
*                                                                        *
*    4images - A Web Based Image Gallery Management System               *
*    ----------------------------------------------------------------    *
*                                                                        *
*             File: random.php                                           *
*        Copyright: (C) 2002 Jan Sorgalla                                *
*            Email: jan@4homepages.de                                    *
*              Web: http://www.4homepages.de                             *
*    Scriptversion: 1.0 for 4images 1.6.1                                *
*                                                                        *
*    Never released without support from: Nicky (http://www.nicky.net)   *
*                                                                        *
**************************************************************************
*                                                                        *
*    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
*    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
*    weitere Informationen.                                              *
*    ---------------------------------------------------------------     *
*    This script is NOT freeware! Please read the Copyright Notice       *
*    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
*    information.                                                        *
*                                                                        *
*************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('GET_CACHES'1);
define('ROOT_PATH''/www/htdocs/******/bildergalerie/');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL."
        "
;

$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat="
.AUTH_ALL.
        AND b.auth_viewimage="
.AUTH_ALL.
        LIMIT 
$number, 1";

$row $site_db->query_firstrow($sql);

$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name multilang($row['image_name']);
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);

?>

Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 08:08:27 PM
Too much spaces :

Quote

$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);

?>


replace with :

Code: [Select]

$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
/*echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";*/
unset ($number);
?>

Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 08:15:09 PM
No error anymore, but when I comment the uncommented line (o god my english), there is no thumbnail and the path is like this
http://www.gpaed.de/SCRIPT_URLdetails.php?image_id=184

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 08:20:03 PM
Quote

http://www.gpaed.de/SCRIPT_URLdetails.php?image_id=184


Well, I mentionned earlier not to use the SCRIPT_URL since your global.php file includes all these instances already - including constants.php file. ;)

Meaning,

by replacing :

Quote

echo "<a href=\"".$site_sess->url(SCRIPT_URL."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


with :

Code: [Select]

echo "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id)."\"><img src=\"".$thumb_src."\" border=\"0\"></a>\n";
echo "<br><b>".$image_name."</b><br>\n";
echo $lang['hits'] . REPLACE_EMPTY . $image_hits."<br><br>\n";


it has to work.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 08:28:30 PM
Still not working  :cry:

But there 's something strange
When I'm going to my homepage from the 4images gallery, there is no thumbnail and path to details.php is like this
http://www.gpaed.de/www/htdocs/******/bildergalerie/details.php?image_id=261


When I going directly to my homepage this is the error:
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/*******/index.php:4) in /www/htdocs/******/bildergalerie/includes/sessions.php on line 79


Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 08:44:18 PM
Exacly so

replace :

Quote

define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');


with :

Code: [Select]

define('ROOT_PATH', './');


and it should work.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 08:53:14 PM
Exacly so

replace :

Quote

define('ROOT_PATH', '/www/htdocs/******/bildergalerie/');


with :

Code: [Select]

define('ROOT_PATH', './');


and it should work.


Quote
Warning: main(./global.php) [function.main]: failed to create stream: No such file or directory in /www/htdocs/******/random.php on line 31

Another error  :wink:
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 08:56:26 PM
This error is related to your server end. If you're not the actual hosting service provider, you're being asked to make contact with them in order to resolve this problem.
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 09:00:13 PM
This error is related to your server end. If you're not the actual hosting service provider, you're being asked to make contact with them in order to resolve this problem.

I've installed your php server information mod. Thank you for that.
And it says: everything is O.K.?

Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 09:02:49 PM
Quote

And it says: everything is O.K.?


From the Global Server Information MOD - on top - everything is being captured as is. In the mean time, it wouldn't be a bad idea to PM me the info between my indicated /* Start copying below */ and /* Stop copying above */ paragraph and with this topic. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 15, 2005, 09:06:45 PM
From the Global Server Information MOD - on top - everything is being captured as is. In the mean time, it wouldn't be a bad idea to PM me the info between my indicated /* Start copying below */ and /* Stop copying above */ paragraph and with this topic. ;)
Quote

Sorry, I dont understand what you mean?
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: TheOracle on September 15, 2005, 09:12:44 PM
Since you installed the Global Server Information MOD, simply read the instructions from that plugin file on top of that page. ;)
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on September 26, 2005, 10:04:43 PM
Hallo

Irgendwie klappt der MOD bei mir nicht so richtig  :cry:

Wenn ich z.B. bei der Kategorie Türkei[deutsch]turkey[english] eintrage, erscheint im Control Center je nach Einstellung der Sprache das richtige Wort. Leider erscheint in der categories.php und details.php der gesamte Eintrag  [english]turkey[deutsch]Türkei . Das gleiche Problem gilt auch bei clickstream und der Vorschaubildbeschreibung.

Was mache ich falsch.....

Hat jemand einen Tipp für mich, denn inzwischen habe ich schon so viel in den Dateien geändert, dass ich nicht mehr so richtig weiter weiß?

Zum Vergleich anbei meine Categorie.php

Steffen

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: categories.php                                       *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$templates_used 'categories,category_bit,thumbnail_bit';
$main_template 'categories';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

if (!
$cat_id || !isset($cat_cache[$cat_id]) || !check_permission("auth_viewcat"$cat_id)) {
  
header("Location: ".$site_sess->url(ROOT_PATH."index.php""&"));
  exit;
}

$cache_id create_cache_id(
  
'cat.page.categories',
  array(
    
$user_info[$user_table_fields['user_id']],
    
$cat_id,
    
$page,
    
$perpage,
    isset(
$user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 08) : 0,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

if (!
$cache_page_categories || !$content get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_categories) {
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'get';
}

ob_start();

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
if (!check_permission("auth_upload"$cat_id)) {
  
$upload_url "";
  
$upload_button "<img src=\"".get_gallery_image("upload_off.gif")."\" border=\"0\" alt=\"\" />";
}
else {
  
$upload_url $site_sess->url(ROOT_PATH."member.php?action=uploadform&amp;".URL_CAT_ID."=".$cat_id);
  
$upload_button "<a href=\"".$upload_url."\"><img src=\"".get_gallery_image("upload.gif")."\" border=\"0\" alt=\"\" /></a>";
}

$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image($cat_id);
$site_template->register_vars(array(
  
"categories" => get_categories($cat_id),
  
"cat_name" => htmlspecialchars($cat_cache[$cat_id]['cat_name']),
  
"cat_description" => $cat_cache[$cat_id]['cat_description'],
  
"cat_hits" => $cat_cache[$cat_id]['cat_hits'],
  
"upload_url" => $upload_url,
  
"upload_button" => $upload_button,
  
"random_cat_image" => $random_cat_image
));

unset(
$random_cat_image);

//-----------------------------------------------------
//--- Show Images -------------------------------------
//-----------------------------------------------------
$num_rows_all = (isset($cat_cache[$cat_id]['num_images'])) ? $cat_cache[$cat_id]['num_images'] : 0;
$link_arg $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id);

include(
ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
$offset $getpaging->get_offset();

$site_template->register_vars(array(
  
"paging" => $getpaging->get_paging(),
  
"paging_stats" => $getpaging->get_paging_stats()
));

$imgtable_width ceil((intval($config['image_table_width'])) / $config['image_cells']);
if ((
substr($config['image_table_width'], -1)) == "%") {
  
$imgtable_width .= "%";
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
        FROM "
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1 AND i.cat_id = 
$cat_id AND c.cat_id = i.cat_id
        ORDER BY "
.$config['image_order']." ".$config['image_sort']."
        LIMIT 
$offset$perpage";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$thumbnails "";
  
$msg $lang['no_images'];
}
else {
  
$thumbnails "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)){
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    
show_image($image_row);
    
$thumbnails .= $site_template->parse_template("thumbnail_bit");
    
$thumbnails .= "\n</td>\n";

    
$count++;
    if (
$count == $config['image_cells']) {
      
$thumbnails .= "</tr>\n";
      
$count 0;
    }
  } 
// end while

  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover 0) {
      for (
$i 0$i $leftover$i++){
        
$thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$thumbnails .= "</tr>\n";
    }
  }
  
$thumbnails .= "</table>\n";
//end else
$site_template->register_vars("thumbnails"$thumbnails);
unset(
$thumbnails);

//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].get_category_path($cat_id)."</span>";
$page_title $config['category_separator'].get_category_path_nohtml($cat_id); // MOD: Dynamic page title

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"page_title" => $page_title // MOD: Dynamic page title
));
$site_template->print_template($site_template->parse_template($main_template));

// MOD: Dynamic page title BLOCK BEGIN
//-----------------------------------------------------
//--- Parse Header & Footer ---------------------------
//-----------------------------------------------------
if (isset($main_template) && $main_template) {
  
$header $site_template->parse_template("header");
  
$footer $site_template->parse_template("footer");
  
$site_template->register_vars(array(
    
"header" => $header,
    
"footer" => $footer
  
));
  unset(
$header);
  unset(
$footer);
}
// MOD: Dynamic page title BLOCK END

$content ob_get_contents();
ob_end_clean();

if (
$cache_page_categories) {
  
// Reset session mode
  
$site_sess->mode $old_session_mode;

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

//Update Category Hits
if ($user_info['user_level'] != ADMIN && $page == 1) {
  
$sql "UPDATE ".CATEGORIES_TABLE."
          SET cat_hits = cat_hits + 1
          WHERE cat_id = 
$cat_id";
  
$site_db->query($sql);
}

include(
ROOT_PATH.'includes/page_footer.php');
?>
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 26, 2005, 10:11:51 PM
Diesen Bereich
Quote
"cat_name" => htmlspecialchars($cat_cache[$cat_id]['cat_name']),
  "cat_description" => $cat_cache[$cat_id]['cat_description'],

in

Code: [Select]
"cat_name" => multilang(htmlspecialchars($cat_cache[$cat_id]['cat_name'])),
"cat_description" => multilang(htmlspecialchars($cat_cache[$cat_id]['cat_description'])),


abändern.

Mir kannst du dafür sagen, was du im Admin-Bereich geändert hast.
Im Control-Center schaffe ich es nämlich nicht die Kategorie und Bildernamen richtig anzuzeigen :-(

Gruß
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on September 27, 2005, 09:31:32 PM
Diesen Bereich
Quote
"cat_name" => htmlspecialchars($cat_cache[$cat_id]['cat_name']),
  "cat_description" => $cat_cache[$cat_id]['cat_description'],

in

Code: [Select]
"cat_name" => multilang(htmlspecialchars($cat_cache[$cat_id]['cat_name'])),
"cat_description" => multilang(htmlspecialchars($cat_cache[$cat_id]['cat_description'])),


abändern.

Gruß
Matthias


Hallo Matthias,

irgendwie klappt das nicht so richtig. Die Beschreibung ist auf einen Mal nicht mehr html fähig. Ist da im Code noch ein Fehler. Es ändert sich vor allem im Clickstream nix.
Dafür haben mir die Tipps bei der Detail.php geholfen.

Anbei zum Vergleich meine home.php Leider geht es mir da wie dir. Ich weiß schon nicht mehr was ich geändert habe.

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: home.php                                             *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$stats_limit 5;

define('IN_CP'1);
define('ROOT_PATH''./../');
require(
'admin_global.php');

if (
$action == "") {
  $action "home";
}

show_admin_header();

$ip_whois_link "http://www.ripe.net/perl/whois/?searchtext=";

if (
$action == "home") {
  if (!defined('USER_INTEGRATION')) {
    printf("<span class=\"headline\">%s</span><br /><br />"$lang['headline_whosonline']);
    echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";
    echo "<tr class=\"tableseparator\">\n";
    echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">&nbsp;</td>\n<td class=\"tableseparator\">".$lang['field_ip']."</td>\n</tr>\n";

    $num_total_online 0;
    $num_visible_online 0;
    $num_invisible_online 0;
    $num_registered_online 0;
    $num_guests_online 0;
    $user_online_list "";
    $prev_user_id "";
    $prev_ip "";

    $sql "SELECT ".get_user_table_field("u.""user_id").get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_location").get_user_table_field(", u.""user_invisible").", s.session_user_id, s.session_lastaction, s.session_ip 
    FROM "
.USERS_TABLE." u, ".SESSIONS_TABLE." s
    WHERE "
.get_user_table_field("u.""user_id")." = s.session_user_id AND s.session_user_id <> ".GUEST." AND ".get_user_table_field("u.""user_lastaction")." > ".(time() - 300)."
    ORDER BY session_ip ASC"
;
    $result $site_db->query($sql);

    while ($row $site_db->fetch_array($result)) {
      if ($row['session_user_id'] != $prev_user_id) {
        echo "<tr class=\"".get_row_bg()."\">\n";
        $user_id $row['session_user_id'];
        $username $row[$user_table_fields['user_name']];

        $is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 0;
        if ($is_invisible) { // Invisible User but show to Admin
          $invisibleuser "*";
        }
        else {
          $invisibleuser "";
          $num_visible_online++;
        }
        if ($row[$user_table_fields['user_level']] == ADMIN) {
          $username sprintf("<b>%s</b>"$username);
        }
        if (empty($user_profile_link)) {
          $username "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_id)."\" target=\"_blank\">".$username."</a>";
        }
        echo "<td>".$username.$invisibleuser."</td>\n";
        echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</td>\n";

        if (eregi("Control Panel"$row[$user_table_fields['user_location']])) {
          echo "<td>Control Panel</td>";
        }
        else {
          echo "<td><a href=\"".$site_sess->url(ROOT_PATH.$row[$user_table_fields['user_location']])."\" target=\"_blank\">".$row[$user_table_fields['user_location']]."</a></td>\n";
        }
        echo "<td><a href=\"".$ip_whois_link.$row['session_ip']."\" target=\"_blank\">".$row['session_ip']."</a></td>\n";
        $num_registered_online++;
      }
      $prev_user_id $row['session_user_id'];
    }

    $sql "SELECT session_user_id, session_lastaction, session_ip, session_location
            FROM "
.SESSIONS_TABLE."
            WHERE session_lastaction >= "
.(time() - 300)." AND session_user_id = ".GUEST;
    $result $site_db->query($sql);

    $num_guests_online 0;
    while ($row $site_db->fetch_array($result)) {
      if ($row['session_ip'] != $prev_ip) {
        echo "<tr class=\"".get_row_bg()."\">\n";
        echo "<td>".$lang['userlevel_guest']."</td>\n";
        echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row['session_lastaction'])."</td>\n";
        if (eregi("Control Panel"$row['session_location'])) {
          echo "<td>Control Panel</td>";
        }
        else {
          echo "<td><a href=\"".$site_sess->url(ROOT_PATH.$row['session_location'])."\" target=\"_blank\">".$row['session_location']."</a></td>\n";
        }
        echo "<td>".$row['session_ip']."</td>\n";
        echo "</tr>\n";
        $num_guests_online++;
      }
      $prev_ip $row['session_ip'];
    }

    echo "</table></td></tr></table><br />";
    
    $num_total_online 
$num_registered_online $num_guests_online;
    $num_invisible_online $num_registered_online $num_visible_online;

    $lang['online_users'] = preg_replace("/".$site_template->start."num_total".$site_template->end."/siU"$num_total_online$lang['online_users']);
    $lang['online_users'] = preg_replace("/".$site_template->start."num_registered".$site_template->end."/siU"$num_registered_online$lang['online_users']);
    $lang['online_users'] = preg_replace("/".$site_template->start."num_guests".$site_template->end."/siU"$num_guests_online$lang['online_users']);
    printf ("<b>%s</b><br /><br /><br />"$lang['online_users']);
  // End defined('USER_INTEGRATION')

  $total_images 0;
  $total_categories 0;
  foreach ($cat_cache as $val) {
    $total_categories++;
    if (isset($val['num_images'])) {
      $total_images += $val['num_images'];
    }
  }

  printf("<span class=\"headline\">%s</span><br /><br />"$lang['headline_stats']);

  show_table_header($lang['nav_general_main'], 4);

  //1
  echo "<tr class=\"".get_row_bg()."\">\n";
  echo "<td width=\"16%\"><b>".$lang['categories']."</b></td><td width=\"16%\">".$total_categories."</td>\n";
  $size 0;
  echo "<td width=\"16%\"><b>".$lang['media_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(MEDIA_PATH))."</td>\n";
  echo "</tr>";

  //2
  echo "<tr class=\"".get_row_bg()."\">\n";

  $sql "SELECT COUNT(*) as temp_images 
          FROM "
.IMAGES_TEMP_TABLE;
  $row $site_db->query_firstrow($sql);

  $awaiting_validation preg_replace("/".$site_template->start."num_images".$site_template->end."/siU"$row['temp_images'], $lang['images_awaiting_validation']);
  $awaiting_validation sprintf("<a href=\"".$site_sess->url("validateimages.php?action=validateimages")."\">%s</a>"$awaiting_validation);
  echo "<td width=\"16%\"><b>".$lang['images']."</b></td><td width=\"16%\">".$total_images." / ".$awaiting_validation."</td>\n";
  $size 0;
  echo "<td width=\"16%\"><b>".$lang['thumb_directory']."</b></td><td width=\"16%\">".format_file_size(get_dir_size(THUMB_PATH))."</td>\n";
  echo "</tr>";

  //3
  echo "<tr class=\"".get_row_bg()."\">\n";

  $sql "SELECT COUNT(*) as users 
          FROM "
.USERS_TABLE.
          WHERE "
.get_user_table_field("""user_id")." <> ".GUEST;
  $row $site_db->query_firstrow($sql);

  echo "<td width=\"16%\"><b>".$lang['users']."</b></td><td width=\"16%\">".$row['users']."</td>\n";

  echo "<td width=\"16%\"><b>".$lang['database']."</b></td><td width=\"16%\">";
  include(ROOT_PATH.'includes/db_utils.php');
  get_database_size();
  if (!empty($global_info['database_size']['total'])) {
    if (!empty($global_info['database_size']['4images'])) {
      $db_status $lang['homestats_total']." <b>".format_file_size($global_info['database_size']['total'])."</b> / ";
      $db_status .= "4images:&nbsp;<b>".format_file_size($global_info['database_size']['4images'])."</b>";
    }
    else {
      $db_status format_file_size(!empty($global_info['database_size']['total']));
    }
  }
  else {
    $db_status "n/a";
  }

  echo $db_status."</td>\n";

  echo "</tr>";
  show_table_footer();

  $sql "SELECT SUM(cat_hits) AS sum 
          FROM "
.CATEGORIES_TABLE;
  $row $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  show_table_header($lang['top_cat_hits']." (".$lang['homestats_total']." ".$sum.")"4);

  $sql "SELECT cat_id, cat_name, cat_hits
          FROM "
.CATEGORIES_TABLE."
          ORDER BY cat_hits DESC
          LIMIT 
$stats_limit";
  $result $site_db->query($sql);

  $num 1;
  while ($row $site_db->fetch_array($result)) {
    if ($num == 1) {
      $max $row['cat_hits'];
      if ($max == 0) {
        $max 1;
      }
    }
    echo "<tr class=\"".get_row_bg()."\">\n";
    echo "<td>&nbsp;".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\" target=\"_blank\">".multilang($row['cat_name'])."</a></b></td>\n\n";
    $per intval($row['cat_hits'] / $max 100);
    echo "<td width=\"100%\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n";
    echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n";
    echo "</tr></table></td></tr></table>\n</td>";
    echo "<td align=\"center\">".$row['cat_hits']."</td></tr>\n";
    $num++;
  }
  if ($num == 1) {
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>";
  }

  $sql "SELECT SUM(image_hits) AS sum 
          FROM "
.IMAGES_TABLE;
  $row $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  show_table_separator($lang['top_image_hits']." (".$lang['homestats_total']." ".$sum.")"4);

  $sql "SELECT image_id, image_name, image_hits
          FROM "
.IMAGES_TABLE."
          ORDER BY image_hits DESC
          LIMIT 
$stats_limit";
  $result $site_db->query($sql);

  $num 1;
  while ($row $site_db->fetch_array($result)) {
    if ($num == 1) {
      $max $row['image_hits'];
      if ($max == 0) {
        $max 1;
      }
    }
    echo "<tr class=\"".get_row_bg()."\">\n";
    echo "<td>&nbsp;".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n";
    $per intval($row['image_hits'] / $max 100);
    echo "<td width=\"100%\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n";
    echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n";
    echo "</tr></table></td></tr></table>\n</td>";
    echo "<td align=\"center\">".$row['image_hits']."</td></tr>\n";
    $num++;
  }
  if ($num == 1) {
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>";
  }

  show_table_separator($lang['top_image_rating'], 4);

  $sql "SELECT image_id, image_name, image_rating
          FROM "
.IMAGES_TABLE."
          ORDER BY image_rating DESC
          LIMIT 
$stats_limit";
  $result $site_db->query($sql);

  $num 1;
  while ($row $site_db->fetch_array($result)) {
    if ($num == 1) {
      $max $row['image_rating'];
      if ($max == 0) {
        $max 1;
      }
    }
    echo "<tr class=\"".get_row_bg()."\">\n";
    echo "<td>&nbsp;".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n";
    $per intval($row['image_rating'] / $max 100);
    echo "<td width=\"100%\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n";
    echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n";
    echo "</tr></table></td></tr></table>\n</td>";
    echo "<td align=\"center\">".$row['image_rating']."</td></tr>\n";
    $num++;
  }
  if ($num == 1) {
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>";
  }

  $sql "SELECT SUM(image_votes) AS sum 
          FROM "
.IMAGES_TABLE;
  $row $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  show_table_separator($lang['top_image_votes']." (".$lang['homestats_total']." ".$sum.")"4);

  $sql "SELECT image_id, image_name, image_votes 
          FROM "
.IMAGES_TABLE.
          ORDER BY image_votes DESC 
          LIMIT 
$stats_limit";
  $result $site_db->query($sql);

  $num 1;
  while ($row $site_db->fetch_array($result)) {
    if ($num == 1) {
      $max $row['image_votes'];
      if ($max == 0) {
        $max 1;
      }
    }
    echo "<tr class=\"".get_row_bg()."\">\n";
    echo "<td>&nbsp;".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n";
    $per intval($row['image_votes'] / $max 100);
    echo "<td width=\"100%\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n";
    echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n";
    echo "</tr></table></td></tr></table>\n</td>";
    echo "<td align=\"center\">".$row['image_votes']."</td></tr>\n";
    $num++;
  }
  if ($num == 1) {
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>";
  }

  $sql "SELECT SUM(image_downloads) AS sum
          FROM "
.IMAGES_TABLE;
  $row $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  show_table_separator($lang['top_image_downloads']." (".$lang['homestats_total']." ".$sum.")"4);

  $sql "SELECT image_id, image_name, image_downloads
          FROM "
.IMAGES_TABLE."
          ORDER BY image_downloads DESC
          LIMIT 
$stats_limit";
  $result $site_db->query($sql);

  $num 1;
  while ($row $site_db->fetch_array($result)) {
    if ($num == 1) {
      $max $row['image_downloads'];
      if ($max == 0) {
        $max 1;
      }
    }
    echo "<tr class=\"".get_row_bg()."\">\n";
    echo "<td>&nbsp;".$num.".</td>\n<td nowrap=\"nowrap\"><b><a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" target=\"_blank\">".$row['image_name']."</a></b></td>\n\n";
    $per intval($row['image_downloads'] / $max 100);
    echo "<td width=\"100%\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\"><tr><td bgcolor=\"#FFFFFF\">\n";
    echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"".$per."%\"><tr>\n";
    echo "<td bgcolor=\"#FCDC43\"><img src=\"images/spacer.gif\" height=\"10\" width=\"2\"></td>\n";
    echo "</tr></table></td></tr></table>\n</td>";
    echo "<td align=\"center\">".$row['image_downloads']."</td></tr>\n";
    $num++;
  }
  if ($num == 1) {
    echo "<tr class=\"".get_row_bg()."\">\n<td colspan=\"4\">".$lang['no_search_results']."</td></tr>";
  }

  show_table_footer();
}
show_admin_footer();
?>
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 27, 2005, 10:38:12 PM
Danke für den Tipp mit der home.php. Ich habe ständig versucht die index.php zu verändern  :?

Wo deine Probleme liegen weiß ich bei der Anzahl der Änderungen leider auch nicht.

Ich kann dir nur sagen wie ich es gemacht habe:
Einfach jeden Code nach image_name und cat_name durchsuchen und dann den multilang (  ) code drum herum bauen.

viel Erfolg
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on September 29, 2005, 05:09:39 PM
Hallo Matthias

ich glaube ich bin ein wenig blond :?  Bei detail.php klappt jetzt alles super.
Könntest Du vielleicht Deine Categories.php posten? Alle anderen Seiten laufen....

Wäre super

Steffen
Title: Re: [MOD] Multi-Language support for any text
Post by: Matthias70 on September 29, 2005, 06:57:20 PM
Meine categories.php habe ich als .txt-Datei angehängt. Php-Dateien kann man nicht anhängen...

Hast du eine Lösung für das Problem "random image außerhalb von 4images" gefunden oder verwendest du das Mod nicht?

Gruß
Matthias
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on September 29, 2005, 08:09:38 PM
Hallo Matthias

Danke für den Anhang. Mit der text. Datei ist eine super Idee. Das ist natürlich viel einfacher im Forum  :D

Leider bleibt der Erfolg bei mir aus. Irgend ein MOD scheint zu stören. Aber das finden wir noch raus....


Hast du eine Lösung für das Problem "random image außerhalb von 4images" gefunden oder verwendest du das Mod nicht?


Das MOD habe ich nicht installiert....sorry

Gruß Steffen
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on September 30, 2005, 04:20:30 PM

I'm confused..."admin category list"? what is it? in ACP? the screenshot u showed is dropdown on "regular" page...

for the categories names, u'll need search in files (mostly in includes/functions.php) for ['cat_name'] (which is only a part of a variable)
for example the full variable could look like: $cat_cache[$category_id]['cat_name'] or $cat_cache[$cat_id]['cat_name']
Quote

Hallo Matthias,

das Rätsel ist gelöst. Da habe ich doch klappt den Hinweis von V@no überlesen. D.h. ich hatte die Variable in functions.php nicht hinzugefügt.
Jetzt läuft alles bestens.  JUHU  :D

schönes WE

Steffen
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on October 01, 2005, 11:25:20 PM
Hallo

Ich benötige doch nochmal einen kleinen Tipp.

Auf einigen Seiten z.B. Startseite habe ich zusätzlich Texte in das Template geschrieben. Für dieses MOD wäre natürlich der Text in den jeweiligen Sprach main.php sinnvoller. D.h. ich habe bereits ein Beispiel  im template {lang_hompage} und in der main.php $lang['homepage'] = "test"; geschrieben. Leider reicht das nicht aus. Fehlt noch etwas in der dazugehörigen z.b. index.php???

Steffen
Title: Re: [MOD] Multi-Language support for any text
Post by: IWS_steffen on October 23, 2005, 01:31:17 PM
hallo

die Anwort auf meine Frage findet ihr hier http://www.4homepages.de/forum/index.php?topic=10150.msg49568#msg49568

Gruß Steffen
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on November 05, 2005, 08:16:38 PM
I just added Step 3.x for support multilanguage in date format.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: GeneT on November 06, 2005, 11:31:29 AM
Hi, thanks for adding the new step for date support.
But I am getting an error.

All files modifed, but get this:
Quote
Fatal error: Call to undefined function: multilang() in /web/www/frac/users/gene/global.php on line 251

Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on November 06, 2005, 03:35:48 PM
Sorry, my bad, I've updated step 3, the two lines were supposed to be inserted below
Code: [Select]
include(ROOT_PATH.'includes/functions.php');
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: GeneT on November 06, 2005, 05:21:02 PM
I still get this error:

Quote
Fatal error: Call to undefined function: multilang() in /web/www/frac/users/gene/global.php on line 264

It is the same, except I have moved the two lines down a few lines so their under the include(ROOT_PATH.'includes/functions.php');
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on November 06, 2005, 07:04:19 PM
Then you missed a step or something
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: GeneT on November 06, 2005, 07:39:57 PM
Now we're talking!
I had to replace my two files (global.php and includes/functions.php) with the original file and then edit.
For some reason it worked. Thanks for everything V@no, honestly much appreciated.

Gene
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Pop_Black on November 06, 2005, 08:12:22 PM
Hi v@no,
My cat_name in sitemap is translated :lol: but not translated in index :cry:
please help me :wink:
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on November 06, 2005, 08:21:29 PM
that's when you start reading through the replys and re-read the instructions on how to use this mod ;)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Matthias70 on November 13, 2005, 11:01:05 AM
Is multilang for {site_name} possible?
When yes, where can I find the code where the "site_name" is generated ???

Matthias
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on November 13, 2005, 04:48:39 PM
in includes/page_header.php
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Matthias70 on November 13, 2005, 05:27:15 PM
Thank you V@no
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: MadeInUSSR on March 09, 2006, 06:48:43 AM
please help me I am not so good at PHP.... somehow I changed function.php,categories.php,member.php,details.php files and now multilang for categories works well..... but I don't know WHAT and WHERE to change php-code ,I need  category_dropdown_selfjump and member.php(this file I need to be worked when user added his image successfully and where clickstrim there must name of Category to be in chosen language) to be worked with multilang for categories

На русском... каким-то образом мне удалось изменить function.php,categories.php,member.php,details.php файлы, теперь категории стали многоязычными. вообщем все работает нормально за исключением выпадающего меню категорий и файл member.php (после удачного добавления фотографии там должно написано быть название категории на установленным пользователем языке в clickstrim ) подскажите что нужно изменить и что добавить... я не владею хорошо пхп... и мне сложно разобраться.. спасибо заранее
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: MadeInUSSR on March 11, 2006, 04:30:31 AM
Nobody can help me?  :cry:
Title: Mehrere sprachen griechisch-deutsch-englisch
Post by: nova2004de on March 30, 2006, 02:14:38 PM
Kann mir jemand hier bei helfen, ich kann leider kann englisch darum komm ich nicht weiter. :cry: :cry:
Mehrere sprachen griechisch-deutsch-englisch
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on May 22, 2006, 08:42:43 PM
need help... i dont understand how to make normal that...
when i do that:
Code: [Select]
format_text(multilang(
shows error... su i must delete format_text to work it, but ten i cant use any images there or bb code  :?
and how to make categories in two languages?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on May 23, 2006, 02:15:54 AM
any function calls must have opening "(" and closing ")" parenthesises, you must be missing the closing one.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on May 23, 2006, 04:50:14 PM
how to use this with simple news publishing mod?  :roll:
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on May 28, 2006, 06:11:11 PM
so can anyone help me?  :?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on May 30, 2006, 04:05:28 PM
plz help me  :?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 23, 2006, 03:56:49 PM
Hallo--

I am having many problems getting the categories to change languages. Any suggestions for getting them to change languages when I click on my language icons.

Also, if I change my language to say Nederlands and i click on an image that has multilanguage support, why in the click-stream does it come up with    Begin / Passport Stamps & Visas / [english]Cambodia 2006[nederlands]Cambodja 2006

example is at: http://galleries.travelingtheworldaround.com/details.php?image_id=185&sessionid=37c85bb12abef3c76eb2f0b3af6a326b&l=nederlands
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: martrix on June 25, 2006, 10:53:30 AM
You get that, because somewhere in the code you did not use "multilang(...)" ;)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on June 28, 2006, 10:54:19 PM
i have news publishing mod and smiles mod... so i made to can write news in two languages and now when write smile... just write this:
Code: [Select]
<img src="./templates/clon/smilies/icon_biggrin.gif"> before change showed smile :( how can i make this working?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on June 29, 2006, 01:21:18 AM
Then you changed the code wrong. Thats all I can say with as much info as you provided ;)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on June 29, 2006, 10:38:24 AM
Then you changed the code wrong. Thats all I can say with as much info as you provided ;)
ok... thats what i made:

 
Code: [Select]
         "news_comment_headline" => format_text(multilang($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0)),
           "news_comment_text" => format_text(multilang($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'])),
how can i make it working?  :roll:
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on June 29, 2006, 02:43:44 PM
you added ")" at the end, which made the extra paramaters being sent to multilang function instead of format_text.
You must send only $news_comment_row[$i]['comment_headline'] variable through multilang function without extra paramaters. (same deal with comment_text)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: idijotaz on June 29, 2006, 02:51:41 PM
so how i need to make it? can u write me code?

Code: [Select]
         "news_comment_headline" => format_text(multilang($news_comment_row[$i]['comment_headline']), 0, $config['wordwrap_comments'], 0, 0),
           "news_comment_text" => format_text(multilang($news_comment_row[$i]['comment_text']), $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
this?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on June 29, 2006, 02:55:56 PM
yep, you've got it ;)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 30, 2006, 03:13:25 AM
I have looked and looked and I do not know where I am going wrong. I still cannot get rid of the language tags in the 'clickstream?' At least that's where I think it is..... is there anyone who would be willing to look at my code and help me... clearly I am not getting it....

http://galleries.travelingtheworldaround.com/categories.php?cat_id=5&l=nederlands
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: om6acw on June 30, 2006, 04:12:09 AM
I have looked and looked and I do not know where I am going wrong. I still cannot get rid of the language tags in the 'clickstream?' At least that's where I think it is..... is there anyone who would be willing to look at my code and help me... clearly I am not getting it....

http://galleries.travelingtheworldaround.com/categories.php?cat_id=5&l=nederlands


look for

Code: [Select]
$path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".$cat_cache[$cat_id]['cat_name']."</a>";
in include/functions.php and change like this

Code: [Select]
$path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".multilang($cat_cache[$cat_id]['cat_name'])."</a>";
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 30, 2006, 04:39:08 AM
This did not work either.... ????? I think V@no is laughing at me secretly. He's got this on his website with no problems.........

The thing I did notice, however, is that when you click on the next subcategory it goes to the way that it should be.

Bad Formatting:
http://galleries.travelingtheworldaround.com/categories.php?cat_id=7&l=nederlands

Good Formatting:
http://galleries.travelingtheworldaround.com/categories.php?cat_id=41&l=nederlands
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: om6acw on June 30, 2006, 04:57:03 AM
This did not work either.... ????? I think V@no is laughing at me secretly. He's got this on his website with no problems.........

The thing I did notice, however, is that when you click on the next subcategory it goes to the way that it should be.

Bad Formatting:
http://galleries.travelingtheworldaround.com/categories.php?cat_id=7&l=nederlands

Good Formatting:
http://galleries.travelingtheworldaround.com/categories.php?cat_id=41&l=nederlands

I dont now, but everithing looks ok for me on both links.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 30, 2006, 05:05:59 AM
yeah, sorry. I was trying something and it wasn't working. it wouldn't give me the complete file... ie: Begin > Zuid-Amerika > Bolivië   only Bolivië
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 30, 2006, 05:11:23 AM
A copy of the php files for includes/functions.php and categories.php are as follows if anyone cares to look:

functions = http://galleries.travelingtheworldaround.com/help/functions.txt
categories = http://galleries.travelingtheworldaround.com/help/categories.txt
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: om6acw on June 30, 2006, 05:53:49 AM
A copy of the php files for includes/functions.php and categories.php are as follows if anyone cares to look:

functions = http://galleries.travelingtheworldaround.com/help/functions.txt
categories = http://galleries.travelingtheworldaround.com/help/categories.txt

look for all

Code: [Select]
$cat_cache[$category_id]['cat_name']

in functions.php and change that to

Code: [Select]
multilang($cat_cache[$category_id]['cat_name'])
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on June 30, 2006, 06:18:16 AM
OK.... I think we are finally in business. Let us keep fingers and toes crossed for good luck..

Thank you for your time and patience.. I appreciate it ALOT!!!!
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: adrianus on September 28, 2006, 01:32:02 AM
hi

Does it work with 4Images 1.7.3 ?

do you have test it ?

thanks
AD
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: F2F on October 21, 2006, 01:28:56 AM
Yes, I tested this MOD in 1.7.3 and it works (at least for image description, that is the part I'm interesting in).
Saddly, I get this:

Code: [Select]
Notice: Undefined index: date_format in global.php on line 139

Notice: Undefined index: language_dir in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1857

Notice: Undefined index: language_dir_default in includes\functions.php on line 1861

Notice: Undefined index: language_list in includes\functions.php on line 1861

Notice: Undefined index: time_format in global.php on line 140

Notice: Undefined index: language_dir in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1857

Notice: Undefined index: language_dir_default in includes\functions.php on line 1861

Notice: Undefined index: language_list in includes\functions.php on line 1861

Warning: Cannot modify header information - headers already sent by (output started at global.php:139) in global.php on line 442

But as I said, it works, and if you configure 4images to not to show notices and warnings, then everything should be fine. However, I would like to know how to get rid of those annoying noticies...

Regards.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: F2F on October 21, 2006, 01:49:09 AM
Well, I just found that I can't open the ACP anymore, I get the same errors as above but nothing else, no ACP at all...  :?

UPDATE/

This is the part that is giving me the errors, and once removed everything is fine:

Code: [Select]
$config['date_format'] = multilang($config['date_format']);
$config['time_format'] = multilang($config['time_format']);

Of course, this means that I have to give up the multilang date and time part of the MOD. But for names and descriptions it simply works.

Regards.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Alessio on December 03, 2006, 01:50:42 PM
I have installed this fantastic mod but I have some problems.

----------------------------------------------------

I have a problem with MOD Guestbook http://www.4homepages.de/forum/index.php?topic=7409.0

when I go to http://www.webax.it/guestbook.php I have this error
Notice: Undefined variable: comment_text in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/guestbook.php on line 422

when I write a message I have this error
Notice: Undefined variable: user_country in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/guestbook.php on line 287

when I delete a message I have these errors
Notice: Undefined variable: comments in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/guestbook.php on line 447
Notice: Undefined variable: contents in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/guestbook.php on line 446

----------------------------------------------------


Another problem with MOD Another Simple News Publishing Mod that I have resolved in this way


Notice: Undefined index: comment_user_name in /var/www/mysite/images/news.php on line 67

(http://www.4homepages.de/forum/index.php?topic=9064.msg43702#msg43702)

Right on the spot.

In your news.php file,

find :

Quote

$comment_user_name = htmlspecialchars($news_row[$i]['comment_user_name']);


replace with :

Code: [Select]

//$comment_user_name = htmlspecialchars($news_row[$i]['comment_user_name']);


It doesn't seem to be used anywhere else in that file.

Then, save the file and reload the page again to see if it works. ;)

Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Alessio on December 12, 2006, 12:38:54 PM
I have another problem!

In "ADMIN - check new images" I have these errors

Notice: Undefined variable: caption in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/admin/checkimages.php on line 1227
Notice: Undefined variable: keywords in /mounted-storage/home28b/sub001/sc24851-FNHZ/www/admin/checkimages.php on line 1228

UPDATE: I have resolved the problems adding to php file this code
error_reporting(E_ALL ^ E_NOTICE);
Title: Re: [MOD] Multi-Language support for any text
Post by: host on December 20, 2006, 04:54:45 PM
Hi V@no, hello all,

I'm a 'new' user of 4images and found this fantastic MOD.
A long time ago the question about the sorting problem was discussed here:

nice thing - there's a lot to change, to have this feature working flawless :)

But there's one little problem I could not solve on my own:


If you have a category and you set sorting by image name - it will absolutely mess up the sorting in there, if you rename some of the pictures to support more languages...
See here: http://photo.overlord.cz/categories.php?cat_id=38

How would it be possible to sort the images by the shown image name, not by the "whole image name" containing [czech] etc.?

For me the general problem of the sorting order (not only with this MOD) was relevant, so I tried to fix it.

I made a small addition in the function.php:

Original
Code: [Select]
function multilang($text, $show_first = 0, $remove = 0){
  global $config;
  preg_match("#\[".$config['language_dir']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#\[".$config['language_dir_default']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  if ($show_first) {
    preg_match("#\[".$config['language_list']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
    if (!empty($match[2])) {
      return $match[2];
    }
  }
  if ($remove) {
    return preg_replace("#\[".$config['language_list']."\](.*)#iDs", "", $text);
  }
  return $text;
}

Changed:
Code: [Select]
function multilang($text, $show_first = 0, $remove = 0){
  global $config;
  preg_match("#\[".$config['language_dir']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }


  preg_match("#\[default\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }


  preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  preg_match("#\[".$config['language_dir_default']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
  if (!empty($match[1])) {
    return $match[1];
  }
  if ($show_first) {
    preg_match("#\[".$config['language_list']."\](.*)(\[\/?".$config['language_list']."\]|$)#iDUs", $text, $match);
    if (!empty($match[2])) {
      return $match[2];
    }
  }
  if ($remove) {
    return preg_replace("#\[".$config['language_list']."\](.*)#iDs", "", $text);
  }
  return $text;
}

This little change - the 'definition' of a [default] language tag, solved for me two problems:
1. I can sort my pictures.
2. I can define text in a default mode, which is taken, if the choosen language is not present in the text.

Example:

A picture with the name: [001][default]Picture[deutsch]Bild will be shown in any language
(except german) as 'Picture' and in german as 'Bild' and the prefix [001] is used to sort my pictures within a category.

As a sorting criteria you can use everything with '[]' at the beginning... of course execpt any installed language-name


I don' know, if anybody else will find this useful, but anyway  :wink:

Cheers
HoSt


Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Madgod on January 12, 2007, 04:59:59 PM
I got a idea about this mod.

is anyone trying to put the code
Code: [Select]
$text = multilang($text);  //( for all site text format)before
 
Code: [Select]
return $text;at
Code: [Select]
function format_text($text, $html = 0, $word_wrap = 0, $bbcode = 0, $bbcode_img = 0) {in the file : includes/functions.php

so that we don't have to make a lot of change of each code.

I am using 1.74

another question:
how can I sort the result of images in category.php, just like when I am in English mode or Chinese mode,the sort result of images won't be the same, I hope that system sort according the language mode, not the real name in database. can anyone help I to fix this problem.....
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on March 04, 2007, 02:59:55 AM
This is a great MOD and I have really enjoyed using it. I have over the past few months noticed (maybe I didn't pay too much attention earlier if this was a problem) but when I have multiple languages: ie: English, Nederlands, German if I do the tags I result this:

example: [english]Germany Munich Palaces[/][deutsch]Deutschland München Schloß[/][nederlands]Duitsland München Palaces[/]
         when language selected:   , Germany, Munich, Palaces

But if I add a space after the language tag I get
example: [english] Germany Munich Palaces[/][deutsch] Deutschland München Schloß[/][nederlands] Duitsland München Palaces[/]
         when language selected:   , Germany, Munich, Palaces.

Also, the URL for the last Keyword comes up with some weird scripting at the end of it, often-times not allowing the keyword to work properly. This only happens on the last keyword in the list and when using a multiple language. (What it looks like its doing is taking a little part of the next language tag and additing it into the url...

For example:
http://galleries.travelingtheworldaround.com/search.php?search_keywords=Porcelain%5B%2F%5D   [in just english]
http://galleries.travelingtheworldaround.com/search.php?search_keywords=Porcelain%5B%2F%5D&l=nederlands [what it looks like with Nederlands language selected
http://galleries.travelingtheworldaround.com/search.php?search_keywords=Porcelain&l=nederlands [what it should look like]

My question is, how can I get it so that I do not have to put a space after the language code, as I do not like the [comma ,] being the first character of the keyword feature. Second, what could have happened which would have caused these weird %5B%2F%5D to be added to the keyword search function...

Your help, as always, most appreciated.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: darvid on March 25, 2007, 05:18:22 PM
which version of 4images are u using?

does somebody has tested it on 4images 1.7.4?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Alessio on April 04, 2007, 08:53:58 PM
I have the same problem of Cronk, moreover I would like to know how to translate the ALT TAGS and the RSS.
I'm using 4images 1.7.4

(http://www.4homepages.de/forum/index.php?action=dlattach;topic=6749.0;attach=1820;image)
Title: Need help with multilanguage setting
Post by: rockquick on July 03, 2007, 02:32:16 PM
Hello, I just found the 4images software, and it pretty cool one .. .I wanted to setit in french and english at the same time I did follow the document I found it in this forum the 1st one for the navigation it works pretty good but for the once of categories (http://www.4homepages.de/forum/index.php?topic=6749.0 )  it didnt work for me I did follwed step by step but nothing...
So please can you explain me with a simple way how to transtate all the website (navigration,  categories ... ) when I change the language... from english to french ...
here is my website http://ecards.rockquick.com
by the way I use the version 1.7.4

Thanks for your help it is appreciated 


Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: orb4 on August 09, 2007, 08:04:03 AM
I ve installed [MOD] Dynamic Page Title.
This mod makes appears on the title bar 's pages the paths,like this:
SITE NAME \ CATEGORY NAME \ IMAGE NAME
 
BUT for me "Paths" are appearing exactly like this for me with "[...]" language translation:

SITE NAME \ [french]CATEGORY NAME [english]CATEGORY NAME \ [french]IMAGE NAME [english]IMAGE NAME

Hmmm...is there a way to exclude this 'function' multilang(...) from appearing on header.html???
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: cronk005 on August 09, 2007, 01:05:03 PM
Hi There--

I use version 1.7.2 and when I installed this into my site (which took a lot of trial and error), it came to my using a [/language] tag after each language and before the next language. Once I did this it worked well.....

[english]English Text[/english] [nederlands]Nederlandse tekst[/nederlands]

If this doesn't work, it may be because you forgot to put in a multilang() tag a long the way. They are easy to miss... ;-)
Title: problem with the [MOD] Multi-Language version 1.7.6
Post by: KamelN on April 15, 2008, 12:40:03 AM
   
Hi,
I just istalleé The [MOD] Multi-Language support for any text runs on 4images 1.7.4 is very good script but I have some problems with my multilang Crying version 1.7.6 or Very sad, :cry:
Is there qq svp who can help me I would get my site in English, French and Arabic if posible Wink. :wink:

Thank you in advance ...
Title: Re: problem with the [MOD] Multi-Language version 1.7.6
Post by: KamelN on April 20, 2008, 10:32:29 PM
up   :(
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: egyptandy on April 18, 2009, 04:38:53 PM
Just one short question before installing in version 1.7.6.
Will this also show all category descriptions (not only the names) in the different languages?
I assume yes, but I am not really sure. I will use English and German.
Thanks for your information.
Andy
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: mediteran13 on April 20, 2009, 03:20:41 AM
Hi Andy,

yes, you can apply it o the category descriptions as well.
Vano wrote in his opening post of this thread:
"Finaly u can add multilanguage support not only for the interface but also for any text, …"

I must concede that I didn't use this MOD until now, but will try it soon…

Btw, are you Andy from Boxers Bar? If yes, we can exchange our knowledge
about 4images in the near future personally. I'll come to Gouna next time
on May 2nd and stay permanently… And we won't be the only users of 4images there…
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: egyptandy on May 10, 2009, 04:04:32 PM
any function calls must have opening "(" and closing ")" parenthesises, you must be missing the closing one.

I have installed this mod in Version 1.7.6.
I have changed the global.php, the categories.php and the functions.php
But now the site does not open anymore and I get the following message:

Parse error: syntax error, unexpected T_STRING, expecting ')' in /usr/export/www/vhosts/funnetwork/hosting/schrieber/includes/functions.php on line 1197

The relevant code in the functions.php there is:
 $site_template->register_vars(array(
      "cat_id" => $category_id,
      "cat_name" => format_text multilang($cat_cache[$category_id]['cat_name']), 2),
      "cat_description" => format_text multilang($cat_cache[$category_id]['cat_description']), 1),
I do not see any mistake.
Any advise?

The code in the categories.php is:
$site_template->register_vars(array(
  "categories" => get_categories($cat_id),
  "cat_name" => format_text  multilang($cat_cache[$cat_id]['cat_name']), 2),
  "cat_description" => format_text  multilang($cat_cache[$cat_id]['cat_description']), 1, 0, 1),

Based on all comments here, I don't see a mistake.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on May 10, 2009, 09:13:30 PM
You are missing ( in:
format_text(multilang(
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: egyptandy on May 11, 2009, 09:10:13 AM
Dear V@no, thanks for your assistance, but I am still struggeling.

You are missing ( in:
format_text(multilang(

I did these changes in functions.php and in categories.php but still have a problem.
The error message is now the following:
Parse error: syntax error, unexpected ';' in /usr/export/www/vhosts/funnetwork/hosting/schrieber/includes/functions.php on line 1253
Line 1253 says:
 $path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".format_text(multilang($cat_cache[$cat_id]['cat_name'], 2)."</a>";

next line is only: }

When I delete the ; in line 1253 the error message tells my that the following } is wrong and so on.
     
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: egyptandy on May 11, 2009, 11:13:27 AM
Hi V@no,
in the meantime the error message for line 1253 disappears. Now i have a new one for line 1285:

Parse error: syntax error, unexpected T_VARIABLE in /usr/export/www/vhosts/funnetwork/hosting/schrieber/includes/functions.php on line 1285

These are the 1284 -1289 code lines, which look correct to me:

 if ($depth > 1) {
        $category_list .= ">".str_repeat("--", $depth - 1)." ".format_text(multilang($cat_cache $category_id]['cat_name']), 2)."</option>\n";
      }
      else {
        $category_list .= ">".format_text(multilang($cat_cache [$category_id]['cat_name']), 2)."</option>\n";
      }

Any idea about the mistake?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on May 11, 2009, 03:15:58 PM
For some reason you are having problem with the brackets..allergy?
$category_list .= ">".str_repeat("--", $depth - 1)." ".format_text(multilang($cat_cache[$category_id]['cat_name']), 2)."</option>\n";


as of line 1253 again missing bracket:
$path = "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".format_text(multilang($cat_cache[$cat_id]['cat_name']), 2)."</a>";
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: egyptandy on May 11, 2009, 09:25:14 PM
Sorry for this. but those have been obviously mistakes in the template.
My website pops now up again, but without the expected multilang effects.
I see on the web site always such Catagory names [deutsch]Test  [english]Trial   whether I use the english or deutsch Tab.

But before the site did pop up again I had to delete the multilang code 2x in:
$site_template->register_vars(array(
"cat_name" => format_text($image_row['cat_name'], 2),

and also in

$num_subs = sizeof($visible_cat_cache);
  $sub_cat_list = "";
  $i = 1;
  foreach ($visible_cat_cache as $subcat_id) {
    if ($i <= $num_subs && $i <= $config['num_subcats']) {
      $sub_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$subcat_id);
      $sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";

and finally in

$category_list = "";
  foreach ($drop_down_cat_cache[$cid] as $key => $category_id) {
    if (check_permission("auth_viewcat", $category_id)) {
      $category_list .= "<option value=\"".$category_id."\"";
      if ($cat_id == $category_id) {
        $category_list .= " selected=\"selected\"";
      }
      if ($cat_cache[$category_id]['cat_parent_id'] == 0) {
        $category_list .= " class=\"dropdownmarker\"";
      }

      if ($depth > 1) {
        $category_list .= ">".str_repeat("--", $depth - 1)." ".format_text($cat_cache [$category_id]['cat_name'], 2)."</option>\n";
      }
      else {
        $category_list .= ">".format_text($cat_cache [$category_id]['cat_name'], 2)."</option>\n";

Maybe this is the reason for not functioning correctly, but with the multilang tag in, the site did not open and one error message after the other came up.
So I have now no ideas what else to do. All the other changes are done according your MOD. I did not start to do anything about image names or image descriptions so far, because for me the cat names and cat descriptions are the important items.
     
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: daymos on July 08, 2009, 05:19:59 PM
can anyone help me create fields like
--------------------------------
Image name in english  |====|
Image name in russian  |====|

$
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on July 09, 2009, 03:03:54 AM
Please explain with more details.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun on July 17, 2009, 03:02:47 PM
Thanks for this mod. It's good work on 1.7.6  :)

I want a little change for it, but i don't know how to create this:
I have 3 languages russian(default), english and deutsch. When i choose deutsch then, if i haven't tag [deutsch] for this field, i see russian. But i want see text in [english] tag. How to change it(russian must be default language)?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on July 17, 2009, 03:59:51 PM
in your particular case you can try this: in includes/functions.php find
  preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);

Insert above:
  if ($config['language_dir'] == "deutsch")
  {
    $b = $config['language_dir'];
    $config['language_dir'] = "english";
    $t = multilang($text, $show_first, $remove);
    $config['language_dir'] = $b;
    return $t;
  }
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun on July 17, 2009, 04:09:04 PM
It is not work :( . It's look like before: if i choose deutsch, i see russian, and not english
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on July 17, 2009, 04:40:38 PM
Please show example of the text with tags you are testing with.


[EDIT]

Try move the new code (from my previous post) above
preg_match("#^(.*)\[".$config['language_list']."\]#iDUs", $text, $match);
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun on July 21, 2009, 04:24:28 PM
It is work now  :) . Thank you, V@no
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun Zaza on August 11, 2009, 04:46:16 PM
Hello V@no,

I like this mod and I am using it om my gallery.

I have a small issue. I am trying to use this mod also for the additional fields, but it does not work yet.

For example:

I want to show the name of the city. If it dutch it will show PARIJS (Frankrijk) and if it English it will show PARIS (France).

In de functions I added this line:

Code: [Select]
"image_city" => multilang($image_city),
And in the ACP i used this line:

Code: [Select]
[english]PARIS (France)[nederlands]PARIJS (Frankrijk)
Am I missing something?

Any help will be appreciated
Cruxy
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on August 12, 2009, 01:36:11 AM
you forgot to mention the result of your attempt. does it displays entire string with [] tags or what?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun Zaza on August 12, 2009, 01:40:59 AM
Thanks V@no for your reply.

Yes, I get the following string:

Code: [Select]
[english]PARIS (France)[nederlands]PARIJS (Frankrijk)
Hi V@no:

I solved it with using this string in the details.php:

Code: [Select]
$image_city = multilang($image_row['image_city']);
Thanks anyway for your support.

Cheers,
Cruxy
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on August 12, 2009, 05:03:13 AM
in that case, you might have tag "image_city" registered twice...
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun Zaza on August 12, 2009, 09:10:32 AM
I beleive so, but I did not test it yet. I will try it later on and I will let you know.
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: urmasmuld on March 12, 2010, 12:40:38 PM
Yes, I tested this MOD in 1.7.3 and it works (at least for image description, that is the part I'm interesting in).
Saddly, I get this:

Code: [Select]
Notice: Undefined index: date_format in global.php on line 139

Notice: Undefined index: language_dir in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1857

Notice: Undefined index: language_dir_default in includes\functions.php on line 1861

Notice: Undefined index: language_list in includes\functions.php on line 1861

Notice: Undefined index: time_format in global.php on line 140

Notice: Undefined index: language_dir in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1853

Notice: Undefined index: language_list in includes\functions.php on line 1857

Notice: Undefined index: language_dir_default in includes\functions.php on line 1861

Notice: Undefined index: language_list in includes\functions.php on line 1861

Warning: Cannot modify header information - headers already sent by (output started at global.php:139) in global.php on line 442

But as I said, it works, and if you configure 4images to not to show notices and warnings, then everything should be fine. However, I would like to know how to get rid of those annoying noticies...

Regards.

I got same notices (except that warning). What to do to get those notices disappear ?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun Zaza on September 07, 2010, 01:12:19 AM
Hello,

I have some problems with this mod.

My default language is dutch.

So I am using the folowing title in the image_name:

[dutch]dutch[english]english

When I use the english language i get the folowing image_name: english

but when I use the dutch language, I get the folowing image_name: dutch[english]english


I have tried everything, but without results.

Any help will be apreciated.

Thanks in advance,
Cruxy
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on September 07, 2010, 02:04:44 AM
are you sure that the "dutch" folder exists? maybe it's "Dutch"?
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: Sun Zaza on September 07, 2010, 07:56:17 AM
Thanks V@no for your reaction.

It is correct, otherwise I won't get: dutch[english]english when I choose the dutch language. Am I right?

I installed the mod again and it is now working. Very strange.

Thank you for your support.

Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: kubiczek on October 20, 2010, 10:51:14 PM
Hallo,

habe hier den überblick 8O verloren,   

im ACE wird bei mir beim bearbeiten von "Kategorie namen" der name nicht angezeigt, aber wohl abgespeichert. aber nicht in unterschiedlichen sprachen.


(http://grosspeterwitz.org//Unbenannt.JPG)
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: kubiczek on January 20, 2011, 09:52:05 PM
Hallo,

Hat jemand diesen MOD efolgreich eingebaut?

ich habe es mit 1.7.4 1.7.6 1.7.9  versucht  jedesmal ohne erfolg.


Hat jemand lust den Mod sauber aufzuschreiben? den ich habe hier den Durchblick :roll: verloren.


gruß
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: vovams on May 07, 2011, 11:15:24 AM
Guys, there is better solution to have multilang select and ordering by national alphabets at one time. Add new fields to the DB named cat_name_[your language]. Then you need to dig into the code to make primitive changes to SQL to select field "cat_name_" + [current language] as standard "cat_name" field and then all the 4images logic will process your national words. Also the SELECT ORDER BY will be applied to your national alphbet. Additionally you should add primitive update to the admin/categories.php and you will be able to edit these category names in many different languages at a time. You must have primitive programming skills but the result worth the effort

(http://i015.radikal.ru/1105/f7/245367c235b5.jpg)

(http://s16.radikal.ru/i191/1105/8f/1044c0859372.jpg)

Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: mhstee on August 08, 2011, 02:39:38 PM
Thanks.

I`ve created to 2 new below cat_name called cat_name_deutsch & cat_name_nederlands and updated the categories.php from the admin folder. That all works great.

But how to show those translations on the front. If I browse to mydomain.com/index.php?l=deutsch how do I show the categorie-names in the German language.
How and which files should be edited to show the translation?

Kind regards,
Martin

Guys, there is better solution to have multilang select and ordering by national alphabets at one time. Add new fields to the DB named cat_name_[your language]. Then you need to dig into the code to make primitive changes to SQL to select field "cat_name_" + [current language] as standard "cat_name" field and then all the 4images logic will process your national words. Also the SELECT ORDER BY will be applied to your national alphbet. Additionally you should add primitive update to the admin/categories.php and you will be able to edit these category names in many different languages at a time. You must have primitive programming skills but the result worth the effort

(http://i015.radikal.ru/1105/f7/245367c235b5.jpg)

(http://s16.radikal.ru/i191/1105/8f/1044c0859372.jpg)


Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: V@no on August 09, 2011, 05:55:14 AM
You'll needed edit global.php
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: mhstee on August 09, 2011, 10:34:37 AM
Thanks, but I`m not that good kind of coder.
Could you please help me a bit more? What lines need to be added / edited?

Thanks,
Martin

You'll needed edit global.php
Title: Re: [MOD] Multi-Language support for any text (updated 05-11-2005)
Post by: mhstee on August 10, 2011, 11:07:07 AM
Will pay $ 20,- (Paypal) for the right solution!
Thanks, but I`m not that good kind of coder.
Could you please help me a bit more? What lines need to be added / edited?

Thanks,
Martin

You'll needed edit global.php