function usesubmit() { global $_G; $list = $uids = array(); $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10; $limit = $num + 20; $giftMagicID = C::t('common_magic')->fetch_by_identifier('gift'); $mid = $giftMagicID['available'] ? intval($giftMagicID['magicid']) : 0; if ($mid) { foreach (C::t('common_magiclog')->fetch_all_by_magicid_action_uid($mid, 2, $_G['uid'], 0, $limit) as $value) { $uids[] = intval($value['uid']); } } if ($uids) { $counter = 0; $members = C::t('common_member')->fetch_all($uids); foreach (C::t('common_member_field_home')->fetch_all($uids) as $uid => $value) { $value = array_merge($members[$uid], $value); $info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array(); if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) { $value['avatar'] = addcslashes(avatar($uid, 'small'), "'"); $list[$uid] = $value; $counter++; if ($counter >= $num) { break; } } } } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); $op = 'show'; include template('home/magic_detector'); }
function usesubmit() { global $_G; $list = $uids = array(); $num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10; $limit = $num + 20; loadcache('magics'); $mid = !empty($_G['magics']['gift']) ? intval($_G['magics']['gift']['magicid']) : 0; if ($mid) { $query = DB::query('SELECT * FROM ' . DB::table('common_magiclog') . " WHERE magicid = '{$mid}' AND action='2' AND uid != '{$_G['uid']}' ORDER BY dateline DESC LIMIT 0,{$limit}"); while ($value = DB::fetch($query)) { $uids[] = intval($value['uid']); } } if ($uids) { $counter = 0; $query = DB::query('SELECT m.username, mfh.uid, mfh.magicgift FROM ' . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_field_home') . " mfh USING(uid) WHERE m.uid IN (" . dimplode($uids) . ")"); while ($value = DB::fetch($query)) { $info = !empty($value['magicgift']) ? unserialize($value['magicgift']) : array(); if (!empty($info['left']) && (empty($info['receiver']) || !in_array($_G['uid'], $info['receiver']))) { $value['avatar'] = addcslashes(avatar($value['uid'], 'small'), "'"); $list[$value['uid']] = $value; $counter++; if ($counter >= $num) { break; } } } } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); $op = 'show'; include template('home/magic_detector'); }
function usesubmit() { global $_G; if (empty($_G['gp_pid'])) { showmessage(lang('magic/repent', 'repent_info_nonexistence')); } $_G['tid'] = $_G['gp_ptid']; $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status')); $this->_check($post); require_once libfile('function/post'); require_once libfile('function/delete'); if ($post['first']) { if ($have_replycredit = DB::fetch_first("SELECT * FROM " . DB::table('forum_replycredit') . " WHERE tid ='{$post['tid']}' LIMIT 1")) { if ($replycredit = DB::result_first("SELECT replycredit FROM " . DB::table('forum_thread') . " WHERE tid = '{$post['tid']}'")) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit)); } DB::delete('forum_replycredit', "tid = '{$post['tid']}'"); DB::delete('common_credit_log', "operation IN ('RCT', 'RCA', 'RCB') AND relatedid IN({$post['tid']})"); } deletethread(array($post['tid'])); updateforumcount($post['fid']); } else { if ($post['replycredit'] > 0) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit'])); DB::delete('common_credit_log', "uid = '{$post['authorid']}' AND operation = 'RCA' AND relatedid IN({$post['tid']})"); } deletepost(array($_G['gp_pid'])); updatethreadcount($post['tid']); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']); showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $id = intval($_GET['id']); $idtype = $_GET['idtype']; $blog = magic_check_idtype($id, $idtype); $num = 10; $list = $ids = $note_inserts = array(); $fusername = dimplode($_POST['fusername']); if ($fusername) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $_POST['fusername'], 0, $num); $note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}")); foreach ($query as $value) { $ids[] = $value['fuid']; $value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small')); $list[] = $value; $note_inserts[] = array('uid' => $value['fuid'], 'type' => $name, 'new' => 1, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'note' => $note, 'dateline' => $_G['timestamp']); } } if (empty($ids)) { showmessage('magicuse_has_no_valid_friend'); } foreach ($note_inserts as $note_insert) { C::t('home_notification')->insert($note_insert); } C::t('common_member')->increase($ids, array('newprompt' => 1)); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); $op = 'show'; include template('home/magic_call'); }
function usesubmit() { global $_G; if (empty($_G['gp_pid'])) { showmessage(lang('magic/namepost', 'namepost_info_nonexistence')); } $_G['tid'] = $_G['gp_ptid']; $post = getpostinfo($_G['gp_pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous')); $this->_check($post); $query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'"); $author = daddslashes(DB::result($query, 0), 1); $thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter')); $posttable = getposttablebytid($post['tid']); if ($post['first']) { $lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author; DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE tid='{$post['tid']}' AND first='1'"); } else { $lastposter = $author; $author = $thread['author']; DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='0' WHERE pid='{$_G['gp_pid']}'"); } $forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'")); if ($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) { $lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED'); } DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); if ($post['authorid'] != $_G['uid']) { notification_add($post['authorid'], 'magic', lang('magic/namepost', 'namepost_notification'), array('pid' => $_G['gp_pid'], 'tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/namepost', 'namepost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $info = array('credits' => intval($_POST['credits']), 'percredit' => intval($_POST['percredit']), 'credittype' => $_G['gp_credittype'], 'left' => intval($_POST['credits']), 'magicid' => intval($this->magic['magicid']), 'receiver' => array()); if ($info['credits'] < 1) { showmessage(lang('magic/gift', 'gift_bad_credits_input')); } if ($info['percredit'] < 1 || $info['percredit'] > $info['credits']) { showmessage(lang('magic/gift', 'gift_bad_percredit_input')); } $member = array(); if (preg_match('/^extcredits[1-8]$/', $info['credittype'])) { $member = DB::fetch_first('SELECT * FROM ' . DB::table('common_member_count') . " WHERE uid = '{$_G['uid']}'"); if ($member[$info['credittype']] < $info['credits']) { showmessage(lang('magic/gift', 'gift_credits_out_of_own')); } $extcredits = str_replace('extcredits', '', $info['credittype']); updatemembercount($_G['uid'], array($extcredits => -$info['credits']), 1, 'BGC', $this->magic['magicid']); } else { showmessage(lang('magic/gift', 'gift_bad_credittype_input')); } DB::update('common_member_field_home', array('magicgift' => addslashes(serialize($info))), array('uid' => $_G['uid'])); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage(lang('magic/gift', 'gift_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : ''; if (!in_array($idtype, $this->idtypearray)) { showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); } if (empty($_GET['id'])) { showmessage(lang('magic/highlight', 'highlight_info_nonexistence_' . $idtype)); } if ($idtype == 'tid') { $info = getpostinfo($_GET['id'], $idtype, array('fid', 'authorid', 'subject')); $this->_check($info['fid']); magicthreadmod($_GET['id']); C::t('forum_thread')->update($_GET['id'], array('highlight' => $_GET['highlight_color'], 'moderated' => 1)); $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24; $expiration = TIMESTAMP + $this->parameters['expiration'] * 3600; updatemagicthreadlog($_GET['id'], $this->magic['magicid'], $expiration > 0 ? 'EHL' : 'HLT', $expiration); if ($info['authorid'] != $_G['uid']) { notification_add($info['authorid'], 'magic', lang('magic/highlight', 'highlight_notification'), array('tid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name'])); } } elseif ($idtype == 'blogid') { $info = getpostinfo($_GET['id'], $idtype, array('uid', 'subject')); C::t('home_blogfield')->update($_GET['id'], array('magiccolor' => $_GET['highlight_color'])); if ($info['uid'] != $_G['uid']) { notification_add($info['uid'], 'magic', lang('magic/highlight', 'highlight_notification_blogid'), array('blogid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name'])); } } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $_GET['id']); showmessage(lang('magic/highlight', 'highlight_succeed_' . $idtype), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; if (empty($_GET['username'])) { showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence')); } $member = getuserinfo($_GET['username']); $this->_check($member['groupid']); $online = C::app()->session->fetch_by_uid($member['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1); } if ($online) { $time = dgmdate($online['lastactivity'], 'u'); if ($online['invisible']) { showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } else { showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => $_GET['username'], 'time' => $time), array('alert' => 'info', 'showdialog' => 1)); } } else { showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => $_GET['username']), array('alert' => 'info', 'showdialog' => 1)); } }
function usesubmit() { global $_G; if (empty($_G['gp_username'])) { showmessage(lang('magic/checkonline', 'checkonline_info_nonexistence')); } $member = getuserinfo($_G['gp_username'], array('uid', 'groupid')); $this->_check($member['groupid']); $online = DB::fetch_first("SELECT action, lastactivity, invisible FROM " . DB::table('common_session') . " WHERE uid='{$member['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/checkonline', 'checkonline_notification'), array('magicname' => $this->magic['name']), 1); } if ($online) { $time = dgmdate($online['lastactivity'], 'u'); if ($online['invisible']) { showmessage(lang('magic/checkonline', 'checkonline_hidden_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1)); } else { showmessage(lang('magic/checkonline', 'checkonline_online_message'), '', array('username' => stripslashes($_G['gp_username']), 'time' => $time), array('showdialog' => 1)); } } else { showmessage(lang('magic/checkonline', 'checkonline_offline_message'), '', array('username' => stripslashes($_G['gp_username'])), array('showdialog' => 1)); } }
function usesubmit() { global $_G; $id = intval($_GET['id']); if (empty($id)) { showmessage(lang('magic/namepost', 'namepost_info_nonexistence')); } $idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : ''; if (!in_array($idtype, array('pid', 'cid'))) { showmessage(lang('magic/namepost', 'namepost_use_error')); } if ($idtype == 'pid') { $_G['tid'] = intval($_GET['ptid']); $post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.dateline', 'p.anonymous')); $this->_check($post); $authorid = $post['authorid']; $author = $post['anonymous'] ? '' : 1; } elseif ($idtype == 'cid') { $comment = C::t('home_comment')->fetch($id); $authorid = $comment['authorid']; $author = $comment['author']; } if ($author) { showmessage('magicuse_bad_object'); } $member = getuserbyuid($authorid); if (!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) { showmessage(lang('magic/namepost', 'namepost_info_user_noperm')); } $author = daddslashes($member['username']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id); showmessage(lang('magic/namepost', 'magic_namepost_succeed'), 'javascript:;', array('uid' => $authorid, 'username' => $author, 'avatar' => 1), array('alert' => 'right')); }
function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/sofa', 'sofa_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'dateline', 'subject')); $this->_check($thread); $firstsofa = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_threadmod') . " WHERE magicid='" . $this->magic['magicid'] . "' AND tid='{$_G['gp_tid']}'"); if ($firstsofa >= 1) { showmessage(lang('magic/sofa', 'sofa_info_sofaexistence'), '', array(), array('login' => 1)); } $sofamessage = lang('magic/sofa', 'sofa_text', array('actor' => $_G['member']['username'], 'time' => dgmdate(TIMESTAMP), 'magicname' => $this->magic['name'])); $dateline = $thread['dateline'] + 1; insertpost(array('fid' => $thread['fid'], 'tid' => $_G['gp_tid'], 'first' => '0', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'dateline' => $dateline, 'message' => $sofamessage, 'useip' => $_G['clientip'], 'usesig' => '1')); DB::query("UPDATE " . DB::table('forum_thread') . " SET replies=replies+1, moderated='1' WHERE tid='{$_G['tid']}'", 'UNBUFFERED'); DB::query("UPDATE " . DB::table('forum_forum') . " SET posts=posts+1, todayposts=todayposts+1 WHERE fid='{$post['fid']}'", 'UNBUFFERED'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid']); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/sofa', 'sofa_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/sofa', 'sofa_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => 1)); }
function usesubmit() { global $_G; $id = intval($_G['gp_id']); $idtype = $_G['gp_idtype']; $blog = magic_check_idtype($id, $idtype); $num = 10; $list = $ids = $note_inserts = array(); $fusername = dimplode($_POST['fusername']); if ($fusername) { $query = DB::query('SELECT * FROM ' . DB::table('home_friend') . " WHERE uid='{$_G['uid']}' AND fusername IN (" . $fusername . ") LIMIT {$num}"); $note = lang('spacecp', 'magic_call', array('url' => "home.php?mod=space&uid={$_G['uid']}&do=blog&id={$id}")); while ($value = DB::fetch($query)) { $ids[] = $value['fuid']; $value['avatar'] = str_replace("'", "\\'", avatar($value[fuid], 'small')); $list[] = $value; $note_inserts[] = "('{$value['fuid']}', '{$name}', '1', '{$_G['uid']}', '{$_G['username']}', '{$note}', '{$_G['timestamp']}')"; } } if (empty($ids)) { showmessage('magicuse_has_no_valid_friend'); } DB::query('INSERT INTO ' . DB::table('home_notification') . '(uid, type, new, authorid, author, note, dateline) VALUES ' . implode(',', $note_inserts)); DB::query('UPDATE ' . DB::table('common_member') . ' SET newprompt = newprompt + 1 WHERE uid IN (' . dimplode($ids) . ')'); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); $op = 'show'; include template('home/magic_call'); }
function usesubmit() { global $_G; if (empty($_GET['pid'])) { showmessage(lang('magic/repent', 'repent_info_nonexistence')); } $_G['tid'] = $_GET['ptid']; $post = getpostinfo($_GET['pid'], 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.replycredit', 't.status as thread_status')); $this->_check($post); require_once libfile('function/post'); require_once libfile('function/delete'); if ($post['first']) { if ($have_replycredit = C::t('forum_replycredit')->fetch($post['tid'])) { $thread = C::t('forum_thread')->fetch($post['tid']); if ($thread['replycredit']) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => $replycredit)); } C::t('forum_replycredit')->delete($post['tid']); C::t('common_credit_log')->delete_by_operation_relatedid(array('RCT', 'RCA', 'RCB'), $post['tid']); } deletethread(array($post['tid'])); updateforumcount($post['fid']); } else { if ($post['replycredit'] > 0) { updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$post['replycredit'])); C::t('common_credit_log')->delete_by_uid_operation_relatedid($post['authorid'], 'RCA', $post['tid']); } deletepost(array($_GET['pid'])); updatethreadcount($post['tid']); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['tid']); showmessage(lang('magic/repent', 'repent_succeed'), $post['first'] ? 'forum.php?mod=forumdisplay&fid=' . $post['fid'] : dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; DB::update('home_comment', array('magicflicker' => 1), array('cid' => intval($_G['gp_id']), 'authorid' => $_G['uid'])); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0'); showmessage(lang('magic/flicker', 'flicker_succeed'), '', array(), array('showdialog' => 1, 'closetime' => true)); }
function usesubmit() { global $_G; C::t('home_comment')->update($_GET['id'], array('magicflicker' => 1), $_G['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0'); showmessage(lang('magic/flicker', 'flicker_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'closetime' => true, 'locationtime' => true)); }
function usesubmit() { global $_G; $addnum = !empty($this->parameters['addnum']) ? intval($this->parameters['addnum']) : 10; C::t('common_member_field_home')->increase($_G['uid'], array('addfriend' => $addnum)); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage('magics_friendadd_message', '', array('num' => intval($this->parameters['addnum'])), array('alert' => 'right', 'showdialog' => 1)); }
function usesubmit() { global $_G; $addsize = !empty($this->parameters['addsize']) ? intval($this->parameters['addsize']) : 10; DB::query('UPDATE ' . DB::table('common_member_field_home') . " SET addsize = addsize + {$addsize} WHERE uid = '{$_G['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage('magics_attachsize_message', '', array('num' => intval($this->parameters['addsize'])), array('showdialog' => 1)); }
function usesubmit() { global $_G; $getmoney = rand(1, intval($this->magic['price'] * 1.5)); updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][3] => $getmoney), 1, 'MRC', $this->magic['magicid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $_G['uid']); showmessage('magics_credit_message', '', array('credit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][3]]['title'] . ' ' . $getmoney . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][3]]['unit']), array('showdialog' => 1)); }
function usesubmit() { global $_G; $id = intval($_GET['id']); $idtype = $_GET['idtype']; magic_check_idtype($id, $idtype); $tablename = gettablebyidtype($idtype); C::t($tablename)->update_dateline_by_id_idtype_uid($id, $idtype, $_G['timestamp'], $_G['uid']); C::t('home_feed')->update($id, array('dateline' => $_G['timestamp']), $idtype, $_G['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['updateline']), array('alert' => 'right', 'showdialog' => 1)); }
function usesubmit() { global $_G; $uid = $_G['uid']; $_G['uid'] = 0; $avatar = avatar($uid, 'middle', true); include_once libfile('function/feed'); feed_add('thunder', 'magicuse_thunder_announce_title', array('uid' => $uid, 'username' => "<a href=\"home.php?mod=space&uid={$uid}\">{$_G['username']}</a>"), 'magicuse_thunder_announce_body', array('uid' => $uid, 'magic_thunder' => 1), '', array($avatar), array("home.php?mod=space&uid={$uid}")); $_G['uid'] = $uid; usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage('magics_thunder_message', '', array('magicname' => $_G['setting']['magics']['thunder']), array('showdialog' => 1)); }
function usesubmit() { global $_G; $id = intval($_G['gp_id']); $idtype = $_G['gp_idtype']; magic_check_idtype($id, $idtype); $tablename = gettablebyidtype($idtype); DB::query("UPDATE " . DB::table($tablename) . " SET dateline = '{$_G['timestamp']}' WHERE {$idtype} = '{$id}' AND uid = '{$_G['uid']}'"); DB::query("UPDATE " . DB::table('home_feed') . " SET dateline = '{$_G['timestamp']}' WHERE id = '{$id}' AND idtype = '{$idtype}' AND uid = '{$_G['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['updateline']), array('showdialog' => 1)); }
function usesubmit() { global $_G; $id = intval($_G['gp_id']); $idtype = $_G['gp_idtype']; $blog = magic_check_idtype($id, $idtype); if (DB::result(DB::query('SELECT COUNT(*) FROM ' . DB::table('common_magiclog') . " WHERE action='2' AND uid = '{$_G['uid']}' AND targetid = '{$id}' AND idtype = '{$idtype}' AND magicid = '{$this->magic[magicid]}'"), 0)) { showmessage("magicuse_object_once_limit"); } $num = !empty($_G['setting']['feedhotmin']) ? intval($_G['setting']['feedhotmin']) : 3; DB::query('UPDATE ' . DB::table('home_feed') . " SET hot = hot + {$num} WHERE id = '{$id}' AND idtype = '{$idtype}' AND uid = '{$_G['uid']}'"); DB::query('UPDATE ' . DB::table('home_blog') . " SET hot = hot + {$num} WHERE blogid = '{$id}' AND uid = '{$_G['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['hot']), array('showdialog' => 1)); }
function usesubmit() { global $_G; $id = intval($_GET['id']); $idtype = $_GET['idtype']; $blog = magic_check_idtype($id, $idtype); if (C::t('common_magiclog')->count_by_action_uid_targetid_idtype_magicid(2, $_G['uid'], $id, $idtype, $this->magic['magicid'])) { showmessage('magicuse_object_once_limit'); } $num = !empty($_G['setting']['feedhotmin']) ? intval($_G['setting']['feedhotmin']) : 3; C::t('home_feed')->update_hot_by_id($id, $idtype, $_G['uid'], $num); C::t('home_blog')->increase($id, $_G['uid'], array('hot' => $num)); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['hot']), array('alert' => 'right', 'showdialog' => 1)); }
function usesubmit() { global $_G; if (empty($_G['gp_username'])) { showmessage(lang('magic/showip', 'showip_info_nonexistence')); } $member = getuserinfo($_G['gp_username'], array('uid', 'groupid')); $this->_check($member['groupid']); $ip = DB::result_first("SELECT lastip FROM " . DB::table('common_member_status') . " WHERE uid='{$member['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $member['uid']); if ($member['uid'] != $_G['uid']) { notification_add($member['uid'], 'magic', lang('magic/showip', 'showip_notification'), array('magicname' => $this->magic['name']), 1); } showmessage(lang('magic/showip', 'showip_ip_message'), '', array('username' => stripslashes($_G['gp_username']), 'ip' => $ip), array('showdialog' => 1)); }
function usesubmit() { global $_G; $id = intval($_GET['id']); if (empty($id)) { showmessage(lang('magic/anonymouspost', 'anonymouspost_info_nonexistence')); } $idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : ''; if (!in_array($idtype, array('pid', 'cid'))) { showmessage(lang('magic/anonymouspost', 'anonymouspost_use_error')); } if ($idtype == 'pid') { $_G['tid'] = $_GET['ptid']; $post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.author', 'p.dateline', 'p.anonymous')); $this->_check($post); if ($post['authorid'] != $_G['uid']) { showmessage('magics_operation_nopermission'); } $thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter')); if ($post['first']) { $author = ''; $lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : ''; } else { $author = $thread['author']; $lastposter = ''; } C::t('forum_post')->update('tid:' . $post['tid'], $id, array('anonymous' => 1)); $query = C::t('forum_forum')->fetch($post['fid']); $forum['lastpost'] = explode("\t", $query['lastpost']); if ($post['dateline'] == $forum['lastpost'][2] && ($post['author'] == $forum['lastpost'][3] || $forum['lastpost'][3] == '' && $post['anonymous'])) { $lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}"; C::t('forum_forum')->update($post['fid'], array('lastpost' => $lastpost)); } C::t('forum_thread')->update($post['tid'], array('author' => $author, 'lastposter' => $lastposter)); } elseif ($idtype == 'cid') { $value = C::t('home_comment')->fetch($id, intval($_G['uid'])); if (empty($value)) { showmessage(lang('magic/anonymouspost', 'anonymouspost_use_error')); } elseif ($value['author'] == '') { showmessage(lang('magic/anonymouspost', 'anonymouspost_once_limit')); } C::t('home_comment')->update($id, array('author' => ''), $_G['uid']); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id); showmessage(lang('magic/anonymouspost', 'anonymouspost_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $id = intval($_G['gp_id']); if (empty($id)) { showmessage(lang('magic/anonymouspost', 'anonymouspost_info_nonexistence')); } $idtype = !empty($_G['gp_idtype']) ? htmlspecialchars($_G['gp_idtype']) : ''; if (!in_array($idtype, array('pid', 'cid'))) { showmessage(lang('magic/anonymouspost', 'anonymouspost_use_error')); } if ($idtype == 'pid') { $_G['tid'] = $_G['gp_ptid']; $post = getpostinfo($id, 'pid', array('p.first', 'p.tid', 'p.fid', 'p.authorid', 'p.author', 'p.dateline', 'p.anonymous')); $this->_check($post); if ($post['authorid'] != $_G['uid']) { showmessage('magics_operation_nopermission'); } $thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter')); $posttable = getposttablebytid($post['tid']); if ($post['first']) { $author = ''; $lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : ''; } else { $author = $thread['author']; $lastposter = ''; } DB::query("UPDATE " . DB::table($posttable) . " SET anonymous='1' WHERE pid='{$id}'"); $forum['lastpost'] = explode("\t", DB::result_first("SELECT lastpost FROM " . DB::table('forum_forum') . " WHERE fid='{$post['fid']}'")); if ($post['dateline'] == $forum['lastpost'][2] && ($post['author'] == $forum['lastpost'][3] || $forum['lastpost'][3] == '' && $post['anonymous'])) { $lastpost = "{$thread['tid']}\t{$thread['subject']}\t{$_G['timestamp']}\t{$lastposter}"; DB::query("UPDATE " . DB::table('forum_forum') . " SET lastpost='{$lastpost}' WHERE fid='{$post['fid']}'", 'UNBUFFERED'); } DB::query("UPDATE " . DB::table('forum_thread') . " SET author='{$author}', lastposter='{$lastposter}' WHERE tid='{$post['tid']}'"); } elseif ($idtype == 'cid') { $value = DB::fetch_first('SELECT * FROM ' . DB::table('home_comment') . " WHERE cid = '{$id}' AND authorid = '{$_G['uid']}'"); if (empty($value)) { showmessage('anonymouspost_use_error'); } elseif ($value['author'] == '') { showmessage('anonymouspost_once_limit'); } DB::query("UPDATE " . DB::table('home_comment') . " SET author='' WHERE cid='{$id}' AND authorid='{$_G['uid']}'"); } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $id); showmessage(lang('magic/anonymouspost', 'anonymouspost_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $id = intval($_GET['id']); $idtype = $_GET['idtype']; $blog = magic_check_idtype($id, $idtype); $newdateline = strtotime($_POST['newdateline']); if (!$_POST['newdateline'] || $newdateline < strtotime('1970-1-1') || $newdateline > $blog['dateline']) { showmessage('magicuse_bad_dateline'); } $tablename = gettablebyidtype($idtype); C::t($tablename)->update_dateline_by_id_idtype_uid($id, $idtype, $newdateline, $_G['uid']); C::t('home_feed')->update($id, array('dateline' => $newdateline), $idtype, $_G['uid']); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['downdateline']), array('alert' => 'right', 'showdialog' => 1)); }
function usesubmit() { global $_G; if (empty($_GET['tid'])) { showmessage(lang('magic/bump', 'bump_info_nonexistence')); } $thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject')); $this->_check($thread['fid']); C::t('forum_thread')->update($_GET['tid'], array('moderated' => 1, 'lastpost' => TIMESTAMP)); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']); updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], 'BMP'); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/bump', 'bump_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/bump', 'bump_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; if (empty($_G['gp_tid'])) { showmessage(lang('magic/bump', 'bump_info_nonexistence')); } $thread = getpostinfo($_G['gp_tid'], 'tid', array('fid', 'authorid', 'subject')); $this->_check($thread['fid']); DB::query("UPDATE " . DB::table('forum_thread') . " SET lastpost='" . TIMESTAMP . "', moderated='1' WHERE tid='{$_G['gp_tid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_G['gp_tid']); updatemagicthreadlog($_G['gp_tid'], $this->magic['magicid'], 'BMP'); if ($thread['authorid'] != $_G['uid']) { notification_add($thread['authorid'], 'magic', lang('magic/bump', 'bump_notification'), array('tid' => $_G['gp_tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name'])); } showmessage(lang('magic/bump', 'bump_succeed'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); }
function usesubmit() { global $_G; $id = intval($_G['gp_id']); $idtype = $_G['gp_idtype']; $blog = magic_check_idtype($id, $idtype); $newdateline = strtotime($_POST['newdateline']); if (!$_POST['newdateline'] || $newdateline < strtotime('1970-1-1') || $newdateline > $blog['dateline']) { showmessage('magicuse_bad_dateline'); } $tablename = gettablebyidtype($idtype); DB::query("UPDATE " . DB::table($tablename) . " SET dateline='{$newdateline}' WHERE {$idtype}='{$id}' AND uid='{$_G['uid']}'"); DB::query("UPDATE " . DB::table('home_feed') . " SET dateline='{$newdateline}' WHERE id='{$id}' AND idtype='{$idtype}' AND uid='{$_G['uid']}'"); usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', $idtype, $id); showmessage('magics_use_success', '', array('magicname' => $_G['setting']['magics']['downdateline']), array('showdialog' => 1)); }