protected function getFormattedFileName($uniqueName, $itemInfo) { $pathInfo = pathinfo($_FILES[$uniqueName]['name']); $fileNameFormat = trim($itemInfo['extra']['name_format']) == "" ? get_option('fm-file-name-format') : trim($itemInfo['extra']['name_format']); if ($fileNameFormat == "%filename%") { $newFileName = $pathInfo['filename']; } else { $fileNamePos = strpos($fileNameFormat, '%filename%'); if ($fileNamePos !== false) { if ($fileNamePos > 0) { $before = substr($fileNameFormat, 0, $fileNamePos); $after = substr($fileNameFormat, $fileNamePos + 10, strlen($fileNameFormat) - $fileNamePos - 10); } else { $before = ""; $after = substr($fileNameFormat, -1 * (strlen($fileNameFormat) - 10)); } } $newFileName = ""; if ($before != "") { $newFileName .= fm_get_time($before); } if ($fileNamePos !== false) { $newFileName .= $pathInfo['filename']; } if ($after != "") { $newFileName .= fm_get_time($after); } } $newFileName .= '.' . $pathInfo['extension']; return $newFileName; }
function insertSubmissionData($formID, $dataTable, &$postData) { $q = "INSERT INTO `{$dataTable}` SET "; $arr = array(); $postData['timestamp'] = fm_get_time(); foreach ($postData as $k => $v) { $arr[] = "`{$k}` = '" . $v . "'"; } $q .= implode(",", $arr); $this->query($q); }