Merge branch 'fronkdev' into 'master'
Added Email Logging for Emailnotification class See merge request fronk/thetool!1675
This commit is contained in:
@@ -201,7 +201,7 @@ class FronkDB {
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function insert($_table, $_data, $_forcestr = array(), $options = array()) {
|
||||
public function insert($_table, $_data, $_forcestr = array(), $_forcebinary = array()) {
|
||||
if(empty($_table)) {
|
||||
$this->lastError = "Error constructing INSERT: tablename ommited";
|
||||
return false;
|
||||
@@ -225,13 +225,19 @@ class FronkDB {
|
||||
$_Q = "";
|
||||
}
|
||||
}
|
||||
if($v === null) {
|
||||
$_Q = '';
|
||||
$v = "NULL";
|
||||
}
|
||||
|
||||
$fields .= ",`$f`";
|
||||
$values .= "," . $_Q . $v . $_Q;
|
||||
|
||||
if($v === null) {
|
||||
$values .= ", NULL";
|
||||
} else {
|
||||
if(in_array($f, $_forcebinary)) {
|
||||
$values .= ", _binary" . $_Q . $v . $_Q;
|
||||
} else {
|
||||
$values .= "," . $_Q . $v . $_Q;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$fields = preg_replace('/^,/', '', $fields);
|
||||
@@ -246,7 +252,7 @@ class FronkDB {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update($_table, $_data, $_where, $_forcestr = array()) {
|
||||
public function update($_table, $_data, $_where, $_forcestr = array(), $_forcebinary = array()) {
|
||||
if(empty($_table)) {
|
||||
$this->lastError = "Error constructing UPDATE: tablename ommited";
|
||||
return false;
|
||||
@@ -276,12 +282,16 @@ class FronkDB {
|
||||
$_Q = '';
|
||||
}
|
||||
}
|
||||
if($v === null) {
|
||||
$_Q = '';
|
||||
$v = "NULL";
|
||||
}
|
||||
|
||||
$Pairs .= ", `$f`=" . $_Q . $v . $_Q;
|
||||
if($v === null) {
|
||||
$Pairs .= ", `$f`=NULL";
|
||||
} else {
|
||||
if(in_array($f, $_forcebinary)) {
|
||||
$Pairs .= ", `$f`= _binary " . $_Q . $v . $_Q;
|
||||
} else {
|
||||
$Pairs .= ", `$f`=" . $_Q . $v . $_Q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Pairs = preg_replace('/^,/', '', $Pairs);
|
||||
@@ -361,4 +371,16 @@ class FronkDB {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function startTransaction() {
|
||||
$this->query("START TRANSACTION");
|
||||
}
|
||||
|
||||
public function commitTransaction() {
|
||||
$this->query("COMMIT");
|
||||
}
|
||||
|
||||
public function rollbackTransaction() {
|
||||
$this->query("ROLLBACK");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class mfBaseModel {
|
||||
protected $edit;
|
||||
private $worker;
|
||||
protected $forcestr;
|
||||
protected $forcebinary;
|
||||
|
||||
protected $mode = "new";
|
||||
protected $saved = 0;
|
||||
@@ -158,17 +159,28 @@ class mfBaseModel {
|
||||
$fields = $this->buildFields();
|
||||
|
||||
$forcestr = array();
|
||||
|
||||
if(!$this->fieldprefix && is_array($this->forcestr) && count($this->forcestr)) {
|
||||
$forcestr = $this->forcestr;
|
||||
}
|
||||
$forcebinary = array();
|
||||
|
||||
if(is_array($this->forcestr) && count($this->forcestr)) {
|
||||
foreach($this->forcestr as $fstr) {
|
||||
$forcestr[] = $this->fieldprefix . "_$fstr";
|
||||
if ($this->fieldprefix) {
|
||||
foreach ($this->forcestr as $fstr) {
|
||||
$forcestr[] = $this->fieldprefix . "_$fstr";
|
||||
}
|
||||
} else {
|
||||
$forcestr = $this->forcestr;
|
||||
}
|
||||
}
|
||||
|
||||
if(is_array($this->forcebinary) && count($this->forcebinary)) {
|
||||
if ($this->fieldprefix) {
|
||||
foreach ($this->forcebinary as $fstr) {
|
||||
$forcebinary[] = $this->fieldprefix . "_$fstr";
|
||||
}
|
||||
} else {
|
||||
$forcebinary = $this->forcebinary;
|
||||
}
|
||||
}
|
||||
|
||||
if(!is_array($fields) or !count($fields)) {
|
||||
return false;
|
||||
}
|
||||
@@ -179,7 +191,7 @@ class mfBaseModel {
|
||||
if($this->fieldprefix) {
|
||||
$where = "`" . $this->fieldprefix . "_id`=$id";
|
||||
}
|
||||
if($this->db->update($this->table, $fields, $where, $forcestr)) {
|
||||
if($this->db->update($this->table, $fields, $where, $forcestr, $forcebinary)) {
|
||||
$this->saved++;
|
||||
if(method_exists($this, "afterSave")) {
|
||||
$this->afterSave($_params);
|
||||
@@ -187,7 +199,7 @@ class mfBaseModel {
|
||||
return $id;
|
||||
}
|
||||
} else {
|
||||
if($this->db->insert($this->table, $fields, $forcestr)) {
|
||||
if($this->db->insert($this->table, $fields, $forcestr, $forcebinary)) {
|
||||
$id = $this->db->insert_id;
|
||||
$this->id = $id;
|
||||
$this->saved++;
|
||||
|
||||
@@ -113,6 +113,23 @@ class mfLayout {
|
||||
|
||||
$file = PDFOUTPUTPATH . "/$filename";
|
||||
|
||||
if(file_exists($file)) {
|
||||
$creator = mb_convert_encoding("Xinon Thetool", "UTF-16");
|
||||
|
||||
$pdf_contents = file_get_contents($file);
|
||||
if(!$pdf_contents) return $file;
|
||||
// /CreationDate (D:20250821155741+02\'00\')
|
||||
$pdf_contents = preg_replace('#/CreationDate \([^)]*\)'."\n".'#im', '', $pdf_contents, 1);
|
||||
// /Creator (<FE><FF>\0w\0k\0h\0t\0m\0l\0t\0o\0p\0d\0f\0 \00\0.\01\02\0.\06)\n
|
||||
$pdf_contents = preg_replace('#/Creator \([^)]*\)#im', "/Creator (\xfe\xff$creator)", $pdf_contents, 1);
|
||||
// /Producer (<FE><FF>\0Q\0t\0 \04\0.\08\0.\07)\n/CreationDate (D:20250821155741+02\'00\')\n
|
||||
$pdf_contents = preg_replace('#/Producer \([^)]*\)#im', "/Producer (\xfe\xff$creator)", $pdf_contents, 1);
|
||||
|
||||
if(!$pdf_contents) return $file;
|
||||
|
||||
file_put_contents($file, $pdf_contents);
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user