Alternc  3.2
Alternc logiel libre pour l'hébergement
 All Data Structures Namespaces Files Functions Variables Pages
cron.php
Go to the documentation of this file.
1 <?php
2 require_once("../class/config.php");
3 include_once("head.php");
4 
5 $fields = array (
6  "cronupdate" => array ("post", "array", ""),
7 );
9 
10 if (!empty($cronupdate)) {
11  if (! $cron->update($cronupdate)) {
12  $error=$err->errstr();
13  } else {
14  $error=_("Save done.");
15  }
16 }
17 
18 $lst_cron = $cron->lst_cron();
19 ?>
20 
21 <h3><?php __("Scheduled tasks"); ?></h3>
22 <hr id="topbar"/>
23 <br />
24 
25 <?php if (isset($error) && $error) { ?>
26  <p class="alert alert-danger"><?php echo $error ?></p>
27 <?php } ?>
28 
29 <form method="post" action="cron.php" id="main" name="cron" >
30 
31 
32 <table class="tlist">
33 <!--
34  <tr>
35  <th/>
36  <th><?php __("URL"); ?></th>
37  <th><?php __("Schedule"); ?></th>
38  <th><?php __("User"); ?></th>
39  <th><?php __("Password"); ?></th>
40  <th><?php __("Email report"); ?></th>
41  </tr>
42 -->
43 <?php
44 $max_cron = $quota->getquota("cron");
45 $max_cron = $max_cron['t'];
46 if ( sizeof($lst_cron) > $max_cron ) $max_cron=sizeof($lst_cron);
47 
48 for ($i=0; $i < $max_cron ; $i++) {
49 ?>
50  <tr class="<?php echo ($i%2)?"lst1":"lst2"; ?>">
51  <td rowspan='2'>
52  <?php if (isset($lst_cron[$i])) echo "<input type='hidden' name='cronupdate[$i][id]' value='".$lst_cron[$i]['id']."' />"; ?>
53  <?php if (isset($lst_cron[$i])) { echo '#'.$lst_cron[$i]['id']; } ?><br/>
54  <a href="javascript:cleancron('<?php echo $i ?>');"><img src="images/delete.png" alt="<?php __("Delete");?>" title="<?php __("Delete");?>"/></a>
55  </td>
56  <td colspan='2'>
57  <label for="crup_url_<?php echo $i?>"><?php __("Called URL"); ?> :</label><br/><input type="text" id="crup_url_<?php echo $i?>" name="<?php echo "cronupdate[$i][url]";?>" size="40" maxlength="255" value="<?php if (isset($lst_cron[$i]['url'])) { echo htmlentities($lst_cron[$i]['url']);} ?>"/>
58  </td>
59  <td>
60  <?php __("Period:");?> <select name='cronupdate[<?php echo $i; ?>][schedule]'>
61 <?php
62 foreach ($cron->schedule() as $cs) {
63  echo "<option value='".$cs['unit']."'";
64  if (isset($lst_cron[$i]['schedule']) && ($lst_cron[$i]['schedule'] == $cs['unit'])){
65  echo " selected='selected' ";
66  }
67  echo " >".$cs['name'];
68  echo "</option>";
69 }
70 ?>
71  </select>
72  <br/><?php if (isset($lst_cron[$i])) {__("Next execution: "); echo $lst_cron[$i]['next_execution'];}?>
73  </td>
74  </tr><tr class="<?php echo ($i%2)?"lst1":"lst2"; ?>">
75  <td><label for="crup_user_<?php echo $i?>"><?php __("HTTP user (optional)"); ?> :</label><br/><input type="text" id="crup_user_<?php echo $i?>" name="<?php echo "cronupdate[$i][user]";?>" size="20" maxlength="64" value="<?php if (isset($lst_cron[$i]['user'])) { echo htmlentities($lst_cron[$i]['user']);} ?>"/></td>
76  <td><label for="crup_pass_<?php echo $i?>"><?php __("HTTP password (optional)"); ?> :</label><br/><input type="text" id="crup_pass_<?php echo $i?>" name="<?php echo "cronupdate[$i][password]";?>" size="20" maxlength="64" value="<?php if (isset($lst_cron[$i]['password'])) { echo htmlentities($lst_cron[$i]['password']);} ?>"/></td>
77  <td><label for="crup_mail_<?php echo $i?>"><?php __("Mail address (optional)"); ?> :</label><br/><input type="text" id="crup_mail_<?php echo $i?>" name="<?php echo "cronupdate[$i][email]";?>" size="25" maxlength="64" value="<?php if (isset($lst_cron[$i]['email'])) { echo htmlentities($lst_cron[$i]['email']);} ?>"/></td>
78  </tr>
79 <?php } //foreach ?>
80 </table>
81 <p><input type="submit" name="submit" class="inb ok" value="<?php __("Apply the modifications"); ?>" /></p>
82 
83 </form>
84 
85 <script type="text/javascript">
86 function cleancron(i) {
87  document.getElementById('crup_url_'+i).value = '';
88  document.getElementById('crup_user_'+i).value = '';
89  document.getElementById('crup_pass_'+i).value = '';
90  document.getElementById('crup_mail_'+i).value = '';
91 }
92 
93 </script>
94 
95 <?php include_once("foot.php"); ?>