Example #1
0
 }
 //Is this a new attribute?
 if ($isNewAttribute) {
     $result = createAttribute($newCode, $newName, $newDescription);
     $attributeID = intval($result[0]);
     $error = $result[1];
 } else {
     $attributeID = intval($_POST["id"]);
     if ($newCode != $_POST["oldAttributeCode"] || $newName != $_POST["oldAttributeName"] || $newDescription != $_POST["oldAttributeDescription"]) {
         $error = updateAttribute($attributeID, $newCode, $newName, $newDescription);
     }
 }
 $labelChanges = array();
 for ($i = 0; $i < $maxLabels; $i++) {
     //If nothing changed, skip this label
     $code = emptyAsNull(stripString1($_POST["labelCode"][$i]));
     $nameChange = $code != null && $_POST["oldLabelName"][$i] == '' || $_POST["labelName"][$i] != $_POST["oldLabelName"][$i];
     $descChange = $_POST["labelDescription"][$i] != $_POST["oldLabelDescription"][$i];
     $delete = checkDelete($code);
     if ($code == null || !($nameChange || $descChange || $delete)) {
         continue;
     }
     $labelID = intval($_POST["labelID"][$i]);
     $change = new LabelUpdate();
     $change->id = $labelID;
     $change->attributeID = $attributeID;
     $change->code = $code;
     $change->newName = stripString2($_POST["labelName"][$i]);
     if ($change->newName == '') {
         $change->newName = $change->code;
     }
Example #2
0
function updateCrisis($crisisID, $code, $name, $crisisTypeID)
{
    $crisisID = intval($crisisID);
    $code = stripString1($code);
    $name = stripString2($name);
    $crisisTypeID = intval($crisisTypeID);
    $con = getMySqlConnection();
    $con->query("update crisis set code='{$code}', name='{$name}', crisisTypeID={$crisisTypeID}\n        where crisisID={$crisisID} limit 1");
    $error = $con->error;
    $con->close();
    return $error;
}