Example #1
0
 /**
  * Get the member's image
  *
  * @return  string
  */
 public function image()
 {
     if (!isset($this->_image)) {
         $this->_image = \Hubzero\User\Profile\Helper::getMemberPhoto($this->_obj, 0);
     }
     return $this->_image;
 }
Example #2
0
 function display($tpl = null)
 {
     $user = User::getRoot();
     // If this is an auth_link account update, carry on, otherwise raise an error
     if (!is_object($user) || !array_key_exists('auth_link_id', $user) || !is_numeric($user->get('username')) || !$user->get('username') < 0) {
         App::abort('405', 'Method not allowed');
         return;
     }
     // Get and add the js and extra css to the page
     \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'link.css');
     \Hubzero\Document\Assets::addComponentStylesheet('com_users', 'providers.css');
     \Hubzero\Document\Assets::addComponentScript('com_users', 'link');
     // Import a few things
     jimport('joomla.user.helper');
     // Look up a few things
     $hzal = \Hubzero\Auth\Link::find_by_id($user->get("auth_link_id"));
     $hzad = \Hubzero\Auth\Domain::find_by_id($hzal->auth_domain_id);
     $plugins = Plugin::byType('authentication');
     // Get the display name for the current plugin being used
     Plugin::import('authentication', $hzad->authenticator);
     $plugin = Plugin::byType('authentication', $hzad->authenticator);
     $pparams = new \Hubzero\Config\Registry($plugin->params);
     $refl = new ReflectionClass("plgAuthentication{$plugin->name}");
     $display_name = $pparams->get('display_name', $refl->hasMethod('onGetLinkDescription') ? $refl->getMethod('onGetLinkDescription')->invoke(NULL) : ucfirst($plugin->name));
     // Look for conflicts - first check in the hub accounts
     $profile_conflicts = \Hubzero\User\Profile\Helper::find_by_email($hzal->email);
     // Now check the auth_link table
     $link_conflicts = \Hubzero\Auth\Link::find_by_email($hzal->email, array($hzad->id));
     $conflict = array();
     if ($profile_conflicts) {
         foreach ($profile_conflicts as $p) {
             $user_id = JUserHelper::getUserId($p);
             $juser = User::getInstance($user_id);
             $auth_link = \Hubzero\Auth\Link::find_by_user_id($juser->id);
             $dname = is_object($auth_link) && $auth_link->auth_domain_name ? $auth_link->auth_domain_name : 'hubzero';
             $conflict[] = array("auth_domain_name" => $dname, "name" => $juser->name, "email" => $juser->email);
         }
     }
     if ($link_conflicts) {
         foreach ($link_conflicts as $l) {
             $juser = User::getInstance($l['user_id']);
             $conflict[] = array("auth_domain_name" => $l['auth_domain_name'], "name" => $juser->name, "email" => $l['email']);
         }
     }
     // Make sure we don't somehow have any duplicate conflicts
     $conflict = array_map("unserialize", array_unique(array_map("serialize", $conflict)));
     // @TODO: Could also check for high probability of name matches???
     // Get the site name
     $sitename = Config::get('sitename');
     // Assign variables to the view
     $this->assign('hzal', $hzal);
     $this->assign('hzad', $hzad);
     $this->assign('plugins', $plugins);
     $this->assign('display_name', $display_name);
     $this->assign('conflict', $conflict);
     $this->assign('sitename', $sitename);
     $this->assignref('juser', $user);
     parent::display($tpl);
 }
Example #3
0
 /**
  * Get progress data
  *
  * @return void
  **/
 private function getprogressrows()
 {
     // Only allow for instructors
     if (!$this->course->offering()->section()->access('manage')) {
         echo json_encode(array('success' => false));
         exit;
     }
     // Get our limit and limitstart
     $limit = Request::getInt('limit', '10');
     $start = Request::getInt('limitstart', 0);
     // Get all section members
     $members = $this->course->offering()->section()->members(array('student' => 1, 'limit' => $limit, 'start' => $start));
     $member_ids = array();
     $mems = array();
     $grades = null;
     $progress = null;
     $passing = null;
     $recognitions = null;
     if (count($members) > 0) {
         foreach ($members as $m) {
             $member_ids[] = $m->get('id');
             $mems[] = array('id' => $m->get('id'), 'user_id' => $m->get('user_id'), 'name' => User::getInstance($m->get('user_id'))->get('name'), 'thumb' => ltrim(\Hubzero\User\Profile\Helper::getMemberPhoto($m->get('user_id'), 0, true), DS), 'full' => ltrim(\Hubzero\User\Profile\Helper::getMemberPhoto($m->get('user_id'), 0, false), DS), 'enrolled' => $m->get('enrolled') != '0000-00-00 00:00:00' ? Date::of($m->get('enrolled'))->format('M j, Y') : 'unknown', 'lastvisit' => User::getInstance($m->get('user_id'))->get('lastvisitDate') != '0000-00-00 00:00:00' ? Date::of(User::getInstance($m->get('user_id'))->get('lastvisitDate'))->format('M j, Y') : 'never');
         }
         // Refresh the grades
         $this->course->offering()->gradebook()->refresh($member_ids);
         // Get the grades
         $grades = $this->course->offering()->gradebook()->grades(array('unit', 'course'));
         $progress = $this->course->offering()->gradebook()->progress($member_ids);
         $passing = $this->course->offering()->gradebook()->passing($member_ids);
         $recognitions = $this->course->offering()->gradebook()->isEligibleForRecognition($member_ids);
     }
     echo json_encode(array('members' => $mems, 'grades' => $grades, 'progress' => $progress, 'passing' => $passing, 'recognitions' => $recognitions));
     exit;
 }
