Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard
Author Message
montego
Site Admin



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

PostPosted: Sat Oct 15, 2005 4:06 pm Reply with quote

Hi again, unfortunately, I am struggling with another problem. I am trying to Google-Tap the NSN GR Downloads module -- with quite a bit difficulty given that it is very GT unfriendly in a few areas.

What I seem to be finding is that although I can see links like downloads-NewDownloads.html in the brower and in the status bar, but Apache seems to be lower casing everything so that it comes to the re-write engine all lower case as downloads-newdownloads.html. I am able to get around this issue by making many more specific .htaccess directives, but unfortunately, the way paging is done and the search function, it comes out all wrong.

With the paging, I just gave up as I didn't want to modify code. In terms of Search, though, its a problem because the search is broken by the last GT replace of downloads.html. Bob has buried the link reference in an OPTION element as a POST, which when GT'd, it comes out with an empty value in the $query parameter, basically making the search non-functional.

GR Downloads is not googletap friendly. (Bob: I would suggest making this more friendly in future revisions as it is really a nice module otherwise.)

Here is the code that is writing the search form:

Code:


function SearchForm() {
    global $module_name, $query;
    echo "<table border='0' cellspacing='0' cellpadding='0' align='center'>\n";
    echo "<form action='modules.php?name=$module_name&amp;op=search&amp;query=$query' method='post'>\n";
    echo "<tr><td><font class='content'><input type='text' size='25' name='query' value='$query'> <input type='submit' value='"._DL_SEARCH."'></td></tr>\n";
    echo "</form>\n";
    echo "</table>\n";
}


For those of you who are familiar with GT, basically, this will come out looking like:

download-search-.html

So, the query string is lost. I have been unable to figure out a way to fix this. What I was thinking of doing was changing the GT line:

Code:


"'(?<!/)modules.php\?name=Downloads'"


to something that would STOP after the last "s" so that if there was another &amp; it would not change it. Then, I would just live with the search not being GT'd by removing all the GT statements for changing op=search*.

Any suggestions? I can't seem to find anything that will do it because it is most likely not at the end of a line.

TIA,
montego

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Oct 15, 2005 4:41 pm Reply with quote

Apache doesn't modify that. Are you sure that in header.php the outurl isn't lower casing it?
 
View user's profile Send private message
montego







PostPosted: Sat Oct 15, 2005 5:18 pm Reply with quote

Actually, Raven, I am not certain, but I didn't modify the GT-NextGEn code. Anyways, just in case, here is the GT-Downloads that I have for NSN GR Downloads (note that it has the offending statements commented out right now since this is now "live"):

Code:


$urlin = array(
"'(?<!/)modules.php\?name=Downloads&amp;op=modifydownloadrequest&amp;lid=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&amp;op=NewDownloads&amp;newdownloadshowdays=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&amp;op=NewDownloadsDate&amp;selectdate=([a-zA-Z0-9+]*)'",
"'(?<!/)modules.php\?name=Downloads&amp;op=getit&amp;lid=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&amp;op=(MostPopular)&amp;ratenum=([0-9]*)&amp;ratetype=(num|percent)'",
"'(?<!/)modules.php\?name=Downloads&amp;op=(NewDownloads|MostPopular)'",
"'(?<!/)modules.php\?name=Downloads&amp;cid=([0-9]*)&amp;orderby=([a-zA-Z0-9+]*)'",
//"'(?<!/)modules.php\?name=Downloads&amp;min=([0-9]*)&amp;cid=([0-9]*))'",   //GR Downloads not GT-Friendly!!
//"'(?<!/)modules.php\?name=Downloads&amp;op=search&amp;query=([/:\-\'{}()\,\._&amp;a-zA-Z0-9+=]*)&amp;min=([0-9]*)&amp;orderby=([a-zA-Z0-9+]*)&amp;show=([0-9]*)'",   //GR Downloads not GT-Friendly!!
//"'(?<!/)modules.php\?name=Downloads&amp;op=search&amp;query=([/:\-\'{}()\,\._&amp;a-zA-Z0-9+= ]*)&amp;orderby=([a-zA-Z0-9+]*)'",   //GR Downloads not GT-Friendly!!
//"'(?<!/)modules.php\?name=Downloads&amp;op=search&amp;query=([/:\-\'{}\(\)\,\._&amp;a-zA-Z0-9+=]*)'",   //GR Downloads not GT-Friendly!!
"'(?<!/)modules.php\?name=Downloads&amp;op=gfx&amp;random_num=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads&amp;cid=([0-9]*)'",
"'(?<!/)modules.php\?name=Downloads'"
);

