Esempio n. 1
0
 function LoadXml($xml)
 {
     // Create the XML Parser.
     $this->_XmlParser = xml_parser_create('');
     // Setup the parser.
     xml_parser_set_option($this->_XmlParser, XML_OPTION_SKIP_WHITE, 1);
     xml_set_object($this->_XmlParser, $this);
     xml_set_element_handler($this->_XmlParser, '_ElementOpen', '_ElementClosed');
     xml_set_character_data_handler($this->_XmlParser, '_ElementData');
     // Parse it.
     if (!xml_parse($this->_XmlParser, $xml)) {
         ExitError(sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->_XmlParser)), xml_get_current_line_number($this->_XmlParser)));
     }
     // Release the parser.
     xml_parser_free($this->_XmlParser);
     unset($this->_XmlParser);
     unset($this->_CurrentNode);
     // For debug purposes:
     // SaveStringToFile( print_r( $this, TRUE ), 'parsed.txt' ) ;
     // print_r( $this ) ;
     // exit ;
     return TRUE;
 }
Esempio n. 2
0
 * == END LICENSE ==
 */
echo "\n";
echo 'FCKreleaser - FCKeditor Releaser' . "\n";
echo 'Copyright 2003-2007 Frederico Caldeira Knabben - All rights reserved' . "\n";
echo "\n";
require_once 'includes/fckreleaser.inc';
require_once 'includes/fckversionmarker.inc';
require_once 'includes/fckpackager/common.inc';
require_once 'includes/fckpackager/fckpackager.inc';
// Check the number of arguments passed. The first one is the script name.
if (count($argv) > 5) {
    ExitError('Invalid arguments. Operation aborted.');
}
if (count($argv) < 4) {
    ExitError('Please specify the source and the target directories and the version number.');
}
$sourceDir = $argv[1];
$targetDir = $argv[2];
$version = $argv[3];
// Get the package definition file.
$xmlFileName = 'fckreleaser.xml';
if (isset($argv[4])) {
    $xmlFileName = $argv[4];
}
echo '### Release started', "\n\n";
// ### Copy the files.
$releaser = new FCKReleaser($sourceDir, $targetDir, $xmlFileName);
$releaser->Run();
// ### Set version and build information.
FCKVersionMarker::Mark($targetDir, $version);
Esempio n. 3
0
    $mys = new MySensorSendEthernet($argv[1], $opts['p']);
}
$ack = isset($opts['a']) ? 1 : 0;
$wait = isset($opts['g']) ? 1 : 0;
$verbose = isset($opts['v']) ? 1 : 0;
$commands = array_keys($mys->getMessageTypes());
if (!in_array($argv[2], $commands)) {
    ExitError("Unknow command '{$argv[2]}' !");
}
if ($argv[2] == 'set' and !isset($argv[6])) {
    ExitError("Missing payload argument");
}
$r = $mys->sendMessage($argv[3], $argv[4], $argv[2], $ack, $argv[5], $argv[6], $wait);
if ($wait) {
    if ($r) {
        echo "{$r}\n";
    } else {
        ExitError("No answer received or command failed!");
    }
}
if ($verbose) {
    echo " - Message : " . $mys->getRawMessage() . "\n";
    if ($wait and $r) {
        echo " - Answer  : " . $mys->getRawAnswer() . "\n";
    }
}
if ($r) {
    exit(0);
} else {
    ExitError("Command Failed !!!!\n\tPlease check Gateway is responding correctly.", 0);
}
Esempio n. 4
0
function ReadMandatoryParam($oP, $sParam)
{
    $sValue = utils::ReadParam($sParam, null, true, 'raw_data');
    if (is_null($sValue)) {
        ExitError($oP, "ERROR: Missing argument '{$sParam}'");
    }
    return trim($sValue);
}