コード例 #1
0
 public function __construct()
 {
     runHook("action:login:before");
     $email = getInput("email");
     $access = getIgnoreAccess();
     $referer = getInput("referer");
     $user = getEntity(array("type" => "User", "metadata_name" => "email", "metadata_value" => $email), true, true);
     if ($user) {
         $password = getInput("password");
         $password1 = md5($password);
         $password2 = $user->password;
         if ($password1 == $password2) {
             $user->logIn();
             new SystemMessage(translate("system_message:logged_in"));
             runHook("action:login:after", array("user" => $user));
             if ($referer) {
                 forward($referer);
             }
         } else {
             new SystemMessage(translate("system_message:could_not_log_in"));
         }
     } else {
         new SystemMessage(translate("system_message:could_not_log_in"));
     }
     forward("home");
 }
コード例 #2
0
 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");
 }
コード例 #3
0
 public function __construct()
 {
     gateKeeper();
     $user = getLoggedInUser();
     $user->createAvatar();
     if (isEnabledPlugin("photos")) {
         $album = getEntity(array("type" => "Photoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "Profile Avatars"))));
         $photo = new Photo();
         $photo->owner_guid = getLoggedInUserGuid();
         $photo_guid = $photo->save();
         Image::copyAvatar($user, $photo);
         $photo = getEntity($photo_guid);
         if (!$album) {
             $album = new Photoalbum();
             $album->owner_guid = getLoggedInUserGuid();
             $album->title = "Profile Avatars";
             $album_guid = $album->save();
             $album = getEntity($album_guid);
             Image::copyAvatar($photo, $album);
         }
         $photo->container_guid = $album->guid;
         $photo->save();
     }
     runHook("action:edit_avatar:after", array("user" => $user));
     new Activity(getLoggedInUserGuid(), "activity:avatar:updated", array($user->getURL(), $user->full_name));
     new SystemMessage("Your avatar has been uploaded.");
     forward("profile/" . $user->guid);
 }
コード例 #4
0
 public function __construct()
 {
     $title = getInput("title");
     $description = getInput("description");
     // Create filestore object to store file information
     $file = new File();
     $file->title = $title;
     $file->description = $description;
     $file->owner_guid = getLoggedInUserGuid();
     $file->access_id = "public";
     $file->container_guid = getInput("container_guid");
     $guid = $file->save();
     uploadFile("file", $guid, getLoggedInUserGuid());
     $file = getEntity($guid);
     Image::createThumbnail($file->guid, TINY);
     Image::createThumbnail($file->guid, SMALL);
     Image::createThumbnail($file->guid, MEDIUM);
     Image::createThumbnail($file->guid, LARGE);
     Image::createThumbnail($file->guid, EXTRALARGE);
     Image::createThumbnail($file->guid, HUGE);
     new Activity(getLoggedInUserGuid(), "action:upload:file", $guid);
     runHook("upload_file:redirect");
     new SystemMessage("Your file has been uploaded.");
     forward();
 }
コード例 #5
0
 public function __construct()
 {
     runHook("action:logout:before");
     $user = getLoggedInUser();
     if ($user) {
         $user->logout();
     }
     runHook("action:logout:after");
     new SystemMessage(translate("system_message:logged_out"));
     forward("home");
 }
コード例 #6
0
 public function __construct($data = NULL)
 {
     gateKeeper();
     $logged_in_user = getLoggedInUser();
     if (!$data) {
         // Get the comment body
         $comment_body = getInput("comment");
         // Get container url
         $container_guid = getInput("guid");
     } else {
         $comment_body = $data['comment_body'];
         $container_guid = $data['container_guid'];
     }
     $container = getEntity($container_guid);
     $container_owner_guid = $container->owner_guid;
     if ($container_owner_guid) {
         $container_owner = getEntity($container_owner_guid);
     }
     $url = $container->getURL();
     if (!$url) {
         $url = getSiteURL();
     }
     // Create the comment
     CommentsPlugin::createComment($container_guid, $comment_body);
     if ($container_owner_guid) {
         if ($container_owner_guid != getLoggedInUserGuid()) {
             $params = array("to" => array($container_owner->full_name, $container_owner->email), "from" => array(getSiteName(), getSiteEmail()), "subject" => "You have a new comment.", "body" => "You have a new comment.  Click <a href='{$url}'>Here</a> to view it.", "html" => true);
             switch ($logged_in_user->getSetting("notify_when_comment")) {
                 case "email":
                     sendEmail($params);
                     break;
                 case "none":
                     break;
                 case "site":
                     notifyUser("comment", $container_guid, getLoggedInUserGuid(), $container_owner_guid);
                     break;
                 case "both":
                     sendEmail($params);
                     notifyUser("comment", $container_guid, getLoggedInUserGuid(), $container_owner_guid);
                     break;
             }
         }
     }
     runHook("add:comment:after");
     if (getLoggedInUserGuid() != $container_owner_guid && $container_owner_guid) {
         new Activity(getLoggedInUserGuid(), "activity:comment", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $container_owner->getURL(), $container_owner->full_name, $container->getURL(), translate($container->type), truncate($comment_body)));
     } elseif (!$container_owner_guid) {
         new Activity(getLoggedInUserGuid(), "activity:comment:own", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $container->getURL(), $container->title, translate($container->type), truncate($comment_body)));
     }
     // Return to container page.
     forward();
 }
 public function __construct()
 {
     runHook("send_verification_email:before");
     $guid = getInput("guid");
     $user = getEntity($guid);
     classGateKeeper($user, "User");
     if ($user->verified == "true") {
         forward();
     }
     Email::sendVerificationEmail($user);
     runHook("send_verification_email:after");
     new SystemMessage(translate("system_message:verification_email_sent"));
     forward("home");
 }
