table_common_plugin.php
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_common_plugin.php 32122 2012-11-14 01:55:46Z monkey $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_common_plugin extends discuz_table
{
public function __construct() {
$this->_table = 'common_plugin';
$this->_pk = 'pluginid';
parent::__construct();
}
public function fetch_by_identifier($identifier) {
return DB::fetch_first('SELECT * FROM %t WHERE identifier=%s', array($this->_table, $identifier));
}
public function fetch_all_identifier($identifier) {
return DB::fetch_all('SELECT * FROM %t WHERE identifier IN (%n)', array($this->_table, $identifier), 'identifier');
}
public function fetch_all_data($available = false) {
$available = $available !== false ? 'WHERE available='.intval($available) : '';
return DB::fetch_all('SELECT * FROM %t %i ORDER BY available DESC, pluginid DESC', array($this->_table, $available));
}
public function fetch_all_by_identifier($identifier) {
if(!$identifier) {
return;
}
return DB::fetch_all('SELECT * FROM %t WHERE %i', array($this->_table, DB::field('identifier', $identifier)));
}
public function fetch_by_pluginvarid($pluginid, $pluginvarid) {
return DB::fetch_first("SELECT * FROM %t p, %t pv WHERE p.pluginid=%d AND pv.pluginid=p.pluginid AND pv.pluginvarid=%d",
array($this->_table, 'common_pluginvar', $pluginid, $pluginvarid));
}
public function delete_by_identifier($identifier) {
if(!$identifier) {
return;
}
DB::delete('common_plugin', DB::field('identifier', $identifier));
}
}
?>