JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
renamed basics.php to misc.php
[wfpl.git] / misc.php
1 <?php
2
3 function read_whole_file($name) {
4         $fd = fopen($name, 'r');
5         if($fd === false) {
6                 die("Failed to read file: '$name'");
7         }
8         $file_data = fread($fd, filesize($name));
9         fclose($fd);
10         return $file_data;
11 }
12
13 function unix_newlines($str) {
14         $str = str_replace("\r\n", "\n", $str);
15         return str_replace("\r", "\n", $str);
16 }
17
18 # return current year (all 4 digits)
19 function this_year() {
20         return strftime('%Y');
21 }
22
23 # return the number of the current month (1..12)
24 function this_month() {
25         return strftime('%m');
26 }
27
28 ?>