Progress report
I'll start gradually publishing the progress on the project's new core.
For more than a week now I've been writing the code for the modules of the project's new core; the user authorization api is done, for example, I dropped the md5 cache, worked out the permissions system, grouping, settings storage...
Yesterday I finished a rather important plugin...
The plugin is a profanity filter. Even though the plugin isn't hard to implement, I still had to sit with it for more than 6 hours in total, including optimizing for execution speed, tests... Since the plugin will be used every time a message is sent in chat or a comment is added, performance is simply essential. After all the trimming, tweaking, and removing all the "convenient" variables... I managed to fit the filter and the dictionary... I couldn't believe it myself, into 41 lines :) Although if you strip away all the code beauty and inline the database query while keeping the code readable, I think it'll come out to 35 lines :)
So what's in those 35 lines? Of course the dictionary of bad words; to speed up iterating over all the words during the check, I implemented a trick of spreading them by alphabet, which gained me about 5-8 times in performance - not bad :) Of course I had to sacrifice memory - a whole 1kb, although by "trimming" convenience I gained much more :D
In the remaining 31 lines there's a parser that splits text into individual words and punctuation marks. Then each word goes on a long journey - a check against the dictionary. Words like... m... avto, aavvvtttoo, avtoooooooo, a v t o and other spelling variants are treated as one little word; ambiguous words like "оскорблять", "требуется" will no longer be flagged as profanity, however this won't let you swear by adding any letters to words; for that I came up with an automatic system for collecting similar words to bad ones. Each such unclear case will raise the coefficient. When the coefficient gets too high, your profile will appear in the moderator's panel, after which they'll review your messages :) If things are really bad - the account goes to the bathhouse, but if it's a mistake, the coefficient is reset and the dictionary gets replenished with exceptions. And for outright profanity the system will ban the person itself for a random term, from an hour to a week :D Oh yes, this coefficient is only visible to admins and mods.
I hope the plugin won't let me down at the most crucial moment :)