Skip to content

Commit

Permalink
Fixed #24. Cast to int before === check
Browse files Browse the repository at this point in the history
  • Loading branch information
lesterchan committed Dec 31, 2018
1 parent dfbf1f3 commit 41981b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: php
php:
- "7.3"
- "7.2"
- "7.1"
- "7.0"
Expand Down
15 changes: 8 additions & 7 deletions wp-downloadmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ function download_rename_file($file_path, $file) {
### Function: Editable Timestamp
function file_timestamp($file_timestamp) {
global $month;
$day = gmdate('j', $file_timestamp);
$day = (int) gmdate('j', $file_timestamp);
echo '<select id="file_timestamp_day" name="file_timestamp_day" size="1">'."\n";
for($i = 1; $i <=31; $i++) {
if($day === $i) {
Expand All @@ -849,7 +849,7 @@ function file_timestamp($file_timestamp) {
}
}
echo '</select>&nbsp;&nbsp;'."\n";
$month2 = gmdate('n', $file_timestamp);
$month2 = (int) gmdate('n', $file_timestamp);
echo '<select id="file_timestamp_month" name="file_timestamp_month" size="1">'."\n";
for($i = 1; $i <= 12; $i++) {
if ($i < 10) {
Expand All @@ -864,9 +864,10 @@ function file_timestamp($file_timestamp) {
}
}
echo '</select>&nbsp;&nbsp;'."\n";
$year = gmdate('Y', $file_timestamp);
$year = (int) gmdate('Y', $file_timestamp);
$current_year = (int) gmdate('Y');
echo '<select id="file_timestamp_year" name="file_timestamp_year" size="1">'."\n";
for($i = 2000; $i <= gmdate('Y'); $i++) {
for($i = 2000; $i <= $current_year; $i++) {
if($year === $i) {
echo "<option value=\"$i\" selected=\"selected\">$i</option>\n";
} else {
Expand All @@ -875,7 +876,7 @@ function file_timestamp($file_timestamp) {
}
echo '</select>&nbsp;@'."\n";
echo '<span dir="ltr">'."\n";
$hour = gmdate('H', $file_timestamp);
$hour = (int) gmdate('H', $file_timestamp);
echo '<select id="file_timestamp_hour" name="file_timestamp_hour" size="1">'."\n";
for($i = 0; $i < 24; $i++) {
if($hour === $i) {
Expand All @@ -885,7 +886,7 @@ function file_timestamp($file_timestamp) {
}
}
echo '</select>&nbsp;:'."\n";
$minute = gmdate('i', $file_timestamp);
$minute = (int) gmdate('i', $file_timestamp);
echo '<select id="file_timestamp_minute" name="file_timestamp_minute" size="1">'."\n";
for($i = 0; $i < 60; $i++) {
if($minute === $i) {
Expand All @@ -896,7 +897,7 @@ function file_timestamp($file_timestamp) {
}

echo '</select>&nbsp;:'."\n";
$second = gmdate('s', $file_timestamp);
$second = (int) gmdate('s', $file_timestamp);
echo '<select id="file_timestamp_second" name="file_timestamp_second" size="1">'."\n";
for($i = 0; $i <= 60; $i++) {
if($second === $i) {
Expand Down

0 comments on commit 41981b0

Please sign in to comment.