[BETA] Change Style 0.9.8 (updated)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

change style without cookie update

Post by Tomba »

well..

I'd like to make my board appear in a style given by s=.. , but without updating the cookie. It's for a coöperative site, that calls my forum with ...?s=x . This should show my forum in their template (on my server of course) but it should show it in my style as soon as a visitor visits my site. Without ?s= I need the default style, which should stay in the cookie. (user style override is on!) :roll:

any helps please?
thanks already,

Tomba
ktauber
Registered User
Posts: 98
Joined: Mon Nov 26, 2001 2:37 pm
Location: Munich, Germany
Contact:

Post by ktauber »

Hi,

There is a small bug in version 0.9.0 beta :(

I forgot to add $db to the global statement in init_userprefs().

I have fixed it in 0.9.1 beta, which is available for download now. :)

Download: http://www.ktauber.com/downloads/phpbb2mods.html
Last edited by ktauber on Mon Jan 20, 2003 7:22 am, edited 1 time in total.
Karl Tauber
subGreen, subRed and subRebel phpBB2 styles; Change Style MOD; Styles Demo MOD
ktauber
Registered User
Posts: 98
Joined: Mon Nov 26, 2001 2:37 pm
Location: Munich, Germany
Contact:

Re: change style without cookie update

Post by ktauber »

Tomba wrote: I'd like to make my board appear in a style given by s=.. , but without updating the cookie. It's for a coöperative site, that calls my forum with ...?s=x . This should show my forum in their template (on my server of course) but it should show it in my style as soon as a visitor visits my site. Without ?s= I need the default style, which should stay in the cookie. (user style override is on!) :roll:

Hey Tomba La Bomba,

here is the solution for you.
It's a variation of the Change Style MOD.

You should not install the Change Style MOD when you want to use this one. If already installed, then undo the changes in the function init_userprefs() in functions.php. Then apply this MOD. You will notice that there are some things in common.

Differences to the Change Style MOD:
- not using cookies
- not updating the user profile
- addes ?s=style to all links


Note: This is not the Change Style MOD. It's a solution for Tomba's problem.

Code: Select all

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
# 

define('POST_GROUPS_URL', 'g');

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

define('STYLE_URL', 's');

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/functions.php

# 
#-----[ FIND ]------------------------------------------ 
# 