Example #4
0
						</h3>
						<?php 
            if (!User::isGuest()) {
                ?>
							<form action="<?php 
                echo Route::url('index.php?option=' . $this->option);
                ?>
" method="post" id="commentform">
								<p class="comment-member-photo">
									<span class="comment-anchor"></span>
									<?php 
                $jxuser = \Hubzero\User\Profile::getInstance(User::get('id'));
                $anon = !User::isGuest() ? 0 : 1;
                ?>
									<img src="<?php 
                echo \Hubzero\User\Profile\Helper::getMemberPhoto($jxuser, $anon);
                ?>
" alt="<?php 
                echo Lang::txt('COM_ANSWERS_MEMBER_PICTURE');
                ?>
" />
								</p>
								<fieldset>
									<input type="hidden" name="option" value="<?php 
                echo $this->option;
                ?>
" />
									<input type="hidden" name="controller" value="<?php 
                echo $this->controller;
                ?>
" />
Example #5
0
		</a>
	</div>

	<div class="item-sub" >
		<span tabindex="-1"><?php 
echo $this->page->url();
?>
</span>
	</div>

	<?php 
if ($this->checkout) {
    ?>
		<div class="item-checkout">
			<img width="15" src="<?php 
    echo \Hubzero\User\Profile\Helper::getMemberPhoto($this->checkout->userid);
    ?>
" />
			<?php 
    $user = \Hubzero\User\Profile::getInstance($this->checkout->userid);
    echo Lang::txt('COM_GROUPS_PAGES_PAGE_CHECKED_OUT', $user->get('uidNumber'), $user->get('name'));
    ?>
		</div>
	<?php 
}
?>

	<?php 
if ($this->version->get('approved') == 0) {
    ?>
		<div class="item-approved">
Example #6
0
            echo $span_title;
            ?>
			</span>
		<?php 
        }
        ?>
	<?php 
    }
    ?>
</header>

<div class="innerwrap">
	<div id="page_container">
		<div id="page_sidebar">
			<?php 
    $src = \Hubzero\User\Profile\Helper::getMemberPhoto($this->profile, 0, false);
    $link = Route::url($this->profile->getLink());
    ?>
			<div id="page_identity">
				<?php 
    $title = $this->profile->get('uidNumber') == User::get('id') ? Lang::txt('COM_MEMBERS_GO_TO_MY_DASHBOARD') : Lang::txt('COM_MEMBERS_GO_TO_MEMBER_PROFILE', $this->profile->get('name'));
    ?>
				<a href="<?php 
    echo Route::url($this->profile->getLink());
    ?>
" id="page_identity_link" title="<?php 
    echo $title;
    ?>
">
					<img src="<?php 
    echo $this->profile->getPicture(0, false);
Example #7
0
			<?php 
    }
    ?>

			<h3 class="post-comment-title">
				<?php 
    echo Lang::txt('COM_KB_POST_COMMENT');
    ?>
			</h3>
			<form method="post" action="<?php 
    echo Route::url($this->article->link());
    ?>
" id="commentform">
				<p class="comment-member-photo">
					<img src="<?php 
    echo \Hubzero\User\Profile\Helper::getMemberPhoto(User::getRoot(), !User::isGuest() ? 0 : 1);
    ?>
