This took me some time to analyze, so I thought I would post it to save time to anyone faced with the same problem.
TYPO3 handles timezones, making sure that whatever input it gets is timezone-aware, both server-side, and client-side. Any input in TCEforms that is set to be evaluated as a datetime must be in GMT. TYPO3 backend automatically converts the timestamps based on client timezone before submitting the date. So if one user is in timezone GMT+1, and another is in GMT-5, and they insert a new record simultaneously, the timestamp in the DB will be the same.
TYPO3 then offsets the timestamp by the server offset. When presenting the result to the user, the timestamp is converted to user’s timezone.
Side note: I tested this in the back end – but I need to check the front end. I would assume it displays the time in server’s timezone. If not, it would be interesting how it works with caching…
When inserting records through the TCE, a time() function is not enough. Due to the processing described above, you must offset your timestamp by the timezone difference with GMT, even if you’re inserting it server side, on the same server that you’re storing it on. You can do it by: $data[$table][$uid]['datetime'] = intval($data[$table][$uid]['datetime']) + ($GLOBALS['TYPO3_CONF_VARS']['SYS']['serverTimeZone'] * 3600);
This assumes serverTimeZone has been set correctly in the TYPO3 configuration.
TYPO3 has a table for backend users. Those users need to occasionally upload files to the fileadmin directory via FTP. Wouldn’t it be nice to configure the FTP server to pull from the be_users table and authenticate them, so that two separate locations for userdata don’t have to be maintained?
It’s possible. This guide documents how I was able to set up FTP on a Debian Linux server running TYPO3 4.2. Our TYPO3 installation uses MySQL 5.0 DB.
My FTP server of choice was pure-ftpd. Fortunately this server has MySQL authentication capabilities, they just had to be set up.
apt-get install pure-ftpd-common pure-ftpd-mysql
This will remove plain old pure-ftpd package if you have it, and install the MySQL enabled version, that can use a MySQL DB to authenticate users against.
Next step is to set up the configuration, so edit /etc/pure-ftpd/db/mysq.conf. You need to set some configuration variables:
MYSQLServer: Point it to your MySQL server IP, or localhost
MYSQLUser: DB username
MYSQLPassword: DB password
MYSQLCrypt: TYPO3 encodes be_users passwords with md5
MYSQLGetPW: This query authenticates the user. Here is how I set it up: SELECT password FROM be_users WHERE username="\L" AND LEFT(username, 1) != '_' AND deleted=0
In the first where clause, \L is replaced by the username of a user who is trying to login. The second clause is for security reasons – backend processes running as scheduled tasks require users with a prefix “_” (usually “_cli”). This clause prevents them from being awarded FTP access automatically. Third clause, of course, prevents deleted users from logging in.
MYSQLDefaultUID: since each TYPO3 user might not necessarily have a user account on the server, its better to set the default UID of the file owner here.
MYSQLDefaultGID: same as above, set the user group.
MYSQLGetDir: This is a fun one. As you may know, TYPO3 has file mounts for users and groups, which restrict the user to a certain folder. We would want to restrict the user to the same folder, right?
The disadvantage of the code below is that 1) it requires relative filemounts 2) it ignores multiple filemounts and 3) it only allows one usergroup per user. If a user has several filemounts selected this query will fail, and the user will be denied FTP access. This is a problem I was not able to resolve yet.
SELECT CONCAT('/srv/ftp',file.path) AS Dir
FROM be_users as user
JOIN be_groups as ugroup ON user.usergroup=ugroup.uid
JOIN sys_filemounts as file ON user.file_mountpoints=file.uid OR ugroup.file_mountpoints=file.uid
WHERE user.username="\L" LIMIT 1
Next I tried to connect to FTP, but got an error: ‘Can’t exec /usr/sbin/pure-ftpd’. I had to modify /usr/sbin/pure-ftpd-wrapper to call pure-ftpd-mysql instead of pure-ftpd. This may be different depending on which package you install.
You would also want to secure the FTP by limiting the users to their respective directory. This can be done by creating a file /etc/pure-ftpd/conf/ChrootEveryone with content ‘yes’. Now when they login, they will have access only to their file-mounted folder.
So at this point everything should work. Nothing ever works as planned though, but pure-ftpd writes log messages to syslog, so go there to pinpoint the problem in your installation.
After upgrading a Debian server to use mod_fcgid to run PHP instead of mod_php, I started seeing Internal Server Errors on some pages. Apache Error log had the following: [error] Premature end of script headers: index.php
I haven’t seen messages this useless since my days of coding in Perl! I realized it must be an issue of timeout, since the message appeared after some loading time. Using the following resource, I changed fcgid.conf in /etc/apache2/mods_available directory, adding: BusyTimeout 256
This let the script run longer, allowing it to finish, and release the output to the browser. If it doesn’t work for you, increase the values until it does.
You’ve probably seen Microsoft’s response to Apple’s “I’m a Mac, and I’m a PC commercial”. Well, from a marketing perspective, the campaign is a disaster. Any person familiar with marketing (and I only have a few undergrad courses behind my belt) will tell you that an ad is supposed to build a brand. In this case there are a few choices: Microsoft, Windows, Vista, Windows Live, etc. Yet MS chose to advertise a generic PC. At the end of an ad there is usually a small MS logo and the name Windows, but that’s not what the viewer takes away from the ad.
Apple has already benefited from this campaign by launching hilarious response to the ad, mocking Microsoft’s decision to put more money into advertising, rather than fixing Vista’s problems. And, in today’s economy, Linux is benefiting from the ads, since its a free alternative operating system, which many geeks will tell you is much better than Windows.