<?xml version="1.0"?>

<!-- list of possible events
EVENT_LOGIN_ONLOAD EVENT_BEFORELOGIN EVENT_AFTERSUCCESSFULLOGIN EVENT_AFTERUNSUCCESSFULLOGIN

EVENT_REGISTER_ONLOAD EVENT_BEFOREREGISTER EVENT_AFTERSUCCESSFULREGISTRATION EVENT_AFTERUNSUCCESSFULREGISTRATION

EVENT_CHANGEPASSWORD_ONLOAD EVENT_BEFORECHANGEPASSWORD EVENT_AFTERCHANGEPASSWORD

EVENT_REMINDPASSWORD_ONLOAD EVENT_BEFOREREMINDPASSWORD EVENT_AFTERREMINDPASSWORD

EVENT_ADD_ONLOAD EVENT_BEFOREADD EVENT_AFTERADD

EVENT_LIST_ONLOAD EVENT_BEFOREDELETE EVENT_AFTERDELETE EVENT_AFTERMASSDELETE

EVENT_EDIT_ONLOAD EVENT_BEFOREEDIT EVENT_AFTEREDIT
	
EVENT_COPY_ONLOAD EVENT_BEFORECOPY EVENT_AFTERCOPY

EVENT_VIEW_ONLOAD
EVENT_PRINT_ONLOAD
EVENT_EXPORT_ONLOAD
EVENT_REPORT_ONLOAD
EVENT_CHART_ONLOAD

<Events>
<Event>EVENT_LOGIN_ONLOAD</Event>
<Event>EVENT_BEFORELOGIN</Event>
<Event>EVENT_AFTERSUCCESSFULLOGIN</Event>
<Event>EVENT_AFTERUNSUCCESSFULLOGIN</Event>
<Event>EVENT_REGISTER_ONLOAD</Event>
<Event>EVENT_BEFOREREGISTER</Event>
<Event>EVENT_AFTERSUCCESSFULREGISTRATION</Event>
<Event>EVENT_AFTERUNSUCCESSFULREGISTRATION</Event>
<Event>EVENT_CHANGEPASSWORD_ONLOAD</Event>
<Event>EVENT_BEFORECHANGEPASSWORD</Event>
<Event>EVENT_AFTERCHANGEPASSWORD</Event>
<Event>EVENT_REMINDPASSWORD_ONLOAD</Event>
<Event>EVENT_BEFOREREMINDPASSWORD</Event>
<Event>EVENT_AFTERREMINDPASSWORD</Event>
<Event>EVENT_ADD_ONLOAD</Event>
<Event>EVENT_BEFOREADD</Event>
<Event>EVENT_AFTERADD</Event>
<Event>EVENT_LIST_ONLOAD</Event>
<Event>EVENT_BEFOREDELETE</Event>
<Event>EVENT_AFTERDELETE</Event>
<Event>EVENT_AFTERMASSDELETE</Event>
<Event>EVENT_EDIT_ONLOAD</Event>
<Event>EVENT_BEFOREEDIT</Event>
<Event>EVENT_AFTEREDIT</Event>
<Event>EVENT_COPY_ONLOAD</Event>
<Event>EVENT_BEFORECOPY</Event>
<Event>EVENT_AFTERCOPY</Event>
<Event>EVENT_VIEW_ONLOAD</Event>
<Event>EVENT_SEARCH_ONLOAD</Event>
<Event>EVENT_PRINT_ONLOAD</Event>
<Event>EVENT_EXPORT_ONLOAD</Event>
<Event>EVENT_REPORT_ONLOAD</Event>
<Event>EVENT_CHART_ONLOAD</Event>
</Events>
</EventCode>

 --> 


<languages>
<language name="php"/>

<EventCodes language="php">
<EventCode id="SIMPLE_MAIL" type="EMAIL" name="Send simple email" events="all" code="
// **********  Send simple email  ************
$email=&quot;--rbegin--test@test.com--rend--&quot;;
$from=&quot;--rbegin--admin@test.com--rend--&quot;;
$msg=&quot;--rbegin--Hello there\nBest regards--rend--&quot;;
$subject=&quot;--rbegin--Sample subject--rend--&quot;;
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret[&quot;mailed&quot;])
	echo $ret[&quot;message&quot;];
">
<Events/>
</EventCode>

<EventCode id="ORECORD_MAIL" type="EMAIL" name="Send email with old data record" code="
//**********  Send email with old data record  ************
global $conn,$strTableName;
$email=&quot;--rbegin--test@test.com--rend--&quot;;
$from=&quot;--rbegin--admin@test.com--rend--&quot;;
$msg=&quot;&quot;;
$subject=&quot;--rbegin--Sample subject--end--&quot;;

// modify the following SQL query to select fields you like to send
$rs =  db_query(&quot;select * from &quot; . $strTableName .&quot; where &quot;. $where,$conn);

