Back to top

Autore Topic: Mi aiutate a correggere un bug?  (Letto 1007 volte)

Offline emmezeta

  • Nuovo arrivato
  • *
  • Post: 21
    • Mostra profilo
Mi aiutate a correggere un bug?
« il: 26 Mar 2009, 15:51:57 »
Salve,
sul mio sito uso(1.5.9) FB e non potendo usare artiosef o simili per i Sef URL, ho semplicemente sostituito il file router.php, con questo:
Codice: [Seleziona]
<?php
/**
* @version $Id: router.php 2007-010-05 qson $
* @package FireBoard
* @copyright Copyright (C) 2007 Qson Multimedia. All rights reserved.
* @license GNU/GPL
*/
 
/* fireboardSefUrl is for converting titles and category names into url- and user-friendly strings */
/* It is this complex to make support for "non-ASCII"-letters */
/* Recently removed support for the dot (.) because it fucked up the .htaccess (urls ended with eg. ".com" or "...." which made a 404) */
function fireboardSefUrl$url ) {
$url=html_entity_decode($url,ENT_COMPAT,'UTF-8');
$url=htmlentities($url,ENT_COMPAT,'UTF-8');
$url=preg_replace('/&(..?)(acute|grave|slash|cedil|circ|ring|tilde|uml|lig);/','$1',$url);
$url=preg_replace('/&[^;]*;/','',$url);
$url=preg_replace('/\s-\s/','-',$url);
$url=preg_replace('/[\s]+/','-',$url);
$url=preg_replace('/[.:,;+&#\/*]/','-',$url);
$url=preg_replace('/[^a-z0-9_-]/','',strtolower($url));
$url=preg_replace('/-+/','-',$url);
return $url;
}

function 
fireboardBuildRoute(&$query)
{
$db = & JFactory::getDBO();

$segments = array();

/* Uncomment the following line to turn off SEF urls for FireBoard. */
// return $segments; 

/* catid specified in url */
if (!empty($query['catid'])) {
$catid=$query['catid'];
unset($query['catid']);
}
else
{
$catid=false;
}

/* Get category name */
if ($catid) {

$sql "SELECT `name` FROM `#__fb_categories`
WHERE `id` = 
$catid LIMIT 1";

$db->setQuery($sql);
$catname $db->loadResult();
if (!$catname$catname='';

$catname=fireboardSefUrl($catname);

}

/* id specified in url */
if (!empty($query['id'])) {
$id=$query['id'];
unset($query['id']);
}
else
{
$id=false;
}

/* Get message subject */
if ($id) {

$sql "SELECT `subject`
FROM `#__fb_messages`
WHERE `id` = 
$id";

$db->setQuery($sql);
$msgtitle $db->loadResult();
if (!$msgtitle$msgtitle='';

$msgtitle=fireboardSefUrl($msgtitle);

}

/* userid specified in url */
if (!empty($query['userid'])) {
$userid=$query['userid'];
unset($query['userid']);
}
else
{
$userid=false;
}

/* Get username */
if ($userid) {

$sql "SELECT `username`
FROM `#__users`
WHERE `id` = 
$userid";

$db->setQuery($sql);
$username $db->loadResult();
if (!$username$username='';

$username=fireboardSefUrl($username);

}

/* Feel like the following is not really good. */
/* Partly copied and pasted from another router.php (think it was for com_content) */

if (isset($query['func'])) {
$func=$query['func'];
unset($query['func']);
}
else
{
$func='';
}
$task=isset($query['task'])?$query['task']:'';
if (!empty($task)&&(!isset($func)||empty($func))) {
$func=$task;
unset($query['task']);
}

if (empty($task) && isset($func)) {
$task $func;
}

if ($func=='view') {
$segments[]="$catid-$catname";
$segments[]="$id-$msgtitle";
}
else if ($func=='showcat') {
$segments[]="$catid-$catname";
}
else if ($func=='fbprofile') {
$segments[]='fbprofile';
if ($task!='showprf')
$segments[]=$task;
unset($query['task']);
if ($userid)
$segments[]="$userid-$username";
}
else
{
/* Partly copied from Artio JoomSEF Fireboard Extension */
$oper=array();
if (isset($func)) {
$oper[] = $func;
if (isset($query['func'])) 
unset($query['func']);
}
if (isset($query['do'])) {
$oper[] = $query['do'];
unset($query['do']);
}

$segments[] = join('-'$oper);

if ($catid
$segments[]="$catid-$catname";
if ($id)
$segments[]="$id-$msgtitle";
if ($userid)
$segments[]="$userid-$username";
}

return $segments;
}

function 
fireboardParseRoute($segments)
{
$vars = array();

$count=count($segments);

@list($func,$do)=split('[-:]',$segments[0]);

if ($count==2&&is_numeric($func)) { // $func=view
$vars['func']='view';
list($catid)=explode('-',$segments[0],1);
list($id)=explode('-',$segments[1],1);
$vars['catid']=$catid;
$catid=intval($catid);
$vars['id']=$id;
$id=intval($id);

return $vars;
}
else if ($count==1&&is_numeric($func)) { // $func=showcat
$vars['func']='showcat';
list($catid)=explode('-',$segments[0],1);
$catid=intval($catid);
$vars['catid']=$catid;

return $vars;
}
else if ($func=='fbprofile') { // $func=fbprofile
$vars['func']='fbprofile';
/* we want to show profile */
/* /fbprofile/1-username */
if ($count<3)
$vars['task']='showprf';
else
$vars['task']=$segments[1];

list($userid)=explode('-',$segments[$count-1],1);
$vars['userid']=intval($userid);

return $vars;
}
else 
{
if ($func=='listcat') {
$vars['task']='listcat';
}
else
{
$vars['func']=$func;
}
if (isset($do)&&!empty($do)) 
$vars['do']=$do;

if ($func=='karma') {
list($userid)=explode('-',$segments[$count-1],1);
$vars['userid']=intval($userid);
}
else if ($count>2) {
list($id)=explode('-',$segments[$count-1],1);
$vars['id']=intval($id);
list($catid)=explode('-',$segments[$count-2],1);
$vars['catid']=intval($catid);
}
else if ($count>1) {
list($catid)=explode('-',$segments[$count-1],1);
$vars['catid']=intval($catid);
}

}

return $vars;
}

?>

il problema è che questo file più pagine con url diversi e questo a google non piace, esempio:
//modificato

come vedete la differenza sta nel numero di trattini che man mano che cresce la discussione si moltiplicano, non so nulla di php ma credo che con una piccola correzione al file si dovrebbe risolvere, sapete aiutarmi? grazie
« Ultima modifica: 06 Apr 2009, 01:20:53 da emmezeta »

 



Web Design Bolzano Kreatif