STUdS fork

This commit is contained in:
Simon Leblanc 2011-05-15 01:32:47 +02:00
parent 3d6148c819
commit 475556c0e3
109 changed files with 27384 additions and 0 deletions

View file

@ -0,0 +1,90 @@
<?php
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Auteur : Guilhem BORGHESI
//Création : Février 2008
//
//borghesi@unistra.fr
//
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Author : Guilhem BORGHESI
//Creation : Feb 2008
//
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
//find a copy of this license in the file LICENSE.
//
//==========================================================================
//ouverture de la connection avec la base SQL
$connect = pg_connect("host= dbname= user=");
$sondage=pg_exec($connect, "select * from sondage where format='D' or format='D+'");
for ($i=0;$i<pg_numrows($sondage);$i++){
$dsondage=pg_fetch_object($sondage,$i);
// print "Pour le sondage ".$dsondage->id_sondage." ";
$sujets=pg_exec($connect, "select sujet from sujet_studs where id_sondage='$dsondage->id_sondage'");
$dsujets=pg_fetch_object($sujets,0);
$nouvelledateaffiche="";
$anciensujethoraires=explode(",",$dsujets->sujet);
for ($j=0;$j<count($anciensujethoraires);$j++){
if (strpos('@',$anciensujethoraires[$j]) !== false){
$ancientsujet=explode("@",$anciensujethoraires[$j]);
//;([0-2]\d)/([0-2]\d)/(\d{4});
if (preg_match(";(\d{1,2})/(\d{1,2})/(\d{4});",$ancientsujet[0],$registredate)){
$nouvelledate=mktime(0,0,0,$registredate[2],$registredate[1],$registredate[3]);
// echo $ancientsujet[0].'@'.$ancientsujet[1].' ---> '.$nouvelledate.'@'.$ancientsujet[1].'<br> ';
$nouvelledateaffiche.=$nouvelledate.'@'.$ancientsujet[1].',';
}
}
else{
if (preg_match(";(\d{1,2})/(\d{1,2})/(\d{4});",$anciensujethoraires[$j],$registredate)){
$nouvelledate=mktime(0,0,0,$registredate[2],$registredate[1],$registredate[3]);
// echo $anciensujethoraires[$j].' ---- > '.$nouvelledate.'<br>';
$nouvelledateaffiche.=$nouvelledate.',';
}
}
}
$nouvelledateaffiche=substr($nouvelledateaffiche,0,-1);
print $dsujets->sujet.' donne '.$nouvelledateaffiche.'\n\n';
// pg_exec($connect,"update sujet_studs set sujet='$nouvelledateaffiche' where id_sondage='$dsondage->id_sondage'");
}
?>

View file

@ -0,0 +1,64 @@
<?php
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Auteur : Guilhem BORGHESI
//Création : Février 2008
//
//borghesi@unistra.fr
//
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Author : Guilhem BORGHESI
//Creation : Feb 2008
//
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
//find a copy of this license in the file LICENSE.
//
//==========================================================================
include_once('../fonctions.php');
//recuperation de la date
$date_courante=date("U");
$date=date('H:i:s d/m/Y:');
//ouverture de la connection avec la base SQL
$sondage=$connect->Execute("select * from sondage");
while ( $dsondage=$sondage->FetchNextObject(false)) {
if ($date_courante > strtotime($dsondage->date_fin)){
//destruction des données dans la base
$connect->Execute('DELETE FROM sondage LEFT INNER JOIN sujet_studs ON sujet_studs.id_sondage = sondage.id_sondage '.
'LEFT INNER JOIN user_studs ON user_studs.id_sondage = sondage.id_sondage ' .
'LEFT INNER JOIN comments ON comments.id_sondage = sondage.id_sondage ' .
"WHERE id_sondage = '$dsondage->id_sondage' ");
// ecriture des traces dans le fichier de logs
error_log($date . " SUPPRESSION: $dsondage->id_sondage\t$dsondage->format\t$dsondage->nom_admin\t$dsondage->mail_admin\n", '../admin/logs_studs.txt');
}
}
?>

