26 defined(
'LGV_ADBTB_CATCHER' ) or die ( 'Cannot Execute Directly' );
28 if ( !defined('LGV_DBF_CATCHER') ) {
29 define(
'LGV_DBF_CATCHER', 1);
32 require_once(CO_Config::db_classes_class_dir().
'/co_security_login.class.php');
68 return Array(
'id' => 0,
69 'last_access' => 86400,
71 'read_security_id' => 0,
72 'write_security_id' => 0,
73 'access_class_context' => NULL
87 $this->write_security_id = -1;
88 $this->read_security_id = $this->
id();
91 $ret[
'id'] = $this->
id();
92 $ret[
'access_class'] = strval(get_class($this));
93 $ret[
'last_access'] = strval(date(
'Y-m-d H:i:s'));
94 $ret[
'read_security_id'] = intval($this->read_security_id);
95 $ret[
'write_security_id'] = intval($this->write_security_id);
96 $name = trim(strval($this->name));
98 $ret[
'access_class_context'] = $this->context ? $this->
_badger_serialize($this->context) : NULL;
111 return serialize($in_data);
122 return unserialize($in_data);
136 if (isset($this->_db_object)) {
139 if (isset($params) && is_array($params) && count($params)) {
140 $ret = $this->_db_object->write_record($params);
142 if ((1 < intval($ret)) && !$this->error) {
143 $this->_id = intval($ret);
145 $this->read_security_id = $this->
id();
146 $this->write_security_id = -1;
164 if ($this->
id() && isset($this->_db_object)) {
165 $ret = $this->_db_object->delete_record($this->
id());
182 $this->class_description =
'';
184 $this->last_access = time();
185 $this->read_security_id = 0;
186 $this->write_security_id = 0;
188 $this->context = NULL;
189 $this->instance_description = NULL;
190 $this->_db_object = $in_db_object;
194 if (!$in_db_result) {
207 $this->_batch_mode =
true;
220 $this->_batch_mode =
false;
223 if (method_exists($this,
'_scrub')) {
242 $this->last_access = max(86400, time());
244 if (isset($this->_db_object) && isset($in_db_result) && isset($in_db_result[
'id']) && intval($in_db_result[
'id'])) {
246 $this->_id = intval($in_db_result[
'id']);
248 if (isset($in_db_result[
'last_access'])) {
249 $date_from_db = date_create_from_format(
'Y-m-d H:i:s', $in_db_result[
'last_access']);
250 $timestamp = date_timestamp_get($date_from_db);
251 $this->last_access = max(86400, $timestamp);
254 if (isset($in_db_result[
'read_security_id']) && intval($in_db_result[
'read_security_id'])) {
255 $this->read_security_id = intval($in_db_result[
'read_security_id']);
259 $this->write_security_id = -1;
261 $this->read_security_id = $this->
id();
264 if (isset($in_db_result[
'write_security_id'])) {
265 $this->write_security_id = intval($in_db_result[
'write_security_id']);
267 $this->write_security_id = $this->read_security_id ? -1 : intval($this->write_security_id);
271 if (isset($in_db_result[
'object_name'])) {
272 $this->name = strval($in_db_result[
'object_name']);
275 if (isset($in_db_result[
'access_class_context'])) {
276 $serialized_context = trim(strval($in_db_result[
'access_class_context']));
277 if (isset($serialized_context) && $serialized_context) {
278 $serialized_context = stripslashes($serialized_context);
282 $this->context = $temp_context;
288 $this->class_description =
'Abstract Base Class for Records -Should never be instantiated.';
299 public function id() {
310 return $this->_db_object->lock_record($this->
id());
318 return $this->read_security_id == -2;
340 $my_read_item = intval($this->read_security_id);
341 $my_write_item = intval($this->write_security_id);
346 if (isset($ids) && is_array($ids) && count($ids)) {
347 $ret = in_array($my_read_item, $ids) || in_array($my_write_item, $ids);
352 $ret = (1 == $my_read_item);
367 $my_write_item = intval($this->write_security_id);
369 if (((isset($ids) && is_array($ids) && count($ids)) && (0 == $my_write_item)) || $this->
get_access_object()->god_mode()) {
372 if (isset($ids) && is_array($ids) && count($ids)) {
373 $ret = in_array($my_write_item, $ids);
392 $this->read_security_id = intval($in_new_id);
411 $this->write_security_id = intval($in_new_id);
428 if (isset($in_new_value)) {
429 $this->name = strval($in_new_value);
462 if (!$this->_batch_mode) {
481 $db_result = $this->_db_object->get_single_raw_row_by_id($this->
id());
483 if (!isset($this->error) || !$this->error) {
497 if (isset($db_object)) {
498 return $db_object->access_object;
512 if (isset($this->context[
'lang']) && trim($this->context[
'lang'])) {
513 $ret = strtolower(trim($this->context[
'lang']));
528 $this->context[
'lang'] = strtolower(trim(strval($in_lang_id)));
if(!defined( 'LGV_DBF_CATCHER'))
danger_will_robinson_danger_clear_id()
$name
This is the "object_name" string field.
$last_access
This is a UNIX epoch date that describes the last modification. The default is UNIX Day Two (in case ...
set_lang( $in_lang_id=NULL)
$instance_description
This is a description that describes the instance.
set_read_security_id($in_new_id)
__construct( $in_db_object=NULL, $in_db_result=NULL)
set_write_security_id($in_new_id)
$_db_object
This is the actual database object that "owns" this instance. It should not be exposed beyond this cl...
$class_description
This is a description of the class (not the instance).
$_id
This is the within-table unique ID of this record.
load_from_db( $in_db_result)
$write_security_id
This is a single integer, defining the required security token to modify the record....
$context
This is a mixed associative array, containing fields for the object.
$error
If there is an error, it is contained here, in a LGV_Error instance.
$_batch_mode
If this is true, then the write_record call will not be made in update_db. It will be done when clear...
_badger_unserialize( $in_data)
$read_security_id
This is a single integer, defining the security ID required to view the record. If it is 0,...
_badger_serialize( $in_data)