forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: AWJunkies on January 29, 2006, 08:53:01 pm

Title: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on January 29, 2006, 08:53:01 pm
##############################################################
## MOD Title: JUpload Mod
## MOD Author: mstralka < your_email > (Mark Stralka) http://www.photo-junky.com Edited AWJunkies aellis@awjunkies.com
## MOD Description: This allows users to upload multiple pictures
## easily, even if they do not have Windows XP.  It is a Java applet
## MOD Version: 2.5.0
## MODED by AWJunkies to work with 1.4.x
## Installation Level: Beginner
## Installation Time: 5 Minutes
## Files To Edit: lang/english.php, groupmgr.php, includes/init.inc.php, bridge/coppermine.inc.php
## Included Files: (upload.php)
##############################################################
##############################################################
## Author Notes: Download and install jupload from http://jupload.biz (http://jupload.biz)
## Put JUpload.jar in the same directory as your coppermmine files or modify
## function jupload_applet() to point to it
## I recommend you install my Multiple Edit mod first:
## http://forum.coppermine-gallery.net/index.php?topic=9391.msg125116#msg125116 (http://forum.coppermine-gallery.net/index.php?topic=9391.msg125116#msg125116) DO NOT DO THE upload.php edits when using the below upload file or follow along and edit the edit all at once mod changes.
##############################################################
## MOD History:
##   2006-03-27 - Version 1.5.0 Edited by AWJunkies
##   2004-07-25 - Version 1.0.0
##      - Initial release, required separate files
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

[edit GauGau 2006-01-29]
Split this thread that deals with the JUpload mod for cpg1.4.x from the "original" thread "Cross-platform Batch Uploading (http://forum.coppermine-gallery.net/index.php?topic=8199.0)" that was made for cpg1.3.x
Thanks for the contrib.
[/edit]

##Database modifications
Code: [Select]
ALTER TABLE `cpg143_usergroups` ADD `can_use_jupload` TINYINT( 4 ) DEFAULT '0' NOT NULL ;

!EDIT ALL AT ONCE MOD:
Code: [Select]
INSERT INTO `cpg143_config` ( `name` , `value` )
VALUES (
'allow_assign_multiple_photos', '0'
);

Adding this code will create a Yes/No option on the CONFIG page, under User Settings.  The default value
is No, which means uploads will work just like they do now.  Setting it to Yes will turn on the mod.
lang/english.php
FIND:
Code: [Select]
  'User settings',
  array('Allow new user registrations', 'allow_user_registration', 1),
  array('User registration requires email verification', 'reg_requires_valid_email', 1),
ADD to end of User Settings section:
Code: [Select]
  array('Allow users to assign uploaded photos at once (instead of one-at-a-time)','allow_assign_multiple_photos',1), //Mark Stralka cpg1.3.2
END OF EDIT ALL AT ONCE MOD!

lang/english.php
FIND:
Code: [Select]
if (defined('UPLOAD_PHP')) $lang_upload_php = array(
ADD:
Code: [Select]
  'jupload_title' => 'Upload multiple photos', //JUpload MOD

Find:
Code: [Select]
if (defined('GROUPMGR_PHP')) $lang_groupmgr_php = array(
add this line to the array:
Code: [Select]
'can_use_jupload' => 'Can use JUpload',

USE MY ATTACHED upload.txt instead of doing all thee upload.php edits! AWJunkies

groupmgr.php - groups need to have permission to use JUPLOAD - added permission field 'can_use_jupload'
FIND:
Code: [Select]
$field_list = array('can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval');
Replace With:
Code: [Select]
$field_list = array('can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval', 'can_use_jupload');

FIND:
Code: [Select]
function process_post_data()
{
    global $CONFIG;

    $field_list = array('group_name', 'group_quota', 'can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval', 'upload_form_config', 'custom_user_upload', 'num_file_upload', 'num_URI_upload');
Replace With:
Code: [Select]
function process_post_data()
{
    global $CONFIG;
    //added 'can_use_jupload'
    $field_list = array('group_name', 'group_quota', 'can_rate_pictures', 'can_send_ecards', 'can_post_comments', 'can_upload_pictures', 'pub_upl_need_approval', 'can_create_albums', 'priv_upl_need_approval', 'can_use_jupload','upload_form_config', 'custom_user_upload', 'num_file_upload', 'num_URI_upload');

FIND:
Code: [Select]
            elseif ($field_name=='priv_upl_need_approval') {
                echo $tr_start.$td_start.$lang_groupmgr_php['approval'].$td_end;
            }
After ADD:
Code: [Select]
            //JUpload MOD
            elseif ($field_name=='can_use_jupload') {
                echo $tr_start.$td_start.$lang_groupmgr_php['can_use_jupload'].$td_end;
            }

bridge/coppermine.inc.php (if you have a bridged version you "MAY" need to put this in the bridge file session extraction or cookie extraction)
FIND:
Code: [Select]
return ($id) ? array($id, $pass) : false;Add before:
Code: [Select]
if (isset($_GET['cookie'])) {
$USER = @unserialize(@base64_decode($_GET['cookie']));
    $id = $USER[$CONFIG['cookie_name'].'_uid'];
$pass = $USER[$CONFIG['cookie_name'].'_pass'];
}
if (!$pass) return false;

bridge/udb_base.inc.php - added new config variable USER_CAN_USE_JUPLOAD
FIND:
Code: [Select]
define('USER_ID', $USER_DATA['user_id']);
        define('USER_NAME', addslashes($USER_DATA['user_name']));
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', $user_group_set);
        define('USER_IS_ADMIN', $USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);
Replace With:
Code: [Select]
define('USER_ID', $USER_DATA['user_id']);
        define('USER_NAME', addslashes($USER_DATA['user_name']));
        define('USER_GROUP', $USER_DATA['group_name']);
        define('USER_GROUP_SET', $user_group_set);
        define('USER_IS_ADMIN', $USER_DATA['has_admin_access']);
        define('USER_CAN_SEND_ECARDS', (int)$USER_DATA['can_send_ecards']);
        define('USER_CAN_RATE_PICTURES', (int)$USER_DATA['can_rate_pictures']);
        define('USER_CAN_POST_COMMENTS', (int)$USER_DATA['can_post_comments']);
        define('USER_CAN_UPLOAD_PICTURES', (int)$USER_DATA['can_upload_pictures']);
        define('USER_CAN_CREATE_ALBUMS', (int)$USER_DATA['can_create_albums']);
        define('USER_UPLOAD_FORM', (int)$USER_DATA['upload_form_config']);
        define('CUSTOMIZE_UPLOAD_FORM', (int)$USER_DATA['custom_user_upload']);
//JUpload Modification Mark Stralka 7/25/2004
define('USER_CAN_USE_JUPLOAD', (int)$USER_DATA['can_use_jupload']);
        define('NUM_FILE_BOXES', (int)$USER_DATA['num_file_upload']);
        define('NUM_URI_BOXES', (int)$USER_DATA['num_URI_upload']);

FIND:
Code: [Select]
            $result = cpg_db_query("SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, " .
                            "MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, " .
                            "MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, " .
                            "MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, " .
                            "MAX(num_URI_upload) as num_URI_upload, " .
                            "MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, " .
                            "MAX(can_create_albums) as can_create_albums, " .
                            "MAX(has_admin_access) as has_admin_access, " .
                            "MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval, ".
                            "FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id in (" .  implode(",", $groups). ")");
Replace With:
Code: [Select]
            $result = cpg_db_query("SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, " .
                            "MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, " .
                            "MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, " .
                            "MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, " .
                            "MAX(num_URI_upload) as num_URI_upload, " .
                            "MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, " .
                            "MAX(can_create_albums) as can_create_albums, " .
                            "MAX(has_admin_access) as has_admin_access, " .
                            "MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval, ".
                            //JUpload MOD
                            "MAX(can_use_jupload) as can_use_jupload " .
                            "FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id in (" .  implode(",", $groups). ")");
Title: Re: Cross-platform Batch Uploading (cpg1.4.x)
Post by: Joachim Müller on January 30, 2006, 12:16:01 am
@Adam: is your question you sent by PM still valid? If yes, please post it publicly.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) CASH $ REWARD!
Post by: sundelius on March 11, 2006, 08:15:58 pm
Anyone got this to work yet?
I cannot get it to work with Jupload...
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) CASH $ REWARD!
Post by: iblazed on March 15, 2006, 05:24:24 am
I would also be very intrested in knowing if anyone got this working. This would be a great mod to have.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) CASH $ REWARD!
Post by: AWJunkies on March 25, 2006, 11:08:09 pm
WOOT I got it to work! Fully functional. Thanks to guice for the help! Look to post #1 for all instructions.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 28, 2006, 03:59:17 am
looks like there is a problem with the uploaded upload.txt file, it ends on line 2844 with:

Code: [Select]
    $captionLabel = $lang_upload_php['
I think there is ment to be more after this, right?

(gallery gives error: Parse error: syntax error, unexpected $end in /home/.bellow/stevie46j/stevieandamys.com/gallery/upload.php on line 2858)

I tried finishing off the file with the contents of your old upload.txt file, but then the gallery gives:

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2F7b4d44219b.jpg&hash=48f547749357b274730b6dc97af395a95e96a32c)

i have been waiting for this mod to be finished for some time, thanks for all your work.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 28, 2006, 07:30:49 pm
It is something to do with the attachment MOD on this site. I am viewing the upload.txt file on my computer and it has complete code. But when I upload it to the server it cuts it off at that line.? Please someone help figure out why it is doing that.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 28, 2006, 07:34:24 pm
OK fixed it! It had to do with how I was saving it. I saved it as UNIX platform not PC .txt file. So somehow it was messing with the attachment mod upload system. Well happy downloading! :)
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 28, 2006, 08:06:03 pm
Thats great, the problem is my end, but hoping you can fix it for me.

