Пример #1
0
         unset($theme);
         unset($action);
     }
     break;
 */
 case "delete":
     $id = intval(trim($_GET['msg']));
     if ($id && $uid) {
         $error = opinions::DeleteMsg($uid, $id, hasPermissions('users'));
     }
     //header("Location: /blogs/viewgroup.php?gr=$gr&t=$t");
     break;
 case "delete_com":
     $id = intval(trim($_GET['msg']));
     if ($id && $uid) {
         $error = opinions::deleteComment($id, $uid, hasPermissions('users'));
     }
     break;
 case "cmtopinion":
     $id = intval($_POST['opid']);
     $theme = substr(change_q_x($_POST['comment'], false, false, 'br|b|i'), 0, 3000);
     if (!$uid) {
         $com_error_flag = 1;
     }
     if (!$theme) {
         $com_error_flag = 1;
         $com_alert[2] = "Поле заполнено некорректно";
     }
     if (strlen($_POST['comment']) > 3000) {
         $com_error_flag = 1;
         $com_alert[2] = "Слишком большой комментарий. Допускается не более 3000 знаков";
Пример #2
0
/**
 * удаляет комментарий к мнению, отзыву.
 *
 * @param type $op_id
 * @param type $comm_id
 * @param type $from
 * @param type $isFeedback если true - это отзыв
 *
 * @return \xajaxResponse
 */
function DeleteOpinionComm($op_id, $comm_id, $from = 'frl', $isFeedback = false)
{
    @session_start();
    $objResponse = new xajaxResponse();
    if ($isFeedback) {
        $msg = sbr_meta::getFeedback($op_id, true);
    } else {
        $msg = opinions::GetMessageById($op_id);
    }
    if (get_uid(0) == $msg['touser_id'] || hasPermissions('users')) {
        $error = opinions::deleteComment($comm_id, get_uid(false), hasPermissions('users'), $isFeedback);
    } else {
        $error = 'Вы не можете удалить комментарий.';
    }
    $prefix = $isFeedback ? 'feedback_' : '';
    if (!$error) {
        $objResponse->script("\$('{$prefix}opinion_btn_add_comment_{$op_id}').setStyle('display', ''); \n                              \$('{$prefix}opinion_btn_add_comment_{$op_id}').setProperty('disabled', '');\n                              \$('{$prefix}opinion_btn_edit_comment_{$op_id}').setProperty('disabled', '');\n                              \$('{$prefix}comment_content_{$op_id}').dispose();");
    } else {
        $objResponse->script("alert('{$error}')");
    }
    return $objResponse;
}