SimpleSEF 2.0 (SMF 1.1.x and SMF 2.0)

Started by SlammedDime, December 05, 2009, 10:08:40 PM

Previous topic - Next topic

maipgeut

#780
this is my error log

2: Cannot modify header information - headers already sent by (output started at /home3/vago/public_htfile, ml/foro/Sources/SimpleSEF-Db/x00.php:1)
Archivo: /home3/vago/public_html/foro/Sources/Subs.php
Línea: 3409


I replace that file x00.php ,and reinstaled the mod,  but the same problem

when i replace the file x00.php, part of the code is missing, so i put the code directly in the file and problem resolved
Ingresa a forosdelvago.com

tooman

Quote from: Phoestre on June 30, 2010, 04:22:43 PM
Quote from: SlammedDime on June 30, 2010, 04:08:40 PM
Get rid of the 'r'...

RewriteRule ^(sitemap.xml)$ /sitemap/xml/ [L]

The 'R' tells apache to redirect, rather than just rewrite.

This results in a broken version of SimplePortal's frontpage(articles are in the center but all other portal blocks are missing). This is also the case with unexisting pages, thats why I asked for an error handling feature.

doesn't work for me, need some help  :-\

Ryan2320

Can I get some 404 pages?

My site is informationtechsysforum.com and if an older post is no longer there I sill get spiders trying to index that page, and it just shows the main index. (So they index the page)  For example informationtechsysforum.com/nothing
will just show a main index page... and nothing else

How can I get some 404 pages to solve this issue..

Thanks
Ryan

SlammedDime

well /nothing is not a post or topic, it would be an action... topics and boards would still throw the appropriate error messages.  As for 404 on actions... It shouldn't be too hard to add though.

This is a rough hack for it that you can try out...

Open Sources/SimpleSEF.php

Code (find) Select
// handle unknown variables


Code (replace) Select
elseif (strpos($url_array[0], ',') === false)
{
header('HTTP/1.0 404 Not Found');
fatal_lang_error('simplesef_404', false);
}

// handle unknown variables


Open Themes/default/languages/Errors.english.php

Code (find) Select
?>

Code (add before) Select
$txt['simplesef_404'] = 'The page you requested could not be found.';
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Ryan2320

#784
Alright,

So far so good,

I want to make sure I did this right this is the new sources/SimpleSEF.php file
}

// handle unknown variables
elseif (strpos($url_array[0], ',') === false)
{
header('HTTP/1.0 404 Not Found');
fatal_lang_error('simplesef_404', false);

}
}

return $querystring;
}


Please let me know if I did something wrong..
Also other errors will still remain on the site right?


Thanks Ryan

EDIT: I did notice one thing whenever the HTTP 404 page is displayed I get an error in the error log,
All it says is this:
Guest                                                Today at 03:53:50 PM 
     
http://informationtechsysforum.com/index.php 


Not really a huge problem, becuase nobody should just be typing random letters..at the URL
Anything that could be done to solve that issue?


SlammedDime

You didn't do the edit correct... please review the find/replace and find/add before more carefully.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Ryan2320

Ok sorry about that... :(

Misread it,

This is now what I have in the sources/SimpleSEF.php

// User
if (!empty($url_array) && (in_array($querystring['action'], $simpleSEF['useractions']) !== false) && ($index = sef_strrpos($url_array[0], $modSettings['simplesef_space'])) !== false)
{
$user = substr($url_array[0], $index + 1);
if (is_numeric($user))
$querystring['u'] = intval($user);
else
$querystring['user'] = $user;
array_shift($url_array);

}

}
elseif (strpos($url_array[0], ',') === false)
{
header('HTTP/1.0 404 Not Found');
fatal_lang_error('simplesef_404', false);
}

// handle unknown variables
$temp = array();
foreach ($url_array as $part)
{
if (strpos($part, ',') !== false)
$part = substr_replace($part, '=', strpos($part, ','), 1);
parse_str($part, $temp);
$querystring += $temp;
}

}

return $querystring;
}



