public function __construct()
 {
     if (!pageArray(2) || !pageArray(3)) {
         return false;
     }
     $email = pageArray(2);
     $code = pageArray(3);
     runHook("action:verify_email:before");
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "email_verification_code", "value" => $code))));
     setIgnoreAccess($access);
     if (!$user) {
         new SystemMessage(translate("system_message:email_could_not_be_verified"));
         forward("home");
     }
     $user = $user[0];
     $user->email_verification_code = NULL;
     $user->verified = "true";
     $user->save();
     runHook("action:verify_email:after");
     new SystemMessage(translate("system_message:email_verified"));
     new Activity($user->guid, "activity:joined", array($user->getURL(), $user->full_name));
     forward("login");
 }
 public function __construct()
 {
     $password = getInput("password");
     $password2 = getInput("password2");
     if ($password != $password2) {
         new SystemMessage("Passwords must match.");
     }
     $guid = getInput("guid");
     $code = getInput("code");
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $user = getEntity($guid);
     if ($user) {
         if ($user->password_reset_code == $code) {
             $user->password = password_hash($password, PASSWORD_BCRYPT);
             $user->password_reset_code = NULL;
             $user->save();
             new SystemMessage("Your password has been reset.");
             forward("home");
         }
     } else {
         new SystemMessage("No user found with that email.");
         forward("home");
     }
     setIgnoreAccess($access);
 }
 static function getNotificationCount($guid)
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $count = getEntities(array("type" => "Notification", "count" => true, "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()))));
     setIgnoreAccess($access);
     return $count;
 }
 /**
  * Creates notification page html
  */
 public function __construct()
 {
     $user_guid = getLoggedInUserGuid();
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $notifications = listEntities(array("type" => "Notification", "metadata_name" => "owner_guid", "metadata_value" => $user_guid));
     setIgnoreAccess($access);
     $buttons = getSiteURL() . "action/deleteAllNotifications/{$user_guid}";
     $buttons = addTokenToURL($buttons);
     $buttons = "<a href='{$buttons}' class='btn btn-danger'>Dismiss All</a>";
     $page = drawPage(array("header" => "Notifications", "body" => $notifications, "button" => $buttons));
     $this->html = $page;
 }
 function __construct()
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $system_settings = getEntities(array("type" => "Setting", "metadata_name" => "tab", "metadata_value" => "adsense"));
     setIgnoreAccess($access);
     if ($system_settings) {
         foreach ($system_settings as $setting) {
             $setting->value = getInput($setting->name);
             $setting->save();
         }
     }
     clearCache();
     forward("admin/adsense");
 }
 public function __construct()
 {
     $email = getInput("email");
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $user = getEntities(array("type" => "User", "metadata_name" => "email", "metadata_value" => $email, "limit" => 1));
     setIgnoreAccess($access);
     if (!empty($user)) {
         $user = $user[0];
         $user->sendPasswordResetLink();
         forward("passwordResetEmailSent");
     } else {
         new SystemMessage("No account with that email found.");
         forward();
     }
 }
 public function __construct()
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $system_settings = getEntities(array("type" => "Setting"));
     setIgnoreAccess($access);
     if ($system_settings) {
         foreach ($system_settings as $setting) {
             $name = $setting->name;
             $value = getInput($name);
             $setting->value = $value;
             $setting->save();
         }
     }
     clearCache();
     forward("admin/general");
 }
