本文整理汇总了PHP中reason_require_authentication函数的典型用法代码示例。如果您正苦于以下问题:PHP reason_require_authentication函数的具体用法?PHP reason_require_authentication怎么用?PHP reason_require_authentication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reason_require_authentication函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_error_checks
function run_error_checks()
{
$name = trim($this->display_name);
if (empty($name)) {
$name = $this->name;
}
$name = prettify_string($name);
$username = reason_require_authentication();
$password = $this->grab_value();
$dir = new directory_service();
if (!$dir->authenticate($username, $password)) {
$this->set_error($name . ': Please check your password.');
}
}
示例2: authenticate
/**
* Ensure that the user is an admin with access to the master admin site.
*/
function authenticate()
{
if (!isset($this->authenticated)) {
if (!empty($this->admin_page->user_id)) {
$user_id = $this->admin_page->user_id;
$user = new entity($user_id);
$user_netid = $user->get_value('name');
} else {
$user_netid = reason_require_authentication();
$user_id = get_user_id($user_netid);
}
if (reason_user_has_privs($user_id, 'manage_allowable_relationships')) {
$user_man = new User();
$this->authenticated = $user_man->is_site_user($user_netid, id_of('master_admin'));
}
}
return $this->authenticated;
}
示例3: date_create
{
$date_2 = date_create($date_2);
$temp = date_create($date_1);
$count = 0;
while ($temp < $date_2 && $count < 500) {
$temp->modify('+1 day');
$count++;
}
return $count;
}
}
// Checks for user, requires authentication for non-cli users.
if (PHP_SAPI == 'cli') {
$user = 'causal_agent';
} else {
$user = reason_require_authentication();
$reason_user_id = get_user_id($user);
if (!reason_user_has_privs($reason_user_id, 'db_maintenance')) {
die('Access denied.' . "\n");
}
}
// Creates a list of the publications with reminder_days set above 0.
$es = new entity_selector();
$es->add_type(id_of('publication_type'));
$es->add_relation('`reminder_days` > 0');
$publications = $es->run_one();
// For each publication, make sure the site owning it is live, then create a reminder, set pulication for that reminder, and run the remind function.
foreach ($publications as $pub_id => $pub) {
$sites = $pub->get_right_relationship('site_owns_publication_type');
$to_show = false;
foreach ($sites as $index => $site) {
示例4: get_user_id
function get_user_id()
{
static $user_id;
if (!isset($user_id)) {
$user_netid = reason_require_authentication();
$user_id = get_user_id($user_netid);
}
return $user_id;
}
示例5: authenticate
/**
* Sets up the authenticated_user_id class variable
* @return authenticated_user_id
*/
function authenticate()
{
if ($this->authenticated_user_id == false) {
$user_netid = reason_require_authentication();
$this->authenticated_user_id = empty($user_netid) ? false : get_user_id($user_netid);
}
return $this->authenticated_user_id;
}
示例6: reason_include_once
*
* This script will change the name of the event.repeat field to
* event.recurrence so that Reason can be run under MySQL 5.x
*
* @package reason
* @subpackage scripts
*/
/**
* include dependencies
*/
include_once 'reason_header.php';
include_once CARL_UTIL_INC . '/db/db.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('function_libraries/user_functions.php');
connectDB(REASON_DB);
$current_user = reason_require_authentication();
$cur_user_id = get_user_id($current_user);
if (empty($cur_user_id)) {
die('valid Reason user required');
}
if (!reason_user_has_privs($cur_user_id, 'upgrade')) {
die('You must have upgrade privileges to run this script');
}
$es = new entity_selector();
$es->add_type(id_of('content_table'));
$es->add_relation('entity.name = "event"');
$es->set_num(1);
$tables = $es->run_one();
if (empty($tables)) {
$msg = 'Not able to find event entity table. Not able to proceed.';
echo $msg;
示例7: get_user_netid
/**
*
*/
function get_user_netid()
{
if (!isset($this->_user_netid)) {
$netid = reason_require_authentication();
$requested_netid = THIS_IS_A_DEVELOPMENT_REASON_INSTANCE && isset($_REQUEST['netid']) ? $_REQUEST['netid'] : '';
if (!empty($requested_netid) && !empty($netid) && $requested_netid != $netid) {
$user_id = get_user_id($netid);
if (reason_user_has_privs($user_id, 'pose_as_other_user')) {
$this->_user_netid = $requested_netid;
}
} else {
$this->_user_netid = $netid;
}
}
return $this->_user_netid;
}
示例8: init
function init($table_id = false, $table_name = false)
{
if ($table_id) $this->set_table_id($table_id);
if ($table_name) $this->set_table_name($table_name);
$this->user_id = get_user_id(reason_require_authentication());
}
示例9: _check_force_login_parameter
/**
* The old form module supported a force_login parameter - we will continue to support it though really the models
* are probably a better place to force login.
*
* @access private
*/
function _check_force_login_parameter()
{
if ($this->params['force_login']) {
reason_require_authentication('form_login_msg');
}
}
示例10: access_allowed
/**
* determines whether or not authentication is necessary for a particular asset
* and whether the current user is a member of the group that has access
* @return boolean true if the user has access
*/
function access_allowed()
{
$es = new entity_selector();
$es->add_right_relationship($this->asset->id(), relationship_id_of('asset_access_permissions_to_group'));
$es->add_type(id_of('group_type'));
$es->set_num(1);
$groups = $es->run_one();
if (empty($groups)) {
return true;
}
$group = current($groups);
$gh = new group_helper();
$gh->set_group_by_entity($group);
$access = $gh->is_username_member_of_group("") ? true : $gh->is_username_member_of_group($this->get_username());
// else discover and check username
if ($access === NULL) {
reason_require_authentication('login_to_access_file');
die;
}
return $access;
// true or false
}
示例11: set_user_requested_admin
function set_user_requested_admin($boolean)
{
if ($boolean == true)
{
if ($this->admin_requires_login()) reason_require_authentication();
}
$this->_user_requested_admin = $boolean;
}
示例12: getmicrotime
* @todo remove fallback check to DISABLE_REASON_LOGIN by the release of RC 1
*/
//xdebug_start_trace();
//xdebug_start_profiling();
function getmicrotime()
{
list($usec, $sec) = explode(" ", microtime());
return (double) $usec + (double) $sec;
}
$_page_timing_start = getmicrotime();
// admin site needs sessioning
// $reason_session = true;
include_once 'reason_header.php';
reason_include_once('function_libraries/user_functions.php');
force_secure_if_available();
$authenticated_user_netid = reason_require_authentication('admin_login');
$auth_user_id = get_user_id($authenticated_user_netid);
if ($auth_user_id && isset($_GET['do']) && ($_GET['do'] === 'moveup' || $_GET['do'] === 'movedown')) {
if (reason_user_has_privs($auth_user_id, 'pose_as_other_user')) {
if (!empty($_GET['user_id'])) {
$user_id = (int) $_GET['user_id'];
if (!empty($user_id)) {
$e = new entity($user_id);
if ($e->get_value('type') == id_of('user')) {
$user_netid = $e->get_value('name');
}
}
}
}
$user_netid = isset($user_netid) ? $user_netid : $authenticated_user_netid;
reason_include_once('classes/admin/rel_sort.php');
示例13: reason_include_once
* -- Updated 5/20/09 integration with table admin, report on #s, reduced false positives, uses entity selector API
*
* @author Nathan White
* @package reason
* @subpackage scripts
*/
/**
* include dependencies
*/
include_once 'reason_header.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('function_libraries/user_functions.php');
reason_include_once('minisite_templates/page_types.php');
reason_include_once('classes/page_types.php');
include_once CARL_UTIL_INC . 'db/table_admin.php';
if (reason_require_authentication() && !reason_check_privs('view_sensitive_data')) {
die('<h1>Sorry.</h1><p>You do not have permission to view page types.</p></body></html>');
}
echo '<!DOCTYPE html>' . "\n";
echo '<html xmlns="http://www.w3.org/1999/xhtml">' . "\n";
echo '<head>' . "\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . "\n";
echo '<title>Reason Page Types</title>' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . REASON_HTTP_BASE_PATH . 'css/forms/form_data.css" />' . "\n";
echo '</head>' . "\n";
echo '<body>' . "\n";
echo '<h2>Page Type Information</h2>';
echo '<p>This table shows information about each page type defined in the Reason instance. For each page type that is assigned to a live page,
a random url is generated. This module can help you verify that page types are working properly, or to identify page types that are
not being used and should perhaps be deleted.</p>';
$es = new entity_selector();
示例14: reason_include_once
include_once CARL_UTIL_INC . '/db/db.php';
reason_include_once('classes/entity_selector.php');
reason_include_once('function_libraries/user_functions.php');
connectDB(REASON_DB);
/**
* 9/1/2006
*
* this script updates a reason 4 database for relationship sorting (if needed) and sets up relationship sorting for a particular allowable relationship
*
* specifically, it does the following
* - changes the name of the sort_order column in the relationship table to rel_sort_order (if this hasn't been done)
* - establishes an initial relationship sort order two related types
* - makes the relationship sortable in the allowable relationships table
* @author nathan white
*/
$current_user = $user_netID = reason_require_authentication();
$reason_user_id = get_user_id($user_netID);
if (empty($reason_user_id)) {
die('valid Reason user required');
}
if (!reason_user_has_privs($reason_user_id, 'upgrade')) {
die('You must have upgrade privileges to run this script');
}
ini_set('max_execution_time', 1800);
ini_set('mysql_connect_timeout', 1200);
ini_set("memory_limit", "256M");
//////////////////////////////////////////////
//////////////// CONFIGURATION ///////////////
//////////////////////////////////////////////
$test_mode = false;
// switch to true to actually make database changes
示例15: form_id_is_valid
/**
* Does the following:
*
* If a form_id has been provided, return true if the user has access to it.
*
* @todo how are forms that do not require login handled?
*/
function form_id_is_valid($form_id)
{
$user_netid = $this->get_user_netid();
if ($form_id && $user_netid) // only attempt retrieval if user is logged in!
{
$qry = $this->get_select_by_key_sql($form_id, 'id');
$result = $this->perform_query($qry);
return true;
}
elseif ($form_id && !$user_netid && $this->is_editable()) reason_require_authentication();
elseif ($form_id == "0") // a form_id of 0 is valid if the user is allowed to create new entries
{
if ($this->form_allows_multiple()) return true;
}
return false;
// consider redirect cases
$user_netid = $this->get_user_netid();
$user_submissions = (!empty($user_netid)) ? $this->get_values_for_user($user_netid) : false;
// redirect case 1 - user logged in, editable form, multiples not allowed, valid row exists
if ($this->is_editable() && !$this->form_allows_multiple() && !empty($user_submissions))
{
$redirect_form_id = max(array_keys($user_submissions)); // highest id in the user submissions array
}
elseif ($form_id) // we have a form id but it was invalid
{
$redirect_form_id = '';
}
if (isset($redirect_form_id))
{
$redirect = carl_make_redirect(array('form_id' => $redirect_form_id));
header("Location: " . $redirect);
exit;
}
}