Хранилища Subversion ant

Редакция

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

Редакция Автор № строки Строка
304 alex-w 1
<?php
2
 
3
/**
4
 *  
5
 *  Codename: ant-ng - generator of sources.list for Debian and
6
 *  distributives, based on Debian
7
 *  http://alex-w.org.ru/p/antng/
8
 *
9
 *  Copyright (c) 2009 Alexander Wolf
10
 *  Dual licensed under the MIT and GNU LGPL licenses.
11
 *  http://alex-w.org.ru/p/antng/license
12
 *
13
 */
14
 
15
class Core {
308 alex-w 16
    protected $db       = NULL;
17
    protected $prefix   = NULL;
304 alex-w 18
 
308 alex-w 19
    function __constructor($database,$prefix) {
20
        $this->db       = $database;
21
        $this->prefix   = $prefix;
307 alex-w 22
    }
23
 
308 alex-w 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;
38
    }
39
 
304 alex-w 40
}
41
 
307 alex-w 42
class Security extends Core {
43
    function __constructor() {
308 alex-w 44
    }
307 alex-w 45
 
308 alex-w 46
    function checkInt($value) {
47
        return abs(intval($value));
307 alex-w 48
    }
308 alex-w 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
    }
307 alex-w 59
}
60
 
61
class Owner extends Core {
62
    function __constructor() {
63
 
64
    }
65
}
66
 
304 alex-w 67
?>