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

PHP submit_pm函数代码示例

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

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



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

示例1: sendphpbbpm

function sendphpbbpm($pmmessage, $groupid, $pmsubject)
{
    include_once 'forum/includes/functions_privmsgs.php';
    $message = utf8_normalize_nfc($pmmessage);
    $uid = $bitfield = $options = '';
    $allow_bbcode = $allow_smilies = true;
    $allow_urls = true;
    generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
    $pm_data = array('from_user_id' => 2, 'from_user_ip' => "127.0.0.1", 'from_username' => "Raid Admin", 'enable_sig' => false, 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => false, 'icon_id' => 0, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'message' => $message, 'address_list' => array('g' => array($groupid => 'to')));
    submit_pm('post', $pmsubject, $pm_data, false);
}
开发者ID:ahmatjan,项目名称:Crimson,代码行数:11,代码来源:admin.php


示例2: user_welcome

 /** User PM welcome message */
 private function user_welcome($user_to, $user_id, $subject, $text)
 {
     $m_flags = 3;
     // 1 is bbcode, 2 is smiles, 4 is urls (add together to turn on more than one)
     $uid = $bitfield = '';
     $allow_bbcode = $allow_urls = $allow_smilies = true;
     $text = str_replace('{USERNAME}', $this->user->data['username'], $text);
     generate_text_for_storage($text, $uid, $bitfield, $m_flags, $allow_bbcode, $allow_urls, $allow_smilies);
     include_once $this->phpbb_root_path . 'includes/functions_privmsgs.' . $this->php_ext;
     $pm_data = array('address_list' => array('u' => array($user_to => 'to')), 'from_user_id' => $user_id, 'from_user_ip' => $this->user->ip, 'enable_sig' => false, 'enable_bbcode' => $allow_bbcode, 'enable_smilies' => $allow_smilies, 'enable_urls' => $allow_urls, 'icon_id' => 0, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'message' => utf8_normalize_nfc($text));
     submit_pm('post', utf8_normalize_nfc($subject), $pm_data, false);
 }
开发者ID:Galixte,项目名称:apwa,代码行数:13,代码来源:listener.php


