24,9 → 24,10 |
$this->secure = $secure; |
} |
|
// Получение данных о настройке |
function getOption($attr) { |
$result = array(); |
$query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkInt($attr)."'"; |
$query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
$rq =& $this->db->query($query); |
if ($rq->numRows()!=0) { |
$rq->fetchInto($element); |
39,6 → 40,71 |
return $result; |
} |
|
// Получение и отображение списка дистрибутивов |
function showDistributionList($name, $info = "", $format = 'html') { |
$query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
switch ($format) { |
case 'html': |
$show = "<label for='".$name."'>".$info."</label> <select id='".$name."' name='".$name."'>\n"; |
$rq =& $this->db->query($query); |
while ($rq->fetchInto($element)) { |
$show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
} |
$show .= "</select>"; |
break; |
case 'json': |
$show = '[{value:"",text:"'.$info.'"}'; |
$rq =& $this->db->query($query); |
while ($rq->fetchInto($element)) { |
$show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
} |
$show .= ']'; |
break; |
} |
return $show; |
} |
|
// Получение названия дистрибутива |
function getDistName($distID) { |
$result = array(); |
$query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
$rq =& $this->db->query($query); |
if (PEAR::isError($this->db)) { |
$result["ERR"] = 1; |
$result["ERRINFO"] = $this->db->getMessage(); |
} else { |
$rq->fetchInto($element); |
$result["ERR"] = 0; |
$result["DistName"] = $this->secure->checkStr($element["distname"],1); |
} |
|
return $result; |
} |
|
// Получение и отображение списка версий дистрибутива |
function showDistVersionsList($name, $distID, $format = 'html') { |
$query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
switch ($format) { |
case 'html': |
$show = "<label for='".$name."'>".$info."</label> <select id='".$name."' name='".$name."'>\n"; |
$rq =& $this->db->query($query); |
while ($rq->fetchInto($element)) { |
$show .= "<option value='".$this->secure->checkInt($element["dist_id"])."'>".$this->secure->checkStr($element["distname"],1)."</option>\n"; |
} |
$show .= "</select>"; |
break; |
case 'json': |
$show = '[{value:"",text:"'.$info.'"}'; |
$rq =& $this->db->query($query); |
while ($rq->fetchInto($element)) { |
$show .= ',{value:"'.$this->secure->checkInt($element["dist_id"]).'",text:"'.$this->secure->checkStr($element["distname"],1).'"}'; |
} |
$show .= ']'; |
break; |
} |
return $show; |
} |
|
} |
|
?> |