$dbConnection = Config::getConnection(); $index = array('hidelinkLeft' => TranslationProvider::staticTranslate('hidelink_left'), 'hidelinkRight' => TranslationProvider::staticTranslate('hidelink_right'), 'head' => array('title' => 'Site loading, please wait', 'requirejs' => 'js/App')); //Checking for minified js/App setup: require_once 'Git.php'; if (Git::getBranch() === 'master') { $app = 'js/App-minified'; if (file_exists('./' . $app . '.js')) { $index['head']['requirejs'] = $app; } } //Making sure we get our appSetup: $index['appSetup'] = true; //Processing the Content-type: $headers = getallheaders(); if (!array_key_exists('Accept', $headers)) { $headers['Accept'] = 'text/html'; } $cType = $headers['Accept']; switch ($cType) { case preg_match('/application\\/json/i', $cType) ? true : false: header('Content-type: application/json'); Config::toJSON($index); break; case preg_match('/text\\/html/i', $cType) ? true : false: default: //Rendering: echo Config::getMustache()->render('index', $index); //Done :) $endTime = microtime(true); echo "<!-- Page generated in " . round($endTime - $startTime, 4) . "s -->"; }
<?php require_once '../config.php'; /** Under http://<domain>/projects/<familyname> we want to serve an iframe page that seamlessly integrates the project URL for the given family, if possible. This script expects a $_GET['name'] parameter, and will catch the correct routes due to .htaccess magic. */ $family = $_GET['name']; if ($family) { $stmt = Config::getConnection()->prepare('SELECT ProjectAboutUrl FROM Families WHERE FamilyNm = ?'); $stmt->bind_param('s', $family); $stmt->execute(); $stmt->bind_result($url); if ($stmt->fetch()) { echo Config::getMustache()->render('Projects', array('title' => "Project page for {$family}", 'backlink' => 'soundcomparisons.com', 'url' => $url)); } else { die("Sorry, we cannot find a family named '{$family}' in our database."); } } else { die('Sorry, we cannot find that project in our database.'); }