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


PHP reason_user_has_privs函数代码示例

本文整理汇总了PHP中reason_user_has_privs函数的典型用法代码示例。如果您正苦于以下问题:PHP reason_user_has_privs函数的具体用法?PHP reason_user_has_privs怎么用?PHP reason_user_has_privs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: init

 /**
  * Standard Module init function
  * 
  * @return void
  */
 function init()
 {
     if (!empty($this->admin_page->id)) {
         $this->_event = new entity($this->admin_page->id);
     } else {
         $this->_should_run = false;
         $this->_no_run_msg = 'No event ID provided.';
         return;
     }
     if (!reason_user_has_privs($this->admin_page->user_id, 'add') || !reason_user_has_privs($this->admin_page->user_id, 'edit')) {
         $this->_should_run = false;
         $this->_no_run_msg = 'You do not have the privileges to duplicate an event.';
         return;
     }
     if (empty($this->_event) || !$this->_event->get_values() || $this->_event->get_value('type') != id_of('event_type')) {
         $this->_should_run = false;
         $this->_no_run_msg = 'The item you are trying to split up is not an event.';
         return;
     }
     $owner = $this->_event->get_owner();
     if ($owner->id() != $this->admin_page->site_id) {
         $this->_should_run = false;
         $this->_no_run_msg = 'The event you are trying to split up is not owned by the current site.';
         return;
     }
     $dates = $dates = $this->_get_dates_from_event($this->_event);
     if (count($dates) < 2) {
         $this->_should_run = false;
         $this->_no_run_msg = 'The event you are trying to split up only occurs on one date.';
         return;
     }
     $this->admin_page->title = 'Split Up Event: "' . $this->_event->get_value('name') . '"';
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:38,代码来源:event_split.php

示例2: run

 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
         return;
     }
     if (!empty($this->admin_page->request['error_reporting_state'])) {
         switch ($this->admin_page->request['error_reporting_state']) {
             case 'on':
                 override_developer_status(true);
                 break;
             case 'off':
                 override_developer_status(false);
                 break;
         }
     }
     $status = is_developer();
     echo '<form method="post" action="' . htmlspecialchars(get_current_url()) . '">';
     if ($status) {
         echo '<h3>In-page error reporting is currently ON.</h3>' . "\n";
         echo '<input type="submit" value="Turn Error Reporting Off" /><input type="hidden" name="error_reporting_state" value="off" />';
     } else {
         echo '<h3>In-page error reporting is currently OFF.</h3>' . "\n";
         echo '<input type="submit" value="Turn Error Reporting On" /><input type="hidden" name="error_reporting_state" value="on" />';
     }
     echo '</form>';
     echo '<p>Note: changes made via this form only last for the duration of the current session.</p>';
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:error_visibility.php

