function fetchImportRow($row = 0) { global $mosConfig_absolute_path; if (!importExists()) { return array(); } $filename = $mosConfig_absolute_path . '/administrator/components/com_jtips/import.csv'; if (isJoomla15()) { jimport('joomla.filesystem.path'); JPath::setPermissions($filename); } $handle = fopen($filename, 'r'); //how many lines in csv? $lines = file($filename); if ($row > count($lines) - 1) { jTipsLogger::_log('trying to read csv data beyond length of file, aborting', 'ERROR'); return array(); } $index = 0; $result = array(); while (($data = fgetcsv($handle, 5000, ",")) !== false) { if ($index == $row) { $result = $data; break; } else { $index++; } } fclose($handle); return $result; }
/** * Website: www.jtips.com.au * @author Jeremy Roberts * @copyright Copyright © 2009, jTips * @license Commercial - See website for details * * @since 2.1 - 09/10/2008 * @version 2.1 * @package jTips * * Description: Perform an import */ jTipsSpoofCheck(); set_time_limit(0); global $database; if (!importExists() or !jTipsGetParam($_REQUEST, 'importObject', false)) { //should never get here mosRedirect('index2.php?option=com_jtips&task=list&module=Import', 'Nothing to Import'); } $filename = $mosConfig_absolute_path . '/administrator/components/com_jtips/import.csv'; $handle = fopen($filename, 'r'); $index = 0; $class = jTipsGetParam($_REQUEST, 'importObject', 'jSeason'); require_once 'components/com_jtips/classes/' . strtolower($class) . '.class.php'; $jObj = new $class($database); $header_row = true; $mapping = array(); $importFields = jTipsGetParam($_REQUEST, 'importFields', array()); foreach ($importFields as $header => $field) { if ($field == -1) { continue;