Редакция 307 | Редакция 309 | К новейшей редакции | Только различия | Учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS
Редакция 307 | Редакция 308 | ||
---|---|---|---|
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 | 18 | ||
18 | function __constructor($database) { |
19 | function __constructor($database,$prefix) { |
19 | $this->db = $database; |
20 | $this->db = $database; |
- | 21 | $this->prefix = $prefix; |
|
- | 22 | }
|
|
- | 23 | ||
- | 24 | function getSetting($attr) { |
|
- | 25 | $db = $this->db; |
|
- | 26 | $result = array(); |
|
- | 27 | $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$attr."'"; |
|
- | 28 | $rq =& $db->query($query); |
|
- | 29 | if ($rq->numRows()!=0) { |
|
- | 30 | $rq->fetchInto($element); |
|
- | 31 | $result["ERR"] = 0; |
|
- | 32 | $result["OptValue"] = $element["optvalue"]; |
|
- | 33 | } else { |
|
- | 34 | $result["ERR"] = 1; |
|
- | 35 | $result["ERRINFO"] = "Empty result"; |
|
- | 36 | }
|
|
- | 37 | return $result; |
|
20 | }
|
38 | }
|
21 | 39 | ||
22 | }
|
40 | }
|
23 | 41 | ||
24 | class Security extends Core { |
42 | class Security extends Core { |
25 | function __constructor() { |
43 | function __constructor() { |
- | 44 | }
|
|
26 | 45 | ||
- | 46 | function checkInt($value) { |
|
- | 47 | return abs(intval($value)); |
|
- | 48 | }
|
|
- | 49 | ||
- | 50 | function checkStr($value, $mode = 0) { |
|
- | 51 | // mode - 0 -> wrap; mode - 1 -> strip;
|
|
- | 52 | if ($mode == 0) { |
|
- | 53 | $result = mysql_real_escape_string($value); |
|
- | 54 | } else { |
|
- | 55 | $result = stripslashes($value); |
|
- | 56 | }
|
|
- | 57 | return $result; |
|
27 | }
|
58 | }
|
28 | }
|
59 | }
|
29 | 60 | ||
30 | class Owner extends Core { |
61 | class Owner extends Core { |
31 | function __constructor() { |
62 | function __constructor() { |
32 | 63 | ||
33 | }
|
64 | }
|
34 | }
|
65 | }
|
35 | 66 | ||
36 | ?>
|
67 | ?>
|
37 | 68 |