SMF attachments in coppermine SMF attachments in coppermine
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

SMF attachments in coppermine

Started by auroramae, June 05, 2006, 06:10:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

auroramae

Hi,

This is less a request for support and more a request for a mod.
I didn't know where to post this or if a mod already exists.
I looked through the boards and I see way to remotely integrate photos into coppermine and a way to see coppermine photos in other locations but this are not quite what I am looking for.

I have an SMF forum and I would like to have it's attachment folder visible in my batch upload section.
I don't want to download photos and upload them again. I could feasilby just move my attachments directory to coppermine albums and point SMF there but I am not sure if that is possible.  Is that possible? Would SMF be able to write to coppermine's album directory? 

A gallery of all he forum's attached pictures would be awesome

Please excuse me if this a redundant question.  I tried searching first.

aurora

Joachim Müller

If you're on Lunix, just create a symlink (or ask your webhost to do so) within the "albums" folder of Coppermine that points to the attachment folder of your BBS. Please note that SMF out of the box encrypts the filenames inside the attachment folder, so you might run into issues identifying which file is which.

auroramae

Thank Youn very much!
I'm clueless, but at least I have somewhere to start.
aurora

Joachim Müller

Another option: afaik SMF allows the avatar / attachment folders to reside outside the SMF folder. Just create a sub-folder within Coppermine's albums folder and change the paths in SMF accordingly to point to those subfolders.

Sizzling Hot


peersr

Quote from: GauGau on June 07, 2006, 09:05:29 AM
Another option: afaik SMF allows the avatar / attachment folders to reside outside the SMF folder. Just create a sub-folder within Coppermine's albums folder and change the paths in SMF accordingly to point to those subfolders.

hello,

both options are working by me - except of one "minor" problem - Simplemachine forum is storing attachments as files without extension... How could I solve this problem?
By batch upload it says:
QuoteOnly files with the following extensions are accepted :
jpg/jpeg/jpe/gif/png/bmp/jpc/jp2/jpx/jb2/swc/iff/asf/asx/mpg/mpeg/wmv/swf/avi/mov/mp3/midi/mid/wma/wav/ogg/psd/doc/txt/rtf/pdf/xls/pps/ppt/zip/gz/mdb.

Sizzling Hot

Quote from: peersr on June 16, 2006, 02:37:12 PM
both options are working by me - except of one "minor" problem - Simplemachine forum is storing attachments as files without extension... How could I solve this problem?

Somewhere is SMF it should say something like encrypt file names (or something like that) - try unchecking that...

peersr

Quote from: Sizzling Hot on June 16, 2006, 02:42:02 PM
Somewhere is SMF it should say something like encrypt file names (or something like that) - try unchecking that...

right!  Encrypt stored filenames  - thanks

auroramae

Thanks very much  for the suggestion about using an album sub folder as the SMF attachment folder.  That was the first thing I thought to do but it seemed too easy... and I worried coppermine would spit them back!

I unchecked the encrypted file function in SMF and the existing filenames did not change.
I decided to download, rename and upload to an album and start fresh with all the subsequent files.
I will just have two forum albums... I'll name them pre-June 2006 and post-June 2006.
There are nearly 300 at this point so that will be a nice album.  Some are thumbs so I will filter them out as I go.

My one concern is what coppermine will do when there are files in the folder that don't have extensions...will it ignore them?

aurora

auroramae

New files posted on SMF since I took off the encryption are named normally.
I have moved the folder over and SMF still writes to it...YAY!
BUT  Coppermine will not overlook the existing encrypted files. 
I can't rename them in SMF or the forum will not recognize them.
Is there anything I can modify to make coppermine ignore the lack of extension on the files.
I tried making ALL files acceptable temporarily in config but it didn't help.

Here are the errors coppermine is generating when I try to batch upload.

/include/functions.inc.php

    * Warning line 2914: cannot yet handle MBCS in html_entity_decode()!

       this line repeats for a gazillion lines...or maybe just  three hundred  -- LOL

then

