Ejemplo n.º 1
0
$vocabs = json_decode(file_get_contents('vocabs/vocabs.json'), true);
$github = 'https://github.com/sakamies/vocabs';
$appCredits = '<a href="http://twitter.com/sakamies">@sakamies</a> / <a href="http://twitter.com/workflower">@workflower</a>';
$reportIssue = '<a href="' . $github . '/issues/new">Report an issue</a>';
$createVocab = '<a href="' . $github . '/fork">Create a vocab or translation</a>';
// If there are no vocabName & locale given, output the index list and die
$vocabName = filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING);
$locale = filter_input(INPUT_GET, 'lang', FILTER_SANITIZE_STRING);
if (isset($vocabName) == false && isset($locale) == false) {
    include 'list.php';
    exit;
}
// If a vocab name & locale is in the url, make sure they exist in vocabs.json
// Should be safe to use vocabName & locale after this
$vocabExists = array_key_exists($vocabName, $vocabs);
$hasLocale = array_key_exists($locale, $vocabs[$vocabName]);
if ($vocabExists == false || $hasLocale == false) {
    header('HTTP/1.0 404 Not Found');
    include 'error.php';
    exit;
} else {
    // Ok cool, we have a vocab & locale, time party
    //Read page title and stuff from vocabs.json according to bundle & locale
    $vocab = $vocabs[$vocabName][$locale];
    $title = $vocab['title'];
    $language = $vocab['language'];
    $credits = creditsLinks($vocab['credits']);
    $specs = specsLinks($vocab['specs']);
    $helpText = $vocab['help-text'];
    include 'app.php';
}
Ejemplo n.º 2
0
} else {
    $path = 'http://apps.workflower.fi/css-cheats/';
}
$sets = json_decode(file_get_contents('rulesets/rulesets.json'), true);
$github = 'https://github.com/sakamies/css-cheats';
$appCredits = '<a href="http://twitter.com/sakamies">@sakamies</a> / <a href="http://twitter.com/workflower">@workflower</a>';
$reportIssue = '<a href="' . $github . '/issues/new">Report an issue</a>';
$createSet = '<a href="' . $github . '/fork">Create a cheatsheet</a>';
// If there is no name given, output the index list and die
$setName = filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING);
if (isset($setName) == false) {
    include 'list.php';
    exit;
}
// If a name is in the url, make sure it exists in sets.json
// Should be safe to use setName
$setExists = array_key_exists($setName, $sets);
if ($setExists == false) {
    header('HTTP/1.0 404 Not Found');
    include 'error.php';
    exit;
} else {
    // Ok cool, we have a cheatsheet, time party
    //Read page title and stuff from sets.json according to bundle
    $set = $sets[$setName];
    $title = $set['title'];
    $credits = creditsLinks($set['credits']);
    $specs = specsLinks($set['specs']);
    $helpText = $set['help-text'];
    include 'app.php';
}