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


PHP utf8_clean_string函数代码示例

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


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

示例1: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template, $phpbb_container;
        if (!$config['allow_password_reset']) {
            trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>'));
        }
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new \phpbb\auth\auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            // Make password at least 8 characters long, make it longer if admin wants to.
            // gen_rand_string() however has a limit of 12 or 13.
            $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars'])));
            // For the activation key a random length between 6 and 10 will do.
            $user_actkey = gen_rand_string(mt_rand(6, 10));
            // Instantiate passwords manager
            $passwords_manager = $phpbb_container->get('passwords.manager');
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->set_addresses($user_row);
            $messenger->anti_abuse_headers($config, $user);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:60,代码来源:ucp_remind.php

示例2: login

    function login($phpbb_user_id)
    {
        define('IN_PHPBB', true);
        define('PBB_ROOT_PATH', "D://www/phpBB3");
        global $phpbb_root_path, $phpEx, $user, $db, $config, $cache, $template;
        $phpEx = "php";
        $phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : PBB_ROOT_PATH . '/';
        require_once $phpbb_root_path . 'config.' . $phpEx;
        include $phpbb_root_path . 'common.' . $phpEx;
        //		$session_id = $user->session_begin($phpbb_user_id, $user_ip, 0, FALSE, 0);
        //		$auth->acl($user->data);
        //		$user->setup();
        //
        //		if ($session_id) {
        //			return $session_id;
        //		}
        //		else
        //		{
        //			message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__, __FILE__);
        //		}
        $user->session_begin();
        $auth->acl($user->data);
        $user->setup();
        //Does user have phpBB3 account?
        $sql = 'SELECT user_id
		        FROM ' . USERS_TABLE . "\r\n\t\t        WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($user)) . "'";
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        if (!$row) {
            //Create phpBB3 user
        }
        //Signin automaticly for phpBB3
        $user->session_create($row['user_id'], true, true, true);
        return true;
    }
开发者ID:hukumonline,项目名称:idh,代码行数:35,代码来源:ForumBB.php

示例3: run_tool

	/**
	* Run Tool
	*
	* Does the actual stuff we want the tool to do after submission
	*/
	function run_tool()
	{
		global $db, $template;

		$part = request_var('part', 0);
		$limit = 500;
		$i = 0;

        $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE;
        $result = $db->sql_query_limit($sql, $limit, ($part * $limit));
        while ($row = $db->sql_fetchrow($result))
        {
        	$i++;
        	$username_clean = utf8_clean_string($row['username']);

        	if ($username_clean != $row['username_clean'])
        	{
        		$db->sql_query('UPDATE ' . USERS_TABLE . " SET username_clean = '$username_clean' WHERE user_id = {$row['user_id']}");
			}
		}
		$db->sql_freeresult($result);

		if ($i == $limit)
		{
			meta_refresh(0, append_sid(STK_INDEX, 't=reclean_usernames&amp;submit=1&amp;part=' . (++$part)));
			$template->assign_var('U_BACK_TOOL', false);

			trigger_error('RECLEAN_USERNAMES_NOT_COMPLETE');
		}
		else
		{
			trigger_error('RECLEAN_USERNAMES_COMPLETE');
		}
	}
开发者ID:sietf,项目名称:sietf.org,代码行数:39,代码来源:reclean_usernames.php