129
scripts/phpVar2getText.php Normal file
View file

@ -0,0 +1,129 @@
<?php
/*
raphael.droz@gmail.com, dwtfywwi licence , 2010 :
choppe un fichier $vara="traduction"; dans <lang>.inc
build un assoc array
preg_replace les appels wrappés dans gettext() dans le php principal
generate un .po
(
echo -e "<?php\n\$l = array (";
sed -n '/^$.*$/s/^$\([^=]\+\)=.\(.*\).;/"\1"=>\x27\2\x27,/p' lang/en.inc;
echo '); ?>'
) > /tmp/lang.mod
(manually tweak 2 double quotes)
*/
// drop a $l which contain the array
if(isset($_SERVER['PHP_SELF']))
die(); // die if not run with php-cli
require_once('/tmp/lang.mod');
$mypath = '/var/www/studs';
/* Language, country need to be adapted */
$header = 'msgid ""
msgstr ""
"Project-Id-Version: Studs 0.6.4\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-01 18:32+0100\n"
"PO-Revision-Date: 2010-05-01 18:32+0100\n"
"Last-Translator: Raphaël Droz <raphael.droz@gmail.com>\n"
"Language-Team: Guilhem Borghesi, Raphaël Droz\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: FR\n"
"X-Poedit-Country: FRANCE\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-KeywordsList: _\n"
"X-Poedit-Basepath: /var/www/studs\n"
"X-Poedit-SearchPath-0: .\n"
';
/* helpers */
function stripN($a) {
return preg_replace("/\n/","\\n", $a);
}
function addDQ($a) {
return addcslashes($a,'"');
}
/* low priority for weak regexps (small variable length) at the end, please */
function cmp($a, $b) {
return (mb_strlen($a) < mb_strlen($b));
}
uksort($l, 'cmp');
/*
0: surely direct, like in: echo 'text ' . $var;
1: wrap in, like in: echo "$var";
2: direct, like in: echo $var . "text";
*/
$match0 = $repl0 = $match1 = $repl1 = $match2 = $repl2 = $match3 = $repl3 = array();
foreach($l as $k => $v) {
$match0[] = ';([\'"][ \.]|echo|print) *\$' . $k . ' *([\. ][\'"]|\;);' ;
$repl0[] = '\1 _("' . stripN(stripcslashes($v)) . '") \2' ;
$match1[] = ';(["\'])(.*?)\$' . $k . ';' ;
$repl1[] = '\1\2" . _("' . stripN(addcslashes(stripcslashes($v),'"')) . '") . \1' ;
$match2[] = ';\$' . $k . ';' ;
$repl2[] = '_("' . stripN(stripcslashes($v)) . '")' ;
$match3[] = ';\. *\$GLOBALS\["' . $k . '"\] *\.;' ;
$repl3[] = '. _("' . stripN(stripcslashes($v)) . '") .' ;
}
foreach (new DirectoryIterator('.') as $fileInfo) {
if($fileInfo->isDot()) continue;
$name = $fileInfo->getFilename();
// process php files
if(!preg_match('/\.php$/' , $name) ||
preg_match('/phpVar2getText/', $name))
continue;
$orig = file_get_contents($name);
$a = preg_replace($match0, $repl0, $orig, -1, $b);
$a = preg_replace($match1, $repl1, $a, -1, $c);
$a = preg_replace($match2, $repl2, $a, -1, $d);
$a = preg_replace($match3, $repl3, $a, -1, $e);
$tot = $b + $c + $e;
echo $name . ' --- ' . $tot . " (match1: $c)" . "\n";
if($tot > 0) {
file_put_contents($name . '.save', $orig);
file_put_contents($name, $a);
}
}
foreach(array('fr_FR','es_ES','de_DE', 'en_GB') as $i) {
$ii = explode('_', $i);
$f = $ii[0]; $g = $ii[1];
// de.inc corrupted the whole process !
unset($tt_adminstuds_mail_corps_changemail);
// now define each of the strings with a new langague
require_once($mypath . '/lang/' . $f . '.inc');
$a = '';
/* duplicates are fatal to poedit */
foreach(array_unique($l) as $k => $v) {
/* poedit is strict with its syntax */
$po_ready_v = stripN(addDQ($v));
if($f == 'en')
$a .= 'msgid "' . $po_ready_v . '"' . "\n" .
'msgstr "' . $po_ready_v . '"' . "\n\n";
else
$a .= 'msgid "' . $po_ready_v . '"' . "\n" .
/* ${$k} the key (var name) in the orig (EN) array
to look for as a raw $var while the <lang>.inc is included in the context */
'msgstr "' . stripN(addDQ(${$k})) . '"' . "\n\n";
}
file_put_contents('locale/' . $f . '_' . $g . '/LC_MESSAGES/Studs.po', $header . $a);
}
?>

