Fix the pretty-URL stuff so that it breaks fewer search engines.

Basically, browers deal with the  HTML BASE element differently than the
various crawlers/spiders out there -- the latter tend to [re]write the
BASE element.  If we use pretty URLs to fake out a path, this means we
need absolute URLs to keep the search engines happy.

Meh.
This commit is contained in:
Solomon Peachy 2009-07-10 13:02:04 -04:00
parent cd52dbd609
commit 537f290f76
8 changed files with 28 additions and 29 deletions

View File

@ -19,6 +19,7 @@ For further information about Photo Organizer, see its web site at:
[misc] Fix some CSS inefficiences
[misc] Include the sizecode in the pretty image/photo URLs.
[fix] Ensure all exif/iptc/xmp data imported is explicitly escaped.
[misc] Tweak the pretty URL stuff so that it breaks fewer search engines.
2.37-rc1 (June 2, 2009)

View File

@ -899,7 +899,7 @@ function display_photo_slides($display_type, $container_id, $photo_data, $offset
}
}
print "</div> <!-- slides end --> \n";
print "</div>\n";
if ($cell_counter)
return $checkboxes;
@ -2838,6 +2838,7 @@ function emit_folder_comment($string) {
function generate_link($type, $arg0='', $args = array(), $raw = FALSE) {
global $pretty_urls;
global $webroot;
switch($type) {
case 'album':
@ -2943,6 +2944,11 @@ function generate_link($type, $arg0='', $args = array(), $raw = FALSE) {
}
}
/* Because lots of webspiders can't get this right.. */
if ($pretty_urls) {
$url = $webroot . "$url";
}
return $url;
}

View File

@ -28,8 +28,8 @@
/* Do not remove this line */
include_once "vars.php";
// The PO site url
$site_url = "http://localhost/po";
// The PO site url -- Make sure it has a trailing '/'
$site_url = "http://localhost/po/";
// This appears in the titlebar on every page.
$site_title = "My Photo Organizer";
@ -37,6 +37,7 @@ $pretty_urls = FALSE;
$ad_script = FALSE;
$ad_script2 = FALSE;
$misc_script = FALSE;
// A URL to the bug tracker or whatnot for this site
$bug_url = "http://bugs.shaftnet.org/";
@ -320,6 +321,11 @@ $po_options['quota_count'] = $po_options_default['quota_count'];
$po_options['show_ads'] = $po_options_default['show_ads'];
$po_options['theme'] = $po_options_default['theme'];
/* Figure out the webroot. */
$webroot = strstr($site_url, "//");
$webroot = substr($webroot, 2);
$webroot = strstr($webroot, "/");
include_once "lang/en_US.php";
?>

View File

@ -501,12 +501,12 @@ function site_head($page_title, $title_b = "", $rss = "") {
header("Content-Type: application/xhtml+xml");
print "<?xml version=\"1.0\" encoding=\"".$strings['formats_encoding']."\"?>\n";
*/
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"".$strings['formats_lang_xml']."\" lang=\"".$strings['formats_lang_xml']."\" dir=\"".$strings['formats_direction']."\">";
print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"".$strings['formats_lang_xml']."\" lang=\"".$strings['formats_lang_xml']."\" dir=\"".$strings['formats_direction']."\">\n";
print "<head>\n";
if ($pretty_urls)
print "<base href=\"$site_url\" />";
print "<base href=\"$site_url\" />\n";
print "<title>$site_title : $page_title". ($title_b != "" ? " : $title_b" : "") ."</title>\n";
print "<!-- compliance patch for microsoft browsers -->\n";
@ -518,7 +518,7 @@ function site_head($page_title, $title_b = "", $rss = "") {
// print "<!--[if lt IE 8]><script src=\"javascript/firebug/firebug.js\" type=\"text/javascript\"></script><![endif]-->\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=".$strings['formats_encoding']."\" />";
print "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=".$strings['formats_encoding']."\" />\n";
print $thm_elem['shortcut_icon'];
print $thm_elem['stylesheets'];
@ -534,7 +534,7 @@ function site_header($page_title, $title_b = "", $rss = "") {
global $po_options;
global $install_enabled;
global $strings;
site_head($page_title, $title_b, $rss);
print "<body>\n";
@ -571,8 +571,13 @@ http://www.tnet.com/fun-web-products.php for further details.");
function site_foot() {
global $ad_script2;
global $misc_script;
global $po_options;
if ($misc_script) {
print $misc_script;
}
if ($po_options['show_ads'] != 'f') {
if ($ad_script2) {
print $ad_script2;
@ -583,14 +588,13 @@ function site_foot() {
}
function site_footer($database) {
print "</div> <!-- id=content --> \n";
print "</div>\n";
site_credit();
site_foot();
}
function site_navigator_status($left_string, $right_string) {
print "<!-- Navigator Status Begin -->\n";
print "<div class=\"status\">";
print "<table><tr>";
print "<td>";
@ -599,7 +603,6 @@ function site_navigator_status($left_string, $right_string) {
print "$right_string\n";
print "</td></tr></table>";
print "</div>";
print "<!-- Navigator Status End -->\n";
}
function site_search_entry($size) {

View File

@ -136,8 +136,6 @@ function site_navigator($sub_menu) {
$type = $po_user['type'];
print "<!-- Navigator Begin -->\n";
print "<div class=\"navigator2\">";
if ($type >= PO_USER_TYPE_CLIENT) {
@ -234,8 +232,6 @@ function site_navigator($sub_menu) {
print "</ul>";
print "</div>\n";
print "<!-- Navigator End -->\n";
}
$thm_elem['javascript'] = "<script language=\"JavaScript\" type=\"text/javascript\" src=\"$theme/checkbox.js\"></script>";

View File

@ -119,8 +119,6 @@ function site_navigator($sub_menu) {
$type = $po_user['type'];
print "<!-- Navigator Begin -->\n";
print "<div class=\"navigator2\">";
if ($type >= PO_USER_TYPE_CLIENT) {
@ -217,8 +215,6 @@ function site_navigator($sub_menu) {
print "</ul>";
print "</div>\n";
print "<!-- Navigator End -->\n";
}
$thm_elem['javascript'] = "<script language=\"JavaScript\" type=\"text/javascript\" src=\"$theme/checkbox.js\"></script>";

View File

@ -16,7 +16,7 @@ my ($size, $max, $count, $block);
# configuration
my $root = "/mnt/bulk2/po"; # points to PO repository
my $root = "/mnt/bulk/po"; # points to PO repository
my $db_dsn = "dbname=photo"; # db dsn
my $db_pass = "apache"; # db pass
my $db_user = "apache"; # db user

View File

@ -25,16 +25,7 @@ ExpiresByType application/x-javascript A2592000
# Disable etag generation for static content.
FileEtag none
# Disables access to russian log spammers.
<IfModule mod_setenvif.c>
SetEnvIf Request_URI \.ru/ ru_spam=1
Order allow,deny
Allow from all
Deny from env=ru_spam
</IfModule>
<IfModule mod_rewrite.c>
Options FollowSymLinks
RewriteEngine on
# set this to the Base path!