Let me know if I did something wrong again...  :-[

I am still getting that error in the error log..however everything seems to be working..

Thanks for your time,
Ryan


SlammedDime

Yea, that looks right... what error are you getting in the error log though?  Did you add the language string to the Errors.english.php file?
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Ryan2320

#788
The error I am getting is
Guest             Today at 04:25:38 PM 
     
http://informationtechsysforum.com/index.php 



I get this error when I type something random like /404error

I did add the language string at the bottom of file, before the ?>
.....
$txt['visual_verification_failed'] = 'The letters you typed don\'t match the letters that were shown in the picture.';
$txt['simplesef_404'] = 'The page you requested could not be found.';

?>


EDIT: I found another issue, (same one) but I do have Simple Portal installed and I can't click on the recent topics, or posts (I get the 404 error and the same error in the error log)

EDIT: I found that anything with /topicseen (simpleportal) I get an 404 error...

Thanks Ryan

SlammedDime

hrm... forgot about those... I'll have to work some more then on how to work around it... I have one idea but it's not pretty... add a comma after topicseen and see what that does... /topicseen,/
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Ryan2320

#790
The comma idea did work...

What do you got in mind? 


Awilum

Web Development Art - Programming :: Design :: SEO
| My web projects |

SlammedDime

Not possible the way the mod is designed.  The number is there so a database query is not needed to go to the right profile.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Awilum

its not prety username_1 or username_7897

may be its posible from .htaccess to delete this _7877 ?
Web Development Art - Programming :: Design :: SEO
| My web projects |

SlammedDime

I don't see how .htaccess could help out at all here.  It may not be the prettiest solution, but this isn't 'Pretty Urls'... the purpose of this mod is to keep it simple (hence the name) and part of the simplicity is very few database queries and overhead to make it work.  The other pitfall of not having the id's and only using usernames are when users have special characters or utf-8 characters in their name.  Then the overhead work of trying to find the actual user(name) from a mashed up version of it becomes a lot of extra and unneeded work and support.

I prefer to keep my mods as stable as possible... creates a better user experience, requires less work from me on the support front, and allows me to concentrate on making other things.  I always try not introduce things into my mods that create ambiguity and and problems for the end user or forum admins.  As far as this goes, or even with topic names having the id and message id in them, it is easier for everyone involved to just leave them there, which is what I plan to do.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Awilum

where can I edit the Russian transliteration? because he did not correctly

I have: priedlozhieniia_po_usoviershienstvovaniiu_templatecms_3.0.html

Must: predlojeniya_po_usovershenstvovaniyu_templatecms_3.0.html
Web Development Art - Programming :: Design :: SEO
| My web projects |

Awilum

Russian translit must

$patern = array(
      "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
      "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I",
      "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
      "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
      "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
      "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"",
      "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
      "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j",
      "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
      "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
      "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
      "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"y",
      "ї"=>"i", "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye",
      "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya"
      );
Web Development Art - Programming :: Design :: SEO
| My web projects |

Awilum

Okey I solved this problem so

function translitIt($str)
{
$patern = array(
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
"Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I",
"Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
"О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
"У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
"Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"",
"Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
"в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j",
"з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
"м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
"с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
"ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"y",
"ї"=>"i", "Ї"=>"Yi", "є"=>"ie", "Є"=>"Ye",
"ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya"
);
return strtr($str,$patern);
}
.....
.....
.....
.....
function sef_encode($string)
{
global $modSettings, $sourcedir, $simpleSEF, $txt;
static $utf8_db = array();

if (empty($string))
return '';

// A way to track/store the current character
$character = 0;
// Gotta return something...
$result = '';


$string = translitIt($string);

$string = str_replace($simpleSEF['strip_chars'], '', $string);
$string = implode(' ', array_diff(explode(' ', $string), $simpleSEF['strip_words']));
$string = trim($string, " $modSettings[simplesef_space]");
$string = urlencode($string);
$string = str_replace('%2F', '', $string);
$string = str_replace($modSettings['simplesef_space'], '+', $string);
$string = preg_replace('~(\+)+~', $modSettings['simplesef_space'], $string);
if (!empty($modSettings['simplesef_lowercase']))
$string = strtolower($string);

return $string;
}



and i have this: predlojeniya_po_usovershenstvovaniyu_templatecms_2.0.html - correct url


Web Development Art - Programming :: Design :: SEO
| My web projects |

Awilum

#798
hm..
this mod does not work if I create a new board. There is simply no reference to it.

UPD
its was problem with cache.
Web Development Art - Programming :: Design :: SEO
| My web projects |

SlammedDime

See the FAQ in the very first post...

As for the Russion translation, this is what I currently have, located in SimpleSEF-Db/x04.php

array (
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D',
'Е' => 'Ie', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'I',
'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O',
'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U',
'Ф' => 'F', 'Х' => 'Kh', 'Ц' => 'Ts', 'Ч' => 'Ch', 'Ш' => 'Sh',
'Щ' => 'Shch', 'Ъ' => '', 'Ы' => 'Y', 'Ь' => '\'', 'Э' => 'E',
'Ю' => 'Iu', 'Я' => 'Ia', 'а' => 'a', 'б' => 'b', 'в' => 'v',
'г' => 'gh', 'д' => 'd', 'е' => 'ie', 'ж' => 'zh', 'з' => 'z',
'и' => 'i', 'й' => 'i', 'к' => 'k', 'л' => 'l', 'м' => 'm',
'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's',
'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts',
'ч' => 'ch', 'ш' => 'sh', 'щ' => 'shch', 'ъ' => '', 'ї' => 'yi',
'Ї' => 'Yi', 'є' => 'ie', 'Є' => 'Ie', 'ы' => 'y', 'ь' => '\'',
'э' => 'e', 'ю' => 'iu', 'я' => 'ia',
)

The ones that are different are:
array ( 'Е' => 'Ie', 'Ж' => 'Zh', 'Й' => 'I', 'Х' => 'Kh', 'Ц' => 'Ts', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Shch', 'Ы' => 'Y', 'Ь' => '\'', 'Ю' => 'Iu', 'Я' => 'Ia', 'г' => 'gh', 'е' => 'ie', 'ж' => 'zh', 'й' => 'i', 'х' => 'kh', 'щ' => 'shch', 'ъ' => '', 'ї' => 'yi', 'Є' => 'Ie', 'ы' => 'y', 'ь' => '\'', 'ю' => 'iu', 'я' => 'ia', )

If you can find others that agree this should be changed, I will make the change for the next release.  I can't, however, go off the word of just one person.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: