/branches/ant-ng/lib/security.php |
---|
Новый файл |
0,0 → 1,33 |
<?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 { |
function __constructor() { |
} |
function checkInt($value) { |
return abs(intval($value)); |
} |
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; |
} |
} |
?> |
/branches/ant-ng/lib/core.php |
---|
15,10 → 15,15 |
class Core { |
protected $db = NULL; |
protected $prefix = NULL; |
protected $secure = NULL; |
protected $owner = NULL; |
function __constructor($database,$prefix) { |
function __constructor($database,$prefix,$secure,$owner) { |
$this->db = $database; |
$this->prefix = $prefix; |
$this->secure = $secure; |
$this->owner = $owner; |
} |
function getSetting($attr) { |
39,29 → 44,4 |
} |
class Security extends Core { |
function __constructor() { |
} |
function checkInt($value) { |
return abs(intval($value)); |
} |
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; |
} |
} |
class Owner extends Core { |
function __constructor() { |
} |
} |
?> |
/branches/ant-ng/lib/owner.php |
---|
Новый файл |
0,0 → 1,26 |
<?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 Owner { |
protected $db = NULL; |
protected $prefix = NULL; |
protected $secure = NULL; |
function __constructor($database,$prefix,$secure) { |
$this->db = $database; |
$this->prefix = $prefix; |
$this->secure = $secure; |
} |
} |
?> |
/branches/ant-ng/init.php |
---|
40,7 → 40,9 |
$db->setFetchMode(DB_FETCHMODE_ASSOC); |
$query =& $db->query("SET NAMES utf8"); |
$core = new Core($db); |
$secure = new Security(); |
$owner = new Owner($db, PREFIX, $secure); |
$core = new Core($db, PREFIX, $secure, $owner); |
$smarty = new Smarty(); |
?> |