Хранилища Subversion ant

Редакция

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

<?php
/**
 *
 *  Codename: ant-ng - generator of sources.list for Debian and
 *  distributives, based on Debian
 *  http://alex-w.org.ru/p/antng/
 *
 *  Copyright (c) 2009 Alexander Wolf
 *  Dual licensed under the MIT and GNU LGPL licenses.
 *  http://alex-w.org.ru/p/antng/license
 *
 */


class Security extends Core {
    public function __construct() {
    }

    public function checkInt($value) {
        return abs(intval($value));
    }

    public function checkStr($value, $mode = 0) {
        // mode - 0 -> wrap; mode - 1 -> strip;
        if ($mode == 0) {
            $result = mysql_real_escape_string($value);
        } else {
            $result = stripslashes($value);
        }
        return $result;
    }

    // генерация хеша пароля
    public function encryptStr($string) {
        return md5(md5($string)."-CN-ANT-NG-".sha1($string));
    }

}

?>