='2037' && $month>='12')) message($lang_calendar['date_error']); $days_in_mth = date("t", mktime(0, 0, 0, $month, 1, $year)) ; $dayfull = date("jS", mktime(0, 0, 0, $month, $day, $year)); $monthtext = date("F", mktime(0, 0, 0, $month, 1, $year)); $day_text = date("D", mktime(0, 0, 0, $month, 1, $year)); $day_of_wk = start_date(date('w', mktime(0, 0, 0, $month, 1, $year))); $type = (isset($_REQUEST['type']))? $_REQUEST['type'] : $configuration['o_cal_start_view'] ; $ltype = 'type='.$type.'&'; $view = (isset($_GET['view']))? $_GET['view'] : NULL ; $action = (isset($_GET['action']))? $_GET['action'] : NULL ; //$week = (isset($_GET['week']))? $_GET['week'] : NULL ; $week = (isset($_GET['week']))? strip_tags($_GET['week']) : NULL ; $month_start = mktime(0,0,0,$month,1,$year); $month_end = mktime(23,59,59,$month,$days_in_mth,$year); $datestart = mktime(0,0,0,$month,$day,$year); $dateend = mktime(23,59,59,$month,$day,$year); ?>
query('SELECT id FROM '.$db->prefix.'topics WHERE posted > '.$datestart.' AND posted < '.$dateend); $num_replies = $db->num_rows($result); $num_pages = ceil(($num_replies) / $disp_topics); $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p']; $start_from = $disp_topics * ($p - 1); $pages = paginate($num_pages, $p, 'calendar.php?view=topics&date='.$year.'.'.$month.'.'.$day); $result = $db->query(' SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.last_post_id, t.last_poster, t.moved_to, t.num_replies, t.closed, t.forum_id FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].') WHERE t.posted > '.$datestart.' AND t.posted < '.$dateend.' AND (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY posted LIMIT '.$start_from.','.$disp_topics ) or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error()); ?>