I am still getting the error above (the pic one), here it is in more detail:

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2Faacec93953.jpg&hash=80615adb07a1a9e047719c81cedd7695adebec78)

I think this is because my server is using Mysql 5.0, and it is line 786 of upload.php which is causing the error. line 786 is:

Code: [Select]
    $result = cpg_db_query("SELECT username, user_password AS password, user_id AS userid " . "FROM {$CONFIG['NUKE_USERS']} " . "WHERE user_id ='" . USER_ID . "' ");
i was hoping that you may be able to make it mysql 5.1 compatable?

Thanks again.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 28, 2006, 11:30:50 pm
OOPS I didn't realize there was nuke stuff in there let me fix that. Give me a bit upgrading to 1.4.4 manuely and change the upload.txt file.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 29, 2006, 11:28:12 pm
Fixed it should work for all bridging now. Let me know if you get any issues. Works perfect for me.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 30, 2006, 01:22:25 am
All loads up fine now, but once the files have been uploaded i still get errors when it tries to redirect to the next page. There are two different errors that appear. At first i get this:

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2F32450490dc.jpg&hash=ab0f268e1cc123f15a6124aaa2c15b7fc46dabca)

I have checked all permisions in group manager and i have them all correct, i am logged in as Admin (same happens on a users account)

But then if i go back and try the upload again, i get this (firefox error):

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2F4c92a25d1b.jpg&hash=c60633f19b305550f265f1bd9a9ef891f536ea1f)

if i restart firefox, it goes back to the first error again.

Some more info:

Browser: Firefox (same happens in IE)
Server: UNIX
PHP Version: 5.1.2
MySql Version: 5.0.16
Bridged with: Invision Power Board 2.1.4
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 30, 2006, 02:46:07 am
Ok I am not sure what your bridge values are for username and user_id etc if it does NOT match then it will throw that error or time out.

Check line 786-797 from upload.txt and make sure this works with your bridge.

Code: [Select]
    $result = cpg_db_query("SELECT username, user_password AS password, user_id AS userid " . "FROM {$CONFIG['NUKE_USERS']} " . "WHERE user_id ='" . USER_ID . "' ");
    $user_data = mysql_fetch_array($result);
    mysql_free_result($result);

$pass = $user_data['password'];
// $username = $user_data['username'];
$userid = $user_data['userid'];

