|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class DBStaticNote { |
|
4
|
|
|
|
|
5
|
|
|
public static function db_note_list_delete($user, $query_where) { |
|
6
|
|
|
doquery("DELETE FROM {{notes}} WHERE `owner` = {$user['id']} {$query_where};"); |
|
7
|
|
|
} |
|
8
|
|
|
|
|
9
|
|
|
public static function db_note_get_id_and_owner($note_id_edit) { |
|
10
|
|
|
return doquery("SELECT `id`, `owner` FROM {{notes}} WHERE `id` = {$note_id_edit} LIMIT 1 FOR UPDATE", true); |
|
|
|
|
|
|
11
|
|
|
} |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* @param $user_id |
|
15
|
|
|
* @param bool $sticky |
|
16
|
|
|
* |
|
17
|
|
|
* @return array|bool|mysqli_result|null |
|
18
|
|
|
*/ |
|
19
|
|
|
public static function db_note_list_by_owner($user_id, $sticky = false) { |
|
20
|
|
|
$sticky = $sticky ? ' AND `sticky` = 1' : ''; |
|
21
|
|
|
$extra_sort = $sticky ? ' `galaxy` ASC, `system` ASC, `planet` ASC, `planet_type` ASC,' : ''; |
|
22
|
|
|
$notes_query = doquery("SELECT * FROM `{{notes}}` WHERE `owner` = {$user_id} {$sticky} ORDER BY `priority` DESC, {$extra_sort} `time` DESC"); |
|
23
|
|
|
|
|
24
|
|
|
return $notes_query; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @param $note_priority |
|
29
|
|
|
* @param $note_title |
|
30
|
|
|
* @param $note_text |
|
31
|
|
|
* @param $note_galaxy |
|
32
|
|
|
* @param $note_system |
|
33
|
|
|
* @param $note_planet |
|
34
|
|
|
* @param $note_planet_type |
|
35
|
|
|
* @param $note_sticky |
|
36
|
|
|
* @param $note_id_edit |
|
37
|
|
|
*/ |
|
38
|
|
|
public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
|
39
|
|
|
doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
40
|
|
|
`galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
|
41
|
|
|
WHERE `id` = {$note_id_edit} LIMIT 1;"); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param $user |
|
46
|
|
|
* @param $note_priority |
|
47
|
|
|
* @param $note_title |
|
48
|
|
|
* @param $note_text |
|
49
|
|
|
* @param $note_galaxy |
|
50
|
|
|
* @param $note_system |
|
51
|
|
|
* @param $note_planet |
|
52
|
|
|
* @param $note_planet_type |
|
53
|
|
|
* @param $note_sticky |
|
54
|
|
|
*/ |
|
55
|
|
|
public static function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) { |
|
56
|
|
|
doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
57
|
|
|
`galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};"); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @param $user |
|
63
|
|
|
* |
|
64
|
|
|
* @return array|bool|mysqli_result|null |
|
65
|
|
|
*/ |
|
66
|
|
|
public static function db_note_list_select_by_owner_and_planet($user) { |
|
67
|
|
|
$query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
|
68
|
|
|
|
|
69
|
|
|
return $query; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: