public function __construct() { parent::__construct(); $this->name = 'news'; $this->prefix = DBI_PREFIX; $this->addField('newsid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('authorid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('categoryid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('title', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('encodedtitle', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('author', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('article', new Dbi_Field('text', array(), '', false)); $this->addField('image', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('file', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('summary', new Dbi_Field('text', array(), '', false)); $this->addField('autosummary', new Dbi_Field('tinyint', array('4'), '0', false)); $this->addField('pubdate', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('expdate', new Dbi_Field('datetime', array(), '', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('closed', new Dbi_Field('tinyint', array('4'), '0', false)); $this->addField('views', new Dbi_Field('int', array('11'), '0', false)); $this->addField('status', new Dbi_Field('enum', array('draft', 'published'), 'published', false)); $this->addIndex('primary', array('newsid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'page_perm'; $this->prefix = DBI_PREFIX; $this->addField('pageid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('usergroupid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addIndex('primary', array('pageid', 'usergroupid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'comment_meta'; $this->prefix = DBI_PREFIX; $this->addField('urlmetaid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('closed', new Dbi_Field('tinyint', array('4'), '', false)); $this->addIndex('primary', array('urlmetaid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'site_master'; $this->prefix = DBI_PREFIX; $this->addField('id', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('name', new Dbi_Field('varchar', array('100'), '', false)); $this->addIndex('primary', array('id'), 'unique'); }
public function delete(Dbi_Model $query) { $components = $query->components(); $delete = new Dbi_Sql_Query_Delete(); $delete->table($query->prefix() . $components['table']); foreach ($components['where'] as $where) { $orStatements = array(); $orParameters = array(); foreach ($where->expressions() as $or) { $orStatements[] = $or->statement(); $orParameters = array_merge($orParameters, $or->parameters()); } $args = array_merge(array(implode(' OR ', $orStatements)), $orParameters); call_user_func_array(array($delete, 'where'), $args); } $expression = $delete->expression(); $this->_execute($delete); }
public function __construct() { parent::__construct(); $this->name = 'download_tag'; $this->prefix = DBI_PREFIX; $this->addField('fileid', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addField('tag', new Dbi_Field('varchar', array('128'), '', false)); $this->addIndex('primary', array('fileid', 'tag'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'usergroup_admin'; $this->prefix = DBI_PREFIX; $this->addField('usergroupid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('application', new Dbi_Field('varchar', array('32'), '', false)); $this->addIndex('primary', array('usergroupid', 'application'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'config'; $this->prefix = DBI_PREFIX; $this->addField('configname', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('configvalue', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('configname'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'user_reset'; $this->prefix = DBI_PREFIX; $this->addField('userid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('resetkey', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('expire', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addIndex('primary', array('userid', 'resetkey'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'content_page'; $this->prefix = DBI_PREFIX; $this->addField('pageid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('content', new Dbi_Field('longtext', array(), '', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addIndex('primary', array('pageid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'news_revision'; $this->prefix = DBI_PREFIX; $this->addField('revisionid', new Dbi_Field('int', array('11', 'unsigned', 'auto_increment'), '', false)); $this->addField('newsid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('data', new Dbi_Field('longtext', array(), '', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addIndex('primary', array('revisionid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'redirect'; $this->prefix = DBI_PREFIX; $this->addField('id', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('siteid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('original', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('destination', new Dbi_Field('varchar', array('255'), '', false)); $this->addIndex('primary', array('id'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'seo_head'; $this->prefix = DBI_PREFIX; $this->addField('urlmetaid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('title', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('metakeywords', new Dbi_Field('text', array(), '', false)); $this->addField('metadescription', new Dbi_Field('text', array(), '', false)); $this->addField('extra', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('urlmetaid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'urlmeta'; $this->prefix = DBI_PREFIX; $this->addField('id', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('pageid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('pathinfo', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('label', new Dbi_Field('varchar', array('100'), '', false)); $this->addIndex('primary', array('id'), 'unique'); $this->addIndex('pageid', array('pageid', 'pathinfo'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'timg_queue'; $this->prefix = DBI_PREFIX; $this->addField('src', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('dst', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('width', new Dbi_Field('int', array('11'), '', false)); $this->addField('height', new Dbi_Field('int', array('11'), '', false)); $this->addField('ratio', new Dbi_Field('tinyint', array('4'), '', false)); $this->addIndex('primary', array('src', 'dst', 'width', 'height', 'ratio'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'sessions'; $this->prefix = DBI_PREFIX; $this->addField('sid', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('ip_addr', new Dbi_Field('varchar', array('39'), '', false)); $this->addField('uid', new Dbi_Field('int', array('11'), '', false)); $this->addField('expires', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addField('session_data', new Dbi_Field('longtext', array(), '', false)); $this->addIndex('primary', array('sid', 'ip_addr'), 'unique'); $this->addIndex('uid', array('uid'), ''); }
public function __construct() { parent::__construct(); $this->name = 'news_category'; $this->prefix = DBI_PREFIX; $this->addField('categoryid', new Dbi_Field('int', array('11', 'unsigned', 'auto_increment'), '', false)); $this->addField('parentid', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addField('categoryname', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('categoryimage', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('categorydescr', new Dbi_Field('text', array(), '', false)); $this->addField('sortnum', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addIndex('primary', array('categoryid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'plug_loc'; $this->prefix = DBI_PREFIX; $this->addField('locid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('plugid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('skin', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('socket', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('sortnum', new Dbi_Field('int', array('11'), '', false)); $this->addField('rules', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('locid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'site_master_page'; $this->prefix = DBI_PREFIX; $this->addField('id', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('masterid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('uri', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('nickname', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('application', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('skin', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('settings', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('id'), 'unique'); $this->addIndex('masterid', array('masterid', 'uri'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'mailform_log'; $this->prefix = DBI_PREFIX; $this->addField('logid', new Dbi_Field('int', array('11', 'unsigned', 'auto_increment'), '', false)); $this->addField('mailformid', new Dbi_Field('int', array('11', 'unsigned'), '', false)); $this->addField('submission', new Dbi_Field('text', array(), '', false)); $this->addField('ipaddress', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('datesubmitted', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('referrer', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('read', new Dbi_Field('tinyint', array('1', 'unsigned'), '0', false)); $this->addField('hidden', new Dbi_Field('tinyint', array('4'), '', false)); $this->addIndex('primary', array('logid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'comment'; $this->prefix = DBI_PREFIX; $this->addField('commentid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('urlmetaid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('userid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('author', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('email', new Dbi_Field('varchar', array('100'), '', false)); $this->addField('url', new Dbi_Field('varchar', array('200'), '', false)); $this->addField('comment', new Dbi_Field('text', array(), '', false)); $this->addField('approved', new Dbi_Field('tinyint', array('4'), '', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '', false)); $this->addIndex('primary', array('commentid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'log'; $this->prefix = DBI_PREFIX; $this->addField('logid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('userid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('ipaddress', new Dbi_Field('varchar', array('24'), '', false)); $this->addField('package', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('application', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('action', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('logdate', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('full_desc', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('logid'), 'unique'); $this->addIndex('userid', array('userid', 'logdate'), ''); $this->addIndex('ipaddress', array('ipaddress'), ''); }
public function __construct() { parent::__construct(); $this->name = 'download'; $this->prefix = DBI_PREFIX; $this->addField('fileid', new Dbi_Field('int', array('11', 'unsigned', 'auto_increment'), '', false)); $this->addField('siteid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('categoryid', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addField('filename', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('filetitle', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('encodedtitle', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('filedescr', new Dbi_Field('text', array(), '', false)); $this->addField('fileimage', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('downloads', new Dbi_Field('int', array('11', 'unsigned'), '0', false)); $this->addField('status', new Dbi_Field('enum', array('draft', 'published'), 'published', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '', false)); $this->addIndex('primary', array('fileid'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'page'; $this->prefix = DBI_PREFIX; $this->addField('pageid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('siteid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('uri', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('nickname', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('application', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('skin', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('settings', new Dbi_Field('text', array(), '', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('driver', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('rules', new Dbi_Field('text', array(), '', false)); $this->addIndex('primary', array('pageid'), 'unique'); $this->addIndex('uri', array('siteid', 'uri'), 'unique'); }
public function __construct() { parent::__construct(); $this->name = 'nav'; $this->prefix = DBI_PREFIX; $this->addField('itemid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('plugid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('label', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('url', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('onclick', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('sortnum', new Dbi_Field('int', array('11'), '0', false)); $this->addField('visibility', new Dbi_Field('enum', array('always', 'loggedin', 'loggedout', 'permitted'), 'always', false)); $this->addField('method', new Dbi_Field('enum', array('get', 'post'), 'get', false)); $this->addField('target', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('parent', new Dbi_Field('int', array('11'), '0', false)); $this->addField('pageid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addIndex('primary', array('itemid'), 'unique'); $this->addIndex('plugid_sortnum', array('plugid', 'sortnum'), ''); }
public function delete(Dbi_Model $query) { self::$queryCount++; $components = $query->components(); $delete = new BuildSql_Delete(); $delete->table($query->prefix() . $components['table']); foreach ($components['where'] as $where) { $orStatements = array(); $orParameters = array(); foreach ($where->expressions() as $or) { $orStatements[] = $or->statement(); $orParameters = array_merge($orParameters, $or->parameters()); } $args = array_merge(array(implode(' OR ', $orStatements)), $orParameters); call_user_func_array(array($delete, 'where'), $args); } mysql_query($delete->query()); if (mysql_error()) { throw new Exception(mysql_error()); } }
public function __construct() { parent::__construct(); $this->name = 'user'; $this->prefix = DBI_PREFIX; $this->addField('userid', new Dbi_Field('int', array('10', 'unsigned', 'auto_increment'), '', false)); $this->addField('username', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('auth', new Dbi_Field('varchar', array('16'), '', false)); $this->addField('passhash', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('salt', new Dbi_Field('varchar', array('32'), '', false)); $this->addField('hashtype', new Dbi_Field('varchar', array('16'), 'md5', false)); $this->addField('email', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('firstname', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('lastname', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('usergroupid', new Dbi_Field('int', array('10', 'unsigned'), '0', false)); $this->addField('confirmed', new Dbi_Field('tinyint', array('4'), '0', false)); $this->addField('regdate', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('lastrequest', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addIndex('primary', array('userid'), 'unique'); $this->addIndex('username', array('username'), 'unique'); $this->addIndex('email', array('email'), ''); }
public function __construct() { parent::__construct(); $this->name = 'mailform'; $this->prefix = DBI_PREFIX; $this->addField('mailformid', new Dbi_Field('int', array('11', 'unsigned', 'auto_increment'), '', false)); $this->addField('siteid', new Dbi_Field('int', array('10', 'unsigned'), '', false)); $this->addField('mailformname', new Dbi_Field('varchar', array('64'), '', false)); $this->addField('message', new Dbi_Field('text', array(), '', false)); $this->addField('response', new Dbi_Field('text', array(), '', false)); $this->addField('multiple', new Dbi_Field('tinyint', array('1'), '0', false)); $this->addField('subject', new Dbi_Field('varchar', array('128'), '', false)); $this->addField('recipients', new Dbi_Field('text', array(), '', false)); $this->addField('recipient', new Dbi_Field('text', array(), '', false)); $this->addField('replyto', new Dbi_Field('tinyint', array('1'), '', false)); $this->addField('mapping', new Dbi_Field('text', array(), '', false)); $this->addField('redirect', new Dbi_Field('varchar', array('255'), '', false)); $this->addField('formfields', new Dbi_Field('text', array(), '', false)); $this->addField('datecreated', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addField('captcha', new Dbi_Field('tinyint', array('4'), '', false)); $this->addField('datemodified', new Dbi_Field('datetime', array(), '0000-00-00 00:00:00', false)); $this->addIndex('primary', array('mailformid'), 'unique'); }
protected function _generateSql(Dbi_Model $query) { //$select = new BuildSql_Select('mysqli_real_escape_string'); $select = new Dbi_Sql_Query_Select(); $components = $query->components(); // Table $select->table($query->prefix() . $components['table'] . ' AS ' . $components['table']); $this->_build($select, $query, $components); if (count($components['orders'])) { $fixedOrders = array(); foreach ($components['orders'] as $order) { $parts = explode(' ', $order); if (strpos($parts[0], '.') === false && strpos($parts[0], '(') === false) { //$parts[0] = "{$components['table']}.{$parts[0]}"; } $fixedOrders[] = implode(' ', $parts); } $select->order(implode(', ', $fixedOrders)); } if (is_array($components['limit'])) { $select->limit(implode(',', $components['limit'])); } return $select; }