Exemple #1
0
$client = new NDB_Client();
$client->initialize();
require_once "HelpFile.class.inc";
// create DB object
$DB =& Database::singleton();
// store some request information
if (!empty($_REQUEST['helpID'])) {
    $helpID = $_REQUEST['helpID'];
} else {
    if (!empty($_REQUEST['test_name'])) {
        $helpID = HelpFile::hashToID(md5($_REQUEST['test_name']));
    }
    if (!empty($_REQUEST['test_name']) && !empty($_REQUEST['subtest'])) {
        $helpID = HelpFile::hashToID(md5($_REQUEST['subtest']));
    }
}
$help_file = HelpFile::factory($helpID);
$data = $help_file->toArray();
$data['content'] = utf8_encode(trim($data['content']));
if (empty($data['content'])) {
    $data['content'] = 'Under Construction';
}
if (empty($data['updated'])) {
    $data['updated'] = "-";
    // if document was never updated should display date created
    if (!empty($data['created'])) {
        $data['updated'] = $data['created'];
    }
}
print json_encode($data);
ob_end_flush();