PluginProbe
wpForo Forum / 1.4.12
wpForo Forum v1.4.12
3.1.6 3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 All 138 releases
wpforo / wpf-themes / classic / index.php

index.php in wpForo Forum 1.4.12, at wpf-themes/classic/index.php

268 lines 16.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if( !defined( 'ABSPATH' ) ) exit;
4 ?>
5 <?php
6 /**
7 * Template Name: WpForo Index (Forums List)
8 */
9 ?>
10 <?php if( WPF()->use_home_url ) get_header(); ?>
11 <?php extract(WPF()->current_object, EXTR_OVERWRITE); ?>
12 <?php include("header.php"); ?>
13 <div class="wpforo-main <?php echo 'wpft-' . $template ?>">
14 <div class="wpforo-content <?php if(WPF()->api->options['sb_location_toggle'] == 'right') echo 'wpfrt' ?>"<?php echo is_active_sidebar('forum-sidebar') ? '' : 'style="width:100%"' ?>>
15 <?php do_action( 'wpforo_content_start' ); ?>
16 <?php if( WPF()->current_user_status == 'banned' || WPF()->current_user_status == 'trashed' ) : ?>
17 <p class="wpf-p-error"><?php wpforo_phrase('You have been banned. Please contact to forum administrators for more information.') ?></p>
18 <?php else : ?>
19 <?php
20 if($template == 'search'){
21 include( wpftpl('search.php') );
22 }elseif($template == 'recent'){
23 include( wpftpl('recent.php') );
24 }elseif($template == 'register'){
25 include( wpftpl('register.php') );
26 }elseif($template == 'login'){
27 include( wpftpl('login.php') );
28 }elseif($template == 'lostpassword'){
29 do_shortcode('[wpforo-lostpassword]');
30 }elseif($template == 'resetpassword'){
31 do_shortcode('[wpforo-resetpassword]');
32 }elseif($template == 'page'){
33 wpforo_page();
34 }elseif($template == 'members'){
35 if( !empty($_GET['_wpfms']) ){
36 $users_include = array();
37 $search_fields_names = WPF()->member->get_search_fields_names(false);
38
39 $wpfms = (isset($_GET['wpfms'])) ? sanitize_text_field($_GET['wpfms']) : '';
40 if($wpfms){
41 $users_include = WPF()->member->search($wpfms, $search_fields_names);
42 }else{
43 if( $filters = array_filter($_GET) ){
44 $args = array();
45 foreach ($filters as $filter_key => $filter){
46 if( in_array($filter_key, (array) $search_fields_names) && !is_array($filter) ){
47 $args[$filter_key] = $filter;
48 }
49 }
50 $users_include = WPF()->member->filter($args);
51 }
52 }
53
54 $users_include = apply_filters('wpforo_member_search_users_include', $users_include);
55 }
56 $args = array(
57 'offset' => ($paged - 1) * WPF()->post->options['posts_per_page'],
58 'row_count' => WPF()->post->options['posts_per_page'],
59 'orderby' => 'posts',
60 'order' => 'DESC',
61 'groupids' => WPF()->usergroup->get_visible_usergroup_ids()
62 );
63 if(!empty($users_include)) $args['include'] = $users_include;
64 $items_count = 0;
65 $members = WPF()->member->get_members($args, $items_count);
66 if(isset($users_include) && empty($users_include)){ $members = array(); $items_count = 0; }
67
68 include( wpftpl('members.php') );
69 }elseif( isset(WPF()->member_tpls[$template]) && WPF()->member_tpls[$template] ){
70 include( wpftpl('profile.php') );
71 }else{
72 if( $template == 'forum' || $template == 'topic' ) : ?>
73 <?php if(!isset($forum_slug)) : ?>
74 <h1 id="wpforo-title">
75 <?php echo esc_html(WPF()->general_options['title']) ?>
76 <?php if( wpforo_feature('rss-feed') ): ?>
77 <div class="wpforo-feed">
78 <span class="wpf-feed-forums">
79 <a href="<?php WPF()->feed->rss2_url( true, 'forum' ); ?>" title="<?php wpforo_phrase('Forums RSS Feed') ?>" target="_blank">
80 <span><?php wpforo_phrase('Forums') ?></span> <i class="fas fa-rss wpfsx"></i>
81 </a>
82 </span><sep> | </sep>
83 <span class="wpf-feed-topics">
84 <a href="<?php WPF()->feed->rss2_url( true, 'topic' ); ?>" title="<?php wpforo_phrase('Topics RSS Feed') ?>" target="_blank">
85 <span><?php wpforo_phrase('Topics') ?></span> <i class="fas fa-rss wpfsx"></i>
86 </a>
87 </span>
88 </div>
89 <?php endif; ?>
90 </h1>
91 <?php endif; ?>
92 <?php $cats = WPF()->forum->get_forums( (isset($forum_slug) && $forum_slug != '' ? array( "parent_slug" => $forum_slug ) : array( "type" => 'category' ) ) ); ?>
93
94 <?php if(is_array($cats) && !empty($cats)) : ?>
95
96 <?php foreach($cats as $key => $cat) : ?>
97 <?php if( WPF()->perm->forum_can( 'vf', $cat['forumid'] ) ): ?>
98 <?php $forums = WPF()->forum->get_forums( array( "parentid" => $cat['forumid'], "type" => 'forum' ) ); ?>
99 <?php if(is_array($forums) && !empty($forums)) : ?>
100 <?php do_action( 'wpforo_category_loop_start', $cat, $key ) ?>
101 <?php include( wpftpl('layouts/'.($cat['cat_layout'] ? $cat['cat_layout'] : 1).'/forum.php') ); ?>
102 <?php do_action( 'wpforo_category_loop_end', $cat, $key ) ?>
103 <?php endif; ?>
104 <?php endif; //checking forum permissions (can view forum) ?>
105 <?php endforeach; //$cats as $cat ?>
106
107 <?php else : ?>
108 <p class="wpf-p-error"><?php wpforo_phrase('No forums were found here.') ?></p>
109 <?php endif; //is_array($cats) && !empty($cats) ?>
110 <?php if( $template == 'topic' ) : ?><div class="wpf-subforum-sep" style="height:20px;"></div><?php endif; ?>
111
112 <?php endif; //Forum template ?>
113
114 <?php if( $template == 'topic' ) : ?>
115 <?php if( is_array($cats) && !empty($cats) && $cat['is_cat'] == 0 ) : ?>
116
117 <?php if( isset($forum_slug) && $forum_slug ) : ?>
118
119 <?php $forum = WPF()->forum->get_forum( array( 'slug' => $forum_slug ) ); ?>
120
121 <?php if(is_array($forum) && !empty($forum)) : ?>
122
123 <?php if( WPF()->perm->forum_can( 'vf', $forum['forumid'] ) ): ?>
124
125 <div class="wpf-head-bar">
126 <div class="wpf-head-bar-left">
127 <h1 id="wpforo-title"><?php echo esc_html($forum['title']) ?></h1>
128 <?php if( $forum['description'] ): ?>
129 <div id="wpforo-description"><?php echo $forum['description'] ?></div>
130 <?php endif; ?>
131 <div class="wpf-action-link">
132 <?php WPF()->tpl->forum_subscribe_link() ?>
133 <?php if( wpforo_feature('rss-feed') ): ?>
134 <span class="wpf-feed">| <a href="<?php WPF()->feed->rss2_url(); ?>" title="<?php wpforo_phrase('Forum RSS Feed') ?>" target="_blank"><span style="text-transform: uppercase;"><?php wpforo_phrase('RSS') ?></span> <i class="fas fa-rss wpfsx"></i></a></span>
135 <?php endif; ?>
136 </div>
137 </div>
138 <?php if( WPF()->perm->forum_can( 'ct', $cat['forumid']) ): ?>
139 <div class="wpf-head-bar-right"><button class="wpf-button" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
140 <?php elseif( WPF()->current_user_groupid == 4 ) : ?>
141 <div class="wpf-head-bar-right"><button class="wpf-button not_reg_user" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
142 <?php endif; ?>
143 <div class="wpf-clear"></div>
144 </div>
145
146 <?php if( WPF()->perm->forum_can( 'ct', $forum['forumid'] ) ) WPF()->tpl->topic_form($forum['forumid']); ?>
147
148 <?php
149 $args = array(
150 'offset' => ($paged - 1) * WPF()->post->options['topics_per_page'],
151 'row_count' => WPF()->post->options['topics_per_page'],
152 'forumid' => $cat['forumid'],
153 'orderby' => 'type, modified',
154 'order' => 'DESC'
155 );
156 $items_count = 0;
157 $topics = WPF()->topic->get_topics( $args, $items_count );
158 ?>
159
160 <?php if( is_array($topics) && !empty($topics) ) : ?>
161
162 <?php WPF()->tpl->pagenavi($paged, $items_count, true, 'wpf-navi-topic-top'); ?>
163
164 <?php include( wpftpl('layouts/'.($cat['cat_layout'] ? $cat['cat_layout'] : 1).'/topic.php') ); ?>
165
166 <?php WPF()->tpl->pagenavi($paged, $items_count, true, 'wpf-navi-topic-bottom'); ?>
167
168 <?php else : ?>
169 <p class="wpf-p-error"><?php wpforo_phrase('No topics were found here') ?> </p>
170 <?php endif; ?>
171
172 <?php else : ?>
173 <p class="wpf-p-error"><?php wpforo_phrase('You don\'t have permissions to see this page, please register or login for further information') ?></p>
174 <?php endif; //chekcing permissions (can view forum) ?>
175
176 <?php else : ?>
177 <?php include( wpftpl('404.php') ) ?>
178 <?php endif; ?>
179
180 <?php else : ?>
181 <?php include( wpftpl('404.php') ) ?>
182 <?php endif; ?>
183
184 <?php endif; ?>
185 <?php endif; ?>
186
187 <?php if( $template == 'post' ) : ?>
188 <?php
189 if( is_array($forum) && !empty($forum) ) :
190
191 if( WPF()->perm->forum_can( 'vt', $forum['forumid'] ) ):
192
193 if( is_array($topic) && !empty($topic) ) : ?>
194
195 <?php $owner = wpforo_is_owner($topic['userid'], $topic['email']); ?>
196 <?php if( isset($topic['private']) && $topic['private'] && !$owner && !WPF()->perm->forum_can( 'vp', $forum['forumid'] ) ): ?>
197 <p class="wpf-p-error"><?php wpforo_phrase('Topic are private, please register or login for further information') ?></p>
198 <?php else: ?>
199
200 <?php
201 $cat_layout = WPF()->forum->get_layout( array( 'topicid' => $topic['topicid'] ) );
202 $args = array(
203 'offset' => ($paged - 1) * WPF()->post->options['posts_per_page'],
204 'row_count' => WPF()->post->options['posts_per_page'],
205 'topicid' => $topic['topicid'],
206 'forumid' => $forum['forumid'],
207 //'owner' => $owner
208 );
209 $items_count = 0;
210 $posts = WPF()->post->get_posts( $args, $items_count);
211 ?>
212
213 <?php if( is_array($posts) && !empty($posts) ) : ?>
214 <div class="wpf-head-bar">
215 <h1 id="wpforo-title"><?php $icon_title = WPF()->tpl->icon('topic', $topic, false, 'title'); if( $icon_title ) echo '<span class="wpf-status-title">[' . esc_html($icon_title) . ']</span> ' ?><?php echo esc_html( wpforo_text($topic['title'], 0, false) ) ?>&nbsp;&nbsp;</h1>
216 <div class="wpf-action-link"><?php WPF()->tpl->topic_subscribe_link() ?></div>
217 </div>
218
219 <?php WPF()->tpl->pagenavi( $paged, $items_count, true, 'wpf-navi-post-top' ); ?>
220
221 <?php include( wpftpl('layouts/'.($cat_layout ? $cat_layout : 1).'/post.php') ); ?>
222
223 <?php WPF()->tpl->pagenavi($paged, $items_count, true, 'wpf-navi-post-bottom'); ?>
224
225 <?php
226 if( WPF()->perm->forum_can( 'cr', $forum['forumid'] ) ) {
227 $default = array(
228 "topic_closed" => $topic['closed'],
229 "topicid" => $topic['topicid'],
230 "forumid" => $forum['forumid'],
231 "layout" => ($cat_layout ? $cat_layout : 1),
232 "topic_title" => wpforo_text($topic['title'], 0, false)
233 );
234 WPF()->tpl->reply_form( $default );
235 }
236 ?>
237 <?php else : ?>
238 <?php include( wpftpl('404.php') ) ?>
239 <?php endif; ?>
240
241 <?php endif; ?>
242
243 <?php else : ?>
244 <?php include( wpftpl('404.php') ) ?>
245 <?php endif; ?>
246
247 <?php else : ?>
248 <p class="wpf-p-error"><?php wpforo_phrase('You don\'t have permissions to see this page, please register or login for further information') ?></p>
249 <?php endif; //checking permission can view topic ?>
250
251 <?php else : ?>
252 <?php include( wpftpl('404.php') ) ?>
253 <?php endif ?>
254
255 <?php endif; ?>
256 <?php } ?>
257 </div>
258 <?php if (is_active_sidebar('forum-sidebar')) : ?>
259 <div class="wpforo-right-sidebar">
260 <?php dynamic_sidebar('forum-sidebar') ?>
261 </div>
262 <?php endif; ?>
263 <?php endif; ?>
264 <div class="wpf-clear"></div>
265 </div>
266 <?php include("footer.php") ?>
267
268 <?php if( WPF()->use_home_url ) get_footer() ?>