本文整理汇总了PHP中sql_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_filter函数的具体用法?PHP sql_filter怎么用?PHP sql_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_filter函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
$sql = 'SELECT forum_id, forum_name
FROM _forums
ORDER BY forum_order ASC';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('forums');
_style('forums.row', array(
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'])
);
}
return false;
}
$list = request_var('listContainer', array(0));
$orderid = 10;
foreach ($list as $catid) {
$sql = 'UPDATE _forums SET forum_order = ?
WHERE forum_id = ?';
sql_query(sql_filter($sql, $orderid, $catid));
$orderid += 10;
}
_pre('Update.', true);
}
示例2: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$topic = request_var('topic', 0);
$important = request_var('important', 0);
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$topicdata = sql_fieldrow(sql_filter($sql, $topic))) {
fatal_error();
}
$sql_important = ($important) ? ', topic_important = 1' : '';
$sql = 'UPDATE _forum_topics
SET topic_color = ?, topic_announce = 1' . $sql_important . '
WHERE topic_id = ?';
sql_query(sql_filter($sql, 'E1CB39', $topic));
return _pre('El tema <strong>' . $topicdata['topic_title'] . '</strong> ha sido anunciado.', true);
}
示例3: create
private function create() {
$v = _request(array('username' => ''));
if (_empty($v)) return;
$v->username = get_username_base($v->username);
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if (!$result = sql_fieldrow(sql_filter($sql, $v->username))) {
return;
}
$sql = 'SELECT *
FROM _banlist
WHERE ban_userid = ?';
if (!$ban = sql_fieldrow(sql_filter($sql, $result['user_id']))) {
$insert = array(
'ban_userid' => $result['user_id']
);
sql_insert('banlist', $insert);
$sql = 'DELETE FROM _sessions
WHERE session_user_id = ?';
sql_query(sql_filter($sql, $result['user_id']));
echo 'El usuario ' . $result['username'] . ' fue bloqueado.';
}
return true;
}
示例4: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$topic_id = request_var('topic_id', 0);
if (!$topic_id) {
fatal_error();
}
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$data = sql_fieldrow(sql_filter($sql, $topic_id))) {
fatal_error();
}
$title = ucfirst(strtolower($data['topic_title']));
$sql = 'UPDATE _forum_topics SET topic_title = ?
WHERE topic_id = ?';
sql_query(sql_filter($sql, $title, $topic_id));
return _pre($data['topic_title'] . ' > ' . $title, true);
}
示例5: home
public function home()
{
global $user;
$v = $this->__(w('alias filename ext'));
if (!f($v['alias']) || !f($v['filename'])) {
_fatal();
}
$sql = 'SELECT tree_id
FROM _tree
WHERE tree_alias = ?';
if (!($tree = _fieldrow(sql_filter($sql, $v['alias'])))) {
_fatal();
}
$sql = 'SELECT *
FROM _downloads
WHERE download_alias = ?
AND download_tree = ?';
if (!($download = _fieldrow(sql_filter($sql, $v['filename'], $tree['tree_id'])))) {
_fatal();
}
if ($download['download_login']) {
_login();
}
$sql = 'UPDATE _downloads SET download_count = download_count + 1
WHERE download_id = ?';
_sql(sql_filter($sql, $download['download_id']));
$filepath = LIB . 'fetch/' . _filename($download['download_id'], $download['download_extension']);
return;
}
示例6: _home
public function _home() {
global $config, $user, $cache;
$artist = request_var('a', '');
$redirect = request_var('r', '');
if (!empty($artist)) {
redirect(s_link('acp', array($redirect, 'a' => $artist)));
}
$artist_select = '';
if (!$user->is('founder')) {
$sql = 'SELECT ub
FROM _artists_auth
WHERE user_id = ?';
$artist_select = ' WHERE ub IN (' . _implode(',', sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) . ') ';
}
$sql = 'SELECT ub, subdomain, name
FROM _artists
??
ORDER BY name';
$artists = sql_rowset(sql_filter($sql, $artist_select));
foreach ($artists as $i => $row) {
if (!$i) _style('artist_list');
_style('artist_list.row', array(
'URL' => s_link('acp', array($redirect, 'a' => $row['subdomain'])),
'NAME' => $row['name'])
);
}
return;
}
示例7: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return;
}
$this->id = request_var('msg_id', 0);
$sql = 'SELECT *
FROM _forum_topics
WHERE topic_id = ?';
if (!$this->object = sql_fieldrow(sql_filter($sql, $this->id))) {
fatal_error();
}
$this->object = (object) $this->object;
$this->object->new_value = ($this->object->topic_featured) ? 0 : 1;
topic_feature($this->id, $this->object->new_value);
$sql_insert = array(
'bio' => $user->d('user_id'),
'time' => time(),
'ip' => $user->ip,
'action' => 'feature',
'old' => $this->object->topic_featured,
'new' => $this->object->new_value
);
sql_insert('log_mod', $sql_insert);
return redirect(s_link('topic', $this->id));
}
示例8: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username = request_var('username', '');
$password = request_var('password', '');
$username = get_username_base($username);
$sql = 'SELECT user_id, username
FROM _members
WHERE username_base = ?';
if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) {
fatal_error();
}
$sql = 'UPDATE _members SET user_password = ?
WHERE user_id = ?';
sql_query(sql_filter($sql, HashPassword($password), $userdata['user_id']));
return _pre('La contraseña de ' . $userdata['username'] . ' fue actualizada.', true);
}
示例9: _artist
public function _artist() {
global $user;
if ($user->is('artist')) {
$sql = 'SELECT a.ub
FROM _artists_auth t
INNER JOIN _artists a ON a.ub = t.ub
WHERE t.user_id = ?';
if ($artist_ary = sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) {
$sql_where = sql_filter('WHERE ub IN (??)', implode(',', $artist_ary));
}
}
$artist = request_var('a', '');
$module = request_var('module', '');
$url = s_link('acp', array('artist_select', 'r' => $module));
if (empty($artist)) {
redirect($url);
}
if (!$this->object = get_artist($artist, true)) {
fatal_error();
}
v_style(array(
'ARTIST_SELECT' => $url,
'ARTIST_NAME' => $this->object['name'])
);
return;
}
示例10: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username = request_var('username', '');
if (empty($username)) {
fatal_error();
}
$username = get_username_base($username);
$sql = 'SELECT user_id
FROM _members
WHERE username_base = ?';
if (!$row = sql_fieldrow(sql_filter($sql, $username))) {
fatal_error();
}
$sql = 'DELETE FROM _members_unread
WHERE user_id = ?
AND element <> ?';
sql_query(sql_filter($sql, $row['user_id'], 16));
return _pre('Deleted', true);
}
示例11: _home
public function _home() {
global $config, $user, $cache;
if (_button()) {
$forum_id = request_var('fid', 0);
$forum_alias = request_var('falias', '');
$sql = 'UPDATE _forums SET forum_alias = ?
WHERE forum_id = ?';
sql_query(sql_filter($sql, $forum_alias, $forum_id));
_pre($forum_id . ' > ' . $forum_alias, true);
}
$sql = 'SELECT forum_id, forum_name
FROM _forums
ORDER BY forum_order';
$result = sql_rowset($sql);
foreach ($result as $i => $row) {
if (!$i) _style('forums');
_style('forums.row', array(
'FORUM_ID' => $row['forum_id'],
'FORUM_NAME' => $row['forum_name'])
);
}
return;
}
示例12: _home
public function _home() {
global $config, $user, $comments;
$this->_artist();
if (_button()) {
$message = request_var('message', '');
$message = $comments->prepare($message);
$sql = 'UPDATE _artists SET bio = ?
WHERE ub = ?';
sql_query(sql_filter($sql, $message, $this->object['ub']));
_style('updated');
}
$sql = 'SELECT bio
FROM _artists
WHERE ub = ?';
$bio = sql_field(sql_filter($sql, $this->object['ub']), 'bio');
v_style(array(
'MESSAGE' => $bio)
);
return;
}
示例13: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username = request_var('username', '');
$username = get_username_base($username);
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) {
fatal_error();
}
$ary_sql = array(
'DELETE FROM _members WHERE user_id = ?',
'DELETE FROM _banlist WHERE ban_userid = ?',
'DELETE FROM _members_group WHERE user_id = ?',
'DELETE FROM _members_iplog WHERE log_user_id = ?',
'DELETE FROM _members_ref_invite WHERE invite_uid = ?',
'DELETE FROM _members_unread WHERE user_id = ?',
'DELETE FROM _poll_voters WHERE vote_user_id = ?',
'DELETE FROM _artists_auth WHERE user_id = ?',
'DELETE FROM _artists_viewers WHERE user_id = ?',
'DELETE FROM _artists_voters WHERE user_id = ?',
'DELETE FROM _dl_voters WHERE user_id = ?',
'UPDATE _members_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _news_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _artists_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _dl_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _events_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _forum_posts SET poster_id = 1 WHERE poster_id = ?',
'UPDATE _forum_topics SET topic_poster = 1 WHERE topic_poster = ?'
);
$sql = w();
foreach ($ary_sql as $row) {
$sql[] = sql_filter($row, $userdata['user_id']);
}
$ary_sql = array(
'DELETE FROM _members_ban WHERE user_id = ? OR banned_user = ?',
'DELETE FROM _members_friends WHERE user_id = ? OR buddy_id = ?',
'DELETE FROM _members_ref_assoc WHERE ref_uid = ? OR ref_orig = ?',
'DELETE FROM _members_viewers WHERE viewer_id = ? OR user_id = ?',
);
foreach ($ary_sql as $row) {
$sql[] = sql_filter($row, $userdata['user_id'], $userdata['user_id']);
}
sql_query($sql);
return _pre('El registro de <strong>' . $userdata['username'] . '</strong> fue eliminado.', true);
}
示例14: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('r'), _array_keys(w('v'), 0)));
if (!empty($v->v)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t
WHERE o.object_id = ?
AND t.type_alias = ?
AND o.object_type = t.type_id';
$video = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE o.object_id <> ?
AND t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv_list = sql_rowset(sql_filter($sql, $v->v, 'tv'));
$tv = w();
foreach ($video as $row) {
$tv[] = $row;
}
foreach ($tv_list as $row) {
$tv[] = $row;
}
//_pre($tv, true);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time';
$tv = sql_rowset(sql_filter($sql, 'tv'));
}
foreach ($tv as $i => $row) {
if (!$i) {
_style('tv', array('FIRST_SUBJECT' => $row->object_subject));
}
//$preg = preg_match("^http://(?<domain>([^./]+\\.)*youtube\\.com)(/v/|/watch\\?v=)(?<videoId>[A-Za-z0-9_-]{11})", $row->object_content);
preg_match('#(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\\n]+|(?<=embed\\/)[^"&\\n]+|(?<=(?:v|i)=)[^&\\n]+|(?<=youtu.be\\/)[^&\\n]+#', $row->object_content, $preg);
$embed = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $preg[0] . '" frameborder="0" allowfullscreen></iframe>';
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => $row->object_content, 'VIDEO' => $preg[0], 'EMBED' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '" class="thumbnail"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt=""><br /><h5>' . $row->object_subject . '</h5></a>', 'EMBED2' => !$i ? $embed : '<img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140" rel="' . _link('tv', array('v' => $row->object_id)) . '" />', 'EMBED3' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140"></a>', 'SPAN' => !$i ? 'span6' : 'span2', 'TIME' => $bio->format_date($row->object_time));
_style('tv.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('TV_URL' => _link('tv')));
}
$row->type_alias = _link('tv', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}
示例15: home
public function home()
{
global $core, $bio;
$v = $this->__(array_merge(w('a r'), _array_keys(w('s'), 0)));
if (!empty($v->a)) {
}
if (!empty($v->r)) {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND o.object_bio = b.bio_id
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->r, $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t, _objects_rel_assoc ra, _objects_rel_type rt
WHERE t.type_alias = ?
AND rt.type_alias = ?
AND ra.assoc_object = o.object_id
AND ra.assoc_rel_type = rt.type_id';
$news_total = sql_field(sql_filter($sql, 'news', $v->r), 'total', 0);
} else {
$sql = 'SELECT *
FROM _objects o, _objects_type t, _bio b
WHERE t.type_alias = ?
AND o.object_type = t.type_id
AND o.object_bio = b.bio_id
ORDER BY o.object_time
LIMIT ??, ??';
$news = sql_rowset(sql_filter($sql, 'news', $v->s, $core->v('objects_per_page')));
$sql = 'SELECT COUNT(object_id) AS total
FROM _objects o, _objects_type t
WHERE t.type_alias = ?
AND o.object_type = t.type_id';
$news_total = sql_field(sql_filter($sql, 'news'), 'total', 0);
}
foreach ($news as $i => $row) {
if (!$i) {
_style('news', _pagination(_link('news'), 's:%d', $news_total + 1, $core->v('objects_per_page'), $v->s));
}
$_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => _message($row->object_content), 'TIME' => $bio->format_date($row->object_time));
_style('news.row', array_merge($_row, $this->_profile($row)));
}
$sql = 'SELECT *
FROM _objects_rel_type
ORDER BY type_alias';
$rel_type = sql_rowset($sql);
foreach ($rel_type as $i => $row) {
if (!$i) {
_style('rel_type', array('NEWS_URL' => _link('news')));
}
$row->type_alias = _link('news', array('r' => $row->type_alias));
_style('rel_type.row', $row);
}
return;
}