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

PHP avatar_delete函数代码示例

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

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



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

示例1: main


//.........这里部分代码省略.........
                                    $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                                    $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
                                    $messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($user_row['username'])));
                                    $messenger->send(NOTIFY_EMAIL);
                                }
                            }
                            $message = $user_row['user_type'] == USER_INACTIVE ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED';
                            $log = $user_row['user_type'] == USER_INACTIVE ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE';
                            add_log('admin', $log, $user_row['username']);
                            add_log('user', $user_id, $log . '_USER');
                            trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id));
                            break;
                        case 'delsig':
                            if (!check_form_key($form_name)) {
                                trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
                            }
                            $sql_ary = array('user_sig' => '', 'user_sig_bbcode_uid' => '', 'user_sig_bbcode_bitfield' => '');
                            $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
                            $db->sql_query($sql);
                            add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']);
                            add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER');
                            trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
                            break;
                        case 'delavatar':
                            if (!check_form_key($form_name)) {
                                trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING);
                            }
                            $sql_ary = array('user_avatar' => '', 'user_avatar_type' => 0, 'user_avatar_width' => 0, 'user_avatar_height' => 0);
                            $sql = 'UPDATE ' . USERS_TABLE . '
								SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "\n\t\t\t\t\t\t\t\tWHERE user_id = {$user_id}";
                            $db->sql_query($sql);
                            // Delete old avatar if present
                            if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) {
                                avatar_delete('user', $user_row);
                            }
                            add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']);
                            add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER');
                            trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
                            break;
                        case 'delposts':
                            if (confirm_box(true)) {
                                // Delete posts, attachments, etc.
                                delete_posts('poster_id', $user_id);
                                add_log('admin', 'LOG_USER_DEL_POSTS', $user_row['username']);
                                trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id));
                            } else {
                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true)));
                            }
                            break;
                        case 'delattach':
                            if (confirm_box(true)) {
                                delete_attachments('user', $user_id);
                                add_log('admin', 'LOG_USER_DEL_ATTACH', $user_row['username']);
                                trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
                            } else {
                                confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array('u' => $user_id, 'i' => $id, 'mode' => $mode, 'action' => $action, 'update' => true)));
                            }
                            break;
                        case 'deloutbox':
                            if (confirm_box(true)) {
                                $msg_ids = array();
                                $lang = 'EMPTY';
                                $sql = 'SELECT msg_id
									FROM ' . PRIVMSGS_TO_TABLE . "\n\t\t\t\t\t\t\t\t\tWHERE author_id = {$user_id}\n\t\t\t\t\t\t\t\t\t\tAND folder_id = " . PRIVMSGS_OUTBOX;
                                $result = $db->sql_query($sql);
                                if ($row = $db->sql_fetchrow($result)) {
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_users.php


示例2: main


//.........这里部分代码省略.........
                                        $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                        list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                        $submit_ary['avatar'] = $category . '/' . $avatar_select;
                                    }
                                } else {
                                    if ($delete) {
                                        $submit_ary['avatar'] = '';
                                        $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                                    } else {
                                        if ($data['width'] && $data['height']) {
                                            // Only update the dimensions?
                                            if ($config['avatar_max_width'] || $config['avatar_max_height']) {
                                                if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                                    $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                                }
                                            }
                                            if (!sizeof($error)) {
                                                if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                                    if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                                        $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                                    }
                                                }
                                            }
                                            if (!sizeof($error)) {
                                                $submit_ary['avatar_width'] = $data['width'];
                                                $submit_ary['avatar_height'] = $data['height'];
                                            }
                                        }
                                    }
                                }
                            }
                            if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && !isset($group_row['group_avatar']) || $delete) {
                                if (isset($group_row['group_avatar']) && $group_row['group_avatar']) {
                                    avatar_delete('group', $group_row, true);
                                }
                            }
                            if (!check_form_key('ucp_groups')) {
                                $error[] = $user->lang['FORM_INVALID'];
                            }
                            if (!sizeof($error)) {
                                // Only set the rank, colour, etc. if it's changed or if we're adding a new
                                // group. This prevents existing group members being updated if no changes
                                // were made.
                                $group_attributes = array();
                                $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit', 'max_recipients');
                                foreach ($test_variables as $test) {
                                    if ($action == 'add' || isset($submit_ary[$test]) && $group_row['group_' . $test] != $submit_ary[$test]) {
                                        $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
                                    }
                                }
                                if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) {
                                    $cache->destroy('sql', GROUPS_TABLE);
                                    $message = $action == 'edit' ? 'GROUP_UPDATED' : 'GROUP_CREATED';
                                    trigger_error($user->lang[$message] . $return_page);
                                }
                            }
                            if (sizeof($error)) {
                                $group_rank = $submit_ary['rank'];
                                $group_desc_data = array('text' => $group_desc, 'allow_bbcode' => $allow_desc_bbcode, 'allow_smilies' => $allow_desc_smilies, 'allow_urls' => $allow_desc_urls);
                            }
                        } else {
                            if (!$group_id) {
                                $group_name = utf8_normalize_nfc(request_var('group_name', '', true));
                                $group_desc_data = array('text' => '', 'allow_bbcode' => true, 'allow_smilies' => true, 'allow_urls' => true);
                                $group_rank = 0;
                                $group_type = GROUP_OPEN;
开发者ID:html,项目名称:PI,代码行数:67,代码来源:ucp_groups.php


示例3: js_goto

    }
    if (!$avatar_error) {
        if ($avatar_sql) {
            $db->update("{$dbprefix}{$type}");
            $db->set("{$avatar_sql}");
            $db->where("id = {$id}");
            $db->exec();
        }
        if ($op_old == 'galerie') {
            echo "<script>this.opener.location=this.opener.location;this.close();</script>";
        } else {
            js_goto("?page=avatars&id={$id}&mode={$mode}");
        }
    }
} elseif ($op == "delete") {
    $avatar_sql = avatar_delete($ficheX->avatar_type, $ficheX->avatar);
    $db->update("{$dbprefix}{$type}");
    $db->set("{$avatar_sql}");
    $db->where("id = {$id}");
    $db->exec();
    js_goto("?page=avatars&id={$id}&mode={$mode}");
} elseif ($op == "galerie") {
    $dir = @opendir($config['avatars_path'] . '/gallerie');
    $avatar_images = array();
    while ($file = @readdir($dir)) {
        if ($file != '.' && $file != '..' && !is_file($config['avatars_path'] . '/gallerie/' . $file) && !is_link($config['avatars_path'] . '/gallerie/' . $file)) {
            $i = 0;
            $sub_dir = @opendir($config['avatars_path'] . '/gallerie/' . $file);
            while ($sub_file = @readdir($sub_dir)) {
                if (preg_match('/(\\.gif$|\\.png$|\\.jpg|\\.jpeg)$/is', $sub_file)) {
                    $avatar_images[$file][$i] = $file . '/' . $sub_file;
开发者ID:Arnaud-Burn,项目名称:phpTournois,代码行数:31,代码来源:avatars.php


示例4: user_delete

/**
 * Remove User
 *
 * @param string	$mode		Either 'retain' or 'remove'
 * @param mixed		$user_ids	Either an array of integers or an integer
 * @param bool		$retain_username
 * @return bool
 */
function user_delete($mode, $user_ids, $retain_username = true)
{
    global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container;
    global $phpbb_root_path, $phpEx;
    $db->sql_transaction('begin');
    $user_rows = array();
    if (!is_array($user_ids)) {
        $user_ids = array($user_ids);
    }
    $user_id_sql = $db->sql_in_set('user_id', $user_ids);
    $sql = 'SELECT *
		FROM ' . USERS_TABLE . '
		WHERE ' . $user_id_sql;
    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)) {
        $user_rows[(int) $row['user_id']] = $row;
    }
    $db->sql_freeresult($result);
    if (empty($user_rows)) {
        return false;
    }
    /**
     * Event before a user is deleted
     *
     * @event core.delete_user_before
     * @var	string	mode		Mode of deletion (retain/delete posts)
     * @var	array	user_ids	IDs of the deleted user
     * @var	mixed	retain_username	True if username should be retained
     *				or false if not
     * @since 3.1.0-a1
     */
    $vars = array('mode', 'user_ids', 'retain_username');
    extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars)));
    // Before we begin, we will remove the reports the user issued.
    $sql = 'SELECT r.post_id, p.topic_id
		FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
		WHERE ' . $db->sql_in_set('r.user_id', $user_ids) . '
			AND p.post_id = r.post_id';
    $result = $db->sql_query($sql);
    $report_posts = $report_topics = array();
    while ($row = $db->sql_fetchrow($result)) {
        $report_posts[] = $row['post_id'];
        $report_topics[] = $row['topic_id'];
    }
    $db->sql_freeresult($result);
    if (sizeof($report_posts)) {
        $report_posts = array_unique($report_posts);
        $report_topics = array_unique($report_topics);
        // Get a list of topics that still contain reported posts
        $sql = 'SELECT DISTINCT topic_id
			FROM ' . POSTS_TABLE . '
			WHERE ' . $db->sql_in_set('topic_id', $report_topics) . '
				AND post_reported = 1
				AND ' . $db->sql_in_set('post_id', $report_posts, true);
        $result = $db->sql_query($sql);
        $keep_report_topics = array();
        while ($row = $db->sql_fetchrow($result)) {
            $keep_report_topics[] = $row['topic_id'];
        }
        $db->sql_freeresult($result);
        if (sizeof($keep_report_topics)) {
            $report_topics = array_diff($report_topics, $keep_report_topics);
        }
        unset($keep_report_topics);
        // Now set the flags back
        $sql = 'UPDATE ' . POSTS_TABLE . '
			SET post_reported = 0
			WHERE ' . $db->sql_in_set('post_id', $report_posts);
        $db->sql_query($sql);
        if (sizeof($report_topics)) {
            $sql = 'UPDATE ' . TOPICS_TABLE . '
				SET topic_reported = 0
				WHERE ' . $db->sql_in_set('topic_id', $report_topics);
            $db->sql_query($sql);
        }
    }
    // Remove reports
    $db->sql_query('DELETE FROM ' . REPORTS_TABLE . ' WHERE ' . $user_id_sql);
    $num_users_delta = 0;
    // Get auth provider collection in case accounts might need to be unlinked
    $provider_collection = $phpbb_container->get('auth.provider_collection');
    // Some things need to be done in the loop (if the query changes based
    // on which user is currently being deleted)
    $added_guest_posts = 0;
    foreach ($user_rows as $user_id => $user_row) {
        if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == 'avatar.driver.upload') {
            avatar_delete('user', $user_row);
        }
        // Unlink accounts
        foreach ($provider_collection as $provider_name => $auth_provider) {
            $provider_data = $auth_provider->get_auth_link_data($user_id);
            if ($provider_data !== null) {
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:functions_user.php


示例5: while

            if ($config['asacp_ocban_move_to_group']) {
                $sql = 'SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = ' . $user_id;
                $result = $db->sql_query($sql);
                while ($row = $db->sql_fetchrow($result)) {
                    group_user_del($row['group_id'], array($user_id), array($username));
                }
                $db->sql_freeresult($result);
                group_user_add($config['asacp_ocban_move_to_group'], array($user_id), array($username), false, true);
            }
            // Delete the user's posts
            if ($config['asacp_ocban_delete_posts']) {
                delete_posts('poster_id', $user_id);
            }
            // Delete the user's avatar
            if ($config['asacp_ocban_delete_avatar'] && $user_row['user_avatar']) {
                avatar_delete('user', $user_row, true);
            }
            // Delete the user's signature
            if ($config['asacp_ocban_delete_signature']) {
                $sql = 'UPDATE ' . USERS_TABLE . '
					SET ' . $db->sql_build_array('UPDATE', array('user_sig' => '', 'user_sig_bbcode_uid' => '', 'user_sig_bbcode_bitfield' => '')) . '
					WHERE user_id = ' . $user_id;
                $db->sql_query($sql);
            }
            // Delete the user's blog
            if ($config['asacp_ocban_blog'] && file_exists($phpbb_root_path . 'blog/includes/functions_admin.' . $phpEx)) {
                if (!function_exists('blog_delete_user')) {
                    include $phpbb_root_path . 'blog/includes/functions_admin.' . $phpEx;
                }
                blog_delete_user($user_id);
            }
开发者ID:esacinc,项目名称:forum-sitplatform-org-website,代码行数:31,代码来源:index.php


示例6: main


//.........这里部分代码省略.........
                    $submit_ary = array('colour' => request_var('group_colour', ''), 'rank' => request_var('group_rank', 0), 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, 'legend' => isset($_REQUEST['group_legend']) ? 1 : 0, 'message_limit' => request_var('group_message_limit', 0));
                    if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink']) {
                        $data['width'] = request_var('width', '');
                        $data['height'] = request_var('height', '');
                        // Avatar stuff
                        $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                        if (!($error = validate_data($data, $var_ary))) {
                            $data['user_id'] = "g{$group_id}";
                            if ((!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl']) && $can_upload) {
                                list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_upload($data, $error);
                            } else {
                                if ($data['remotelink']) {
                                    list($submit_ary['avatar_type'], $submit_ary['avatar'], $submit_ary['avatar_width'], $submit_ary['avatar_height']) = avatar_remote($data, $error);
                                }
                            }
                        }
                    } else {
                        if ($avatar_select && $config['allow_avatar_local']) {
                            // check avatar gallery
                            if (is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                $submit_ary['avatar'] = $category . '/' . $avatar_select;
                            }
                        } else {
                            if ($delete) {
                                $submit_ary['avatar'] = '';
                                $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                            }
                        }
                    }
                    if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && (!isset($group_row['group_avatar']) || $group_row['group_avatar'] != $submit_ary['avatar']) || $delete) {
                        if (isset($group_row['group_avatar']) && $group_row['group_avatar']) {
                            avatar_delete($group_row['group_avatar']);
                        }
                    }
                    if (!sizeof($error)) {
                        // Only set the rank, colour, etc. if it's changed or if we're adding a new
                        // group. This prevents existing group members being updated if no changes
                        // were made.
                        $group_attributes = array();
                        $test_variables = array('rank', 'colour', 'avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'receive_pm', 'legend', 'message_limit');
                        foreach ($test_variables as $test) {
                            if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) {
                                $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
                            }
                        }
                        if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) {
                            $group_perm_from = request_var('group_perm_from', 0);
                            // Copy permissions?
                            if ($group_perm_from && $action == 'add') {
                                // From the mysql documentation:
                                // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14.
                                // Due to this we stay on the safe side if we do the insertion "the manual way"
                                // Copy permisisons from/to the acl groups table (only group_id gets changed)
                                $sql = 'SELECT forum_id, auth_option_id, auth_role_id, auth_setting
									FROM ' . ACL_GROUPS_TABLE . '
									WHERE group_id = ' . $group_perm_from;
                                $result = $db->sql_query($sql);
                                $groups_sql_ary = array();
                                while ($row = $db->sql_fetchrow($result)) {
                                    $groups_sql_ary[] = array('group_id' => (int) $group_id, 'forum_id' => (int) $row['forum_id'], 'auth_option_id' => (int) $row['auth_option_id'], 'auth_role_id' => (int) $row['auth_role_id'], 'auth_setting' => (int) $row['auth_setting']);
                                }
                                $db->sql_freeresult($result);
                                // Now insert the data
                                if (sizeof($groups_sql_ary)) {
开发者ID:yunsite,项目名称:gloryroad,代码行数:67,代码来源:acp_groups.php


示例7: main


//.........这里部分代码省略.........
                                $submit_ary['avatar_type'] = AVATAR_GALLERY;
                                list($submit_ary['avatar_width'], $submit_ary['avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $avatar_select);
                                $submit_ary['avatar'] = $category . '/' . $avatar_select;
                            }
                        } else {
                            if ($delete) {
                                $submit_ary['avatar'] = '';
                                $submit_ary['avatar_type'] = $submit_ary['avatar_width'] = $submit_ary['avatar_height'] = 0;
                            } else {
                                if ($data['width'] && $data['height']) {
                                    // Only update the dimensions?
                                    if ($config['avatar_max_width'] || $config['avatar_max_height']) {
                                        if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height']) {
                                            $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                        }
                                    }
                                    if (!sizeof($error)) {
                                        if ($config['avatar_min_width'] || $config['avatar_min_height']) {
                                            if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height']) {
                                                $error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
                                            }
                                        }
                                    }
                                    if (!sizeof($error)) {
                                        $submit_ary['avatar_width'] = $data['width'];
                                        $submit_ary['avatar_height'] = $data['height'];
                                    }
                                }
                            }
                        }
                    }
                    if (isset($submit_ary['avatar']) && $submit_ary['avatar'] && !isset($group_row['group_avatar']) || $delete) {
                        if (isset($group_row['group_avatar']) && $group_row['group_avatar']) {
                            avatar_delete('group', $group_row, true);
                        }
                    }
                    // Validate the length of "Maximum number of allowed recipients per private message" setting.
                    // We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value
                    // which is the lowest amongst DBMSes supported by phpBB3
                    if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215)))) {
                        // Replace "error" string with its real, localised form
                        $error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error));
                    }
                    if (!sizeof($error)) {
                        // Only set the rank, colour, etc. if it's changed or if we're adding a new
                        // group. This prevents existing group members being updated if no changes
                        // were made.
                        $group_attributes = array();
                        $test_variables = array('rank' => 'int', 'colour' => 'string', 'avatar' => 'string', 'avatar_type' => 'int', 'avatar_width' => 'int', 'avatar_height' => 'int', 'receive_pm' => 'int', 'legend' => 'int', 'message_limit' => 'int', 'max_recipients' => 'int', 'founder_manage' => 'int', 'skip_auth' => 'int');
                        foreach ($test_variables as $test => $type) {
                            if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test])) {
                                settype($submit_ary[$test], $type);
                                $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test];
                            }
                        }
                        if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) {
                            $group_perm_from = request_var('group_perm_from', 0);
                            // Copy permissions?
                            // If the user has the a_authgroups permission and at least one additional permission ability set the permissions are fully transferred.
                            // We do not limit on one auth category because this can lead to incomplete permissions being tricky to fix for the admin, roles being assigned or added non-default permissions.
                            // Since the user only has the option to copy permissions from non leader managed groups this seems to be a good compromise.
                            if ($group_perm_from && $action == 'add' && $auth->acl_get('a_authgroups') && $auth->acl_gets('a_aauth', 'a_fauth', 'a_mauth', 'a_uauth')) {
                                $sql = 'SELECT group_founder_manage
									FROM ' . GROUPS_TABLE . '
									WHERE group_id = ' . $group_perm_from;
                                $result = $db->sql_query($sql);
开发者ID:ubick,项目名称:lorekeepers.org,代码行数:67,代码来源:acp_groups.php


示例8: group_set_user_default

/**
* Set users default group
*/
function group_set_user_default($group_id, $user_id_ary, $group_attributes = false)
{
    global $db;
    if (!$user_id_ary) {
        return;
    }
    $attribute_ary = array('group_colour' => 'string', 'group_rank' => 'int', 'group_avatar' => 'string', 'group_avatar_type' => 'int', 'group_avatar_width' => 'int', 'group_avatar_height' => 'int');
    $sql_ary = array('group_id' => $group_id);
    // Were group attributes passed to the function? If not we need to obtain them
    if ($group_attributes === false) {
        $sql = 'SELECT ' . implode(', ', array_keys($attribute_ary)) . '
			FROM ' . GROUPS_TABLE . "\n\t\t\tWHERE group_id = {$group_id}";
        $result = $db->sql_query($sql);
        $group_attributes = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
    }
    foreach ($attribute_ary as $attribute => $type) {
        if (isset($group_attributes[$attribute])) {
            // If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set...
            if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) {
                continue;
            }
            settype($group_attributes[$attribute], $type);
            $sql_ary[str_replace('group_', 'user_', $attribute)] = $group_attributes[$attribute];
        }
    }
    // Before we update the user attributes, we will make a list of those having now the group avatar assigned
    if (in_array('user_avatar', array_keys($sql_ary))) {
        // Ok, get the original avatar data from users having an uploaded one (we need to remove these from the filesystem)
        $sql = 'SELECT user_id, user_avatar
			FROM ' . USERS_TABLE . '
			WHERE user_id IN (' . implode(', ', $user_id_ary) . ')
				AND user_avatar_type = ' . AVATAR_UPLOAD;
        $result = $db->sql_query($sql);
        while ($row = $db->sql_fetchrow($result)) {
            avatar_delete($row['user_avatar']);
        }
        $db->sql_freeresult($result);
    }
    $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
		WHERE user_id IN (' . implode(', ', $user_id_ary) . ')';
    $db->sql_query($sql);
}
开发者ID:yunsite,项目名称:gloryroad,代码行数:46,代码来源:functions_user.php


示例9: elseif

                } elseif ($delete) {
                    $filename = '';
                    $type = $width = $height = 0;
                } else {
                    $error[] = 'IM_LOST';
                }
            }
            if (empty($error)) {
                $sql_ary = array('user_avatar' => (string) $filename, 'user_avatar_type' => (int) $type, 'user_avatar_width' => (int) $width, 'user_avatar_height' => (int) $height);
                $sql = 'UPDATE ' . CORE_USERS_TABLE . ' 
					SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
					WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                $_CLASS['core_db']->sql_query($sql);
                /* Delete old avatar if present */
                if ($_CLASS['core_user']->data['user_avatar'] && $filename !== $_CLASS['core_user']->data['user_avatar'] && $_CLASS['core_user']->data['user_avatar_type'] != AVATAR_GALLERY) {
                    avatar_delete($_CLASS['core_user']->data['user_avatar']);
                }
                $_CLASS['core_user']->data += $sql_ary;
                unset($sql_ary);
                $_CLASS['core_display']->meta_refresh(3, generate_link($this->link));
                $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . generate_link($this->link) . '">', '</a>');
                trigger_error($message);
            }
            $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
        }
        // Generate users avatar
        $avatar_img = '';
        if ($_CLASS['core_user']->data['user_avatar']) {
            switch ($_CLASS['core_user']->data['user_avatar_type']) {
                case AVATAR_UPLOAD:
                    $avatar_img = $_CORE_CONFIG['global']['path_avatar_upload'] . '/';
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:31,代码来源:ucp_profile.php


示例10: ucp_profile


//.........这里部分代码省略.........
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '\\>', '</a>');
                        trigger_error($message);
                    }
                    // Replace "error" strings with their real, localised form
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                $signature_preview = '';
                if ($preview && $signature) {
                    // Now parse it for displaying
                    $signature_preview = $message_parser->format_display($enable_html, $enable_bbcode, $enable_urls, $enable_smilies, false);
                    unset($message_parser);
                }
                decode_message($signature, $_CLASS['core_user']->data['user_sig_bbcode_uid']);
                $_CLASS['core_template']->assign(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'SIGNATURE' => $signature, 'SIGNATURE_PREVIEW' => $signature_preview, 'S_HTML_CHECKED' => !$enable_html ? 'checked="checked"' : '', 'S_BBCODE_CHECKED' => !$enable_bbcode ? 'checked="checked"' : '', 'S_SMILIES_CHECKED' => !$enable_smilies ? 'checked="checked"' : '', 'S_MAGIC_URL_CHECKED' => !$enable_urls ? 'checked="checked"' : '', 'HTML_STATUS' => $config['allow_sig_html'] ? $_CLASS['core_user']->lang['HTML_IS_ON'] : $_CLASS['core_user']->lang['HTML_IS_OFF'], 'BBCODE_STATUS' => $config['allow_sig_bbcode'] ? sprintf($_CLASS['core_user']->lang['BBCODE_IS_ON'], '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>') : sprintf($_CLASS['core_user']->lang['BBCODE_IS_OFF'], '<a href="' . generate_link('Forums&amp;file=faq&amp;mode=bbcode') . '" target="_phpbbcode">', '</a>'), 'SMILIES_STATUS' => $config['allow_sig_smilies'] ? $_CLASS['core_user']->lang['SMILIES_ARE_ON'] : $_CLASS['core_user']->lang['SMILIES_ARE_OFF'], 'IMG_STATUS' => $config['allow_sig_img'] ? $_CLASS['core_user']->lang['IMAGES_ARE_ON'] : $_CLASS['core_user']->lang['IMAGES_ARE_OFF'], 'FLASH_STATUS' => $config['allow_sig_flash'] ? $_CLASS['core_user']->lang['FLASH_IS_ON'] : $_CLASS['core_user']->lang['FLASH_IS_OFF'], 'L_SIGNATURE_EXPLAIN' => sprintf($_CLASS['core_user']->lang['SIGNATURE_EXPLAIN'], $config['max_sig_chars']), 'S_HTML_ALLOWED' => $config['allow_sig_html'], 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies']));
                break;
            case 'avatar':
                $display_gallery = isset($_POST['display_gallery']);
                $folder = isset($_REQUEST['category']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_REQUEST['category']) : false;
                $delete = isset($_POST['delete']);
                // Can we upload?
                $can_upload = file_exists($config['avatar_path']) && is_writeable($config['avatar_path']) && @ini_get('file_uploads') ? true : false;
                if ($submit) {
                    $gallery_avatar = isset($_POST['avatarselect']) ? str_replace(array('../', '..\\', './', '.\\'), '', $_POST['avatarselect']) : false;
                    if ($config['allow_avatar_local'] && $gallery_avatar) {
                        if (!file_exists($config['avatar_gallery_path'] . '/' . $gallery_avatar)) {
                            $error[] = 'BAD_AVATAR';
                        } else {
                            $type = AVATAR_GALLERY;
                            $filename = $gallery_avatar;
                            list($width, $height) = getimagesize($config['avatar_gallery_path'] . '/' . $gallery_avatar);
                        }
                    } else {
                        $data['uploadurl'] = get_variable('uploadurl', 'POST', false);
                        $data['remotelink'] = get_variable('remotelink', 'POST', '');
                        $data['width'] = get_variable('width', 'POST', '');
                        $data['height'] = get_variable('height', 'POST', '');
                        $data['user_id'] = $_CLASS['core_user']->data['user_id'];
                        require_once $site_file_root . 'includes/forums/functions_user.php';
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } elseif ($data['remotelink'] && $config['allow_avatar_remote']) {
                            list($type, $filename, $width, $height) = avatar_remote($data, $error);
                        } elseif ($delete) {
                            $type = $filename = $width = $height = '';
                        } else {
                            $error[] = 'IM_LOST';
                        }
                    }
                    if (empty($error)) {
                        $sql_ary = array('user_avatar' => $filename, 'user_avatar_type' => $type, 'user_avatar_width' => $width, 'user_avatar_height' => $height);
                        $sql = 'UPDATE ' . USERS_TABLE . ' 
							SET ' . $_CLASS['core_db']->sql_build_array('UPDATE', $sql_ary) . ' 
							WHERE user_id = ' . $_CLASS['core_user']->data['user_id'];
                        $_CLASS['core_db']->sql_query($sql);
                        // Delete old avatar if present
                        if ($_CLASS['core_user']->data['user_avatar'] && $filename != $_CLASS['core_user']->data['user_avatar'] && $_CLASS['core_user']->data['user_avatar_type'] != AVATAR_GALLERY) {
                            avatar_delete($_CLASS['core_user']->data['user_avatar']);
                        }
                        $_CLASS['core_display']->meta_refresh(3, $module_link);
                        $message = $_CLASS['core_user']->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($_CLASS['core_user']->lang['RETURN_UCP'], '<a href="' . $module_link . '">', '</a>');
                        trigger_error($message);
                    }
                    $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$_CLASS['core_user']->lang['\\1'])) ? \$_CLASS['core_user']->lang['\\1'] : '\\1'", $error);
                }
                // Generate users avatar
                $avatar_img = '';
                if ($_CLASS['core_user']->data['user_avatar']) {
                    switch ($_CLASS['core_user']->data['user_avatar_type']) {
                        case AVATAR_UPLOAD:
                            $avatar_img = $config['avatar_path'] . '/';
                            break;
                        case AVATAR_GALLERY:
                            $avatar_img = $config['avatar_gallery_path'] . '/';
                            break;
                    }
                    $avatar_img .= $_CLASS['core_user']->data['user_avatar'];
                    $avatar_img = '<img src="' . $avatar_img . '" width="' . $_CLASS['core_user']->data['user_avatar_width'] . '" height="' . $_CLASS['core_user']->data['user_avatar_height'] . '" border="0" alt="" />';
                }
                $_CLASS['core_template']->assign(array('ERROR' => empty($error) ? '' : implode('<br />', $error), 'AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'S_FORM_ENCTYPE' => $can_upload ? ' enctype="multipart/form-data"' : '', 'L_AVATAR_EXPLAIN' => sprintf($_CLASS['core_user']->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024))));
                if ($display_gallery && $config['allow_avatar_local']) {
                    require_once $site_file_root . 'includes/functions_user.php';
                    $avatar_list = avatar_gallery($folder, $folders, $error);
                    array_unshift($folders, '');
                    $s_category_options = '';
                    foreach ($folders as $cat) {
                        $s_category_options .= '<option value="' . $cat . '"' . ($cat == $folder ? ' selected="selected"' : '') . '>' . ($cat ? $cat : '--') . '</option>';
                    }
                    $_CLASS['core_template']->assign(array('S_DISPLAY_GALLERY' => true, 'S_CAT_OPTIONS' => $s_category_options));
                    foreach ($avatar_list as $avatar) {
                        $_CLASS['core_template']->assign_vars_array('avatar', array('AVATAR_IMAGE' => $config['avatar_gallery_path'] . '/' . $avatar['file'], 'AVATAR_NAME' => $avatar['name'], 'AVATAR_FILE' => $avatar['file']));
                    }
                    unset($avatar_list);
                } else {
                    $_CLASS['core_template']->assign(array('AVATAR' => $avatar_img, 'AVATAR_SIZE' => $config['avatar_filesize'], 'WIDTH' => $_CLASS['core_user']->data['user_avatar_width'], 'HEIGHT' => $_CLASS['core_user']->data['user_avatar_height'], 'S_CAN_UPLOAD' => $can_upload, 'S_LINK_AVATAR' => $config['allow_avatar_remote'], 'S_GALLERY_AVATAR' => $config['allow_avatar_local']));
                }
                break;
        }
        $_CLASS['core_template']->assign_array(array('L_TITLE' => $_CLASS['core_user']->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $module_link));
        $this->display($_CLASS['core_user']->lang['UCP_PROFILE'], 'ucp_profile_' . $mode . '.html');
    }
