forked from Kliqqi-CMS/Kliqqi-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroups.php
96 lines (74 loc) · 2.92 KB
/
groups.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
include_once('internal/Smarty.class.php');
$main_smarty = new Smarty;
include('config.php');
include(mnminclude.'html1.php');
include(mnminclude.'link.php');
include(mnminclude.'group.php');
include(mnminclude.'smartyvariables.php');
include mnminclude.'extra_fields_smarty.php';
$from_where = "1";
if (!checklevel('admin'))
$from_where .= " AND group_status = 'Enable' ";
elseif ($_REQUEST["approve"] && is_numeric($_REQUEST["approve"]))
$db->query("UPDATE ".table_groups." SET group_status='Enable' WHERE group_id=".$db->escape(sanitize($_REQUEST["approve"],3)));
$keyword = $db->escape(sanitize(trim($_REQUEST['keyword']), 3));
if ($keyword)
{
$from_where .= " AND (group_name LIKE '%$keyword%' OR group_description LIKE '%$keyword%')";
$main_smarty->assign('search', $keyword);
}
if($_REQUEST["sortby"])
{
$sortby = $_REQUEST["sortby"];
if($sortby == 'newest')
$order_by = "group_date DESC";
if($sortby == 'oldest')
$order_by = "group_date ASC";
if($sortby == 'members')
$order_by = "group_members DESC";
if($sortby == 'name')
$order_by = "group_name Asc";
$main_smarty->assign('sortby', $sortby);
}
$rows = $db->get_var("SELECT count(*) FROM " . table_groups . " WHERE group_status='Enable'");
$main_smarty->assign('total_row_for_group', $rows);
// pagename
define('pagename', 'groups');
$main_smarty->assign('pagename', pagename);
$main_smarty = do_sidebar($main_smarty);
group_read($from_where, $order_by);
function group_read($from_where,$order_by)
{
Global $db, $main_smarty, $view, $user, $rows, $page_size, $offset;
// figure out what "page" of the results we're on
$offset=(get_current_page()-1)*$page_size;
// pagesize set in the admin panel
$search->pagesize = $page_size;
if ($order_by == "")
$order_by = "group_date DESC";
include_once(mnminclude.'smartyvariables.php');
global $db,$main_smarty;
$rows = $db->get_var("SELECT count(*) FROM " . table_groups . " WHERE ".$from_where." ");
$group = $db->get_results("SELECT distinct(group_id) as group_id FROM " . table_groups . " WHERE ".$from_where." ORDER BY group_status DESC, ".$order_by." LIMIT $offset,$page_size ");
if ($group)
{
foreach($group as $groupid)
{
$group_display .= group_print_summary($groupid->group_id);
}
$main_smarty->assign('group_display', $group_display);
}
if(Auto_scroll==2 || Auto_scroll==3){
$main_smarty->assign("scrollpageSize", $page_size);
}else
$main_smarty->assign('group_pagination', do_pages($rows, $page_size, "groups", true));
return true;
}
//$main_smarty->assign("scrollpageSize", "1");
//For Infinit scrolling and continue reading option
$main_smarty->assign('link_pagination', do_pages($rows, $page_size, "published", true));
// show the template
$main_smarty->assign('tpl_center', $the_template . '/group_center');
$main_smarty->display($the_template . '/pligg.tpl');
?>