$urlout = array(
"download-mod-\\1.html",
"download-shownew-\\1.html",
"download-seldate-\\1.html",
"download-file-\\1.html",
"download-\\1-\\2-\\3.html",
"downloads-\\1.html",
"download-sort-\\1-orderby-\\2.html",
//"download-paging-\\1-\\2.html",   //GR Downloads not GT-Friendly!!
//"download-search-\\1-\\2-\\3-\\4.html",   //GR Downloads not GT-Friendly!!
//"download-search-\\1-\\2.html",   //GR Downloads not GT-Friendly!!
//"download-search-\\1.html",   //GR Downloads not GT-Friendly!!
"download-gfx-\\1.html",
"downloads-cat\\1.html",
"downloads.html"
);


The header.php code is:

Code:


#Start of Google Tap Header
global $nextgen_name, $prefix, $db;

// Google Tap On or Off, 1=On, 0=Off
$next_gen_ob = 1;

//Used for main module or a module without a name
if ($nextgen_name == "") {
$sql = "SELECT main_module FROM ".$prefix."_main";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$mainmod_name = $row[main_module];
$nextgen_name = $mainmod_name;
}

//Make the path to the GT-NExtGEn Files
$nextgen_path = "GoogleTap/GT-".$nextgen_name.".php";
if ($next_gen_ob == 1) {
   if (file_exists($nextgen_path)) {
   ob_start();
   } else {
   $next_gen_ob = 0;
   }
}

function replace_for_mod_rewrite(&$s, $nextgen_path) {

//Check to see if file exists before continuing
     if (file_exists($nextgen_path)) {
     include($nextgen_path);
     }
     $s = preg_replace($urlin, $urlout, $s);
     return $s;
} #End of Google Tap Header


And the footer.php code is:

Code:


#Start of GoogleTap Footer
if ($next_gen_ob == 1) {
// Store Buffer in $contents
$contents = ob_get_contents();
//Replace all standalone &'s with &amp's
$contents = preg_replace("(&(?!([a-zA-Z]{2,6}|[0-9\#]{1,6})[\;]))", "&amp;", $contents);
//Fix up for && in script and bad coding of middot;'s, and  ;'s
$contents = str_replace(array("&amp;&amp;", "&amp;middot", "&amp;nbsp"), array("&&", "·", " ;"), $contents);
//delete output buffer and stop buffering
ob_end_clean();
//display modified buffer to screen
echo replace_for_mod_rewrite($contents, $nextgen_path);
} else {
//if module has unusual method of including footer, make NExtGEn variables
//global and try it again. If variables have values for NExtGEn it will succeed
//else it will go to normal footer.
global $next_gen_ob, $nextgen_path;
   if ($next_gen_ob == 1 AND $nextgen_path != "") {
   $contents = ob_get_contents();
   $contents = preg_replace("(&(?!([a-zA-Z]{2,6}|[0-9\#]{1,6})[\;]))", "&amp;", $contents);
   $contents = str_replace(array("&amp;&amp;", "&amp;middot", "&amp;nbsp"), array("&&", "·", " ;"), $contents);
   ob_end_clean();
   echo replace_for_mod_rewrite($contents, $nextgen_path);
   }
}
#End of GoogleTap Footer


This is straight out of the 0.4 version of GT-NG.

Also, when I look at the GT'd links, they show up correctly when hovered over. But, when I click them, no dice. The Apache error log shows everything lower cased. This leads me to believe that either Apache is doing it.

Regards,
montego
 
montego







PostPosted: Sat Oct 15, 2005 5:24 pm Reply with quote

Just another follow-up, I had a hunch that it might be the browser changing it, but both IE and FF worked the same.

Note, that it is this re-write rule that won't work:

Code:


RewriteRule ^downloads-(AddDownload|NewDownloads|MostPopular|TopRated).html modules.php?name=Downloads&op=$1


Bummer...
montego
 
Raven







PostPosted: Sat Oct 15, 2005 5:24 pm Reply with quote

Those are all lowercase on output. I need to see the .htaccess lines. That's where mod_rewrite does its magic.
 
