News:

Wondering if this will always be free?  See why free is better.

Main Menu

Pretty URLs

Started by SMFHacks.com Team, January 31, 2007, 10:56:43 AM

Previous topic - Next topic

vbgamer45

You have to replace the package file download from mod site and upload to your packages folder.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ninik

OK, if I have understood you correctly you are telling me to re-upload all files...

If so, then I will have pretty urls up and running once again...

But what I want is to uninstall it!

vbgamer45

No i just  upload the zip file of the mod to your packages folder. overwrite the old one.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ninik

#7543
OK...

first things first... I have re-done everything and pretty urls is up and running again smoothly...

I downloaded the files from the mod site and checked them (they are the same as the ones that I already have installed)...

As said, pretty urls is back, up and running again...

Basically we are back at square one...

In my opinion, the problem may be the uninstall.php (although I am not sure about it)...

Assuming that this is the case, where do I upload the corrected uninstall.php before I proceed with a package uninstall and end up with the same problem?


Update:

OK, what I did was this to solve the issue:

1. I downloaded the zip file from the mod site.

2. Unzipped the files

3. Changed/corrected the uninstall.php

4.re-zipped them again

5. uploaded and replaced the existing package with the new/corrected one from the cpanel

6. run the uninstall and everything went well...

7. pretty urls has been uninstalled successfully

However,

for some reason, in my admin-configuration I still see the "pretty urls" appear (although they have no effect) under "themes and layouts"...

really?  ???


vbgamer45

The only way i know how is if you replace the zip file in the packages folder with the updated zip file...
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ninik

Hi vbgamer45,

thanks for your quick reply and support...

to answer your question, yes, your suggestion is correct...

it did uninstall fine, afterwards, with just one minor leftover... see my updated post right above...

vbgamer45

Looks like that part didn't uninstall
Upload the package to http://www.smfhacks.com/smf-package-parser.html
And reverse edits made to admin.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ninik

Hi vbgamer45,

yep, everything looks fine now.

Moreover, I would like to thank you for all of your support and guidance.

So, yes, thank you  :)

vbgamer45

Glad you have it sorted out.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ambition87

The plugin doesn't work with Boards and Topics giving an error message, but it works with Actions and Profiles.
I have added to this post, the list of the plugins on my forum and the messages on the error log.
I hope someone can help me.

vbgamer45

Did the mod install with errors?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ambition87

#7551
Quote from: vbgamer45 on June 08, 2017, 02:34:22 PM
Did the mod install with errors?
Thank you in advance for the support.
No, the mod installed without any error message.
Even if i try to uninstall the plugin, it doesn't give me any error message, as you can see from the screenshot added to this reply.
Best Regards.

Tair

Seems after last smf update (2.0.14) mod stopped work for non latin characters (cyrillic).

If i enable it - it decodes all topics to tNUMBER format.

vbgamer45

Did you change your database characterset?
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Tair

Quote from: vbgamer45 on June 29, 2017, 05:24:21 PM
Did you change your database characterset?

After update? Nope

All tables in utf8_general_ci & InnoDB mode.


My Subs-PrettyUrls.php file is the following (special section for cyrillic letters):


<?php
// Version: 1.0RC; Subs-PrettyUrls

if (!defined('SMF'))
die('Hacking attempt...');

