Skip to content

Commit 4b5da4e

Browse files
author
Till Brehm
committed
Fixed: FS#3423 - Clients with URL cron limit can also add chrooted cronjobs
1 parent 454fa04 commit 4b5da4e

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

interface/web/sites/cron_edit.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,19 @@ function onUpdateSave($sql) {
140140
if($_SESSION["s"]["user"]["typ"] != 'admin') {
141141
// Get the limits of the client
142142
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
143-
$client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
143+
$client = $app->db->queryOneRecord("SELECT limit_cron_frequency, limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
144144

145145
if($client["limit_cron_frequency"] > 1) {
146146
if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
147147
$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
148148
$has_error = true;
149149
}
150150
}
151+
152+
if($client["limit_cron_type"] == 'url' && $this->dataRecord["type"] != 'url') {
153+
$app->error($app->tform->wordbook["limit_cron_url_txt"]);
154+
$has_error = true;
155+
}
151156
}
152157

153158
if($has_error == true) {
@@ -165,14 +170,19 @@ function onInsertSave($sql) {
165170
if($_SESSION["s"]["user"]["typ"] != 'admin') {
166171
// Get the limits of the client
167172
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
168-
$client = $app->db->queryOneRecord("SELECT limit_cron_frequency FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
173+
$client = $app->db->queryOneRecord("SELECT limit_cron_frequency, limit_cron_type FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
169174

170175
if($client["limit_cron_frequency"] > 1) {
171176
if($app->tform->cron_min_freq < $client["limit_cron_frequency"]) {
172177
$app->error($app->tform->wordbook["limit_cron_frequency_txt"]);
173178
$has_error = true;
174179
}
175180
}
181+
182+
if($client["limit_cron_type"] == 'url' && $this->dataRecord["type"] != 'url') {
183+
$app->error($app->tform->wordbook["limit_cron_url_txt"]);
184+
$has_error = true;
185+
}
176186
}
177187

178188
if($has_error == true) {

interface/web/sites/lib/lang/de_cron.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ $wb['run_wday_error_format'] = 'Das Format für Wochentage ist nicht korrekt.';
1919
$wb['command_error_format'] = 'Das Format für den Befehl ist nicht korrekt. Beachten Sie, dass bei einem URL Aufruf nur http und https erlaubt ist.';
2020
$wb['unknown_fieldtype_error'] = 'Es wurde ein unbekanntes Feld verwendet.';
2121
$wb['server_id_error_empty'] = 'Die Server-ID ist leer.';
22+
$wb['limit_cron_url_txt'] = 'Es sind nur URL cronjobs möglich. Der Cron-Befehl muss mit http:// beginnen.';
23+
$wb['command_error_empty'] = 'Befehl ist leer.';
2224
?>

interface/web/sites/lib/lang/en_cron.lng

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ $wb['run_wday_error_format'] = 'Invalid format for days of the week.';
1919
$wb['command_error_format'] = 'Invalid command format. Please note that in case of an url call only http/https is allowed.';
2020
$wb['unknown_fieldtype_error'] = 'An unknown field type has been used.';
2121
$wb['server_id_error_empty'] = 'The server ID is empty.';
22+
$wb['limit_cron_url_txt'] = 'URL cron only. Please enter a URL starting with http:// as cron command.';
23+
$wb['command_error_empty'] = 'Command is empty.';
2224
?>

0 commit comments

Comments
 (0)