Browse Source

Muokkaa tietokanta-asetukset MySQL:n mukaisiksi.

tags/0.8
Linus Vanas 2 months ago
parent
commit
78cf3e9286
5 changed files with 101 additions and 60 deletions
  1. +1
    -0
      LueMinut.txt
  2. +1
    -0
      ReadMe.txt
  3. +4
    -1
      includes/Database.php
  4. +89
    -55
      src/server-locale/fi_FI.UTF-8/LC_MESSAGES/veturi_admin.po
  5. +6
    -4
      www/admin/config/database/index.php

+ 1
- 0
LueMinut.txt View File

@@ -25,6 +25,7 @@ Veturi koostuu neljästä osasta:
* Piirrä yhteydet kartan reunan yli, kun se on lyhyempi reitti.

Ylläpitokäyttöliittymä:
* Muokkaa tietokanta-asetukset MySQL:n mukaisiksi.
* Korjaa vanhojen asetusten käyttö tietokannan alustuksessa.
* Estä vanhentuneen välimuistin käyttö asiakasohjelmassa.
* Käytä yhtä kirjautumislomaketta kaikkiin ylläpitäjätoimintoihin.


+ 1
- 0
ReadMe.txt View File

@@ -24,6 +24,7 @@ Veturi can be seen as made up of four parts:
* Draw connections over the edge of the map when it's the shortest route.

Admin interface:
* Make database-settings MySQL-specific.
* Fix database initialization using old configuration.
* Prevent the client from using outdated cache.
* Use the same login for all admin functions.


+ 4
- 1
includes/Database.php View File

@@ -16,7 +16,10 @@
{
global $CONFIG;
$conf = $CONFIG["database"];
$this->pdo = new PDO($conf["dsn"],$conf["username"],$conf["password"]);

$dsn = "mysql:host=".$conf["host"].";dbname=".$conf["name"];

$this->pdo = new PDO($dsn,$conf["username"],$conf["password"]);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
}



+ 89
- 55
src/server-locale/fi_FI.UTF-8/LC_MESSAGES/veturi_admin.po View File

@@ -8,16 +8,16 @@ msgid ""
msgstr ""
"Project-Id-Version: Veturi 0.8\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-16 21:57+0200\n"
"PO-Revision-Date: 2019-12-16 21:59+0200\n"
"POT-Creation-Date: 2019-12-26 13:15+0200\n"
"PO-Revision-Date: 2019-12-26 13:24+0200\n"
"Last-Translator: Linus Vanas <linus@vanas.fi>\n"
"Language-Team: Finnish\n"
"Language-Team: Finnish <>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 19.08.3\n"
"X-Generator: Lokalize 19.12.0\n"

#: www/admin/config/client/index.php:7 www/admin/config/index.php:11
#: www/admin/index.php:23
@@ -26,17 +26,10 @@ msgstr "Asiakasohjelman asetukset"

#: www/admin/config/client/index.php:12
#: www/admin/config/postconfig/index.php:13
#: www/admin/config/database/index.php:13
#: www/admin/config/database/index.php:12
msgid "No config exists. Please do the preconfig first."
msgstr "Asetustiedostoa ei löytynyt. Aloitathan esiastuksista."

#: www/admin/config/client/index.php:21
#: www/admin/config/postconfig/index.php:22
#: www/admin/config/database/index.php:22
#: www/admin/config/database/index.php:76 includes/admin_util.php:119
msgid "Incorrect password."
msgstr "Väärä salasana."

#: www/admin/config/client/index.php:53
msgid "Error uploading file."
msgstr "Virhe tiedoston lähetyksessä."
@@ -45,45 +38,45 @@ msgstr "Virhe tiedoston lähetyksessä."
msgid "Uploaded file was not an image."
msgstr "Lähetetty tiedosto ei ollut kuva."

#: www/admin/config/client/index.php:68
#: www/admin/config/client/index.php:76
#, php-format
msgid "Saving image failed."
msgstr "Kuvan tallennus epäonnistui."

#: www/admin/config/client/index.php:75 www/admin/config/database/index.php:45
#: www/admin/config/client/index.php:83 www/admin/config/database/index.php:29
msgid "Configuration saved."
msgstr "Asetukset tallennettu."

