// This is ajax
//header("Content-Type: application/json");
// Get info (post only)
$action = isset($_POST['action']) ? $_POST['action'] : NULL;
// Must be logged in to use tasks below this section
if (!$user->user_exists) {
    echo json_encode(array('result' => FALSE, 'err' => 1));
    exit;
}
//$command_model = new se_gamecommand;
//$gamechat_model = new se_gamechat;
if ($action == 'add_message') {
    $user_id = isset($_POST['user_id']) ? $_POST['user_id'] : NULL;
    $message = isset($_POST['message']) ? $_POST['message'] : NULL;
    $comment = new se_comment('profile', 'user_id', $user_id);
    $comArray = $comment->comment_post($message, 0);
    if ($comArray['comment_id'] != 0) {
        $num_month = date("n", $comArray['comment_date']);
        if ($num_month == 1) {
            $month = "января";
        } elseif ($num_month == 2) {
            $month = "февраля";
        } elseif ($num_month == 3) {
            $month = "марта";
        } elseif ($num_month == 4) {
            $month = "апреля";
        } elseif ($num_month == 5) {
            $month = "мая";
        } elseif ($num_month == 6) {
            $month = "июня";
        } elseif ($num_month == 7) {
Beispiel #2
0
        exit;
    }
    // SET OBJECT TITLE
    $object_title = $object_info[$col . "_title"];
    if ($tab == "eventmedia" || $tab == "groupmedia") {
        $object_title = $object_owner_class->{$object_owner . "_info"}[$object_owner . "_title"];
    }
    if (!$object_title) {
        SE_Language::_preload(589);
        SE_Language::load();
        $object_title = SE_Language::_get(589);
    }
    // START COMMENT OBJECT
    $comment = new se_comment($type, $iden, $value, $tab, $col);
    // POST COMMENT
    $comment_info = $comment->comment_post($_POST['comment_body'], $_POST['comment_secure'], $object_title, $object_owner, $object_owner_id, $permission['object_privacy']);
    $is_error = $comment->is_error;
    $comment_body = isset($comment_info['comment_body']) ? $comment_info['comment_body'] : NULL;
    $comment_date = isset($comment_info['comment_date']) ? $comment_info['comment_date'] : NULL;
    // RUN JAVASCRIPT FUNCTION (JSON)
    echo json_encode(array('is_error' => $is_error, 'comment_body' => $comment_body, 'comment_date' => $comment_date));
    exit;
} elseif ($task == "comment_edit") {
    // MUST BE LOGGED IN TO USE THIS TASK
    if (!$user->user_exists) {
        exit;
    }
    // GET COMMENT TYPE, ETC
    $comment_id = isset($_POST['comment_id']) ? $_POST['comment_id'] : NULL;
    $comment_edit = isset($_POST['comment_edit']) ? $_POST['comment_edit'] : NULL;
    $type = isset($_POST['type']) ? $_POST['type'] : NULL;