diff --git a/bureau/admin/cron.php b/bureau/admin/cron.php index 663d399c..4d50a743 100644 --- a/bureau/admin/cron.php +++ b/bureau/admin/cron.php @@ -30,6 +30,7 @@ $lst_cron = $cron->lst_cron(); +getquota("cron"); $max_cron = $max_cron['t']; @@ -47,14 +49,15 @@ for ($i=0; $i < $max_cron ; $i++) { ?> "; ?> - - - - - + + + + +
+ + #
<?php __(" title=""/>
- " size="30" maxlength="255" value=""/> + + " id="crup_url_" name="" size="40" maxlength="255" value=""/> - schedule() as $cs) { echo "" size="10" maxlength="64" value=""/>" size="10" maxlength="64" value=""/>" size="10" maxlength="64" value=""/>
" id="crup_user_" name="" size="20" maxlength="64" value=""/>" id="crup_pass_" name="" size="20" maxlength="64" value=""/>" id="crup_mail_" name="" size="25" maxlength="64" value=""/>

diff --git a/bureau/class/m_cron.php b/bureau/class/m_cron.php index d2705abb..a66667be 100644 --- a/bureau/class/m_cron.php +++ b/bureau/class/m_cron.php @@ -61,6 +61,7 @@ class m_cron { $tmp['password']=urldecode($db->f('password')); $tmp['schedule']=$db->f('schedule'); $tmp['email']=urldecode($db->f('email')); + $tmp['next_execution']=$db->f('next_execution'); $r[]=$tmp; } return $r; @@ -114,15 +115,15 @@ class m_cron { $err->raise("cron",_("URL not valid")); return false; } - $url=mysql_real_escape_string(urlencode($url)); - $user=mysql_real_escape_string(urlencode($user)); + $url=urlencode($url); + $user=urlencode($user); if (empty($user)) $password=''; - $password=mysql_real_escape_string(urlencode($password)); + $password=urlencode($password); if (! checkmail($email) == 0 ){ $err->raise("cron",_("Email address is not valid")); return false; } - $email=mysql_real_escape_string(urlencode($email)); + $email=urlencode($email); if (! $this->valid_schedule($schedule)) return false; if (is_null($id)) { // if a new insert, quotacheck diff --git a/src/cron_users_doit.sh b/src/cron_users_doit.sh index 7c7a5795..da780223 100755 --- a/src/cron_users_doit.sh +++ b/src/cron_users_doit.sh @@ -1,6 +1,6 @@ #!/bin/bash -# FIXME relecture + commentaires +# FIXME relecture + commentaires id=$1 url=$2 @@ -46,15 +46,14 @@ urldecode() { i=$((i+1)) fi done -) | sed -e 's/"/\\"/g' -e 's/\!/\\\!/g' +) | sed -e 's/"/\\"/g' -e 's/\!/\\\!/g' -e 's/\ /\\\ /g' -e "s/'/\\'/g" } -params="" -if [ ! "x$user" == "x" -a ! "x$password" == "x" ]; then - params="--http-user=\"$(urldecode $user)\" --http-password=\"$(urldecode $password)\"" -fi -wget -O - $params "$(urldecode $url)" --timeout=$timeout | mailx -s "AlternC Cron $id - Report $date" -r "$from" "$email" +date=$(date +%x\ %X) + +# Don't really understand why it must be called this way... +bash -c "( echo -e 'Here the report for the scheduled task for the cron #$id in your AlternC configuration (from http://$FQDN)\n\n\n------------\n\n'; wget -O - --no-check-certificate --http-user=$(urldecode $user) --http-password=$(urldecode $password) \"$(urldecode $url)\" --timeout=$timeout 2>&1 )| mailx -s \"AlternC Cron #$id - Report $date\" -r \"$from\" \"$(urldecode $email)\"" # On calcule l'heure de la prochaine execution idéale ((interval=$schedule * 60))