qa_redirect(qa_request()); } elseif (qa_clicked('doedit')) { qa_redirect(qa_request(), array('state' => 'edit')); } elseif (qa_clicked('dosave')) { require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php'; require_once QA_INCLUDE_DIR . 'qa-db-users.php'; $errors = array(); 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-db-blobs.php'; qa_db_user_set($userid, 'avatarblobid', null); qa_db_user_set($userid, 'avatarwidth', null); qa_db_user_set($userid, 'avatarheight', null); qa_db_blob_delete($useraccount['avatarblobid']); } } if ($fieldseditable) { $inemail = qa_post_text('email'); $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); } }
$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-db-blobs.php'; $newblobid = qa_db_blob_create($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_db_blob_delete($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')) { $email = qa_get_logged_in_email(); if (qa_mailing_send_one(qa_get_logged_in_userid(), qa_get_logged_in_handle(), $email, qa_get_logged_in_user_field('emailcode'))) { $formokhtml = qa_lang_html_sub('admin/test_sent_to_x', qa_html($email)); } else { $formokhtml = qa_lang_html('main/general_error');
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 . 'qa-util-image.php'; $imagedata = qa_image_constrain_data($imagedata, $width, $height, qa_opt('avatar_store_size')); if (isset($imagedata)) { require_once QA_INCLUDE_DIR . 'qa-db-blobs.php'; $newblobid = qa_db_blob_create($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_db_blob_delete($oldblobid); } return true; } } return false; }
function qa_delete_blob($blobid) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } require_once QA_INCLUDE_DIR . 'db/blobs.php'; if (defined('QA_BLOBS_DIRECTORY')) { $blob = qa_db_blob_read($blobid); if (isset($blob) && !isset($blob['content'])) { unlink(qa_get_blob_filename($blobid, $blob['format'])); } } qa_db_blob_delete($blobid); }