示例4: create_welcome_topic

    public function create_welcome_topic($user_id)
    {
        if (!$this->config['welcomerobot_enable']) {
            return false;
        }
        if (!function_exists('get_username_string')) {
            include $this->root_path . 'includes/functions_content.' . $this->phpEx;
        }
        if (!function_exists('submit_post')) {
            include $this->root_path . 'includes/functions_posting.' . $this->phpEx;
        }
        $sql = 'SELECT *
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_id = " . intval($user_id) . "";
        $dbresult = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($dbresult);
        $this->db->sql_freeresult($dbresult);
        if (empty($row)) {
            return false;
        }
        $username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
        $clean_username = utf8_clean_string($row['username']);
        $topic_title = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_title']);
        $topic_content = str_replace(array('%user', '%robot', '%board'), array($clean_username, $this->config['welcomerobot_username'], $this->config['sitename']), $this->config['welcomerobot_detail']);
        $poll = $uid = $bitfield = $options = '';
        // will be modified by generate_text_for_storage
        $allow_bbcode = $allow_urls = $allow_smilies = true;
        generate_text_for_storage($topic_content, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
        $data = array('forum_id' => $this->config['welcomerobot_forum'], 'topic_id' => 0, 'icon_id' => false, 'robot_name' => $this->config['welcomerobot_username'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $topic_content, 'message_md5' => md5($topic_content), 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'post_edit_locked' => 0, 'topic_title' => $topic_title, 'notify_set' => false, 'notify' => false, 'post_time' => 0, 'forum_name' => '', 'enable_indexing' => true, 'force_approved_state' => true);
        submit_post('post', $topic_title, 'robot_name', POST_NORMAL, $poll, $data);
        return true;
    }
开发者ID:Elias64,项目名称:autoPost,代码行数:31,代码来源:listener.php

示例5: update_bots

    public function update_bots()
    {
        // Update bots
        if (!function_exists('user_delete')) {
            include $this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext;
        }
        $bots_updates = array('NG-Search [Bot]' => false, 'Nutch/CVS [Bot]' => false, 'OmniExplorer [Bot]' => false, 'Seekport [Bot]' => false, 'Synoo [Bot]' => false, 'WiseNut [Bot]' => false, 'Baidu [Spider]' => 'Baiduspider', 'Exabot [Bot]' => 'Exabot', 'Voyager [Bot]' => 'voyager/', 'W3C [Validator]' => 'W3C_Validator');
        foreach ($bots_updates as $bot_name => $bot_agent) {
            $sql = 'SELECT user_id
				FROM ' . USERS_TABLE . '
				WHERE user_type = ' . USER_IGNORE . "\n\t\t\t\t\tAND username_clean = '" . $this->db->sql_escape(utf8_clean_string($bot_name)) . "'";
            $result = $this->db->sql_query($sql);
            $bot_user_id = (int) $this->db->sql_fetchfield('user_id');
            $this->db->sql_freeresult($result);
            if ($bot_user_id) {
                if ($bot_agent === false) {
                    $sql = 'DELETE FROM ' . BOTS_TABLE . "\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
                    $this->sql_query($sql);
                    user_delete('retain', $bot_user_id);
                } else {
                    $sql = 'UPDATE ' . BOTS_TABLE . "\n\t\t\t\t\t\tSET bot_agent = '" . $this->db->sql_escape($bot_agent) . "'\n\t\t\t\t\t\tWHERE user_id = {$bot_user_id}";
                    $this->sql_query($sql);
                }
            }
        }
    }
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:bot_update.php

示例6: check_user

    /**
     * Checks to see if we can use this username for a merge, based on a few factors.
     *
     * @param string $username - The username to check
     * @param array &$errors - Errors array to work with
     * @return mixed - Return the user's ID (integer) if valid, return void if there was an error
     */
    function check_user($username, &$errors, $old_user)
    {
        global $db, $user;
        // Grabbeth the old user's ID
        if (!empty($username)) {
            $sql = 'SELECT user_id, user_type
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_id = (int) $db->sql_fetchfield('user_id');
            $user_type = (int) $db->sql_fetchfield('user_type');
            $db->sql_freeresult($result);
            // No such user.  o_0
            if (!$user_id) {
                $errors[] = $user->lang['NO_USER'];
                return;
            }
        } else {
            $errors[] = $user->lang['NO_USER_SPECIFIED'];
            return;
        }
        // Check to see if it is ourselves here
        if ($user_id === (int) $user->data['user_id'] && $old_user) {
            $errors[] = $user->lang['CANNOT_MERGE_SELF'];
            return;
        }
        // Make sure we aren't messing with a founder
        if ($user_type === USER_FOUNDER && $old_user && $user->data['user_type'] !== USER_FOUNDER) {
            $errors[] = $user->lang['CANNOT_MERGE_FOUNDER'];
            return;
        }
        return $user_id;
    }
开发者ID:phpbbmodders-30x-mods,项目名称:user_merge,代码行数:39,代码来源:acp_user_merge.php

示例7: run_tool

 /**
  * Run Tool
  *
  * Does the actual stuff we want the tool to do after submission
  */
 function run_tool()
 {
     global $db, $template, $user, $phpbb_root_path, $phpEx;
     $part = request_var('part', 0);
     $limit = 500;
     $i = 0;
     $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE;
     $result = $db->sql_query_limit($sql, $limit, $part * $limit);
     while ($row = $db->sql_fetchrow($result)) {
         $i++;
         $username_clean = $db->sql_escape(utf8_clean_string($row['username']));
         if ($username_clean != $row['username_clean']) {
             $sql = 'SELECT user_id, username, username_clean FROM ' . USERS_TABLE . ' WHERE username_clean LIKE \'' . $username_clean . '\'';
             $res = $db->sql_query_limit($sql, 1);
             $duplicate = $db->sql_fetchrow($res);
             $db->sql_freeresult($res);
             if (!empty($duplicate)) {
                 $url = append_sid("{$phpbb_root_path}adm/index.{$phpEx}", 'i=users&amp;mode=overview&amp;u=' . $duplicate['user_id'] . '&amp;sid=' . $user->data['session_id']);
                 $problem = append_sid("{$phpbb_root_path}adm/index.{$phpEx}", 'i=users&amp;mode=overview&amp;u=' . $row['user_id'] . '&amp;sid=' . $user->data['session_id']);
                 trigger_error(sprintf($user->lang['USER_ALREADY_EXISTS'], $duplicate['username'], $url, $row['username'], $problem), E_USER_WARNING);
             }
             $db->sql_query('UPDATE ' . USERS_TABLE . " SET username_clean = '{$username_clean}' WHERE user_id = {$row['user_id']}");
         }
     }
     $db->sql_freeresult($result);
     if ($i == $limit) {
         meta_refresh(0, append_sid(STK_INDEX, 't=reclean_usernames&amp;submit=1&amp;part=' . ++$part));
         $template->assign_var('U_BACK_TOOL', false);
         trigger_error('RECLEAN_USERNAMES_NOT_COMPLETE');
     } else {
         trigger_error('RECLEAN_USERNAMES_COMPLETE');
     }
 }
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:38,代码来源:reclean_usernames.php

示例8: onEdit

 function onEdit($record, $old_record)
 {
     $auth_model = Configure::read('security.auth_model');
     $username_field = $this->_controller->Auth->authenticate->userField;
     $email_field = $this->_controller->Auth->authenticate->emailField;
     // phpBB3 files need these
     global $phpbb_root_path, $phpEx;
     $phpbb_root_path = Configure::read('phpbb3.root_path');
     $phpEx = 'php';
     include $phpbb_root_path . 'config.php';
     $bb3_class = "{$table_prefix}users";
     $bb3_model = ClassRegistry::init($bb3_class);
     $bb3_user = $bb3_model->find('first', array('conditions' => array('username' => $old_record[$auth_model][$username_field])));
     // We only care about username and email address changes
     if (empty($bb3_user) || $bb3_user[$bb3_class]['username'] == $record[$auth_model][$username_field] && $bb3_user[$bb3_class]['user_email'] == $record[$auth_model][$email_field]) {
         return;
     }
     // Includ a couple of things needed for function definitions
     define('IN_PHPBB', true);
     include $phpbb_root_path . 'includes/functions.php';
     include $phpbb_root_path . 'includes/utf/utf_tools.php';
     $clean = utf8_clean_string($record[$auth_model][$username_field]);
     $hash = phpbb_email_hash($record[$auth_model][$email_field]);
     $bb3_model->updateAll(array('username' => "'{$record[$auth_model][$username_field]}'", 'username_clean' => "'{$clean}'", 'user_email' => "'{$record[$auth_model][$email_field]}'", 'user_email_hash' => "'{$hash}'"), array('user_id' => $bb3_user[$bb3_class]['user_id']));
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:25,代码来源:user_phpbb3.php

示例9: upload_image

 /**
  * Insert the image into the database
  */
 public static function upload_image(&$image_data, $album_id)
 {
     global $user, $db;
     $sql_ary = array('image_filename' => $image_data['filename'], 'image_name' => $image_data['image_name'], 'image_name_clean' => utf8_clean_string($image_data['image_name']), 'image_user_id' => $user->data['user_id'], 'image_user_colour' => $user->data['user_colour'], 'image_username' => $image_data['username'], 'image_username_clean' => utf8_clean_string($image_data['username']), 'image_user_ip' => $user->ip, 'image_time' => $image_data['image_time'], 'image_album_id' => $image_data['image_album_id'], 'image_status' => phpbb_gallery::$auth->acl_check('i_approve', $album_id) ? phpbb_gallery_image::STATUS_APPROVED : phpbb_gallery_image::STATUS_UNAPPROVED, 'filesize_upload' => $image_data['image_filesize'], 'image_contest' => $image_data['image_contest'], 'image_exif_data' => $image_data['image_exif_data'], 'image_has_exif' => $image_data['image_has_exif']);
     $message_parser = new parse_message();
     $message_parser->message = utf8_normalize_nfc($image_data['image_desc']);
     if ($message_parser->message) {
         $message_parser->parse(true, true, true, true, false, true, true, true);
         $sql_ary['image_desc'] = $message_parser->message;
         $sql_ary['image_desc_uid'] = $message_parser->bbcode_uid;
         $sql_ary['image_desc_bitfield'] = $message_parser->bbcode_bitfield;
     } else {
         $sql_ary['image_desc'] = '';
         $sql_ary['image_desc_uid'] = '';
         $sql_ary['image_desc_bitfield'] = '';
     }
     $sql = 'INSERT INTO ' . GALLERY_IMAGES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
     $db->sql_query($sql);
     $image_id = $db->sql_nextid();
     if (phpbb_gallery::$user->get_data('watch_own')) {
         $sql_ary = array('image_id' => $image_id, 'user_id' => $user->data['user_id']);
         $sql = 'INSERT INTO ' . GALLERY_WATCH_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
         $db->sql_query($sql);
     }
     return array('image_id' => $image_id, 'image_name' => $image_data['image_name']);
 }
开发者ID:phpbbgallery,项目名称:phpbb-gallery,代码行数:29,代码来源:misc.php

示例10: bots

    /**
     * Reset all bots
     */
    function bots($error)
    {
        global $config, $db;
        if (isset($_POST['yes'])) {
            $sql = 'SELECT group_id, group_colour
				FROM ' . GROUPS_TABLE . "\n\t\t\t\tWHERE group_name = 'BOTS'";
            $result = $db->sql_query($sql);
            $group_id = (int) $db->sql_fetchfield('group_id', false, $result);
            $group_colour = $db->sql_fetchfield('group_colour', 0, $result);
            $db->sql_freeresult($result);
            if (!$group_id) {
                // If we reach this point then something has gone very wrong
                $error[] = 'NO_BOT_GROUP';
                return $error;
            } else {
                if (!function_exists('user_add')) {
                    include PHPBB_ROOT_PATH . 'includes/functions_user.' . PHP_EXT;
                }
                // Remove existing bots
                $uids = array();
                $sql = 'SELECT user_id FROM ' . BOTS_TABLE;
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    $uids[] = $row['user_id'];
                }
                $db->sql_freeresult($result);
                if (!empty($uids)) {
                    // Remove all the bots
                    foreach ($uids as $uid) {
                        user_delete('remove', $uid);
                    }
                    // Clear out the bots table
                    $db->sql_query('DELETE FROM ' . BOTS_TABLE);
                }
                // Add the bots
                foreach ($this->db_cleaner->data->bots as $bot_name => $bot_ary) {
                    /* Clean the users table of any bots matching this...
                     * this is an issue if a default bot was removed from the bots group. */
                    $username_clean = utf8_clean_string($bot_name);
                    if (empty($username_clean)) {
                        // This shouldn't happen but we should handle it anyway...
                        continue;
                    }
                    $sql = 'DELETE FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape($username_clean) . '\'';
                    $db->sql_query($sql);
                    // `$bot_ary` can be false, if a bot was removed in a certain phpBB version
                    if ($bot_ary === false) {
                        continue;
                    }
                    $user_row = array('user_type' => USER_IGNORE, 'group_id' => $group_id, 'username' => $bot_name, 'user_regdate' => time(), 'user_password' => '', 'user_colour' => $group_colour, 'user_email' => '', 'user_lang' => $config['default_lang'], 'user_style' => 1, 'user_timezone' => 0, 'user_dateformat' => $config['default_dateformat'], 'user_allow_massemail' => 0);
                    $user_id = user_add($user_row);
                    if ($user_id) {
                        $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array('bot_active' => 1, 'bot_name' => (string) $bot_name, 'user_id' => (int) $user_id, 'bot_agent' => (string) $bot_ary[0], 'bot_ip' => (string) $bot_ary[1]));
                        $result = $db->sql_query($sql);
                    }
                }
            }
        }
    }
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:62,代码来源:database_cleaner_controller.php

示例11: login_box_failed

 /**
  * If login failed set the conter +1
  *
  * @param object $event The event object
  * @return null
  * @access public
  */
 public function login_box_failed($event)
 {
     // Set the counter +1
     $sql = 'UPDATE ' . USERS_TABLE . " SET failed_logins_count = failed_logins_count + 1\n\t\t\tWHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($event['username'])) . "'";
     $this->db->sql_query($sql);
     // Add to user log
     $this->log->add('user', ANONYMOUS, $this->user->ip, 'TRY_TO_LOGIN_FAIL', time(), array('reportee_id' => ANONYMOUS, 'username' => $event['username']));
 }
开发者ID:FastLizard4,项目名称:failedlogins,代码行数:15,代码来源:listener.php

示例12: search_user_func

function search_user_func()
{
    global $user, $config, $auth, $db, $phpbb_root_path;
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup(array('memberlist', 'groups'));
    if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) {
        if ($user->data['user_id'] != ANONYMOUS) {
            trigger_error('NO_VIEW_USERS');
        }
        trigger_error('LOGIN_EXPLAIN_MEMBERLIST');
    }
    if ($config['load_search'] || $auth->acl_get('a_')) {
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $sql_where .= $username ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : '';
        $sql_where .= $auth->acl_get('a_user') && $email ? ' OR u.user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : '';
    } else {
        trigger_error('NO_VIEW_USERS');
    }
    $page = request_var('page', 1);
    $per_page = request_var('perpage', 20);
    $start = ($page - 1) * $per_page;
    $default_key = 'c';
    $sort_key = request_var('sk', $default_key);
    $sort_dir = request_var('sd', 'a');
    $sort_key_sql = array('a' => 'u.username_clean', 'b' => 'u.user_from', 'c' => 'u.user_regdate', 'd' => 'u.user_posts', 'f' => 'u.user_website', 'g' => 'u.user_icq', 'h' => 'u.user_aim', 'i' => 'u.user_msnm', 'j' => 'u.user_yim', 'k' => 'u.user_jabber');
    // Sorting and order
    if (!isset($sort_key_sql[$sort_key])) {
        $sort_key = $default_key;
    }
    $order_by .= $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'a' ? 'ASC' : 'DESC');
    // Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly
    if ($sort_key == 'm') {
        $order_by .= ', u.user_posts DESC';
    }
    // Count the users ...
    if ($sql_where) {
        $sql = 'SELECT COUNT(u.user_id) AS total_users
			FROM ' . USERS_TABLE . " u\r\r\n\t\t\tWHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")\r\r\n\t\t\t{$sql_where}";
        $result = $db->sql_query($sql);
        $total_users = (int) $db->sql_fetchfield('total_users');
        $db->sql_freeresult($result);
    } else {
        $total_users = $config['num_users'];
    }
    // Get us some users :D
    $sql = "SELECT u.*\r\r\n\t\tFROM " . USERS_TABLE . " u\r\r\n\t\tWHERE u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ")\r\r\n\t\t\t{$sql_where}\r\r\n\t\tORDER BY {$order_by}";
    $result = $db->sql_query_limit($sql, $per_page, $start);
    $user_list = array();
    while ($row = $db->sql_fetchrow($result)) {
        $return_user_lists[] = new xmlrpcval(array('username' => new xmlrpcval(basic_clean($row['username']), 'base64'), 'user_id' => new xmlrpcval($row['user_id'], 'string'), 'icon_url' => new xmlrpcval(get_user_avatar_url($row['user_avatar'], $row['user_avatar_type']), 'string')), 'struct');
    }
    $db->sql_freeresult($result);
    $suggested_users = new xmlrpcval(array('total' => new xmlrpcval($total_users, 'int'), 'list' => new xmlrpcval($return_user_lists, 'array')), 'struct');
    return new xmlrpcresp($suggested_users);
}
开发者ID:danielgospodinow,项目名称:GamingZone,代码行数:58,代码来源:search_user.php

