Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Swoole; /** * Record * foreachRecord * @author Tianfeng.Han * @packag..
Decoded Output download
<?php
namespace Swoole;
/**
* Record
* foreachRecord
* @author Tianfeng.Han
* @package SwooleSystem
* @subpackage Model
*/
class RecordSet implements \Iterator
{
protected $_list = array();
protected $table = '';
protected $db;
/**
* @var SelectDb
*/
protected $db_select;
public $primary = "";
public $_current_id = 0;
function __construct($db, $table, $primary, $select)
{
$this->table = $table;
$this->primary = $primary;
$this->db = $db;
$this->db_select = new SelectDB($db);
$this->db_select->from($table);
$this->db_select->primary = $primary;
$this->db_select->select($select);
$this->db_select->order($this->primary . " desc");
}
/**
*
* @return array
*/
function get()
{
return $this->_list;
}
/**
*
* SQL SelectDBput
* @param array $params
* @return bool
*/
function params($params)
{
return $this->db_select->put($params);
}
/**
* SQL SelectDBwhere
* @param array $params
* @return null
*/
function filter($where)
{
$this->db_select->where($where);
}
/**
* $field = $value
* @return unknown_type
*/
function eq($field, $value)
{
$this->db_select->equal($field,$value);
}
/**
* SQL SelectDBorwhere
* @param $params
*/
function orfilter($where)
{
$this->db_select->orwhere($where);
}
/**
*
*
* @param $field
*/
function fetch($field='')
{
return $this->db_select->getone($field);
}
/**
*
*/
function fetchall()
{
return $this->db_select->getall();
}
function __set($key, $v)
{
$this->db_select->$key = $v;
}
function __call($method, $argv)
{
return call_user_func_array(array($this->db_select, $method), $argv);
}
public function rewind()
{
if (empty($this->_list))
{
$this->_list = $this->db_select->getall();
}
$this->_current_id = 0;
}
public function key()
{
return $this->_current_id;
}
public function current()
{
$record = new Record(0, $this->db, $this->table, $this->primary);
$record->put($this->_list[$this->_current_id]);
$record->_current_id = $this->_list[$this->_current_id][$this->primary];
return $record;
}
public function next()
{
$this->_current_id++;
}
public function valid()
{
if (isset($this->_list[$this->_current_id]))
{
return true;
}
else
{
return false;
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Swoole;
/**
* Record
* foreachRecord
* @author Tianfeng.Han
* @package SwooleSystem
* @subpackage Model
*/
class RecordSet implements \Iterator
{
protected $_list = array();
protected $table = '';
protected $db;
/**
* @var SelectDb
*/
protected $db_select;
public $primary = "";
public $_current_id = 0;
function __construct($db, $table, $primary, $select)
{
$this->table = $table;
$this->primary = $primary;
$this->db = $db;
$this->db_select = new SelectDB($db);
$this->db_select->from($table);
$this->db_select->primary = $primary;
$this->db_select->select($select);
$this->db_select->order($this->primary . " desc");
}
/**
*
* @return array
*/
function get()
{
return $this->_list;
}
/**
*
* SQL SelectDBput
* @param array $params
* @return bool
*/
function params($params)
{
return $this->db_select->put($params);
}
/**
* SQL SelectDBwhere
* @param array $params
* @return null
*/
function filter($where)
{
$this->db_select->where($where);
}
/**
* $field = $value
* @return unknown_type
*/
function eq($field, $value)
{
$this->db_select->equal($field,$value);
}
/**
* SQL SelectDBorwhere
* @param $params
*/
function orfilter($where)
{
$this->db_select->orwhere($where);
}
/**
*
*
* @param $field
*/
function fetch($field='')
{
return $this->db_select->getone($field);
}
/**
*
*/
function fetchall()
{
return $this->db_select->getall();
}
function __set($key, $v)
{
$this->db_select->$key = $v;
}
function __call($method, $argv)
{
return call_user_func_array(array($this->db_select, $method), $argv);
}
public function rewind()
{
if (empty($this->_list))
{
$this->_list = $this->db_select->getall();
}
$this->_current_id = 0;
}
public function key()
{
return $this->_current_id;
}
public function current()
{
$record = new Record(0, $this->db, $this->table, $this->primary);
$record->put($this->_list[$this->_current_id]);
$record->_current_id = $this->_list[$this->_current_id][$this->primary];
return $record;
}
public function next()
{
$this->_current_id++;
}
public function valid()
{
if (isset($this->_list[$this->_current_id]))
{
return true;
}
else
{
return false;
}
}
}
Function Calls
None |
Stats
MD5 | 7c227a24661e1e1b17bd73e3eb045529 |
Eval Count | 0 |
Decode Time | 99 ms |