Beispiel #1
1
 /**
  * Processes the google callback from oauth authorize requests
  *
  * @return    void
  **/
 public function googledriveAuthorizeTask()
 {
     $pparams = \Plugin::params('filesystem', 'google');
     $app_id = \Session::get('googledrive.app_id', false);
     $app_secret = \Session::get('googledrive.app_secret', false);
     $new_connection = Session::get('googledrive.connection_to_set_up', false);
     $info = ['key' => isset($app_key) ? $app_key : $pparams->get('app_key'), 'secret' => isset($app_secret) ? $app_secret : $pparams->get('app_secret')];
     $client = new \Google_Client();
     $client->setClientId($app_id);
     $client->setClientSecret($app_secret);
     $client->addScope(\Google_Service_Drive::DRIVE);
     $client->setAccessType('offline');
     $client->setApprovalPrompt('force');
     $redirectUri = trim(Request::root(), '/') . '/developer/callback/googledriveAuthorize';
     $client->setRedirectUri($redirectUri);
     $code = Request::get('code', false);
     if ($code) {
         $client->fetchAccessTokenWithAuthCode($code);
         $accessToken = $client->getAccessToken();
     } else {
         throw new \Exception("No state found", 400);
     }
     //if this is a new connection, we can save the token on the server to ensure that it is used next time
     if ($new_connection) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'models' . DS . 'orm' . DS . 'connection.php';
         $connection = \Components\Projects\Models\Orm\Connection::oneOrFail($new_connection);
         $connection_params = json_decode($connection->get('params'));
         $connection_params->app_token = $accessToken;
         $connection->set('params', json_encode($connection_params));
         $connection->save();
     }
     // Redirect to the local endpoint
     App::redirect(base64_decode(\Session::get('googledrive.state')));
 }
