if ($itemInfos == "") { echo "Item {$itemId} does not exist in the database"; } else { echo $itemInfos; } exit; } $unitInfos = GetUnitInfos($itemInfos["UnitId"]); } else { $itemInfos = array(); $unitInfos = array(); if (!$edit) { // we may have a name here, so that the user can access an item directly if (array_key_exists("Name", $_GET)) { $name = $_GET["Name"]; $infos = GetItemInfosByName($name); if (is_bool($infos)) { echo "Item {$name} does not exist in the database. Please check you typed the name correcty."; exit; } elseif (is_string($infos)) { echo $infos; exit; } else { $itemInfos = $infos; $itemId = $itemInfos["Id"]; $unitInfos = GetUnitInfos($itemInfos["UnitId"]); } } else { echo "Error, the Id or the Name of the item MUST be indicated when not editing"; exit; }
function GetSummaryFromItem($item) { $summary = ""; if (array_key_exists("Summary", $item)) { $summary = $item["Summary"]; } if ($summary == "") { $summary = $item["Description"]; if ($summary == "") { $summary = $item["Extras"]; } // if there is a COMBINE tag in the description, then go look in that element if (!(($combinePos = strpos($summary, "<COMBINE ")) === false)) { $combineName = substr($summary, $combinePos + 9, strpos($summary, ">", $combinePos + 9) - ($combinePos + 9)); $itemInfos = GetItemInfosByName(trim($combineName)); $summary = $itemInfos["Summary"]; } // remove anything after the first carriage return $crlfPos = strpos($summary, "\r\n"); if ($crlfPos === false) { } else { $summary = substr($summary, 0, $crlfPos); if (substr($summary, $crlfPos + 2) != "") { $summary .= "..."; } } } return $summary; }