Skip to content

Commit

Permalink
pre-figure math
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannon committed Mar 12, 2024
1 parent cc9a5f6 commit f5da566
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion export.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

$datem = date ( 'm' );
$dateY = date ( 'Y' );
$yearAgo = time () - 365 * 24 * 3600;
$yearAgo = time () - 31536000; // 365 * 24 * 3600;
$dateYearAgo = date('Ymd', $yearAgo);
$selected = ' selected ';

Expand Down
2 changes: 1 addition & 1 deletion import_outlookcsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function parse_outlookcsv ( $cal_file ) {
}

function dateDifference ( $start_timestamp, $end_timestamp, $unit = 0 ) {
$days_seconds_star = ( 23 * 56 * 60 ) + 4.091; // Star Day
$days_seconds_star = 77284.091; // Star Day ( 23 * 56 * 60 ) + 4.091
$days_seconds_sun = 86400; // Sun Day
$difference_seconds = $end_timestamp - $start_timestamp;
switch ( $unit ) {
Expand Down
22 changes: 11 additions & 11 deletions includes/classes/Doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,71 @@
*/
class Doc {
/**
* The unique id
* The unique id
* @var int
* @access private
*/
var $_blob_id;

/**
* Associated event's id (if any)
* Associated event's id (if any)
* @var int
* @access private
*/
var $_event_id;

/**
* The user login of user who created this Doc
* The user login of user who created this Doc
* @var string
* @access private
*/
var $_login;

/**
* Filename of the doc (not used for comments)
* Filename of the doc (not used for comments)
* @var string
* @access private
*/
var $_name;

/**
* The description of the doc
* The description of the doc
* @var string
* @access private
*/
var $_description;

/**
* The size of the doc (in bytes)
* The size of the doc (in bytes)
* (not used for comments)
* @var int
* @access private
*/
var $_size;

/**
* The MIME type of the doc
* The MIME type of the doc
* @var string
* @access private
*/
var $_mime_type;

/**
* Type of object (C=Comment, A=Attachment)
* Type of object (C=Comment, A=Attachment)
* @var string
* @access private
*/
var $_type;

/**
* Date last modified (in YYYYMMDD format)
* Date last modified (in YYYYMMDD format)
* @var int
* @access private
*/
var $_mod_date;

/**
* Time last modified (in HHMMSS format)
* Time last modified (in HHMMSS format)
* @var int
* @access private
*/
Expand Down Expand Up @@ -314,7 +314,7 @@ function getSummary ($target='') {
if ( $this->_size < 1024 )
$ret .= $this->_size . ' ' . translate ( 'bytes' );
else
if ( $this->_size < 1024 * 1024 )
if ( $this->_size < 1048576 ) // 1024 * 1024
$ret .= sprintf ( " %.1f", ( $this->_size / 1024 ) ) . translate ( 'kb' );
else
$ret .= sprintf ( " %.1f", ( $this->_size / 1048576 ) ) . translate ( 'Mb' );
Expand Down
10 changes: 5 additions & 5 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2581,9 +2581,9 @@ function get_groups($user, $includeUserlist=false)
$res = dbi_execute($sql, [$groups[$i]['cal_group_id']]);
while ($row = dbi_fetch_row($res)) {
if (isset($users_by_name[$row[0]])){
// It is possible some users assigned to this group may not exist,
// so we skip those that don't. For example, if users are fetched
// from an external source via user-app-*.php, and one of those
// It is possible some users assigned to this group may not exist,
// so we skip those that don't. For example, if users are fetched
// from an external source via user-app-*.php, and one of those
// users is deleted externally.
$users[] = $users_by_name[$row[0]];
}
Expand Down Expand Up @@ -3426,8 +3426,8 @@ function getReminders ( $id, $display = false ) {
$d = $h = $minutes = 0;
if ( $reminder['offset'] > 0 ) {
$minutes = $reminder['offset'];
$d = intval ( $minutes / (24*60) );
$minutes -= ( $d * (24*60) );
$d = intval ( $minutes / 1440 ); // (24*&60)
$minutes -= ( $d * 1440 ); // (24*60)
$h = intval ( $minutes / 60 );
$minutes -= ( $h * 60 );
}
Expand Down
20 changes: 10 additions & 10 deletions includes/moon_phases.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ function calculateMoonPhases ( $year, $month = 1 ) {
$U = false;

$K0 = intval ( ( $year - 1900 ) * 12.3685 ) + ( $month - 1 );
$R1 = 3.14159265 / 180;
$T = ( $year - 1899.5 ) / 100;
$R1 = 0.0174532925; // [pi] 3.14159265 / 180
$T = ( $year - 1899.5 ) / 100;
$T2 = $T * $T;
$T3 = $T2 * $T;

$J0 = 2415020 + 29 * $K0;
$J0 = 29 * $K0 + 2415020;

$F0 = ( ( 0.0001178 * $T2 - 0.000000155 * $T3 ) +
( 0.75933 + 0.53058868 * $K0 ) -
( 0.53058868 * $K0 + 0.75933 ) -
( 0.000837 * $T + 0.000335 * $T2 ) );

$M0 = $K0 * 0.08084821133;
Expand All @@ -53,14 +53,14 @@ function calculateMoonPhases ( $year, $month = 1 ) {
( 0.00000239 * $T3 ) );

for ( $K9 = 0; $K9 < 7; $K9 += 0.5 ) {
$J = $J0 + 14 * $K9;
$J = 14 * $K9 + $J0;
$K = $K9 / 2;

$B6 = ( $B1 + $K * 390.67050646 ) * $R1;
$M5 = ( $M0 + $K * 29.10535608 ) * $R1;
$M6 = ( $M1 + $K * 385.81691806 ) * $R1;
$B6 = ( $K * 390.67050646 + $B1 ) * $R1;
$M5 = ( $K * 29.10535608 + $M0 ) * $R1;
$M6 = ( $K * 385.81691806 + $M1 ) * $R1;

$F = ( ( $F0 + 0.765294 * $K9 ) -
$F = ( ( 0.765294 * $K9 + $F0 ) -
( 0.4068 * sin ( $M6 ) ) +
( ( 0.1734 - 0.000393 * $T ) * sin ( $M5 ) ) +
( 0.0161 * sin ( 2 * $M6 ) ) +
Expand All @@ -73,7 +73,7 @@ function calculateMoonPhases ( $year, $month = 1 ) {

$J += intval ( $F );
$F -= intval ( $F );
//.

// Convert from JD to Calendar Date.
$julian = $J + round ( $F );
$s = ( function_exists ( 'jdtogregorian' )
Expand Down
4 changes: 2 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
</td></tr>';
}
if ($show_advanced) {
$startDateYmd = date('Ymd', time() - (90 * 24 * 3600)); // 90 days ago
$endDateYmd = date('Y-m-d', time() + (90 * 24 * 3600)); // 90 days from now
$startDateYmd = date ( 'Ymd', time() - 7776000 ); // 90 days ago
$endDateYmd = date ( 'Y-m-d', time() + 7776000 ); // 90 days from now
echo '<tr id="datefilter">
<td><label for="date_filter" class="colon">' . translate('Filter by Date')
. ':</label></td>
Expand Down

0 comments on commit f5da566

Please sign in to comment.