// $_COOKIE[$CONFIG['cookie_name'].'_uname'] = $username;
$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $userid;
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $pass;
$cookieEnc = base64_encode(serialize($_COOKIE));
Above is what mine shows with manuel push to user table. I am changing it to flow with bridge right now but my bridge. Hense the changes with the new upload.txt file that you just got. You will need to look back at your bridge file info for those variables or change them totaly to {$f[blah blah stuff to make it work. I will make the necisary changes for you if you can't figure it out by tomorrow. I am leaving the office right now.

Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 30, 2006, 03:45:39 am
i have tried several things, but none of them have worked for me, so some extra help would be great.

My current code in upload.php at that point is:

Code: [Select]
    $result = cpg_db_query("SELECT user_password, user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_id ='" . USER_ID . "' ");
    $user_data = mysql_fetch_array($result);
    mysql_free_result($result);

$pass = $user_data['user_password'];
$userid = $user_data['user_id'];

$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $userid;
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $pass;
$cookieEnc = base64_encode(serialize($_COOKIE));

and the code in my bridge file (im pretty sure this has to be "invisionboard20.inc.php", for invision power board 2.1 right?) is:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source: /cvsroot/coppermine/stable/bridge/invisionboard20.inc.php,v $
  $Revision: 1.4 $
  $Author: gaugau $
  $Date: 2006/02/18 10:11:27 $
**********************************************/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

// Switch that allows overriding the bridge manager with hard-coded values
define('USE_BRIDGEMGR'1);

require_once 
'bridge/udb_base.inc.php';

class 
cpg_udb extends core_udb {

function cpg_udb()
{
global $BRIDGE;

if (!USE_BRIDGEMGR) {
$this->boardurl 'http://localhost/ipb';
require_once('../ipb/conf_global.php');
$this->use_post_based_groups 0;
} else {
require_once($BRIDGE['relative_path_to_config_file'] . '/conf_global.php');
$this->boardurl $INFO['board_url'];
$this->use_post_based_groups $BRIDGE['use_post_based_groups'];
}

// Database connection settings
$this->db = array(
'name' => $INFO['sql_database'],
'host' => $INFO['sql_host'] ? $INFO['sql_host'] : 'localhost',
'user' => $INFO['sql_user'] ,
'password' => $INFO['sql_pass'],
'prefix' =>$INFO['sql_tbl_prefix']
);

// Board table names
$this->table = array(
'users' => 'members',
'groups' => 'groups',
'sessions' => 'sessions'
);

// Derived full table names
$this->usertable '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['users'];
$this->groupstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['groups'];
$this->sessionstable =  '`' $this->db['name'] . '`.' $this->db['prefix'] . $this->table['sessions'];

// Table field names
$this->field = array(
'username' => 'name'// name of 'username' field in users table
'user_id' => 'id'// name of 'id' field in users table
'password' => 'member_login_key'// name of 'password' field in users table
'email' => 'email'// name of 'email' field in users table
'regdate' => 'joined'// name of 'registered' field in users table
'location' => "''"// name of 'location' field in users table
'website' => "''"// name of 'website' field in users table
'usertbl_group_id' => 'mgroup'// name of 'group id' field in users table
'grouptbl_group_id' => 'g_id'// name of 'group id' field in groups table
'grouptbl_group_name' => 'g_title' // name of 'group name' field in groups table
);

// Pages to redirect to
$this->page = array(
'register' => '/index.php?act=Reg&CODE=00',
'editusers' => '/admin.php',
'edituserprofile' => '/index.php?showuser='
);


// Group ids - admin and guest only.
$this->admingroups = array($this->use_post_based_groups $INFO['admin_group'] : 1);
$this->guestgroup $this->use_post_based_groups $INFO['guest_group']+100 3;

// Connect to db
$this->connect();
}

// definition of how to extract id, pass from session cookie
function session_extraction()
{
if (isset($_COOKIE['session_id'])) {
$session_id addslashes($_COOKIE['session_id']);

$sql "SELECT member_id , member_login_key FROM {$this->sessionstable} AS s INNER JOIN {$this->usertable} AS u ON s.member_id = u.id WHERE s.id = '$session_id'";

$result cpg_db_query($sql$this->link_id);

if (mysql_num_rows($result)){
$row mysql_fetch_array($result);
return $row;
}
} else {
return false;
}
}

// definition of how to extract an id and password hash from a cookie
function cookie_extraction()
{
    $id 0;
$pass '';

if (isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])) {
$id = (int)$_COOKIE['member_id'];
$pass substr(addslashes($_COOKIE['pass_hash']), 032);
}
if (isset($_GET['cookie'])) {
$USER = @unserialize(@base64_decode($_GET['cookie']));
     $id $USER[$CONFIG['cookie_name'].'_uid'];
$pass $USER[$CONFIG['cookie_name'].'_pass'];
}
if (!$pass) return false;

return ($id) ? array($id$pass) : false;
}

// definition of actions required to convert a password from user database form to cookie form
function udb_hash_db($password)
{
return $password// unused
}

function login_page()
{
$this->redirect("/index.php?act=Login&CODE=00");
}

function logout_page()
{
$this->redirect("/index.php?act=Login&CODE=06");
}
}

