First commit

This commit is contained in:
2025-06-18 10:24:27 +08:00
commit ebc39cd5dd
3873 changed files with 412712 additions and 0 deletions

View File

View File

@@ -0,0 +1,147 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_anonymouspost.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_anonymouspost {
var $version = '1.0';
var $name = 'anonymouspost_name';
var $description = 'anonymouspost_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'fids' => array(
'title' => 'anonymouspost_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
}
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_post('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']))) {
$subject = cutstr($thread['subject'], 80);
$lastpost = "{$thread['tid']}\t{$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_comment($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_comment($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 show() {
global $_G;
$id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if($idtype == 'pid') {
list($id, $_G['tid']) = explode(':', $id);
if($id && $_G['tid']) {
$post = getpostinfo($id, 'pid', array('p.fid', 'p.authorid'));
$this->_check($post);
}
}
magicshowtype('top');
magicshowtips(lang('magic/anonymouspost', 'anonymouspost_desc'));
magicshowtips(lang('magic/anonymouspost', 'anonymouspost_num', array('magicnum' => $this->magic['num'])));
magicshowsetting('', 'id', $id, 'hidden');
magicshowsetting('', 'idtype', $idtype, 'hidden');
if($idtype == 'pid') {
magicshowsetting('', 'ptid', $_G['tid'], 'hidden');
}
magicshowtype('bottom');
}
function buy() {
global $_G;
$id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if(!empty($id) && $idtype == 'pid') {
list($id, $_G['tid']) = explode(':', $id);
$post = getpostinfo(intval($id), 'pid', array('p.fid', 'p.authorid'));
$this->_check($post);
}
}
function _check($post) {
global $_G;
if(!checkmagicperm($this->parameters['forum'], $post['fid'])) {
showmessage(lang('magic/anonymouspost', 'anonymouspost_info_noperm'));
}
if($post['authorid'] != $_G['uid']) {
showmessage(lang('magic/anonymouspost', 'anonymouspost_info_user_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,65 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_attachsize.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_attachsize {
var $version = '1.0';
var $name = 'attachsize_name';
var $description = 'attachsize_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
$settings = array(
'addsize' => array(
'title' => 'attachsize_addsize',
'type' => 'select',
'value' => array(
array('5', '5M'),
array('10', '10M'),
array('20', '20M'),
array('50', '50M'),
array('100', '100M'),
),
'default' => '10'
),
);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
$magicnew['addsize'] = in_array($parameters['addsize'], array(5,10,20,50,100)) ? intval($parameters['addsize']) : '10';
}
function usesubmit() {
global $_G;
$addsize = !empty($this->parameters['addsize']) ? intval($this->parameters['addsize']) : 10;
C::t('common_member_field_home')->increase($_G['uid'], array('addsize' => $addsize));
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('alert' => 'right', 'showdialog' => 1));
}
function show() {
magicshowtips(lang('magic/attachsize', 'attachsize_info', array('num'=>intval($this->parameters['addsize']))));
}
}
?>

View File

@@ -0,0 +1,99 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_bump.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_bump {
var $version = '1.0';
var $name = 'bump_name';
var $description = 'bump_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'fids' => array(
'title' => 'bump_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
}
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 show() {
global $_G;
$tid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($tid) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
magicshowtype('top');
magicshowsetting(lang('magic/bump', 'bump_info'), 'tid', $tid, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
}
function _check($fid) {
if(!checkmagicperm($this->parameters['forum'], $fid)) {
showmessage(lang('magic/bump', 'bump_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_call.php 25246 2011-11-02 03:34:53Z zhangguosheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_call {
var $version = '1.0';
var $name = 'call_name';
var $description = 'call_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
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' => "magic",
'new' => 1,
'authorid' => $_G['uid'],
'author' => $_G['username'],
'note' => $note,
'category' => 3,
'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 show() {
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
magic_check_idtype($id, $idtype);
magicshowtips(lang('magic/call', 'call_info'));
$op = 'use';
include template('home/magic_call');
}
}
?>

View File

@@ -0,0 +1,91 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_checkonline.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_checkonline {
var $version = '1.0';
var $name = 'checkonline_name';
var $description = 'checkonline_desc';
var $price = '10';
var $weight = '10';
var $useevent = 1;
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
}
function setsetting(&$magicnew, &$parameters) {
}
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 show() {
global $_G;
$user = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($user) {
$member = getuserinfo($user);
$this->_check($member['groupid']);
}
magicshowtype('top');
magicshowsetting(lang('magic/checkonline', 'checkonline_targetuser'), 'username', $user, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$member = getuserinfo($_GET['id']);
$this->_check($member['groupid']);
}
}
function _check($groupid) {
if(!checkmagicperm($this->parameters['targetgroups'], $groupid)) {
showmessage(lang('magic/checkonline', 'checkonline_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,74 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_chgusername.php 2248 2020-02-16 00:00:00Z community $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_chgusername {
var $version = '1.0';
var $name = 'chgusername_name';
var $description = 'chgusername_desc';
var $price = '10';
var $weight = '10';
var $useevent = 1;
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip" target="_blank">Discuz! Community Team</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
}
function setsetting(&$magicnew, &$parameters) {
}
function usesubmit() {
global $_G;
if(empty($_GET['newusername'])) {
showmessage(lang('magic/chgusername', 'chgusername_info_nonexistence'));
}
$censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($_G['settting']['censoruser'] = trim($_G['settting']['censoruser'])), '/')).')$/i';
if($_G['settting']['censoruser'] && @preg_match($censorexp, $_GET['newusername'])) {
showmessage(lang('magic/chgusername', 'chgusername_name_badword'));
}
loaducenter();
$ucresult = uc_user_chgusername($_G['uid'], addslashes(trim($_GET['newusername'])));
if($ucresult < 0) {
if($ucresult == -1) {
showmessage(lang('magic/chgusername', 'chgusername_check_failed'));
} elseif($ucresult == -2) {
showmessage(lang('magic/chgusername', 'chgusername_name_badword'));
} elseif($ucresult == -3) {
showmessage(lang('magic/chgusername', 'chgusername_name_exists'));
} else {
showmessage(lang('magic/chgusername', 'chgusername_change_failed'));
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'uid', $_G['uid']);
showmessage(lang('magic/chgusername', 'chgusername_change_success'), '', '', array('alert' => 'info', 'showdialog' => 1));
}
function show() {
magicshowtype('top');
magicshowsetting(lang('magic/chgusername', 'chgusername_newusername'), 'newusername', '', 'text');
magicshowtype('bottom');
}
}
?>

View File

@@ -0,0 +1,116 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_close.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_close {
var $version = '1.0';
var $name = 'close_name';
var $description = 'close_desc';
var $price = '10';
var $weight = '10';
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'expiration' => array(
'title' => 'close_expiration',
'type' => 'text',
'value' => '',
'default' => 24,
),
'fids' => array(
'title' => 'close_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
$magicnew['expiration'] = intval($parameters['expiration']);
}
function usesubmit() {
global $_G;
if(empty($_GET['tid'])) {
showmessage(lang('magic/close', 'close_info_nonexistence'));
}
$thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject'));
$this->_check($thread);
magicthreadmod($_GET['tid']);
C::t('forum_thread')->update($_GET['tid'], array('closed' => 1, 'moderated' => 1));
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
$expiration = TIMESTAMP + $this->parameters['expiration'] * 3600;
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']);
updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], $expiration > 0 ? 'ECL' : 'CLS', $expiration);
if($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/close', 'close_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/close', 'close_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
global $_G;
$tid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($tid) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid', 'authorid'));
$this->_check($thread);
}
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
magicshowtype('top');
magicshowsetting(lang('magic/close', 'close_info', array('expiration' => $this->parameters['expiration'])), 'tid', $tid, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid', 'authorid'));
$this->_check($thread);
}
}
function _check($thread) {
if(!checkmagicperm($this->parameters['forum'], $thread['fid'])) {
showmessage(lang('magic/close', 'close_info_noperm'));
}
$member = getuserbyuid($thread['authorid']);
if(!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
showmessage(lang('magic/close', 'close_info_user_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,90 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_detector.php 27375 2012-01-19 04:47:27Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_detector {
var $version = '1.0';
var $name = 'detector_name';
var $description = 'detector_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
$settings = array(
'num' => array(
'title' => 'detector_num',
'type' => 'select',
'value' => array(
array('5', '5'),
array('10', '10'),
array('20', '20'),
),
'default' => '10'
),
);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
$magicnew['num'] = in_array($parameters['num'], array(5,10,20,50)) ? intval($parameters['num']) : '10';
}
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']) ? dunserialize($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 show() {
global $_G;
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
magicshowtips(lang('magic/detector', 'detector_info', array('num'=>$num)));
}
}
?>

View File

@@ -0,0 +1,52 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_doodle.php 23608 2011-07-27 08:10:07Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_doodle {
var $version = '1.0';
var $name = 'doodle_name';
var $description = 'doodle_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
function usesubmit() {
global $_G;
$config = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
include template('home/magic_doodle');
}
function show() {
global $_G;
magicshowtips(lang('magic/doodle', 'doodle_info'));
echo '
<p>
<input type="hidden" name="showid" value="'.htmlspecialchars($_GET['showid']).'" />
<input type="hidden" name="mtarget" value="'.htmlspecialchars($_GET['target']).'" />
<input type="hidden" name="from" value="'.htmlspecialchars($_GET['from']).'" />
</p>
';
}
}
?>

View File

@@ -0,0 +1,65 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_downdateline.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_downdateline {
var $version = '1.0';
var $name = 'downdateline_name';
var $description = 'downdateline_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
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_feed($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 show() {
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
$blog = magic_check_idtype($id, $idtype);
magicshowtips(lang('magic/downdateline', 'downdateline_info'));
$time = dgmdate($blog['dateline'], 'Y-m-d H:i');
$op='use';
include template('home/magic_downdateline');
}
}
?>

View File

@@ -0,0 +1,44 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_flicker.php 26901 2011-12-27 07:16:24Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_flicker {
var $version = '1.0';
var $name = 'flicker_name';
var $description = 'flicker_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
function usesubmit() {
global $_G;
C::t('home_comment')->update_comment($_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 show() {
global $_G;
magicshowtips(lang('magic/flicker', 'flicker_info'));
}
}
?>

View File

@@ -0,0 +1,65 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_friendnum.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_friendnum {
var $version = '1.0';
var $name = 'friendnum_name';
var $description = 'friendnum_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
$settings = array(
'addnum' => array(
'title' => 'friendnum_addnum',
'type' => 'select',
'value' => array(
array('5', '5'),
array('10', '10'),
array('20', '20'),
array('50', '50'),
),
'default' => '10'
),
);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
$magicnew['addnum'] = in_array($parameters['addnum'], array(5,10,20,50)) ? intval($parameters['addnum']) : '10';
}
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($this->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 show() {
$addnum = !empty($this->parameters['addnum']) ? intval($this->parameters['addnum']) : 10;
magicshowtips(lang('magic/friendnum', 'friendnum_info', array('num'=>$addnum)));
}
}
?>

View File

@@ -0,0 +1,86 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_gift.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_gift {
var $version = '1.0';
var $name = 'gift_name';
var $description = 'gift_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
$settings = array();
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
}
function usesubmit() {
global $_G;
$info = array(
'credits' => intval($_POST['credits']),
'percredit' => intval($_POST['percredit']),
'credittype' => $_GET['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 = C::t('common_member_count')->fetch($_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'));
}
C::t('common_member_field_home')->update($_G['uid'], array('magicgift' => serialize($info)));
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('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
global $_G;
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
magicshowtips(lang('magic/gift', 'gift_info', array('num'=>$num)));
$extcredits = array();
foreach($_G['setting']['extcredits'] as $id => $credit) {
$extcredits['extcredits'.$id] = $credit['title'];
}
$op = 'show';
include template('home/magic_gift');
}
}
?>

View File

@@ -0,0 +1,160 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_highlight.php 33516 2013-06-27 08:58:10Z nemohou $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_highlight {
var $version = '1.0';
var $name = 'highlight_name';
var $description = 'highlight_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
var $idtypearray = array('blogid', 'tid');
function getsetting(&$magic) {
global $_G;
$settings = array(
'expiration' => array(
'title' => 'highlight_expiration',
'type' => 'text',
'value' => '',
'default' => 24,
),
'fids' => array(
'title' => 'highlight_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
$magicnew['expiration'] = intval($parameters['expiration']);
}
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 show() {
global $_G;
$id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
$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($id) {
$info = getpostinfo($_GET['id'], $idtype);
if($idtype == 'tid') {
$this->_check($info['fid']);
$this->parameters['expiration'] = $this->parameters['expiration'] && $idtype == 'tid' ? intval($this->parameters['expiration']) : 24;
}
}
magicshowtype('top');
$lang = lang('magic/highlight');
magicshowsetting(lang('magic/highlight', 'highlight_info_'.$idtype, array('expiration' => $this->parameters['expiration'])), 'id', $id, 'hidden');
echo <<<EOF
<p class="mtm mbn">{$lang['highlight_color']}</p>
<div class="hasd mbm cl">
<input type="hidden" id="highlight_color" name="highlight_color" />
<input type="hidden" id="highlight_idtype" name="idtype" value="$idtype"/>
<input type="text" id="highlight_color_show" class="crl readonly="readonly"" />
<a href="javascript:;" id="highlight_color_ctrl" class="dpbtn" onclick="showHighLightColor('highlight_color')">^</a>
</div>
<script type="text/javascript" reload="1">
function showHighLightColor(hlid) {
var showid = hlid + '_show';
if(!$(showid + '_menu')) {
var str = '';
var coloroptions = {'0' : '#000', '1' : '#EE1B2E', '2' : '#EE5023', '3' : '#996600', '4' : '#3C9D40', '5' : '#2897C5', '6' : '#2B65B7', '7' : '#8F2A90', '8' : '#EC1282'};
var menu = document.createElement('div');
menu.id = showid + '_menu';
menu.className = 'cmen';
menu.style.display = 'none';
for(var i in coloroptions) {
str += '<a href="javascript:;" onclick="$(\'' + hlid + '\').value=' + i + ';$(\'' + showid + '\').style.backgroundColor=\'' + coloroptions[i] + '\';hideMenu(\'' + menu.id + '\')" style="background:' + coloroptions[i] + ';color:' + coloroptions[i] + ';">' + coloroptions[i] + '</a>';
}
menu.innerHTML = str;
$('append_parent').appendChild(menu);
}
showMenu({'ctrlid':hlid + '_ctrl','evt':'click','showid':showid});
}
</script>
EOF;
magicshowtype('bottom');
}
function buy() {
global $_G;
$idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : '';
if(!empty($_GET['id'])) {
$info = getpostinfo($_GET['id'], $idtype);
if($idtype == 'tid') {
$this->_check($info['fid']);
}
}
}
function _check($fid) {
if(!checkmagicperm($this->parameters['forum'], $fid)) {
showmessage(lang('magic/highlight', 'highlight_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,72 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_hot.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_hot {
var $version = '1.0';
var $name = 'hot_name';
var $description = 'hot_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
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 show() {
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;
magicshowtips(lang('magic/hot', 'hot_info', array('num'=>$num)));
echo <<<HTML
<p>
<input type="hidden" name="id" value="'.$id.'" />
<input type="hidden" name="idtype" value="'.$idtype.'" />
</p>
HTML;
}
}
?>

View File

@@ -0,0 +1,116 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_jack.php 34353 2014-03-19 04:57:02Z hypowang $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_jack {
var $version = '1.0';
var $name = 'jack_name';
var $description = 'jack_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'expiration' => array(
'title' => 'jack_expiration',
'type' => 'text',
'value' => '',
'default' => 1,
),
'fids' => array(
'title' => 'jack_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
$magicnew['expiration'] = intval($parameters['expiration']);
}
function usesubmit() {
global $_G;
if(empty($_GET['tid'])) {
showmessage(lang('magic/jack', 'jack_info_nonexistence'));
}
$thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject', 'lastpost'));
$this->_check($thread['fid']);
magicthreadmod($_GET['tid']);
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 1;
$magicnum = abs(intval($_GET['magicnum']));
if(empty($magicnum) || $magicnum > $this->magic['num']) {
showmessage(lang('magic/jack', 'jack_num_not_enough'));
}
$expiration = ($thread['lastpost'] > TIMESTAMP ? $thread['lastpost'] : TIMESTAMP) + $this->parameters['expiration'] * $magicnum * 3600;
C::t('forum_thread')->update($_GET['tid'], array('lastpost' => $expiration));
usemagic($this->magic['magicid'], $this->magic['num'], $magicnum);
updatemagiclog($this->magic['magicid'], '2', $magicnum, '0', 0, 'tid', $_GET['tid']);
if($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/jack', 'jack_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/jack', 'jack_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
global $_G;
$tid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($tid) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 1;
magicshowtype('top');
magicshowtips(lang('magic/jack', 'jack_info', array('expiration' => $this->parameters['expiration'], 'magicnum' => $this->magic['num'])));
magicshowsetting(lang('magic/jack', 'jack_num'), 'magicnum', '1', 'text');
magicshowsetting('', 'tid', $tid, 'hidden');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 1;
magicshowtips(lang('magic/jack', 'jack_info', array('expiration' => $this->parameters['expiration'])));
}
function _check($fid) {
if(!checkmagicperm($this->parameters['forum'], $fid)) {
showmessage(lang('magic/jack', 'jack_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,51 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_money.php 26715 2011-12-21 01:35:43Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_money {
var $version = '1.0';
var $name = 'money_name';
var $description = 'money_desc';
var $price = '10';
var $weight = '10';
var $useevent = 1;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
}
function setsetting(&$magicnew, &$parameters) {
}
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('alert' => 'right', 'showdialog' => 1));
}
function show() {
magicshowtips(lang('magic/money', 'money_info'));
}
function buy() {
}
}
?>

View File

@@ -0,0 +1,133 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_namepost.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_namepost {
var $version = '1.0';
var $name = 'namepost_name';
var $description = 'namepost_desc';
var $price = '10';
var $weight = '10';
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'fids' => array(
'title' => 'namepost_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
}
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_comment($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 show() {
global $_G;
$id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if($idtype == 'pid') {
list($id, $_G['tid']) = explode(':', $id);
if($id && $_G['tid']) {
$post = getpostinfo($id, 'pid', array('p.fid', 'p.authorid'));
$this->_check($post);
}
}
magicshowtype('top');
magicshowtips(lang('magic/namepost', 'namepost_desc'));
magicshowtips(lang('magic/namepost', 'namepost_num', array('magicnum' => $this->magic['num'])));
magicshowsetting('', 'id', $id, 'hidden');
magicshowsetting('', 'idtype', $idtype, 'hidden');
if($idtype == 'pid') {
magicshowsetting('', 'ptid', $_G['tid'], 'hidden');
}
magicshowtype('bottom');
}
function buy() {
global $_G;
$id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
$idtype = !empty($_GET['idtype']) ? dhtmlspecialchars($_GET['idtype']) : '';
if(!empty($id) && $_GET['idtype'] == 'pid') {
list($id, $_G['tid']) = explode(':', $id);
$post = getpostinfo(intval($id), 'pid', array('p.fid', 'p.authorid'));
$this->_check($post);
}
}
function _check($post) {
global $_G;
if(!checkmagicperm($this->parameters['forum'], $post['fid'])) {
showmessage(lang('magic/namepost', 'namepost_info_noperm'));
}
$member = getuserbyuid($post['authorid']);
if(!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
showmessage(lang('magic/namepost', 'namepost_info_user_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,107 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_open.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_open {
var $version = '1.0';
var $name = 'open_name';
var $description = 'open_desc';
var $price = '10';
var $weight = '10';
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'fids' => array(
'title' => 'open_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
$magicnew['expiration'] = intval($parameters['expiration']);
}
function usesubmit() {
global $_G;
if(empty($_GET['tid'])) {
showmessage(lang('magic/open', 'open_info_nonexistence'));
}
$thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject'));
$this->_check($thread);
magicthreadmod($_GET['tid']);
C::t('forum_thread')->update($_GET['tid'], array('closed' => 0, 'moderated' => 1));
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']);
updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], 'OPN');
if($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/open', 'open_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/open', 'open_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
global $_G;
$tid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($tid) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid', 'authorid'));
$this->_check($thread);
}
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
magicshowtype('top');
magicshowsetting(lang('magic/open', 'open_info', array('expiration' => $this->parameters['expiration'])), 'tid', $tid, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid', 'authorid'));
$this->_check($thread);
}
}
function _check($thread) {
if(!checkmagicperm($this->parameters['forum'], $thread['fid'])) {
showmessage(lang('magic/open', 'open_info_noperm'));
}
$member = getuserbyuid($thread['authorid']);
if(!checkmagicperm($this->parameters['targetgroups'], $member['groupid'])) {
showmessage(lang('magic/open', 'open_info_user_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,127 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_repent.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_repent {
var $version = '1.0';
var $name = 'repent_name';
var $description = 'repent_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'fids' => array(
'title' => 'repent_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
}
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_thread($post['tid']);
if($thread['replycredit']) {
updatemembercount($post['authorid'], array($_G['setting']['creditstransextra'][10] => -$thread['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 show() {
global $_G;
$pid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
list($pid, $_G['tid']) = explode(':', $pid);
if($_G['tid']) {
$post = getpostinfo($_GET['id'], 'pid', array('p.fid', 'p.authorid', 't.status as thread_status'));
$this->_check($post);
}
magicshowtype('top');
magicshowsetting(lang('magic/repent', 'repent_info'), 'pid', $pid, 'text');
magicshowsetting('', 'ptid', $_G['tid'], 'hidden');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
list($_GET['id'], $_G['tid']) = explode(':', $_GET['id']);
$post = getpostinfo($_GET['id'], 'pid', array('p.fid', 'p.authorid'));
$this->_check($post);
}
}
function _check($post) {
global $_G;
if(!checkmagicperm($this->parameters['forum'], $post['fid'])) {
showmessage(lang('magic/repent', 'repent_info_noperm'));
}
if($post['authorid'] != $_G['uid']) {
showmessage(lang('magic/repent', 'repent_info_user_noperm'));
}
if(getstatus($post['status'], 3)) {
showmessage(lang('magic/repent', 'repent_do_not_rushreply'));
}
}
}
?>

View File

@@ -0,0 +1,88 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_showip.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_showip {
var $version = '1.0';
var $name = 'showip_name';
var $description = 'showip_desc';
var $price = '10';
var $weight = '10';
var $useevent = 1;
var $targetgroupperm = true;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
}
function setsetting(&$magicnew, &$parameters) {
}
function usesubmit() {
global $_G;
if(empty($_GET['username'])) {
showmessage(lang('magic/showip', 'showip_info_nonexistence'));
}
$member = getuserinfo($_GET['username']);
$this->_check($member['groupid']);
$memberstatus = C::t('common_member_status')->fetch($member['uid']);
$ip = $memberstatus['lastip'];
unset($memberstatus);
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' => $_GET['username'], 'ip' => $ip), array('alert' => 'info', 'showdialog' => 1));
}
function show() {
global $_G;
$user = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($user) {
$member = getuserinfo($user);
$this->_check($member['groupid']);
}
magicshowtype('top');
magicshowsetting(lang('magic/showip', 'showip_targetuser'), 'username', $user, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$member = getuserinfo($_GET['id']);
if($_G['group']['allowviewip']) {
$_GET['username'] = $member['username'];
$this->usesubmit();
} else {
$this->_check($member['groupid']);
}
}
}
function _check($groupid) {
if(!checkmagicperm($this->parameters['targetgroups'], $groupid)) {
showmessage(lang('magic/showip', 'showip_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,111 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_stick.php 29373 2012-04-09 07:55:30Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_stick {
var $version = '1.0';
var $name = 'stick_name';
var $description = 'stick_desc';
var $price = '10';
var $weight = '10';
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
global $_G;
$settings = array(
'expiration' => array(
'title' => 'stick_expiration',
'type' => 'text',
'value' => '',
'default' => 24,
),
'fids' => array(
'title' => 'stick_forum',
'type' => 'mselect',
'value' => array(),
),
);
loadcache('forums');
$settings['fids']['value'][] = array(0, '&nbsp;');
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
foreach($_G['cache']['forums'] as $fid => $forum) {
$settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat('&nbsp;', 4) : ($forum['type'] == 'sub' ? str_repeat('&nbsp;', 8) : '')).$forum['name']);
}
$magic['fids'] = explode("\t", $magic['forum']);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
global $_G;
$magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : '';
$magicnew['expiration'] = intval($parameters['expiration']);
}
function usesubmit() {
global $_G;
if(empty($_GET['tid'])) {
showmessage(lang('magic/stick', 'stick_info_nonexistence'));
}
$thread = getpostinfo($_GET['tid'], 'tid', array('fid', 'authorid', 'subject'));
$this->_check($thread['fid']);
magicthreadmod($_GET['tid']);
C::t('forum_thread')->update($_GET['tid'], array('displayorder' => 1, 'moderated' => 1));
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
$expiration = TIMESTAMP + $this->parameters['expiration'] * 3600;
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, 'tid', $_GET['tid']);
updatemagicthreadlog($_GET['tid'], $this->magic['magicid'], $expiration > 0 ? 'EST' : 'STK', $expiration);
if($thread['authorid'] != $_G['uid']) {
notification_add($thread['authorid'], 'magic', lang('magic/stick', 'stick_notification'), array('tid' => $_GET['tid'], 'subject' => $thread['subject'], 'magicname' => $this->magic['name']));
}
showmessage(lang('magic/stick', 'stick_succeed'), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
global $_G;
$tid = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : '';
if($tid) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
$this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24;
magicshowtype('top');
magicshowsetting(lang('magic/stick', 'stick_info', array('expiration' => $this->parameters['expiration'])), 'tid', $tid, 'text');
magicshowtype('bottom');
}
function buy() {
global $_G;
if(!empty($_GET['id'])) {
$thread = getpostinfo($_GET['id'], 'tid', array('fid'));
$this->_check($thread['fid']);
}
}
function _check($fid) {
if(!checkmagicperm($this->parameters['forum'], $fid)) {
showmessage(lang('magic/stick', 'stick_info_noperm'));
}
}
}
?>

View File

@@ -0,0 +1,60 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_thunder.php 27087 2012-01-05 01:49:09Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_thunder {
var $version = '1.0';
var $name = 'thunder_name';
var $description = 'thunder_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
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', 'home.php?mod=space&do=home&view=all', array('magicname'=>$_G['setting']['magics']['thunder']), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true));
}
function show() {
magicshowtips(lang('magic/thunder', 'thunder_info'));
}
}
?>

View File

@@ -0,0 +1,61 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_updateline.php 26749 2011-12-22 07:38:37Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_updateline {
var $version = '1.0';
var $name = 'updateline_name';
var $description = 'updateline_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {}
function setsetting(&$magicnew, &$parameters) {}
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_feed($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 show() {
global $_G;
$id = intval($_GET['id']);
$idtype = $_GET['idtype'];
magic_check_idtype($id, $idtype);
magicshowtips(lang('magic/updateline', 'updateline_info'));
echo '<p><input type="hidden" name="id" value="'.$id.'" /><input type="hidden" name="idtype" value="'.$idtype.'" /></p>';
}
}
?>

View File

@@ -0,0 +1,170 @@
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: magic_visit.php 33714 2013-08-07 01:42:26Z andyzheng $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class magic_visit {
var $version = '1.0';
var $name = 'visit_name';
var $description = 'visit_desc';
var $price = '20';
var $weight = '20';
var $useevent = 0;
var $targetgroupperm = false;
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
var $magic = array();
var $parameters = array();
function getsetting(&$magic) {
$settings = array(
'num' => array(
'title' => 'visit_num',
'type' => 'select',
'value' => array(
array('5', '5'),
array('10', '10'),
array('20', '20'),
),
'default' => '10'
),
);
return $settings;
}
function setsetting(&$magicnew, &$parameters) {
$magicnew['num'] = in_array($parameters['num'], array(5,10,20,50)) ? intval($parameters['num']) : '10';
}
function usesubmit() {
global $_G;
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
$friends = $uids = $fids = array();
$query = C::t('home_friend')->fetch_all_by_uid($_G['uid'], 0, 500);
foreach($query as $value) {
$value['username'] = $value['fusername'];
$value['uid'] = $value['fuid'];
$uids[] = intval($value['fuid']);
$friends[$value['fuid']] = $value;
}
$count = count($uids);
if(!$count) {
showmessage('magicuse_has_no_valid_friend');
} elseif($count == 1) {
$fids = array($uids[0]);
} else {
$keys = array_rand($uids, min($num, $count));
$fids = array();
foreach ($keys as $key) {
$fids[] = $uids[$key];
}
}
$users = array();
foreach($fids as $uid) {
$value = $friends[$uid];
$value['avatar'] = str_replace("'", "\'", avatar($value['uid'], 'small'));
$users[$uid] = $value;
}
$inserts = array();
if($_POST['visitway'] == 'poke') {
$note = '';
$icon = intval($_POST['visitpoke']);
foreach ($fids as $fid) {
$insertdata = array(
'uid' => $fid,
'fromuid' => $_G['uid'],
'fromusername' => $_G['username'],
'note' => $note,
'dateline' => $_G['timestamp'],
'iconid' => $icon
);
C::t('home_poke')->insert($insertdata, false, true);
}
$repokeids = array();
foreach(C::t('home_poke')->fetch_all_by_uid_fromuid($_G['uid'], $fids) as $value) {
$repokeids[] = $value['uid'];
}
$ids = array_diff($fids, $repokeids);
if($ids) {
require_once libfile('function/spacecp');
$pokemsg = makepokeaction($icon);
$pokenote = array(
'fromurl' => 'home.php?mod=space&uid='.$_G['uid'],
'fromusername' => $_G['username'],
'fromuid' => $_G['uid'],
'from_id' => $_G['uid'],
'from_idtype' => 'pokequery',
'pokemsg' => $pokemsg
);
foreach($ids as $puid) {
notification_add($puid, 'poke', 'poke_request', $pokenote);
}
}
} elseif($_POST['visitway'] == 'comment') {
$message = getstr($_POST['visitmsg'], 255);
$ip = $_G['clientip'];
$note_inserts = array();
foreach ($fids as $fid) {
$actor = "<a href=\"home.php?mod=space&uid={$_G['uid']}\">{$_G['username']}</a>";
$inserts[] = array(
'uid' => $fid,
'id' => $fid,
'idtype'=> 'uid',
'authorid' => $_G['uid'],
'author' => $_G['username'],
'ip' => $ip,
'port' => $_G['remoteport'],
'dateline' => $_G['timestamp'],
'message' => $message
);
$note = lang('spacecp', 'magic_note_wall', array('actor' => $actor, 'url'=>"home.php?mod=space&uid=$fid&do=wall"));
$note_inserts[] = array(
'uid' => $fid,
'type' => 'comment',
'new' => 1,
'authorid' => $_G['uid'],
'author' => $_G['username'],
'note' => $note,
'dateline' => $_G['timestamp']
);
}
foreach($inserts as $insert) {
C::t('home_comment')->insert($insert);
}
foreach($note_inserts as $note_insert) {
C::t('home_notification')->insert($note_insert);
}
C::t('common_member')->increase($fids, array('newprompt' => 1));
} else {
foreach ($fids as $fid) {
C::t('home_visitor')->insert(array('uid'=>$fid, 'vuid'=>$_G['uid'], 'vusername'=>$_G['username'], 'dateline'=>$_G['timestamp']), false, true);
}
}
usemagic($this->magic['magicid'], $this->magic['num']);
updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']);
$op = 'show';
include template('home/magic_visit');
}
function show() {
global $_G;
$num = !empty($this->parameters['num']) ? intval($this->parameters['num']) : 10;
magicshowtips(lang('magic/visit', 'visit_info', array('num'=>$num)));
$op = 'use';
include template('home/magic_visit');
}
}
?>