/usr/share/IlohaMail/include/array2sql.inc is in ilohamail 0.8.14-0rc3sid6.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <?php
/*
array2sql.inc - Convert associative array into sql request
(C)Copyright 2002 Ryo Chijiiwa
This file is part of IlohaMail, released under GPL
Params:
$table - Table name
$array - Array, key=field name, val=data
$action - String: "INSERT" or "UPDATE"
*/
function Array2SQL($table, $array, $action){
$fields="";
$vals="";
$sql="";
if (strcasecmp($action,"INSERT")==0){
reset($array);
while ( list($field, $val) = each($array) ){
$fields .= (!empty($fields)?",":"").$field;
$vals .= (!empty($vals)?",":"")."'".$val."'";
}
$sql = "INSERT INTO $table ($fields) VALUES ($vals)";
}else if (strcasecmp($action, "UPDATE")==0){
reset($array);
while ( list($field, $val) = each($array) )
$sql .= (!empty($sql)?",":"")."$field='$val'";
$sql = "UPDATE $table SET ".$sql;
}
return $sql;
}
?>
|