// and go !
$cpg_udb = new cpg_udb;

Thanks again.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 30, 2006, 06:40:40 am
Your invision board code!!!!

Code: [Select]
$this->field = array(
'username' => 'name', // name of 'username' field in users table
'user_id' => 'id', // name of 'id' field in users table
'password' => 'member_login_key', // name of 'password' field in users table

So you need to change username and user_id in upload.php file to match. SO need to do this.

FIND:
Code: [Select]
    $result = cpg_db_query("SELECT user_password, user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_id ='" . USER_ID . "' ");
    $user_data = mysql_fetch_array($result);
    mysql_free_result($result);

$pass = $user_data['user_password'];
$userid = $user_data['user_id'];

$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $userid;
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $pass;
$cookieEnc = base64_encode(serialize($_COOKIE));

REPLACE WITH
Code: [Select]
    $result = cpg_db_query("SELECT member_login_key, id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE id ='" . USER_ID . "' ");
    $user_data = mysql_fetch_array($result);
    mysql_free_result($result);

$pass = $user_data['member_login_key'];
$userid = $user_data['id'];

$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $userid;
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $pass;
$cookieEnc = base64_encode(serialize($_COOKIE));

This should work now if not you need to change {$CONFIG['TABLE_USERS']} to whatever your user table is ( $this->usertable ).
I will have an universal bridge fix sometime tomorrow. Putting together our race car before Formula D in Long Beach.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 30, 2006, 07:18:01 am
ok, so now i have this in upload.php:

Code: [Select]
        $result = cpg_db_query("SELECT member_login_key, id " . "FROM ibf_members " . "WHERE id ='" . USER_ID . "' ");
    $user_data = mysql_fetch_array($result);
    mysql_free_result($result);

$pass = $user_data['member_login_key'];
$userid = $user_data['id'];

$_COOKIE[$CONFIG['cookie_name'].'_uid'] = $userid;
$_COOKIE[$CONFIG['cookie_name'].'_pass'] = $pass;
$cookieEnc = base64_encode(serialize($_COOKIE));

, and still have the same problem that it completely forgets what user i am after uploading the files using jupload:

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2F1c5e42862a.jpg&hash=9c113ff3fdf8de64b89ff67eec076b76f407ba13)

any more ideas on this?  ???
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 30, 2006, 06:19:25 pm
IS your coppermine and invision on the same database? If not then the " FROM ibf_members " wont work. Give me a bit to do the universal bridge fix one for ya. I am just mad busy right now putting together the race car that has to be to LA tomorrow at 5pm.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: steve46 on March 30, 2006, 11:13:12 pm
yeah there all on the same database, if they werent then i would get a mysql error before the upload.php page even loads jupload.

no, worries, i can wait for this, just hope to be able to have it in the future.

Good luck with the car.

[UPDATE]

got more info for you, (by enabling debug mode to everyone). This comes up after i have used jupload to upload the photos, (once the page has been forwarded):

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimageimp.com%2Fuploads%2Fc8b5509ab3.jpg&hash=f514f5a180096bcc7cef08996c148d2c346e76bb)

I think the notices at the bottom show what the problem is. Line 113-131 in invisionboard20.inc.php are:

Code: [Select]
// definition of how to extract an id and password hash from a cookie
function cookie_extraction()
{
    $id = 0;
$pass = '';

if (isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])) {
$id = (int)$_COOKIE['member_id'];
$pass = substr(addslashes($_COOKIE['pass_hash']), 0, 32);
}
if (isset($_GET['cookie'])) {
$USER = @unserialize(@base64_decode($_GET['cookie']));
    $id = $USER[$CONFIG['cookie_name'].'_uid'];
$pass = $USER[$CONFIG['cookie_name'].'_pass'];
}
if (!$pass) return false;

