Exemplo n.º 1
0
 public function passwordVerify($email, $password)
 {
     include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
     $profile = new Profile();
     $hash = $profile->gimme("hash", "email", $email);
     if (password_verify($password, $hash)) {
         return true;
     }
     $_SESSION["debug"] = $hash;
 }
Exemplo n.º 2
0
function generateResults($searchOccupation, $searchCause, $searchLocation)
{
    $search = new Search();
    $results = $search->results($searchOccupation, $searchCause, $searchLocation);
    list($exact, $differentCause, $differentOccupation, $locationOnly) = $results;
    $generatedResults = "";
    $profile = new Profile();
    if (!empty($exact)) {
        foreach ($exact as $id) {
            $photo = "/app/controller/avatar.controller.php?id=" . $id;
            $name = $profile->gimme("name", "id", $id);
            $occupation = $profile->gimme("occupation", "id", $id);
            $location = $profile->gimme("location", "id", $id);
            $summary = $profile->gimme("summary", "id", $id);
            $exactResult = "<div class=\"result\">";
            // Profile URL
            $exactResult .= "<a href=\"/forger/" . $id . "/\"><span></span></a>";
            //Photo
            $exactResult .= "<div class=\"photo\">";
            $exactResult .= "<img src=\"" . $photo . "\">";
            $exactResult .= "</div>";
            $exactResult .= "<div class=\"info\">";
            //Name
            $exactResult .= "<div class=\"name\"><h3>";
            $exactResult .= $name;
            $exactResult .= "</h3></div>";
            //Occupation
            $exactResult .= "<div class=\"occupation\"><h4>";
            $exactResult .= $occupation;
            $exactResult .= "</h4></div>";
            //Location
            $exactResult .= "<div class=\"location\"><h4>";
            $exactResult .= $location;
            $exactResult .= "</h4></div>";
            //Summary
            $exactResult .= "<div class=\"summary\">";
            $exactResult .= $summary;
            $exactResult .= "</div>";
            $exactResult .= "</div>";
            $exactResult .= "</div>";
        }
        $generatedResults .= $exactResult;
    } else {
        $generatedResults .= "<p id=\"nomatch\">Sorry! No artists match that exact criteria.</p>";
    }
    if (!empty($differentCause)) {
        $differentCauseResult = "<h2>Other <strong>{$searchOccupation}s</strong> in <strong>{$searchLocation}</strong></h2>";
        foreach ($differentCause as $id) {
            $photo = "/app/controller/avatar.controller.php?id=" . $id;
            $name = $profile->gimme("name", "id", $id);
            $occupation = $profile->gimme("occupation", "id", $id);
            $location = $profile->gimme("location", "id", $id);
            $summary = $profile->gimme("summary", "id", $id);
            // Profile URL
            $differentCauseResult .= "<div class=\"result\"><a href=\"/forger/" . $id . "/\"><span></span></a>";
            //Photo
            $differentCauseResult .= "<div class=\"photo\">";
            $differentCauseResult .= "<img src=\"" . $photo . "\">";
            $differentCauseResult .= "</div>";
            $differentCauseResult .= "<div class=\"info\">";
            //Name
            $differentCauseResult .= "<div class=\"name\"><h3>";
            $differentCauseResult .= $name;
            $differentCauseResult .= "</h3></div>";
            //Occupation
            $differentCauseResult .= "<div class=\"occupation\"><h4>";
            $differentCauseResult .= $occupation;
            $differentCauseResult .= "</h4></div>";
            //Location
            $differentCauseResult .= "<div class=\"location\"><h4>";
            $differentCauseResult .= $location;
            $differentCauseResult .= "</h4></div>";
            //Summary
            $differentCauseResult .= "<div class=\"summary\">";
            $differentCauseResult .= $summary;
            $differentCauseResult .= "</div>";
            $differentCauseResult .= "</div>";
            $differentCauseResult .= "</div>";
        }
        $generatedResults .= $differentCauseResult;
    }
    if (!empty($differentOccupation)) {
        $differentOccupationResult = "<h2>Other artists in <strong>{$searchLocation}</strong> who support <strong>{$searchCause}</strong></h2>";
        foreach ($differentOccupation as $id) {
            $photo = "/app/controller/avatar.controller.php?id=" . $id;
            $name = $profile->gimme("name", "id", $id);
            $occupation = $profile->gimme("occupation", "id", $id);
            $location = $profile->gimme("location", "id", $id);
            $summary = $profile->gimme("summary", "id", $id);
            // Profile URL
            $differentOccupationResult .= "<div class=\"result\"><a href=\"/forger/" . $id . "/\"><span></span></a>";
            //Photo
            $differentOccupationResult .= "<div class=\"photo\">";
            $differentOccupationResult .= "<img src=\"" . $photo . "\">";
            $differentOccupationResult .= "</div>";
            $differentOccupationResult .= "<div class=\"info\">";
            //Name
            $differentOccupationResult .= "<div class=\"name\"><h3>";
            $differentOccupationResult .= $name;
            $differentOccupationResult .= "</h3></div>";
            //Occupation
            $differentOccupationResult .= "<div class=\"occupation\"><h4>";
            $differentOccupationResult .= $occupation;
            $differentOccupationResult .= "</h4></div>";
            //Location
            $differentOccupationResult .= "<div class=\"location\"><h4>";
            $differentOccupationResult .= $location;
            $differentOccupationResult .= "</h4></div>";
            //Summary
            $differentOccupationResult .= "<div class=\"summary\">";
            $differentOccupationResult .= $summary;
            $differentOccupationResult .= "</div>";
            $differentOccupationResult .= "</div>";
            $differentOccupationResult .= "</div>";
        }
        $generatedResults .= $differentOccupationResult;
    }
    if (!empty($locationOnly)) {
        $locationOnlyResult = "<h2>Other artists in <strong>{$searchLocation}</strong></h2>";
        foreach ($locationOnly as $id) {
            $photo = "/app/controller/avatar.controller.php?id=" . $id;
            $name = $profile->gimme("name", "id", $id);
            $occupation = $profile->gimme("occupation", "id", $id);
            $location = $profile->gimme("location", "id", $id);
            $summary = $profile->gimme("summary", "id", $id);
            // Profile URL
            $locationOnlyResult .= "<div class=\"result\"><a href=\"/forger/" . $id . "/\"><span></span></a>";
            //Photo
            $locationOnlyResult .= "<div class=\"photo\">";
            $locationOnlyResult .= "<img src=\"" . $photo . "\">";
            $locationOnlyResult .= "</div>";
            $locationOnlyResult .= "<div class=\"info\">";
            //Name
            $locationOnlyResult .= "<div class=\"name\"><h3>";
            $locationOnlyResult .= $name;
            $locationOnlyResult .= "</h3></div>";
            //Occupation
            $locationOnlyResult .= "<div class=\"occupation\"><h4>";
            $locationOnlyResult .= $occupation;
            $locationOnlyResult .= "</h4></div>";
            //Location
            $locationOnlyResult .= "<div class=\"location\"><h4>";
            $locationOnlyResult .= $location;
            $locationOnlyResult .= "</h4></div>";
            //Summary
            $locationOnlyResult .= "<div class=\"summary\">";
            $locationOnlyResult .= $summary;
            $locationOnlyResult .= "</div>";
            $locationOnlyResult .= "</div>";
            $locationOnlyResult .= "</div>";
        }
        $generatedResults .= $locationOnlyResult;
    }
    return $generatedResults;
}
Exemplo n.º 3
0
        $_SESSION["status"] = "It looks like you&rsquo;re already signed&ndash;up. Do you need to <a href=\"\">reset your password</a>?";
        header("Location: /join-us/");
    } else {
        // Send the user an email to confirm their email address
        $signUp->mailConfirmation($email);
        // Go ahead and get them signed-up and set their identifying number
        $_SESSION["id"] = $signUp->insertArtist($email, $hash);
        // Let them know to check for the confirmation email
        $_SESSION["status"] = "Great! You&rsquo;re all signed&ndash;up. We&rsquo;ve sent you an email with a link to click so that we can confirm your email address. <i>Be sure and double check your spam folder</i> :)";
        // Kick them to edit their profile
        header("Location: /profile/edit/");
    }
} else {
    if (isset($_GET["confirm"])) {
        $email = $signUp->confirmEmail($_GET["confirm"]);
        if ($email === null) {
            $_SESSION["status"] = "We received an unknown confirmation key somehow.";
            header("Location: /join-us/");
        } else {
            include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
            $profile = new Profile();
            $_SESSION["id"] = $profile->gimme("id", "email", $email);
            $_SESSION["status"] = "Thanks for confirming your email.";
            header("Location: /profile/");
        }
    } else {
        if (isset($_SESSION["id"]) && !empty($_SESSION["id"])) {
            header("Location: /profile/");
        }
    }
}
Exemplo n.º 4
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
$profile = new Profile();
if (!empty($_POST) && $_SERVER['REQUEST_URI'] != "/search/") {
    $id = $_SESSION["id"];
    if (empty($profile->gimme("name", "id", $id))) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/sign-up.model.php";
        $signUp = new signUp();
        $signUp->notifySlack($id, $_POST["name"], $_POST["occupation"], $_POST["location"], $_POST["cause"]);
    }
    if (!empty($_FILES["photo"]["name"])) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/avatar.model.php";
        $avatar = new Avatar();
        $avatar->save($_FILES["photo"], $id);
    }
    if (isset($_POST["jcrop-x"]) && $_POST["jcrop-w"] != 0) {
        // Create array to hold jcrop values
        $jcrop = array();
        // Push incoming jcrop values to jcrop[]
        array_push($jcrop, $_POST["jcrop-x"], $_POST["jcrop-y"], $_POST["jcrop-w"], $_POST["jcrop-h"]);
        // Get Avatar class so we can crop
        include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/avatar.model.php";
        $avatar = new Avatar();
        $avatar->crop($jcrop, $id);
    }
    unset($_POST["jcrop-x"]);
    unset($_POST["jcrop-y"]);
    unset($_POST["jcrop-w"]);
    unset($_POST["jcrop-h"]);
Exemplo n.º 5
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
$profile = new Profile();
$forgerId = intval($_GET["forger"]);
$forgerName = $profile->gimme("name", "id", $forgerId);
$forgerLocation = $profile->gimme("location", "id", $forgerId);
$forgerCause = $profile->gimme("cause", "id", $forgerId);
$forgerWebsite = $profile->gimme("website", "id", $forgerId);
$forgerOccupation = $profile->gimme("occupation", "id", $forgerId);
$forgerAbout = $profile->gimme("about", "id", $forgerId);
$forgerSummary = $profile->gimme("summary", "id", $forgerId);
$forgerCurrentprojects = $profile->gimme("currentprojects", "id", $forgerId);
$forgerPhoto = "/app/controller/avatar.controller.php?id=" . $forgerId;
$styles = <<<CSS

#profile {
\twidth: 60%; min-width: 960px;
\tmargin: auto;
\tposition: relative;
\toverflow: visible;
\tpadding-top: 40px;
}

#profile-edit {
\tposition: absolute;
\ttop: 0; right: 60px;
\tcolor: #777;
}
Exemplo n.º 6
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/facebook.model.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/sign-up.model.php";
$signUp = new signUp();
if ($signUp->emailExists($_POST["user"]["email"])) {
    include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
    $profile = new Profile();
    $_SESSION["id"] = $profile->gimme("id", "email", $_POST["user"]["email"]);
} else {
    $facebook = new Facebook();
    $id = $facebook->activate($_POST["user"]);
    $_SESSION["id"] = $id;
}
Exemplo n.º 7
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/sign-in.model.php";
$signIn = new signIn();
$email = $_POST["email"];
$password = $_POST["password"];
$remember = $_POST["remember"];
if (!empty($_POST["facebook"])) {
} else {
    if ($signIn->passwordVerify($email, $password)) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
        $profile = new Profile();
        $_SESSION["id"] = intval($profile->gimme("id", "email", $email));
        if ($remember === "on") {
            $rememberkey = md5(microtime() . rand());
            $profile->set("remember", $rememberkey, $_SESSION["id"]);
            setcookie("remember", $rememberkey, time() + 5184000, "/");
        }
        $_SESSION["debug"] = "blah";
        header("Location: /profile/");
    } else {
        if (isset($_POST["response"])) {
        } else {
            $_SESSION["status"] = "Sorry! Your login information wasn&rsquo;t recognized. Please try again.";
            header("Location: /sign-in");
        }
    }
}
Exemplo n.º 8
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
if (isset($_SESSION["id"])) {
    $id = $_SESSION["id"];
}
if (isset($_SESSION["id"]) && !empty($_SESSION["id"]) && $_SERVER["REQUEST_URI"] === "/sign-in/") {
    header("Location: /profile/");
}
if (!isset($_SESSION["id"]) && $_SERVER["REQUEST_URI"] === "/profile/") {
    header("Location: /sign-in/");
} else {
    if (!empty($_COOKIE["remember"])) {
        include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
        $profile = new Profile();
        $_SESSION["id"] = $profile->gimme("id", "remember", $_COOKIE["remember"]);
        if ($_SERVER["REQUEST_URI"] === "/sign-in/" && !empty($_SESSION["id"])) {
            header("Location: /profile/");
        }
    }
}
Exemplo n.º 9
0
<?php

include_once $_SERVER["DOCUMENT_ROOT"] . "/app/controller/access.controller.php";
include_once $_SERVER["DOCUMENT_ROOT"] . "/app/model/profile.model.php";
$profile = new Profile();
$id = $_SESSION["id"];
if (!empty($_POST["jcrop-x"])) {
    // Get jcrop values
    $x = $_POST["jcrop-x"];
    $y = $_POST["jcrop-y"];
    $x2 = $_POST["jcrop-x2"];
    $y2 = $_POST["jcrop-y2"];
    $w = $_POST["jcrop-w"];
    $h = $_POST["jcrop-h"];
    // Create photo object from image file path in database
    $photo = imagecreatefromstring(file_get_contents($profile->gimme("photo", "id", $id)));
    //
}