$toobig = qa_image_file_too_big($_FILES['avatar_default_file']['tmp_name'], qa_opt('avatar_store_size')); if ($toobig) { $errors['avatar_default_show'] = qa_lang_sub('main/image_too_big_x_pc', (int) ($toobig * 100)); } else { $imagedata = qa_image_constrain_data(file_get_contents($_FILES['avatar_default_file']['tmp_name']), $width, $height, qa_opt('avatar_store_size')); if (isset($imagedata)) { require_once QA_INCLUDE_DIR . 'qa-app-blobs.php'; $newblobid = qa_create_blob($imagedata, 'jpeg'); if (isset($newblobid)) { qa_set_option('avatar_default_blobid', $newblobid); qa_set_option('avatar_default_width', $width); qa_set_option('avatar_default_height', $height); qa_set_option('avatar_default_show', 1); } if (strlen($oldblobid)) { qa_delete_blob($oldblobid); } } else { $errors['avatar_default_show'] = qa_lang_sub('main/image_not_read', implode(', ', qa_gd_image_formats())); } } } } } // Mailings management if ($adminsection == 'mailing') { if (qa_clicked('domailingtest') || qa_clicked('domailingstart') || qa_clicked('domailingresume') || qa_clicked('domailingcancel')) { if (!qa_check_form_security_code('admin/' . $adminsection, qa_post_text('code'))) { $securityexpired = true; } else { if (qa_clicked('domailingtest')) {
foreach ($userfields as $userfield) { $inprofile[$userfield['fieldid']] = qa_post_text('field_' . $userfield['fieldid']); } if (!qa_check_form_security_code('user-edit-' . $handle, qa_post_text('code'))) { $errors['page'] = qa_lang_html('misc/form_security_again'); $userediting = true; } else { if (qa_post_text('removeavatar')) { qa_db_user_set_flag($userid, QA_USER_FLAGS_SHOW_AVATAR, false); qa_db_user_set_flag($userid, QA_USER_FLAGS_SHOW_GRAVATAR, false); if (isset($useraccount['avatarblobid'])) { require_once QA_INCLUDE_DIR . 'qa-app-blobs.php'; qa_db_user_set($userid, 'avatarblobid', null); qa_db_user_set($userid, 'avatarwidth', null); qa_db_user_set($userid, 'avatarheight', null); qa_delete_blob($useraccount['avatarblobid']); } } if ($fieldseditable) { $filterhandle = $handle; // we're not filtering the handle... $errors = qa_handle_email_filter($filterhandle, $inemail, $useraccount); unset($errors['handle']); // ...and we don't care about any errors in it if (!isset($errors['email'])) { if ($inemail != $useraccount['email']) { qa_db_user_set($userid, 'email', $inemail); qa_db_user_set_flag($userid, QA_USER_FLAGS_EMAIL_CONFIRMED, false); } } if (count($inprofile)) {
function qa_set_user_avatar($userid, $imagedata, $oldblobid = null) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } require_once QA_INCLUDE_DIR . 'util/image.php'; $imagedata = qa_image_constrain_data($imagedata, $width, $height, qa_opt('avatar_store_size')); if (isset($imagedata)) { require_once QA_INCLUDE_DIR . 'app/blobs.php'; $newblobid = qa_create_blob($imagedata, 'jpeg', null, $userid, null, qa_remote_ip_address()); if (isset($newblobid)) { qa_db_user_set($userid, 'avatarblobid', $newblobid); qa_db_user_set($userid, 'avatarwidth', $width); qa_db_user_set($userid, 'avatarheight', $height); qa_db_user_set_flag($userid, QA_USER_FLAGS_SHOW_AVATAR, true); qa_db_user_set_flag($userid, QA_USER_FLAGS_SHOW_GRAVATAR, false); if (isset($oldblobid)) { qa_delete_blob($oldblobid); } return true; } } return false; }