1st commit
This commit is contained in:
commit
571b1f995c
|
@ -0,0 +1,3 @@
|
|||
RewriteEngine on
|
||||
|
||||
RewriteRule ^(.*)$ public_html/$1 [QSA,L]
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
/* [1] On definit les chemins absolus si c'est pas deja fait
|
||||
=========================================================*/
|
||||
if( !defined('__ROOT__') ) define('__ROOT__', dirname(__FILE__) );
|
||||
if( !defined('__CONFIG__') ) define('__CONFIG__', __ROOT__.'/config' );
|
||||
if( !defined('__BUILD__') ) define('__BUILD__', __ROOT__.'/build' );
|
||||
if( !defined('__PUBLIC__') ) define('__PUBLIC__', __ROOT__.'/public_html' );
|
||||
|
||||
|
||||
/* ACTIVE LE DEBUGGAGE (WARNING + EXCEPTION)
|
||||
*
|
||||
*/
|
||||
function debug(){
|
||||
ini_set('display_errors',1);
|
||||
ini_set('display_startup_errors',1);
|
||||
error_reporting(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* AUTOLOADER
|
||||
*
|
||||
* @className<String> Nom de la classe appelee
|
||||
*
|
||||
*/
|
||||
function autoloader($className){
|
||||
$path = '';
|
||||
|
||||
/* [1] On utilise le namespace pour localiser
|
||||
===============================================*/
|
||||
// On remplace les '\' par des '/'
|
||||
$path = str_replace('\\', '/', $className) . '.php';
|
||||
$path = __BUILD__.'/'.$path;
|
||||
|
||||
// Si le fichier existe
|
||||
if( file_exists($path) )
|
||||
require_once $path; // on inclue le fichier
|
||||
|
||||
}
|
||||
|
||||
// On definit l'autoloader comme autoloader (obvious)
|
||||
spl_autoload_register('autoloader', false, true);
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,2 @@
|
|||
Order deny,allow
|
||||
Deny from all
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
$monthList = [
|
||||
'janvier' => '01',
|
||||
'février' => '02',
|
||||
'mars' => '03',
|
||||
'avril' => '04',
|
||||
'mai' => '05',
|
||||
'juin' => '06',
|
||||
'juillet' => '07',
|
||||
'août' => '08',
|
||||
'septembre' => '09',
|
||||
'octobre' => '10',
|
||||
'novembre' => '11',
|
||||
'décembre' => '12'
|
||||
];
|
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
// Absolute root dir
|
||||
$ABSROOT = dirname(__DIR__);
|
||||
require_once "$ABSROOT/lib/months.php";
|
||||
|
||||
|
||||
/* [1] Check arguments
|
||||
=========================================================*/
|
||||
/* (1) If not enough -> abort */
|
||||
if( $argc <= 2 )
|
||||
exit(1);
|
||||
|
||||
/* (2) If @type incorrect */
|
||||
if( !in_array($argv[1], ['cursus', 'period']) )
|
||||
die(" * incorrect file type\n");
|
||||
|
||||
/* (3) Check given file */
|
||||
if( !file_exists($argv[2]) )
|
||||
die(" * file does not exist\n");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* [2] Try to access file's content
|
||||
=========================================================*/
|
||||
/* (1) Read file */
|
||||
$raw = file_get_contents($argv[2]);
|
||||
|
||||
/* (2) Manage error */
|
||||
if( !is_string($raw) )
|
||||
die(" * Cannot read file\n");
|
||||
|
||||
/* (3) Split by lines */
|
||||
$raw = explode("\n", $raw);
|
||||
|
||||
|
||||
|
||||
/* [3] Parse data
|
||||
=========================================================*/
|
||||
/* (1) Prepare the output list */
|
||||
$list = [];
|
||||
|
||||
/* (2) Cursur parser */
|
||||
if( $argv[1] == 'cursus' ){
|
||||
|
||||
foreach($raw as $line)
|
||||
if( preg_match('@"grDiplome","(?:<)?(.+)(?:>)?","T(.+)"@i', $line, $m) )
|
||||
$list[ html_entity_decode($m[1]) ] = "T${m[2]}";
|
||||
|
||||
/* (3) Period parser */
|
||||
}else{
|
||||
|
||||
$first = null;
|
||||
|
||||
foreach($raw as $line){
|
||||
|
||||
if( preg_match('@"T\d+","du \d+ au (\d+) ([a-z]+) (\d+)","T\d+S(.+)"@i', $line, $m) ){
|
||||
|
||||
/* (3.1) Translate month */
|
||||
$month = $monthList[$m[2]];
|
||||
|
||||
/* (3.2) Get date of monday */
|
||||
$list[ "S${m[4]}" ] = date('d-m-Y', strtotime("${m[1]}-$month-${m[3]} - 5 days"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [4] Write data back
|
||||
=========================================================*/
|
||||
if( !file_put_contents("$ABSROOT/../../tmp/${argv[1]}.json", json_encode($list)) )
|
||||
die(" * Cannot write parsed data back\n");
|
||||
|
||||
|
||||
exit(0);
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
// Absolute root dir
|
||||
$ABSROOT = dirname(__DIR__);
|
||||
|
||||
|
||||
|
||||
|
||||
/* [1] Check needed files
|
||||
=========================================================*/ {
|
||||
$path = [
|
||||
'cursus' => "$ABSROOT/../../tmp/cursus.json",
|
||||
'period' => "$ABSROOT/../../tmp/period.json",
|
||||
];
|
||||
|
||||
/* (1) cursus list */
|
||||
if( !file_exists($path['cursus']) )
|
||||
die(" * Missing tmp/cursus.json\n");
|
||||
|
||||
/* (2) period list */
|
||||
if( !file_exists($path['period']) )
|
||||
die(" * Missing tmp/period.json\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [2] Parse cursus list
|
||||
=========================================================*/ {
|
||||
/* (1) Read from file */
|
||||
$clist = file_get_contents($path['cursus']);
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $clist == false )
|
||||
die(" * Cannot read cursus file\n");
|
||||
|
||||
/* (3) Parse JSON */
|
||||
$clist = json_decode($clist, true);
|
||||
|
||||
/* (4) Manage error */
|
||||
if( $clist == null )
|
||||
die(" * Cannot parse cursus file\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* [3] Parse period list
|
||||
=========================================================*/ {
|
||||
|
||||
/* (1) Read from file */
|
||||
$plist = file_get_contents($path['period']);
|
||||
|
||||
/* (2) Manage error */
|
||||
if( $plist == false )
|
||||
die(" * Cannot read period file\n");
|
||||
|
||||
/* (3) Parse JSON */
|
||||
$plist = json_decode($plist, true);
|
||||
|
||||
/* (4) Manage error */
|
||||
if( $plist == null )
|
||||
die(" * Cannot parse period file\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* [4] Manage each cursus
|
||||
=========================================================*/ {
|
||||
|
||||
/* (1) For each cursus */
|
||||
foreach($clist as $cname=>$cvalue){
|
||||
|
||||
/* (1.2) Create a directory */
|
||||
if( !file_exists("$ABSROOT/../../tmp/$cvalue") )
|
||||
file_put_contents("$ABSROOT/../../tmp/$cvalue.ics", "");
|
||||
|
||||
|
||||
/* (1) Download all images
|
||||
---------------------------------------------------------*/
|
||||
foreach($plist as $pvalue=>$pdate)
|
||||
"http://sciences.univ-pau.fr/edt/diplomes/${cvalue}${pvalue}.png"; // image file
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Absolute root dir
|
||||
ABSROOT=$( dirname $(realpath $0) );
|
||||
|
||||
|
||||
|
||||
# [1] Download the list of Diplomes
|
||||
#========================================================#
|
||||
# (1) Get the diplomes list #
|
||||
wget http://sciences.univ-pau.fr/edt/_ressource.js -qO $ABSROOT/../../tmp/cursus.js && echo "* downloaded successfully" || echo "* download failed" || exit 1;
|
||||
|
||||
# (2) Get Period list #
|
||||
wget http://sciences.univ-pau.fr/edt/_periode.js -qO $ABSROOT/../../tmp/period.js && echo "* downloaded successfully" || echo "* download failed" || exit 1;
|
||||
|
||||
|
||||
|
||||
|
||||
# [2] Parse these lists
|
||||
#========================================================#
|
||||
# (1) Parse the diplomes list #
|
||||
php $ABSROOT/lib/parse.php cursus $ABSROOT/../../tmp/cursus.js && echo "* parsed successfully" || echo "* parsing failed" || exit 1;
|
||||
|
||||
# (2) Parse the period list #
|
||||
php $ABSROOT/lib/parse.php period $ABSROOT/../../tmp/period.js && echo "* parsed successfully" || echo "* parsing failed" || exit 1;
|
||||
|
||||
|
||||
|
||||
|
||||
# [3] Update ICS files
|
||||
#========================================================#
|
||||
# (1) Create ICS files #
|
||||
php $ABSROOT/lib/update.php;
|
||||
|
||||
# (2) Remove buffer data #
|
||||
rm -r $ABSROOT/../../tmp/*.ics
|
||||
|
||||
|
||||
|
||||
|
||||
# [X] Remove downloaded original files
|
||||
#========================================================#
|
||||
# (1) Remove cursus #
|
||||
rm $ABSROOT/../../tmp/cursus.js && echo "* removed successfully" || echo "* removing failed" || exit 1;
|
||||
|
||||
# (2) Remove period #
|
||||
rm $ABSROOT/../../tmp/period.js && echo "* removed successfully" || echo "* removing failed" || exit 1;
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Order deny,allow
|
||||
Deny from all
|
|
@ -0,0 +1,4 @@
|
|||
RewriteEngine on
|
||||
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.*)$ index.php?url=/$1 [QSA,L]
|
|
@ -0,0 +1,6 @@
|
|||
<?php require_once '../autoloader.php';
|
||||
|
||||
debug();
|
||||
|
||||
|
||||
echo "bla";
|
|
@ -0,0 +1 @@
|
|||
{"CMI- CBE 1\u00e8re Ann\u00e9e> CMI-CBE Bio 1\u00e8re Ann\u00e9e":"T0005396693","CMI- CBE 1\u00e8re Ann\u00e9e> CMI-CBE Chimie 1\u00e8re Ann\u00e9e":"T0005396692","CMI- CBE 2\u00e8me Ann\u00e9e> CMI-CBE Bio 2\u00e8me Ann\u00e9e":"T0005396892","CMI- CBE 2\u00e8me Ann\u00e9e> CMI-CBE Chimie 2\u00e8me Ann\u00e9e":"T0005396893","CMI- GP 1\u00e8re Ann\u00e9e> CMI-GP G\u00e9osciences 1\u00e8re Ann\u00e9e":"T0005396862","CMI- GP 1\u00e8re Ann\u00e9e> CMI-GP R\u00e9serv et Product 1\u00e8re Ann\u00e9e":"T0005396863","L1 Biologie> L1 BIO groupe 1":"T0000000491","L1 Biologie> L1 BIO groupe 2":"T0000000494","L1 Biologie> L1 BIO groupe 3":"T0005395984","L1 Biologie> L1 BIO groupe 4":"T0005396527","L1 Informatique> L1 Info Gr1":"T0005396004","L1 Informatique> L1 Info Gr2":"T0005396003","L1 Informatique> L1 Info Gr3":"T0005396450","L1 Maths> L1 MATH Gr1":"T0005396556","L1 Maths> L1 MATH Gr2":"T0005396557","L1 Maths> L1 MATH Gr3":"T0005396715","L1 MIASHS> L1 MIASHS Gr1":"T0005396232","L1 MIASHS> L1 MIASHS Gr2":"T0005396233","L1 Phys. et Chim.> L1 PC groupe 1":"T0000000488","L1 Phys. et Chim.> L1 PC groupe 2":"T0000000489","L1 Phys. et Chim.> L1 PC groupe 3":"T0005396633","L1 Sciences de la Terre> L1 SDT GR 1":"T0005396887","L1 Sciences de la Terre> L1 SDT GR 2":"T0005396888","L2 Biologie> L2 BIO GR1":"T0005396244","L2 Biologie> L2 BIO GR2":"T0005396245","L2 Biologie> L2 BIO GR3":"T0005396246","L2 Biologie> L2 BIO GR4":"T0005396690","L2 Informatique> L2 Info Gr1":"T0005395091","L2 Informatique> L2 Info Gr2":"T0005395092","L2 Informatique> L2 Info Gr3":"T0005396870","L2 Math\u00e9matiques> L2 MATH Gr 1":"T0005394768","L2 Math\u00e9matiques> L2 MATH Gr 2":"T0005396687","L3 Biologie> L3 BIO G1":"T0000000219","L3 Biologie> L3 BIO G2":"T0000000218","L3 Biologie> L3 BIO G3":"T0005396782","L3 informatique> L3 info groupe 1":"T0000000246","L3 informatique> L3 info groupe 2":"T0000000247","L3 Math\u00e9matiques> L3 Math G 1":"T0005396879","L3 Math\u00e9matiques> L3 Math G 2":"T0005396880","M1 G\u00e9nie p\u00e9trolier> M1 GP G\u00e9osciences":"T0005394886","M1 G\u00e9nie p\u00e9trolier> M1 GP Production et trait":"T0005394888","M1 G\u00e9nie p\u00e9trolier> M1 GP R\u00e9servoirs":"T0005394887","M1 Technologie de l'Internet> M1 Tech Inter groupe 1":"T0000000377","M1 Technologie de l'Internet> M1 Tech Inter groupe 2":"T0000000378","M2 G\u00e9nie p\u00e9trolier> M2 GP G\u00e9osciences":"T0005394889","M2 G\u00e9nie p\u00e9trolier> M2 GP Production et trait":"T0005394891","M2 G\u00e9nie p\u00e9trolier> M2 GP R\u00e9servoirs":"T0005394890"}
|
|
@ -0,0 +1 @@
|
|||
{"S0000000000002":"11-09-2017","S0000000000004":"18-09-2017","S0000000000008":"25-09-2017","S0000000000010":"02-10-2017","S0000000000020":"09-10-2017","S0000000000040":"16-10-2017","S0000000000080":"23-10-2017","S0000000000200":"06-11-2017","S0000000000400":"13-11-2017","S0000000000800":"20-11-2017"}
|
Loading…
Reference in New Issue