예제 #1
0
    function return_profile_block()
    {
        global $_configuration;
        $user_id = api_get_user_id();

        if (empty($user_id)) {
            return;
        }

        $profile_content = '<ul class="nav nav-list">';

        //  @todo Add a platform setting to add the user image.
        if (api_get_setting('allow_message_tool') == 'true') {
            require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';

            // New messages.
            $number_of_new_messages             = MessageManager::get_new_messages();
            // New contact invitations.
            $number_of_new_messages_of_friend   = SocialManager::get_message_number_invitation_by_user_id(api_get_user_id());

            // New group invitations sent by a moderator.
            $group_pending_invitations = GroupPortalManager::get_groups_by_user(api_get_user_id(), GROUP_USER_PERMISSION_PENDING_INVITATION, false);
            $group_pending_invitations = count($group_pending_invitations);

            $total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;
            $cant_msg = Display::badge($number_of_new_messages);

            $link = '';
            if (api_get_setting('allow_social_tool') == 'true') {
                $link = '?f=social';
            }
            $profile_content .= '<li class="inbox-social"><a href="'.api_get_path(WEB_PATH).'main/messages/inbox.php'.$link.'">'.get_lang('Inbox').$cant_msg.' </a></li>';
            $profile_content .= '<li class="new-message-social"><a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php'.$link.'">'.get_lang('Compose').' </a></li>';

            if (api_get_setting('allow_social_tool') == 'true') {
                $total_invitations = Display::badge($total_invitations);
                $profile_content .= '<li class="invitations-social"><a href="'.api_get_path(WEB_PATH).'main/social/invitations.php">'.get_lang('PendingInvitations').$total_invitations.'</a></li>';
            }

            if (isset($_configuration['allow_my_files_link_in_homepage']) && $_configuration['allow_my_files_link_in_homepage']) {
                $profile_content .= '<li class="myfiles-social"><a href="'.api_get_path(WEB_PATH).'main/social/myfiles.php">'.get_lang('MyFiles').'</a></li>';
            }
        }

        $editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';

        if (api_get_setting('sso_authentication') === 'true') {
            $subSSOClass = api_get_setting('sso_authentication_subclass');
            $objSSO = null;

            if (!empty($subSSOClass)) {
                require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php';

                $subSSOClass = 'sso' . $subSSOClass;
                $objSSO = new $subSSOClass();
            } else {
                $objSSO = new sso();
            }

            $editProfileUrl = $objSSO->generateProfileEditingURL();
        }

        $profile_content .= '<li class="profile-social"><a href="' . $editProfileUrl . '">'.get_lang('EditProfile').'</a></li>';
        $profile_content .= '</ul>';
        $html = self::show_right_block(get_lang('Profile'), $profile_content, 'profile_block');
        return $html;
    }