return ($id) ? array($id, $pass) : false;
}
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on March 31, 2006, 03:44:41 am
Put THIS:
Code: [Select]
if (isset($_GET['cookie'])) {
$USER = @unserialize(@base64_decode($_GET['cookie']));
    $id = $USER[$CONFIG['cookie_name'].'_uid'];
$pass = $USER[$CONFIG['cookie_name'].'_pass'];
}
if (!$pass) return false;
after extract session not extract cookie. That is how I have mine and it does work. It doesn't work in extract cookies section. I was just doing it on the fly that bridged people would probably be able to put it in the cookies section and not sessions. Make it easy on yourself and put it in the sessions. Cookies extraction section is ONLY used when first crossing over from invision board to coppermine. Once in coppermine it uses sessions. OR if set shared sessions linked then you never really use the cookie extraction. I will change the code above. That will help you, now make the same changes you have been with the upload.php. It should work! Sorry still building this car no time to double check any of this just doing it on the fly. You can contact me through AIM= AWJunkies and I can help you a LOT more. I will make an universal one when i get the chance. If you want to see it working with 1.4.x version (tested on 1.4.3 and 1.4.4) go here:

www.allwheelphotos.com
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: fayoeu on April 23, 2006, 08:18:20 am
OK fixed it! It had to do with how I was saving it. I saved it as UNIX platform not PC .txt file. So somehow it was messing with the attachment mod upload system. Well happy downloading! :)

I am still having problems downloading the upload.txt file from here. it seems to be truncated. Here is the last thing I see:

Code: [Select]
   5691     //Use the IPTC title or headline for the Coppermine title if available.^M
   5692
   5693     if (isset($iptc['Title']) && !empty($iptc['Title'])) {^M
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: fayoeu on April 23, 2006, 09:28:09 am
I found out that firefox was munging up the download for some reason.  I downloaded it on windows and it worked fine... however, now I am running into a different problem.  When I attempt to upload and the upload is complete, I received a message saying:

Code: [Select]
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    *   This problem can sometimes be caused by disabling or refusing to accept
          cookies.

Here is the request that the server recieves:

192.168.1.2 - - [23/Apr/2006:00:24:34 -0700] "GET /upload.php?control=phase_2&unique_ID=86c1462a&cookie=YTo0OntzOjExOiJjcGcxMzFfZGF0YSI7czo5MjoiWVRveU9udHpPakk2SWtsRUlqdHpPak15T2lKallqQm1abVppWXpZd016ZzFNamhpWldFeE5qVTRPVEV3TkdVM09UTTBNQ0k3Y3pveU9pSmhiU0k3YVRveE8zMD0iO3M6MzI6IjhlYjE1MTgzYzY5ZTE4YzkwZjQyMDJjNDhiYjA4NzQwIjtzOjMyOiJjODJiZGEyNjcyN2Y3ODYzMjRjOGRiYjQ2MzZmY2I1ZCI7czoxMDoiY3BnMTMxX3VpZCI7czoxOiI0IjtzOjExOiJjcGcxMzFfcGFzcyI7czo4OiJzdGFydHJlayI7fQ== HTTP/1.1" 302 55494 "http://neophoto.org/upload.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.2) Gecko/20060419 Fedora/1.5.0.2-1.2.fc5 Firefox/1.5.0.2 pango-text"
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: jonplqs on July 25, 2006, 09:14:39 pm
I did all the steps but i cant see the applet i got this java error

java.lang.ClassFormatError: Incompatible magic value 1010792557 in class file JUpload/startup
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at sun.applet.AppletClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadCode(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Thanks
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: jonplqs on July 25, 2006, 10:45:03 pm
I did all the steps but i cant see the applet i got this java error

java.lang.ClassFormatError: Incompatible magic value 1010792557 in class file JUpload/startup
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at sun.applet.AppletClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.applet.AppletClassLoader.loadCode(Unknown Source)
   at sun.applet.AppletPanel.createApplet(Unknown Source)
   at sun.plugin.AppletViewer.createApplet(Unknown Source)
   at sun.applet.AppletPanel.runLoader(Unknown Source)
   at sun.applet.AppletPanel.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Thanks

Hi. I fix it... But now i have another problem... I upload photos but when the upload procces is finish the web page dont change anything.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: cyis100 on August 01, 2006, 08:01:05 pm
i have done exactly the same as mention but nothing happen and no error.

anyone can screenshot me what is it like after doing so>

tks!
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: cyis100 on August 02, 2006, 04:18:01 am
i am able to install and use it now.

but after uploading some photos, nothing happen and i duno where to find those uploaded photo.

help!

ivan
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) CASH $ REWARD!
Post by: cyis100 on August 02, 2006, 04:19:33 am
WOOT I got it to work! Fully functional. Thanks to guice for the help! Look to post #1 for all instructions.

what next after loading photo as nothing happen?

tks!

ivan
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: Joachim Müller on August 02, 2006, 07:54:05 am
http://coppermine-gallery.net/demo/cpg14x/docs/faq.htm#lamesupport
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: cyis100 on August 04, 2006, 02:23:00 pm
after uploading photo, it did not direct me to add photo into photo album.

did i setup anything wrong?
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: Joachim Müller on August 05, 2006, 07:06:07 am
Is there an echo in here? Don't double-post.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on December 08, 2006, 08:48:01 am
I am back and this mod works perfect for past year+! I have uploaded 500 images at a time. You guys have half the mod right. The userid and pass is not getting passed through the set cookie. I will make changes on this mod for you guys to make universal. Just need to set your userid and pass which is different on everyones setup if they have a bridge so I need to make universal keys for those id's. Or you can manuely set them like I did in my setup. You guys where only 2 lines of code off.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: Ziver on January 08, 2007, 09:32:23 pm
I found out that firefox was munging up the download for some reason.  I downloaded it on windows and it worked fine... however, now I am running into a different problem.  When I attempt to upload and the upload is complete, I received a message saying:

Code: [Select]
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    *   This problem can sometimes be caused by disabling or refusing to accept
          cookies.

Here is the request that the server recieves:

192.168.1.2 - - [23/Apr/2006:00:24:34 -0700] "GET /upload.php?control=phase_2&unique_ID=86c1462a&cookie=YTo0OntzOjExOiJjcGcxMzFfZGF0YSI7czo5MjoiWVRveU9udHpPakk2SWtsRUlqdHpPak15T2lKallqQm1abVppWXpZd016ZzFNamhpWldFeE5qVTRPVEV3TkdVM09UTTBNQ0k3Y3pveU9pSmhiU0k3YVRveE8zMD0iO3M6MzI6IjhlYjE1MTgzYzY5ZTE4YzkwZjQyMDJjNDhiYjA4NzQwIjtzOjMyOiJjODJiZGEyNjcyN2Y3ODYzMjRjOGRiYjQ2MzZmY2I1ZCI7czoxMDoiY3BnMTMxX3VpZCI7czoxOiI0IjtzOjExOiJjcGcxMzFfcGFzcyI7czo4OiJzdGFydHJlayI7fQ== HTTP/1.1" 302 55494 "http://neophoto.org/upload.php" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.2) Gecko/20060419 Fedora/1.5.0.2-1.2.fc5 Firefox/1.5.0.2 pango-text"

