93 lines
3.0 KiB
PHP
93 lines
3.0 KiB
PHP
<?php
|
|
|
|
/* $Id: browse_groups.php 80 2009-03-06 02:46:35Z john $ */
|
|
|
|
$page = "adopt_groups";
|
|
|
|
include "header.php";
|
|
|
|
// DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION
|
|
if( (!$user->user_exists && !$setting['setting_permission_group']) || ($user->user_exists && (~(int)$user->level_info['level_group_allow'] & 1)) )
|
|
{
|
|
$page = "error";
|
|
$smarty->assign('error_header', 639);
|
|
$smarty->assign('error_message', 656);
|
|
$smarty->assign('error_submit', 641);
|
|
include "footer.php";
|
|
}
|
|
|
|
|
|
// PARSE GET/POST
|
|
if(isset($_POST['p'])) { $p = $_POST['p']; } elseif(isset($_GET['p'])) { $p = $_GET['p']; } else { $p = 1; }
|
|
if(isset($_POST['s'])) { $s = $_POST['s']; } elseif(isset($_GET['s'])) { $s = $_GET['s']; } else { $s = "group_datecreated DESC"; }
|
|
if(isset($_POST['v'])) { $v = $_POST['v']; } elseif(isset($_GET['v'])) { $v = $_GET['v']; } else { $v = 0; }
|
|
if(isset($_POST['group_search'])) { $group_search = $_POST['group_search']; } elseif(isset($_GET['group_search'])) { $group_search = $_GET['group_search']; } else { $group_search = NULL; }
|
|
|
|
if(isset($_POST['groupcat_id'])) { $groupcat_id = $_POST['groupcat_id']; } elseif(isset($_GET['groupcat_id'])) { $groupcat_id = $_GET['groupcat_id']; } else { $groupcat_id = 0; }
|
|
|
|
// ENSURE SORT/VIEW ARE VALID
|
|
if($s != "group_datecreated DESC" && $s != "group_totalmembers DESC"&& $s != "group_title ASC") { $s = "group_datecreated DESC"; }
|
|
if($v != "0" && $v != "1") { $v = 0; }
|
|
|
|
|
|
// SET WHERE CLAUSE
|
|
$where = "se_groups.adoption=1";
|
|
|
|
|
|
|
|
|
|
|
|
// CREATE GROUP OBJECT
|
|
$group = new se_group();
|
|
|
|
// GET TOTAL GROUPS
|
|
$total_groups = $group->group_total($where);
|
|
|
|
// MAKE ENTRY PAGES
|
|
$groups_per_page = 1000;
|
|
$page_vars = make_page($total_groups, $groups_per_page, $p);
|
|
|
|
// GET GROUP ARRAY
|
|
$group_array = $group->group_list($page_vars[0], $groups_per_page, $s, $where, TRUE);
|
|
$rand=rand(1, $group->group_media_total1()-56);
|
|
|
|
$group_files = $group->group_media_list1($rand, 65, $sort_by = "groupmedia_date DESC", $where = "");
|
|
//var_dump($group_files);
|
|
|
|
|
|
// GET CATS
|
|
$field = new se_field("group");
|
|
$field->cat_list(0, 0, 0, "", "", "groupfield_id=0");
|
|
$cat_array = $field->cats;
|
|
|
|
// SET GLOBAL PAGE TITLE
|
|
$global_page_title[0] = 2000324;
|
|
$global_page_description[0] = 2000325;
|
|
for($x=$page_vars[1]; $x<=$page_vars[2]; $x++)
|
|
{
|
|
|
|
if(($page_vars[1]+10)==$x)
|
|
{break;}
|
|
$for[$y]=$x;
|
|
$y++;
|
|
}
|
|
|
|
$smarty->assign_by_ref('ipaddress', $_SERVER['REMOTE_ADDR']);
|
|
$smarty->assign_by_ref('signups', $group_files);
|
|
$smarty->assign('for', $for);
|
|
// ASSIGN SMARTY VARIABLES AND DISPLAY GROUPS PAGE
|
|
$smarty->assign('groupcat_id', $groupcat_id);
|
|
$smarty->assign('group_search', $group_search);
|
|
$smarty->assign('groupcat', $groupcat);
|
|
$smarty->assign('groupsubcat', $groupsubcat);
|
|
$smarty->assign('cats', $cat_array);
|
|
$smarty->assign('groups', $group_array);
|
|
$smarty->assign('total_groups', $total_groups);
|
|
$smarty->assign('p', $page_vars[1]);
|
|
$smarty->assign('maxpage', $page_vars[2]);
|
|
$smarty->assign('p_start', $page_vars[0]+1);
|
|
$smarty->assign('p_end', $page_vars[0]+count($group_array));
|
|
$smarty->assign('s', $s);
|
|
$smarty->assign('v', $v);
|
|
include "footer.php";
|
|
?>
|