예제 #2
0
         }
     }
     //end else login failed
 } elseif (api_get_setting('sso_authentication') === 'true' && !in_array('webservices', explode('/', $_SERVER['REQUEST_URI']))) {
     /**
      * TODO:
      * - Work on a better validation for webservices paths. Current is very poor and exit
      */
     $subsso = api_get_setting('sso_authentication_subclass');
     if (!empty($subsso)) {
         require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subsso . '.class.php';
         $subsso = 'sso' . $subsso;
         $osso = new $subsso();
         //load the subclass
     } else {
         $osso = new sso();
     }
     if (isset($_SESSION['_user']['user_id'])) {
     } else {
         // Handle cookie comming from Master Server
         if (!isset($_GET['sso_referer']) && !isset($_GET['loginFailed']) && isset($_GET['sso_cookie'])) {
             // Redirect to master server
             $osso->ask_master();
         } elseif (isset($_GET['sso_cookie'])) {
             // Here we are going to check the origin of
             // what the call says should be used for
             // authentication, and ensure  we know it
             $matches_domain = false;
             if (isset($_GET['sso_referer'])) {
                 $protocol = api_get_setting('sso_authentication_protocol');
                 // sso_authentication_domain can list
예제 #3
0
         }
     }
     //end else login failed
 } elseif (api_get_setting('sso_authentication') === 'true' && !in_array('webservices', explode('/', $_SERVER['REQUEST_URI']))) {
     /**
      * TODO:
      * - Work on a better validation for webservices paths. Current is very poor and exit
      */
     $subsso = api_get_setting('sso_authentication_subclass');
     if (!empty($subsso)) {
         require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subsso . '.class.php';
         $subsso = 'sso' . $subsso;
         $osso = new $subsso();
         //load the subclass
     } else {
         $osso = new sso();
     }
     if (isset($_SESSION['_user']['user_id'])) {
         if ($logout) {
             // Make custom redirect after logout
             online_logout($_SESSION['_user']['user_id'], false);
             $osso->logout();
             //redirects and exits
         }
     } elseif (!$logout) {
         // Handle cookie from Master Server
         $forceSsoRedirect = api_get_setting('sso_force_redirect');
         if ($forceSsoRedirect === 'true') {
             // all users to be redirected unless they are connected (removed req on sso_cookie)
             $redirectToMasterConditions = !isset($_GET['sso_referer']) && !isset($_GET['loginFailed']);
         } else {
예제 #4
0
 /**
  * Get the profile edition link for a user
  * @param int $userId The user id
  * @param boolean $asAdmin Optional. Whether get the URL for the platform admin
  * @return string The link
  */
 public static function getProfileEditionLink($userId, $asAdmin = false)
 {
     $editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
     if ($asAdmin) {
         $editProfileUrl = api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=" . intval($userId);
     }
     if (api_get_setting('sso_authentication') === 'true') {
         $subSSOClass = api_get_setting('sso_authentication_subclass');
         $objSSO = null;
         if (!empty($subSSOClass)) {
             require_once api_get_path(SYS_CODE_PATH) . "auth/sso/sso.{$subSSOClass}.class.php";
             $subSSOClass = 'sso' . $subSSOClass;
             $objSSO = new $subSSOClass();
         } else {
             $objSSO = new sso();
         }
         $editProfileUrl = $objSSO->generateProfileEditingURL($userId, $asAdmin);
     }
     return $editProfileUrl;
 }
예제 #5
0
// information current user
$socialRightContent .= '<div>' . Display::description($list) . '</div>';

$editProfileUrl = api_get_path(WEB_CODE_PATH) . 'auth/profile.php';

if (api_get_setting('sso_authentication') === 'true') {
    $subSSOClass = api_get_setting('sso_authentication_subclass');
    $objSSO = null;

    if (!empty($subSSOClass)) {
        require_once api_get_path(SYS_CODE_PATH) . 'auth/sso/sso.' . $subSSOClass . '.class.php';

        $subSSOClass = 'sso' . $subSSOClass;
        $objSSO = new $subSSOClass();
    } else {
        $objSSO = new sso();
    }

    $editProfileUrl = $objSSO->generateProfileEditingURL();
}

$socialRightContent .= '
    <div class="form-actions">
    <a class="btn" href="' . $editProfileUrl . '">
        ' . get_lang('EditProfile') . '
    </a>
    </div></div></div>';
$socialRightInformation = '<div class="span4">';
if (api_get_setting('allow_skills_tool') == 'true') {
    $socialRightInformation .= '<div class="well_border">';
    $skill = new Skill();
예제 #6
0
         }
     } //end else login failed
 } elseif (api_get_setting('sso_authentication') === 'true'
     && !in_array('webservices', explode('/', $_SERVER['REQUEST_URI']))
     ) {
     /**
      * TODO:
      * - Work on a better validation for webservices paths. Current is very poor and exit
      */
     $subsso = api_get_setting('sso_authentication_subclass');
     if (!empty($subsso)) {
         require_once api_get_path(SYS_CODE_PATH).'auth/sso/sso.'.$subsso.'.class.php';
         $subsso = 'sso'.$subsso;
         $osso = new $subsso(); //load the subclass
     } else {
         $osso = new sso();
     }
     if (isset($_SESSION['_user']['user_id'])) {
         if ($logout) {
             // Make custom redirect after logout
             online_logout($_SESSION['_user']['user_id'], false);
             $osso->logout(); //redirects and exits
         }
     } elseif (!$logout) {
         // Handle cookie comming from Master Server
         //  Use this first line if you want users to still see the
         //  homepage without connecting
         //if (!isset($_GET['sso_referer']) && !isset($_GET['loginFailed']) && isset($_GET['sso_cookie'])) {
         //  Use this second line if you want all users to be redirected
         //  unless they are connected (removed req on sso_cookie)
         if (!isset($_GET['sso_referer']) && !isset($_GET['loginFailed'])) {