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


PHP access_get_show_hidden_status函数代码示例

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


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

示例1: event_user_login

/**
 * Called on successful user login
 * If they are not in stormpath lets add them
 * 
 * @param type $event
 * @param type $type
 * @param type $user
 */
function event_user_login($event, $type, $user)
{
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(TRUE);
    if ($user instanceof ElggUser && !$user->isEnabled() && !$user->validated) {
        // send new validation email
        uservalidationbyemail_request_validation($user->getGUID());
        // restore hidden entities settings
        access_show_hidden_entities($access_status);
        // throw error so we get a nice error message
        throw new LoginException(elgg_echo('uservalidationbyemail:login:fail'));
    }
    access_show_hidden_entities($access_status);
    if ($user->__stormpath_user) {
        return true;
    }
    // search stormpath for a matching account
    // may be in stormpath by manual addition, or from another application
    // with shared login
    $application = get_application();
    if ($application) {
        $accts = $application->getAccounts(array('email' => $user->email));
        foreach ($accts as $a) {
            $user->__stormpath_user = $a->href;
            return true;
        }
        $password = get_input('password');
        if ($password) {
            add_to_stormpath($user, $password);
        }
    }
    return true;
}
开发者ID:arckinteractive,项目名称:elgg_stormpath,代码行数:41,代码来源:events.php

示例2: uservalidationbyadmin_register_user_hook

/**
 * Listen to the registration of a new user
 *
 * @param string $hook         the name of the hook
 * @param string $type         the type of the hook
 * @param bool   $return_value the current return value
 * @param array  $params       supplied params
 *
 * @return bool
 */
function uservalidationbyadmin_register_user_hook($hook, $type, $return_value, $params)
{
    if (empty($params) || !is_array($params)) {
        return $return_value;
    }
    $user = elgg_extract("user", $params);
    if (empty($user) || !elgg_instanceof($user, "user")) {
        return $return_value;
    }
    // make sure we can see everything
    $hidden = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    // make sure we can save metadata
    elgg_push_context("uservalidationbyadmin_new_user");
    // this user needs validation
    $user->admin_validated = false;
    // check who to notify
    $notify_admins = uservalidationbyadmin_get_admin_notification_setting();
    if ($notify_admins == "direct") {
        uservalidationbyadmin_notify_admins();
    }
    // check if we need to disable the user
    if ($user->isEnabled()) {
        $user->disable();
    }
    // restore context
    elgg_pop_context();
    // restore access settings
    access_show_hidden_entities($hidden);
    return $return_value;
}
开发者ID:coldtrick,项目名称:uservalidationbyadmin,代码行数:41,代码来源:hooks.php

示例3: uservalidationbyemail_page_handler

/**
 * Get security token, forward to action.
 *
 * @param unknown_type $page
 * @return unknown_type
 */
function uservalidationbyemail_page_handler($page)
{
    global $CONFIG;
    if (isset($page[0]) && $page[0] == 'confirm') {
        $code = sanitise_string(get_input('c', FALSE));
        $user_guid = get_input('u', FALSE);
        // new users are not enabled by default.
        $access_status = access_get_show_hidden_status();
        access_show_hidden_entities(true);
        $user = get_entity($user_guid);
        if ($code && $user) {
            if (uservalidationbyemail_validate_email($user_guid, $code)) {
                system_message(elgg_echo('email:confirm:success'));
                $user = get_entity($user_guid);
                $user->enable();
                notify_user($user_guid, $CONFIG->site->guid, sprintf(elgg_echo('email:validate:success:subject'), $user->username), sprintf(elgg_echo('email:validate:success:body'), $user->name), NULL, 'email');
            } else {
                register_error(elgg_echo('email:confirm:fail'));
            }
        } else {
            register_error(elgg_echo('email:confirm:fail'));
        }
        access_show_hidden_entities($access_status);
    } else {
        register_error(elgg_echo('email:confirm:fail'));
    }
    forward();
}
开发者ID:adamboardman,项目名称:Elgg,代码行数:34,代码来源:start.php

示例4: uservalidationbyadmin_login_event

/**
 * Listen to the login event to make sure the user is validated
 *
 * @param string   $event the name of the event
 * @param string   $type  the type of the event
 * @param ElggUser $user  supplied user
 *
 * @return bool
 */