示例3: run_tool

    /**
     * Run the tool
     */
    function run_tool()
    {
        global $cache, $config, $db, $user;
        // Prevent some errors from missing language strings.
        $user->add_lang('posting');
        // Define some vars that we'll need
        $last_batch = false;
        $reparse_id = request_var('reparseids', '');
        $reparse_pm_id = request_var('reparsepms', '');
        $reparse_forum_ids = request_var('reparseforums', array(0));
        $create_backup = request_var('create_backup', false);
        $all = request_var('reparseall', false);
        $mode = request_var('mode', BBCODE_REPARSE_POSTS);
        $step = request_var('step', 0);
        $start = $step * $this->step_size;
        $cnt = 0;
        if (sizeof($reparse_forum_ids)) {
            $reparse_id = '';
            $sql_forum_where = ' WHERE ' . $db->sql_in_set('forum_id', $reparse_forum_ids);
        }
        if (!sizeof($reparse_forum_ids) && !$reparse_id && !$reparse_pm_id && !$all && $step == 0) {
            trigger_error('REPARSE_IDS_EMPTY', E_USER_WARNING);
        }
        // If post IDs or PM IDs were specified, we need to make sure the list is valid.
        $reparse_posts = array();
        $reparse_pms = array();
        if (!empty($reparse_id)) {
            $reparse_posts = explode(',', $reparse_id);
            $reparse_forum_ids = array();
            if (!sizeof($reparse_posts)) {
                trigger_error('REPARSE_IDS_INVALID', E_USER_WARNING);
            }
            // Make sure there's no extra whitespace
            array_walk($reparse_posts, array($this, '_trim_post_ids'));
            $cache->put('_stk_reparse_posts', $reparse_posts);
        } else {
            if ($mode == BBCODE_REPARSE_POSTS) {
                if (($result = $cache->get('_stk_reparse_posts')) !== false) {
                    $reparse_posts = $result;
                }
            }
        }
        if (!empty($reparse_pm_id)) {
            $reparse_pms = explode(',', $reparse_pm_id);
            if (!sizeof($reparse_pms)) {
                trigger_error('REPARSE_IDS_INVALID');
            }
            if (!$all) {
                $mode = BBCODE_REPARSE_PMS;
            }
            // Again, make sure the format is okay
            array_walk($reparse_pms, array($this, '_trim_post_ids'));
            $cache->put('_stk_reparse_pms', $reparse_pms);
        } else {
            if ($mode == BBCODE_REPARSE_PMS) {
                if (($result = $cache->get('_stk_reparse_pms')) !== false) {
                    $reparse_pms = $result;
                }
            }
        }
        // The message parser
        if (!class_exists('parse_message')) {
            global $phpbb_root_path, $phpEx;
            // required!
            include PHPBB_ROOT_PATH . 'includes/message_parser.' . PHP_EXT;
        }
        // Posting helper functions
        if ($mode == BBCODE_REPARSE_POSTS && !function_exists('submit_post')) {
            include PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT;
        }
        // PM helper function
        if ($mode == BBCODE_REPARSE_PMS && !function_exists('submit_pm')) {
            include PHPBB_ROOT_PATH . 'includes/functions_privmsgs.' . PHP_EXT;
        }
        // First step? Prepare the backup
        if ($create_backup && $step == 0 && $mode == BBCODE_REPARSE_POSTS) {
            $this->_prepare_backup();
        }
        // Greb our batch
        $bitfield = $all ? true : false;
        // The MSSQL DBMS doesn't break correctly out of the loop
        // when it is finished reparsing the last post. Therefore
        // we'll have to find out manually whether the tool is
        // finished, and if not how many objects it can select
        // if ($this->step_size * $step > 'maxrows')
        // #62822
        // First the easiest, the user selected certain posts/pms
        if (!empty($reparse_posts) || !empty($reparse_pms)) {
            $this->step_size = !empty($reparse_posts) ? sizeof($reparse_posts) : sizeof($reparse_pms);
            // This is always done in one go
            $last_batch = true;
        } else {
            // Get the total
            $this->max = request_var('rowsmax', 0);
            if ($this->max == 0) {
                switch ($mode) {
                    case BBCODE_REPARSE_POSTS:
//.........这里部分代码省略.........
开发者ID:melvingb,项目名称:phpbb3.1-STK,代码行数:101,代码来源:reparse_bbcode.php


示例4: add_warning

/**
* Insert the warning into the database
*/
function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
{
	global $phpEx, $phpbb_root_path, $config;
	global $template, $db, $user, $auth;

	if ($send_pm)
	{
		include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx);
		include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);

		$user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . $user_row['user_lang'] . "/mcp.$phpEx")) ? $user_row['user_lang'] : $config['default_lang'];
		include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp.$phpEx");

		$message_parser = new parse_message();

		$message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
		$message_parser->parse(true, true, true, false, false, true, true);

		$pm_data = array(
			'from_user_id'			=> $user->data['user_id'],
			'from_user_ip'			=> $user->ip,
			'from_username'			=> $user->data['username'],
			'enable_sig'			=> false,
			'enable_bbcode'			=> true,
			'enable_smilies'		=> true,
			'enable_urls'			=> false,
			'icon_id'				=> 0,
			'bbcode_bitfield'		=> $message_parser->bbcode_bitfield,
			'bbcode_uid'			=> $message_parser->bbcode_uid,
			'message'				=> $message_parser->message,
			'address_list'			=> array('u' => array($user_row['user_id'] => 'to')),
		);

		submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
	}

	add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
	$log_id = add_log('user', $user_row['user_id'], 'LOG_USER_WARNING_BODY', $warning);

	$sql_ary = array(
		'user_id'		=> $user_row['user_id'],
		'post_id'		=> $post_id,
		'log_id'		=> $log_id,
		'warning_time'	=> time(),
	);

	$db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));

	$sql = 'UPDATE ' . USERS_TABLE . '
		SET user_warnings = user_warnings + 1,
			user_last_warning = ' . time() . '
		WHERE user_id = ' . $user_row['user_id'];
	$db->sql_query($sql);

	// We add this to the mod log too for moderators to see that a specific user got warned.
	$sql = 'SELECT forum_id, topic_id
		FROM ' . POSTS_TABLE . '
		WHERE post_id = ' . $post_id;
	$result = $db->sql_query($sql);
	$row = $db->sql_fetchrow($result);
	$db->sql_freeresult($result);

	add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']);
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:67,代码来源:mcp_warn.php


示例5: compose_pm


