• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP generate_users_info_cache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: login

 public function login()
 {
     global $db_type, $lang_login;
     $form_username = feather_trim($this->request->post('req_username'));
     $form_password = feather_trim($this->request->post('req_password'));
     $save_pass = $this->request->post('save_pass');
     $user = DB::for_table('users')->where('username', $form_username)->find_one();
     $authorized = false;
     if (!empty($user->password)) {
         $form_password_hash = feather_hash($form_password);
         // Will result in a SHA-1 hash
         // If the length isn't 40 then the password isn't using sha1, so it must be md5 from 1.2
         // Maybe this should be removed
         if (strlen($user->password) != 40) {
             if (md5($form_password) == $user->password) {
                 $authorized = true;
                 DB::for_table('users')->where('id', $user->id)->find_one()->set('password', $form_password_hash)->save();
             }
         } else {
             $authorized = $user->password == $form_password_hash;
         }
     }
     if (!$authorized) {
         message($lang_login['Wrong user/pass'] . ' <a href="' . get_link('login/action/forget/') . '">' . $lang_login['Forgotten pass'] . '</a>');
     }
     // Update the status if this is the first time the user logged in
     if ($user->group_id == FEATHER_UNVERIFIED) {
         DB::for_table('users')->where('id', $user->id)->find_one()->set('group_id', $this->config['o_default_user_group'])->save();
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
     }
     // Remove this user's guest entry from the online list
     DB::for_table('online')->where('ident', get_remote_address())->delete_many();
     $expire = $save_pass == '1' ? time() + 1209600 : time() + $this->config['o_timeout_visit'];
     feather_setcookie($user->id, $form_password_hash, $expire);
     // Reset tracked topics
     set_tracked_topics(null);
     // Try to determine if the data in redirect_url is valid (if not, we redirect to index.php after login)
     $redirect_url = validate_redirect($this->request->post('redirect_url'), get_base_url());
     redirect(feather_escape($redirect_url), $lang_login['Login redirect']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:44,代码来源:login.php


示例2: panther_hash

        $initial_group_id = $random_pass == 0 ? $panther_config['o_default_user_group'] : PANTHER_UNVERIFIED;
        $password_hash = panther_hash($password1 . $password_salt);
        // Add the user
        $insert = array('username' => $username, 'group_id' => $initial_group_id, 'password' => $password_hash, 'salt' => $password_salt, 'email' => $email, 'email_setting' => $panther_config['o_default_email_setting'], 'timezone' => $panther_config['o_default_timezone'], 'dst' => $panther_config['o_default_dst'], 'language' => $panther_config['o_default_lang'], 'style' => $panther_config['o_default_style'], 'registered' => $now, 'registration_ip' => get_remote_address(), 'last_visit' => $now);
        $db->insert('users', $insert);
        $new_uid = $db->lastInsertId($db->prefix . 'users');
        if ($random_pass == '1') {
            $info = array('subject' => array('<board_title>' => $panther_config['o_board_title']), 'message' => array('<base_url>' => get_base_url(), '<username>' => $username, '<password>' => $password1, '<login_url>' => panther_link($panther_url['login'])));
            $mail_tpl = $mailer->parse(PANTHER_ROOT . 'lang/' . $panther_user['language'] . '/mail_templates/welcome.tpl', $info);
            $mailer->send($email, $mail_tpl['subject'], $mail_tpl['message']);
        }
        // Regenerate the users info cache
        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
            require PANTHER_ROOT . 'include/cache.php';
        }
        generate_users_info_cache();
        redirect(panther_link($panther_url['admin_maintenance']), $lang_admin_maintenance['User created message']);
    }
}
// Get the first post ID from the db
$ps = $db->select('posts', 'id', array(), '', 'id ASC LIMIT 1');
$first_id = $ps->rowCount() ? $ps->fetchColumn() : 0;
$page_title = array($panther_config['o_board_title'], $lang_admin_common['Admin'], $lang_admin_common['Maintenance']);
define('PANTHER_ACTIVE_PAGE', 'admin');
require PANTHER_ROOT . 'header.php';
$options = array();
$ps = $db->run('SELECT u.id, u.username, g.g_title FROM ' . $db->prefix . 'users AS u INNER JOIN ' . $db->prefix . 'groups AS g ON u.group_id=g.g_id WHERE u.id!=1 ORDER BY u.id ASC');
foreach ($ps as $result) {
    $options[] = array('id' => $result['id'], 'username' => $result['username'], 'group_title' => $result['g_title']);
}
$forums = $catgeories = array();
开发者ID:mtechnik,项目名称:pantherforum,代码行数:31,代码来源:maintenance.php


