Хранилища Subversion ant

Редакция

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

Редакция 314 Редакция 315
Строка 22... Строка 22...
22
        $this->db       = $database;
22
        $this->db       = $database;
23
        $this->prefix   = $prefix;
23
        $this->prefix   = $prefix;
24
        $this->secure   = $secure;        
24
        $this->secure   = $secure;        
25
    }
25
    }
26
26
-
 
27
    // Получение данных о настройке
27
    function getOption($attr) {
28
    function getOption($attr) {
28
        $result = array();
29
        $result = array();
29
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkInt($attr)."'";
30
        $query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'";
30
        $rq =& $this->db->query($query);
31
        $rq =& $this->db->query($query);
31
        if ($rq->numRows()!=0) {
32
        if ($rq->numRows()!=0) {
32
            $rq->fetchInto($element);
33
            $rq->fetchInto($element);
33
            $result["ERR"] = 0;
34
            $result["ERR"] = 0;
34
            $result["OptValue"] = $element["optvalue"];
35
            $result["OptValue"] = $element["optvalue"];
Строка 37... Строка 38...
37
            $result["ERRINFO"] = "Empty result";
38
            $result["ERRINFO"] = "Empty result";
38
        }
39
        }
39
        return $result;
40
        return $result;
40
    }
41
    }
41
42
-
 
43
    // Получение и отображение списка дистрибутивов
-
 
44
    function showDistributionList($name, $info = "", $format = 'html') {
-
 
45
        $query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC";
-
 
46
        switch ($format) {
-
 
47
            case 'html':
-
 
48
                $show = "<label for='".$name."'>".$info."</label> <select id='".$name."' name='".$name."'>\n";
-
 
49
                $rq =& $this->db->query($query);
-
 
50
                while ($rq->fetchInto($element)) {
-
 
51
                    $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n";
-
 
52
                }
-
 
53
                $show .= "</select>";
-
 
54
                break;
-
 
55
            case 'json':
-
 
56
                $show = '[{value:"",text:"'.$info.'"}';
-
 
57
                $rq =& $this->db->query($query);
-
 
58
                while ($rq->fetchInto($element)) {
-
 
59
                    $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}';
-
 
60
                }
-
 
61
                $show .= ']';
-
 
62
                break;
-
 
63
        }
-
 
64
        return $show;
-
 
65
    }
-
 
66
-
 
67
    // Получение названия дистрибутива
-
 
68
    function getDistName($distID) {
-
 
69
        $result = array();
-
 
70
        $query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'";
-
 
71
        $rq =& $this->db->query($query);
-
 
72
        if (PEAR::isError($this->db)) {
-
 
73
            $result["ERR"] = 1;
-
 
74
            $result["ERRINFO"] = $this->db->getMessage();
-
 
75
        } else {
-
 
76
            $rq->fetchInto($element);
-
 
77
            $result["ERR"] = 0;
-
 
78
            $result["DistName"] = $this->secure->checkStr($element["distname"],1);
-
 
79
        }
-
 
80
-
 
81
        return $result;
-
 
82
    }
-
 
83
-
 
84
    // Получение и отображение списка версий дистрибутива
-
 
85
    function showDistVersionsList($name, $distID, $format = 'html') {
-
 
86
        $query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC";
-
 
87
        switch ($format) {
-
 
88
            case 'html':
-
 
89
                $show = "<label for='".$name."'>".$info."</label> <select id='".$name."' name='".$name."'>\n";
-
 
90
                $rq =& $this->db->query($query);
-
 
91
                while ($rq->fetchInto($element)) {
-
 
92
                    $show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n";
-
 
93
                }
-
 
94
                $show .= "</select>";
-
 
95
                break;
-
 
96
            case 'json':
-
 
97
                $show = '[{value:"",text:"'.$info.'"}';
-
 
98
                $rq =& $this->db->query($query);
-
 
99
                while ($rq->fetchInto($element)) {
-
 
100
                    $show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}';
-
 
101
                }
-
 
102
                $show .= ']';
-
 
103
                break;
-
 
104
        }
-
 
105
        return $show;
-
 
106
    }
-
 
107
42
}
108
}
43
109
44
?>
110
?>