Ejemplo n.º 1
0
             }
         }
         if ($entry['s']) {
             $testData['script'] = $entry['s'];
         }
         ValidateParameters($testData, $locations, $error, $entry['u']);
         $entry['id'] = CreateTest($testData, $entry['u']);
         if ($entry['id']) {
             $entry['v'] = array();
             foreach ($bulk['variations'] as $variation_index => &$variation) {
                 if (strlen($test['label']) && strlen($variation['l'])) {
                     $test['label'] .= ' - ' . $variation['l'];
                 }
                 $url = CreateUrlVariation($entry['u'], $variation['q']);
                 if ($url) {
                     ValidateParameters($testData, $locations, $error, $url);
                     $entry['v'][$variation_index] = CreateTest($testData, $url);
                 }
             }
             $testCount++;
         }
     }
     // write out the list of urls and the test ID for each
     if ($testCount) {
         $path = GetTestPath($test['id']);
         gz_file_put_contents("./{$path}/bulk.json", json_encode($bulk));
     } else {
         $error = 'Urls could not be submitted for testing';
     }
 } else {
     $error = "No valid urls submitted for bulk testing";
Ejemplo n.º 2
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/include/scripts/include-all.php";
if (isset($_POST)) {
    $user = $_POST["user"];
    $password = $_POST["password"];
    $retypedPassword = $_POST["retypedPassword"];
    $error = ValidateParameters($user, $password, $retypedPassword);
    if ($error->code != Error::NoError) {
        Site::Redirect("/register.php", $error);
    }
    $error = UserFacade::RegisterUser($user, $password);
    if ($error->code != Error::NoError) {
        Site::Redirect("/register.php", $error);
    }
    $error = UserFacade::LogUserIn($user, $password);
    if ($error->code != Error::NoError) {
        Site::Redirect("/log-in.php", $error);
    }
} else {
    $error = new Error(Error::InvalidParameter, "No parameter has been sent.");
    Site::Redirect("/register.php", $error);
}
Site::Redirect("/index.php");
//Checks whether parameters are correct
function ValidateParameters($user, $password, $retypedPassword)
{
    if (empty($user)) {
        return new Error(Error::InvalidParameter, "User name cannot be empty.");
    }
    if (UserFacade::IsUserRegistered($user)) {
Ejemplo n.º 3
0
        define("IN_MYBB", 1);
        chdir('forums');
        // path to MyBB
        include './global.php';
        $test['uid'] = $mybb->user['uid'];
        $test['user'] = $mybb->user['username'];
    } catch (Exception $e) {
    }
    chdir($dir);
}
// check to make sure the referrer is the same as the host
if (CheckReferrer() && CheckIp() && CheckUrl($test['url'])) {
    // load the location information
    $locations = parse_ini_file('./settings/locations.ini', true);
    $error = NULL;
    ValidateParameters($test, $locations, $error);
    if (!$error) {
        if ($test['remoteUrl']) {
            // send the test request to the remote system (only allow this for POST requests for now)
            SendRemoteTest($test, $_POST, $error);
        } else {
            // generate the test ID
            include_once 'unique.inc';
            $id = null;
            if ($test['private']) {
                $id = md5(uniqid(rand(), true));
            } else {
                $id = uniqueId();
            }
            $today = new DateTime("now", new DateTimeZone('America/New_York'));
            $test['id'] = $today->format('ymd_') . $id;
Ejemplo n.º 4
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/include/header.php";
Site::RequiresLoggedInUser("/log-in.php");
Site::RequiresPermission(Permission::AddNewChampion, "/index.php");
if (isset($_POST)) {
    $championName = $_POST["champion"];
    $file = $_FILES["image"];
    $user = UserFacade::GetLoggedUserId();
    $error = new Error();
    $error = ValidateParameters($championName, $file);
    if ($error->code != Error::NoError) {
        Site::Redirect("/add-new-champion.php", $error);
    }
    $fileName = GenerateFileNameWithPath($championName);
    $error = SaveFile($file, $fileName);
    if ($error->code != Error::NoError) {
        Site::Redirect("/add-new-champion.php", $error);
    }
    $error = ChampionFacade::AddChampion($championName, $fileName);
    if ($error->code != Error::NoError) {
        Site::Redirect("/add-new-champion.php", $error);
    }
} else {
    $error = new Error(Error::InvalidParameter, "No parameter has been sent.");
    Site::Redirect("/add-new-champion.php", $error);
}
Site::Redirect("/add-new-champion.php");
//Checks whether all provided parameters are correct
function ValidateParameters($championName, $file)
{