mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-05-09 19:51:26 +02:00
Fix incorrect user column; Add default empty data for text fields
This commit is contained in:
parent
0f1a7d2f09
commit
c9f456edfb
2 changed files with 10 additions and 7 deletions
|
@ -11,7 +11,7 @@ class Dictionary {
|
||||||
$this->token = new Token();
|
$this->token = new Token();
|
||||||
|
|
||||||
$this->defaults = array(
|
$this->defaults = array(
|
||||||
'partsOfSpeech' => array("Noun","Adjective","Verb"),
|
'partsOfSpeech' => 'Noun,Adjective,Verb',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,14 +29,17 @@ class Dictionary {
|
||||||
$id_exists = $this->checkIfIdExists($new_id);
|
$id_exists = $this->checkIfIdExists($new_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$insert_dictionary_query = "INSERT INTO dictionaries (id, user, created_on) VALUES (?, ?, ?)";
|
$insert_dictionary_query = "INSERT INTO dictionaries (id, user, description, created_on) VALUES (?, ?, ?, ?)";
|
||||||
$insert_dictionary = $this->db->execute($insert_dictionary_query, array($new_id, $user, time()));
|
$insert_dictionary = $this->db->execute($insert_dictionary_query, array($new_id, $user, 'A new dictionary.', time()));
|
||||||
|
|
||||||
if ($insert_dictionary === true) {
|
if ($insert_dictionary === true) {
|
||||||
$insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech)
|
$insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech, exceptions, orthography_notes, grammar_notes)
|
||||||
VALUES ($new_id, ?)";
|
VALUES ($new_id, ?, ?, ?, ?)";
|
||||||
$insert_linguistics = $this->db->execute($insert_linguistics_query, array(
|
$insert_linguistics = $this->db->execute($insert_linguistics_query, array(
|
||||||
json_encode($this->defaults['partsOfSpeech']),
|
$this->defaults['partsOfSpeech'],
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($insert_linguistics === true) {
|
if ($insert_linguistics === true) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ VALUES (?, ?, ?, ?, ?)';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUserData ($user_id) {
|
public function getUserData ($user_id) {
|
||||||
$query = 'SELECT email, public_name, allow_emails FROM users WHERE id=?';
|
$query = 'SELECT email, public_name, allow_email FROM users WHERE id=?';
|
||||||
$stmt = $this->db->query($query, array($user_id));
|
$stmt = $this->db->query($query, array($user_id));
|
||||||
$user = $stmt->fetch();
|
$user = $stmt->fetch();
|
||||||
if ($stmt && $user) {
|
if ($stmt && $user) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue