$idx = array(); foreach ($legenda as $key => $header) { $idx[strtolower(trim($header))] = $key; } function check_columns($idx) { $args = func_get_args(); array_shift($args); foreach ($args as $arg) { if (!isset($idx[strtolower($arg)])) { fatal_error('kolom ' . $arg . ' ontbreekt in geuploade file'); } } } // controleer of de benodigde kolommen aanwezig zijn check_columns($idx, 'Incassodatum', 'Soort incasso', 'IBAN', 'BIC tegenrekening', 'T.n.v.', 'Bedrag', 'Omschrijving', 'Kenmerk machtiging', 'Ondertekeningsdatum mandaat'); function get_field($line, $idx, $naam) { return trim($line[$idx[strtolower($naam)]]); } // telt regels in inputbestand, zodat foutmeldingen kunnen worden voorzien van regelnummer $linecounter = 1; $PmtInfs = array(); $CtrlSum = 0; $NbOfTxs = 0; function line_empty($line) { foreach ($line as $elt) { if (trim($elt) != '') { return false; }
function check_status() { global $page, $webimroot, $settings, $dbversion; $page['done'][] = getlocal2("install.0.php", array(phpversion())); if (!check_webimroot()) { return; } if (!check_files()) { return; } $link = check_connection(); if (!$link) { return; } if (!check_database($link)) { mysql_close($link); return; } if (!check_tables($link)) { mysql_close($link); return; } if (!check_columns($link)) { mysql_close($link); return; } check_sound(); $page['done'][] = getlocal("installed.message"); if (!check_admin($link)) { $page['nextstep'] = getlocal("installed.login_link"); $page['nextnotice'] = getlocal2("installed.notice", array("{$webimroot}/install/")); $page['nextstepurl'] = "{$webimroot}/operator/login.php?login=admin"; } $page['show_small_login'] = true; mysql_close($link); loadsettings(); $settings['dbversion'] = $dbversion; update_settings(); }
} // loop througt each table foreach ($tabledate as $tblname => $tbldef) { // check if the table exist _dbinst_write($newline . 'Processing Table "' . $pref . $tblname . '\\n'); $exist = false; $drop = false; $newline = '\\n'; $tablelist = $smcFunc['db_list_tables'](false, $pref . $tblname); if (!empty($tablelist) && in_array($pref . $tblname, $tablelist)) { // exist .. check the cols, the type and value _dbinst_write('.. Table exist, checking columns and indexes.' . $newline); $exist = true; list($cols, $index, $params) = $tbldef; $structure = $smcFunc['db_table_structure']('{db_prefix}' . $tblname, true); $drop = check_columns($cols, $structure['columns']); if (empty($drop)) { $drop = check_indexes($index, $structure['indexes'], $pref . $tblname); } if (empty($drop)) { _dbinst_write('.. Table successful checked.' . $newline); // update the settings table if ($tblname == 'portamx_settings') { // remove the old data row $request = $smcFunc['db_query']('', ' DELETE FROM {db_prefix}portamx_settings WHERE varname = {string:rowname}', array('rowname' => 'keydata')); $request = $smcFunc['db_query']('', ' SELECT config FROM {db_prefix}portamx_settings WHERE varname = {string:rowname}', array('rowname' => 'tblvers')); if ($row = $smcFunc['db_fetch_assoc']($request)) {