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


PHP user_avatar_delete函数代码示例

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


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

示例1: make_bbcode_uid

 if ($signature != '') {
     if (strlen($signature) > $board_config['max_sig_chars']) {
         $error = TRUE;
         $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Signature_too_long'];
     }
     if ($signature_bbcode_uid == '') {
         $signature_bbcode_uid = $allowbbcode ? make_bbcode_uid() : '';
     }
     $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
 }
 if ($website != '') {
     rawurlencode($website);
 }
 $avatar_sql = '';
 if (isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile') {
     $avatar_sql = user_avatar_delete($userdata['user_avatar_type'], $userdata['user_avatar']);
 }
 if ((!empty($user_avatar_upload) || !empty($user_avatar_name)) && $board_config['allow_avatar_upload']) {
     if (!empty($user_avatar_upload)) {
         $avatar_mode = !empty($user_avatar_name) ? 'local' : 'remote';
         $avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
     } else {
         if (!empty($user_avatar_name)) {
             $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
             $error = true;
             $error_msg .= (!empty($error_msg) ? '<br />' : '') . $l_avatar_size;
         }
     }
 } else {
     if ($user_avatar_remoteurl != '' && $board_config['allow_avatar_remote']) {
         if (@file_exists(@phpbb_realpath('./' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'])) && $userdata['user_avatar_type'] == USER_AVATAR_UPLOAD) {
开发者ID:BackupTheBerlios,项目名称:domsmod-svn,代码行数:31,代码来源:usercp_register.php

示例2: user_avatar_upload


//.........这里部分代码省略.........
        }
        $avatar_filesize = $file_data1[1];
        $avatar_filetype = $file_data2[1];
        if (!$error && $avatar_filesize > 0 && $avatar_filesize < $board_config['avatar_filesize']) {
            $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);
            $tmp_path = !@$ini_val('safe_mode') ? '/tmp' : './' . $board_config['avatar_path'] . '/tmp';
            $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');
            $fptr = @fopen($tmp_filename, 'wb');
            $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
            @fclose($fptr);
            if ($bytes_written != $avatar_filesize) {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, 'Could not write avatar file to local storage. Please contact the board administrator with this message', '', __LINE__, __FILE__);
            }
            list($width, $height, $type) = @getimagesize($tmp_filename);
        } else {
            $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
            $error = true;
            $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
        }
    } else {
        if (file_exists(@phpbb_realpath($avatar_filename)) && preg_match('/\\.(jpg|jpeg|gif|png)$/i', $avatar_realname)) {
            if ($avatar_filesize <= $board_config['avatar_filesize'] && $avatar_filesize > 0) {
                preg_match('#image\\/[x\\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
                $avatar_filetype = $avatar_filetype[1];
            } else {
                $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
                $error = true;
                $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
                return;
            }
            list($width, $height, $type) = @getimagesize($avatar_filename);
        }
    }
    if (!($imgtype = check_image_type($avatar_filetype, $error, $error_msg))) {
        return;
    }
    switch ($type) {
        // GIF
        case 1:
            if ($imgtype != '.gif') {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
            }
            break;
            // JPG, JPC, JP2, JPX, JB2
        // JPG, JPC, JP2, JPX, JB2
        case 2:
        case 9:
        case 10:
        case 11:
        case 12:
            if ($imgtype != '.jpg' && $imgtype != '.jpeg') {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
            }
            break;
            // PNG
        // PNG
        case 3:
            if ($imgtype != '.png') {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
            }
            break;
        default:
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
    }
    if ($width > 0 && $height > 0 && $width <= $board_config['avatar_max_width'] && $height <= $board_config['avatar_max_height']) {
        $new_filename = uniqid(rand()) . $imgtype;
        if ($mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '') {
            user_avatar_delete($current_type, $current_avatar);
        }
        if ($avatar_mode == 'remote') {
            @copy($tmp_filename, './' . $board_config['avatar_path'] . "/{$new_filename}");
            @unlink($tmp_filename);
        } else {
            if (@$ini_val('open_basedir') != '') {
                if (@phpversion() < '4.0.3') {
                    message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                }
                $move_file = 'move_uploaded_file';
            } else {
                $move_file = 'copy';
            }
            if (!is_uploaded_file($avatar_filename)) {
                message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
            }
            $move_file($avatar_filename, './' . $board_config['avatar_path'] . "/{$new_filename}");
        }
        @chmod('./' . $board_config['avatar_path'] . "/{$new_filename}", 0777);
        $avatar_sql = $mode == 'editprofile' ? ", user_avatar = '{$new_filename}', user_avatar_type = " . USER_AVATAR_UPLOAD : "'{$new_filename}', " . USER_AVATAR_UPLOAD;
    } else {
        $l_avatar_size = sprintf($lang['Avatar_imagesize'], $board_config['avatar_max_width'], $board_config['avatar_max_height']);
        $error = true;
        $error_msg = !empty($error_msg) ? $error_msg . '<br />' . $l_avatar_size : $l_avatar_size;
    }
    return $avatar_sql;
}
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:101,代码来源:usercp_avatar.php

示例3: make_bbcode_uid

             }
         }
     }
 }
 if ($signature != '') {
     if (strlen($signature) > $board_config['max_sig_chars']) {
         $error = TRUE;
         $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Signature_too_long'];
     }
     if ($signature_bbcode_uid == '') {
         $signature_bbcode_uid = $allowbbcode ? make_bbcode_uid() : '';
     }
     $signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
 }
 if (isset($HTTP_POST_VARS['avatardel']) && $mode == 'editprofile') {
     $avatar_sql = user_avatar_delete($userdata['avatar_type'], $userdata['avatar_file']);
 } else {
     if ((!empty($user_avatar_upload) || !empty($user_avatar_name)) && $board_config['allow_avatar_upload']) {
         if (!empty($user_avatar_upload)) {
             $avatar_mode = !empty($user_avatar_name) ? 'local' : 'remote';
             $avatar_sql = user_avatar_upload($mode, $avatar_mode, $userdata['user_avatar'], $userdata['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
         } else {
             if (!empty($user_avatar_name)) {
                 $l_avatar_size = sprintf($lang['Avatar_filesize'], round($board_config['avatar_filesize'] / 1024));
                 $error = true;
                 $error_msg .= (!empty($error_msg) ? '<br />' : '') . $l_avatar_size;
             }
         }
     } else {
         if ($user_avatar_remoteurl != '' && $board_config['allow_avatar_remote']) {
             $avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
开发者ID:noikiy,项目名称:owaspbwa,代码行数:31,代码来源:usercp_register.php

示例4: user_avatar_delete

 if (isset($_POST['avatardel']) && $mode == 'editprofile') {
     $avatar_sql = user_avatar_delete($user->data['user_avatar_type'], $user->data['user_avatar']);
 } elseif ((!empty($user_avatar_upload) || !empty($user_avatar_name)) && $config['allow_avatar_upload']) {
     if (!empty($user_avatar_upload)) {
         $avatar_mode = empty($user_avatar_name) ? 'remote' : 'local';
         $avatar_sql = user_avatar_upload($mode, $avatar_mode, $user->data['user_avatar'], $user->data['user_avatar_type'], $error, $error_msg, $user_avatar_upload, $user_avatar_name, $user_avatar_size, $user_avatar_filetype);
     } elseif (!empty($user_avatar_name)) {
         $l_avatar_size = sprintf($lang['Avatar_filesize'], round($config['avatar_filesize'] / 1024));
         $error = true;
         $error_msg .= (!empty($error_msg) ? '<br />' : '') . $l_avatar_size;
     }
 } elseif ($user_avatar_remoteurl != '' && $config['allow_avatar_remote']) {
     user_avatar_delete($user->data['user_avatar_type'], $user->data['user_avatar']);
     $avatar_sql = user_avatar_url($mode, $error, $error_msg, $user_avatar_remoteurl);
 } elseif ($user_avatar_local != '' && $config['allow_avatar_local']) {
     user_avatar_delete($user->data['user_avatar_type'], $user->data['user_avatar']);
     $avatar_sql = user_avatar_gallery($mode, $error, $error_msg, $user_avatar_local, $user_avatar_category);
 } elseif ($user_avatar_generator != '' && $config['allow_avatar_generator']) {
     if (@file_exists(@phpbb_realpath('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']))) {
         @unlink(@phpbb_realpath('./' . $config['avatar_path'] . '/' . $user->data['user_avatar']));
     }
     $avatar_sql = user_avatar_generator($mode, $error, $error_msg, $user_avatar_generator);
 } elseif ($user_gravatar != '' && $config['enable_gravatars']) {
     $avatar_sql = $mode == 'editprofile' ? ", user_avatar = '" . $db->sql_escape($user_gravatar) . "', user_avatar_type = " . USER_GRAVATAR : '';
 }
 // Start add - Gender Mod
 if ($config['gender_required']) {
     if (!$gender) {
         $error = true;
         $error_msg .= (isset($error_msg) ? '<br />' : '') . $lang['Gender_require'];
     }
开发者ID:GabrielAnca,项目名称:icy_phoenix,代码行数:31,代码来源:usercp_register.php

示例5: user_avatar_upload


//.........这里部分代码省略.........
            }
            break;
            // JPG, JPC, JP2, JPX, JB2
        // JPG, JPC, JP2, JPX, JB2
        case 2:
        case 9:
        case 10:
        case 11:
        case 12:
            if ($imgtype != '.jpg' && $imgtype != '.jpeg') {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, $lang['UNABLE_TO_UPLOAD_AVATAR'], '', __LINE__, __FILE__);
            }
            break;
            // PNG
        // PNG
        case 3:
            if ($imgtype != '.png') {
                @unlink($tmp_filename);
                message_die(GENERAL_ERROR, $lang['UNABLE_TO_UPLOAD_AVATAR'], '', __LINE__, __FILE__);
            }
            break;
        default:
            @unlink($tmp_filename);
            message_die(GENERAL_ERROR, $lang['UNABLE_TO_UPLOAD_AVATAR'], '', __LINE__, __FILE__);
    }
    // Automatic Avatar Resize - BEGIN
    // If you want tu use Avatar Resize function, you have to change the line below and decomment the block named AUTOMATIC AVATAR RESIZE some lines below.
    //if ($width > 0 && $height > 0)
    // Automatic Avatar Resize - END
    if ($width > 0 && $height > 0 && $width <= $config['avatar_max_width'] && $height <= $config['avatar_max_height']) {
        $new_filename = uniqid(rand()) . $imgtype;
        if ($mode == 'editprofile' && $current_type == USER_AVATAR_UPLOAD && $current_avatar != '') {
            user_avatar_delete($current_type, $current_avatar);
        }
        if ($avatar_mode == 'remote') {
            @copy($tmp_filename, './' . $config['avatar_path'] . "/{$new_filename}");
            @unlink($tmp_filename);
        } else {
            if (@$ini_val('open_basedir') != '') {
                if (@phpversion() < '4.0.3') {
                    message_die(GENERAL_ERROR, 'open_basedir is set and your PHP version does not allow move_uploaded_file', '', __LINE__, __FILE__);
                }
                $move_file = 'move_uploaded_file';
            } else {
                $move_file = 'copy';
            }
            if (!is_uploaded_file($avatar_filename)) {
                message_die(GENERAL_ERROR, 'Unable to upload file', '', __LINE__, __FILE__);
            }
            $move_file($avatar_filename, './' . $config['avatar_path'] . "/{$new_filename}");
        }
        @chmod('./' . $config['avatar_path'] . "/{$new_filename}", 0777);
        // Automatic Avatar Resize - BEGIN
        /*
        if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
        {
        	$width_old = $width;
        	$height_old = $height;
        	if ($width > $config['avatar_max_width'])
        	{
        		$height = ($config['avatar_max_width'] / $width) * $height;
        		$width = $config['avatar_max_width'];
        	}
        	if ($height > $config['avatar_max_height'])
        	{
开发者ID:ALTUN69,项目名称:icy_phoenix,代码行数:67,代码来源:usercp_avatar.php


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