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


PHP reason_check_authentication函数代码示例

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


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

示例1: get_user_netid

 function get_user_netid()
 {
     if (!isset($this->user_netid)) {
         $this->user_netid = reason_check_authentication();
     }
     return $this->user_netid;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:7,代码来源:login_link.php

示例2: checkPermissions

 function checkPermissions()
 {
     // first, make sure user is logged in
     $username = reason_check_authentication();
     if (!$username) {
         $this->error("this page requires authentication");
     } else {
         // next, figure out the form id
         $matches = array();
         $res = preg_match("/form_(\\d*)/", $this->table, $matches);
         if (count($matches) != 2) {
             $this->error("invalid table name");
         } else {
             $formId = $matches[1];
             // now that we've got the form id, find out what site it belongs to
             $form = new entity($formId);
             $site = $form->get_owner();
             // and finally, make sure the logged in user has access to the site, and is an admin
             $hasSiteAccess = reason_username_has_access_to_site($username, $site->id());
             // $isAdmin = user_is_a(get_user_id($username), id_of("admin_role"));
             // return $hasSiteAccess && $isAdmin;
             return $hasSiteAccess;
         }
     }
     return false;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:26,代码来源:getFormFile.php

示例3: get_username

 function get_username()
 {
     if ($this->_username === NULL) {
         $this->_username = reason_check_authentication();
     }
     return $this->_username;
 }
开发者ID:natepixel,项目名称:reason_package,代码行数:7,代码来源:asset_access.php

示例4: has_content

 function has_content()
 {
     if (!empty($this->blurbs) && reason_check_authentication()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:8,代码来源:blurbs_if_logged_in.php

示例5: reason_iframe_get_media_work

function reason_iframe_get_media_work()
{
    static $media_work;
    if (isset($media_work)) {
        return $media_work;
    }
    if (!empty($_REQUEST['media_work_id'])) {
        $id = (int) $_REQUEST['media_work_id'];
        if ($id) {
            $media_work = new entity($id);
            if ($media_work->get_value('type') == id_of('av') && ($media_work->get_value('state') == 'Live' || user_can_edit_site(get_user_id(reason_check_authentication()), get_owner_site_id($id)))) {
                return $media_work;
            }
        }
    }
    $media_work = false;
    return $media_work;
}
开发者ID:hunter2814,项目名称:reason_package,代码行数:18,代码来源:media_iframe.php

示例6: user_is_slot_admin

 /**
  * Is the user a valid administrator for registration slots for a given event?
  * @param object $event event entity
  * @return boolean
  */
 function user_is_slot_admin($event)
 {
     if ($event->get_value('contact_username') && $event->get_value('contact_username') == reason_check_authentication()) {
         return true;
     }
     return $this->user_can_inline_edit_event($event->id());
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:12,代码来源:events.php

示例7: user_is_author

		/**
		* Checks to see if the user's id matches the auther of the current item.
		*/ 
		function user_is_author()
		{
			if (isset($this->current_item_id) && ($netid = reason_check_authentication()))
			{
				$item = new entity($this->current_item_id);
				if (reason_is_entity($item, 'news'))
				{
					if ($item->get_value('created_by') == get_user_id($netid))
					{
						return true;
					}
				}
			}
			return false;
		}
开发者ID:natepixel,项目名称:reason_package,代码行数:18,代码来源:module.php

示例8: _email_confirmation

 protected function _email_confirmation($disco, $image_id)
 {
     $netid = reason_check_authentication();
     $tos = $netid;
     if (empty($tos)) {
         $tos = $disco->get_value('email');
     }
     $froms = 'auto-form-process@carleton.edu';
     $replytos = '';
     $subject = 'Media Submission Confirmation';
     $txtbody = 'Your media, "' . $disco->get_value('media_title') . '", was successfully submitted.';
     $htmlbody = '<p>Your media, <strong>' . htmlspecialchars($disco->get_value('media_title')) . '</strong>, was  submitted for processing.';
     if ($netid) {
         $additional = ' An email notification will be sent to you when the media is finished processing.';
         $txtbody .= $additional;
         $htmlbody .= $additional;
     } else {
         $additional = ' You won\'t receive an email notification when processing of your media is complete because you were not logged in when your media was uploaded.';
         $txtbody .= $additional;
         $htmlbody .= $additional;
     }
     $txtbody .= "\n";
     $htmlbody .= '</p>';
     $footer = "Please do not reply to this automatically generated notification message.";
     $footer_divider = "--------------------------------------------------------------------------------------";
     $txtbody .= "\n\n" . $footer_divider . "\n" . $footer . "\n" . $footer_divider;
     $htmlbody .= "<hr/>" . $footer . "<hr/>";
     $mailer = new Email($tos, $froms, $replytos, $subject, $txtbody, $htmlbody);
     $mailer->send();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:media_import.php

示例9: reason_include_once

/**
 * Generate a view of the events on a particular day
 * 
 *
 * @package reason
 * @subpackage scripts
 */
/**
 * include dependencies
 */
include_once 'reason_header.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('classes/calendar.php');
reason_include_once('classes/admin/admin_page.php');
if (!reason_check_authentication()) {
    header('HTTP/1.1 400 Bad Request');
    echo '<html><head><title>Calendar did not work</title><meta name="robots" content="none" /></head><body><h1>Calendar did not work</h1><p>You must be logged in to use this script.</p></body></html>';
} else {
    if (!empty($_REQUEST['date'])) {
        // normalize the date format
        $stamp = strtotime($_REQUEST['date']);
        $date = date('Y-m-d', $stamp);
        // Get and sort the events
        $calendar = new reasonCalendar(array('start_date' => $date, 'end_date' => $date, 'view' => 'daily', 'show_statuses' => array('show', 'tentative', 'cancelled')));
        $calendar->run();
        $events = $calendar->get_all_events();
        usort($events, 'compare_times');
        // Figure out the URL for the borrow action
        parse_str(trim($_REQUEST['params'], '?'), $params);
        $editing_id = $params['id'];
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:calendar_preview.php

示例10: reason_include_once

<?php

/**
 * This script reports on any sites which have more than one root page.
 *
 * @package reason
 * @subpackage scripts
 * @author Nathan White
 */
include_once 'reason_header.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('function_libraries/user_functions.php');
force_secure_if_available();
$current_user = reason_check_authentication();
if (!reason_user_has_privs(get_user_id($current_user), 'db_maintenance')) {
    die('<html><head><title>Reason: Find Extra Root Pages</title></head><body><h1>Sorry.</h1><p>You do not have permission to find extra root pages.</p><p>Only Reason users who have database maintenance privileges may do that.</p></body></html>');
}
?>
<html>
<head>
<title>Reason: Find Extra Root Pages</title>
</head>
<body>
<h1>Find Extra Root Pages</h1>
<?php 
if (empty($_POST['do_it'])) {
    ?>
<form method="post">
<p>When this script is run, it will check your sites and report on those that have more than one root page.</p>
<p>You should edit those sites and delete the extra root page(s) to ensure that your site works properly.</p>
<input type="submit" name="do_it" value="Run the script" />
开发者ID:hunter2814,项目名称:reason_package,代码行数:31,代码来源:find_extra_root_pages.php

示例11: _merge_and_send_pdfs

 /**
  * Merge and send a set of pdfs
  *
  * @access private
  */
 function _merge_and_send_pdfs($pdfs)
 {
     if (!empty($pdfs)) {
         $username = reason_check_authentication();
         if (!$this->_has_access($pdfs, $username)) {
             if (!empty($username)) {
                 $this->_display_403_page();
                 die;
             } else {
                 header('Location: ' . REASON_LOGIN_URL . '?dest_page=' . urlencode(get_current_url()));
                 die;
             }
         }
         $pdf_files = array();
         $titles = array();
         foreach ($pdfs as $pdf) {
             $file_location = reason_get_asset_filesystem_location($pdf);
             $pdf_files[] = $file_location;
             $titles[$file_location] = strip_tags($pdf->get_value('name'));
         }
         include_once CARL_UTIL_INC . 'pdf/pdf_utils.php';
         $merged = carl_merge_pdfs($pdf_files, $titles);
         if (empty($merged)) {
             trigger_error('PDF merge failed');
         } else {
             if (carl_send_pdf($merged, $this->cur_page->get_value('url_fragment') . '.pdf')) {
                 die;
             } else {
                 trigger_error('Unable to send PDF');
             }
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:38,代码来源:assets.php

示例12: process_editor_submission

 function process_editor_submission()
 {
     if (!$this->course->get_value('sourced_id')) {
         $this->course->set_value('org_id', $this->form->get_value('subject'));
         $this->course->set_value('course_number', $this->form->get_value('course_number'));
     }
     $this->course->set_value('list_of_prerequisites', $this->form->get_value('prerequisites'));
     $this->course->set_value('credits', $this->form->get_value('credits'));
     $this->course->set_value('title', $this->form->get_value('title'));
     $this->course->set_value('long_description', $this->form->get_value('description'));
     reason_update_entity($this->course->id(), get_user_id(reason_check_authentication()), $this->course->get_values(), true);
     // Apply title and description changes to selected sections
     if ($sections = $this->course->get_sections()) {
         var_dump($sections);
         foreach ($this->form->get_value('sections') as $id) {
             if (isset($sections[$id])) {
                 $sections[$id]->set_value('title', $this->form->get_value('title'));
                 $sections[$id]->set_value('long_description', $this->form->get_value('description'));
                 reason_update_entity($id, get_user_id(reason_check_authentication()), $sections[$id]->get_values(), true);
             }
         }
     }
     if ($this->form->get_value('display_in_catalog') && !$this->course->owned_or_borrowed_by($this->site_id)) {
         create_relationship($this->site_id, $this->course->id(), get_borrows_relationship_id(id_of('course_template_type')));
     } else {
         if (!$this->form->get_value('display_in_catalog') && $this->course->owned_or_borrowed_by($this->site_id)) {
             delete_borrowed_relationship($this->site_id, $this->course->id(), get_borrows_relationship_id(id_of('course_template_type')));
         }
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:30,代码来源:manage_courses.php

示例13: is_username_member_of_group

 /**
  * Helper function to has_authorization()
  *
  * If username given, will return true or false.
  *
  * If no username given, this will be interpreted as meaning "an anonymous user" and will
  * return true, false, or NULL. In this case, true indicates the group includes anybody; 
  * false indicates that it includes nobody; and NULL indicates that the group includes some
  * people and not others -- identification will be necessary to establish group membership.
  *
  * @access private
  * @param string $user_netID -- username. Use an empty string to determine if anonymous access is permitted
  * @return boolean | NULL true if user is a member of the authorized group, false if they are not, NULL if no username passed and access cannot be determined as a result
  */
 function is_username_member_of_group($user_netID, $assume_netid_is_in_directory = false)
 {
     if ($this->group_has_members()) {
         if (!$this->requires_login()) {
             return true;
         } elseif (empty($user_netID)) {
             return NULL;
         } elseif (array_key_exists($user_netID, $this->permissions)) {
             return $this->permissions[$user_netID];
         } elseif ($this->group->get_value('limit_authorization') == 'true') {
             // build up an LDAP-style query
             $rep = $this->get_group_representation();
             $check_info = $this->add_netid_check_to_representation($user_netID, $rep);
             foreach ($check_info as $dir_array) {
                 if (!empty($dir_array['directory_services'])) {
                     $dir = new directory_service($dir_array['directory_services']);
                 } else {
                     $dir = new directory_service();
                 }
                 $dir->merge_results_off();
                 if (!empty($dir_array['filter']) && $dir->search_by_filter($dir_array['filter'])) {
                     $members = $dir->get_records();
                     if (!empty($members)) {
                         $this->permissions[$user_netID] = true;
                         return true;
                     }
                 }
                 if (!empty($dir_array['group_filter']) && $dir->group_search_by_filter($dir_array['group_filter'])) {
                     $groups = $dir->get_records();
                     if (!empty($groups)) {
                         $this->permissions[$user_netID] = true;
                         return true;
                     }
                 }
             }
             $this->permissions[$user_netID] = false;
             return false;
         } else {
             if ($assume_netid_is_in_directory || reason_check_authentication() == $user_netID) {
                 $this->permissions[$user_netID] = true;
                 return true;
             } else {
                 if (!empty($dir_array['directory_services'])) {
                     $dir = new directory_service($dir_array['directory_services']);
                 } else {
                     $dir = new directory_service();
                 }
                 $dir->search_by_filter('(ds_username=' . ldap_escape($user_netID) . ')');
                 $member = $dir->get_records();
                 if (!empty($member)) {
                     $this->permissions[$user_netID] = true;
                     return true;
                 } else {
                     $this->permissions[$user_netID] = false;
                     return false;
                 }
             }
         }
     } else {
         return false;
     }
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:76,代码来源:group_helper.php

示例14: _email_confirmation

 protected function _email_confirmation($disco, $image_id)
 {
     $tos = reason_check_authentication();
     if (empty($tos)) {
         $tos = $disco->get_value('email');
     }
     $froms = 'auto-form-process@carleton.edu';
     $replytos = '';
     $subject = 'Media Submission Confirmation';
     $txtbody = 'Your media, "' . $disco->get_value('media_title') . '", was successfully submitted.' . "\n";
     $htmlbody = '<p>Your media, <strong>' . htmlspecialchars($disco->get_value('media_title')) . '</strong>, was successfully submitted.</p>';
     $footer = "Please do not reply to this automatically generated notification message.";
     $footer_divider = "--------------------------------------------------------------------------------------";
     $txtbody .= "\n\n" . $footer_divider . "\n" . $footer . "\n" . $footer_divider;
     $htmlbody .= "<hr/>" . $footer . "<hr/>";
     $mailer = new Email($tos, $froms, $replytos, $subject, $txtbody, $htmlbody);
     $mailer->send();
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:18,代码来源:kaltura_import.php

示例15: _get_current_user

 /**
  * Get the user entity for the current user
  * (if they are logged in, if they have a Reason user for them).
  * @return mixed user entity object if there is a logged-in user and if they have a reason user entity; otherwise boolean false
  */
 protected function _get_current_user()
 {
     if (!isset($this->_current_user)) {
         if ($username = reason_check_authentication()) {
             if ($user_id = get_user_id($username)) {
                 $this->_current_user = new entity($user_id);
             } else {
                 $this->_current_user = false;
             }
         } else {
             $this->_current_user = false;
         }
     }
     return $this->_current_user;
 }
开发者ID:hunter2814,项目名称:reason_package,代码行数:20,代码来源:locks.php


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