function store($itemid, $fielddata, $value, $table) { global $config; $data["name"] = $fielddata["name"]; $data["subtype"] = $_POST[$value]; if ($data["subtype"] == 1) { # save link info $data["spage"] = $_POST[$fielddata["name"] . "_spage"]; $data["subtype"] = 1; } Sql_query(sprintf('replace into %s values("%s",%d,"%s")', $table, $fielddata["name"], $itemid, delimited($data))); }
$values = join(", ", $_POST["criteria_values"]); } else { $values = $_POST["criteria_values"]; } foreach ($_POST["attribute_names"] as $key => $val) { $att_names[$key] = $val; } $newcriterion = array("attribute" => sprintf('%d', $_POST["criteria_attribute"]), "attribute_name" => $att_names[$_POST["criteria_attribute"]], "operator" => $operator, "values" => $values); # find out what number we are $numarr = Sql_Fetch_Row_Query(sprintf('select data from %s where id = %d and name = "numcriteria"', $tables["messagedata"], $messageid)); $num = sprintf('%d', $numarr[0] + 1); # store this one # print $att_names[$_POST["criteria_attribute"]]; # print $_POST["attribute_names[".$_POST["criteria_attribute"]."]"]; print "<p>" . $GLOBALS['I18N']->get("adding") . " " . $newcriterion["attribute_name"] . " " . $newcriterion["operator"] . " " . $newcriterion["values"] . "</p>"; Sql_Query(sprintf('insert into %s (name,id,data) values("criterion%d",%d,"%s")', $tables["messagedata"], $num, $messageid, delimited($newcriterion))); # increase number Sql_Query(sprintf('replace into %s (name,id,data) values("numcriteria",%d,"%s")', $tables["messagedata"], $messageid, $num)); # save overall operator } if (isset($_POST["criteria_match"])) { Sql_Query(sprintf('replace into %s (name,id,data) values("criteria_overall_operator",%d,"%s")', $tables["messagedata"], $messageid, $_POST["criteria_match"])); } if (isset($_POST['notify_start']) && $_POST['notify_start']) { Sql_Query(sprintf('replace into %s set name = "notify_start",id = %d,data = "%s"', $GLOBALS['tables']['messagedata'], $id, $_POST['notify_start'])); } if (isset($_POST['notify_end']) && $_POST['notify_end']) { Sql_Query(sprintf('replace into %s set name = "notify_end",id = %d,data = "%s"', $GLOBALS['tables']['messagedata'], $id, $_POST['notify_end'])); } if (ALLOW_ATTACHMENTS) { for ($att_cnt = 1; $att_cnt <= NUMATTACHMENTS; $att_cnt++) {
$values = $_POST["criteria_values"]; } foreach ($_POST["attribute_names"] as $key => $val) { $att_names[$key] = $val; } $newcriterion = array("attribute" => sprintf('%d', $_POST["criteria_attribute"]), "attribute_name" => $att_names[$_POST["criteria_attribute"]], "operator" => $operator, "values" => $values); # find out what number we are $num = $_SESSION["userselection"]["num"]; if (!$num) { $num = 1; } # store this one # print $att_names[$_POST["criteria_attribute"]]; # print $_POST["attribute_names[".$_POST["criteria_attribute"]."]"]; print '<p class="information">Adding ' . $newcriterion["attribute_name"] . " " . $newcriterion["operator"] . " " . $newcriterion["values"] . "</p>"; $_SESSION["userselection"]["criterion{$num}"] = delimited($newcriterion); # increase number $_SESSION["userselection"]["num"]++; } if (isset($_POST["criteria_match"])) { $_SESSION["criteria_overall_operator"] = $_POST["criteria_match"]; } $num = sprintf('%d', $_SESSION["userselection"]["num"]); #print '<br/>'.$num . " criteria already defined"; $ls = new WebblerListing("Existing criteria"); $used_attributes = array(); $delete_base = sprintf('%s&id=%d&tab=%s', $_GET["page"], $_GET["id"], $_GET["tab"]); $tc = 0; # table counter $mainoperator = $_SESSION["criteria_overall_operator"] == "all" ? ' and ' : ' or '; for ($i = 1; $i <= $num; $i++) {