if($data=db_fetch_array($rs))
{
	foreach($data as $field=>$value)
		$msg.= $field.&quot; : &quot;.$value.&quot;\r\n&quot;;
	$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
	if(!$ret[&quot;mailed&quot;])
		echo $ret[&quot;message&quot;];
}


">
<Events>
<Event>EVENT_BEFOREDELETE</Event>
<Event>EVENT_EDIT_ONLOAD</Event>
<Event>EVENT_BEFOREEDIT</Event>
<Event>EVENT_COPY_ONLOAD</Event>
<Event>EVENT_BEFORECOPY</Event>
<Event>EVENT_VIEW_ONLOAD</Event>
</Events>
</EventCode>


<EventCode id="NEWDATA_MAIL" type="EMAIL" name="Send email with new data" code="
//**********  Send email with new data  ************

$email=&quot;--rbegin--test@test.com--rend--&quot;;
$from=&quot;--rbegin--admin@test.com--rend--&quot;;
$msg=&quot;&quot;;
$subject=&quot;--rbegin--New data record--rend--&quot;;

foreach($values as $field=>$value)
{
	if(!IsBinaryType(GetFieldType($field)))
		$msg.= $field.&quot; : &quot;.$value.&quot;\r\n&quot;;
}
	
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret[&quot;mailed&quot;])
	echo $ret[&quot;message&quot;];

">

<Events>
<Event>EVENT_BEFOREREGISTER</Event>
<Event>EVENT_BEFOREADD</Event>
<Event>EVENT_BEFOREEDIT</Event>
<Event>EVENT_AFTERADD</Event>
<Event>EVENT_AFTEREDIT</Event>
<Event>EVENT_BEFORECOPY</Event>
</Events>
</EventCode>


<EventCode id="MESSAGE" type="OTHER" name="Display a message on the Web page" events="all" code="
//**********  Display a message on the Web page  ************
echo &quot;--rbegin--Your message here--rend--&quot;;

">
<Events/>
</EventCode>


<EventCode id="SAVEOLDREC" type="DATABASE" name="Save old data record in another table" code="
//**********  Save old data record in another table  ************
global $conn,$strTableName;

$strSQLSave = &quot;INSERT INTO --rbegin--AnotherTable--rend-- (--rbegin--Field1, Field2--rend--) SELECT --rbegin--Field1, Field2--rend-- FROM &quot;.$strTableName.&quot; where &quot;.$where;
db_exec($strSQLSave,$conn);

">
<Events>
<Event>EVENT_BEFOREDELETE</Event>
<Event>EVENT_EDIT_ONLOAD</Event>
<Event>EVENT_BEFOREEDIT</Event>
<Event>EVENT_COPY_ONLOAD</Event>
<Event>EVENT_BEFORECOPY</Event>
<Event>EVENT_VIEW_ONLOAD</Event>
</Events>
</EventCode>
 
<EventCode id="SAVENEWREC" type="DATABASE" name="Save new data in another table" code="
//**********  Save new data in another table  ************
global $conn,$strTableName;

$strSQLSave = &quot;INSERT INTO --rbegin--AnotherTable--rend-- (--rbegin--Field1, Field2--rend--) values (&quot;;

$strSQLSave .=  $values[&quot;--rbegin--Field1--rend--&quot;].&quot;,&quot;;
$strSQLSave .=  $values[&quot;--rbegin--Field2--rend--&quot;];

$strSQLSave .= &quot;)&quot;;
db_exec($strSQLSave,$conn);

">
<Events>
<Event>EVENT_BEFOREREGISTER</Event>
<Event>EVENT_BEFOREADD</Event>
<Event>EVENT_BEFOREEDIT</Event>
<Event>EVENT_BEFORECOPY</Event>
</Events>
</EventCode>


<EventCode id="INSNEWREC" type="DATABASE" name="Insert a record into another table" events="all" code="
//**********  Insert a record into another table  ************
global $conn;
$strSQLInsert = &quot;insert into --rbegin--TableName--rend-- (--rbegin--Field1, Field2--rend--) values (--rbegin--Value1, Value2--rend--)&quot;;
db_exec($strSQLInsert,$conn);

">
<Events/>
</EventCode>


<EventCode id="REDIRECT" type="OTHER" name="Redirect to another page" events="all" code="
//**********  Redirect to another page  ************
header(&quot;Location: --rbegin--anypage.php--rend--&quot;);
exit();
">
<Events/>
</EventCode>

<EventCode id="CHECKREC" type="DATABASE" name="Check if specific record exists" events="all" code="
//**********  Check if specific record exists  ************
global $conn;
$strSQLExists = &quot;select * from --rbegin--AnyTable--rend-- where --rbegin--SomeColumn--rend--='--rbegin--SomeValue--rend--'&quot;;
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
	--rbegin--// if record exists do something--rend--
}
else
{
	--rbegin--// if dont exist do something else--rend--
}

">
<Events/>
</EventCode>
</EventCodes>
</languages>