//.........这里部分代码省略.........
        $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true);
        if (sizeof($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) {
            $error[] = implode('<br />', $message_parser->warn_msg);
            $message_parser->warn_msg = array();
        }
        // Parse message
        $message_parser->parse($enable_bbcode, $config['allow_post_links'] ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']);
        // On a refresh we do not care about message parsing errors
        if (sizeof($message_parser->warn_msg) && !$refresh) {
            $error[] = implode('<br />', $message_parser->warn_msg);
        }
        if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) {
            // Flood check
            $last_post_time = $user->data['user_lastpost_time'];
            if ($last_post_time) {
                if ($last_post_time && $current_time - $last_post_time < intval($config['flood_interval'])) {
                    $error[] = $user->lang['FLOOD_ERROR'];
                }
            }
        }
        // Subject defined
        if ($submit) {
            if (utf8_clean_string($subject) === '') {
                $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT'];
            }
            if (!sizeof($address_list)) {
                $error[] = $user->lang['NO_RECIPIENT'];
            }
        }
        // Store message, sync counters
        if (!sizeof($error) && $submit) {
            $pm_data = array('msg_id' => (int) $msg_id, 'from_user_id' => $user->data['user_id'], 'from_user_ip' => $user->ip, 'from_username' => $user->data['username'], 'reply_from_root_level' => isset($post['root_level']) ? (int) $post['root_level'] : 0, 'reply_from_msg_id' => (int) $msg_id, 'icon_id' => (int) $icon_id, 'enable_sig' => (bool) $enable_sig, 'enable_bbcode' => (bool) $enable_bbcode, 'enable_smilies' => (bool) $enable_smilies, 'enable_urls' => (bool) $enable_urls, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid, 'message' => $message_parser->message, 'attachment_data' => $message_parser->attachment_data, 'filename_data' => $message_parser->filename_data, 'address_list' => $address_list);
            // ((!$message_subject) ? $subject : $message_subject)
            $msg_id = submit_pm($action, $subject, $pm_data);
            $return_message_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;mode=view&amp;p=' . $msg_id);
            $inbox_folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;folder=inbox');
            $outbox_folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;folder=outbox');
            $folder_url = '';
            if ($folder_id > 0 && isset($user_folders[$folder_id])) {
                $folder_url = append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&amp;folder=' . $folder_id);
            }
            $return_box_url = $action === 'post' || $action === 'edit' ? $outbox_folder_url : $inbox_folder_url;
            $return_box_lang = $action === 'post' || $action === 'edit' ? 'PM_OUTBOX' : 'PM_INBOX';
            $save_message = $action === 'edit' ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED'];
            $message = $save_message . '<br /><br />' . $user->lang('VIEW_PRIVATE_MESSAGE', '<a href="' . $return_message_url . '">', '</a>');
            $last_click_type = 'CLICK_RETURN_FOLDER';
            if ($folder_url) {
                $message .= '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $folder_url . '">', '</a>', $user_folders[$folder_id]['folder_name']);
                $last_click_type = 'CLICK_GOTO_FOLDER';
            }
            $message .= '<br /><br />' . sprintf($user->lang[$last_click_type], '<a href="' . $return_box_url . '">', '</a>', $user->lang[$return_box_lang]);
            meta_refresh(3, $return_message_url);
            trigger_error($message);
        }
        $message_subject = $subject;
    }
    // Preview
    if (!sizeof($error) && $preview) {
        $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);
        $preview_signature = $user->data['user_sig'];
        $preview_signature_uid = $user->data['user_sig_bbcode_uid'];
        $preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield'];
        // Signature
        if ($enable_sig && $config['allow_sig'] && $preview_signature) {
            $parse_sig = new parse_message($preview_signature);
            $parse_sig->bbcode_uid = $preview_signature_uid;
开发者ID:Voxel37,项目名称:phpbb,代码行数:67,代码来源:ucp_pm_compose.php


示例6: main

    function main($id, $mode)
    {
        global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $ultimate_points, $points_config, $points_values, $auth, $checked_user, $check_auth;
        add_form_key('transfer_user');
        // Grab the message variable
        $message = request_var('comment', '', true);
        // Check, if transferring is allowed
        if (!$points_config['transfer_enable']) {
            $message = $user->lang['TRANSFER_REASON_TRANSFER'] . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
            trigger_error($message);
        }
        // Check, if user is allowed to use the transfer module
        if (!$auth->acl_get('u_use_transfer')) {
            $message = $user->lang['NOT_AUTHORISED'] . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
            trigger_error($message);
        }
        // Add part to bar
        $template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user"), 'FORUM_NAME' => sprintf($user->lang['TRANSFER_TITLE'], $config['points_name'])));
        if (isset($_POST['submit'])) {
            if (!check_form_key('transfer_user')) {
                trigger_error('FORM_INVALID');
            }
            // Grab need variables for the transfer
            $am = round(request_var('amount', 0.0), 2);
            $comment = request_var('comment', '', true);
            $username1 = request_var('username', '', true);
            $username = strtolower($username1);
            // Select the user data to transfer to
            $sql = 'SELECT *
				FROM ' . USERS_TABLE . "\n\t\t\t\tWHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'\n\t\t\t\t\tAND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
            $result = $db->sql_query($sql);
            $transfer_user = $db->sql_fetchrow($result);
            $db->sql_freeresult($result);
            if ($transfer_user == NULL) {
                $message = $user->lang['TRANSFER_NO_USER_RETURN'] . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
                trigger_error($message);
            }
            // Select the old user_points from user_id to transfer to
            $sql_array = array('SELECT' => 'user_points', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . (int) $transfer_user['user_id']);
            $sql = $db->sql_build_query('SELECT', $sql_array);
            $result = $db->sql_query($sql);
            $transfer_user_old_points = (int) $db->sql_fetchfield('user_points');
            $db->sql_freeresult($result);
            // Check, if the sender has enough cash
            if ($user->data['user_points'] < $am) {
                $message = sprintf($user->lang['TRANSFER_REASON_MINPOINTS'], $config['points_name']) . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
                trigger_error($message);
            }
            // Check, if the amount is 0 or below
            if ($am <= 0) {
                $message = sprintf($user->lang['TRANSFER_REASON_UNDERZERO'], $config['points_name']) . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
                trigger_error($message);
            }
            // Check, if user is trying to send to himself
            if ($user->data['user_id'] == $transfer_user['user_id']) {
                $message = sprintf($user->lang['TRANSFER_REASON_YOURSELF'], $config['points_name']) . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
                trigger_error($message);
            }
            // Add cash to receiver
            add_points($transfer_user['user_id'], $am);
            // Remove cash from sender
            substract_points($user->data['user_id'], $am);
            // Get current time for log
            $current_time = time();
            // Add transferring information to the log
            $text = utf8_normalize_nfc($message);
            $sql = 'INSERT INTO ' . POINTS_LOG_TABLE . ' ' . $db->sql_build_array('INSERT', array('point_send' => (int) $user->data['user_id'], 'point_recv' => (int) $transfer_user['user_id'], 'point_amount' => $am, 'point_sendold' => $user->data['user_points'], 'point_recvold' => $transfer_user_old_points, 'point_comment' => $text, 'point_type' => '1', 'point_date' => $current_time));
            $db->sql_query($sql);
            // Send pm to receiver, if PM is enabled
            if (!$points_config['transfer_pm_enable'] == 0 && $transfer_user['user_allow_pm']) {
                // Select the receiver language
                $transfer_user['user_lang'] = file_exists($phpbb_root_path . 'language/' . $transfer_user['user_lang'] . "/mods/points.{$phpEx}") ? $transfer_user['user_lang'] : $config['default_lang'];
                // load receivers language
                include $phpbb_root_path . 'language/' . basename($transfer_user['user_lang']) . "/mods/points.{$phpEx}";
                $points_name = $config['points_name'];
                $comment = $db->sql_escape($comment);
                $pm_subject = utf8_normalize_nfc(sprintf($lang['TRANSFER_PM_SUBJECT']));
                $pm_text = utf8_normalize_nfc(sprintf($lang['TRANSFER_PM_BODY'], $am, $points_name, $text));
                $poll = $uid = $bitfield = $options = '';
                generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
                generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
                $pm_data = array('address_list' => array('u' => array($transfer_user['user_id'] => 'to')), 'from_user_id' => $user->data['user_id'], 'from_username' => $user->data['username'], 'icon_id' => 0, 'from_user_ip' => '', 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $pm_text, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid);
                submit_pm('post', $pm_subject, $pm_data, false);
            }
            // Change $username back to regular username
            $sql_array = array('SELECT' => 'username', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . (int) $transfer_user['user_id']);
            $sql = $db->sql_build_query('SELECT', $sql_array);
            $result = $db->sql_query($sql);
            $show_user = $db->sql_fetchfield('username');
            $db->sql_freeresult($result);
            // Add log entry to inform the admin too
            add_log('user', $user->data['username'], 'LOG_USER_TRANSFER', $user->data['username'], $show_user, number_format_points($am), $config['points_name']);
            // Show the successful transfer message
            $message = sprintf($user->lang['TRANSFER_REASON_TRANSUCC'], number_format_points($am), $config['points_name'], $show_user) . '<br /><br /><a href="' . append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user") . '">&laquo; ' . $user->lang['BACK_TO_PREV'] . '</a>';
            trigger_error($message);
            $template->assign_vars(array('U_ACTION' => $this->u_action));
        }
        $template->assign_vars(array('USER_POINTS' => sprintf(number_format_points($checked_user['user_points'])), 'POINTS_NAME' => $config['points_name'], 'POINTS_COMMENTS' => $points_config['comments_enable'] ? true : false, 'LOTTERY_NAME' => $points_values['lottery_name'], 'BANK_NAME' => $points_values['bank_name'], 'L_TRANSFER_DESCRIPTION' => sprintf($user->lang['TRANSFER_DESCRIPTION'], $config['points_name']), 'U_TRANSFER_USER' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=transfer_user"), 'U_LOGS' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=logs"), 'U_LOTTERY' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=lottery"), 'U_BANK' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=bank"), 'U_ROBBERY' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=robbery"), 'U_INFO' => append_sid("{$phpbb_root_path}points.{$phpEx}", "mode=info"), 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=searchuser&amp;form=post&amp;field=username&amp;select_single=true"), 'U_USE_TRANSFER' => $auth->acl_get('u_use_transfer'), 'U_USE_LOGS' => $auth->acl_get('u_use_logs'), 'U_USE_LOTTERY' => $auth->acl_get('u_use_lottery'), 'U_USE_BANK' => $auth->acl_get('u_use_bank'), 'U_USE_ROBBERY' => $auth->acl_get('u_use_robbery'), 'S_ALLOW_SEND_PM' => $auth->acl_get('u_sendpm')));
        // Generate the page
        page_header(sprintf($user->lang['TRANSFER_TITLE'], $config['points_name']));