Hi I have the same problem. upload.php nerver creates the temp record thats why it loops for ever but I don't now why it dosent create the record.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: jongbj on January 14, 2007, 04:39:53 pm
Hi,

After following the instructions to the letter, and noticing that there are no changes to /include/init.inc.php (which the first part of the instructions mention as a to be changed file), I get the same error in all browsers: Fatal error
and that's it.

My server is an Appach 2.0 with MySQL 5.0.27 and PHP 5.2.0 all on WinXP with SP2

Could anyone hint to the right direction. I've tested the JUpload and that works fine. Coppermine 1.4.10 without the mod also works fine:
See the difference: http://bajor.dyndns.tv/coppermine  (http://bajor.dyndns.tv/coppermine) vs http://bajor.dyndns.tv/copperminetest (http://bajor.dyndns.tv/copperminetest)

Thanks
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: Nibbler on January 14, 2007, 05:06:32 pm
Enable debug mode using the admin panel or http://coppermine-gallery.net/tutorial/debug_mode.php
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: jongbj on January 14, 2007, 07:40:41 pm
Thanks, doing that gave an mysql error saying that the syntax

"MAX(can_use_jupload) as can_use_jupload " .

in /bridge/init.inc.php

is not correct for my version of MySQL (which is 5.0.27).

As I don't really speak MySQL I'm not able to see what is wrong.
I triplechecked whether the code was correctly copied and it was.

Btw, removing the line gave me enterence to the gallery but somehow disabled the admin-function. I was completely locked out, no way to login. :'(
Eventually I had to delete everything and restore a backup to get it working again.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: jongbj on January 15, 2007, 06:35:25 pm
Just found the other tread with the JUpload applet for batch uploading. This does sort of what I need so I won't persue the option in this thread anymore.
Thanks for the help anyway.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: artoonie on February 03, 2007, 05:36:49 am
I'm having the same problem as jongbj. with cpg1410, all i see is "Fatal Error:"

