Kom ihåg mig?
Home Menu

Menu


mod rewrite

 
Ämnesverktyg Visningsalternativ
Oläst 2008-10-13, 23:05 #11
eidos- eidos- är inte uppkopplad
Medlem
 
Reg.datum: Nov 2003
Inlägg: 62
eidos- eidos- är inte uppkopplad
Medlem
 
Reg.datum: Nov 2003
Inlägg: 62
sorry...


Citat:

if ( !$userdata['session_logged_in'] )
{
ob_start();
function replace_for_mod_rewrite(&$s)
{
$urlin =
array(
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;topicdays=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&amp;mark=topics'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;watch=topic*'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;unwatch=topic*'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;highlight=*'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;vote=viewresult'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)&amp;postdays=([0-9]*)&amp;postorder=([a-zA-Z]*)&amp;highlight=([a-zA-Z0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&amp;start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)'",
"'(?<!/)viewtopic.php&amp;p=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'",
);
$urlout = array(
"topic-\\1-\\2-\\3.html",
"mark-forum\\1.html",
"updates-topic\\1.html",
"stop-updates-topic\\1.html",
"about\\1.html&amp;highlight=\\2",
"forum-\\1.html",
"ptopic\\1.html",
"ntopic\\1.html",
"view-poll\\1-\\2-\\3.html",
"about\\1-\\2-\\3-\\4.html",
"about\\1.html",
"about\\1-\\2.html",
"about\\1.html",
"post-\\1.html",
"post-\\1.html",
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
}
eidos- är inte uppkopplad   Svara med citatSvara med citat
Oläst 2008-10-13, 23:44 #12
WizKid WizKid är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Apr 2004
Inlägg: 618
WizKid WizKid är inte uppkopplad
Mycket flitig postare
 
Reg.datum: Apr 2004
Inlägg: 618
a-zA-Z matchar inte åäö

men jag ser inte hur den koden skulle kunna generera: trningsjournal-vf19.html med tanke på att ingen replace skriver om till det.
WizKid är inte uppkopplad   Svara med citatSvara med citat
Oläst 2008-10-14, 00:05 #13
eidos- eidos- är inte uppkopplad
Medlem
 
Reg.datum: Nov 2003
Inlägg: 62
eidos- eidos- är inte uppkopplad
Medlem
 
Reg.datum: Nov 2003
Inlägg: 62
här kanske

Citat:

function make_url_friendly($url)
{

$url = strtolower($url);

$find = array(' ',
'&',
'\r\n',
'\n',
'/',
'\\',
'+');

$url = str_replace ($find, '-', $url);

$find = array(' ',
'é',
'č',
'ë',
'ę');

$url = str_replace ($find, 'e', $url);

$find = array(' ',
'ķ',
'ō',
'ô',
'ö');

$url = str_replace ($find, 'o', $url);

$find = array(' ',
'á',
'ā',
'â',
'ä');

$url = str_replace ($find, 'a', $url);

$find = array(' ',
'í',
'ė',
'î',
'ī');

$url = str_replace ($find, 'i', $url);

$find = array(' ',
'ú',
'ų',
'û',
'ü');

$url = str_replace ($find, 'u', $url);

$find = array('/[^a-z0-9\-<>]/',
'/[\-]+/',
'/<[^>]*>/');

$repl = array('',
'-',
'');

$url = preg_replace ($find, $repl, $url);

return $url;

}


function rewrite_urls($content)
{

function if_query($amp)
{

if($amp != '')
{
return '?';
}

}

$url_in = array('/(?<!\/)viewforum.php\?f=([0-9]+)((&amp|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
'/(?<!\/)viewtopic.php\?p=([0-9]+)((&amp|(&)){0,1}([^>]+>)(.*?)<\/a>/e',
'/(?<!\/)viewtopic.php\?t=([0-9]+)((&amp|(&)){0,1}([^>]+>)(.*?)<\/a>/e');

$url_out = array("make_url_friendly('\\6') . '-vf\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
"make_url_friendly('\\6') . '-vp\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'",
"make_url_friendly('\\6') . '-vt\\1.html' . if_query('\\2') . stripslashes('\\5\\6') . '</a>'");

$content = preg_replace($url_in, $url_out, $content);

return $content;

}
eidos- är inte uppkopplad   Svara med citatSvara med citat
Svara


Aktiva användare som för närvarande tittar på det här ämnet: 1 (0 medlemmar och 1 gäster)
 

Regler för att posta
Du får inte posta nya ämnen
Du får inte posta svar
Du får inte posta bifogade filer
Du får inte redigera dina inlägg

BB-kod är
Smilies är
[IMG]-kod är
HTML-kod är av

Forumhopp


Alla tider är GMT +2. Klockan är nu 12:55.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson
 
Copyright © 2017