// Generate a pretty URL from a given text
function pretty_generate_url($text)
{
global $modSettings$txt;

// Do you know your ABCs?
$characterHash = array (
'a' => array ('a''A''à''À''á''Á''â''Â''ã''Ã''ä''Ä''å''Å''ª''ą''Ą''а''А''ạ''Ạ''ả''Ả''Ầ''ầ''Ấ''ấ''Ậ''ậ''Ẩ''ẩ''Ẫ''ẫ''Ă''ă''Ắ''ắ''Ẵ''ẵ''Ặ''ặ''Ằ''ằ''Ẳ''ẳ'),
'ae' => array ('æ''Æ'),
'b' => array ('b''B'),
'c' => array ('c''C''ç''Ç''ć''Ć''č''Č'),
'd' => array ('d''D''Ð''đ''Đ''ď''Ď'),
'e' => array ('e''E''è''È''é''É''ê''Ê''ë''Ë''ę''Ę''е''Е''ё''Ё''э''Э''Ẹ''ẹ''Ẻ''ẻ''Ẽ''ẽ''Ề''ề''Ế''ế''Ệ''ệ''Ể''ể''Ễ''ễ''ε''Ε''ě''Ě'),
'f' => array ('f''F'),
'g' => array ('g''G''ğ''Ğ'),
'h' => array ('h''H'),
'i' => array ('i''I''ì''Ì''í''Í''î''Î''ï''Ï''ı''İ''Ị''ị''Ỉ''ỉ''Ĩ''ĩ''Ι''ι'),
'j' => array ('j''J'),
'k' => array ('k''K''к''К''κ''Κ'),
'l' => array ('l''L''ł''Ł'),
'm' => array ('m''M''м''М''Μ'),
'n' => array ('n''N''ñ''Ñ''ń''Ń''ň''Ň'),
'o' => array ('o''O''ò''Ò''ó''Ó''ô''Ô''õ''Õ''ö''Ö''ø''Ø''º''о''О''Ọ''ọ''Ỏ''ỏ''Ộ''ộ''Ố''ố''Ỗ''ỗ''Ồ''ồ''Ổ''ổ''Ơ''ơ''Ờ''ờ''Ớ''ớ''Ợ''ợ''Ở''ở''Ỡ''ỡ''ο''Ο'),
'p' => array ('p''P'),
'q' => array ('q''Q'),
'r' => array ('r''R''ř''Ř'),
's' => array ('s''S''ş''Ş''ś''Ś''š''Š'),
'ss' => array ('ß'),
't' => array ('t''T''т''Т''τ''Τ''ţ''Ţ''ť''Ť'),
'u' => array ('u''U''ù''Ù''ú''Ú''û''Û''ü''Ü''Ụ''ụ''Ủ''ủ''Ũ''ũ''Ư''ư''Ừ''ừ''Ứ''ứ''Ự''ự''Ử''ử''Ữ''ữ''ů''Ů'),
'v' => array ('v''V'),
'w' => array ('w''W'),
'x' => array ('x''X''×'),
'y' => array ('y''Y''ý''Ý''ÿ''Ỳ''ỳ''Ỵ''ỵ''Ỷ''ỷ''Ỹ''ỹ'),
'z' => array ('z''Z''ż''Ż''ź''Ź''ž''Ž''Ζ'),
'-' => array ('-'' ''.'','),
'_' => array ('_'),
'!' => array ('!'),
'~' => array ('~'),
'*' => array ('*'),
"\x12" => array ("'"'"'),
'(' => array ('(''{''['),
')' => array (')''}'']'),
'$' => array ('$'),
'0' => array ('0'),
'1' => array ('1''¹'),
'2' => array ('2''²'),
'3' => array ('3''³'),
'4' => array ('4'),
'5' => array ('5'),
'6' => array ('6'),
'7' => array ('7'),
'8' => array ('8'),
'9' => array ('9'),
);

// Pretty URLs RUS
$characterHash = array(
'' => array ('ъ''Ъ''ь''Ь''!''?''«''»'':''&''+''*''~''@''%''^'),
'-' => array('-''№''#''$''_'' ''.'','),
'(' => array ('(''{''['),
')' => array (')''}'']'),
"\x12" => array ("'"'"'),
'0' => array ('0'),
'1' => array ('1''¹'),
'2' => array ('2''²'),
'3' => array ('3''³'),
'4' => array ('4'),
'5' => array ('5'),
'6' => array ('6'),
'7' => array ('7'),
'8' => array ('8'),
'9' => array ('9'),
'a' => array ('a''A''а''А'),
'b' => array ('b''B''б''Б'),
'c' => array ('c''C''ц''Ц'),
'd' => array ('d''D''д''Д'),
'e' => array ('e''E''е''Е'),
'f' => array ('f''F''ф''Ф'),
'g' => array ('g''G''г''Г'),
'h' => array ('h''H''х''Х'),
'i' => array ('i''I''и''И'),
'j' => array ('j''J''й''Й'),
'k' => array ('k''K''к''К'),
'l' => array ('l''L''л''Л'),
'm' => array ('m''M''м''М'),
'n' => array ('n''N''н''Н'),
'o' => array ('o''O''о''О'),
'p' => array ('p''P''п''П'),
'q' => array ('q''Q'),
'r' => array ('r''R''р''Р'),
's' => array ('s''S''с''С'),
't' => array ('t''T''т''Т'),
'u' => array ('u''U''у''У'),
'v' => array ('v''V''в''В'),
'w' => array ('w''W'),
'x' => array ('x''X'),
'y' => array ('y''Y''ы''Ы'),
'z' => array ('z''Z''з''З'),
'jo' => array ('ё''Ё'),
'zh' => array ('ж''Ж'),
'ch' => array ('ч''Ч'),
'sh' => array ('ш''Ш'),
'sch' => array ('щ''Щ'),
'je' => array ('э''Э'),
'ju' => array ('ю''Ю'),
'ja' => array ('я''Я')
);

// Get or detect the database encoding, firstly from the settings or language files
if (isset($modSettings['global_character_set']))
$encoding strtoupper($modSettings['global_character_set']);
else if (isset($txt['lang_character_set']))
$encoding strtoupper($txt['lang_character_set']);
// or try checking UTF-8 conformance
else if (preg_match('~.~su'$text))
$encoding 'UTF-8';
// or sadly... we may have to assume Latin-1
else
$encoding 'ISO-8859-1';

// If the database encoding isn't UTF-8 and multibyte string functions are available, try converting the text to UTF-8
if ($encoding != 'UTF-8' && function_exists('mb_convert_encoding'))
$text mb_convert_encoding($text'UTF-8'$encoding);
// Or maybe we can convert with iconv
else if ($encoding != 'UTF-8' && function_exists('iconv'))
$text iconv($encoding'UTF-8'$text);
// Fix Turkish
else if ($encoding == 'ISO-8859-9')
{
$text str_replace(array("\xD0""\xDD""\xDE""\xF0""\xFD""\xFE"), array('g''i''s''g''i''s'), $text);
$text utf8_encode($text);
}
// Latin-1 can be converted easily
else if ($encoding == 'ISO-8859-1')
$text utf8_encode($text);

// Change the entities back to normal characters
$text str_replace(array('&amp;''&quot;'), array('&''"'), $text);
$prettytext '';

// Split up $text into UTF-8 letters
preg_match_all("~.~su"$text$characters);
foreach ($characters[0] as $aLetter)
{
foreach ($characterHash as $replace => $search)
{
// Found a character? Replace it!
if (in_array($aLetter$search))
{
$prettytext .= $replace;
break;
}
}
}
// Remove unwanted '-'s
$prettytext preg_replace(array('~^-+|-+$~''~-+~'), array('''-'), $prettytext);
return $prettytext;
}

// URL maintenance
function pretty_run_maintenance($installing false)
{
global $boarddir$context$modSettings$smcFunc;

$context['pretty']['maintenance_tasks'] = array();

// Get the array of actions
$indexphp file_get_contents($boarddir '/index.php');
preg_match('~actionArray\\s*=\\s*array[^;]+~'$indexphp$actionArrayText);
preg_match_all('~\'([^\']+)\'\\s*=>~'$actionArrayText[0], $actionArrayPREG_PATTERN_ORDER);
$context['pretty']['action_array'] = $actionArray[1];
    if (
function_exists('call_integration_hook'))
{
$dummy = array();
call_integration_hook('integrate_actions', array(&$dummy));
$context['pretty']['action_array'] += array_keys($dummy);
}

// Pretty URLs RUS
global $txt;
$context['pretty']['maintenance_tasks'][] = $txt['pretty_task_actons'];

// Update the list of boards
// Get the current pretty board urls, or make new arrays if there are none
$pretty_board_urls = isset($modSettings['pretty_board_urls']) ? unserialize($modSettings['pretty_board_urls']) : array();
$pretty_board_lookup_old = isset($modSettings['pretty_board_lookup']) ? unserialize($modSettings['pretty_board_lookup']) : array();

// Fix old boards by replacing ' with \x12
$pretty_board_urls str_replace("'""\x12"$pretty_board_urls);
$pretty_board_lookup = array();
foreach ($pretty_board_lookup_old as $board => $id)
$pretty_board_lookup[str_replace("'""\x12"$board)] = $id;

// Fix old topics too
$smcFunc['db_query']('''
UPDATE {db_prefix}pretty_topic_urls
SET pretty_url = REPLACE(pretty_url, {string:old_quote}, {string:new_quote})'
,
array(
'old_quote' => "'",
'new_quote' => "\x12",
'db_error_skip' => true,
));
// Pretty URLs RUS
$context['pretty']['maintenance_tasks'][] = $txt['pretty_task_old'];

// Get the board names
$query $smcFunc['db_query'](''"
SELECT id_board, name
FROM {db_prefix}boards"
);

// Process each board
while ($row $smcFunc['db_fetch_assoc']($query))
{
// Don't replace the board urls if they already exist
if (!isset($pretty_board_urls[$row['id_board']]) || $pretty_board_urls[$row['id_board']] == '' || in_array($row['id_board'], $pretty_board_lookup) === false)
{
$pretty_text pretty_generate_url($row['name']);
// We need to have something to refer to this board by...
if ($pretty_text == '')
// ... so use 'bID_BOARD'
$pretty_text 'b' $row['id_board'];
// Numerical or duplicate URLs aren't allowed!
if (is_numeric($pretty_text) || isset($pretty_board_lookup[$pretty_text]) || in_array($pretty_text$context['pretty']['action_array']))
// Add suffix '-ID_BOARD' to the pretty url
$pretty_text .= ($pretty_text != '' '-' 'b') . $row['id_board'];
// Update the arrays
$pretty_board_urls[$row['id_board']] = $pretty_text;
$pretty_board_lookup[$pretty_text] = $row['id_board'];
}
// Current board URL is the same as an action
elseif (in_array($pretty_board_urls[$row['id_board']], $context['pretty']['action_array']))
{
$pretty_text $pretty_board_urls[$row['id_board']] . '-' $row['id_board'];
$pretty_board_urls[$row['id_board']] = $pretty_text;
$pretty_board_lookup[$pretty_text] = $row['id_board'];
}
}
$smcFunc['db_free_result']($query);
// Pretty URLs RUS
$context['pretty']['maintenance_tasks'][] = $txt['pretty_task_urls'];

// Update the database
updateSettings(array(
'pretty_action_array' => serialize($context['pretty']['action_array']),
'pretty_board_lookup' => serialize($pretty_board_lookup),
'pretty_board_urls' => serialize($pretty_board_urls),
));

// Update the filter callbacks
pretty_update_filters($installing);
// Pretty URLs RUS
$context['pretty']['maintenance_tasks'][] = $txt['pretty_task_filters'];
}

// Update the database based on the installed filters and build the .htaccess file
function pretty_update_filters($installing false)
{
global $boarddir$boardurl$context$modSettings$smcFunc;

// Get the settings
$prettyFilters unserialize($modSettings['pretty_filters']);
$filterSettings = array();
$rewrites = array();
foreach ($prettyFilters as $id => $filter)
// Get the important data from enabled filters
if ($filter['enabled'])
{
if (isset($filter['filter']))
$filterSettings[$filter['filter']['priority']] = $filter['filter']['callback'];
if (isset($filter['rewrite']))
$rewrites[$filter['rewrite']['priority']] = array(
'id' => $id,
'rule' => $filter['rewrite']['rule'],
);
}

// Build the new .htaccess file
$htaccess '# PRETTYURLS MOD BEGINS
# Pretty URLs mod
# http://code.google.com/p/prettyurls/
# .htaccess file generated automatically on: ' 
date('F j, Y, G:i') . '

RewriteEngine on'
;

// Check if we'll need a RewriteBase rule
// Thanks heaps to Silverstripe!
// http://open.silverstripe.com/ticket/2903
$base dirname($_SERVER['SCRIPT_NAME']);
if (defined('DIRECTORY_SEPARATOR'))
$base str_replace(DIRECTORY_SEPARATOR'/'$base);
else
$base str_replace("\\"'/'$base);
if ($base != '.')
$htaccess .= "\nRewriteBase " $base;

// Output the rules
ksort($rewrites);
foreach ($rewrites as $rule)
{
$htaccess .= "\n\n# Rules for: " $rule['id'] . "\n";
if (is_array($rule['rule']))
$htaccess .= implode("\n"$rule['rule']);
else
$htaccess .= $rule['rule'];
}
$htaccess .= "\n\n# PRETTYURLS MOD ENDS";

// Fix the Root URL
if (preg_match('`' $boardurl '/(.*)`'$modSettings['pretty_root_url'], $match))
$htaccess str_replace('ROOTURL'$match[1] . '/'$htaccess);
else
$htaccess str_replace('ROOTURL'''$htaccess);

// Actions
if (strpos($htaccess'#ACTIONS') !== false)
{
// Put them in groups of 8
$action_array str_replace('.''\\.'$context['pretty']['action_array']);
$groups array_chunk($action_array8);
// Construct the rewrite rules
$lines = array();
foreach ($groups as $group)
$lines[] = 'RewriteRule ^('implode('|'$group) .')/?$ ./index.php?pretty;action=$1 [L,QSA]';
$actions_rewrite implode("\n"$lines);
$htaccess str_replace('#ACTIONS'$actions_rewrite$htaccess);
}

// Check if there is already a .htaccess file
if (file_exists($boarddir '/.htaccess'))
{
// If we can't write to it, disable the filters!
if (!is_writable($boarddir '/.htaccess'))
{
unset($context['template_layers']['pretty_chrome']);
updateSettings(array('pretty_enable_filters' => '0'));

if ($installing)
return;
else
fatal_lang_error('pretty_cant_write_htaccess'false);
}

// Backup the old .htaccess file
@copy($boarddir '/.htaccess'$boarddir '/.htaccess.backup');

// Replace the old with the new, if we can
$oldHtaccess file_get_contents($boarddir '/.htaccess');
$pattern '~# PRETTYURLS MOD BEGINS.+# PRETTYURLS MOD ENDS~s';
if (preg_match($pattern$oldHtaccess$match))
$htaccess str_replace($match[0], $htaccess$oldHtaccess);
}

// Output the new .htaccess file
$handle fopen($boarddir '/.htaccess''w');
fwrite($handle$htaccess);
fclose($handle);

// Update the settings table
ksort($filterSettings);
updateSettings(array('pretty_filter_callbacks' => serialize($filterSettings)));

// Clear the URLs cache
$smcFunc['db_query']('truncate_table'"
TRUNCATE {db_prefix}pretty_urls_cache"
);

// Don't rewrite anything for this page
$modSettings['pretty_enable_filters'] = false;
}

// Format a JSON string
// From http://au2.php.net/manual/en/function.json-encode.php#80339
function pretty_json($json)
{
$tab "    ";
$new_json "";
$indent_level 0;
$in_string false;
$len strlen($json);

for($c 0$c $len$c++)
{
$char $json[$c];
if ($char == '"')
{
if($c && $json[$c 1] != '\\')
$in_string = !$in_string;
$new_json .= $char;
}
else if ($in_string)
$new_json .= $char;
else if ($char == '{' || $char == '[')
{
$indent_level++;
$new_json .= $char "\n" str_repeat($tab$indent_level);
}
else if ($char == '}' || $char == ']')
{
$indent_level--;
$new_json .= "\n" str_repeat($tab$indent_level) . $char;
}
else if ($char == ',')
$new_json .= ",\n" str_repeat($tab$indent_level);
else if ($char == ':')
$new_json .= ": ";
else
$new_json .= $char;
}

return $new_json;
}

?>





Also - during the preview of pretty urls setting (in settings, before apply when enable it) - all links are ok.


helpplease

#7555
German language question

Hello :)

