Редакция 313 | Редакция 315 | К новейшей редакции | Только различия | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 313 | Редакция 314 | ||
---|---|---|---|
1 | <?php
|
1 | <?php
|
2 | 2 | ||
3 | /**
|
3 | /**
|
4 | *
|
4 | *
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
5 | * Codename: ant-ng - generator of sources.list for Debian and
|
6 | * distributives, based on Debian
|
6 | * distributives, based on Debian
|
7 | * http://alex-w.org.ru/p/antng/
|
7 | * http://alex-w.org.ru/p/antng/
|
8 | *
|
8 | *
|
9 | * Copyright (c) 2009 Alexander Wolf
|
9 | * Copyright (c) 2009 Alexander Wolf
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
10 | * Dual licensed under the MIT and GNU LGPL licenses.
|
11 | * http://alex-w.org.ru/p/antng/license
|
11 | * http://alex-w.org.ru/p/antng/license
|
12 | *
|
12 | *
|
13 | */
|
13 | */
|
14 | 14 | ||
15 | class Core { |
15 | class Core { |
16 | protected $db = NULL; |
16 | protected $db = NULL; |
17 | protected $prefix = NULL; |
17 | protected $prefix = NULL; |
18 | protected $secure = NULL; |
18 | protected $secure = NULL; |
19 | 19 | ||
20 | 20 | ||
21 | function __constructor($database,$prefix,$secure) { |
21 | function __construct($database, $prefix, $secure) { |
22 | $this->db = $database; |
22 | $this->db = $database; |
23 | $this->prefix = $prefix; |
23 | $this->prefix = $prefix; |
24 | $this->secure = $secure; |
24 | $this->secure = $secure; |
25 | }
|
25 | }
|
26 | 26 | ||
27 | function getSetting($attr) { |
27 | function getOption($attr) { |
28 | $db = $this->db; |
- | |
29 | $result = array(); |
28 | $result = array(); |
30 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$attr."'"; |
29 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkInt($attr)."'"; |
31 | $rq =& $db->query($query); |
30 | $rq =& $this->db->query($query); |
32 | if ($rq->numRows()!=0) { |
31 | if ($rq->numRows()!=0) { |
33 | $rq->fetchInto($element); |
32 | $rq->fetchInto($element); |
34 | $result["ERR"] = 0; |
33 | $result["ERR"] = 0; |
35 | $result["OptValue"] = $element["optvalue"]; |
34 | $result["OptValue"] = $element["optvalue"]; |
36 | } else { |
35 | } else { |
37 | $result["ERR"] = 1; |
36 | $result["ERR"] = 1; |
38 | $result["ERRINFO"] = "Empty result"; |
37 | $result["ERRINFO"] = "Empty result"; |
39 | }
|
38 | }
|
40 | return $result; |
39 | return $result; |
41 | }
|
40 | }
|
42 | 41 | ||
43 | }
|
42 | }
|
44 | 43 | ||
45 | ?>
|
44 | ?>
|
46 | 45 |