 |  |  | |
/*
+---------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
+---------------------------------------------------------------+
*/
//$ec_dir = e_PLUGIN."calendar_menu/";
$lan_file = $ec_dir."languages/".e_LANGUAGE.".php";
include(file_exists($lan_file) ? $lan_file : e_PLUGIN."calendar_menu/languages/English.php");
$datearray = getdate();
$current_day = $datearray['mday'];
$current_month = $datearray['mon'];
$current_year = $datearray['year'];
// get first and last days of month in unix format---------------------------------------------------
$monthstart= mktime(0,0,0,$current_month,1,$current_year);
$firstdayarray = getdate($monthstart);
$monthend = mktime(0,0,0,$current_month+1,0,$current_year);
$lastdayarray = getdate($monthend);
// ----------------------------------------------------------------------------------------------------------
// get events from current month----------------------------------------------------------------------
$sql -> db_Select("event", "*", "(event_start>='$monthstart' AND event_start<= '$monthend') OR (event_rec_y='$current_month')");
$events = $sql -> db_Rows();
while($row = $sql -> db_Fetch()){
extract($row);
$evf = getdate($event_start);
$tmp = $evf['mday'];
$event_true[$tmp] = $event_category;
}
// -----------------------------------------------------------------------------------------------------------
// set up arrays for calender display ------------------------------------------------------------------
$week = Array(EC_LAN_25,EC_LAN_19,EC_LAN_20,EC_LAN_21,EC_LAN_22,EC_LAN_23,EC_LAN_24);
$months = Array(EC_LAN_0,EC_LAN_1,EC_LAN_2,EC_LAN_3,EC_LAN_4,EC_LAN_5,EC_LAN_6,EC_LAN_7,EC_LAN_8,EC_LAN_9,EC_LAN_10,EC_LAN_11);
$calendar_title = $months[$datearray[mon]-1]." ".$current_year;
// -----------------------------------------------------------------------------------------------------------
$text = "";
if($events){
$text .= EC_LAN_26 . ": ".$events;
}else{
$text .= EC_LAN_27;
}
$start = $monthstart;
$text .= "
";
foreach($week as $day){
$text .= "| ".$day." | ";
}
$text .= " ";
$thismonth = $datearray['mon'];
$thisday = $datearray['mday'];
for($c=0; $c<$firstdayarray['wday']; $c++){
$text .= "
| ";
}
$loop = $firstdayarray['wday'];
for($c=1; $c<=31; $c++){
$dayarray = getdate($start+($c*84460));
if($dayarray['mon'] == $thismonth){
if($thisday == $c){
$text .= "";
}else{
$text .=" | ";
}
if($event_true[($c)]){
$sql -> db_Select("event_cat", "*", "event_cat_id='".$event_true[($c)]."' ");
$icon = $sql -> db_Fetch();
extract($icon);
$img = " ";
}else{
$img = " ";
}
$linkut = mktime(0 ,0 ,0 ,$dayarray['mon'], $c, $datearray['year']);
$text .="$img $c";
if($thisday == $c){
}
$text .= " | \n";
$loop++;
if($loop == 7){
$loop = 0;
$text .= " ";
}
}
}
for($a=($loop+1); $a<=7; $a++){
$text .="| | ";
}
$text .= "
";
$ns -> tablerender($calendar_title, $text);
?>
| |
unset($text);
if(!e_QUERY){
// no qs - render categories ...
if(!$sql -> db_Select("download_category", "*", "download_category_parent='0' ")){
$ns -> gen_tablerend(LAN_dl_18, " ".LAN_dl_2." ");
?>
|
addSearch($ns);
?>
|
require_once(FOOTERF);
exit;
}else{
$text = "
| |
".LAN_dl_19." |
".LAN_dl_20." |
".LAN_dl_21." |
".LAN_dl_18." |
";
$sql2 = new db; $sql3 = new db;
while($row = $sql-> db_Fetch()){
extract($row);
if(($download_category_class && check_class($download_category_class)) || !$download_category_class || ($download_category_class == 254 && USER) ){
$text .= " ";
$parent_status == "open";
}else{
$parent_status == "closed";
}
$categories = $sql2 -> db_Select("download_category", "*", "download_category_parent='".$download_category_id."' ");
if(!$categories){
$text .= " ";
}else{
while($row = $sql2-> db_Fetch()){
extract($row);
$total_filesize=0; $total_downloadcount=0;
if($filecount = $sql3 -> db_Select("download", "*", "download_category='$download_category_id'")){
while($row = $sql3 -> db_Fetch()){
extract($row);
$total_filesize += $download_filesize;
$total_downloadcount += $download_requested;
}
$total_filesize = parsesize($total_filesize);
}
$new = (USER && $sql3 -> db_Count("download", "(*)", "WHERE download_category='$download_category_id' AND download_datestamp>".USERLV) ? " " : "");
if(!$download_category_class || ($download_category_class && check_class($download_category_class))){
$text .= "
";
}
}
}
}
$text .= "
 ".LAN_dl_36."
";
$ns -> gen_tablerend(LAN_dl_18.$type, $text);
?>
|
addSearch($ns);
?>
|
require_once(FOOTERF);
exit;
}
}
$tmp = explode(".", e_QUERY);
if(is_numeric($tmp[0])){
$from = $tmp[0];
$action = $tmp[1];
$id = $tmp[2];
$view = $tmp[3];
$order = $tmp[4];
$sort = $tmp[5];
}else{
$action = $tmp[0];
$id = $tmp[1];
}
if($action == "list"){
if(IsSet($_POST['view'])){
extract($_POST);
}
if(!$from) $from=0;
if(!$order) $order = "download_datestamp";
if(!$sort) $sort = "DESC";
if(!$view) $view = 10;
$total_downloads = $sql -> db_Select("download", "*", "download_category='$id' AND download_active='1'");
if(!$total_downloads){ require_once(FOOTERF); exit; }
$sql -> db_Select("download_category", "*", "download_category_id='$id'");
$row = $sql -> db_Fetch(); extract($row);
$core_total = $sql -> db_Count("download WHERE download_category='$id' AND download_active=1");
$type = $download_category_name." [ ".$download_category_description." ]";
$text = "";
$ns -> gen_tablerend($type, $text);
echo "";
require_once(e_HANDLER."np_class.php");
$ix = new nextprev("download.php", $from, $view, $total_downloads, "Downloads", "list.".$id.".".$view.".".$order.".".$sort);
?>
|
addSearch($ns);
?>
|