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
|
<?php
// ClanSphere 2009 - www.clansphere.net
// $Id$
$cs_lang = cs_translate('events');
$data = array();
$categories_id = empty($_REQUEST['where']) ? 0 : (int) $_REQUEST['where'];
$where = empty($categories_id) ? 0 : "categories_id = '" . $categories_id . "'";
$start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start'];
$cs_sort[1] = 'evs.events_time DESC';
$cs_sort[2] = 'evs.events_time ASC';
$cs_sort[3] = 'evs.events_name DESC';
$cs_sort[4] = 'evs.events_name ASC';
$sort = empty($_REQUEST['sort']) ? 1 : $_REQUEST['sort'];
$order = $cs_sort[$sort];
$count_all = cs_sql_count(__FILE__,'events',$where);
$data['head']['pages'] = cs_pages('events','list',$count_all,$start,$categories_id,$sort);
$cells = 'evs.events_name AS events_name, evs.events_pictures AS events_flyer, evs.events_url AS events_url, evs.events_time AS events_time, evs.events_venue AS events_venue, evs.events_cancel AS events_cancel';
$tables = 'events evs INNER JOIN {pre}_categories cat ON evs.categories_id = cat.categories_id';
$cond = 'evs.events_time > \'' . cs_time() . '\'';
$data['events_upcoming'] = cs_sql_select(__FILE__,$tables,$cells,$cond,$order,$start,$account['users_limit']);
$events_count = count($data['events_upcoming']);
$path = empty($cs_main['mod_rewrite']) ? '' : 'http://' . $_SERVER['HTTP_HOST'] . str_replace('index.php','',$_SERVER['PHP_SELF']);
for ($u = 0; $u < $events_count; $u++) {
$data['events_upcoming'][$u]['time'] = cs_date('unix',$data['events_upcoming'][$u]['events_time'],0,1);
$data['events_upcoming'][$u]['url'] = cs_secure($data['events_upcoming'][$u]['events_url']);
$data['events_upcoming'][$u]['if']['cancel'] = $data['events_upcoming'][$u]['events_cancel'] == 0 ? FALSE : TRUE;
$data['events_upcoming'][$u]['if']['pics'] = !empty($data['events_upcoming'][$u]['events_url']) ? TRUE : FALSE;
$data['events_upcoming'][$u]['flyer'] = cs_secure('uploads/events/picture-' . $data['events_upcoming'][$u]['events_flyer']);
$data['events_upcoming'][$u]['if']['flyer'] = !empty($data['events_upcoming'][$u]['events_flyer']) ? TRUE : FALSE;
}
$cells2 = 'evs.events_name AS events_name, evs.events_pictures AS events_flyer, evs.events_url AS events_url, evs.events_time AS events_time, evs.events_venue AS events_venue, evs.events_cancel AS events_cancel';
$tables2 = 'events evs INNER JOIN {pre}_categories cat ON evs.categories_id = cat.categories_id';
$cond2 = 'evs.events_time <= \'' . cs_time() . '\'';
$data['events'] = cs_sql_select(__FILE__,$tables2,$cells2,$cond2,$order,$start,$account['users_limit']);
$events_count2 = count($data['events']);
for ($i = 0; $i < $events_count2; $i++) {
$data['events'][$i]['time'] = cs_date('unix',$data['events'][$i]['events_time'],0,1);
$data['events'][$i]['url'] = cs_secure($data['events'][$i]['events_url']);
$data['events'][$i]['if']['cancel'] = $data['events'][$i]['events_cancel'] == 0 ? FALSE : TRUE;
$data['events'][$i]['if']['pics'] = !empty($data['events'][$i]['events_url']) ? TRUE : FALSE;
$data['events'][$i]['flyer'] = cs_secure('uploads/events/picture-' . $data['events'][$i]['events_flyer']);
$data['events'][$i]['if']['flyer'] = !empty($data['events'][$i]['events_flyer']) ? TRUE : FALSE;
}
echo cs_subtemplate(__FILE__, $data, 'events');
|