示例#1
0
/**
 * @deprecated #0015627
 */
function AddOpinion($source_uid, $dest_uid, $message, $rating, $counter, $from = 'frl')
{
    return false;
    $source_uid = get_uid(false);
    $objResponse = new xajaxResponse();
    $message = trim($message);
    if (!in_array($rating, array(-1, 0, 1))) {
        $objResponse->assign('rating_error', 'innerHTML', 'Вы не выбрали категорию отзыва');
    } elseif (opinions::CheckUserCanPost($source_uid, $dest_uid) != 0) {
        // левый пользователь
    } elseif ($message == '') {
        $objResponse->script("opinionFormError('error_msg');");
    } elseif (strlen($message) > opinions::$opinion_max_length) {
        $objResponse->script("opinionMaxLengthError('msg', " . opinions::$opinion_max_length . ');');
    } else {
        $message = str_replace('&', '&', $message);
        $message = stripslashes($message);
        $message = change_q_x($message, FALSE, TRUE, '', false, false);
        $error = opinions::NewMsg($source_uid, $dest_uid, $message, $rating, getRemoteIP(), $new_id);
        if (!$error) {
            $msg = opinions::GetLastMessage($source_uid, $dest_uid);
            if ($msg) {
                $user = new users();
                $user->GetUserByUID($dest_uid);
                $objResponse->remove('form_container');
                if (is_emp() && $from == 'frl' || !is_emp() && $from == 'emp') {
                    $from = $from == 'frl' ? 'emp' : 'frl';
                    $objResponse->redirect("/users/{$user->login}/opinions/?from={$from}#o_{$new_id}");
                    return $objResponse;
                }
                $objResponse->prepend('messages_container', 'innerHTML', opinions::printTheme($msg, $from, $counter, $user));
                $objResponse->prepend('messages_container', 'innerHTML', opinions::printAddForm($source_uid, $dest_uid, $from));
                $nt = $rating == 1 ? 'plus' : ($rating == -1 ? 'minus' : 'neitral');
                $objResponse->call('opinionChConuters', NULL, 'ops-' . $from . $nt);
                $objResponse->script("opinionCheckMaxLengthStop('msg');");
                $objResponse->assign('no_messages', 'innerHTML', '');
            } else {
                $objResponse->script("alert('" . serialize($msg) . "')");
            }
        } else {
            $objResponse->script("alert('" . $error . "')");
        }
    }
    return $objResponse;
}