'', 'last_code_update' => '', 'code_version' => '1.0.2', 'db_version' => '1' ); $res = $db->Execute('SELECT * FROM dpversion LIMIT 1'); if ($res && $res->RecordCount() > 0) { $row = $res->FetchRow(); $result['last_db_update'] = str_replace('-', '', $row['last_db_update']); $result['last_code_update'] = str_replace('-', '', $row['last_code_update']); $result['code_version'] = $row['code_version'] ? $row['code_version'] : '1.0.2'; $result['db_version'] = $row['db_version'] ? $row['db_version'] : '1'; } return $result; } /* * Utility function to split given SQL-Code * @param $sql string SQL-Code * @param $last_update string last update that has been installed */ function InstallSplitSql($sql, $last_update) { global $lastDBUpdate; $buffer = array(); $ret = array(); $sql = trim($sql); $matched = preg_match_all('/\n#\s*(\d{8})\b/', $sql, $matches); if ($matched) { // Used for updating from previous versions, even if the update // is not correctly set. $len = count($matches[0]); $lastDBUpdate = $matches[1][$len-1]; } if ($last_update && $last_update != '00000000') { // Find the first occurrance of an update that is // greater than the last_update number. dPmsg("Checking for previous updates"); if ($matched) { for ($i = 0; $i < $len; $i++) { if ((int)$last_update < (int)$matches[1][$i]) { // Remove the SQL up to the point found $match = '/^.*' . trim($matches[0][$i]) . '/Us'; $sql = preg_replace($match, "", $sql); break; } } // If we run out of indicators, we need to debunk, otherwise we will reinstall if ($i == $len) return $ret; } } $sql = ereg_replace("\n#[^\n]*\n", "\n", $sql); $in_string = false; for($i=0; $iExecute($pieces[$i])) { $errors++; $dbErr = true; $dbMsg .= $db->ErrorMsg().'
'; } } } dPmsg("There were $errors errors in $piece_count SQL statements"); } class InstallerUI { var $user_id = 0; function setMsg($msg, $msgno = '', $append=false) { return dPmsg($msgno . $msg); } } ?>