示例3: init

 function init()
 {
     if (!empty($this->admin_page->id)) {
         $temp = new entity($this->admin_page->id, false);
         if ($temp->get_value('new') && $temp->get_value('state') == 'Pending' && !$temp->get_value('name') && reason_user_has_privs($this->admin_page->user_id, 'delete_pending')) {
             reason_expunge_entity($this->admin_page->id, $this->admin_page->user_id);
         }
     }
     if (!empty($this->admin_page->request[CM_VAR_PREFIX . 'type_id'])) {
         $old_vars = array();
         foreach ($this->admin_page->request as $key => $val) {
             if (substr($key, 0, strlen(CM_VAR_PREFIX)) == CM_VAR_PREFIX) {
                 $old_vars[substr($key, strlen(CM_VAR_PREFIX))] = $val;
                 $old_vars[$key] = '';
             }
         }
         foreach ($this->admin_page->default_args as $arg) {
             if (!isset($old_vars[$arg])) {
                 $old_vars[$arg] = '';
             }
         }
         $link = $this->admin_page->make_link($old_vars);
     } else {
         $link = $this->admin_page->make_link(array('id' => '', 'site_id' => $this->admin_page->site_id, 'type_id' => $this->admin_page->type_id, 'cur_module' => 'Lister'));
     }
     header('Location: ' . unhtmlentities($link));
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:28,代码来源:cancel.php

示例4: can_upload

function can_upload($session)
{
    if ($session['authenticator']) {
        $auth = $session['authenticator'];
        $reason_session =& get_reason_session();
        $username = $reason_session->get("username");
        if (isset($_REQUEST['user_id']) && !empty($_REQUEST['user_id'])) {
            $username = $reason_session->get('username');
            $param_cleanup_rules = array('user_id' => array('function' => 'turn_into_int', 'extra_args' => array('zero_to_null' => 'true')));
            $cleanRequest = array_merge($_REQUEST, carl_clean_vars($_REQUEST, $param_cleanup_rules));
            $nametag = $cleanRequest['user_id'];
            $id = get_user_id($username);
            if (reason_user_has_privs($id, 'pose_as_other_user')) {
                $user = new Entity($nametag);
                $username = $user->get_value("name");
            }
        }
        if ($auth['file']) {
            require_once $auth['file'];
        }
        $args = array_merge(array($username), $auth['arguments']);
        if (!call_user_func_array($auth['callback'], $args)) {
            return false;
        }
    }
    return true;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:27,代码来源:common.inc.php

示例5: _produce_borrowing_nav

 function _produce_borrowing_nav()
 {
     $ret = '';
     $nes = new entity_selector();
     $nes->add_type(id_of('type'));
     $nes->add_right_relationship($this->admin_page->site_id, relationship_id_of('site_cannot_edit_type'));
     $nes->add_relation('`entity`.`id` = "' . addslashes($this->admin_page->type_id) . '"');
     $nes->set_num(1);
     $nes->limit_tables();
     $nes->limit_fields();
     $ns = $nes->run_one();
     $show_edit = reason_user_has_privs($this->admin_page->user_id, 'edit') && !$this->admin_page->is_second_level() && empty($ns) ? true : false;
     /* $type = new entity($this->admin_page->type_id);
     			$name = $type->get_value('plural_name') ? $type->get_value('plural_name') : $type->get_value('name');
     			if(function_exists('mb_strtolower'))
     				$name = mb_strtolower($name);
     			else
     				$name = strtolower($name); */
     $ret .= '<div class="borrowNav">' . "\n";
     $ret .= '<ul>';
     if ($show_edit) {
         $ret .= '<li><a href="' . $this->admin_page->get_owned_list_link($this->admin_page->type_id) . '"><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/bullet_edit.png" alt="" /> Add &amp; edit</a></li>';
     }
     $ret .= '<li class="current"><strong><img src="' . REASON_HTTP_BASE_PATH . 'silk_icons/car.png" alt="" /> Borrow</strong></li>';
     $ret .= '</ul>' . "\n";
     $ret .= '</div>' . "\n";
     // if(reason_user_has_privs($this->admin_page->user_id,'edit'))
     return $ret;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:29,代码来源:sharing.php

示例6: run

 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo '<p>Sorry; use of this module is restricted.</p>' . "\n";
         return;
     }
     if (!empty($this->admin_page->request['entity_id_test'])) {
         $id = $this->admin_page->request['entity_id_test'];
         settype($id, 'integer');
     }
     if (empty($id)) {
         $id = '';
     }
     echo '<form method="get" action="?"><label for="entity_id_test">Entity ID:</label> <input type="text" name="entity_id_test" id="entity_id_test" value="' . $id . '"/><input type="submit" value="submit" /><input type="hidden" name="cur_module" value="EntityInfo" /></form>';
     if (!empty($id)) {
         $entity = new entity($id);
         if ($entity->get_values()) {
             echo '<div class="EntityInfo">' . "\n";
             $this->show_entity_header($entity);
             $this->show_entity_data($entity);
             $this->show_pages($entity);
             $this->show_borrowing_sites($entity);
             $this->show_entity_relationships($entity);
             echo '</div>' . "\n";
         } else {
             echo '<p>The Reason ID ' . $id . ' does not belong to a real entity. It may have been deleted.</p>';
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:entity_info.php

示例7: init

 function init()
 {
     $this->admin_page->set_show('leftbar', false);
     if (empty($this->admin_page->id)) {
         $this->_not_expungable_reason = 'no_id_provided';
         return false;
     }
     if (!reason_user_has_privs($this->admin_page->user_id, 'expunge')) {
         $this->_not_expungable_reason = 'insufficient_privileges';
         return false;
     }
     $item = new entity($this->admin_page->id);
     $user = new entity($this->admin_page->user_id);
     if (!$item->user_can_edit_field('state', $user)) {
         $this->_not_expungable_reason = 'state_field_locked';
         return false;
     }
     if ($item->get_value('state') != 'Deleted') {
         $this->_not_expungable_reason = 'not_deleted_yet';
         return false;
     }
     $this->expungable = $this->admin_page->is_deletable();
     if ($this->expungable) {
         $this->_set_up_form();
     } else {
         $this->_not_expungable_reason = 'dependencies';
         return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:29,代码来源:expunge.php

示例8: init

 /**
  * Standard Module init function
  *
  * @return void
  */
 function init()
 {
     parent::init();
     if (!reason_user_has_privs($this->admin_page->user_id, 'delete')) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you don\'t have the privileges to delete items on this site.';
     } elseif (empty($this->admin_page->site_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a site before batch deleting items.';
     } elseif (empty($this->admin_page->type_id)) {
         $this->_ok_to_run = false;
         $this->_not_ok_message = 'Sorry; you need to specify a type before batch deleting items.';
     }
     if ($this->_ok_to_run) {
         $this->_type = new entity($this->admin_page->type_id);
         $this->admin_page->title = 'Batch Delete ' . $this->_type->get_value('plural_name');
         $es = new entity_selector($this->admin_page->site_id);
         $es->add_type($this->admin_page->type_id);
         $es->set_sharing('owns');
         $es->set_order('entity.last_modified DESC');
         // pray($this->admin_page->request);
         if (isset($this->admin_page->request['state']) && $this->admin_page->request['state'] == 'pending') {
             $status = 'Pending';
         } else {
             $status = 'Live';
         }
         $this->_items = $es->run_one('', $status);
         foreach (array_keys($this->_items) as $id) {
             if (!$this->admin_page->is_deletable($id)) {
                 unset($this->_items[$id]);
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:39,代码来源:batch_delete.php

示例9: has_access

 function has_access()
 {
     if (!isset($this->_has_access)) {
         $this->_has_access = !empty($this->admin_page->site_id) && reason_user_has_privs($this->admin_page->user_id, 'edit');
     }
     return $this->_has_access;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:clear_cache.php

示例10: do_wysiwygs

 function do_wysiwygs()
 {
     $editor_name = html_editor_name($this->site_info->id());
     $params = html_editor_params($this->site_info->id());
     if (function_exists('reason_user_has_privs') && strpos($editor_name, 'loki') === 0 && ($user_id = get_user_id($this->user_netID))) {
         $params['user_is_admin'] = reason_user_has_privs($user_id, 'edit_html');
     }
     $this->change_element_type('post_content', $editor_name, $params);
     $this->change_element_type('description', $editor_name, $params);
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:10,代码来源:submit_post.php

示例11: run

 /**
  * Lists the sites, the non-live list depending on admin role
  * 
  * @return void
  */
 function run()
 {
     echo '<h2>' . $this->ls_count . ' Live Sites</h2>' . "\n";
     $this->list_minisites($this->live_sites_list);
     /* Non-live sites are listed only if viewed by an admin */
     if (reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo '<h2>' . $this->nls_count . ' Non-Live Sites</h2>' . "\n";
         $this->list_minisites($this->not_live_site_list);
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:15,代码来源:list_sites.php

示例12: _cm_ok_to_run

 function _cm_ok_to_run()
 {
     switch ($this->entity->get_value('state')) {
         case 'Live':
             return reason_user_has_privs($this->admin_page->user_id, 'edit');
         case 'Pending':
             return reason_user_has_privs($this->admin_page->user_id, 'edit_pending');
         default:
             return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:11,代码来源:editor.php

示例13: run

 /**
  * Run form if it is OK
  */
 function run()
 {
     if ($this->site_can_manage_images($this->admin_page->site_id)) {
         if (reason_user_has_privs($this->admin_page->user_id, 'add')) {
             $this->run_form();
         } else {
             echo 'Sorry. You do not have privileges to add images to this site.';
         }
     } else {
         echo '<p>Sorry; this site is not set up to manage images.</p>' . "\n";
     }
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:15,代码来源:image_import.php

示例14: init

 function init()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'borrow')) {
         die('You do not have privileges to borrow or unborrow items');
     }
     $this->set_borrowship_first_level();
     if ($this->admin_page->is_second_level()) {
         $this->add_relationship_second_level();
     }
     $link = unhtmlentities($this->admin_page->make_link(array('cur_module' => 'Sharing', 'id' => '')));
     header('Location: ' . $link);
     die;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:13,代码来源:doBorrow.php

示例15: run

 function run()
 {
     if (!reason_user_has_privs($this->admin_page->user_id, 'view_sensitive_data')) {
         echo 'Sorry; you do not have the rights to view this information.';
         return;
     }
     // get audiences in REason
     $es = new entity_selector();
     $es->add_type(id_of('audience_type'));
     $audiences = $es->run_one();
     $options = array();
     foreach ($audiences as $aud) {
         $options[$aud->get_value('directory_service_value')] = $aud->get_value('name');
     }
     $d = new disco();
     $d->add_element('active_since', 'textdatetime');
     $d->add_element('affiliations', 'checkboxgroup', array('options' => $options));
     $d->set_display_name('affiliations', 'Audiences');
     $d->add_comments('affiliations', form_comment('Leaving these checkboxes blank won\'t filter the results.'));
     $d->set_actions(array('run' => 'Run'));
     $d->run();
     if ($d->get_value('active_since')) {
         $user_ids = $this->_get_active_user_ids($d->get_value('active_since'));
         echo count($user_ids) . ' Reason users modified at least one item since ' . prettify_mysql_datetime($d->get_value('active_since')) . '<br />';
         if ($d->get_value('affiliations')) {
             $affiliations = array_values($d->get_value('affiliations'));
         } else {
             $affiliations = array();
         }
         $users = $this->_get_active_users_from_ids($user_ids, $affiliations);
         echo '<br />' . count($users) . ' of the above users currently have access to at least one site<br />';
         if (!empty($users)) {
             echo '<textarea rows="12">' . "\n";
             $usernames = array();
             foreach ($users as $user) {
                 $usernames[$user->id()] = $user->get_value('name');
             }
             echo implode(', ', $usernames);
             echo '</textarea>' . "\n";
         }
         $emails = $this->_get_email_addresses_from_users($users);
         echo '<br />' . count($emails) . ' of the users with site access have an email addresses in the directory<br />';
         if (!empty($emails)) {
             echo '<textarea rows="12">' . "\n";
             echo implode(', ', $emails);
             echo '</textarea>' . "\n";
         }
     }
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:49,代码来源:active_users.php


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