Issues (1369)

classes/Alliance/DBStaticAlly.php (45 issues)

1
<?php
2
3
namespace Alliance;
4
5
use classLocale;
6
use mysqli_result;
7
8
class DBStaticAlly {
9
10
// ALLY *************************************************************************************************************
11
  public static function db_ally_list_recalc_counts() {
12
    doquery("UPDATE `{{alliance}}` AS a LEFT JOIN (SELECT ally_id, count(*) AS ally_memeber_count FROM `{{users}}`
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

12
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE `{{alliance}}` AS a LEFT JOIN (SELECT ally_id, count(*) AS ally_memeber_count FROM `{{users}}`
Loading history...
13
      WHERE ally_id IS NOT NULL GROUP BY ally_id) AS u ON u.ally_id = a.id SET a.`ally_members` = u.ally_memeber_count;");
14
  }
15
16
  public static function db_ally_request_list($ally_id) {
17
    return doquery("SELECT {{alliance_requests}}.*, {{users}}.username FROM {{alliance_requests}} LEFT JOIN {{users}} ON {{users}}.id = {{alliance_requests}}.id_user WHERE id_ally='{$ally_id}'");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

17
    return /** @scrutinizer ignore-deprecated */ doquery("SELECT {{alliance_requests}}.*, {{users}}.username FROM {{alliance_requests}} LEFT JOIN {{users}} ON {{users}}.id = {{alliance_requests}}.id_user WHERE id_ally='{$ally_id}'");
Loading history...
18
  }
19
20
  public static function db_ally_request_get_by_user_id($player_id) {
21
    return doquery("SELECT * FROM {{alliance_requests}} WHERE `id_user` ='{$player_id}' LIMIT 1;", true);
0 ignored issues
show
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
    return doquery("SELECT * FROM {{alliance_requests}} WHERE `id_user` ='{$player_id}' LIMIT 1;", /** @scrutinizer ignore-type */ true);
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

21
    return /** @scrutinizer ignore-deprecated */ doquery("SELECT * FROM {{alliance_requests}} WHERE `id_user` ='{$player_id}' LIMIT 1;", true);
Loading history...
22
  }
23
24
  public static function db_ally_count() {
25
    $result = doquery('SELECT COUNT(`id`) AS ally_count FROM `{{alliance}}`', true);
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

25
    $result = /** @scrutinizer ignore-deprecated */ doquery('SELECT COUNT(`id`) AS ally_count FROM `{{alliance}}`', true);
Loading history...
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
    $result = doquery('SELECT COUNT(`id`) AS ally_count FROM `{{alliance}}`', /** @scrutinizer ignore-type */ true);
Loading history...
26
27
    return isset($result['ally_count']) ? $result['ally_count'] : 0;
28
  }
29
30
  /**
31
   * @param $id_ally
32
   *
33
   * @return array|bool|mysqli_result|null
34
   */
35
  public static function db_ally_get_by_id($id_ally) {
36
    $ally = doquery("SELECT * FROM `{{alliance}}` WHERE `id` ='{$id_ally}' LIMIT 1", true);
0 ignored issues
show
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

36
    $ally = doquery("SELECT * FROM `{{alliance}}` WHERE `id` ='{$id_ally}' LIMIT 1", /** @scrutinizer ignore-type */ true);
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

36
    $ally = /** @scrutinizer ignore-deprecated */ doquery("SELECT * FROM `{{alliance}}` WHERE `id` ='{$id_ally}' LIMIT 1", true);
Loading history...
37
38
    return $ally;
39
  }
40
41
  /**
42
   * @param $searchtext
43
   *
44
   * @return array|bool|mysqli_result|null
45
   */
46
  public static function db_ally_list_search($searchtext) {
47
    $search = doquery("SELECT ally_name, ally_tag, total_rank, ally_members FROM {{alliance}} WHERE ally_tag LIKE '%{$searchtext}%' OR ally_name LIKE '%{$searchtext}%' LIMIT 30");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

47
    $search = /** @scrutinizer ignore-deprecated */ doquery("SELECT ally_name, ally_tag, total_rank, ally_members FROM {{alliance}} WHERE ally_tag LIKE '%{$searchtext}%' OR ally_name LIKE '%{$searchtext}%' LIMIT 30");
Loading history...
48
49
    return $search;
50
  }
51
52
  /**
53
   * @param $ally_tag
54
   * @param $ally_name
55
   *
56
   * @return array|bool|mysqli_result|null
57
   */
58
  public static function db_ally_get_by_name_or_tag($ally_tag, $ally_name) {
59
    $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true);
0 ignored issues
show
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

59
    $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", /** @scrutinizer ignore-type */ true);
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

59
    $query = /** @scrutinizer ignore-deprecated */ doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true);
Loading history...
60
61
    return $query;
62
  }
63
64
  /**
65
   * @param $ally_name
66
   *
67
   * @return array|bool|mysqli_result|null
68
   */
69
  public static function db_ally_get_by_name($ally_name) {
70
    $query = doquery("SELECT ally_name FROM {{alliance}} WHERE `ally_name` = '{$ally_name}' LIMIT 1;", true);
0 ignored issues
show
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

70
    $query = doquery("SELECT ally_name FROM {{alliance}} WHERE `ally_name` = '{$ally_name}' LIMIT 1;", /** @scrutinizer ignore-type */ true);
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

70
    $query = /** @scrutinizer ignore-deprecated */ doquery("SELECT ally_name FROM {{alliance}} WHERE `ally_name` = '{$ally_name}' LIMIT 1;", true);
Loading history...
71
72
    return $query;
73
  }
74
75
  /**
76
   * @param $ally_name
77
   * @param $ally_tag
78
   * @param $user
79
   */
80
  public static function db_ally_insert($ally_name, $ally_tag, $user) {
81
    $ally = doquery("INSERT INTO {{alliance}} SET
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

81
    $ally = /** @scrutinizer ignore-deprecated */ doquery("INSERT INTO {{alliance}} SET
Loading history...
82
    `ally_name` = '{$ally_name}',
83
    `ally_tag` = '{$ally_tag}',
84
    `ally_owner` = '{$user['id']}',
85
    `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "',
0 ignored issues
show
The property lang does not seem to exist on classLocale.
Loading history...
86
    `ally_members` = 1,
87
    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0',
88
    `ally_register_time`= " . SN_TIME_NOW
89
    );
90
91
    return $ally;
92
  }
93
94
  /**
95
   * @param $ally_user_id
96
   * @param $ally_id
97
   */
98
  public static function db_ally_update_ally_user($ally_user_id, $ally_id) {
99
    doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_id} LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

99
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_id} LIMIT 1;");
Loading history...
100
  }
101
102
  /**
103
   * @param $user
104
   * @param $id_ally
105
   * @param $POST_text
106
   */
107
  public static function db_ally_request_insert($user, $id_ally, $POST_text) {
108
    doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

108
    /** @scrutinizer ignore-deprecated */ doquery("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";");
Loading history...
109
  }
110
111
  /**
112
   * @param $user
113
   */
114
  public static function db_ally_request_delete_by_user($user) {
115
    doquery("DELETE FROM {{alliance_requests}} WHERE `id_user` = {$user['id']};");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

115
    /** @scrutinizer ignore-deprecated */ doquery("DELETE FROM {{alliance_requests}} WHERE `id_user` = {$user['id']};");
Loading history...
116
  }
117
118
119
  /**
120
   * @param $tag
121
   *
122
   * @return array|bool|mysqli_result|null
123
   */
124
  public static function db_ally_get_by_tag($tag) {
125
    $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

125
    $ally = /** @scrutinizer ignore-deprecated */ doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true);
Loading history...
126
127
    return $ally;
128
  }
129
130
  /**
131
   * @param $ali_search_text
132
   *
133
   * @return array|bool|mysqli_result|null
134
   */
135
  public static function db_ally_search_by_name_or_tag($ali_search_text) {
136
    $search = doquery("SELECT DISTINCT * FROM {{alliance}} WHERE `ally_name` LIKE '%{$ali_search_text}%' OR `ally_tag` LIKE '%{$ali_search_text}%' LIMIT 30");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

136
    $search = /** @scrutinizer ignore-deprecated */ doquery("SELECT DISTINCT * FROM {{alliance}} WHERE `ally_name` LIKE '%{$ali_search_text}%' OR `ally_tag` LIKE '%{$ali_search_text}%' LIMIT 30");
Loading history...
137
138
    return $search;
139
  }
140
141
  /**
142
   * @param $ally
143
   *
144
   * @return array|bool|mysqli_result|null
145
   */
146
  public static function db_ally_request_count_by_id($ally) {
147
    $request = doquery("SELECT COUNT(*) AS request_count FROM {{alliance_requests}} WHERE `id_ally` ='{$ally['id']}'", true);
0 ignored issues
show
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

147
    $request = doquery("SELECT COUNT(*) AS request_count FROM {{alliance_requests}} WHERE `id_ally` ='{$ally['id']}'", /** @scrutinizer ignore-type */ true);
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

147
    $request = /** @scrutinizer ignore-deprecated */ doquery("SELECT COUNT(*) AS request_count FROM {{alliance_requests}} WHERE `id_ally` ='{$ally['id']}'", true);
Loading history...
148
149
    return $request;
150
  }
151
152
153
  /**
154
   * @param $ally_changeset
155
   * @param $ally
156
   */
157
  public static function db_ally_update_by_changeset($ally_changeset, $ally) {
158
    doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

158
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
Loading history...
159
  }
160
161
  /**
162
   * @param $text_list
163
   * @param $allyTextID
164
   * @param $text
165
   * @param $ally
166
   */
167
  public static function db_ally_update_texts($text_list, $allyTextID, $text, $ally) {
168
    doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

168
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';");
Loading history...
169
  }
170
171
  /**
172
   * @param $idNewLeader
173
   * @param $user
174
   */
175
  public static function db_ally_update_owner($idNewLeader, $user) {
176
    doquery("UPDATE {{alliance}} SET `ally_owner`='{$idNewLeader}' WHERE `id`={$user['ally_id']};");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

176
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `ally_owner`='{$idNewLeader}' WHERE `id`={$user['ally_id']};");
Loading history...
177
  }
178
179
  /**
180
   * @param $ally
181
   */
182
  public static function db_ally_delete($ally) {
183
    doquery("DELETE FROM {{alliance}} WHERE id='{$ally['id']}';");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

183
    /** @scrutinizer ignore-deprecated */ doquery("DELETE FROM {{alliance}} WHERE id='{$ally['id']}';");
Loading history...
184
  }
185
186
187
  /**
188
   * @param $user
189
   * @param $alliance_negotiation_contr_ally_id
190
   */
191
  public static function db_ally_negotiation_delete($user, $alliance_negotiation_contr_ally_id) {
192
    doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id = {$user['ally_id']} AND alliance_negotiation_contr_ally_id = {$alliance_negotiation_contr_ally_id} LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

192
    /** @scrutinizer ignore-deprecated */ doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_ally_id = {$user['ally_id']} AND alliance_negotiation_contr_ally_id = {$alliance_negotiation_contr_ally_id} LIMIT 1;");
Loading history...
193
  }
194
195
  /**
196
   * @param $offer_id
197
   *
198
   * @return array|bool|mysqli_result|null
199
   */
200
  public static function db_ally_negotiation_get_by_offer_id($offer_id) {
201
    $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true);
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

201
    $negotiation = /** @scrutinizer ignore-deprecated */ doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true);
Loading history...
202
203
    return $negotiation;
204
  }
205
206
  /**
207
   * @param $offer_id
208
   */
209
  public static function db_ally_negotiation_delete_by_offer_id($offer_id) {
210
    doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

210
    /** @scrutinizer ignore-deprecated */ doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
Loading history...
211
  }
212
213
  /**
214
   * @param $offer_id
215
   */
216
  public static function db_ally_negotiation_update_status_1($offer_id) {
217
    doquery("UPDATE {{alliance_negotiation}} SET alliance_negotiation_status = 1 WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

217
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance_negotiation}} SET alliance_negotiation_status = 1 WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;");
Loading history...
218
  }
219
220
  /**
221
   * @param $negotiation
222
   * @param $user
223
   */
224
  public static function db_ally_negotiatiion_delete_extended($negotiation, $user) {
225
    doquery(
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

225
    /** @scrutinizer ignore-deprecated */ doquery(
Loading history...
226
      "DELETE FROM {{alliance_negotiation}}
227
  	 WHERE
228
        (alliance_negotiation_ally_id = {$negotiation['alliance_negotiation_ally_id']} AND alliance_negotiation_contr_ally_id = {$user['ally_id']})
229
        OR
230
        (alliance_negotiation_ally_id = {$user['ally_id']} AND alliance_negotiation_contr_ally_id = {$negotiation['alliance_negotiation_ally_id']});"
231
    );
232
  }
233
234
  /**
235
   * @param $user
236
   *
237
   * @return array|bool|mysqli_result|null
238
   */
239
  public static function db_ally_list_get_by_not_user_ally($user) {
240
    $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

240
    $query = /** @scrutinizer ignore-deprecated */ doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;");
Loading history...
241
242
    return $query;
243
  }
244
245
  /**
246
   * @param $user
247
   *
248
   * @return array|bool|mysqli_result|null
249
   */
250
  public static function db_ally_negotiation_list($user) {
251
    $query = doquery(
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

251
    $query = /** @scrutinizer ignore-deprecated */ doquery(
Loading history...
252
      "SELECT
253
    *,
254
    if(alliance_negotiation_ally_id = {$user['ally_id']}, 1, 0) AS owner,
255
    if(alliance_negotiation_ally_id = {$user['ally_id']}, alliance_negotiation_contr_ally_name, alliance_negotiation_ally_name) AS ally_name
256
  FROM
257
    {{alliance_negotiation}}
258
  WHERE
259
    alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};"
260
    );
261
262
    return $query;
263
  }
264
265
  /**
266
   * @param $d
267
   */
268
  public static function db_ally_request_deny($d) {
269
    doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;");
0 ignored issues
show
The property lang does not seem to exist on classLocale.
Loading history...
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

269
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;");
Loading history...
270
  }
271
272
  /**
273
   * @param $ally
274
   */
275
  public static function db_ally_update_member_increase($ally) {
276
    doquery("UPDATE {{alliance}} SET `ally_members`= `ally_members` + 1 WHERE `id`='{$ally['id']}'");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

276
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `ally_members`= `ally_members` + 1 WHERE `id`='{$ally['id']}'");
Loading history...
277
  }
278
279
  /**
280
   * @param $ally
281
   */
282
  public static function db_ally_update_member_decrease($ally) {
283
    doquery("UPDATE {{alliance}} SET `ally_members`= `ally_members` - 1 WHERE `id`='{$ally['id']}' LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

283
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `ally_members`= `ally_members` - 1 WHERE `id`='{$ally['id']}' LIMIT 1;");
Loading history...
284
  }
285
286
  /**
287
   * @param $i
288
   * @param $ally
289
   */
290
  public static function db_ally_update_member_set($i, $ally) {
291
    doquery("UPDATE {{alliance}} SET `ally_members`='{$i}' WHERE `id`='{$ally['id']}'");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

291
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `ally_members`='{$i}' WHERE `id`='{$ally['id']}'");
Loading history...
292
  }
293
294
  /**
295
   * @param $id_user
296
   */
297
  public static function db_ally_request_delete_by_user_id($id_user) {
298
    doquery("DELETE FROM {{alliance_requests}} WHERE `id_user`= '{$id_user}' LIMIT 1;");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

298
    /** @scrutinizer ignore-deprecated */ doquery("DELETE FROM {{alliance_requests}} WHERE `id_user`= '{$id_user}' LIMIT 1;");
Loading history...
299
  }
300
301
302
  /**
303
   * @param $user
304
   *
305
   * @return array|bool|mysqli_result|null
306
   */
307
  public static function db_ally_get_members_by_user_as_ally(&$user) {
308
    $alliance = doquery("SELECT `ally_members` FROM {{alliance}} WHERE `ally_user_id` = {$user['id']}", true);
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

308
    $alliance = /** @scrutinizer ignore-deprecated */ doquery("SELECT `ally_members` FROM {{alliance}} WHERE `ally_user_id` = {$user['id']}", true);
Loading history...
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

308
    $alliance = doquery("SELECT `ally_members` FROM {{alliance}} WHERE `ally_user_id` = {$user['id']}", /** @scrutinizer ignore-type */ true);
Loading history...
309
310
    return $alliance;
311
  }
312
313
  /**
314
   * @param $ranklist
315
   * @param $user
316
   */
317
  public static function db_ally_update_ranklist($ranklist, $user) {
318
    doquery("UPDATE {{alliance}} SET `ranklist` = '{$ranklist}' WHERE `id` ='{$user['ally_id']}';");
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

318
    /** @scrutinizer ignore-deprecated */ doquery("UPDATE {{alliance}} SET `ranklist` = '{$ranklist}' WHERE `id` ='{$user['ally_id']}';");
Loading history...
319
  }
320
321
  /**
322
   * @param $ally_from
323
   * @param $ally_to
324
   *
325
   * @return array|bool|mysqli_result|null
326
   */
327
  public static function db_ally_diplomacy_get_relations($ally_from, $ally_to) {
328
    $query = doquery(
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

328
    $query = /** @scrutinizer ignore-deprecated */ doquery(
Loading history...
329
      "SELECT b.*
330
      FROM
331
        {{alliance_diplomacy}} AS b,
332
        (SELECT alliance_diplomacy_contr_ally_id, MAX(alliance_diplomacy_time) AS alliance_diplomacy_time
333
          FROM {{alliance_diplomacy}}
334
          WHERE alliance_diplomacy_ally_id = {$ally_from}  {$ally_to}
335
          GROUP BY alliance_diplomacy_ally_id, alliance_diplomacy_contr_ally_id
336
        ) AS m
337
      WHERE b.alliance_diplomacy_contr_ally_id = m.alliance_diplomacy_contr_ally_id
338
        AND b.alliance_diplomacy_time = m.alliance_diplomacy_time AND b.alliance_diplomacy_ally_id = {$ally_from}
339
      ORDER BY alliance_diplomacy_time, alliance_diplomacy_id;"
340
    );
341
342
    return $query;
343
  }
344
345
  /**
346
   * @param $user
347
   *
348
   * @return array|bool|mysqli_result|null
349
   */
350
  public static function db_ally_get_ally_count(&$user) {
351
    $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true);
0 ignored issues
show
Deprecated Code introduced by
The function doquery() has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

351
    $lab_level = /** @scrutinizer ignore-deprecated */ doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true);
Loading history...
true of type true is incompatible with the type string expected by parameter $table of doquery(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

351
    $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", /** @scrutinizer ignore-type */ true);
Loading history...
352
353
    return $lab_level;
354
  }
355
356
}