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

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