Welcome, Guest. Please Login or Register.
June 17, 2024, 10:35:22 AM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  Development  |  Completed mods  |  [beta 1.5.4] Relative URLs 1.3 « previous next »
Pages: 1 [2] 3 4 Reply Ignore Print
Author Topic: [beta 1.5.4] Relative URLs 1.3  (Read 26252 times)
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Relative Urls 1.2
« Reply #15 on: September 15, 2003, 09:46:32 PM »
Reply with quote

Quote from: Anguz on September 15, 2003, 09:33:35 PM
well... that wouldn't work in win either

It does.  Click this link: http://www.yabbse.org/community/?board=158

As far as I know, that URL is perfectly legal, however, the mac version of IE doesn't like it.
« Last Edit: September 15, 2003, 09:47:37 PM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.2
« Reply #16 on: September 15, 2003, 09:53:24 PM »
Reply with quote

Quote from: dschwab9 on September 15, 2003, 09:46:32 PM
Quote from: Anguz on September 15, 2003, 09:33:35 PM
well... that wouldn't work in win either

It does.  Click this link: http://www.yabbse.org/community/?board=158

As far as I know, that URL is perfectly legal, however, the mac version of IE doesn't like it.

hahaha maaan... I'm learning so many new things working on these mods ;D

yeah, it does, I guess it defaults to index.php and places the query after it

well, don't worry, I don't plan to compose that kind of relative urls ;)

I'll post the new version of this mod in a few minutes, hold on :)
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #17 on: September 15, 2003, 11:09:40 PM »
Reply with quote

updated to v1.4, I updated ob_anguz_url to v1.1 too, to have more control over future updates

also Spider URLs was updated to 1.1, I'm changing the first post in that thread right now

with the new change, making use of the base tag [Unknown] told me about (thank you!), now urls can be made relative even with Spider URLs installed too

with Relative URLs and Spider URLs together, the previous example, gave a byte count of 103,509, that's 16,321 bytes saved from the un-modded version :D
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:[beta 1.5.4] Relative Urls 1.2
« Reply #18 on: September 16, 2003, 01:59:27 PM »
Reply with quote

Quote from: Anguz on September 15, 2003, 05:53:11 AM
Quote from: [Unknown] on September 15, 2003, 04:18:00 AM
Have you looked at Short URLs, by me?

-[Unknown]

I haven't read the code, although I've downloaded it some time ago... it shortens the url using less variables in the query, like:
http://www.yabbse.org/community/index.php?thread=25772/new
instead of:
http://www.yabbse.org/community/index.php?board=158;action=display;threadid=25772;start=new
right?

btw, I was about to ask if the base url worked with the search engine spider without problems, but I guess it does, cause I just checked php.net, they use it and their website is well indexed

Umm... no, that was not a mod.  I suggest you take another look... my Short URLs mod makes it so URLs are shorter - index.php?blah instead of http://wwww.dumb.com/long/path/same/as/this/does/actually/index.php?blah

-[Unknown]
Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #19 on: September 16, 2003, 05:48:32 PM »
Reply with quote

QuoteUmm... no, that was not a mod.  I suggest you take another look... my Short URLs mod makes it so URLs are shorter - index.php?blah instead of http://wwww.dumb.com/long/path/same/as/this/does/actually/index.php?blah

-[Unknown]