Pretty URLs works well on my small Forum, great Job  :D

But how can I change ä, ü, ö into ae ue, oe, ?

PrettyUrls make ä, ü, ö only into a, u, o...

And one last question: Is the change of the URL still important for SEO today?

Thanks for any help.


vbgamer45

Quote from: helpplease on June 30, 2017, 09:41:28 PM
German language question

Hello :)

Pretty URLs works well on my small Forum, great Job  :D

But how can I change ä, ü, ö into ae ue, oe, ?

PrettyUrls make ä, ü, ö only into a, u, o...

And one last question: Is the change of the URL still important for SEO today?

Thanks for any help.


Check above your post
It would be in the file Subs-PrettyUrls.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

helpplease



[/quote]
Check above your post
It would be in the file Subs-PrettyUrls.php
[/quote]

Hi :)

I know where the Subs-PrettyUrls.php file is located, but I don't know what or how I need to change it in order to work  :laugh:



vbgamer45

In the function pretty_generate_url($text) you can see all the mappings there.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

helpplease

Quote from: vbgamer45 on July 01, 2017, 11:58:45 AM
In the function pretty_generate_url($text) you can see all the mappings there.

:) Thanks, and how it needs to be done? What is the coding that I need to change?

I want to change the ä, ü, ö into ae, ue, oe

PrettyUrls make ä, ü, ö only into a, u, o.

Advertisement: