$subject = 'Ofrecimiento para dar una charla';
    if (isset($_SESSION['user'])) {
        $GeodevDB = new GeodevDB(array("meetup_id" => $_SESSION['user']['meetup_id']));
        $userprofile = $GeodevDB->getUser(array("type" => "userprofile"));
        $replyTo = $userprofile['email'];
        $message = "\n              Nombre: <a href='http://{$_SERVER['HTTP_HOST']}" . $ROOT . "miembros/{$userprofile['meetup_id']}'>\n                          {$userprofile['name']} {$userprofile['last_name']}\n                      </a><br>\n              Email: {$userprofile['email']}<br>\n              ";
    } else {
        $replyTo = $_POST["email"];
        $message = "";
    }
    $data = sendMail($to, $subject, $message, $replyTo);
    echo json_encode($data);
});
$app->post('/video/suggest', 'authenticated', function () use($app, $db) {
    global $ROOT;
    $GeodevDB = new GeodevDB(array("meetup_id" => $_SESSION["user"]['meetup_id']));
    $userprofile = $GeodevDB->getUser(array("type" => "userprofile"));
    $to = '*****@*****.**';
    $replyTo = $userprofile['email'];
    $subject = 'Nuevos vídeos sugeridos';
    $message = "\n            Nombre: <a href='http://{$_SERVER['HTTP_HOST']}" . $ROOT . "miembros/{$userprofile['meetup_id']}'>\n                        {$userprofile['name']} {$userprofile['last_name']}\n                    </a><br>\n            Email: {$userprofile['email']}<br>\n            ";
    foreach ($_POST["videos"] as $v) {
        $message .= "<a href='{$v['url']}'>{$v['title']}</a><br>";
    }
    $data = sendMail($to, $subject, $message, $replyTo);
    echo json_encode($data);
});
function sendMail($to, $subject, $message, $replyTo)
{
    $message = wordwrap($message, 70, "\r\n");
    $headers = "From: " . strip_tags($to) . "\r\n";
<?php

require_once '../config.php';
require_once 'init.php';
$GeodevDB = new GeodevDB(array("meetup_id" => $_GET["query"]));
$userprofile = $GeodevDB->getUser(array("type" => "userprofile"));
if ($userprofile) {
    $smarty->assign('PROFILE', $userprofile);
    $smarty->assign('SKILLSGIS', $GeodevDB->getUserSkills(array("type" => "gis")));
    $smarty->assign('SKILLS', $GeodevDB->getUserSkills(array("type" => "other")));
    $smarty->assign('REFERRERS', $referrers = $GeodevDB->getReferrers());
    $smarty->assign('ACTION', "view");
    $smarty->assign('ISRECOMMENDED', false);
    if (isset($_SESSION["user"])) {
        $date = getdate();
        $date = $date["year"] . "-" . $date["mon"] . "-" . $date["mday"];
        $db->where("visitor", $_SESSION["user"]['id'])->where("visited", $userprofile['id'])->where("date", $date, "=");
        $visit = $db->get('profile_views');
        if (!$visit) {
            $db->insert("profile_views", array("visitor" => $_SESSION["user"]['id'], "visited" => $userprofile['id'], "date" => $date));
        }
        if ($GeodevDB->getIsReferred(array("referrer" => $_SESSION["user"]["meetup_id"]))) {
            $smarty->assign('ISRECOMMENDED', true);
        }
    }
    $smarty->display('profile.tpl');
} else {
    echo "Error el usuario no existe en la base de datos";
}
<?php

require_once '../../config.php';
require_once 'init.php';
$GeodevDB = new GeodevDB();
$video = $GeodevDB->getVideo(array("youtubeId" => $_GET["id"]));
$smarty->assign('VIDEO', $video);
$smarty->assign('TYPE', "webinars");
$smarty->display('view.tpl');
        $member->linkedin_url = $_POST["linkedin_url"];
    }
    $member->save();
    $_SESSION['logged'] = true;
    $_SESSION["user"]['email'] = $member->email;
    $_SESSION["user"]['name'] = $member->name;
    if (isset($returnURL)) {
        unset($_SESSION['returnURL']);
        header('Location: ' . $returnURL);
    } else {
        header('Location: ' . $ROOT);
    }
}
// Register $_GET
if (isset($_SESSION["user"]['meetup_id']) && !isset($_SESSION['logged'])) {
    $GeodevDB = new GeodevDB(array("meetup_id" => $member->meetup_id));
    $userprofile = $GeodevDB->getUser(array("type" => "userprofile"));
    if ($userprofile) {
        //User is in the database
        $smarty->assign('USER', $userprofile);
    } elseif (isset($_SESSION["meetup_member"])) {
        $smarty->assign('USER', array("name" => $_SESSION["meetup_member"]->name, "joined" => $member->parseEpoch($_SESSION["meetup_member"]->joined), "photo_url" => $_SESSION['photo_url']));
    }
    $smarty->assign('GEOSKILLS', $GeodevDB->getSkills(array("type" => "geo")));
    $smarty->assign("SESSION", $_SESSION);
    $smarty->display('register.tpl');
} else {
    if (isset($_GET['returnURL'])) {
        header('Location: ' . $_GET['returnURL']);
    } else {
        header('Location: ' . $ROOT);
<?php

require_once '../modules/prettyprint.php';
require_once '../vendor/autoload.php';
require_once '../config.php';
require_once 'init.php';
ini_set('max_execution_time', 10000);
$client = DMS\Service\Meetup\MeetupKeyAuthClient::factory(array('key' => $meetup_api_key));
$i = 0;
$options = array('group_urlname' => 'Geo-Developers', 'page' => 200, 'order' => 'name', 'offset' => $i);
$GeodevDB = new GeodevDB();
do {
    $members = $client->getMembers($options);
    foreach ($members as $member) {
        $user = $GeodevDB->getUser(array("type" => "user", "meetup_id" => $member["id"]));
        if (!$user) {
            $m = new Member(array("meetup_response" => $member));
            echo $m->meetup_id . " is not registered, add or update all fields<br>";
            $m->save();
        }
    }
    $i++;
    $options["offset"] = $i;
} while ($members->count() != 0);
<?php

require_once '../config.php';
require_once 'init.php';
if (isset($_SESSION['user']['meetup_id'])) {
    $GeodevDB = new GeodevDB();
    $video = $GeodevDB->getVideo(array("youtubeId" => $_GET["id"], "meetupId" => $_SESSION['user']['meetup_id']));
    if ($video["length"] == 0) {
        header('Location: ' . $ROOT . 'academy/');
    }
    // Get user preferences
    $user = new Member(array("meetup_id" => $_SESSION["user"]["meetup_id"]));
    $preferences = $user->getPreferences();
    $smarty->assign('INTERESTS', $preferences["interests"]);
    $smarty->assign('GROUPINGS', $preferences["groupings"]);
    $smarty->assign('VIDEO', $video);
    $smarty->assign('TYPE', "academy");
    $smarty->display('view.tpl');
} else {
    $_SESSION['returnURL'] = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
    header('Location: ' . $ROOT . 'login/');
}
<?php

require_once '../config.php';
require_once 'init.php';
$GeodevDB = new GeodevDB();
if (isset($_GET['tech']) && $_GET['tech']) {
    $users = $GeodevDB->getExperts(array("tech" => $_GET['tech']));
    $smarty->assign('TECH', $_GET['tech']);
} else {
    $users = $GeodevDB->getMembers();
}
$smarty->assign('SKILLS', $GeodevDB->getSkills(array("type" => "all")));
$smarty->assign('OTHERSKILLS', $GeodevDB->getSkills(array("type" => "other")));
$smarty->assign('GEOSKILLS', $GeodevDB->getSkills(array("type" => "geo")));
$smarty->assign('TOTALUSERS', $db->getValue("profiles", "count(meetup_id)"));
$smarty->assign('USERS', $users);
$smarty->display('miembros.tpl');
<?php

require_once '../config.php';
require_once 'init.php';
/*prettyprint($_POST);
die("ya!");*/
if (!isset($_SESSION["logged"])) {
    header('Location: ' . $ROOT . 'login/?returnURL=' . $_SERVER['REQUEST_URI']);
}
if (intval($_SESSION["user"]["meetup_id"]) === intval($_GET["meetup_id"])) {
    $GeodevDB = new GeodevDB(array("meetup_id" => $_GET["meetup_id"]));
    if (!empty($_POST)) {
        $user = new Member(array("meetup_id" => $_SESSION["user"]["meetup_id"]));
        $errorMessage = "";
        if ($_FILES["photo"]["name"]) {
            $path = uploadFile($_SESSION["user"]["meetup_id"]);
            if ($path["status"] === "error") {
                $errorMessage .= $path["response"];
            } else {
                $user->photo_url = $path["response"];
            }
        }
        $user->update($_POST);
        if ($user->save() && $errorMessage !== "") {
            $smarty->assign('MESSAGE', "El perfil ha sido actualizado con éxito");
        } else {
            $smarty->assign('MESSAGE', $errorMessage);
        }
        $userprofile = $user->getUserProfile();
        $_SESSION['user'] = $userprofile;
    } else {