root/trunk/gui/include/date-functions.php

Revision 1327, 1.9 kB (checked in by rats, 4 months ago)

* Fixed: --scan-knownbad-files and --check-deleted are no longer supported by rkhunter
* Fixed #1471: chkrootkit should be in lenny / hardy
* Updated Chinese (simplified)
* Updated German
* Fixed #1475: typo on installation (ispcp-setup)
* Fixed: default user for rkhunter.log

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 function check_day($day) {
22
23     if ($day === '') return 0;
24     if (preg_match("/^0?[1-9]$/D", $day)) return 1;
25     if (preg_match("/^[1-9][0-9]$/D", $day) && (9 < $day) && ($day < 32)) return 1;
26
27     return 0;
28 }
29
30 function check_month($month) {
31
32     if ($month === '') return 0;
33     if (preg_match("/^0?[1-9]$/D", $month)) return 1;
34     if (preg_match("/^[1-9][0-9]$/D", $month) && (9 < $month) && ($month < 13)) return 1;
35
36     return 0;
37 }
38
39 function check_year($year) {
40
41     $current_year = date("Y", time());
42     if ($year === '') return 0;
43     if (preg_match("/^[1-9][0-9][0-9][0-9]$/D", $year) && (1899 < $year) && ($year < ($current_year + 1))) return 1;
44
45     return 0;
46 }
47
48 function check_date($date) {
49
50     if ($date === '') return 0;
51     $res = preg_match_all("/^([^\.]+)\.([^\.]+)\.([^\n]+)\n/D", "$date\n", $parts, PREG_PATTERN_ORDER);
52     if ($res != 1) return 0;
53     if (check_day($parts[1][0]) && check_month($parts[2][0]) && check_year($parts[3][0])) return 1;
54
55     return 0;
56 }
57
58 function split_date($date) {
59
60     if (check_date($date)) {
61         $res = preg_match_all("/^([^\.]+)\.([^\.]+)\.([^\n]+)\n/D", "$date\n", $parts, PREG_PATTERN_ORDER);
62         return array($parts[1][0], $parts[2][0], $parts[3][0]);
63     }
64
65     return '';
66 }
67
68 ?>
Note: See TracBrowser for help on using the browser.