num_rows($result)) { while ($cur_topic = $db->fetch_assoc($result)) { if ($cur_topic['moved_to'] == null) $last_post = ''.format_time($cur_topic['last_post']).'
'.$lang_common['by'].' '.convert_htmlspecialchars($cur_topic['last_poster']); else $last_post = ' '; if ($configuration['o_censoring'] == '1') $cur_topic['subject'] = censor_words($cur_topic['subject']); if ($cur_topic['closed'] == '0') $subject = ''.convert_htmlspecialchars($cur_topic['subject']).''; else $subject = ''.convert_htmlspecialchars($cur_topic['subject']).''; ?> \n\t\t\t\t\n\t\t\t"; ?>
".$lang_calendar['No_Topics']."
query('SELECT id FROM '.$db->prefix.'posts WHERE posted > '.$datestart.' AND posted < '.$dateend); $num_replies = $db->num_rows($result); $num_pages = ceil(($num_replies) / $disp_posts); $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p']; $start_from = $disp_posts * ($p - 1); $pages = paginate($num_pages, $p, 'calendar.php?view=posts&date='.$year.'.'.$month.'.'.$day); $result = $db->query(' SELECT p.id, p.poster, p.poster_id, p.message, p.posted, p.topic_id, t.id as tid, t.subject as tsub, t.forum_id, f.id as fid, f.forum_name as fname FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id INNER JOIN '.$db->prefix.'forums AS f ON t.forum_id=f.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$forum_user['g_id'].') WHERE p.posted > '.$datestart.' AND p.posted < '.$dateend.' AND (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY p.posted LIMIT '.$start_from.','.$disp_posts )or error('Unable to fetch topic list for forum', __FILE__, __LINE__, $db->error()); ?>

num_rows($result)) { while ($cur_posts = $db->fetch_assoc($result)) { if (forum_strlen($cur_posts['message']) >= 80) { $cur_posts['message'] = substr($cur_posts['message'], 0, 79); $cur_posts['message'] .= '…'; } ?> \n\t\t\t\t\n\t\t\t"; ?>
 
:

".$lang_calendar['No_Posts']."
query('SELECT id, username, use_avatar, last_post, registered, birthday, DAYOFMONTH(birthday) as day FROM '.$db->prefix.'users WHERE DAYOFMONTH(birthday) = '.$day.' AND MONTH(birthday) = '.$month.' ORDER BY username') or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error()); ?>

num_rows($result)) { while($bday_list = $db->fetch_assoc($result)) { if ($bday_list['use_avatar'] == '1') { if ($img_size = @getimagesize($configuration['o_avatars_dir'].'/'.$bday_list['id'].'.gif')) $avatar = ''; else if ($img_size = @getimagesize($configuration['o_avatars_dir'].'/'.$bday_list['id'].'.jpg')) $avatar = ''; else if ($img_size = @getimagesize($configuration['o_avatars_dir'].'/'.$bday_list['id'].'.png')) $avatar = ''; else $avatar = $lang_profile['No avatar']; } else $avatar = $lang_profile['No avatar']; list($bday_year,$bday_month,$bday_day) = explode('-', $bday_list['birthday']); $age = (strlen($bday_year)!='4')? $lang_profile['Unknown']: $year-$bday_year; ?> \n\t\t\t\t\n\t\t\t\n"; ?>
".$lang_calendar['No_Bday']>"
query('SELECT e.id, e.date, e.title, e.user_id, e.body, u.username as username, u.num_posts as posts, u.registered as reg, g.g_title as group_id FROM '.$db->prefix.'calendar AS e INNER JOIN '.$db->prefix.'users AS u ON e.user_id=u.id LEFT JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id WHERE '.$stype) or error('Unable to fetch event list', __FILE__, __LINE__, $db->error()); ?>

num_rows($result)) { while($event_info = $db->fetch_assoc($result)) { $date_part = explode('-',$event_info['date']); $date = date("F jS", mktime(0,0,0,$date_part['1'],$date_part['2'], $date_part['0'])); if($date_part[0]=="0000") $date .= ' (Recuring Event)'; else $date .= ' '.$date_part[0].' (Single Day Event)'; ?> \n\t\t\t\t\n\t\t\t\n"; ?>
""
".$lang_calendar['No_Events']>"
', forum_linebreaks($_POST['body'])); if($_POST['year'] == 'Year') $_POST['year'] = date('Y'); $year=($_POST['year']=='0000')? date('Y'): $_POST['year']; if(date('t', mktime(0,0,0,$_POST['month'],1,$year))< $_POST['day']) message($lang_calendar['date_error']); $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day']; $db->query('INSERT INTO '.$db->prefix.'calendar (date, title, body, user_id) VALUES("'.$date.'", "'.$title.'", "'.$body.'", "'.$_POST['user_id'].'")') or error('Unable to create new event', __FILE__, __LINE__, $db->error()); redirect('calendar.php', $lang_calendar['event_added']); } else { ?>



', forum_linebreaks($_POST['body'])); if($_POST['year'] == 'Year') $_POST['year'] = date('Y'); $year=($_POST['year']=='0000')? date('Y'): $_POST['year']; if(date('t', mktime(0,0,0,$_POST['month'],1,$year))< $_POST['day']) message($lang_calendar['date_error']); $date = $_POST['year'].'-'.$_POST['month'].'-'.$_POST['day']; $db->query('UPDATE '.$db->prefix.'calendar SET date="'.$date.'", title="'.$title.'", body="'.$body.'" WHERE id='.$_POST['event_id']) or error('Unable to Update event', __FILE__, __LINE__, $db->error()); redirect('calendar.php?action=edit', $lang_calendar['event_edited']); } elseif(isset($_POST['delete_event'])) { if(isset($_POST['delete_confirmed'])) { $db->query('DELETE FROM '.$db->prefix.'calendar WHERE id ="'.$_POST['delete_event'].'"') or error('Unable to Delete event', __FILE__, __LINE__, $db->error()); redirect('calendar.php?action=edit', $lang_calendar['event_deleted']); } else { if(empty($_POST['event'])) message($lang_calendar['no_event']); $result = $db->query('SELECT date, title, body FROM '.$db->prefix.'calendar WHERE id = "'.$_POST['event'].'"') or error('Unable to fetch Event info', __FILE__, __LINE__, $db->error()); $cur_event = $db->fetch_assoc($result); ?>

query('SELECT * FROM '.$db->prefix.'calendar WHERE id ="'.$_POST['event'].'"') or error('Unable to fetch event information', __FILE__, __LINE__, $db->error()); $event_list = $db->fetch_assoc($result); $date = explode('-', $event_list['date']); ?>



query('SELECT id FROM '.$db->prefix.'calendar'); $num_replies = $db->num_rows($result); $num_pages = ceil(($num_replies) / $disp_posts); $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p']; $start_from = $disp_posts * ($p - 1); $pages = paginate($num_pages, $p, 'calendar.php?action=edit'); $result = $db->query('SELECT * FROM '.$db->prefix.'calendar '.$can_edit.' ORDER BY id LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch event information', __FILE__, __LINE__, $db->error()); if(!$db->num_rows($result)) { message($lang_calendar['no_events']); } ?>

fetch_assoc($result)) { $date_part = explode('-',$event_list['date']); $date_year = ($date_part['0']=='0000')? date('y') : $date_part['0']; $date = date("F jS", mktime(0,0,0,$date_part['1'],$date_part['2'],$date_year)); ?>
 
',$event_list['body'])?>
  
query('SELECT t.posted FROM '.$db->prefix.'topics as t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].') WHERE t.posted > '.$week_start.' AND t.posted < '.$week_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); $topic = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); while($topic_list = $db->fetch_row($result)) { $time = date("j",$topic_list[0]); $topic[$time]++; }; $result = $db->query('SELECT p.posted FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].') WHERE p.posted > '.$week_start.' AND p.posted < '.$week_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error()); $posts = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); while($post_list = $db->fetch_assoc($result)) { $time = date('j',$post_list['posted']); $posts[$time]++; }; } elseif($type == "events") { $result = $db->query('SELECT DAYOFMONTH(birthday) as day, username FROM '.$db->prefix.'users WHERE MONTH(birthday) = '.$month) or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error()); $bdays = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); while($bday_list = $db->fetch_assoc($result)) { if(count($bday_list)>6) $bdays[$bday_list['day']]++; else $bdays[$bday_list['day']] .="".$bday_list['username']."'s ".$lang_calendar['Birthday']."  "; }; $result = $db->query('SELECT id, title, DAYOFMONTH(date) as day FROM '.$db->prefix.'calendar WHERE MONTH(date) = '.$month.' AND (YEAR(date) = '.$year.' OR YEAR(date) = "0000")') or error('Unable to fetch calendar dates', __FILE__, __LINE__, $db->error()); $dates = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); while($dates_list = $db->fetch_assoc($result)) { $dates[$dates_list['day']] .= "".$dates_list['title']."  "; }; } ?>

