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


PHP access_show_hidden_entities函数代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: clean_unvalidate

/**
 * Clean unvalidated users cron hook
 */
function clean_unvalidate($vars)
{
    $days_till_first_reminder = elgg_get_plugin_setting("validation_reminder_first_message") * 1;
    $days_till_second_reminder = elgg_get_plugin_setting("validation_reminder_second_message") * 1;
    $days_till_removal = elgg_get_plugin_setting("validation_reminder_remove") * 1;
    $proviousAccessShowHiddenEntities = access_show_hidden_entities(true);
    $proviousIgnoreAccess = elgg_set_ignore_access(true);
    $dbprefix = elgg_get_config('dbprefix');
    // @var $users ElggUser[]
    $users = elgg_get_entities_from_metadata(['type' => 'user', 'limit' => false, 'metadata_name_value_pair' => array(array('name' => 'validated', 'value' => false))]);
    foreach ($users as $user) {
        $validate_reminder_start_date = $user->time_created;
        if (time() - $validate_reminder_start_date >= $days_till_removal * 24 * 60 * 60) {
            $user->delete();
            echo 'Account deleted';
        } else {
            if (time() - $validate_reminder_start_date >= $days_till_second_reminder * 24 * 60 * 60 && time() - $validate_reminder_start_date <= ($days_till_second_reminder + 1) * 24 * 60 * 60) {
                send_validation_reminder_mail($user, $days_till_removal, $days_till_second_reminder);
                echo 'Send second reminder send';
            } else {
                if (time() - $validate_reminder_start_date >= $days_till_first_reminder * 24 * 60 * 60 && time() - $validate_reminder_start_date <= ($days_till_first_reminder + 1) * 24 * 60 * 60) {
                    send_validation_reminder_mail($user, $days_till_removal, $days_till_first_reminder);
                    echo 'Send first reminder send';
                } else {
                    echo 'Waiting for validation';
                }
            }
        }
        echo ' for user: ' . $user->getGUID() . PHP_EOL . '<br>';
    }
    elgg_set_ignore_access($proviousIgnoreAccess);
    access_show_hidden_entities($proviousAccessShowHiddenEntities);
}
开发者ID:centillien,项目名称:validation_reminder,代码行数:36,代码来源:start.php

示例6: getPhase

 /**
  * Return the phase of the answer
  *
  * @return QeustionsWorkflowPhase| workflow phase
  */
 public function getPhase()
 {
     access_show_hidden_entities(true);
     if ($this->phase_guid) {
         $phase = get_entity($this->phase_guid);
     }
     access_show_hidden_entities(false);
     return $phase;
 }
开发者ID:Pleio,项目名称:questions,代码行数:14,代码来源:ElggIntAnswer.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: testElggEnableAnnotations

 public function testElggEnableAnnotations()
 {
     $e = new ElggObject();
     $e->save();
     for ($i = 0; $i < 30; $i++) {
         $e->annotate('test_annotation', rand(0, 10000));
     }
     $options = array('guid' => $e->getGUID(), 'limit' => 0);
     $this->assertTrue(elgg_disable_annotations($options));
     // cannot see any annotations so returns null
     $this->assertNull(elgg_enable_annotations($options));
     access_show_hidden_entities(true);
     $this->assertTrue(elgg_enable_annotations($options));
     access_show_hidden_entities(false);
     $annotations = elgg_get_annotations($options);
     $this->assertIdentical(30, count($annotations));
     $this->assertTrue($e->delete());
 }
开发者ID:elainenaomi,项目名称:labxp2014,代码行数:18,代码来源:annotations.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: 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

示例15: 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


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