.
// TODO: the following is organized in a funky way. Clean it up
require_once("../inc/profile.inc");
require_once("../inc/akismet.inc");
if (DISABLE_PROFILES) error_page("Profiles are disabled");
check_get_args(array());
// output a select form item with the given name,
// from a list of newline-delineated items from the text file.
// If $selection is provided, and if it matches one of the entries in the file,
// it will be selected by default.
//
function show_combo_box($name, $filename, $selection=null) {
echo "\n";
fclose($file);
}
function show_picture_option($profile) {
row1(tra("Picture"));
$warning = "";
if (profile_screening() && $profile->has_picture) {
$warning = offensive_profile_warning($profile->verification);
}
if (($profile) && ($profile->has_picture)) {
echo "
" .tra("%1 Your profile picture is shown to the left.", $warning) ."
".
tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB") ."
".
tra("To remove it from your profile, check this box:") . "
";
rowify(" ");
end_table();
echo "";
} else {
rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB") . "
");
rowify(" ");
}
}
function show_language_selection($profile) {
if (!file_exists(LANGUAGE_FILE)) {
return;
}
row1(tra("Language"));
echo "
" .
tra("Select the language in which your profile is written:") . "
\n";
}
function show_submit() {
row1(tra("Submit profile"));
$config = get_config();
$publickey = parse_config($config, "");
if ($publickey) {
table_row(recaptcha_get_html($publickey));
}
table_row("
");
}
// Returns an array containing:
// [0]: The original image refered to by $fileName if its dimensions are
// less than MAX_IMG_WIDTH x MAX_IMG_HEIGHT, or a version scaled to
// those dimensions if it was too large.
// [1]: A scaled version of the above.
function getImages($fileName) {
$size = getImageSize($fileName);
// Determine if the filetype uploaded is supported.
// TODO: Change these to constants.
switch($size[2]) {
case '2': // JPEG
$image = imageCreateFromJPEG($fileName);
break;
case '3': // PNG
$image = imageCreateFromPNG($fileName);
break;
default:
error_page(tra("The format of your uploaded image is not supported."));
}
$width = $size[0];
$height = $size[1];
$smallImage = scale_image($image, $width, $height, SMALL_IMG_WIDTH, SMALL_IMG_HEIGHT);
if ($width > MAX_IMG_WIDTH || $height > MAX_IMG_HEIGHT) {
$image = scale_image($image, $width, $height, MAX_IMG_WIDTH, MAX_IMG_HEIGHT);
}
/*
echo "