function login($data)
{
    $returnuser = "******";
    $email = $data['email'];
    $password = $data['password'];
    $ignore_access = getIgnoreAccess();
    setIgnoreAccess(true);
    $user = getEntity(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "verified", "value" => "true"))), true, true);
    setIgnoreAccess($ignore_access);
    if ($user) {
        $password1 = md5($password);
        $password2 = $user->password;
        if ($password1 == $password2) {
            $returnuser = $user;
            unset($returnuser->password);
            return json_encode($returnuser);
        }
    }
    return "false";
}
 /**
  * Creates html for forgot password page
  */
 public function __construct()
 {
     $code = pageArray(1);
     $email = pageArray(2);
     if ($code && $email) {
         $access = getIgnoreAccess();
         setIgnoreAccess();
         $user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "password_reset_code", "value" => $code))));
         setIgnoreAccess($access);
         if ($user) {
             $user = $user[0];
             new Vars("guid", $user->guid);
             new Vars("code", $code);
             $form = drawForm(array("name" => "new_password", "method" => "post", "action" => "newPassword"));
             $header = "Enter your new password.";
             $this->html = drawPage($header, $form);
             $this->html = drawPage(array("header" => $header, "body" => $form));
         }
     } else {
         $form = drawForm(array("name" => "forgot_password", "method" => "post", "action" => "ForgotPassword"));
         $this->html = drawPage(array("header" => "Reset Your Password", "body" => $form));
     }
 }
 * SocialApparatus CONFIDENTIAL
 * __________________
 * 
 *  [2002] - [2017] SocialApparatus (http://SocialApparatus.co) 
 *  All Rights Reserved.
 * 
 * NOTICE:  All information contained herein is, and remains the property of SocialApparatus 
 * and its suppliers, if any.  The intellectual  and technical concepts contained herein 
 * are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign 
 * Patents, patents in process, and are protected by trade secret or copyright law. 
 * 
 * Dissemination of this information or reproduction of this material is strictly forbidden 
 * unless prior written permission is obtained from SocialApparatus.
 * 
 * Contact Shane Barron admin@socia.us for more information.
 */
namespace SocialApparatus;

denyDirect();
$access = getIgnoreAccess();
setIgnoreAccess();
$system_settings = Setting::getAll("video_settings");
setIgnoreAccess($access);
if ($system_settings) {
    foreach ($system_settings as $name => $setting) {
        echo display("input/" . $setting->field_type, array("name" => $setting->name, "value" => $setting->value, "class" => "form-control", "label" => isset($setting->label) ? $setting->label : translate("admin:video_settings:" . $setting->name), "options_values" => $setting->options));
    }
    echo display("input/submit", array("class" => "btn btn-success", "label" => "Save"));
} else {
    echo "<blockquote>These settings are created by plugins.</blockquote>";
}
 public function __construct($first_name = NULL, $last_name = NULL, $email = NULL, $password = NULL, $password2 = NULL)
 {
     $registration_fields = getAllRegistrationFields();
     runHook("action:register:before");
     if (!$first_name) {
         foreach ($registration_fields as $field) {
             $name = $field['name'];
             ${$name} = getInput($name);
         }
     }
     $banned = getEntity(array("type" => "BlacklistEmail", "metadata_name" => "email", "metadata_value" => $email));
     if ($banned) {
         new SystemMessage("Your email address has been banned.");
         forward("home");
     }
     $ip = NULL != getenv('REMOTE_ADDR') ? getenv('REMOTE_ADDR') : "";
     if ($ip) {
         $banned = getEntity(array("type" => "BlacklistIp", "metadata_name" => "ip", "metadata_value" => $ip));
         if ($banned) {
             new SystemMessage("Your ip has been banned.");
             forward("home");
         }
     }
     $ip2 = NULL != getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : "";
     if ($ip2) {
         $banned = getEntity(array("type" => "BannedIp", "metadata_name" => "ip", "metadata_value" => $ip2));
         if ($banned) {
             new SystemMessage("Your ip has been banned.");
             forward("home");
         }
     }
     $banned_emails = json_decode(file_get_contents(getSitePath() . "data/banned_email_providers.json"));
     foreach ($banned_emails as $banned_email) {
         if (strpos($email, $banned_email) !== false) {
             new SystemMessage("Sorry, temporary email addresses aren't allowed.");
             forward("register?first_name=" . $first_name . "&last_name=" . $last_name . "&email=" . $email . "&message_type=danger");
         }
     }
     if (isset($password) && isset($password2) && isset($email)) {
         if ($password != $password2) {
             new SystemMessage(translate("system_message:passwords_must_match"));
             forward("register?first_name=" . $first_name . "&last_name=" . $last_name . "&email=" . $email . "&message_type=danger");
         }
         $access = getIgnoreAccess();
         setIgnoreAccess();
         $test = getEntities(array("type" => "User", "metadata_name" => "email", "metadata_value" => $email, "limit" => 1));
         setIgnoreAccess($access);
         if ($test) {
             new SystemMessage(translate("system_message:email_taken"));
             forward("register?first_name=" . $first_name . "&last_name=" . $last_name . "&email=" . $email . "&message_type=danger");
         }
         $user = new User();
         foreach ($registration_fields as $field) {
             if (isset($field['name'])) {
                 $name = $field['name'];
                 $user->{$name} = ${$name};
             }
         }
         $user->password = md5($password);
         $user->verified = "false";
         unset($user->password2);
         $user_exists = getEntities(array("type" => "User", "limit" => 1));
         if (!$user_exists) {
             $user->level = "admin";
             $user->verified = "true";
             new SystemMessage("Since you are the first registered user, your account has been setup as the site administrator, and your email verified.");
         }
         $ip1 = NULL != getenv('REMOTE_ADDR') ? getenv('REMOTE_ADDR') : "";
         $ip2 = NULL != getenv('HTTP_X_FORWARDED_FOR') ? getenv('HTTP_X_FORWARDED_FOR') : "";
         $user->ip1 = $ip1;
         $user->ip2 = $ip2;
         $user->save();
         runHook("send_verification_email:before");
         $email_sent = Email::sendVerificationEmail($user);
         runHook("send_verification_email:after");
         runHook("action:register:after", array('user' => $user));
         if ($email_sent) {
             forward("VerificationEmailSent/" . $user->guid);
         } else {
             forward("home");
         }
     }
 }
 static function getAll()
 {
     $access = getIgnoreAccess();
     setIgnoreAccess();
     $plugins = getEntities(array("type" => "Plugin"));
     setIgnoreAccess($access);
     return $plugins;
 }