Differences between servers and local host

Questions about how to install and problems installing - please read the documentation first!
Post Reply
svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Differences between servers and local host

Post by svasti » Thu May 01, 2014 8:19 pm

I am just baffled...
I wanted to publish a new version of Teaser_XH and tried it on my homepage. Argh, the online editor in the backend of teaser completely disregarded the css (php 5.3.3-7+squeeze15). However the same thing worked fine on local host (php 5.2.5). I downloaded my homepage and uploaded the whole thing on a different server of the same hoster -- and it worked (php 5.28)! I also tried on a laptop with php 5.5.3 and it worked fine.

The strange thing is, the old stylesheet.css of Teaser 1.1 works on my homepage, but stylesheet of Teaser 1.2 doesn't work. In the new stylesheet the teasers are no longer floating blocks but inline-blocks with text-align: justify. Somehow it seems the server doesn't like that, because If I take away from the new stylesheet the justifying rules like

Code: Select all

div.teaser {
    text-align: justify;
    text-align-last: justify;
    -moz-text-align-last:justify;
}
div.teaser div {
    text-align: left;
    text-align-last: left;
    -moz-text-align-last: left;
}
it works.
That's why I am baffled.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Differences between servers and local host

Post by cmb » Fri May 02, 2014 11:01 am

That's really strange. Actually the server shouldn't be interested in any stylesheets (besides delivering them on request). Somehow I suspect some other reason for the behavior; for instance, there might be a problem regarding the joined plugin stylesheets. Or maybe there is a problem regarding the construction of the editor stylesheet.

Have you checked, that the browser gets the styles that you expect?
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Differences between servers and local host

Post by svasti » Fri May 02, 2014 3:49 pm

cmb wrote:regarding the joined plugin stylesheets
The problem is the editor stylesheet, which is delivered via $_GET.
There is the editorcss.php

Code: Select all

$css = 'html{margin-top:10px;}'."\n".' body{float:none;margin-right:auto;margin-left:auto;display:block;}';
if(isset($_GET['xeditorcss'])) $css = $_GET['xeditorcss'] . $css;
if(isset($_GET['ckeditor']) && $_GET['ckeditor']) $css = str_replace('body', 'body.cke_show_borders', $css);
header('Content-Type: text/css');
echo $css;
 
And the admin.php

Code: Select all

$editorcss = $pth['folder']['plugins'].'teaser/css/editorcss.php?ckeditor=1&xeditorcss='.urlencode($xeditorcss);
 
cmb wrote:Have you checked, that the browser gets the styles that you expect?

In my website only this is arriving:

Code: Select all

html{margin-top:10px;}
 body.cke_show_borders{float:none;margin-right:auto;margin-left:auto;display:block;} 
It seems the $_GET doesn't work here.

whereas on my localhost it is very different:

Code: Select all

body.cke_show_borders {
    width:48.5%;
    margin:0 0 15px;
    display: inline-block;
    vertical-align: top;
    overflow: hidden;
} etc.
 
This is how it should look like.

Now why doesn't the $_GET work on this specific server?
And, when I DELETE

Code: Select all

div.teaser.standard {
    text-align: justify;
    text-align-last: justify;
    -moz-text-align-last:justify;
}
div.teaser.standard div {
    text-align: left;
    text-align-last: left;
    -moz-text-align-last: left;
}
from the stylesheet, the $_GET will work on this server. But not, when this rules are simply outcommented. Even outcommented rules will break the $_GET.

It gets even stranger:

Code: Select all

div.teaser.standard {

}
div.teaser.standard div {
    /*
    text-align-last:left;
     */
}
breaks it,
but not

Code: Select all

div.teaser.standard {

}
div.teaser.standard div {
    /*
    text-align-last:;
     */
}
Just this one word: "left" outcommented !,

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Differences between servers and local host

Post by cmb » Fri May 02, 2014 5:20 pm

It seems there's some something (mod_security?) blocking the request parameter for certains contents. Have you tried renaming xeditorcss?
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Differences between servers and local host

Post by svasti » Fri May 02, 2014 7:05 pm

cmb wrote:Have you tried renaming xeditorcss?
Just tried with "t_editorcss". No change :(
Same with both editors. :evil:

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Differences between servers and local host

Post by cmb » Fri May 02, 2014 9:27 pm

svasti wrote:Just tried with "t_editorcss". No change
Please try something totally different. Maybe it's the "css" (an, albeit uncommon, abbreviation for Cross-Site-Scripting) that's blocked. And of course, you should check, whether there's mod_security active (and maybe Suhosin might cause the problem).

Anyway, it might be better to pass the CSS in a session variable instead of the URL. And maybe it's not even necessary to pass the CSS around at all, see http://cmsimpleforum.com/viewtopic.php? ... 62&p=41198.
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Differences between servers and local host

Post by svasti » Sat May 03, 2014 8:51 am

Whew,
cmb wrote:Please try something totally different
:shock:
cmb wrote:maybe it's not even necessary to pass the CSS around at all
:o all right... half way done... now the editors aren't getting file addresses any more but the actual css.
It works for ckeditor, but not yet for tinymce.

In

Code: Select all

init_editor(array('xh-editor'), $config);
$config is supposed to be the address of a file.
But now I have

Code: Select all

$config = file_get_contents($initFile);
$config = str_replace('%STYLESHEET%', '%STYLESHEET%,' . $editorcss, $config); 
where $editorcss is plain css. I suppose it has to go into some kind of fancy brackets? Couldn't find something sensible on their website. So here I am stuck at the moment.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Differences between servers and local host

Post by cmb » Sat May 03, 2014 10:04 am

svasti wrote:Whew,
cmb wrote:Please try something totally different
:shock:
I actually meant you should use a completely different name than xeditorcss, such as action (just to make sure, that it's not the name of the GET parameter that is being blocked).
svasti wrote:all right... half way done... now the editors aren't getting file addresses any more but the actual css.
Ah! :idea: I thought that you already pass the actual CSS. File paths in the URL are not seldom blocked, especially if they contain ../../. This is done for security reasons to prevent malicious users exploiting script vulnerabilities (consider a script that displays the content of a given file, and does neither validate nor filter the given filepath). I had to resrtucture the folder layout of Ajaxfilemanager_XH because of this, see http://cmsimpleforum.com/viewtopic.php? ... 587#p28587.
svasti wrote:I suppose it has to go into some kind of fancy brackets? Couldn't find something sensible on their website. So here I am stuck at the moment.
At least for TinyMCE it doesn't seem to be possible to pass the CSS directly:
This option enables you to specify a custom CSS file that extends the theme content CSS.
You most likely have to go back to passing the filepath, but in a way that is not blocked. BTW, where does this filename come from?
Christoph M. Becker – Plugins for CMSimple_XH

svasti
Posts: 1659
Joined: Wed Dec 17, 2008 5:08 pm

Re: Differences between servers and local host

Post by svasti » Sat May 03, 2014 3:04 pm

cmb wrote:At least for TinyMCE it doesn't seem to be possible to pass the CSS directly:
OK, now the css is written into a file and tinymce gets the file path. Finally everything works.

Post Reply