Beispiel #2
0
 /**
  * Initializes the dropbox connection
  *
  * @param   array   $params  Any connection params needed
  * @return  \League\Flysystem\Dropbox\DropboxAdapter
  **/
 public static function init($params = [])
 {
     // Get the params
     $pparams = Plugin::params('filesystem', 'dropbox');
     if (isset($params['app_token'])) {
         $accessToken = $params['app_token'];
     } else {
         $info = ['key' => isset($params['app_key']) ? $params['app_key'] : $pparams->get('app_key'), 'secret' => isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret')];
         \Session::set('dropbox.app_key', $info['key']);
         \Session::set('dropbox.app_secret', $info['secret']);
         \Session::set('dropbox.connection_to_set_up', Request::getVar('connection', 0));
         $appInfo = \Dropbox\AppInfo::loadFromJson($info);
         $clientIdentifier = 'hubzero-cms/2.0';
         $redirectUri = trim(Request::root(), '/') . '/developer/callback/dropboxAuthorize';
         $csrfTokenStore = new \Dropbox\ArrayEntryStore($_SESSION, 'dropbox-auth-csrf-token');
         $oauth = new \Dropbox\WebAuth($appInfo, $clientIdentifier, $redirectUri, $csrfTokenStore);
         // Redirect to dropbox
         // We hide the return url in the state field...that's not exactly what
         // it was intended for, but it does the trick
         $return = Request::getVar('return') ? Request::getVar('return') : Request::current(true);
         $return = base64_encode($return);
         App::redirect($oauth->start($return));
     }
     $app_secret = isset($params['app_secret']) ? $params['app_secret'] : $pparams->get('app_secret');
     // Create the client
     $client = new \Dropbox\Client($accessToken, $app_secret);
     // Return the adapter
     return new \League\Flysystem\Dropbox\DropboxAdapter($client, isset($params['subdir']) ? $params['subdir'] : null);
 }
Beispiel #3
0
 /**
  * Initializes the Google Drive connection
  *
  * @param   array   $params  Any connection params needed
  * @return  object
  **/
 public static function init($params = [])
 {
     // Get the params
     $pparams = Plugin::params('filesystem', 'googledrive');
     $app_id = isset($params['app_id']) && $params['app_id'] != '' ? $params['app_id'] : $pparams->get('app_id');
     $app_secret = isset($params['app_secret']) && $params['app_secret'] != '' ? $params['app_secret'] : $pparams->get('app_secret');
     $client = new \Google_Client();
     $client->setClientId($app_id);
     $client->setClientSecret($app_secret);
     $client->addScope(Google_Service_Drive::DRIVE);
     $client->setAccessType('offline');
     $client->setApprovalPrompt('force');
     $client->setIncludeGrantedScopes(true);
     if (isset($params['app_token'])) {
         $accessToken = $params['app_token'];
         // json encode turned our array into an object, we need to undo that
         $accessToken = (array) $accessToken;
     } else {
         \Session::set('googledrive.app_id', $app_id);
         \Session::set('googledrive.app_secret', $app_secret);
         \Session::set('googledrive.connection_to_set_up', Request::getVar('connection', 0));
         // Set upp a return and redirect to Google for auth
         $return = Request::getVar('return') ? Request::getVar('return') : Request::current(true);
         $return = base64_encode($return);
         $redirectUri = trim(Request::root(), '/') . '/developer/callback/googledriveAuthorize';
         $client->setRedirectUri($redirectUri);
         Session::set('googledrive.state', $return);
         App::redirect($client->createAuthUrl());
     }
     $client->setAccessToken($accessToken);
     $service = new \Google_Service_Drive($client);
     $adapter = new \Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter($service, 'root');
     return $adapter;
 }
Beispiel #4
0
 /**
  * Initializes the github connection
  *
  * @param   array   $params  Any connection params needed
  * @return  object
  **/
 public static function init($params = [])
 {
     // Get the params
     $pparams = Plugin::params('filesystem', 'github');
     $app_key = isset($params['app_key']) ? $params['app_key'] : $pparams['app_key'];
     $app_secret = isset($params['app_secret']) ? $params['app_secret'] : $pparams['app_secret'];
     \Session::set('github.app_key', $app_key);
     \Session::set('github.app_secret', $app_secret);
     $repository = isset($params['repository']) ? $params['repository'] : $pparams['repository'];
     $credentials = [];
     if (isset($params['username']) && isset($params['password'])) {
         $credentials = [Settings::AUTHENTICATE_USING_PASSWORD, $params['username'], $params['password']];
     } else {
         $accessToken = Session::get('github.token', false);
         if (!$accessToken) {
             $base = 'https://github.com/login/oauth/authorize';
             $params = '?client_id=' . $app_key;
             $scope = '&scope=user,repo';
             $return = Request::getVar('return') ? Request::getVar('return') : Request::current(true);
             $return = base64_encode($return);
             $state = '&state=' . $return;
             Session::set('github.state', $return);
             App::redirect($base . $params . $scope . $state);
         }
         $credentials = [Settings::AUTHENTICATE_USING_TOKEN, $accessToken];
     }
     $settings = new Settings($params['repository'], $credentials);
     $api = new Api(new \Github\Client(), $settings);
     // Return the adapter
     return new GithubAdapter($api);
 }
Beispiel #5
0
 /**
  * Email member activity digest
  *
  * Current limitations include a lack of queuing/scheduling. This means that this cron job
  * should not be set to run more than once daily, otherwise it will continue to send out the
  * same digest to people over and over again.
  *
  * @param   object  $job  \Components\Cron\Models\Job
  * @return  bool
  */
 public function emailMemberDigest(\Components\Cron\Models\Job $job)
 {
     // Make sure digests are enabled?  The cron job being on may be evidence enough...
     if (!Plugin::params('members', 'activity')->get('email_digests', false)) {
         return true;
     }
     // Load language files
     Lang::load('plg_members_activity') || Lang::load('plg_members_activity', PATH_CORE . DS . 'plugins' . DS . 'members' . DS . 'activity');
     // Database connection
     $db = App::get('db');
     // 0 = no email
     // 1 = immediately
     // 2 = digest daily
     // 3 = digest weekly
     // 4 = digest monthly
     $intervals = array(0 => 'none', 1 => 'now', 2 => 'day', 3 => 'week', 4 => 'month');
     // Check frequency (this plugin should run early every morning)
     // If daily, run every day
     // If weekly, only run this one on mondays
     // If monthly, only run this on on the 1st of the month
     $isDay = true;
     $isWeek = Date::of('now')->toLocal('N') == 1 ? true : false;
     $isMonth = Date::of('now')->toLocal('j') == 1 ? true : false;
     foreach ($intervals as $val => $interval) {
         // Skip the first two options for now
         if ($val < 2) {
             continue;
         }
         if ($val == 3 && !$isWeek) {
             continue;
         }
         if ($val == 4 && !$isMonth) {
             continue;
         }
         // Find all users that want weekly digests and the last time the digest
         // was sent was NEVER or older than 1 month ago.
         $previous = Date::of('now')->subtract('1 ' . $interval)->toSql();
         // Set up the query
         $query = "SELECT DISTINCT(scope_id) FROM `#__activity_digests` WHERE `scope`=" . $db->quote('user') . " AND `frequency`=" . $db->quote($val) . " AND (`sent` = '0000-00-00 00:00:00' OR `sent` <= " . $db->quote($previous) . ")";
         $db->setQuery($query);
         $users = $db->loadColumn();
         // Loop through members and get their groups that have the digest set
         if ($users && count($users) > 0) {
             foreach ($users as $user) {
                 $posts = \Hubzero\Activity\Recipient::all()->including('log')->whereEquals('scope', 'user')->whereEquals('scope_id', $user)->whereEquals('state', 1)->where('created', '>', $previous)->ordered()->rows();
                 // Gather up applicable posts and queue up the emails
                 if (count($posts) > 0) {
                     if ($this->sendEmail($user, $posts, $interval)) {
                         // Update the last sent timestamp
                         $query = "UPDATE `#__activity_digests` SET `sent`=" . $db->quote(Date::toSql()) . " WHERE `scope`=" . $db->quote('user') . " AND `scope_id`=" . $db->quote($user);
                         $db->setQuery($query);
                         $db->query();
                     }
                 }
             }
         }
     }
     return true;
 }
Beispiel #6
0
function get_conf($db_id)
{
    global $dv_conf, $com_name;
    $params = Plugin::params('projects', 'databases');
    $dv_conf['db']['host'] = $params->get('db_host');
    $dv_conf['db']['user'] = $params->get('db_ro_user');
    $dv_conf['db']['password'] = $params->get('db_ro_password');
    return $dv_conf;
}
 /**
  * Checks to see if user is jailed
  *
  * @return  bool
  */
 public function isJailed()
 {
     if ($this->get('user_id', false)) {
         $params = Plugin::params('system', 'spamjail');
         $sessionCount = $params->get('session_count', 5);
         $lifetimeCount = $params->get('user_count', 10);
         if (Session::get('spam_count', 0) > $sessionCount || $this->get('spam_count', 0) > $lifetimeCount) {
             return true;
         }
     }
     return false;
 }
Beispiel #8
0
 /**
  * Constructor
  *
  * @param	   object	$connect
  * @return	   void
  */
 public function __construct($connect = NULL)
 {
     if (empty($connect)) {
         return false;
     }
     $this->_db = \App::get('db');
     $this->_connect = $connect;
     $this->model = $connect->model;
     $this->_uid = User::get('id');
     $this->params = Plugin::params('projects', 'files');
     $this->_logPath = \Components\Projects\Helpers\Html::getProjectRepoPath($this->model->get('alias'), 'logs', false);
     if (!is_dir($this->_logPath)) {
         Filesystem::makeDirectory($this->_logPath, 0755, true, true);
     }
     $this->_path = $this->model->repo()->get('path');
 }
Beispiel #9
0
    echo ' selected="selected"';
}
?>
><?php 
echo Lang::txt('COM_COURSES_TRASHED');
?>
</option>
					</select>
				</div>
			</fieldset>

			<?php 
