if (preg_match(new RegExp('^details/(\\d+)'), $data, $_match)) { $EntryID = intval($_match[1], 10); $MainEntry = $Database->where('entryid', $EntryID)->getOne('log'); if (empty($MainEntry)) { Response::fail('Log entry does not exist'); } if (empty($MainEntry['refid'])) { Response::fail('There are no details to show', array('unlickable' => true)); } $Details = $Database->where('entryid', $MainEntry['refid'])->getOne("log__{$MainEntry['reftype']}"); if (empty($Details)) { error_log("Could not find details for entry {$MainEntry['reftype']}#{$MainEntry['refid']}, NULL-ing refid of Main#{$MainEntry['entryid']}"); $Database->where('entryid', $MainEntry['entryid'])->update('log', array('refid' => null)); Response::fail('Failed to retrieve details', array('unlickable' => true)); } Response::done(Logs::formatEntryDetails($MainEntry, $Details)); } else { CoreUtils::notFound(); } break; case "usefullinks": if (preg_match(new RegExp('^([gs]et|del|make)(?:/(\\d+))?$'), $data, $_match)) { $action = $_match[1]; $creating = $action === 'make'; if (!$creating) { $Link = $Database->where('id', $_match[2])->getOne('usefullinks'); if (empty($Link)) { Response::fail('The specified link does not exist'); } } switch ($action) {