//.........这里部分代码省略.........
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:101,代码来源:points_transfer_user.php


示例7: submit

 /**
  * Submits the pm to the database.
  */
 function submit()
 {
     global $user, $db;
     if (!$this->msg_id) {
         //new message, set some default values if not set yet
         if (!$this->author_id) {
             $this->author_id = $user->data['user_id'];
         }
         if (!$this->author_ip) {
             $this->author_ip = $user->ip;
         }
         if (!$this->message_time) {
             $this->message_time = time();
         }
     }
     $this->message_subject = truncate_string($this->message_subject);
     if ($user->data['user_id'] == $this->author_id) {
         $author_username = $user->data['username'];
     } else {
         $sql = 'SELECT username FROM ' . USERS_TABLE . ' WHERE user_id=' . $this->author_id;
         $result = $db->sql_query($sql);
         $row = $db->sql_fetchrow($result);
         if (!$row) {
             trigger_error('NO_USER', E_USER_ERROR);
         }
         $author_username = $row['username'];
     }
     $message = $this->message_text;
     $bbcode_uid = $bbcode_bitfield = $options = '';
     generate_text_for_storage($message, $bbcode_uid, $bbcode_bitfield, $options, $this->enable_bbcode, $this->enable_magic_url, $this->enable_smilies);
     $data = array('msg_id' => (int) $this->msg_id, 'from_user_id' => (int) $this->author_id, 'from_user_ip' => $this->author_ip, 'from_username' => $author_username, 'reply_from_root_level' => $this->root_level, 'reply_from_msg_id' => $this->reply_from_msg_id, 'icon_id' => (int) $this->icon_id, 'enable_sig' => (bool) $this->enable_sig, 'enable_bbcode' => (bool) $this->enable_bbcode, 'enable_smilies' => (bool) $this->enable_smilies, 'enable_urls' => (bool) $this->enable_magic_url, 'bbcode_bitfield' => $bbcode_bitfield, 'bbcode_uid' => $bbcode_uid, 'message' => $message, 'attachment_data' => false, 'filename_data' => false, 'address_list' => $this->address_list);
     $mode = $this->msg_id ? 'edit' : ($this->reply_from_msg_id ? 'reply' : 'post');
     submit_pm($mode, $this->message_subject, $data);
     $this->msg_id = $data['msg_id'];
 }
