fluxbb-friendly-url
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:Backport of FluxBB 1.3 friendly URL feature
##
##
##        Mod title:  Friendly URL
##
##      Mod version:  1.0.9
##  Works on FluxBB:  1.4.7
##     Release date:  2011-11-16
##      Review date:  2011-11-16
##           Author:  Daris (daris91@gmail.com)
##
##      Description:  Backport of FluxBB 1.3 friendly URL feature
##
##   Repository URL:  http://fluxbb.org/resources/mods/friendly-url/
##
##   Affected files:  include/common.php
##                    include/functions.php
##                    include/cache.php
##                    viewtopic.php
##
## Upgrading from 1.0.8: overwrite include/friendly_url.php file
##
##       Affects DB:  Yes
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    FluxBB. Installation of this modification is done at
##                    your own risk. Backup your forum database and any and
##                    all applicable files before proceeding.
##
##


#
#---------[ 1. UPLOAD ]-------------------------------------------------
#

files/install_mod.php to /
files/gen.php to /
files/rewrite.php to /
files/.htaccess to /
files/include/friendly_url.php to /include/
files/include/url/ to /include/url/
files/include/js/quick_jump.js to /include/js/ (if directory does not exist, create it)
files/plugins/AP_Friendly_URL.php to /plugins/
files/lang/English/url_replace.php to /lang/English/
files/lang/English/admin_plugin_friendly_url.php to /lang/English/

#
#---------[ 2. RUN ]----------------------------------------------------------
#

install_mod.php

#
#---------[ 3. DELETE ]-------------------------------------------------------
#

install_mod.php

#
#---------[ 4. OPEN ]---------------------------------------------------------
#

include/common.php

#
#---------[ 5. FIND ]---------------------------------------------
#

if (!defined('PUN_ROOT'))

#
#---------[ 6. BEFORE, ADD ]-------------------------------------------------
#

// Do not load common.php twice
if (defined('FORUM_VERSION'))
	return;

#
#---------[ 7. FIND ]---------------------------------------------
#

require PUN_ROOT.'include/functions.php';

#
#---------[ 8. AFTER, ADD ]---------------------------------------------------
#

require PUN_ROOT.'include/friendly_url.php';

#
#---------[ 9. FIND ]---------------------------------------------
#

// Define standard date/time formats

#
#---------[ 10. BEFORE, ADD ]---------------------------------------------------
#

// Setup the URL rewriting scheme
if (file_exists(PUN_ROOT.'include/url/'.$pun_config['o_sef'].'/forum_urls.php'))
	require PUN_ROOT.'include/url/'.$pun_config['o_sef'].'/forum_urls.php';
else
	require PUN_ROOT.'include/url/Default/forum_urls.php';

// Convert rewritten url back to normal url
if (isset($_SERVER['HTTP_REFERER']))
{
	$_SERVER['HTTP_REFERER_REWRITTEN'] = $_SERVER['HTTP_REFERER'];
	$_SERVER['HTTP_REFERER'] = fix_referer();
}

#
#---------[ 11. OPEN ]---------------------------------------------------------
#

include/functions.php

#
#---------[ 12. FIND ]---------------------------------------------
#

function paginate($num_pages, $cur_page, $link)
{
	global $lang_common;

	$pages = array();
	$link_to_all = false;

	// If $cur_page == -1, we link to all pages (used in viewforum.php)
	if ($cur_page == -1)
	{
		$cur_page = 1;
		$link_to_all = true;
	}

	if ($num_pages <= 1)
		$pages = array('1');
	else
	{
		// Add a previous page link
		if ($num_pages > 1 && $cur_page > 1)
			$pages[] = '';

		if ($cur_page > 3)
		{
			$pages[] = '1';

			if ($cur_page > 5)
				$pages[] = ''.$lang_common['Spacer'].'';
		}

		// Don't ask me how the following works. It just does, OK? :-)
		for ($current = ($cur_page == 5) ? $cur_page - 3 : $cur_page - 2, $stop = ($cur_page + 4 == $num_pages) ? $cur_page + 4 : $cur_page + 3; $current < $stop; ++$current)
		{
			if ($current < 1 || $current > $num_pages)
				continue;
			else if ($current != $cur_page || $link_to_all)
				$pages[] = ''.forum_number_format($current).'';
			else
				$pages[] = ''.forum_number_format($current).'';
		}

		if ($cur_page <= ($num_pages-3))
		{
			if ($cur_page != ($num_pages-3) && $cur_page != ($num_pages-4))
				$pages[] = ''.$lang_common['Spacer'].'';

			$pages[] = ''.forum_number_format($num_pages).'';
		}

		// Add a next page link
		if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages)
			$pages[] = '';
	}