function init_userprefs($userdata)
{


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	global $HTTP_GET_VARS;

# 
#-----[ FIND ]------------------------------------------ 
# 

	//
	// Set up style
	//

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	if ( isset($HTTP_GET_VARS[STYLE_URL]) )
	{
		$style = urldecode( $HTTP_GET_VARS[STYLE_URL] );
		if ( $theme = setup_style($style) )
		{
			return;
		}
	}

# 
#-----[ FIND ]------------------------------------------ 
# 

function setup_style($style)
{
	global $db, $board_config, $template, $images, $phpbb_root_path;


# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	if ( intval($style) == 0 )
	{
		$sql = "SELECT *
			FROM " . THEMES_TABLE . "
			WHERE style_name = '$style'";
	}
	else
	{


# 
#-----[ FIND ]------------------------------------------ 
# 

		$sql = "SELECT *
			FROM " . THEMES_TABLE . "
			WHERE themes_id = $style";

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	}

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/page_header.php

# 
#-----[ FIND ]------------------------------------------ 
# 

	'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'), 

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	'L_BOARD_STYLE' => $lang['Board_style'],

# 
#-----[ OPEN ]------------------------------------------ 
# 

includes/session.php

# 
#-----[ FIND ]------------------------------------------ 
# 

function append_sid($url, $non_html_amp = false)
{
	global $SID;

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	global $HTTP_GET_VARS;

# 
#-----[ FIND ]------------------------------------------ 
# 

	if ( !empty($SID) && !eregi('sid=', $url) )
	{
		$url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
	}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

	if ( isset($HTTP_GET_VARS[STYLE_URL]) )
	{
		$url .= ( ( strpos($url, '?') != false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . "s=" . $HTTP_GET_VARS[STYLE_URL];
	}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
Karl Tauber
subGreen, subRed and subRebel phpBB2 styles; Change Style MOD; Styles Demo MOD
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

wow thanks!

Post by Tomba »

8O 8O

Think other peeps will be interested too..
at least I hope so for the work you have done

Hope it works.. and will surely try it within a couple of hours (haven't got time for an hours now or so.. I'll get back here to post my findings

thanks! :wink:
Tomba
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

that's it!

Post by Tomba »

wow this is exactly what I was looking for

ktauber if I can do a suggestion, not sure alreay if it works, gut replace those $HTTP_GET_VARS by $_GET , saves you from declaring it globally as these are autoglobals.
$HTTP_GET_VARS are also considered deprecated php

thank a lot!
Tomba La Bomba :P
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

damn!

Post by Tomba »

a big problem I'm afraid :'(

worked all fine on my localhost, upload the changed files to my webhost, and one minute later my site is completely down :'(

phpBB : error creating new session

crap!
ktauber
Registered User
Posts: 98
Joined: Mon Nov 26, 2001 2:37 pm
Location: Munich, Germany
Contact:

Post by ktauber »

Seems that there is a problem with your includes/session.php.

Take a look at it.

If you do not find the problem, then enable DEBUG mode (in includes/constants.php) to get a detailed error message including SQL statement.

If this does not help, then try the original session.php from phpBB.


And check your config.php on the server. Maybe you copied your config.php from localhost to your webhost. config.php contains the name of the MySQL server. Maybe your webhost tries to access now your local MySQL server :wink:
Karl Tauber
subGreen, subRed and subRebel phpBB2 styles; Change Style MOD; Styles Demo MOD
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

Post by Tomba »

djees how can this happen??
phpBB : Critical Error

Error creating new session

DEBUG MODE

SQL Error : 1114 The table 'forum_sessions' is full

INSERT INTO forum_sessions (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in) VALUES ('b5921bd4845ea4a81ede099db7f0bb60', -1, 1031390173, 1031390173, 'd9887970', 0, 0)

Line : 152
File : /www/S/sdegroote/web/www.f1technical.net/forum/includes/sessions.php


how for god's sake can a table be full??
ktauber
Registered User
Posts: 98
Joined: Mon Nov 26, 2001 2:37 pm
Location: Munich, Germany
Contact:

Post by ktauber »

Don't know :?

Do you have phpMyAdmin.
Then you can take a look into the table and empty it.
Karl Tauber
subGreen, subRed and subRebel phpBB2 styles; Change Style MOD; Styles Demo MOD
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

hehe!

Post by Tomba »

now isn't that a strange error or what :lol:
I'll delete my table then.. see what it does

of no change, I can put it back with some dump I have

do you know why it is that this sessions table is from type=heap, and all the others are not?

greets,

Tomba

EDIT : it works now, but I'm afraid I'm getting the same problem again in some time :(
ktauber
Registered User
Posts: 98
Joined: Mon Nov 26, 2001 2:37 pm
Location: Munich, Germany
Contact:

Re: hehe!

Post by ktauber »

Tomba wrote: do you know why it is that this sessions table is from type=heap, and all the others are not?
As far as I know is HEAP a in-memory table. Why it's used? Maybe it's faster or it's not necessary to save sessions on disk. Don't know.

Seems that my provider does not support HEAP tables. I have only MyISAM tables and it works fine.

Maybe it's better to change the type of the sessions table to MyISAM to avoid the problem in the future.

How many records were in the sessions table?
Tomba wrote: it works now, but I'm afraid I'm getting the same problem again in some time :(

I think you should post the problem (The table 'forum_sessions' is full) in the Support forum.

BTW: I can't imagine that the problem has anything to do with the MOD.
Karl Tauber
subGreen, subRed and subRebel phpBB2 styles; Change Style MOD; Styles Demo MOD
User avatar
Tomba
Registered User
Posts: 137
Joined: Tue Jun 18, 2002 7:52 am
Location: Belgium
Name: Steven De Groote
Contact:

Post by Tomba »

indeed it certainly has nothing to do with the mod..
seems like other phpBB'ers have experienced the same problem.

changing to MyIsam is an option, another was programmed by Ashe,
http://www.phpbb.com/phpBB/viewtopic.ph ... 157#229157

voila! :)
OliOli
Registered User
Posts: 16
Joined: Sun Sep 22, 2002 8:36 pm

Post by OliOli »

I've just reinstalled the mod after changing my 2.0.2 to a 2.0.3 board using a clean install.

I'm finding that the mod has lost its ability to keep the style requested with the handle.

Eg
TYPE www.blahblahblahblah.blah.com/phpbb/index.php?s=Cobalt
Page Loads with Cobalt style
Click Search or Forum X, or anything else
Page Loads with Default style

Is this a cookie issue or something?

Regards
Oliver
User avatar
ErDrRon
Registered User
Posts: 2156
Joined: Sat Jun 22, 2002 7:18 pm
Location: Colorado, USA
Contact:

Another curious problem...

Post by ErDrRon »

I installed the latest version of this MOD (0.9.1beta) on a friend's forum. He is using Lycos (I know) and got all the usual header errors. I appended the @ to all the offending code including the one in changestyle.php and the header errors went away. Now, however, when I click on one of the template choices in the box then page goes blank and remains so..even if refreshed.

Any thoughts?
Ron
8O
ErDrRon (Yes, I really am an ER Doc) ;-)

Author of the Admin Voting, Retroactive Signature and Edit Post Date MODs. [Unofficial MODs, of course]
Visit my phpBB Support Forum with over 90 installed MODs.
Get inexpensive yet great webhosting at PokedYou.com.
Night4554
Registered User
Posts: 99
Joined: Sun Apr 07, 2002 3:09 am

Post by Night4554 »

@ suppresses errors so you don't see them. They're still there.
Post Reply

Return to “[2.0.x] MODs in Development”