/** * **/ function import_droplets() { global $parser, $backend; $groups = CAT_Users::get_groups_id(); if (!CAT_Helper_Droplet::is_allowed('import_droplets', $groups)) { $backend->print_error($backend->lang()->translate("You don't have the permission to do this")); } $problem = NULL; $info = NULL; if (count($_FILES)) { if (!function_exists('droplets_upload')) { @(include_once dirname(__FILE__) . '/include.php'); } list($result, $data) = droplets_upload('file'); $info = NULL; if (is_array($data)) { $isIndexed = array_values($data) === $data; if ($isIndexed) { $info .= implode('<br />', $data); } else { foreach ($data as $key => $value) { $info .= $key . ' -> ' . $value . "<br />"; } } } if ($result == 'error') { $problem = $backend->lang()->translate('An error occurred when trying to import the Droplet(s)') . '<br /><br />' . $info; } else { $info = $backend->lang()->translate('Successfully imported [{{count}}] Droplet(s)', array('count' => $data)); if (CAT_Helper_Validate::sanitizeGet('save_and_back')) { list_droplets($info); return; } } } $parser->output('import.tpl', array('problem' => $problem, 'info' => $info)); }
/** * **/ function import_droplets() { global $admin, $parser, $database, $MOD_DROPLET; $groups = $admin->get_groups_id(); if (!is_allowed('Import_droplets', $groups)) { $admin->print_error($MOD_DROPLET["You don't have the permission to do this"]); } $problem = NULL; if (count($_FILES)) { list($result, $data) = droplets_upload('file'); $info = NULL; if (is_array($data)) { $isIndexed = array_values($data) === $data; if ($isIndexed) { $info .= implode('<br />', $data); } else { foreach ($data as $key => $value) { $info .= $key . ' -> ' . $value . "<br />"; } } } if ($result == 'error') { $problem = $MOD_DROPLET['An error occurred when trying to import the Droplet(s)'] . '<br /><br />' . $info; } else { List_droplets(str_replace("{{count}}", count($data), $MOD_DROPLET['Successfully imported [{{count}}] Droplet(s)'])); return; } } echo $parser->render('@droplets/import.lte', array('problem' => $problem)); }