lonemadmax (@lonemadmax)

Forum Replies Created

Viewing 24 replies - 1 through 24 (of 24 total)
  • In reply to: Syntax questions

    lonemadmax
    Member

    @lonemadmax

    fel64’s assumption is correct. You can see the definition of _e() and __() in bb-includes/l10n.php:

    // Return a translated string.

    function __($text, $domain = 'default') {

    // Echo a translated string.

    function _e($text, $domain = 'default') {


    lonemadmax
    Member

    @lonemadmax

    If punbb uses the same markup in posts that phpBB uses (the square bracket things) maybe a few changes to phpbb2bbpress can give you a direct conversion script. I could have a look if you provide me with a database dump from punbb. Also, if you are trying multistep conversions, there’s a script to go from SMF to bbPress :-)

    In reply to: Import SMF to bbPress

    lonemadmax
    Member

    @lonemadmax

    From what I see in topic 856, it seems I’m late again. Does your last message mean that everything’s OK now? I still don’t understand how the cache of 3 different browsers conspired against us, so maybe there’s a problem with the script. Maybe a recount is needed after use. Or it does something wrong to the database under some circumstances, I don’t know. I can say that I didn’t have your problem, but I’ve only tested with bbPress 0.74 and 0.80, and barely enough to have a feeling that it worked (posting after the import is one of the few things I tried). And all feedback I’ve had has come from this topic, so if it is something in the script, you were the first to notice.

    In reply to: Import SMF to bbPress

    lonemadmax
    Member

    @lonemadmax

    Thank you, I’ll do that when I clean the script from the references to phpbb and other stuff one day. This one bit me, as I have PHP4, but the script can still be used to import the data directly and not put it in a file.


    lonemadmax
    Member

    @lonemadmax

    Yep, and with its same name. For example, put kakumei.zip in bb-templates/kakumei/ This was in the README :-), though maybe a bit hidden. Now it has its own section to be easier to spot, and there’s a one-liner to build all the zips in bash.

    Also, a bug and a security issue (hopefully) corrected in the new version.


    lonemadmax
    Member

    @lonemadmax

    New version, same link.

    Changes:

    • Box/reminder/no box option expires with the session.
    • Micro comments in the plugin file, to make changes (esp. removing things) a bit easier.
    • Download link for the themes with the zip, both in the box and in the screenshots page.

    The zips have to be added manually. Hey, just like the themes themselves. It’s better that way, as an automatic creation would make them available and thus you’d be redistributing them, so you’d better check the license. OK, it’s just a cheap excuse to avoid the work :-) I may add that functionality for the admin (create/rebuild/delete zip links in the screenshots page when the admin loads it), but it’s low in my general TODO list. So, until a new bug is found or another good idea pops up that is easy for me to implement, consider it a final version.

    Also, keep in mind that the users can fake cookies and I don’t check their values. I don’t know how much of a risk it is for this case, nor how to solve it (yeah, I could check that only letters appear in the values).


    lonemadmax
    Member

    @lonemadmax

    But the server doesn’t know when a theme is added. It can be done, of course, by checking the existence of the zip when the list of themes is created. But then, you don’t always have writing permissions. And the theme may be updated without erasing the generated zip. It can probably all be worked out by checking permissions, change times, etc. and choosing the appropriate behaviour.

    I’m excited with this and will work on it, but I’ll have to learn a bit of PHP first and then find some time to do it, so don’t hold your breath. I haven’t even started with the cookie expiration time yet.

    Thank you for your comments.


    lonemadmax
    Member

    @lonemadmax

    Download button that will (on click) download the theme currently viewing (even grater if it would zip the theme folder and offer it for download on the fly)

    Good idea! I’ll work on that. I don’t know if zipping on the fly would be nice on the server. I think it’d be better that the admin adds the zip each time he adds a theme. But that’s more work for the admin :-) so I don’t know.

    Remove the Show theme button. Just selecting it in the ddlb should be enough to switch (or some explainetion of how to do this, cause I want to use it without that button)

    You can remove it by deleting the lines that generate it. Line 139 – 142 in cookie_themes.php (that is, from var but = ... to f.appendChild(but);). I put it before adding the “submit on change” stuff, and then I left it just in case the new thing didn’t work. When I tried it yesterday on MSIE, it didn’t work there, you had to use the button. But it may be just my MSIE with paranoid configuration.


    lonemadmax
    Member

    @lonemadmax

    Yep, just have a look at the beginning of the injected javascript, in the plugin file. st is the variable through which you change the CSS of the box. Regarding position, the original file has:

    st.position = "fixed";
    st.left = st.top = "40px";

    Changing top to bottom may give what you are asking for. You can change the value, of course, and add other CSS that you may want. Also, if you know JavaScript, you can make the box work as a draggable window, there are examples of that out there.

    I’ve just tried it under MSIE and guess what, it puts the box in the bottom of the page, after all content (that is, where it is generated). :-)

    And there’s a BUG (I’m talking about my files again, not MSIE positioning). The “close this box for this session” closes it forever. Well, for “more than just this session”, a week, I think. I can’t correct it and test it now, but the change needed would be to add the “just for this session” expiration time for the “annoying_box” cookie. That’d be the third parameter to bb_cookie in line 15 of themes.php. There are only two parameters now, and bbPress takes the absence of the third (or its value being 0) to mean a week. Right now I don’t know if you have to set a value in the past, a negative value or no value to make it a session cookie. In the latter case, it may be necessary to call setcookie directly instead of bb_cookie as bb_cookie changes the no-value case to a week.

    You may also leave that option out, the “box that disappears after 5 seconds” one may be enough.

    In reply to: Import SMF to bbPress

    lonemadmax
    Member

    @lonemadmax

    You don’t have to know Spanish to send mail :-)

    I got your script, and it worked for me. That is, after I added an ‘l’ you deleted with a parenthesis :-). So it seems the problem with your second try was just a typo. In line 521 the original script said:

    $import_sql = utf8_encode($import_sql);

    and yours say:

    $import_sql = $import_sq;

    So add back the ‘l’ or delete the whole line, as it’s useless in the utf8->utf8 version.


    lonemadmax
    Member

    @lonemadmax

    New version, same link. No need to touch core files now. It relies on the bb_foot action to inject the box. More info in the README.


    lonemadmax
    Member

    @lonemadmax

    It looks broken to me. Even the second link gives an error. I’d go and recount everything (there’s an option somewhere in the admin pages). I don’t know if that will solve anything, though, it’s just a wild guess.

    In reply to: Import SMF to bbPress

    lonemadmax
    Member

    @lonemadmax

    I’m very sorry to hear that. The problem is most probably in the script; as I said, I’m a complete newbie to php and databases, and just modified the script without really knowing how much of it worked. The only thing I can say is: have you deleted all occurrences of ut8_encode? There are more than one. Also utf8_decode may give you problems, but I don’t think they’d be the ones your seeing.

    Is there any chance that I could get a dump of your database? (A fake one, with russian characters in fake posts and fake users from SMF in the same conditions as the real one, so that I can play with it here.) If so, please send it to antiswen at yahoo dot es (yep, es, not com). Oh, and please zip it or something so that yahoo doesn’t mess with the text.

    In reply to: En español

    lonemadmax
    Member

    @lonemadmax


    lonemadmax
    Member

    @lonemadmax

    From all those links, I could only get the es_AR one (I’m having some strange problems with my DNS, so it may be just me). So here is my es_ES version.


    lonemadmax
    Member

    @lonemadmax

    At the end of the plugin you can see:

    add_filter('user_sanitize', 'user_sanitize_i18n_fix', 10, 3);

    That adds the function defined in the plugin to the user_sanitize hook. Grepping the core files for user_sanitize, you find return apply_filters( 'user_sanitize'[…] in bb-includes/formatting-functions.php, in the function user_sanitize. When that function is called with strict = true, it removes what it considers not to be a letter, a number or a ‘-‘ from the first parameter (the provided username), and replaces repetitions of ‘-‘ with just one. So the underscore is removed. When strict is false, underscores are kept. Another effect is that accented characters and other such niceties of international scripts are also invalidated.

    After doing that, it runs the filters, telling them its result, the original value and the value of strict. If installed, usernames-i18n-fix will be one of those filters. It returns the original username value (that is, with whatever characters were there from the beginning) if not in strict mode. If strict is true, it just replaces repetitions of ‘-‘ with only one ‘-‘.

    So that’s how I read it. But I don’t know if the names really need the sanitazion.


    lonemadmax
    Member

    @lonemadmax

    Maybe look for the usernames-i18n-fix plugin. It allows much more that underscores, but reading it and the place it hooks to, you may be able to craft something to your liking.


    lonemadmax
    Member

    @lonemadmax

    Unfortunately, I don’t have a place to show it. You can download and install, *your forum will keep its functionality*, just with an optional annoying box reminding you that you can test themes. And only if you install that part.

    Also, a few things I failed to mention: it’s ugly (I just wanted it to work and I’m not a designer, anyway), it expects nice theme names, the box only appears in the pages that use bb_get_header and the template’s header file is supposed to not finish in the middle of a tag (the middle of the tag itself, not its content, of course). Those don’t seem to be great assumptions, even though I’ve only tested it with two themes.

    OK, here it is. Notice though that the selection box is added using evil ways. You may be all well and good if you don’t add it, though. More info in the README.

    A few modifications and it will become a nice plugin that saves the user preferred theme in the db and id not annoying (and only works for registered users when logged in). Will that be useful to anyone?

    In blogs open without registration I usually put an address @example.com. I’ve also found quite a few people use one time addresses. So if this is going to be done, it should be made clear that the address is not just for gravatars and other such stuff. Also, unconfirmed users should be removed after some time to avoid “usernames starvation”.

    In reply to: Import SMF to bbPress

    I’m very sorry. My SMF forum was not in UTF-8. If your try was in a test bbPress forum, try again deleting all utf8_encode calls in the script (leave the argument, of course).

    In reply to: Import SMF to bbPress

    OK, if you are lucky and the server isn’t dead as it usually is, you may get it here.

    Remember, no guarantees. I hadn’t even read php before messing with that script.

    If it’s for a demo, wouldn’t an ad hoc patch be enough? I have not delved into the code, but I guess that adding the name of the chosen theme to the user cookie and changing the function that tells what template is in use to look there first (if necessary) would do. Well, and the dropdown box to select theme, of course.

    In reply to: Import SMF to bbPress

    Sometime ago I adapted a script that imports data from phpBB. Some of the changes are probably a Bad Thing, but it worked for me (about 40 users, 15 forums, 150 topics and 800 posts).

    Among the changes:

    • Keeps current users, forums, etc. in bbPress. The new forum had started, so I wanted that, even though most new messages were just for testing.
    • When an SMF username is found in the bbPress DB, the bbPress user is assigned to the SMF one. Otherwise, a new user is created.
    • Imports tags that can’t be used in bbPress, such as table, flash and some stupid formatting stuff.
    • Probably other things I don’t remember.

    Jump to the CONFIGURATION SECTION and change to match your setup and liking. Wherever you see phpbb it really means smf, of course. One of the things I didn’t do was that type of cleanup. Also, despite the comments saying that you need a fresh new install of bbPress, that’s not true anymore.

    Keep in mind that data reuse only happens with users. If a forum or a topic exists in bbPress with the same name that one from SMF, you’ll probably get two topics with the same name (different ID number, though). I haven’t tested this, and I don’t know if that means problems.

    Also, subforums become forums on their own, as bbPress uses a flat one-level system. If you are using the plugin that allows for subforums, you may be able to correct this afterwards, or even add the code to the script so that it is done.

    If you don’t want any of the probably Bad Things I introduced, get the original one and look compare the

    $export_sql

    lines to have a feeling of what to change.

    Now, if there’s any interest, where do I send it?

Viewing 24 replies - 1 through 24 (of 24 total)