function uservalidationbyadmin_login_event($event, $type, $user)
{
    $result = false;
    // make sure we can see all users
    $hidden = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    // do we actualy have a user
    if (!empty($user) && elgg_instanceof($user, "user")) {
        // is the user enabled
        if ($user->isEnabled()) {
            if ($user->isAdmin()) {
                // admins are always allowed
                $result = true;
            } elseif (isset($user->admin_validated)) {
                // check if the user is validated
                if ($user->admin_validated) {
                    // user is validated and can login
                    $result = true;
                }
            } else {
                // user has register before this plugin was activated
                $result = true;
            }
        }
    }
    // check if the user can login
    if (empty($result)) {
        // register error
        register_error(elgg_echo("uservalidationbyadmin:login:error"));
    }
    // restore access setting
    access_show_hidden_entities($hidden);
    return $result;
}
开发者ID:coldtrick,项目名称:uservalidationbyadmin,代码行数:43,代码来源:events.php

示例5: pam_handler

/**
 * Can we allow the user with the credentials to log in?
 * Check stormpath, create the user if they can log in and don't exist
 * Enable the user if they can log in but were waiting for email verification
 * 
 * @param type $credentials
 * @return boolean
 */
function pam_handler($credentials)
{
    // try to authenticate first
    $application = get_application();
    $authResult = $application->authenticate($credentials['username'], $credentials['password']);
    $account = $authResult->account;
    if (!$account || strtolower($account->status) != 'enabled') {
        return false;
    }
    // we need to search hidden users too
    // in case of email confirmation disabling
    $show_hidden = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    // we have an account and it's enabled
    // see if we have a matching account here
    // check if logging in with email address
    if (strpos($credentials['username'], '@') !== false) {
        $users = get_user_by_email($credentials['username']);
        $user = $users[0];
    } else {
        $user = get_user_by_username($credentials['username']);
    }
    // custom context gives us permission to do this
    elgg_push_context('stormpath_validate_user');
    // if we don't have a user we need to create one
    if (!$user) {
        $user = new \ElggUser();
        $user->username = preg_replace("/[^a-zA-Z0-9]/", "", $account->username);
        $user->email = $account->email;
        $user->name = $account->fullName;
        $user->access_id = ACCESS_PUBLIC;
        $user->salt = _elgg_generate_password_salt();
        $user->password = generate_user_password($user, $credentials['password']);
        $user->owner_guid = 0;
        // Users aren't owned by anyone, even if they are admin created.
        $user->container_guid = 0;
        // Users aren't contained by anyone, even if they are admin created.
        $user->language = get_current_language();
        $user->save();
        $user->__stormpath_user = $account->href;
        elgg_set_user_validation_status($user->guid, TRUE, 'stormpath');
        // Turn on email notifications by default
        set_user_notification_setting($user->getGUID(), 'email', true);
    }
    // see if we need to enable/verify the user
    if (!$user->isEnabled() && in_array($user->disable_reason, array('stormpath_new_user', 'uservalidationbyemail_new_user'))) {
        $user->enable();
        $user->__stormpath_user = $account->href;
        elgg_set_user_validation_status($user->guid, TRUE, 'stormpath');
    }
    elgg_pop_context();
    access_show_hidden_entities($show_hidden);
    if ($user && $user->isEnabled()) {
        return true;
    }
    return false;
}
开发者ID:arckinteractive,项目名称:elgg_stormpath,代码行数:65,代码来源:start.php

示例6: isAvailableUsername

 public static function isAvailableUsername(\PropertyInterface $prop, $value = null, array $params = array())
 {
     $access_status = access_get_show_hidden_status();
     access_show_hidden_entities(true);
     $available = true;
     if (get_user_by_username($value)) {
         $available = false;
     }
     access_show_hidden_entities($access_status);
     return $available;
 }
开发者ID:hypejunction,项目名称:hypeapps,代码行数:11,代码来源:Validators.php

示例7: customizations_purge_messages

/**
 * Delete messages from a user who is being deleted
 *
 * @param string   $event
 * @param string   $type
 * @param ElggUser $user
 */
function customizations_purge_messages($event, $type, $user)
{
    // make sure we delete them all
    $entity_disable_override = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $messages = elgg_get_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => $user->getGUID(), 'limit' => 0));
    if ($messages) {
        foreach ($messages as $e) {
            $e->delete();
        }
    }
    access_show_hidden_entities($entity_disable_override);
}
开发者ID:elgg,项目名称:community_customizations,代码行数:20,代码来源:start.php

示例8: forms_register_generate_username

