Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 236

PostPosted: Tue Nov 17, 2009 12:03 pm Reply with quote

I have problems when adding the Swedish National Characters ┼─Í in the alphabet of the Reviews module, but it works on my local site on my PC with Xampp, but it does not work on the webb hotel with the identical index.php.

This is from the index.php of Reviews module:
Code:


$alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M",
                       "N","O","P","Q","R","S","T","U","V","W","X","Y","Z","┼","─","Í","1","2","3","4","5","6","7","8","9","0");


The letters looks OK, when I am in Reviews:

When I click on ─ in the local site, I can see the books that starts with this letter.
When I click on ─ on the web hotel, I just can see the index-page again. Nothing happens, but the other letters like V works normally and displays books that starts with V.

I have checked the database query and it works for the web hotell and displays books for letter ─.

It seems that it must be the php-code that are triggered by clicking on ─ that is not working because it is a non-english letter.

I think it must be this code:
Code:


function reviews($letter, $field, $order) {
    global $bgcolor4, $sitename, $prefix, $multilingual, $currentlang, $db, $module_name;
    include('header.php');
    $letter = substr("$letter", 0,1);
    if ($multilingual == 1) {
    $querylang = "AND rlanguage='$currentlang'";
    } else {
    $querylang = "";
    }
    OpenTable();
    echo "<center><b>$sitename "._REVIEWS."</b><br>";
    echo "<i>"._REVIEWSLETTER." \"$letter\"</i><br><br>";
    switch ($field) {

   case "reviewer":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by reviewer $order");
   break;

   case "score":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by score $order");
   break;

   case "hits":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by hits $order");
   break;

   default:
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
   break;

    }
    $numresults = $db->sql_numrows($result);
    if ($numresults == 0) {
   echo "<i><b>"._NOREVIEWS." \"$letter\"</b></i><br><br>";
    } elseif ($numresults > 0) {
   echo "<TABLE BORDER=\"0\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"4\">
      <tr>
      <td width=\"50%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"LEFT\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._PRODUCTTITLE." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"18%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._REVIEWER." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=desc\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"18%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._SCORE." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"14%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._HITS." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      </tr>";


PHP 5.2.4 on my local site
PHP 5.2.10 on my web hotel

Has anyone any idea here?
 
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6793
Location: Ha Noi, Viet Nam

PostPosted: Tue Nov 17, 2009 1:16 pm Reply with quote

The most obvious, possible difference that I can think of between the two is the database character set. Are the both using LATIN-1 or ...........
 
View user's profile Send private message Send e-mail
slackervaara
PostPosted: Tue Nov 17, 2009 1:21 pm Reply with quote

The database is latin-1 and identical. The database query for the letter ─ worked very well in both cases. I think it must be a php issue and the step prior the database is not working OK.
 
Guardian2003
PostPosted: Tue Nov 17, 2009 3:20 pm Reply with quote

And the actual character can be seen in the page source, not a htmlentity?
Weird.
 
slackervaara
PostPosted: Tue Nov 17, 2009 3:39 pm Reply with quote

Thanks! In the page source it is the actual character ─ and not the htmlentity.
 
slackervaara
PostPosted: Wed Nov 18, 2009 12:16 am Reply with quote

index.php from Ravennuke 2.30 gave also the identical problem on the web hotel.

I have also tested a local site on Mandriva 2010 with PHP 5.3 with identical problems as the web hotel.
 
Guardian2003
PostPosted: Wed Nov 18, 2009 5:08 am Reply with quote

In that case, I don't know the answer. I'm actually building a test site at the moment to use strictly utf-8 in order to research these sorts of problems but it seems to me that the character your using isn't in the latin-1 or iso character set but don't have a clue as to if it's mySQL that has a problem with the character or PHP.
 
slackervaara
PostPosted: Wed Nov 18, 2009 11:28 pm Reply with quote

It seems to be a difficult problem to solve, but your help is highly appreciated. When I click on ─ at the web hotel I can see ─ in the URL all right, but the page with the book starting with ─ does not show up, but instead the index page.

I have tried to use utf8_decode like this:

default:
$letter = utf8_decode($letter);
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
break;

This would have change the letter from utf8 to iso8859, but this does not change anything. It must be letter ─ that is disturbing some how, because normal letters works OK.
 
Guardian2003
PostPosted: Thu Nov 19, 2009 5:09 am Reply with quote

So this character is in a book title.
It would be worth checking to see if the character is seen as it really is or an htmlentity when you look at the page source for that review and also, see what is stored in the DB.
It seems to me that the reason the search fails is because the character doesn't match what is being searched for, so somewhere, there is a mis-match, it just a question of finding it.
 
slackervaara
PostPosted: Fri Nov 20, 2009 12:39 am Reply with quote

I have looked in the database and the characters are correct and ─. Also if I make the database query it will find the correct book that starts with ─.

I think it must be a php issue with ─ and possible alternative is $letter or $title in index.php.

On top of index.php I have:

<?php header("Content-Type: text/html; charset=iso-8859-1");

Unfortunately, this did not make any difference.
 
slackervaara
PostPosted: Sat Nov 28, 2009 11:54 pm Reply with quote

I could not get it working, but instead I had to use Reviews Plus module Only registered users can see links on this board! Get registered or login!
I have a small problem with this module and the rights block are showing up, despite I have changed in index.php to:
Code:


$index = 0;   //Turn Right Blocks On (1) or Off (0) / Bloques Derechos Activos (1) o Inactivos (0); For 7.7 patched 3.1 or earlier version.
define('INDEX_FILE', false);   // Turn Right Blocks On (true) or Off (false) / Bloques Derechos Activos (true) o Inactivos (false); For 7.8 Patched 3.1 or newer version
define('IN_RPM', false);
 
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9456
Location: Arizona

PostPosted: Sun Nov 29, 2009 8:51 am Reply with quote

slackervaara, comment out the 'define' line.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
slackervaara
PostPosted: Sun Nov 29, 2009 9:51 am Reply with quote

Many thanks! It worked perfectly!
 
montego
PostPosted: Sun Nov 29, 2009 2:59 pm Reply with quote

RavensScripts
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©