DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • October 22, 2017, 12:12:42 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: How Do I Remove Color-Coding Notations From Page Headers?  (Read 272 times)
0 Members and 1 Guest are viewing this topic.
TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« 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?
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1777


You're welcome.


View Profile WWW
« Reply #1 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.
Logged

TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« Reply #2 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.
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1777


You're welcome.


View Profile WWW
« Reply #3 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.
Logged

TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« Reply #4 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?
Logged
Stephen.Kise
Codemeister
****
Offline Offline

Posts: 375


So meme'd up.


View Profile
« Reply #5 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).
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5
TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« Reply #6 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...
« Last Edit: October 12, 2017, 05:30:54 PM by TGTarheel » Logged
Stephen.Kise
Codemeister
****
Offline Offline

Posts: 375


So meme'd up.


View Profile
« Reply #7 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.
Logged

Slowly progressing fork with PHP 7 support: https://github.com/stephenKise/Legend-of-the-Green-Dragon
Cheap VPS Hosting (10$ credit!): https://m.do.co/c/acde75b086c5
TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« Reply #8 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?
Logged
Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5475



View Profile WWW
« Reply #9 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...
Logged

Play the latest beta version here on DragonPrime
TGTarheel
Captain of the Guard
***
Offline Offline

Posts: 143


View Profile
« Reply #10 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.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
26 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search