/**
 * Generates a unique available and valid username
 *
 * @param string $username Username prefix
 * @return string
 */
function forms_register_generate_username($username = '')
{
    $available = false;
    $username = iconv('UTF-8', 'ASCII//TRANSLIT', $username);
    $blacklist = '/[\\x{0080}-\\x{009f}\\x{00a0}\\x{2000}-\\x{200f}\\x{2028}-\\x{202f}\\x{3000}\\x{e000}-\\x{f8ff}]/u';
    $blacklist2 = array(' ', '\'', '/', '\\', '"', '*', '&', '?', '#', '%', '^', '(', ')', '{', '}', '[', ']', '~', '?', '<', '>', ';', '|', '¬', '`', '@', '-', '+', '=');
    $username = preg_replace($blacklist, '', $username);
    $username = str_replace($blacklist2, '.', $username);
    $ia = elgg_set_ignore_access(true);
    $ha = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $minlength = elgg_get_config('minusername') ?: 4;
    if ($username) {
        $fill = $minlength - strlen($username);
    } else {
        $fill = 8;
    }
    $algo = elgg_get_plugin_setting('autogen_username_algo', 'forms_register', 'first_name_only');
    if ($algo == 'full_name' && $fill <= 0) {
        $separator = '.';
    } else {
        $separator = '';
    }
    if ($fill > 0) {
        $suffix = (new ElggCrypto())->getRandomString($fill);
        $username = "{$username}{$separator}{$suffix}";
    }
    $iterator = 0;
    while (!$available) {
        if ($iterator > 0) {
            $username = "{$username}{$separator}{$iterator}";
        }
        $user = get_user_by_username($username);
        $available = !$user;
        try {
            if ($available) {
                validate_username($username);
            }
        } catch (Exception $e) {
            if ($iterator >= 100) {
                // too many failed attempts
                $username = (new ElggCrypto())->getRandomString(8);
            }
        }
        $iterator++;
    }
    access_show_hidden_entities($ha);
    elgg_set_ignore_access($ia);
    return strtolower($username);
}
开发者ID:hypeJunction,项目名称:Elgg-forms_register,代码行数:56,代码来源:start.php

示例9: ws_pack_get_application_from_id

/**
 * Return application for a given application id
 * 
 * @param string $application_id id of the applications
 * 
 * @return ElggEntity|boolean
 */