ah... I see...  :-[

well, I didn't mean to make your mod less, I just needed a fix for relative urls when using look back in apache and that's how this mod came about (I didn't know the base tag yet)

hmm... I looked at the Short URLs now, it doesn't look like it changes the urls in images too, does it? I don't feel so bad now, otherwise they'd do almost the same :P
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #20 on: September 24, 2003, 10:30:16 AM »
Reply with quote

dschwab9, could you try this changed code and tell me if it works for you now? it's just the Relative URLs mod, but if this method works fine for you now (it did for me), I'll modify Spider URLs too

function ob_anguz_url($buffer) {
   function relative_url($match1, $i){
      if(!stristr($match1['1'][$i], 'base')){
         global $boardurl, $scripturl;
         $pboardurl = parse_url($boardurl);
         $pscripturl = parse_url($scripturl);
         $pmatchurl = parse_url($match1['3'][$i]);
         $arr1 = array($scripturl . '?', $boardurl . '/', $pscripturl['path'] . '?', $pboardurl['path'] . '/');
         $arr2 = array('?', '', '?', '');
         if(($pmatchurl['scheme'] == 'http' &&  stristr($pboardurl['host'], str_replace('www.', '', $pmatchurl['host']))) || $pmatchurl['scheme'] == 'javascript' || $match1['3'][$i]{0} == '/')
            return $match1['1'][$i] . $match1['2'][$i] . '="' . str_replace($arr1, $arr2, $match1['3'][$i]) . '"';
         elseif($match1['3'][$i]{0} == '#')
            return $match1['1'][$i] . $match1['2'][$i] . '="' . str_replace($arr1, $arr2, $_SERVER['REQUEST_URI']) . $match1['3'][$i] . '"';
      }
      return $match1['0'][$i];
   }
   #relative_url
   preg_match_all('/([^<]*)(href|src|action)="([^"]*)"/i', $buffer, $match1);
   for($i = 0; $i < count($match1['0']); $i++){
      $match2[$i] = relative_url($match1, $i);
   }
   $buffer = str_replace($match1['0'], $match2, $buffer);
   return $buffer;
}
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #21 on: September 25, 2003, 01:18:36 AM »
Reply with quote

I got rid of the nested function now, that's another possible conflict less for you... it's also faster

function ob_anguz_url($buffer) {
   global $boardurl, $scripturl;
   $pboardurl = parse_url($boardurl);
   $pscripturl = parse_url($scripturl);
   $arr1 = array($scripturl . '?', $boardurl . '/', $pscripturl['path'] . '?', $pboardurl['path'] . '/');
   $arr2 = array('?', '', '?', '');

   #relative_url
   preg_match_all('/([^<]*)(href|src|action)="([^"]*)"/i', $buffer, $match, PREG_SET_ORDER);
   for($i = 0; $i < count($match); $i++){
      $match1[$i] = $match[$i]['0'];
      if(!stristr($match[$i]['1'], 'base')){
         $pmatchurl[$i] = parse_url($match[$i]['3']);
         if(($pmatchurl[$i]['scheme'] == 'http' &&  stristr($pboardurl['host'], str_replace('www.', '', $pmatchurl[$i]['host']))) || $pmatchurl[$i]['scheme'] == 'javascript' || $match[$i]['3']{0} == '/')
            $match2[$i] = $match[$i]['1'] . $match[$i]['2'] . '="' . str_replace($arr1, $arr2, $match[$i]['3']) . '"';
         elseif($match[$i]['3']{0} == '#')
            $match2[$i] = $match[$i]['1'] . $match[$i]['2'] . '="' . str_replace($arr1, $arr2, $_SERVER['REQUEST_URI']) . $match[$i]['3'] . '"';
         else
            $match2[$i] = $match[$i]['0'];
      }else{
         $match2[$i] = $match[$i]['0'];
      }
   }
   $buffer = str_replace($match1, $match2, $buffer);

   return $buffer;
}


please try it out and let me know if it's working for you... this way I'll be able to release next version of each mod now working for all, hopefully  ;D
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #22 on: September 25, 2003, 08:08:07 AM »
Reply with quote

try both, please, I'm interested to know which one works or not

cause if nested functions isn't an issue (which I don't see why, since it's ok), then I'll keep using them :)
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #23 on: September 26, 2003, 01:20:03 PM »
Reply with quote

Sorry, I've been out of town all week.  I'll try it today though.
Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #24 on: September 26, 2003, 02:58:11 PM »
Reply with quote

Quote from: dschwab9 on September 26, 2003, 01:20:03 PM
Sorry, I've been out of town all week.  I'll try it today though.

cool! thx :)
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #25 on: September 26, 2003, 11:21:57 PM »
Reply with quote

That one didn't crash apache, but when I view the source, the URL's weren't relative either   ???

I tried both and didn't notice any difference in the results.
« Last Edit: September 26, 2003, 11:23:23 PM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #26 on: September 26, 2003, 11:52:21 PM »
Reply with quote

Quote from: dschwab9 on September 26, 2003, 11:21:57 PM
That one didn't crash apache, but when I view the source, the URL's weren't relative either   ???

