PageRenderTime 64ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/phpical2/month.php

https://gitlab.com/endomorphosis/fusenews
PHP | 143 lines | 121 code | 17 blank | 5 comment | 17 complexity | 3fb947438afb58321d26d0e36b1b6e84 MD5 | raw file
  1. <?php
  2. define('BASE', './');
  3. $current_view = "month";
  4. require_once(BASE.'functions/ical_parser.php');
  5. require_once(BASE.'functions/list_functions.php');
  6. require_once(BASE.'functions/template.php');
  7. header("Content-Type: text/html; charset=$phpiCal_config->charset");
  8. if ($phpiCal_config->minical_view == 'current') $minical_view = 'month';
  9. $unix_time = strtotime($getdate);
  10. $today_today = date('Ymd', time() + $phpiCal_config->second_offset);
  11. $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time));
  12. $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time));
  13. $sidebar_date = localizeDate($dateFormat_week_list, $unix_time);
  14. if (!isset($style_select)) $style_select = '';
  15. // find out next month
  16. $next_month_month = ($this_month+1 == '13') ? '1' : ($this_month+1);
  17. $next_month_day = $this_day;
  18. $next_month_year = ($next_month_month == '1') ? ($this_year+1) : $this_year;
  19. while (!checkdate($next_month_month,$next_month_day,$next_month_year)) $next_month_day--;
  20. $next_month_time = mktime(0,0,0,$next_month_month,$next_month_day,$next_month_year);
  21. // find out last month
  22. $prev_month_month = ($this_month-1 == '0') ? '12' : ($this_month-1);
  23. $prev_month_day = $this_day;
  24. $prev_month_year = ($prev_month_month == '12') ? ($this_year-1) : $this_year;
  25. while (!checkdate($prev_month_month,$prev_month_day,$prev_month_year)) $prev_month_day--;
  26. $prev_month_time = mktime(0,0,0,$prev_month_month,$prev_month_day,$prev_month_year);
  27. $next_month = date("Ymd", $next_month_time);
  28. $prev_month = date("Ymd", $prev_month_time);
  29. $display_date = localizeDate ($dateFormat_month, $unix_time);
  30. $parse_month = date ("Ym", $unix_time);
  31. $first_of_month = $this_year.$this_month."01";
  32. $start_month_day = dateOfWeek($first_of_month, $phpiCal_config->week_start_day);
  33. $thisday2 = localizeDate($dateFormat_week_list, $unix_time);
  34. $num_of_events2 = 0;
  35. // select for calendars
  36. $list_icals = display_ical_list(availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED));
  37. $list_years = list_years();
  38. $list_months = list_months();
  39. $list_weeks = list_weeks();
  40. $list_jumps = list_jumps();
  41. $list_calcolors = list_calcolors();
  42. $list_icals_pick = display_ical_list(availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED), TRUE);
  43. // login/logout
  44. $is_logged_in = ($username != '' && !$invalid_login) ? true : false;
  45. $show_user_login = (!$is_logged_in && $phpiCal_config->allow_login == 'yes');
  46. $login_querys = login_querys();
  47. $logout_querys = logout_querys();
  48. $page = new Page(BASE.'templates/'.$phpiCal_config->template.'/month.tpl');
  49. $page->replace_files(array(
  50. 'header' => BASE.'templates/'.$phpiCal_config->template.'/header.tpl',
  51. 'event_js' => BASE.'functions/event.js',
  52. 'footer' => BASE.'templates/'.$phpiCal_config->template.'/footer.tpl',
  53. 'calendar_nav' => BASE.'templates/'.$phpiCal_config->template.'/calendar_nav.tpl',
  54. 'search_box' => BASE.'templates/'.$phpiCal_config->template.'/search_box.tpl'
  55. ));
  56. $page->replace_tags(array(
  57. 'version' => $phpiCal_config->phpicalendar_version,
  58. 'charset' => $phpiCal_config->charset,
  59. 'template' => $phpiCal_config->template,
  60. 'cal' => $cal,
  61. 'getdate' => $getdate,
  62. 'getcpath' => "&cpath=$cpath",
  63. 'cpath' => $cpath,
  64. 'calendar_name' => $cal_displayname,
  65. 'display_date' => $display_date,
  66. 'rss_powered' => $rss_powered,
  67. 'default_path' => $phpiCal_config->default_path,
  68. 'rss_available' => '',
  69. 'rss_valid' => '',
  70. 'show_search' => $phpiCal_config->show_search,
  71. 'next_month' => $next_month,
  72. 'prev_month' => $prev_month,
  73. 'show_goto' => '',
  74. 'show_user_login' => $show_user_login,
  75. 'invalid_login' => $invalid_login,
  76. 'login_querys' => $login_querys,
  77. 'is_logged_in' => $is_logged_in,
  78. 'username' => $username,
  79. 'logout_querys' => $logout_querys,
  80. 'list_jumps' => $list_jumps,
  81. 'list_icals' => $list_icals,
  82. 'list_icals_pick' => $list_icals_pick,
  83. 'list_years' => $list_years,
  84. 'list_months' => $list_months,
  85. 'list_weeks' => $list_weeks,
  86. 'legend' => $list_calcolors,
  87. 'current_view' => $current_view,
  88. # 'style_select' => $style_select,
  89. 'sidebar_date' => $sidebar_date,
  90. 'l_goprint' => $lang['l_goprint'],
  91. 'l_preferences' => $lang['l_preferences'],
  92. 'l_calendar' => $lang['l_calendar'],
  93. 'l_legend' => $lang['l_legend'],
  94. 'l_tomorrows' => $lang['l_tomorrows'],
  95. 'l_jump' => $lang['l_jump'],
  96. 'l_todo' => $lang['l_todo'],
  97. 'l_day' => $lang['l_day'],
  98. 'l_week' => $lang['l_week'],
  99. 'l_month' => $lang['l_month'],
  100. 'l_year' => $lang['l_year'],
  101. 'l_subscribe' => $lang['l_subscribe'],
  102. 'l_download' => $lang['l_download'],
  103. 'l_this_months' => $lang['l_this_months'],
  104. 'l_search' => $lang['l_search'],
  105. 'l_pick_multiple' => $lang['l_pick_multiple'],
  106. 'l_powered_by' => $lang['l_powered_by'],
  107. 'l_this_site_is' => $lang['l_this_site_is']
  108. ));
  109. if ($phpiCal_config->allow_preferences != 'yes') {
  110. $page->replace_tags(array(
  111. 'allow_preferences' => ''
  112. ));
  113. }
  114. if ($phpiCal_config->allow_login == 'yes') {
  115. $page->replace_tags(array(
  116. 'l_invalid_login' => $lang['l_invalid_login'],
  117. 'l_password' => $lang['l_password'],
  118. 'l_username' => $lang['l_username'],
  119. 'l_login' => $lang['l_login'],
  120. 'l_logout' => $lang['l_logout']
  121. ));
  122. }
  123. $page->nomonthbottom($page);
  124. $page->draw_subscribe($page);
  125. $page->output();
  126. ?>