// ! Get file extension of the uploaded file // =========================================== $file_extension = strtolower(pathinfo($_FILES[$field_name]['name'], PATHINFO_EXTENSION)) == '' ? false : strtolower(pathinfo($_FILES[$field_name]['name'], PATHINFO_EXTENSION)); // ====================================== // ! Check if file extension is allowed // ====================================== if (isset($file_extension) && in_array($file_extension, $allowed_file_types)) { // ======================================= // ! Try to include the upload helper // ======================================= if (!is_array($_FILES) || !count($_FILES)) { $ajax = array('message' => $backend->lang()->translate('No files!'), 'success' => false); print json_encode($ajax); exit; } else { $current = CAT_Helper_Upload::getInstance($_FILES[$field_name]); if ($current->uploaded) { // If-schleife wenn überschreiben if ($file_overwrite != '') { $current->file_overwrite = true; } else { $current->file_overwrite = false; } $current->process($file_path); if ($current->processed) { $unzip_file = $val->sanitizePost('unzip_' . $file_id); $delete_file = $val->sanitizePost('delete_zip_' . $file_id); if ($unzip_file != '') { $archive = CAT_Helper_Zip::getInstance($current->file_dst_pathname); $archive->config('Path', $dirh->sanitizePath($file_path)); $archive->extract();
if (!$val->sanitizePost('filter_' . $key)) { if ($key == 'code' && isset($_FILES['filter_file'])) { $data[$key] = ''; continue; } $errors[$key] = $backend->lang()->translate('Please fill out the field: {{ name }}', array('name' => $backend->lang()->translate($key))); } else { $data[$key] = $val->sanitizePost('filter_' . $key); } } if (isset($errors['file']) && !isset($errors['code'])) { unset($errors['file']); } if (!count($errors)) { if (isset($_FILES['filter_file']) && isset($_FILES['filter_file']['error']) && $_FILES['filter_file']['error'] != 4) { $file = CAT_Helper_Upload::getInstance($_FILES['filter_file']); $file->no_script = false; $file->allowed = array('application/octet-stream'); $file->process(CAT_Helper_Directory::sanitizePath(CAT_PATH . '/modules/blackcatFilter/filter/')); if (!$file->processed) { $upload_error = $file->error; } else { $data['name'] = $file->file_dst_name_body; } // filter must have the same name as the file // the file will be renamed by the upload helper if it already // exists, so we use the destination name here } } if (count($errors) || $upload_error) { $showit = true;
continue; } $dir .= '/' . $sub; if (file_exists($dir . '/framework/class.secure.php')) { include $dir . '/framework/class.secure.php'; $inc = true; break; } } if (!$inc) { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } // handle upload if (CAT_Helper_Validate::sanitizePost('upload') && isset($_FILES['userfile']) && is_array($_FILES['userfile'])) { $p = CAT_Helper_Upload::getInstance($_FILES['userfile'], CAT_PATH . '/temp'); $p->file_overwrite = true; $p->process(CAT_PATH . '/temp'); if ($p->processed) { $subdir = $p->file_dst_name_body; $z = CAT_Helper_Zip::getInstance(CAT_PATH . '/temp/' . $p->file_dst_name)->config('Path', CAT_PATH . '/modules/lib_jquery/plugins/' . $subdir); $z->extract(); } } // get already installed plugins $files = CAT_Helper_Directory::getInstance()->maxRecursionDepth(0)->getDirectories(CAT_PATH . '/modules/lib_jquery/plugins', CAT_PATH . '/modules/lib_jquery/plugins/'); $readmes = jqpmgr_getReadmes($files); $parser->setPath(CAT_PATH . '/modules/jquery_plugin_mgr/templates/default'); $parser->output('tool', array('plugins' => $files, 'readmes' => $readmes)); function jqpmgr_getReadmes($plugins) {