Location: PHPKode > projects > Scriptorium > scriptorium1.6/categories.php
<?php

if (!isset($_GET['eid']) || !isset($_GET['cid'])) {
  header("Location: index.php");
}

require('includes/scriptorium_inc.php');

$environment_name = eidToName($_GET['eid']);
$category_name = cidToName($_GET['cid']);

$smarty->assign('page_title', lib('title_category').": $environment_name: $category_name");

// get all scripts in this category
$sql = <<<SQL

SELECT id, name, description, date_modified, date_added
FROM scriptorium_scripts 
WHERE environment_id={$_GET['eid']}
AND category_id={$_GET['cid']}
ORDER BY date_modified DESC

SQL;

$scripts = $db->getAll($sql);
  

$script_list = '';
if (sizeof($scripts) == 0) {
  $script_list = '<p>'.lib('category_empty').'</p>';

} else {
  foreach ($scripts as $script) {
    $script_id = $script[0];
    $name = stripslashes($script[1]);
    $name = htmlentities($name);
    if ($name == '') {
      $name = '?';
    }
    $description = libDB('description_'.$script_id);
    if (!$description) {
      $description = $script[2];
    }

    $description = htmlentities($description);

    $modified_date = $script[3];
    $added_date = $script[4];

    $script_list .= "<p><a href='view.php?sid=$script_id'>$name</a> $date<br><i> $description</i></p>";
  }
}

$output = <<<HTML
<h2><a class='blackLink' href='environments.php?eid={$_GET['eid']}'>$environment_name</a>: $category_name</h2>
$script_list
HTML;


$smarty->assign('content',$output);

$smarty->display('main.tpl.html');

?>
Return current item: Scriptorium