updating cron module
This commit is contained in:
parent
114c1eb999
commit
9d5794a83f
|
@ -9,7 +9,7 @@ getFields($fields);
|
||||||
|
|
||||||
if (!empty($cronupdate)) {
|
if (!empty($cronupdate)) {
|
||||||
if (! $cron->update($cronupdate)) {
|
if (! $cron->update($cronupdate)) {
|
||||||
$error=_("There was an error during the record.");
|
$error=$err->errstr();
|
||||||
} else {
|
} else {
|
||||||
$error=_("Save done.");
|
$error=_("Save done.");
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ foreach ($cron->schedule() as $cs) {
|
||||||
<tr>
|
<tr>
|
||||||
<td/>
|
<td/>
|
||||||
<td>
|
<td>
|
||||||
<input type="submit" name="submit" class="inb" value="<?php __("Save"); ?>" />
|
<input type="submit" name="submit" class="inb" value="<?php __("Apply the modifications"); ?>" />
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class m_cron {
|
||||||
*/
|
*/
|
||||||
function m_cron() {
|
function m_cron() {
|
||||||
}
|
}
|
||||||
//FIXME add a NOT NULL constraint on uid in the DB
|
|
||||||
function schedule() {
|
function schedule() {
|
||||||
return Array(
|
return Array(
|
||||||
Array('unit'=>1440, 'name'=>_("Daily")),
|
Array('unit'=>1440, 'name'=>_("Daily")),
|
||||||
|
@ -109,12 +109,19 @@ class m_cron {
|
||||||
return $this->delete_one($id);
|
return $this->delete_one($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME check the url property
|
|
||||||
|
if(filter_var($url,FILTER_VALIDATE_URL)===false){
|
||||||
|
$err->raise("cron",_("URL not valid"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$url=mysql_real_escape_string(urlencode($url));
|
$url=mysql_real_escape_string(urlencode($url));
|
||||||
$user=mysql_real_escape_string(urlencode($user));
|
$user=mysql_real_escape_string(urlencode($user));
|
||||||
if (empty($user)) $password='';
|
if (empty($user)) $password='';
|
||||||
$password=mysql_real_escape_string(urlencode($password));
|
$password=mysql_real_escape_string(urlencode($password));
|
||||||
if (! checkmail($email) == 0 ) return false;
|
if (! checkmail($email) == 0 ){
|
||||||
|
$err->raise("cron",_("Email address is not valid"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$email=mysql_real_escape_string(urlencode($email));
|
$email=mysql_real_escape_string(urlencode($email));
|
||||||
if (! $this->valid_schedule($schedule)) return false;
|
if (! $this->valid_schedule($schedule)) return false;
|
||||||
|
|
||||||
|
@ -126,7 +133,9 @@ class m_cron {
|
||||||
}
|
}
|
||||||
} else { // if not a new insert, check the $cuid
|
} else { // if not a new insert, check the $cuid
|
||||||
$db->query("SELECT uid FROM cron WHERE id = $id;");
|
$db->query("SELECT uid FROM cron WHERE id = $id;");
|
||||||
if (! $db->next_record()) { return "false"; } // return false if pb
|
if (! $db->next_record()) {
|
||||||
|
return "false";
|
||||||
|
} // return false if pb
|
||||||
if ( $db->f('uid') != $cuid ) {
|
if ( $db->f('uid') != $cuid ) {
|
||||||
$err->raise("cron",_("Identity problem"));
|
$err->raise("cron",_("Identity problem"));
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue