1<?php
2/*
3 * e107 Bootstrap CMS
4 *
5 * Copyright (C) 2008-2015 e107 Inc (e107.org)
6 * Released under the terms and conditions of the
7 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
8 *
9 * IMPORTANT: Make sure the redirect script uses the following code to load class2.php:
10 *
11 * 	if (!defined('e107_INIT'))
12 * 	{
13 * 		require_once("../../class2.php");
14 * 	}
15 *
16 */
17
18if (!defined('e107_INIT')) { exit; }
19
20// v2.x Standard  - Simple mod-rewrite module.
21
22class forum_url // plugin-folder + '_url'
23{
24	function config()
25	{
26		$config = array();
27
28		$config['rules'] = array(
29			'regex'			=> '^forum/rules/?',
30			'sef'			=> 'forum/rules',
31			'redirect'		=> '{e_PLUGIN}forum/forum.php?f=rules',
32		);
33
34		$config['stats'] = array(
35			'regex'			=> '^forum/stats/?',
36			'sef'			=> 'forum/stats',
37			'redirect'		=> '{e_PLUGIN}forum/forum_stats.php',
38		);
39
40		$config['track'] = array(
41			'regex'			=> '^forum/track/?',
42			'sef'			=> 'forum/track',
43			'redirect'		=> '{e_PLUGIN}forum/forum.php?f=track',
44		);
45
46		$config['markread']  = array(
47			'sef'           => '^forum/markread/{forum_id}',
48			'regex'			=> 'forum/markread/([\d]*)',
49			'redirect'      => '{e_PLUGIN}forum/forum.php?f=mfar&id=$1',
50			'legacy'        => '{e_PLUGIN}forum/forum.php?f=mfar&id={forum_id}'
51		);
52
53		$config['new']  = array(
54            'regex'			=> '^forum/new$/?',
55			'sef'           => 'forum/new',
56			'redirect'      => '{e_PLUGIN}forum/forum.php?new'
57		);
58
59		$config['post'] = array(
60			'regex'			=> '^forum/post/?',
61			'sef'			=> 'forum/post/',
62			'redirect'		=> '{e_PLUGIN}forum/forum_post.php',
63		);
64
65		// only create url  - parsed above.
66		$config['move'] = array(
67			'sef'           => 'forum/post/?f=move&id={thread_id}',
68			'legacy'        => '{e_PLUGIN}forum/forum_post.php?f=move&id={thread_id}'
69		);
70
71
72
73		$config['split'] = array(
74			'sef'           => 'forum/post/?f=split&id={thread_id}&post={post_id}',
75			'legacy'        => '{e_PLUGIN}forum/forum_post.php?f=split&id={thread_id}&post={post_id}'
76		);
77
78		$config['topic'] = array(
79			'regex'         => 'forum\/([^\/]*)\/([\d]*)(?:\/|-)([\w-]*)/?\??(.*)',
80		//	'regex'			=> '^forum/(.*)/(\d*)(?:-|/)([\w-]*)/?\??(.*)',
81			'sef'			=> 'forum/{forum_sef}/{thread_id}/{thread_sef}/',
82			'redirect'		=> '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4'
83		);
84/*
85		$config['subforum'] = array(
86			'regex'			=> '^forum/(.*)/(.*)$',
87			'sef'			=> 'forum/{parent_sef}/{forum_sef}',
88			'redirect'		=> '{e_PLUGIN}forum/forum_viewforum.php?sef=$2',
89			'legacy'        => '{e_PLUGIN}forum/forum_viewforum.php?id={forum_id}'
90		);
91*/
92
93		$config['index'] = array(
94			'regex'			=> '^forum\/?$', 						// matched against url, and if true, redirected to 'redirect' below.
95			'sef'			=> 'forum', 							// used by e107::url(); to create a url from the db table.
96			'redirect'		=> '{e_PLUGIN}forum/forum.php', 		// file-path of what to load when the regex returns true.
97
98		);
99
100
101		$config['forum'] = array(
102			'regex'			=> '^forum\/([^\/]*)\/?\??([^\/]*)?$',
103			'sef'			=> 'forum/{forum_sef}/',
104			'redirect'		=> '{e_PLUGIN}forum/forum_viewforum.php?sef=$1&$2',
105			'legacy'        => '{e_PLUGIN}forum/forum_viewforum.php?id={forum_id}'
106		);
107
108
109
110
111		return $config;
112	}
113
114
115
116}