示例13: clean_url

function clean_url($url)
{
	$url = str_replace(array('Re:', 're:', ' '), '', $url);
	$find = array('?', '#', '%', '¿', '^', '.', '/', ' ', '_', ')', '[', ']', ':', '.');
	$url = str_replace($find, '-', censor_text($url));
	$url = str_replace(array('---', '--'), '-', $url);

	return utf8_clean_string($url);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:9,代码来源:functions_seo.php

示例14: main

    function main($id, $mode)
    {
        global $config, $phpbb_root_path, $phpEx;
        global $db, $user, $auth, $template;
        $username = request_var('username', '', true);
        $email = strtolower(request_var('email', ''));
        $submit = isset($_POST['submit']) ? true : false;
        if ($submit) {
            $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE user_email = '" . $db->sql_escape($email) . "'\n\t\t\t\t\tAND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
            $result = $db->sql_query($sql);
            $user_row = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if (!$user_row) {
                trigger_error('NO_EMAIL_USER');
            }
            if ($user_row['user_type'] == USER_IGNORE) {
                trigger_error('NO_USER');
            }
            if ($user_row['user_type'] == USER_INACTIVE) {
                if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL) {
                    trigger_error('ACCOUNT_DEACTIVATED');
                } else {
                    trigger_error('ACCOUNT_NOT_ACTIVATED');
                }
            }
            // Check users permissions
            $auth2 = new auth();
            $auth2->acl($user_row);
            if (!$auth2->acl_get('u_chgpasswd')) {
                trigger_error('NO_AUTH_PASSWORD_REMINDER');
            }
            $server_url = generate_board_url();
            $key_len = 54 - strlen($server_url);
            $key_len = max(6, $key_len);
            // we want at least 6
            $key_len = $config['max_pass_chars'] ? min($key_len, $config['max_pass_chars']) : $key_len;
            // we want at most $config['max_pass_chars']
            $user_actkey = substr(gen_rand_string(10), 0, $key_len);
            $user_password = gen_rand_string(8);
            $sql = 'UPDATE ' . USERS_TABLE . "\n\t\t\t\tSET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "'\n\t\t\t\tWHERE user_id = " . $user_row['user_id'];
            $db->sql_query($sql);
            include_once $phpbb_root_path . 'includes/functions_messenger.' . $phpEx;
            $messenger = new messenger(false);
            $messenger->template('user_activate_passwd', $user_row['user_lang']);
            $messenger->to($user_row['user_email'], $user_row['username']);
            $messenger->im($user_row['user_jabber'], $user_row['username']);
            $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username']), 'PASSWORD' => htmlspecialchars_decode($user_password), 'U_ACTIVATE' => "{$server_url}/ucp.{$phpEx}?mode=activate&u={$user_row['user_id']}&k={$user_actkey}"));
            $messenger->send($user_row['user_notify_type']);
            meta_refresh(3, append_sid("{$phpbb_root_path}index.{$phpEx}"));
            $message = $user->lang['PASSWORD_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.{$phpEx}") . '">', '</a>');
            trigger_error($message);
        }
        $template->assign_vars(array('USERNAME' => $username, 'EMAIL' => $email, 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')));
        $this->tpl_name = 'ucp_remind';
        $this->page_title = 'UCP_REMIND';
    }
开发者ID:jvinhit,项目名称:php,代码行数:57,代码来源:ucp_remind.php

示例15: get_user_id

    public function get_user_id($username)
    {
        $sql = 'SELECT user_id, username
				FROM ' . USERS_TABLE . '
				WHERE username_clean = \'' . $this->db->sql_escape(utf8_clean_string($username)) . '\'';
        $result = $this->db->sql_query($sql);
        $row = $this->db->sql_fetchrow($result);
        return $row['user_id'];
    }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:9,代码来源:autoban_base.php


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