1768 |
raphael |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
$options = getopt("hiou:d:e:p:FU:P:",array("help", "images", "obs", "user:", "domain:", "email:", "pass:", "flush", "upload:", "phpsessid"));
|
|
|
4 |
if(isset($options['h']) || isset($options['help'])) {
|
|
|
5 |
die(basename(__FILE__) . ' -i|--images -o|--obs [-u|--user = 22506] [-d|--domain = http://cel]');
|
|
|
6 |
}
|
|
|
7 |
|
|
|
8 |
define('USER', isset($options['u']) ? $options['u'] : (isset($options['user']) ? $options['user'] : 22506));
|
|
|
9 |
define('DOMAIN', isset($options['d']) ? $options['d'] : (isset($options['domain']) ? $options['domain'] : 'http://cel'));
|
|
|
10 |
define('EMAIL', isset($options['e']) ? $options['e'] : (isset($options['email']) ? $options['email'] : NULL));
|
|
|
11 |
define('PASS', isset($options['p']) ? $options['p'] : (isset($options['pass']) ? $options['pass'] : NULL));
|
|
|
12 |
define('COOKIE', isset($options['P']) ? $options['P'] : (isset($options['phpsessid']) ? $options['phpsessid'] : NULL));
|
|
|
13 |
|
|
|
14 |
// API::auth() define()'s COOKIE
|
|
|
15 |
require_once('api.php');
|
|
|
16 |
|
|
|
17 |
if(isset($options['o']) || isset($options['obs']) || isset($options['F']) || isset($options['flush'])) {
|
|
|
18 |
cel_delete_all_obs();
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
if(isset($options['i']) || isset($options['images']) || isset($options['F']) || isset($options['flush'])) {
|
|
|
22 |
cel_delete_all_images();
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
$upload = isset($options['U']) ? $options['U'] : (isset($options['upload']) ? $options['upload'] : NULL);
|
|
|
26 |
if($upload) cel_upload_image($upload);
|
|
|
27 |
|
|
|
28 |
if(! COOKIE) { if(!auth()) die('no auth'); }
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
// $csv = genCSV(array('ordre' => 1, 'Date' => '23/06/1991', 'rien' => 'rien'));
|
|
|
32 |
var_dump(getCSV_line(export(), 1));
|