" alt="" />
				</p>
				<fieldset>
					<?php 
    $replyto = \Components\Kb\Models\Comment::oneOrNew(Request::getInt('replyto'));
    if (!User::isGuest()) {
        if (!$replyto->isNew()) {
            $name = Lang::txt('COM_KB_ANONYMOUS');
            if (!$replyto->get('anonymous')) {
                $name = $this->escape(stripslashes($replyto->creator()->get('name')));
                if ($replyto->creator()->get('public')) {
                    $name = '<a href="' . Route::url($replyto->creator()->getLink()) . '">' . $name . '</a>';
                }
            }
Example #8
0
						(<?php 
                    echo Lang::txt('COM_WISHLIST_PLAN_NOT_STARTED');
                    ?>
)
					<?php 
                }
                ?>
				</h3>
				<form action="<?php 
                echo Route::url('index.php?option=' . $this->option);
                ?>
" method="post" id="planform" enctype="multipart/form-data">
					<p class="plan-member-photo">
						<span class="plan-anchor"></span>
						<img src="<?php 
                echo \Hubzero\User\Profile\Helper::getMemberPhoto(User::getRoot(), 0);
                ?>
" alt="<?php 
                echo Lang::txt('COM_WISHLIST_MEMBER_PICTURE');
                ?>
" />
					</p>
					<fieldset>
				<?php 
                if ($this->wish->get('action') == 'editplan') {
                    ?>
						<div class="grid">
							<div class="col span6">
								<label>
									<?php 
                    echo Lang::txt('COM_WISHLIST_WISH_ASSIGNED_TO');
Example #9
0
</div>
								</a>
					<?php 
            }
        }
        ?>
					</div>
				</fieldset>
				<div class="clear"></div>
				<?php 
    }
}
?>

		<?php 
