PluginProbe
wpForo Forum / 1.4.0
wpForo Forum v1.4.0
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.0, at wpf-themes/classic/index.php

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