https://www.icyphoenix.com/viewtopic.php?f=35&t=540
-----------------------------------
tormentor
Wed 01 Nov, 2006 13:15

Questions
-----------------------------------
Hi, I've just swapped my old integramod based phpbb to XS for my site ( http://www.posetteforever.com ) and I've some questions to ask :

-Same for the avatar, it was not shown and I can't find the option to show it so I had to phisycally remove the "something like" "show avatar" in the viewtopic template, the oprion is not in the control panel nor in the ACP 
happened ?
-If I play with style, for example for halloween I fixed the style to a black one some mess happen with the style, in particulare after replying to a post the original style reappears, I found that it's related to the UPI2DB mod, I turned it off but this is a bug


-----------------------------------
Mighty Gorgon
Sat 04 Nov, 2006 01:41

Re: Questions
-----------------------------------
[quote user="tormentor" post="4346"]-Same for the avatar, it was not shown and I can't find the option to show it so I had to phisycally remove the "something like" "show avatar" in the viewtopic template, the oprion is not in the control panel nor in the ACP [/quote]
I can't understand what your problem is. Can you try to explain it again, by providing some link or examples? :shock:

[quote user="tormentor" post="4346"]-If I play with style, for example for halloween I fixed the style to a black one some mess happen with the style, in particulare after replying to a post the original style reappears, I found that it's related to the UPI2DB mod, I turned it off but this is a bug[/quote]
I've never had this error.

Try to:
[list][*]Set the default style using eXtreme Style ACP
[*]Empty site cache
[*]Empty your cookies[/list]


-----------------------------------
tormentor
Mon 06 Nov, 2006 22:09

Re: Questions
-----------------------------------
Thank you for your reply, I've found what I was doing wrong in both cases, the second one can be defined a "bug" because if you force all the users on a style or if you delete a style that a user was using the fact that the information for the style are stored in a cookie make the connection impossible for the specified user unless he or she deletes the cookies.


-----------------------------------
Mighty Gorgon
Thu 09 Nov, 2006 00:58

Re: Questions
-----------------------------------
[quote user="tormentor" post="4536"]Thank you for your reply, I've found what I was doing wrong in both cases, the second one can be defined a "bug" because if you force all the users on a style or if you delete a style that a user was using the fact that the information for the style are stored in a cookie make the connection impossible for the specified user unless he or she deletes the cookies.[/quote]
That should be avoided by an option I put in the template.php... are you getting this error in 058b?


-----------------------------------
tormentor
Thu 09 Nov, 2006 03:27

Re: Questions
-----------------------------------
I'll take a look at the template.php file, I should be using the latest release, I downloaded it 30 October if I'm not wrong. However I'm not used of this kind of mod that writes the information about the theme in the cookie and it really caused me a big headache because if you uninstall a style and then you reinstall it (or another one) the counter of the styles goes on so if the user is "pointed" to a style's number that doesn't exist anymore he or she has an error unless he or she deletes the cookie (or if the webmaster manually changes the style's number in the database  :roll: ). Or even if the style exists, if you force all the users on a specific style, when the browser makes use of the cookie (for example after writing a post) it turns back on the style selected by the user (or to the same error page that I mentioned above). If you want to test it it's simple: change your style to one different from the default one, make sure the cookie has been written then force all the users on the default style. When you post something if you'll be turned to the style you selected. It's not a real problem (for me) because I'm not intended to play with the styles anymore.


[quote user="Mighty Gorgon" post="4609"][quote user="tormentor" post="4536"]Thank you for your reply, I've found what I was doing wrong in both cases, the second one can be defined a "bug" because if you force all the users on a style or if you delete a style that a user was using the fact that the information for the style are stored in a cookie make the connection impossible for the specified user unless he or she deletes the cookies.[/quote]
That should be avoided by an option I put in the template.php... are you getting this error in 058b?[/quote]


-----------------------------------
Mighty Gorgon
Fri 10 Nov, 2006 01:19

Re: Questions
-----------------------------------
You are right... I forgot to add another check... :roll:

Try this:

OPEN [b]functions.php[/b]

FIND
[codeblock]			if ( $theme = setup_style($style) )[/codeblock]
REPLACE WITH
[codeblock]			if ( $theme = setup_style($style, $old_style) )[/codeblock]

FIND
[codeblock]function setup_style($style)[/codeblock]
REPLACE WITH
[codeblock]function setup_style($style, $old_style = false)[/codeblock]

