CMS MADE SIMPLE FORGE

Company Directory

 

[#12106] copying company listing

avatar
Created By: Jack Skiba (nidus)
Date Submitted: Wed Aug 14 19:45:41 -0400 2019

Assigned To: Robert Campbell (calguy1000)
Version: 1.23.10
CMSMS Version: 2.2.10
Severity: Major
Resolution: None
State: Open
Summary:
copying company listing
Detailed Description:
file action.copycompany.php has two bugs:
$compid = '';
$srcdir =
cms_join_path($gCms->config['uploads_path'],'companydirectory','id'.$compid);
// get params
if( !isset($params['compid']) )
  {
    echo $this->ShowErrors($this->Lang('error_missingparam'));
    return;
  }
$compid = (int)$params['compid'];

should be (srcdir assigned after compid):
$compid = '';
// get params
if( !isset($params['compid']) )
  {
    echo $this->ShowErrors($this->Lang('error_missingparam'));
    return;
  }
$compid = (int)$params['compid'];
$srcdir =
cms_join_path($gCms->config['uploads_path'],'companydirectory','id'.$compid);

if( count($srcfiles) ) {
$destdir =
cms_join_path($gCms->config['uploads_path'],'companydirectory','id'.$new_compid);
  cge_dir::mkdirr($destdir);
  foreach( $srcfiles as $onefile ) {
	$bn = basename($onefile);
	@copy($srcfile,cms_join_path($destdir,$bn));
  }
}

should be the file ($onefile) not the array $srcfile) in copy():
if( count($srcfiles) ) {
$destdir =
cms_join_path($gCms->config['uploads_path'],'companydirectory','id'.$new_compid);
  cge_dir::mkdirr($destdir);
  foreach( $srcfiles as $onefile ) {
	$bn = basename($onefile);
	@copy($onefile,cms_join_path($destdir,$bn));
  }
}

with those changes the listing copy, copies the files into a new directory


History