Exemplo n.º 1
0
     $info = opinions::GetMsgComInfo($id_edit);
     $com_msg = $theme;
     $medit = $info['opinion_id'];
     if (!$uid) {
         $ecom_error_flag = 1;
     }
     if (!$theme) {
         $ecom_error_flag = 1;
         $com_alert[2] = "Поле заполнено некорректно";
     }
     if (strlen($_POST['comment']) > 3000) {
         $ecom_error_flag = 1;
         $com_alert[2] = "Слишком большой комментарий. Допускается не более 3000 знаков";
     }
     if (!$ecom_error_flag) {
         $error .= opinions::editCommentOpinion($theme, $uid, $id_edit);
         unset($theme);
         unset($action);
     }
     break;
 case "change":
     $theme = substr(change_q_x($_POST['msg'], false, false, 'br|b|i'), 0, 2000);
     $rating = intval($_POST['rating']);
     if ($rating !== -1 && $rating !== 0 && $rating !== 1) {
         header("Location: /404.php");
         exit;
     }
     $msgid = intval($_POST['msgid']);
     if ($_SESSION['uid'] && $msgid) {
         if ($theme || $attach['name']) {
             $error = opinions::Edit($_SESSION['uid'], $msgid, $theme, $rating, getRemoteIP(), hasPermissions('users'));
Exemplo n.º 2
0
function EditOpinionComm($op_id, $comm_id, $text, $from = 'frl', $isFeedback = false)
{
    @session_start();
    $objResponse = new xajaxResponse();
    $text = trim($text);
    if ($text == '') {
        $objResponse->script("opinionCommentFormError('{$op_id}');");
    } elseif (strlen(stripslashes($text)) > opinions::$comment_max_length) {
        $objResponse->script("opinionMaxLengthError('edit_comm_{$op_id}', " . opinions::$comment_max_length . ');');
    } else {
        if ($isFeedback) {
            $msg = sbr_meta::getFeedback($op_id, true);
        } else {
            $msg = opinions::GetMessageById($op_id);
        }
        $text = str_replace('&', '&', $text);
        $text = stripslashes($text);
        $text = change_q_x($text, FALSE, TRUE, '', false, false);
        $prefix = $isFeedback ? 'feedback_' : '';
        if ((int) $comm_id > 0) {
            // Редактируем
            if ($isFeedback) {
                opinions::editCommentFeedback($text, get_uid(false), $comm_id, $msg['fromuser_id']);
            } else {
                opinions::editCommentOpinion($text, get_uid(false), $comm_id);
            }
            $objResponse->script("\$('" . $prefix . "comment_content_{$op_id}').setStyle('display', '');\n                                  \$('" . $prefix . "opinion_btn_edit_comment_{$op_id}').setProperty('disabled', '');\n                              \$('" . $prefix . "ed_comm_form_{$op_id}').dispose();");
            //$objResponse->assign($prefix . "comment_text_{$op_id}", "innerHTML", $text);
            $html = opinions::printCommentOpinions($op_id, $isFeedback);
            $objResponse->script("\$('" . $prefix . "comment_cont_{$op_id}').empty()");
            $objResponse->append($prefix . "comment_cont_{$op_id}", 'innerHTML', $html);
        } else {
            // Добавляем
            if ($isFeedback) {
                opinions::newCommentFeedback($text, get_uid(false), $op_id);
            } else {
                opinions::newCommentOpinion($text, get_uid(false), $op_id);
            }
            $html = opinions::printCommentOpinions($op_id, $isFeedback);
            $objResponse->script("\$('" . $prefix . "ed_comm_form_{$op_id}').dispose();");
            $objResponse->append($prefix . "comment_cont_{$op_id}", 'innerHTML', $html);
        }
        $objResponse->script("opinionCheckMaxLengthStop('" . $prefix . "edit_comm_{$op_id}');");
    }
    return $objResponse;
}