Example #1
0
        case "convertToOOo":
        case "convertToDoc":
            $convertShellCommand = "export HOME=\"{$homeDir}\"\n" . escapeshellcmd($executable . " -writer -invisible -headless -nofirststartwizard -norestore") . " " . escapeshellarg("macro:///eZconversion.Module1.{$convertCommand}(\"{$sourceFileName}\", \"{$destinationFileName}\")") . " 2>&1 ";
            $result = shell_exec($convertShellCommand);
            break;
        default:
            throw new Exception("Unknown command {$convertCommand}", 1);
            break;
    }
    if (!file_exists($destinationFileName)) {
        throw new Exception("Unknown failure converting document \n command was: '{$convertShellCommand}' \nresult: {$result}", 3);
    }
}
echo "eZ Publish document conversion daemon\n";
// Parse input
$input = fread(STDIN, 1024);
$inputParts = explode(" ", $input);
$command = trim($inputParts[0]);
$fileName = trim($inputParts[1]);
$destName = trim($inputParts[2]);
try {
    if (!file_exists($fileName)) {
        throw new Exception("File not found: {$fileName}", 2);
    }
    sleep(10);
    convertTo($fileName, $command, $destName, $ooexecutable, $homeDir);
    echo "FilePath: {$destName}\n";
} catch (Exception $e) {
    echo "Error: (", $e->getCode(), ") - ", $e->getMessage(), "\n";
    die($e->getCode());
}
Example #2
0
    }
    return 'Резултат: ' . $result;
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>Home3</title>
	</head>
	<body>
		<?php 
if ($_POST) {
    ?>
			<p> <?php 
    echo convertTo($gradus, $convert);
    ?>
</p>
		<?php 
}
?>
		<form method="post">
			<div>
				<label for="gradus">Градуси</label>
				<input type="text" id="gradus" name="gradus" >
			</div>
			<div>
				<label for="pass">Password</label>
				<select name="convert">
					<option value="1">C to F</option>
					<option value="2">F to C</option>