Хранилища Subversion ant

Редакция

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

Редакция 308 Редакция 309
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;
-
 
19
    protected $owner    = NULL;
18
20
-
 
21
19
    function __constructor($database,$prefix) {
22
    function __constructor($database,$prefix,$secure,$owner) {
20
        $this->db       = $database;
23
        $this->db       = $database;
21
        $this->prefix   = $prefix;
24
        $this->prefix   = $prefix;
-
 
25
        $this->secure   = $secure;
-
 
26
        $this->owner    = $owner;
22
    }
27
    }
23
28
24
    function getSetting($attr) {
29
    function getSetting($attr) {
25
        $db = $this->db;
30
        $db = $this->db;
26
        $result = array();
31
        $result = array();
27
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$attr."'";
32
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$attr."'";
28
        $rq =& $db->query($query);
33
        $rq =& $db->query($query);
29
        if ($rq->numRows()!=0) {
34
        if ($rq->numRows()!=0) {
30
            $rq->fetchInto($element);
35
            $rq->fetchInto($element);
31
            $result["ERR"] = 0;
36
            $result["ERR"] = 0;
32
            $result["OptValue"] = $element["optvalue"];
37
            $result["OptValue"] = $element["optvalue"];
33
        } else {
38
        } else {
34
            $result["ERR"] = 1;
39
            $result["ERR"] = 1;
35
            $result["ERRINFO"] = "Empty result";
40
            $result["ERRINFO"] = "Empty result";
36
        }
41
        }
37
        return $result;
42
        return $result;
38
    }
43
    }
39
44
40
}
45
}
41
-
 
42
class Security extends Core {
-
 
43
    function __constructor() {
-
 
44
    }
-
 
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;
-
 
58
    }
-
 
59
}
-
 
60
-
 
61
class Owner extends Core {
-
 
62
    function __constructor() {
-
 
63
-
 
64
    }
-
 
65
}
-
 
66
46
67
?>
47
?>
68
 
48