#: www/admin/config/client/index.php:79 www/admin/config/preconfig/index.php:24
#: www/admin/config/database/index.php:49
#: www/admin/config/client/index.php:87 www/admin/config/preconfig/index.php:25
#: www/admin/config/database/index.php:33
msgid "Saving configuration failed."
msgstr "Asetusten tallennus epäonnistui."

#: www/admin/config/client/index.php:87
#: www/admin/config/client/index.php:96
msgid "Client"
msgstr "Asiakasohjelma"

#: www/admin/config/client/index.php:88
#: www/admin/config/client/index.php:97
msgid "Language:"
msgstr "Kieli:"

#: www/admin/config/client/index.php:114
#: www/admin/config/client/index.php:122
msgid "World"
msgstr "Maailma"

#: www/admin/config/client/index.php:118
#: www/admin/config/client/index.php:126
msgid "Current background image"
msgstr "Nykyinen taustakuva"

#: www/admin/config/client/index.php:120
#: www/admin/config/client/index.php:128
msgid "Change background image:"
msgstr "Muuta taustakuvaa:"

#: www/admin/config/client/index.php:131
#: www/admin/config/client/index.php:139
msgid "Width:"
msgstr "Leveys:"

#: www/admin/config/client/index.php:132
#: www/admin/config/client/index.php:140
msgid "Height:"
msgstr "Korkeus:"

@@ -105,8 +98,8 @@ msgid "Admin account creation failed."
msgstr "Ylläpitäjätilin luonti epäonnistui."

#: www/admin/config/postconfig/index.php:52
#: www/admin/config/database/index.php:70 www/admin/user/create/index.php:29
#: includes/admin_util.php:127
#: www/admin/config/database/index.php:54 www/admin/user/create/index.php:29
#: includes/admin_util.php:145
msgid "Connecting to the database failed."
msgstr "Tietokantaan yhdistäminen epäonnistui."

@@ -115,11 +108,39 @@ msgid "Account"
msgstr "Tili"

#: www/admin/config/postconfig/index.php:60
#: www/admin/config/database/index.php:90 www/admin/user/create/index.php:36
#: includes/admin_util.php:164
#: www/admin/config/database/index.php:70 www/admin/user/create/index.php:36
#: includes/admin_util.php:173
msgid "Username:"
msgstr "Käyttäjätunnus:"

#: www/admin/config/postconfig/index.php:63
msgid "Admin privileges"
msgstr "Ylläpitäjäoikeudet"

#: www/admin/config/postconfig/index.php:64
msgid "Manage users"
msgstr "Hallitse käyttäjiä"

#: www/admin/config/postconfig/index.php:65
msgid "Edit gameworld"
msgstr "Muokkaa pelimaailmaa"

#: www/admin/config/postconfig/index.php:66
msgid "Edit game configuration"
msgstr "Muokkaa pelin asetuksia"

#: www/admin/config/postconfig/index.php:67
msgid "Edit client configuration"
msgstr "Muokkaa asiakasohjelman asetuksia"

#: www/admin/config/postconfig/index.php:68
msgid "Edit server configuration"
msgstr "Muokkaa palvelimen asetuksia"

#: www/admin/config/postconfig/index.php:69
msgid "Manage admin privileges"
msgstr "Hallitse ylläpitäjäoikeuksia"

#: www/admin/config/preconfig/index.php:10
msgid "A config already exists."
msgstr "Asetustiedosto on jo olemassa."
@@ -133,7 +154,11 @@ msgstr ""
"Asetukset on alustettu. Salasana niiden muokkaamiseksi on \"%1$s\" (ilman "
"lainausmerkkejä)."

#: www/admin/config/preconfig/index.php:48 www/admin/config/index.php:9
#: www/admin/config/preconfig/index.php:21
msgid "To use the configuration password, leave the username empty."
msgstr "Käyttääksesi asetussalasanaa, jätä käyttäjänimi tyhjäksi."

#: www/admin/config/preconfig/index.php:49 www/admin/config/index.php:9
#: www/admin/index.php:21
msgid "Preconfig"
msgstr "Esiasetukset"
@@ -152,27 +177,31 @@ msgstr "Tietokanta-asetukset"
msgid "Back to administration index"
msgstr "Taikaisin ylläpitäjätoimintojen sisällysluetteloon"

#: www/admin/config/database/index.php:61
#: www/admin/config/database/index.php:45
msgid "Database initialized."
msgstr "Tietokanta alustettu"

#: www/admin/config/database/index.php:65
#: www/admin/config/database/index.php:49
msgid "Database initialization failed."
msgstr "Tietokannan alustus epäonnistui."

#: www/admin/config/database/index.php:88
msgid "Database"
msgstr "Tietokanta"
#: www/admin/config/database/index.php:67
msgid "MySQL Database"
msgstr "MySQL tietokanta"

#: www/admin/config/database/index.php:89
msgid "DSN:"
msgstr ""
#: www/admin/config/database/index.php:68
msgid "Host:"
msgstr "Isäntä (host):"

#: www/admin/config/database/index.php:69
msgid "Databse name:"
msgstr "Tietokannan nimi:"

#: www/admin/config/database/index.php:91 includes/admin_util.php:165
#: www/admin/config/database/index.php:71 includes/admin_util.php:174
msgid "Password:"
msgstr "Salasana:"

#: www/admin/config/database/index.php:92
#: www/admin/config/database/index.php:72
msgid "Initialize database:"
msgstr "Alusta tietokanta:"

@@ -210,26 +239,31 @@ msgstr "Tilin luonti epäonnistui."
msgid "User info"
msgstr "Käyttäjätiedot"

#: includes/admin_util.php:67 includes/admin_util.php:163
msgid "Authorization"
msgstr "Tunnistautuminen"

#: includes/admin_util.php:68
msgid "Veturi configuration password"
msgstr "Veturin asetussalasana"

#: includes/admin_util.php:69
msgid "Config password:"
msgstr "Asetussalasana: "

#: includes/admin_util.php:87
#: includes/admin_util.php:84
msgid "No config exists. Please do the config first."
msgstr "Asetustiedostoa ei löytynyt. Aloitathan tekemällä asetukset."

#: includes/admin_util.php:110
#: includes/admin_util.php:104 includes/admin_util.php:129
msgid "Incorrect password."
msgstr "Väärä salasana."

#: includes/admin_util.php:121
msgid "User doesn't exist."
msgstr "Käyttäjää ei ole olemassa."

#: includes/admin_util.php:136
msgid "User is not an admin."
msgstr "Käyttäjä ei ole ylläpitäjä."
#: includes/admin_util.php:137
msgid "Insufficient privileges."
msgstr "Riittämättömät ylläpitäjäoikeudet."

#: includes/admin_util.php:172
msgid "Authorization"
msgstr "Tunnistautuminen"

#~ msgid "Veturi configuration password"
#~ msgstr "Veturin asetussalasana"

#~ msgid "Config password:"
#~ msgstr "Asetussalasana: "

#~ msgid "User is not an admin."
#~ msgstr "Käyttäjä ei ole ylläpitäjä."

+ 6
- 4
www/admin/config/database/index.php View File

@@ -17,9 +17,10 @@
require_admin_login($pagedepth,$pagetitle,$content,VAP_CONFIG_SERVER);

//Käsittele lomake
if (isset($_POST["dsn"]))
if (isset($_POST["db_host"]))
{
$CONFIG["database"]["dsn"] = $_POST["dsn"];
$CONFIG["database"]["host"] = $_POST["db_host"];
$CONFIG["database"]["name"] = $_POST["db_name"];
$CONFIG["database"]["username"] = $_POST["db_username"];
$CONFIG["database"]["password"] = $_POST["db_password"];

@@ -63,8 +64,9 @@

$content[] = "<form method=post>";
$content[] = "\t<fieldset>";
$content[] = "\t\t<legend>"._("Database")."</legend>";
$content[] = "\t<label>"._("DSN:")." <input name=dsn value='".hsc($CONFIG["database"]["dsn"])."'></label>";
$content[] = "\t\t<legend>"._("MySQL Database")."</legend>";
$content[] = "\t<label>"._("Host:")." <input name=db_host value='".hsc($CONFIG["database"]["host"])."' required></label>";
$content[] = "\t<label>"._("Databse name:")." <input name=db_name value='".hsc($CONFIG["database"]["name"])."' required></label>";
$content[] = "\t<label>"._("Username:")." <input name=db_username value='".hsc($CONFIG["database"]["username"])."'></label>";
$content[] = "\t<label>"._("Password:")." <input type=password name=db_password value='".hsc($CONFIG["database"]["password"])."'></label>";
$content[] = "\t<label>"._("Initialize database:")." <input type=checkbox name=initdb></label>";


Loading…
Cancel
Save