Skip to content

Commit

Permalink
Started implementing client ability to limit projects returned
Browse files Browse the repository at this point in the history
  • Loading branch information
bentasker committed Nov 3, 2014
1 parent 0cd6fcf commit eeb3c63
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion projects.php
Expand Up @@ -30,7 +30,22 @@



$sql = "SELECT ID, pname, pkey, DESCRIPTION from project ORDER BY pkey ASC";
$sql = "SELECT ID, pname, pkey, DESCRIPTION from project ";

// This will be moved somewhere more suitable (and global) in future
if (isset($_SERVER['HTTP_X_PROJECT_LIMIT']) && !empty($_SERVER['HTTP_X_PROJECT_LIMIT'])){

$sql .= "WHERE pkey IN (";
$keys = explode(",",$_SERVER['HTTP_X_PROJECT_LIMIT']);
foreach ($keys as $k){
$sql .= "'".$db->stringEscape($k)."',";
}

$sql .= "'') ";

}
$sql .= 'ORDER BY pkey ASC';

$db->setQuery($sql);
$projects = $db->loadResults();

Expand Down

0 comments on commit eeb3c63

Please sign in to comment.