*

Burton

  • ***
  • 128
Changing your database to utf8
« on: February 04, 2015, 12:19:44 PM »
Hello Phil,

Thank you for the changeDB_to_utf8.php download link,

Quote
As for the \rn\ try changing your database to utf8 using the script I have attached, upload it to the admin side and then type the
name of it into the address bar being admin/changeDB_to_utf8.php the hit enter.

Once this is done, delete it. Check you database has change, the \rn\ issue should be gone.

I uploaded the changeDB_to_utf8.php in my www.mydomain.com/admin folder

Then I ran www.mydomain.com/admin/changeDB_to_utf8.php

I did not see anything happen on the page,

Then after re-saving the page in Page Management I still have the rn between lines.

So maybe the DB did not change.


« Last Edit: February 04, 2015, 09:12:08 PM by Pharg »

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: Changing your database to utf8
« Reply #1 on: February 04, 2015, 09:52:17 PM »
Hi Burton,

I have just installed a fresh copy of osDate v2.6.5 on PHP 5.4 to see if I
could recreate the same rn error your getting and yes I got it, now I am going
to convert the database to utf8 to see if it still happens.

The changeDB_to_utf8.php worked perfectly, shows a white page, but that is normal and the database is now in UTF8.

Then tested to see if the rn issue went away, it didn't so now I have to find the old fix for it, if there ever was one.
Other long term members might know the fix for this from the developers old forum, sorry I can't remember it at the moment,
However, you can edit the pages in the database directly if you know what your doing :)

 
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Burton

  • ***
  • 128
Re: Changing your database to utf8
« Reply #2 on: February 05, 2015, 01:00:00 AM »
Hello Phil,

Thank you for doing all that testing.

From my reading on the TinyMCE Forum many others have had this problem,

and the solution was adding this code into TinyMCE, but I do not know where to place it?

stripslashes(str_replace('\r\n', '', mysql_real_escape_string($_post['description'])))

http://www.tinymce.com/forum/viewtopic.php?id=24299

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: Changing your database to utf8
« Reply #3 on: February 05, 2015, 07:08:55 AM »
Hello Phil,

Thank you for doing all that testing.

From my reading on the TinyMCE Forum many others have had this problem,

and the solution was adding this code into TinyMCE, but I do not know where to place it?

stripslashes(str_replace('\r\n', '', mysql_real_escape_string($_post['description'])))

http://www.tinymce.com/forum/viewtopic.php?id=24299

Hi Burton,

I haven't forgotten about this, I have been trying to fix this issue most of the day.

The above code isn't working, because it's not just the TinyMCE code that needs to be worked around, as the
tpl file already has the stripslashes which uses smarty tags.

What is happening is the <br> are being converted into nr text.
There was a fix to this but the Developer has closed their own forum and I can't get the answer.

I am still trying to work this out, It's a pity the others Members on here don't also help, some have more knowledge on this than me.

If anyone readying this knows the answer, Please help us out??
« Last Edit: February 05, 2015, 07:12:19 AM by Pharg »
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35

*

Burton

  • ***
  • 128
Re: Changing your database to utf8
« Reply #4 on: February 05, 2015, 07:50:31 AM »
Hi Phil,

Good to hear from you, and thank you for your efforts,

Yes need a fix for this rn problem, or all page text looks terrible! lol

I did a google search for - coding fix for <br> are being converted into nr text.

and found these pages:

http://php.net/manual/en/function.nl2br.php

http://stackoverflow.com/questions/5946114/replace-r-n-with-br

may help you :)

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Changing your database to utf8
« Reply #5 on: February 05, 2015, 11:21:57 AM »
I know the rn issue was created in osDate 2.6, due to the creator making some changes.
However I thought I fixed this in the osDate 2.6.5 update, but looking at a download it appears I didn't.

Give this a try open init.php and minimum_init.php

Find:
Code: [Select]
function checkRequestData() {
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);
foreach ($_GET as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_GET[$k] = $val;
}
foreach ($_POST as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_POST[$k] = $val;
}
}

Change to:
Code: [Select]
function checkRequestData() {
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);
/*
foreach ($_GET as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_GET[$k] = $val;
}
foreach ($_POST as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_POST[$k] = $val;
}
*/
}

If this works, you will need to fix anything that has already got the rn in it.
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

Burton

  • ***
  • 128
Re: Changing your database to utf8
« Reply #6 on: February 05, 2015, 11:56:14 AM »
Thank you CBG :)

Yes that worked for me :)

Changed the code, re-saved the page in Page Management, and all rn's have gone :)

many thank yous to you and Phil :)

PS: CBG do you have time to look at the bug with Private Albums not displaying for users?

*

CBG

  • *****
  • 673
    • osDate Forum
Re: Changing your database to utf8
« Reply #7 on: February 05, 2015, 12:17:16 PM »
PS: CBG do you have time to look at the bug with Private Albums not displaying for users?
Not at this time, but I will get to it, when I look at releasing a new update to osDate.
Regards,
CBG (Garry)
osDate: 2.6.5, 2.7 & Evo
PHP: 5.5.x/5.6.x (5.3.x to 5.6.x) | MySQL: 5.5.34-cll

*

Burton

  • ***
  • 128
Re: Changing your database to utf8
« Reply #8 on: February 05, 2015, 12:23:56 PM »
Thank you CBG :)

A great script, many thank yous for your generosity :)

*

Pharg

  • *****
  • 2,071
  • osDate Version: osDate Evo v1.0
Re: Changing your database to utf8
« Reply #9 on: February 05, 2015, 09:38:11 PM »
I know the rn issue was created in osDate 2.6, due to the creator making some changes.
However I thought I fixed this in the osDate 2.6.5 update, but looking at a download it appears I didn't.

Give this a try open init.php and minimum_init.php

Find:
Code: [Select]
function checkRequestData() {
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);
foreach ($_GET as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_GET[$k] = $val;
}
foreach ($_POST as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_POST[$k] = $val;
}
}

Change to:
Code: [Select]
function checkRequestData() {
$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);
/*
foreach ($_GET as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_GET[$k] = $val;
}
foreach ($_POST as $k => $val) {
if (!is_array($val)){$val = mysql_real_escape_string($val, $conn); }
$_POST[$k] = $val;
}
*/
}

If this works, you will need to fix anything that has already got the rn in it.

Hi CBG,

Thanks for that, for those still getting the issue in php 5.4 then you also need to add the same fix to the init.php on line 705.

After that, if the RN's are still there, just go to the admin/ page management load select each page and click the button modify page.

Now all the rn problems will be gone. :)
Regards,
Pharg ( Phill )

REMEMBER: ALWAYS BACKUP BEFORE YOU MAKE ANY CHANGES!!

osDateEvo v1.0 | PHP: 5.3.42 & PHP: 5.6.18 | MySQL: 5.5.35