/branches/v1.7-croissant/jrest/tests/cmd-test.php |
---|
1,9 → 1,10 |
#!/usr/bin/env php |
<?php |
define('DEFAULT_DOMAIN', 'http://cel'); |
define('DEFAULT_USER', 22506); |
$options = getopt("hiou:d:e:p:FU:P:",array("help", "images", "obs", "user:", "domain:", "email:", "pass:", "flush", "upload:", "phpsessid")); |
$options = getopt("hiou:d:e:p:FU:P:D",array("help", "images", "obs", "user:", "domain:", "email:", "pass:", "flush", "upload:", "phpsessid", "debug")); |
if(isset($options['h']) || isset($options['help'])) die(__help()); |
11,8 → 12,11 |
define('DOMAIN', isset($options['d']) ? $options['d'] : (isset($options['domain']) ? $options['domain'] : DEFAULT_DOMAIN)); |
define('EMAIL', isset($options['e']) ? $options['e'] : (isset($options['email']) ? $options['email'] : NULL)); |
define('PASS', isset($options['p']) ? $options['p'] : (isset($options['pass']) ? $options['pass'] : NULL)); |
define('COOKIE', isset($options['P']) ? $options['P'] : (isset($options['phpsessid']) ? $options['phpsessid'] : NULL)); |
define('DEBUG', isset($options['D']) ? 1 : (isset($options['debug']) ? 1 : 0)); |
if (isset($options['P'])) define('COOKIE', $options['P']); |
elseif (isset($options['phpsessid'])) define('COOKIE', $options['phpsessid']); |
// API::auth() define()'s COOKIE |
require_once('api.php'); |
27,7 → 31,7 |
$upload = isset($options['U']) ? $options['U'] : (isset($options['upload']) ? $options['upload'] : NULL); |
if($upload) cel_upload_image($upload); |
if(! COOKIE) { if(!auth()) die('no auth'); } |
if(! defined('COOKIE')) { if(!auth()) die('no auth'); } |
// $csv = genCSV(array('ordre' => 1, 'Date' => '23/06/1991', 'rien' => 'rien')); |
58,8 → 62,9 |
La priorité est donnée à -P sur le couple (-e , -p) pour l'authentification, eg: |
$ sqlite3 .mozilla/firefox/*.default/cookies.sqlite<<<"SELECT * FROM moz_cookies WHERE baseDomain = 'cel' AND name = 'PHPSESSID';" |
%1\$s -u|--upload <file> |
%1\$s -U|--upload <file> |
Upload le fichier "file". |
EOF |
, // */ |
basename(__FILE__), |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nonom-nonum.result.php |
---|
New file |
0,0 → 1,0 |
<?php return array ( 'nom_referentiel' => 'autre' ); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nom-nonum.test.php |
---|
New file |
0,0 → 1,9 |
<?php |
/* test détermination setting du référentiel: |
Théorie, valable pour insert et update: |
- pas de nom_sel = pas de num_nom |
MAIS: |
- pas de nom_sel = pas de référentiel (NULL) |
- nom_sel mais pas de num_nom = référentiel = "autre" |
*/ |
return array('data' => array('nom_referentiel' => 'bdtfx', 'nom_sel' => 'blah')); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-from-nom-ret.test.php |
---|
New file |
0,0 → 1,3 |
<?php |
// test détermination espèce avec un nom retenu (contenant déjà le nom_sci concaténé) |
return array('data' => array('Espèce' => 'Hieracium lysanum Arv.-Touv. & Gaut.', 'nom_referentiel' => 'bdtfx')); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-badref-bdnffnn.result.php |
---|
1,3 → 1,3 |
<?php return array ( |
'nom_sel' => 'bdtfx:nn:72475', |
'nom_referentiel' => 'bdtxa'); |
'nom_sel' => 'Viola riviniana subsp. bavarica', |
'nom_referentiel' => 'bdtfx'); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nonom-nonum.test.php |
---|
New file |
0,0 → 1,9 |
<?php |
/* test détermination setting du référentiel: |
Théorie, valable pour insert et update: |
- pas de nom_sel = pas de num_nom |
MAIS: |
- pas de nom_sel = pas de référentiel (NULL) |
- nom_sel mais pas de num_nom = référentiel = "autre" |
*/ |
return array('data' => array('nom_referentiel' => 'bdtfx')); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nom-nonum.result.php |
---|
New file |
0,0 → 1,0 |
<?php return array ('nom_sel' => 'blah','nom_referentiel' => 'autre'); |
/branches/v1.7-croissant/jrest/tests/phptests/transmission.result.php |
---|
1,4 → 1,6 |
<?php return array ( |
<?php |
date_default_timezone_set("Europe/Paris"); |
return array ( |
'transmission' => 'oui', |
//'date_transmission' => '2013-07-26 18:20:08', |
'date_transmission' => date("Y-m-d H:i:s") // attention au décallage (1sec par exemple) |
); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nonom-num.test.php |
---|
New file |
0,0 → 1,9 |
<?php |
/* test détermination setting du référentiel: |
Théorie, valable pour insert et update: |
- pas de nom_sel = pas de num_nom |
MAIS: |
- pas de nom_sel = pas de référentiel (NULL) |
- nom_sel mais pas de num_nom = référentiel = "autre" |
*/ |
return array('data' => array('nom_referentiel' => 'bdtfx', 'nom_sel_nn' => 182)); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nom-num.result.php |
---|
New file |
0,0 → 1,0 |
<?php return array ('nom_sel' => 'blah','nom_referentiel' => 'autre'); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-bdnffnt.result.php |
---|
1,7 → 1,7 |
<?php return array ( |
'nom_sel' => 'Viola riviniana subsp. riviniana', |
'nom_sel' => 'Viola riviniana f. riviniana', |
'nom_sel_nn' => '72478', |
'nom_ret' => 'Viola riviniana subsp. riviniana', |
'nom_ret' => 'Viola riviniana f. riviniana', |
'nom_ret_nn' => '72478', |
'nt' => '5757', |
'famille' => 'Violaceae', |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-noref-bdnffnn.result.php |
---|
1,3 → 1,3 |
<?php return array ( |
'nom_sel' => 'bdtfx:nn:72475', |
'nom_referentiel' => 'autre'); |
'nom_sel' => 'Viola riviniana subsp. bavarica', |
'nom_referentiel' => 'bdtfx'); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-ref-badbdnffnn.result.php |
---|
New file |
0,0 → 1,4 |
<?php return array ( |
'nom_sel' => 'bdtfx:nn:72475000', |
'nom_referentiel' => 'autre', |
); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nonom-num.result.php |
---|
New file |
0,0 → 1,0 |
<?php return array ('nom_referentiel' => 'autre'); |
/branches/v1.7-croissant/jrest/tests/phptests/ref-nom-num.test.php |
---|
New file |
0,0 → 1,9 |
<?php |
/* test détermination setting du référentiel: |
Théorie, valable pour insert et update: |
- pas de nom_sel = pas de num_nom |
MAIS: |
- pas de nom_sel = pas de référentiel (NULL) |
- nom_sel mais pas de num_nom = référentiel = "autre" |
*/ |
return array('data' => array('nom_referentiel' => 'bdtfx', 'nom_sel' => 'blah', 'nom_sel_nn' => -42)); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-from-nom-ret.result.php |
---|
New file |
0,0 → 1,9 |
<?php return array ( |
'nom_sel' => 'Hieracium lysanum Arv.-Touv. & Gaut.', |
'nom_sel_nn' => '33392', |
'nom_ret' => 'Hieracium lysanum Arv.-Touv. & Gaut.', |
'nom_ret_nn' => '33392', |
'nt' => '11235', |
'famille' => 'Asteraceae', |
'nom_referentiel' => 'bdtfx' |
); |
/branches/v1.7-croissant/jrest/tests/phptests/determ-espece-ref-badbdnffnn.test.php |
---|
New file |
0,0 → 1,3 |
<?php |
// test détermination espèce avec mauvais bdnffnn mais bon référentiel |
return array('data' => array('Espèce' => 'bdtfx:nn:72475000', 'nom_referentiel' => 'bdtfx')); |
/branches/v1.7-croissant/jrest/tests/api.php |
---|
36,6 → 36,8 |
'phenologie' => 'Phénologie', |
'images' => 'Image(s)', |
'nom_commun' => 'Nom Commun', |
'observateur' => 'Observateur', |
); |
104,8 → 106,10 |
'ce_utilisateur' => USER |
)); |
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE); |
//curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE); |
//execute post |
if(DEBUG) @fwrite(STDERR, sprintf("curl -F file=@%s '%s'\n", $file, $URL)); |
$result = curl_exec($ch); |
curl_close($ch); |
return $result; |