开发者ID:gn36,项目名称:phpbb-oo-posting-api,代码行数:38,代码来源:privmsg.php


示例8: handle_subscription

/**
* handles sending subscription notices for blogs or replies
*
* Sends a PM or Email to each user in the subscription list, depending on what they want
*
* @param string $mode The mode (new_blog, or new_reply)
* @param string $post_subject The subject of the post made
* @param int|bool $uid The user_id of the user who made the new blog (if there is one).  If this is left as 0 it will grab the global value of $user_id.
* @param int|bool $bid The blog_id of the blog.  If this is left as 0 it will grab the global value of $blog_id.
* @param int|bool $rid The reply_id of the new reply (if there is one).  If this is left as 0 it will grab the global value of $reply_id.
*/
function handle_subscription($mode, $post_subject, $uid = 0, $bid = 0, $rid = 0)
{
    global $db, $user, $phpbb_root_path, $phpEx, $config;
    global $user_id, $blog_id, $reply_id;
    global $blog_data, $blog_urls;
    // if $uid, $bid, or $rid are not set, use the globals
    $uid = $uid != 0 ? $uid : $user_id;
    $bid = $bid != 0 ? $bid : $blog_id;
    $rid = $rid != 0 ? $rid : $reply_id;
    // make sure that subscriptions are enabled and that a blog_id is sent
    if (!$config['user_blog_subscription_enabled'] || $bid == 0) {
        return;
    }
    if (!isset($user->lang['BLOG_SUBSCRIPTION_NOTICE'])) {
        $user->add_lang('mods/blog/posting');
    }
    // This will hold all the send info, all ones that will be sent via PM would be $send[1], or Email would be $send[2], next would be $send[4], etc.
    $send = array();
    $subscribe_modes = get_blog_subscription_types();
    $temp = compact('mode', 'post_subject', 'uid', 'bid', 'rid', 'send');
    blog_plugins::plugin_do_ref('function_handle_subscription', $temp);
    extract($temp);
    // Fix the URLs...
    if (isset($config['user_blog_seo']) && $config['user_blog_seo']) {
        $view_url = $rid ? blog_url($uid, $bid, $rid) : blog_url($uid, $bid);
        $unsubscribe_url = $rid ? blog_url($uid, $bid, false, array('page' => 'unsubscribe')) : blog_url($uid, false, false, array('page' => 'unsubscribe'));
    } else {
        $view_url = redirect($rid ? blog_url($uid, $bid, $rid) : blog_url($uid, $bid), true);
        $unsubscribe_url = redirect($rid ? blog_url($uid, $bid, false, array('page' => 'unsubscribe')) : blog_url($uid, false, false, array('page' => 'unsubscribe')), true);
    }
    if ($mode == 'new_reply' && $rid != 0) {
        $sql = 'SELECT * FROM ' . BLOGS_SUBSCRIPTION_TABLE . '
			WHERE blog_id = ' . intval($bid) . '
			AND sub_user_id != ' . $user->data['user_id'];
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            if (!array_key_exists($row['sub_type'], $send)) {
                $send[$row['sub_type']] = array($row['sub_user_id']);
            } else {
                $send[$row['sub_type']][] = $row['sub_user_id'];
            }
        }
        $db->sql_freeresult($result);
        $message = sprintf($user->lang['BLOG_SUBSCRIPTION_NOTICE'], $view_url, $user->data['username'], $unsubscribe_url);
    } else {
        if ($mode == 'new_blog' && $uid != 0) {
            $sql = 'SELECT * FROM ' . BLOGS_SUBSCRIPTION_TABLE . '
			WHERE user_id = ' . intval($uid) . '
			AND sub_user_id != ' . $user->data['user_id'];
            $result = $db->sql_query($sql);
            while ($row = $db->sql_fetchrow($result)) {
                if (!array_key_exists($row['sub_type'], $send)) {
                    $send[$row['sub_type']] = array($row['sub_user_id']);
                } else {
                    $send[$row['sub_type']][] = $row['sub_user_id'];
                }
            }
            $db->sql_freeresult($result);
            $message = sprintf($user->lang['USER_SUBSCRIPTION_NOTICE'], $user->data['username'], $view_url, $unsubscribe_url);
        }
    }
    $blog_data->get_user_data($config['user_blog_message_from']);
    // Send the PM
    if (isset($send[1]) && sizeof($send[1])) {
        if (!function_exists('submit_pm')) {
            // include the private messages functions page
            include "{$phpbb_root_path}includes/functions_privmsgs.{$phpEx}";
        }
        if (!class_exists('parse_message')) {
            include "{$phpbb_root_path}includes/message_parser.{$phpEx}";
        }
        $message_parser = new parse_message();
        $message_parser->message = $message;
        $message_parser->parse(true, true, true);
        // setup out to address list
        $address_list = array();
        foreach ($send[1] as $id) {
            $address_list[$id] = 'to';
        }
        $pm_data = array('from_user_id' => $config['user_blog_message_from'], 'from_username' => blog_data::$user[$config['user_blog_message_from']]['username'], 'address_list' => array('u' => $address_list), 'icon_id' => 10, 'from_user_ip' => '0.0.0.0', 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $message_parser->message, 'bbcode_bitfield' => $message_parser->bbcode_bitfield, 'bbcode_uid' => $message_parser->bbcode_uid);
        submit_pm('post', $user->lang['SUBSCRIPTION_NOTICE'], $pm_data, false);
        unset($message_parser, $address_list, $pm_data);
    }
    // Send the email
    if (isset($send[2]) && sizeof($send[2]) && $config['email_enable']) {
        if (!class_exists('messenger')) {
            include "{$phpbb_root_path}includes/functions_messenger.{$phpEx}";
        }
        $messenger = new messenger(false);
//.........这里部分代码省略.........
开发者ID:EXreaction,项目名称:User-Blog-Mod,代码行数:101,代码来源:functions_posting.php


示例9: run_lottery

    /**
     * Run Lottery
     */
    function run_lottery()
    {
        $current_time = time();
        /**
         * Read out config values
         */
        $sql = 'SELECT *
				FROM ' . $this->points_values_table;
        $result = $this->db->sql_query($sql);
        $points_values = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        // Count number of tickets
        $sql_array = array('SELECT' => 'COUNT(ticket_id) AS num_tickets', 'FROM' => array($this->points_lottery_tickets_table => 'l'));
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query($sql);
        $total_tickets = (int) $this->db->sql_fetchfield('num_tickets');
        $this->db->sql_freeresult($result);
        // Select a random user from tickets table
        $sql_layer = $this->db->get_sql_layer();
        switch ($sql_layer) {
            case 'postgres':
                $order_by = 'RANDOM()';
                break;
            case 'mssql':
            case 'mssql_odbc':
                $order_by = 'NEWID()';
                break;
            default:
                $order_by = 'RAND()';
                break;
        }
        $sql_array = array('SELECT' => '*', 'FROM' => array($this->points_lottery_tickets_table => 'l'), 'ORDER_BY' => $order_by);
        $sql = $this->db->sql_build_query('SELECT', $sql_array);
        $result = $this->db->sql_query_limit($sql, 1);
        $random_user_by_tickets = (int) $this->db->sql_fetchfield('user_id');
        $this->db->sql_freeresult($result);
        if ($total_tickets > 0) {
            // Genarate a random number
            $rand_base = $points_values['lottery_chance'];
            $rand_value = rand(0, 100);
            // Decide, if the user really wins
            if ($rand_value <= $rand_base) {
                $winning_number = $random_user_by_tickets;
                // Select a winner from ticket table
                $sql_array = array('SELECT' => '*', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . $winning_number);
                $sql = $this->db->sql_build_query('SELECT', $sql_array);
                $result = $this->db->sql_query($sql);
                $winner = $this->db->sql_fetchrow($result);
                $this->db->sql_freeresult($result);
                // Check if lottery is enabled and prepare winner informations
                $sql = 'SELECT lottery_enable
						FROM ' . $this->points_config_table;
                $result = $this->db->sql_query($result);
                $lottery_enabled = $this->db->sql_fetchfield('lottery_enable');
                $this->db->sql_freeresult($result);
                if ($lottery_enabled != 0) {
                    $winnings_update = $winner['user_points'] + $this->points_values('lottery_jackpot');
                    $this->set_points($winner['user_id'], $winnings_update);
                    $winner_notification = $this->number_format_points($points_values['lottery_jackpot']) . ' ' . $this->config['points_name'] . ' ';
                    $winner_deposit = $this->user->lang['LOTTERY_PM_CASH_ENABLED'];
                    $amount_won = $points_values['lottery_jackpot'];
                } else {
                    $winner_notification = '';
                    $winner_deposit = '';
                    $amount_won = '';
                }
                // Update previous winner information
                $this->set_points_values('lottery_prev_winner', "'" . $winner['username'] . "'");
                $this->set_points_values('lottery_prev_winner_id', $winner['user_id']);
                // Check, if user wants to be informed by PM
                if ($winner['user_allow_pm'] == 1) {
                    $sql_array = array('SELECT' => '*', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . $points_values['lottery_pm_from']);
                    $sql = $this->db->sql_build_query('SELECT', $sql_array);
                    $result = $this->db->sql_query($sql);
                    $pm_sender = $this->db->sql_fetchrow($result);
                    $this->db->sql_freeresult($result);
                    // Notify the lucky winner by PM
                    $pm_subject = utf8_normalize_nfc($this->user->lang['LOTTERY_PM_SUBJECT']);
                    $pm_text = utf8_normalize_nfc(sprintf($this->user->lang['LOTTERY_PM_BODY'], $winner_notification, $winner_deposit));
                    $poll = $uid = $bitfield = $options = '';
                    generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
                    generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
                    $pm_data = array('address_list' => array('u' => array($winner['user_id'] => 'to')), 'from_user_id' => $points_values['lottery_pm_from'] == 0 ? $winner['user_id'] : $pm_sender['user_id'], 'from_username' => $points_values['lottery_pm_from'] == 0 ? $this->user->lang['LOTTERY_PM_COMMISION'] : $pm_sender['username'], 'icon_id' => 0, 'from_user_ip' => '', 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $pm_text, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid);
                    submit_pm('post', $pm_subject, $pm_data, false);
                }
                // Add new winner to lottery history
                $sql = 'INSERT INTO ' . $this->points_lottery_history_table . ' ' . $this->db->sql_build_array('INSERT', array('user_id' => (int) $winner['user_id'], 'user_name' => $winner['username'], 'time' => $current_time, 'amount' => $points_values['lottery_jackpot']));
                $this->db->sql_query($sql);
                // Update winners total
                $this->set_points_values('lottery_winners_total', $points_values['lottery_winners_total'] + 1);
                // Add jackpot to winner
                $this->add_points((int) $winner['user_id'], $points_values['lottery_jackpot']);
                // Reset jackpot
                $this->set_points_values('lottery_jackpot', $points_values['lottery_base_amount']);
            } else {
                $this->set_points_values('lottery_jackpot', $points_values['lottery_jackpot'] + $points_values['lottery_base_amount']);
                $no_winner = 0;
//.........这里部分代码省略.........
开发者ID:rampmaster,项目名称:Ultimate-Points-Extension,代码行数:101,代码来源:functions_points.php


示例10: main


//.........这里部分代码省略.........
                 $db->sql_freeresult($result);
                 if (sizeof($user_ids)) {
                     if ($func == 'add') {
                         $sql = "UPDATE " . USERS_TABLE . "\n                SET user_points = user_points + {$group_transfer_points}\n                WHERE " . $db->sql_in_set('user_id', $user_ids);
                         add_log('admin', 'LOG_GROUP_TRANSFER_ADD');
                     }
                     if ($func == 'substract') {
                         $sql = "UPDATE " . USERS_TABLE . "\n                SET user_points = user_points - {$group_transfer_points}\n                WHERE " . $db->sql_in_set('user_id', $user_ids);
                         add_log('admin', 'LOG_GROUP_TRANSFER_ADD');
                     }
                     if ($func == 'set') {
                         $sql = "UPDATE " . USERS_TABLE . "\n                SET user_points = {$group_transfer_points}\n                WHERE " . $db->sql_in_set('user_id', $user_ids);
                         add_log('admin', 'LOG_GROUP_TRANSFER_SET');
                     }
                     $result = $db->sql_query($sql);
                     // Send PM, if pm subject and pm comment is entered
                     if ($pm_subject != '' || $pm_text != '') {
                         if ($pm_subject == '' || $pm_text == '') {
                             trigger_error($user->lang['POINTS_GROUP_TRANSFER_PM_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
                         } else {
                             $sql_array = array('SELECT' => 'user_id, group_id', 'FROM' => array(USER_GROUP_TABLE => 'g'), 'WHERE' => 'user_pending <> ' . TRUE . '
                 AND group_id = ' . (int) $group_id);
                             $sql = $db->sql_build_query('SELECT', $sql_array);
                             $result = $db->sql_query($sql);
                             $group_to = array();
                             while ($row = $db->sql_fetchrow($result)) {
                                 $group_to[$row['group_id']] = 'to';
                             }
                             $poll = $uid = $bitfield = $options = '';
                             generate_text_for_storage($pm_subject, $uid, $bitfield, $options, false, false, false);
                             generate_text_for_storage($pm_text, $uid, $bitfield, $options, true, true, true);
                             include $phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx;
                             $pm_data = array('address_list' => array('g' => $group_to), 'from_user_id' => $user->data['user_id'], 'from_username' => 'Points Transfer', 'icon_id' => 0, 'from_user_ip' => $user->data['user_ip'], 'enable_bbcode' => true, 'enable_smilies' => true, 'enable_urls' => true, 'enable_sig' => true, 'message' => $pm_text, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid);
                             submit_pm('post', $pm_subject, $pm_data, false);
                             $db->sql_freeresult($result);
                         }
                         $message = $user->lang['POINTS_GROUP_TRANSFER_PM_SUCCESS'] . adm_back_link($this->u_action);
                         trigger_error($message);
                     } else {
                         $message = $user->lang['POINTS_GROUP_TRANSFER_SUCCESS'] . adm_back_link($this->u_action);
                         trigger_error($message);
                     }
                 }
             }
             // phpBB Gallery integration
             if (isset($config['gallery_total_images'])) {
                 $template->assign_vars(array('S_GALLERY_EXIST' => true, 'POINTS_NAME' => $config['points_name']));
             }
             $template->assign_vars(array('S_POINTS_MAIN' => true, 'S_POINTS_ACTIVATED' => $config['points_enable'] ? true : false, 'U_ACTION' => $this->u_action));
             break;
         case 'lottery':
             $this->page_title = 'ACP_POINTS_LOTTERY_TITLE';
             $this->tpl_name = 'acp_points_lottery';
             $action = request_var('action', '');
             $submit = request_var('submit', '');
             $lottery_data = $errors = array();
             if ($submit) {
                 if (!check_form_key('acp_points')) {
                     trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
                 }
                 // Get current lottery_base_amount
                 $current_lottery_jackpot = $points_values['lottery_jackpot'];
                 $current_lottery_base_amount = $points_values['lottery_base_amount'];
                 // Values for phpbb_points_config
                 $lottery_enable = request_var('lottery_enable', 0);
                 $lottery_multi_ticket_enable = request_var('lottery_multi_ticket_enable', 0);
开发者ID:FifoF,项目名称:phpbb3.1_ultimate_points,代码行数:67,代码来源:points_module.php


示例11: award_medal

 private function award_medal($medals, $medal_id, $user_id, $message, $time, $points = 0, $update = 0)
 {
     generate_text_for_storage($message, $this->uid, $this->bitfield, $this->m_flags, $this->allow_bbcode, $this->allow_urls, $this->allow_smilies);
     if ($update > 0) {
         $sql_ary = array('medal_id' => $medal_id, 'user_id' => $user_id, 'nominated' => 0, 'nominated_reason' => $message, 'points' => $points, 'time' => $time, 'bitfield' => $this->bitfield, 'bbuid' => $this->uid);
         $sql = "UPDATE " . $this->tb_medals_awarded . " SET " . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\tWHERE id = {$update}\n\t\t\t\t\tLIMIT 1";
         $this->db->sql_query($sql);
         $sql = "SELECT awarder_id, awarder_un, awarder_color\n\t\t\t\t\tFROM " . $this->tb_medals_awarded . "\n\t\t\t\t\tWHERE id = {$update}\n\t\t\t\t\tLIMIT 1";
         $result = $this->db->sql_query($sql);
         $row = $this->db->sql_fetchrow($result);
         $this->db->sql_freeresult($result);
         $color = $row['awarder_color'] != "" ? '[color=#' . $row['awarder_color'] . ']' . $row['awarder_un'] . '[/color]' : $row['awarder_un'];
     } else {
         $sql_ary = array('medal_id' => $medal_id, 'user_id' => $user_id, 'awarder_id' => $this->user->data['user_id'], 'awarder_un' => $this->user->data['username'], 'awarder_color' => $this->user->data['user_colour'], 'nominated' => 0, 'nominated_reason' => $message, 'points' => $points, 'time' => $time, 'bitfield' => $this->bitfield, 'bbuid' => $this->uid);
         $sql = "INSERT INTO " . $this->tb_medals_awarded . " " . $this->db->sql_build_array('INSERT', $sql_ary);
         $color = $this->user->data['user_colour'] ? '[color=#' . $this->user->data['user_colour'] . ']' . $this->user->data['username'] . '[/color]' : $this->user->data['username'];
     }
     $result = $this->db->sql_query($sql);
     $message = generate_text_for_edit($message, $this->uid, $this->m_flags);
     $message = isset($message['text']) ? $message['text'] : '';
     if ($result && $this->config['points_enable'] == 1) {
         $sql = "UPDATE " . USERS_TABLE . " \n\t\t\t\tSET medal_user_points = user_points + {$points}\n\t\t\t\tWHERE user_id = {$user_id}";
         $this->db->sql_query($sql);
     }
     $message2 = sprintf($this->user->lang['PM_MESSAGE'], '[img]' . $medals[$medal_id]['image'] . '[/img]', $medals[$medal_id]['name'], $color);
     $message2 .= $message;
     if ($this->config['points_enable'] == 1) {
         if ($points < 0) {
             $plural = $points < -1 ? 's' : '';
             $message2 .= sprintf($this->user->lang['PM_MESSAGE_POINTS_DEDUCT'], $points * -1, $plural);
         } else {
             if ($points > 0) {
                 $plural = $points > 1 ? 's' : '';
                 $message2 .= sprintf($this->user->lang['PM_MESSAGE_POINTS_EARN'], $points, $plural);
             }
         }
     }
     generate_text_for_storage($message2, $this->uid, $this->bitfield, $this->m_flags, $this->allow_bbcode, $this->allow_urls, $this->allow_smilies);
     $this->user->add_lang('ucp');
     include_once $this->phpbb_root_path . 'includes/functions_privmsgs.' . $this->php_ext;
     $pm_data = array('address_list' => array('u' => array($user_id => 'to')), 'from_user_id' => $this->user->data['user_id'], 'from_user_ip' => $this->user->data['user_ip'], 'from_username' => $this->user->data['username'], 'enable_sig' => false, 'enable_bbcode' => $this->allow_bbcode, 'enable_smilies' => $this->allow_smilies, 'enable_urls' => $this->allow_urls, 'icon_id' => 0, 'bbcode_bitfield' => $this->bitfield, 'bbcode_uid' => $this->uid, 'message' => $message2);
     $subject = sprintf($this->user->lang['PM_MSG_SUBJECT'], $this->user->data['username']);
     submit_pm('post', $subject, $pm_data, false);
     return;
 }
开发者ID:emmea90,项目名称:medals,代码行数:45,代码来源:medals.php


示例12: send_notify_edit_meeting

该文章已有0人参与评论

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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