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


PHP object::access方法代码示例

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


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

示例1: onCourse

 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     if (!$offering->access('manage', 'section')) {
         return;
     }
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'managers'))->set('display_menu_tab', true)->set('icon', 'f083');
     if ($describe) {
         return $response;
     }
     $nonadmin = Request::getState('com_courses.offering' . $offering->get('id') . '.nonadmin', 0);
     if (!($active = Request::getVar('active')) && !$nonadmin) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         // Set the page title
         Document::setTitle(Document::getTitle() . ': ' . Lang::txt('PLG_COURSES_' . strtoupper($this->_name)));
         Pathway::append(Lang::txt('PLG_COURSES_' . strtoupper($this->_name)), $offering->link() . '&active=' . $this->_name);
         $view = with($this->view('default', 'overview'))->set('option', Request::getVar('option', 'com_courses'))->set('course', $course)->set('offering', $offering)->set('params', $this->params);
         foreach ($this->getErrors() as $error) {
             $view->setError($error);
         }
         $response->set('html', $view->loadTemplate());
     }
     // Return the output
     return $response;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:34,代码来源:dashboard.php

示例2: testFormatPermissions

 /**
  * Tests the Filter format access permissions functionality.
  */
 function testFormatPermissions()
 {
     // Make sure that a regular user only has access to the text formats for
     // which they were granted access.
     $fallback_format = entity_load('filter_format', filter_fallback_format());
     $this->assertTrue($this->allowed_format->access('use', $this->web_user), 'A regular user has access to use a text format they were granted access to.');
     $this->assertEqual(AccessResult::allowed()->cachePerRole(), $this->allowed_format->access('use', $this->web_user, TRUE), 'A regular user has access to use a text format they were granted access to.');
     $this->assertFalse($this->disallowed_format->access('use', $this->web_user), 'A regular user does not have access to use a text format they were not granted access to.');
     $this->assertEqual(AccessResult::neutral(), $this->disallowed_format->access('use', $this->web_user, TRUE));
     //, 'A regular user does not have access to use a text format they were not granted access to.');
     $this->assertTrue($fallback_format->access('use', $this->web_user), 'A regular user has access to use the fallback format.');
     $this->assertEqual(AccessResult::allowed(), $fallback_format->access('use', $this->web_user, TRUE), 'A regular user has access to use the fallback format.');
     // Perform similar checks as above, but now against the entire list of
     // available formats for this user.
     $this->assertTrue(in_array($this->allowed_format->format, array_keys(filter_formats($this->web_user))), 'The allowed format appears in the list of available formats for a regular user.');
     $this->assertFalse(in_array($this->disallowed_format->format, array_keys(filter_formats($this->web_user))), 'The disallowed format does not appear in the list of available formats for a regular user.');
     $this->assertTrue(in_array(filter_fallback_format(), array_keys(filter_formats($this->web_user))), 'The fallback format appears in the list of available formats for a regular user.');
     // Make sure that a regular user only has permission to use the format
     // they were granted access to.
     $this->assertTrue($this->web_user->hasPermission($this->allowed_format->getPermissionName()), 'A regular user has permission to use the allowed text format.');
     $this->assertFalse($this->web_user->hasPermission($this->disallowed_format->getPermissionName()), 'A regular user does not have permission to use the disallowed text format.');
     // Make sure that the allowed format appears on the node form and that
     // the disallowed format does not.
     $this->drupalLogin($this->web_user);
     $this->drupalGet('node/add/page');
     $elements = $this->xpath('//select[@name=:name]/option', array(':name' => 'body[0][format]', ':option' => $this->allowed_format->format));
     $options = array();
     foreach ($elements as $element) {
         $options[(string) $element['value']] = $element;
     }
     $this->assertTrue(isset($options[$this->allowed_format->format]), 'The allowed text format appears as an option when adding a new node.');
     $this->assertFalse(isset($options[$this->disallowed_format->format]), 'The disallowed text format does not appear as an option when adding a new node.');
     $this->assertFalse(isset($options[filter_fallback_format()]), 'The fallback format does not appear as an option when adding a new node.');
     // Check regular user access to the filter tips pages.
     $this->drupalGet('filter/tips/' . $this->allowed_format->format);
     $this->assertResponse(200);
     $this->drupalGet('filter/tips/' . $this->disallowed_format->format);
     $this->assertResponse(403);
     $this->drupalGet('filter/tips/' . filter_fallback_format());
     $this->assertResponse(200);
     $this->drupalGet('filter/tips/invalid-format');
     $this->assertResponse(404);
     // Check admin user access to the filter tips pages.
     $this->drupalLogin($this->admin_user);
     $this->drupalGet('filter/tips/' . $this->allowed_format->format);
     $this->assertResponse(200);
     $this->drupalGet('filter/tips/' . $this->disallowed_format->format);
     $this->assertResponse(200);
     $this->drupalGet('filter/tips/' . filter_fallback_format());
     $this->assertResponse(200);
     $this->drupalGet('filter/tips/invalid-format');
     $this->assertResponse(404);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:56,代码来源:FilterFormatAccessTest.php

示例3: onProject

 /**
  * Event call to return data for a specific project
  *
  * @param   object  $model   Project model
  * @param   string  $action  Plugin task
  * @param   string  $areas   Plugins to return data
  * @return  array   Return array of html
  */
 public function onProject($model, $action = '', $areas = NULL)
 {
     $returnhtml = true;
     $arr = array('html' => '', 'metadata' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check that project exists
     if (!$model->exists()) {
         return $arr;
     }
     // Check authorization
     if (!$model->access('member')) {
         return $arr;
     }
     // Are we returning HTML?
     if ($returnhtml) {
         $fields = Components\Projects\Models\Orm\Description\Field::all()->order('ordering', 'ASC')->rows();
         $projectDescription = Components\Projects\Models\Orm\Description::all()->where('project_id', '=', $model->get('id'))->rows();
         $info = array();
         foreach ($fields as $field) {
             foreach ($projectDescription as $description) {
                 if ($description->description_key == $field->name) {
                     $f = new stdClass();
                     $f->label = $field->label;
                     $f->value = $description->description_value;
                     array_push($info, $f);
                 }
             }
         }
         // Set vars
         $view = $this->view('default', 'view')->set('option', 'com_projects')->set('info', $info)->set('model', $model);
         $arr['html'] = $view->loadTemplate();
     }
     // Return data
     return $arr;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:50,代码来源:info.php

示例4: access

 /**
  * This function is used by different methods in controller to restrict
  * user access by checking the passed object and object id
  * 
  * @param string $permission permisson passed by function
  * @param object $obj An object of a model
  * @param int $obj_id object id of model ie primary key
  * 
  * @return object
  */
 protected function access($permission, $obj = null, $obj_id = 0)
 {
     $response = null;
     if ($obj_id) {
         $response = $obj->find($obj_id);
         if (!$response) {
             App::abort(404, Lang::get('messages.errors.corporate.missing'));
         }
     }
     if (!(Auth::check() && Auth::user()->can($permission))) {
         App::abort(403, Lang::get('messages.errors.corporate.access', array('section' => 'requested')));
     }
     if ($response) {
         if (!(Auth::user()->is('CRM User') || Auth::user()->is_super || Auth::user()->is('Loylty Admin'))) {
             if (!$obj->access($obj_id, Auth::user()->corporate_id)) {
                 App::abort(403, Lang::get('messages.errors.corporate.access', array('section' => 'requested')));
             }
         }
     }
     return $response;
 }
开发者ID:kapil-gupta,项目名称:carbazar,代码行数:31,代码来源:CorporateController.php

示例5: onProjectExtras

 /**
  * Event call to get side content
  *
  * @param   object  $model
  * @param   string  $area
  * @return  mixed
  */
 public function onProjectExtras($model, $area)
 {
     // Check if our area is the one we want to return results for
     if ($area != 'feed') {
         return;
     }
     // No suggestions for read-only users
     if (!$model->access('content')) {
         return false;
     }
     // Allow to place custom modules on project pages
     $html = \Hubzero\Module\Helper::renderModules('projectpage');
     // Side blocks from other plugins?
     $sections = Event::trigger('projects.onProjectMiniList', array($model));
     if (!empty($sections)) {
         // Show subscription to feed (new)
         $subscribe = Event::trigger('projects.onProjectMember', array($model));
         $html .= !empty($subscribe[0]) ? $subscribe[0] : NULL;
         foreach ($sections as $section) {
             $html .= !empty($section) ? $section : NULL;
         }
     }
     return $html;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:31,代码来源:feed.php

示例6: onProject

 /**
  * Event call to return data for a specific project
  *
  * @param      object  $model           Project model
  * @param	   string  $action			Plugin task
  * @param	   string  $areas			Plugins to return data
  * @return	   array   Return array of html
  */
 public function onProject($model, $action = '', $areas = null)
 {
     $returnhtml = true;
     $arr = array('html' => '', 'metadata' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check that project exists
     if (!$model->exists()) {
         return $arr;
     }
     // Check authorization
     if (!$model->access('member')) {
         return $arr;
     }
     // Model
     $this->model = $model;
     // Are we returning HTML?
     if ($returnhtml) {
         // Get our To do model
         $this->todo = new \Components\Projects\Models\Todo();
         // Set vars
         $this->_task = $action ? $action : Request::getVar('action', '');
         $this->_todoid = Request::getInt('todoid', 0);
         $this->_database = App::get('db');
         $this->_uid = User::get('id');
         switch ($this->_task) {
             case 'page':
             default:
                 $arr['html'] = $this->page();
                 break;
             case 'save':
                 $arr['html'] = $this->save();
                 break;
             case 'changestate':
                 $arr['html'] = $this->save();
                 break;
             case 'delete':
                 $arr['html'] = $this->delete();
                 break;
             case 'assign':
                 $arr['html'] = $this->save();
                 break;
             case 'view':
             case 'new':
             case 'edit':
                 $arr['html'] = $this->item();
                 break;
             case 'savecomment':
                 $arr['html'] = $this->_saveComment();
                 break;
             case 'deletecomment':
                 $arr['html'] = $this->_deleteComment();
                 break;
             case 'reorder':
             case 'sortitems':
                 $arr['html'] = $this->reorder();
                 break;
         }
     }
     // Return data
     return $arr;
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:76,代码来源:todo.php

示例7: onProject

 /**
  * Event call to return data for a specific project
  *
  * @param      object  $model           Project model
  * @param      string  $action			Plugin task
  * @param      string  $areas  			Plugins to return data
  * @return     array   Return array of html
  */
 public function onProject($model, $action = 'view', $areas = null)
 {
     $arr = array('html' => '', 'metadata' => '', 'message' => '', 'error' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check authorization
     if ($model->exists() && !$model->access('member')) {
         return $arr;
     }
     // Model
     $this->model = $model;
     // Load component configs
     $this->_config = $model->config();
     $this->gitpath = $this->_config->get('gitpath', '/opt/local/bin/git');
     // Incoming
     $raw_op = Request::getInt('raw_op', 0);
     $action = $action ? $action : Request::getVar('action', 'list');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return $arr;
         }
     }
     $this->_database = App::get('db');
     $this->_uid = User::get('id');
     // Publishing?
     if ($action == 'browser') {
         return $this->browser();
     }
     if ($action == 'select') {
         return $this->select();
     }
     $act_func = 'act_' . $action;
     if (!method_exists($this, $act_func)) {
         if ($raw_op) {
             print json_encode(array('status' => 'success', 'data' => $table));
             exit;
         } else {
             $act_func = 'act_list';
         }
     }
     // detect CR as new line
     ini_set('auto_detect_line_endings', true);
     if ($raw_op) {
         $this->{$act_func}();
         exit;
     } else {
         Document::addScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
         Document::addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js');
         Document::addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css');
         Document::addScript('/core/plugins/projects/databases/res/main.js');
         Document::addStyleSheet('/core/plugins/projects/databases/res/main.css');
         if (file_exists(__DIR__ . '/res/ds.' . $action . '.js')) {
             Document::addScript('/core/plugins/projects/databases/res/ds.' . $action . '.js');
         }
         if (file_exists(__DIR__ . '/res/ds.' . $action . '.css')) {
             Document::addStyleSheet('/core/plugins/projects/databases/res/ds.' . $action . '.css');
         }
         return $this->{$act_func}();
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:77,代码来源:databases.php

示例8: onProject

 /**
  * Event call to return data for a specific project
  *
  * @param      object  $model           Project model
  * @param      string  $action			Plugin task
  * @param      string  $areas  			Plugins to return data
  * @return     array   Return array of html
  */
 public function onProject($model, $action = '', $areas = null)
 {
     $returnhtml = true;
     $arr = array('html' => '', 'metadata' => '', 'message' => '', 'error' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check authorization
     if ($model->exists() && !$model->access('member')) {
         return $arr;
     }
     // Model
     $this->model = $model;
     // Incoming
     $this->_task = Request::getVar('action', '');
     $this->_pid = Request::getInt('pid', 0);
     if (!$this->_task) {
         $this->_task = $this->_pid ? 'publication' : $action;
     }
     $this->_uid = User::get('id');
     $this->_database = App::get('db');
     $this->_config = $this->model->config();
     $this->_pubconfig = Component::params('com_publications');
     // Common extensions (for gallery)
     $this->_image_ext = \Components\Projects\Helpers\Html::getParamArray($this->params->get('image_types', 'bmp, jpeg, jpg, png'));
     $this->_video_ext = \Components\Projects\Helpers\Html::getParamArray($this->params->get('video_types', 'avi, mpeg, mov, wmv'));
     // Check if exists or new
     if (!$this->model->exists()) {
         // Contribute process outside of projects
         $this->model->set('provisioned', 1);
         $ajax_tasks = array('showoptions', 'save', 'showitem');
         $this->_task = $action == 'start' ? 'start' : 'contribute';
         if ($action == 'publication') {
             $this->_task = 'publication';
         } elseif (in_array($action, $ajax_tasks)) {
             $this->_task = $action;
         }
     } elseif ($this->model->isProvisioned()) {
         // No browsing within provisioned project
         $this->_task = $action == 'browse' ? 'contribute' : $action;
     }
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications');
     \Hubzero\Document\Assets::addPluginStylesheet('projects', 'publications', 'curation');
     \Hubzero\Document\Assets::addPluginScript('projects', 'publications', 'curation');
     // Actions
     switch ($this->_task) {
         case 'browse':
         default:
             $arr['html'] = $this->browse();
             break;
         case 'start':
         case 'new':
             $arr['html'] = $this->startDraft();
             break;
         case 'edit':
         case 'publication':
         case 'continue':
         case 'review':
             $arr['html'] = $this->editDraft();
             break;
         case 'newversion':
         case 'savenew':
             $arr['html'] = $this->newVersion();
             break;
         case 'checkstatus':
             $arr['html'] = $this->checkStatus();
             break;
         case 'select':
             $arr['html'] = $this->select();
             break;
         case 'saveparam':
             $arr['html'] = $this->saveParam();
             break;
             // Change publication state
         // Change publication state
         case 'publish':
         case 'republish':
         case 'archive':
         case 'revert':
         case 'post':
             $arr['html'] = $this->publishDraft();
             break;
         case 'apply':
         case 'save':
         case 'rewind':
         case 'reorder':
         case 'deleteitem':
//.........这里部分代码省略.........
开发者ID:sumudinie,项目名称:hubzero-cms,代码行数:101,代码来源:publications.php

示例9: access

 /**
  * Check a user's authorization
  *
  * @param      string $action Action to check
  * @return     boolean True if authorized, false if not
  */
 public function access($action = 'view', $item = 'course')
 {
     return $this->_permissions->access($action, $item);
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:10,代码来源:course.php

示例10: onProjectMember

 /**
  * Return data on a project team member
  *
  * @param      object  $project 	Current publication
  * @return     array
  */
 public function onProjectMember($project)
 {
     // Only show for logged-in users
     if (User::isGuest()) {
         return false;
     }
     // Only show to members
     if (!$project->access('member')) {
         return false;
     }
     $this->database = App::get('db');
     $this->project = $project;
     // Item watch class
     $this->watch = new \Hubzero\Item\Watch($this->database);
     $this->action = strtolower(Request::getWord('action', ''));
     switch ($this->action) {
         case 'save':
             return $this->_save();
             break;
         case 'manage':
             return array('html' => $this->_manage());
             break;
         default:
             return $this->_status();
             break;
     }
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:33,代码来源:watch.php

示例11: onProject

 /**
  * Event call to return data for a specific project
  *
  * @param      object  $model           Project model
  * @param      string  $action			Plugin task
  * @param      string  $areas  			Plugins to return data
  * @return     array   Return array of html
  */
 public function onProject($model, $action = '', $areas = null)
 {
     $returnhtml = true;
     $arr = array('html' => '', 'metadata' => '');
     // Get this area details
     $this->_area = $this->onProjectAreas();
     // Check if our area is in the array of areas we want to return results for
     if (is_array($areas)) {
         if (empty($this->_area) || !in_array($this->_area['name'], $areas)) {
             return;
         }
     }
     // Check that project exists
     if (!$model->exists()) {
         return $arr;
     }
     // Check authorization
     if (!$model->access('member')) {
         return $arr;
     }
     // Model
     $this->model = $model;
     // Are we returning HTML?
     if ($returnhtml) {
         // Set vars
         $this->_task = $action ? $action : Request::getVar('action', '');
         $this->_database = App::get('db');
         $this->_uid = User::get('id');
         $this->_config = $model->config();
         switch ($this->_task) {
             case 'edit':
             case 'setup':
                 $arr['html'] = $this->display(1);
                 break;
             case 'delete':
             case 'deleteit':
                 $arr['html'] = $this->delete();
                 break;
             case 'changerole':
             case 'assignrole':
                 $arr['html'] = $this->_changeRole();
                 break;
             case 'changeowner':
                 $arr['html'] = $this->_changeOwner();
                 break;
             case 'save':
                 $arr['html'] = $this->_save();
                 break;
             case 'quit':
                 $arr['html'] = $this->_quit();
                 break;
             case 'view':
             default:
                 $arr['html'] = $this->display();
                 break;
             case 'select':
             case 'newauthor':
                 $arr['html'] = $this->select();
                 break;
         }
     }
     // Return data
     return $arr;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:72,代码来源:team.php

示例12: access

 /**
  * Check a user's authorization
  *
  * @param      string $action Action to check
  * @return     boolean True if authorized, false if not
  */
 public function access($action = 'view', $item = 'offering')
 {
     if (!isset($this->_permissions)) {
         $this->_permissions = Permissions::getInstance();
         $this->_permissions->set('course_id', $this->get('course_id'));
         $this->_permissions->set('offering_id', $this->get('id'));
         $this->_permissions->set('section_id', $this->section()->get('id'));
     }
     return $this->_permissions->access($action, $item);
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:16,代码来源:offering.php

示例13: hook_webform_update_access

/**
 * Overrides the $node->access() and $account->hasPermission() permission to
 * access and edit webform components, e-mails, conditions, and form settings.
 *
 * Return NULL to defer to other modules. If all implementations defer, then
 * access to the node's EDIT tab plus 'edit webform components' permission
 * determines access. To grant access, return TRUE; to deny access, return
 * FALSE. If more than one implementation return TRUE/FALSE, all must be TRUE
 * to grant access.
 *
 * In this way, access to the EDIT tab of the node may be decoupled from
 * access to the WEBFORM tab. When returning TRUE, consider all aspects of
 * access as this will be the only test. For example, 'return TRUE;' would grant
 * annonymous access to creating webform components, which seldom be desired.
 *
 * @see webform_node_update_access().
 *
 * @param object $node
 *   The Webform node to check access on.
 * @param object $account
 *   The user account to check access on.
 * @return boolean|NULL
 *   TRUE or FALSE if the user can access the webform results, or NULL if
 *   access should be deferred to other implementations of this hook or
 *   $node->access('update') plus
 *   $account->hasPermission('edit webform components').
 */
function hook_webform_update_access($node, $account)
{
    // Allow anyone who can see webform_editable_by_user nodes and who has
    // 'my webform component edit access' permission to see, edit, and delete the
    // webform components, e-mails, conditionals, and form settings.
    if ($node->bundle() == 'webform_editable_by_user') {
        return $node->access('view', $account) && $account->hasPermission('my webform component edit access');
    }
}
开发者ID:Progressable,项目名称:openway8,代码行数:36,代码来源:webform.api.php

示例14: download

 /**
  * Download a wiki file
  *
  * @param   object $course \Components\Courses\Models\Course
  * @return  void
  */
 public function download($course)
 {
     // Get some needed libraries
     if (!$course->access('view')) {
         App::abort(404, Lang::txt('COM_COURSES_NO_COURSE_FOUND'));
         return;
     }
     // Get the scope of the parent page the file is attached to
     $filename = Request::getVar('file', '');
     if (substr(strtolower($filename), 0, strlen('image:')) == 'image:') {
         $filename = substr($filename, strlen('image:'));
     } else {
         if (substr(strtolower($filename), 0, strlen('file:')) == 'file:') {
             $filename = substr($filename, strlen('file:'));
         }
     }
     $filename = urldecode($filename);
     // Get the configured upload path
     $config = Component::params('com_courses');
     $base_path = $this->path($course->get('id'));
     // Does the path start with a slash?
     $filename = DS . ltrim($filename, DS);
     // Does the beginning of the $attachment->path match the config path?
     if (substr($filename, 0, strlen($base_path)) == $base_path) {
         // Yes - this means the full path got saved at some point
     } else {
         // No - append it
         $filename = $base_path . $filename;
     }
     // Add PATH_CORE
     $filename = PATH_APP . $filename;
     // Ensure the file exist
     if (!file_exists($filename)) {
         App::abort(404, Lang::txt('COM_COURSES_FILE_NOT_FOUND') . ' ' . $filename);
         return;
     }
     // Initiate a new content server and serve up the file
     $xserver = new \Hubzero\Content\Server();
     $xserver->filename($filename);
     $xserver->disposition('inline');
     $xserver->acceptranges(false);
     // @TODO fix byte range support
     if (!$xserver->serve()) {
         // Should only get here on error
         App::abort(404, Lang::txt('COM_COURSES_SERVER_ERROR'));
     } else {
         exit;
     }
     return;
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:56,代码来源:asset.php

示例15: onProjectMiniList

 /**
  * Event call to get side content for main project page
  * Will show recent visits and who is online
  *
  * @param   object  $model
  * @return  mixed
  */
 public function onProjectMiniList($model)
 {
     if (!$model->exists() || !$model->access('content')) {
         return false;
     }
     // Get team
     $team = $model->team();
     // Display team visits only on multiple-member projects
     if (count($team) == 1) {
         return false;
     }
     $view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'team', 'name' => 'mini'));
     $view->team = $team;
     $view->model = $model;
     return $view->loadTemplate();
 }
开发者ID:kevinwojo,项目名称:hubzero-cms,代码行数:23,代码来源:team.php


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