function WA_AB_cleanUpEquality($tEquality)
{
    if (preg_replace('/^\\s*|\\s*$/', "", $tEquality) != "=") {
        return WA_AB_cleanUpColumnName($tEquality);
    }
    return $tEquality;
}
Ejemplo n.º 2
0
 function processEvent($isError)
 {
     if ($this->ToDo == "none") {
         return true;
     }
     if (sizeof($this->ColumnList) == 0) {
         return false;
     }
     $LogIncludeDirectory = getcwd();
     chdir(dirname(__FILE__));
     require "../../Connections/" . $this->Connection . ".php";
     if (!function_exists("WA_AB_generateInsertParams")) {
         require_once "../database_management/wa_appbuilder_php.php";
     }
     chdir($LogIncludeDirectory);
     eval("\$" . "logConnection = \$" . $this->Connection . ";");
     eval("\$" . "logDatabase = \$" . "database_" . $this->Connection . ";");
     mysql_select_db($logDatabase, $logConnection);
     $insertParams = WA_AB_generateInsertParams($this->ColumnList, $this->TypeList, $this->ValueList, -1);
     switch ($this->ToDo) {
         case "update":
             $emailToValue = "";
             $emailToType = "',none,''";
             for ($n = 0; $n < sizeof($this->ColumnList); $n++) {
                 if ($this->ColumnList[$n] == $this->EmailColumn) {
                     $emailToValue = $this->ValueList[$n];
                     $emailToType = $this->TypeList[$n];
                     break;
                 }
             }
             if (!$emailToValue && isset($_SESSION[$this->MailRef . "_To"])) {
                 $emailToValue = $_SESSION[$this->MailRef . "_To"];
             }
             if ($emailToValue) {
                 $toArrUpdate = WA_getEmailArray($emailToValue);
                 $emailToValue = $toArrUpdate[0][1];
                 if ($emailToValue) {
                     //check to see if record exists then update / insert as needed
                     $whereClause = WA_AB_generateWhereClause(array($this->EmailColumn), array($emailToType), array($emailToValue), array("="));
                     //$logUpdateTest = mysql_query("SELECT ".WA_AB_cleanUpColumnName($this->EmailColumn)." FROM ".WA_AB_cleanUpColumnName($this->TableName)." WHERE ".$whereClause->sqlWhereClause, $logConnection) or die(mysql_error());
                     //if (mysql_num_rows($logUpdateTest) > 0) {
                     //do update
                     $logUpdate = mysql_query("UPDATE " . WA_AB_cleanUpColumnName($this->TableName) . " SET " . $insertParams->WA_setValues . " WHERE " . $whereClause->sqlWhereClause, $logConnection) or die(mysql_error());
                     //break;
                     //}
                 }
             }
             //mysql_free_result($logUpdateTest);
             break;
         case "create":
             //create email_log table in database (if it doesn't exist) and insert
             //creation handled by UI
             //break; // do not break, continue to insert
         //create email_log table in database (if it doesn't exist) and insert
         //creation handled by UI
         //break; // do not break, continue to insert
         case "insert":
             //insert record to table
             $logInsert = mysql_query("INSERT INTO " . WA_AB_cleanUpColumnName($this->TableName) . " (" . $insertParams->WA_tableValues . ") VALUES (" . $insertParams->WA_dbValues . ")", $logConnection) or die(mysql_error());
             break;
     }
     return true;
 }