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