First commit
This commit is contained in:
1
source/class/task/index.htm
Normal file
1
source/class/task/index.htm
Normal file
@@ -0,0 +1 @@
|
||||
|
41
source/class/task/task_avatar.php
Normal file
41
source/class/task/task_avatar.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_avatar.php 16433 2010-09-07 00:04:33Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_avatar {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'avatar_name';
|
||||
var $description = 'avatar_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if(!empty($_G['member']['avatarstatus'])) {
|
||||
return true;
|
||||
} else {
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/avatar', 'avatar_view');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
40
source/class/task/task_blog.php
Normal file
40
source/class/task/task_blog.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_blog.php 24741 2011-10-10 03:41:51Z chenmengshu $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_blog {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'blog_name';
|
||||
var $description = 'blog_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if(C::t('home_blog')->count_by_uid($_G['uid'])) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/blog', 'blog_view');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
40
source/class/task/task_connect_bind.php
Normal file
40
source/class/task/task_connect_bind.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_connect_bind.php 22196 2011-04-26 02:02:52Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_connect_bind {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'connect_bind_name';
|
||||
var $description = 'connect_bind_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if($_G['member']['conisbind']) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/connect_bind', 'connect_bind_view');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
40
source/class/task/task_email.php
Normal file
40
source/class/task/task_email.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_email.php 6752 2010-03-25 08:47:54Z cnteacher $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_email {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'email_name';
|
||||
var $description = 'email_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if($_G['member']['emailstatus']) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/email', 'email_view');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
40
source/class/task/task_friend.php
Normal file
40
source/class/task/task_friend.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_friend.php 6752 2010-03-25 08:47:54Z cnteacher $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_friend {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'friend_name';
|
||||
var $description = 'friend_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if(getuserprofile('friends') >= 5) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/friend', 'friend_view');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
36
source/class/task/task_gift.php
Normal file
36
source/class/task/task_gift.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_gift.php 6752 2010-03-25 08:47:54Z cnteacher $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_gift {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'gift_name';
|
||||
var $description = 'gift_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function preprocess($task) {
|
||||
dheader("Location: home.php?mod=task&do=draw&id={$task['taskid']}");
|
||||
}
|
||||
|
||||
function csc($task = array()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
113
source/class/task/task_member.php
Normal file
113
source/class/task/task_member.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_member.php 26595 2011-12-16 03:50:07Z svn_project_zhangjie $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_member {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'member_name';
|
||||
var $description = 'member_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array(
|
||||
'act' => array(
|
||||
'title' => 'member_complete_var_act',
|
||||
'type' => 'mradio',
|
||||
'value' => array(
|
||||
array('favorite', 'member_complete_var_act_favorite'),
|
||||
array('magic', 'member_complete_var_act_magic'),
|
||||
),
|
||||
'default' => 'favorite',
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'num' => array(
|
||||
'title' => 'member_complete_var_num',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'time' => array(
|
||||
'title' => 'member_complete_var_time',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'sort' => 'complete',
|
||||
)
|
||||
);
|
||||
|
||||
function preprocess($task) {
|
||||
global $_G;
|
||||
|
||||
$act = C::t('common_taskvar')->get_value_by_taskid($task['taskid'], 'act');
|
||||
if($act == 'favorite') {
|
||||
$value = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], 'tid');
|
||||
C::t('forum_spacecache')->insert(array(
|
||||
'uid' => $_G['uid'],
|
||||
'variable' => 'favorite'.$task['taskid'],
|
||||
'value' => $value,
|
||||
'expiration' => $_G['timestamp'],
|
||||
), false, true);
|
||||
}
|
||||
}
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
$taskvars = array('num' => 0);
|
||||
$num = 0;
|
||||
foreach(C::t('common_taskvar')->fetch_all_by_taskid($task['taskid']) as $taskvar) {
|
||||
if($taskvar['value']) {
|
||||
$taskvars[$taskvar['variable']] = $taskvar['value'];
|
||||
}
|
||||
}
|
||||
|
||||
$taskvars['time'] = floatval($taskvars['time']);
|
||||
if($taskvars['act'] == 'favorite') {
|
||||
$favorite = C::t('forum_spacecache')->fetch_spacecache($_G['uid'], 'favorite'.$task['taskid']);
|
||||
$favorite = $favorite['value'];
|
||||
$num = C::t('home_favorite')->count_by_uid_idtype($_G['uid'], 'tid') - $favorite;
|
||||
} elseif($taskvars['act'] == 'magic') {
|
||||
$maxtime = $taskvars['time'] ? $task['applytime']+3600*$taskvars['time'] : 0;
|
||||
$num = C::t('common_magiclog')->count_by_action_uid_dateline(2, $_G['uid'], $task['applytime'], $maxtime);
|
||||
}
|
||||
|
||||
if($num && $num >= $taskvars['num']) {
|
||||
if($taskvars['act'] == 'favorite') {
|
||||
C::t('forum_spacecache')->delete_spacecache($_G['uid'], $taskvars['act'].$task['taskid']);
|
||||
}
|
||||
return TRUE;
|
||||
} elseif($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
|
||||
}
|
||||
}
|
||||
|
||||
function view($task, $taskvars) {
|
||||
$return = lang('task/member', 'task_complete_time_start');
|
||||
if($taskvars['complete']['time']) {
|
||||
$return .= lang('task/member', 'task_complete_time_limit', array('value' => $taskvars['complete']['time']['value']));
|
||||
}
|
||||
$taskvars['complete']['num']['value'] = intval($taskvars['complete']['num']['value']);
|
||||
if($taskvars['complete']['act']['value'] == 'favorite') {
|
||||
$return .= lang('task/member', 'task_complete_act_favorite', array('value' => $taskvars['complete']['num']['value']));
|
||||
} else {
|
||||
$return .= lang('task/member', 'task_complete_act_magic', array('value' => $taskvars['complete']['num']['value']));
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
159
source/class/task/task_post.php
Normal file
159
source/class/task/task_post.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_post.php 26754 2011-12-22 08:14:22Z zhengqingpeng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_post {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'post_name';
|
||||
var $description = 'post_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array(
|
||||
'act' => array(
|
||||
'title' => 'post_complete_var_act',
|
||||
'type' => 'mradio',
|
||||
'value' => array(
|
||||
array('newthread', 'post_complete_var_act_newthread'),
|
||||
array('newreply', 'post_complete_var_act_newreply'),
|
||||
array('newpost', 'post_complete_var_act_newpost'),
|
||||
),
|
||||
'default' => 'newthread',
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'forumid' => array(
|
||||
'title' => 'post_complate_var_forumid',
|
||||
'type' => 'select',
|
||||
'value' => array(),
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'threadid' => array(
|
||||
'title' => 'post_complate_var_threadid',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'num' => array(
|
||||
'title' => 'post_complete_var_num',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'sort' => 'complete',
|
||||
),
|
||||
'time' => array(
|
||||
'title' => 'post_complete_var_time',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'sort' => 'complete',
|
||||
)
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
global $_G;
|
||||
loadcache('forums');
|
||||
$this->conditions['forumid']['value'][] = array(0, ' ');
|
||||
if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array();
|
||||
foreach($_G['cache']['forums'] as $fid => $forum) {
|
||||
$this->conditions['forumid']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat(' ', 4) : ($forum['type'] == 'sub' ? str_repeat(' ', 8) : '')).$forum['name'], $forum['type'] == 'group' ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
$taskvars = array('num' => 0);
|
||||
foreach(C::t('common_taskvar')->fetch_all_by_taskid($task['taskid']) as $taskvar) {
|
||||
if($taskvar['value']) {
|
||||
$taskvars[$taskvar['variable']] = $taskvar['value'];
|
||||
}
|
||||
}
|
||||
$taskvars['num'] = $taskvars['num'] ? $taskvars['num'] : 1;
|
||||
|
||||
$tbladd = $sqladd = '';
|
||||
if($taskvars['act'] == 'newreply' && $taskvars['threadid']) {
|
||||
$threadid = $taskvars['threadid'];
|
||||
} else {
|
||||
if($taskvars['forumid']) {
|
||||
$forumid = $taskvars['forumid'];
|
||||
}
|
||||
if($taskvars['author']) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if($taskvars['act']) {
|
||||
if($taskvars['act'] == 'newthread') {
|
||||
$first = '1';
|
||||
} elseif($taskvars['act'] == 'newreply') {
|
||||
$first = '0';
|
||||
}
|
||||
}
|
||||
|
||||
$starttime = $task['applytime'];
|
||||
if($taskvars['time'] = floatval($taskvars['time'])) {
|
||||
$endtime = $task['applytime'] + 3600 * $taskvars['time'];
|
||||
}
|
||||
|
||||
$num = C::t('forum_post')->count_by_search(0, $threadid, null, 0, $forumid, $_G['uid'], null, $starttime, $endtime, null, $first);
|
||||
|
||||
if($num && $num >= $taskvars['num']) {
|
||||
return TRUE;
|
||||
} elseif($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
|
||||
return FALSE;
|
||||
} else {
|
||||
return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
|
||||
}
|
||||
}
|
||||
|
||||
function view($task, $taskvars) {
|
||||
global $_G;
|
||||
$return = $value = '';
|
||||
if(!empty($taskvars['complete']['forumid'])) {
|
||||
$value = intval($taskvars['complete']['forumid']['value']);
|
||||
loadcache('forums');
|
||||
$value = '<a href="forum.php?mod=forumdisplay&fid='.$value.'"><strong>'.$_G['cache']['forums'][$value]['name'].'</strong></a>';
|
||||
} elseif(!empty($taskvars['complete']['threadid'])) {
|
||||
$value = intval($taskvars['complete']['threadid']['value']);
|
||||
$thread = C::t('forum_thread')->fetch_thread($value);
|
||||
$value = '<a href="forum.php?mod=viewthread&tid='.$value.'"><strong>'.($thread['subject'] ? $thread['subject'] : 'TID '.$value).'</strong></a>';
|
||||
} elseif(!empty($taskvars['complete']['author'])) {
|
||||
$value = $taskvars['complete']['author']['value'];
|
||||
$authorid = C::t('common_member')->fetch_uid_by_username($value);
|
||||
$value = '<a href="home.php?mod=space&uid='.$authorid.'"><strong>'.$value.'</strong></a>';
|
||||
}
|
||||
$taskvars['complete']['num']['value'] = intval($taskvars['complete']['num']['value']);
|
||||
$taskvars['complete']['num']['value'] = $taskvars['complete']['num']['value'] ? $taskvars['complete']['num']['value'] : 1;
|
||||
if($taskvars['complete']['act']['value'] == 'newreply') {
|
||||
if($taskvars['complete']['threadid']) {
|
||||
$return .= lang('task/post', 'task_complete_act_newreply_thread', array('value' => $value, 'num' => $taskvars['complete']['num']['value']));
|
||||
} else {
|
||||
$return .= lang('task/post', 'task_complete_act_newreply_author', array('value' => $value, 'num' => $taskvars['complete']['num']['value']));
|
||||
}
|
||||
} else {
|
||||
if($taskvars['complete']['forumid']) {
|
||||
$return .= lang('task/post', 'task_complete_forumid', array('value' => $value));
|
||||
}
|
||||
if($taskvars['complete']['act']['value'] == 'newthread') {
|
||||
$return .= lang('task/post', 'task_complete_act_newthread', array('num' => $taskvars['complete']['num']['value']));
|
||||
} else {
|
||||
$return .= lang('task/post', 'task_complete_act_newpost', array('num' => $taskvars['complete']['num']['value']));
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
function sufprocess($task) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
69
source/class/task/task_profile.php
Normal file
69
source/class/task/task_profile.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_profile.php 24704 2011-10-08 10:19:11Z zhangguosheng $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_profile {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'profile_name';
|
||||
var $description = 'profile_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
$data = $this->checkfield();
|
||||
if(!$data[0]) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => $data[1], 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
$data = $this->checkfield();
|
||||
return lang('task/profile', 'profile_view', array('profiles' => implode(', ', $data[0])));
|
||||
}
|
||||
|
||||
function checkfield() {
|
||||
global $_G;
|
||||
|
||||
$fields = array('realname', 'gender', 'birthyear', 'birthmonth', 'birthday', 'bloodtype', 'affectivestatus', 'birthcountry', 'birthprovince', 'birthcity', 'residecountry', 'resideprovince', 'residecity');
|
||||
loadcache('profilesetting');
|
||||
$fieldsnew = array();
|
||||
foreach($fields as $v) {
|
||||
if(isset($_G['cache']['profilesetting'][$v])) {
|
||||
$fieldsnew[$v] = $_G['cache']['profilesetting'][$v]['title'];
|
||||
}
|
||||
}
|
||||
if($fieldsnew) {
|
||||
space_merge($_G['member'], 'profile');
|
||||
$none = array();
|
||||
foreach($_G['member'] as $k => $v) {
|
||||
if(in_array($k, $fields, true) && !trim($v) && !empty($fieldsnew[$k])) {
|
||||
$none[] = $fieldsnew[$k];
|
||||
}
|
||||
}
|
||||
$all = count($fields);
|
||||
$csc = intval(($all - count($none)) / $all * 100);
|
||||
return array($none, $csc);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
67
source/class/task/task_promotion.php
Normal file
67
source/class/task/task_promotion.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: task_promotion.php 24735 2011-10-10 02:45:39Z svn_project_zhangjie $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_promotion {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'promotion_name';
|
||||
var $description = 'promotion_desc';
|
||||
var $copyright = '<a href="https://www.discuz.vip/" target="_blank">Discuz!</a>';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array(
|
||||
'num' => array(
|
||||
'title' => 'promotion_complete_var_iplimit',
|
||||
'type' => 'text',
|
||||
'value' => '',
|
||||
'default' => 100,
|
||||
'sort' => 'complete',
|
||||
),
|
||||
);
|
||||
|
||||
function preprocess($task) {
|
||||
global $_G;
|
||||
|
||||
$promotions = C::t('forum_promotion')->count_by_uid($_G['uid']);
|
||||
C::t('forum_spacecache')->insert(array(
|
||||
'uid' => $_G['uid'],
|
||||
'variable' => 'promotion'.$task['taskid'],
|
||||
'value' => $promotions,
|
||||
'expiration' => $_G['timestamp'],
|
||||
), false, true);
|
||||
}
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
$promotion = C::t('forum_spacecache')->fetch_spacecache($_G['uid'], 'promotion'.$task['taskid']);
|
||||
$promotion = $promotion['value'];
|
||||
$num = C::t('forum_promotion')->count_by_uid($_G['uid']) - $promotion;
|
||||
$numlimit = C::t('common_taskvar')->get_value_by_taskid($task['taskid'], 'num');
|
||||
if($num && $num >= $numlimit) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return array('csc' => $num > 0 && $numlimit ? sprintf("%01.2f", $num / $numlimit * 100) : 0, 'remaintime' => 0);
|
||||
}
|
||||
}
|
||||
|
||||
function sufprocess($task) {
|
||||
global $_G;
|
||||
|
||||
C::t('forum_spacecache')->delete_spacecache($_G['uid'], 'promotion'.$task['taskid']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
38
source/class/task/task_secmobile.php
Normal file
38
source/class/task/task_secmobile.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
class task_secmobile {
|
||||
|
||||
var $version = '1.0';
|
||||
var $name = 'secmobile_name';
|
||||
var $description = 'secmobile_desc';
|
||||
var $copyright = 'Discuz! X Community Team';
|
||||
var $icon = '';
|
||||
var $period = '';
|
||||
var $periodtype = 0;
|
||||
var $conditions = array();
|
||||
|
||||
function csc($task = array()) {
|
||||
global $_G;
|
||||
|
||||
if($_G['member']['secmobilestatus']) {
|
||||
return true;
|
||||
}
|
||||
return array('csc' => 0, 'remaintime' => 0);
|
||||
}
|
||||
|
||||
function view() {
|
||||
return lang('task/secmobile', 'secmobile_view');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user