https://www.icyphoenix.com/viewtopic.php?f=35&t=4009
-----------------------------------
Lopalong
Sun 06 Apr, 2008 04:51

[BUG] Critical Error - Line : 1010 - File : Functions.php
-----------------------------------
Critical Error 

Could not get theme data for themes_id [32]

DEBUG MODE

Line : 1010
File : functions.php

I've read everything here that pertains to the problem (After sifting through such useless titles as "Locked Out" "Big Errors" :( and nothing suggested works to fix the problem.

Something as simple as "Disabling the Site" - logging out - clear cache and cookies, and logging back in created this error message in IE7, FF and Opera - with the /cache cleared, and all browser cookies and caches cleared.

I've had this before, and I thought it was me, ;) and the only way I could get it back then was to edit the DB and change one of the theme_id's to the number it was looking for. :(

Here's the current dump for ip_themes that returns the error.

[code linenumbers=false]DROP TABLE IF EXISTS `ip_themes`;
CREATE TABLE `ip_themes` (
  `themes_id` mediumint(8) unsigned NOT NULL auto_increment,
  `template_name` varchar(30) collate latin1_general_ci NOT NULL default '',
  `style_name` varchar(30) collate latin1_general_ci NOT NULL default '',
  `head_stylesheet` varchar(100) collate latin1_general_ci default NULL,
  `body_background` varchar(100) collate latin1_general_ci default NULL,
  `body_bgcolor` varchar(6) collate latin1_general_ci default NULL,
  `body_text` varchar(6) collate latin1_general_ci default NULL,
  `body_link` varchar(6) collate latin1_general_ci default NULL,
  `body_vlink` varchar(6) collate latin1_general_ci default NULL,
  `body_alink` varchar(6) collate latin1_general_ci default NULL,
  `body_hlink` varchar(6) collate latin1_general_ci default NULL,
  `tr_color1` varchar(6) collate latin1_general_ci default NULL,
  `tr_color2` varchar(6) collate latin1_general_ci default NULL,
  `tr_color3` varchar(6) collate latin1_general_ci default NULL,
  `tr_class1` varchar(25) collate latin1_general_ci default NULL,
  `tr_class2` varchar(25) collate latin1_general_ci default NULL,
  `tr_class3` varchar(25) collate latin1_general_ci default NULL,
  `th_color1` varchar(6) collate latin1_general_ci default NULL,
  `th_color2` varchar(6) collate latin1_general_ci default NULL,
  `th_color3` varchar(6) collate latin1_general_ci default NULL,
  `th_class1` varchar(25) collate latin1_general_ci default NULL,
  `th_class2` varchar(25) collate latin1_general_ci default NULL,
  `th_class3` varchar(25) collate latin1_general_ci default NULL,
  `td_color1` varchar(6) collate latin1_general_ci default NULL,
  `td_color2` varchar(6) collate latin1_general_ci default NULL,
  `td_color3` varchar(6) collate latin1_general_ci default NULL,
  `td_class1` varchar(25) collate latin1_general_ci default NULL,
  `td_class2` varchar(25) collate latin1_general_ci default NULL,
  `td_class3` varchar(25) collate latin1_general_ci default NULL,
  `fontface1` varchar(50) collate latin1_general_ci default NULL,
  `fontface2` varchar(50) collate latin1_general_ci default NULL,
  `fontface3` varchar(50) collate latin1_general_ci default NULL,
  `fontsize1` tinyint(4) default NULL,
  `fontsize2` tinyint(4) default NULL,
  `fontsize3` tinyint(4) default NULL,
  `fontcolor1` varchar(6) collate latin1_general_ci default NULL,
  `fontcolor2` varchar(6) collate latin1_general_ci default NULL,
  `fontcolor3` varchar(6) collate latin1_general_ci default NULL,
  `span_class1` varchar(25) collate latin1_general_ci default NULL,
  `span_class2` varchar(25) collate latin1_general_ci default NULL,
  `span_class3` varchar(25) collate latin1_general_ci default NULL,
  `img_size_poll` smallint(5) unsigned default NULL,
  `img_size_privmsg` smallint(5) unsigned default NULL,
  `online_color` varchar(6) collate latin1_general_ci default NULL,
  `offline_color` varchar(6) collate latin1_general_ci default NULL,
  `hidden_color` varchar(6) collate latin1_general_ci default NULL,
  PRIMARY KEY  (`themes_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=32;

-- 
-- Dumping data for table `ip_themes`
-- 

INSERT INTO `ip_themes` (`themes_id`, `template_name`, `style_name`, `head_stylesheet`, `body_background`, `body_bgcolor`, `body_text`, `body_link`, `body_vlink`, `body_alink`, `body_hlink`, `tr_color1`, `tr_color2`, `tr_color3`, `tr_class1`, `tr_class2`, `tr_class3`, `th_color1`, `th_color2`, `th_color3`, `th_class1`, `th_class2`, `th_class3`, `td_color1`, `td_color2`, `td_color3`, `td_class1`, `td_class2`, `td_class3`, `fontface1`, `fontface2`, `fontface3`, `fontsize1`, `fontsize2`, `fontsize3`, `fontcolor1`, `fontcolor2`, `fontcolor3`, `span_class1`, `span_class2`, `span_class3`, `img_size_poll`, `img_size_privmsg`, `online_color`, `offline_color`, `hidden_color`) VALUES 
(14, 'mg_themes', 'Icy Phoenix', 'style_ice.css', 'ice', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'row1', 'row2', 'row3', '', '', '', 10, 11, 12, '', '22BB33', 'DD2222', '', '', '', 0, 0, NULL, NULL, NULL),
(30, 'vista', 'Crystal', 'style_crystal.css', 'crystal', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'row1', 'row2', 'row3', '', '', '', 10, 11, 12, '', '22BB33', 'DD2222', '', '', '', 0, 0, NULL, NULL, NULL);[/code]

If I change this - (30, 'vista', 'Crystal', 'style_crystal.css', 'crystal' to - (32 Then everything goes back to normal. :)

Q. Where is IP getting the information from for themes_id [32] when it doesn't exist in the Db, and all caches / cookies etc, etc, have been cleared ??


-----------------------------------
moreteavicar
Sun 06 Apr, 2008 17:12

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
I think the clue is in the last line of your create table:
[quote]
AUTO_INCREMENT=32;[/quote] ;)


-----------------------------------
Lopalong
Sun 06 Apr, 2008 23:06

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
:| 

Dunno if that's the problem MTV as it appears to be looking for a theme ID, and not an incremental value. 

 :?:


-----------------------------------
moreteavicar
Mon 07 Apr, 2008 00:46

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
It already has a theme id, by virtue of the error: Critical Error

Could not get theme data for themes_id [32] 

And how do you think xs_styles.php obtains the theme id?

[code linenumbers=false]//
// get list of installed styles
//
$sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name';[/code]
[code linenumbers=false]
$style_rowset = $db->sql_fetchrowset($result);

for($i=0; $i<count($style_rowset); $i++)
{
	$id = $style_rowset[$i]['themes_id'];
[/code]

sql_fetchrowset is really using the php function mysql_fetch_array($result, MYSQL_ASSOC) the "MYSQL_ASSOC" returns associative indices. 

And so the value of rows are associated with their index in the table, and the way mysql works, last auto-index is associated with the last row, which in turn is assigned by xs_styles as the value of the theme id for the last theme. Spin this around the other way, go into your themes table and change the theme id back to 30, and set then auto-increment value to 30, see what happens ;)


-----------------------------------
Mighty Gorgon
Mon 07 Apr, 2008 01:34

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
Try to reset your def_themes.php as well...


-----------------------------------
moreteavicar
Mon 07 Apr, 2008 02:15

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
Ah yes... now thinking about it, we are bordering into the subtle world of how this crazy templating system works... one of the things is that it normally only tries to access the DB themes table for themes if the def_themes is empty, or if caching is disabled...

There is something else that is more likely... *edit - more likely to my last post, not MG's * - there is a function called setup_style() that gets the style based on the board_config default_style, or if a user has a preferred theme, then: setup_style($userdata['user_style']...) - so maybe the error for Lopalong was really the fact that he had set a default theme / personal theme for the theme that was numbered 32... (it is setup_style()  which loads the def_themes file, and uses it if it has data, or else queries the database...) and when you want to remove a theme, you have to do it from within extreme styles, so that it can strip all the references to that theme from the users table... Now that would make a lot more sense if you're hacking themes about like our buddy down under... 

So I suddenly realise now that xs_styles.php is a red-herring... the clue was in Lop's first post:

[quote]DEBUG MODE

Line : 1010
File : functions.php [/quote]Which is precisely the file where this function comes from... Sometimes I jump ahead of myself too far for my own good.. I think its the walamat galloping too fast.. :mrgreen:


-----------------------------------
Lopalong
Mon 07 Apr, 2008 03:07

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
@ MTV,

[quote]so maybe the error for Lopalong was really the fact that he had set a default theme / personal theme for the theme that was numbered 32... (it is setup_style()  which loads the def_themes file, and uses it if it has data, or else queries the database...) and when you want to remove a theme, you have to do it from within extreme styles, so that it can strip all the references to that theme from the users table... [/quote]

Somewhere, something is screwed up ? def_themes.php, no longer appears to have theme 32 as it was no doubt flushed from the file when it was removed / uninstalled.  Why it still looks for it? is a mystery - But I do give it a hiding with swapping themes, re-naming folders, config files and the like, and as I'm using localhost for most of the work, maybe MS couldn't keep track of what was happening.

:mryellow:

@MG,

Easy! once one gets to know where these things are.  8) 

[quote=MTV]Now that would make a lot more sense if you're hacking themes about like our buddy down under... [/quote]

[i][b]Modelling [/b][/i]- NOT hacking! :P

And I'm still only a learner when it comes to phpBB - aka IP.  :oops:


-----------------------------------
moreteavicar
Mon 07 Apr, 2008 12:13

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
[quote user="Lopalong" post="27418"]@ MTV,
You were right in one way, auto-increment appends the next number to the next theme but it wouldn't matter if the existing theme was 32 and auto increment was 132. The next theme would be 133.
[/quote]

Well yes, thats just because its the primary key - as per my second post on xs_styles.php, it looks like something subtle happens there - it still has what looks like a crazy way of obtaining the the theme_id - indirectly using mysql_fetch_array($result, MYSQL_ASSOC) - why use a function that returns associative indices? Totally strange, I mean, I would have expected something using standard sql_fetchrow like:

[code linenumbers=false]
$sql = 'SELECT themes_id, template_name, style_name FROM ' . THEMES_TABLE . ' ORDER BY template_name';
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query themes information', '', __LINE__, __FILE__, $sql);
	}

while ( $row = $db->sql_fetchrow($result) )
{
	$id = $row['themes_id']; 
}
$db->sql_freeresult($result);
[/code]
But there, thats immaterial for the error message you got, and ultimately, although xs_styles.php uses a method which gives the row index, it is still addressing the field 'themes_id', so perhaps it [i]is[/i] be getting the right info... but I'm just not sure exactly what the phpbb dB library returns for mysql_fetch_array($result, MYSQL_ASSOC)... since it could still just be getting the row index associated with the field 'themes_id' rather than the value stored in there itself... if you're curious [url=http://uk.php.net/manual/en/function.mysql-fetch-array.php]read this- anyway... an example of how crazy this mod is - not doing the obvious!

And I think MGs message about deleting the entries in def_themes.php was actually to stop you having another error - the dreaded white page. Any false entries in there usually result in nothing being seen at all. 

To recap from my last post, the reason your error message appeared is because setup_style() was accessing the DB to query the themes id - the only reason it does this is because def_themes was empty at that time. That the theme reappeared in def_themes is probably because you changed your theme id back to 32 - then when setup_style() found theme-id 32 in your database, the theme info is then stored in def_themes (actually another function does that step, cache_themes in functions_categories_hierarchy.php...

If you're not convinced about this, open functions.php and look at the lines 947 - 1010 (where your error message occured). It was querying [code linenumbers=false]if ( ($style != $board_config['default_style']) || ($old_style != false) )[/code] the else to that is line 1010:[code linenumbers=false]message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]", '', __LINE__, __FILE__);[/code]which is precisely the error you got.

And so... it was trying to query the themes id based on what is stored in your settings for the default theme in the config table $board_config['default_style']. As I'm sure you'll discover in time... def_themes screws things up in a much nastier way - you'll be lucky to even see an error message  ;)

[quote user="Lopalong" post="27418"]Modelling - NOT hacking![/quote]I'm beginning to doubt you're an Aussie now... I mean, first off, use of euphemisms... only Americans do that... (e.g. "bathroom" instead of "toilet"), secondly... making fancy themes - I mean, Australians are too down to earth to care about appearances... you still have mullets over there! And 3rd... that you're even in front of a computer... I mean a real Aussie would be out in his yard trying to perfect the spin bowling technique to be the next Shane Warne ;)


-----------------------------------
Lopalong
Mon 07 Apr, 2008 13:09

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
All too confusing!  :P 

The bottom line on how I understand it is: The error wasn't being generated by the Db, and there really was no need for me to modify it. 

When and / or if it happens again, I will compare the Db entries against def_themes.php, and that should or will indicate where the the problem or request was being generated from. Until then, it's a mystery-bag.

 :mricy:


-----------------------------------
moreteavicar
Tue 08 Apr, 2008 12:46

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
[quote user="Lopalong" post="27433"]All too confusing!  :P 

Edit to stay on topic:

The bottom line is: The error wasn't being generated by the Db, and there really was no need for me to modify it. 

When and / or if it happens again, I will compare the Db entries against def_themes.php, and that should or will indicate where the the problem or request was being generated from. Until then, it's a mystery-bag.

 :mricy:[/quote] Hmmm.... you are suffering from amnesia from your very first post which clearly states where the error occurred. ;) 
Actyall its because your board default theme setting - it contains an entry for a theme that doesn't exist.

To see whats happening to give this error, here are the relevant lines from functions.php:

[code linenumbers=false]
START - query the database:
		$sql = 'SELECT * FROM ' . THEMES_TABLE . ' WHERE themes_id = ' . (int) $style;
		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(CRITICAL_ERROR, 'Could not query database for theme info');
		}

		if ( !($row = $db->sql_fetchrow($result)) )
		{
			// We are trying to setup a style which does not exist in the database
			// Try to fallback to the board default (if the user had a custom style)
			// and then any users using this style to the default if it succeeds
			if ( ($style != $board_config['default_style']) || ($old_style != false) )
			{
				if ($old_style != false)
				{
					$board_config['default_style'] = $old_style;
				}
				$sql = 'SELECT * FROM ' . THEMES_TABLE . ' WHERE themes_id = ' . (int) $board_config['default_style'];
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(CRITICAL_ERROR, 'Could not query database for theme info');
				}

				if ( $row = $db->sql_fetchrow($result) )
				{
					$db->sql_freeresult($result);
				}
				else
				{
					$style = $old_default_style;
					//message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]", '', __LINE__, __FILE__);
				}

				$sql = 'UPDATE ' . USERS_TABLE . '
					SET user_style = ' . (int) $board_config['default_style'] . "
					WHERE user_style = $style";
				if ( !($result = $db->sql_query($sql)) )
				{
					message_die(CRITICAL_ERROR, 'Could not update user theme info');
				}
			}
			else
			{
LINE 1010:		message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]", '', __LINE__, __FILE__);
			}
		}
	}[/code] The clue is in the IF: [code linenumbers=false]if ( !($row = $db->sql_fetchrow($result)) )[/code] In other words, if the row couldn't be queried from DB, try a number of things to change the theme settings, but, if the original query was relating to the default style, it means that default style couldn't be retrieved from DB, so then we have problems (there should always be a default style) - hence the error message on line 1010. So the question is why did mysql return an error? We come back my previous point, about the board default theme setting, that it contains an entry for a theme that doesn't exist.


-----------------------------------
Lopalong
Tue 08 Apr, 2008 13:53

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
MTV,

My question was:

[quote]Q. Where is IP getting the information from for themes_id [32] when it doesn't exist in the Db, and all caches / cookies etc, etc, have been cleared ??[/quote]

Why and how it happens doesn't interest me in the slightest, only that the theme was at one time installed and had been deleted / uninstalled along with a few others.

IP had cached this information elsewhere and all I wanted to know was where that information may be stored. Not a breakdown of the core-file code on how MYSQL works or how IP deciphers that information.


-----------------------------------
moreteavicar
Tue 08 Apr, 2008 14:57

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
[quote]Why and how it happens doesn't interest me in the slightest, only that the theme was at one time installed and had been deleted / uninstalled along with a few others. [/quote]I am trying to help you understand why you get to 
[quote]
"Where is IP getting the information from for themes_id [32] when it doesn't exist in the Db, and all caches / cookies etc, etc, have been cleared ??[/quote] 

Sorry I'm trying to explain why this error occurs.

It is because you have a default theme set in your board config which no longer exists, you need to go into ACP>> board config. 

Function get_themes is being called with $board_config['default_style'])  - the themes_id is being obtained from the settings for your board default themes. But you are right that it could be a caching issue, in that the board config database table is also cached. However, if you make a change in the default theme, you should change it in your ACP, so it will regenerate the cache file. But you stated [quote]
The bottom line is: The error wasn't being generated by the Db, and there really was no need for me to modify it. [/quote] which is perhaps a misstatement on your part - the error is clearly created by the DB, because it contains data in default board style for a theme that doesn't exist, a theme defined by what is configured to be your default board style, as said previously. Yes it could be in a database cache file, but that cache file depends on what is in the database.


-----------------------------------
Lopalong
Wed 09 Apr, 2008 00:28

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
I'm still not sure. Let me suggest this to you:

I removed all themes from the Db "Dumping data for table `ip_themes`"

[code]
-- 
-- Table structure for table `ip_themes`
-- 

CREATE TABLE `ip_themes` (
  `themes_id` mediumint(8) unsigned NOT NULL auto_increment,
  `template_name` varchar(30) collate latin1_general_ci NOT NULL default '',
  `style_name` varchar(30) collate latin1_general_ci NOT NULL default '',
  `head_stylesheet` varchar(100) collate latin1_general_ci default NULL,
  `body_background` varchar(100) collate latin1_general_ci default NULL,
  `body_bgcolor` varchar(6) collate latin1_general_ci default NULL,
  `body_text` varchar(6) collate latin1_general_ci default NULL,
  `body_link` varchar(6) collate latin1_general_ci default NULL,
  `body_vlink` varchar(6) collate latin1_general_ci default NULL,
  `body_alink` varchar(6) collate latin1_general_ci default NULL,
  `body_hlink` varchar(6) collate latin1_general_ci default NULL,
  `tr_color1` varchar(6) collate latin1_general_ci default NULL,
  `tr_color2` varchar(6) collate latin1_general_ci default NULL,
  `tr_color3` varchar(6) collate latin1_general_ci default NULL,
  `tr_class1` varchar(25) collate latin1_general_ci default NULL,
  `tr_class2` varchar(25) collate latin1_general_ci default NULL,
  `tr_class3` varchar(25) collate latin1_general_ci default NULL,
  `th_color1` varchar(6) collate latin1_general_ci default NULL,
  `th_color2` varchar(6) collate latin1_general_ci default NULL,
  `th_color3` varchar(6) collate latin1_general_ci default NULL,
  `th_class1` varchar(25) collate latin1_general_ci default NULL,
  `th_class2` varchar(25) collate latin1_general_ci default NULL,
  `th_class3` varchar(25) collate latin1_general_ci default NULL,
  `td_color1` varchar(6) collate latin1_general_ci default NULL,
  `td_color2` varchar(6) collate latin1_general_ci default NULL,
  `td_color3` varchar(6) collate latin1_general_ci default NULL,
  `td_class1` varchar(25) collate latin1_general_ci default NULL,
  `td_class2` varchar(25) collate latin1_general_ci default NULL,
  `td_class3` varchar(25) collate latin1_general_ci default NULL,
  `fontface1` varchar(50) collate latin1_general_ci default NULL,
  `fontface2` varchar(50) collate latin1_general_ci default NULL,
  `fontface3` varchar(50) collate latin1_general_ci default NULL,
  `fontsize1` tinyint(4) default NULL,
  `fontsize2` tinyint(4) default NULL,
  `fontsize3` tinyint(4) default NULL,
  `fontcolor1` varchar(6) collate latin1_general_ci default NULL,
  `fontcolor2` varchar(6) collate latin1_general_ci default NULL,
  `fontcolor3` varchar(6) collate latin1_general_ci default NULL,
  `span_class1` varchar(25) collate latin1_general_ci default NULL,
  `span_class2` varchar(25) collate latin1_general_ci default NULL,
  `span_class3` varchar(25) collate latin1_general_ci default NULL,
  `img_size_poll` smallint(5) unsigned default NULL,
  `img_size_privmsg` smallint(5) unsigned default NULL,
  `online_color` varchar(6) collate latin1_general_ci default NULL,
  `offline_color` varchar(6) collate latin1_general_ci default NULL,
  `hidden_color` varchar(6) collate latin1_general_ci default NULL,
  PRIMARY KEY  (`themes_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=40 ;

-- 
-- Dumping data for table `ip_themes`
-- 


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

-- 
-- Table structure for table `ip_themes_name`
-- 

CREATE TABLE `ip_themes_name` (
  `themes_id` smallint(5) unsigned NOT NULL default '0',
  `tr_color1_name` char(50) collate latin1_general_ci default NULL,
  `tr_color2_name` char(50) collate latin1_general_ci default NULL,
  `tr_color3_name` char(50) collate latin1_general_ci default NULL,
  `tr_class1_name` char(50) collate latin1_general_ci default NULL,
  `tr_class2_name` char(50) collate latin1_general_ci default NULL,
  `tr_class3_name` char(50) collate latin1_general_ci default NULL,
  `th_color1_name` char(50) collate latin1_general_ci default NULL,
  `th_color2_name` char(50) collate latin1_general_ci default NULL,
  `th_color3_name` char(50) collate latin1_general_ci default NULL,
  `th_class1_name` char(50) collate latin1_general_ci default NULL,
  `th_class2_name` char(50) collate latin1_general_ci default NULL,
  `th_class3_name` char(50) collate latin1_general_ci default NULL,
  `td_color1_name` char(50) collate latin1_general_ci default NULL,
  `td_color2_name` char(50) collate latin1_general_ci default NULL,
  `td_color3_name` char(50) collate latin1_general_ci default NULL,
  `td_class1_name` char(50) collate latin1_general_ci default NULL,
  `td_class2_name` char(50) collate latin1_general_ci default NULL,
  `td_class3_name` char(50) collate latin1_general_ci default NULL,
  `fontface1_name` char(50) collate latin1_general_ci default NULL,
  `fontface2_name` char(50) collate latin1_general_ci default NULL,
  `fontface3_name` char(50) collate latin1_general_ci default NULL,
  `fontsize1_name` char(50) collate latin1_general_ci default NULL,
  `fontsize2_name` char(50) collate latin1_general_ci default NULL,
  `fontsize3_name` char(50) collate latin1_general_ci default NULL,
  `fontcolor1_name` char(50) collate latin1_general_ci default NULL,
  `fontcolor2_name` char(50) collate latin1_general_ci default NULL,
  `fontcolor3_name` char(50) collate latin1_general_ci default NULL,
  `span_class1_name` char(50) collate latin1_general_ci default NULL,
  `span_class2_name` char(50) collate latin1_general_ci default NULL,
  `span_class3_name` char(50) collate latin1_general_ci default NULL,
  PRIMARY KEY  (`themes_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

-- 
-- Dumping data for table `ip_themes_name`
-- 


-- --------------------------------------------------------[/code]


And IP still works OK and continues to bring up theme 32, because it is obviously getting its information from def_themes.php here.

[code]
$themes_style = array(
		14 => array('themes_id' => '14', 'template_name' => 'mg_themes', 'style_name' => 'Icy Phoenix', 'head_stylesheet' => 'style_ice.css', 'body_background' => 'ice', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),
		32 => array('themes_id' => '32', 'template_name' => 'vista', 'style_name' => 'Crystal', 'head_stylesheet' => 'style_crystal.css', 'body_background' => 'crystal', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),
		37 => array('themes_id' => '37', 'template_name' => 'vista', 'style_name' => 'Teal', 'head_stylesheet' => 'style_teal.css', 'body_background' => 'teal', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),
		38 => array('themes_id' => '38', 'template_name' => 'vista', 'style_name' => 'Split', 'head_stylesheet' => 'style_split.css', 'body_background' => 'split', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),
		39 => array('themes_id' => '39', 'template_name' => 'vista', 'style_name' => 'Crystal P Blue', 'head_stylesheet' => 'style_crystal_p_blue.css', 'body_background' => 'crystal_p_blue', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),
	);
return;
[/code]

If I remove:
[code]
		32 => array('themes_id' => '32', 'template_name' => 'vista', 'style_name' => 'Crystal', 'head_stylesheet' => 'style_crystal.css', 'body_background' => 'crystal', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),[/code]

I get:

Critical Error 

Could not get theme data for themes_id [32]

DEBUG MODE

Line : 1010
File : functions.php

And if I change:
[code]
		14 => array('themes_id' => '14', 'template_name' => 'mg_themes', 'style_name' => 'Icy Phoenix', 'head_stylesheet' => 'style_ice.css', 'body_background' => 'ice', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),[/code]


To:
[code]
		32 => array('themes_id' => '32', 'template_name' => 'mg_themes', 'style_name' => 'Icy Phoenix', 'head_stylesheet' => 'style_ice.css', 'body_background' => 'ice', 'body_bgcolor' => '', 'body_text' => '', 'body_link' => '', 'body_vlink' => '', 'body_alink' => '', 'body_hlink' => '', 'tr_color1' => '', 'tr_color2' => '', 'tr_color3' => '', 'tr_class1' => '', 'tr_class2' => '', 'tr_class3' => '', 'th_color1' => '', 'th_color2' => '', 'th_color3' => '', 'th_class1' => '', 'th_class2' => '', 'th_class3' => '', 'td_color1' => '', 'td_color2' => '', 'td_color3' => '', 'td_class1' => 'row1', 'td_class2' => 'row2', 'td_class3' => 'row3', 'fontface1' => '', 'fontface2' => '', 'fontface3' => '', 'fontsize1' => '10', 'fontsize2' => '11', 'fontsize3' => '12', 'fontcolor1' => '', 'fontcolor2' => '22BB33', 'fontcolor3' => 'DD2222', 'span_class1' => '', 'span_class2' => '', 'span_class3' => '', 'img_size_poll' => '0', 'img_size_privmsg' => '0', 'online_color' => '', 'offline_color' => '', 'hidden_color' => ''),[/code]

The Error is removed and IP comes up with the "Icy Phoenix" theme.

And as there are NO themes in the Db, it's obvious that functions.php is first taking (or only taking) its information from def_themes.php which makes a lot of sense if one has set this up to reduce Db queries.


That's all my question was - So yes! I DO understand, and NO I don't have amneasia.

Edit: This appears to be the real problem: ('default_style', '32'), as previously somewhere along the way it never changed when the default theme (32) at that time was removed. Dunno, it hasn't happened since. ?

[b]Edit 2:[/b]


MTV,

I hope this helps to finally put this to bed. :)

It happened again after re-installing all of the themes which now number from 40 to 44 and it still looks for 32?

And it appears that the crux of the issue was:

In the ACP I had set.

Default Style = Crystal" (32)
Override user style = (Y)
Replaces users style with the default   

Then I used XS to set a new default and remove what was the "old" default. But the "Board Config" keeps switching it back for a theme that no longer exists. :(

Now that I have: 

Override user style = (N)

It no longer looks for theme (32)


-----------------------------------
moreteavicar
Wed 09 Apr, 2008 11:21

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
Ha ha, ok, good... I did say it is the settings of your default style as function get_themes is being called with $board_config['default_style']), for a few times now, but its good you found this out in your own way ;)


-----------------------------------
Lopalong
Wed 09 Apr, 2008 12:05

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
It still doesn't explain why changing the default style in XS allows one to delete what is the default theme set in the ACP, so there is a conflict between the two functions as the XS setting doesn't recognise the setting in the ACP, and vice-versa.

So I think it's a BUG, and the best remedy I think, is to remove the option from the ACP and use only XS to over-ride user's settings and all other theme functions etc.

Then there won't be any more slightly "warm and long" conversations about as to what the problem may or may not be, because it wont exist anymore.  :mricy:

Catcha later,  and I'm glad that "all" avenues pertaining to this issue have been covered, and hopefully resolved. 8)


-----------------------------------
moreteavicar
Wed 09 Apr, 2008 13:43

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
Well, I'm not convinced it is a bug, because if you uninstall a theme through XS styles, it checks that the theme you are unistalling is not set as the default theme:

[b]Uninstalling styles and Default Style settings[/b]

If you uninstall themes in ACP XS styles, it checks that the selected theme to uninstall is not set to board config, or else display an error message. The relevant lines are in adm/xs_uninstall.php:

[code linenumbers=false]	
        $remove_id = intval($_GET['remove']);
	if($board_config['default_style'] == $remove_id)
	{
		xs_error(str_replace('{URL}', append_sid('xs_styles.' . $phpEx), $lang['xs_uninstall_default']) . '<br /><br />' . $lang['xs_uninstall_back']);
	}[/code]

If an error message is not displayed, then there is a possible problem with xs_error() not being included, however, I cannot see why this is the case - the function is defined in xs_include.php, and that file is included at the top of xs_uninstall.php, and more to the point, if that function didn't exist, then you would get an error for a call to an undefined function. 

Another possibility might be suggested that the variables are not correctly parsed to the function, but if that was the case, a blank error message would be displayed, so there would still be something to stop you removing a theme defined as the site default - so far this has always worked for me. 

However, if a theme is removed by deleting it from the themes directory, or else renaming the folder, then the xs styles uninstall script will not have had any chance of being executed, and thus it would be possible to remove a theme that was defined as a default style. In this final scenario, the bug is definitely the user ;)


-----------------------------------
Lopalong
Wed 09 Apr, 2008 21:59

Re: [BUG] Critical Error - Line : 1010 - File : Functions.ph
-----------------------------------
8) 

Thanks for your time and effort in helping to resolve this, but as I'm only a novice to IP and the way the code is laid out, you lost me a few times. :P

So the end result to fix, or avoid this error (In layman's terms) appears to be (for whatever reason the style is missing?):

[i][b]ACP > Site > 

Default Style: "Change This"

Override user style: (N)

Clear cache's, optimise the Database and then use Override user style: (Y) ONLY if you need to.

And Note: Setting (Y) is not recommended if you are using IP to create / modify or are re-naming themes etc.[/b][/i]

Is that too short? :P

[b]Off Topic:[/b] Hey! mtv, it's about time you were concentrating on finishing your Thesis, not hanging around here.  :mricy:


-----------------------------------
Mighty Gorgon
Wed 09 Apr, 2008 23:34

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
Edited because I was Drunk...


-----------------------------------
moreteavicar
Fri 11 Apr, 2008 11:08

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
I think MG posted in the wrong thread, hey [b]Lopalong [/b]? ;)


-----------------------------------
Lopalong
Fri 11 Apr, 2008 13:17

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
[quote user="moreteavicar" post="27607"]I think MG posted in the wrong thread, hey [b]Lopalong [/b]? ;)[/quote]

Don't know? But there is a certain influence about his presence in a thread. Maybe it's because the "Hand that wields the sword, also rocks the cradle".

 :mryellow:


-----------------------------------
moreteavicar
Tue 15 Apr, 2008 20:54

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
I think maybe a little too much vino rosso caused him to wield the sword in an unsteady manner...  :mrgreen:


-----------------------------------
Mighty Gorgon
Wed 16 Apr, 2008 00:39

Re: SOLVED - [BUG] Critical Error - Line : 1010 - File : Fun
-----------------------------------
You are right... I have edited my post... :P