function ws_pack_get_application_from_id($application_id)
{
    $result = false;
    if (!empty($application_id)) {
        $hidden = access_get_show_hidden_status();
        access_show_hidden_entities(true);
        $options = array("type" => "object", "subtype" => APIApplication::SUBTYPE, "limit" => 1, "metadata_name_value_pairs" => array("application_id" => $application_id));
        if ($entities = elgg_get_entities_from_metadata($options)) {
            $result = $entities[0];
        }
        access_show_hidden_entities($hidden);
    }
    return $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:21,代码来源:functions.php

示例10: generateUsername

 /**
  * Generates random unique username
  * @return string
  */
 public static function generateUsername()
 {
     $username = false;
     $ia = elgg_set_ignore_access(true);
     $ha = access_get_show_hidden_status();
     access_show_hidden_entities(true);
     while (!$username) {
         $temp = "u" . rand(100000000, 999999999);
         if (!get_user_by_username($temp)) {
             $username = $temp;
         }
     }
     access_show_hidden_entities($ha);
     elgg_set_ignore_access($ia);
     return $username;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:20,代码来源:Registration.php

示例11: dbvalidate_get_incomplete_entities

/**
 * Looks for entities without a corresponding entry in the correct type table.
 */
function dbvalidate_get_incomplete_entities()
{
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $db_prefix = elgg_get_config('dbprefix');
    $types = array('user', 'site', 'group', 'object');
    $bad_guids = array();
    foreach ($types as $type) {
        // thank you for consistent table naming
        $query = "SELECT guid, type, subtype FROM {$db_prefix}entities WHERE type='{$type}'\n\t\t\tAND guid NOT IN (SELECT guid FROM {$db_prefix}{$type}s_entity)";
        if ($result = get_data($query)) {
            $bad_guids = array_merge($bad_guids, $result);
        }
    }
    access_show_hidden_entities($access_status);
    return $bad_guids;
}
开发者ID:beck24,项目名称:elgg-db-cleaner,代码行数:20,代码来源:start.php

示例12: stripe_webhook_handler

/**
 * Handle Stripe webhooks
 */
function stripe_webhook_handler($environment)
{
    $body = get_post_data();
    $event_json = json_decode($body);
    $event_id = $event_json->id;
    $gateway = new StripeClient($environment);
    $event = $gateway->getEvent($event_id);
    if (!$event) {
        return array('success' => false, 'message' => 'Stripe Event for this webhook was not found');
    }
    $ia = elgg_set_ignore_access(true);
    $ha = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $result = elgg_trigger_plugin_hook_handler($event->type, 'stripe.events', array('environment' => $environment, 'event' => $event), array('success' => true));
    access_show_hidden_entities($ha);
    elgg_set_ignore_access($ia);
    return $result;
}
开发者ID:Daltonmedia,项目名称:stripe,代码行数:21,代码来源:start.php

示例13: generateUsername

 static function generateUsername($email)
 {
     list($username, $dummy) = explode("@", $email);
     $username = preg_replace("/[^a-zA-Z0-9]+/", "", $username);
     $hidden = access_get_show_hidden_status();
     access_show_hidden_entities(true);
     if (get_user_by_username($username)) {
         $i = 1;
         while (get_user_by_username($username . $i)) {
             $i++;
         }
         $result = $username . $i;
     } else {
         $result = $username . $i;
     }
     access_show_hidden_entities($hidden);
     return $result;
 }
开发者ID:pleio,项目名称:rijkshuisstijl,代码行数:18,代码来源:Helpers.php

示例14: expirationdate_expire_entities

/**
 * Deletes expired entities.
 * @return boolean
 */
function expirationdate_expire_entities($verbose = true)
{
    $now = time();
    $access = elgg_set_ignore_access(true);
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    if (!($entities = elgg_get_entities_from_metadata(array('metadata_names' => 'expirationdate', 'limit' => false)))) {
        // no entities that need to expire.
        return true;
    }
    foreach ($entities as $entity) {
        if ($entity->expirationdate < $now) {
            $guid = $entity->guid;
            if (!elgg_trigger_plugin_hook('expirationdate:expire_entity', $entity->type, array('entity' => $entity), true)) {
                continue;
            }
            // call the standard delete to allow for triggers, etc.
            if ($entity->expirationdate_disable_only == 1) {
                if ($entity->disable()) {
                    $return = expirationdate_unset($entity->getGUID());
                    $msg = "Disabled {$guid}<br>\n";
                } else {
                    $msg = "Couldn't disable {$guid}<br>\n";
                }
            } else {
                if ($entity->delete()) {
                    $msg = "Deleted {$guid}<br>\n";
                } else {
                    $msg = "Couldn't delete {$guid}<br>\n";
                }
            }
        } else {
            if (!elgg_trigger_plugin_hook('expirationdate:will_expire_entity', $entity->type, array('expirationdate' => $entity->expirationdate, 'entity' => $entity), true)) {
                continue;
            }
        }
        if ($verbose) {
            print $msg;
        }
    }
    access_show_hidden_entities($access_status);
    elgg_set_ignore_access($access);
    return true;
}
开发者ID:iionly,项目名称:expirationdate,代码行数:48,代码来源:start.php

示例15: thewire_tools_upgrade_system_event_handler

/**
 * Listen to the upgrade event to make sure upgrades can be run
 *
 * @param string $event  the name of the event
 * @param string $type   the type of the event
 * @param null   $object nothing
 *
 * @return void
 */
function thewire_tools_upgrade_system_event_handler($event, $type, $object)
{
    // Upgrade also possible hidden entities. This feature get run
    // by an administrator so there's no need to ignore access.
    $access_status = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    // register an upgrade script
    $options = array("type" => "user", "plugin_id" => "thewire_tools", "plugin_user_setting_name" => "notify_mention", "count" => true);
    $count = elgg_get_entities_from_plugin_user_settings($options);
    if ($count) {
        $path = "admin/upgrades/thewire_tools_mentions";
        $upgrade = new ElggUpgrade();
        if (!$upgrade->getUpgradeFromPath($path)) {
            $upgrade->setPath($path);
            $upgrade->title = "TheWire Tools mentions upgrade";
            $upgrade->description = "The way mention notifications are handled has changed. Run this script to make sure all settings are migrated.";
            $upgrade->save();
        }
    }
    access_show_hidden_entities($access_status);
}
开发者ID:Twizanex,项目名称:thewire_tools,代码行数:30,代码来源:events.php


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