Raven







PostPosted: Sat Oct 15, 2005 5:31 pm Reply with quote

I just tried the New on your site and it shows http://montegoscripts.com/downloads-NewDownloads.html So, as usual, I'm all confused Laughing

I need to see an example of what you're talking about.
 
montego







PostPosted: Sat Oct 15, 2005 5:58 pm Reply with quote

I had to break apart the mod rewrite statements like this in order to get it to work (because it does come in lower case -- I can prove it from my access logs):

RewriteRule ^downloads-(NewDownloads|newdownloads).html modules.php?name=Downloads&op=NewDownloads

If you see, I had to hard-code the op variable. I wouldn't have to do that if I could simple pass the \\1 into it and it would retain the original incoming case.

Regards,
montego
 
montego







PostPosted: Sat Oct 15, 2005 6:04 pm Reply with quote

Sorry, i meant to say "error logs" because it cannot find downloads-NewDownloads.html.
 
Raven







PostPosted: Sat Oct 15, 2005 7:33 pm Reply with quote

It may be coming in lower case but it is not Apache. Take out all of the download urlin and urlout and .htaccess except the one condition. Let's resolve this once and for all.
 
montego







PostPosted: Sat Oct 15, 2005 8:42 pm Reply with quote

Ok, that did it! I have only two entries now and those two are working properly. I will need to work on the others and try and figure out just what is stepping on what!

thanks!
montego
 
Raven







PostPosted: Sat Oct 15, 2005 9:05 pm Reply with quote

RavensScripts

I think you'll find that your urlin/out was stepping on itself Wink
 
montego







PostPosted: Sat Oct 15, 2005 10:19 pm Reply with quote

yeah, just wish I knew POSIX better... I came from the "evil GUI world". Laughing

Thanks again!
montego
 
montego







PostPosted: Mon Oct 17, 2005 8:31 am Reply with quote

I spoke too fast! Although it is working fine on my montegoscripts.com domain hosted on a *nix server, it is still NOT working on my development windows server! I am really needing both to work the same so that I can properly test before publishing. Now I am thinking again that it is either Windows or the combination of Apache on Windows, because here are the "facts":

1. Development is on Windows2000/Apache 1.3.x and Production is on *nix/Apache 1.3.x.

2. I copied the working .htaccess and GT-Downloads.php scripts from Production to Development so that I am using the exact same directives.

3. Development and Production Nuke files are exactly the same as I had just done an upgrade to the lastest patchset (3.1) and Sentinel so I always replace ALL my files accordingly.

4. Same browsers (IE and FF) used to test both in Development and Production.

5. "New" (NewDownloads) works fine in Production, but in Development, it gives a 404 file not found. The url coming in is downloads-NewDownloads.html and what is being shown in the error log in Development is "Unable to find downloads-newdownloads.html".

So, back to my original premise! Something is forcing the URL to lower case!!!!

Uuuugggghhhhhh.....

montego
 
Raven







PostPosted: Mon Oct 17, 2005 10:04 am Reply with quote

I run my development on WindowsXP, same Apache. That code above works on mine. I can't think of anything else right now except that Windows is not case sensitive. But, as to Apache, Apache will not convert on its own. If a conversion is being made it's being made in code that passes to Apache, regardless of how it appears.

Since you're only using 1 rule right now, please post the urlin, urlout, and .htaccess mod_rewrite rule that you are using on Windows.
 
montego







PostPosted: Mon Oct 17, 2005 12:51 pm Reply with quote

hhhhmmmm... yes, this is strange. Same setup. My PC at home is WindowsXP and same issue as my laptop with Windows2000. All running the same Apache and GT/.htaccess/etc. Ok here are the lines:

Code:



$urlin = array(
"'(?<!/)modules.php\?name=Downloads&amp;op=(NewDownloads|MostPopular)'"
);

$urlout = array(
"downloads-\\1.html"
);

RewriteRule ^downloads-(AddDownload|NewDownloads|MostPopular|TopRated).html modules.php?name=Downloads&op=$1



In addition, here is the line from my Apache error log file:

Code:


[Mon Oct 17 11:51:08 2005] [error] [client 127.0.0.1] File does not exist: d:/http/montegoscripts/html/downloads-newdownloads.html


TIA,
montego
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> GT - Next Gen and Standard

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 ©