Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #35 from jefferyto/date-no-leading-zero

Pass month/day values to mktime() without any leading zeros
  • Loading branch information...
commit 25ddad85a2219c20914ac4bda4d85dfabb8fb107 2 parents edc11b3 + 357baa7
@jeremyclark13 authored
Showing with 6 additions and 6 deletions.
  1. +3 −3 api/download.php
  2. +3 −3 api/packages.php
View
6 api/download.php
@@ -9,8 +9,8 @@
// loop over all the versions for each theme and plugin
foreach ( $package['versions'] as $version ) {
// md5 timestamp of current and previous day and the file name
- $tod_md5 = md5( $version['file_name'] . mktime( 0, 0, 0, date( "m" ), date( "d" ), date( "Y" ) ) );
- $yes_md5 = md5( $version['file_name'] . mktime( 0, 0, 0, date( "m" ), date( "d" ) - 1, date( "Y" ) ) );
+ $tod_md5 = md5( $version['file_name'] . mktime( 0, 0, 0, date( "n" ), date( "j" ), date( "Y" ) ) );
+ $yes_md5 = md5( $version['file_name'] . mktime( 0, 0, 0, date( "n" ), date( "j" ) - 1, date( "Y" ) ) );
// test if the either of the md5 hashes match what was passed
if ( $_GET['key'] == $tod_md5 || $_GET['key'] == $yes_md5 ) {
$download = $update_folder . $version['file_name'];
@@ -29,4 +29,4 @@
}
}
}
-?>
+?>
View
6 api/packages.php
@@ -6,7 +6,7 @@
'version' => '1.0', //Current version available
'date' => '2010-04-10', //Date version was released
//theme.zip is the same as file_name
- 'package' => 'http://url_to_your_site/download.php?key=' . md5('theme.zip' . mktime(0,0,0,date("m"),date("d"),date("Y"))),
+ 'package' => 'http://url_to_your_site/download.php?key=' . md5('theme.zip' . mktime(0,0,0,date("n"),date("j"),date("Y"))),
//file_name is the name of the file in the update folder.
'file_name' => 'theme.zip', //File name of theme zip file
'author' => 'Author Name', //Author of theme
@@ -34,7 +34,7 @@
'downloaded' => '1000', // Number of times downloaded
'external' => '', // Unused
//plugin.zip is the same as file_name
- 'package' => 'http://url_to_your_site/download.php?key=' . md5('plugin.zip' . mktime(0,0,0,date("m"),date("d"),date("Y"))),
+ 'package' => 'http://url_to_your_site/download.php?key=' . md5('plugin.zip' . mktime(0,0,0,date("n"),date("j"),date("Y"))),
//file_name is the name of the file in the update folder.
'file_name' => 'plugin.zip',
'sections' => array(
@@ -55,4 +55,4 @@
'info' => array(
'url' => 'http://your_plugin_webiste' // Site devoted to your plugin if available
)
-);
+);
Please sign in to comment.
Something went wrong with that request. Please try again.