$emailusers = \Hubzero\User\Profile\Helper::find_by_email($this->registration['email']);
if (($this->task == 'create' || $this->task == 'proxycreate') && $emailusers) {
    ?>
			<div class="error">
				<p>The email address "<?php 
    echo $this->escape($this->registration['email']);
    ?>
" is already registered. If you have lost or forgotten this <?php 
    echo $this->sitename;
    ?>
 login information, we can help you recover it:</p>
				<p class="submit"><a href="<?php 
    echo Route::url('index.php?option=com_users&view=remind');
    ?>
" class="btn btn-danger">Email Existing Account Information</a>
				<p>If you are aware you already have another account registered to this email address, and are requesting another account because you need more resources, <?php 
Example #10
0
 /**
  * Passport badges. Placeholder for now.
  *
  * @apiMethod POST
  * @apiUri    /courses/passport/badge
  * @apiParameter {
  * 		"name":        "action",
  * 		"description": "Badge action",
  * 		"type":        "string",
  * 		"required":    true,
  * 		"default":     null
  * }
  * @apiParameter {
  * 		"name":        "badge_id",
  * 		"description": "Passport badge ID",
  * 		"type":        "integer",
  * 		"required":    true,
  * 		"default":     null
  * }
  * @apiParameter {
  * 		"name":        "user_email",
  * 		"description": "Email address to which the badge was asserted",
  * 		"type":        "string",
  * 		"required":    true,
  * 		"default":     null
  * }
  * @return    void
  */
 public function badgeTask()
 {
     // Require authentication and authorization
     $this->authorizeOrFail();
     $action = Request::getVar('action', '');
     $badge_id = Request::getVar('badge_id', '');
     $user_email = Request::getVar('user_email', '');
     if (empty($action)) {
         App::abort(400, 'Please provide action');
     }
     if ($action != 'accept' && $action != 'deny') {
         App::abort(400, 'Bad action. Must be either accept or deny');
     }
     if (empty($badge_id)) {
         App::abort(400, 'Please provide badge ID');
     }
     if (empty($user_email)) {
         App::abort(400, 'Please provide user email');
     }
     // Find user by email
     $user_email = \Hubzero\User\Profile\Helper::find_by_email($user_email);
     if (empty($user_email[0])) {
         App::abort(404, 'User was not found');
     }
     $user = \Hubzero\User\Profile::getInstance($user_email[0]);
     if ($user === false) {
         App::abort(404, 'User was not found');
     }
     $user_id = $user->get('uidNumber');
     // Get section from provider badge id
     $section_badge = \Components\Courses\Models\Section\Badge::loadByProviderBadgeId($badge_id);
     // Check if there is a match
     if (!($section_id = $section_badge->get('section_id'))) {
         App::abort(400, 'No matching badge found');
     }
     // Get member id via user id and section id
     $member = \Components\Courses\Models\Member::getInstance($user_id, 0, 0, $section_id);
     // Check if there is a match
     if (!$member->get('id')) {
         App::abort(400, 'Matching course member not found');
     }
     // Now actually load the badge
     $member_badge = \Components\Courses\Models\MemberBadge::loadByMemberId($member->get('id'));
     // Check if there is a match
     if (!$member_badge->get('id')) {
         App::abort(400, 'This member does not have a matching badge entry');
     }
     $now = Date::toSql();
     $member_badge->set('action', $action);
     $member_badge->set('action_on', $now);
     $member_badge->store();
     // Return message
     $this->send('Passport data saved.');
 }
Example #11
0
 /**
  * Download a file
  *
  * @return     void
  */
 public function downloadTask()
 {
     //get vars
     $id = Request::getInt('id', 0);
     //check to make sure we have an id
     if (!$id || $id == 0) {
         return;
     }
     //Load member profile
     $member = \Hubzero\User\Profile::getInstance($id);
     // check to make sure we have member profile
     if (!$member) {
         return;
     }
     //get the file name
     // make sure to leave out any query params (ex. ?v={timestamp})
     $uri = Request::getVar('SCRIPT_URL', '', 'server');
     if (strstr($uri, 'Image:')) {
         $file = str_replace('Image:', '', strstr($uri, 'Image:'));
     } elseif (strstr($uri, 'File:')) {
         $file = str_replace('File:', '', strstr($uri, 'File:'));
     }
     //decode file name
     $file = urldecode($file);
     // build base path
     $base_path = $this->filespace() . DS . \Hubzero\User\Profile\Helper::niceidformat($member->get('uidNumber'));
     //if we are on the blog
     if (Request::getVar('active', 'profile') == 'blog') {
         // @FIXME Check still needs to occur for non-public entries
         //authorize checks
         /*if ($this->_authorize() != 'admin')
         		{
         			if (User::get('id') != $member->get('uidNumber'))
         			{
         				App::abort(403, Lang::txt('You are not authorized to download the file: ') . ' ' . $file);
         				return;
         			}
         		}*/
         //get the params from the members blog plugin
         $blog_params = Plugin::params('members', 'blog');
         //build the base path to file based of upload path param
         $base_path = str_replace('{{uid}}', \Hubzero\User\Profile\Helper::niceidformat($member->get('uidNumber')), $blog_params->get('uploadpath'));
     }
     //build file path
     $file_path = $base_path . DS . $file;
     // Ensure the file exist
     if (!file_exists(PATH_APP . DS . $file_path)) {
         App::abort(404, Lang::txt('The requested file could not be found: ') . ' ' . $file);
         return;
     }
     // Serve up the image
     $xserver = new \Hubzero\Content\Server();
     $xserver->filename(PATH_APP . DS . $file_path);
     $xserver->disposition('attachment');
     $xserver->acceptranges(false);
     // @TODO fix byte range support
     //serve up file
     if (!$xserver->serve()) {
         // Should only get here on error
         App::abort(404, Lang::txt('An error occured while trying to output the file'));
     } else {
         exit;
     }
     return;
 }
Example #12
0
 /**
  * Save an entry
  *
  * @param      boolean $redirect Redirect after save?
  * @return     void
  */
 public function saveTask($redirect = true)
 {
     // [SECURITY] Check for request forgeries
     Request::checkToken();
     // Incoming
     $fields = Request::getVar('fields', array(), 'post', 'none', 2);
     $team = Request::getVar('team', '', 'post', 2, 'none');
     // Bind the incoming data to our mdoel
     $row = new Models\Api\Application($fields);
     // Validate and save the data
     if (!$row->store(true)) {
         $this->setError($row->getError());
         $this->editTask($row);
         return;
     }
     // parse incoming team
     $team = array_map('trim', explode(',', $team));
     // clean up team
     foreach ($team as $k => $t) {
         // handle usernames & emails
         if (!is_numeric($t)) {
             // handle emails
             if (strpos($t, '@')) {
                 // load profile by email
                 $profile = \Hubzero\User\Profile\Helper::find_by_email($t);
             } else {
                 // load profile by username
                 $profile = \Hubzero\User\Profile::getInstance($t);
             }
             // swap usernames for uidnumbers
             if ($profile) {
                 $team[$k] = $profile->get('uidNumber');
             } else {
                 unset($team[$k]);
             }
         }
     }
     // add creator if new
     // will only ever get added once
     $team[] = User::get('id');
     // get current team
     $currentTeam = $row->team()->lists('uidNumber');
     // remove members not included now
     foreach (array_diff($currentTeam, $team) as $uidNumber) {
         $member = $row->team($uidNumber);
         $member->delete();
     }
     // add each non-team member to team
     foreach (array_diff($team, $currentTeam) as $uidNumber) {
         if ($uidNumber < 1) {
             continue;
         }
         // new team member object
         $teamMember = new Models\Api\Application\Team\Member(array('uidNumber' => $uidNumber, 'application_id' => $row->get('id')));
         $teamMember->store();
     }
     // Are we redirecting?
     // This will happen if a user clicks the "save & close" button.
     if ($redirect) {
         // Set the redirect
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_DEVELOPER_APPLICATION_SAVED'));
         return;
     }
     // Display the edit form. This will happen if the user clicked
     // the "save" or "apply" button.
     $this->editTask($row);
 }
Example #13
0
 /**
  * Download a picture
  *
  * @return  void
  */
 public function pictureTask()
 {
     //get vars
     $id = Request::getInt('id', 0);
     //check to make sure we have an id
     if (!$id || $id == 0) {
         return;
     }
     //Load member profile
     $member = Profile::getInstance($id);
     // check to make sure we have member profile
     if (!$member) {
         return;
     }
     $file = DS . trim($this->config->get('webpath', '/site/members'), DS);
     $file .= DS . Profile\Helper::niceidformat($member->get('uidNumber'));
     $file .= DS . Request::getVar('image', $member->get('picture'));
     // Ensure the file exist
     if (!file_exists(PATH_APP . DS . $file)) {
         App::abort(404, Lang::txt('COM_MEMBERS_FILE_NOT_FOUND') . ' ' . $file);
         return;
     }
     // Serve up the image
     $xserver = new \Hubzero\Content\Server();
     $xserver->filename(PATH_APP . DS . $file);
     $xserver->disposition('attachment');
     $xserver->acceptranges(false);
     // @TODO fix byte range support
     //serve up file
     if (!$xserver->serve()) {
         // Should only get here on error
         App::abort(404, Lang::txt('COM_MEMBERS_MEDIA_ERROR_SERVING_FILE'));
     } else {
         exit;
     }
     return;
 }
Example #14
0
 /**
  * Save developer application details
  * 
  * @return  void
  */
 public function saveTask()
 {
     // CSRF check
     Request::checkToken();
     // get request vars
     $data = Request::getVar('application', array(), 'post', 2, 'none');
     $team = Request::getVar('team', array(), 'post', 2, 'none');
     // bind data to model
     $model = new Models\Api\Application($data);
     // must be logged in
     if (User::isGuest()) {
         $return = Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&task=edit&id=' . $data['id'], false, true);
         App::redirect(Route::url('index.php?option=com_users&view=login&return=' . base64_encode($return)));
         return;
     }
     // is the app available
     if ($model->isDeleted()) {
         App::redirect(Route::url('index.php?option=com_developer&controller=applications'), Lang::txt('COM_DEVELOPER_API_APPLICATION_DOES_NOT_EXIST'), 'warning');
         return;
     }
     // make sure its ours
     if (!$this->config->get('access-edit-application', 0) && (!$this->config->get('access-create-application', 0) && $data['id'] > 0)) {
         App::redirect(Route::url('index.php?option=com_developer&controller=applications'), Lang::txt('COM_DEVELOPER_API_APPLICATION_NOT_AUTHORIZED'), 'warning');
         return;
     }
     // attempt to save model
     if (!$model->store(true)) {
         $this->setError($model->getError());
         $this->editTask($model);
         return;
     }
     // parse incoming team
     $team = array_map('trim', explode(',', $team));
     // clean up team
     foreach ($team as $k => $t) {
         // handle usernames & emails
         if (!is_numeric($t)) {
             // handle emails
             if (strpos($t, '@')) {
                 // load profile by email
                 $profile = \Hubzero\User\Profile\Helper::find_by_email($t);
             } else {
                 // load profile by username
                 $profile = \Hubzero\User\Profile::getInstance($t);
             }
             // swap usernames for uidnumbers
             if ($profile) {
                 $team[$k] = $profile->get('uidNumber');
             } else {
                 unset($team[$k]);
             }
         }
     }
     // add creator if new
     // will only ever get added once
     $team[] = User::get('id');
     // get current team
     $currentTeam = $model->team()->lists('uidNumber');
     // add each non-team member to team
     foreach (array_diff($team, $currentTeam) as $uidNumber) {
         if ($uidNumber < 1) {
             continue;
         }
         // new team member object
         $teamMember = new Models\Api\Application\Team\Member(array('uidNumber' => $uidNumber, 'application_id' => $model->get('id')));
         $teamMember->store();
     }
     // Redirect back to the main listing with a success message
     App::redirect(Route::url($model->link()), Lang::txt('COM_DEVELOPER_API_APPLICATION_SAVED'), 'passed');
 }
Example #15
0
    ?>
</span>
								<?php 
    echo $approved_on;
    ?>
							</div>
							<div class="col span3 omega">
								<span><?php 
    echo Lang::txt('COM_GROUPS_PAGES_VERSIONS_APPROVED_BY');
    ?>
</span>
								<?php 
    if ($approved_by != 'n/a' && $approved_by != 'System') {
        ?>
									<img align="left" width="20" src="<?php 
        echo \Hubzero\User\Profile\Helper::getMemberPhoto($profile->get('uidNumber'));
        ?>
" />
								<?php 
    }
    ?>
								<?php 
    echo $approved_by;
    ?>
							</div>
						</div>
						<div class="version-content">
							<?php 
    echo \Components\Groups\Helpers\Pages::generatePreview($this->page, $pageVersion->get('version'), true);
    ?>
						</div>
Example #16
0
 /**
  * Get a user's picture
  *
  * @param   integer  $anonymous  Is user anonymous?
  * @param   boolean  $thumbit    Show thumbnail or full picture?
  * @return  string
  */
 public function getPicture($anonymous = 0, $thumbit = true, $serveFile = true)
 {
     return ProfileHelper::getMemberPhoto($this, $anonymous, $thumbit, $serveFile);
 }
Example #17
0
 if ($i + $this->start >= count($this->groupusers)) {
     break;
 }
 $guser = $this->groupusers[$i + $this->start];
 $u = \Hubzero\User\Profile::getInstance($guser);
 if (!$u) {
     $u = new \Hubzero\User\Profile();
 }
 if (preg_match("/^[_\\.\\%0-9a-zA-Z-]+@([0-9a-zA-Z-]+\\.)+[a-zA-Z]{2,6}\$/i", $guser)) {
     $inviteemail = true;
     $pic = rtrim(Request::base(true), '/') . '/core/components/com_groups/site/assets/img/emailthumb.png';
 } else {
     if (!is_object($u)) {
         continue;
     } else {
         $pic = \Hubzero\User\Profile\Helper::getMemberPhoto($u, 0);
     }
 }
 switch ($this->filter) {
     case 'invitees':
         $status = Lang::txt('PLG_GROUPS_MEMBERS_STATUS_INVITEE');
         break;
     case 'pending':
         $status = Lang::txt('PLG_GROUPS_MEMBERS_STATUS_PENDING');
         break;
     case 'managers':
         $status = Lang::txt('PLG_GROUPS_MEMBERS_STATUS_MANAGER');
         $cls .= ' manager';
         break;
     case 'members':
     default:
Example #18
0
     }
 }
 $name = $row->surname ? stripslashes($row->surname) : '';
 if ($row->givenName) {
     $name .= $row->surname ? ', ' : '';
     $name .= stripslashes($row->givenName);
     $name .= $row->middleName ? ' ' . stripslashes($row->middleName) : '';
 }
 if (!trim($name)) {
     $name = Lang::txt('COM_MEMBERS_UNKNOWN') . ' (' . $row->username . ')';
 }
 $profile = new \Hubzero\User\Profile();
 $profile->set('uidNumber', $row->uidNumber);
 $profile->set('email', $row->email);
 $profile->set('picture', $row->picture);
 $p = \Hubzero\User\Profile\Helper::getMemberPhoto($profile);
 // User messaging
 $messageuser = false;
 if ($messaging && $row->uidNumber > 0 && $row->uidNumber != User::get('id')) {
     switch ($this->config->get('user_messaging')) {
         case 1:
             // Get the groups of the profile
             $pgroups = \Hubzero\User\Helper::getGroups($row->uidNumber, 'all');
             // Get the groups the user has access to
             $profilesgroups = array();
             if (!empty($pgroups)) {
                 foreach ($pgroups as $group) {
                     if ($group->regconfirmed) {
                         $profilesgroups[] = $group->cn;
                     }
                 }
Example #19
0
            $task = 'confirm';
            $img = 'publish_x.png';
            $alt = Lang::txt('JNO');
            $state = 'unpublish';
            break;
    }
    if (!$row->lastvisitDate || $row->lastvisitDate == "0000-00-00 00:00:00") {
        $lvisit = '<span class="never" style="color:#bbb;">' . Lang::txt('COM_MEMBERS_NEVER') . '</span>';
    } else {
        $lvisit = '<time datetime="' . $row->lastvisitDate . '">' . Date::of($row->lastvisitDate)->toLocal('Y-m-d') . '</time>';
    }
    if ($row->picture) {
        $thumb = substr(PATH_APP, strlen(PATH_ROOT)) . DS . trim($this->config->get('webpath'), DS);
        $thumb .= DS . \Hubzero\User\Profile\Helper::niceidformat($row->uidNumber);
        $thumb .= DS . ltrim($row->picture, DS);
        $thumb = \Hubzero\User\Profile\Helper::thumbit($thumb);
        if (file_exists(PATH_ROOT . $thumb)) {
            $picture = $thumb;
        }
    }
    ?>
			<tr class="<?php 
    echo "row{$k}";
    ?>
">
				<td>
					<input type="checkbox" name="id[]" id="cb<?php 
    echo $i;
    ?>
" value="<?php 
    echo $row->uidNumber;
Example #20
0
 /**
  * Get user profile info
  *
  * @apiMethod GET
  * @apiUri    /members/{id}
  * @apiParameter {
  * 		"name":        "id",
  * 		"description": "Member identifier",
  * 		"type":        "integer",
  * 		"required":    true,
  * 		"default":     null
  * }
  * @return  void
  */
 public function readTask()
 {
     $userid = Request::getInt('id', 0);
     $result = \Hubzero\User\Profile::getInstance($userid);
     if ($result === false) {
         throw new Exception(Lang::txt('COM_MEMBERS_ERROR_USER_NOT_FOUND'), 404);
     }
     // Get any request vars
     $format = Request::getVar('format', 'json');
     $profile = array('id' => $result->get('uidNumber'), 'username' => $result->get('username'), 'name' => $result->get('name'), 'first_name' => $result->get('givenName'), 'middle_name' => $result->get('middleName'), 'last_name' => $result->get('surname'), 'bio' => $result->getBio('clean'), 'email' => $result->get('email'), 'phone' => $result->get('phone'), 'url' => $result->get('url'), 'gender' => $result->get('gender'), 'organization' => $result->get('organization'), 'organization_type' => $result->get('orgtype'), 'country_resident' => $result->get('countryresident'), 'country_origin' => $result->get('countryorigin'), 'member_since' => $result->get('registerDate'), 'orcid' => $result->get('orcid'), 'picture' => array('thumb' => \Hubzero\User\Profile\Helper::getMemberPhoto($result, 0, true), 'full' => \Hubzero\User\Profile\Helper::getMemberPhoto($result, 0, false)));
     /* Is this correct ? */
     //corrects image path, API application breaks Route::url() in the Helper::getMemberPhoto() method.
     $profile['picture']['thumb'] = str_replace('/api', '', $profile['picture']['thumb']);
     $profile['picture']['full'] = str_replace('/api', '', $profile['picture']['full']);
     // Encode and return result
     $object = new stdClass();
     $object->profile = $profile;
     $this->send($object);
 }
Example #21
0
        }
        ?>
			<?php 
        if (!$row->original()) {
            //if ($item->get('created_by') != $this->member->get('uidNumber')) {
            ?>
				<div class="convo attribution reposted clearfix">
					<a href="<?php 
            echo Route::url('index.php?option=com_members&id=' . $row->get('created_by'));
            ?>
" title="<?php 
            echo $this->escape(stripslashes($row->creator()->get('name')));
            ?>
" class="img-link">
						<img src="<?php 
            echo \Hubzero\User\Profile\Helper::getMemberPhoto($this->member, 0);
            ?>
" alt="Profile picture of <?php 
            echo $this->escape(stripslashes($row->creator()->get('name')));
            ?>
" />
					</a>
					<p>
						<a href="<?php 
            echo Route::url('index.php?option=com_members&id=' . $row->get('created_by'));
            ?>
">
							<?php 
            echo $this->escape(stripslashes($row->creator()->get('name')));
            ?>
						</a>
Example #22
0
 /**
  * Return results for autocompleter
  *
  * @return     string JSON
  */
 public function autocompleteTask()
 {
     if (User::isGuest()) {
         return;
     }
     $restrict = '';
     $referrer = Request::getVar('HTTP_REFERER', NULL, 'server');
     if ($referrer && preg_match('/members\\/\\d+\\/messages/i', $referrer)) {
         if (!User::authorise('core.admin', $this->_option) && !User::authorise('core.manage', $this->_option)) {
             switch ($this->config->get('user_messaging')) {
                 case 2:
                     $restrict = " AND xp.public=1";
                     break;
                 case 1:
                 default:
                     $profile = \Hubzero\User\Profile::getInstance(User::get('id'));
                     $xgroups = $profile->getGroups('all');
                     $usersgroups = array();
                     if (!empty($xgroups)) {
                         foreach ($xgroups as $group) {
                             if ($group->regconfirmed) {
                                 $usersgroups[] = $group->gidNumber;
                             }
                         }
                     }
                     $members = null;
                     if (!empty($usersgroups)) {
                         $query = "SELECT DISTINCT uidNumber\n\t\t\t\t\t\t\t\t\tFROM `#__xgroups_members`\n\t\t\t\t\t\t\t\t\tWHERE gidNumber IN (" . implode(',', $usersgroups) . ")";
                         $this->database->setQuery($query);
                         $members = $this->database->loadColumn();
                     }
                     if (!$members || empty($members)) {
                         $members = array(User::get('id'));
                     }
                     $restrict = " AND xp.uidNumber IN (" . implode(',', $members) . ")";
                     break;
             }
         }
     }
     $filters = array();
     $filters['limit'] = 20;
     $filters['start'] = 0;
     $filters['search'] = strtolower(trim(Request::getString('value', '')));
     $originalQuery = $filters['search'];
     // match against orcid id
     if (preg_match('/\\d{4}-\\d{4}-\\d{4}-\\d{4}/', $filters['search'])) {
         $query = "SELECT xp.uidNumber, xp.name, xp.username, xp.organization, xp.picture, xp.public\n\t\t\t\t\tFROM #__xprofiles AS xp\n\t\t\t\t\tINNER JOIN #__users u ON u.id = xp.uidNumber AND u.block = 0\n\t\t\t\t\tWHERE orcid= " . $this->database->quote($filters['search']) . " AND xp.emailConfirmed>0 {$restrict}\n\t\t\t\t\tORDER BY xp.name ASC\n\t\t\t\t\tLIMIT " . $filters['start'] . "," . $filters['limit'];
     } else {
         // add trailing wildcard
         $filters['search'] = $filters['search'] . '*';
         // match member names on all three name parts
         $match = "MATCH(xp.givenName,xp.middleName,xp.surname) AGAINST(" . $this->database->quote($filters['search']) . " IN BOOLEAN MODE)";
         $query = "SELECT xp.uidNumber, xp.name, xp.username, xp.organization, xp.picture, xp.public, {$match} as rel\n\t\t\t\t\tFROM #__xprofiles AS xp\n\t\t\t\t\tINNER JOIN #__users u ON u.id = xp.uidNumber AND u.block = 0\n\t\t\t\t\tWHERE {$match} AND xp.emailConfirmed>0 {$restrict}\n\t\t\t\t\tORDER BY rel DESC, xp.name ASC\n\t\t\t\t\tLIMIT " . $filters['start'] . "," . $filters['limit'];
     }
     $this->database->setQuery($query);
     $rows = $this->database->loadObjectList();
     // Output search results in JSON format
     $json = array();
     if (count($rows) > 0) {
         $default = DS . trim($this->config->get('defaultpic', '/core/components/com_members/site/assets/img/profile.gif'), DS);
         if ($default == '/components/com_members/assets/img/profile.gif') {
             $default = '/core/components/com_members/site/assets/img/profile.gif';
         }
         $default = \Hubzero\User\Profile\Helper::thumbit($default);
         foreach ($rows as $row) {
             $picture = $default;
             $name = str_replace("\n", '', stripslashes(trim($row->name)));
             $name = str_replace("\r", '', $name);
             $name = str_replace('\\', '', $name);
             if ($row->public && $row->picture) {
                 $thumb = DS . trim($this->config->get('webpath', '/site/members'), DS);
                 $thumb .= DS . \Hubzero\User\Profile\Helper::niceidformat($row->uidNumber);
                 $thumb .= DS . ltrim($row->picture, DS);
                 $thumb = \Hubzero\User\Profile\Helper::thumbit($thumb);
                 if (file_exists(PATH_APP . $thumb)) {
                     $picture = substr(PATH_APP, strlen(PATH_ROOT)) . $thumb;
                 }
             }
             $obj = array();
             $obj['id'] = $row->uidNumber;
             $obj['name'] = $name;
             $obj['org'] = $row->public ? $row->organization : '';
             $obj['picture'] = $picture;
             $json[] = $obj;
         }
     }
     // formats names in the autocompleter
     if (!\Hubzero\Utility\Validate::email($originalQuery) && str_word_count($originalQuery) >= 2) {
         $originalQuery = ucwords($originalQuery);
     }
     //original query
     $obj = array();
     $obj['name'] = $originalQuery;
     $obj['id'] = $originalQuery;
     $obj['org'] = '';
     $obj['picture'] = '';
     $obj['orig'] = true;
     //add back original query
     array_unshift($json, $obj);
     echo json_encode($json);
 }