<?php require_once "data_access.php"; require_once "utils.php"; StartAccessToDB(); $unitsInfos = GetUnitsInProject(12); foreach ($unitsInfos as $unitInfos) { echo "Unit: " . $unitInfos["Name"] . "<br>"; $unit_tmpInfos_request = "SELECT * FROM jh_units_tmp WHERE Name=\"" . $unitInfos["Name"] . "\""; $unit_tmpInfos_res = mysql_query($unit_tmpInfos_request); if (!$unit_tmpInfos_res) { die($unit_tmpInfos_request . "<br>" . mysql_error()); } else { $unit_tmpInfos = mysql_fetch_array($unit_tmpInfos_res, MYSQL_ASSOC); $update_request = "UPDATE jh_units SET Author=\"" . EscapeCharsForMySQL($unit_tmpInfos["Author"]) . "\" " . "WHERE Id=" . $unitInfos["Id"]; echo $update_request . "<br>"; if (!mysql_query($update_request)) { die($update_request . "<br>" . mysql_error()); } echo "<br>"; } } EndAccessToDB();
$tpl->setVariable("TYPE_NAME", FormatItemName(trim($type["Name"]))); $tpl->setVariable("TYPE_SUMMARY", EncodeString($type["Summary"])); $tpl->setVariable("TYPE_UNIT_NAME", $unitName); $tpl->setVariable("TYPE_UNIT_ID", $type["UnitId"]); $tpl->parseCurrentBlock("type_list"); } $tpl->parseCurrentBlock("by_types"); } else { // Assign data to the types list block $tpl->setCurrentBlock("no_types"); $tpl->touchBlock("no_types"); $tpl->parseCurrentBlock("no_types"); } } else { $limits = ProcessPagesLists(GetUnitsInProjectCount($_GET["Id"]), $tpl, $projectInfos["Id"]); $projectUnits = GetUnitsInProject($_GET["Id"], "ORDER BY Name", $limits[0], $limits[1]); if (!is_array($projectUnits)) { if ($projectUnits == "") { die("Project " . $_GET["Id"] . " does not exist in the database."); } else { die($projectUnits); } } elseif (count($projectUnits) > 0) { $tpl->setVariable("TYPES", ""); $tpl->setCurrentBlock("by_units"); foreach ($projectUnits as $unit) { $unitName = str_replace(".dtx", ".pas", $unit["Name"]); $summary = $unit["Description"]; if (!(strpos($summary, "\r\n") === 0)) { $summary = substr($summary, 0, strpos($summary, "\r\n")); }
exit; } } else { // If the directory exists, then empty it. This happens when a generation is cancelled // or goes wrong. We have to cleanup the left overs. $dirHandle = opendir($outDirName); while (($filename = readdir($dirHandle)) !== false) { if (is_file($outDirName . "/" . $filename)) { // unlink file unlink($outDirName . "/" . $filename); } } closedir($dirHandle); } setcookie(DTX_COOKIE_NAME . "_project", $_GET["ProjectId"]); $unitsInfos = GetUnitsInProject($_GET["ProjectId"]); if (is_string($unitsInfos)) { die($unitsInfos); } $unitIDs = array(); foreach ($unitsInfos as $unitInfo) { $unitIDs[] = $unitInfo["Id"]; } } else { // Step 2: We have the cookie that indicates the name of the file keeping // track of the list of Ids of units left to generate. We then extract the // list from the file. if (!file_exists($outDirName)) { $tpl->SetVariable("MESSAGE", "Output directory does not exist"); $tpl->Show(); exit;