Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1906 → Rev 1907

/trunk/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__),
/trunk/jrest/tests/api.php
106,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;