开发者ID:BackupTheBerlios,项目名称:viperals-svn,代码行数:101,代码来源:ucp_profile.php


示例11: main


//.........这里部分代码省略.........
                $i = 0;
                while ($row = $db->sql_fetchrow($result)) {
                    $template->assign_block_vars('custom_tags', array('BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => 22 + $i * 2, 'BBCODE_TAG' => $row['bbcode_tag']));
                    $i++;
                }
                $db->sql_freeresult($result);
                break;
            case 'avatar':
                $display_gallery = isset($_POST['display_gallery']) ? true : false;
                $delete = isset($_POST['delete']) ? true : false;
                $avatar_select = basename(request_var('avatar_select', ''));
                $category = basename(request_var('category', ''));
                // Can we upload?
                $can_upload = $config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
                if ($submit) {
                    $var_ary = array('uploadurl' => (string) '', 'remotelink' => (string) '', 'width' => (string) '', 'height' => (string) '');
                    foreach ($var_ary as $var => $default) {
                        $data[$var] = request_var($var, $default);
                    }
                    $var_ary = array('uploadurl' => array('string', true, 5, 255), 'remotelink' => array('string', true, 5, 255), 'width' => array('string', true, 1, 3), 'height' => array('string', true, 1, 3));
                    $error = validate_data($data, $var_ary);
                    if (!sizeof($error)) {
                        $data['user_id'] = $user->data['user_id'];
                        if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) {
                            list($type, $filename, $width, $height) = avatar_upload($data, $error);
                        } else {
                            if ($data['remotelink'] && $auth->acl_get('u_chgavatar') && $config['allow_avatar_remote']) {
                                list($type, $filename, $width, $height) = avatar_remote($data, $error);
                            } else {
                                if ($avatar_select && $auth->acl_get('u_chgavatar') && $config['allow_avatar_local']) {
                                    $type = AVATAR_GALLERY;
                                    $filename = $avatar_select;
                                    // check avatar gallery
                                    if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category)) {
                                        $filename = '';
                                        $type = $width = $height = 0;
                                    } else {
                                        list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
                                        $filename = $category . '/' . $filename;
                                    }
                                } else {
                                    if ($delete && $auth->acl_get('u_chgavatar')) {
                                        $filename = '';
                                        $type = $width = $height = 0;
                                    } else {
                                        $data = array();
                                    }
                                }
                            }
                        }
                    }
                    if (!sizeof($error)) {
                        // Do  

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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