Sort order pull down list when uploading an image Sort order pull down list when uploading an image
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Sort order pull down list when uploading an image

Started by Peter R, December 18, 2008, 10:04:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Peter R

I have read that hacks should be posted in the appropriate board, so I did. This one is so simple, that calling it a hack is maybe to much. While uploading an image, you get a pull down list from all the categories and albums you can post the image in. I would think, the order of this list is the same as the order of the categories list, but that is not the case, but I wanted it to be like this. I am using version 1.4.19
For making this happen:


In upload.php, line 225
Change:
    $listArray = array_csort($listArray,'cat','title');
To:
    $listArray = array_csort($listArray,'pos','title');


In upload.php, line 220
Under:
        $listArray[$list_count]['title'] = $album['title'];

Add:
        $listArray[$list_count]['pos'] = $vRes['pos'];


In upload.php, line 209
Change:
        $vQuery = "SELECT cat.name FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";
To:
        $vQuery = "SELECT cat.name, cat.pos FROM " . $CONFIG['TABLE_CATEGORIES'] . " cat, " . $CONFIG['TABLE_ALBUMS'] . " alb WHERE alb.aid='" . $album_id . "' AND cat.cid=alb.category";