Bots and Styles

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Bots and Styles

Post by Michaelo »

For the longest time I have noticed the following error in Error log..

A general error occured: General Error
» Could not get style data

On this (and all other occasions) it relates to bots using a style that has been disabled or deleted...
To fix the problem I add the following code to force the default style...

sessions.php

Code: Select all

		if (!$this->theme)
		{
			// returns the group name for the passed id //
			include($phpbb_root_path . 'includes/sgp_functions.' . $phpEx);
			$grp = strtoupper(sgp_get_group_name($user->data['group_id']));
			
			if ($grp == 'BOTS') // ADDED ADMIN FOR TESTING ONLY // || $grp == 'ADMINISTRATORS')
			{
				redirect(build_url('style') .'?style='. $config['default_style']);
			}
			else
			{
				trigger_error('Could not get style data', E_USER_ERROR);
			}
		}
This seems a little more than is necessary so I am just checking to see if there is an easier method to remove/disable the style=x for bots?

Also, the official code uses hard coded language, should this not be $user->lang['COULD_NOT_GET_STYLE_DATA'] ?
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Bots and Styles

Post by Michaelo »

As an alternative and without additional code just use:

Code: Select all

		if (!$this->theme)
		{
			//trigger_error('Could not get style data', E_USER_ERROR);
			redirect(build_url('style') .'?style='. $config['default_style']);
		}
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Bots and Styles

Post by DavidIQ »

This sounds more like a bug in the software. Is there a ticket open for this in the tracker? Also isn't this something that the ACP takes care of when you inactivate a style? If it does not then it's definitely a bug.
Image

Michaelo
Registered User
Posts: 106
Joined: Thu Apr 01, 2004 7:56 am
Location: Dublin

Re: Bots and Styles

Post by Michaelo »

Will test on a clean install without mod... mind you we have only seen the error with bots where styles are constantly updated, added /removed...

Reported the use of hard coded language instead of language var...
Reported the error relating to bots...

Have update the code to:

Code: Select all

		if (!$this->theme)
		{
			// Report missing style and redirect to default style...
			add_log('critical', 'STYLE_MISSING', request_var('style', 0), $user->data['user_id']);
			redirect(build_url('style') .'?style='. $config['default_style']);

			//original code
			//trigger_error('Could not get style data', E_USER_ERROR);
		}
Add language variable to /langusge/en/acp/common.php

Code: Select all

	'STYLE_MISSING'			=> 'Could not get style data for style id: %1$s user_id: %2$s',
Mods: Forum Icons Enhancement, Kiss Portal Engine
Links:
Kiss Portal Engine (dev site) Stargate Portal (archive site) ...
Styles: Technika

victory1
Registered User
Posts: 5
Joined: Tue May 17, 2011 2:29 am

Re: Bots and Styles

Post by victory1 »

There is definitely a bug there. I moved my board from another software last October. Unfortunately, I did not know anything about Prosilver or Subsilver and my default style was Black Pearl which was a dark style (base on Subsilver). I later added a 2nd style, RedSteel which was a light style (base on Prosilver). I realized that a lot of mod authors don't feel obligated to have Subsilver edits and there were a couple of mods that I wanted so I decided to remove the Black Pearl and find another dark style base on Prosilver. So I made RedSteel the default style. I then added ExtremeDark Red as my dark style and activated that. I then deactivated Black Pearl from ACP and it prompt me to move everyone that was using BP to default style RedSteel, including all the bots. Then I uninstall it from ACP. Now my error log is filled with:

Code: Select all

Could not get style data for style
But it's only doing it for Google Bot and Anonymous user. When I add Michaelo code, both are looking for style #2 which was the Black Pearl Style. Why is that? I've check both and they are using the default style, RedSteel.

Post Reply