X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=misc.php;h=e604e610dde4cae1b44df45e1d26885fc5efe9f3;hb=4592989440cf123fa19dcadbe3e89015f48545e5;hp=18a1a41727a99a4968efff7008900a80207fce26;hpb=ddd681b6dcd0ef511238e96a0c3b94d9e8600ef2;p=wfpl.git diff --git a/misc.php b/misc.php index 18a1a41..e604e61 100644 --- a/misc.php +++ b/misc.php @@ -18,19 +18,6 @@ # along with wfpl; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# This exists because file_get_contents() is not documented well. (It says that -# the second parameter is optional, but does not specify what happens when you -# do not pass anything.) And because it's nice to work in PHP4.2 -function read_whole_file($name) { - $fd = fopen($name, 'r'); - if($fd === false) { - die("Failed to read file: '$name'"); - } - $file_data = fread($fd, filesize($name)); - fclose($fd); - return $file_data; -} - function unix_newlines($str) { $str = str_replace("\r\n", "\n", $str); return str_replace("\r", "\n", $str); @@ -46,6 +33,10 @@ function this_month() { return ereg_replace('^0', '', strftime('%m')); } +# return today's date in yyyy-mm-dd format +function today_ymd() { + return strftime('%Y-%m-%d'); +} # php4 is broken, in that you cannot set a default value for a parameter that # is passed by reference. So, this is set up to use the following screwy