NineChime forum

Furry stuff, oekaki stuff, and other stuff.

You are not logged in.

#1 01-16-2008 16:52:58

Marriland
New member

Moving pictures between multiple boards.

Hi, I have been looking around for an easy way to move drawn pictures across multiple boards to allow more order for each board. For instance, a board with lesser quality art (just for fun), a board with normal quality, and then a board of high quality. One of the things that has always bothered me is that, although integration of multiple boards is relatively simple (all sharing one members table), moving pictures between boards seems to be nil existent and has to be done through manual file moving and database work.

I hate having to delete members art just because it "isn't good enough," because that sounds too snobbish and doesn't help promote artistic development, but if the art that the artist considers to be equivalent of the Mona Lisa is viewed by the other viewers as something that would be better left on a doodle board, the simple solution would be to just move the picture to the doodle board so no one gets upset.

This would make a great feature or addition for a future version of Wacintaki, but I'll be in need of a more immediate solution, so I have been poking around at the code to see if there is any quick remedies to make it an easy one-two process for Admins there to move pictures. I don't have a perfect grasp on the relationships with the code, though.

First of all, is this even allowed, or should I just scrap it and be delete-happy with people's pictures? I obviously wish for no angst for me modifying code so it fits the specific needs (as opposed to the general needs) of my site.

Second, does something like this already exist? I've gone through many of the posts here and haven't found anything on the topic, but that doesn't necessarily mean it is not there.

Third, if it doesn't exist, could I receive an answer if I am going about this task in the right way or not?

This is the current code I have added to the functions.php script (not yet complete):

functions.php

Code:

if ($action == 'moveto') {
    if ($flags['admin']) {
        $picno = w_gpc('picno','i+');
        $board = w_gpc('board');
        switch($board) {
            case 'pro':
                $movedb = 'op_p_';
                break;
            case 'doodle':
                $movedb = 'op_d_';
                break;
            case 'req':
                $movedb = 'op_req_';
                break;
            case 'norm':
            default:
                $movedb = 'op_';
        }
        if ($movedb == $OekakiPoteto_Prefix) {
            // Target board is the same as the current board. Kill the action!
            exit('Same board?'); // What would be the best way to kill a script with Oekaki?
        }

        // SQL call here should pull up the original picture to get its filename # and verify against the supplied $picno variable.
        // It will also carry all of the information to be migrated over to the new table.

        // If there is a match, run a SQL query to the $movedb table and INSERT the data from the previous SQL query.
        // Sounds good, but here's the problem: I need to still fetch the new picture number and rename the file accordingly using the rename() function.
        // I think there is a function called get_new_picnumber(), but I haven't yet (keyword, yet) located it. I'm guessing it's relative, but it'd need to check based on the target board.

        // Afterwards, and after there is a valid new PIC_NO and ID_2 for the moved picture, all comments will be moved and attached to the new entry as well.
    } else {
        // Anything in here to spit out an error so only Admins can do this action?
    }
}

Comments fill in my thoughts on what would likely be involved in getting easy movement between boards. The appropriate changes will be made to any related files to get this to work properly, but the actual action is the trouble-spot.

I appreciate any input on the matter on getting the ability to move pictures between boards, and I also appreciate the fantastic job done on Wacintaki! Thanks! big_smile

EDIT: Using 1.3.11, btw; doing local testing before it goes live to the server.

Last edited by Marriland (01-16-2008 17:43:37)

Offline

#2 01-17-2008 04:51:02

Waccoon
Administrator

Re: Moving pictures between multiple boards.

I hate to dash your hopes, but it's rather difficult to do this, because OekakiPoteto wasn't designed for multi-board support in the first place.

Getting info from the current board is easy, but sending that data to the target board is pretty much impossible without a lot of hard-coded values (such as the $movedb values you have in your code, here).  You also have to copy all the comments, which exist in a different database table than the picture information.

The get_new_picnumber() routine is in paintsave.php.  You'd have to extend that function so any database prefix could be used, such as:

Code:

function get_new_picnumber($my_prefix = '') {
    // Need DB
    global $dbconn, $OekakiPoteto_Prefix;

    // Use the correct database prefix
    if (empty($my_prefix))
        $my_prefix = $Oekaki_Poteto_Prefix;

    // Get piccount
    $result = mysql_query ("UPDATE {$my_prefix}oekakimisc SET miscvalue=(miscvalue + 1) WHERE miscname='piccount'");
    $result = mysql_query ("SELECT miscvalue FROM {$my_prefix}oekakimisc WHERE miscname='piccount'");

    return mysql_result ($result, 0);
}

This would get you the correct PIC_ID for the target board.  Of course, get_new_picnumber() is a flawed method to begin with, so it will likely be replaced with direct inserts in the future, which only makes things more complicated for board transfers.

A high priority for Wacintaki 1.4 is to get all the config information into the database, thus allowing each board to read the database (prefixes) and config settings for each other board, along with the true local paths.  It's the best compromise available given that true multi-board support isn't something I can add without a complete rewrite of the code, and I don't have time to do that.

Offline

Board footer

Yep, still running PunBB
© Copyright 2002–2008 PunBB