static function loggedInUserCanJoin($group)
 {
     if (!is_object($group)) {
         $group = getEntity($group);
     }
     $membership = $group->membership;
     // check to see if already a member
     $is_member = getEntity(array("type" => "Groupmembership", "metadata_name_value_pairs" => array(array("name" => "group", "value" => $group->guid), array("name" => "member_guid", "value" => getLoggedInuserGuid()))));
     if ($is_member) {
         return false;
     }
     switch ($membership) {
         case "public":
             return true;
             break;
         case "friends":
             if (isEnabledPlugin("Friends")) {
                 if (FriendsPlugin::friends(getLoggedInUserGuid(), $group->owner_guid)) {
                     return true;
                 }
             } else {
                 return true;
             }
             break;
     }
 }
 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);
 }
 public function __construct()
 {
     if (loggedIn()) {
         new MenuItem(array("name" => "profile", "label" => "My Profile", "page" => "profile/" . getLoggedInUserGuid(), "menu" => "my_account", "weight" => 0));
         if (currentPage() == "profile" && pageArray(1) == getLoggedInUserGuid()) {
             new MenuItem(array("name" => "edit_profile", "label" => "Edit Profile", "menu" => "profile", "page" => "editProfile", "list_class" => "active", "link_class" => "list-group-item list-group-item-danger"));
         } elseif (currentPage() == "home" && loggedIn()) {
             new MenuItem(array("name" => "view_my_profile", "label" => "View My Profile", "menu" => "profile", "page" => "profile/" . getLoggedInUserGuid(), "weight" => 10));
             new MenuItem(array("name" => "edit_profile", "label" => "Edit My Profile", "menu" => "profile", "page" => "editProfile", "link_class" => "list-group-item", "weight" => 20));
             if (isEnabledPlugin("members")) {
                 new MenuItem(array("name" => "members", "label" => "Browse Members", "menu" => "profile", "page" => "members", "weight" => 30));
             }
             if (isEnabledPlugin("inviteFriends")) {
                 new MenuItem(array("name" => "invite_friends", "label" => translate("invite_your_friends"), "menu" => "profile", "page" => "members", "weight" => 40));
             }
         }
         if (currentPage() == "profile" && adminLoggedIn()) {
             if (adminLoggedIn()) {
                 $guid = pageArray(1);
                 $user = getEntity($guid);
                 if (is_a($user, "SocialApparatus\\User")) {
                     if (!isAdmin($user)) {
                         new MenuItem(array("name" => "delete", "label" => "Delete User", "page" => "action/deleteUser/{$guid}", "menu" => "profile", "weight" => 100000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         new MenuItem(array("name" => "login_as", "label" => "Login As", "page" => "action/loginas/{$guid}", "menu" => "profile", "weight" => 90000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         if ($user->banned == "true") {
                             new MenuItem(array("name" => "unban", "label" => "Unban", "page" => "action/unbanUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         } else {
                             new MenuItem(array("name" => "ban", "label" => "Ban", "page" => "action/banUser/{$guid}", "menu" => "profile", "weight" => 80000, "list_class" => "active", "link_class" => "list-group-item list-group-item-danger confirm"));
                         }
                     }
                 }
             }
         }
     }
     if (currentPage() == "profile") {
         new CSS("profile", getSitePath() . "core_plugins/profile/assets/css/profile.css");
         new FooterJS('profile', getSiteURL() . 'core_plugins/profile/assets/js/profile.js', 900, true);
     }
     if (currentPage() == "admin") {
         new ViewExtension("admin/tabs", "admin_tabs/profile_fields");
     }
     new ProfileField("first_name", "First Name", "text", false, false, "form-control", "default", 10);
     new ProfileField("last_name", "Last Name", "text", false, false, "form-control", "default", 20);
     new ProfileField("gender", "Gender", "dropdown", array("Male" => "Male", "Female" => "Female"));
     new ProfileField("birthday", "Birthday", "date");
     new ProfileField("about", "About Me", "textarea");
     new ProfileField("hobbies", "Hobbies", "tags");
     new StorageType("User", "about", "text");
     new ViewExtension("profile/right", "profile/activity");
 }
 static function accessHandlerDropdown()
 {
     $array = array();
     $access_handlers = Accesshandler::getAll();
     foreach ($access_handlers as $handler) {
         $array[$handler->handler] = translate("access_handler:" . $handler->handler);
     }
     if (isEnabledPlugin("Groups")) {
         $groups = GroupsPlugin::getGroups(getLoggedInUserGuid());
         foreach ($groups as $group) {
             $array[$group->guid] = $group->title . " Group";
         }
     }
     return $array;
 }
 public function __construct()
 {
     new Setting("who_can_create_blogs", "dropdown", array("everyone" => "Everyone", "admin_only" => "Admin Only"), "general", "everyone");
     new MenuItem(array("name" => "blogs", "label" => "Blogs", "page" => "blogs", "list_class" => "visible-xs hidden-sm visible-md visible-lg"));
     new MenuItem(array("name" => "blogs2", "label" => "Blogs", "page" => "blogs", "menu" => "tools"));
     new StorageType("blog", "title", "text");
     new StorageType("blog", "description", "longtext");
     if (pageArray(0) == "blogs" && (pageArray(1) == "add" || pageArray(1) == "edit") || pageArray(0) == 'home' && pageArray(1) == false) {
         new ViewExtension("tinymce/buttons", "blogs/tinymce");
     } else {
         ViewExtension::remove("tinymce/buttons", "blogs/tinymce");
     }
     if (isEnabledPlugin("groups")) {
         new ViewExtension("groups/right", "blogs/group_blogs");
     } else {
         removeViewExtension("groups/right", "blogs/group_blogs");
     }
 }
 function __construct()
 {
     if (loggedIn()) {
         if (currentPage() == "profile") {
             if (isEnabledPlugin("Friends")) {
                 $user_one = pageArray(1);
                 $user_two = getLoggedInUserGuid();
                 if (FriendsPlugin::friends($user_one, $user_two)) {
                     new MenuItem(array("name" => "chat", "menu" => "profile", "label" => "Chat", "page" => "action/CreateChat/" . $user_one, "link_class" => "list-group-item list-group-item-success"));
                 }
             }
         }
     }
     new ViewExtension("page_elements/foot", "chat/chat_boxes");
     new CSS("chat", getSitePath() . "core_plugins/chat/assets/css/chat.css", 400);
     new FooterJS("chat", getSiteURL() . "core_plugins/chat/assets/js/chat.js", 400, true);
     new Usersetting(array("name" => "notify_offline_chat", "field_type" => "dropdown", "options" => array("yes" => "Yes", "no" => "No"), "default_value" => "yes", "tab" => "notifications"));
 }
 public function __construct()
 {
     new CSS("photo", getSitePath() . "core_plugins/photos/assets/css/photos.css");
     new StorageType("Photo", "description", "text");
     new StorageType("Photoalbum", "description", "text");
     new StorageType("Photoalbum", "icon_filename", "text");
     new FooterJS("photo", getSiteURL() . "core_plugins/photos/assets/js/photo.js", 5000, true);
     new ViewExtension("header:after", "page_elements/photo_selector");
     new ViewExtension("profile/middle", "photos/profile");
     new ViewExtension('pages/home_stats', "pages/photo_stats");
     new ViewExtension("page_elements/site_js", "photos/photo_footer");
     new ViewExtension("tinymce/buttons", "photos/tinymce_button");
     if (isEnabledPlugin("groups")) {
         new ViewExtension("groups/right", "photos/group_photos");
     } else {
         removeViewExtension("groups/right", "photos/group_photos");
     }
     new Metatag("Photo", "title", getSiteName() . " | Photos");
     new MenuItem(array("name" => "photos", "href" => "photos", "label" => "Photos", "menu" => "header_left", "list_class" => "visible-xs hidden-sm visible-md visible-lg"));
     new MenuItem(array("name" => "photos2", "href" => "photos", "label" => "Photos", "menu" => "tools", "page" => "photos"));
 }
<?php

namespace SocialApparatus;

require_once dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/engine/start.php";
header("Content-type: application/javascript");
$toolbar = NULL;
if (isEnabledPlugin("photos")) {
    $toolbar .= "browse";
}
if (isEnabledPlugin("videos")) {
    $toolbar .= " media";
}
$toolbar .= " smileys";
?>
    
    var profile_status = {
        init: function () {
            profile_status.tinymce();
            profile_status.updatestatus();
        },
        tinymce: function () {
            tinymce.init({
                menubar: false,
                skin_url: '<?php 
echo getSiteURL();
?>
assets/css/tinymce/lightgray',
                selector: ".tinymce_status_input",
                statusbar: false,
                toolbar: "browse media smileys",
 static function loggedInUserCanViewEntity($entity = false, $ignore_access = false, $logged_in_user_guid = false)
 {
     // run blocked content handlers
     $handlers = Cache::get("blocked_content_handlers", "session");
     if ($handlers) {
         foreach ($handlers as $handler) {
             $handlerEntity = "SocialApparatus\\" . $handler;
             $r = new $handlerEntity();
             $return = $r->validate($entity);
             if (!$return) {
                 return false;
             }
         }
     }
     if ($entity->access_id == "system") {
         return true;
     }
     if (!is_a($entity, "SocialApparatus\\User")) {
         if (loggedIn()) {
             $logged_in_user_guid = getLoggedInUserGuid();
         }
     }
     if (!is_object($entity)) {
         return true;
     }
     if (!$entity) {
         return true;
     }
     if (!$entity->access_id) {
         $entity->access_id = "system";
         $entity->save();
     }
     if ($ignore_access) {
         return true;
     }
     if (!is_object($entity)) {
         return true;
     }
     if (getIgnoreAccess()) {
         return true;
     }
     // Logged in user trying to view him/herself
     if (getLoggedInUserGuid() == $entity->guid || $logged_in_user_guid == $entity->guid) {
         return true;
     }
     // Logged in user owns entity
     if (getLoggedInUserGuid() == $entity->owner_guid || $logged_in_user_guid == $entity->owner_guid) {
         return true;
     }
     // Admins can view everything
     if (adminLoggedIn()) {
         return true;
     }
     if (is_numeric($entity->access_id)) {
         $access_entity = getEntity($entity->access_id);
         if (is_a($access_entity, "SocialApparatus\\Group")) {
             if (isEnabledPlugin("Groups")) {
                 if ($access_entity->loggedInUserIsMember($logged_in_user_guid)) {
                     return true;
                 }
             }
         }
         return false;
     }
     $access_handler = Accesshandler::get($entity->access_id);
     $access_handler = ucfirst($entity->access_id) . "AccessHandler";
     $access_handler = "SocialApparatus\\" . $access_handler;
     if (class_exists($access_handler)) {
         $return = (new $access_handler())->init($entity, $logged_in_user_guid);
         return $return;
     }
     return false;
 }
示例#10
0
 static function loadDefaultMenus()
 {
     if (isEnabledPlugin("members") || isEnabledPlugin("groups")) {
         $params = array("name" => "directory", "label" => "Directory", "page" => "#", "menu" => "header_left", "weight" => 1);
         new MenuItem($params);
     }
     $params = array("name" => "my_account", "label" => "My Account", "page" => "#", "menu" => "header_right");
     new MenuItem($params);
     if (!loggedIn()) {
         $params = array("name" => "login", "label" => "Login", "page" => "login", "menu" => "my_account", "weight" => 10);
         new MenuItem($params);
         $params = array("name" => "register", "label" => "Register", "page" => "register", "menu" => "my_account", "weight" => 10);
         new MenuItem($params);
     } else {
         $notifications = Notification::getNotificationCount(getLoggedInUserGuid());
         if (!$notifications) {
             $notifications = 0;
         }
         $params = array("name" => "notifications", "label" => "Notifications <span class='badge'>{$notifications}</span>", "page" => "notifications", "menu" => "my_account", "weight" => 10);
         new MenuItem($params);
         $params = array("name" => "my_settings", "label" => "My Settings", "page" => "mySettings", "menu" => "my_account", "weight" => 100);
         if (!empty(Usersetting::listTabs())) {
             new MenuItem($params);
         }
         if (adminLoggedIn()) {
             $params = array("name" => "admin", "label" => "Admin", "page" => "admin", "menu" => "header_right");
             new MenuItem($params);
         }
         $params = array("name" => "logout", "label" => "Logout", "page" => "action/logout", "menu" => "my_account");
         new MenuItem($params);
     }
     return;
 }
/* * ***********************************************************************
 * 
 * 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();
$activity_url = getSiteURL() . "activity";
$guid = Vars("guid");
$user = getEntity($guid);
if (isEnabledPlugin("Friends")) {
    $friends = FriendsPlugin::getFriendGuidCSString($user);
}
if (isset($friends)) {
    $params = array("type" => "Activity", "order_by" => "time_created", "order_reverse" => true, "limit" => 8, "metadata_name" => "owner_guid", "metadata_value" => "(" . $friends . ")", "operand" => "IN");
    echo display("ajax/entity_list", array("params" => $params, "wrapper" => "ul", "wrapper_class" => "timeline timeline-small", "title" => translate("latest_friends_activity"), "id" => "ajax_friends_activity", "panel" => true));
}