Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4929a2e
Showing
138 changed files
with
12,147 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
class rex_xform_action_callback extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
|
||
if(!isset($this->action["elements"][2])) | ||
return FALSE; | ||
|
||
$f = $this->action["elements"][2]; | ||
|
||
$f($this); | ||
|
||
return; | ||
|
||
|
||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|callback|function|"; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
class rex_xform_action_copy_value extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
|
||
$label_from = $this->action["elements"][2]; | ||
$label_to = $this->action["elements"][3]; | ||
|
||
foreach($this->elements_sql as $key => $value) | ||
{ | ||
if ($label_from==$key) | ||
{ | ||
$this->elements_sql[$label_to] = $value; | ||
break; | ||
} | ||
} | ||
|
||
return; | ||
|
||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|copy_value|label_from|label_to"; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
class rex_xform_action_createdb extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
$table = $this->action["elements"][2]; | ||
|
||
// Tabelle vorhanden ? | ||
$sql = new rex_sql; | ||
$sql->debug = 1; | ||
$sql->setQuery('show tables'); | ||
$table_exists = FALSE; | ||
foreach($sql->getArray() as $k => $v) | ||
{ | ||
if($table == $v) | ||
{ | ||
$table_exists = TRUE; | ||
break; | ||
} | ||
} | ||
|
||
if(!$table_exists) | ||
{ | ||
$sql->setQuery('CREATE TABLE `'.$table.'` (`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY);'); | ||
} | ||
|
||
// Welche Felder sind vorhanden ? | ||
$sql->setQuery('show columns from '.$table); | ||
$sql_cols = $sql->getArray(); | ||
$cols = array(); | ||
foreach($sql_cols as $k => $v) | ||
{ | ||
$cols[] = $v['Field']; | ||
} | ||
|
||
// wenn Feld nicht in Datenbank, dann als TEXT anlegen. | ||
foreach($this->elements_sql as $key => $value) | ||
{ | ||
if(!in_array($key,$cols)) | ||
{ | ||
$sql->setQuery('ALTER TABLE `'.$table.'` ADD `'.$key.'` TEXT NOT NULL;'); | ||
} | ||
} | ||
|
||
return; | ||
|
||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|createdb|tblname|"; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
/* | ||
$objparams["actions"][] = "db"; // z.b. email, datenbank, als datei speichern etc. | ||
$objparams["action_params"][] = array( | ||
"table" => "REX_VALUE[8]", | ||
"where" => "REX_VALUE[8]", | ||
); | ||
*/ | ||
|
||
|
||
class rex_xform_action_db extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
// echo "DB EXECUTE"; | ||
// return; | ||
|
||
$sql = rex_sql::factory(); | ||
if ($this->params["debug"]) $sql->debugsql = TRUE; | ||
|
||
$main_table = ""; | ||
if (!$main_table = $this->action["elements"][2]) | ||
{ | ||
$main_table = $this->params["main_table"]; | ||
} | ||
|
||
if ($main_table == "") | ||
{ | ||
$this->params["form_show"] = TRUE; | ||
$this->params["hasWarnings"] = TRUE; | ||
$this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"]; | ||
return FALSE; | ||
} | ||
|
||
$sql->setTable($main_table); | ||
|
||
$where = ""; | ||
if ($where = $this->getElement(3)) // isset($this->action["elements"][3]) && trim($this->action["elements"][3]) != "" | ||
{ | ||
if($where == "main_where") | ||
{ | ||
$where = $this->params["main_where"]; | ||
} | ||
} | ||
|
||
// SQL Objekt mit Werten füllen | ||
foreach($this->elements_sql as $key => $value) | ||
{ | ||
$sql->setValue($key, $value); | ||
if ($where != "") $where = str_replace('###'.$key.'###',addslashes($value),$where); | ||
} | ||
|
||
if ($where != "") | ||
{ | ||
$sql->setWhere($where); | ||
$sql->update(); | ||
$flag = "update"; | ||
}else | ||
{ | ||
$sql->insert(); | ||
$flag = "insert"; | ||
$id = $sql->getLastId(); | ||
|
||
$this->params["main_id"] = $id; | ||
$this->elements_email["ID"] = $id; | ||
// $this->elements_sql["ID"] = $id; | ||
if ($id == 0) | ||
{ | ||
$this->params["form_show"] = TRUE; | ||
$this->params["hasWarnings"] = TRUE; | ||
$this->params["warning_messages"][] = $this->params["Error-Code-InsertQueryError"]; | ||
} | ||
} | ||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|db|tblname|[where(id=2)/main_where]"; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
class rex_xform_action_db2email extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
|
||
global $REX; | ||
|
||
$template_name = $this->action["elements"][2]; | ||
|
||
if($etpl = rex_xform_emailtemplate::getTemplate($template_name)) | ||
{ | ||
|
||
// ----- find mailto | ||
$mail_to = $REX['ERROR_EMAIL']; // default | ||
|
||
// finde email label in list | ||
if (isset($this->action["elements"][3]) && $this->action["elements"][3] != "") | ||
{ | ||
foreach($this->elements_email as $key => $value) | ||
if ($this->action["elements"][3]==$key) | ||
{ | ||
$mail_to = $value; | ||
break; | ||
} | ||
} | ||
|
||
// ---- fix mailto from definition | ||
if (isset($this->action["elements"][4]) && $this->action["elements"][4] != "") | ||
$mail_to = $this->action["elements"][4]; | ||
|
||
$etpl = rex_xform_emailtemplate::replaceVars($etpl,$this->elements_email); | ||
|
||
$etpl['mail_to'] = $mail_to; | ||
$etpl['mail_to_name'] = $mail_to; | ||
|
||
if($etpl['attachments'] != "") | ||
{ | ||
$f = explode(",",$etpl['attachments']); | ||
$etpl['attachments'] = array(); | ||
foreach($f as $v) | ||
{ | ||
$etpl['attachments'][] = array("name"=>$v,"path"=>$REX["INCLUDE_PATH"].'/../../files/'.$v); | ||
} | ||
|
||
}else | ||
{ | ||
$etpl['attachments'] = array(); | ||
} | ||
|
||
if(!rex_xform_emailtemplate::sendMail($etpl)) | ||
{ | ||
echo "Fehler beim E-Mail Versand"; | ||
return FALSE; | ||
} | ||
|
||
return TRUE; | ||
|
||
} | ||
|
||
return FALSE; | ||
|
||
} | ||
|
||
function getDescription() | ||
{ | ||
|
||
return "action|db2email|namekey|emaillabel|[email@domain.de]"; | ||
|
||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
/* | ||
$objparams["actions"][] = "db"; // z.b. email, datenbank, als datei speichern etc. | ||
$objparams["action_params"][] = array( | ||
"table" => "REX_VALUE[8]", | ||
"where" => "REX_VALUE[8]", | ||
); | ||
*/ | ||
|
||
|
||
class rex_xform_action_db_query extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
|
||
$query = trim($this->action["elements"][2]); | ||
|
||
if($query == "") | ||
{ | ||
if ($this->params["debug"]) | ||
{ | ||
echo 'ActionQuery Error: no query'; | ||
} | ||
return; | ||
} | ||
|
||
$sql = rex_sql::factory(); | ||
if ($this->params["debug"]) $sql->debugsql = TRUE; | ||
|
||
// SQL Objekt mit Werten füllen | ||
foreach($this->elements_sql as $key => $value) | ||
{ | ||
$query = str_replace('###'.$key.'###',addslashes($value),$query); | ||
} | ||
|
||
$sql->setQuery($query); | ||
|
||
if( $sql->getError() != "") | ||
{ | ||
$this->params["form_show"] = TRUE; | ||
$this->params["hasWarnings"] = TRUE; | ||
$this->params["warning_messages"][] = $this->action["elements"][3]; | ||
} | ||
|
||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|db_query|query|Fehlermeldung"; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
class rex_xform_action_email extends rex_xform_action_abstract | ||
{ | ||
|
||
function execute() | ||
{ | ||
|
||
$mail_from = $this->action["elements"][2]; | ||
$mail_to = $this->action["elements"][3]; | ||
$mail_subject = $this->action["elements"][4]; | ||
$mail_body = $this->action["elements"][5]; | ||
|
||
foreach ($this->elements_email as $search => $replace) | ||
{ | ||
$mail_body = str_replace('###'. $search .'###', $replace, $mail_body); | ||
} | ||
|
||
$mail = new rex_mailer(); | ||
$mail->AddAddress($mail_to, $mail_to); | ||
$mail->WordWrap = 80; | ||
$mail->FromName = $mail_from; | ||
$mail->From = $mail_from; | ||
$mail->Subject = $mail_subject; | ||
$mail->Body = nl2br($mail_body); | ||
$mail->AltBody = strip_tags($mail_body); | ||
// $mail->IsHTML(true); | ||
$mail->Send(); | ||
} | ||
|
||
function getDescription() | ||
{ | ||
return "action|email|from@email.de|to@emila.de|Mailsubject|Mailbody###name###"; | ||
} | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.