本文整理汇总了PHP中_pre函数的典型用法代码示例。如果您正苦于以下问题:PHP _pre函数的具体用法?PHP _pre怎么用?PHP _pre使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_pre函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _home
public function _home() {
global $config, $cache;
if (!_button()) {
$sql = 'SELECT ub, name
FROM _artists
ORDER BY name';
return _rowset_style($sql, 'artists');
}
$name = request_var('name', '');
$sql = 'SELECT *
FROM _artists
WHERE name = ?';
if (!$a_data = sql_fieldrow(sql_filter($sql, $name))) {
fatal_error();
}
$sql = 'SELECT m.user_id, m.user_email
FROM _artists_auth a, _members m
WHERE a.ub = ?
AND a.user_id = m.user_id';
$result = sql_rowset(sql_filter($sql, $a_data['ub']));
$mods = w();
foreach ($result as $row) {
$mods[] = $row['user_id'];
}
if (count($mods)) {
foreach ($mods as $i => $each) {
$sql = 'SELECT COUNT(user_id) AS total
FROM _artists_auth
WHERE user_id = ?';
$total = sql_field(sql_filter($sql, $each), 'total', 0);
if ($total > 1) {
unset($mods[$i]);
}
}
}
if (count($mods)) {
$sql = 'UPDATE _members SET user_auth_control = 0
WHERE user_id IN (??)';
$d_sql[] = sql_filter($sql, _implode(',', $mods));
}
$ary_sql = array(
'DELETE FROM _artists WHERE ub = ?',
'DELETE FROM _artists_auth WHERE ub = ?',
'DELETE FROM _artists_fav WHERE ub = ?',
'DELETE FROM _artists_images WHERE ub = ?',
'DELETE FROM _artists_log WHERE ub = ?',
'DELETE FROM _artists_lyrics WHERE ub = ?',
'DELETE FROM _artists_posts WHERE post_ub = ?',
'DELETE FROM _artists_stats WHERE ub = ?',
'DELETE FROM _artists_viewers WHERE ub = ?',
'DELETE FROM _artists_voters WHERE ub = ?',
'DELETE FROM _artists_votes WHERE ub = ?',
'DELETE FROM _forum_topics WHERE topic_ub = ?',
'DELETE FROM _dl WHERE ub = ?'
);
$d_sql = sql_filter($ary_sql, $a_data['ub']);
$sql = 'SELECT topic_id
FROM _forum_topics
WHERE topic_ub = ?';
if ($topics = sql_rowset(sql_filter($sql, $a_data['ub']), false, 'topic_id')) {
$d_sql[] = sql_filter('DELETE FROM _forum_posts
WHERE topic_id IN (??)', _implode(',', $topics));
}
$sql = 'SELECT id
FROM _dl
WHERE ub = ?';
if ($downloads = sql_rowset(sql_filter($sql, $a_data['ub']), false, 'id')) {
$ary_sql = array(
'DELETE FROM _dl_fav WHERE dl_id IN (??)',
'DELETE FROM _dl_posts WHERE download_id IN (??)',
'DELETE FROM _dl_vote WHERE ud IN (??)',
'DELETE FROM _dl_voters WHERE ud IN (??)'
);
$d_sql = array_merge($d_sql, sql_filter($ary_sql, _implode(',', $downloads)));
}
if (!_rm($config['artists_path'] . $a_data['ub'])) {
_pre('Error al eliminar directorio de artista.', true);
}
sql_query($d_sql);
// Cache
$cache->delete('ub_list a_last_images');
redirect(s_link('a'));
}
示例2: remove
private function remove() {
$v = _request(array('event' => 0));
if (_empty($v)) {
return;
}
$sql = 'SELECT *
FROM _events
WHERE id = ?';
if (!$row = sql_fieldrow(sql_filter($sql, $event))) {
_pre('El evento no existe.', true);
}
$e_artist = explode(nr(), $artist);
foreach ($e_artist as $row) {
$subdomain = get_subdomain($row);
$sql = 'SELECT *
FROM _artists
WHERE subdomain = ?';
if ($a_row = sql_fieldrow(sql_filter($sql, $subdomain))) {
$sql = 'DELETE FROM _artists_events
WHERE a_artist = ?
AND a_event = ?';
sql_query(sql_filter($sql, $a_row['ub'], $event));
}
}
return redirect(s_link('events', $row['event_alias']));
}
示例3: _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;
}
示例4: home
public function home()
{
/*
$sql = 'SELECT *
FROM _store
WHERE store_field = 4
ORDER BY store_value';
$countries = _rowset($sql);
foreach ($countries as $row)
{
$sv = ucwords(_rm_acute($row['store_value']));
$sql = 'UPDATE _store SET store_value = ?
WHERE store_id = ?';
_sql(sql_filter($sql, $sv, $row['store_id']));
}
*/
$sql = 'SELECT DISTINCT store_value
FROM _store
WHERE store_field = 4
ORDER BY store_value';
$countries = _rowset($sql, 'store_value');
_pre($countries, true);
$this->e('');
return;
}
示例5: _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);
}
示例6: _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);
}
示例7: _home
public function _home() {
global $config, $user, $cache;
sql_truncate('_smilies');
$emoticon_path = $config['assets_path'] . 'emoticon/';
$process = 0;
$fp = @opendir($emoticon_path);
while ($file = @readdir($fp)) {
if (preg_match('#([a-z0-9]+)\.(gif|png)#is', $file, $part)) {
$insert = array(
'code' => ':' . $part[1] . ':',
'smile_url' => $part[0]
);
sql_insert('smilies', $insert);
$process++;
}
}
@closedir($fp);
$cache->delete('smilies');
return _pre($process . ' emoticons.');
}
示例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: _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);
}
示例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()) {
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);
}
示例12: _home
public function _home() {
global $config, $user, $cache;
$submit2 = _button('submit2');
if (_button() || $submit2) {
$news_id = request_var('news_id', 0);
$sql = 'SELECT *
FROM _news
WHERE news_id = ?';
if (!$news_data = sql_fieldrow(sql_filter($sql, $news_id))) {
fatal_error();
}
if ($submit2) {
$post_subject = request_var('post_subject', '');
$post_desc = request_var('post_desc', '', true);
$post_message = request_var('post_text', '', true);
if (empty($post_desc) || empty($post_message)) {
_pre('Campos requeridos.', true);
}
$comments = new _comments();
$post_message = $comments->prepare($post_message);
$post_desc = $comments->prepare($post_desc);
//
$sql = 'UPDATE _news SET post_subject = ?, post_desc = ?, post_text = ?
WHERE news_id = ?';
sql_query(sql_filter($sql, $post_subject, $post_desc, $post_message, $news_id));
$cache->delete('news');
redirect(s_link('news', $news_id));
}
if (_button()) {
_style('edit', array(
'ID' => $news_data['news_id'],
'SUBJECT' => $news_data['post_subject'],
'DESC' => $news_data['post_desc'],
'TEXT' => $news_data['post_text'])
);
}
}
if (!_button()) {
_style('field');
}
return;
}
示例13: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$username1 = request_var('username1', '');
$username2 = request_var('username2', '');
if (empty($username1) || empty($username2)) {
fatal_error();
}
$username_base1 = get_username_base($username1);
$username_base2 = get_username_base($username2);
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base1))) {
_pre('El usuario no existe.', true);
}
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
if ($void = sql_fieldrow(sql_filter($sql, $username_base2))) {
_pre('El usuario ya existe.', true);
}
//
$sql = 'UPDATE _members SET username = ?, username_base = ?
WHERE user_id = ?';
sql_query(sql_filter($sql, $username2, $username_base2, $userdata['user_id']));
$emailer = new emailer();
$emailer->from('info');
$emailer->use_template('username_change', $config['default_lang']);
$emailer->email_address($userdata['user_email']);
$emailer->assign_vars(array(
'USERNAME' => $userdata['username'],
'NEW_USERNAME' => $username2,
'U_USERNAME' => s_link('m', $username_base2))
);
$emailer->send();
$emailer->reset();
redirect(s_link('m', $username_base2));
return;
}
示例14: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$msg_id = request_var('msg_id', 0);
$sql = 'SELECT *
FROM _members_posts
WHERE post_id = ?';
if (!$d = sql_fieldrow(sql_filter($sql, $msg_id))) {
fatal_error();
}
$sql = 'DELETE FROM _members_posts
WHERE post_id = ?';
sql_query(sql_filter($sql, $msg_id));
$sql = 'UPDATE _members SET userpage_posts = userpage_posts - 1
WHERE user_id = ?';
sql_query(sql_filter($sql, $d['userpage_id']));
if (_button('user')) {
$sql = 'SELECT ban_id
FROM _banlist
WHERE ban_userid = ?';
if (!$row = sql_fieldrow(sql_filter($sql, $d['poster_id']))) {
sql_insert('banlist', array('ban_userid' => $d['poster_id']));
}
}
if (_button('ip')) {
$sql = 'SELECT ban_id
FROM _banlist
WHERE ban_ip = ?';
if (!$row = sql_fieldrow(sql_filter($sql, $d['post_ip']))) {
$sql_insert = array(
'ban_ip' => $d['post_ip']
);
sql_insert('banlist', $sql_insert);
}
}
return _pre($d, true);
}
示例15: _home
public function _home() {
global $config, $user, $cache;
if (!_button()) {
return false;
}
$userid = request_var('uid', 0);
$username = request_var('username', '');
$email = request_var('email', '');
if (empty($username) && empty($email) && !$userid) {
fatal_error();
}
if (!empty($email)) {
$sql = 'SELECT *
FROM _members
WHERE user_email = ?';
$sql = sql_filter($sql, $email);
} else if ($userid) {
$sql = 'SELECT *
FROM _members
WHERE user_id = ?';
$sql = sql_filter($sql, $userid);
} else {
$sql = 'SELECT *
FROM _members
WHERE username_base = ?';
$sql = sql_filter($sql, get_username_base($username));
}
if (!$userdata = sql_fieldrow($sql)) {
fatal_error();
}
foreach ($userdata as $k => $void) {
if (preg_match('#\d+#is', $k)) {
unset($userdata[$k]);
}
}
return _pre($userdata, true);
}