Beispiel #1
0
    }
    $reply_to = intval($P['reply-to']);
    // Check for duplicate
    $q = $__database->query("\r\nSELECT\r\n\t1\r\nFROM\r\n\tsocial_statuses\r\nWHERE\r\n\taccount_id = " . $_loginaccount->GetId() . "\r\n\tAND\r\n\tcontent = '" . $__database->real_escape_string($content) . "'\r\n\tAND\r\n\tDATE_ADD(`timestamp`, INTERVAL 24 HOUR) >= NOW()\r\n");
    if ($q->num_rows != 0) {
        $q->free();
        JSONDie('Duplicate status.', 400);
    }
    $q->free();
    if ($reply_to != -1) {
        // Check if status exists...
        $q = $__database->query("\r\nSELECT\r\n\t1\r\nFROM\r\n\tsocial_statuses\r\nWHERE\r\n\tid = " . $reply_to);
        if ($q->num_rows == 0) {
            // No status found!
            JSONDie('Reply-to status not found.', 400);
        }
    }
    $using_face = MakeOKFace($P['usingface']);
    $blog = $_loginaccount->IsRankOrHigher(RANK_MODERATOR) && isset($_POST['blog']) ? 1 : 0;
    $char_config = $_loginaccount->GetConfigurationOption('character_config', array('characters' => array(), 'main_character' => null));
    // set internally
    $nicknm = $_loginaccount->GetNickname();
    $chr = $char_config['main_character'] !== null ? $char_config['main_character'] : '';
    $_loginaccount->SetConfigurationOption('last_status_sent', date('Y-m-d H:i:s'));
    $__database->query("\r\nINSERT INTO\r\n\tsocial_statuses\r\nVALUES\r\n\t(\r\n\t\tNULL,\r\n\t\t" . $_loginaccount->GetId() . ",\r\n\t\t'" . $__database->real_escape_string($nicknm) . "',\r\n\t\t'" . $__database->real_escape_string($chr) . "',\r\n\t\t'" . $__database->real_escape_string($content) . "',\r\n\t\t" . $blog . ",\r\n\t\tNOW(),\r\n\t\t0,\r\n\t\t" . ($reply_to == -1 ? 'NULL' : $reply_to) . ",\r\n\t\t'" . $using_face . "'\r\n\t)\r\n\t");
    if ($__database->affected_rows == 1) {
        JSONAnswer(array('result' => 'Status successfully posted.'), 200);
    } else {
        JSONDie('Unable to post status due to internal error.', 400);
    }
}
Beispiel #2
0
if ($request_type == 'visibility') {
    if (!$_loggedin) {
        JSONDie('Not loggedin');
    }
    RetrieveInputGET('name', 'what', 'shown');
    $internalid = IsOwnCharacter($P['name'], CURRENT_LOCALE);
    if ($internalid === false) {
        JSONDie('No.');
    }
    $q = $_char_db->query("\nINSERT INTO\n\tcharacter_options\nVALUES\n\t(\n\t\t" . $internalid . ",\n\t\t'display_" . $_char_db->real_escape_string($P['what']) . "',\n\t\t" . ($P['shown'] == 'false' ? 0 : 1) . "\n\t)\nON DUPLICATE KEY UPDATE\n\t`option_value` = VALUES(`option_value`)");
    if ($_char_db->affected_rows != 0) {
        JSONAnswer(array('result' => 'okay'));
    } else {
        JSONAnswer(array('result' => 'failure'));
    }
} elseif ($request_type == 'statistics') {
    RetrieveInputGET('name');
    $q = $_char_db->query("\nSELECT \n\tchr.name,\n\tw.world_name,\n\tchr.channel_id AS channel,\n\tchr.level,\n\tchr.job,\n\tchr.fame,\n\tchr.str,\n\tchr.dex,\n\tchr.int,\n\tchr.luk,\n\tchr.exp,\n\tchr.map,\n\tchr.honourlevel AS honorlevel,\n\tchr.honourexp AS honorexp,\n\tmesos,\n\tTIMESTAMPDIFF(SECOND, last_update, NOW()) AS `seconds_since`\nFROM\n\t`characters` chr\nLEFT JOIN \n\tworld_data w\n\tON\n\t\tw.world_id = chr.world_id\nWHERE \n\tchr.name = '" . $_char_db->real_escape_string($P['name']) . "'");
    if ($q->num_rows == 0) {
        JSONDie('Character not found', 404);
    }
    $row = $q->fetch_assoc();
    $percenta = GetExpPercentage($row['level'], $row['exp']);
    $percentb = round($percenta * 100) / 100;
    $job = GetJobname($row['job']);
    $map = GetMapname($row['map'], CURRENT_LOCALE);
    $extra = array('percentage' => $percentb, 'job_name' => $job, 'map_name' => $map);
    $answer = $row + $extra;
    $q->free();
    JSONAnswer(array('result' => $answer));
}
Beispiel #3
0
                        // Check if it's really a mention
                        // Check if is friend...
                        $mentioning = $status->mention_list[0];
                        $q_temp = $__database->query("\r\nSELECT\r\n\t" . DB_ACCOUNTS . ".`FriendStatus`(`id`, " . $_loginaccount->GetID() . ") IN ('FRIENDS', 'FOREVER_ALONE')\r\nFROM\r\n\t" . DB_ACCOUNTS . ".accounts\r\nWHERE\r\n\tusername = '******'");
                        if ($q_temp->num_rows > 0) {
                            // And? Is it a friend?
                            $row = $q_temp->fetch_row();
                            $q_temp->free();
                            if ($row[0] == 0) {
                                // Nope.
                                unset($status);
                                continue;
                            }
                        } else {
                            $q_temp->free();
                        }
                    }
                }
                $status->PrintAsHTML('');
                unset($status);
            }
            $level_info = ob_get_clean();
            $stream[] = array((int) $timestamp, $level_info, $uniqueid);
        }
        $highest_date = $timestamp;
        $res['statuses'] = $stream;
        $res['oldest_status'] = (int) $lowest_date;
        $res['newest_status'] = (int) $highest_date;
    }
    JSONAnswer($res);
}
Beispiel #4
0
<?php

require_once __DIR__ . '/../../inc/functions.ajax.php';
CheckSupportedTypes('description', 'name', 'nebuliteinfo', 'potentialinfo');
require_once __DIR__ . '/../../inc/classes/database.php';
require_once __DIR__ . '/../../inc/functions.php';
require_once __DIR__ . '/../../inc/functions.datastorage.php';
RetrieveInputGET('id');
if (!is_numeric($P['id'])) {
    JSONDie('Error');
}
$id = $P['id'];
if ($request_type == 'description') {
    $result = IGTextToWeb(GetMapleStoryString('item', $id, 'desc', CURRENT_LOCALE));
    JSONAnswer(array('result' => $result));
} elseif ($request_type == 'name') {
    $result = IGTextToWeb(GetMapleStoryString('item', $id, 'name', CURRENT_LOCALE));
    JSONAnswer(array('result' => $result));
} elseif ($request_type == 'nebuliteinfo') {
    $result = GetNebuliteInfo($id, CURRENT_LOCALE);
    JSONAnswer(array('result' => $result));
} elseif ($request_type == 'potentialinfo') {
    $result = GetPotentialInfo($id, CURRENT_LOCALE);
    JSONAnswer(array('result' => $result));
}