FIND
[codeblock]			if ( $style != $board_config['default_style'])
			{[/codeblock]
REPLACE WITH
[codeblock]			if ( ($style != $board_config['default_style']) || ($old_style != false) )
			{
				if ($old_style != false)
				{
					$board_config['default_style'] = $old_style;
				}[/codeblock]

This should definitely solve this issue. :roll:


-----------------------------------
tormentor
Fri 10 Nov, 2006 09:39

Re: Questions
-----------------------------------
I made it, checked it twice but still:


Critical Error 

Could not update user theme info

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' at line 3


-----------------------------------
Mighty Gorgon
Tue 14 Nov, 2006 01:46

Re: Questions
-----------------------------------
Now I should really have solved it! :lol:

I have added a function in [b]functions.php[/b]

[codeblock]function check_style_exists($style_id)
{
	global $db, $board_config, $template, $images, $phpbb_root_path;
	global $phpEx, $themes_style;

	if ( defined('CACHE_THEMES') )
	{
		include( $phpbb_root_path . './includes/def_themes.' . $phpEx );
		if ( empty($themes_style) )
		{
			cache_themes();
			@include( $phpbb_root_path . './includes/def_themes.' . $phpEx );
		}
	}
	if ( !empty($themes_style[$style_id]) )
	{
		$stile_exists = true;
	}
	else
	{
		$sql = 'SELECT *
			FROM ' . THEMES_TABLE . '
			WHERE themes_id = ' . (int) $style;
		if ( !($result = $db->sql_query($sql, false, true)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for theme info');
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			$stile_exists = false;
		}
		else
		{
			$stile_exists = true;
		}
	}

	return $stile_exists;
}[/codeblock]

And added a new check in [b]common.php[/b] if the user is trying to change its template:

FIND
[codeblock]		$board_config['default_style'] = ($board_config['default_style'] == 0) ? $old_style : $board_config['default_style'];[/codeblock]

REPLACE WITH
[codeblock]		$board_config['default_style'] = (check_style_exists($board_config['default_style']) == false) ? $old_style : $board_config['default_style'];[/codeblock]

Let me know if this time it is working as expected! :wink:


-----------------------------------
tormentor
Tue 14 Nov, 2006 10:27

Re: Questions
-----------------------------------
It can't work (or it can't work in my installation), I've not that original line of code in common.php ("old_style" there isn't on the original file)  and in the first mod there is nothing about common.php, only changes in functions.php, you should have forgot something to change in common.php in the first try. I'll look forward  :wink:


-----------------------------------
Mighty Gorgon
Tue 14 Nov, 2006 12:42

Re: Questions
-----------------------------------
Ok... this should teach me to not try solving problems on the fly... I hope it won't happen again. :wink:

I'm working on the new project and I have inserted code everywhere... I think that 80% of XS files have something different respect to 058, so I'll stop to provide minor fixes on the fly, because most of them won't work as expected on 058, and I don't want to complicate users' life.

This bug should be solved in the new project, and until a public beta will be out, you have to trust me... :mrb:


Thank you for your time, and sorry for having provided a wrong fix.


-----------------------------------
tormentor
Tue 14 Nov, 2006 15:40

Re: Questions
-----------------------------------
MG, I made all, the only thing missing is the code to change in common.php , from the original file, you simply forgot to write it in the post


-----------------------------------
Mighty Gorgon
Fri 17 Nov, 2006 02:44

Re: Questions
-----------------------------------
[quote user="tormentor" post="4775"]MG, I made all, the only thing missing is the code to change in common.php , from the original file, you simply forgot to write it in the post[/quote]
The problem is different... I'm working on a version which is now too different from 058b... :roll:

It is fixed here on this site, and you'll have this fixed in the new project. :wink:


-----------------------------------
tormentor
Sun 28 Jan, 2007 00:14

Re: Questions
-----------------------------------
The problem is still there on the beta, just a reminder


-----------------------------------
Mighty Gorgon
Wed 31 Jan, 2007 03:00

Re: Questions
-----------------------------------
[quote user="tormentor" post="8145"]The problem is still there on the beta, just a reminder[/quote]
Do you have a link of the error on this site?

Or... Can you provide me a way on how to replicate it on a clean installation?

I thought I have fixed it, and I cannot replicate the error here... :roll:


-----------------------------------
tormentor
Sat 03 Feb, 2007 02:22

Re: Questions
-----------------------------------
That's simple: Add a theme to the board. Choose it with another browser and nickname, now with the browser that you use to go to the acp, go there and delete the theme. Now try to connect to the site with the test nickname (you could do it with your main browser and admin nickname but it will be more difficult to go in the site). The error is something like "Could not get data for theme id []".


-----------------------------------
Mighty Gorgon
Mon 12 Feb, 2007 01:51

Re: Questions
-----------------------------------
[quote user="tormentor" post="8414"]That's simple: Add a theme to the board. Choose it with another browser and nickname, now with the browser that you use to go to the acp, go there and delete the theme. Now try to connect to the site with the test nickname (you could do it with your main browser and admin nickname but it will be more difficult to go in the site). The error is something like "Could not get data for theme id []".[/quote]
Ah now I got your point... so the problem is related to the style stored in the cookie which is validated only when chosen... but of course if the theme is then deleted the cookies is not valid anymore.

I should have fixed it adding a new check when reading the cookie.


