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


PHP remove_private_setting函数代码示例

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


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

示例1: subsite_manager_remove_superadmin

function subsite_manager_remove_superadmin($user_guid = 0)
{
    $result = false;
    if (empty($user_guid)) {
        $user_guid = elgg_get_logged_in_user_guid();
    }
    if (!empty($user_guid) && subsite_manager_is_superadmin_logged_in()) {
        if (remove_private_setting($user_guid, "superadmin")) {
            $result = true;
        }
    }
    return $result;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:13,代码来源:functions.php

示例2: translation_editor_actions_hook

function translation_editor_actions_hook($hook, $type, $return, $params)
{
    $allowed_actions = array("admin/plugins/activate", "admin/plugins/deactivate", "admin/plugins/activate_all", "admin/plugins/deactivate_all", "admin/plugins/set_priority", "upgrading");
    if (!empty($type) && in_array($type, $allowed_actions)) {
        // make sure we have all translations
        translation_editor_reload_all_translations();
        if ($languages = get_installed_translations()) {
            foreach ($languages as $key => $desc) {
                remove_private_setting(elgg_get_site_entity()->getGUID(), "te_last_update_" . $key);
            }
        }
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:13,代码来源:hooks.php

示例3: execute_new_password_request

/**
 * Validate and execute a password reset for a user.
 *
 * @param int $user_guid The user id
 * @param string $conf_code Confirmation code as sent in the request email.
 */
function execute_new_password_request($user_guid, $conf_code)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    if ($user && get_private_setting($user_guid, 'passwd_conf_code') == $conf_code) {
        $password = generate_random_cleartext_password();
        if (force_user_password_reset($user_guid, $password)) {
            //remove_metadata($user_guid, 'conf_code');
            remove_private_setting($user_guid, 'passwd_conf_code');
            $email = sprintf(elgg_echo('email:resetpassword:body'), $user->name, $password);
            return notify_user($user->guid, $CONFIG->site->guid, elgg_echo('email:resetpassword:subject'), $email, NULL, 'email');
        }
    }
    return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:22,代码来源:users.php

示例4: elgg_generate_plugin_entities

/**
 * Discovers plugins in the plugins_path setting and creates ElggPlugin
 * entities for them if they don't exist.  If there are plugins with entities
 * but not actual files, will disable the ElggPlugin entities and mark as inactive.
 * The ElggPlugin object holds config data, so don't delete.
 *
 * @todo Crappy name?
 * @return bool
 * @since 1.8.0
 * @access private
 */
function elgg_generate_plugin_entities()
{
    // @todo $site unused, can remove?
    $site = get_config('site');
    $dir = elgg_get_plugins_path();
    $db_prefix = elgg_get_config('dbprefix');
    $options = array('type' => 'object', 'subtype' => 'plugin', 'selects' => array('plugin_oe.*'), 'joins' => array("JOIN {$db_prefix}objects_entity plugin_oe on plugin_oe.guid = e.guid"), 'limit' => ELGG_ENTITIES_NO_VALUE);
    $old_ia = elgg_set_ignore_access(true);
    $old_access = access_get_show_hidden_status();
    access_show_hidden_entities(true);
    $known_plugins = elgg_get_entities_from_relationship($options);
    /* @var ElggPlugin[] $known_plugins */
    if (!$known_plugins) {
        $known_plugins = array();
    }
    // map paths to indexes
    $id_map = array();
    foreach ($known_plugins as $i => $plugin) {
        // if the ID is wrong, delete the plugin because we can never load it.
        $id = $plugin->getID();
        if (!$id) {
            $plugin->delete();
            unset($known_plugins[$i]);
            continue;
        }
        $id_map[$plugin->getID()] = $i;
    }
    $physical_plugins = elgg_get_plugin_ids_in_dir($dir);
    if (!$physical_plugins) {
        return false;
    }
    // check real plugins against known ones
    foreach ($physical_plugins as $plugin_id) {
        // is this already in the db?
        if (array_key_exists($plugin_id, $id_map)) {
            $index = $id_map[$plugin_id];
            $plugin = $known_plugins[$index];
            // was this plugin deleted and its entity disabled?
            if (!$plugin->isEnabled()) {
                $plugin->enable();
                $plugin->deactivate();
                $plugin->setPriority('last');
            }
            // remove from the list of plugins to disable
            unset($known_plugins[$index]);
        } else {
            // add new plugins
            // priority is force to last in save() if not set.
            $plugin = new ElggPlugin($plugin_id);
            $plugin->save();
        }
    }
    // everything remaining in $known_plugins needs to be disabled
    // because they are entities, but their dirs were removed.
    // don't delete the entities because they hold settings.
    foreach ($known_plugins as $plugin) {
        if ($plugin->isActive()) {
            $plugin->deactivate();
        }
        // remove the priority.
        $name = elgg_namespace_plugin_private_setting('internal', 'priority');
        remove_private_setting($plugin->guid, $name);
        $plugin->disable();
    }
    access_show_hidden_entities($old_access);
    elgg_set_ignore_access($old_ia);
    elgg_reindex_plugin_priorities();
    return true;
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:80,代码来源:plugins.php

示例5: unsetUserSetting

 /**
  * Removes a user setting name and value.
  *
  * @param string $name      The user setting name
  * @param int    $user_guid The user GUID
  * @return bool
  */
 public function unsetUserSetting($name, $user_guid = null)
 {
     $user_guid = (int) $user_guid;
     if ($user_guid) {
         $user = get_entity($user_guid);
     } else {
         $user = elgg_get_logged_in_user_entity();
     }
     if (!$user instanceof ElggUser) {
         return false;
     }
     // set the namespaced name.
     $name = elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
     return remove_private_setting($user->guid, $name);
 }
开发者ID:rasul,项目名称:Elgg,代码行数:22,代码来源:ElggPlugin.php

示例6: ElggPlugin

         // add new plugins
         // priority is force to last in save() if not set.
         $plugin = new ElggPlugin($plugin_id);
         $plugin->save();
     }
 }
 // everything remaining in $known_plugins needs to be disabled
 // because they are entities, but their dirs were removed.
 // don't delete the entities because they hold settings.
 foreach ($known_plugins as $plugin) {
     if ($plugin->isActive()) {
         $plugin->deactivate();
     }
     // remove the priority.
     $name = elgg_namespace_plugin_private_setting('internal', 'priority');
     remove_private_setting($plugin->guid, $name);
     $plugin->disable();
 }
 // get old enabled plugins
 $enabled_plugin_options["guids"] = array($subsite->getGUID());
 $old_enabled_plugins = elgg_get_metadata($enabled_plugin_options);
 if (!empty($old_enabled_plugins)) {
     $old_enabled_plugins = metadata_array_to_values($old_enabled_plugins);
     $old_enabled_plugins = array_unique($old_enabled_plugins);
     foreach ($old_enabled_plugins as $plugin_id) {
         if ($plugin = elgg_get_plugin_from_id($plugin_id)) {
             if (!check_entity_relationship($plugin->getGUID(), 'active_plugin', $subsite->getGUID())) {
                 add_entity_relationship($plugin->getGUID(), 'active_plugin', $subsite->getGUID());
             }
         }
     }
开发者ID:pleio,项目名称:subsite_manager,代码行数:31,代码来源:2011010101.php

示例7: get_input

$entity_guid = (int) get_input('entity_guid');
$icons = get_input('icons');
$texts = get_input('texts');
$hrefs = get_input('hrefs');
$targets = get_input('targets');
$entity = get_entity($entity_guid);
if (empty($entity) || !$entity->canEdit()) {
    register_error(elgg_echo('InvalidParameterException:NoEntityFound'));
    forward(REFERER);
}
$new_values = array();
foreach ($hrefs as $index => $href) {
    // check if value matches placeholder text
    if ($texts[$index] == elgg_echo('theme_haarlem_intranet:quick_nav:text')) {
        $texts[$index] = '';
    }
    if ($href == elgg_echo('theme_haarlem_intranet:quick_nav:href')) {
        continue;
    }
    if (empty($href)) {
        continue;
    }
    $new_values[] = array('icon' => $icons[$index], 'text' => $texts[$index], 'href' => $href, 'target' => $targets[$index]);
}
if (empty($new_values)) {
    remove_private_setting($entity_guid, 'quick_nav');
} else {
    set_private_setting($entity_guid, 'quick_nav', json_encode($new_values));
}
system_message(elgg_echo('theme_haarlem_intranet:action:quick_nav:success'));
forward(REFERER);
开发者ID:Twizanex,项目名称:theme_haarlem_intranet,代码行数:31,代码来源:quick_nav.php

示例8: pleio_api_push_gcm_messages

function pleio_api_push_gcm_messages($gcmMessages = array())
{
    if (!sizeof($gcmMessages)) {
        return;
    }
    $apiKey = elgg_get_plugin_setting("gcm_api_key", "pleio_api");
    $url = 'https://android.googleapis.com/gcm/send';
    $headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    foreach ($gcmMessages as $m) {
        //$m ["dry_run"] = true; //TEST SERVER
        $user_guids = $m["user_guids"];
        unset($m["user_guids"]);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($m));
        $result = curl_exec($ch);
        $results = json_decode($result);
        for ($i = 0; $i < sizeof($results->results); $i++) {
            $result = $results->results[$i];
            if (isset($result->error)) {
                switch ($result->error) {
                    case "InvalidRegistration":
                    case "NotRegistered":
                        remove_private_setting($user_guids[$i], "device_token");
                        break;
                }
            } elseif (isset($result->registration_id)) {
                set_private_setting($user_guids[$i], "device_token", $result->registration_id);
            }
        }
    }
    curl_close($ch);
    return true;
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:37,代码来源:helpers.php

示例9: translation_editor_invalidate_site_cache

/**
 * Reset the site timestamp that tracks the merged translation status.
 *
 * This will recreate the translation editor cache
 *
 * @param int $site_guid which site to invalidate (defaults to current site)
 *
 * @return void
 */
function translation_editor_invalidate_site_cache($site_guid = 0)
{
    $site_guid = sanitize_int($site_guid, false);
    // make sure we have all translations
    translation_editor_reload_all_translations();
    $languages = get_installed_translations();
    if (empty($languages) || !is_array($languages)) {
        return;
    }
    $site = elgg_get_site_entity($site_guid);
    if (empty($site)) {
        return;
    }
    foreach ($languages as $key => $desc) {
        remove_private_setting($site->getGUID(), "te_last_update_{$key}");
    }
}
开发者ID:coldtrick,项目名称:translation_editor,代码行数:26,代码来源:functions.php

示例10: execute_new_password_request

/**
 * Validate and execute a password reset for a user.
 *
 * @param int    $user_guid The user id
 * @param string $conf_code Confirmation code as sent in the request email.
 *
 * @return mixed
 */
function execute_new_password_request($user_guid, $conf_code)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    if ($user instanceof ElggUser) {
        $saved_code = $user->getPrivateSetting('passwd_conf_code');
        if ($saved_code && $saved_code == $conf_code) {
            $password = generate_random_cleartext_password();
            if (force_user_password_reset($user_guid, $password)) {
                remove_private_setting($user_guid, 'passwd_conf_code');
                // clean the logins failures
                reset_login_failure_count($user_guid);
                $email = '<div style="color:#333;font-size:16px;">' . elgg_echo('email:resetpassword:body', array($user->name, $password)) . '</div>';
                //return notify_user($user->guid, $CONFIG->site->guid,
                //	elgg_echo('email:resetpassword:subject'), $email, array(), 'email');
                $site_name = elgg_get_site_entity()->name;
                return zhgroups_send_email($site_name, $user->email, elgg_echo('email:resetpassword:subject', array($site_name)), $email);
            }
        }
    }
    return FALSE;
}
开发者ID:pingwangcs,项目名称:51zhaohu,代码行数:31,代码来源:users.php

示例11: executeNewPasswordReset

 /**
  * Validate and change password for a user.
  *
  * @param int    $user_guid The user id
  * @param string $conf_code Confirmation code as sent in the request email.
  * @param string $password  Optional new password, if not randomly generated.
  *
  * @return bool True on success
  */
 function executeNewPasswordReset($user_guid, $conf_code, $password = null)
 {
     $user_guid = (int) $user_guid;
     $user = get_entity($user_guid);
     if ($password === null) {
         $password = generate_random_cleartext_password();
         $reset = true;
     } else {
         $reset = false;
     }
     if (!$user instanceof \ElggUser) {
         return false;
     }
     $saved_code = $user->getPrivateSetting('passwd_conf_code');
     $code_time = (int) $user->getPrivateSetting('passwd_conf_time');
     $codes_match = _elgg_services()->crypto->areEqual($saved_code, $conf_code);
     if (!$saved_code || !$codes_match) {
         return false;
     }
     // Discard for security if it is 24h old
     if (!$code_time || $code_time < time() - 24 * 60 * 60) {
         return false;
     }
     if (!$this->forcePasswordReset($user, $password)) {
         return false;
     }
     remove_private_setting($user_guid, 'passwd_conf_code');
     remove_private_setting($user_guid, 'passwd_conf_time');
     // clean the logins failures
     reset_login_failure_count($user_guid);
     $ns = $reset ? 'resetpassword' : 'changepassword';
     $message = _elgg_services()->translator->translate("email:{$ns}:body", array($user->username, $password), $user->language);
     $subject = _elgg_services()->translator->translate("email:{$ns}:subject", array(), $user->language);
     notify_user($user->guid, elgg_get_site_entity()->guid, $subject, $message, array(), 'email');
     return true;
 }
开发者ID:ibou77,项目名称:elgg,代码行数:45,代码来源:PasswordService.php

示例12: unsetUserSetting

 /**
  * Removes a user setting name and value.
  *
  * @param string $name      The user setting name
  * @param int    $user_guid The user GUID
  * @return bool
  */
 public function unsetUserSetting($name, $user_guid = null)
 {
     $user_guid = (int) $user_guid;
     if ($user_guid) {
         $user = get_entity($user_guid);
     } else {
         $user = elgg_get_logged_in_user_entity();
     }
     if (!$user instanceof ElggUser) {
         return false;
     }
     // set the namespaced name.
     $name = elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
     // Subsite adjustment
     $site = elgg_get_site_entity();
     $alt_name = str_replace(ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":", ELGG_PLUGIN_USER_SETTING_PREFIX . $this->getID() . ":" . $site->getGUID() . ":", $name);
     $main_res = remove_private_setting($user->getGUID(), $name);
     $alt_res = remove_private_setting($user->getGUID(), $alt_name);
     return $main_res || $alt_res;
 }
开发者ID:pleio,项目名称:subsite_manager,代码行数:27,代码来源:SubsitePlugin.php

示例13: execute_new_password_request

/**
 * Validate and change password for a user.
 *
 * @param int    $user_guid The user id
 * @param string $conf_code Confirmation code as sent in the request email.
 * @param string $password  Optional new password, if not randomly generated.
 *
 * @return bool True on success
 */
function execute_new_password_request($user_guid, $conf_code, $password = null)
{
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    if ($password === null) {
        $password = generate_random_cleartext_password();
        $reset = true;
    }
    if (!elgg_instanceof($user, 'user')) {
        return false;
    }
    $saved_code = $user->getPrivateSetting('passwd_conf_code');
    $code_time = (int) $user->getPrivateSetting('passwd_conf_time');
    if (!$saved_code || $saved_code != $conf_code) {
        return false;
    }
    // Discard for security if it is 24h old
    if (!$code_time || $code_time < time() - 24 * 60 * 60) {
        return false;
    }
    if (force_user_password_reset($user_guid, $password)) {
        remove_private_setting($user_guid, 'passwd_conf_code');
        remove_private_setting($user_guid, 'passwd_conf_time');
        // clean the logins failures
        reset_login_failure_count($user_guid);
        $ns = $reset ? 'resetpassword' : 'changepassword';
        notify_user($user->guid, elgg_get_site_entity()->guid, elgg_echo("email:{$ns}:subject", array(), $user->language), elgg_echo("email:{$ns}:body", array($user->username, $password), $user->language), array(), 'email');
        return true;
    }
    return false;
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:40,代码来源:users.php

示例14: unsetUserSetting

 /**
  * Removes a user setting name and value.
  *
  * @param string $name      The user setting name
  * @param int    $user_guid The user GUID
  * @return bool
  */
 public function unsetUserSetting($name, $user_guid = 0)
 {
     $user_guid = (int) $user_guid;
     if ($user_guid) {
         $user = get_entity($user_guid);
     } else {
         $user = _elgg_services()->session->getLoggedInUser();
     }
     if (!$user instanceof \ElggUser) {
         return false;
     }
     // set the namespaced name.
     $name = _elgg_namespace_plugin_private_setting('user_setting', $name, $this->getID());
     return remove_private_setting($user->guid, $name);
 }
开发者ID:bhargavgarlapati,项目名称:Elgg,代码行数:22,代码来源:ElggPlugin.php

示例15: execute_new_password_request

/**
 * Validate and execute a password reset for a user.
 *
 * @param int    $user_guid The user id
 * @param string $conf_code Confirmation code as sent in the request email.
 *
 * @return mixed
 */
function execute_new_password_request($user_guid, $conf_code)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    if ($user) {
        $saved_code = $user->getPrivateSetting('passwd_conf_code');
        if ($saved_code && $saved_code == $conf_code) {
            $password = generate_random_cleartext_password();
            if (force_user_password_reset($user_guid, $password)) {
                remove_private_setting($user_guid, 'passwd_conf_code');
                // clean the logins failures
                reset_login_failure_count($user_guid);
                $email = elgg_echo('email:resetpassword:body', array($user->name, $password));
                return notify_user($user->guid, $CONFIG->site->guid, elgg_echo('email:resetpassword:subject'), $email, NULL, 'email');
            }
        }
    }
    return FALSE;
}
开发者ID:riggo,项目名称:Elgg,代码行数:28,代码来源:users.php


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