+function sendScript($path)
+{
+ global $varDir;
+
+ $listItems = array();
+ addPreviousItem($listItems, $path);
+
+ $fullPath = $varDir . $path;
+ addScriptOutput($listItems, $fullPath);
+ sendListItems($listItems);
+}
+
+function addScriptOutput(&$listItems, $fullPath)
+{
+ exec($fullPath . ' 2>&1', $output, $retVal);
+
+ if ($retVal == 0) {
+ addTextLines($listItems, $output);
+ } else {
+ $listItems[] = getMessageItem('Error executing script');
+ addTextLines($listItems, $output);
+ }
+}
+