18,7 → 18,7 |
protected $secure = NULL; |
protected $cookie = NULL; |
|
public function __construct($database, $prefix, $secure, $cookie) { |
function __construct($database, $prefix, $secure, $cookie) { |
$this->db = $database; |
$this->prefix = $prefix; |
$this->secure = $secure; |
26,7 → 26,7 |
} |
|
// Получение данных о настройке |
public function getOption($attr) { |
function getOption($attr) { |
$result = array(); |
$query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$this->secure->checkStr($attr)."'"; |
$rq =& $this->db->query($query); |
42,7 → 42,7 |
} |
|
// Установка данных о настройке |
public function setOption($attr, $value) { |
function setOption($attr, $value) { |
$result = array(); |
|
if ($attr != "passwd") { |
64,7 → 64,7 |
} |
|
// Создание настройки |
public function addOption($attr, $value) { |
function addOption($attr, $value) { |
$result = array(); |
$sValue = $this->secure->checkStr($value); |
|
80,8 → 80,9 |
return $result; |
} |
|
|
// Получение и отображение списка дистрибутивов |
public function showDistributionList($name, $info = "", $format = 'html') { |
function showDistributionList($name, $info = "", $format = 'html') { |
$query = "SELECT * FROM ".$this->prefix."distribution ORDER BY dist_id ASC"; |
$rq =& $this->db->query($query); |
switch ($format) { |
104,7 → 105,7 |
} |
|
// Получение названия дистрибутива |
public function getDistName($distID) { |
function getDistName($distID) { |
$result = array(); |
$query = "SELECT distname FROM ".$this->prefix."distribution WHERE dist_id='".$this->secure->checkInt($distID)."'"; |
$rq =& $this->db->query($query); |
121,7 → 122,7 |
} |
|
// Получение и отображение списка версий дистрибутива |
public function showDistVersionsList($name, $distID, $format = 'html') { |
function showDistVersionsList($name, $distID, $format = 'html') { |
$distname = $this->getDistName($distID); |
$query = "SELECT * FROM ".$this->prefix."version WHERE dist_id='".$this->secure->checkInt($distID)."' ORDER BY version ASC"; |
$rq =& $this->db->query($query); |
145,7 → 146,7 |
} |
|
// Получение и отображение списка секций основного (официального) репозитория |
public function showBranchesList($version, $format = 'html') { |
function showBranchesList($version, $format = 'html') { |
$query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
$rq =& $this->db->query($query); |
$rq->fetchInto($types); |
172,7 → 173,7 |
} |
|
// Получение и отображение списка репозиториев |
public function showRepList($version, $reptype, $format = 'html') { |
function showRepList($version, $reptype, $format = 'html') { |
$query = "SELECT rtype FROM ".$this->prefix."rtype WHERE rtype_id='1'"; |
$rq =& $this->db->query($query); |
$rq->fetchInto($types); |
195,7 → 196,7 |
} |
|
// Добавление поддержки нового apt-дистрибутива |
public function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
function addDistribution($distname, $disttype, $distua = 1, $distlogo = 0) { |
$result = array(); |
$sDName = $this->secure->checkStr($distname); |
$sDType = $this->secure->checkInt($disttype); |
216,7 → 217,7 |
} |
|
// Добавление поддержки новой версии apt-дистрибутива |
public function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
function addDistVersion($distID, $version, $vname = "", $vcodename = "") { |
$result = array(); |
$sDistID = $this->secure->checkStr($distID); |
$sDVersion = $this->secure->checkStr($version); |
237,7 → 238,7 |
} |
|
// Отображение типа дистрибутива |
public function showDistTypeForm($name = "dtype",$type = 0) { |
function showDistTypeForm($name = "dtype",$type = 0) { |
$query = "SELECT * FROM ".$this->prefix."dtype"; |
$rq =& $this->db->query($query); |
$show = "<select name='".$name."' id='".$name."'>\n"; |
254,7 → 255,7 |
} |
|
// Отображение формы создания и редактирования apt-дистрибутива |
public function showDistributionForm($distID = 0) { |
function showDistributionForm($distID = 0) { |
$sDistID = $this->secure->checkInt($distID); |
if ($sDistID != 0) { |
// Режим редактирования |
281,12 → 282,12 |
} |
|
// sourses.list |
public function showSourcesList() { |
function showSourcesList() { |
//TODO Написать генератор sources.list |
} |
|
// Проверка пароля (из формы авторизации) |
public function checkSign($word) { |
function checkSign($word) { |
$result = array(); |
|
$sHash = $this->secure->encryptStr($word); |
298,7 → 299,7 |
} else { |
$result["ERR"] = 1; |
$result["ERRINFO"] = "Password not valid"; |
$result["Location"] = "manager.php?error=1"; |
$result["Location"] = "sign.php?error=1"; |
} |
|
return $result; |
305,7 → 306,7 |
} |
|
// Проверка пароля (из cookies) |
public function checkCookieSign($hash) { |
function checkCookieSign($hash) { |
$result = array(); |
|
$pwd = $this->getOption("passwd"); |
314,26 → 315,14 |
} else { |
$result["ERR"] = 1; |
$result["ERRINFO"] = "Hash not valid"; |
$result["Location"] = "manager.php"; |
$result["Location"] = "sign.php"; |
} |
|
return $result; |
} |
|
// Форма ввода пароля |
public function showSigninForm() { |
$show = "<form action='process.php' method='post'>\n"; |
$show .= "<fieldset><legend>Пароль</legend>\n"; |
$show .= "<input type='hidden' name='mode' value='authorize'>\n"; |
$show .= "<input type='text' name='word' value=''>\n<br />"; |
$show .= "<input type='submit' value=' Войти '>\n"; |
$show .= "</fieldset>\n</form>\n"; |
|
return $show; |
} |
|
// Обновление пароля |
public function updatePassword($word1, $word2) { |
function updatePassword($word1, $word2) { |
$result = array(); |
|
if ($word1 == $word2) { |