function showAskConfirm() { global $lll; global $hostName, $dbUser, $dbUserPw, $dbName, $dbPort, $dbSocket, $dbPrefix; global $scriptName; $s = ""; iPrint($lll["inst_params"], "ok", $s1); $s .= $s1; $s .= "<table border='1'>"; $s .= "<table border='0'><tr><td>"; $s .= "<pre><strong>"; $s .= $lll["mysqluser"] . ":{$dbUser}<BR>"; $s .= $lll["dbHostName"] . ":{$hostName}<BR>"; $s .= $lll["dbDbName"] . ":{$dbName}<BR>"; $s .= $lll["dbPrefix"] . ":{$dbPrefix}<BR>"; if ($dbSocket != "") { $s .= $lll["dbSocket"] . ":{$dbSocket}<BR>"; } if ($dbPort != "") { $s .= $lll["dbPort"] . ":{$dbPort}<BR>"; } $s .= "</strong></pre>"; $s .= "</td></tr></table>\n"; $s .= "<form method='POST' action='install.php' onsubmit='return checkAccept();'>\n"; $s .= generHiddens(); iPrint($lll["acceptTerms"], "ok", $s1); $s .= "{$s1}<br>"; $s .= "<input type='submit' name='edit' value='" . $lll["edit_params"] . "'>"; $s .= "<br><br>\n"; $s .= "<input type='submit' name='confirm' value='" . $lll["install"] . "'>"; $s .= "</form><br>\n"; $s .= "<textarea rows=30 cols=100>\n" . join('', file(NOAH_APP . '/terms.txt')) . "</textarea>\n"; return $s; }
function update(&$s, $dbName, $fromVersion, $toVersion = "Latest") { global $noahVersions; global $lll; $s = ""; $length = sizeof($noahVersions); if ($toVersion == "Latest") { $toVersion = $noahVersions[$length - 1]; } if (!in_array($fromVersion, $noahVersions) || !in_array($toVersion, $noahVersions)) { iPrint(sprintf($lll["invalid_version"], "{$fromVersion}, {$toVersion}"), "err", $sp); $s .= $sp; return ok; } if ($fromVersion == $toVersion) { iPrint(sprintf($lll["already_installed"], $toVersion), "ok", $sp); $s .= $sp; return ok; } $fromIndex = getIndex($fromVersion); $toIndex = getIndex($toVersion); if ($toIndex < $fromIndex) { iPrint(sprintf($lll["invalid_version"], "{$fromVersion}, {$toVersion}"), "err", $sp); $s .= $sp; return ok; } global $updateOutput; $updateOutput = ""; for ($vInd = $fromIndex + 1; $vInd <= $toIndex; $vInd++) { $fname = NOAH_BASE . "/updateinfo-{$noahVersions[$vInd]}.php"; if (file_exists($fname)) { $contents = join('', file($fname)); if (preg_match('{/\\* Files to delete:\\s*(\\S.*)\\s*\\*/}s', $contents, $matches)) { $filesToDelete = preg_split('/[\\n\\r]+/', $matches[1]); foreach ($filesToDelete as $file) { @unlink(NOAH_BASE . "/{$file}"); } } include $fname; $s .= $updateOutput; } else { updateGlobalstatAndFooter($noahVersions[$vInd]); } } // storing the last update time: executeQueryForUpdate("UPDATE @globalstat SET lastUpdate=NOW()", __FILE__, __LINE__); iPrint($lll["updateSuccessful"], "ok", $sp); $s .= $sp; }