\n\t\n\t

".$mth_name." ".$year_name."

\n\t
\n\t
\n"; $class = ($date_no == date('j') && $mth_name == date('F') && $year_name == date('Y'))? "class='calendar_day'" : ""; echo "\t\t\t\t\n"; echo "\t\t\t\t\n\t\t\t\t\t\n"; echo "\t\t\t\t\t\n\t\t\t\t\n\n"; } ?>
".$wk_name."
".$date_no.""; if(!empty($topic[$date_no]))echo"".$lang_calendar['Topics']." ".$topic[$date_no]."  "; if(!empty($posts[$date_no]))echo"".$lang_calendar['Posts']." ".$posts[$date_no]."  "; if(!empty($bdays[$date_no]) && is_int($bdays[$date_no])) echo"".$lang_calendar['Birthdays']." ".$bdays[$date_no]."
"; elseif(!empty($bdays[$date_no]) && !is_int($bdays[$date_no])) echo $bdays[$date_no];if(!empty($dates[$date_no]))echo $dates[$date_no]."  "; echo " 
query('SELECT t.posted FROM '.$db->prefix.'topics as t LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].') WHERE t.posted > '.$month_start.' AND t.posted < '.$month_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); $topic = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); while($topic_list = $db->fetch_row($result)) { $time = date("j",$topic_list[0]); $topic[$time]++; }; $result = $db->query('SELECT p.posted FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON p.topic_id=t.id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=t.forum_id AND fp.group_id='.$forum_user['g_id'].') WHERE p.posted > '.$month_start.' AND p.posted < '.$month_end.' AND (fp.read_forum IS NULL OR fp.read_forum=1)') or error('Unable to fetch posts list', __FILE__, __LINE__, $db->error()); $posts = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); while($post_list = $db->fetch_assoc($result)) { $time = date('j',$post_list['posted']); $posts[$time]++; }; } elseif($type == "events") { $result = $db->query('SELECT DAYOFMONTH(birthday) as day, username FROM '.$db->prefix.'users WHERE MONTH(birthday) = '.$month) or error('Unable to fetch birtday list', __FILE__, __LINE__, $db->error()); $bdays = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); while($bday_list = $db->fetch_assoc($result)) { if(count($bday_list)>3) $bdays[$bday_list['day']]++; else $bdays[$bday_list['day']] .="".$bday_list['username']."'s ".$lang_calendar['Birthday']."
"; }; $result = $db->query('SELECT id, title, DAYOFMONTH(date) as day FROM '.$db->prefix.'calendar WHERE MONTH(date) = '.$month.' AND (YEAR(date) = '.$year.' OR YEAR(date) = "0000")') or error('Unable to fetch calendar dates', __FILE__, __LINE__, $db->error()); $dates = array('','','','','','','','','','','','','','','','','','','','','','','','','','','','','','','',''); while($dates_list = $db->fetch_assoc($result)) { $dates[$dates_list['day']] .= "".$dates_list['title']."
"; }; } ?>

