Хранилища Subversion ant

Редакция

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

Редакция 314 Редакция 358
1
<?php
1
<?php
2
/**
2
/**
3
 *
3
 *
4
 *  Codename: ant-ng - generator of sources.list for Debian and
4
 *  Codename: ant-ng - generator of sources.list for Debian and
5
 *  distributives, based on Debian
5
 *  distributives, based on Debian
6
 *  http://alex-w.org.ru/p/antng/
6
 *  http://alex-w.org.ru/p/antng/
7
 *
7
 *
8
 *  Copyright (c) 2009 Alexander Wolf
8
 *  Copyright (c) 2009 Alexander Wolf
9
 *  Dual licensed under the MIT and GNU LGPL licenses.
9
 *  Dual licensed under the MIT and GNU LGPL licenses.
10
 *  http://alex-w.org.ru/p/antng/license
10
 *  http://alex-w.org.ru/p/antng/license
11
 *
11
 *
12
 */
12
 */
13
13
14
class Security extends Core {
14
class Security extends Core {
15
    function __construct() {
15
    function __construct() {
16
    }
16
    }
17
17
18
    function checkInt($value) {
18
    function checkInt($value) {
19
        return abs(intval($value));
19
        return abs(intval($value));
20
    }
20
    }
21
21
22
    function checkStr($value, $mode = 0) {
22
    function checkStr($value, $mode = 0) {
23
        // mode - 0 -> wrap; mode - 1 -> strip;
23
        // mode - 0 -> wrap; mode - 1 -> strip;
24
        if ($mode == 0) {
24
        if ($mode == 0) {
25
            $result = mysql_real_escape_string($value);
25
            $result = mysql_real_escape_string($value);
26
        } else {
26
        } else {
27
            $result = stripslashes($value);
27
            $result = stripslashes($value);
28
        }
28
        }
29
        return $result;
29
        return $result;
30
    }
30
    }
-
 
31
-
 
32
    // генерация хеша пароля
-
 
33
    function encryptStr($string) {
-
 
34
        return md5(md5($string)."-CN-ANT-NG-".sha1($string));
-
 
35
    }
-
 
36
31
}
37
}
32
38
33
?>
39
?>
34
 
40