Changeset 1257

Show
Ignore:
Timestamp:
04/20/05 23:21:09 (4 years ago)
Author:
benjamin
Message:

French / English translation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bureau/admin/cron_execute.php

    r1253 r1257  
    4444} 
    4545 
    46 // Many times a day between 2 hours : Yeah Man, no so hard :) 
     46// Many times a day between 2 hours : Man, not so hard :) 
    4747$r=mysql_query("SELECT id, uid, action, url, mail, acmode, corpus FROM crontasks WHERE 
    4848        `period`='1' AND (  ((p2*60+p3)-$minsince  )%p1)=0 AND ($ch>=p2 AND $ci>=p3 AND $ch<=p4 AND $ci<=p5)"); 
  • trunk/bureau/admin/phpcron_add.php

    r1253 r1257  
    100100} 
    101101?> 
    102 <h2>Nouvelle tache planifiee</h2> 
     102<h2><?php __("New timed task"); ?>Nouvelle tache planifiee</h2> 
    103103<form method="post" action="phpcron_doadd.php" name="main"> 
    104104<p> 
    105 Periodicite de l'evenement :  
     105<?php __("Event periodicity: "); ?> 
    106106<select id="t" name="t" onchange="upd(this.selectedIndex);"> 
    107107<?php 
     
    110110</select> 
    111111</p> 
     112 
     113<!-- HERE There should be specific code for each language ... --> 
     114 
    112115<p> 
    113116<div id="u1"> 
     
    272275</p> 
    273276 
     277<!-- END OF 'HERE There should be specific code for each language ...' --> 
     278 
     279 
     280 
     281 
     282 
    274283<p> 
    275 Quel evenement declencher :  
     284<?php __("Which event shall I trigger: "); ?> 
    276285<select id="w" name="w" onchange="upd2(this.selectedIndex);"> 
    277286<?php 
     
    281290 
    282291<div id="w1"> 
    283 <label for="url">Url : </label><input type="text" size="40" id="url" name="url" value="<?php echo htmlentities($url); ?>"/> 
     292<label for="url"><?php __("Url: "); ?></label><input type="text" size="40" id="url" name="url" value="<?php echo htmlentities($url); ?>"/> 
    284293</div> 
    285294<div id="w2"> 
    286 <label for="mail2">Adresse Email : </label><input type="text" size="30" id="mail2" name="mail2" value="<?php echo htmlentities($mail2); ?>"/> 
     295<label for="mail2"><?php __("Email Address: "); ?></label><input type="text" size="30" id="mail2" name="mail2" value="<?php echo htmlentities($mail2); ?>"/> 
    287296</div> 
    288297<div id="w4"> 
    289 <label for="mode2">Comment envoyer la page </label><select name="mode2" id="mode2"> 
    290 <?php 
    291         $mm=array(0=>"En piece jointe",1=>"Dans le corps du mail"); 
     298<label for="mode2"><?php __("How shall I send the page ?"); ?></label><select name="mode2" id="mode2"> 
     299<?php 
     300        $mm=array(0=>)_("As an attachment"),1=>_("In the mail body")); 
    292301        do_list($mm,$mode2); 
    293302 ?> 
     
    295304</div> 
    296305<div id="w3"> 
    297 <label for="sujet">Sujet du mail : </label><input type="text" size="40" id="sujet" name="sujet" value="<?php echo htmlentities($sujet); ?>"/><br /> 
    298 <label for="texte">Texte du mail : </label><textarea name="texte" id="texte" cols="30" rows="6"><?php echo htmlentities($texte); ?></textarea> 
     306<label for="sujet"><?php __("Email Subject: "); ?></label><input type="text" size="40" id="sujet" name="sujet" value="<?php echo htmlentities($sujet); ?>"/><br /> 
     307<label for="texte"><?php __("Email Body: "); ?></label><textarea name="texte" id="texte" cols="30" rows="6"><?php echo htmlentities($texte); ?></textarea> 
    299308</div> 
    300309 
    301310 
    302311<br /> 
    303         <input type="submit" value="Creer cet evenement" /> 
     312        <input type="submit" value="<?php __("Create this task"); ?>" /> 
    304313 
    305314</form> 
  • trunk/bureau/admin/phpcron_doadd.php

    r1253 r1257  
    2525 ---------------------------------------------------------------------- 
    2626 Original Author of file: Benjamin Sonntag 
    27  Purpose of file: List ftp accounts of the user. 
     27 Purpose of file: Do add a cron task to the user account 
    2828 ---------------------------------------------------------------------- 
    2929*/ 
     
    106106 
    107107if ($error) { 
    108         $error=_("$t Erreur dans le choix de la periode, merci de preciser une periode correcte."); 
     108        $error=_("Error in the period choice, please ask for a correct period."); 
    109109        include("phpcron_add.php"); 
    110110        exit(); 
     
    140140 
    141141if ($error) { 
    142         $error="Erreur dans le choix de la tache a effectuer, merci de preciser une tache correct."; 
     142        $error=_("Error in the task choice. Please set a correct task parameter."; 
    143143        include("cron_add".$r.".php"); 
    144144        exit(); 
    145145} 
    146146 
    147 $phpcron->add_task( 
     147       //$phpcron->add_task( 
    148148// ok, let's use $t $w $p1-4 $f* to insert into mysql :  
    149 mysql_query("INSERT INTO crontasks SET 
     149$db->query("INSERT INTO crontasks SET 
    150150        uid='".$uid."',  
    151151        `period`='$t', p1='$p1', p2='$p2', p3='$p3', p4='$p4', p5='$p5',  
     
    153153        "); 
    154154 
    155 if (mysql_errno()) { 
    156         $error="Impossible de creer l'entree crontab, reessayez plus tard (".mysql_error().")."; 
    157         include("cron_add".$r.".php"); 
    158         exit(); 
    159 
    160  
    161 $error="L'entree a ete cree avec succes."; 
     155$error=_("Task successfully created."); 
    162156include("index.php"); 
    163157 
  • trunk/bureau/admin/phpcron_list.php

    r1253 r1257  
    2525 ---------------------------------------------------------------------- 
    2626 Original Author of file: Benjamin Sonntag 
    27  Purpose of file: List ftp accounts of the user. 
     27 Purpose of file: List cron tasks of the user. 
    2828 ---------------------------------------------------------------------- 
    2929*/ 
     
    4040</head> 
    4141<body> 
    42 <h3><?php __("Tasks list"); ?></h3> 
     42<h3><?php __("Timed tasks list"); ?></h3> 
    4343<?php 
    4444        if ($notask) { 
     
    8383<?php   } 
    8484 
    85 $mem->show_help("ftp_list"); 
    8685?> 
    8786</body> 
    8887</html> 
    8988 
    90  
    91  
    92  
    93  
    94  
    95  
    96  
    97 <?php 
    98  
    99 require_once("config.php"); 
    100  
    101 ?> 
    102 <html> 
    103 <head> 
    104 <title>Cron</title> 
    105 </head> 
    106 <body> 
    107 <?php 
    108  
    109 if ($error) { 
    110         echo "<p class=\"error\">$error</p>"; 
    111 } 
    112  
    113 ?> 
    114 <p> 
    115 <a href="cron_add.php">Ajouter une nouvelle planification.</a> 
    116 <br /> 
    117 <a href="cron_add2.php">Ajouter une nouvelle planification.</a> 
    118 </p> 
    119 <h2>Liste des taches planifiees</h2> 
    120 <?php 
    121  
    122 $r=mysql_query("SELECT * FROM crontasks WHERE uid='1';"); 
    123 if (!mysql_num_rows($r)) { 
    124         echo "<p class=\"error\">Aucune tache planifiee</p>"; 
    125 } else { 
    126  
    127 ?> 
    128 <form method="post" action="cron_dodel.php" /> 
    129 <table> 
    130 <tr><th></th><th>Periodicite</th><th>Action</th></tr> 
    131 <?php 
    132  
    133 $i=0; 
    134 while($c=mysql_fetch_array($r)) { 
    135         $d=task2str($c); 
    136         echo "<tr>"; 
    137         echo "<td><input type=\"checkbox\" name=\"del_$i\" value=\"".$c["id"]."\" /> "; 
    138         echo "<a href=\"cron_edit.php?id=".$c["id"]."\">Modifier</a></td>"; 
    139         echo "<td>".$d[0]."</td>"; 
    140         echo "<td>".$d[1]."</td>"; 
    141         echo "</tr>"; 
    142         $i++; 
    143 } 
    144  
    145 ?> 
    146 </table> 
    147 <input type="submit" value="Effacer les taches cochees" /> 
    148 </form> 
    149 <?php 
    150 } 
    151  
    152 ?> 
    153  
    154  
    155 </body> 
    156 </html> 
  • trunk/bureau/class/m_phpcron.php

    r1253 r1257  
    3030class m_phpcron { 
    3131   
     32  // The fqdn of the server so that mail sent to anybody will by marked by X-PHP-CRON uniq instance id. 
     33  $SITE_SIGNATURE="alternc.info"; 
     34   
     35  var $jobtype_str=array( 
     36                     0 => _("Send an email"), 
     37                     1 => _("Send a page by email"), 
     38                     2 => _("Call a web page"), 
     39                     3 => _("Call a web page and keep it"), 
     40                     ); 
     41   
     42   
     43  var $period_str=array( 
     44                    0 => _("Once"), 
     45                    1 => _("Many times a day"), 
     46                    2 => _("Daily"), 
     47                    3 => _("Weekly"), 
     48                    4 => _("Monthly (by day number)"), 
     49                    5 => _("Monthly (by day name)"), 
     50                    6 => _("Yearly"), 
     51                    ); 
     52   
     53  var $hourly_str=array( 
     54                    0 => _("15 minutes"), 
     55                    1 => _("30 minutes"), 
     56                    2 => _("45 minutes"), 
     57                    3 => _("Hours"), 
     58                    4 => _("2 Hours"), 
     59                    5 => _("3 Hours"), 
     60                    6 => _("4 Hours"), 
     61                    7 => _("6 Hours"), 
     62                    8 => _("8 Hours"), 
     63                    9 => _("12 Hours"), 
     64                    ); 
     65   
     66  var $mhourly_str=array( 
     67                     "m15" => _("15 minutes"), 
     68                     "m30" => _("30 minutes"), 
     69                     "m45" => _("45 minutes"), 
     70                     "m60" => _("Hours"), 
     71                     "m120" => _("2 Hours"), 
     72                     "m180" => _("3 Hours"), 
     73                     "m240" => _("4 Hours"), 
     74                     "m360" => _("6 Hours"), 
     75                     "m480" => _("8 Hours"), 
     76                     "m720" => _("12 Hours"), 
     77                     ); 
     78   
     79  var $weekly_str=array( 
     80                    0 => _("Sunday"), 
     81                    1 => _("Monday"), 
     82                    2 => _("Thirsday"), 
     83                    3 => _("Wednesday"), 
     84                    4 => _("Tuesday"), 
     85                    5 => _("Friday"), 
     86                    6 => _("Saturday"), 
     87                    ); 
     88   
     89  var $monthly_str=array( 
     90                     0 => _("First"), 
     91                     1 => _("Second"), 
     92                     2 => _("Third"), 
     93                     3 => _("Before the last"), 
     94                     4 => _("Last"), 
     95                     ); 
     96   
     97  var $yearly_str=array( 
     98                    0 => _("January"), 
     99                    1 => _("February"), 
     100                    2 => _("March"), 
     101                    3 => _("April"), 
     102                    4 => _("May"), 
     103                    5 => _("June"), 
     104                    6 => _("July"), 
     105                    7 => _("August"), 
     106                    8 => _("September"), 
     107                    9 => _("October"), 
     108                    10=> _("November"), 
     109                    11=> _("December"), 
     110                    ); 
     111   
     112 
     113  var $action_texts=array( 
     114        0 => _("Send a mail to %1\$s with subject '%2\$s' and content : \n%3\$s"), 
     115        1 => _("Send the content of page %1\$s by mail to %2\$s."), 
     116        2 => _("Call the web page %1\$s"), 
     117        3 => _("Call the web page %1\$s and keep it in a document manager."), 
     118        ); 
     119  var $period_texts=array( 
     120        0 => _("On %2\$s, %1\$d %3\$d at %4\$d:%5\$d"), // Le 1 Janvier 2004 a 23H30 
     121        1 => _("Every %1\$s from %2\$d:%3\$d to %4\$d:%5\$d"), // Toutes les 15 minutes de 0H00 a 23H45 
     122        2 => _("Every day at %1\$d:%2\$d"), // Tous les jours a 12H10 
     123        3 => _("Every %1\$s at %2\$d:%3\$d"), // Tous les dimanches a 12H10 
     124        4 => _("Every %1\$s of the month at %2\$d:%3\$d"), // Tous les 4 du mois a 12H10 
     125        5 => _("Every %1\$s %2\$s of the month at %3\$d:%4\$d"), // Tous les premier lundi du mois a 12H10 
     126        6 => _("Every %2\$s, %1\$d at %3\$d:%4\$d"), // Tous les 1 Janvier a 23H30 
     127        ); 
     128   
    32129  var $clsid="phpcron";       /* Numero de la classe php (pour les logs) */ 
    33130   
    34131  /*****************************************************************************/ 
    35   function m_phpcron() { } 
     132  function m_phpcron() {  
     133    global $FQDN; 
     134    $this->SITE_SIGNATURE=$FQDN; 
     135  } 
    36136   
    37137  /*****************************************************************************/ 
     
    39139  function get_list() { 
    40140    global $err,$db,$cuid; 
    41     $err->log("phpcron","enum_tasks"); 
     141    $err->log($this->clsid,"get_list"); 
    42142    $db->query("SELECT * FROM crontasks WHERE uid='$cuid';"); 
    43143    if (!$db->next_record()) { 
     
    55155  /*****************************************************************************/ 
    56156function exec_cron_job($c,$dry_run=0) { 
    57         global $SITE_SIGNATURE; 
    58157        echo "Executing Cron job #".$c["id"]."<br />\n"; 
    59158        if (!$dry_run) { 
     
    61160        switch ($c[action]) { 
    62161                case 0: // Send a mail 
    63                         mail($c["mail"],$c["url"],$c["corpus"],"X-PHP-CRON: ".$SITE_SIGNATURE."#".$c["id"]); 
     162                        mail($c["mail"],$c["url"],$c["corpus"],"X-PHP-CRON: ".$this->SITE_SIGNATURE."#".$c["id"]); 
    64163                break; 
    65164                case 1: // Send a page by mail 
    66165                        $res=retrieve_url($c["url"]); 
    67                         mail($c["mail"],"Tache planifiee ".$c["id"]," Page web jointe",$res,"X-PHP-CRON: ".$SITE_SIGNATURE."#".$c["id"]); 
     166                        mail($c["mail"],_("Timed task number ").$c["id"],_(" Web page attached"),$res,"X-PHP-CRON: ".$SITE_SIGNATURE."#".$c["id"]); 
    68167                break; 
    69168                case 2: // Call a web page 
     
    74173                        mysql_query("INSERT INTO cronpages SET url='".addslashes($c["url"])."', taskid='".$c["uid"]."', size='".strlen($res)."', content='".addslashes($res)."';");      
    75174                default:  
    76                         echo "Error executing job #".$c["id"]."<br />\n"; 
     175                        echo _("Error executing job #").$c["id"]."<br />\n"; 
    77176                break; 
    78177        } 
     
    92191  /*****************************************************************************/ 
    93192function retrieve_url($url) { 
    94         return "nothing here, sorry ..."; 
     193        return "nothing here, sorry ... (To be coded, benjamin has a http_fetch power tool)"; 
    95194} 
    96195 
    97196  /*****************************************************************************/ 
    98197function task2str($c) { 
    99       global $mhourly_str,$weekly_str,$monthly_str,$yearly_str; 
     198  //  global $mhourly_str,$weekly_str,$monthly_str,$yearly_str; 
    100199        // Return a language-dependant formatted string from a task entry (from mysql) 
    101         $period_texts=array( 
    102         0 => "Le %1\$d %2\$s %3\$d a %4\$dH%5\$d", // Le 1 Janvier 2004 a 23H30 
    103         1 => "Toutes les %1\$s de %2\$dH%3\$d a %4\$dH%5\$d", // Toutes les 15 minutes de 0H00 a 23H45 
    104         2 => "Tous les jours a %1\$dH%2\$d", // Tous les jours a 12H10 
    105         3 => "Tous les %1\$s de %2\$dH%3\$d", // Tous les dimanches a 12H10 
    106         4 => "Tous les %1\$s du mois a %2\$dH%3\$d", // Tous les 4 du mois a 12H10 
    107         5 => "Tous les %1\$s %2\$s du mois a %3\$dH%4\$d", // Tous les premier lundi du mois a 12H10 
    108         6 => "Tous les %1\$d %2\$s a %3\$dH%4\$d", // Tous les 1 Janvier a 23H30 
    109         ); 
    110200        switch ($c["period"]) { 
    111201        case 0:  
    112                 $str=sprintf($period_texts[0],$c["p1"],$yearly_str[$c["p2"]],$c["p3"],$c["p4"],$c["p5"]); 
     202                $str=sprintf($this->period_texts[0],$c["p1"],$this->yearly_str[$c["p2"]],$c["p3"],$c["p4"],$c["p5"]); 
    113203        break; 
    114204        case 1: 
    115                 $str=sprintf($period_texts[1],$mhourly_str["m".$c["p1"]],$c["p2"],$c["p3"],$c["p4"],$c["p5"]); 
     205                $str=sprintf($this->period_texts[1],$this->mhourly_str["m".$c["p1"]],$c["p2"],$c["p3"],$c["p4"],$c["p5"]); 
    116206        break; 
    117207        case 2: 
    118                 $str=sprintf($period_texts[2],$c["p1"],$c["p2"]); 
     208                $str=sprintf($this->period_texts[2],$c["p1"],$c["p2"]); 
    119209        break; 
    120210        case 3: 
    121                 $str=sprintf($period_texts[3],$weekly_str[$c["p1"]],$c["p2"],$c["p3"]); 
     211                $str=sprintf($this->period_texts[3],$this->weekly_str[$c["p1"]],$c["p2"],$c["p3"]); 
    122212        break; 
    123213        case 4: 
    124                 $str=sprintf($period_texts[4],$c["p1"],$c["p2"],$c["p3"]); 
     214                $str=sprintf($this->period_texts[4],$c["p1"],$c["p2"],$c["p3"]); 
    125215        break; 
    126216        case 5: 
    127                 $str=sprintf($period_texts[5],$monthly_str[$c["p1"]],$weekly_str[$c["p2"]],$c["p3"],$c["p4"]); 
     217                $str=sprintf($this->period_texts[5],$this->monthly_str[$c["p1"]],$this->weekly_str[$c["p2"]],$c["p3"],$c["p4"]); 
    128218        break; 
    129219        case 6: 
    130                 $str=sprintf($period_texts[6],$c["p1"],$yearly_str[$c["p2"]],$c["p3"],$c["p4"],$c["p5"]); 
     220                $str=sprintf($this->period_texts[6],$c["p1"],$this->yearly_str[$c["p2"]],$c["p3"],$c["p4"],$c["p5"]); 
    131221        break; 
    132222        default: 
    133                 $str="Tache mal formattee !"; 
    134         break; 
    135         } 
    136  
    137         $action_texts=array( 
    138         0 => "Envoyer un mail a %1\$s ayant pour sujet '%2\$s' et pour contenu : \n%3\$s", 
    139         1 => "Envoyer le contenu de la page web %1\$s par mail a %2\$s.", 
    140         2 => "Appeler la page web %1\$s", 
    141         3 => "Appeler la page web %1\$s et la conserver dans un porte document.", 
    142         ); 
     223                $str=_("Task is badly formatted!"); 
     224        break; 
     225        } 
     226 
    143227        // Now the task itself :) 
    144228        switch ($c["action"]) { 
    145229        case 0: 
    146                 $str2=sprintf($action_texts[0],$c["mail"],$c["url"],$c["corpus"]); 
     230                $str2=sprintf($this->action_texts[0],$c["mail"],$c["url"],$c["corpus"]); 
    147231        break; 
    148232        case 1: 
    149                 $str2=sprintf($action_texts[1],$c["url"],$c["mail"]); 
     233                $str2=sprintf($this->action_texts[1],$c["url"],$c["mail"]); 
    150234        break; 
    151235        case 2: 
    152                 $str2=sprintf($action_texts[2],$c["url"]); 
     236                $str2=sprintf($this->action_texts[2],$c["url"]); 
    153237        break; 
    154238        case 3: 
    155                 $str2=sprintf($action_texts[3],$c["url"]); 
     239                $str2=sprintf($this->action_texts[3],$c["url"]); 
    156240        break; 
    157241        default:  
    158                 $str2="Tache mal formattee !"
     242                $str2=_("Task is badly formatted!")
    159243        break; 
    160244        }