View file

@ -0,0 +1,53 @@
#/==========================================================================
#/
#/Université de Strasbourg - Direction Informatique
#/Auteur : Guilhem BORGHESI
#/Création : Février 2008
#/
#/borghesi@unistra.fr
#/
#/Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
#/respectant les principes de diffusion des logiciels libres. Vous pouvez
#/utiliser, modifier et/ou redistribuer ce programme sous les conditions
#/de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
#/sur le site "http://www.cecill.info".
#/
#/Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
#/pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
#/termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
#/
#/==========================================================================
#/
#/Université de Strasbourg - Direction Informatique
#/Author : Guilhem BORGHESI
#/Creation : Feb 2008
#/
#/borghesi@unistra.fr
#/
#/This software is governed by the CeCILL-B license under French law and
#/abiding by the rules of distribution of free software. You can use,
#/modify and/ or redistribute the software under the terms of the CeCILL-B
#/license as circulated by CEA, CNRS and INRIA at the following URL
#/"http://www.cecill.info".
#/
#/The fact that you are presently reading this means that you have had
#/knowledge of the CeCILL-B license and that you accept its terms. You can
#/find a copy of this license in the file LICENSE.
#/
#/==========================================================================
#!/usr/bin/perl
open (FILE,"../admin/logs_studs.txt");
while (<FILE>){
/.*\t(.*u-strasbg.fr)\t.*/;
print $1."\n";
}

View file

@ -0,0 +1,57 @@
<?php
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Auteur : Guilhem BORGHESI
//Création : Février 2008
//
//borghesi@unistra.fr
//
//Ce logiciel est régi par la licence CeCILL-B soumise au droit français et
//respectant les principes de diffusion des logiciels libres. Vous pouvez
//utiliser, modifier et/ou redistribuer ce programme sous les conditions
//de la licence CeCILL-B telle que diffusée par le CEA, le CNRS et l'INRIA
//sur le site "http://www.cecill.info".
//
//Le fait que vous puissiez accéder à cet en-tête signifie que vous avez
//pris connaissance de la licence CeCILL-B, et que vous en avez accepté les
//termes. Vous pouvez trouver une copie de la licence dans le fichier LICENCE.
//
//==========================================================================
//
//Université de Strasbourg - Direction Informatique
//Author : Guilhem BORGHESI
//Creation : Feb 2008
//
//borghesi@unistra.fr
//
//This software is governed by the CeCILL-B license under French law and
//abiding by the rules of distribution of free software. You can use,
//modify and/ or redistribute the software under the terms of the CeCILL-B
//license as circulated by CEA, CNRS and INRIA at the following URL
//"http://www.cecill.info".
//
//The fact that you are presently reading this means that you have had
//knowledge of the CeCILL-B license and that you accept its terms. You can
//find a copy of this license in the file LICENSE.
//
//==========================================================================
//ouverture de la connection avec la base SQL
$connect = pg_connect("host= dbname= user=");
$sondage=pg_exec($connect, "select distinct mail_admin from sondage ");
for ($i=0;$i<pg_numrows($sondage);$i++){
$dsondage=pg_fetch_object($sondage,$i);
print "$dsondage->mail_admin, ";
// print "$dsondage->mail_admin\n";
}
?>