コード例 #8
0
 public function __construct()
 {
     if (!pageArray(2)) {
         return false;
     }
     $guid = pageArray(2);
     $file = getEntity($guid);
     classGateKeeper($file, "File");
     if (getLoggedInUserGuid() == $file->owner_guid) {
         $file->delete();
     }
     runHook("delete_file:redirect");
     forward("files");
 }
コード例 #9
0
 public function __construct()
 {
     adminGateKeeper();
     $guid = pageArray(2);
     if ($guid) {
         $user = getEntity($guid);
         // Prevent admin from deleting self
         if ($user->guid != getLoggedInUserGuid()) {
             $guid = $user->guid;
             $user->delete();
             runHook("delete_user", array("user_guid" => $guid));
         }
     }
     forward("admin/users");
 }
コード例 #10
0
 static function display($path, $variables = array())
 {
     if (!isset($variables['value'])) {
         $variables['value'] = NULL;
     }
     if (!isset($variables['container'])) {
         $variables['container'] = true;
     }
     $return = NULL;
     if (Setting::get("wrap_views") == "yes") {
         $return = "<!-- {$path} -->";
     }
     $view_exists = false;
     $plugin_view = false;
     foreach ($variables as $name => $value) {
         new Vars($name, $value);
     }
     $plugins = Plugin::getEnabledPlugins(true);
     $static_vars = Cache::get("vars", "session");
     $return = runHook("view:before", array("view" => $path, "return" => $return));
     new Cache("vars", $static_vars, "session");
     $return .= ViewExtension::display($path, "before");
     if ($plugins) {
         foreach ($plugins as $plugin) {
             if (is_a($plugin, "SocialApparatus\\Plugin")) {
                 $name = $plugin->name;
                 if (!$plugin_view) {
                     if (file_exists(SITEPATH . "plugins/{$name}/views/{$path}.php")) {
                         $return .= self::getRenderedHTML(SITEPATH . "plugins/{$name}/views/{$path}.php");
                         $plugin_view = true;
                         $view_exists = true;
                     } elseif (file_exists(SITEPATH . "core_plugins/{$name}/views/{$path}.php")) {
                         $return .= self::getRenderedHTML(SITEPATH . "core_plugins/{$name}/views/{$path}.php");
                         $plugin_view = true;
                         $view_exists = true;
                     }
                 }
             }
         }
     }
     if (!$plugin_view) {
         $file_path = SITEPATH . "views/" . $path . ".php";
         if (file_exists($file_path)) {
             $view_exists = true;
             $return .= self::getRenderedHTML($file_path);
         }
     }
     new Cache("vars", $static_vars, "session");
     $return .= viewExtension::display($path, "after");
     return $return;
 }
コード例 #11
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:day");
コード例 #12
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:fifteen");
コード例 #13
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:minute");
コード例 #14
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:week");
コード例 #15
0
 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");
         }
     }
 }
コード例 #16
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:hour");
コード例 #17
0
<?php

/* * ***********************************************************************
 * 
 * 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;

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
runHook("cron:five");