Exemplo n.º 1
0
/**
 * Writes a log statement into the entity log file.
 * 
 * @param WebSoccer $websoccer application context.
 * @param string $type edit|delete
 * @param string $username name of admin who executed an action.
 * @param string $entity name of affacted entity.
 * @param string $entityValue string value which identifies the entity item.
 */
function logAdminAction(WebSoccer $websoccer, $type, $username, $entity, $entityValue)
{
    $userIp = getenv('REMOTE_ADDR');
    $message = $websoccer->getFormattedDatetime($websoccer->getNowAsTimestamp()) . ';' . $username . ';' . $userIp . ';' . $type . ';' . $entity . ';' . $entityValue;
    $file = BASE_FOLDER . '/generated/entitylog.php';
    $fw = new FileWriter($file, FALSE);
    $fw->writeLine($message);
    $fw->close();
}