PluginProbe
wpForo Forum / 1.2.0
wpForo Forum v1.2.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.2.0, at wpf-themes/classic/index.php

227 lines 14.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( $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 == 'members'){
26 $wpfms = (isset($_GET['wpfms'])) ? sanitize_text_field($_GET['wpfms']) : '';
27 if($wpfms){
28 $users_include = $wpforo->member->search($wpfms, array('user_nicename', 'user_email', 'display_name', 'title'));
29 }
30 $args = array(
31 'offset' => ($paged - 1) * $wpforo->post_options['posts_per_page'],
32 'row_count' => $wpforo->post_options['posts_per_page'],
33 'orderby' => 'posts DESC, display_name'
34 );
35 if(!empty($users_include)) $args['include'] = $users_include;
36 $items_count = 0;
37 $members = $wpforo->member->get_members($args, $items_count);
38 if(isset($users_include) && empty($users_include)){ $members = array(); $items_count = 0; }
39
40 include( wpftpl('members.php') );
41 }elseif( isset($wpforo->member_tpls[$template]) && $wpforo->member_tpls[$template] ){
42 include( wpftpl('profile.php') );
43 }else{
44 if( $template == 'forum' || $template == 'topic' ) : ?>
45 <?php if(!isset($forum_slug)) : ?><h2 id="wpforo-title"><?php echo esc_html($wpforo->general_options['title']) ?></h2><?php endif; ?>
46 <?php $cats = $wpforo->forum->get_forums( (isset($forum_slug) && $forum_slug != '' ? array( "parent_slug" => $forum_slug ) : array( "type" => 'category' ) ) ); ?>
47
48 <?php if(is_array($cats) && !empty($cats)) : ?>
49
50 <?php foreach($cats as $cat) : ?>
51 <?php if( $wpforo->perm->forum_can( 'vf', $cat['forumid'] ) ): ?>
52 <?php $forums = $wpforo->forum->get_forums( array( "parentid" => $cat['forumid'], "type" => 'forum' ) ); ?>
53 <?php if(is_array($forums) && !empty($forums)) : ?>
54 <?php include( wpftpl('layouts/'.($cat['cat_layout'] ? $cat['cat_layout'] : 1).'/forum.php') ); ?>
55 <?php endif; ?>
56 <?php endif; //checking forum permissions (can view forum) ?>
57 <?php endforeach; //$cats as $cat ?>
58
59 <?php else : ?>
60 <p class="wpf-p-error"><?php wpforo_phrase('No forums were found here.') ?></p>
61 <?php endif; //is_array($cats) && !empty($cats) ?>
62
63 <?php endif; //Forum template ?>
64
65 <?php if( $template == 'topic' ) : ?>
66 <?php if( is_array($cats) && !empty($cats) && $cat['is_cat'] == 0 ) : ?>
67
68 <?php if( isset($forum_slug) && $forum_slug ) : ?>
69
70 <?php $forum = $wpforo->forum->get_forum( array( 'slug' => $forum_slug ) ); ?>
71
72 <?php if(is_array($forum) && !empty($forum)) : ?>
73
74 <?php if( $wpforo->perm->forum_can( 'vf', $forum['forumid'] ) ): ?>
75
76 <div class="wpf-head-bar">
77 <div class="wpf-head-bar-left">
78 <h2 id="wpforo-title"><?php echo esc_html($forum['title']) ?></h2>
79 <div class="wpf-action-link">
80 <?php if ( is_user_logged_in() ): ?>
81 <?php
82 $args = array( "userid" => $wpforo->current_userid , "itemid" => $forum['forumid'], "type" => "forum" );
83 $subscribe = $wpforo->sbscrb->get_subscribe( $args );
84 if( isset( $subscribe['subid'] ) ): ?>
85 <span class="wpf-unsubscribe-forum wpf-action" id="wpfsubscribe-<?php echo intval($forum['forumid']) ?>"><?php wpforo_phrase('Unsubscribe') ?></span>
86 <?php else: ?>
87 <span class="wpf-subscribe-forum wpf-action" id="wpfsubscribe-<?php echo intval($forum['forumid']) ?>"><?php wpforo_phrase('Subscribe for new topics') ?></span>
88 <?php endif; ?>
89 <?php endif; ?>
90 <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>
91 </div>
92 </div>
93 <?php if( $wpforo->perm->forum_can( 'ct', $cat['forumid']) ): ?>
94 <div class="wpf-head-bar-right"><button class="wpf-button" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
95 <?php elseif( $wpforo->current_user_groupid == 4 ) : ?>
96 <div class="wpf-head-bar-right"><button class="wpf-button not_reg_user" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
97 <?php endif; ?>
98 <div class="wpf-clear"></div>
99 </div>
100
101 <?php if( is_user_logged_in() && $wpforo->perm->forum_can( 'ct', $cat['forumid'] ) ) $wpforo->tpl->topic_form($forum['forumid']); ?>
102
103 <?php
104 $args = array(
105 'offset' => ($paged - 1) * $wpforo->post_options['topics_per_page'],
106 'row_count' => $wpforo->post_options['topics_per_page'],
107 'forumid' => $cat['forumid'],
108 'orderby' => 'type, modified',
109 'order' => 'DESC'
110 );
111 $items_count = 0;
112 $topics = $wpforo->topic->get_topics( $args, $items_count );
113 ?>
114
115 <?php if( is_array($topics) && !empty($topics) ) : ?>
116
117 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
118
119 <?php include( wpftpl('layouts/'.($cat['cat_layout'] ? $cat['cat_layout'] : 1).'/topic.php') ); ?>
120
121 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
122
123 <?php else : ?>
124 <p class="wpf-p-error"><?php wpforo_phrase('No topics were found here') ?> </p>
125 <?php endif; ?>
126
127 <?php endif; //chekcing permissions (can view forum) ?>
128
129 <?php else : ?>
130 <?php include( wpftpl('404.php') ) ?>
131 <?php endif; ?>
132
133 <?php else : ?>
134 <?php include( wpftpl('404.php') ) ?>
135 <?php endif; ?>
136
137 <?php endif; ?>
138 <?php endif; ?>
139
140 <?php if( $template == 'post' ) : ?>
141 <?php
142 if( is_array($forum) && !empty($forum) ) :
143
144 if( $wpforo->perm->forum_can( 'vt', $forum['forumid'] ) ):
145
146 if( is_array($topic) && !empty($topic) ) : ?>
147
148 <?php if( isset($topic['private']) && $topic['private'] && !wpforo_is_owner($topic['userid']) && !$wpforo->perm->forum_can( 'vp', $forum['forumid'] ) ): ?>
149 <p class="wpf-p-error"><?php wpforo_phrase('Permission denied') ?></p>
150 <?php else: ?>
151
152 <?php
153 $cat_layout = $wpforo->forum->get_layout( array( 'topicid' => $topic['topicid'] ) );
154 $args = array(
155 'offset' => ($paged - 1) * $wpforo->post_options['posts_per_page'],
156 'row_count' => $wpforo->post_options['posts_per_page'],
157 'topicid' => $topic['topicid']
158 );
159 $items_count = 0;
160 $posts = $wpforo->post->get_posts( $args, $items_count);
161 ?>
162
163 <?php if( is_array($posts) && !empty($posts) ) : ?>
164 <div class="wpf-head-bar">
165 <h2 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;</h2>
166 <?php if ( is_user_logged_in() ): ?>
167 <div class="wpf-action-link">
168 <?php
169 $args = array( "userid" => $wpforo->current_userid , "itemid" => $topic['topicid'], "type" => "topic" );
170 $subscribe = $wpforo->sbscrb->get_subscribe( $args );
171 if( isset( $subscribe['subid'] ) ): ?>
172 <span class="wpf-unsubscribe-topic wpf-action" id="wpfsubscribe-<?php echo intval($topic['topicid']) ?>" ><?php wpforo_phrase('Unsubscribe') ?></span>
173 <?php else: ?>
174 <span class="wpf-subscribe-topic wpf-action" id="wpfsubscribe-<?php echo intval($topic['topicid']) ?>" ><?php wpforo_phrase('Subscribe for new replies') ?></span>
175 <?php endif; ?>
176 </div>
177 <?php endif; ?>
178 </div>
179
180 <?php $wpforo->tpl->pagenavi( $paged, $items_count ); ?>
181
182 <?php include( wpftpl('layouts/'.($cat_layout ? $cat_layout : 1).'/post.php') ); ?>
183
184 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
185
186 <?php
187 if(is_user_logged_in()){
188 $default = array(
189 "topic_closed" => $topic['closed'],
190 "topicid" => $topic['topicid'],
191 "forumid" => $forum['forumid'],
192 "layout" => ($cat_layout ? $cat_layout : 1),
193 "topic_title" => $topic['title']
194 );
195 $wpforo->tpl->reply_form( $default );
196 }
197 ?>
198 <?php else : ?>
199 <?php include( wpftpl('404.php') ) ?>
200 <?php endif; ?>
201
202 <?php endif; ?>
203
204 <?php else : ?>
205 <?php include( wpftpl('404.php') ) ?>
206 <?php endif; ?>
207
208 <?php endif; //checking permission can view topic ?>
209
210 <?php else : ?>
211 <?php include( wpftpl('404.php') ) ?>
212 <?php endif ?>
213
214 <?php endif; ?>
215 <?php } ?>
216 </div>
217 <?php if (is_active_sidebar('forum-sidebar')) : ?>
218 <div class="wpforo-right-sidebar">
219 <?php dynamic_sidebar('forum-sidebar') ?>
220 </div>
221 <?php endif; ?>
222 <?php endif; ?>
223 <div class="wpf-clear"></div>
224 </div>
225 <?php include("footer.php") ?>
226
227 <?php if( $wpforo->use_home_url ) get_footer() ?>