13,18 → 13,49 |
*/ |
|
class Core { |
protected $db = NULL; |
protected $db = NULL; |
protected $prefix = NULL; |
|
function __constructor($database) { |
$this->db = $database; |
function __constructor($database,$prefix) { |
$this->db = $database; |
$this->prefix = $prefix; |
} |
|
function getSetting($attr) { |
$db = $this->db; |
$result = array(); |
$query = "SELECT optvalue FROM ".$this->prefix."settings WHERE opt='".$attr."'"; |
$rq =& $db->query($query); |
if ($rq->numRows()!=0) { |
$rq->fetchInto($element); |
$result["ERR"] = 0; |
$result["OptValue"] = $element["optvalue"]; |
} else { |
$result["ERR"] = 1; |
$result["ERRINFO"] = "Empty result"; |
} |
return $result; |
} |
|
} |
|
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 { |