Cristian-Petru Pencov wrote:
I'm again in situation to replace some text in user's signature for more than fifty accounts.
with the usual "SQL database" backend for preference storage, it is possible to write code that retrieves the individual users' "identities" preferences (they are serialized PHP objects and can be unserialize()d). Note that one user can have several identities, so for each user, you are looking at an array of arrays. Then, there is both a "signature" and a "signature_html" preference. While parsing and manipulating the normal signature with preg_replace or such shouldn't be too hard to do, things get a bit more complicated when you're dealing with HTML code. Depending on what you would like to change in every user's signature (e.g. phone number or postal address), you might have a hard time parsing the HTML code since users may have selected to use a different font (small, bold, whatever) for parts of the signature, and they might even have done so accidentally. For instance, imagine you're trying to put a new phone number into everyone's signatures, but some user has got opening or closing HTML tags inside the phone number because they missed to select one digit of the phone number when they edited their signature and put all other digits of the phone number into boldface. That really is one mess to sort out if all you wanted to do is write one small script to adapt you users' signatures. Oh, and you'll have to serialize() that stuff and write it back to the database once you've walked through each user's array of identities. Better have a backup of the old data, too, in case something goes wrong.
Jens
smime.p7s
Description: S/MIME Cryptographic Signature
-- imp mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: imp-unsubscr...@lists.horde.org