Merge branch 'master' of git.tt-rss.org:fox/tt-rss

master
Andrew Dolgov 5 years ago
commit 84bea5086c

@ -153,14 +153,16 @@
$rv = file_get_contents("../config.php-dist"); $rv = file_get_contents("../config.php-dist");
$escape_chars = "\\'";
$settings = [ $settings = [
"%DB_TYPE" => $DB_TYPE == 'pgsql' ? 'pgsql' : 'mysql', "%DB_TYPE" => $DB_TYPE == 'pgsql' ? 'pgsql' : 'mysql',
"%DB_HOST" => addslashes($DB_HOST), "%DB_HOST" => addcslashes($DB_HOST, $escape_chars),
"%DB_USER" => addslashes($DB_USER), "%DB_USER" => addcslashes($DB_USER, $escape_chars),
"%DB_NAME" => addslashes($DB_NAME), "%DB_NAME" => addcslashes($DB_NAME, $escape_chars),
"%DB_PASS" => addslashes($DB_PASS), "%DB_PASS" => addcslashes($DB_PASS, $escape_chars),
"%DB_PORT" => intval($DB_PORT), "%DB_PORT" => $DB_PORT ? intval($DB_PORT) : '',
"%SELF_URL_PATH" => addslashes($SELF_URL_PATH) "%SELF_URL_PATH" => addcslashes($SELF_URL_PATH, $escape_chars)
]; ];
$rv = str_replace(array_keys($settings), array_values($settings), $rv); $rv = str_replace(array_keys($settings), array_values($settings), $rv);
@ -234,28 +236,28 @@
<fieldset> <fieldset>
<label>Username:</label> <label>Username:</label>
<input dojoType="dijit.form.TextBox" required name="DB_USER" size="20" value="<?php echo $DB_USER ?>"/> <input dojoType="dijit.form.TextBox" required name="DB_USER" size="20" value="<?php echo htmlspecialchars($DB_USER) ?>"/>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>Password:</label> <label>Password:</label>
<input dojoType="dijit.form.TextBox" name="DB_PASS" size="20" type="password" value="<?php echo $DB_PASS ?>"/> <input dojoType="dijit.form.TextBox" name="DB_PASS" size="20" type="password" value="<?php echo htmlspecialchars($DB_PASS) ?>"/>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>Database name:</label> <label>Database name:</label>
<input dojoType="dijit.form.TextBox" required name="DB_NAME" size="20" value="<?php echo $DB_NAME ?>"/> <input dojoType="dijit.form.TextBox" required name="DB_NAME" size="20" value="<?php echo htmlspecialchars($DB_NAME) ?>"/>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>Host name:</label> <label>Host name:</label>
<input dojoType="dijit.form.TextBox" name="DB_HOST" size="20" value="<?php echo $DB_HOST ?>"/> <input dojoType="dijit.form.TextBox" name="DB_HOST" size="20" value="<?php echo htmlspecialchars($DB_HOST) ?>"/>
<span class="hint">If needed</span> <span class="hint">If needed</span>
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>Port:</label> <label>Port:</label>
<input dojoType="dijit.form.TextBox" name="DB_PORT" type="number" size="20" value="<?php echo $DB_PORT ?>"/> <input dojoType="dijit.form.TextBox" name="DB_PORT" type="number" size="20" value="<?php echo htmlspecialchars($DB_PORT) ?>"/>
<span class="hint">Usually 3306 for MySQL or 5432 for PostgreSQL</span> <span class="hint">Usually 3306 for MySQL or 5432 for PostgreSQL</span>
</fieldset> </fieldset>
@ -265,7 +267,7 @@
<fieldset> <fieldset>
<label>Tiny Tiny RSS URL:</label> <label>Tiny Tiny RSS URL:</label>
<input dojoType="dijit.form.TextBox" type="url" name="SELF_URL_PATH" placeholder="<?php echo $SELF_URL_PATH; ?>" value="<?php echo $SELF_URL_PATH ?>"/> <input dojoType="dijit.form.TextBox" type="url" name="SELF_URL_PATH" placeholder="<?php echo htmlspecialchars($SELF_URL_PATH); ?>" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/>
</fieldset> </fieldset>
<p><button type="submit" dojoType="dijit.form.Button" class="alt-primary">Test configuration</button></p> <p><button type="submit" dojoType="dijit.form.Button" class="alt-primary">Test configuration</button></p>
@ -336,7 +338,7 @@
$pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT); $pdo = pdo_connect($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $DB_TYPE, $DB_PORT);
if (!$pdo) { if (!$pdo) {
print_error("Unable to connect to database using specified parameters (driver: $DB_TYPE)."); print_error("Unable to connect to database using specified parameters (driver: " . htmlspecialchars($DB_TYPE) . ").");
exit; exit;
} }
@ -362,13 +364,13 @@
<form method="post"> <form method="post">
<input type="hidden" name="op" value="installschema"> <input type="hidden" name="op" value="installschema">
<input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/>
<input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/>
<input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/>
<input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/>
<input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/>
<input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/>
<input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/>
<p> <p>
<?php if ($need_confirm) { ?> <?php if ($need_confirm) { ?>
@ -382,13 +384,13 @@
</td><td> </td><td>
<form method="post"> <form method="post">
<input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/>
<input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/>
<input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/>
<input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/>
<input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/>
<input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/>
<input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/>
<input type="hidden" name="op" value="skipschema"> <input type="hidden" name="op" value="skipschema">
@ -440,16 +442,16 @@
<form action="" method="post"> <form action="" method="post">
<input type="hidden" name="op" value="saveconfig"> <input type="hidden" name="op" value="saveconfig">
<input type="hidden" name="DB_USER" value="<?php echo $DB_USER ?>"/> <input type="hidden" name="DB_USER" value="<?php echo htmlspecialchars($DB_USER) ?>"/>
<input type="hidden" name="DB_PASS" value="<?php echo $DB_PASS ?>"/> <input type="hidden" name="DB_PASS" value="<?php echo htmlspecialchars($DB_PASS) ?>"/>
<input type="hidden" name="DB_NAME" value="<?php echo $DB_NAME ?>"/> <input type="hidden" name="DB_NAME" value="<?php echo htmlspecialchars($DB_NAME) ?>"/>
<input type="hidden" name="DB_HOST" value="<?php echo $DB_HOST ?>"/> <input type="hidden" name="DB_HOST" value="<?php echo htmlspecialchars($DB_HOST) ?>"/>
<input type="hidden" name="DB_PORT" value="<?php echo $DB_PORT ?>"/> <input type="hidden" name="DB_PORT" value="<?php echo htmlspecialchars($DB_PORT) ?>"/>
<input type="hidden" name="DB_TYPE" value="<?php echo $DB_TYPE ?>"/> <input type="hidden" name="DB_TYPE" value="<?php echo htmlspecialchars($DB_TYPE) ?>"/>
<input type="hidden" name="SELF_URL_PATH" value="<?php echo $SELF_URL_PATH ?>"/> <input type="hidden" name="SELF_URL_PATH" value="<?php echo htmlspecialchars($SELF_URL_PATH) ?>"/>
<?php print "<textarea rows='20' style='width : 100%'>"; <?php print "<textarea rows='20' style='width : 100%'>";
echo make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS, echo htmlspecialchars(make_config($DB_TYPE, $DB_HOST, $DB_USER, $DB_NAME, $DB_PASS,
$DB_PORT, $SELF_URL_PATH); $DB_PORT, $SELF_URL_PATH));
print "</textarea>"; ?> print "</textarea>"; ?>
<hr/> <hr/>

Loading…
Cancel
Save