<– <— —> –>

0) { for ($i=0; $i<$day_of_wk; $i++) { echo "\t\t\t\t\n"; } } for ($date_of_mth = 1; $date_of_mth <= $days_in_mth; $date_of_mth++) { $date_no = date("j", mktime(0, 0, 0, $month, $date_of_mth, $year)); $day_of_wk = start_date(date('w', mktime(0, 0, 0, $month, $date_of_mth, $year))); $class = ($date_no == date("j") && $month == date("n") && $year == date("Y"))? " class='calendar_day'" : NULL ; echo "\t\t\t\t\n"; if ( $day_of_wk == 6 ) { if($date_no-5 > 0) { $date_link = date('W', mktime(0,0,0,$month,($date_no-5),$year)); $year_link = $year; } else { if($month-1 < 1) { $pre_year = $year-1; $pre_month = '12'; $pre_day = date('t', mktime(0,0,0,$pre_month,1,$pre_year))+($date_no-5)-1; } else { $pre_year = $year; $pre_month = $month-1; $pre_day = date('t', mktime(0,0,0,$pre_month,1,$pre_year))+($date_no-5); } $date_link = date('W', mktime(0,0,0,$pre_month,$pre_day,$pre_year)); $year_link = $pre_year; } if($year_link == date('Y')-1) $date_link = $date_link-1; elseif($year_link == date('Y')+1) $date_Link = $date_link+1; echo "\t\t\t\t\n"; echo "\t\t\t\n\t\t\t\n"; } if ( $day_of_wk < 6 && $date_of_mth == $days_in_mth ) { for ( $i = $day_of_wk ; $i < 6; $i++ ) { echo "\t\t\t\t\n"; } echo "\t\t\t\t\n"; echo "\t\t\t\n"; } if( $date_of_mth == $days_in_mth) break; } ?>
 
 ".$date_no."
"; if(!empty($topic[$date_no]))echo"".$lang_calendar['Topics']." ".$topic[$date_no]."
"; if(!empty($posts[$date_no]))echo"".$lang_calendar['Posts']." ".$posts[$date_no]."
"; if(!empty($bdays[$date_no]) && is_int($bdays[$date_no])) echo"".$lang_calendar['Birthdays']." ".$bdays[$date_no]."
"; elseif(!empty($bdays[$date_no]) && !is_int($bdays[$date_no])) echo $bdays[$date_no]."
"; if(!empty($dates[$date_no]))echo $dates[$date_no]."
"; echo "
«
 «
\n\t\n\t\n\t\t\n\t\n\t
\n"; mini_cal($month, $year, 'main'); echo "\t\t
\n"; } if (($forum_user['g_id'] == USER_MOD && $configuration['o_cal_mod_add']=='1') or ($forum_user['g_id'] == USER_MEMBER && $configuration['o_cal_user_add']=='1') or ($forum_user['g_id'] == USER_ADMIN)) echo "\t
\n\t

 ".$lang_calendar['Add_event']." | ".$lang_calendar['Edit_event']."

\n"; } ?>