Ejemplo n.º 1
0
 if ($discuz_uid && !empty($uidarray)) {
     sendnotice(implode(',', $uidarray), 'favoritethreads_notice', 'threads', $tid, array('user' => !$isanonymous ? $discuz_userss : '<i>Anonymous</i>', 'maxusers' => 5));
     $db->query("UPDATE {$tablepre}favoritethreads SET newreplies=newreplies+1, dateline='{$timestamp}' WHERE uid IN (" . implodeids($uidarray) . ") AND tid='{$tid}'", 'UNBUFFERED');
 }
 if ($discuz_uid) {
     $stataction = '';
     if ($attentionon) {
         $stataction = 'attentionon';
         $db->query("REPLACE INTO {$tablepre}favoritethreads (tid, uid, dateline) VALUES ('{$tid}', '{$discuz_uid}', '{$timestamp}')", 'UNBUFFERED');
     }
     if ($attentionoff) {
         $stataction = 'attentionoff';
         $db->query("DELETE FROM {$tablepre}favoritethreads WHERE tid='{$tid}' AND uid='{$discuz_uid}'", 'UNBUFFERED');
     }
     if ($stataction) {
         write_statlog('', 'item=attention&action=newreply_' . $stataction, '', '', 'my.php');
     }
 }
 if ($special == 3 && $thread['authorid'] != $discuz_uid && $thread['price'] > 0) {
     $rewardlog = $db->fetch_first("SELECT * FROM {$tablepre}rewardlog WHERE tid='{$tid}' AND answererid='{$discuz_uid}'");
     if (!$rewardlog) {
         $db->query("INSERT INTO {$tablepre}rewardlog (tid, answererid, dateline) VALUES ('{$tid}', '{$discuz_uid}', '{$timestamp}')");
     }
 } elseif ($special == 5) {
     $stand = $firststand ? $firststand : intval($stand);
     if (!$db->num_rows($standquery)) {
         if ($stand == 1) {
             $db->query("UPDATE {$tablepre}debates SET affirmdebaters=affirmdebaters+1 WHERE tid='{$tid}'");
         } elseif ($stand == 2) {
             $db->query("UPDATE {$tablepre}debates SET negadebaters=negadebaters+1 WHERE tid='{$tid}'");
         }
Ejemplo n.º 2
0
         $db->query("UPDATE {$tablepre}threads SET lastposter='" . ($isanonymous ? '' : addslashes($orig['author'])) . "' WHERE tid='{$tid}'", 'UNBUFFERED');
     }
     $attentionon = empty($attention_add) ? 0 : 1;
     $attentionoff = empty($attention_remove) ? 0 : 1;
     if ($discuz_uid) {
         $stataction = '';
         if ($attentionon) {
             $stataction = 'attentionon';
             $db->query("REPLACE INTO {$tablepre}favoritethreads (tid, uid, dateline) VALUES ('{$tid}', '{$discuz_uid}', '{$timestamp}')", 'UNBUFFERED');
         }
         if ($attentionoff) {
             $stataction = 'attentionoff';
             $db->query("DELETE FROM {$tablepre}favoritethreads WHERE tid='{$tid}' AND uid='{$discuz_uid}'", 'UNBUFFERED');
         }
         if ($stataction) {
             write_statlog('', 'item=attention&action=editpost_' . $stataction, '', '', 'my.php');
         }
     }
     if (!$isorigauthor) {
         updatemodworks('EDT', 1);
         require_once DISCUZ_ROOT . './include/misc.func.php';
         modlog($thread, 'EDT');
     }
     if ($thread['special'] == 3 && $isfirstpost && $thread['price'] > 0) {
         $pricediff = $rewardprice - $thread['price'];
         $db->query("UPDATE {$tablepre}members SET extcredits{$creditstransextra['2']}=extcredits{$creditstransextra['2']}-{$pricediff} WHERE uid='{$orig['authorid']}'", 'UNBUFFERED');
     }
 } else {
     if ($isfirstpost && $thread['replies'] > 0) {
         showmessage($thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply', NULL, 'HALTED');
     }
Ejemplo n.º 3
0
 $ordertype && ($thread['status'] = setstatus(4, 1, $thread['status']));
 $hiddenreplies && ($thread['status'] = setstatus(2, 1, $thread['status']));
 if ($allowpostrushreply && $rushreply) {
     $thread['status'] = setstatus(3, 1, $thread['status']);
     $thread['status'] = setstatus(1, 1, $thread['status']);
 }
 $db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, sortid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated, status)\r\n\t\tVALUES ('{$fid}', '{$readperm}', '{$price}', '{$iconid}', '{$typeid}', '{$sortid}', '{$author}', '{$discuz_uid}', '{$subject}', '{$timestamp}', '{$timestamp}', '{$author}', '{$displayorder}', '{$digest}', '{$special}', '0', '{$moderated}', '{$thread['status']}')");
 $tid = $db->insert_id();
 if ($discuz_uid) {
     $stataction = '';
     if ($attentionon) {
         $stataction = 'attentionon';
         $db->query("REPLACE INTO {$tablepre}favoritethreads (tid, uid, dateline) VALUES ('{$tid}', '{$discuz_uid}', '{$timestamp}')", 'UNBUFFERED');
     }
     if ($stataction) {
         write_statlog('', 'item=attention&action=newthread_' . $stataction, '', '', 'my.php');
     }
     $db->query("UPDATE {$tablepre}favoriteforums SET newthreads=newthreads+1 WHERE fid='{$fid}' AND uid<>'{$discuz_uid}'", 'UNBUFFERED');
 }
 if ($special == 3 && $allowpostreward) {
     $db->query("INSERT INTO {$tablepre}rewardlog (tid, authorid, netamount, dateline) VALUES ('{$tid}', '{$discuz_uid}', {$realprice}, '{$timestamp}')");
 }
 if ($moderated) {
     updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG');
     updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1);
 }
 if ($special == 1) {
     $db->query("INSERT INTO {$tablepre}polls (tid, multiple, visible, maxchoices, expiration, overt)\r\n\t\t\tVALUES ('{$tid}', '{$pollarray['multiple']}', '{$pollarray['visible']}', '{$pollarray['maxchoices']}', '{$pollarray['expiration']}', '{$pollarray['overt']}')");
     foreach ($pollarray['options'] as $polloptvalue) {
         $polloptvalue = dhtmlspecialchars(trim($polloptvalue));
         $db->query("INSERT INTO {$tablepre}polloptions (tid, polloption) VALUES ('{$tid}', '{$polloptvalue}')");
Ejemplo n.º 4
0
function task_newbie_complete()
{
    global $db, $tablepre, $discuz_uid, $timestamp, $task, $newbietasks, $newbietaskid, $currenttaskcsc, $nextnewbietaskid, $magicname, $medalname, $grouptitle, $rewards;
    require_once DISCUZ_ROOT . './include/tasks/newbie_' . $newbietasks[$newbietaskid]['scriptname'] . '.inc.php';
    $task = $db->fetch_first("SELECT * FROM {$tablepre}tasks WHERE taskid='{$newbietaskid}' AND available='2'");
    $currenttaskcsc = 0;
    if (task_csc($task) === TRUE) {
        $currenttaskcsc = 100;
        if ($task['reward']) {
            $rewards = task_reward($task);
            if ($task['reward'] == 'magic') {
                $magicname = $db->result_first("SELECT name FROM {$tablepre}magics WHERE magicid='{$task['prize']}'");
            } elseif ($task['reward'] == 'medal') {
                $medalname = $db->result_first("SELECT name FROM {$tablepre}medals WHERE medalid='{$task['prize']}'");
            } elseif ($task['reward'] == 'group') {
                $grouptitle = $db->result_first("SELECT grouptitle FROM {$tablepre}usergroups WHERE groupid='{$task['prize']}'");
            }
            sendnotice($discuz_uid, 'task_reward_' . $task['reward'], 'systempm');
        }
        $db->query("UPDATE {$tablepre}mytasks SET status='1', csc='100', dateline='{$timestamp}' WHERE uid='{$discuz_uid}' AND taskid='{$newbietaskid}'");
        $db->query("UPDATE {$tablepre}tasks SET achievers=achievers+1 WHERE taskid='{$newbietaskid}'", 'UNBUFFERED');
        $nextnewbietaskid = intval($db->result_first("SELECT t.taskid FROM {$tablepre}tasks t LEFT JOIN {$tablepre}mytasks mt ON mt.taskid=t.taskid AND mt.uid='{$discuz_uid}' WHERE mt.taskid IS NULL AND t.available='2' AND t.newbietask='1' ORDER BY t.newbietask DESC LIMIT 1"));
        if ($nextnewbietaskid) {
            $nexttask = $db->fetch_first("SELECT * FROM {$tablepre}tasks WHERE taskid='{$nextnewbietaskid}' AND available='2'");
            $nexttask['newbie'] = 1;
            task_apply($nexttask);
            $db->query("UPDATE {$tablepre}members SET newbietaskid='{$nextnewbietaskid}' WHERE uid='{$discuz_uid}'", 'UNBUFFERED');
        } else {
            $db->query("UPDATE {$tablepre}members SET prompt=prompt^8, newbietaskid='0' WHERE uid='{$discuz_uid}'", 'UNBUFFERED');
        }
        $taskmsg = $newbietasks['task'][$newbietaskid]['scriptname'];
        if (!$nextnewbietaskid) {
            $taskmsg .= '_complete';
        }
        write_statlog('', 'action=newbie&from=' . $taskmsg, '', '', 'task.php');
    }
}
Ejemplo n.º 5
0
					FROM {$tablepre}favorites fav, {$tablepre}threads t, {$tablepre}forums f
					WHERE fav.tid=t.tid AND t.displayorder>='0' AND fav.uid='$discuz_uid' AND t.fid=f.fid $threadadd
					ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp");

				while($fav = $db->fetch_array($query)) {
					$fav['lastposterenc'] = rawurlencode($fav['lastposter']);
					$fav['lastpost'] = dgmdate("$dateformat $timeformat", $fav['lastpost'] + $timeoffset * 3600);
					$favlist[] = $fav;
				}
			}

		} else {

			if($ids = implodeids($delete)) {
				$db->query("DELETE FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid IN ($ids)", 'UNBUFFERED');
				write_statlog('', 'item=favorites&action=deletefav', '', '', 'my.php');
			}
			showmessage('favorite_update_succeed', dreferer());
		}

	}

} elseif($item == 'selltrades' || $item == 'buytrades') {

	require_once DISCUZ_ROOT.'./include/trade.func.php';
	include_once language('misc');

	$sqlfield = $item == 'selltrades' ? 'sellerid' : 'buyerid';
	$sqlfilter = '';
	switch($filter) {
		case 'attention': $typestatus = $item; break;
Ejemplo n.º 6
0
function showmessage($message, $url_forward = '', $extra = '', $forwardtype = 0)
{
    extract($GLOBALS, EXTR_SKIP);
    global $hookscriptmessage, $extrahead, $discuz_uid, $discuz_action, $debuginfo, $seccode, $seccodestatus, $fid, $tid, $charset, $show_message, $inajax, $_DCACHE, $advlist;
    define('CACHE_FORBIDDEN', TRUE);
    $hookscriptmessage = $show_message = $message;
    $messagehandle = 0;
    $msgforward = unserialize($_DCACHE['settings']['msgforward']);
    $refreshtime = intval($msgforward['refreshtime']);
    $refreshtime = empty($forwardtype) ? $refreshtime : ($refreshtime ? $refreshtime : 3);
    $msgforward['refreshtime'] = $refreshtime * 1000;
    $url_forward = empty($url_forward) ? '' : (empty($_DCOOKIE['sid']) && $transsidstatus ? transsid($url_forward) : $url_forward);
    $seccodecheck = $seccodestatus & 2;
    if ($_DCACHE['settings']['funcsiteid'] && $_DCACHE['settings']['funckey'] && $funcstatinfo && !IS_ROBOT) {
        $statlogfile = DISCUZ_ROOT . './forumdata/funcstat.log';
        if ($fp = @fopen($statlogfile, 'a')) {
            @flock($fp, 2);
            if (is_array($funcstatinfo)) {
                $funcstatinfo = array_unique($funcstatinfo);
                foreach ($funcstatinfo as $funcinfo) {
                    fwrite($fp, funcstat_query($funcinfo, $message) . "\n");
                }
            } else {
                fwrite($fp, funcstat_query($funcstatinfo, $message) . "\n");
            }
            fclose($fp);
            $funcstatinfo = $GLOBALS['funcstatinfo'] = '';
        }
    }
    if (!defined('STAT_DISABLED') && STAT_ID > 0 && !IS_ROBOT) {
        write_statlog($message);
    }
    if ($url_forward && (!empty($quickforward) || empty($inajax) && $msgforward['quick'] && $msgforward['messages'] && @in_array($message, $msgforward['messages']))) {
        updatesession();
        dheader("location: " . str_replace('&amp;', '&', $url_forward));
    }
    if (!empty($infloat)) {
        if ($extra) {
            $messagehandle = $extra;
        }
        $extra = '';
    }
    if (in_array($extra, array('HALTED', 'NOPERM'))) {
        $discuz_action = 254;
    } else {
        $discuz_action = 255;
    }
    include language('messages');
    $vars = explode(':', $message);
    if (count($vars) == 2 && isset($scriptlang[$vars[0]][$vars[1]])) {
        eval("\$show_message = \"" . str_replace('"', '\\"', $scriptlang[$vars[0]][$vars[1]]) . "\";");
    } elseif (isset($language[$message])) {
        $pre = $inajax ? 'ajax_' : '';
        eval("\$show_message = \"" . (isset($language[$pre . $message]) ? $language[$pre . $message] : $language[$message]) . "\";");
        unset($pre);
    }
    if (empty($infloat)) {
        $show_message .= $url_forward && empty($inajax) ? '<script>setTimeout("window.location.href =\'' . $url_forward . '\';", ' . $msgforward['refreshtime'] . ');</script>' : '';
    } elseif ($handlekey) {
        $show_message = str_replace("'", "\\'", $show_message);
        if ($url_forward) {
            $show_message = "<script type=\"text/javascript\" reload=\"1\">\nif(\$('return_{$handlekey}')) \$('return_{$handlekey}').className = 'onright';\nif(typeof submithandle_{$handlekey} =='function') {submithandle_{$handlekey}('{$url_forward}', '{$show_message}');} else {location.href='{$url_forward}'}\n</script>";
        } else {
            $show_message .= "<script type=\"text/javascript\" reload=\"1\">\nif(typeof messagehandle_{$handlekey} =='function') {messagehandle_{$handlekey}('{$messagehandle}', '{$show_message}');}\n</script>";
        }
    }
    if ($advlist = array_merge($globaladvs ? $globaladvs['type'] : array(), $redirectadvs ? $redirectadvs['type'] : array())) {
        $advitems = ($globaladvs ? $globaladvs['items'] : array()) + ($redirectadvs ? $redirectadvs['items'] : array());
        foreach ($advlist as $type => $redirectadvs) {
            $advlist[$type] = $advitems[$redirectadvs[array_rand($redirectadvs)]];
        }
    }
    if ($extra == 'NOPERM') {
        include template('nopermission');
    } else {
        include template('showmessage');
    }
    dexit();
}
Ejemplo n.º 7
0
					} elseif($simple == 1 && $type != 'image' && $isimage) {
						$isimage = -1;
					} elseif($simple == 2 && $type == 'image' && !$isimage) {
						dunlink($attach['attachment'], $attach['thumb'], $attach['remote']);
						echo "DISCUZUPLOAD|1|4|0|0|";
						exit;
					}
					$db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote, width)
						VALUES ('0', '0', '$timestamp', '0', '0', '$attach[name]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$isimage', '$uid', '$attach[thumb]', '$attach[remote]', '$attach[width]')");
					$aid = $db->insert_id();
					$statusid = 0;
					$uploadtag = 'upload';
					if(!$attachid) {
						$uploadtag = 'swfupload';
					}
					write_statlog('', 'action='.$uploadtag, '', '', 'forumstat.php');
				} else {
					$statusid = $attachments;
				}
			} else {
				$statusid = 9;
			}
		} else {
			$statusid = 10;
		}
		if($simple == 1) {
			echo "DISCUZUPLOAD|$statusid|$aid|$isimage";
		} elseif($simple == 2) {
			echo "DISCUZUPLOAD|".($type == 'image' ? '1' : '0')."|$statusid|$aid|$isimage|$attach[attachment]";
		} else {
			echo $aid;