コード例 #1
0
ファイル: theme.php プロジェクト: povrazor/ludumdare
                if ($event_id !== 0) {
                    /// Broadphase: check if $event_id is on the master list of event nodes.
                    if (in_array($event_id, GetEventNodes())) {
                        ///	Narrowphase: Get the threshold from the node itself
                        $threshold = nodeCache_GetMetaFieldById($event_id, 'theme_threshold', null);
                        $cache_key = CACHE_KEY_PREFIX . "IDEA!GET" . $event_id . "!" . $threshold;
                        $RESPONSE['themes'] = cache_Fetch($cache_key);
                        if (!isset($RESPONSE['themes'])) {
                            $RESPONSE['themes'] = themeIdea_GetOriginal($event_id, null, $threshold);
                            cache_Store($cache_key, $RESPONSE['themes'], CACHE_TTL);
                        }
                        $RESPONSE['count'] = count($RESPONSE['themes']);
                    } else {
                        json_EmitFatalError_NotFound(null, $RESPONSE);
                    }
                } else {
                    json_EmitFatalError_BadRequest(null, $RESPONSE);
                }
                break;
            case 'set':
                break;
            default:
                json_EmitFatalError_Forbidden(null, $RESPONSE);
                break;
        }
        break;
    default:
        json_EmitFatalError_Forbidden(null, $RESPONSE);
        break;
}
json_End();
コード例 #2
0
ファイル: user.php プロジェクト: povrazor/ludumdare
     break;
 case 'login':
     json_ValidateHTTPMethod('POST');
     $login = null;
     $pw = null;
     $secret = null;
     // Confirm Arguments
     if (isset($_POST['login'])) {
         $login = coreSanitize_String($_POST['login']);
     } else {
         json_EmitFatalError_BadRequest("'login' not found in POST", $RESPONSE);
     }
     if (isset($_POST['pw'])) {
         $pw = coreSanitize_String($_POST['pw']);
     } else {
         json_EmitFatalError_BadRequest("'pw' not found in POST", $RESPONSE);
     }
     if (isset($_POST['secret'])) {
         $secret = coreSanitize_String($_POST['secret']);
     }
     // Bail if empty
     if (empty($login) || empty($pw)) {
         json_EmitFatalError_Permission(null, $RESPONSE);
     }
     $name = null;
     $mail = null;
     $user = null;
     // Decode the login as either an e-mail address, or a username
     if (coreValidate_Mail($login)) {
         $mail = coreSanitize_Mail($login);
     } else {