if (isset($parsed_url['query']) && !empty($parsed_url['query'])) { // if anything, might want to CURL it :) foreach (explode('&', $parsed_url['query']) as $chunk) { $param = explode("=", $chunk); if ($param) { $parameter_name = urldecode($param[0]); ${$parameter_name} = urldecode($param[1]); } } if (isset($launch_plugin) && $launch_plugin == 1) { // need the following defined //echo $plugin.PHP_EOL; //echo $script.PHP_EOL; //echo $feedname.PHP_EOL; //echo $status.PHP_EOL; $command = PluginC::getExecutable(sanitize($plugin . PHP_EOL)); $command .= ' ' . $ncommand; $command .= ' --output {OUTPUT}/'; echo $command . PHP_EOL; $username = $_SESSION['username']; $password = $_SESSION['password']; $feed_id = -1; $jobid = ''; $memory = 2048; // import launcher.php include 'controller/launcher.php'; } // then clean URL, back to main entry point header("Location: ?"); exit; }
$password = $_SESSION['password']; $feedname = sanitize($_POST['FEED_NAME']); if (isset($_POST['FEED_STATUS'])) { // status, if we don't want to start with status=0 $status = sanitize($_POST['FEED_STATUS']); } else { $status = 0; } if (isset($_POST['FEED_MEMORY'])) { // memory, if we don't want to start with memory=256 $memory = sanitize($_POST['FEED_MEMORY']); } else { $memory = 2048; } // plugin name? $command = PluginC::getExecutable(sanitize($_POST['FEED_PLUGIN'])); // parameters? $parentFolder = null; if (is_array($v0)) { foreach ($v0 as $key => $value) { if ($value['type'] == 'dropzone' && $value['value'] != '') { $value['value'] = joinPaths(CHRIS_USERS, $value['value']); if (!$parentFolder) { // no parent folder set yet, so let's grab this value if (is_dir($value['value'])) { // this is already the directory $parentFolder = $value['value']; } else { $parentFolder = dirname($value['value']); } }
/** * Get the UI of a given plugin. * * This queries the plugin executable for a XML * representation (Slicer Execution Model) and converts * it to HTML/JS. * * @param string $plugin The plugin name. * @param array $user_configuration User specific configuration. * @return string The resulting HTML UI representation. */ public static function getUI($plugin) { $p_executable = PluginC::getExecutable($plugin); // probe for the ui xml $p_xml = array(); // note: we also redirect stderr here to get the full output $configuration = ''; $config = isset($_SESSION['userconf'][$plugin]) ? $_SESSION['userconf'][$plugin] : false; if ($config != false) { $configuration = ' --configuration=' . escapeshellarg(json_encode($config)); } exec($p_executable . ' --xml' . $configuration . ' 2>&1', $p_xml); $p_xml = implode($p_xml); // thanks to http://www.tonymarston.net/php-mysql/xsl.html // requires sudo apt-get install php5-xsl // we need a XSLT processor $xp = new XSLTProcessor(); // load the XSL stylesheet $xsl = new DOMDocument(); $xsl->load(CHRIS_PLUGINS_FOLDER . DIRECTORY_SEPARATOR . 'sem2html.xsl'); // attach it to the processor $xp->importStylesheet($xsl); // ..transform the XML to HTML $html = $xp->transformToXML(new SimpleXMLElement($p_xml)); // replace plugin name variable $html = str_replace('${PLUGIN_NAME}', $plugin, $html); // ... and the executable $html = str_replace('${PLUGIN_EXECUTABLE}', $p_executable, $html); return $html; }