case 'support_description': $folderName = 'support'; break; case 'sts_description': $folderName = 'sts'; break; } // set path to module folder in adm_my_files $myFilesProfilePhotos = new MyFiles($folderName); if ($myFilesProfilePhotos->checkSettings()) { // upload photo to images folder of module folder if ($myFilesProfilePhotos->setSubFolder('images')) { // create a filename with the unix timestamp, // so we have a scheme for the filenames and the risk of duplicates is low $localFile = time() . substr($_FILES['upload']['name'], strrpos($_FILES['upload']['name'], '.')); $serverUrl = $myFilesProfilePhotos->getServerPath() . '/' . $localFile; if (file_exists($serverUrl)) { // if file exists than create a random number and append it to the filename $serverUrl = $myFilesProfilePhotos->getServerPath() . '/' . substr($localFile, 0, strrpos($localFile, '.')) . '_' . rand() . substr($localFile, strrpos($localFile, '.')); } $htmlUrl = $g_root_path . '/adm_program/system/show_image.php?module=' . $folderName . '&file=' . $localFile; move_uploaded_file($_FILES['upload']['tmp_name'], $serverUrl); } else { $message = strStripTags($gL10n->get($myFilesProfilePhotos->errorText, $myFilesProfilePhotos->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>')); } } else { $message = strStripTags($gL10n->get($myFilesProfilePhotos->errorText, $myFilesProfilePhotos->errorPath, '<a href="mailto:' . $gPreferences['email_administrator'] . '">', '</a>')); } // now call CKEditor function and send photo data echo '<html><body><script type="text/javascript"> window.parent.CKEDITOR.tools.callFunction(' . $getCKEditorFuncNum . ', "' . $htmlUrl . '","' . $message . '");