public function get_import_location()
{
if (defined('MW_CRON_EXEC')) {
} elseif (!is_admin()) {
return false;
}
$loc = $this->imports_folder;
if ($loc != false) {
return $loc;
}
$folder_root = false;
if (function_exists('userfiles_path')) {
$folder_root = userfiles_path();
} elseif (mw_cache_path()) {
$folder_root = normalize_path(mw_cache_path());
}
$here = $folder_root . 'import' . DS;
if (!is_dir($here)) {
mkdir_recursive($here);
$hta = $here . '.htaccess';
if (!is_file($hta)) {
touch($hta);
file_put_contents($hta, 'Deny from all');
}
}
$here = $folder_root . 'import' . DS . get_table_prefix() . DS;
$here2 = $this->app->option_manager->get('import_location', 'admin/import');
if ($here2 != false and is_string($here2) and trim($here2) != 'default' and trim($here2) != '') {
$here2 = normalize_path($here2, true);
if (!is_dir($here2)) {
mkdir_recursive($here2);
}
if (is_dir($here2)) {
$here = $here2;
}
}
if (!is_dir($here)) {
mkdir_recursive($here);
}
$loc = $here;
$this->imports_folder = $loc;
return $here;
}