public static function Mail($to, $subject = '(No subject)', $message = '', $from = '') { $header = "MIME-Version: 1.0\n"; $header .= "Content-type: text/html; charset=utf-8 \n"; $header .= "Content-Transfer-Encoding: 8bit\n"; $header .= H::Format("From: {0}\n", $from); mail($to, $subject, $message, $header, H::Format("-f {0}", $from)); }
private function BuildUpdate($table, $values, $conditions) { $query = "UPDATE {PREFIX}{TABLE} SET {VALS} WHERE {CONDS}"; $valuesString = ""; $conditionsString = ""; $values_bits = []; $conditions_bits = []; foreach ($values as $key => $value) { $valueStr = $value; if (is_string($value)) { $valueStr = "'" . $this->Escape($value) . "'"; } $values_bits[] = H::Format("{0} = {1}", $key, $valueStr); } foreach ($conditions as $condition) { if (is_array($condition)) { $targetStr = $condition["TARGET"]; if (is_string($targetStr)) { $targetStr = "'" . $this->Escape($targetStr) . "'"; } $conditions_bits[] = H::Format("{0} {1} {2}", $condition["KEY"], $condition["COMPARISON"], $targetStr); } else { $conditions_bits[] = $condition; } } $valuesString = implode(", ", array_values($values_bits)); $conditionsString = implode(" ", array_values($conditions_bits)); $query = H::FormatArr($query, ["PREFIX" => DBPREFIX, "TABLE" => $table, "VALS" => $valuesString, "CONDS" => $conditionsString]); return $query; }