Plone: Set default timezone (for the entire website) - plone

How to set timezone for my plone website?
I think there must be a global setting for this, but I can't find it.

If you have plone.app.event installed, you can set the default timezone for events under "Event Settings" (/##event-settings).
Without p.a.e, there is, as far as I recall, no explicit support for timezones, so Plone will probably take the time zone globally configured for the server.

You can set the TZ environment variable in your instance configuration (see the option 'environment-vars' in plone.recipe.zope2instance buildout recipe) setting your custom timezone.

Related

Joomla 3.x Administrator datetime doesn't match frontend

I've burn too much time on that one. I really need help.
We have Joomla 3.2.3 installed on a dedicated server.
Our client ask us to set the timezone to New York.
The timezone is setted from UTC (default from joomla) to America/New_York on php.ini.
In the config section in the administrator panel, we've make sure that the timezone was matching with php.ini.
The problem is that there is an offset of 4 hours only in the administrator panel.
If you save a content publish date to 2014-05-28 02:34:00, in MYSQL and in the frontend, it will show 2014-05-28 11:34:00.
This is a timezone issue for sure, but I can't find where I did wrong. Can anyone help?
Again, what I did so far is:
Set timezone to America/New_York in php.ini
Select New York in "System - Global Configuration - Server"
Check in each user profile to set timezone to default.
MySQL and Frontend display -4hours offset.
Thanks for any help. Very appreciated!
-------- UPDATES -----
Problem is finally solved.
Joomla stores date in GMT / UTC format.
I had to reconverted the timezone to display it correctly.
So the lesson would be : "Do not use the raw data from MySQL DB, some need to be converted before".
Problem is finally solved.
Joomla stores date in GMT / UTC format. I had to reconverted the timezone to display it correctly.
So the lesson would be : "Do not use the raw data from MySQL DB, some need to be converted before".

How to set the repository locale in alfresco?

I need to set the repository locale within the alfresco repository so that all my email notifications are sent out in the right language as opposed to the default (english). I have searched but nothing has turned up so far.
After a little searching, I found that this was linked to the server's locale which can be overridden by setting the Java opts in the container startup script
and answered in this post. Thanks Loftux

What is the best IFormatProvider for Logging?

I have an installable ASP.Net application that is logging using Common.Logging.
When writing log messages ie:
_log.InfoFormat(CultureInfo.???, "{0}: Writing to the Log", DateTime.UtcNow);
I am confused about which culture I should be using. The result I want is that the log messages are formatted using the server's regional settings. That way when administrators install the application they have control over how their log messages are formatted.
There are fours options but none seem to be the correct choice:
CultureInfo.CurrentCulture: this seems like it would be the correct choice for a windows app but ASP.Net is changing this to match the user browsing the site - so it's appropriate for formatting content to display to the user but not for writing to the log.
CultureInfo.CurrentUICulture: similar problems to CurrentCulture - will match the current user browsing the site.
CultureInfo.InstalledUICulture: the system installed culture - appears to relate to the copy of windows installed but not alterable by the user. Apparently this one is a bit useless
CultureInfo.InvariantCulture: this is not user configurable. I am wondering if this is the best of the four options here though because at least it is consistent and won't vary by who is browsing the site/the media windows was installed from.
I am left wondering if I need to add explicit configuration in my web.config for the system culture so the installer can choose a culture. The answer I really want is whatever CultureInfo.CurrentCulture was before ASP.Net changed it to match the current user.
Note: I know I can turn off ASP.Net changing the CurrentCulture per user but the UI relies on this behaviour.
Admins like to have control over the logs. Telling them to go configure their server culture so that the logs are in a particular format doesn't seem like the best solution to me.
Adding a configuration option into web.config is a good idea. This will let the admin configure the log format as required.
Rather than ask the user, you could make an intelligent guess while installing using CultureInfo.CurrentCulture. If the user wants it to be something different, he can always change it.
If you do want to take it from CultureInfo.CurrentCulture rather than configuration, you can pick it during the Application_Start event, and keep it in the application context.

Plone & CGI single-sign-on using mod_auth_tkt

A couple of questions have had answers suggesting making use of mod_auth_tkt to allow Plone 4 (Plone and Asp.Net Integration, Use Plone's authentication mechanism to login to other sites.) to authenticate other web applications, and since I have a couple of CGIs that already jump through hoops to authenticate via Plone, this seems ideal for my purpose. However, I can't seem to find much documentation about using mod_auth_tkt in general, and absolutely none about using it with Plone.
I have the following problems.
mod_auth_tkt expects a shared "secret". mod_auth_tkt's examples show Apache getting this from a config file. Plone doesn't share its secrets - so how does Apache know that a given Plone cookie is a valid auth_tkt?
what url would one use in the Apache config TKTAuthLoginURL? [I'm not sure that's vital, as, at the moment, I'm only really interested in ensuring that something is invoked from inside plone, rather than directly as a cgi]
Apache expects the ticket cookie to be named via TKTAuthCookieName (default 'auth_tkt'). What does Plone call it? __ac?
The documentation on using mod_auth_tkt is a man page distributed with the source.
In answer to your specific questions:
In /Plone/acl_users/session. On the Manage secrets tab set a shared secret. (This is described in the documentation for setting up a shared secret with an IIS login form.) You should set the same secret in the Apache config with the TKTAuthSecret directive.
For Plone 4.0 (or Plone 3.x with plone.session 3.x) use /Plone/login_form. For Plone 4.1 use /Plone/login, assuming that the Plone site is hosted at /Plone. Use /login_form or /login if it is hosted at the root.
Plone uses _ac by default, so use TKTAuthCookieName "_ac". (The cookie name Plone uses is set in the acl_users session settings and cookie authentication settings.)
You might have to set TKTAuthBackArgName "came_from", though I think Plone will fallback to the referrer url so it may work without. And you will need to check the "Use mod_auth_tkt compatible hashing algorithm" option on the preferences tab of acl_users/session.
It turns out that there seems to be a conflict with pas.plugins.sqlalchemy. I've been investigating PPS, and while it doesn't seem that there should be any crossover, the site I was testing had PPS installed. When I switched to a site without PPS, setting the "secret" and the mod_auth_tkt flag had the desired effect. Since I seem to have fallen into the maintenance role for pas.plugins.sqlalchemy, I guess it's my problem :-)
Domo arigato, Mr. Rowe-boto!

Limiting ASP.Net cookies to application

I have two applications on my webserver.
myserver.com/ApplicationA
myserver.com/ApplicationB
Both applications are using similar codebases and so there are several overlaps in their cookie names, which are causing problems...
I'm aware that it is possible to limit a cookie in ASP.Net so that only applications on a certain "Path" can access it. However, what I'd really like to do this without having to make any code changes to either application.
Is it possible to configuare an ASP.Net application to default to limiting ALL of its cookies to a certain path?
Thanks,
Neil
Sadly the web.configuration httpCookies element only allows you to set the default domain, and not the path.
You'd need to set the Path property as you write the cookie, which means that you will need to make some code changes - your best bet would probably be to factor out cookie writing to a shared class, and then use either a value from the web.config or get the application root path to set the property correctly.

Resources