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('&', '"', '<', '>', ' ', '''), 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('&', '"', '<', '>'), 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