#
#---------[ 13. REPLACE WITH ]---------------------------------------------------
#

function paginate($num_pages, $cur_page, $link, $args = null)
{
	global $lang_common, $forum_url;

	$pages = array();
	$link_to_all = false;

	// If $cur_page == -1, we link to all pages (used in viewforum.php)
	if ($cur_page == -1)
	{
		$cur_page = 1;
		$link_to_all = true;
	}

	if ($num_pages <= 1)
		$pages = array('1');
	else
	{
		// Add a previous page link
		if ($num_pages > 1 && $cur_page > 1)
			$pages[] = '';

		if ($cur_page > 3)
		{
			$pages[] = '1';

			if ($cur_page > 5)
				$pages[] = ''.$lang_common['Spacer'].'';
		}

		// Don't ask me how the following works. It just does, OK? :-)
		for ($current = ($cur_page == 5) ? $cur_page - 3 : $cur_page - 2, $stop = ($cur_page + 4 == $num_pages) ? $cur_page + 4 : $cur_page + 3; $current < $stop; ++$current)
		{
			if ($current < 1 || $current > $num_pages)
				continue;
			else if ($current != $cur_page || $link_to_all)
				$pages[] = ''.forum_number_format($current).'';
			else
				$pages[] = ''.forum_number_format($current).'';
		}

		if ($cur_page <= ($num_pages-3))
		{
			if ($cur_page != ($num_pages-3) && $cur_page != ($num_pages-4))
				$pages[] = ''.$lang_common['Spacer'].'';

			$pages[] = ''.forum_number_format($num_pages).'';
		}

		// Add a next page link
		if ($num_pages > 1 && !$link_to_all && $cur_page < $num_pages)
			$pages[] = '';
	}

#
#---------[ 14. OPEN ]---------------------------------------------------------
#

include/cache.php

#
#---------[ 15. FIND ]---------------------------------------------
#

				$output .= "\t\t\t\t".'
'."\n\t\t\t\t\t".'
'."\n\t\t\t\t".'
'."\n"; # #---------[ 20. REPLACE WITH ]--------------------------------------------------- # $output .= "\t\t\t\t\t\t".''."\n\t\t\t\t\t".''."\n\t\t\t\t\t".''."\n\t\t\t\t\t".'
'."\n\t\t\t\t".''."\n"; $output .= ''."\n"; # #---------[ 21. OPEN ]--------------------------------------------------------- # viewtopic.php # #---------[ 22. FIND ]--------------------------------------------- # define('PUN_ALLOW_INDEX', 1); # #---------[ 23. REPLACE WITH ]------------------------------------------------- # if (!$pid) define('PUN_ALLOW_INDEX', 1); # #---------[ 24. RUN (WARNING: MAKE BACKUP OF FLUXBB DIRECTORY as this script replaces all links with forum_link function!) ]------ # gen.php # #---------[ 25. DELETE ]------------------------------------------------- # gen.php # #---------[ 26. SAVE/UPLOAD ]------------------------------------------------- # # #---------[ 27. NOTE (for nginx server) ]------------------------------------------------- # For nginx server add the following code to server section of the nginx.conf file (assuming you have fluxbb in forum directory) location /forum { index index.html index.htm index.php; if (!-e $request_filename) { rewrite ^/(.+)$ /forum/rewrite.php last; break; } }
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。