From 3fd6591a688b841359a64cd0631d8e01a940541b Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 7 Sep 2011 12:38:36 +0000
Subject: [PATCH] Fixed: FS#1717 - Regular Expression (@reboot) in User Cron

---
 interface/lib/classes/validate_cron.inc.php | 8 ++++++++
 interface/web/sites/form/cron.tform.php     | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/interface/lib/classes/validate_cron.inc.php b/interface/lib/classes/validate_cron.inc.php
index c42e06dc92..d49c2809a1 100644
--- a/interface/lib/classes/validate_cron.inc.php
+++ b/interface/lib/classes/validate_cron.inc.php
@@ -55,6 +55,14 @@ class validate_cron {
             if(preg_match("'^([a-z0-9][a-z0-9-]{0,62}\.)+([a-z]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
         }
     }
+	
+	function run_month_format($field_name, $field_value, $validator) {
+		global $app;
+		//* allow value @reboot in month field
+		if($field_value != '@reboot') {
+			return $this->run_time_format($field_name, $field_value, $validator);
+		}
+	}
     
 	/*
 		Validator function to check if a given cron time is in correct form.
diff --git a/interface/web/sites/form/cron.tform.php b/interface/web/sites/form/cron.tform.php
index fc63548ff8..3a7bd6decc 100644
--- a/interface/web/sites/form/cron.tform.php
+++ b/interface/web/sites/form/cron.tform.php
@@ -129,7 +129,7 @@ $form["tabs"]['cron'] = array (
             'formtype'  => 'TEXT',
             'validators'    => array (  0 => array (    'type'  => 'CUSTOM',
                                                         'class' => 'validate_cron',
-                                                        'function' => 'run_time_format',
+                                                        'function' => 'run_month_format',
                                                         'errmsg'=> 'run_month_error_format'),
                                     ),
             'default'   => '',
-- 
GitLab