/include/media.functions.inc.php

    * Notice line 53: Undefined index: 128_cc12_jpg2d97ba9cc4e8b94d9f1ecb1cfee16049
    * Notice line 53: Undefined index: 128_cc12_jpg2d97ba9cc4e8b94d9f1ecb1cfee16049
    * Notice line 53: Undefined index: 128_cc12_jpg2d97ba9cc4e8b94d9f1ecb1cfee16049
    * Notice line 53: Undefined index: 128_cc12_jpg2d97ba9cc4e8b94d9f1ecb1cfee16049

/searchnew.php

    * Notice line 244: Undefined variable: lang_db_input_php

/include/plugin_api.inc.php

    * Notice line 651: Only variable references should be returned by reference

The page says to post this debug information
and yes now I realize I should upgrade to the newest vesion --will do that tonight.

USER:
------------------
Array
(
    [ID] => 96ee5d4b63cf0550ede187c3a063b055
    [am] => 1
    [lang] => english
)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 1
    [user_name] => admin
    [groups] => Array
        (
            [0] => 1
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg145_filetypes; (0s)
    [1] => select * from cpg145_plugins order by priority asc; (0s)
    [2] => delete from `mahoning_gallery`.cpg145_sessions where time<1150940883 and remember=0; (0s)
    [3] => delete from `mahoning_gallery`.cpg145_sessions where time<1149734883; (0s)
    [4] => select user_id from `mahoning_gallery`.cpg145_sessions where session_id=md5("b3e03cf7b1f0cf3cecb80eca639d511e4230aa777671875acf0c3a7a8e3cb911"); (0s)
    [5] => select user_id as id, user_password as password from `mahoning_gallery`.cpg145_users where user_id=1 (0s)
    [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `mahoning_gallery`.cpg145_users AS u INNER JOIN `mahoning_gallery`.cpg145_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='1' (0s)
    [7] => SELECT user_group_list FROM `mahoning_gallery`.cpg145_users AS u WHERE user_id='1' and user_group_list <> ''; (0s)
    [8] => 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 cpg145_usergroups WHERE group_id in (1) (0s)
    [9] => SELECT group_name FROM  cpg145_usergroups WHERE group_id= 1 (0s)
    [10] => update `mahoning_gallery`.cpg145_sessions set time='1150944483' where session_id=md5('b3e03cf7b1f0cf3cecb80eca639d511e4230aa777671875acf0c3a7a8e3cb911'); (0s)
    [11] => SELECT user_favpics FROM cpg145_favpics WHERE user_id = 1 (0s)
    [12] => DELETE FROM cpg145_banned WHERE expiry < '2006-06-22 02:48:03' (0s)
    [13] => SELECT * FROM cpg145_banned WHERE (ip_addr='65.25.93.126' OR ip_addr='65.25.93.126' OR user_id=1) AND brute_force=0 (0s)
    [14] => SELECT aid, title FROM cpg145_albums WHERE 1 (0s)
    [15] => SELECT COUNT(*) FROM cpg145_pictures WHERE approved = 'NO' (0s)
    [16] => SELECT filepath, filename FROM cpg145_pictures WHERE filepath LIKE 'forum-june2006%' (0s)
)

==========================
GET :
------------------
Array
(
    [startdir] => forum-june2006
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.4.2 - OK
------------------
mySQL version: 4.1.20-standard-log
------------------
Coppermine version: 1.4.5(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support:
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 1
Client API version 4.1.20
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/lib/mysql/mysql.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib64 -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.2.1.2
Linked Version 1.2.1.2
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/lib/php:/usr/local/lib/php | .:/usr/lib/php:/usr/local/lib/php
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | no value | no value
sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | 60 | 60
upload_max_filesize | 2M | 2M
post_max_size | 8M | 8M
==========================
Page generated in 0.106 seconds - 17 queries in 0 seconds - Album set : ; Meta set: ;



any help would be appreciated.

aurora

Joachim Müller

Those are not errors, but notices. Turn notices_display off if you don't know what they mean - they're a dev-only feature.

auroramae

#11
I only turned debugging on to get the details of the error to post here.

When I try to use the folder, a page pops up and says ERROR with nothing else in the window.
Coppermine refuses to accept the folder with the files with no extensions.

I've tried changing the browsable interface option..no help.

What can I change in the config options to make it ignore the lack of extensions?
I would only do it when the site is closed so that it wouldn't pose a security risk.

auroramae

Update:
after upgrading to 1.4.8  I get an error message with  some content!
It is in regard to the file extensions that are accepted.

Joachim Müller

SMF encrypts the file names. As suggested before: turn filename encryption off.

auroramae

Hello again,

I apologize if I am not explaining this issue correctly.
I feel I am causing irritation.  Please excuse my lack of knowledge.

As noted previously, I did turn off encryption.
The encryption directive  only affects new attachments.
The existing encrypted attachments stay encrypted.
I posted to SMF to find out how to decrypt but so far -  no solution.
Coppermine will not ignore the encrypted files in the directory.
New jpg files in the directory are overlooked.

Is there some  way I can edit the searchnew.php and functions.inc.php to force coppermine to ignore the files without extensions?

I  would not  keep the edited PHP files on the server -
I would only upload for file processing and then overwrite with the original PHP  files  after I've finished. 
It would be easier than making new directories, waiting for downloads/uploads, renaming all the files and having 2 copies of each image on the server.

searchnew.php
//File name has been changed, let's get a unique filename and rename the existing file.
                  $matches = array();
                  if (!preg_match("/(.+)\.(.*?)\Z/", $newfile, $matches)) {
                      $matches[1] = 'invalid_fname';
                      $matches[2] = 'xxx';
                  }

                  if ($matches[2] == '' || !is_known_filetype($matches)) {
                      cpg_die(ERROR, sprintf($lang_db_input_php['err_invalid_fext'], $CONFIG['allowed_file_extensions']), __FILE__, __LINE__);
                  }

                  // Create a unique name for the uploaded file
                  $nr = 0;
                  $picture_name = $matches[1] . '.' . $matches[2];
                  while (file_exists($CONFIG['fullpath'] . $folder . $picture_name)) {
                    $picture_name = $matches[1] . '~' . $nr++ . '.' . $matches[2];
                  }
                  @rename($CONFIG['fullpath'] . $folder . $file, $CONFIG['fullpath'] . $folder . $picture_name);
                  $file = $picture_name;
                }
                $pic_array[] = $file;


functions.inc.php
function replace_forbidden($str)
{
  static $forbidden_chars;
  if (!is_array($forbidden_chars)) {
    global $CONFIG, $mb_utf8_regex;
    if (function_exists('html_entity_decode')) {
      $chars = html_entity_decode($CONFIG['forbiden_fname_char'], ENT_QUOTES, 'UTF-8');
    } else {
      $chars = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;', '&nbsp;', '&#39;'), array('&', '"', '<', '>', ' ', "'"), $CONFIG['forbiden_fname_char']);
    }
    preg_match_all("#$mb_utf8_regex".'|[\x00-\x7F]#', $chars, $forbidden_chars);
  }
  /**
   * $str may also come from $_POST, in this case, all &, ", etc will get replaced with entities.
   * Replace them back to normal chars so that the str_replace below can work.
   */
  $str = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;'), array('&', '"', '<', '>'), $str);;
  $return = str_replace($forbidden_chars[0], '_', $str);

  /**
  * Fix the obscure, misdocumented "feature" in Apache that causes the server
  * to process the last "valid" extension in the filename (rar exploit): replace all
  * dots in the filename except the last one with an underscore.
  */
  // This could be concatenated into a more efficient string later, keeping it in three
  // lines for better readability for now.
  $extension = ltrim(substr($return,strrpos($return,'.')),'.');
  $filenameWithoutExtension = str_replace('.' . $extension, '', $return);
  $return = str_replace('.', '_', $filenameWithoutExtension) . '.' . $extension;

  return $return;


At the SMF support forum someone suggested bridging.  I did that once and log ins became problematic. I gave up. My users are not computer geeks.  They just want to post community news and happenings. Using the gallery to post and then link to the posts from the forum would be too much back and forth for them.

aurora