Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-29 10:51:32

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

r1763 - New category names forced to lowercase

In the Categories panel (I love being able to say that now), when you create a new category, the “name” field is forced to lowercase. Existing names are not affected, only new ones act this way. Intended function or bug?

I have a system of using camelCase for category names in the code when it’s necessary to use two words. Easier to read that way, and when it comes to markup attribute values I like it better than dashes or underscores… ack.

Oh, and I just thought I’d mention that all my diagnostics errors have disappeared in this later revision (though I’ve skipped a few) except this one keeps hanging around:

site_url_mismatch: local.site.tld\

My settings are the same as they they’ve been for ever. My Site URL is set as <code>local.site.tld</code> (no closing slash). I don’t know what mismatch it’s talking about, and of course there’s no help for that one.

Last edited by Destry (2006-08-29 11:02:36)

Offline

#2 2006-08-29 12:20:15

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: r1763 - New category names forced to lowercase

It was an unintended side-effect of 1663.
1768 should allow uppercase again.

Your Site URL i set correctly, there should be no warning

This is the diagnostics code:
$guess_site_url = $_SERVER['HTTP_HOST'] . rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/');
if ($siteurl and $siteurl != $guess_site_url)
$fail['site_url_mismatch'] = gTxt('site_url_mismatch').cs.$guess_site_url;

I am not sure where that backslash is coming from could you tell us your values for
$_SERVER['HTTP_HOST']
$_SERVER['SCRIPT_NAME']

(for example by var_dump(...);ing them.)

Offline

#3 2006-08-29 12:48:30

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: r1763 - New category names forced to lowercase

Unfortunately, in r1768 spaces and a whole lot of other characters are now allowed in category names.

This should work (not tested, but trivial). Replaces series of dashes and spacing with a single dash and strips out non-alphanumeric chars (except underscore and dash):
line 319: <notextile><code>$name = preg_replace(“/[^A-Za-z0-9\-_]/”, “”, preg_replace(“[\s\-]+”, “-”, preg_replace(“/(^|&\S+;)|(<[^>]*>)/U”,”“,dumbDown($title))));</code></notextile>
line 378: <notextile><code>$name = preg_replace(“/[^A-Za-z0-9\-_]/”, “”, preg_replace(“[\s\-]+”, “-”, preg_replace(“/(^|&\S+;)|(<[^>]*>)/U”,”“,dumbDown($name))));</code></notextile>

Or perhaps add an extra param to strip_spaces so it can handle category and title names?

Last edited by ruud (2006-08-29 12:57:07)

Offline

#4 2006-08-29 13:10:31

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: r1763 - New category names forced to lowercase

You’ll have to forgive my lack of PHP understanding…

I create a file called var_dump.php with the following contents…

<code><?php
var_dump($_SERVER['HTTP_HOST'], $_SERVER['SCRIPT_NAME']);
?></code>

I put it in the install root, and when browsed to I get <code>string(14) “local.site.tld” string(13) “/var_dump.php”</code>

I probably did it wrong. :|

(sorry, I can never guess this forum block code thing correctly)

Last edited by Destry (2006-08-29 21:44:30)

Offline

#5 2006-08-29 13:12:25

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: r1763 - New category names forced to lowercase

Thanks, ruud, I had overlooked that.

Destry: No that was good. And the error message you get says “local.wion.com\” (with the backslash at the end? Otherwise it’s the exct same name – ist that correct?

Offline

#6 2006-08-29 13:50:47

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: r1763 - New category names forced to lowercase

Correct. Want diagnostics?

Last edited by Destry (2006-08-29 14:08:43)

Offline

#7 2006-08-29 14:43:16

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: r1763 - New category names forced to lowercase

Yes, please.

Offline

#8 2006-08-29 15:27:03

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: r1763 - New category names forced to lowercase

(trying to make it a bit more anonymous)

begin ———————————————————————————————

Textpattern version: 4.0.3 (r1763)
Last Update: 2006-08-21 18:32:03/2006-08-06 01:29:50
Document root: C:/_txp/site (C:\_txp\site)
$path_to_site: C:\_txp\site
Textpattern path: C:\_txp\site\textpattern
Permanent link mode: section_title
upload_tmp_dir: C:\xampp\tmp
Temp folder: C:\_txp\site\textpattern\tmp
Site URL: local.site.tld
PHP version: 5.1.4
Server Local Time: 2006-08-29 17:17:32
MySQL: 5.0.21-community
Locale: English_United States.1252
Server: Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4
Apache version: Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4
PHP Server API: apache2handler
rfc2616_headers:
Server OS: Windows NT 5.1
active_plugins: zem_contact-0.6m, ied_plugin_composer-0.4, zem_prblock-0.1, ajw_clean_feed-0.2, zem_article_info-0.1, rss_article_edit-0.1, rss_admin_show_adv_opts-0.2, rsx_plugins_list-1.0m, ajw_comment_alt-0.3, ajw_comment_num-0.2, ajw_if_comment_owner-0.3.1, ied_hide_in_admin-0.1.5

Pre-flight check:

site_url_mismatch: local.site.tld\

.htaccess file contents:

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#RewriteBase /relative/web/path/

<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+) – [PT,L]

RewriteRule ^(.*) index.php </IfModule>

#php_value register_globals 0

——————————————————————————————————— end

If you could tell me how to display that better without a lengthy Textile battle, I’ll gladly do so.

Offline

#9 2006-08-29 17:33:37

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: r1763 - New category names forced to lowercase

Hmm… if the var_dump of those two variable looks good (and I think it does) and the $site_url is good too… then it must be the dirname function call in line 295 that’s adding the backslash. Perhaps replace backslashes with forward slashes before doing the rtrim?

Destry, can you create an extra subdirectory (or go one level deeper than where you did the previous var_dump) and put this code there, see what it does:
<pre><code>&lt;?php
var_dump( $_SERVER[‘HTTP_HOST’], $_SERVER[‘SCRIPT_NAME’], dirname($_SERVER[‘SCRIPT_NAME’]), dirname(dirname($_SERVER[‘SCRIPT_NAME’]))
);
?&gt;</code></pre>

(rtrim can trim the backslash too, but what happens if TXP is not installed in the root_dir, does it leave a forward slash or a backslash?)

Last edited by ruud (2006-08-29 17:35:30)

Offline

#10 2006-08-29 17:56:03

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: r1763 - New category names forced to lowercase

Ah, Windows! Now the madness makes sense.

dirname returns a \ instead of a / so our rtrim ignores it, as ruud correctly guessed. Please try 1772.

Last edited by Sencer (2006-08-29 17:58:37)

Offline

#11 2006-08-29 18:20:14

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: r1763 - New category names forced to lowercase

… never a dull moment when Windows is involved ;)

Apparently SCRIPT_NAME contains forward slashes only, even on Windows, so <code>rtrim(dirname(dirname($_SERVER[‘SCRIPT_NAME’])), ‘/\\’)</code> should work.

Offline

#12 2006-08-29 21:42:30

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,912
Website

Re: r1763 - New category names forced to lowercase

Sorry guys, I had child duty. OK, just updated to r1776 and the diagnostics are now clear. I guess you figured it out. Thanks for looking into it.

Yeah, windows, it was more a choice by necessity than desire. Someday I’ll get out of this sandtrap and hit muscle beach.

Offline

Board footer

Powered by FluxBB