DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: TGTarheel on October 09, 2017, 03:00:16 PM



Title: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 09, 2017, 03:00:16 PM
Even if it is a two-step process, no biggie.

But in my Dwellings, when anyone uses bolds or color in their Dwelling name...then the page header for their dwelling us the name f their Dwelling, as should be...but the stupid color codes are there so that I get "` b Joe's Dwellling ` b" etc, when all I WANT there is "Joe's Dwelling"

So...how do I strip those color codes out so that the page header will not include them, since they do not parse in page headers?


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: Aeolus on October 09, 2017, 09:44:49 PM
Where the dwellings code uses the page_header function when you enter a dwelling, use the sanitize function first on the dwelling name, then pass that into page_header.


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 10, 2017, 05:02:41 AM
Where the dwellings code uses the page_header function when you enter a dwelling, use the sanitize function first on the dwelling name, then pass that into page_header.

Thanks.  I wonder how come dwellings was not done that way to begin with. Oh well.  Should solve my problem.


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: Aeolus on October 10, 2017, 02:24:30 PM
Because not everything is made perfect. Dwellings were created a long time ago, and colouring dwelling names probably wasn't implemented in its first version so they would have had no need to do this.


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 10, 2017, 02:25:04 PM
Where the dwellings code uses the page_header function when you enter a dwelling, use the sanitize function first on the dwelling name, then pass that into page_header.

Humm...not sure I get it.  It LOOKS like the sanitize is already being used, nevertheless, I still get unwanted stuff in my page headers.

Here is the code snip for case_enter on dwellins:
Code:
<?php
if (
$session['user']['location'] != get_module_setting("logoutlocation"))
set_module_pref("location_saver"$session['user']['location']);
$sql "SELECT name,description,ownerid FROM ".db_prefix("dwellings")." WHERE dwid=$dwid";
$result db_query($sql);
$row db_fetch_assoc($result); 
if($row['name'] == ""){
$name translate_inline("Unnamed");
}else{
$name $row['name'];
}
page_header("%s",sanitize($name));

Is that not supposed to sanitize the name and get the bold and color codes out of the page header?

Or am I missing something here?


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: Stephen.Kise on October 12, 2017, 09:26:32 AM
Where the dwellings code uses the page_header function when you enter a dwelling, use the sanitize function first on the dwelling name, then pass that into page_header.

Humm...not sure I get it.  It LOOKS like the sanitize is already being used, nevertheless, I still get unwanted stuff in my page headers.

Here is the code snip for case_enter on dwellins:
Code:
<?php
if (
$session['user']['location'] != get_module_setting("logoutlocation"))
set_module_pref("location_saver"$session['user']['location']);
$sql "SELECT name,description,ownerid FROM ".db_prefix("dwellings")." WHERE dwid=$dwid";
$result db_query($sql);
$row db_fetch_assoc($result); 
if($row['name'] == ""){
$name translate_inline("Unnamed");
}else{
$name $row['name'];
}
page_header("%s",sanitize($name));

Is that not supposed to sanitize the name and get the bold and color codes out of the page header?

Or am I missing something here?


You should look for another declaration of page_header() then. Unless your lib/sanitize.php functions are edited - yes, that should remove the backtick character and anything in the set of [1234567890!@#\$%^&)~QqRVvGgTtjJeElLxXyYkKpPmM?*AabicnHw] (as of 1.2).


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 12, 2017, 05:25:56 PM
I do not believe that was in any way edited or why I would.

I will look for another declaration of page_header then.

Just looked, I do not see another declaration.  I am stumped.

Do you have to somewhere require_once /lib/sanitize.php or something?

That is the only thing I can think of...


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: Stephen.Kise on October 13, 2017, 08:08:35 AM
I do not believe that was in any way edited or why I would.

I will look for another declaration of page_header then.

Just looked, I do not see another declaration.  I am stumped.

Do you have to somewhere require_once /lib/sanitize.php or something?

That is the only thing I can think of...

You shouldn't have to. There should have been a fatal error because of the undeclared function if you didn't require the file. You should probably try that out before posting about it o.O.


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 13, 2017, 01:45:11 PM
I do not believe that was in any way edited or why I would.

I will look for another declaration of page_header then.

Just looked, I do not see another declaration.  I am stumped.

Do you have to somewhere require_once /lib/sanitize.php or something?

That is the only thing I can think of...

You shouldn't have to. There should have been a fatal error because of the undeclared function if you didn't require the file. You should probably try that out before posting about it o.O.

That was what I thought.
And I do not get a fatal error.

I know I got a number of fatal errors with the Item system for not requiring /lib/itemhandler.php - but those all got fixed long ago.

So...so come this is not working for me?  I still get the stupid codes...

I am pretty sure I never messed with the sanitize function, I would have had no reason to.

Any help here?


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: Talisman on October 13, 2017, 05:08:22 PM
I am pretty sure I never messed with the sanitize function, I would have had no reason to.

Just curious...do you document all your code and especially your changes to the core code in the files?  If not, strongly recommended...


Title: Re: How Do I Remove Color-Coding Notations From Page Headers?
Post by: TGTarheel on October 13, 2017, 10:43:50 PM
I am pretty sure I never messed with the sanitize function, I would have had no reason to.

Just curious...do you document all your code and especially your changes to the core code in the files?  If not, strongly recommended...

Well, my site goes back quite some time.  I do not think, at the beginning, I was doing that.

I do now.

But I am pretty sure I never had any reason to muck around with the sanitize function.

I should look, what file is this?  I do have archived the original core files I could always try uploading a fresh copy and see.

Of course I would save my own so I could do a side by side compare.

© 2017 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines