Хранилища Subversion ant

Редакция

Редакция 307 | Редакция 309 | К новейшей редакции | Весь файл | Не учитывать пробелы | Содержимое файла | Авторство | Последнее изменение | Открыть журнал | RSS

Редакция 307 Редакция 308
Строка 11... Строка 11...
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
    }
-
 
45
-
 
46
    function checkInt($value) {
-
 
47
        return abs(intval($value));
-
 
48
    }
26
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() {