if ($plugins = Event::trigger('courses.onAssetgroupEdit')) {
    $data = $this->row->get('params');
    foreach ($plugins as $plugin) {
        $default = Plugin::params('courses', $plugin['name']);
        $param = new \Hubzero\Html\Parameter(is_object($data) ? $data->toString() : $data, PATH_CORE . DS . 'plugins' . DS . 'courses' . DS . $plugin['name'] . DS . $plugin['name'] . '.xml');
        foreach ($default->toArray() as $k => $v) {
            if (substr($k, 0, strlen('default_')) == 'default_') {
                $param->def(substr($k, strlen('default_')), $default->get($k, $v));
            }
        }
        $out = $param->render('params', 'onAssetgroupEdit');
        if (!$out) {
            continue;
        }
        ?>
					<fieldset class="adminform eventparams" id="params-<?php 
        echo $plugin['name'];
        ?>
">
Beispiel #10
0
 /**
  * Calculate royalties
  *
  * @return     void
  */
 public function royaltyTask()
 {
     $auto = Request::getInt('auto', 0);
     $action = 'royalty';
     if (!$auto) {
         $who = User::get('id');
     } else {
         $who = 0;
     }
     // What month/year is it now?
     $curmonth = Date::of('now')->format("F");
     $curyear = Date::of('now')->format("Y-m");
     $ref = strtotime($curyear);
     $this->_message = 'Royalties on Answers for ' . $curyear . ' were distributed successfully.';
     $rmsg = 'Royalties on Reviews for ' . $curyear . ' were distributed successfully.';
     $resmsg = 'Royalties on Resources for ' . $curyear . ' were distributed successfully.';
     // Make sure we distribute royalties only once/ month
     $MH = new MarketHistory($this->database);
     $royaltyAnswers = $MH->getRecord('', $action, 'answers', $curyear, $this->_message);
     $royaltyReviews = $MH->getRecord('', $action, 'reviews', $curyear, $rmsg);
     $royaltyResources = $MH->getRecord('', $action, 'resources', $curyear, $resmsg);
     // Include economy classes
     if (is_file(PATH_CORE . DS . 'components' . DS . 'com_answers' . DS . 'helpers' . DS . 'economy.php')) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_answers' . DS . 'helpers' . DS . 'economy.php';
     }
     if (is_file(PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'economy.php')) {
         require_once PATH_CORE . DS . 'components' . DS . 'com_resources' . DS . 'helpers' . DS . 'economy.php';
     }
     $AE = new \Components\Answers\Helpers\Economy($this->database);
     $accumulated = 0;
     // Get Royalties on Answers
     if (!$royaltyAnswers) {
         $rows = $AE->getQuestions();
         if ($rows) {
             foreach ($rows as $r) {
                 $AE->distribute_points($r->id, $r->q_owner, $r->a_owner, $action);
                 $accumulated = $accumulated + $AE->calculate_marketvalue($r->id, $action);
             }
             // make a record of royalty payment
             if (intval($accumulated) > 0) {
                 $MH = new MarketHistory($this->database);
                 $data['itemid'] = $ref;
                 $data['date'] = Date::toSql();
                 $data['market_value'] = $accumulated;
                 $data['category'] = 'answers';
                 $data['action'] = $action;
                 $data['log'] = $this->_message;
                 if (!$MH->bind($data)) {
                     $err = $MH->getError();
                 }
                 if (!$MH->store()) {
                     $err = $MH->getError();
                 }
             }
         } else {
             $this->_message = 'There were no questions eligible for royalty payment. ';
         }
     } else {
         $this->_message = 'Royalties on Answers for ' . $curyear . ' were previously distributed. ';
     }
     // Get Royalties on Resource Reviews
     if (!$royaltyReviews) {
         // get eligible
         $RE = new \Components\Resources\Helpers\Economy\Reviews($this->database);
         $reviews = $RE->getReviews();
         // do we have ratings on reviews enabled?
         $plparam = Plugin::params('resources', 'reviews');
         $voting = $plparam->get('voting');
         $accumulated = 0;
         if ($reviews && $voting) {
             foreach ($reviews as $r) {
                 $RE->distribute_points($r, $action);
                 $accumulated = $accumulated + $RE->calculate_marketvalue($r, $action);
             }
             $this->_message .= $rmsg;
         } else {
             $this->_message .= 'There were no reviews eligible for royalty payment. ';
         }
         // make a record of royalty payment
         if (intval($accumulated) > 0) {
             $MH = new MarketHistory($this->database);
             $data['itemid'] = $ref;
             $data['date'] = Date::toSql();
             $data['market_value'] = $accumulated;
             $data['category'] = 'reviews';
             $data['action'] = $action;
             $data['log'] = $rmsg;
             if (!$MH->bind($data)) {
                 $err = $MH->getError();
             }
             if (!$MH->store()) {
                 $err = $MH->getError();
             }
         }
     } else {
         $this->_message .= 'Royalties on Reviews for ' . $curyear . ' were previously distributed. ';
     }
     // Get Royalties on Resources
     if (!$royaltyResources) {
         // get eligible
         $ResE = new \Components\Resources\Helpers\Economy\Reviews($this->database);
         $cons = $ResE->getCons();
         $accumulated = 0;
         if ($cons) {
             foreach ($cons as $con) {
                 $ResE->distribute_points($con, $action);
                 $accumulated = $accumulated + $con->ranking;
             }
             $this->_message .= $resmsg;
         } else {
             $this->_message .= 'There were no resources eligible for royalty payment.';
         }
         // make a record of royalty payment
         if (intval($accumulated) > 0) {
             $MH = new MarketHistory($this->database);
             $data['itemid'] = $ref;
             $data['date'] = Date::toSql();
             $data['market_value'] = $accumulated;
             $data['category'] = 'resources';
             $data['action'] = $action;
             $data['log'] = $resmsg;
             if (!$MH->bind($data)) {
                 $err = $MH->getError();
             }
             if (!$MH->store()) {
                 $err = $MH->getError();
             }
         }
     } else {
         $this->_message .= 'Royalties on Resources for ' . $curyear . ' were previously distributed.';
     }
     if (!$auto) {
         // show output if run manually
         App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt($this->_message));
     }
 }