I tried both and didn't notice any difference in the results.

but it didn't crash! lol ;D

it may have to do with your apache alias, although I thought it'd deal with it correctly... could you tell me your $boardurl and $scripturl?
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #27 on: September 27, 2003, 11:15:46 PM »
Reply with quote

$boardulr = "http://bbs.zuwharrie.com"

$scripturl = "$boardurl/content"
Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #28 on: September 27, 2003, 11:43:24 PM »
Reply with quote

hmm... it should work

"http://bbs.zuwharrie.com/content?board=1"

should turn into
"?board=1"

I did a couple of changes to the code since posting the last time, here's the one I'm using now (the other one should still work though)

ob_start('ob_anguz_url');
function ob_anguz_url($buffer) {
   global $scripturl;

   function spider_url($match){
      if(!strstr($match['2'], 'action') || strstr($match['2'], 'display') || strstr($match['2'], 'messageindex'))
         return $match['1'] . '/' . strtr($match['2'], "=;&", "-__") . $match['3'];
      return $match['0'];
   }

   function relative_url($match){
      if(!stristr($match['1'], 'base')){
         global $boardurl, $scripturl;
         $pboardurl = parse_url($boardurl);
         $pscripturl = parse_url($scripturl);
         $pmatchurl = parse_url($match['3']);
         $arr1 = array($scripturl . '?', $boardurl . '/', $pscripturl['path'] . '?', $pboardurl['path'] . '/');
         $arr2 = array('?', '', '?', '');
         if(($pmatchurl['scheme'] == 'http' &&  stristr($pboardurl['host'], str_replace('www.', '', $pmatchurl['host']))) || $pmatchurl['scheme'] == 'javascript' || $match['3']{0} == '/')
            return $match['1'] . $match['2'] . '="' . str_replace($arr1, $arr2, $match['3']) . '"';
         elseif($match['3']{0} == '#')
            return $match['1'] . $match['2'] . '="' . str_replace($arr1, $arr2, $_SERVER['REQUEST_URI']) . $match['3'] . '"';
      }
      return $match['0'];
   }

   #spider_url
   preg_match_all('/(' . preg_quote($scripturl, '/') . ')\?([^ "]+)([ "]+)/i', $buffer, $match_spider, PREG_SET_ORDER);
   rsort($match_spider, SORT_STRING);
   for($i = 0; $i < count($match_spider); $i++){
      $arr1_spider[$i] = $match_spider[$i]['0'];
      $arr2_spider[$i] = spider_url($match_spider[$i]);
   }
   $buffer = str_replace($arr1_spider, $arr2_spider, $buffer);

   #relative_url
   preg_match_all('/([^<]*)(href|src|action)="([^"]*)"/i', $buffer, $match_relative, PREG_SET_ORDER);
   rsort($match_relative, SORT_STRING);
   for($i = 0; $i < count($match_relative); $i++){
      $arr1_relative[$i] = $match_relative[$i]['0'];
      $arr2_relative[$i] = relative_url($match_relative[$i]);
   }
   $buffer = str_replace($arr1_relative, $arr2_relative, $buffer);

   return $buffer;
}


that has spider and relative urls in it, I hope it works

don't forget to have this code where it goes too :P

#get vars from friendly ulr
$arr1 = explode('/', $PATH_INFO);
$arr2 = explode('_', $arr1['1']);
foreach($arr2 as $element) {
   list($key, $value) = explode('-', $element);
   $$key = $value;
}


I really don't know what the problem is that it just doesn't wanna work right in your board  :'(

let me know how it goes
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Relative Urls 1.3
« Reply #29 on: September 28, 2003, 02:24:59 AM »
Reply with quote

Quote from: Anguz on September 27, 2003, 11:43:24 PM
don't forget to have this code where it goes too :P

#get vars from friendly ulr
$arr1 = explode('/', $PATH_INFO);
$arr2 = explode('_', $arr1['1']);
foreach($arr2 as $element) {
   list($key, $value) = explode('-', $element);
   $$key = $value;
}


Was I supposed to have that in there with that last code I tried?  I don't think I did.
Logged
Pages: 1 [2] 3 4 Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [beta 1.5.4] Relative URLs 1.3 « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.047 seconds with 20 queries.