Хранилища Subversion ant

Редакция

Редакция 313 | Редакция 315 | К новейшей редакции | Содержимое файла | Сравнить с предыдущей | Последнее изменение | Открыть журнал | 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;
313 alex-w 18
    protected $secure   = NULL;    
304 alex-w 19
 
309 alex-w 20
 
314 alex-w 21
    function __construct($database, $prefix, $secure) {
308 alex-w 22
        $this->db       = $database;
23
        $this->prefix   = $prefix;
312 alex-w 24
        $this->secure   = $secure;        
307 alex-w 25
    }
26
 
314 alex-w 27
    function getOption($attr) {
308 alex-w 28
        $result = array();
314 alex-w 29
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkInt($attr)."'";
30
        $rq =& $this->db->query($query);
308 alex-w 31
        if ($rq->numRows()!=0) {
32
            $rq->fetchInto($element);
33
            $result["ERR"] = 0;
34
            $result["OptValue"] = $element["optvalue"];
35
        } else {
36
            $result["ERR"] = 1;
37
            $result["ERRINFO"] = "Empty result";
38
        }
39
        return $result;
40
    }
41
 
304 alex-w 42
}
43
 
44
?>