Beispiel #11
0
 /**
  * This method will return a user object
  *
  * If options['autoregister'] is true, if the user doesn't exist yet he will be created
  *
  * @param   array   $user     Holds the user data.
  * @param   array   $options  Array holding options (remember, autoregister, group).
  * @return  object  A User object
  */
 protected function _getUser($user, $options = array())
 {
     $instance = JUser::getInstance();
     if ($id = intval(JUserHelper::getUserId($user['username']))) {
         $instance->load($id);
         return $instance;
     }
     //TODO : move this out of the plugin
     $config = Component::params('com_users');
     // Default to Registered.
     $defaultUserGroup = $config->get('new_usertype', 2);
     $acl = JFactory::getACL();
     $instance->set('id', 0);
     $instance->set('name', $user['fullname']);
     $instance->set('username', $user['username']);
     $instance->set('password_clear', isset($user['password_clear']) ? $user['password_clear'] : '');
     $instance->set('email', $user['email']);
     // Result should contain an email (check)
     $instance->set('usertype', 'deprecated');
     $instance->set('groups', array($defaultUserGroup));
     // Check joomla user activation setting
     // 0 = automatically confirmed
     // 1 = require email confirmation (the norm)
     // 2 = require admin confirmation
     $useractivation = $config->get('useractivation', 1);
     // If requiring admin approval, set user to not approved
     if ($useractivation == 2) {
         $instance->set('approved', 0);
     } else {
         $instance->set('approved', 2);
     }
     // Now, also check to see if user came in via an auth plugin, as that may affect their approval status
     if (isset($user['auth_link'])) {
         $domain = \Hubzero\Auth\Domain::find_by_id($user['auth_link']->auth_domain_id);
         if ($domain && is_object($domain)) {
             $params = Plugin::params('authentication', $domain->authenticator);
             if ($params && is_object($params) && $params->get('auto_approve', false)) {
                 $instance->set('approved', 2);
             }
         }
     }
     // If autoregister is set let's register the user
     $autoregister = isset($options['autoregister']) ? $options['autoregister'] : $this->params->get('autoregister', 1);
     if ($autoregister) {
         if (!$instance->save()) {
             return new Exception($instance->getError());
         }
     } else {
         // No existing user and autoregister off, this is a temporary user.
         $instance->set('tmp_user', true);
     }
     return $instance;
 }
Beispiel #12
0
					<div class="input-modal">
						<span class="input-cell">
							<input type="text" name="spam_count" id="field-reputation" value="<?php 
    echo $this->escape($this->profile->reputation->get('spam_count', 0));
    ?>
" />
						</span>
						<span class="input-cell">
							<a class="button" href="#field-reputation" onclick="document.getElementById('field-reputation').value='0';Joomla.submitbutton('apply');"><?php 
    echo Lang::txt('COM_MEMBERS_RESET');
    ?>
</a>
						</span>
					</div>
					<?php 
    if ($this->profile->reputation->get('spam_count', 0) > Plugin::params('system', 'spamjail')->get('user_count', 10)) {
        ?>
						<p class="warning"><?php 
        echo Lang::txt('COM_MEMBERS_SPAM_COUNT_EXCEEDED');
        ?>
</p>
					<?php 
    }
    ?>
				</div>
			<?php 
}
?>
		</fieldset>

		<?php 
Beispiel #13
0
 /**
  * Delete a record
  *
  * @return  void
  */
 public function settingsTask()
 {
     $id = Request::getInt('id', 0);
     $member = User::getInstance($id);
     if (!$member || !$member->get('id')) {
         // Output messsage and redirect
         App::abort(404, Lang::txt('Unknown or invalid member ID'));
     }
     $database = App::get('db');
     $xmc = Message\Component::blank();
     $components = $xmc->getRecords();
     /*if ($components)
     		{
     			$this->setError(Lang::txt('No vlaues found'));
     		}*/
     $settings = array();
     foreach ($components as $component) {
         $settings[$component->get('action')] = array();
     }
     // Fetch message methods
     $notimethods = Event::trigger('xmessage.onMessageMethods', array());
     // A var for storing the default notification method
     $default_method = null;
     // Instantiate our notify object
     $notify = Message\Notify::blank();
     // Get the user's selected methods
     $methods = $notify->getRecords($member->get('id'));
     if ($methods->count()) {
         foreach ($methods as $method) {
             $settings[$method->get('type')]['methods'][] = $method->get('method');
             $settings[$method->get('type')]['ids'][$method->get('method')] = $method->get('id');
         }
     } else {
         $default_method = \Plugin::params('members', 'messages')->get('default_method');
     }
     // Fill in any settings that weren't set.
     foreach ($settings as $key => $val) {
         if (count($val) <= 0) {
             // If the user has never changed their settings, set up the defaults
             if ($default_method !== null) {
                 $settings[$key]['methods'][] = 'internal';
                 $settings[$key]['methods'][] = $default_method;
                 $settings[$key]['ids']['internal'] = 0;
                 $settings[$key]['ids'][$default_method] = 0;
             } else {
                 $settings[$key]['methods'] = array();
                 $settings[$key]['ids'] = array();
             }
         }
     }
     $this->view->set('member', $member)->set('settings', $settings)->set('notimethods', $notimethods)->set('components', $components)->display();
 }
Beispiel #14
0
 /**
  * Refresh a Specific Group Calendar
  *
  * @param  bool  $force  Force refresh calendar?
  */
 public function refresh($force = false)
 {
     // only refresh subscriptions
     if (!$this->isSubscription()) {
         $this->setError($this->get('title'));
         return false;
     }
     // get refresh interval
     $interval = \Plugin::params('calendar', 'groups')->get('import_subscription_interval', 60);
     // get datetimes needed to refresh
     $now = Date::of('now');
     $lastRefreshed = Date::of($this->get('last_fetched_attempt'));
     $refreshInterval = new DateInterval("PT{$interval}M");
     // add refresh interval to last refreshed
     $lastRefreshed->add($refreshInterval);
     // if we havent passed our need to refresh date stop
     if ($now < $lastRefreshed && !$force) {
         return false;
     }
     // get current events
     $currentEvents = $this->events('list', array('scope' => $this->get('scope'), 'scope_id' => $this->get('scope_id'), 'calendar_id' => $this->get('id'), 'state' => array(1)));
     //build calendar url
     $calendarUrl = str_replace('webcal', 'http', $this->get('url'));
     //test to see if this calendar is valid
     $calendarHeaders = get_headers($calendarUrl, 1);
     $statusCode = isset($calendarHeaders[0]) ? $calendarHeaders[0] : '';
     // if we got a 301, lets update the location
     if (stristr($statusCode, '301 Moved Permanently')) {
         if (isset($calendarHeaders['Location'])) {
             $this->set('url', $calendarHeaders['Location']);
             $this->store(true);
             $this->refresh();
         }
     }
     //make sure the calendar url is valid
     if (!strstr($statusCode, '200 OK')) {
         $this->set('failed_attempts', $this->failed_attempts + 1);
         $this->set('last_fetched_attempt', Date::toSql());
         $this->store(true);
         $this->setError($this->get('title'));
         return false;
     }
     //read calendar file
     $icalparser = new \icalparser($calendarUrl);
     $incomingEvents = $icalparser->getEvents();
     // check to make sure we have events
     if (count($incomingEvents) < 1) {
         $this->setError($this->get('title'));
         return false;
     }
     //make uid keys for array
     //makes it easier to diff later on
     foreach ($incomingEvents as $k => $incomingEvent) {
         //get old and new key
         $oldKey = $k;
         $newKey = isset($incomingEvent['UID']) ? $incomingEvent['UID'] : '';
         //set keys to be the uid
         if ($newKey != '') {
             $incomingEvents[$newKey] = $incomingEvent;
             unset($incomingEvents[$oldKey]);
         }
     }
     //get events we need to delete
     $eventsToDelete = array_diff($currentEvents->lists('ical_uid'), array_keys($incomingEvents));
     //delete each event we dont have in the incoming events
     foreach ($eventsToDelete as $eventDelete) {
         $e = $currentEvents->fetch('ical_uid', $eventDelete);
         $e->delete();
     }
     //create new events for each event we pull
     foreach ($incomingEvents as $uid => $incomingEvent) {
         // fetch event from our current events by uid
         $event = $currentEvents->fetch('ical_uid', $uid);
         // create blank event if we dont have one
         if (!$event) {
             $event = new Event();
         }
         // set the timezone
         $tz = new DateTimezone(Config::get('offset'));
         // start already datetime objects
         $start = $incomingEvent['DTSTART'];
         $start->setTimezone($tz);
         // set publish up/down
         $publish_up = $start->toSql();
         $publish_down = '0000-00-00 00:00:00';
         $allday = isset($incomingEvent['ALLDAY']) && $incomingEvent['ALLDAY'] == 1 ? 1 : 0;
         $rrule = null;
         // handle end
         if (isset($incomingEvent['DTEND'])) {
             $end = $incomingEvent['DTEND'];
             $end->setTimezone($tz);
             $publish_down = $end->toSql();
         }
         // handle rrule
         if (isset($incomingEvent['RRULE'])) {
             // add frequency
             $rrule = 'FREQ=' . $incomingEvent['RRULE']['FREQ'];
             // add interval
             if (!isset($incomingEvent['RRULE']['INTERVAL'])) {
                 $incomingEvent['RRULE']['INTERVAL'] = 1;
             }
             $rrule .= ';INTERVAL=' . $incomingEvent['RRULE']['INTERVAL'];
             // count
             if (isset($incomingEvent['RRULE']['COUNT'])) {
                 $rrule .= ';COUNT=' . $incomingEvent['RRULE']['COUNT'];
             }
             // until
             if (isset($incomingEvent['RRULE']['UNTIL'])) {
                 if (strlen($incomingEvent['RRULE']['UNTIL']) == 8) {
                     $incomingEvent['RRULE']['UNTIL'] .= 'T000000Z';
                 }
                 $until = Date::of($incomingEvent['RRULE']['UNTIL']);
                 $rrule .= ';UNTIL=' . $until->format('Ymd\\THis\\Z');
             }
             //by day
             if (isset($incomingEvent['RRULE']['BYDAY'])) {
                 $rrule .= ';BYDAY=' . $incomingEvent['RRULE']['BYDAY'];
             }
         }
         // handle all day events
         if ($start->add(new DateInterval('P1D')) == $end) {
             $publish_down = '0000-00-00 00:00:00';
         }
         // set event details
         $event->set('title', isset($incomingEvent['SUMMARY']) ? $incomingEvent['SUMMARY'] : '');
         $event->set('content', isset($incomingEvent['DESCRIPTION']) ? $incomingEvent['DESCRIPTION'] : '');
         $event->set('content', stripslashes(str_replace('\\n', "\n", $event->get('content'))));
         $event->set('adresse_info', isset($incomingEvent['LOCATION']) ? $incomingEvent['LOCATION'] : '');
         $event->set('extra_info', isset($incomingEvent['URL']) ? $incomingEvent['URL'] : '');
         $event->set('modified', Date::toSql());
         $event->set('modified_by', User::get('id'));
         $event->set('publish_up', $publish_up);
         $event->set('publish_down', $publish_down);
         $event->set('allday', $allday);
         $event->set('repeating_rule', $rrule);
         // new event
         if (!$event->get('id')) {
             $event->set('catid', -1);
             $event->set('calendar_id', $this->get('id'));
             $event->set('ical_uid', isset($incomingEvent['UID']) ? $incomingEvent['UID'] : '');
             $event->set('scope', $this->get('scope'));
             $event->set('scope_id', $this->get('scope_id'));
             $event->set('state', 1);
             $event->set('created', Date::toSql());
             $event->set('created_by', User::get('id'));
             $event->set('time_zone', -5);
             $event->set('registerby', '0000-00-00 00:00:00');
             $event->set('params', '');
         }
         // save event
         $event->store(true);
     }
     // mark as fetched
     // clear failed attempts
     $this->set('last_fetched', Date::toSql());
     $this->set('last_fetched_attempt', Date::toSql());
     $this->set('failed_attempts', 0);
     $this->store(true);
     return true;
 }
Beispiel #15
0
 /**
  * Load a database dump
  *
  * @museDescription  Loads the provided database into the hubs currently configured database
  *
  * @return  void
  **/
 public function load()
 {
     if (!($infile = $this->arguments->getOpt(3))) {
         $this->output->error('Please provide an input file');
     } else {
         if (!is_file($infile)) {
             $this->output->error("'{$infile}' does not appear to be a valid file");
         }
     }
     // First, set some things aside that we need to reapply after the update
     $params = [];
     $params['com_system'] = \Component::params('com_system');
     $params['com_tools'] = \Component::params('com_tools');
     $params['com_usage'] = \Component::params('com_usage');
     $params['com_users'] = \Component::params('com_users');
     $params['plg_projects_databases'] = \Plugin::params('projects', 'databases');
     $tables = App::get('db')->getTableList();
     // See if we should drop all tables first
     if ($this->arguments->getOpt('drop-all-tables')) {
         $this->output->addLine('Dropping all tables...');
         foreach ($tables as $table) {
             App::get('db')->dropTable($table);
         }
     }
     // Craft the command to be executed
     $infile = escapeshellarg($infile);
     $cmd = "mysql -u " . Config::get('user') . " -p'" . Config::get('password') . "' -D " . Config::get('db') . " < {$infile}";
     $this->output->addLine('Loading data from ' . $infile . '...');
     // Now push the big red button
     exec($cmd);
     $migration = new Migration(App::get('db'));
     // Now load some things back up
     foreach ($params as $k => $v) {
         if (!empty($v)) {
             $migration->saveParams($k, $v);
         }
     }
     $this->output->addLine('Load complete!', 'success');
 }
Beispiel #16
0
 public static function onRenderOption($return = NULL, $title = 'With an affiliated institution:')
 {
     // hide the login box if the plugin is in "debug mode" and the special key is not set in the request
     $params = Plugin::params('authentication', 'shibboleth');
     if (($testKey = $params->get('testkey', NULL)) && !array_key_exists($testKey, $_GET)) {
         return '<span />';
     }
     // saved id provider? use it as the default
     $prefill = isset($_COOKIE['shib-entity-id']) ? $_COOKIE['shib-entity-id'] : NULL;
     if (!$prefill && ($host = self::getHostByAddress(isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'], $params->get('dns', '8.8.8.8'))) && preg_match('/[.]([^.]*?[.][a-z0-9]+?)$/', $host, $ma)) {
         // hostname lookup seems php jsonrational (not an ip address, has a few dots in it
         // try to look up a provider to pre-select based on the user's hostname
         foreach (self::getInstitutions() as $inst) {
             if (fnmatch('*' . $ma[1], $inst['host'])) {
                 $prefill = $inst['entity_id'];
                 break;
             }
         }
     }
     // attach style and scripts
     foreach (array('bootstrap-select.min.js', 'shibboleth.js', 'bootstrap-select.min.css', 'bootstrap-theme.min.css', 'shibboleth.css') as $asset) {
         $mtd = 'addPlugin' . (preg_match('/[.]js$/', $asset) ? 'script' : 'stylesheet');
         \Hubzero\Document\Assets::$mtd('authentication', 'shibboleth', $asset);
     }
     list($a, $h) = self::htmlify();
     // make a dropdown/button combo that (hopefully) gets prettied up client-side into a bootstrap dropdown
     $html = ['<div class="shibboleth account incommon-color" data-placeholder="' . $a($title) . '">'];
     $html[] = '<h3>Select an affiliated institution</h3>';
     $html[] = '<ol>';
     $html = array_merge($html, array_map(function ($idp) use($h, $a) {
         return '<li data-entityid="' . $a($idp['entity_id']) . '" data-content="' . (isset($idp['logo_data']) ? $a($idp['logo_data']) : '') . ' ' . $h($idp['label']) . '"><a href="' . Route::url('index.php?option=com_users&view=login&authenticator=shibboleth&idp=' . $a($idp['entity_id'])) . '">' . $h($idp['label']) . '</a></li>';
     }, self::getInstitutions()));
     $html[] = '</ol></div>';
     return $html;
 }
Beispiel #17
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;
 }
Beispiel #18
0
							<input type="hidden"  name="params[notes_public]" value="0" />
							<input type="checkbox" class="option" name="params[notes_public]" value="1" <?php 
                if ($this->model->params->get('notes_public')) {
                    echo ' checked="checked"';
                }
                ?>
 /> <?php 
                echo Lang::txt('COM_PROJECTS_NOTES_PUBLIC');
                ?>
						</label>
						<?php 
            }
            ?>

						<?php 
            $pparams = Plugin::params('projects', 'files');
            if ($pparams->get('enable_publinks')) {
                ?>
						<label>
							<input type="hidden"  name="params[files_public]" value="0" />
							<input type="checkbox" class="option" name="params[files_public]" value="1" <?php 
                if ($this->model->params->get('files_public')) {
                    echo ' checked="checked"';
                }
                ?>
 /> <?php 
                echo Lang::txt('COM_PROJECTS_FILES_PUBLIC');
                ?>
						</label>
						<?php 
            }
Beispiel #19
0
 public static function onRenderOption($return, $title = 'With an affiliated institution:')
 {
     // hide the login box if the plugin is in "debug mode" and the special key is not set in the request
     $params = Plugin::params('authentication', 'shibboleth');
     if (($testKey = $params->get('testkey', NULL)) && !array_key_exists($testKey, $_GET)) {
         return '<span />';
     }
     // saved id provider? use it as the default
     $prefill = isset($_COOKIE['shib-entity-id']) ? $_COOKIE['shib-entity-id'] : NULL;
     if (!$prefill && ($host = self::getHostByAddress(isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'], $params->get('dns', '8.8.8.8'))) && preg_match('/[.]([^.]*?[.][a-z0-9]+?)$/', $host, $ma)) {
         // hostname lookup seems php jsonrational (not an ip address, has a few dots in it
         // try to look up a provider to pre-select based on the user's hostname
         foreach (self::getInstitutions() as $inst) {
             if (fnmatch('*' . $ma[1], $inst['host'])) {
                 $prefill = $inst['entity_id'];
                 break;
             }
         }
     }
     // attach style and scripts
     foreach (array('bootstrap.min.js', 'bootstrap-select.min.js', 'shibboleth.js', 'bootstrap.min.css', 'bootstrap-select.min.css', 'bootstrap-theme.min.css', 'shibboleth.css') as $asset) {
         $isJs = preg_match('/[.]js$/', $asset);
         if ($isJs) {
             \Hubzero\Document\Assets::addPluginScript('authentication', 'shibboleth', $asset);
         } else {
             \Hubzero\Document\Assets::addPluginStylesheet('authentication', 'shibboleth', $asset);
         }
     }
     list($a, $h) = self::htmlify();
     // make a dropdown/button combo that (hopefully) gets prettied up client-side into a bootstrap dropdown
     $html = array();
     $html[] = '<form class="shibboleth account incommon-color" action="' . Route::url('index.php?option=com_users&view=login') . '" method="get">';
     $html[] = '<div class="default-icon"></div>';
     $html[] = '<select title="' . $a($title) . '" name="idp">';
     $html[] = '<option class="placeholder">' . $h($title) . '</option>';
     foreach (self::getInstitutions() as $idp) {
         $logo = isset($idp['logo_data']) && $idp['logo_data'] ? '<img src="' . $idp['logo_data'] . '" />' : '<span class="logo-placeholder"></span>';
         $html[] = '<option ' . ($prefill == $idp['entity_id'] ? 'selected="selected" ' : '') . 'value="' . $a($idp['entity_id']) . '" data-content="' . $a($logo . ' ' . $h($idp['label'])) . '">' . $h($idp['label']) . '</option>';
     }
     $html[] = '</select>';
     $html[] = '<input type="hidden" name="authenticator" value="shibboleth" />';
     if ($return) {
         $html[] = '<input type="hidden" name="return" value="' . $a(preg_replace('/^.return=/', '', $return)) . '" />';
     }
     $html[] = '<button class="submit" type="submit">Sign in</button>';
     $html[] = '</form>';
     return $html;
 }
Beispiel #20
0
 /**
  * Display a member's profile
  *
  * @return  void
  */
 private function profile()
 {
     if (!$this->group->isSuperGroup()) {
         return;
     }
     include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'member.php';
     $id = Request::getInt('member', 0);
     $profile = Components\Members\Models\Member::oneOrFail($id);
     if (!$profile->get('id')) {
         App::abort(404, Lang::txt('PLG_GROUPS_MEMBERS_PROFILE_NOT_FOUND'));
     }
     include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'profile' . DS . 'field.php';
     $fields = Components\Members\Models\Profile\Field::all()->including(['options', function ($option) {
         $option->select('*')->ordered();
     }])->where('action_edit', '!=', Components\Members\Models\Profile\Field::STATE_HIDDEN)->ordered()->rows();
     // Set the page title
     Document::setTitle(Lang::txt(strtoupper($this->name)) . ': ' . $this->group->get('description') . ': ' . Lang::txt(strtoupper($profile->get('name'))));
     $params = Plugin::params('members', 'profile');
     $params->merge(new \Hubzero\Config\Registry($profile->get('params')));
     // Display form asking for a reason to deny membership
     $view = $this->view('default', 'profile')->set('params', $params)->set('option', $this->_option)->set('profile', $profile)->set('fields', $fields)->set('group', $this->group)->set('authorized', $this->authorized)->set('membership_control', $this->membership_control);
     $this->_output = $view->loadTemplate();
 }
Beispiel #21
0
 /**
  * Get available disk space
  *
  * @return integer
  */
 public function getAvailableDiskSpace()
 {
     $pParams = Plugin::params('projects', 'files');
     $projectParams = $this->get('project')->params;
     $quota = $this->get('project')->config()->get('defaultQuota', '1');
     // Get disk usage
     $diskUsage = $this->call('getDiskUsage', $params = array('working' => true, 'history' => $pParams->get('disk_usage')));
     // Get quota
     if (!isset($this->_quota)) {
         $this->_quota = $projectParams->get('quota') ? $projectParams->get('quota') : Helpers\Html::convertSize(floatval($quota), 'GB', 'b');
     }
     return $this->_quota - $diskUsage;
 }
Beispiel #22
0
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Sam Wilson <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access.
defined('_HZEXEC_') or die;
$params = Plugin::params('system', 'spamjail');
?>

<header id="content-header">
	<h2><?php 
echo Lang::txt('COM_USERS_SPAM_DETECTED');
?>
</h2>
</header>

<section class="section">
	<p><?php 
echo Lang::txt('COM_USERS_SPAM_MESSAGE');
?>
</p>
Beispiel #23
0
    $html .= $filters['filterby'] == 'shortlisted' ? Lang::txt('shortlisted') . ' ' : '';
    $html .= strtolower(Lang::txt('candidates'));
    echo $html;
    ?>
			</p>

			<ul id="candidates">
			<?php 
    foreach ($seekers as $seeker) {
        ?>
				<li>
				<?php 
        $this->controller = '';
        $this->task = 'resumes';
        $view = $this->view('seeker');
        $params = new \Hubzero\Config\Registry(Plugin::params('members', 'resume'));
        $view->seeker = $seeker;
        $view->emp = $emp;
        $view->option = 'com_members';
        $view->admin = $admin;
        $view->params = $params;
        $view->list = 1;
        echo $view->loadTemplate();
        ?>
				</li>
				<?php 
    }
    ?>
			</ul>
		<?php 
} else {
Beispiel #24
0
 /**
  * Set configuration to connect with outside services
  *
  * @return	   void
  */
 public function setConfigs()
 {
     // Make up redirection URL for Google service
     $redirectUri = trim(Request::base(), DS) . DS . 'projects' . DS . 'auth';
     // Scope for Google service
     $scope = array('https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/userinfo.email');
     // We will use files plugin params
     $filesParams = Plugin::params('projects', 'files');
     // Get project params
     $pparams = $this->model->params;
     $connect = array('google' => array('servicename' => 'Google Drive', 'on' => $filesParams->get('enable_google', 0), 'clientId' => $filesParams->get('google_clientId', 0), 'clientSecret' => $filesParams->get('google_clientSecret', 0), 'appKey' => $filesParams->get('google_appKey', 0), 'redirectUri' => $redirectUri, 'scope' => $scope, 'approvalPrompt' => 'force', 'accessType' => 'offline', 'local_dir' => $pparams->get('google_local_dir', '#home'), 'remote_dir' => $pparams->get('google_dir', 'Project :: ' . $this->model->get('alias')), 'remote_dir_id' => $pparams->get('google_dir_id', 1), 'active' => $pparams->get('google_token', 0)), 'dropbox' => array('servicename' => 'Dropbox', 'on' => $filesParams->get('enable_dropbox', 0), 'key' => $filesParams->get('dropbox_key', 0), 'secret' => $filesParams->get('dropbox_secret', 0), 'local_dir' => $pparams->get('dropbox_local_dir', '#home'), 'remote_dir' => $pparams->get('dropbox_dir', 'project_' . $this->model->get('alias')), 'remote_dir_id' => $pparams->get('dropbox_dir_id', 1), 'active' => $pparams->get('dropbox_service', 0)));
     $this->_connect = $connect;
 }
Beispiel #25
0
 /**
  * Display a member's profile
  *
  * @return  void
  */
 private function profile()
 {
     if (!$this->group->isSuperGroup()) {
         return;
     }
     $id = Request::getInt('member', 0);
     $profile = \Hubzero\User\Profile::getInstance($id);
     if (!$profile) {
         App::abort(404, Lang::txt('PLG_GROUPS_MEMBERS_PROFILE_NOT_FOUND'));
     }
     include_once PATH_CORE . DS . 'components' . DS . 'com_members' . DS . 'models' . DS . 'registration.php';
     // Find out which fields are hidden, optional, or required
     $registration = new \Hubzero\Base\Object();
     $registration->Fullname = $this->_registrationField('registrationFullname', 'RRRR', 'edit');
     $registration->Email = $this->_registrationField('registrationEmail', 'RRRR', 'edit');
     $registration->URL = $this->_registrationField('registrationURL', 'HHHH', 'edit');
     $registration->Phone = $this->_registrationField('registrationPhone', 'HHHH', 'edit');
     $registration->Employment = $this->_registrationField('registrationEmployment', 'HHHH', 'edit');
     $registration->Organization = $this->_registrationField('registrationOrganization', 'HHHH', 'edit');
     $registration->Citizenship = $this->_registrationField('registrationCitizenship', 'HHHH', 'edit');
     $registration->Residency = $this->_registrationField('registrationResidency', 'HHHH', 'edit');
     $registration->Sex = $this->_registrationField('registrationSex', 'HHHH', 'edit');
     $registration->Disability = $this->_registrationField('registrationDisability', 'HHHH', 'edit');
     $registration->Hispanic = $this->_registrationField('registrationHispanic', 'HHHH', 'edit');
     $registration->Race = $this->_registrationField('registrationRace', 'HHHH', 'edit');
     $registration->Interests = $this->_registrationField('registrationInterests', 'HHHH', 'edit');
     $registration->Reason = $this->_registrationField('registrationReason', 'HHHH', 'edit');
     $registration->OptIn = $this->_registrationField('registrationOptIn', 'HHHH', 'edit');
     $registration->address = $this->_registrationField('registrationAddress', 'OOOO', 'edit');
     $registration->ORCID = $this->_registrationField('registrationORCID', 'OOOO', 'edit');
     // Set the page title
     Document::setTitle(Lang::txt(strtoupper($this->name)) . ': ' . $this->group->get('description') . ': ' . Lang::txt(strtoupper($profile->get('name'))));
     $params = Plugin::params('members', 'profile');
     $params->merge(new \Hubzero\Config\Registry($profile->get('params')));
     // Display form asking for a reason to deny membership
     $view = $this->view('default', 'profile');
     $view->option = $this->_option;
     $view->group = $this->group;
     $view->authorized = $this->authorized;
     $view->profile = $profile;
     $view->registration = $registration;
     $view->params = $params;
     $view->membership_control = $this->membership_control;
     $this->_output = $view->loadTemplate();
 }