Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

might help with login & not-authorized errors #462

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
2 changes: 1 addition & 1 deletion ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* This is the handler for Ajax httpXmlRequests.
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion autocomplete_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
* }
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
4 changes: 2 additions & 2 deletions events_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* TODO: hide private events of other users.
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';
require_once 'includes/classes/Event.php';
require_once 'includes/classes/RptEvent.php';
Expand All @@ -21,7 +22,6 @@
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand All @@ -33,8 +33,8 @@
// Load Doc classes for attachments and comments
require_once 'includes/classes/Doc.php';
require_once 'includes/classes/DocList.php';
require_once 'includes/classes/CommentList.php';
require_once 'includes/classes/AttachmentList.php';
require_once 'includes/classes/CommentList.php';

$WebCalendar->initializeSecondPhase();

Expand Down
2 changes: 1 addition & 1 deletion freebusy.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';
require_once 'includes/classes/Event.php';
require_once 'includes/classes/RptEvent.php';
Expand All @@ -50,7 +51,6 @@
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion icalclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@
*/

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
46 changes: 18 additions & 28 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,41 +796,31 @@ function date_selection($prefix, $date, $trigger = false, $num_years = 20)
}

/**
* Converts a date to a timestamp.
* date_to_epoch
*
* @param string $d Date in YYYYMMDD or YYYYMMDDHHIISS format
* @param bool $gmt Whether to use GMT or LOCAL
* Converts a date to a timestamp
*
* @return int Timestamp representing, in UTC or LOCAL time.
* @param mixed $d Date in YYYYMMDD or YYYYMMDDHHIISS format
* @param bool $gmt Whether to use GMT or LOCAL
*
* @return int timestamp representing, in UTC or LOCAL time
*/
function date_to_epoch( $d, $gmt = true ) {
if ( $d == 0 || $d === '' )
function date_to_epoch ( $d, $gmt = true ) {
if ( ! $d ) {
return 0;

$dH = $di = $ds = 0;
if ( strlen ( $d ) == 13 ) { // Hour value is single digit.
$dH = substr ( $d, 8, 1 );
$di = substr ( $d, 9, 2 );
$ds = substr ( $d, 11, 2 );
}
if ( strlen ( $d ) == 14 ) {
$dH = substr ( $d, 8, 2 );
$di = substr ( $d, 10, 2 );
$ds = substr ( $d, 12, 2 );
}

if ( $gmt )
return gmmktime ( $dH, $di, $ds,
(int)substr ( $d, 4, 2 ),
(int)substr ( $d, 6, 2 ),
(int)substr ( $d, 0, 4 ) );
else
return mktime ( $dH, $di, $ds,
(int)substr ( $d, 4, 2 ),
(int)substr ( $d, 6, 2 ),
(int)substr ( $d, 0, 4 ) );
}
$f = ( $gmt ? 'gm' : '' ) . 'mktime';

return $f (
(int) mb_substr ( $d, 8, ( mb_strlen ( $d ) === 13 ? 1 : 2 ) ),
(int) mb_substr ( $d, -4, 2 ),
(int) mb_substr ( $d, -2, 2 ),
(int) mb_substr ( $d, 4, 2 ),
(int) mb_substr ( $d, 6, 2 ),
(int) mb_substr ( $d, 0, 4 )
);
}

/**
* Converts a date in YYYYMMDD format into "Friday, December 31, 1999",
Expand Down
10 changes: 5 additions & 5 deletions includes/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
* 3. call the print_header function with proper arguments
*
* What gets called:
* - require_once 'includes/translate.php';
* - require_once 'includes/functions.php';
* - require_once 'includes/classes/WebCalendar.php';
* - require_once "includes/$user_inc";
* - require_once 'includes/access.php';
* - require_once 'includes/assert.php';
* - require_once 'includes/classes/Event.php';
* - require_once 'includes/classes/RptEvent.php';
* - require_once 'includes/classes/WebCalendar.php';
* - require_once 'includes/config.php';
* - require_once 'includes/dbi4php.php';
* - require_once 'includes/formvars.php';
* - require_once 'includes/functions.php';
* - require_once 'includes/site_extras.php';
* - require_once 'includes/translate.php';
* - require_once 'includes/validate.php';
*
* Also, for month.php, day.php, week.php, week_details.php:
Expand All @@ -49,17 +49,17 @@
}

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';
require_once 'includes/classes/Event.php';
require_once 'includes/classes/RptEvent.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/assert.php';
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion layers_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* Handler for AJAX requests from layers.php.
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion login-app.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

session_name(getSessionName());
@session_start();
Expand Down
2 changes: 1 addition & 1 deletion nulogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* This page handles logins for nonuser calendars.
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
*/

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion register.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
unset ( $_SESSION['webcalendar_session'] );

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
21 changes: 9 additions & 12 deletions rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,31 @@
*
* We do not include unapproved events in the RSS feed.
*
*
* TODO
* Add other RSS 2.0 options such as media.
* Add <managingEditor>: dan@spam_me.com (Dan Deletekey)
*/

$debug = false;

include_once 'includes/translate.php';
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';
require_once 'includes/classes/Event.php';
require_once 'includes/classes/RptEvent.php';

$WebCalendar = new WebCalendar( __FILE__ );

include 'includes/formvars.php';
include 'includes/functions.php';
include 'includes/config.php';
include 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';

$WebCalendar->initializeFirstPhase();

include 'includes/' . $user_inc;

include_once 'includes/validate.php';
include 'includes/site_extras.php';

include_once 'includes/xcal.php';
require_once "includes/$user_inc";
require_once 'includes/validate.php';
require_once 'includes/site_extras.php';
require_once 'includes/xcal.php';

$WebCalendar->initializeSecondPhase();

Expand Down
2 changes: 1 addition & 1 deletion rss_activity_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );
Expand All @@ -42,7 +43,6 @@
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion rss_unapproved.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*/

require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar( __FILE__ );
Expand All @@ -41,7 +42,6 @@
require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down
2 changes: 1 addition & 1 deletion users_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* and remotecal_mgmt.php.
*/
require_once 'includes/translate.php';
require_once 'includes/functions.php';
require_once 'includes/classes/WebCalendar.php';

$WebCalendar = new WebCalendar(__FILE__);

require_once 'includes/config.php';
require_once 'includes/dbi4php.php';
require_once 'includes/formvars.php';
require_once 'includes/functions.php';

$WebCalendar->initializeFirstPhase();

Expand Down