69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
#!/usr/bin/php
|
|
<?
|
|
require_once ("inc/utils.inc");
|
|
//require_once ("inc/utils-devl.inc");
|
|
//phpinfo();
|
|
// parsing argument list
|
|
$options = parseArgs($_SERVER['argv']);
|
|
if(empty($options))
|
|
exit;
|
|
|
|
debugPrint("input data: ", $options);
|
|
|
|
// check options
|
|
if(checkopts($options))
|
|
exit;
|
|
|
|
// analyze command
|
|
if(empty($options['f'])) // command mode
|
|
{
|
|
echo "Analyze command.....\n";
|
|
$dataes = array();
|
|
// read file
|
|
if(!empty($options['read_path'])) {
|
|
$filedata = array();
|
|
$filedata = filereaddata($options['read_path']);
|
|
|
|
if(empty($filedata))
|
|
exit;
|
|
// parsing file data
|
|
$dataes = parsefiledata($options['m'], $filedata);
|
|
|
|
if(empty($dataes))
|
|
exit;
|
|
}
|
|
else {
|
|
$dataes[] = "empty_data";
|
|
}
|
|
|
|
foreach($dataes as $data) {
|
|
if(is_array($data))
|
|
{
|
|
setOption($options, $data);
|
|
}
|
|
// convert to ISM command
|
|
$command = convert2ISMcommand($options);
|
|
debugPrint("ISM command data: ", $command);
|
|
|
|
// insert ISM
|
|
if(!insertData($command))
|
|
echo "Success. \n";
|
|
}
|
|
}
|
|
else // file mode
|
|
{
|
|
echo "File Read.....\n";
|
|
|
|
// read file
|
|
$readdate = filereaddata($options['f']);
|
|
if(empty($readdate))
|
|
exit;
|
|
|
|
// analyze read data... Here is implemented in the future.
|
|
debugPrint("File read data: ", $readdate);
|
|
$data = parsefiledata($readdate);
|
|
if(empty($readdate))
|
|
exit;
|
|
}
|
|
?>
|