<?php require "login/login.php"; include 'monitor.inc'; if (isset($_REQUEST['id'])) { $script_id = $_REQUEST['id']; } $user_id = getCurrentUserId(); if (isset($script_id)) { $folderId = getFolderIdFor($script_id, 'WPTScript'); } else { $folderId = $_REQUEST['folderId']; } if (!hasPermission('WPTScript', $folderId, PERMISSION_UPDATE)) { echo "Invalid Permission"; exit; } if (isset($script_id)) { $q = Doctrine_Query::create()->from('WPTScript s')->andWhere('s.Id= ?', $script_id); $script = $q->fetchOne(); $q->free(true); } else { $script = new WPTScript(); } $folderTree = getFolderTree($user_id, 'WPTScript'); $shares = getFolderShares($user_id, 'WPTScript'); $smarty->assign('folderTree', $folderTree); $smarty->assign('shares', $shares); $smarty->assign('folderId', $folderId); $smarty->assign('script', $script); $smarty->display('script/addScript.tpl');
<?php require "login/login.php"; include 'monitor.inc'; $userId = getCurrentUserId(); $id = $_REQUEST['id']; if ($id) { $folderId = getFolderIdFor($id, 'WPTJob'); } else { $folderId = $_REQUEST['folderId']; } if ($_REQUEST['active']) { $active = 1; } else { $active = 0; } $label = $_REQUEST['label']; $description = $_REQUEST['description']; $location = $_REQUEST['location']; $script = $_REQUEST['script']; $alerts = $_REQUEST['alerts']; // Extract host and location from $location field $hostloc = explode(" ", $location); $host = $hostloc[0]; $location = $hostloc[1]; $frequency = $_REQUEST['frequency']; $maxDownloadAttempts = $_REQUEST['maxdownloadattempts']; $numberOfRuns = $_REQUEST['numberofruns']; $runToUserForAverage = $_REQUEST['runtouseforaverage']; if ($runToUserForAverage > $numberOfRuns) { $smarty->assign('errorMessage', "Run to use for average must be equal to or less than number of runs.");
$key = $loc['Location']; $wptLocs[$loc->WPTHost['HostURL'] . ' ' . $key] = $loc['Label'] . ' (' . $key . ' ' . $loc->WPTHost['HostURL'] . ')'; } if (isset($jobId)) { $q = Doctrine_Query::create()->from('WPTJob j')->where('j.Id= ?', $jobId); $result = $q->fetchOne(); $q->free(true); $scriptId = $result['WPTScript']['Id']; $smarty->assign('selectedLocation', $result['Host'] . ' ' . $result['Location']); } else { $result = new WPTJob(); $result['Frequency'] = 60; $smarty->assign('selectedLocation', ''); } if (isset($scriptId)) { $scriptFolderId = getFolderIdFor($scriptId, 'WPTScript'); $canChangeScript = hasPermission('WPTScript', $scriptFolderId, PERMISSION_UPDATE); } else { $canChangeScript = true; } $smarty->assign('canChangeScript', $canChangeScript); if (!$result['WPTBandwidthDown'] && $result['WPTBandwidthDown'] != 0) { $result['WPTBandwidthDown'] = 1500; } if (!$result['WPTBandwidthUp'] && $result['WPTBandwidthUp'] != 0) { $result['WPTBandwidthUp'] = 384; } if (!$result['WPTBandwidthLatency'] && $result['WPTBandwidthLatency'] != 0) { $result['WPTBandwidthLatency'] = 50; } if (!$result['WPTBandwidthPacketLoss'] && $result['WPTBandwidthPacketLoss'] != 0) {