SMF 2.0.x (Módulos Manual) > SMF 2.x Módulos Manual

Advance SEF Urls

(1/1)

joomlamz:
Manuel İnstallation for SMF 2.0 Beta 4

Sources/ManageSettings.php
Pesquisar

--- Código: --- );

if ($return_config)
return $config_vars;

--- Fim de Código ---


Adicionar antes


--- Código: --- '',
// Action SEF URLS?
array('check', 'enableActionurls'),
array('check', 'enableSubActionurls'),
array('check', 'enableCurls'),
array('check', 'enablePageurls'),
array('check', 'enableUseQuestion'),
array('check', 'enableNoIndex'),
array('check', 'enableNoFile'),

--- Fim de Código ---

Sources/QueryString.php
Pesquisar

--- Código: ---global $board, $topic, $boardurl, $scripturl, $modSettings, $smcFunc;
--- Fim de Código ---

Trocar por

--- Código: ---global $board, $topic, $boardurl, $scripturl, $modSettings, $smcFunc, $disable_sef;
--- Fim de Código ---

Pesquisar

--- Código: ---// Makes it easier to refer to things this way.
$scripturl = $boardurl . '/index.php';
--- Fim de Código ---

Adicionar antes


--- Código: ---if(!empty($modSettings['enableUseQuestion']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '/?', $scripturl);
elseif(!empty($modSettings['enableNoIndex']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '/index', $scripturl);
// This will make all urls use a double /, but it is needed for detection by the script.
elseif(!empty($modSettings['enableNoFile']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '//', $scripturl);
--- Fim de Código ---

Pesquisar

--- Código: ---function ob_sessrewrite($buffer)
{
--- Fim de Código ---

Adicionar antes

--- Código: --- global $disable_sef;
--- Fim de Código ---


Pesquisar

--- Código: --- // If $scripturl is set to nothing, or the SID is not defined (SSI?) just quit.
--- Fim de Código ---

Adicionar antes


--- Código: ---// Clean URL to start with.
$sef_urls = array();

// Check the Settings, with a backup.
if(!empty($modSettings['enableActionurls']) && empty($disable_sef))
$sef_urls[] = 'action';
if(!empty($modSettings['enableSubActionurls']))
$sef_urls[] = 'sa';
if(!empty($modSettings['enableCurls']) && empty($disable_sef))
$sef_urls[] = 'c';
if(!empty($modSettings['enablePageurls']) && empty($disable_sef))
$sef_urls[] = 'page';


// After all that, Rip it up and drop it in a single line.
$sef_urls = implode('|', $sef_urls) . '|';
--- Fim de Código ---

Pesquisar

--- Código: ---$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . ';)((?:
--- Fim de Código ---

Trocar por


--- Código: ---$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . ';)((?:' . $sef_urls . '
--- Fim de Código ---

Pesquisar

--- Código: ---$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:
--- Fim de Código ---

Trocar por

--- Código: ---$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:' . $sef_urls . '
--- Fim de Código ---

Pesquisar

--- Código: ---if (empty($_COOKIE) && SID != '' && empty($context['browser']['possibly_robot']) && @version_compare(PHP_VERSION, '4.3.0') != -1)
--- Fim de Código ---

Trocar por

--- Código: ---if (empty($_COOKIE) && SID != '' && empty($context['browser']['possibly_robot']) && @version_compare(PHP_VERSION, '4.3.0') != -1 && (empty($modSettings['enableNoFile']) || !empty($disable_sef)))
--- Fim de Código ---


Pesquisar

--- Código: ---if (isset($_GET['debug']))
--- Fim de Código ---

Trocar por

--- Código: ---if (isset($_GET['debug']) && !empty($disable_sef))
--- Fim de Código ---


Pesquisar

--- Código: ---// Return the changed buffer.
return $buffer;
--- Fim de Código ---

Adicionar antes

--- Código: --- // If we are using SEF urls, we want a clean debug.
if (isset($_GET['debug']) && empty($disable_sef))
$buffer = str_replace($scripturl, substr($scripturl, 0, -1) . 'debug', $buffer);
// Maybe we want to clean slashes?
elseif(!empty($modSettings['enableNoFile']) && empty($disable_sef))
$buffer = str_replace($scripturl, substr($scripturl, 0, -2), $buffer);

--- Fim de Código ---


Sources/Subs.php
Pesquisar

--- Código: --- // Put the session ID in.
--- Fim de Código ---

Adicionar Depois

--- Código: --- // Clean URL to start with.
$sef_urls = array();

// Check the Settings..
if(!empty($modSettings['enableActionurls']))
$sef_urls[] = 'action';
if(!empty($modSettings['enableSubActionurls']))
$sef_urls[] = 'sa';
if(!empty($modSettings['enableCurls']))
$sef_urls[] = 'c';
if(!empty($modSettings['enablePageurls']))
$sef_urls[] = 'page';

// After all that, Rip it up and drop it in a single line.
$sef_urls = implode('|', $sef_urls) . '|';

--- Fim de Código ---

Pesquisar

--- Código: ---$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?(?:' . SID . ';)((?:board|topic)=[^#]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2?' . SID", $setLocation);
else
$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2'", $setLocation);
--- Fim de Código ---

Trocar por

--- Código: ---$setLocation = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . ';)((?:' . $sef_urls . 'board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $setLocation);
else
$setLocation = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:' . $sef_urls . 'board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $setLocation);
--- Fim de Código ---

Pesquisar

--- Código: --- // We send a Refresh header only in special cases because Location looks better. (and is quicker...)
--- Fim de Código ---

Trocar por

--- Código: --- if(!empty($modSettings['enableUseQuestion']) && empty($disable_sef))
$setLocation = str_replace('??', '?', $setLocation);

--- Fim de Código ---

Themes/default/Post.template.php

Pesquisar

--- Código: --- new_url = new_url.substr(0, new_url.indexOf("rand=") + 5);
--- Fim de Código ---

Trocar por

--- Código: --- new_url = new_url.substr(0, new_url.indexOf("rand") + 5);
--- Fim de Código ---


.htaccess

Pesquisar

--- Código: ---?>
--- Fim de Código ---

Adicionar depois

--- Código: ---<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [QSA]
</IfModule>
--- Fim de Código ---


Themes/default/languages/Modifications.english.php

Pesquisar

--- Código: ---?>
--- Fim de Código ---

Adicionar depois

--- Código: ---$txt['enableActionurls'] = 'Enable Action SEF URLS';
$txt['enableSubActionurls'] = 'Enable Sub Action SEF URLS';
$txt['enableCurls'] = 'Enable Category SEF URLS (For Single Category Mod)';
$txt['enablePageurls'] = 'Enable Page SEF URLS (For Tinyportal Pages)';
$txt['enableUseQuestion'] = 'Use a question Mark (?) Instead of index.php';
$txt['enableNoIndex'] = 'Use index instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
$txt['enableNoFile'] = 'Use Nothing instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
--- Fim de Código ---


A TRADUCAO EM PT Candidosa2 Vai fazer..e colocar aqui

marcio-msa:
da quase para montar um mods

ManageSettings.php

--- Código: --- <file name="$sourcedir/ManageSettings.php">
<operation>
<search position="before"><![CDATA[ );

if ($return_config)
return $config_vars;]]></search>
<add><![CDATA[ '',
// Action SEF URLS?
array('check', 'enableActionurls'),
array('check', 'enableSubActionurls'),
array('check', 'enableCurls'),
array('check', 'enablePageurls'),
array('check', 'enableUseQuestion'),
array('check', 'enableNoIndex'),
array('check', 'enableNoFile'),
]]></add>
</operation>
</file>
--- Fim de Código ---


QueryString.php

--- Código: --- <file name="$sourcedir/QueryString.php">
<operation>
<search position="replace"><![CDATA[
global $board, $topic, $boardurl, $scripturl, $modSettings, $smcFunc;
]]></search>
<add><![CDATA[
global $board, $topic, $boardurl, $scripturl, $modSettings, $smcFunc, $disable_sef;
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
// Makes it easier to refer to things this way.
$scripturl = $boardurl . '/index.php';
]]></search>
<add><![CDATA[
if(!empty($modSettings['enableUseQuestion']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '/', $scripturl);
elseif(!empty($modSettings['enableNoIndex']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '/index', $scripturl);
// This will make all urls use a double /, but it is needed for detection by the script.
elseif(!empty($modSettings['enableNoFile']) && empty($disable_sef))
$scripturl = str_replace('/index.php', '//', $scripturl);
]]></add>
</operation>
<operation>
<search position="before"><![CDATA[
function ob_sessrewrite($buffer)
{
]]></search>
<add><![CDATA[
global $disable_sef;
]]></add>
</operation>


<operation>
<search position="after"><![CDATA[
// If $scripturl is set to nothing, or the SID is not defined (SSI?) just quit.
]]></search>
<add><![CDATA[
// Clean URL to start with.
$sef_urls = array();

// Check the Settings, with a backup.
if(!empty($modSettings['enableActionurls']) && empty($disable_sef))
$sef_urls[] = 'action';
if(!empty($modSettings['enableSubActionurls']))
$sef_urls[] = 'sa';
if(!empty($modSettings['enableCurls']) && empty($disable_sef))
$sef_urls[] = 'c';
if(!empty($modSettings['enablePageurls']) && empty($disable_sef))
$sef_urls[] = 'page';


// After all that, Rip it up and drop it in a single line.
$sef_urls = implode('|', $sef_urls) . '|';
]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:]]></search>
<add><![CDATA[$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:' . $sef_urls . ']]></add>
</operation>
<operation>
<search position="replace"><![CDATA[$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:]]></search>
<add><![CDATA[$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:' . $sef_urls . ']]></add>
</operation>
<operation>
<search position="replace"><![CDATA[if (empty($_COOKIE) && SID != '' && empty($context['browser']['possibly_robot']) && @version_compare(PHP_VERSION, '4.3.0') != -1)]]></search>
<add><![CDATA[if (empty($_COOKIE) && SID != '' && empty($context['browser']['possibly_robot']) && @version_compare(PHP_VERSION, '4.3.0') != -1 && (empty($modSettings['enableNoFile']) || !empty($disable_sef)))]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[if (isset($_GET['debug']))]]></search>
<add><![CDATA[if (isset($_GET['debug']) && !empty($disable_sef))]]></add>
</operation>
<operation>
<search position="after"><![CDATA[ // Return the changed buffer.
return $buffer;
]]></search>
<add><![CDATA[ // If we are using SEF urls, we want a clean debug.
if (isset($_GET['debug']) && empty($disable_sef))
$buffer = str_replace($scripturl, substr($scripturl, 0, -1) . 'debug', $buffer);
// Maybe we want to clean slashes?
elseif(!empty($modSettings['enableNoFile']) && empty($disable_sef))
$buffer = str_replace($scripturl, substr($scripturl, 0, -2), $buffer);
]]></add>
</operation>
</file>
--- Fim de Código ---



Subs.php

--- Código: --- <file name="$sourcedir/Subs.php">
<operation>
<search position="after"><![CDATA[
// Put the session ID in.
]]></search>
<add><![CDATA[
// Clean URL to start with.
$sef_urls = array();

// Check the Settings..
if(!empty($modSettings['enableActionurls']))
$sef_urls[] = 'action';
if(!empty($modSettings['enableSubActionurls']))
$sef_urls[] = 'sa';
if(!empty($modSettings['enableCurls']))
$sef_urls[] = 'c';
if(!empty($modSettings['enablePageurls']))
$sef_urls[] = 'page';

// After all that, Rip it up and drop it in a single line.
$sef_urls = implode('|', $sef_urls) . '|';
]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[ $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:board|topic)=[^#]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2?' . SID", $setLocation);
else
$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2'", $setLocation);
]]></search>
<add><![CDATA[ $setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?(?:' . SID . '(?:;|&|&amp;))((?:' . $sef_urls . 'board|topic)=[^#]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2?' . SID", $setLocation);
else
$setLocation = preg_replace('/^' . preg_quote($scripturl, '/') . '\?((?:' . $sef_urls . 'board|topic)=[^#"]+?)(#[^"]*?)?$/e', "\$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2'", $setLocation);
]]></add>
</operation>

<operation>
<search position="replace"><![CDATA[
// We send a Refresh header only in special cases because Location looks better. (and is quicker...)
]]></search>
<add><![CDATA[
if(!empty($modSettings['enableUseQuestion']) && empty($disable_sef))
$setLocation = str_replace('??', '?', $setLocation);
]]></add>
</operation>
</file>
--- Fim de Código ---

.htaccess

--- Código: --- <file name="$boarddir/.htaccess" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [QSA]
</IfModule>
]]></add>
</operation>
</file>
--- Fim de Código ---


Modifications.english.php

--- Código: --- <file name="$languagedir/Modifications.english.php">
<operation>
<search position="end" />
<add><![CDATA[
$txt['enableActionurls'] = 'Enable Action SEF URLS';
$txt['enableSubActionurls'] = 'Enable Sub Action SEF URLS';
$txt['enableCurls'] = 'Enable Category SEF URLS (For Single Category Mod)';
$txt['enablePageurls'] = 'Enable Page SEF URLS (For Tinyportal Pages)';
$txt['enableUseQuestion'] = 'Use a question Mark (?) Instead of index.php';
$txt['enableNoIndex'] = 'Use index instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
$txt['enableNoFile'] = 'Use Nothing instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
]]></add>
</operation>
</file>
--- Fim de Código ---


Modifications.english_utf8.php

--- Código: --- <file name="$languagedir/Modifications.english_utf8.php" error="skip">
<operation>
<search position="end" />
<add><![CDATA[
$txt['enableActionurls'] = 'Enable Action SEF URLS';
$txt['enableSubActionurls'] = 'Enable Sub Action SEF URLS';
$txt['enableCurls'] = 'Enable Category SEF URLS (For Single Category Mod)';
$txt['enablePageurls'] = 'Enable Page SEF URLS (For Tinyportal Pages)';
$txt['enableUseQuestion'] = 'Use a question Mark (?) Instead of index.php';
$txt['enableNoIndex'] = 'Use index instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
$txt['enableNoFile'] = 'Use Nothing instead of index.php <span class="smalltext">(Doesn\'t work on all servers, use "$disable_sef = true;" in your Settings.php if enabling this breaks your site)</span>';
]]></add>
</operation>
</file>
--- Fim de Código ---

candidosa2:
Sim pode montar se quiser nao a problema nisso

Navegação

[0] Índice de mensagens

Ir para versão completa