I did the debug mode tutorial thing, and it said:
Code: [Select]
While executing query "SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval MAX(can_use_jupload) as can_use_jupload FROM cpg1410_usergroups WHERE group_id in (1)" on 0

mySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MAX(can_use_jupload) as can_use_jupload FROM cpg1410_usergroups WHERE group_id i' at line 1
All I did different was change cpg143 to cpg1410 in the database query, and added the changes in bridges/coppermine.inc.php to bridges/phpbb2018.inc.php.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: artoonie on February 03, 2007, 05:56:20 pm
I think I figured it out:



It says to replace the following code:
Code: [Select]
            $result = cpg_db_query("SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, " .
                            "MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, " .
                            "MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, " .
                            "MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, " .
                            "MAX(num_URI_upload) as num_URI_upload, " .
                            "MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, " .
                            "MAX(can_create_albums) as can_create_albums, " .
                            "MAX(has_admin_access) as has_admin_access, " .
                            "MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval[u][b],[/b][/u] ".
                            "FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_id in (" .  implode(",", $groups). ")");
However, on the second to last line, there is no comma (bolded). I'm assuming you only put a comma when there is more, so we are "finding" the wrong thing, so I just added that comma (before I just added the next line).

Sorry if that didn't make sense.


....and it works! yay.

Thanks, awesome mod.
Title: Python script to add images to database
Post by: logik9bar on September 06, 2007, 07:53:18 am
It's pretty hacky works in my gallery over about 100 albums and 11,000 images.

You'll need to do the following before running the script...

1. download and install python 2.5
http://www.python.org/download/
2. download and install python imaging library for python 2.5
http://www.pythonware.com/products/pil/
3. download and install mysql for python
http://sourceforge.net/projects/mysql-python
4. extract the attached file to somewhere on your computer (let's say c:\)

run the following from the command line to get a list of options required to import pictures into your database...

python import_to_cpg.py -?

finally run it with something like this...

python import_to_cpg.py -sc:/www/coppermine/albums/holidaysnaps -dcoppermine -uadmin -pasimplepassword -m -a -v

sit back and watch it churn through your images creating thumbs and adding them to your database.

If you managed to get all that to work open up import_to_cpg.py and play around with the category_from_album_path() function to generate your own custom categories.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: logik9bar on September 06, 2007, 08:01:34 am
Doh, posted old zip (album descriptions weren't being read in correctly)
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: logik9bar on September 06, 2007, 03:45:58 pm
Fixed bug where files with the same name would not be added to the database (all my test files had different names).
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on November 20, 2007, 01:03:59 pm
Still works perfect on latest release of coppermine for another year now. I have to do a lot of updates to coppermine so I will update all my mods and be more specific sorry for being MIA and support dropped off.
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: AWJunkies on November 29, 2007, 12:14:50 am
Works with all bridges and latest coppermine now. I will start a new thread i think with all the details.

Nibbler how do you want me to do it?
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: moby5532 on December 03, 2007, 02:44:28 pm
habe alles gemacht wie beschrieben...
allerdings wird bei mir wenn ich auf datei hochladen klicke die jar datei nicht geladen...
http://inseltrip07.pytalhost.de/upload.php
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: moby5532 on December 03, 2007, 02:47:35 pm
sorry... didn't realize it was an english forum...  ;D

again in english:
did everything as described, but by using upload.php
jupload is not loaded... (its in the same directory as upload.php)
http://inseltrip07.pytalhost.de/upload.php
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: moby5532 on December 03, 2007, 03:24:48 pm
sorry for another post, but i'm not allowed to edit my old one...


turned out, that this hack is for an old version of jupload... changed the parameters in upload.txt
and it seems to work now...
Title: Re: Cross-platform Batch Uploading (cpg1.4.x) COMPLETED!
Post by: Joachim Müller on December 03, 2007, 04:26:05 pm
Locking this thread. Everybody who is interessted in JUpload should look into the thread "Upload applet (JUpload) - The easiest and quickest way to upload files ! (http://forum.coppermine-gallery.net/index.php?topic=43432.0)" instead. This one remains only as reference, as it is outdated.