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

215 lines 11.1 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(is_array($forum) && !empty($forum)) : ?>
69
70 <?php if( $wpforo->perm->forum_can( 'vf', $forum['forumid'] ) ): ?>
71
72 <div class="wpf-head-bar">
73 <div class="wpf-head-bar-left">
74 <h2 id="wpforo-title"><?php echo esc_html($forum['title']) ?></h2>
75 <div class="wpf-action-link">
76 <?php if ( is_user_logged_in() ): ?>
77 <?php
78 $args = array( "userid" => $wpforo->current_userid , "itemid" => $forum['forumid'], "type" => "forum" );
79 $subscribe = $wpforo->sbscrb->get_subscribe( $args );
80 if( isset( $subscribe['subid'] ) ): ?>
81 <span class="wpf-unsubscribe-forum wpf-action" id="wpfsubscribe-<?php echo intval($forum['forumid']) ?>"><?php wpforo_phrase('Unsubscribe') ?></span>
82 <?php else: ?>
83 <span class="wpf-subscribe-forum wpf-action" id="wpfsubscribe-<?php echo intval($forum['forumid']) ?>"><?php wpforo_phrase('Subscribe for new topics') ?></span>
84 <?php endif; ?>
85 <?php endif; ?>
86 <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>
87 </div>
88 </div>
89 <?php if( $wpforo->perm->forum_can( 'ct', $cat['forumid']) ): ?>
90 <div class="wpf-head-bar-right"><button class="wpf-button" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
91 <?php elseif( $wpforo->current_user_groupid == 4 ) : ?>
92 <div class="wpf-head-bar-right"><button class="wpf-button not_reg_user" id="add_wpftopic"><?php wpforo_phrase('Add topic') ?></button></div>
93 <?php endif; ?>
94 <div class="wpf-clear"></div>
95 </div>
96
97 <?php if( is_user_logged_in() && $wpforo->perm->forum_can( 'ct', $cat['forumid'] ) ) $wpforo->tpl->topic_form($forum['forumid']); ?>
98
99 <?php
100 $args = array(
101 'offset' => ($paged - 1) * $wpforo->post_options['topics_per_page'],
102 'row_count' => $wpforo->post_options['topics_per_page'],
103 'forumid' => $cat['forumid'],
104 'orderby' => 'type, modified',
105 'order' => 'DESC'
106 );
107 $items_count = 0;
108 $topics = $wpforo->topic->get_topics( $args, $items_count );
109 ?>
110
111 <?php if( is_array($topics) && !empty($topics) ) : ?>
112
113 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
114
115 <?php include( wpftpl('layouts/'.($cat['cat_layout'] ? $cat['cat_layout'] : 1).'/topic.php') ); ?>
116
117 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
118
119 <?php else : ?>
120 <p class="wpf-p-error"><?php wpforo_phrase('No topics were found here') ?> </p>
121 <?php endif; ?>
122
123 <?php endif; //chekcing permissions (can view forum) ?>
124
125 <?php else : ?>
126 <?php include( wpftpl('404.php') ) ?>
127 <?php endif; ?>
128
129 <?php endif; ?>
130 <?php endif; ?>
131
132 <?php if( $template == 'post' ) : ?>
133 <?php
134 if( is_array($forum) && !empty($forum) ) :
135
136 if( $wpforo->perm->forum_can( 'vt', $forum['forumid'] ) ):
137 if( is_array($topic) && !empty($topic) ) :
138
139 $cat_layout = $wpforo->forum->get_layout( array( 'topicid' => $topic['topicid'] ) );
140
141 $args = array(
142 'offset' => ($paged - 1) * $wpforo->post_options['posts_per_page'],
143 'row_count' => $wpforo->post_options['posts_per_page'],
144 'topicid' => $topic['topicid']
145 );
146
147 $items_count = 0;
148 $posts = $wpforo->post->get_posts( $args, $items_count);
149 ?>
150
151 <?php if( is_array($posts) && !empty($posts) ) : ?>
152
153 <div class="wpf-head-bar">
154 <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>
155 <?php if ( is_user_logged_in() ): ?>
156 <div class="wpf-action-link">
157 <?php
158 $args = array( "userid" => $wpforo->current_userid , "itemid" => $topic['topicid'], "type" => "topic" );
159 $subscribe = $wpforo->sbscrb->get_subscribe( $args );
160 if( isset( $subscribe['subid'] ) ): ?>
161 <span class="wpf-unsubscribe-topic wpf-action" id="wpfsubscribe-<?php echo intval($topic['topicid']) ?>" ><?php wpforo_phrase('Unsubscribe') ?></span>
162 <?php else: ?>
163 <span class="wpf-subscribe-topic wpf-action" id="wpfsubscribe-<?php echo intval($topic['topicid']) ?>" ><?php wpforo_phrase('Subscribe for new replies') ?></span>
164 <?php endif; ?>
165 </div>
166 <?php endif; ?>
167 </div>
168
169 <?php $wpforo->tpl->pagenavi( $paged, $items_count ); ?>
170
171 <?php include( wpftpl('layouts/'.($cat_layout ? $cat_layout : 1).'/post.php') ); ?>
172
173 <?php $wpforo->tpl->pagenavi($paged, $items_count); ?>
174
175 <?php
176 if(is_user_logged_in()){
177 $default = array(
178 "topic_closed" => $topic['closed'],
179 "topicid" => $topic['topicid'],
180 "forumid" => $forum['forumid'],
181 "layout" => ($cat_layout ? $cat_layout : 1),
182 "topic_title" => $topic['title']
183 );
184 $wpforo->tpl->reply_form( $default );
185 }
186 ?>
187
188 <?php else : ?>
189 <?php include( wpftpl('404.php') ) ?>
190 <?php endif; ?>
191
192 <?php else : ?>
193 <?php include( wpftpl('404.php') ) ?>
194 <?php endif; ?>
195
196 <?php endif; //checking permission can view topic ?>
197
198 <?php else : ?>
199 <?php include( wpftpl('404.php') ) ?>
200 <?php endif ?>
201
202 <?php endif; ?>
203 <?php } ?>
204 </div>
205 <?php if (is_active_sidebar('forum-sidebar')) : ?>
206 <div class="wpforo-right-sidebar">
207 <?php dynamic_sidebar('forum-sidebar') ?>
208 </div>
209 <?php endif; ?>
210 <?php endif; ?>
211 <div class="wpf-clear"></div>
212 </div>
213 <?php include("footer.php") ?>
214
215 <?php if( $wpforo->use_home_url ) get_footer() ?>