示例3: insert_user

 public function insert_user($user)
 {
     global $lang_register;
     // Insert the new user into the database. We do this now to get the last inserted ID for later use
     $now = time();
     $intial_group_id = $this->config['o_regs_verify'] == '0' ? $this->config['o_default_user_group'] : FEATHER_UNVERIFIED;
     $password_hash = feather_hash($user['password1']);
     // Add the user
     $insert_user = array('username' => $user['username'], 'group_id' => $intial_group_id, 'password' => $password_hash, 'email' => $user['email1'], 'email_setting' => $this->config['o_default_email_setting'], 'timezone' => $this->config['o_default_timezone'], 'dst' => 0, 'language' => $user['language'], 'style' => $this->config['o_default_style'], 'registered' => $now, 'registration_ip' => get_remote_address(), 'last_visit' => $now);
     DB::for_table('users')->create()->set($insert_user)->save();
     $new_uid = DB::get_db()->lastInsertId($this->feather->prefix . 'users');
     if ($this->config['o_regs_verify'] == '0') {
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
     }
     // If the mailing list isn't empty, we may need to send out some alerts
     if ($this->config['o_mailing_list'] != '') {
         // If we previously found out that the email was banned
         if (isset($user['banned_email'])) {
             // Load the "banned email register" template
             $mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/banned_email_register.tpl'));
             // The first row contains the subject
             $first_crlf = strpos($mail_tpl, "\n");
             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
             $mail_message = trim(substr($mail_tpl, $first_crlf));
             $mail_message = str_replace('<username>', $user['username'], $mail_message);
             $mail_message = str_replace('<email>', $user['email1'], $mail_message);
             $mail_message = str_replace('<profile_url>', get_link('user/' . $new_uid . '/'), $mail_message);
             $mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
             pun_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
         }
         // If we previously found out that the email was a dupe
         if (!empty($dupe_list)) {
             // Load the "dupe email register" template
             $mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/dupe_email_register.tpl'));
             // The first row contains the subject
             $first_crlf = strpos($mail_tpl, "\n");
             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
             $mail_message = trim(substr($mail_tpl, $first_crlf));
             $mail_message = str_replace('<username>', $user['username'], $mail_message);
             $mail_message = str_replace('<dupe_list>', implode(', ', $dupe_list), $mail_message);
             $mail_message = str_replace('<profile_url>', get_link('user/' . $new_uid . '/'), $mail_message);
             $mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
             pun_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
         }
         // Should we alert people on the admin mailing list that a new user has registered?
         if ($this->config['o_regs_report'] == '1') {
             // Load the "new user" template
             $mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/new_user.tpl'));
             // The first row contains the subject
             $first_crlf = strpos($mail_tpl, "\n");
             $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
             $mail_message = trim(substr($mail_tpl, $first_crlf));
             $mail_message = str_replace('<username>', $user['username'], $mail_message);
             $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
             $mail_message = str_replace('<profile_url>', get_link('user/' . $new_uid . '/'), $mail_message);
             $mail_message = str_replace('<admin_url>', get_link('user/' . $new_uid . '/section/admin/'), $mail_message);
             $mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
             pun_mail($this->config['o_mailing_list'], $mail_subject, $mail_message);
         }
     }
     // Must the user verify the registration or do we log him/her in right now?
     if ($this->config['o_regs_verify'] == '1') {
         // Load the "welcome" template
         $mail_tpl = trim(file_get_contents(FEATHER_ROOT . 'lang/' . $this->user->language . '/mail_templates/welcome.tpl'));
         // The first row contains the subject
         $first_crlf = strpos($mail_tpl, "\n");
         $mail_subject = trim(substr($mail_tpl, 8, $first_crlf - 8));
         $mail_message = trim(substr($mail_tpl, $first_crlf));
         $mail_subject = str_replace('<board_title>', $this->config['o_board_title'], $mail_subject);
         $mail_message = str_replace('<base_url>', get_base_url() . '/', $mail_message);
         $mail_message = str_replace('<username>', $user['username'], $mail_message);
         $mail_message = str_replace('<password>', $user['password1'], $mail_message);
         $mail_message = str_replace('<login_url>', get_link('login/'), $mail_message);
         $mail_message = str_replace('<board_mailer>', $this->config['o_board_title'], $mail_message);
         pun_mail($user['email1'], $mail_subject, $mail_message);
         message($lang_register['Reg email'] . ' <a href="mailto:' . feather_escape($this->config['o_admin_email']) . '">' . feather_escape($this->config['o_admin_email']) . '</a>.', true);
     }
     feather_setcookie($new_uid, $password_hash, time() + $this->config['o_timeout_visit']);
     redirect(get_base_url(), $lang_register['Reg complete']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:84,代码来源:register.php


示例4: generate_cache

 /**
  * Regenerate FluxBB cache after conversion
  */
 function generate_cache()
 {
     // Load the cache script
     require_once PUN_ROOT . 'include/cache.php';
     // Generate cache
     generate_config_cache();
     generate_bans_cache();
     generate_quickjump_cache();
     generate_censoring_cache();
     generate_users_info_cache();
     clear_feed_cache();
 }
开发者ID:kichawa,项目名称:converter,代码行数:15,代码来源:converter.class.php


示例5: delete_users

 public function delete_users()
 {
     global $lang_admin_users;
     if ($this->request->post('users')) {
         $user_ids = is_array($this->request->post('users')) ? array_keys($this->request->post('users')) : explode(',', $this->request->post('users'));
         $user_ids = array_map('intval', $user_ids);
         // Delete invalid IDs
         $user_ids = array_diff($user_ids, array(0, 1));
     } else {
         $user_ids = array();
     }
     if (empty($user_ids)) {
         message($lang_admin_users['No users selected']);
     }
     // Are we trying to delete any admins?
     $is_admin = DB::for_table('users')->where_in('id', $user_ids)->where('group_id', FEATHER_ADMIN)->find_one();
     if ($is_admin) {
         message($lang_admin_users['No delete admins message']);
     }
     if ($this->request->post('delete_users_comply')) {
         // Fetch user groups
         $user_groups = array();
         $select_fetch_user_groups = array('id', 'group_id');
         $result = DB::for_table('users')->select_many($select_fetch_user_groups)->where_in('id', $user_ids)->find_many();
         foreach ($result as $cur_user) {
             if (!isset($user_groups[$cur_user['group_id']])) {
                 $user_groups[$cur_user['group_id']] = array();
             }
             $user_groups[$cur_user['group_id']][] = $cur_user['id'];
         }
         // Are any users moderators?
         $group_ids = array_keys($user_groups);
         $select_fetch_user_mods = array('g_id', 'g_moderator');
         $result = DB::for_table('groups')->select_many($select_fetch_user_mods)->where_in('g_id', $group_ids)->find_many();
         foreach ($result as $cur_group) {
             if ($cur_group['g_moderator'] == '0') {
                 unset($user_groups[$cur_group['g_id']]);
             }
         }
         // Fetch forum list and clean up their moderator list
         $select_mods = array('id', 'moderators');
         $result = DB::for_table('forums')->select_many($select_mods)->find_many();
         foreach ($result as $cur_forum) {
             $cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
             foreach ($user_groups as $group_users) {
                 $cur_moderators = array_diff($cur_moderators, $group_users);
             }
             if (!empty($cur_moderators)) {
                 DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set('moderators', serialize($cur_moderators))->save();
             } else {
                 DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set_expr('moderators', 'NULL')->save();
             }
         }
         // Delete any subscriptions
         DB::for_table('topic_subscriptions')->where_in('user_id', $user_ids)->delete_many();
         DB::for_table('forum_subscriptions')->where_in('user_id', $user_ids)->delete_many();
         // Remove them from the online list (if they happen to be logged in)
         DB::for_table('online')->where_in('user_id', $user_ids)->delete_many();
         // Should we delete all posts made by these users?
         if ($this->request->post('delete_posts')) {
             require FEATHER_ROOT . 'include/search_idx.php';
             @set_time_limit(0);
             // Find all posts made by this user
             $select_user_posts = array('p.id', 'p.topic_id', 't.forum_id');
             $result = DB::for_table('posts')->table_alias('p')->select_many($select_user_posts)->inner_join('topics', array('t.id', '=', 'p.topic_id'), 't')->inner_join('forums', array('f.id', '=', 't.forum_id'), 'f')->where('p.poster_id', $user_ids)->find_many();
             if ($result) {
                 foreach ($result as $cur_post) {
                     // Determine whether this post is the "topic post" or not
                     $result2 = DB::for_table('posts')->where('topic_id', $cur_post['topic_id'])->order_by('posted')->find_one_col('id');
                     if ($this->db->result($result2) == $cur_post['id']) {
                         delete_topic($cur_post['topic_id']);
                     } else {
                         delete_post($cur_post['id'], $cur_post['topic_id']);
                     }
                     update_forum($cur_post['forum_id']);
                 }
             }
         } else {
             // Set all their posts to guest
             DB::for_table('posts')->where_in('poster_id', '1')->update_many('poster_id', $user_ids);
         }
         // Delete the users
         DB::for_table('users')->where_in('id', $user_ids)->delete_many();
         // Delete user avatars
         foreach ($user_ids as $user_id) {
             delete_avatar($user_id);
         }
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
         redirect(get_link('admin/users/'), $lang_admin_users['Users delete redirect']);
     }
     return $user_ids;
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:96,代码来源:users.php


示例6: collect_stats

 public function collect_stats()
 {
     // Collect some statistics from the database
     if (file_exists(FORUM_CACHE_DIR . 'cache_users_info.php')) {
         include FORUM_CACHE_DIR . 'cache_users_info.php';
     }
     if (!defined('feather_userS_INFO_LOADED')) {
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
         require FORUM_CACHE_DIR . 'cache_users_info.php';
     }
     $stats_query = DB::for_table('forums')->select_expr('SUM(num_topics)', 'total_topics')->select_expr('SUM(num_posts)', 'total_posts')->find_one();
     $stats['total_topics'] = intval($stats_query['total_topics']);
     $stats['total_posts'] = intval($stats_query['total_posts']);
     if ($this->user->g_view_users == '1') {
         $stats['newest_user'] = '<a href="' . get_link('user/' . $stats['last_user']['id']) . '/">' . feather_escape($stats['last_user']['username']) . '</a>';
     } else {
         $stats['newest_user'] = feather_escape($stats['last_user']['username']);
     }
     return $stats;
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:23,代码来源:index.php


示例7: update_profile


//.........这里部分代码省略.........
                 if (feather_strlen($form['signature']) > $this->config['p_sig_length']) {
                     message(sprintf($lang_prof_reg['Sig too long'], $this->config['p_sig_length'], feather_strlen($form['signature']) - $this->config['p_sig_length']));
                 } elseif (substr_count($form['signature'], "\n") > $this->config['p_sig_lines'] - 1) {
                     message(sprintf($lang_prof_reg['Sig too many lines'], $this->config['p_sig_lines']));
                 } elseif ($form['signature'] && $this->config['p_sig_all_caps'] == '0' && is_all_uppercase($form['signature']) && !$this->user->is_admmod) {
                     $form['signature'] = utf8_ucwords(utf8_strtolower($form['signature']));
                 }
                 // Validate BBCode syntax
                 if ($this->config['p_sig_bbcode'] == '1') {
                     require FEATHER_ROOT . 'include/parser.php';
                     $errors = array();
                     $form['signature'] = preparse_bbcode($form['signature'], $errors, true);
                     if (count($errors) > 0) {
                         message('<ul><li>' . implode('</li><li>', $errors) . '</li></ul>');
                     }
                 }
             }
             break;
         case 'display':
             $form = array('disp_topics' => feather_trim($this->request->post('form_disp_topics')), 'disp_posts' => feather_trim($this->request->post('form_disp_posts')), 'show_smilies' => $this->request->post('form_show_smilies') ? '1' : '0', 'show_img' => $this->request->post('form_show_img') ? '1' : '0', 'show_img_sig' => $this->request->post('form_show_img_sig') ? '1' : '0', 'show_avatars' => $this->request->post('form_show_avatars') ? '1' : '0', 'show_sig' => $this->request->post('form_show_sig') ? '1' : '0');
             if ($form['disp_topics'] != '') {
                 $form['disp_topics'] = intval($form['disp_topics']);
                 if ($form['disp_topics'] < 3) {
                     $form['disp_topics'] = 3;
                 } elseif ($form['disp_topics'] > 75) {
                     $form['disp_topics'] = 75;
                 }
             }
             if ($form['disp_posts'] != '') {
                 $form['disp_posts'] = intval($form['disp_posts']);
                 if ($form['disp_posts'] < 3) {
                     $form['disp_posts'] = 3;
                 } elseif ($form['disp_posts'] > 75) {
                     $form['disp_posts'] = 75;
                 }
             }
             // Make sure we got a valid style string
             if ($this->request->post('form_style')) {
                 $styles = forum_list_styles();
                 $form['style'] = feather_trim($this->request->post('form_style'));
                 if (!in_array($form['style'], $styles)) {
                     message($lang_common['Bad request'], '404');
                 }
             }
             break;
         case 'privacy':
             $form = array('email_setting' => intval($this->request->post('form_email_setting')), 'notify_with_post' => $this->request->post('form_notify_with_post') ? '1' : '0', 'auto_notify' => $this->request->post('form_auto_notify') ? '1' : '0');
             if ($form['email_setting'] < 0 || $form['email_setting'] > 2) {
                 $form['email_setting'] = $this->config['o_default_email_setting'];
             }
             break;
         default:
             message($lang_common['Bad request'], '404');
     }
     // Single quotes around non-empty values and nothing for empty values
     $temp = array();
     foreach ($form as $key => $input) {
         $temp[$key] = $input;
     }
     if (empty($temp)) {
         message($lang_common['Bad request'], '404');
     }
     DB::for_table('users')->where('id', $id)->find_one()->set($temp)->save();
     // If we changed the username we have to update some stuff
     if ($username_updated) {
         $bans_updated = DB::for_table('bans')->where('username', $info['old_username'])->update_many('username', $form['username']);
         DB::for_table('posts')->where('poster_id', $id)->update_many('poster', $form['username']);
         DB::for_table('posts')->where('edited_by', $info['old_username'])->update_many('edited_by', $form['username']);
         DB::for_table('topics')->where('poster', $info['old_username'])->update_many('poster', $form['username']);
         DB::for_table('topics')->where('last_poster', $info['old_username'])->update_many('last_poster', $form['username']);
         DB::for_table('forums')->where('last_poster', $info['old_username'])->update_many('last_poster', $form['username']);
         DB::for_table('online')->where('ident', $info['old_username'])->update_many('ident', $form['username']);
         // If the user is a moderator or an administrator we have to update the moderator lists
         $group_id = DB::for_table('users')->where('id', $id)->find_one_col('group_id');
         $group_mod = DB::for_table('groups')->where('g_id', $group_id)->find_one_col('g_moderator');
         if ($group_id == FEATHER_ADMIN || $group_mod == '1') {
             $select_mods = array('id', 'moderators');
             $result = DB::for_table('forums')->select_many($select_mods)->find_many();
             foreach ($result as $cur_forum) {
                 $cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
                 if (in_array($id, $cur_moderators)) {
                     unset($cur_moderators[$info['old_username']]);
                     $cur_moderators[$form['username']] = $id;
                     uksort($cur_moderators, 'utf8_strcasecmp');
                     DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set('moderators', serialize($cur_moderators))->save();
                 }
             }
         }
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
         // Check if the bans table was updated and regenerate the bans cache when needed
         if ($bans_updated) {
             generate_bans_cache();
         }
     }
     redirect(get_link('user/' . $id . '/section/' . $section . '/'), $lang_profile['Profile redirect']);
 }
开发者ID:beaver-dev,项目名称:featherbb,代码行数:101,代码来源:profile.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP generate_where_statement函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_user_password函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap