{
/* First step. */
if (is_null($action)) {
- $_SESSION['import_data'] = array();
return Horde_Data::IMPORT_FILE;
}
+ // TODO - Must be injected
+ $session = $GLOBALS['injector']->getInstance('Horde_Session');
+
switch ($action) {
case Horde_Data::IMPORT_FILE:
if (!isset($this->_browser)) {
if ($_FILES['import_file']['size'] <= 0) {
throw new Horde_Data_Exception(Horde_Data_Translation::t("The file contained no data."));
}
- $_SESSION['import_data']['format'] = $this->_vars->import_format;
+ $session->set('horde', 'import_data/format', $this->_vars->import_format);
break;
case Horde_Data::IMPORT_MAPPED:
$appKeys = explode("\t", $this->_vars->appKeys);
$map = array();
$dates = array();
+
+ $import_data = $session->get('horde', 'import_data/data', Horde_Session::TYPE_ARRAY);
+
foreach ($appKeys as $key => $app) {
$map[$dataKeys[$key]] = $app;
if (isset($param['time_fields']) &&
$dates[$dataKeys[$key]]['values'] = array();
$i = 0;
/* Build an example array of up to 10 date/time fields. */
- while ($i < count($_SESSION['import_data']['data']) && count($dates[$dataKeys[$key]]['values']) < 10) {
- if (!empty($_SESSION['import_data']['data'][$i][$dataKeys[$key]])) {
- $dates[$dataKeys[$key]]['values'][] = $_SESSION['import_data']['data'][$i][$dataKeys[$key]];
+ while ($i < count($import_data) &&
+ count($dates[$dataKeys[$key]]['values']) < 10) {
+ if (!empty($import_data[$i][$dataKeys[$key]])) {
+ $dates[$dataKeys[$key]]['values'][] = $import_data[$i][$dataKeys[$key]];
}
- $i++;
+ ++$i;
}
}
}
- $_SESSION['import_data']['map'] = $map;
+
+ $session->set('horde', 'import_data/map', $map);
if (count($dates) > 0) {
foreach ($dates as $key => $data) {
if (count($data['values'])) {
- $_SESSION['import_data']['dates'] = $dates;
+ $session->set('horde', 'import_data/dates', $dates);
return Horde_Data::IMPORT_DATETIME;
}
}
);
}
- if (!isset($_SESSION['import_data']['data'])) {
+ if (!$session->exists('horde', 'import_data/data')) {
throw new Horde_Data_Exception('The uploaded data was lost since the previous step.');
}
/* Build the result data set as an associative array. */
$data = array();
- foreach ($_SESSION['import_data']['data'] as $row) {
+ $data_map = $session->get('horde', 'import_data/map', Horde_Session::TYPE_ARRAY);
+
+ foreach ($session->get('horde', 'import_data/data') as $row) {
$data_row = array();
foreach ($row as $key => $val) {
- if (isset($_SESSION['import_data']['map'][$key])) {
- $mapped_key = $_SESSION['import_data']['map'][$key];
+ if (isset($data_map[$key])) {
+ $mapped_key = $data_map[$key];
if ($action == Horde_Data::IMPORT_DATETIME &&
!empty($val) &&
isset($param['time_fields']) &&
isset($param['time_fields'][$mapped_key])) {
$val = $this->_mapDate($val, $param['time_fields'][$mapped_key], $params, $key);
}
- $data_row[$_SESSION['import_data']['map'][$key]] = $val;
+ $data_row[$mapped_key] = $val;
}
}
$data[] = $data_row;
}
+
return $data;
}
}
*/
public function cleanup()
{
- if (isset($_SESSION['import_data']['file_name'])) {
- @unlink($_SESSION['import_data']['file_name']);
+ // TODO - Must be injected
+ $session = $GLOBALS['injector']->getInstance('Horde_Session');
+
+ if ($filename = $session->get('horde', 'import_data/file_name')) {
+ @unlink($filename);
}
- $_SESSION['import_data'] = array();
+ $session->remove('horde', 'import_data');
if ($this->_cleanupCallback) {
return call_user_func($this->_cleanupCallback);
*/
public function nextStep($action, $param = array())
{
+ $session = $GLOBALS['injector']->getInstance('Horde_Session');
+
switch ($action) {
case Horde_Data::IMPORT_FILE:
parent::nextStep($action, $param);
if (!move_uploaded_file($_FILES['import_file']['tmp_name'], $file_name)) {
throw new Horde_Data_Exception('The uploaded file could not be saved.');
}
- $_SESSION['import_data']['file_name'] = $file_name;
+ $session->set('horde', 'import_data/file_name', $file_name);
/* Check if charset was specified. */
- $_SESSION['import_data']['charset'] = $this->_vars->charset;
+ $session->set('horde', 'import_data/charset', $this->_vars->charset);
/* Read the file's first two lines to show them to the user. */
- $_SESSION['import_data']['first_lines'] = '';
- $fp = @fopen($file_name, 'r');
- if ($fp) {
+ $first_lines = '';
+ if ($fp = @fopen($file_name, 'r')) {
$line_no = 1;
while ($line_no < 3 && $line = fgets($fp)) {
- if (!empty($_SESSION['import_data']['charset'])) {
- $line = Horde_String::convertCharset($line, $_SESSION['import_data']['charset'], $this->_charset);
- }
+ $line = Horde_String::convertCharset($line, $this->_vars->charset, $this->_charset);
$newline = Horde_String::length($line) > 100 ? "\n" : '';
- $_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline;
- $line_no++;
+ $first_lines .= substr($line, 0, 100) . $newline;
+ ++$line_no;
}
}
+ $session->set('horde', 'import_data/first_lines', $first_lines);
return Horde_Data::IMPORT_CSV;
case Horde_Data::IMPORT_CSV:
- $_SESSION['import_data']['header'] = $this->_vars->header;
+ $session->set('horde', 'import_data/header', $this->_vars->header);
$import_mapping = array();
if (isset($param['import_mapping'])) {
$import_mapping = $param['import_mapping'];
}
- $import_data = $this->importFile(
- $_SESSION['import_data']['file_name'],
- $_SESSION['import_data']['header'],
+ $session->set('horde', 'import_data/data', $this->importFile(
+ $session->get('horde', 'import_data/file_name'),
+ $this->_vars->header,
$this->_vars->sep,
$this->_vars->quote,
$this->_vars->fields,
$import_mapping,
- $_SESSION['import_data']['charset'],
- $_SESSION['import_data']['crlf']
- );
- $_SESSION['import_data']['data'] = $import_data;
- unset($_SESSION['import_data']['map']);
+ $session->get('horde', 'import_data/charset'),
+ $session->get('horde', 'import_data/crlf')
+ ));
+ $session->remove('horde', 'import_data/map');
return Horde_Data::IMPORT_MAPPED;
default:
*/
public function importData($contents, $header = false, $delimiter = "\t")
{
- if ($_SESSION['import_data']['format'] == 'pine') {
+ if ($GLOBALS['injector']->getInstance('Horde_Session')->get('horde', 'import_data/format') == 'pine') {
$contents = preg_replace('/\n +/', '', $contents);
}
*/
public function nextStep($action, $param = array())
{
+ $session = $GLOBALS['injector']->getInstance('Horde_Session');
+
switch ($action) {
case Horde_Data::IMPORT_FILE:
parent::nextStep($action, $param);
- if ($_SESSION['import_data']['format'] == 'mulberry' ||
- $_SESSION['import_data']['format'] == 'pine') {
- $_SESSION['import_data']['data'] = $this->importFile($_FILES['import_file']['tmp_name']);
- $format = $_SESSION['import_data']['format'];
- if ($format == 'mulberry') {
+ $format = $session->get('horde', 'import_data/format');
+ if (in_array($format, array('mulberry', 'pine'))) {
+ $filedata = $this->importFile($_FILES['import_file']['tmp_name']);
+
+ switch ($format) {
+ case 'mulberry':
$appKeys = array('alias', 'name', 'email', 'company', 'workAddress', 'workPhone', 'homePhone', 'fax', 'notes');
$dataKeys = array(0, 1, 2, 3, 4, 5, 6, 7, 9);
- } elseif ($format == 'pine') {
+ break;
+
+ case 'pine':
$appKeys = array('alias', 'name', 'email', 'notes');
$dataKeys = array(0, 1, 2, 4);
+ break;
}
+
foreach ($appKeys as $key => $app) {
$map[$dataKeys[$key]] = $app;
}
+
$data = array();
- foreach ($_SESSION['import_data']['data'] as $row) {
+ foreach ($filedata as $row) {
$hash = array();
- if ($format == 'mulberry') {
+
+ switch ($format) {
+ case 'mulberry':
if (preg_match("/^Grp:/", $row[0]) || empty($row[1])) {
continue;
}
$hash[$key] = stripslashes(preg_replace('/\\\\r/', "\n", $row[$key]));
}
}
- } elseif ($format == 'pine') {
+ break;
+
+ case 'pine':
if (count($row) < 3 || preg_match("/^#DELETED/", $row[0]) || preg_match("/[()]/", $row[2])) {
continue;
}
$hash[$key] = $row[$key];
}
}
+ break;
}
+
$data[] = $hash;
}
- $_SESSION['import_data']['data'] = $data;
- $_SESSION['import_data']['map'] = $map;
- $ret = $this->nextStep(Horde_Data::IMPORT_DATA, $param);
- return $ret;
+
+ $session->set('horde', 'import_data/data', $data);
+ $session->set('horde', 'import_data/map', $map);
+
+ return $this->nextStep(Horde_Data::IMPORT_DATA, $param);
}
/* Move uploaded file so that we can read it again in the next step
if (!move_uploaded_file($_FILES['import_file']['tmp_name'], $file_name)) {
throw new Horde_Data_Exception('The uploaded file could not be saved.');
}
- $_SESSION['import_data']['file_name'] = $file_name;
+ $session->set('horde', 'import_data/file_name', $file_name);
/* Read the file's first two lines to show them to the user. */
- $_SESSION['import_data']['first_lines'] = '';
- $fp = @fopen($file_name, 'r');
- if ($fp) {
+ $first_lines = '';
+ if ($fp = @fopen($file_name, 'r')) {
$line_no = 1;
- while ($line_no < 3 && $line = fgets($fp)) {
+ while (($line_no < 3) && ($line = fgets($fp))) {
$newline = Horde_String::length($line) > 100 ? "\n" : '';
- $_SESSION['import_data']['first_lines'] .= substr($line, 0, 100) . $newline;
- $line_no++;
+ $first_lines .= substr($line, 0, 100) . $newline;
+ ++$line_no;
}
}
+ $session->set('horde', 'import_data/first_lines', $first_lines);
return Horde_Data::IMPORT_TSV;
case Horde_Data::IMPORT_TSV:
- $_SESSION['import_data']['header'] = $this->_vars->header;
- $import_data = $this->importFile($_SESSION['import_data']['file_name'],
- $_SESSION['import_data']['header']);
- $_SESSION['import_data']['data'] = $import_data;
- unset($_SESSION['import_data']['map']);
+ $session->set('horde', 'import_data/header', $this->_vars->header);
+ $session->set('horde', 'import_data/data', $this->importFile($session->get('horde', 'import_data/file_name'), $session->get('horde', 'import_data/header')));
+ $session->remove('horde', 'import_data/map');
return Horde_Data::IMPORT_MAPPED;
}
</h1>
<div class="headerbox text">
<?php echo _("Here is the beginning of the file:") ?><br />
- <pre><?php echo htmlspecialchars($_SESSION['import_data']['first_lines']) ?></pre><br />
+ <pre><?php echo htmlspecialchars($GLOBALS['session']->get('horde', 'import_data/first_lines')) ?></pre><br />
<?php echo Horde::label('header', _("Does the first row contain the field names? If yes, check this box:")) ?>
<input id="header" type="checkbox" name="header" value="1" checked="checked" /><br />
<?php echo Horde::label('sep', _("What is the delimiter character?")) ?>
- <input type="text" id="sep" name="sep" size="1" value="<?php echo htmlspecialchars($_SESSION['import_data']['sep']) ?>" /><br />
- <?php if (isset($_SESSION['import_data']['quote'])): ?>
+ <input type="text" id="sep" name="sep" size="1" value="<?php echo htmlspecialchars($GLOBALS['session']->get('horde', 'import_data/sep')) ?>" /><br />
+ <?php if ($quote = $GLOBALS['session']->get('horde', 'import_data/quote')): ?>
<?php echo Horde::label('quote', _("What is the quote character?")) ?>
- <input type="text" id="quote" name="quote" size="1" value="<?php echo htmlspecialchars($_SESSION['import_data']['quote']) ?>" /><br />
+ <input type="text" id="quote" name="quote" size="1" value="<?php echo htmlspecialchars($quote) ?>" /><br />
<?php endif; ?>
- <?php if (isset($_SESSION['import_data']['fields'])): ?>
+ <?php if ($fields = $GLOBALS['session']->get('horde', 'import_data/fields')): ?>
<?php echo Horde::label('fields', _("How many fields (columns) are there?")) ?>
- <input type="text" id="fields" name="fields" size="2" value="<?php echo (int)$_SESSION['import_data']['fields'] ?>" /><br />
+ <input type="text" id="fields" name="fields" size="2" value="<?php echo (int)$fields ?>" /><br />
<?php endif; ?>
</div>
<input type="submit" value="<?php echo _("Next") ?>" class="button" />
<?php echo Horde::label('select1', _("Imported fields:")) ?> <br />
<select id="select1" name="select1" size="10">
<?php
- foreach ($_SESSION['import_data']['data'][0] as $key => $value):
+ $data = $GLOBALS['session']->get('horde', 'import_data/data');
+ foreach ($data[0] as $key => $value):
if (!isset($app_fields[$key])):
?>
- <option value="<?php echo htmlspecialchars($key) ?>"><?php echo ($_SESSION['import_data']['header']) ? htmlspecialchars($key) : htmlspecialchars($value) ?></option>
+ <option value="<?php echo htmlspecialchars($key) ?>"><?php echo ($GLOBALS['session']->get('horde', 'import_data/header')) ? htmlspecialchars($key) : htmlspecialchars($value) ?></option>
<?php endif; endforeach; ?>
</select>
</div>
<select id="select2" name="select2" size="10">
<?php
foreach ($app_fields as $key => $value):
- if (!isset($_SESSION['import_data']['data'][0][$key])):
+ if (!isset($data[0][$key])):
if (($key == 'alarm_time') || ($key == 'alarm_date')):
- if (!isset($_SESSION['import_data']['data'][0]['alarm'])):
+ if (!isset($data[0]['alarm'])):
?>
<option value="<?php echo htmlspecialchars($key) ?>"><?php echo htmlspecialchars($value) ?></option>
<?php
endif;
elseif ($key == 'alarm'):
- if (!(isset($_SESSION['import_data']['data'][0]['alarm_time']) &&
- isset($_SESSION['import_data']['data'][0]['alarm_date']))):
+ if (!(isset($data[0]['alarm_time']) &&
+ isset($data[0]['alarm_date']))):
?>
<option value="<?php echo htmlspecialchars($key) ?>"><?php echo htmlspecialchars($value) ?></option>
<?php endif; else: ?>
<select id="selectData" name="selectData" size="10" onchange="document.mapform.selectApp[this.selectedIndex].selected=true">
<?php
$matching = array();
- foreach ($_SESSION['import_data']['data'][0] as $key => $value):
+ foreach ($data[0] as $key => $value):
if (isset($app_fields[$key])):
$matching[] = array($key, $app_fields[$key]);
?>
- <option value="<?php echo htmlspecialchars($key) ?>"><?php echo ($_SESSION['import_data']['header']) ? htmlspecialchars($key) : htmlspecialchars($value) ?></option>
+ <option value="<?php echo htmlspecialchars($key) ?>"><?php echo ($GLOBALS['session']->get('horde', 'import_data/header')) ? htmlspecialchars($key) : htmlspecialchars($value) ?></option>
<?php endif; endforeach; ?>
</select>
<label for="selectApp" class="hidden"><?php echo _("Application") ?></label>
<?php printf(_("Import, Step %d"), (int)$import_step) ?>
</h1>
<table cellspacing="0" width="100%">
-<?php foreach ($_SESSION['import_data']['dates'] as $key => $date): ?>
+<?php
+$map = $GLOBALS['session']->get('horde', 'import_data/map');
+foreach ($GLOBALS['session']->get('horde', 'import_data/dates') as $key => $date): ?>
<tr>
<td>
<table cellspacing="0" width="100%">
<tr><td class="item"> </td></tr>
- <tr><td class="smallheader"><?php printf(_("Imported field: %s"), htmlspecialchars($app_fields[$_SESSION['import_data']['map'][$key]])) ?></td></tr>
+ <tr><td class="smallheader"><?php printf(_("Imported field: %s"), htmlspecialchars($app_fields[$map[$key]])) ?></td></tr>
</table>
</td>
</tr>
</h1>
<div class="headerbox">
<?php echo _("Here is the beginning of the file:") ?><br />
- <pre><?php echo htmlspecialchars($_SESSION['import_data']['first_lines']) ?></pre><br />
+ <pre><?php echo htmlspecialchars($GLOBALS['session']->get('horde', 'import_data/first_lines')) ?></pre><br />
<?php echo Horde::label('header', _("Does the first row contain the field names? If yes, check this box:")) ?>
<input id="header" type="checkbox" name="header" value="1" /><br />
</div>
break;
case Horde_Data::IMPORT_FILE:
- $_SESSION['import_data']['import_cal'] = Horde_Util::getFormData('importCal');
- $_SESSION['import_data']['purge'] = Horde_Util::getFormData('purge');
+ $session->set('horde', 'import_data/import_cal', Horde_Util::getFormData('importCal'));
+ $session->set('horde', 'import_data/purge', Horde_Util::getFormData('purge'));
break;
}
if ($actionID == Horde_Data::IMPORT_FILE) {
$cleanup = true;
try {
- if (!in_array($_SESSION['import_data']['import_cal'], array_keys(Kronolith::listCalendars(Horde_Perms::EDIT)))) {
+ if (!in_array($session->get('horde', 'import_data/import_cal'), array_keys(Kronolith::listCalendars(Horde_Perms::EDIT)))) {
$notification->push(_("You do not have permission to add events to the selected calendar."), 'horde.error');
} else {
$next_step = $data->nextStep($actionID, $param);
if ($max_events !== true) {
$num_events = Kronolith::countEvents();
}
- list($type, $calendar) = explode('_', $_SESSION['import_data']['import_cal'], 2);
+ list($type, $calendar) = explode('_', $session->get('horde', 'import_data/import_cal'), 2);
$kronolith_driver = Kronolith::getDriver($type, $calendar);
if (!count($next_step)) {
$notification->push(sprintf(_("The %s file didn't contain any events."),
- $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.error');
$error = true;
} else {
/* Purge old calendar if requested. */
- if ($_SESSION['import_data']['purge']) {
+ if ($session->get('horde', 'import_data/purge')) {
try {
$kronolith_driver->delete($calendar);
$notification->push(_("Calendar successfully purged."), 'horde.success');
if (!$error) {
$notification->push(sprintf(_("%s file successfully imported"),
- $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.success');
if (Horde_Util::getFormData('import_ajax')) {
Horde::addInlineScript('window.parent.KronolithCore.loadCalendar(\'' . $type . '\', \'' . $calendar . '\');');
}
break;
case Horde_Data::IMPORT_FILE:
- $_SESSION['import_data']['target'] = Horde_Util::getFormData('notepad_target');
+ $session->set('horde', 'import_data/target', Horde_Util::getFormData('notepad_target'));
break;
}
$categories = $cManager->get();
/* Create a Mnemo storage instance. */
- $storage = &Mnemo_Driver::singleton($_SESSION['import_data']['target']);
+ $storage = &Mnemo_Driver::singleton($session->get('horde', 'import_data/target'));
$max_memos = $GLOBALS['injector']->getInstance('Horde_Perms')->hasAppPermission('max_notes');
$num_memos = Mnemo::countMemos();
foreach ($next_step as $row) {
if (is_array($row['created'])) {
$row['created'] = $row['created']['ts'];
}
- $history->log('mnemo:' . $_SESSION['import_data']['target'] . ':' . $note['uid'],
+ $history->log('mnemo:' . $session->get('horde', 'import_data/target') . ':' . $note['uid'],
array('action' => 'add', 'ts' => $row['created']), true);
}
if (!empty($row['modified'])) {
if (is_array($row['modified'])) {
$row['modified'] = $row['modified']['ts'];
}
- $history->log('mnemo:' . $_SESSION['import_data']['target'] . ':' . $note['uid'],
+ $history->log('mnemo:' . $session->get('horde', 'import_data/target') . ':' . $note['uid'],
array('action' => 'modify', 'ts' => $row['modified']), true);
}
if (!count($next_step)) {
$notification->push(sprintf(_("The %s file didn't contain any notes."),
- $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.error');
} elseif (is_a($result, 'PEAR_Error')) {
$notification->push(sprintf(_("There was an error importing the data: %s"),
$result->getMessage()), 'horde.error');
} else {
$notification->push(sprintf(_("%s file successfully imported"),
- $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.success');
}
$next_step = $data->cleanup();
}
break;
case Horde_Data::IMPORT_FILE:
- $_SESSION['import_data']['target'] = Horde_Util::getFormData('tasklist_target');
+ $session->set('horde', 'import_data/target', Horde_Util::getFormData('tasklist_target'));
break;
}
$categories = $cManager->get();
/* Create a Nag storage instance. */
- $storage = Nag_Driver::singleton($_SESSION['import_data']['target']);
+ $storage = Nag_Driver::singleton($session->get('horde', 'import_data/target'));
$max_tasks = $perms->hasAppPermission('max_tasks');
$num_tasks = Nag::countTasks();
$result = null;
if (!count($next_step)) {
$notification->push(sprintf(_("The %s file didn't contain any tasks."),
- $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.error');
} elseif (is_a($result, 'PEAR_Error')) {
$notification->push(sprintf(_("There was an error importing the data: %s"),
$result->getMessage()), 'horde.error');
} else {
$notification->push(sprintf(_("%s successfully imported"),
- $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.success');
}
$next_step = $data->cleanup();
}
break;
}
- $_SESSION['import_data']['target'] = $dest;
- $_SESSION['import_data']['purge'] = Horde_Util::getFormData('purge');
+ $session->set('horde', 'import_data/target', $dest);
+ $session->set('horde', 'import_data/purge', Horde_Util::getFormData('purge'));
break;
case Horde_Data::IMPORT_MAPPED:
case Horde_Data::IMPORT_DATETIME:
- foreach ($cfgSources[$_SESSION['import_data']['target']]['map'] as $field => $null) {
+ foreach ($cfgSources[$session->get('horde', 'import_data/target')]['map'] as $field => $null) {
if (substr($field, 0, 2) != '__' && !is_array($null)) {
if ($attributes[$field]['type'] == 'monthyear' ||
$attributes[$field]['type'] == 'monthdayyear') {
$categories = $cManager->get();
/* Create a Turba storage instance. */
- $dest = $_SESSION['import_data']['target'];
+ $dest = $session->get('horde', 'import_data/target');
try {
$driver = $injector->getInstance('Turba_Driver')->getDriver($source);
} catch (Turba_Exception $e) {
if (!count($next_step)) {
$notification->push(sprintf(_("The %s file didn't contain any contacts."),
- $file_types[$_SESSION['import_data']['format']]), 'horde.error');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.error');
} elseif ($driver) {
/* Purge old address book if requested. */
- if ($_SESSION['import_data']['purge']) {
+ if ($session->get('horde', 'import_data/purge')) {
try {
$driver->deleteAll();
$notification->push(_("Address book successfully purged."), 'horde.success');
}
if (!$error) {
$notification->push(sprintf(_("%s file successfully imported."),
- $file_types[$_SESSION['import_data']['format']]), 'horde.success');
+ $file_types[$session->get('horde', 'import_data/format')]), 'horde.success');
}
}
$next_step = $data->cleanup();
switch ($next_step) {
case Horde_Data::IMPORT_MAPPED:
case Horde_Data::IMPORT_DATETIME:
- foreach ($cfgSources[$_SESSION['import_data']['target']]['map'] as $field => $null) {
+ foreach ($cfgSources[$session->get('horde', 'import_data/target')]['map'] as $field => $null) {
if (substr($field, 0, 2) != '__' && !is_array($null)) {
$app_fields[$field] = $attributes[$field]['label'];
}
case Horde_Data::IMPORT_FILE:
parent::nextStep($action, $param);
- $_SESSION['import_data']['data'] = $this->importFile($_FILES['import_file']['tmp_name']);
+ $f_data = $this->importFile($_FILES['import_file']['tmp_name']);
+
$data = array();
- foreach ($_SESSION['import_data']['data'] as $record) {
+ foreach ($f_data as $record) {
$turbaHash = array();
foreach ($this->_turbaAttr as $value) {
switch ($value) {
$data[] = $turbaHash;
}
- unset($_SESSION['import_data']['data']);
+ $GLOBALS['session']->remove('horde', 'import_data/data');
return $data;
default: