Welcome, Guest. Please login or register.
Did you miss your activation email?
04 Jul 2009, 17:38

Login with username, password and session length
Home Chat Help Search Calendar Login Register
Pages: [1]
Print
Author Topic: admin/styles.php workaround  (Read 10061 times)
0 Members and 1 Guest are viewing this topic.
rescbr
Guest
« on: 10 Mar 2006, 14:45 »

I had some problems with admin/style.php, and I've corrected them.
Here goes admin/style.php for you that having the same problem (no style being displayed)
Code:
<?php
// Style.php Workaround by rescbr
//CHANGED
header("Content-type: text/css");
require_once(
"../include.php");
require_once(
"../lib/classes/class.user.inc.php");
$theme=get_preference(get_userid(),"admintheme");
$style="style";
if (isset(
$_GET['ie']))
    {
    
$style.="_ie";
    }
$style .= ".css";
if (
file_exists(dirname(__FILE__)."/themes/".$theme."/css/".$style))
{

        
//change readfile to these commands:
//readfile(dirname(__FILE__)."/themes/".$theme."/css/".$style);
        
$localfile file_get_contents(dirname(__FILE__)."/themes/default/css/".$style);
echo($localfile);

}
else if (
file_exists(dirname(__FILE__)."/themes/default/css/".$style))
{
        
// Same thing here
//readfile(dirname(__FILE__)."/themes/default/css/".$style);
$localfile file_get_contents(dirname(__FILE__)."/themes/default/css/".$style);
echo($localfile);
}
?>


That's only this.
Logged
Ted
Benevolent Dictator
Administrator
Power Poster
*****

Karma: 94
Offline Offline

Posts: 3264

Location: Fairless Hills, Pa USA

Gravatar


WWW
« Reply #1 on: 11 Mar 2006, 08:14 »

Hmm.  Interesting.  The only real issue I see is that file_get_contents was introduced in 4.3.0.  However, I think this could be adjusted into an if/else.  At least the majority of people will get file_get_contents and rest will get readfile.
Logged

Need CMSMS custom development, paid support and or contract programming?  Hire me: Shift Refresh.
What am I up to?  Check twitter
tonypiazza
Forum Members
**

Karma: 0
Offline Offline

Posts: 12


« Reply #2 on: 13 Jan 2007, 17:11 »

I had this exact problem and tried a number of things to fix it with no success. I decided to give your workaround a try. It worked perfectly! Maybe this code should get added to the code base.

Thanks very much for posting this.

Tony
Logged
Elijah Lofgren
I follow Jesus Christ, enjoy reading, writing, helping people, and making websites.
Power Poster
***

Karma: 81
Offline Offline

Posts: 835

Location: Deatsville, AL



WWW
« Reply #3 on: 12 Mar 2007, 12:17 »

I had this exact problem and tried a number of things to fix it with no success. I decided to give your workaround a try. It worked perfectly! Maybe this code should get added to the code base.

Thanks very much for posting this.

Tony

Hmm.... Any idea why this fixes the problem?

I'd be glad to apply this patch if it would be helpful to everyone and didn't have any downsides.

I'd first like to understand more about this patch though.

Thanks,

Elijah
Logged

Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. Smiley
My CMSMS site: http://www.elijahlofgren.com/
DanH
Peanut Gallery


Karma: 0
Offline Offline

Posts: 1


« Reply #4 on: 21 Mar 2007, 20:38 »

I realize that this is an old post, but for what it worths, this workaround works for me too Smiley
The instalation worked like a charm until I logged in in the admin area ... where I had no style. Browsed the forums like crazy after that until I stumbled on this thread Smiley
Thx a lot rescbr.
Logged
Elijah Lofgren
I follow Jesus Christ, enjoy reading, writing, helping people, and making websites.
Power Poster
***

Karma: 81
Offline Offline

Posts: 835

Location: Deatsville, AL



WWW
« Reply #5 on: 21 Mar 2007, 20:42 »

Hmm... If I had more time I'd post this in the wiki somewhere. For now I'll bookmark it on my CMSMS tips page.

Thanks  Smiley
Logged

Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. Smiley
My CMSMS site: http://www.elijahlofgren.com/
SideshowBob
Forum Members
**

Karma: 3
Offline Offline

Posts: 65

Location: Bristol, UK


« Reply #6 on: 13 Sep 2007, 07:01 »

Hi Everyone,

I appreciate this is an old thread so apologies if this isn't new info to you, however this issue still exists in V1.1.1.

This issue crops up a number of times in the forums so anything you can do to solve it or make it more visible would be a good thing.

For me (and no doubt many others) this problem is caused by my host disabling readfile for security reasons.

The solution for me is to replace readfile with echo file_get_contents

The readfile command occurs in a few files so be sure to replace all of them.

Bob
Logged
Pages: [1]
Print
Jump to: