当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugin::params方法代码示例

本文整理汇总了PHP中Plugin::params方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::params方法的具体用法?PHP Plugin::params怎么用?PHP Plugin::params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugin的用法示例。


在下文中一共展示了Plugin::params方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 /**
  * 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);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:35,代码来源:dropbox.php

示例2: init

 /**
  * 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;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:40,代码来源:googledrive.php

示例3: init

 /**
  * 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);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:37,代码来源:github.php

示例4: emailMemberDigest

 /**
  * 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;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:69,代码来源:activity.php

示例5: get_conf

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;
}
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:9,代码来源:mode_dsl.php

示例6: isJailed

 /**
  * 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;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:17,代码来源:Reputation.php

示例7: __construct

 /**
  * 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');
 }
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:22,代码来源:sync.php

示例8: settingsTask

 /**
  * 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();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:57,代码来源:messages.php

示例9: refresh

 /**
  * 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'])) {
//.........这里部分代码省略.........
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:101,代码来源:calendar.php

示例10: load

 /**
  * 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');
 }
开发者ID:mined-gatech,项目名称:framework,代码行数:46,代码来源:Database.php

示例11: strtolower

    $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 {
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:31,代码来源:default.php

示例12: royaltyTask

 /**
  * 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 {
//.........这里部分代码省略.........
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:101,代码来源:points.php

示例13: getAvailableDiskSpace

 /**
  * 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;
 }
开发者ID:digideskio,项目名称:hubzero-cms,代码行数:18,代码来源:repo.php

示例14: profile

 /**
  * 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();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:28,代码来源:members.php

示例15: downloadTask

 /**
  * 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;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:70,代码来源:media.php


注:本文中的Plugin::params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。