$description = $_REQUEST['description'];
$contact = $_REQUEST['contact'];
$contactemail = $_REQUEST['contactemail'];
if (!($active = $_REQUEST['active'])) {
    $active = 0;
}
try {
    if ($id) {
        $q = Doctrine_Query::create()->from('WPTHost h')->where('h.Id= ?', $id);
        $result = $q->fetchOne();
        $q->free(true);
        if ($result) {
            $wptHost = $result;
        } else {
            //TODO: Passed in an Id, but didn't find it. Add error here.
        }
    } else {
        $wptHost = new WPTHost();
    }
    $wptHost['Active'] = $active;
    $wptHost['Label'] = $label;
    $wptHost['Description'] = $description;
    $wptHost['HostURL'] = $hosturl;
    $wptHost['Contact'] = $contact;
    $wptHost['ContactEmailAddress'] = $contactemail;
    $wptHost->save();
} catch (Exception $e) {
    error_log("[WPTMonitor] Failed while updating host" . $e->getMessage());
}
header("Location: listHosts.php");
exit;
Example #2
0
             $user['Username'] = $adminUsername;
             $user['LastName'] = $adminFirstName;
             $user['FirstName'] = $adminLastName;
             $user['Password'] = $adminPassword;
             $user['IsSuperAdmin'] = true;
             $user['IsActive'] = true;
             $user['MaxJobsPerMonth'] = 9999999;
             $user['EmailAddress'] = $adminEmailAddress;
             $user->save();
             $host = new WPTHost();
             $host['Active'] = true;
             $host['Label'] = $hostLabel;
             $host['Contact'] = $hostContact;
             $host['ContactEmailAddress'] = $hostContactEmail;
             $host['HostURL'] = $hostUrl;
             $host->save();
             $_SESSION['ls_id'] = 1;
             //include 'FixFolders.php';
             updateLocations(1);
             header("Location: install.php?step=3");
         } else {
             echo "<br><h2>Warning!</h2><br><h3>Database file already exists.<br></h3>To reinitialize remove/drop the wpt_monitor database. If using sqlite this will be wpt_monitor.sqlite in the db direcotry.<br>";
         }
     } catch (Exception $e) {
         echo $e;
     }
 } else {
     if ($step == "3") {
         echo "Creating db...<br>";
         echo "Initializing configuration...<br>";
         echo "Creating admin user...<br>";