code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: cleanup_daily.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $db->query("UPDATE {$tablepre}advertisements SET available='0' WHERE endtime>'0' AND endtime<='$timestamp'", 'UNBUFFERED'); if($db->affected_rows()) { require_once DISCUZ_ROOT.'./include/cache.func.php'; updatecache(array('settings', 'advs_archiver', 'advs_register', 'advs_index', 'advs_forumdisplay', 'advs_viewthread')); } $db->query("TRUNCATE {$tablepre}searchindex"); $db->query("DELETE FROM {$tablepre}threadsmod WHERE dateline<'$timestamp'-31536000", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}subscriptions WHERE lastpost<'$timestamp'-7776000", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}forumrecommend WHERE expiration<'$timestamp'", 'UNBUFFERED'); if($qihoo['status'] && $qihoo['relatedthreads']) { $db->query("DELETE FROM {$tablepre}relatedthreads WHERE expiration<'$timestamp'", 'UNBUFFERED'); } $db->query("UPDATE {$tablepre}trades SET closed='1' WHERE expiration<>0 AND expiration<'$timestamp'", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}tradelog WHERE status=0 AND lastupdate<'".($timestamp - 5 * 86400)."'", 'UNBUFFERED'); if($cachethreadon) { removedir($cachethreaddir, TRUE); } if($regstatus > 1) { $db->query("UPDATE {$tablepre}invites SET status='4' WHERE expiration<'$timestamp' AND status IN ('1', '3')"); } function removedir($dirname, $keepdir = FALSE) { $dirname = wipespecial($dirname); if(!is_dir($dirname)) { return FALSE; } $handle = opendir($dirname); while(($file = readdir($handle)) !== FALSE) { if($file != '.' && $file != '..') { $dir = $dirname . DIRECTORY_SEPARATOR . $file; is_dir($dir) ? removedir($dir) : unlink($dir); } } closedir($handle); return !$keepdir ? (@rmdir($dirname) ? TRUE : FALSE) : TRUE; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/crons/cleanup_daily.inc.php
PHP
asf20
1,986
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: medals_daily.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $medalnewarray = array(); $query = $db->query("SELECT me.id, me.uid, me.medalid, me.expiration, mf.medals FROM {$tablepre}medallog me LEFT JOIN {$tablepre}memberfields mf USING (uid) WHERE me.status=1 AND me.expiration<$timestamp"); while($medalnew = $db->fetch_array($query)) { $medalsnew = array(); $medalnew['medals'] = empty($medalnewarray[$medalnew['uid']]) ? explode("\t", $medalnew['medals']) : explode("\t", $medalnewarray[$medalnew['uid']]); foreach($medalnew['medals'] as $key => $medalnewid) { list($medalid, $medalexpiration) = explode("|", $medalnewid); if($medalnew['medalid'] == $medalid) { unset($medalnew['medals'][$key]); } } $medalnewarray[$medalnew['uid']] = implode("\t", $medalnew['medals']); $db->query("UPDATE {$tablepre}medallog SET status='0' WHERE id='".$medalnew['id']."'"); $db->query("UPDATE {$tablepre}memberfields SET medals='".$medalnewarray[$medalnew['uid']]."' WHERE uid='".$medalnew['uid']."'"); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/crons/medals_daily.inc.php
PHP
asf20
1,237
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: secqaa_daily.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($secqaa['status'] > 0) { require_once DISCUZ_ROOT.'./include/cache.func.php'; updatecache('secqaa'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/crons/secqaa_daily.inc.php
PHP
asf20
359
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: threadexpiries_hourly.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $actionarray = array(); $query = $db->query("SELECT * FROM {$tablepre}threadsmod WHERE expiration>'0' AND expiration<'$timestamp' AND status='1'"); while($expiry = $db->fetch_array($query)) { $threads[] = $expiry; switch($expiry['action']) { case 'EST': $actionarray['UES'][] = $expiry['tid']; break; case 'EHL': $actionarray['UEH'][] = $expiry['tid']; break; case 'ECL': $actionarray['UEC'][] = $expiry['tid']; break; case 'EOP': $actionarray['UEO'][] = $expiry['tid']; break; case 'EDI': $actionarray['UED'][] = $expiry['tid']; break; case 'TOK': $actionarray['UES'][] = $expiry['tid']; break; case 'CCK': $actionarray['UEH'][] = $expiry['tid']; break; case 'CLK': $actionarray['UEC'][] = $expiry['tid']; break; } } if($actionarray) { foreach($actionarray as $action => $tids) { $tids = implode(',', $tids); switch($action) { case 'UES': $db->query("UPDATE {$tablepre}threads SET displayorder='0' WHERE tid IN ($tids)", 'UNBUFFERED'); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($tids) AND action IN ('EST', 'TOK')", 'UNBUFFERED'); require_once DISCUZ_ROOT.'./include/cache.func.php'; updatecache('globalstick'); break; case 'UEH': $db->query("UPDATE {$tablepre}threads SET highlight='0' WHERE tid IN ($tids)", 'UNBUFFERED'); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($tids) AND action IN ('EHL', 'CCK')", 'UNBUFFERED'); break; case 'UEC': case 'UEO': $closed = $action == 'UEO' ? 1 : 0; $db->query("UPDATE {$tablepre}threads SET closed='$closed' WHERE tid IN ($tids)", 'UNBUFFERED'); $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($tids) AND action IN ('EOP', 'ECL', 'CLK')", 'UNBUFFERED'); break; case 'UED': $db->query("UPDATE {$tablepre}threadsmod SET status='0' WHERE tid IN ($tids) AND action='EDI'", 'UNBUFFERED'); $digestarray = $authoridarry = array(); $query = $db->query("SELECT authorid, digest FROM {$tablepre}threads WHERE tid IN ($tids)"); while($digest = $db->fetch_array($query)) { $authoridarry[] = $digest['authorid']; $digestarray[$digest['digest']][] = $digest['authorid']; } $db->query("UPDATE {$tablepre}members SET digestposts=digestposts-1 WHERE uid IN (".implode(',', $authoridarry).")", 'UNBUFFERED'); foreach($digestarray as $digest => $authorids) { updatecredits(implode('\',\'', $authorids), $creditspolicy['digest'], 0 - $digest); } $db->query("UPDATE {$tablepre}threads SET digest='0' WHERE tid IN ($tids)", 'UNBUFFERED'); break; } } require_once DISCUZ_ROOT.'./include/post.func.php'; foreach($actionarray as $action => $tids) { updatemodlog(implode(',', $tids), $action, 0, 1); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/crons/threadexpiries_hourly.inc.php
PHP
asf20
3,085
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: diff.class.php 16698 2008-11-14 07:58:56Z cnteacher $ */ class Diff { var $table = array(); var $left = array(); var $right = array(); var $left_len = 0; var $right_len = 0; function Diff($left, $right) { $this->left = preg_split('/(\r\n|\n|\r)/', $left); $this->right = preg_split('/(\r\n|\n|\r)/', $right); $this->left_len = count($this->left); $this->right_len = count($this->right); } function getrow($row) { $return = array(); $i = -1; foreach(explode('|', $row) AS $value) { $return[$i] = $value; $i++; } return $return; } function &fetch_diff() { $prev_row = array(); for($i = -1; $i < $this->right_len; $i++) { $prev_row[$i] = 0; } for($i = 0; $i < $this->left_len; $i++) { $this_row = array('-1' => 0); $data_left_value = $this->left[$i]; for($j = 0; $j < $this->right_len; $j++) { if($data_left_value == $this->right[$j]) { $this_row[$j] = $prev_row[$j - 1] + 1; } elseif($this_row[$j - 1] > $prev_row[$j]) { $this_row[$j] = $this_row[$j - 1]; } else { $this_row[$j] = $prev_row[$j]; } } $this->table[$i - 1] = implode('|', $prev_row); $prev_row = $this_row; } unset($prev_row); $this->table[$this->left_len - 1] = implode('|', $this_row); $table = &$this->table; $output = $match = $nonmatch1 = $nonmatch2 = array(); $data_left_key = $this->left_len - 1; $data_right_key = $this->right_len - 1; $this_row = $this->getrow($table[$data_left_key]); $above_row = $this->getrow($table[$data_left_key - 1]); while($data_left_key >= 0 AND $data_right_key >= 0) { if($this_row[$data_right_key] != $above_row[$data_right_key - 1] AND $this->left[$data_left_key] == $this->right[$data_right_key]) { $this->nonmatches($output, $nonmatch1, $nonmatch2); array_unshift($match, $this->left[$data_left_key]); $data_left_key--; $data_right_key--; $this_row = $above_row; $above_row = $this->getrow($table[$data_left_key - 1]); } elseif($above_row[$data_right_key] > $this_row[$data_right_key - 1]) { $this->matches($output, $match); array_unshift($nonmatch1, $this->left[$data_left_key]); $data_left_key--; $this_row = $above_row; $above_row = $this->getrow($table[$data_left_key - 1]); } else { $this->matches($output, $match); array_unshift($nonmatch2, $this->right[$data_right_key]); $data_right_key--; } } $this->matches($output, $match); if($data_left_key > -1 OR $data_right_key > -1) { for(; $data_left_key > -1; $data_left_key--) { array_unshift($nonmatch1, $this->left[$data_left_key]); } for(; $data_right_key > -1; $data_right_key--) { array_unshift($nonmatch2, $this->right[$data_right_key]); } $this->nonmatches($output, $nonmatch1, $nonmatch2); } return $output; } function matches(&$output, &$match) { if(count($match) > 0) { $data = implode("\n", $match); array_unshift($output, new Diff_Entry($data, $data)); } $match = array(); } function nonmatches(&$output, &$text_left, &$text_right) { $s1 = count($text_left); $s2 = count($text_right); if($s1 > 0 AND $s2 == 0) { array_unshift($output, new Diff_Entry(implode("\n", $text_left), '')); } elseif($s2 > 0 AND $s1 == 0) { array_unshift($output, new Diff_Entry('', implode("\n", $text_right))); } elseif($s1 > 0 AND $s2 > 0) { array_unshift($output, new Diff_Entry(implode("\n", $text_left), implode("\n", $text_right))); } $text_left = $text_right = array(); } } class Diff_Entry { var $left = ''; var $right = ''; function Diff_Entry($data_left, $data_right) { $this->left = $data_left; $this->right = $data_right; } function left_class() { if($this->left == $this->right) { return 'unchanged'; } elseif($this->left AND empty($this->right)) { return 'deleted'; } elseif(trim($this->left) === '') { return 'notext'; } else { return 'changed'; } } function right_class() { if($this->left == $this->right) { return 'unchanged'; } elseif($this->right AND empty($this->left)) { return 'added'; } elseif(trim($this->right) === '') { return 'notext'; } else { return 'changed'; } } function diff_text($string, $wrap = true) { if(trim($string) === '') { return '&nbsp;'; } else { return $wrap ? '<code>'.str_replace(array(' ', "\t"), array('&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'), nl2br(htmlspecialchars($string))).'</code>' : '<pre style="display:inline">'.htmlspecialchars($string).'</pre>'; } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/diff.class.php
PHP
asf20
4,771
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: sendmail.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $mail = unserialize($mail); $errorlog = $action != 'mailcheck' ? 'errorlog' : 'checkmailerror'; @include language('emails'); if($mail['sendmail_silent']) { error_reporting(0); } if(isset($language[$email_subject])) { eval("\$email_subject = \"".$language[$email_subject]."\";"); } if(isset($language[$email_message])) { eval("\$email_message = \"".$language[$email_message]."\";"); } $maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n"); $mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1; $email_subject = '=?'.$charset.'?B?'.base64_encode(str_replace("\r", '', str_replace("\n", '', '['.$bbname.'] '.$email_subject))).'?='; $email_message = chunk_split(base64_encode(str_replace("\r\n.", " \r\n..", str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $email_message))))))); $email_from = $email_from == '' ? '=?'.$charset.'?B?'.base64_encode($bbname)."?= <$adminemail>" : (preg_match('/^(.+?) \<(.+?)\>$/',$email_from, $from) ? '=?'.$charset.'?B?'.base64_encode($from[1])."?= <$from[2]>" : $email_from); foreach(explode(',', $email_to) as $touser) { $tousers[] = preg_match('/^(.+?) \<(.+?)\>$/',$touser, $to) ? ($mailusername ? '=?'.$charset.'?B?'.base64_encode($to[1])."?= <$to[2]>" : $to[2]) : $touser; } $email_to = implode(',', $tousers); $headers = "From: $email_from{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: Discuz! $version{$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/plain; charset=$charset{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}"; $mail['port'] = $mail['port'] ? $mail['port'] : 25; if($mail['mailsend'] == 1 && function_exists('mail')) { @mail($email_to, $email_subject, $email_message, $headers); } elseif($mail['mailsend'] == 2) { if(!$fp = fsockopen($mail['server'], $mail['port'], $errno, $errstr, 30)) { $errorlog('SMTP', "($mail[server]:$mail[port]) CONNECT - Unable to connect to the SMTP server", 0); } stream_set_blocking($fp, true); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != '220') { $errorlog('SMTP', "$mail[server]:$mail[port] CONNECT - $lastmessage", 0); } fputs($fp, ($mail['auth'] ? 'EHLO' : 'HELO')." discuz\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) { $errorlog('SMTP', "($mail[server]:$mail[port]) HELO/EHLO - $lastmessage", 0); } while(1) { if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) { break; } $lastmessage = fgets($fp, 512); } if($mail['auth']) { fputs($fp, "AUTH LOGIN\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { $errorlog('SMTP', "($mail[server]:$mail[port]) AUTH LOGIN - $lastmessage", 0); } fputs($fp, base64_encode($mail['auth_username'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { $errorlog('SMTP', "($mail[server]:$mail[port]) USERNAME - $lastmessage", 0); } fputs($fp, base64_encode($mail['auth_password'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 235) { $errorlog('SMTP', "($mail[server]:$mail[port]) PASSWORD - $lastmessage", 0); } $email_from = $mail['from']; } fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { $errorlog('SMTP', "($mail[server]:$mail[port]) MAIL FROM - $lastmessage", 0); } } $email_tos = array(); foreach(explode(',', $email_to) as $touser) { $touser = trim($touser); if($touser) { fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n"); $lastmessage = fgets($fp, 512); $errorlog('SMTP', "($mail[server]:$mail[port]) RCPT TO - $lastmessage", 0); } } } fputs($fp, "DATA\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 354) { $errorlog('SMTP', "($mail[server]:$mail[port]) DATA - $lastmessage", 0); } $headers .= 'Message-ID: <'.gmdate('YmdHs').'.'.substr(md5($email_message.microtime()), 0, 6).rand(100000, 999999).'@'.$_SERVER['HTTP_HOST'].">{$maildelimiter}"; fputs($fp, "Date: ".gmdate('r')."\r\n"); fputs($fp, "To: ".$email_to."\r\n"); fputs($fp, "Subject: ".$email_subject."\r\n"); fputs($fp, $headers."\r\n"); fputs($fp, "\r\n\r\n"); fputs($fp, "$email_message\r\n.\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { $errorlog('SMTP', "($mail[server]:$mail[port]) END - $lastmessage", 0); } fputs($fp, "QUIT\r\n"); } elseif($mail['mailsend'] == 3) { ini_set('SMTP', $mail['server']); ini_set('smtp_port', $mail['port']); ini_set('sendmail_from', $email_from); @mail($email_to, $email_subject, $email_message, $headers); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/sendmail.inc.php
PHP
asf20
5,549
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: security.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($attackevasive & 1 || $attackevasive & 4) { $_DCOOKIE['lastrequest'] = authcode($_DCOOKIE['lastrequest'], 'DECODE'); dsetcookie('lastrequest', authcode($timestamp, 'ENCODE'), $timestamp + 816400, 1, true); } if($attackevasive & 1) { if($timestamp - $_DCOOKIE['lastrequest'] < 1) { securitymessage('attachsave_1_subject', 'attachsave_1_message'); } } if(($attackevasive & 2) && ($_SERVER['HTTP_X_FORWARDED_FOR'] || $_SERVER['HTTP_VIA'] || $_SERVER['HTTP_PROXY_CONNECTION'] || $_SERVER['HTTP_USER_AGENT_VIA'] || $_SERVER['HTTP_CACHE_INFO'] || $_SERVER['HTTP_PROXY_CONNECTION'])) { securitymessage('attachsave_2_subject', 'attachsave_2_message', FALSE); } if($attackevasive & 4) { if(empty($_DCOOKIE['lastrequest']) || $timestamp - $_DCOOKIE['lastrequest'] > 300) { securitymessage('attachsave_4_subject', 'attachsave_4_message'); } } if($attackevasive & 8) { list($questionkey, $questionanswer, $questiontime) = explode('|', authcode($_DCOOKIE['secqcode'], 'DECODE')); include_once DISCUZ_ROOT.'./forumdata/cache/cache_secqaa.php'; if(!$questionanswer || !$questiontime || $_DCACHE['secqaa'][$questionkey]['answer'] != $questionanswer) { if(empty($_POST['secqsubmit']) || (!empty($_POST['secqsubmit']) && $_DCACHE['secqaa'][$questionkey]['answer'] != md5($_POST['answer']))) { $questionkey = array_rand($_DCACHE['secqaa']); dsetcookie('secqcode', authcode($questionkey.'||'.$timestamp, 'ENCODE'), $timestamp + 816400, 1, true); securitymessage($_DCACHE['secqaa'][$questionkey]['question'], '<input type="text" name="answer" size="8" maxlength="150" /><input class="button" type="submit" name="secqsubmit" value=" Submit " />', FALSE, TRUE); } else { dsetcookie('secqcode', authcode($questionkey.'|'.$_DCACHE['secqaa'][$questionkey]['answer'].'|'.$timestamp, 'ENCODE'), $timestamp + 816400, 1, true); } } } function securitymessage($subject, $message, $reload = TRUE, $form = FALSE) { $scuritylang = array( 'attachsave_1_subject' => '&#x9891;&#x7e41;&#x5237;&#x65b0;&#x9650;&#x5236;', 'attachsave_1_message' => '&#x60a8;&#x8bbf;&#x95ee;&#x672c;&#x7ad9;&#x901f;&#x5ea6;&#x8fc7;&#x5feb;&#x6216;&#x8005;&#x5237;&#x65b0;&#x95f4;&#x9694;&#x65f6;&#x95f4;&#x5c0f;&#x4e8e;&#x4e24;&#x79d2;&#xff01;&#x8bf7;&#x7b49;&#x5f85;&#x9875;&#x9762;&#x81ea;&#x52a8;&#x8df3;&#x8f6c;&#x20;&#x2e;&#x2e;&#x2e;', 'attachsave_2_subject' => '&#x4ee3;&#x7406;&#x670d;&#x52a1;&#x5668;&#x8bbf;&#x95ee;&#x9650;&#x5236;', 'attachsave_2_message' => '&#x672c;&#x7ad9;&#x73b0;&#x5728;&#x9650;&#x5236;&#x4f7f;&#x7528;&#x4ee3;&#x7406;&#x670d;&#x52a1;&#x5668;&#x8bbf;&#x95ee;&#xff0c;&#x8bf7;&#x53bb;&#x9664;&#x60a8;&#x7684;&#x4ee3;&#x7406;&#x8bbe;&#x7f6e;&#xff0c;&#x76f4;&#x63a5;&#x8bbf;&#x95ee;&#x672c;&#x7ad9;&#x3002;', 'attachsave_4_subject' => '&#x9875;&#x9762;&#x91cd;&#x8f7d;&#x5f00;&#x542f;', 'attachsave_4_message' => '&#x6b22;&#x8fce;&#x5149;&#x4e34;&#x672c;&#x7ad9;&#xff0c;&#x9875;&#x9762;&#x6b63;&#x5728;&#x91cd;&#x65b0;&#x8f7d;&#x5165;&#xff0c;&#x8bf7;&#x7a0d;&#x5019;&#x20;&#x2e;&#x2e;&#x2e;' ); $subject = $scuritylang[$subject] ? $scuritylang[$subject] : $subject; $message = $scuritylang[$message] ? $scuritylang[$message] : $message; if($_GET['inajax']) { ajaxshowheader(); echo '<div id="attackevasive_1" class="popupmenu_option"><b style="font-size: 16px">'.$subject.'</b><br /><br />'.$message.'</div>'; ajaxshowfooter(); } else { echo '<html>'; echo '<head>'; echo '<title>'.$subject.'</title>'; echo '</head>'; echo '<body bgcolor="#FFFFFF">'; if($reload) { echo '<script language="JavaScript">'; echo 'function reload() {'; echo ' document.location.reload();'; echo '}'; echo 'setTimeout("reload()", 1001);'; echo '</script>'; } if($form) { echo '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; } echo '<table cellpadding="0" cellspacing="0" border="0" width="700" align="center" height="85%">'; echo ' <tr align="center" valign="middle">'; echo ' <td>'; echo ' <table cellpadding="10" cellspacing="0" border="0" width="80%" align="center" style="font-family: Verdana, Tahoma; color: #666666; font-size: 11px">'; echo ' <tr>'; echo ' <td valign="middle" align="center" bgcolor="#EBEBEB">'; echo ' <br /><br /> <b style="font-size: 16px">'.$subject.'</b> <br /><br />'; echo $message; echo ' <br /><br />'; echo ' </td>'; echo ' </tr>'; echo ' </table>'; echo ' </td>'; echo ' </tr>'; echo '</table>'; if($form) { echo '</form>'; } echo '</body>'; echo '</html>'; } exit(); } function ajaxshowheader() { global $charset, $inajax; ob_end_clean(); @header("Expires: -1"); @header("Cache-Control: no-store, private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); header("Content-type: application/xml"); echo "<?xml version=\"1.0\" encoding=\"$charset\"?>\n<root><![CDATA["; } function ajaxshowfooter() { echo ']]></root>'; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/security.inc.php
PHP
asf20
5,303
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: promotion.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(!empty($fromuid)) { $fromuid = intval($fromuid); $fromuser = ''; } if(!$discuz_uid || !($fromuid == $discuz_uid || $fromuser == $discuz_user)) { if($creditspolicy['promotion_visit']) { $db->query("REPLACE INTO {$tablepre}promotions (ip, uid, username) VALUES ('$onlineip', '$fromuid', '$fromuser')"); } if($creditspolicy['promotion_register']) { if(!empty($fromuser) && empty($fromuid)) { if(empty($_DCOOKIE['promotion'])) { $fromuid = $db->result_first("SELECT uid FROM {$tablepre}members WHERE username='$fromuser'"); } else { $fromuid = intval($_DCOOKIE['promotion']); } } if($fromuid) { dsetcookie('promotion', ($_DCOOKIE['promotion'] = $fromuid), 1800); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/promotion.inc.php
PHP
asf20
981
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: newtrade.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 11; if(empty($forum['fid']) || $forum['type'] == 'group') { showmessage('forum_nonexistence'); } if($special != 2 || !submitcheck('topicsubmit', 0, $seccodecheck, $secqaacheck)) { showmessage('undefined_action', NULL, 'HALTED'); } if(!$allowposttrade) { showmessage('group_nopermission', NULL, 'NOPERM'); } if(!$discuz_uid && !((!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])))) { showmessage('group_nopermission', NULL, 'NOPERM'); } elseif(empty($forum['allowpost'])) { if(!$forum['postperm'] && !$allowpost) { showmessage('group_nopermission', NULL, 'NOPERM'); } elseif($forum['postperm'] && !forumperm($forum['postperm'])) { showmessage('post_forum_newthread_nopermission', NULL, 'HALTED'); } } elseif($forum['allowpost'] == -1) { showmessage('post_forum_newthread_nopermission', NULL, 'HALTED'); } checklowerlimit($postcredits); if($post_invalid = checkpost(1)) { showmessage($post_invalid); } if(checkflood()) { showmessage('post_flood_ctrl'); } $item_price = floatval($item_price); if(!trim($item_name)) { showmessage('trade_please_name'); } elseif($maxtradeprice && ($mintradeprice > $item_price || $maxtradeprice < $item_price)) { showmessage('trade_price_between'); } elseif(!$maxtradeprice && $mintradeprice > $item_price) { showmessage('trade_price_more_than'); } elseif($item_number < 1) { showmessage('tread_please_number'); } if(!empty($_FILES['tradeattach']['tmp_name'][0])) { $_FILES['attach'] = array_merge_recursive((array)$_FILES['attach'], $_FILES['tradeattach']); } if($allowpostattach && is_array($_FILES['attach'])) { foreach($_FILES['attach']['name'] as $attachname) { if($attachname != '') { checklowerlimit($postattachcredits); break; } } } $typeid = isset($typeid) ? $typeid : 0; $tradetypeid = isset($tradetypeid) ? $tradetypeid : 0; $iconid = !empty($iconid) && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0; $displayorder = $modnewthreads ? -2 : (($forum['ismoderator'] && !empty($sticktopic)) ? 1 : 0); $digest = ($forum['ismoderator'] && !empty($addtodigest)) ? 1 : 0; $readperm = $allowsetreadperm ? $readperm : 0; $isanonymous = $isanonymous && $allowanonymous ? 1 : 0; $author = !$isanonymous ? $discuz_user : ''; $moderated = $digest || $displayorder > 0 ? 1 : 0; $attachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0; $subscribed = !empty($emailnotify) && $discuz_uid ? 1 : 0; $db->query("INSERT INTO {$tablepre}threads (fid, readperm, price, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, subscribed, moderated, replies) VALUES ('$fid', '$readperm', '$price', '$iconid', '$typeid', '$author', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest', '$special', '$attachment', '$subscribed', '$moderated', '1')"); $tid = $db->insert_id(); if($subscribed) { $db->query("REPLACE INTO {$tablepre}subscriptions (uid, tid, lastpost, lastnotify) VALUES ('$discuz_uid', '$tid', '$timestamp', '$timestamp')", 'UNBUFFERED'); } $db->query("REPLACE INTO {$tablepre}mythreads (uid, tid, dateline, special) VALUES ('$discuz_uid', '$tid', '$timestamp', '$special')", 'UNBUFFERED'); if($moderated) { updatemodlog($tid, ($displayorder > 0 ? 'STK' : 'DIG')); updatemodworks(($displayorder > 0 ? 'STK' : 'DIG'), 1); } $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff)); $smileyoff = checksmilies($message, !empty($smileyoff)); $parseurloff = !empty($parseurloff); $htmlon = bindec(($tagstatus && !empty($tagoff) ? 1 : 0).($allowhtml && !empty($htmlon) ? 1 : 0)); $pinvisible = $modnewthreads ? -2 : 0; $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '0')"); if($tagstatus && $tags != '') { $tagarray = array_unique(explode(' ', censor($tags))); $tagcount = 0; foreach($tagarray as $tagname) { $tagname = trim($tagname); if(preg_match('/^([\x7f-\xff_-]|\w){3,20}$/', $tagname)) { $query = $db->query("SELECT closed FROM {$tablepre}tags WHERE tagname='$tagname'"); if($db->num_rows($query)) { if(!$tagstatus = $db->result($query, 0)) { $db->query("UPDATE {$tablepre}tags SET total=total+1 WHERE tagname='$tagname'", 'UNBUFFERED'); } } else { $db->query("INSERT INTO {$tablepre}tags (tagname, closed, total) VALUES ('$tagname', 0, 1)", 'UNBUFFERED'); $tagstatus = 0; } if(!$tagstatus) { $db->query("INSERT {$tablepre}threadtags (tagname, tid) VALUES ('$tagname', $tid)", 'UNBUFFERED'); } $tagcount++; if($tagcount > 4) { unset($tagarray); break; } } } } $pinvisible = $modnewreplies ? -2 : 0; $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '0', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$message', '$onlineip', '$pinvisible', '$isanonymous', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')"); $pid = $db->insert_id(); threadsort_checkoption(1, 1); $optiondata = array(); if($tradetypes && $typeoption && $checkoption) { $optiondata = threadsort_validator($typeoption); } if($tradetypes && $optiondata) { foreach($optiondata as $optionid => $value) { $db->query("INSERT INTO {$tablepre}tradeoptionvars (sortid, pid, optionid, value) VALUES ('$tradetypeid', '$pid', '$optionid', '$value')"); } } $tradeaid = 0; if($attachment) { $searcharray = $pregarray = $replacearray = array(); foreach($attachments as $key => $attach) { $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote) VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]')"); $searcharray[] = '[local]'.$localid[$key].'[/local]'; $pregarray[] = '/\[localimg=(\d{1,3}),(\d{1,3})\]'.$localid[$key].'\[\/localimg\]/is'; $insertid = $db->insert_id(); $replacearray[] = '[attach]'.$db->insert_id().'[/attach]'; } if(!empty($_FILES['tradeattach']['tmp_name'][0])) { $tradeaid = $insertid; } $message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); $db->query("UPDATE {$tablepre}posts SET message='$message' WHERE pid='$pid'"); updatecredits($discuz_uid, $postattachcredits, count($attachments)); } require_once DISCUZ_ROOT.'./include/trade.func.php'; trade_create(array( 'tid' => $tid, 'pid' => $pid, 'aid' => $tradeaid, 'typeid' => $tradetypeid, 'item_expiration' => $item_expiration, 'thread' => $thread, 'discuz_uid' => $discuz_uid, 'author' => $author, 'seller' => $seller, 'item_name' => $item_name, 'item_price' => $item_price, 'item_number' => $item_number, 'item_quality' => $item_quality, 'item_locus' => $item_locus, 'transport' => $transport, 'postage_mail' => $postage_mail, 'postage_express' => $postage_express, 'postage_ems' => $postage_ems, 'item_type' => $item_type, 'item_costprice' => $item_costprice )); if($modnewthreads) { $db->query("UPDATE {$tablepre}forums SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); showmessage('post_newthread_mod_succeed', "forumdisplay.php?fid=$fid"); } else { $feed = array(); if($addfeed && $forum['allowfeed']) { $feed['icon'] = 'goods'; $feed['title_template'] = 'feed_thread_goods_title'; $feed['body_template'] = 'feed_thread_goods_message'; $feed['body_data'] = array( 'itemname'=> "<a href=\"{$boardurl}viewthread.php?do=tradeinfo&tid=$tid&pid=$pid\">$item_name</a>", 'itemprice'=> $item_price ); if(in_array($attachments[1]['type'], array('image/gif', 'image/jpeg', 'image/png'))) { $attachurl = preg_match("/^((https?|ftps?):\/\/|www\.)/i", $attachurl) ? $attachurl : $boardurl.$attachurl; $imgurl = $attachurl.'/'.$attachments[1]['attachment'].($attachments[1]['thumb'] && $attachments[1]['type'] != 'image/gif' ? '.thumb.jpg' : ''); $feed['images'][] = $attachments[1]['attachment'] ? array('url' => $imgurl, 'link' => "{$boardurl}viewthread.php?tid=$tid") : array(); } postfeed($feed); } if($digest) { foreach($digestcredits as $id => $addcredits) { $postcredits[$id] = (isset($postcredits[$id]) ? $postcredits[$id] : 0) + $addcredits; } } updatepostcredits('+', $discuz_uid, $postcredits); $lastpost = "$tid\t$subject\t$timestamp\t$author"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', threads=threads+1, posts=posts+2, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); } showmessage('post_newthread_succeed', "viewthread.php?tid=$tid&extra=$extra"); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/newtrade.inc.php
PHP
asf20
9,825
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: misc.func.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } function convertip($ip) { $return = ''; if(preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $ip)) { $iparray = explode('.', $ip); if($iparray[0] == 10 || $iparray[0] == 127 || ($iparray[0] == 192 && $iparray[1] == 168) || ($iparray[0] == 172 && ($iparray[1] >= 16 && $iparray[1] <= 31))) { $return = '- LAN'; } elseif($iparray[0] > 255 || $iparray[1] > 255 || $iparray[2] > 255 || $iparray[3] > 255) { $return = '- Invalid IP Address'; } else { $tinyipfile = DISCUZ_ROOT.'./ipdata/tinyipdata.dat'; $fullipfile = DISCUZ_ROOT.'./ipdata/wry.dat'; if(@file_exists($tinyipfile)) { $return = convertip_tiny($ip, $tinyipfile); } elseif(@file_exists($fullipfile)) { $return = convertip_full($ip, $fullipfile); } } } return $return; } function convertip_tiny($ip, $ipdatafile) { static $fp = NULL, $offset = array(), $index = NULL; $ipdot = explode('.', $ip); $ip = pack('N', ip2long($ip)); $ipdot[0] = (int)$ipdot[0]; $ipdot[1] = (int)$ipdot[1]; if($fp === NULL && $fp = @fopen($ipdatafile, 'rb')) { $offset = unpack('Nlen', fread($fp, 4)); $index = fread($fp, $offset['len'] - 4); } elseif($fp == FALSE) { return '- Invalid IP data file'; } $length = $offset['len'] - 1028; $start = unpack('Vlen', $index[$ipdot[0] * 4] . $index[$ipdot[0] * 4 + 1] . $index[$ipdot[0] * 4 + 2] . $index[$ipdot[0] * 4 + 3]); for ($start = $start['len'] * 8 + 1024; $start < $length; $start += 8) { if ($index{$start} . $index{$start + 1} . $index{$start + 2} . $index{$start + 3} >= $ip) { $index_offset = unpack('Vlen', $index{$start + 4} . $index{$start + 5} . $index{$start + 6} . "\x0"); $index_length = unpack('Clen', $index{$start + 7}); break; } } fseek($fp, $offset['len'] + $index_offset['len'] - 1024); if($index_length['len']) { return '- '.fread($fp, $index_length['len']); } else { return '- Unknown'; } } function convertip_full($ip, $ipdatafile) { if(!$fd = @fopen($ipdatafile, 'rb')) { return '- Invalid IP data file'; } $ip = explode('.', $ip); $ipNum = $ip[0] * 16777216 + $ip[1] * 65536 + $ip[2] * 256 + $ip[3]; if(!($DataBegin = fread($fd, 4)) || !($DataEnd = fread($fd, 4)) ) return; @$ipbegin = implode('', unpack('L', $DataBegin)); if($ipbegin < 0) $ipbegin += pow(2, 32); @$ipend = implode('', unpack('L', $DataEnd)); if($ipend < 0) $ipend += pow(2, 32); $ipAllNum = ($ipend - $ipbegin) / 7 + 1; $BeginNum = $ip2num = $ip1num = 0; $ipAddr1 = $ipAddr2 = ''; $EndNum = $ipAllNum; while($ip1num > $ipNum || $ip2num < $ipNum) { $Middle= intval(($EndNum + $BeginNum) / 2); fseek($fd, $ipbegin + 7 * $Middle); $ipData1 = fread($fd, 4); if(strlen($ipData1) < 4) { fclose($fd); return '- System Error'; } $ip1num = implode('', unpack('L', $ipData1)); if($ip1num < 0) $ip1num += pow(2, 32); if($ip1num > $ipNum) { $EndNum = $Middle; continue; } $DataSeek = fread($fd, 3); if(strlen($DataSeek) < 3) { fclose($fd); return '- System Error'; } $DataSeek = implode('', unpack('L', $DataSeek.chr(0))); fseek($fd, $DataSeek); $ipData2 = fread($fd, 4); if(strlen($ipData2) < 4) { fclose($fd); return '- System Error'; } $ip2num = implode('', unpack('L', $ipData2)); if($ip2num < 0) $ip2num += pow(2, 32); if($ip2num < $ipNum) { if($Middle == $BeginNum) { fclose($fd); return '- Unknown'; } $BeginNum = $Middle; } } $ipFlag = fread($fd, 1); if($ipFlag == chr(1)) { $ipSeek = fread($fd, 3); if(strlen($ipSeek) < 3) { fclose($fd); return '- System Error'; } $ipSeek = implode('', unpack('L', $ipSeek.chr(0))); fseek($fd, $ipSeek); $ipFlag = fread($fd, 1); } if($ipFlag == chr(2)) { $AddrSeek = fread($fd, 3); if(strlen($AddrSeek) < 3) { fclose($fd); return '- System Error'; } $ipFlag = fread($fd, 1); if($ipFlag == chr(2)) { $AddrSeek2 = fread($fd, 3); if(strlen($AddrSeek2) < 3) { fclose($fd); return '- System Error'; } $AddrSeek2 = implode('', unpack('L', $AddrSeek2.chr(0))); fseek($fd, $AddrSeek2); } else { fseek($fd, -1, SEEK_CUR); } while(($char = fread($fd, 1)) != chr(0)) $ipAddr2 .= $char; $AddrSeek = implode('', unpack('L', $AddrSeek.chr(0))); fseek($fd, $AddrSeek); while(($char = fread($fd, 1)) != chr(0)) $ipAddr1 .= $char; } else { fseek($fd, -1, SEEK_CUR); while(($char = fread($fd, 1)) != chr(0)) $ipAddr1 .= $char; $ipFlag = fread($fd, 1); if($ipFlag == chr(2)) { $AddrSeek2 = fread($fd, 3); if(strlen($AddrSeek2) < 3) { fclose($fd); return '- System Error'; } $AddrSeek2 = implode('', unpack('L', $AddrSeek2.chr(0))); fseek($fd, $AddrSeek2); } else { fseek($fd, -1, SEEK_CUR); } while(($char = fread($fd, 1)) != chr(0)) $ipAddr2 .= $char; } fclose($fd); if(preg_match('/http/i', $ipAddr2)) { $ipAddr2 = ''; } $ipaddr = "$ipAddr1 $ipAddr2"; $ipaddr = preg_replace('/CZ88\.NET/is', '', $ipaddr); $ipaddr = preg_replace('/^\s*/is', '', $ipaddr); $ipaddr = preg_replace('/\s*$/is', '', $ipaddr); if(preg_match('/http/i', $ipaddr) || $ipaddr == '') { $ipaddr = '- Unknown'; } return '- '.$ipaddr; } function procthread($thread) { global $dateformat, $timeformat, $timeoffset, $ppp, $colorarray; if(empty($colorarray)) { $colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282'); } $thread['icon'] = isset($GLOBALS['_DCACHE']['icons'][$thread['iconid']]) ? '<img src="images/icons/'.$GLOBALS['_DCACHE']['icons'][$thread['iconid']].'" alt="Icon'.$thread['iconid'].'" class="icon" />' : '&nbsp;'; $thread['forumname'] = $GLOBALS['_DCACHE']['forums'][$thread['fid']]['name']; $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600); $thread['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $thread['lastposterenc'] = rawurlencode($thread['lastposter']); if($thread['replies'] > $thread['views']) { $thread['views'] = $thread['replies']; } $postsnum = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1; $thread['special'] == 3 && $thread['price'] < 0 && $thread['replies']--; $pagelinks = ''; if($postsnum > $ppp) { $posts = $postsnum; $topicpages = ceil($posts / $ppp); for($i = 1; $i <= $topicpages; $i++) { $pagelinks .= '<a href="viewthread.php?tid='.$thread['tid'].'&page='.$i.'" target="_blank">'.$i.'</a> '; if($i == 6) { $i = $topicpages + 1; } } if($topicpages > 6) { $pagelinks .= ' .. <a href="viewthread.php?tid='.$thread['tid'].'&page='.$topicpages.'" target="_blank">'.$topicpages.'</a> '; } $thread['multipage'] = '... '.$pagelinks; } else { $thread['multipage'] = ''; } if($thread['highlight']) { $string = sprintf('%02d', $thread['highlight']); $stylestr = sprintf('%03b', $string[0]); $thread['highlight'] = 'style="'; $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : ''; $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : ''; $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : ''; $thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : ''; $thread['highlight'] .= '"'; } else { $thread['highlight'] = ''; } if($thread['attachment']) { require_once DISCUZ_ROOT.'./include/attachment.func.php'; $thread['attachment'] = attachtype($thread['attachment']).' '; } else { $thread['attachment'] = ''; } return $thread; } function updateviews($table, $idcol, $viewscol, $logfile) { global $db, $tablepre; $viewlog = $viewarray = array(); if(@$viewlog = file($logfile = DISCUZ_ROOT.$logfile)) { if(!@unlink($logfile)) { if($fp = @fopen($logfile, 'w')) { fwrite($fp, ''); fclose($fp); } } $viewlog = array_count_values($viewlog); foreach($viewlog as $id => $views) { $viewarray[$views] .= ($id > 0) ? ','.intval($id) : ''; } foreach($viewarray as $views => $ids) { $db->query("UPDATE LOW_PRIORITY $tablepre$table SET $viewscol=$viewscol+'$views' WHERE $idcol IN (0$ids)", 'UNBUFFERED'); } } } function modlog($thread, $action) { global $discuz_user, $adminid, $onlineip, $timestamp, $forum, $reason; writelog('modslog', dhtmlspecialchars("$timestamp\t$discuz_user\t$adminid\t$onlineip\t$forum[fid]\t$forum[name]\t$thread[tid]\t$thread[subject]\t$action\t$reason")); } function checkreasonpm() { global $reason; $reason = trim(strip_tags($reason)); if(($GLOBALS['reasonpm'] == 1 || $GLOBALS['reasonpm'] == 3) && !$reason) { showmessage('admin_reason_invalid'); } } function procreportlog($tids = '', $pids = '', $del = FALSE) { global $db, $tablepre, $fid, $forum; if(!$pids && $tids) { $pids = $comma = ''; $query = $db->query("SELECT pid FROM {$tablepre}posts WHERE tid IN ($tids)".($del ? '' : ' AND first=1')); while($post = $db->fetch_array($query)) { $pids .= $comma.$post['pid']; $comma = ','; } } if($pids) { if($del) { $db->query("DELETE FROM {$tablepre}reportlog WHERE pid IN ($pids)", 'UNBUFFERED'); } else { $db->query("UPDATE {$tablepre}reportlog SET status=0 WHERE pid IN ($pids)", 'UNBUFFERED'); } if($forum['modworks'] && !$db->result_first("SELECT COUNT(*) FROM {$tablepre}reportlog WHERE fid='$fid' AND status=1")) { $db->query("UPDATE {$tablepre}forums SET modworks='0' WHERE fid='$fid'", 'UNBUFFERED'); } } } function sendreasonpm($var, $item) { global $$var; ${$var}['subject'] = strtr(${$var}['subject'], array_flip(get_html_translation_table(HTML_ENTITIES))); ${$var}['dateline'] = gmdate($GLOBALS['_DCACHE']['settings']['dateformat'].' '.$GLOBALS['_DCACHE']['settings']['timeformat'], ${$var}['dateline'] + ($GLOBALS['timeoffset'] * 3600)); if(!empty(${$var}['authorid']) && ${$var}['authorid'] != $GLOBALS['discuz_uid']) { sendpm(${$var}['authorid'], $item.'_subject', $item.'_message', 0); } } function modreasonselect() { global $_DCACHE; if(!isset($_DCACHE['modreasons']) || !is_array($_DCACHE['modreasons'])) { @include DISCUZ_ROOT.'./forumdata/cache/cache_topicadmin.php'; } $select = ''; foreach($_DCACHE['modreasons'] as $reason) { $select .= $reason ? '<li>'.$reason.'</li>' : '<li></li>'; } return $select; } function logincheck() { global $db, $tablepre, $onlineip, $timestamp; $return = 0; $login = $db->fetch_first("SELECT count, lastupdate FROM {$tablepre}failedlogins WHERE ip='$onlineip'"); $return = (!$login || ($timestamp - $login['lastupdate'] > 900)) ? 4 : max(0, 5 - $login['count']); if($return == 4) { $db->query("REPLACE INTO {$tablepre}failedlogins (ip, count, lastupdate) VALUES ('$onlineip', '1', '$timestamp')"); $db->query("DELETE FROM {$tablepre}failedlogins WHERE lastupdate<$timestamp-901", 'UNBUFFERED'); } return $return; } function loginfailed($permission) { global $db, $tablepre, $onlineip, $timestamp; $db->query("UPDATE {$tablepre}failedlogins SET count=count+1, lastupdate='$timestamp' WHERE ip='$onlineip'"); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/misc.func.php
PHP
asf20
11,569
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: editpost.inc.php 17400 2008-12-17 09:59:30Z liuqiang $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($special == 6) { require_once DISCUZ_ROOT.'./api/video.php'; require_once DISCUZ_ROOT.'./include/insenz.func.php'; } $discuz_action = 13; $orig = $db->fetch_first("SELECT m.adminid, p.first, p.authorid, p.author, p.dateline, p.anonymous, p.invisible, p.htmlon FROM {$tablepre}posts p LEFT JOIN {$tablepre}members m ON m.uid=p.authorid WHERE pid='$pid' AND tid='$tid' AND fid='$fid'"); if($magicstatus) { $magicid = $db->result_first("SELECT magicid FROM {$tablepre}threadsmod WHERE tid='$tid' AND magicid='10'"); $allowanonymous = $allowanonymous || $magicid ? 1 : $allowanonymous; } $isfirstpost = $orig['first'] ? 1 : 0; $isorigauthor = $discuz_uid && $discuz_uid == $orig['authorid']; $isanonymous = $isanonymous && $allowanonymous ? 1 : 0; $audit = $orig['invisible'] == -2 || $thread['displayorder'] == -2 ? $audit : 0; if(empty($orig)) { showmessage('undefined_action'); } elseif((!$forum['ismoderator'] || !$alloweditpost || (in_array($orig['adminid'], array(1, 2, 3)) && $adminid > $orig['adminid'])) && !($forum['alloweditpost'] && $isorigauthor)) { showmessage('post_edit_nopermission', NULL, 'HALTED'); } elseif($thread['digest'] == '-1' && $isfirstpost) { showmessage('special_noaction'); } elseif($isorigauthor && !$forum['ismoderator']) { if($edittimelimit && $timestamp - $orig['dateline'] > $edittimelimit * 60) { showmessage('post_edit_timelimit', NULL, 'HALTED'); } elseif(($isfirstpost && $modnewthreads) || (!$isfirstpost && $modnewreplies)) { showmessage('post_edit_moderate'); } } if($swfattachs && $orig['authorid'] != $discuz_uid) { $swfattachs = 0; } $thread['pricedisplay'] = $thread['price'] == -1 ? 0 : $thread['price']; if($tagstatus) { $query = $db->query("SELECT tagname FROM {$tablepre}threadtags WHERE tid='$tid'"); $threadtagary = array(); while($tagname = $db->fetch_array($query)) { $threadtagary[] = $tagname['tagname']; } $threadtags = dhtmlspecialchars(implode(' ',$threadtagary)); } if($special == 5) { $debate = array_merge($thread, daddslashes($db->fetch_first("SELECT * FROM {$tablepre}debates WHERE tid='$tid'"), 1)); $firststand = $db->result_first("SELECT stand FROM {$tablepre}debateposts WHERE tid='$tid' AND uid='$discuz_uid' AND stand<>'0' ORDER BY dateline LIMIT 1"); if(!$isfirstpost && $debate['endtime'] && $debate['endtime'] < $timestamp && !$forum['ismoderator']) { showmessage('debate_end'); } if($isfirstpost && $debate['umpirepoint'] && !$forum['ismoderator']) { showmessage('debate_umpire_comment_invalid'); } } if(!submitcheck('editsubmit')) { include_once language('misc'); $icons = ''; if(!$special && is_array($_DCACHE['icons']) && $isfirstpost) { $key = 1; foreach($_DCACHE['icons'] as $id => $icon) { $icons .= ' <input class="radio" type="radio" name="iconid" value="'.$id.'" '.($thread['iconid'] == $id ? 'checked="checked"' : '').' /><img src="images/icons/'.$icon.'" alt="" />'; $icons .= !(++$key % 10) ? '<br />' : ''; } } $postinfo = $db->fetch_first("SELECT * FROM {$tablepre}posts WHERE pid='$pid' AND tid='$tid' AND fid='$fid'"); $usesigcheck = $postinfo['usesig'] ? 'checked="checked"' : ''; $urloffcheck = $postinfo['parseurloff'] ? 'checked="checked"' : ''; $smileyoffcheck = $postinfo['smileyoff'] == 1 ? 'checked="checked"' : ''; $codeoffcheck = $postinfo['bbcodeoff'] == 1 ? 'checked="checked"' : ''; $tagoffcheck = $postinfo['htmlon'] & 2 ? 'checked="checked"' : ''; $htmloncheck = $postinfo['htmlon'] & 1 ? 'checked="checked"' : ''; $showthreadsorts = ($thread['sortid'] || !empty($sortid)) && $isfirstpost; $sortid = empty($sortid) ? $thread['sortid'] : $sortid; $poll = $temppoll = ''; if($isfirstpost) { $thread['freecharge'] = $maxchargespan && $timestamp - $thread['dateline'] >= $maxchargespan * 3600 ? 1 : 0; if($thread['special'] == 1 && ($alloweditpoll || $thread['authorid'] == $discuz_uid)) { $query = $db->query("SELECT polloptionid, displayorder, polloption, multiple, visible, maxchoices, expiration, overt FROM {$tablepre}polloptions AS polloptions LEFT JOIN {$tablepre}polls AS polls ON polloptions.tid=polls.tid WHERE polls.tid ='$tid' ORDER BY displayorder"); while($temppoll = $db->fetch_array($query)) { $poll['multiple'] = $temppoll['multiple']; $poll['visible'] = $temppoll['visible']; $poll['maxchoices'] = $temppoll['maxchoices']; $poll['expiration'] = $temppoll['expiration']; $poll['overt'] = $temppoll['overt']; $poll['polloptionid'][] = $temppoll['polloptionid']; $poll['displayorder'][] = $temppoll['displayorder']; $poll['polloption'][] = stripslashes($temppoll['polloption']); } $maxpolloptions = $maxpolloptions - $db->num_rows($query); } elseif($thread['special'] == 3) { $rewardprice = abs($thread['price']); } elseif($thread['special'] == 4) { $activitytypelist = $activitytype ? explode("\n", trim($activitytype)) : ''; $activity = $db->fetch_first("SELECT * FROM {$tablepre}activities WHERE tid='$tid'"); $activity['starttimefrom'] = gmdate("Y-m-d H:i", $activity['starttimefrom'] + $timeoffset * 3600); $activity['starttimeto'] = $activity['starttimeto'] ? gmdate("Y-m-d H:i", $activity['starttimeto'] + $timeoffset * 3600) : ''; $activity['expiration'] = $activity['expiration'] ? gmdate("Y-m-d H:i", $activity['expiration'] + $timeoffset * 3600) : ''; } elseif($thread['special'] == 5 ) { $debate['endtime'] = $debate['endtime'] ? gmdate("Y-m-d H:i", $debate['endtime'] + $timeoffset * 3600) : ''; } } if($thread['special'] == 2 && $allowposttrade) { $query = $db->query("SELECT * FROM {$tablepre}trades WHERE pid='$pid'"); $tradetypeselect = ''; if($db->num_rows($query)) { $trade = $db->fetch_array($query); $trade['expiration'] = $trade['expiration'] ? date('Y-m-d', $trade['expiration']) : ''; $trade['costprice'] = $trade['costprice'] > 0 ? $trade['costprice'] : ''; $trade['message'] = dhtmlspecialchars($trade['message']); $tradetypeid = $trade['typeid']; $forum['tradetypes'] = $forum['tradetypes'] == '' ? -1 : unserialize($forum['tradetypes']); if((!$tradetypeid || !isset($tradetypes[$tradetypeid]) && !empty($forum['tradetypes']))) { $tradetypeselect = '<select name="tradetypeid" onchange="ajaxget(\'post.php?action=threadsorts&tradetype=yes&sortid=\'+this.options[this.selectedIndex].value+\'&sid='.$sid.'\', \'threadtypes\', \'threadtypeswait\')"><option value="0">&nbsp;</option>'; foreach($tradetypes as $typeid => $name) { if($forum['tradetypes'] == -1 || @in_array($typeid, $forum['tradetypes'])) { $tradetypeselect .= '<option value="'.$typeid.'">'.strip_tags($name).'</option>'; } } $tradetypeselect .= '</select><span id="threadtypeswait"></span>'; } else { $tradetypeselect = '<select disabled><option>'.$tradetypes[$trade['typeid']].'</option></select>'; } $expiration_7days = date('Y-m-d', $timestamp + 86400 * 7); $expiration_14days = date('Y-m-d', $timestamp + 86400 * 14); $expiration_month = date('Y-m-d', mktime(0, 0, 0, date('m')+1, date('d'), date('Y'))); $expiration_3months = date('Y-m-d', mktime(0, 0, 0, date('m')+3, date('d'), date('Y'))); $expiration_halfyear = date('Y-m-d', mktime(0, 0, 0, date('m')+6, date('d'), date('Y'))); $expiration_year = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y')+1)); } else { $tradetypeid = $special = 0; $trade = array(); } } if($thread['special'] == 6 && $allowpostvideo) { $videoAccount = new VideoClient_Util($appid, $siteid, $sitekey); $videoupload = $videoAccount->createUploadFrom($option, array('url' => 'data.php')); $query = $db->query("SELECT value FROM {$tablepre}settings WHERE variable='videoinfo'"); $settings = unserialize($db->result($query, 0)); if($settings['videotype'] && is_array($settings['videotype'])) { $vtypeselect = '<select name="vclass">'; foreach($settings['videotype'] as $key => $type) { if($type['able']) { $vtypeselect .= '<option value="'.$key.'"> '.$type['name'].'</option>'; } } $vtypeselect .= '</select>'; } $videolist = array(); $query = $db->query("SELECT vid, vthumb, vtitle, displayorder FROM {$tablepre}videos WHERE tid='$tid'"); while($videoinfo = $db->fetch_array($query)) { $videolist[] = $videoinfo; } } if($postinfo['attachment']) { require_once DISCUZ_ROOT.'./include/attachment.func.php'; $attachfind = $attachreplace = $attachments = array(); $query = $db->query("SELECT * FROM {$tablepre}attachments WHERE pid='$postinfo[pid]'"); while($attach = $db->fetch_array($query)) { $attach['filenametitle'] = $attach['filename']; $attach['filename'] = cutstr($attach['filename'], 30); $attach['dateline'] = gmdate("$dateformat $timeformat", $attach['dateline'] + $timeoffset * 3600); $attach['filesize'] = sizecount($attach[filesize]); $attach['filetype'] = attachtype(fileext($attach['attachment'])."\t".$attach['filetype']); if($attach['isimage']) { $attach['url'] = $attach['remote'] ? $ftp['attachurl'] : $attachurl; $attachfind[] = "/\[attach\]$attach[aid]\[\/attach\]/i"; $attachreplace[] = '[attachimg]'.$attach['aid'].'[/attachimg]'; } if($special == 2 && $trade['aid'] == $attach['aid']) { $tradeattach = $attach; continue; } $attachments[] = $attach; } } $postinfo['subject'] = str_replace('"', '&quot;', $postinfo['subject']); $postinfo['message'] = dhtmlspecialchars($postinfo['message']); $postinfo['message'] = preg_replace($language['post_edit_regexp'], '', $postinfo['message']); if($postinfo['attachment'] && $attachfind) { $postinfo['message'] = preg_replace($attachfind, $attachreplace, $postinfo['message']); } if($special == 5) { $standselected = array($firststand => 'selected="selected"'); } include template('post'); } else { $redirecturl = "viewthread.php?tid=$tid&page=$page&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : '')."#pid$pid"; if(empty($delete)) { if($post_invalid = checkpost($isfirstpost && $special)) { showmessage($post_invalid); } if($allowpostattach && is_array($_FILES['attach'])) { foreach($_FILES['attach']['name'] as $attachname) { if($attachname != '') { checklowerlimit($creditspolicy['postattach']); break; } } } if(!$isorigauthor && !$allowanonymous) { if($orig['anonymous'] && !$isanonymous) { $isanonymous = 0; $authoradd = ', author=\''.addslashes($orig['author']).'\''; $anonymousadd = ', anonymous=\'0\''; } else { $isanonymous = $orig['anonymous']; $authoradd = $anonymousadd = ''; } } else { $authoradd = ', author=\''.($isanonymous ? '' : addslashes($orig['author'])).'\''; $anonymousadd = ", anonymous='$isanonymous'"; } if($isfirstpost) { if($subject == '') { showmessage('post_sm_isnull'); } if(!$sortid && !$thread['special'] && $message == '') { showmessage('post_sm_isnull'); } $typeid = isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0; $sortid = isset($forum['threadsorts']['types'][$sortid]) ? $sortid : 0; $iconid = isset($_DCACHE['icons'][$iconid]) ? $iconid : 0; if(!$typeid && $forum['threadtypes']['required'] && !$thread['special']) { showmessage('post_type_isnull'); } $readperm = $allowsetreadperm ? intval($readperm) : ($isorigauthor ? 0 : 'readperm'); $price = intval($price); $price = $thread['price'] < 0 && !$thread['special'] ?($isorigauthor || !$price ? -1 : $price) :($maxprice ? ($price <= $maxprice ? ($price > 0 ? $price : 0) : $maxprice) : ($isorigauthor ? 0 : $thread['price'])); if($price > 0 && floor($price * (1 - $creditstax)) == 0) { showmessage('post_net_price_iszero'); } $polladd = ''; if($thread['special'] == 1 && ($alloweditpoll || $isorigauthor) && !empty($polls)) { $pollarray = ''; foreach($polloption as $key => $value) { if($value === '') { unset($polloption[$key], $displayorder[$key]); } } $pollarray['options'] = $polloption; if($pollarray['options']) { if(count($pollarray['options']) > $maxpolloptions) { showmessage('post_poll_option_toomany'); } foreach($pollarray['options'] as $key => $value) { if(!trim($value)) { $db->query("DELETE FROM {$tablepre}polloptions WHERE polloptionid='$key' AND tid='$tid'"); unset($pollarray['options'][$key]); } } $polladd = ', special=\'1\''; foreach($displayorder as $key => $value) { if(preg_match("/^-?\d*$/", $value)) { $pollarray['displayorder'][$key] = $value; } } $pollarray['multiple'] = !empty($multiplepoll); $pollarray['visible'] = empty($visibilitypoll); $pollarray['expiration'] = $expiration; $pollarray['overt'] = !empty($overt); foreach($polloptionid as $key => $value) { if(!preg_match("/^\d*$/", $value)) { showmessage('submit_invalid'); } } $maxchoices = !empty($multiplepoll) ? (!$maxchoices || $maxchoices >= count($pollarray['options']) ? count($pollarray['options']) : $maxchoices) : ''; if(preg_match("/^\d*$/", $maxchoices)) { if(!$pollarray['multiple']) { $pollarray['maxchoices'] = 1; } elseif(empty($maxchoices)) { $pollarray['maxchoices'] = 0; } else { $pollarray['maxchoices'] = $maxchoices; } } $expiration = intval($expiration); if($close) { $pollarray['expiration'] = $timestamp; } elseif($expiration) { if(empty($pollarray['expiration'])) { $pollarray['expiration'] = 0; } else { $pollarray['expiration'] = $timestamp + 86400 * $expiration; } } $optid = ''; $query = $db->query("SELECT polloptionid FROM {$tablepre}polloptions WHERE tid='$tid'"); while($tempoptid = $db->fetch_array($query)) { $optid[] = $tempoptid['polloptionid']; } foreach($pollarray['options'] as $key => $value) { $value = dhtmlspecialchars(trim($value)); if(in_array($polloptionid[$key], $optid)) { if($alloweditpoll) { $db->query("UPDATE {$tablepre}polloptions SET displayorder='".$pollarray['displayorder'][$key]."', polloption='$value' WHERE polloptionid='$polloptionid[$key]' AND tid='$tid'"); } else { $db->query("UPDATE {$tablepre}polloptions SET displayorder='".$pollarray['displayorder'][$key]."' WHERE polloptionid='$polloptionid[$key]' AND tid='$tid'"); } } else { $db->query("INSERT INTO {$tablepre}polloptions (tid, displayorder, polloption) VALUES ('$tid', '".$pollarray['displayorder'][$key]."', '$value')"); } } $db->query("UPDATE {$tablepre}polls SET multiple='$pollarray[multiple]', visible='$pollarray[visible]', maxchoices='$pollarray[maxchoices]', expiration='$pollarray[expiration]', overt='$pollarray[overt]' WHERE tid='$tid'", 'UNBUFFERED'); } else { $polladd = ', special=\'0\''; $db->query("DELETE FROM {$tablepre}polls WHERE tid='$tid'"); $db->query("DELETE FROM {$tablepre}polloptions WHERE tid='$tid'"); } } elseif($thread['special'] == 3 && $allowpostreward) { if($thread['price'] > 0 && $thread['price'] != $rewardprice) { $rewardprice = intval($rewardprice); if($rewardprice <= 0){ showmessage("reward_credits_invalid"); } $addprice = ceil(($rewardprice - $thread['price']) + ($rewardprice - $thread['price']) * $creditstax); if(!$forum['ismoderator']) { if($rewardprice < $thread['price']) { showmessage("reward_credits_fall"); } elseif($rewardprice < $minrewardprice || ($maxrewardprice > 0 && $rewardprice > $maxrewardprice)) { showmessage("reward_credits_between"); } elseif($addprice > $_DSESSION["extcredits$creditstransextra[2]"]) { showmessage('reward_credits_shortage'); } } $realprice = ceil($thread['price'] + $thread['price'] * $creditstax) + $addprice; $db->query("UPDATE {$tablepre}members SET extcredits$creditstransextra[2]=extcredits$creditstransextra[2]-$addprice WHERE uid='$thread[authorid]'"); $db->query("UPDATE {$tablepre}rewardlog SET netamount='$realprice' WHERE tid='$tid' AND authorid='$thread[authorid]'"); } if(!$forum['ismoderator']) { if($thread['replies'] > 1) { $subject = addslashes($thread['subject']); } if($thread['price'] < 0) { $rewardprice = abs($thread['price']); } } $price = $thread['price'] > 0 ? $rewardprice : -$rewardprice; } elseif($thread['special'] == 4 && $allowpostactivity) { $activitytime = intval($activitytime); if(empty($starttimefrom[$activitytime])) { showmessage('activity_fromtime_please'); } elseif(strtotime($starttimefrom[$activitytime]) === -1 || @strtotime($starttimefrom[$activitytime]) === FALSE) { showmessage('activity_fromtime_error'); } elseif($activitytime && ((@strtotime($starttimefrom) > @strtotime($starttimeto) || !$starttimeto))) { showmessage('activity_fromtime_error'); } elseif(!trim($activityclass)) { showmessage('activity_sort_please'); } elseif(!trim($activityplace)) { showmessage('activity_address_please'); } elseif(trim($activityexpiration) && (@strtotime($activityexpiration) === -1 || @strtotime($activityexpiration) === FALSE)) { showmessage('activity_totime_error'); } $activity = array(); $activity['class'] = dhtmlspecialchars(trim($activityclass)); $activity['starttimefrom'] = @strtotime($starttimefrom[$activitytime]); $activity['starttimeto'] = $activitytime ? @strtotime($starttimeto) : 0; $activity['place'] = dhtmlspecialchars(trim($activityplace)); $activity['cost'] = intval($cost); $activity['gender'] = intval($gender); $activity['number'] = intval($activitynumber); if($activityexpiration) { $activity['expiration'] = @strtotime($activityexpiration); } else { $activity['expiration'] = 0; } $db->query("UPDATE {$tablepre}activities SET cost='$activity[cost]', starttimefrom='$activity[starttimefrom]', starttimeto='$activity[starttimeto]', place='$activity[place]', class='$activity[class]', gender='$activity[gender]', number='$activity[number]', expiration='$activity[expiration]' WHERE tid='$tid'", 'UNBUFFERED'); } elseif($thread['special'] == 5 && $allowpostdebate) { if(empty($affirmpoint) || empty($negapoint)) { showmessage('debate_position_nofound'); } elseif(!empty($endtime) && (!($endtime = @strtotime($endtime)) || $endtime < $timestamp)) { showmessage('debate_endtime_invalid'); } elseif(!empty($umpire)) { if(!$db->result_first("SELECT COUNT(*) FROM {$tablepre}members WHERE username='$umpire'")) { $umpire = dhtmlspecialchars($umpire); showmessage('debate_umpire_invalid'); } } $affirmpoint = dhtmlspecialchars($affirmpoint); $negapoint = dhtmlspecialchars($negapoint); $db->query("UPDATE {$tablepre}debates SET affirmpoint='$affirmpoint', negapoint='$negapoint', endtime='$endtime', umpire='$umpire' WHERE tid='$tid' AND uid='$discuz_uid'"); } $optiondata = array(); if($forum['threadsorts']['types'][$sortid] && $checkoption) { $optiondata = threadsort_validator($typeoption); } if($forum['threadsorts']['types'][$sortid] && $optiondata && is_array($optiondata)) { foreach($optiondata as $optionid => $value) { $db->query("UPDATE {$tablepre}typeoptionvars SET value='$value' WHERE tid='$tid' AND optionid='$optionid'"); } } $db->query("UPDATE {$tablepre}threads SET iconid='$iconid', typeid='$typeid', sortid='$sortid', subject='$subject', readperm='$readperm', price='$price' $authoradd $polladd ".($auditstatuson && $audit == 1 ? ",displayorder='0', moderated='1'" : '')." WHERE tid='$tid'", 'UNBUFFERED'); if($tagstatus) { $tags = str_replace(array(chr(0xa3).chr(0xac), chr(0xa1).chr(0x41), chr(0xef).chr(0xbc).chr(0x8c)), ',', censor($tags)); if(strexists($tags, ',')) { $tagarray = array_unique(explode(',', $tags)); } else { $tags = str_replace(array(chr(0xa1).chr(0xa1), chr(0xa1).chr(0x40), chr(0xe3).chr(0x80).chr(0x80)), ' ', $tags); $tagarray = array_unique(explode(' ', $tags)); } $threadtagsnew = array(); $tagcount = 0; foreach($tagarray as $tagname) { $tagname = trim($tagname); if(preg_match('/^([\x7f-\xff_-]|\w|\s){3,20}$/', $tagname)) { $threadtagsnew[] = $tagname; if(!in_array($tagname, $threadtagary)) { $query = $db->query("SELECT closed FROM {$tablepre}tags WHERE tagname='$tagname'"); if($db->num_rows($query)) { if(!$tagstatus = $db->result($query, 0)) { $db->query("UPDATE {$tablepre}tags SET total=total+1 WHERE tagname='$tagname'", 'UNBUFFERED'); } } else { $db->query("INSERT INTO {$tablepre}tags (tagname, closed, total) VALUES ('$tagname', 0, 1)", 'UNBUFFERED'); $tagstatus = 0; } if(!$tagstatus) { $db->query("INSERT {$tablepre}threadtags (tagname, tid) VALUES ('$tagname', '$tid')", 'UNBUFFERED'); } } } $tagcount++; if($tagcount > 4) { unset($tagarray); break; } } foreach($threadtagary as $tagname) { if(!in_array($tagname, $threadtagsnew)) { if($db->result_first("SELECT count(*) FROM {$tablepre}threadtags WHERE tagname='$tagname' AND tid!='$tid'")) { $db->query("UPDATE {$tablepre}tags SET total=total-1 WHERE tagname='$tagname'", 'UNBUFFERED'); } else { $db->query("DELETE FROM {$tablepre}tags WHERE tagname='$tagname'", 'UNBUFFERED'); } $db->query("DELETE FROM {$tablepre}threadtags WHERE tagname='$tagname' AND tid='$tid'", 'UNBUFFERED'); } } } } else { if($subject == '' && $message == '') { showmessage('post_sm_isnull'); } } if($editedby && ($timestamp - $orig['dateline']) > 60 && $adminid != 1) { include_once language('misc'); $editor = $isanonymous && $isorigauthor ? $language['anonymous'] : $discuz_user; $edittime = gmdate($_DCACHE['settings']['dateformat'].' '.$_DCACHE['settings']['timeformat'], $timestamp + $timeoffset * 3600); eval("\$message = \"$language[post_edit]\".\$message;"); } $bbcodeoff = checkbbcodes($message, !empty($bbcodeoff)); $smileyoff = checksmilies($message, !empty($smileyoff)); $tagoff = $isfirstpost ? !empty($tagoff) : 0; $htmlon = bindec(($tagstatus && $tagoff ? 1 : 0).($allowhtml && !empty($htmlon) ? 1 : 0)); $tattachment = 0; if($special == 2 && !empty($_FILES['tradeattach']['tmp_name'][0])) { $_FILES['attach'] = array_merge_recursive($_FILES['attach'], $_FILES['tradeattach']); $deleteaid[] = $tradeaid; } $pattachment = ($allowpostattach && $attachments = attach_upload()) ? 1 : 0; $uattachment = ($allowpostattach && $uattachments = attach_upload('attachupdate')) ? 1 : 0; $query = $db->query("SELECT aid, readperm, price, attachment, description, thumb, remote FROM {$tablepre}attachments WHERE pid='$pid'"); $attachdescnew = is_array($attachdescnew) ? $attachdescnew : array(); $attachpermnew = is_array($attachpermnew) ? $attachpermnew : array(); $attachpricenew = is_array($attachpricenew) ? $attachpricenew : array(); while($attach = $db->fetch_array($query)) { $attachpermnew[$attach['aid']] = intval($attachpermnew[$attach['aid']]); $attachpermadd = $allowsetattachperm && $attach['readperm'] != $attachpermnew[$attach['aid']] ? ", readperm='{$attachpermnew[$attach['aid']]}'" : '' ; $attachpricenew[$attach['aid']] = intval($attachpricenew[$attach['aid']]); $attachpriceadd = $maxprice && $attach['price'] != $attachpricenew[$attach['aid']] && $attachpricenew[$attach['aid']] <= $maxprice ? ", price='{$attachpricenew[$attach['aid']]}'" : '' ; $attachdescnew[$attach['aid']] = cutstr(dhtmlspecialchars($attachdescnew[$attach['aid']]), 100); $attachdescadd = $attach['description'] != $attachdescnew[$attach['aid']] ? 1 : 0; if($uattachment || $attachpermadd || $attachdescadd || $attachpriceadd) { $paid = 'paid'.$attach['aid']; $attachfileadd = ''; if($uattachment && isset($uattachments[$paid])) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); $attachfileadd = ', dateline=\''.$timestamp.'\', filename=\''.$uattachments[$paid]['name'].'\', filetype=\''.$uattachments[$paid]['type'].'\', filesize=\''.$uattachments[$paid]['size'].'\', attachment=\''.$uattachments[$paid]['attachment'].'\', thumb=\''.$uattachments[$paid]['thumb'].'\', isimage=\''.$uattachments[$paid]['isimage'].'\', remote=\''.$uattachments[$paid]['remote'].'\', width=\''.$uattachments[$paid]['width'].'\''; unset($uattachments[$paid]); } $db->query("UPDATE {$tablepre}attachments SET description='{$attachdescnew[$attach['aid']]}' $attachpermadd $attachpriceadd $attachfileadd WHERE aid='$attach[aid]'"); } } if($uattachment && !empty($uattachments)) { foreach($uattachments as $attach) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } } if(!empty($deleteaid) || $pattachment) { if(!empty($deleteaid) && is_array($deleteaid)) { $deleteaids = '\''.implode("','", $deleteaid).'\''; $query = $db->query("SELECT aid, attachment, thumb, remote FROM {$tablepre}attachments WHERE aid IN ($deleteaids) AND pid='$pid'"); while($attach = $db->fetch_array($query)) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } $db->query("DELETE FROM {$tablepre}attachments WHERE aid IN ($deleteaids) AND pid='$pid'"); updatecredits($orig['authorid'], $postattachcredits, -($db->affected_rows())); } if($pattachment) { $searcharray = $pregarray = $replacearray = array(); foreach($attachments as $key => $attach) { $db->query("INSERT INTO {$tablepre}attachments (tid, pid, dateline, readperm, price, filename, description, filetype, filesize, attachment, downloads, isimage, uid, thumb, remote, width) VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach[description]', '$attach[type]', '$attach[size]', '$attach[attachment]', '0', '$attach[isimage]', '$attach[uid]', '$attach[thumb]', '$attach[remote]', '$attach[width]')"); $searcharray[] = '[local]'.$localid[$key].'[/local]'; $pregarray[] = '/\[localimg=(\d{1,3}),(\d{1,3})\]'.$localid[$key].'\[\/localimg\]/is'; $insertid = $db->insert_id(); $replacearray[] = '[attach]'.$insertid.'[/attach]'; } if($special == 2 && !empty($_FILES['tradeattach']['tmp_name'][0])) { $tradeaid = $insertid; } $message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message)); updatecredits($orig['authorid'], $postattachcredits, count($attachments)); } else { $pattachment = $db->result_first("SELECT aid FROM {$tablepre}attachments WHERE pid='$pid' LIMIT 1") ? 1 : 0; } $tattachment = $db->result_first("SELECT count(*) FROM {$tablepre}posts p, {$tablepre}attachments a WHERE a.tid='$tid' AND a.isimage='1' AND a.pid=p.pid AND p.invisible='0' LIMIT 1") ? 2 : ($db->result_first("SELECT count(*) FROM {$tablepre}posts p, {$tablepre}attachments a WHERE a.tid='$tid' AND a.pid=p.pid AND p.invisible='0' LIMIT 1") ? 1 : 0); $db->query("UPDATE {$tablepre}threads SET attachment='$tattachment' WHERE tid='$tid'"); } if($swfupload) { updateswfattach(); } if($special == 2 && $allowposttrade) { $oldtypeid = $db->result_first("SELECT typeid FROM {$tablepre}trades WHERE pid='$pid'"); $oldtypeid = isset($tradetypes[$oldtypeid]) ? $oldtypeid : 0; $tradetypeid = !$tradetypeid ? $oldtypeid : $tradetypeid; $optiondata = array(); threadsort_checkoption($oldtypeid, 1); $optiondata = array(); if($tradetypes && $typeoption && is_array($typeoption) && $checkoption) { $optiondata = threadsort_validator($typeoption); } if($tradetypes && $optiondata && is_array($optiondata)) { foreach($optiondata as $optionid => $value) { if($oldtypeid) { $db->query("UPDATE {$tablepre}tradeoptionvars SET value='$value' WHERE pid='$pid' AND optionid='$optionid'"); } else { $db->query("INSERT INTO {$tablepre}tradeoptionvars (sortid, pid, optionid, value) VALUES ('$tradetypeid', '$pid', '$optionid', '$value')"); } } } if(!$oldtypeid) { $db->query("UPDATE {$tablepre}trades SET typeid='$tradetypeid' WHERE pid='$pid'"); } $query = $db->query("SELECT * FROM {$tablepre}trades WHERE tid='$tid' AND pid='$pid'"); if($db->num_rows($query)) { $seller = dhtmlspecialchars(trim($seller)); $item_name = dhtmlspecialchars(trim($item_name)); $item_price = floatval($item_price); $item_locus = dhtmlspecialchars(trim($item_locus)); $item_number = intval($item_number); $item_quality = intval($item_quality); $item_transport = intval($item_transport); $postage_mail = intval($postage_mail); $postage_express = intval(trim($postage_express)); $postage_ems = intval($postage_ems); $item_type = intval($item_type); $item_costprice = floatval($item_costprice); if(!$item_name) { showmessage('trade_please_name'); } elseif($maxtradeprice && ($mintradeprice > $item_price || $maxtradeprice < $item_price)) { showmessage('trade_price_between'); } elseif(!$maxtradeprice && $mintradeprice > $item_price) { showmessage('trade_price_more_than'); } elseif($item_number < 0) { showmessage('tread_please_number'); } $expiration = $item_expiration ? @strtotime($item_expiration) : 0; $closed = $expiration > 0 && @strtotime($item_expiration) < $timestamp ? 1 : $closed; switch($transport) { case 'seller':$item_transport = 1;break; case 'buyer':$item_transport = 2;break; case 'virtual':$item_transport = 3;break; case 'logistics':$item_transport = 4;break; } $tradeaidadd = $special == 2 && !empty($_FILES['tradeattach']['tmp_name'][0]) ? "aid='$tradeaid'," : ''; $db->query("UPDATE {$tablepre}trades SET $tradeaidadd account='$seller', subject='$item_name', price='$item_price', amount='$item_number', quality='$item_quality', locus='$item_locus', transport='$item_transport', ordinaryfee='$postage_mail', expressfee='$postage_express', emsfee='$postage_ems', itemtype='$item_type', expiration='$expiration', closed='$closed', costprice='$item_costprice' WHERE tid='$tid' AND pid='$pid'", 'UNBUFFERED'); if(!empty($infloat)) { $viewpid = $db->result_first("SELECT pid FROM {$tablepre}posts WHERE tid='$tid' AND first='1' LIMIT 1"); $redirecturl = "viewthread.php?tid=$tid&viewpid=$viewpid#pid$viewpid"; } else { $redirecturl = "viewthread.php?do=tradeinfo&tid=$tid&pid=$pid"; } } } $feed = array(); if($special == 6 && $allowpostvideo) { $videoAccount = new VideoClient_VideoService($appid, $siteid, $sitekey); if($vid && $isfirstpost) { if(empty($vsubject) || empty($vtag)) { showmessage('video_required_invalid'); } $vid = dhtmlspecialchars($vid); $vsubject = dhtmlspecialchars($vsubject); $vclass = intval($vclass); $visup = intval($visup); $vlength = intval($vlength); $vautoplay = $vautoplay ? intval($vautoplay) : 2; $vshare = $vshare ? intval($vshare) : 1; $videoAccount = new VideoClient_VideoService($appid, $siteid, $sitekey); $result = $videoAccount->upload($vid, $tid, $visup, insenz_convert($vsubject, 1), insenz_convert($vtag, 1), '', $vclass, $vautoplay, $vshare); $query = $db->query("INSERT INTO {$tablepre}videos (vid, tid, uid, dateline, vthumb, vtitle, vclass, vtime, visup, vautoplay) VALUES ('$vid', '$tid', '$discuz_uid', '$timestamp', '', '$vsubject', '$vclass', '$vlength', '$visup', '$vautoplay')", 'SILENT'); if($customaddfeed & 4) { $feed['icon'] = 'video'; $feed['title_template'] = 'feed_thread_video_title'; $feed['body_template'] = 'feed_thread_video_message'; $feed['body_data'] = array( 'subject'=> "<a href=\"{$boardurl}viewthread.php?tid=$tid&vid=$vid&autoplay=1\">$vsubject</a>", 'play' => "<a href=\"{$boardurl}viewthread.php?tid=$tid&vid=$vid&autoplay=1\" class=\"playbutton\">Play</a>", 'message' => cutstr(strip_tags(preg_replace(array("/\[hide=?\d*\].+?\[\/hide\]/is", "/\[.+?\]/is"), array('', ''), $message)), 150), 'vlength'=> sprintf("%02d", intval($vlength / 60)).':'.sprintf("%02d", intval($vlength % 60)), ); $feed['images'][] = array('url' => VideoClient_Util::getThumbUrl($vid, 'small'), 'link' => "{$boardurl}viewthread.php?tid=$tid"); postfeed($feed); } } if($deletevideo && is_array($deletevideo)) { $toapivideo = array(); foreach($deletevideo as $videoid) { $toapivideo[] = array('videoid' => $videoid); } $query = $db->query("DELETE FROM {$tablepre}videos WHERE vid IN (".implodeids($deletevideo).")"); $videoAccount->removeMulti($toapivideo); } if(is_array($displayorder) && is_array($vtitle)) { foreach($displayorder as $vid => $val) { $db->query("UPDATE {$tablepre}videos SET displayorder='$displayorder[$vid]', vtitle='$vtitle[$vid]' WHERE vid='$vid'"); } } $thread['author'] = addslashes($thread['author']); $db->query("UPDATE {$tablepre}threads SET lastposter='$thread[author]', lastpost='$timestamp' WHERE tid='$tid'", 'UNBUFFERED'); $lastpost = "$thread[tid]\t".addslashes($thread['subject'])."\t$timestamp\t$thread[author]"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); } } if($auditstatuson && $audit == 1) { updatepostcredits('+', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits)); updatemodworks('MOD', 1); updatemodlog($tid, 'MOD'); } $message = preg_replace('/\[attachimg\](\d+)\[\/attachimg\]/is', '[attach]\1[/attach]', $message); $db->query("UPDATE {$tablepre}posts SET message='$message', usesig='$usesig', htmlon='$htmlon', bbcodeoff='$bbcodeoff', parseurloff='$parseurloff', smileyoff='$smileyoff', subject='$subject' ".($pattachment ? ", attachment='1'" : '')." $anonymousadd ".($auditstatuson && $audit == 1 ? ",invisible='0'" : '')." WHERE pid='$pid'"); $forum['lastpost'] = explode("\t", $forum['lastpost']); if($orig['dateline'] == $forum['lastpost'][2] && ($orig['author'] == $forum['lastpost'][3] || ($forum['lastpost'][3] == '' && $orig['anonymous']))) { $lastpost = "$tid\t".($isfirstpost ? $subject : addslashes($thread['subject']))."\t$orig[dateline]\t".($isanonymous ? '' : addslashes($orig['author'])); $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$fid'", 'UNBUFFERED'); } if($thread['lastpost'] == $orig['dateline'] && ((!$orig['anonymous'] && $thread['lastposter'] == $orig['author']) || ($orig['anonymous'] && $thread['lastposter'] == '')) && $orig['anonymous'] != $isanonymous) { $db->query("UPDATE {$tablepre}threads SET lastposter='".($isanonymous ? '' : addslashes($orig['author']))."' WHERE tid='$tid'", 'UNBUFFERED'); } if(!$isorigauthor) { updatemodworks('EDT', 1); require_once DISCUZ_ROOT.'./include/misc.func.php'; modlog($thread, 'EDT'); } } else { if($isfirstpost && $thread['replies'] > 0) { showmessage(($thread['special'] == 3 ? 'post_edit_reward_already_reply' : 'post_edit_thread_already_reply'), NULL, 'HALTED'); } if($thread['special'] == 3) { if($thread['price'] < 0 && ($thread['dateline'] + 1 == $orig['dateline'])) { showmessage('post_edit_reward_nopermission', NULL, 'HALTED'); } } elseif($thread['special'] == 6 && $isfirstpost && $videoopen) { videodelete($tid); } updatepostcredits('-', $orig['authorid'], ($isfirstpost ? $postcredits : $replycredits)); if($thread['special'] == 3 && $isfirstpost) { $db->query("UPDATE {$tablepre}members SET extcredits$creditstransextra[2]=extcredits$creditstransextra[2]+$thread[price] WHERE uid='$orig[authorid]'", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}rewardlog WHERE tid='$tid'", 'UNBUFFERED'); } $thread_attachment = $post_attachment = 0; $query = $db->query("SELECT pid, attachment, thumb, remote FROM {$tablepre}attachments WHERE tid='$tid'"); while($attach = $db->fetch_array($query)) { if($attach['pid'] == $pid) { $post_attachment ++; dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } else { $thread_attachment = 1; } } if($post_attachment) { $db->query("DELETE FROM {$tablepre}attachments WHERE pid='$pid'", 'UNBUFFEREED'); updatecredits($orig['authorid'], $postattachcredits, -($post_attachment)); } $db->query("DELETE FROM {$tablepre}posts WHERE pid='$pid'"); if($thread['special'] == 2) { $db->query("DELETE FROM {$tablepre}trades WHERE pid='$pid'"); } if($isfirstpost) { $forumadd = 'threads=threads-\'1\', posts=posts-\'1\''; $tablearray = array('threadsmod','relatedthreads','threads','debates','debateposts','polloptions','polls','mythreads','typeoptionvars'); foreach ($tablearray as $table) { $db->query("DELETE FROM {$tablepre}$table WHERE tid='$tid'", 'UNBUFFERED'); } if($globalstick && in_array($thread['displayorder'], array(2, 3))) { require_once DISCUZ_ROOT.'./include/cache.func.php'; updatecache('globalstick'); } } else { $forumadd = 'posts=posts-\'1\''; $query = $db->query("SELECT author, dateline, anonymous FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline DESC LIMIT 1"); $lastpost = $db->fetch_array($query); $lastpost['author'] = !$lastpost['anonymous'] ? addslashes($lastpost['author']) : ''; $db->query("UPDATE {$tablepre}threads SET replies=replies-'1', attachment='$thread_attachment', lastposter='$lastpost[author]', lastpost='$lastpost[dateline]' WHERE tid='$tid'", 'UNBUFFERED'); } $forum['lastpost'] = explode("\t", $forum['lastpost']); if($orig['dateline'] == $forum['lastpost'][2] && ($orig['author'] == $forum['lastpost'][3] || ($forum['lastpost'][3] == '' && $orig['anonymous']))) { $lastthread = daddslashes($db->fetch_first("SELECT tid, subject, lastpost, lastposter FROM {$tablepre}threads WHERE fid='$fid' AND displayorder>='0' ORDER BY lastpost DESC LIMIT 1"), 1); $forumadd .= ", lastpost='$lastthread[tid]\t$lastthread[subject]\t$lastthread[lastpost]\t$lastthread[lastposter]'"; } $db->query("UPDATE {$tablepre}forums SET $forumadd WHERE fid='$fid'", 'UNBUFFERED'); } // debug: update thread caches ? if($forum['threadcaches']) { if($isfirstpost || $page == 1 || $thread['replies'] < $_DCACHE['pospperpage'] || !empty($delete)) { $forum['threadcaches'] && deletethreadcaches($tid); } else { if($db->result_first("SELECT COUNT(*) FROM {$tablepre}posts WHERE tid='$tid' AND pid<'$pid'") < $_DCACHE['settings']['postperpage']) { $forum['threadcaches'] && deletethreadcaches($tid); } } } if($auditstatuson) { if($audit == 1) { showmessage('auditstatuson_succeed', $redirecturl); } else { showmessage('audit_edit_succeed'); } } else { if(!empty($delete) && $isfirstpost) { showmessage('post_edit_delete_succeed', "forumdisplay.php?fid=$fid"); } elseif(!empty($delete)) { showmessage('post_edit_delete_succeed', "viewthread.php?tid=$tid&page=$page&extra=$extra".($vid && $isfirstpost ? "&vid=$vid" : '')); } else { showmessage('post_edit_succeed', $redirecturl); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/editpost.inc.php
PHP
asf20
40,726
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: insenz.func.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } define('INSENZ_VERSION', '1.1'); function insenz_authcode($string, $operation, $key = '') { $key = md5($key); $key_length = strlen($key); $string = $operation == 'DECODE' ? base64_decode($string) : substr(md5($string.$key), 0, 8).$string; $string_length = strlen($string); $rndkey = $box = array(); $result = ''; for($i = 0; $i <= 255; $i++) { $rndkey[$i] = ord($key[$i % $key_length]); $box[$i] = $i; } for($j = $i = 0; $i < 256; $i++) { $j = ($j + $box[$i] + $rndkey[$i]) % 256; $tmp = $box[$i]; $box[$i] = $box[$j]; $box[$j] = $tmp; } for($a = $j = $i = 0; $i < $string_length; $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $tmp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $tmp; $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); } if($operation == 'DECODE') { if(substr($result, 0, 8) == substr(md5(substr($result, 8).$key), 0, 8)) { return substr($result, 8); } else { return ''; } } else { return str_replace('=', '', base64_encode($result)); } } function insenz_convert($str, $type = 1) { global $charset, $discuz_chs, $insenz_chs; if($charset != 'utf-8') { require_once DISCUZ_ROOT.'./include/chinese.class.php'; if($type) { if(!$insenz_chs) { $insenz_chs = new Chinese($charset, 'utf-8', TRUE); } $str = $insenz_chs->convert($str); } else { if(!$discuz_chs) { $discuz_chs = new Chinese('utf-8', $charset, TRUE); } $str = $discuz_chs->convert($str); } } return $type ? htmlspecialchars($str) : addslashes($str); } function insenz_respond($data, $status = 1, $force = 0) { global $insenz, $timestamp; @include_once DISCUZ_ROOT.'./discuz_version.php'; $authkey = !empty($insenz['authkey']) && !$force ? $insenz['authkey'] : 'Discuz!INSENZ'; $t_hex = sprintf("%08x", $timestamp); $postdata = '<?xml version="1.0" encoding="UTF'.'-8"?>'. '<response insenz_version="'.INSENZ_VERSION.'" discuz_version="'.DISCUZ_VERSION.' - '.DISCUZ_RELEASE.'">'. ($status ? "<status>1</status><reason>$data</reason>" : $data). '</response>'; echo insenz_authcode($t_hex.md5($authkey.$postdata.$t_hex).$postdata, 'ENCODE', $authkey); exit; } function insenz_cronnextrun($cronnextrun) { global $_DCACHE; if(empty($_DCACHE['settings']['insenz']['cronnextrun']) || $cronnextrun < $_DCACHE['settings']['insenz']['cronnextrun']) { require_once DISCUZ_ROOT.'./include/cache.func.php'; $_DCACHE['settings']['insenz']['cronnextrun'] = $cronnextrun; updatesettings(); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/insenz.func.php
PHP
asf20
2,847
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: request.func.php 17526 2009-01-12 08:06:52Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } function parse_request($requestdata, $cachefile, $mode, $specialfid = 0, $key = '') { global $_DCACHE; $requesttemplate = ''; $nocachedata = array(); $requestcachelife = (isset($requestdata['cachelife']) && $requestdata['cachelife'] !== '') ? $requestdata['cachelife'] : (isset($_DCACHE['settings']['jscachelife']) ? $_DCACHE['settings']['jscachelife'] : 1800); !empty($requestdata['jstemplate']) && $requesttemplate = stripslashes($requestdata['jstemplate']); get_magic_quotes_gpc() && $requesttemplate = stripslashes($requesttemplate); $nocache = !empty($requestdata['nocache']) ? 1 : 0; $mode && $requestcharset = $requestdata['jscharset']; if(!in_array($requestdata['function'], array('custom', 'side'))) { $requesttemplatebody = ''; if(preg_match("/\[node\](.+?)\[\/node\]/is", $requesttemplate, $node)) { $requesttemplatebody = $requesttemplate; $requesttemplate = $node[1]; } $parsedata = updaterequest($requestdata, $requesttemplatebody, $requesttemplate, $specialfid, $mode, $key, $nocache); if($mode) { $datalist = $writedata = jsprocdata($parsedata, $requestcharset); } else { $datalist = $writedata = $parsedata; } } else { $requestcachelife = (isset($requestdata['cachelife']) && $requestdata['cachelife'] != '') ? $requestdata['cachelife'] : (isset($_DCACHE['settings']['jscachelife']) ? $_DCACHE['settings']['jscachelife'] : 1800); $writedata = preg_match_all("/\[module\](.+?)\[\/module\]/s", $requesttemplate, $modulelist); $modulelist = array_unique($modulelist[1]); $datalist = $writedata = $requesttemplate = str_replace('\"', '"', $requesttemplate); foreach($modulelist as $key) { $find = '[module]'.$key.'[/module]'; if(!empty($_DCACHE['request'][$key]['url'])) { parse_str($_DCACHE['request'][$key]['url'], $requestdata); $function = isset($requestdata['function']) ? $requestdata['function'] : NULL; $requesttemplate = $requestdata['jstemplate']; !empty($requesttemplate) && $requesttemplate = stripslashes($requesttemplate); get_magic_quotes_gpc() && $requesttemplate = stripslashes($requesttemplate); $requesttemplatebody = ''; if(preg_match("/\[node\](.+?)\[\/node\]/is", $requesttemplate, $node)) { $requesttemplatebody = $requesttemplate; $requesttemplate = $node[1]; } $modulenocache = 0; $parsedata = updaterequest($requestdata, $requesttemplatebody, $requesttemplate, $specialfid, $mode, $key, $modulenocache); $datalist = str_replace($find, $parsedata, $datalist); if($modulenocache || $requestdata['cachelife'] === '0') { $nocachedata[$key] = '[module]'.$key.'[/module]'; $writedata = str_replace($find, $nocachedata[$key], $writedata); } else { $writedata = str_replace($find, $parsedata, $writedata); } } } if($mode) { $datalist = jsprocdata($datalist, $requestcharset); $writedata = jsprocdata($writedata, $requestcharset); } } $writedata = addcslashes($writedata, "'\\"); if(!$nocache) { $writedata = "\$datalist = '".$writedata."';"; if($nocachedata) { $writedata .= "\n\$nocachedata = ".var_export($nocachedata, 1).';'; } writetorequestcache($cachefile, $requestcachelife, $writedata); } if($mode) { return $datalist; } else { return eval("return '".addcslashes($datalist, "'\\")."';"); } } function updaterequest($requestdata, $requesttemplatebody, $requesttemplate, $specialfid, $mode, $key, &$nocache) { global $db, $tablepre, $timestamp, $boardurl, $dateformat, $timeformat, $rewritestatus, $uc, $_DCACHE; $function = $requestdata['function']; $fids = isset($requestdata['fids']) ? $requestdata['fids'] : NULL; $startrow = isset($requestdata['startrow']) ? intval($requestdata['startrow']) : 0; $items = isset($requestdata['items']) ? intval($requestdata['items']) : 10; $digest = isset($requestdata['digest']) ? intval($requestdata['digest']) : 0; $stick = isset($requestdata['stick']) ? intval($requestdata['stick']) : 0; $newwindow = isset($requestdata['newwindow']) ? $requestdata['newwindow'] : 1; $LinkTarget = $newwindow == 1 ? " target='_blank'" : ($newwindow == 2 ? " target='main'" : NULL); $sidestatus = !empty($requestdata['sidestatus']) ? 1 : 0; $boardurl = empty($requestdata['boardurl']) ? ($mode ? $boardurl : '') : $requestdata['boardurl'].'/'; if($function == 'threads') { $orderby = isset($requestdata['orderby']) ? (in_array($requestdata['orderby'],array('lastpost','dateline','replies','views','hourviews','todayviews','weekviews','monthviews')) ? $requestdata['orderby'] : 'lastpost') : 'lastpost'; $hours = isset($requestdata['hours']) ? intval($requestdata['hours']) : 0; $highlight = isset($requestdata['highlight']) ? $requestdata['highlight'] : 0; $picpre = isset($requestdata['picpre']) ? urldecode($requestdata['picpre']) : NULL; $maxlength = !empty($requestdata['maxlength']) ? intval($requestdata['maxlength']) : 50; $fnamelength = isset($requestdata['fnamelength']) ? intval($requestdata['fnamelength']) : 0; $recommend = !empty($requestdata['recommend']) ? 1 : 0; $tids = isset($requestdata['tids']) ? $requestdata['tids'] : NULL; $keyword = !empty($requestdata['keyword']) ? $requestdata['keyword'] : NULL; $typeids = isset($requestdata['typeids']) ? $requestdata['typeids'] : NULL; $sortids = isset($requestdata['sortids']) ? $requestdata['sortids'] : NULL; $special = isset($requestdata['special']) ? intval($requestdata['special']) : 0; $rewardstatus = isset($requestdata['rewardstatus']) ? intval($requestdata['rewardstatus']) : 0; $threadtype = isset($requestdata['threadtype']) ? intval($requestdata['threadtype']) : 0; $threadsort = isset($requestdata['threadsort']) ? intval($requestdata['threadsort']) : 0; $tag = !empty($requestdata['tag']) ? trim($requestdata['tag']) : NULL; $messagelength = !empty($requestdata['messagelength']) ? intval($requestdata['messagelength']) : 255; require DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; $datalist = array(); $threadtypeids = array(); if($keyword) { if(preg_match("(AND|\+|&|\s)", $keyword) && !preg_match("(OR|\|)", $keyword)) { $andor = ' AND '; $keywordsrch = '1'; $keyword = preg_replace("/( AND |&| )/is", "+", $keyword); } else { $andor = ' OR '; $keywordsrch = '0'; $keyword = preg_replace("/( OR |\|)/is", "+", $keyword); } $keyword = str_replace('*', '%', addcslashes($keyword, '%_')); foreach(explode('+', $keyword) as $text) { $text = trim($text); if($text) { $keywordsrch .= $andor; $keywordsrch .= "t.subject LIKE '%$text%'"; } } $keyword = " AND ($keywordsrch)"; } else { $keyword = ''; } $sql = ($specialfid && $sidestatus ? ' AND t.fid = '.$specialfid : ($fids ? ' AND t.fid IN (\''.str_replace('_', '\',\'', $fids).'\')' : '')) .$keyword .($tids ? ' AND t.tid IN (\''.str_replace('_', '\',\'', $tids).'\')' : '') .($typeids ? ' AND t.typeid IN (\''.str_replace('_', '\',\'', $typeids).'\')' : '') .($sortids ? ' AND t.sortid IN (\''.str_replace('_', '\',\'', $sortids).'\')' : '') .(($special >= 0 && $special < 127) ? threadrange($special, 'special', 7) : '') .((($special & 16) && $rewardstatus) ? ($rewardstatus == 1 ? ' AND t.price < 0' : ' AND t.price > 0') : '') .(($digest > 0 && $digest < 15) ? threadrange($digest, 'digest') : '') .(($stick > 0 && $stick < 15) ? threadrange($stick, 'displayorder') : ''); if(in_array($orderby, array('hourviews','todayviews','weekviews','monthviews'))) { $historytime = 0; switch($orderby) { case 'hourviews': $historytime = $timestamp - 3600 * $hours; break; case 'todayviews': $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp)); break; case 'weekviews': $week = gmdate('w', $timestamp) - 1; $week = $week != -1 ? $week : 6; $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp) - $week, date('Y', $timestamp)); break; case 'monthviews': $historytime = mktime(0, 0, 0, date('m', $timestamp), 1, date('Y', $timestamp)); break; } $sql .= ' AND t.dateline>='.$historytime; $orderby = 'views'; } $sqlfrom = strexists($requesttemplate, '{message}') ? ",p.message FROM `{$tablepre}threads` t LEFT JOIN `{$tablepre}posts` p ON p.tid=t.tid AND p.first='1'" : "FROM `{$tablepre}threads` t"; if(strexists($requesttemplate, '{imgattach}')) { $sqlfrom = ",a.remote,a.attachment,a.thumb $sqlfrom INNER JOIN `{$tablepre}attachments` a ON a.tid=t.tid"; $sql .= " AND a.isimage='1' AND a.readperm='0' AND a.price='0'"; $attachadd .= "GROUP BY a.tid"; $attachurl = $_DCACHE['settings']['attachurl']; $attachurl = preg_match("/^((https?|ftps?):\/\/|www\.)/i", $attachurl) ? $attachurl : $boardurl.$attachurl; } if($recommend) { $sqlfrom .= " INNER JOIN `{$tablepre}forumrecommend` fc ON fc.tid=t.tid"; } if($tag) { $tags = explode(' ', $tag); foreach($tags as $tagk => $tagv) { if(!preg_match('/^([\x7f-\xff_-]|\w){3,20}$/', $tagv)) { unset($tags[$tagk]); } } if($tags = implode("','", $tags)) { $sqlfrom .= " INNER JOIN `{$tablepre}threadtags` tag ON tag.tid=t.tid AND tag.tagname IN ('$tags')"; } } $query = $db->query("SELECT t.tid,t.fid,t.readperm,t.author,t.authorid,t.subject,t.dateline,t.lastpost,t.lastposter,t.views,t.replies,t.highlight,t.digest,t.typeid,t.sortid $sqlfrom WHERE t.readperm='0' $sql AND t.displayorder>='0' AND t.fid>'0' $attachadd ORDER BY t.$orderby DESC LIMIT $startrow,$items;" ); while($data = $db->fetch_array($query)) { $datalist[$data['tid']]['fid'] = $data['fid']; $datalist[$data['tid']]['fname'] = isset($_DCACHE['forums'][$data['fid']]['name']) ? str_replace('\\\'', '&#39;', addslashes($_DCACHE['forums'][$data['fid']]['name'])) : NULL; $datalist[$data['tid']]['fnamelength'] = strlen($datalist[$data['tid']]['fname']); $datalist[$data['tid']]['subject'] = isset($data['subject']) ? str_replace('\\\'', '&#39;', addslashes($data['subject'])) : NULL; $datalist[$data['tid']]['dateline'] = gmdate("$dateformat $timeformat",$data['dateline'] + $_DCACHE['settings']['timeoffset'] * 3600); $datalist[$data['tid']]['lastpost'] = gmdate("$dateformat $timeformat",$data['lastpost'] + $_DCACHE['settings']['timeoffset'] * 3600); $datalist[$data['tid']]['lastposter'] = $data['lastposter']; $datalist[$data['tid']]['authorid'] = $data['authorid']; $datalist[$data['tid']]['views'] = $data['views']; $datalist[$data['tid']]['replies'] = $data['replies']; $datalist[$data['tid']]['highlight'] = $data['highlight']; $datalist[$data['tid']]['message'] = cutmessage($data['message'], $messagelength); $datalist[$data['tid']]['imgattach'] = ($data['remote'] ? $_DCACHE['settings']['ftp']['attachurl'] : $attachurl)."/$data[attachment]".($_DCACHE['settings']['thumbstatus'] && $data['thumb'] ? '.thumb.jpg' : ''); if($data['author']) { $datalist[$data['tid']]['author'] = $data['author']; } else { $datalist[$data['tid']]['author'] = 'Anonymous'; $datalist[$data['tid']]['authorid'] = 0; } if($data['lastposter']) { $datalist[$data['tid']]['lastposter'] = $data['lastposter']; } else { $datalist[$data['tid']]['lastposter'] = ''; } $datalist[$data['tid']]['typeid'] = $data['typeid']; $datalist[$data['tid']]['sortid'] = $data['sortid']; $datalist[$data['tid']]['subjectprefix'] = ''; $threadtypeids[] = $data['typeid']; $threadtypeids[] = $data['sortid']; } if(($threadsort || $threadtype) && $threadtypeids) { $typelist = array(); $query = $db->query("SELECT typeid, name FROM {$tablepre}threadtypes WHERE typeid IN ('".implode('\',\'', $threadtypeids)."')"); while($typearray = $db->fetch_array($query)) { $typelist[$typearray['typeid']] = $typearray['name']; } foreach($datalist AS $tid=>$value) { $subjectprefix = ''; if($threadsort && $value['sortid'] && isset($typelist[$value['sortid']])) { $subjectprefix .= '['.$typelist[$value['sortid']].']'; } if($threadtype && $value['typeid'] && isset($typelist[$value['typeid']])) { $subjectprefix .= '['.$typelist[$value['typeid']].']'; } $datalist[$tid]['subjectprefix'] = $subjectprefix; } } $writedata = ''; if(is_array($datalist)) { $colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282'); $prefix = $picpre ? "<img src='$picpre' border='0' align='absmiddle'>" : NULL; $requesttemplate = !$requesttemplate ? '{prefix} {subject}<br />' : $requesttemplate; $order = 1; foreach($datalist AS $tid=>$value) { $SubjectStyles = ''; if($highlight && $value['highlight']) { $string = sprintf('%02d', $value['highlight']); $stylestr = sprintf('%03b', $string[0]); $SubjectStyles .= " style='"; $SubjectStyles .= $stylestr[0] ? 'font-weight: bold;' : NULL; $SubjectStyles .= $stylestr[1] ? 'font-style: italic;' : NULL; $SubjectStyles .= $stylestr[2] ? 'text-decoration: underline;' : NULL; $SubjectStyles .= $string[1] ? 'color: '.$colorarray[$string[1]] : NULL; $SubjectStyles .= "'"; } $replace['{link}'] = $boardurl."viewthread.php?tid=$tid"; $value['prefixlength'] = $value['subjectprefix'] ? strlen(strip_tags($value['subjectprefix'])) : 0; $value['maxlength'] = $maxlength - $value['prefixlength']; $replace['{subject_nolink}'] = $value['subjectprefix'].cutstr($value['subject'],($fnamelength ? ($value['maxlength'] - $value['fnamelength']) : $value['maxlength']), ''); $replace['{subject_full}'] = $value['subjectprefix'].$value['subject']; $replace['{prefix}'] = $prefix; $replace['{forum}'] = "<a href='".$boardurl."forumdisplay.php?fid=$value[fid]'$LinkTarget>$value[fname]</a>"; $replace['{dateline}'] = $value['dateline']; $replace['{subject}'] = "<a href='".$boardurl."viewthread.php?tid=$tid' title='$value[subject]'$SubjectStyles$LinkTarget>".$replace['{subject_nolink}']."</a>"; $replace['{message}'] = $value['message']; if($value['authorid']) { $replace['{author}'] = "<a href='".$boardurl."space.php?uid=$value[authorid]'$LinkTarget>$value[author]</a>"; } else { $replace['{author}'] = $value['author']; } $replace['{author_nolink}'] = $value['author']; if($value['lastposter'] !== '') { $replace['{lastposter}'] = "<a href='".$boardurl."space.php?username=".rawurlencode($value['lastposter'])."'$LinkTarget>$value[lastposter]</a>"; $replace['{lastposter_nolink}'] = $value['lastposter']; } else { $replace['{lastposter}'] = $replace['{lastposter_nolink}'] = 'Anonymous'; } $replace['{lastpost}'] = $value['lastpost']; $replace['{views}'] = $value['views']; $replace['{replies}'] = $value['replies']; $replace['{imgattach}'] = $value['imgattach']; $replace['{order}'] = $order++; $writedata .= nodereplace($replace, $requesttemplate); } } } elseif($function == 'forums') { $fups = isset($requestdata['fups']) ? $requestdata['fups'] : NULL; $orderby = isset($requestdata['orderby']) ? (in_array($requestdata['orderby'],array('displayorder','threads','posts')) ? $requestdata['orderby'] : 'displayorder') : 'displayorder'; $datalist = array(); $query = $db->query("SELECT `fid`,`fup`,`name`,`status`,`threads`,`posts`,`todayposts`,`displayorder`,`type` FROM `{$tablepre}forums` WHERE `type`!='group' ".($fups ? "AND `fup` IN ('".str_replace('_', '\',\'', $fups)."') " : "")." AND `status`='1' ORDER BY ".($orderby == 'displayorder' ? " `displayorder` ASC " : " `$orderby` DESC")." LIMIT $startrow,".($items > 0 ? $items : 65535).";" ); while($data = $db->fetch_array($query)) { $datalist[$data['fid']]['name'] = str_replace('\\\'', '&#39;', addslashes($data['name'])); $datalist[$data['fid']]['threads'] = $data['threads']; $datalist[$data['fid']]['posts'] = $data['posts']; $datalist[$data['fid']]['todayposts'] = $data['todayposts']; } $writedata = ''; if(is_array($datalist)) { $requesttemplate = !$requesttemplate ? '{forumname}<br />' : $requesttemplate; $order = 1; foreach($datalist AS $fid=>$value) { $replace['{link}'] = $boardurl."forumdisplay.php?fid=$fid"; $replace['{forumname_nolink}'] = $value['name']; $replace['{forumname}'] = "<a href='".$boardurl."forumdisplay.php?fid=$fid'$LinkTarget>$value[name]</a>"; $replace['{threads}'] = $value['threads']; $replace['{posts}'] = $value['posts']; $replace['{todayposts}'] = $value['todayposts']; $replace['{order}'] = $order++; $writedata .= nodereplace($replace, $requesttemplate); } } } elseif($function == 'memberrank') { $orderby = isset($requestdata['orderby']) ? (in_array($requestdata['orderby'],array('credits','extcredits','posts','digestposts','regdate','hourposts','todayposts','weekposts','monthposts')) ? $requestdata['orderby'] : 'credits') : 'credits'; $hours = isset($requestdata['hours']) ? intval($requestdata['hours']) : 0; $datalist = array(); switch($orderby) { case 'credits': $sql = "SELECT m.`username`,m.`uid`,m.`credits` FROM `{$tablepre}members` m ORDER BY m.`credits` DESC"; break; case 'extcredits': $requestdata['extcredit'] = intval($requestdata['extcredit']); $sql = "SELECT m.`username`,m.`uid`,m.`extcredits$requestdata[extcredit]` FROM `{$tablepre}members` m ORDER BY m.`extcredits$requestdata[extcredit]` DESC"; break; case 'posts': $sql = "SELECT m.`username`,m.`uid`,m.`posts` FROM `{$tablepre}members` m ORDER BY m.`posts` DESC"; break; case 'digestposts': $sql = "SELECT m.`username`,m.`uid`,m.`digestposts` FROM `{$tablepre}members` m ORDER BY m.`digestposts` DESC"; break; case 'regdate': $sql = "SELECT m.`username`,m.`uid`,m.`regdate` FROM `{$tablepre}members` m ORDER BY m.`regdate` DESC"; break; case 'hourposts'; $historytime = $timestamp - 3600 * intval($hours); $sql = "SELECT DISTINCT(p.author) AS username,p.authorid AS uid,COUNT(p.pid) AS postnum FROM `{$tablepre}posts` p WHERE p.`dateline`>=$historytime AND p.`authorid`!='0' GROUP BY p.`author` ORDER BY `postnum` DESC"; break; case 'todayposts': $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp)); $sql = "SELECT DISTINCT(p.author) AS username,p.authorid AS uid,COUNT(p.pid) AS postnum FROM `{$tablepre}posts` p WHERE p.`dateline`>=$historytime AND p.`authorid`!='0' GROUP BY p.`author` ORDER BY `postnum` DESC"; break; case 'weekposts': $week = gmdate('w', $timestamp) - 1; $week = $week != -1 ? $week : 6; $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp) - $week, date('Y', $timestamp)); $sql = "SELECT DISTINCT(p.author) AS username,p.authorid AS uid,COUNT(p.pid) AS postnum FROM `{$tablepre}posts` p LEFT JOIN `{$tablepre}memberfields` mf ON mf.`uid` = p.`authorid` WHERE p.`dateline`>=$historytime AND p.`authorid`!='0' GROUP BY p.`author` ORDER BY `postnum` DESC"; break; case 'monthposts': $historytime = mktime(0, 0, 0, date('m', $timestamp), 1, date('Y', $timestamp)); $sql = "SELECT DISTINCT(p.author) AS username,p.authorid AS uid,COUNT(p.pid) AS postnum FROM `{$tablepre}posts` p LEFT JOIN `{$tablepre}memberfields` mf ON mf.`uid` = p.`authorid` WHERE p.`dateline`>=$historytime AND p.`authorid`!='0' GROUP BY p.`author` ORDER BY `postnum` DESC"; break; } $query = $db->query($sql." LIMIT $startrow,$items;"); while($data = $db->fetch_array($query,MYSQL_NUM)) { $data[2] = $orderby == 'regdate' ? gmdate($dateformat,$data[2] + $_DCACHE['settings']['timeoffset'] * 3600) : $data[2]; $datalist[] = $data; } $writedata = ''; if(is_array($datalist)) { $requesttemplate = !$requesttemplate ? '{regdate} {member} {value}<br />' : $requesttemplate; $order = 1; foreach($datalist AS $value) { $replace['{regdate}'] = $replace['{value}'] = ''; if($orderby == 'regdate') { $replace['{regdate}'] = $value[2]; } else { $replace['{value}'] = $value[2]; } $replace['{uid}'] = $value[1]; $replace['{member}'] = "<a href='".$boardurl."space.php?uid=$value[1]'$LinkTarget>$value[0]</a>"; $replace['{avatar}'] = "<a title='".htmlspecialchars($value[0])."' href='".$boardurl."space.php?uid=$value[1]'$LinkTarget>".discuz_uc_avatar($value[1])."</a>"; $replace['{avatarsmall}'] = "<a title='".htmlspecialchars($value[0])."' href='".$boardurl."space.php?uid=$value[1]'$LinkTarget>".discuz_uc_avatar($value[1], 'small')."</a>"; $replace['{avatarbig}'] = "<a title='".htmlspecialchars($value[0])."' href='".$boardurl."space.php?uid=$value[1]'$LinkTarget>".discuz_uc_avatar($value[1], 'big')."</a>"; $replace['{order}'] = $order++; $writedata .= nodereplace($replace, $requesttemplate); } } } elseif($function == 'stats') { $info = isset($requestdata['info']) ? $requestdata['info'] : NULL; if(is_array($info)) { $language = $info; $info_index = ''; $statsinfo = array(); $statsinfo['forums'] = $statsinfo['threads'] = $statsinfo['posts'] = 0; $query = $db->query("SELECT `status`,`threads`,`posts` FROM `{$tablepre}forums` WHERE `status`='1'; "); while($forumlist = $db->fetch_array($query)) { $statsinfo['forums']++; $statsinfo['threads'] += $forumlist['threads']; $statsinfo['posts'] += $forumlist['posts']; } unset($info['forums'],$info['threads'],$info['posts']); foreach($info AS $index=>$value) { if($index == 'members') { $sql = "SELECT COUNT(*) FROM `{$tablepre}members`;"; } elseif($index == 'online') { $sql = "SELECT COUNT(*) FROM `{$tablepre}sessions`;"; } elseif($index == 'onlinemembers') { $sql = "SELECT COUNT(*) FROM `{$tablepre}sessions` WHERE `uid`>'0';"; } if($index == 'members' || $index == 'online' || $index == 'onlinemembers') { $statsinfo[$index] = $db->result_first($sql); } } unset($index, $value); $writedata = ''; $requesttemplate = !$requesttemplate ? '{name} {value}<br />' : $requesttemplate; foreach($language AS $index=>$value) { $replace['{name}'] = $value; $replace['{value}'] = $statsinfo[$index]; $writedata .= str_replace(array_keys($replace), $replace, $requesttemplate); } } } elseif($function == 'images') { $maxwidth = isset($requestdata['maxwidth']) ? $requestdata['maxwidth'] : 0; $maxheight = isset($requestdata['maxheight']) ? $requestdata['maxheight'] : 0; require DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; $datalist = array(); $sql = ($specialfid && $sidestatus ? ' AND t.fid = '.$specialfid : ($fids ? ' AND t.fid IN (\''.str_replace('_', '\',\'', $fids).'\')' : '')) .(($digest > 0 && $digest < 15) ? threadrange($digest, 'digest') : ''); $imagesql = "AND `attach`.`isimage`".(!empty($requestdata['isimage']) ? ($requestdata['isimage'] == 1 ? "='1'" : ($requestdata['isimage'] == 2 ? "='0'" : ">='0'")) : ">='0'"); $methodsql = !empty($requestdata['threadmethod']) ? 'GROUP BY `attach`.`tid`' : ''; $hours = isset($requestdata['hours']) ? intval($requestdata['hours']) : 0; $orderby = isset($requestdata['orderby']) ? (in_array($requestdata['orderby'],array('dateline','downloads','hourdownloads','todaydownloads','weekdownloads','monthdownloads')) ? $requestdata['orderby'] : 'dateline') : 'dateline'; $orderbysql = $historytime = ''; switch($orderby) { case 'dateline': $orderbysql = "ORDER BY `attach`.`dateline` DESC"; break; case 'downloads': $orderbysql = "ORDER BY `attach`.`downloads` DESC"; break; case 'hourdownloads'; $historytime = $timestamp - 3600 * intval($hours); $orderbysql = "ORDER BY `attach`.`downloads` DESC"; break; case 'todaydownloads': $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp), date('Y', $timestamp)); $orderbysql = "ORDER BY `attach`.`downloads` DESC"; break; case 'weekdownloads': $week = gmdate('w', $timestamp) - 1; $week = $week != -1 ? $week : 6; $historytime = mktime(0, 0, 0, date('m', $timestamp), date('d', $timestamp) - $week, date('Y', $timestamp)); $orderbysql = "ORDER BY `attach`.`downloads` DESC"; break; case 'monthdownloads': $historytime = mktime(0, 0, 0, date('m', $timestamp), 1, date('Y', $timestamp)); $orderbysql = "ORDER BY `attach`.`downloads` DESC"; break; } $historytime = !$historytime ? $timestamp - 2592000 : $historytime; $htsql = "`attach`.`dateline`>=$historytime"; $query = $db->query("SELECT attach.*,t.tid,t.fid,t.digest,t.author,t.subject,t.displayorder FROM `{$tablepre}attachments` attach INNER JOIN `{$tablepre}threads` t ON `t`.`tid`=`attach`.`tid` AND `displayorder`>='0' WHERE $htsql AND `attach`.`readperm`='0' AND `attach`.`price`='0' $imagesql $sql $methodsql $orderbysql LIMIT $startrow,$items;" ); $attachurl = $_DCACHE['settings']['attachurl']; $attachurl = preg_match("/^((https?|ftps?):\/\/|www\.)/i", $attachurl) ? $attachurl : $boardurl.$attachurl; $i = 0; while($data = $db->fetch_array($query)) { $key = $requestdata['threadmethod'] ? $data['tid'] : $i++; $datalist[$key]['threadlink'] = $boardurl."redirect.php?goto=findpost&ptid=$data[tid]&pid=$data[pid]"; $datalist[$key]['imgfile'] = ($data['remote'] ? $_DCACHE['settings']['ftp']['attachurl'] : $attachurl)."/$data[attachment]".($_DCACHE['settings']['thumbstatus'] && $data['thumb'] ? '.thumb.jpg' : ''); $datalist[$key]['file'] = $boardurl."attachment.php?aid=$data[aid]&k=".md5($data[aid].md5($_DCACHE['settings']['authkey']).$timestamp)."&t=$timestamp"; $datalist[$key]['subject'] = str_replace('\\\'', '&#39;', $data['subject']); $datalist[$key]['filename'] = str_replace('\\\'', '&#39;', $data['filename']); $datalist[$key]['author'] = addslashes($data['author']); $datalist[$key]['downloads'] = $data['downloads']; $datalist[$key]['author'] = $data['author']; $datalist[$key]['filesize'] = number_format($data['filesize']); $datalist[$key]['dateline'] = gmdate("$dateformat $timeformat",$data['dateline'] + $_DCACHE['settings']['timeoffset'] * 3600); $datalist[$key]['fname'] = isset($_DCACHE['forums'][$data['fid']]['name']) ? str_replace('\\\'', '&#39;', addslashes($_DCACHE['forums'][$data['fid']]['name'])) : NULL; $datalist[$key]['description'] = $data['description'] ? str_replace('\\\'', '&#39;', addslashes($data['description'])) : NULL; } $writedata = ''; if(is_array($datalist)) { $imgsize = ($maxwidth ? " width='$maxwidth'" : NULL).($maxheight ? " height='$maxheight'" : NULL); $requesttemplate = !$requesttemplate ? '{file} ({filesize} Bytes)<br />' : $requesttemplate; $order = 1; foreach($datalist AS $value) { $replace['{link}'] = $value['threadlink']; $replace['{imgfile}'] = $value['imgfile']; $replace['{url}'] = $value['file']; $replace['{subject}'] = $value['subject']; $replace['{filesubject}'] = $value['filename']; $replace['{filedesc}'] = $value['description']; $replace['{author}'] = $value['author']; $replace['{dateline}'] = $value['dateline']; $replace['{downloads}'] = $value['downloads']; $replace['{filesize}'] = $value['filesize']; $replace['{file}'] = "<a href='$value[file]'$LinkTarget>$value[filename]</a>"; $replace['{image}'] = "<a href='$value[threadlink]'$LinkTarget><img$imgsize src='$value[imgfile]' border='0'></a>"; $replace['{order}'] = $order++; $writedata .= nodereplace($replace, $requesttemplate); } } } elseif($function == 'module') { $requestrun = TRUE; $settings = unserialize(get_magic_quotes_gpc() ? stripslashes($requestdata['settings']) : $requestdata['settings']); if(@!include(DISCUZ_ROOT.'./include/request/'.$requestdata['module'])) { return; } } else { return; } $data = parsenode($writedata, $requesttemplatebody); if($rewritestatus) { $searcharray = $replacearray = array(); if($GLOBALS['rewritestatus'] & 1) { $searcharray[] = "/\<a href\=\'".preg_quote($boardurl, '/')."forumdisplay\.php\?fid\=(\d+)\'/"; $replacearray[] = "<a href='{$boardurl}forum-\\1-1.html'"; } if($GLOBALS['rewritestatus'] & 2) { $searcharray[] = "/\<a href\=\'".preg_quote($boardurl, '/')."viewthread\.php\?tid\=(\d+)\'/"; $replacearray[] = "<a href='{$boardurl}thread-\\1-1-1.html'"; } if($GLOBALS['rewritestatus'] & 4) { $searcharray[] = "/\<a href\=\'".preg_quote($boardurl, '/')."space\.php\?uid\=(\d+)\'/"; $searcharray[] = "/\<a href\=\'".preg_quote($boardurl, '/')."space\.php\?username\=([^&]+?)\'/"; $replacearray[] = "<a href='{$boardurl}space-uid-\\1.html'"; $replacearray[] = "<a href='{$boardurl}space-username-\\1.html'"; } $data = preg_replace($searcharray, $replacearray, $data); } return $data; } function nodereplace($replace, $requesttemplate) { $return = $requesttemplate; if(preg_match("/\[show=(\d+)\].+?\[\/show\]/is", $requesttemplate, $show)) { if($show[1] == $replace['{order}']) { $return = preg_replace("/\[show=\d+\](.+?)\[\/show\]/is", '\\1', $return); } else { $return = preg_replace("/\[show=\d+\].+?\[\/show\]/is", '', $return); } } return str_replace(array_keys($replace), $replace, $return); } function parsenode($data, $requesttemplatebody) { if($requesttemplatebody) { $data = preg_replace("/\[node\](.+?)\[\/node\]/is", $data, $requesttemplatebody, 1); $data = preg_replace("/\[node\](.+?)\[\/node\]/is", '', $data); } return $data; } function threadrange($range, $field, $params = 4) { $range = intval($range); $range = sprintf("%0".$params."d", decbin($range)); $range = "$range"; $range_filed = ''; for($i = 0; $i < $params - 1; $i ++) { $range_filed .= $range[$i] == 1 ? ($i + 1) : ''; } $range_filed .= $range[$params - 1] == 1 ? 0 : ''; $return = str_replace('_', '\',\'', substr(chunk_split($range_filed,1,"_"),0,-1)); return $return != '' ? ' AND `'.$field.'` IN (\''.$return.'\')' : ''; } function writetorequestcache($cachfile, $requestcachelife, $data='') { global $timestamp, $_DCACHE; if(!$fp = @fopen($cachfile, 'wb')) { return; } $fp = @fopen($cachfile, 'wb'); $cachedata = "if(!defined('IN_DISCUZ')) exit('Access Denied');\n\$expiration = '".($timestamp + $requestcachelife)."';\n".$data."\n"; @fwrite($fp, "<?php\n//Discuz! cache file, DO NOT modify me!". "\n//Created: ".date("M j, Y, G:i"). "\n//Identify: ".md5(basename($cachfile).$cachedata.$_DCACHE['settings']['authkey'])."\n\n$cachedata?>"); @fclose($fp); } function cutmessage($message, $messagelength) { $message = preg_replace(array( "/\[hide=?\d*\](.+?)\[\/hide\]/is", "/\[quote](.*)\[\/quote]/siU", "/\[attach\](\d+)\[\/attach\]/i", "/(\[.+\])/s" ), '', strip_tags(nl2br($message))); $message = addslashes(cutstr(dhtmlspecialchars($message), $messagelength)); return str_replace(array('\'',"\n","\r"), '', $message); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request.func.php
PHP
asf20
31,797
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: gifmerge.class.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } class GifMerge { var $ver = '1.1'; var $dly = 50; var $mod = 'C_FILE'; var $first = true; var $use_loop = false; var $transparent = false; var $use_global_in = false; var $x = 0; var $y = 0; var $ch = 0; var $fin = 0; var $fout = ''; var $loop = 0; var $delay = 0; var $width = 0; var $height = 0; var $trans1 = 255; var $trans2 = 255; var $trans3 = 255; var $disposal = 2; var $out_color_table_size = 0; var $local_color_table_flag = 0; var $global_color_table_size = 0; var $out_color_table_sizecode = 0; var $global_color_table_sizecode= 0; var $gif = array(0x47, 0x49, 0x46); var $buffer = array(); var $local_in = array(); var $global_in = array(); var $global_out = array(); var $logical_screen_descriptor = array(); function GifMerge($images, $t1, $t2, $t3, $loop, $dl, $xpos, $ypos, $model) { if($model) { $this->mod = $model; } if($loop > -1) { $this->loop = floor($loop - 1); $this->use_loop = true; } if($t1 > -1 && $t2 > -1 && $t3 > -1) { $this->trans1 = $t1; $this->trans2 = $t2; $this->trans3 = $t3; $this->transparent = true; } for($i = 0; $i < count($images); $i++) { $dl[$i] ? $this->delay = $dl[$i] : $this->delay = $this->dly; $xpos[$i] ? $this->x = $xpos[$i] : $this->x = 0; $ypos[$i] ? $this->y = $ypos[$i] : $this->y = 0; $this->start_gifmerge_process($images[$i]); } $this->fout .= "\x3b"; } function start_gifmerge_process($fp) { if($this->mod == 'C_FILE') { if(!$this->fin = fopen($fp, 'rb')) { return; } } elseif($this->mod == 'C_MEMORY') { $this->ch = 0; $this->fin = $fp; } $this->getbytes(6); if(!$this->arrcmp($this->buffer, $this->gif, 3)) { return; } $this->getbytes(7); if($this->first) $this->logical_screen_descriptor = $this->buffer; $this->global_color_table_sizecode = $this->buffer[4] & 0x07; $this->global_color_table_size = 2 << $this->global_color_table_sizecode; if($this->buffer[4] & 0x80) { $this->getbytes((3 * $this->global_color_table_size)); for($i = 0; $i < ((3 * $this->global_color_table_size)); $i++) { $this->global_in[$i] = $this->buffer[$i]; } if($this->out_color_table_size == 0) { $this->out_color_table_size = $this->global_color_table_size; $out_color_table_sizecode = $this->global_color_table_sizecode; $this->global_out = $this->global_in; } if($this->global_color_table_size != $this->out_color_table_size || $this->arrcmp($this->global_out, $this->global_in, (3 * $this->global_color_table_size))) { $this->use_global_in = true; } } for($loop = true; $loop;) { $this->getbytes(1); switch($this->buffer[0]) { case 0x21: $this->read_extension(); break; case 0x2c: $this->read_image_descriptor(); break; case 0x3b: $loop = false; break; default: $loop = false; } } if($this->mod == 'C_FILE') { fclose($this->fin); } } function read_image_descriptor() { $this->getbytes(9); $head = $this->buffer; $this->local_color_table_flag = ($this->buffer[8] & 0x80) ? true : false; if($this->local_color_table_flag) { $sizecode = $this->buffer[8] & 0x07; $size = 2 << $sizecode; $this->getbytes(3 * $size); for($i = 0; $i < (3 * $size); $i++) { $this->local_in[$i] = $this->buffer[$i]; } if($this->out_color_table_size == 0) { $this->out_color_table_size = $size; $out_color_table_sizecode = $sizecode; for($i = 0; $i < (3 * $size); $i++) { $this->global_out[$i] = $this->local_in[$i]; } } } if($this->first) { $this->first = false; $this->fout .= "\x47\x49\x46\x38\x39\x61"; if($this->width && $this->height) { $this->logical_screen_descriptor[0] = $this->width & 0xFF; $this->logical_screen_descriptor[1] = ($this->width & 0xFF00) >> 8; $this->logical_screen_descriptor[2] = $this->height & 0xFF; $this->logical_screen_descriptor[3] = ($this->height & 0xFF00) >> 8; } $this->logical_screen_descriptor[4] |= 0x80; $this->logical_screen_descriptor[5] &= 0xF0; $this->logical_screen_descriptor[6] |= $this->out_color_table_sizecode; $this->putbytes($this->logical_screen_descriptor, 7); $this->putbytes($this->global_out, ($this->out_color_table_size * 3)); if($this->use_loop) { $ns[0] = 0x21; $ns[1] = 0xFF; $ns[2] = 0x0B; $ns[3] = 0x4e; $ns[4] = 0x45; $ns[5] = 0x54; $ns[6] = 0x53; $ns[7] = 0x43; $ns[8] = 0x41; $ns[9] = 0x50; $ns[10] = 0x45; $ns[11] = 0x32; $ns[12] = 0x2e; $ns[13] = 0x30; $ns[14] = 0x03; $ns[15] = 0x01; $ns[16] = $this->loop & 255; $ns[17] = $this->loop >> 8; $ns[18] = 0x00; $this->putbytes($ns, 19); } } if($this->use_global_in) { $outtable = $this->global_in; $outsize = $this->global_color_table_size; $outsizecode = $this->global_color_table_sizecode; } else { $outtable = $this->global_out; $outsize = $this->out_color_table_size; } if($this->local_color_table_flag) { if($size == $this->out_color_table_size && !$this->arrcmp($this->local_in, $this->global_out, $size)) { $outtable = $global_out; $outsize = $this->out_color_table_size; } else { $outtable = $this->local_in; $outsize = $size; $outsizecode = $sizecode; } } $use_trans = false; if($this->transparent) { for($i = 0; $i < $outsize; $i++) { if($outtable[3 * $i] == $this->trans1 && $outtable [3 * $i + 1] == $this->trans2 && $outtable [3 * $i + 2] == $this->trans3) { break; } } if($i < $outsize) { $transindex = $i; $use_trans = true; } } if($this->delay || $use_trans) { $this->buffer[0] = 0x21; $this->buffer[1] = 0xf9; $this->buffer[2] = 0x04; $this->buffer[3] = ($this->disposal << 2) + ($use_trans ? 1 : 0); $this->buffer[4] = $this->delay & 0xff; $this->buffer[5] = ($this->delay & 0xff00) >> 8; $this->buffer[6] = $use_trans ? $transindex : 0; $this->buffer[7] = 0x00; $this->putbytes($this->buffer,8); } $this->buffer[0] = 0x2c; $this->putbytes($this->buffer,1); $head[0] = $this->x & 0xff; $head[1] = ($this->x & 0xff00) >> 8; $head[2] = $this->y & 0xff; $head[3] = ($this->y & 0xff00) >> 8; $head[8] &= 0x40; if($outtable != $this->global_out) { $head[8] |= 0x80; $head[8] |= $outsizecode; } $this->putbytes($head,9); if($outtable != $this->global_out) { $this->putbytes($outtable, (3 * $outsize)); } $this->getbytes(1); $this->putbytes($this->buffer,1); for(;;) { $this->getbytes(1); $this->putbytes($this->buffer,1); if(($u = $this->buffer[0]) == 0) { break; } $this->getbytes($u); $this->putbytes($this->buffer, $u); } } function read_extension() { $this->getbytes(1); switch($this->buffer[0]) { case 0xf9: $this->getbytes(6); break; case 0xfe: for(;;) { $this->getbytes(1); if(($u = $this->buffer[0]) == 0) { break; } $this->getbytes($u); } break; case 0x01: $this->getbytes(13); for(;;) { $this->getbytes(0); if(($u = $this->buffer[0]) == 0) { break; } $this->getbytes($u); } break; case 0xff: $this->getbytes(9); $this->getbytes(3); for(;;) { $this->getbytes(1); if(!$this->buffer[0]) { break; } $this->getbytes($this->buffer[0]); } break; default: for(;;) { $this->getbytes(1); if(!$this->buffer[0]) { break; } $this->getbytes($this->buffer[0]); } } } function arrcmp($b, $s, $l) { for($i = 0; $i < $l; $i++) { if($s{$i} != $b{$i}) { return false; } } return true; } function getbytes($l) { for($i = 0; $i < $l; $i++) { if($this->mod == 'C_FILE') { $bin = unpack('C*', fread($this->fin, 1)); $this->buffer[$i] = $bin[1]; } elseif($this->mod == 'C_MEMORY') { $bin = unpack('C*', substr($this->fin, $this->ch, 1)); $this->buffer[$i] = $bin[1]; $this->ch++; } } return $this->buffer; } function putbytes($s, $l) { for($i = 0; $i < $l; $i++) { $this->fout .= pack('C*', $s[$i]); } } function getAnimation() { return $this->fout; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/gifmerge.class.php
PHP
asf20
9,142
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: db_mysql.class.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } class dbstuff { var $version = ''; var $querynum = 0; var $link = null; function connect($dbhost, $dbuser, $dbpw, $dbname = '', $pconnect = 0, $halt = TRUE, $dbcharset2 = '') { $func = empty($pconnect) ? 'mysql_connect' : 'mysql_pconnect'; if(!$this->link = @$func($dbhost, $dbuser, $dbpw, 1)) { $halt && $this->halt('Can not connect to MySQL server'); } else { if($this->version() > '4.1') { global $charset, $dbcharset; $dbcharset = $dbcharset2 ? $dbcharset2 : $dbcharset; $dbcharset = !$dbcharset && in_array(strtolower($charset), array('gbk', 'big5', 'utf-8')) ? str_replace('-', '', $charset) : $dbcharset; $serverset = $dbcharset ? 'character_set_connection='.$dbcharset.', character_set_results='.$dbcharset.', character_set_client=binary' : ''; $serverset .= $this->version() > '5.0.1' ? ((empty($serverset) ? '' : ',').'sql_mode=\'\'') : ''; $serverset && mysql_query("SET $serverset", $this->link); } $dbname && @mysql_select_db($dbname, $this->link); } } function select_db($dbname) { return mysql_select_db($dbname, $this->link); } function fetch_array($query, $result_type = MYSQL_ASSOC) { return mysql_fetch_array($query, $result_type); } function fetch_first($sql) { return $this->fetch_array($this->query($sql)); } function result_first($sql) { return $this->result($this->query($sql), 0); } function query($sql, $type = '') { global $debug, $discuz_starttime, $sqldebug, $sqlspenttimes; if(defined('SYS_DEBUG') && SYS_DEBUG) { @include_once DISCUZ_ROOT.'./include/debug.func.php'; sqldebug($sql); } $func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ? 'mysql_unbuffered_query' : 'mysql_query'; if(!($query = $func($sql, $this->link))) { if(in_array($this->errno(), array(2006, 2013)) && substr($type, 0, 5) != 'RETRY') { $this->close(); require DISCUZ_ROOT.'./config.inc.php'; $this->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); $this->query($sql, 'RETRY'.$type); } elseif($type != 'SILENT' && substr($type, 5) != 'SILENT') { $this->halt('MySQL Query Error', $sql); } } $this->querynum++; return $query; } function affected_rows() { return mysql_affected_rows($this->link); } function error() { return (($this->link) ? mysql_error($this->link) : mysql_error()); } function errno() { return intval(($this->link) ? mysql_errno($this->link) : mysql_errno()); } function result($query, $row = 0) { $query = @mysql_result($query, $row); return $query; } function num_rows($query) { $query = mysql_num_rows($query); return $query; } function num_fields($query) { return mysql_num_fields($query); } function free_result($query) { return mysql_free_result($query); } function insert_id() { return ($id = mysql_insert_id($this->link)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0); } function fetch_row($query) { $query = mysql_fetch_row($query); return $query; } function fetch_fields($query) { return mysql_fetch_field($query); } function version() { if(empty($this->version)) { $this->version = mysql_get_server_info($this->link); } return $this->version; } function close() { return mysql_close($this->link); } function halt($message = '', $sql = '') { define('CACHE_FORBIDDEN', TRUE); require_once DISCUZ_ROOT.'./include/db_mysql_error.inc.php'; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/db_mysql.class.php
PHP
asf20
3,825
<?php function getuidfields() { return array( 'members', 'memberfields', 'access', 'activities', 'activityapplies', 'attachments', 'attachpaymentlog', 'creditslog', 'debateposts', 'debates', 'favorites', 'forumrecommend|authorid,moderatorid', 'invites', 'magiclog', 'magicmarket', 'membermagics', 'memberspaces', 'moderators', 'modworks', 'myposts', 'mythreads', 'onlinetime', 'orders', 'paymentlog|uid,authorid', 'posts|authorid|pid', 'promotions', 'ratelog', 'rewardlog|authorid,answererid', 'searchindex|uid', 'spacecaches', 'subscriptions', 'threads|authorid|tid', 'threadsmod', 'tradecomments|raterid,rateeid', 'tradelog|sellerid,buyerid', 'trades|sellerid', 'validating', 'videos', ); } function membermerge($olduid, $newuid) { global $db, $tablepre; $uidfields = getuidfields(); foreach($uidfields as $value) { list($table, $field, $stepfield) = explode('|', $value); $fields = !$field ? array('uid') : explode(',', $field); foreach($fields as $field) { $db->query("UPDATE `{$tablepre}$table` SET `$field`='$newuid' WHERE `$field`='$olduid'"); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/membermerge.func.php
PHP
asf20
1,212
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: printable.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $thisbg = '#FFFFFF'; $query = $db->query("SELECT p.*, m.username, m.groupid FROM {$tablepre}posts p LEFT JOIN {$tablepre}members m ON m.uid=p.authorid WHERE p.tid='$tid' AND p.invisible='0' ORDER BY p.dateline LIMIT 100"); while($post = $db->fetch_array($query)) { $post['dateline'] = dgmdate("$dateformat $timeformat", $post['dateline'] + ($timeoffset * 3600)); $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'], $forum['allowhtml'], ($forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0)); if($post['attachment']) { $attachment = 1; } $post['attachments'] = array(); if($post['attachment'] && $allowgetattach) { $attachpids .= ",$post[pid]"; $post['attachment'] = 0; if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) { $attachtags[$post['pid']] = $matchaids[1]; } } $postlist[$post['pid']] = $post; } if($attachpids) { require_once DISCUZ_ROOT.'./include/attachment.func.php'; parseattach($attachpids, $attachtags, $postlist); } include template('viewthread_printable'); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/printable.inc.php
PHP
asf20
1,466
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: modlist.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $modlist = array(); if($GLOBALS['forum']['moderators']) { $moderators = daddslashes(explode("\t", $GLOBALS['forum']['moderators']), 1); if($GLOBALS['modworkstatus']) { $query = $db->query("SELECT m.uid, m.username, sum(mw.count) as actioncount FROM {$tablepre}members m LEFT JOIN {$tablepre}modworks mw on m.uid=mw.uid WHERE m.username in (".implodeids($moderators).") GROUP BY mw.uid ORDER BY actioncount DESC"); } else { $query = $db->query("SELECT m.uid, m.username, m.posts FROM {$tablepre}members m WHERE m.username in (".implodeids($moderators).") ORDER BY posts DESC"); } while($modrow = $db->fetch_array($query)) { $modrow['avatar'] = discuz_uc_avatar($modrow['uid'], 'small'); $modrow['actioncount'] = intval($modrow['actioncount']); $modlist[] = $modrow; } } include template('request_modlist'); } else { $request_version = '1.0'; $request_name = $requestlang['modlist_name']; $request_description = $requestlang['modlist_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/modlist.inc.php
PHP
asf20
1,365
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: thread.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { if(!defined('TPLDIR')) { @include_once DISCUZ_ROOT.'./forumdata/cache/style_'.$_DCACHE['settings']['styleid'].'.php'; } if($tid = intval($settings['tid'])) { $thread = $db->fetch_first("SELECT subject, fid, special, price FROM {$tablepre}threads WHERE tid='$tid'"); $fid = $thread['fid']; if($thread['special'] == 1) { $multiple = $db->result_first("SELECT multiple FROM {$tablepre}polls WHERE tid='$tid'"); $optiontype = $multiple ? 'checkbox' : 'radio'; $query = $db->query("SELECT polloptionid, polloption FROM {$tablepre}polloptions WHERE tid='$tid' ORDER BY displayorder"); while($polloption = $db->fetch_array($query)) { $polloption['polloption'] = preg_replace("/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $polloption['polloption']); $polloptions[] = $polloption; } } elseif($thread['special'] == 2) { $query = $db->query("SELECT subject, price, aid, pid FROM {$tablepre}trades WHERE tid='$tid' ORDER BY displayorder DESC LIMIT 2"); while($trade = $db->fetch_array($query)) { $trades[] = $trade; } } elseif($thread['special'] == 3) { $extcredits = $_DCACHE['settings']['extcredits']; $creditstransextra = $_DCACHE['settings']['creditstransextra']; $rewardend = $thread['price'] > 0; $rewardprice = abs($thread['price']); $message = cutmessage($db->result_first("SELECT message FROM {$tablepre}posts WHERE tid='$tid' AND first=1"), 100); } elseif($thread['special'] == 4) { $message = cutmessage($db->result_first("SELECT message FROM {$tablepre}posts WHERE tid='$tid' AND first=1"), 100); $number = $db->result_first("SELECT number FROM {$tablepre}activities WHERE tid='$tid'"); $applynumbers = $db->result_first("SELECT COUNT(*) FROM {$tablepre}activityapplies WHERE tid='$tid' AND verified=1"); $aboutmembers = $number - $applynumbers; } elseif($thread['special'] == 5) { $message = cutmessage($db->result_first("SELECT message FROM {$tablepre}posts WHERE tid='$tid' AND first=1"), 100); $debate = $db->fetch_first("SELECT affirmdebaters, negadebaters, affirmvotes, negavotes FROM {$tablepre}debates WHERE tid='$tid'"); $debate['affirmvoteswidth'] = $debate['affirmvotes'] ? intval(80 * (($debate['affirmvotes'] + 1) / ($debate['affirmvotes'] + $debate['negavotes'] + 1))) : 1; $debate['negavoteswidth'] = $debate['negavotes'] ? intval(80 * (($debate['negavotes'] + 1) / ($debate['affirmvotes'] + $debate['negavotes'] + 1))) : 1; } elseif($thread['special'] == 6) { require_once DISCUZ_ROOT.'./api/video.php'; $video = $db->fetch_first("SELECT vid, vtitle, vthumb FROM {$tablepre}videos WHERE tid='$tid' ORDER BY displayorder LIMIT 1"); $video['vthumb'] = VideoClient_Util::getThumbUrl($video['vid'], 'small'); } else { $message = cutmessage($db->result_first("SELECT message FROM {$tablepre}posts WHERE tid='$tid' AND first=1"), 100); } } include template('request_thread'); } else { $request_version = '1.0'; $request_name = $requestlang['thread_name']; $request_description = $requestlang['thread_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'tid' => array($requestlang['thread_id'], '', 'text'), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/thread.inc.php
PHP
asf20
3,685
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: feed.inc.php 16697 2008-12-05 07:36:51Z andy $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $parameter = array(); $parameter[] = 'ac=feed'; if(!empty($settings['uids'])) { $parameter[] = 'uids='.trim($settings['uids']); } if(!empty($settings['friend'])) { $parameter[] = 'friend='.intval($GLOBALS['discuz_uid']); $nocache = 1; } $start = !empty($settings['start']) ? intval($settings['start']) : 0; $limit = !empty($settings['limit']) ? intval($settings['limit']) : 10; $parameter[] = 'start='.$start; $parameter[] = 'limit='.$limit; $plus = implode('&', $parameter); $url = $GLOBALS['uchomeurl']."/api/discuz.php?$plus"; $feedlist = unserialize(dfopen($url)); $writedata = ''; if($feedlist && is_array($feedlist)) { $writedata = '<div class="sidebox"><h4>'.$settings['title'].'</h4><table>'; foreach($feedlist as $feed) { $searchs = $replaces = array(); foreach(array_keys($feed) as $key) { $searchs[] = '{'.$key.'}'; $replaces[] = $feed[$key]; } $writedata .= '<tr><td>'.str_replace($searchs, $replaces, stripslashes($settings['template'])).'</td></tr>'; } $writedata .= '</table></div>'; } } else { $request_version = '1.0'; $request_name = $requestlang['feed_name']; $request_description = $requestlang['feed_desc']; $request_copyright = '<a href="http://u.discuz.net/home/" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'title' => array($requestlang['feed_title'], $requestlang['feed_title_comment'], 'text', '', $requestlang['feed_title_value']), 'uids' => array($requestlang['feed_uids'], $requestlang['feed_uids_comment'], 'text'), 'friend' => array($requestlang['feed_friend'], '', 'mradio', array(array('0', $requestlang['feed_friend_nolimit']), array('1', $requestlang['feed_friend_friendonly'])), '0'), 'start' => array($requestlang['feed_start'], $requestlang['feed_start_comment'], 'text', '', '0'), 'limit' => array($requestlang['feed_limit'], $requestlang['feed_limit_comment'], 'text', '', '10'), 'template' => array($requestlang['feed_template'], $requestlang['feed_template_comment'], 'textarea', '','<a href="{userlink}">{title_template}</a>') ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/feed.inc.php
PHP
asf20
2,379
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: doing.inc.php 16697 2008-12-12 07:36:51Z andy $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $parameter = array(); $parameter[] = 'ac=doing'; if(!empty($settings['uid'])) { $parameter[] = 'uid='.trim($settings['uid']); } if(!empty($settings['mood'])) { $parameter[] = 'mood='.intval($settings['mood']); } $start = !empty($settings['start']) ? intval($settings['start']) : 0; $limit = !empty($settings['limit']) ? intval($settings['limit']) : 10; $parameter[] = 'start='.$start; $parameter[] = 'limit='.$limit; $plus = implode('&', $parameter); $url = $GLOBALS['uchomeurl']."/api/discuz.php?$plus"; $doinglist = unserialize(dfopen($url)); $writedata = ''; if($doinglist && is_array($doinglist)) { $writedata = '<div class="sidebox"><h4>'.$settings['title'].'</h4><table>'; foreach($doinglist as $doing) { $searchs = $replaces = array(); foreach(array_keys($doing) as $key) { $searchs[] = '{'.$key.'}'; $replaces[] = $doing[$key]; } $writedata .= '<tr><td>'.str_replace($searchs, $replaces, stripslashes($settings['template'])).'</td></tr>'; } $writedata .= '</table></div>'; } } else { $request_version = '1.0'; $request_name = $requestlang['doing_name']; $request_description = $requestlang['doing_desc']; $request_copyright = '<a href="http://u.discuz.net/home/" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'title' => array($requestlang['doing_title'], $requestlang['doing_title_comment'], 'text', '', $requestlang['doing_title_value']), 'uid' => array($requestlang['doing_uids'], $requestlang['doing_uids_comment'], 'text'), 'mood' => array($requestlang['doing_mood'], '', 'mradio', array(array('0', $requestlang['doing_mood_nolimit']), array('1', $requestlang['doing_mood_moodonly'])), '0'), 'start' => array($requestlang['doing_start'], $requestlang['doing_start_comment'], 'text', '', '0'), 'limit' => array($requestlang['doing_limit'], $requestlang['doing_limit_comment'], 'text', '', '10'), 'template' => array($requestlang['doing_template'], $requestlang['doing_template_comment'], 'textarea', '','<a href="{link}">{message}</a>') ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/doing.inc.php
PHP
asf20
2,352
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: space.inc.php 16697 2008-12-06 07:36:51Z andy $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $parameter = array(); $parameter[] = 'ac=space'; if(!empty($settings['uid'])) { $parameter[] = 'uid='.trim($settings['uid']); } if(!empty($settings['dateline'])) { $parameter[] = 'dateline='.intval($settings['dateline']); } if(!empty($settings['updatetime'])) { $parameter[] = 'updatetime='.intval($settings['updatetime']); } if(!empty($settings['startfriendnum'])) { $parameter[] = 'startfriendnum='.intval($settings['startfriendnum']); } if(!empty($settings['endfriendnum'])) { $parameter[] = 'endfriendnum='.intval($settings['endfriendnum']); } if(!empty($settings['startviewnum'])) { $parameter[] = 'startviewnum='.intval($settings['startviewnum']); } if(!empty($settings['endviewnum'])) { $parameter[] = 'endviewnum='.intval($settings['endviewnum']); } if(!empty($settings['startcredit'])) { $parameter[] = 'startcredit='.intval($settings['startcredit']); } if(!empty($settings['endcredit'])) { $parameter[] = 'endcredit='.intval($settings['endcredit']); } if($settings['avatar'] != -1) { $parameter[] = 'avatar='.intval($settings['avatar']); } if($settings['namestatus'] != -1) { $parameter[] = 'namestatus='.intval($settings['namestatus']); } if(!empty($settings['order'])) { $parameter[] = 'order='.trim($settings['order']); } if(!empty($settings['sc'])) { $parameter[] = 'sc='.trim($settings['sc']); } $start = !empty($settings['start']) ? intval($settings['start']) : 0; $limit = !empty($settings['limit']) ? intval($settings['limit']) : 10; $parameter[] = 'start='.$start; $parameter[] = 'limit='.$limit; $plus = implode('&', $parameter); $url = $GLOBALS['uchomeurl']."/api/discuz.php?$plus"; $spacelist = unserialize(dfopen($url)); $writedata = ''; if($spacelist && is_array($spacelist)) { $writedata = '<div class="sidebox"><h4>'.$settings['title'].'</h4><table>'; foreach($spacelist as $space) { $searchs = $replaces = array(); foreach(array_keys($space) as $key) { $searchs[] = '{'.$key.'}'; $replaces[] = $space[$key]; } $writedata .= '<tr><td>'.str_replace($searchs, $replaces, stripslashes($settings['template'])).'</td></tr>'; } $writedata .= '</table></div>'; } } else { $request_version = '1.0'; $request_name = $requestlang['space_name']; $request_description = $requestlang['space_desc']; $request_copyright = '<a href="http://u.discuz.net/home/" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'title' => array($requestlang['space_title'], $requestlang['space_title_comment'], 'text', '', $requestlang['space_title_value']), 'uid' => array($requestlang['space_uids'], $requestlang['space_uids_comment'], 'text'), 'startfriendnum' => array($requestlang['space_startfriendnum'], '', 'text'), 'endfriendnum' => array($requestlang['space_endfriendnum'], '', 'text'), 'startviewnum' => array($requestlang['space_startviewnum'], '', 'text'), 'endviewnum' => array($requestlang['space_endviewnum'], '', 'text'), 'startcredit' => array($requestlang['space_startcredit'], '', 'text'), 'endcredit' => array($requestlang['space_endcredit'], '', 'text'), 'avatar' => array($requestlang['space_avatar'], $requestlang['space_avatar_comment'], 'mradio', array(array('-1', $requestlang['space_avatar_nolimit']), array('0', $requestlang['space_avatar_noexists']) , array('1', $requestlang['space_avatar_exists'])), '-1'), 'namestatus'=> array($requestlang['space_namestatus'], $requestlang['space_namestatus_comment'], 'mradio', array(array('-1', $requestlang['space_namestatus_nolimit']), array('0', $requestlang['space_namestatus_nopass']) , array('1', $requestlang['space_namestatus_pass'])), '-1'), 'dateline' => array($requestlang['space_dateline'], $requestlang['space_dateline_comment'], 'select', $requestlang['space_dateselect']), 'updatetime' => array($requestlang['space_updatetime'], $requestlang['space_updatetime_comment'], 'select', $requestlang['space_dateselect']), 'order' => array($requestlang['space_order'], $requestlang['space_order_comment'], 'select', $requestlang['space_orderselect']), 'sc' => array($requestlang['space_sc'], $requestlang['space_sc_comment'], 'mradio', array(array('ASC', $requestlang['space_sc_asc']), array('DESC', $requestlang['space_sc_desc'])), 'DESC'), 'start' => array($requestlang['space_start'], $requestlang['space_start_comment'], 'text', '', '0'), 'limit' => array($requestlang['space_limit'], $requestlang['space_limit_comment'], 'text', '', '10'), 'template' => array($requestlang['space_template'], $requestlang['space_template_comment'], 'textarea', '','<a href="{userlink}">{username}</a>') ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/space.inc.php
PHP
asf20
4,976
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: birthday.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $limit = !empty($settings['limit']) ? intval($settings['limit']) : 12; $cachefile = DISCUZ_ROOT.'./forumdata/cache/requestscript_birthday.php'; $today = gmdate('m-d', $timestamp + $timeoffset * 3600); if((@!include($cachefile)) || $today != $todaycache || $limit != $limitcache) { $query = $db->query("SELECT username, uid FROM {$tablepre}members WHERE RIGHT(bday, 5)='".$today."' ORDER BY bday LIMIT $limit"); $birthdaymembers = array(); while($member = $db->fetch_array($query)) { $member['username'] = htmlspecialchars($member['username']); $birthdaymembers[] = $member; } $cachefile = DISCUZ_ROOT.'./forumdata/cache/requestscript_birthday.php'; writetorequestcache($cachefile, 0, "\$limitcache = $limit;\n\$todaycache = '".$today."';\n\$birthdaymembers = ".var_export($birthdaymembers, 1).';'); } include template('request_birthday'); } else { $request_version = '1.0'; $request_name = $requestlang['birthday_name']; $request_description = $requestlang['birthday_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'limit' => array($requestlang['birthday_limit'], $requestlang['birthday_limit_comment'], 'text'), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/birthday.inc.php
PHP
asf20
1,530
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: tag.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $max = $db->result_first("SELECT total FROM {$tablepre}tags WHERE closed=0 ORDER BY total DESC LIMIT 1"); $viewthreadtags = !empty($settings['limit']) ? intval($settings['limit']) : 10; if(!$settings['type']) { $count = $db->result_first("SELECT count(*) FROM {$tablepre}tags WHERE closed=0"); $randlimit = mt_rand(0, $count <= $viewthreadtags ? 0 : $count - $viewthreadtags); $query = $db->query("SELECT tagname,total FROM {$tablepre}tags WHERE closed=0 LIMIT $randlimit, $viewthreadtags"); } else { $query = $db->query("SELECT tagname,total FROM {$tablepre}tags WHERE closed=0 ORDER BY total DESC LIMIT $viewthreadtags"); } $taglist = array(); while($tagrow = $db->fetch_array($query)) { $tagrow['level'] = ceil($tagrow['total'] * 5 / $max); $tagrow['tagnameenc'] = rawurlencode($tagrow['tagname']); $taglist[] = $tagrow; } !$settings['type'] && shuffle($taglist); include template('request_tag'); } else { $request_version = '1.0'; $request_name = $requestlang['tag_name']; $request_description = $requestlang['tag_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'type' => array($requestlang['tag_type'], $requestlang['tag_type_comment'], 'mradio', array( array(0, $requestlang['tag_type_0']), array(1, $requestlang['tag_type_1']) ) ), 'limit' => array($requestlang['tag_type_limit'], $requestlang['tag_type_limit_comment'], 'text'), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/tag.inc.php
PHP
asf20
1,768
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: assistant.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $nocache = 1; $avatar = discuz_uc_avatar($GLOBALS['discuz_uid'], 'small'); $fidadd = isset($_GET['fid']) ? '&srchfid='.$_GET['fid'] : ''; include template('request_assistant'); } else { $request_version = '1.0'; $request_name = $requestlang['assistant_name']; $request_description = $requestlang['assistant_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array(); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/assistant.inc.php
PHP
asf20
731
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: forumtree.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { require_once DISCUZ_ROOT.'./include/forum.func.php'; if(!$_DCACHE['forums']) { include_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; } foreach($_DCACHE['forums'] as $forum) { if(!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t$GLOBALS[discuz_uid]\t")) { $forum['name'] = addslashes($forum['name']); $forum['type'] != 'group' && $haschild[$forum['fup']] = true; $forumlist[] = $forum; } } $nocache = 1; include template('request_forumtree'); } else { $request_version = '1.0'; $request_name = $requestlang['forumtree_name']; $request_description = $requestlang['forumtree_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/forumtree.inc.php
PHP
asf20
1,061
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: rowcombine.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $combinetitles = $combinedata = $datalist = ''; $combinemodules = explode("\n", $settings['data']); $idbase = 'cm_'.random(4); foreach($combinemodules as $id => $combinemodule) { $id = $idbase.'_'.$id; list($combinekey, $combinetitle) = explode(',', $combinemodule); $cachekey = $combinekey; if(CURSCRIPT == 'forumdisplay' && $specialfid) { $cachekey .= '_fid'.$specialfid; } $combinecachefile = DISCUZ_ROOT.'./forumdata/cache/request_'.md5($cachekey).'.php'; if((@!include($combinecachefile)) || $expiration < $timestamp) { parse_str($_DCACHE['request'][$combinekey]['url'], $requestdata); $datalist = parse_request($requestdata, $combinecachefile, 0, $specialfid, $combinekey); } $combinedata .= '<div id="'.$id.'" class="combine" style="display:none">'.$datalist.'</div>'; $combinetitles[] = $combinetitle; } $combinecount = count($combinemodules); include template('request_rowcombine'); } else { $request_version = '1.0'; $request_name = $requestlang['rowcombine_name']; $request_description = $requestlang['rowcombine_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'title' => array($requestlang['rowcombine_title'], $requestlang['rowcombine_title_comment'], 'text'), 'data' => array($requestlang['rowcombine_name'], $requestlang['rowcombine_data_comment'], 'textarea'), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/rowcombine.inc.php
PHP
asf20
1,713
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: google.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $writedata = !empty($GLOBALS['google']) ? '<div id="headsearch" class="sidebox"><script type="text/javascript"> var google_host="'.$_SERVER['HTTP_HOST'].'", google_charset="'.$GLOBALS['charset'].'", google_hl="'.$settings['lang'].'", google_lr="'.($settings['lang'] ? 'lang_'.$settings['lang'] : '').'"; google_default_0="'.($settings['default'] == 0 ? ' selected' : '').'"; google_default_1="'.($settings['default'] == 1 ? ' selected' : '').'"; </script> <script type="text/javascript" src="include/js/google.js"></script></div> ' : ''; } else { $request_version = '1.0'; $request_name = $requestlang['google_name']; $request_description = $requestlang['google_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'lang' => array($requestlang['google_lang'], $requestlang['google_lang_comment'], 'mradio', array( array('', $requestlang['google_lang_any']), array('en', $requestlang['google_lang_en']), array('zh-CN', $requestlang['google_lang_zh-CN']), array('zh-TW', $requestlang['google_lang_zh-TW'])) ), 'default' => array($requestlang['google_default'], $requestlang['google_default_comment'], 'mradio', array( array(0, $requestlang['google_default_0']), array(1, $requestlang['google_default_1'])) ), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/google.inc.php
PHP
asf20
1,634
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: html.inc.php 16697 2008-11-14 07:36:51Z monkey $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($requestrun) { $settings['code'] = stripslashes($settings['code']); if($settings['type']) { include_once DISCUZ_ROOT.'./include/discuzcode.func.php'; $writedata = discuzcode($settings['code'], 0, 0); } else { $writedata = $settings['code']; } if($settings['side']) { $writedata = '<div class="sidebox">'.$writedata.'</div>'; } } else { $request_version = '1.0'; $request_name = $requestlang['html_name']; $request_description = $requestlang['html_desc']; $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>'; $request_settings = array( 'type' => array($requestlang['html_type'], $requestlang['html_type_comment'], 'select', array( array('0', $requestlang['html_type_html']), array('1', $requestlang['html_type_code']) ) ), 'code' => array($requestlang['html_code'], $requestlang['html_code_comment'], 'textarea'), 'side' => array($requestlang['html_side'], $requestlang['html_side_comment'], 'radio'), ); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/request/html.inc.php
PHP
asf20
1,262
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: viewthread_poll.inc.php 17181 2008-12-09 05:58:19Z tiger $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $polloptions = array(); $votersuid = ''; if($count = $sdb->fetch_first("SELECT MAX(votes) AS max, SUM(votes) AS total FROM {$tablepre}polloptions WHERE tid = '$tid'")) { $options = $sdb->fetch_first("SELECT multiple, visible, maxchoices, expiration, overt FROM {$tablepre}polls WHERE tid='$tid'"); $multiple = $options['multiple']; $visible = $options['visible']; $maxchoices = $options['maxchoices']; $expiration = $options['expiration']; $overt = $options['overt']; $query = $sdb->query("SELECT polloptionid, votes, polloption, voterids FROM {$tablepre}polloptions WHERE tid='$tid' ORDER BY displayorder"); $voterids = ''; $bgcolor = rand(0, 9); while($options = $sdb->fetch_array($query)) { if($bgcolor > 9) { $bgcolor = 0; } $viewvoteruid[] = $options['voterids']; $voterids .= "\t".$options['voterids']; $polloptions[] = array ( 'polloptionid' => $options['polloptionid'], 'polloption' => preg_replace("/\[url=(https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $options['polloption']), 'votes' => $options['votes'], 'width' => @round($options['votes'] * 300 / $count['max']) + 2, 'percent' => @sprintf("%01.2f", $options['votes'] * 100 / $count['total']), 'color' => $bgcolor ); $bgcolor++; } $voterids = explode("\t", $voterids); $voters = array_unique($voterids); $voterscount = count($voters) - 1; array_shift($voters); if(!$expiration) { $expirations = $timestamp + 86400; } else { $expirations = $expiration; if($expirations > $timestamp) { $thread['remaintime'] = remaintime($expirations - $timestamp); } } $allwvoteusergroup = $allowvote; $allowvotepolled = !in_array(($discuz_uid ? $discuz_uid : $onlineip), $voters); $allowvotethread = (empty($thread['closed']) || $alloweditpoll) && $timestamp < $expirations && $expirations > 0; $allowvote = $allwvoteusergroup && $allowvotepolled && $allowvotethread; $optiontype = $multiple ? 'checkbox' : 'radio'; $visiblepoll = $visible || $forum['ismoderator'] || ($discuz_uid && $discuz_uid == $thread['authorid']) || ($expirations >= $timestamp && in_array(($discuz_uid ? $discuz_uid : $onlineip), $voters)) || $expirations < $timestamp ? 0 : 1; } else { $db->query("UPDATE {$tablepre}threads SET special='0' WHERE tid='$tid'", 'UNBUFFERED'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/viewthread_poll.inc.php
PHP
asf20
2,711
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: common.inc.php 17460 2008-12-24 01:46:38Z monkey $ */ error_reporting(0); set_magic_quotes_runtime(0); $mtime = explode(' ', microtime()); $discuz_starttime = $mtime[1] + $mtime[0]; define('SYS_DEBUG', FALSE); define('IN_DISCUZ', TRUE); define('DISCUZ_ROOT', substr(dirname(__FILE__), 0, -7)); define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); !defined('CURSCRIPT') && define('CURSCRIPT', ''); if(PHP_VERSION < '4.1.0') { $_GET = &$HTTP_GET_VARS; $_POST = &$HTTP_POST_VARS; $_COOKIE = &$HTTP_COOKIE_VARS; $_SERVER = &$HTTP_SERVER_VARS; $_ENV = &$HTTP_ENV_VARS; $_FILES = &$HTTP_POST_FILES; } if (isset($_REQUEST['GLOBALS']) OR isset($_FILES['GLOBALS'])) { exit('Request tainting attempted.'); } require_once DISCUZ_ROOT.'./include/global.func.php'; getrobot(); if(defined('NOROBOT') && IS_ROBOT) { exit(header("HTTP/1.1 403 Forbidden")); } foreach(array('_COOKIE', '_POST', '_GET') as $_request) { foreach($$_request as $_key => $_value) { $_key{0} != '_' && $$_key = daddslashes($_value); } } if (!MAGIC_QUOTES_GPC && $_FILES) { $_FILES = daddslashes($_FILES); } $charset = $dbs = $dbcharset = $forumfounders = $metakeywords = $extrahead = $seodescription = $mnid = ''; $plugins = $hooks = $admincp = $jsmenu = $forum = $thread = $language = $actioncode = $modactioncode = $lang = array(); $_DCOOKIE = $_DSESSION = $_DCACHE = $_DPLUGIN = $advlist = array(); require_once DISCUZ_ROOT.'./config.inc.php'; if($urlxssdefend && !empty($_SERVER['REQUEST_URI'])) { $temp = urldecode($_SERVER['REQUEST_URI']); if(strpos($temp, '<') !== false || strpos($temp, '"') !== false) exit('Request Bad url'); } $prelength = strlen($cookiepre); foreach($_COOKIE as $key => $val) { if(substr($key, 0, $prelength) == $cookiepre) { $_DCOOKIE[(substr($key, $prelength))] = MAGIC_QUOTES_GPC ? $val : daddslashes($val); } } unset($prelength, $_request, $_key, $_value); $inajax = !empty($inajax); $handlekey = !empty($handlekey) ? htmlspecialchars($handlekey) : ''; $timestamp = time(); if($attackevasive && CURSCRIPT != 'seccode') { require_once DISCUZ_ROOT.'./include/security.inc.php'; } require_once DISCUZ_ROOT.'./include/db_'.$database.'.class.php'; $PHP_SELF = dhtmlspecialchars($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']); $BASESCRIPT = basename($PHP_SELF); list($BASEFILENAME) = explode('.', $BASESCRIPT); $boardurl = htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].preg_replace("/\/+(api|archiver|wap)?\/*$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))).'/'); if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) { $onlineip = getenv('HTTP_CLIENT_IP'); } elseif(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) { $onlineip = getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) { $onlineip = getenv('REMOTE_ADDR'); } elseif(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) { $onlineip = $_SERVER['REMOTE_ADDR']; } preg_match("/[\d\.]{7,15}/", $onlineip, $onlineipmatches); $onlineip = $onlineipmatches[0] ? $onlineipmatches[0] : 'unknown'; unset($onlineipmatches); $cachelost = (@include DISCUZ_ROOT.'./forumdata/cache/cache_settings.php') ? '' : 'settings'; @extract($_DCACHE['settings']); if($gzipcompress && function_exists('ob_gzhandler') && !in_array(CURSCRIPT, array('attachment', 'wap')) && !$inajax) { ob_start('ob_gzhandler'); } else { $gzipcompress = 0; ob_start(); } if(!empty($loadctrl) && substr(PHP_OS, 0, 3) != 'WIN') { if($fp = @fopen('/proc/loadavg', 'r')) { list($loadaverage) = explode(' ', fread($fp, 6)); fclose($fp); if($loadaverage > $loadctrl) { header("HTTP/1.0 503 Service Unavailable"); include DISCUZ_ROOT.'./include/serverbusy.htm'; exit(); } } } if(in_array(CURSCRIPT, array('index', 'forumdisplay', 'viewthread', 'post', 'topicadmin', 'register', 'archiver'))) { $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/cache_'.CURSCRIPT.'.php') ? '' : ' '.CURSCRIPT; } $db = new dbstuff; $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); $dbuser = $dbpw = $pconnect = $sdb = NULL; $sid = daddslashes(($transsidstatus || CURSCRIPT == 'wap') && (isset($_GET['sid']) || isset($_POST['sid'])) ? (isset($_GET['sid']) ? $_GET['sid'] : $_POST['sid']) : (isset($_DCOOKIE['sid']) ? $_DCOOKIE['sid'] : '')); CURSCRIPT == 'attachment' && isset($_GET['sid']) && $sid = addslashes(authcode($_GET['sid'], 'DECODE', $_DCACHE['settings']['authkey'])); $discuz_auth_key = md5($_DCACHE['settings']['authkey'].$_SERVER['HTTP_USER_AGENT']); list($discuz_pw, $discuz_secques, $discuz_uid) = empty($_DCOOKIE['auth']) ? array('', '', 0) : daddslashes(explode("\t", authcode($_DCOOKIE['auth'], 'DECODE')), 1); $prompt = $sessionexists = $seccode = 0; $membertablefields = 'm.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques, m.adminid, m.groupid, m.groupexpiry, m.extgroupids, m.email, m.timeoffset, m.tpp, m.ppp, m.posts, m.digestposts, m.oltime, m.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6, m.extcredits7, m.extcredits8, m.timeformat, m.dateformat, m.pmsound, m.sigstatus, m.invisible, m.lastvisit, m.lastactivity, m.lastpost, m.prompt, m.accessmasks, m.editormode, m.customshow, m.customaddfeed'; if($sid) { if($discuz_uid) { $query = $db->query("SELECT s.sid, s.styleid, s.groupid='6' AS ipbanned, s.pageviews AS spageviews, s.lastolupdate, s.seccode, $membertablefields FROM {$tablepre}sessions s, {$tablepre}members m WHERE m.uid=s.uid AND s.sid='$sid' AND CONCAT_WS('.',s.ip1,s.ip2,s.ip3,s.ip4)='$onlineip' AND m.uid='$discuz_uid' AND m.password='$discuz_pw' AND m.secques='$discuz_secques'"); } else { $query = $db->query("SELECT sid, uid AS sessionuid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'"); } if($_DSESSION = $db->fetch_array($query)) { $sessionexists = 1; if(!empty($_DSESSION['sessionuid'])) { $_DSESSION = array_merge($_DSESSION, $db->fetch_first("SELECT $membertablefields FROM {$tablepre}members m WHERE uid='$_DSESSION[sessionuid]'")); } } else { if($_DSESSION = $db->fetch_first("SELECT sid, groupid, groupid='6' AS ipbanned, pageviews AS spageviews, styleid, lastolupdate, seccode FROM {$tablepre}sessions WHERE sid='$sid' AND CONCAT_WS('.',ip1,ip2,ip3,ip4)='$onlineip'")) { clearcookies(); $sessionexists = 1; } } } if(!$sessionexists) { if($discuz_uid) { if(!($_DSESSION = $db->fetch_first("SELECT $membertablefields, m.styleid FROM {$tablepre}members m WHERE m.uid='$discuz_uid' AND m.password='$discuz_pw' AND m.secques='$discuz_secques'"))) { clearcookies(); } } if(ipbanned($onlineip)) $_DSESSION['ipbanned'] = 1; $_DSESSION['sid'] = random(6); $_DSESSION['seccode'] = random(6, 1); } $_DSESSION['dateformat'] = empty($_DSESSION['dateformat']) || empty($_DCACHE['settings']['userdateformat'][$_DSESSION['dateformat'] -1])? $_DCACHE['settings']['dateformat'] : $_DCACHE['settings']['userdateformat'][$_DSESSION['dateformat'] -1]; $_DSESSION['timeformat'] = empty($_DSESSION['timeformat']) ? $_DCACHE['settings']['timeformat'] : ($_DSESSION['timeformat'] == 1 ? 'h:i A' : 'H:i'); $_DSESSION['timeoffset'] = isset($_DSESSION['timeoffset']) && $_DSESSION['timeoffset'] != 9999 ? $_DSESSION['timeoffset'] : $_DCACHE['settings']['timeoffset']; $membertablefields = ''; @extract($_DSESSION); $newpm = $prompt & 1; $doingtask = $prompt & 2 ? 1 : 0; $lastvisit = empty($lastvisit) ? $timestamp - 86400 : $lastvisit; $timenow = array('time' => gmdate("$dateformat $timeformat", $timestamp + 3600 * $timeoffset), 'offset' => ($timeoffset >= 0 ? ($timeoffset == 0 ? '' : '+'.$timeoffset) : $timeoffset)); if(PHP_VERSION > '5.1') { @date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset))); } $accessadd1 = $accessadd2 = $modadd1 = $modadd2 = $metadescription = ''; if(empty($discuz_uid) || empty($discuz_user)) { $discuz_user = $extgroupids = ''; $discuz_uid = $adminid = $posts = $digestposts = $pageviews = $oltime = $invisible = $credits = $extcredits1 = $extcredits2 = $extcredits3 = $extcredits4 = $extcredits5 = $extcredits6 = $extcredits7 = $extcredits8 = 0; $groupid = empty($groupid) || $groupid != 6 ? 7 : 6; } else { $discuz_userss = $discuz_user; $discuz_user = addslashes($discuz_user); if($accessmasks) { $accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowpostattach'; $accessadd2 = "LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid"; } if($adminid == 3) { $modadd1 = ', m.uid AS ismoderator'; $modadd2 = "LEFT JOIN {$tablepre}moderators m ON m.uid='$discuz_uid' AND m.fid=f.fid"; } } if($errorreport == 2 || ($errorreport == 1 && $adminid > 0)) { error_reporting(E_ERROR | E_WARNING | E_PARSE); } define('FORMHASH', formhash()); $statstatus && !$inajax && require_once DISCUZ_ROOT.'./include/counter.inc.php'; $extra = isset($extra) && @preg_match("/^[&=;a-z0-9]+$/i", $extra) ? $extra : ''; $rsshead = $navtitle = $navigation = ''; $_DSESSION['groupid'] = $groupid = empty($ipbanned) ? (empty($groupid) ? 7 : intval($groupid)) : 6; if(!@include DISCUZ_ROOT.'./forumdata/cache/usergroup_'.$groupid.'.php') { $grouptype = $db->result_first("SELECT type FROM {$tablepre}usergroups WHERE groupid='$groupid'"); if(!empty($grouptype)) { $cachelost .= ' usergroup_'.$groupid; } else { $grouptype = 'member'; } } /* $link_login = 'logging.php?action=login'; $link_logout = 'logging.php?action=logout&amp;formhash='.FORMHASH; $link_register = $regname; */ if($discuz_uid && $_DSESSION) { if(!empty($groupexpiry) && $groupexpiry < $timestamp && !in_array(CURSCRIPT, array('wap', 'member'))) { dheader("Location: {$boardurl}member.php?action=groupexpiry"); } elseif($grouptype && $groupid != getgroupid($discuz_uid, array ( 'type' => $grouptype, 'creditshigher' => $groupcreditshigher, 'creditslower' => $groupcreditslower ), $_DSESSION)) { @extract($_DSESSION); $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/usergroup_'.intval($groupid).'.php') ? '' : ' usergroup_'.$groupid; } } $tpp = intval(empty($_DSESSION['tpp']) ? $topicperpage : $_DSESSION['tpp']); $ppp = intval(empty($_DSESSION['ppp']) ? $postperpage : $_DSESSION['ppp']); if(!in_array($adminid, array(1, 2, 3))) { $alloweditpost = $alloweditpoll = $allowstickthread = $allowmodpost = $allowdelpost = $allowmassprune = $allowrefund = $allowcensorword = $allowviewip = $allowbanip = $allowedituser = $allowmoduser = $allowbanuser = $allowpostannounce = $allowviewlog = $disablepostctrl = 0; } elseif(isset($radminid) && $adminid != $radminid && $adminid != $groupid) { $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/admingroup_'.intval($adminid).'.php') ? '' : ' admingroup_'.$groupid; } $page = isset($page) ? max(1, intval($page)) : 1; $tid = isset($tid) && is_numeric($tid) ? $tid : 0; $fid = isset($fid) && is_numeric($fid) ? $fid : 0; $typeid = isset($typeid) ? intval($typeid) : 0; $modthreadkey = isset($modthreadkey) && $modthreadkey == modthreadkey($tid) ? $modthreadkey : ''; $auditstatuson = $modthreadkey ? true : false; if(!empty($tid) || !empty($fid)) { if(empty($tid)) { $forum = $db->fetch_first("SELECT f.fid, f.*, ff.* $accessadd1 $modadd1, f.fid AS fid FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid $accessadd2 $modadd2 WHERE f.fid='$fid'"); } else { $forum = $db->fetch_first("SELECT t.tid, t.closed,".(defined('SQL_ADD_THREAD') ? SQL_ADD_THREAD : '')." f.*, ff.* $accessadd1 $modadd1, f.fid AS fid FROM {$tablepre}threads t INNER JOIN {$tablepre}forums f ON f.fid=t.fid LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid $accessadd2 $modadd2 WHERE t.tid='$tid'".($auditstatuson ? '' : " AND t.displayorder>='0'")." LIMIT 1"); $tid = $forum['tid']; } if($forum) { $fid = $forum['fid']; $forum['ismoderator'] = !empty($forum['ismoderator']) || $adminid == 1 || $adminid == 2 ? 1 : 0; foreach(array('postcredits', 'replycredits', 'threadtypes', 'threadsorts', 'digestcredits', 'postattachcredits', 'getattachcredits') as $key) { $forum[$key] = !empty($forum[$key]) ? unserialize($forum[$key]) : array(); } } else { $fid = 0; } } $styleid = intval(!empty($_GET['styleid']) ? $_GET['styleid'] : (!empty($_POST['styleid']) ? $_POST['styleid'] : (!empty($_DSESSION['styleid']) ? $_DSESSION['styleid'] : $_DCACHE['settings']['styleid']))); $styleid = intval(isset($styles[$styleid]) ? $styleid : $_DCACHE['settings']['styleid']); if(@!include DISCUZ_ROOT.'./forumdata/cache/style_'.intval(!empty($forum['styleid']) ? $forum['styleid'] : $styleid).'.php') { $cachelost .= (@include DISCUZ_ROOT.'./forumdata/cache/style_'.($styleid = $_DCACHE['settings']['styleid']).'.php') ? '' : ' style_'.$styleid; } if($cachelost) { require_once DISCUZ_ROOT.'./include/cache.func.php'; updatecache(); exit('Cache List: '.$cachelost.'<br />Caches successfully created, please refresh.'); } if(CURSCRIPT != 'wap') { if($nocacheheaders) { @dheader("Expires: 0"); @dheader("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE); @dheader("Pragma: no-cache"); } if($headercharset) { @dheader('Content-Type: text/html; charset='.$charset); } if(empty($_DCOOKIE['sid']) || $sid != $_DCOOKIE['sid']) { dsetcookie('sid', $sid, 604800, 1, true); } } $_DCOOKIE['loginuser'] = !empty($_DCOOKIE['loginuser']) ? substr(htmlspecialchars($_DCOOKIE['loginuser']), 0, 15) : ''; if(!empty($insenz['cronnextrun']) && $insenz['cronnextrun'] <= $timestamp) { require_once DISCUZ_ROOT.'./include/insenz_cron.func.php'; insenz_runcron(); } elseif($cronnextrun && $cronnextrun <= $timestamp) { require_once DISCUZ_ROOT.'./include/cron.func.php'; runcron(); } elseif(isset($insenz['statsnextrun']) && $insenz['statsnextrun'] <= $timestamp) { require_once DISCUZ_ROOT.'./include/insenz_cron.func.php'; insenz_onlinestats(); } if(isset($plugins['include']) && is_array($plugins['include'])) { foreach($plugins['include'] as $include) { if(!$include['adminid'] || ($include['adminid'] && $include['adminid'] >= $adminid)) { @include_once DISCUZ_ROOT.'./plugins/'.$include['script'].'.inc.php'; } } } if((!empty($_DCACHE['advs']) || $globaladvs) && !defined('IN_ADMINCP')) { require_once DISCUZ_ROOT.'./include/advertisements.inc.php'; } if(isset($allowvisit) && $allowvisit == 0 && !(CURSCRIPT == 'member' && ($action == 'groupexpiry' || $action == 'activate'))) { showmessage('user_banned', NULL, 'HALTED'); } elseif(!(in_array(CURSCRIPT, array('logging', 'wap', 'seccode', 'ajax')) || $adminid == 1)) { if($bbclosed) { clearcookies(); $closedreason = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='closedreason'"); showmessage($closedreason ? $closedreason : 'board_closed', NULL, 'NOPERM'); } periodscheck('visitbanperiods'); } if((!empty($fromuid) || !empty($fromuser)) && ($creditspolicy['promotion_visit'] || $creditspolicy['promotion_register'])) { require_once DISCUZ_ROOT.'/include/promotion.inc.php'; } if($uc['addfeed']) { $customaddfeed = $customaddfeed == '-1' ? 0 : ($customaddfeed == 0 ? $uc['addfeed'] : intval($customaddfeed)); } else { $customaddfeed = 0; } $rssauth = $rssstatus && $discuz_uid ? rawurlencode(authcode("$discuz_uid\t".($fid ? $fid : '')."\t".substr(md5($discuz_pw.$discuz_secques), 0, 8), 'ENCODE', md5($_DCACHE['settings']['authkey']))) : '0'; $transferstatus = $transferstatus && $allowtransfer; $feedpostnum = $feedpostnum && $uchomeurl ? intval($feedpostnum) : 0; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/common.inc.php
PHP
asf20
16,377
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_close.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($tid)) { showmessage('magics_info_nonexistence'); } $thread = getpostinfo($tid, 'tid', array('fid')); checkmagicperm($magicperm['forum'], $thread['fid']); magicthreadmod($tid); $db->query("UPDATE {$tablepre}threads SET closed='1', moderated='1' WHERE tid='$tid'"); $expiration = $timestamp + 86400; usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier'], $expiration); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_tid'], 'tid', $tid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_close.inc.php
PHP
asf20
1,012
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_hidden.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($pid)) { showmessage('magics_info_nonexistence'); } $post = getpostinfo($pid, 'pid', array('p.tid', 'p.fid', 'p.author', 'p.authorid', 'first', 'p.dateline', 'anonymous')); checkmagicperm($magicperm['forum'], $post['fid']); if($post['authorid'] != $discuz_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'] : ''; $db->query("UPDATE {$tablepre}posts SET anonymous='1' WHERE tid='$post[tid]' AND first='1'"); updatemagicthreadlog($post['tid'], $magicid, $magic['identifier'], '0', '1'); } else { $author = $thread['author']; $lastposter = ''; $db->query("UPDATE {$tablepre}posts SET anonymous='1' WHERE pid='$pid'"); } $query = $db->query("SELECT lastpost FROM {$tablepre}forums WHERE fid='$post[fid]'"); $forum['lastpost'] = explode("\t", $db->result($query, 0)); if($post['dateline'] == $forum['lastpost'][2] && ($post['author'] == $forum['lastpost'][3] || ($forum['lastpost'][3] == '' && $post['anonymous']))) { $lastpost = "$thread[tid]\t$thread[subject]\t$timestamp\t$lastposter"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$post[fid]'", 'UNBUFFERED'); } $db->query("UPDATE {$tablepre}threads SET author='$author', lastposter='$lastposter', moderated='1' WHERE tid='$post[tid]'"); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '0', $pid); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $pid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_pid'], 'pid', $pid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_hidden.inc.php
PHP
asf20
2,118
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_del.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($pid)) { showmessage('magics_info_nonexistence'); } $post = getpostinfo($pid, 'pid', array('t.tid', 't.fid', 't.authorid', 'first')); checkmagicperm($magicperm['forum'], $post['fid']); if($post['authorid'] != $discuz_uid) { showmessage('magics_operation_nopermission'); } require_once DISCUZ_ROOT.'./include/post.func.php'; if($post['first']) { foreach(array('threads', 'threadsmod', 'relatedthreads', 'posts', 'polls', 'polloptions', 'trades', 'activities', 'activityapplies', 'attachments', 'favorites', 'mythreads', 'myposts', 'subscriptions', 'debates', 'debateposts', 'typeoptionvars', 'forumrecommend') as $value) { $db->query("DELETE FROM {$tablepre}$value WHERE tid='$post[tid]'", 'UNBUFFERED'); } $query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE tid='$post[tid]'"); while($attach = $db->fetch_array($query)) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } updateforumcount($post['fid']); } else { $db->query("DELETE FROM {$tablepre}posts WHERE pid='$pid'", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}myposts WHERE pid='$pid'", 'UNBUFFERED'); $db->query("DELETE FROM {$tablepre}attachments WHERE pid='$pid'", 'UNBUFFERED'); $query = $db->query("SELECT uid, attachment, dateline, thumb, remote FROM {$tablepre}attachments WHERE pid='$pid'"); while($attach = $db->fetch_array($query)) { dunlink($attach['attachment'], $attach['thumb'], $attach['remote']); } updatethreadcount($post['tid']); } usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '0', $pid); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $pid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_pid'], 'pid', $pid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_del.inc.php
PHP
asf20
2,192
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_renew.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($pid)) { showmessage('magics_info_nonexistence'); } $post = getpostinfo($pid, 'pid', array('p.tid', 'p.fid', 'p.authorid', 'first', 'anonymous')); checkmagicperm($magicperm['forum'], $post['fid']); $query = $db->query("SELECT username FROM {$tablepre}members WHERE uid='$post[authorid]'"); $author = daddslashes($db->result($query, 0), 1); $thread = getpostinfo($post['tid'], 'tid', array('tid', 'subject', 'author', 'replies', 'lastposter')); if($post['first']) { $lastposter = $thread['replies'] > 0 ? $thread['lastposter'] : $author; $db->query("UPDATE {$tablepre}posts SET anonymous='0' WHERE tid='$post[tid]' AND first='1'"); updatemagicthreadlog($post['tid'], $magicid, $magic['identifier'], '0', '1'); } else { $lastposter = $author; $author = $thread['author']; $db->query("UPDATE {$tablepre}posts SET anonymous='0' WHERE pid='$pid'"); } $query = $db->query("SELECT lastpost FROM {$tablepre}forums WHERE fid='$post[fid]'"); $forum['lastpost'] = explode("\t", $db->result($query, 0)); if($thread['subject'] == $forum['lastpost'][1] && ($forum['lastpost'][3] == '' && $post['anonymous'])) { $lastpost = "$thread[tid]\t$thread[subject]\t$timestamp\t$lastposter"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$post[fid]'", 'UNBUFFERED'); } $db->query("UPDATE {$tablepre}threads SET author='$author', lastposter='$lastposter', moderated='1' WHERE tid='$post[tid]'"); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '0', $pid); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $pid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_pid'], 'pid', $pid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_renew.inc.php
PHP
asf20
2,089
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_open.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($tid)) { showmessage('magics_info_nonexistence'); } $thread = getpostinfo($tid, 'tid', array('fid')); checkmagicperm($magicperm['forum'], $thread['fid']); magicthreadmod($tid); $db->query("UPDATE {$tablepre}threads SET closed='0', moderated='1' WHERE tid='$tid'"); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier']); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_tid'], 'tid', $tid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_open.inc.php
PHP
asf20
962
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_up.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($tid)) { showmessage('magics_info_nonexistence'); } $thread = getpostinfo($tid, 'tid', array('fid')); checkmagicperm($magicperm['forum'], $thread['fid']); $db->query("UPDATE {$tablepre}threads SET lastpost='$timestamp', moderated='1' WHERE tid='$tid'"); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier']); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_tid'], 'tid', $tid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_up.inc.php
PHP
asf20
947
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_reporter.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($username)) { showmessage('magics_info_nonexistence'); } $member = getuserinfo($username, array('uid', 'groupid')); checkmagicperm($magicperm['targetgroups'], $member['groupid']); $query = $db->query("SELECT action FROM {$tablepre}sessions WHERE uid='$member[uid]'"); if(!$msession = $db->fetch_array($query)) { $magicmessage = 'magics_RTK_on_message'; } else { include language('actions'); $magicmessage = 'magics_RTK_off_message'; } usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '', '', $member['uid']); showmessage($magicmessage, '', 1); } function showmagic() { global $username, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_username'], 'username', $username, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_reporter.inc.php
PHP
asf20
1,112
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_see.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($pid)) { showmessage('magics_info_nonexistence'); } $post = getpostinfo($pid, 'pid', array('p.fid', 'useip')); checkmagicperm($magicperm['forum'], $post['fid']); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '0', $pid); showmessage('magics_SEK_message', '', 1); } function showmagic() { global $pid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_pid'], 'pid', $pid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_see.inc.php
PHP
asf20
789
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_money.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { $getmoney = rand(1, intval($magic['price'] * 1.5)); $db->query("UPDATE {$tablepre}members SET extcredits$creditstransextra[3]=extcredits$creditstransextra[3]+'$getmoney' WHERE uid='$discuz_uid'"); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', '', '', $discuz_uid); showmessage('magics_MOK_message', '', 1); } function showmagic() { global $lang; magicshowtips($lang['MOK_info'], $lang['option']); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_money.inc.php
PHP
asf20
731
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_color.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($highlight_color)) { showmessage('magics_info_nonexistence'); } $thread = getpostinfo($tid, 'tid', array('fid')); checkmagicperm($magicperm['forum'], $thread['fid']); magicthreadmod($tid); $db->query("UPDATE {$tablepre}threads SET highlight='$highlight_color', moderated='1' WHERE tid='$tid'", 'UNBUFFERED'); $expiration = $timestamp + 86400; usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier'], $expiration); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; magicshowsetting('', '', '', ' <table cellspacing="0" cellpadding="2" style="margin-top:-20px;"> <tr> <td>'.$lang['target_tid'].'</td> <td>'.$lang['CCK_color'].'</td> </tr> <tr> <td><input type="text" value="'.$tid.'" name="tid" size="12" class="txt" /></td> <td class="hasdropdownbtn" style="position: relative;"> <input type="hidden" id="highlight_color" name="highlight_color" /> <input type="text" readonly="readonly" class="txt" id="color_bg" style="width: 18px; border-right: none;" /> <a class="dropdownbtn" onclick="display(\'color_menu\')" href="javascript:;">^</a> <div id="color_menu" class="color_menu" style="display: none; clear: both; left: auto; top: auto;"> <a href="javascript:;" onclick="switchhl(this, 1)" style="float:left;background:#EE1B2E;color:#EE1B2E;">#EE1B2E</a> <a href="javascript:;" onclick="switchhl(this, 2)" style="float:left;background:#EE5023;color:#EE5023;">#EE5023</a> <a href="javascript:;" onclick="switchhl(this, 3)" style="float:left;background:#996600;color:#996600;">#996600</a> <a href="javascript:;" onclick="switchhl(this, 4)" style="float:left;background:#3C9D40;color:#3C9D40;">#3C9D40</a> <a href="javascript:;" onclick="switchhl(this, 5)" style="float:left;background:#2897C5;color:#2897C5;">#2897C5</a> <a href="javascript:;" onclick="switchhl(this, 6)" style="float:left;background:#2B65B7;color:#2B65B7;">#2B65B7</a> <a href="javascript:;" onclick="switchhl(this, 7)" style="float:left;background:#8F2A90;color:#8F2A90;">#8F2A90</a> <a href="javascript:;" onclick="switchhl(this, 8)" style="float:left;background:#EC1282;color:#EC1282;">#EC1282</a> </div> </td> </tr> </table> <script type="text/javascript" reload="1"> function switchhl(obj, v) { $(\'highlight_color\').value = v; $(\'color_bg\').style.backgroundColor = obj.style.backgroundColor; $(\'color_menu\').style.display = \'none\'; } </script> '); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_color.inc.php
PHP
asf20
2,922
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_move.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($tid) && empty($moveto)) { showmessage('magics_info_nonexistence'); } $thread = getpostinfo($tid, 'tid', array('fid', 'tid', 'authorid', 'special')); checkmagicperm($magicperm['forum'], $thread['fid']); if($thread['authorid'] != $discuz_uid) { showmessage('magics_operation_nopermission'); } if($thread['special']) { $query = $db->query("SELECT allowpostspecial FROM {$tablepre}forums WHERE fid='$moveto'"); if(!substr(sprintf('%04b', $forum['allowpostspecial']), -$thread['special'], 1)) { showmessage('admin_move_nopermission'); } } $query = $db->query("SELECT postperm FROM {$tablepre}forumfields WHERE fid='$moveto'"); if($forum = $db->fetch_array($query)) { if(!$forum['postperm'] && !$allowpost) { showmessage('group_nopermission'); } elseif($forum['postperm'] && !forumperm($forum['postperm'])) { showmessage('post_forum_newthread_nopermission'); } } $db->query("UPDATE {$tablepre}threads SET fid='$moveto', moderated='1' WHERE tid='$tid'"); $db->query("UPDATE {$tablepre}posts SET fid='$moveto' WHERE tid='$tid'"); require_once DISCUZ_ROOT.'./include/post.func.php'; updateforumcount($moveto); updateforumcount($thread['fid']); usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier']); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; require_once DISCUZ_ROOT.'./include/forum.func.php'; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_tid'], 'tid', $tid, 'text'); magicshowsetting($lang['MVK_target'], '', '', '<select name="moveto">'.forumselect().'</select>'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_move.inc.php
PHP
asf20
2,050
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: magic_top.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(submitcheck('usesubmit')) { if(empty($tid)) { showmessage('magics_info_nonexistence'); } $post = getpostinfo($tid, 'tid', array('fid')); checkmagicperm($magicperm['forum'], $post['fid']); magicthreadmod($tid); $db->query("UPDATE {$tablepre}threads SET displayorder='1', moderated='1' WHERE tid='$tid'"); $expiration = $timestamp + 86400; usemagic($magicid, $magic['num']); updatemagiclog($magicid, '2', '1', '0', $tid); updatemagicthreadlog($tid, $magicid, $magic['identifier'], $expiration); showmessage('magics_operation_succeed', '', 1); } function showmagic() { global $tid, $lang; magicshowtype($lang['option'], 'top'); magicshowsetting($lang['target_tid'], 'tid', $tid, 'text'); magicshowtype('', 'bottom'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/include/magic/magic_top.inc.php
PHP
asf20
1,012
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: forumdisplay.php 17459 2008-12-24 01:20:28Z zhaoxiongfei $ */ define('CURSCRIPT', 'forumdisplay'); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./include/forum.func.php'; $discuz_action = 2; if($forum['redirect']) { dheader("Location: $forum[redirect]"); } elseif($forum['type'] == 'group') { dheader("Location: {$indexname}?gid=$fid"); } elseif(empty($forum['fid'])) { showmessage('forum_nonexistence', NULL, 'HALTED'); } $showoldetails = isset($showoldetails) ? $showoldetails : ''; switch($showoldetails) { case 'no': dsetcookie('onlineforum', 0, 86400 * 365); break; case 'yes': dsetcookie('onlineforum', 1, 86400 * 365); break; } $forum['name'] = strip_tags($forum['name']) ? strip_tags($forum['name']) : $forum['name']; if($forum['type'] == 'forum') { $navigation = '&raquo; '.$forum['name']; $navtitle = $forum['name']; } else { $forumup = $_DCACHE['forums'][$forum['fup']]['name']; $navigation = '&raquo; <a href="forumdisplay.php?fid='.$forum['fup'].'">'.$forumup.'</a> &raquo; '.$forum['name']; $navtitle = $forum['name'].' - '.strip_tags($forumup); } $rsshead = $rssstatus ? ('<link rel="alternate" type="application/rss+xml" title="'.$bbname.' - '.$navtitle.'" href="'.$boardurl.'rss.php?fid='.$fid.'&amp;auth='.$rssauth."\" />\n") : ''; $navtitle .= ' - '; $metakeywords = !$forum['keywords'] ? $forum['name'] : $forum['keywords']; $metadescription = !$forum['description'] ? $forum['name'] : strip_tags($forum['description']); if($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) { showmessage('forum_nopermission', NULL, 'NOPERM'); } elseif ($forum['formulaperm']) { formulaperm($forum['formulaperm']); } if($forum['password']) { if($action == 'pwverify') { if($pw != $forum['password']) { showmessage('forum_passwd_incorrect', NULL, 'HALTED'); } else { dsetcookie('fidpw'.$fid, $pw); showmessage('forum_passwd_correct', "forumdisplay.php?fid=$fid"); } } elseif($forum['password'] != $_DCOOKIE['fidpw'.$fid]) { include template('forumdisplay_passwd'); exit(); } } $sdb = loadmultiserver(); foreach(array('modarea_c', 'sidebar') as $key) { if(!isset($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], $key) === FALSE) { $collapseimg[$key] = 'collapsed_no'; $collapse[$key] = ''; } else { $collapseimg[$key] = 'collapsed_yes'; $collapse[$key] = 'display: none'; } } $forum['modrecommend'] = $forum['modrecommend'] ? unserialize($forum['modrecommend']) : array(); if($forum['modrecommend'] && $forum['modrecommend']['open']) { $forum['recommendlist'] = recommendupdate($fid, $forum['modrecommend']); } $toptablewidth = $forum['rules'] && $forum['recommendlist'] ? '50%' : '100%'; $infosidestatus[0] = !empty($infosidestatus['f'.$fid][0]) ? $infosidestatus['f'.$fid][0] : $infosidestatus[0]; $infosidestatus['allow'] = $infosidestatus['allow'] && $infosidestatus[0] && $infosidestatus[0] != -1 ? (!$collapse['sidebar'] ? 2 : 1) : 0; $forum['typemodels'] = $forum['typemodels'] ? unserialize($forum['typemodels']) : array(); $moderatedby = moddisplay($forum['moderators'], 'forumdisplay'); $highlight = empty($highlight) ? '' : htmlspecialchars($highlight); if($forum['autoclose']) { $closedby = $forum['autoclose'] > 0 ? 'dateline' : 'lastpost'; $forum['autoclose'] = abs($forum['autoclose']) * 86400; } $subexists = 0; foreach($_DCACHE['forums'] as $sub) { if($sub['type'] == 'sub' && $sub['fup'] == $fid && (!$hideprivate || !$sub['viewperm'] || forumperm($sub['viewperm']) || strstr($sub['users'], "\t$discuz_uid\t"))) { $subexists = 1; $sublist = array(); $sql = $accessmasks ? "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm, a.allowview FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid WHERE fup='$fid' AND status>0 AND type='sub' ORDER BY f.displayorder" : "SELECT f.fid, f.fup, f.type, f.name, f.threads, f.posts, f.todayposts, f.lastpost, ff.description, ff.moderators, ff.icon, ff.viewperm FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff USING(fid) WHERE f.fup='$fid' AND f.status>0 AND f.type='sub' ORDER BY f.displayorder"; $query = $sdb->query($sql); while($sub = $sdb->fetch_array($query)) { if(forum($sub)) { $sub['orderid'] = count($sublist); $sublist[] = $sub; } } break; } } if($subexists) { if($forum['forumcolumns']) { $forum['forumcolwidth'] = floor(100 / $forum['forumcolumns']).'%'; $forum['subscount'] = count($sublist); $forum['endrows'] = ''; if($colspan = $forum['subscount'] % $forum['forumcolumns']) { while(($forum['forumcolumns'] - $colspan) > 0) { $forum['endrows'] .= '<td>&nbsp;</td>'; $colspan ++; } $forum['endrows'] .= '</tr>'; } } if(empty($_COOKIE['discuz_collapse']) || strpos($_COOKIE['discuz_collapse'], 'subforum_'.$fid) === FALSE) { $collapse['subforum'] = ''; $collapseimg['subforum'] = 'collapsed_no.gif'; } else { $collapse['subforum'] = 'display: none'; $collapseimg['subforum'] = 'collapsed_yes.gif'; } } if($forum['simple'] & 1) { $forummenu = ''; if($forumjump) { $forummenu = forumselect(FALSE, 1); } include template('forumdisplay_simple'); exit(); } $page = isset($page) ? max(1, intval($page)) : 1; $page = $threadmaxpages && $page > $threadmaxpages ? 1 : $page; $start_limit = ($page - 1) * $tpp; if($page == 1) { if($_DCACHE['announcements_forum']) { $announcement = $_DCACHE['announcements_forum']; $announcement['starttime'] = gmdate($dateformat, $announcement['starttime'] + ($timeoffset * 3600)); } else { $announcement = NULL; } } $forumdisplayadd = $filteradd = $sortadd = $typeadd = ''; $specialtype = array('poll' => 1, 'trade' => 2, 'reward' => 3, 'activity' => 4, 'debate' => 5, 'video' => 6); if(isset($filter)) { if($filter == 'digest') { $forumdisplayadd .= '&amp;filter=digest'; $filteradd = "AND digest>'0'"; } elseif($filter == 'type' && $forum['threadtypes']['listable'] && $typeid && isset($forum['threadtypes']['types'][$typeid])) { $forumdisplayadd .= "&amp;filter=type&amp;typeid=$typeid"; $typeadd = "&amp;typeid=$typeid"; $filteradd = "AND typeid='$typeid'"; $filteradd .= $sortid ? "AND sortid='$sortid'" : ''; } elseif($filter == 'sort' && $forum['threadsorts']['listable'] && $sortid && isset($forum['threadsorts']['types'][$sortid])) { $forumdisplayadd .= "&amp;filter=sort&amp;sortid=$sortid"; $sortadd = "&amp;sortid=$sortid"; $filteradd = "AND sortid='$sortid'"; $filteradd .= $typeid ? "AND typeid='$typeid'" : ''; } elseif(preg_match("/^\d+$/", $filter)) { $forumdisplayadd .= "&amp;filter=$filter"; $filteradd = $filter ? "AND lastpost>='".($timestamp - $filter)."'" : ''; } elseif(isset($specialtype[$filter])) { $forumdisplayadd .= "&amp;filter=$filter"; $filteradd = "AND special='$specialtype[$filter]'"; } else { $filter = ''; } } else { $filter = ''; } isset($orderby) && in_array($orderby, array('lastpost', 'dateline', 'replies', 'views')) ? $forumdisplayadd .= "&amp;orderby=$orderby" : $orderby = $_DCACHE['forums'][$fid]['orderby'] ? $_DCACHE['forums'][$fid]['orderby'] : 'lastpost'; isset($ascdesc) && in_array($ascdesc, array('ASC', 'DESC')) ? $forumdisplayadd .= "&amp;ascdesc=$ascdesc" : $ascdesc = $_DCACHE['forums'][$fid]['ascdesc'] ? $_DCACHE['forums'][$fid]['ascdesc'] : 'DESC'; $check = array(); $check[$filter] = $check[$orderby] = $check[$ascdesc] = 'selected="selected"'; if($whosonlinestatus == 2 || $whosonlinestatus == 3) { $whosonlinestatus = 1; $onlineinfo = explode("\t", $onlinerecord); $detailstatus = $showoldetails == 'yes' || (((!isset($_DCOOKIE['onlineforum']) && !$whosonline_contract) || $_DCOOKIE['onlineforum']) && $onlineinfo[0] < 500 && !$showoldetails); if($detailstatus) { updatesession(); @include language('actions'); $whosonline = array(); $forumname = strip_tags($forum['name']); $guestwhere = isset($_DCACHE['onlinelist'][7]) ? '' : "uid>'0' AND"; $query = $db->query("SELECT uid, groupid, username, invisible, lastactivity, action FROM {$tablepre}sessions WHERE $guestwhere fid='$fid' AND invisible='0'"); if($db->num_rows($query)) { $whosonlinestatus = 1; while($online = $db->fetch_array($query)) { if($online['uid']) { $online['icon'] = isset($_DCACHE['onlinelist'][$online['groupid']]) ? $_DCACHE['onlinelist'][$online['groupid']] : $_DCACHE['onlinelist'][0]; } else { $online['icon'] = $_DCACHE['onlinelist'][7]; $online['username'] = $_DCACHE['onlinelist']['guest']; } $online['action'] = $actioncode[$online['action']]; $online['lastactivity'] = gmdate($timeformat, $online['lastactivity'] + ($timeoffset * 3600)); $whosonline[] = $online; } } unset($online); } } else { $whosonlinestatus = 0; } if(empty($filter)) { $threadcount = $forum['threads']; } else { $threadcount = $sdb->result_first("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'"); } $thisgid = $forum['type'] == 'forum' ? $forum['fup'] : $_DCACHE['forums'][$forum['fup']]['fup']; if($globalstick && $forum['allowglobalstick']) { $stickytids = $_DCACHE['globalstick']['global']['tids'].(empty($_DCACHE['globalstick']['categories'][$thisgid]['count']) ? '' : ','.$_DCACHE['globalstick']['categories'][$thisgid]['tids']); $stickycount = $_DCACHE['globalstick']['global']['count'] + $_DCACHE['globalstick']['categories'][$thisgid]['count']; } else { $stickycount = $stickytids = 0; } $filterbool = !empty($filter) && in_array($filter, array('digest', 'type', 'activity', 'poll', 'trade', 'reward', 'debate', 'video')); $threadcount += $filterbool ? 0 : $stickycount; $multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd", $threadmaxpages); $extra = rawurlencode("page=$page$forumdisplayadd"); $separatepos = 0; $threadlist = array(); $colorarray = array('', '#EE1B2E', '#EE5023', '#996600', '#3C9D40', '#2897C5', '#2B65B7', '#8F2A90', '#EC1282'); $displayorderadd = !$filterbool && $stickycount ? 't.displayorder IN (0, 1)' : 't.displayorder IN (0, 1, 2, 3)'; if(($start_limit && $start_limit > $stickycount) || !$stickycount || $filterbool) { $querysticky = ''; $query = $sdb->query("SELECT t.* FROM {$tablepre}threads t WHERE t.fid='$fid' $filteradd AND $displayorderadd ORDER BY t.displayorder DESC, t.$orderby $ascdesc LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp"); } else { $querysticky = $sdb->query("SELECT t.* FROM {$tablepre}threads t WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3) ORDER BY displayorder DESC, $orderby $ascdesc LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp)); if($tpp - $stickycount + $start_limit > 0) { $query = $sdb->query("SELECT t.* FROM {$tablepre}threads t WHERE t.fid='$fid' $filteradd AND $displayorderadd ORDER BY displayorder DESC, $orderby $ascdesc LIMIT ".($tpp - $stickycount + $start_limit)); } else { $query = ''; } } if($page < 4 && !(empty($_DCACHE['floatthreads']['categories'][$thisgid]) && empty($_DCACHE['floatthreads']['forums'][$fid]))) { $queryfloat = $sdb->query("SELECT t.* FROM {$tablepre}threads t WHERE t.tid IN (".(!empty($_DCACHE['floatthreads']['categories'][$thisgid]) ? $_DCACHE['floatthreads']['categories'][$thisgid] : 0).','.(!empty($_DCACHE['floatthreads']['forums'][$fid]) ? $_DCACHE['floatthreads']['forums'][$fid] : 0).") AND t.displayorder IN (4, 5) ORDER BY displayorder DESC"); } else { $queryfloat = ''; } $ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp; while(($querysticky && $thread = $sdb->fetch_array($querysticky)) || ($query && $thread = $sdb->fetch_array($query)) || ($queryfloat && $thread = $sdb->fetch_array($queryfloat))) { $thread['icon'] = isset($_DCACHE['icons'][$thread['iconid']]) ? '<img src="images/icons/'.$_DCACHE['icons'][$thread['iconid']].'" alt="Icon'.$thread['iconid'].'" class="icon" />' : '&nbsp;'; $thread['lastposterenc'] = rawurlencode($thread['lastposter']); $thread['typeid'] = $thread['typeid'] && !empty($forum['threadtypes']['prefix']) && isset($forum['threadtypes']['types'][$thread['typeid']]) ? '<em>[<a href="forumdisplay.php?fid='.$fid.'&amp;filter=type&amp;typeid='.$thread['typeid'].'">'.$forum['threadtypes']['types'][$thread['typeid']].'</a>]</em>' : ''; $thread['sortid'] = $thread['sortid'] && !empty($forum['threadsorts']['prefix']) && isset($forum['threadsorts']['types'][$thread['sortid']]) ? '<em>[<a href="forumdisplay.php?fid='.$fid.'&amp;filter=sort&amp;sortid='.$thread['sortid'].'">'.$forum['threadsorts']['types'][$thread['sortid']].'</a>]</em>' : ''; $thread['multipage'] = ''; $topicposts = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1; $thread['special'] == 3 && $thread['price'] < 0 && $thread['replies']--; if($topicposts > $ppp) { $pagelinks = ''; $thread['pages'] = ceil($topicposts / $ppp); for($i = 2; $i <= 6 && $i <= $thread['pages']; $i++) { $pagelinks .= "<a href=\"viewthread.php?tid=$thread[tid]&amp;extra=$extra&amp;page=$i\">$i</a> "; } if($thread['pages'] > 6) { $pagelinks .= " .. <a href=\"viewthread.php?tid=$thread[tid]&amp;extra=$extra&amp;page=$thread[pages]\">$thread[pages]</a> "; } $thread['multipage'] = '&nbsp;... '.$pagelinks; } if($thread['highlight']) { $string = sprintf('%02d', $thread['highlight']); $stylestr = sprintf('%03b', $string[0]); $thread['highlight'] = ' style="'; $thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : ''; $thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : ''; $thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : ''; $thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : ''; $thread['highlight'] .= '"'; } else { $thread['highlight'] = ''; } $thread['moved'] = 0; if($thread['closed'] || ($forum['autoclose'] && $timestamp - $thread[$closedby] > $forum['autoclose'])) { $thread['new'] = 0; if($thread['closed'] > 1) { $thread['moved'] = $thread['tid']; $thread['tid'] = $thread['closed']; $thread['replies'] = '-'; $thread['views'] = '-'; } $thread['folder'] = 'lock'; } else { $thread['folder'] = 'common'; if($lastvisit < $thread['lastpost'] && (empty($_DCOOKIE['oldtopics']) || strpos($_DCOOKIE['oldtopics'], 'D'.$thread['tid'].'D') === FALSE)) { $thread['new'] = 1; $thread['folder'] = 'new'; } else { $thread['new'] = 0; } if($thread['replies'] > $thread['views']) { $thread['views'] = $thread['replies']; } if($thread['replies'] >= $hottopic) { $thread['folder'] = 'hot'; } } $thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600); $thread['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); if(in_array($thread['displayorder'], array(1, 2, 3))) { $thread['id'] = 'stickthread_'.$thread['tid']; $separatepos++; } elseif(in_array($thread['displayorder'], array(4, 5))) { $thread['id'] = 'floatthread_'.$thread['tid']; } else { $thread['id'] = 'normalthread_'.$thread['tid']; } $threadlist[] = $thread; } $separatepos = $separatepos ? $separatepos + 1 : ($announcement ? 1 : 0); $visitedforums = $visitedforums ? visitedforums() : ''; $forummenu = ''; $usesigcheck = $discuz_uid && $sigstatus ? 'checked="checked"' : ''; $allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || ($forum['allowpost'] == 1 && $allowpost); $fastpost = $fastpost && !$forum['allowspecialonly']; $allowpost = $forum['allowpost'] != -1 ? $allowpost : false; $addfeedcheck = $customaddfeed & 1 ? 'checked="checked"': ''; $showpoll = $showtrade = $showreward = $showactivity = $showdebate = $showvideo = 0; if($forum['allowpostspecial']) { $showpoll = $forum['allowpostspecial'] & 1; $showtrade = $forum['allowpostspecial'] & 2; $showreward = isset($extcredits[$creditstransextra[2]]) && ($forum['allowpostspecial'] & 4); $showactivity = $forum['allowpostspecial'] & 8; $showdebate = $forum['allowpostspecial'] & 16; $showvideo = ($forum['allowpostspecial'] & 32) && $videoopen; } if($allowpost) { $allowpostpoll = $allowpostpoll && $showpoll; $allowposttrade = $allowposttrade && $showtrade; $allowpostreward = $allowpostreward && $showreward; $allowpostactivity = $allowpostactivity && $showactivity; $allowpostdebate = $allowpostdebate && $showdebate; $allowpostvideo = $allowpostvideo && $showvideo; } if($forumjump) { $forummenu = forumselect(FALSE, 1); } include template('forumdisplay'); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/forumdisplay.php
PHP
asf20
17,301
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: mail.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class mailcontrol extends base { function __construct() { $this->mailcontrol(); } function mailcontrol() { parent::__construct(); $this->init_input(); } function onadd() { $this->load('mail'); $mail = array(); $mail['appid'] = UC_APPID; $mail['uids'] = explode(',', $this->input('uids')); $mail['emails'] = explode(',', $this->input('emails')); $mail['subject'] = $this->input('subject'); $mail['message'] = $this->input('message'); $mail['charset'] = $this->input('charset'); $mail['htmlon'] = intval($this->input('htmlon')); $mail['level'] = abs(intval($this->input('level'))); $mail['frommail'] = $this->input('frommail'); $mail['dateline'] = $this->time; return $_ENV['mail']->add($mail); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/mail.php
PHP
asf20
993
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: pm.php 836 2008-12-05 02:25:48Z monkey $ */ !defined('IN_UC') && exit('Access Denied'); define('PMLIMIT1DAY_ERROR', -1); define('PMFLOODCTRL_ERROR', -2); define('PMMSGTONOTFRIEND', -3); define('PMSENDREGDAYS', -4); class pmcontrol extends base { function __construct() { $this->pmcontrol(); } function pmcontrol() { parent::__construct(); $this->load('user'); $this->load('pm'); } function oncheck_newpm() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $more = $this->input('more'); $result = $_ENV['pm']->check_newpm($this->user['uid'], $more); if($more == 3) { require_once UC_ROOT.'lib/uccode.class.php'; $this->uccode = new uccode(); $result['lastmsg'] = $this->uccode->complie($result['lastmsg']); } return $result; } function onsendpm() { $this->init_input(); $fromuid = $this->input('fromuid'); $msgto = $this->input('msgto'); $subject = $this->input('subject'); $message = $this->input('message'); $replypmid = $this->input('replypmid'); $isusername = $this->input('isusername'); if($fromuid) { $user = $_ENV['user']->get_user_by_uid($fromuid); $user = daddslashes($user, 1); if(!$user) { return 0; } $this->user['uid'] = $user['uid']; $this->user['username'] = $user['username']; } else { $this->user['uid'] = 0; $this->user['username'] = ''; } if($replypmid) { $isusername = 1; $pms = $_ENV['pm']->get_pm_by_pmid($this->user['uid'], $replypmid); if($pms[0]['msgfromid'] == $this->user['uid']) { $user = $_ENV['user']->get_user_by_uid($pms[0]['msgtoid']); $msgto = $user['username']; } else { $msgto = $pms[0]['msgfrom']; } } $msgto = array_unique(explode(',', $msgto)); $isusername && $msgto = $_ENV['user']->name2id($msgto); $blackls = $_ENV['pm']->get_blackls($this->user['uid'], $msgto); if($fromuid) { if($this->settings['pmsendregdays']) { if($user['regdate'] > $this->time - $this->settings['pmsendregdays'] * 86400) { return PMSENDREGDAYS; } } $this->load('friend'); if(count($msgto) > 1 && !($is_friend = $_ENV['friend']->is_friend($fromuid, $msgto, 3))) { return PMMSGTONOTFRIEND; } $pmlimit1day = $this->settings['pmlimit1day'] && $_ENV['pm']->count_pm_by_fromuid($this->user['uid'], 86400) > $this->settings['pmlimit1day']; if($pmlimit1day || ($this->settings['pmfloodctrl'] && $_ENV['pm']->count_pm_by_fromuid($this->user['uid'], $this->settings['pmfloodctrl']))) { if(!$_ENV['friend']->is_friend($fromuid, $msgto, 3)) { if(!$_ENV['pm']->is_reply_pm($fromuid, $msgto)) { if($pmlimit1day) { return PMLIMIT1DAY_ERROR; } else { return PMFLOODCTRL_ERROR; } } } } } $lastpmid = 0; foreach($msgto as $uid) { if(!$fromuid || !in_array('{ALL}', $blackls[$uid])) { $blackls[$uid] = $_ENV['user']->name2id($blackls[$uid]); if(!$fromuid || isset($blackls[$uid]) && !in_array($this->user['uid'], $blackls[$uid])) { $lastpmid = $_ENV['pm']->sendpm($subject, $message, $this->user, $uid, $replypmid); } } } return $lastpmid; } function ondelete() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $id = $_ENV['pm']->deletepm($this->user['uid'], $this->input('pmids')); return $id; } function ondeleteuser() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $id = $_ENV['pm']->deleteuidpm($this->user['uid'], $this->input('touids')); return $id; } function onreadstatus() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $_ENV['pm']->set_pm_status($this->user['uid'], $this->input('uids'), $this->input('pmids'), $this->input('status')); } function onignore() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); return $_ENV['pm']->set_ignore($this->user['uid']); } function onls() { $this->init_input(); $pagesize = $this->input('pagesize'); $folder = $this->input('folder'); $filter = $this->input('filter'); $page = $this->input('page'); $folder = in_array($folder, array('newbox', 'inbox', 'outbox', 'searchbox')) ? $folder : 'inbox'; if($folder != 'searchbox') { $filter = $filter ? (in_array($filter, array('newpm', 'privatepm', 'systempm', 'announcepm')) ? $filter : '') : ''; } $msglen = $this->input('msglen'); $this->user['uid'] = intval($this->input('uid')); if($folder != 'searchbox') { $pmnum = $_ENV['pm']->get_num($this->user['uid'], $folder, $filter); $start = $this->page_get_start($page, $pagesize, $pmnum); } else { $pmnum = $pagesize; $start = ($page - 1) * $pagesize; } if($pagesize > 0) { $pms = $_ENV['pm']->get_pm_list($this->user['uid'], $pmnum, $folder, $filter, $start, $pagesize); if(is_array($pms) && !empty($pms)) { foreach($pms as $key => $pm) { if($msglen) { $pms[$key]['message'] = htmlspecialchars($_ENV['pm']->removecode($pms[$key]['message'], $msglen)); } else { unset($pms[$key]['message']); } unset($pms[$key]['folder']); } } $result['data'] = $pms; } $result['count'] = $pmnum; return $result; } function onviewnode() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $pmid = $_ENV['pm']->pmintval($this->input('pmid')); $type = $this->input('type'); $pm = $_ENV['pm']->get_pmnode_by_pmid($this->user['uid'], $pmid, $type); if($pm) { require_once UC_ROOT.'lib/uccode.class.php'; $this->uccode = new uccode(); $pm['message'] = $this->uccode->complie($pm['message']); return $pm; } } function onview() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $touid = $this->input('touid'); $pmid = $_ENV['pm']->pmintval($this->input('pmid')); $daterange = $this->input('daterange'); if(empty($pmid)) { $daterange = empty($daterange) ? 1 : $daterange; $today = $this->time - ($this->time + $this->settings['timeoffset']) % 86400; if($daterange == 1) { $starttime = $today; } elseif($daterange == 2) { $starttime = $today - 86400; } elseif($daterange == 3) { $starttime = $today - 172800; } elseif($daterange == 4) { $starttime = $today - 604800; } elseif($daterange == 5) { $starttime = 0; } $endtime = $this->time; $pms = $_ENV['pm']->get_pm_by_touid($this->user['uid'], $touid, $starttime, $endtime); } else { $pms = $_ENV['pm']->get_pm_by_pmid($this->user['uid'], $pmid); } require_once UC_ROOT.'lib/uccode.class.php'; $this->uccode = new uccode(); $status = FALSE; foreach($pms as $key => $pm) { $pms[$key]['message'] = $this->uccode->complie($pms[$key]['message']); !$status && $status = $pm['msgtoid'] && $pm['new']; } $status && $_ENV['pm']->set_pm_status($this->user['uid'], $touid, $pmid); return $pms; } function onblackls_get() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); return $_ENV['pm']->get_blackls($this->user['uid']); } function onblackls_set() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $blackls = $this->input('blackls'); return $_ENV['pm']->set_blackls($this->user['uid'], $blackls); } function onblackls_add() { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $username = $this->input('username'); return $_ENV['pm']->update_blackls($this->user['uid'], $username, 1); } function onblackls_delete($arr) { $this->init_input(); $this->user['uid'] = intval($this->input('uid')); $username = $this->input('username'); return $_ENV['pm']->update_blackls($this->user['uid'], $username, 2); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/pm.php
PHP
asf20
8,108
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: domain.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class domaincontrol extends base { function __construct() { $this->domaincontrol(); } function domaincontrol() { parent::__construct(); $this->init_input(); $this->load('domain'); } function onls() { return $_ENV['domain']->get_list(1, 9999, 9999); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/domain.php
PHP
asf20
511
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: friend.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class friendcontrol extends base { function __construct() { $this->friendcontrol(); } function friendcontrol() { parent::__construct(); $this->init_input(); $this->load('friend'); } function ondelete() { $uid = intval($this->input('uid')); $friendids = $this->input('friendids'); $id = $_ENV['friend']->delete($uid, $friendids); return $id; } function onadd() { $uid = intval($this->input('uid')); $friendid = $this->input('friendid'); $comment = $this->input('comment'); $id = $_ENV['friend']->add($uid, $friendid, $comment); return $id; } function ontotalnum() { $uid = intval($this->input('uid')); $direction = intval($this->input('direction')); $totalnum = $_ENV['friend']->get_totalnum_by_uid($uid, $direction); return $totalnum; } function onls() { $uid = intval($this->input('uid')); $page = intval($this->input('page')); $pagesize = intval($this->input('pagesize')); $totalnum = intval($this->input('totalnum')); $direction = intval($this->input('direction')); $pagesize = $pagesize ? $pagesize : UC_PPP; $totalnum = $totalnum ? $totalnum : $_ENV['friend']->get_totalnum_by_uid($uid); $data = $_ENV['friend']->get_list($uid, $page, $pagesize, $totalnum, $direction); return $data; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/friend.php
PHP
asf20
1,532
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: app.php 884 2008-12-16 01:13:31Z monkey $ */ !defined('IN_UC') && exit('Access Denied'); class appcontrol extends base { function __construct() { $this->appcontrol(); } function appcontrol() { parent::__construct(); $this->load('app'); } function onls() { $this->init_input(); $applist = $_ENV['app']->get_apps('appid, type, name, url, tagtemplates, viewprourl, synlogin'); $applist2 = array(); foreach($applist as $key => $app) { $app['tagtemplates'] = $this->unserialize($app['tagtemplates']); $applist2[$app['appid']] = $app; } return $applist2; } function onadd() { } function onucinfo() { } function _random($length, $numeric = 0) { } function _generate_key() { } function _format_notedata($notedata) { } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/app.php
PHP
asf20
925
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: feed.php 883 2008-12-16 00:51:21Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); class feedcontrol extends base { function __construct() { $this->feedcontrol(); } function feedcontrol() { parent::__construct(); $this->init_input(); } function onadd() { $this->load('misc'); $appid = intval($this->input('appid')); $icon = $this->input('icon'); $uid = intval($this->input('uid')); $username = $this->input('username'); $body_data = $_ENV['misc']->array2string($this->input('body_data')); $title_data = $_ENV['misc']->array2string($this->input('title_data')); $title_template = $this->_parsetemplate($this->input('title_template')); $body_template = $this->_parsetemplate($this->input('body_template')); $body_general = $this->input('body_general'); $target_ids = $this->input('target_ids'); $image_1 = $this->input('image_1'); $image_1_link = $this->input('image_1_link'); $image_2 = $this->input('image_2'); $image_2_link = $this->input('image_2_link'); $image_3 = $this->input('image_3'); $image_3_link = $this->input('image_3_link'); $image_4 = $this->input('image_4'); $image_4_link = $this->input('image_4_link'); $hash_template = md5($title_template.$body_template); $hash_data = md5($title_template.$title_data.$body_template.$body_data); $dateline = $this->time; $this->db->query("INSERT INTO ".UC_DBTABLEPRE."feeds SET appid='$appid', icon='$icon', uid='$uid', username='$username', title_template='$title_template', title_data='$title_data', body_template='$body_template', body_data='$body_data', body_general='$body_general', image_1='$image_1', image_1_link='$image_1_link', image_2='$image_2', image_2_link='$image_2_link', image_3='$image_3', image_3_link='$image_3_link', image_4='$image_4', image_4_link='$image_4_link', hash_template='$hash_template', hash_data='$hash_data', target_ids='$target_ids', dateline='$dateline'"); return $this->db->insert_id(); } function ondelete() { $start = $this->input('start'); $limit = $this->input('limit'); $end = $start + $limit; $this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>'$start' AND feedid<'$end'"); } function onget() { $this->load('misc'); $limit = intval($this->input('limit')); $delete = $this->input('delete'); $feedlist = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."feeds ORDER BY feedid DESC LIMIT $limit"); if($feedlist) { $maxfeedid = $feedlist[0]['feedid']; foreach($feedlist as $key => $feed) { $feed['body_data'] = $_ENV['misc']->string2array($feed['body_data']); $feed['title_data'] = $_ENV['misc']->string2array($feed['title_data']); $feedlist[$key] = $feed; } } if(!empty($feedlist)) { if(!isset($delete) || $delete) { $this->_delete(0, $maxfeedid); } } return $feedlist; } function _delete($start, $end) { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."feeds WHERE feedid>='$start' AND feedid<='$end'"); } function _parsetemplate($template) { $template = str_replace(array("\r", "\n"), '', $template); $template = str_replace(array('<br>', '<br />', '<BR>', '<BR />'), "\n", $template); $template = str_replace(array('<b>', '<B>'), '[B]', $template); $template = str_replace(array('<i>', '<I>'), '[I]', $template); $template = str_replace(array('<u>', '<U>'), '[U]', $template); $template = str_replace(array('</b>', '</B>'), '[/B]', $template); $template = str_replace(array('</i>', '</I>'), '[/I]', $template); $template = str_replace(array('</u>', '</U>'), '[/U]', $template); $template = htmlspecialchars($template); $template = nl2br($template); $template = str_replace(array('[B]', '[I]', '[U]', '[/B]', '[/I]', '[/U]'), array('<b>', '<i>', '<u>', '</b>', '</i>', '</u>'), $template); return $template; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/feed.php
PHP
asf20
4,028
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: tag.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class tagcontrol extends base { function __construct() { $this->tagcontrol(); } function tagcontrol() { parent::__construct(); $this->init_input(); $this->load('tag'); $this->load('misc'); } function ongettag() { $appid = $this->input('appid'); $tagname = $this->input('tagname'); $nums = $this->input('nums'); if(empty($tagname)) { return NULL; } $return = $apparray = $appadd = array(); if($nums && is_array($nums)) { foreach($nums as $k => $num) { $apparray[$k] = $k; } } $data = $_ENV['tag']->get_tag_by_name($tagname); if($data) { $apparraynew = array(); foreach($data as $tagdata) { $row = $r = array(); $tmp = explode("\t", $tagdata['data']); $type = $tmp[0]; array_shift($tmp); foreach($tmp as $tmp1) { $tmp1 != '' && $r[] = $_ENV['misc']->string2array($tmp1); } if(in_array($tagdata['appid'], $apparray)) { if($tagdata['expiration'] > 0 && $this->time - $tagdata['expiration'] > 3600) { $appadd[] = $tagdata['appid']; $_ENV['tag']->formatcache($tagdata['appid'], $tagname); } else { $apparraynew[] = $tagdata['appid']; } $datakey = array(); $count = 0; foreach($r as $data) { $return[$tagdata['appid']]['data'][] = $data; $return[$tagdata['appid']]['type'] = $type; $count++; if($count >= $nums[$tagdata['appid']]) { break; } } } } $apparray = array_diff($apparray, $apparraynew); } else { foreach($apparray as $appid) { $_ENV['tag']->formatcache($appid, $tagname); } } if($apparray) { $this->load('note'); $_ENV['note']->add('gettag', "id=$tagname", '', $appadd, -1); } return $return; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/tag.php
PHP
asf20
2,012
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: cache.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class cachecontrol extends base { function __construct() { $this->cachecontrol(); } function cachecontrol() { parent::__construct(); } function onupdate($arr) { $this->load("cache"); $_ENV['cache']->updatedata(); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/control/cache.php
PHP
asf20
473
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: client.php 919 2009-01-21 01:25:32Z zhaoxiongfei $ */ if(!defined('UC_API')) { exit('Access denied'); } error_reporting(0); define('IN_UC', TRUE); define('UC_CLIENT_VERSION', '1.5.0'); define('UC_CLIENT_RELEASE', '20090121'); define('UC_ROOT', substr(__FILE__, 0, -10)); define('UC_DATADIR', UC_ROOT.'./data/'); define('UC_DATAURL', UC_API.'/data'); define('UC_API_FUNC', UC_CONNECT == 'mysql' ? 'uc_api_mysql' : 'uc_api_post'); $GLOBALS['uc_controls'] = array(); function uc_addslashes($string, $force = 0, $strip = FALSE) { !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); if(!MAGIC_QUOTES_GPC || $force) { if(is_array($string)) { foreach($string as $key => $val) { $string[$key] = uc_addslashes($val, $force, $strip); } } else { $string = addslashes($strip ? stripslashes($string) : $string); } } return $string; } if(!function_exists('daddslashes')) { function daddslashes($string, $force = 0) { return uc_addslashes($string, $force); } } function uc_stripslashes($string) { !defined('MAGIC_QUOTES_GPC') && define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc()); if(MAGIC_QUOTES_GPC) { return stripslashes($string); } else { return $string; } } function uc_api_post($module, $action, $arg = array()) { $s = $sep = ''; foreach($arg as $k => $v) { $k = urlencode($k); if(is_array($v)) { $s2 = $sep2 = ''; foreach($v as $k2 => $v2) { $k2 = urlencode($k2); $s2 .= "$sep2{$k}[$k2]=".urlencode(uc_stripslashes($v2)); $sep2 = '&'; } $s .= $sep.$s2; } else { $s .= "$sep$k=".urlencode(uc_stripslashes($v)); } $sep = '&'; } $postdata = uc_api_requestdata($module, $action, $s); return uc_fopen2(UC_API.'/index.php', 500000, $postdata, '', TRUE, UC_IP, 20); } function uc_api_requestdata($module, $action, $arg='', $extra='') { $input = uc_api_input($arg); $post = "m=$module&a=$action&inajax=2&release=".UC_CLIENT_RELEASE."&input=$input&appid=".UC_APPID.$extra; return $post; } function uc_api_url($module, $action, $arg='', $extra='') { $url = UC_API.'/index.php?'.uc_api_requestdata($module, $action, $arg, $extra); return $url; } function uc_api_input($data) { $s = urlencode(uc_authcode($data.'&agent='.md5($_SERVER['HTTP_USER_AGENT'])."&time=".time(), 'ENCODE', UC_KEY)); return $s; } function uc_api_mysql($model, $action, $args=array()) { global $uc_controls; if(empty($uc_controls[$model])) { include_once UC_ROOT.'./lib/db.class.php'; include_once UC_ROOT.'./model/base.php'; include_once UC_ROOT."./control/$model.php"; eval("\$uc_controls['$model'] = new {$model}control();"); } if($action{0} != '_') { $args = uc_addslashes($args, 1, TRUE); $action = 'on'.$action; $uc_controls[$model]->input = $args; return $uc_controls[$model]->$action($args); } else { return ''; } } function uc_serialize($arr, $htmlon = 0) { include_once UC_ROOT.'./lib/xml.class.php'; return xml_serialize($arr, $htmlon); } function uc_unserialize($s) { include_once UC_ROOT.'./lib/xml.class.php'; return xml_unserialize($s); } function uc_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { $ckey_length = 4; $key = md5($key ? $key : UC_KEY); $keya = md5(substr($key, 0, 16)); $keyb = md5(substr($key, 16, 16)); $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : ''; $cryptkey = $keya.md5($keya.$keyc); $key_length = strlen($cryptkey); $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string; $string_length = strlen($string); $result = ''; $box = range(0, 255); $rndkey = array(); for($i = 0; $i <= 255; $i++) { $rndkey[$i] = ord($cryptkey[$i % $key_length]); } for($j = $i = 0; $i < 256; $i++) { $j = ($j + $box[$i] + $rndkey[$i]) % 256; $tmp = $box[$i]; $box[$i] = $box[$j]; $box[$j] = $tmp; } for($a = $j = $i = 0; $i < $string_length; $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $tmp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $tmp; $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); } if($operation == 'DECODE') { if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) { return substr($result, 26); } else { return ''; } } else { return $keyc.str_replace('=', '', base64_encode($result)); } } function uc_fopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) { $__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1; if($__times__ > 2) { return ''; } $url .= (strpos($url, '?') === FALSE ? '?' : '&')."__times__=$__times__"; return uc_fopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block); } function uc_fopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE) { $return = ''; $matches = parse_url($url); !isset($matches['host']) && $matches['host'] = ''; !isset($matches['path']) && $matches['path'] = ''; !isset($matches['query']) && $matches['query'] = ''; !isset($matches['port']) && $matches['port'] = ''; $host = $matches['host']; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; $port = !empty($matches['port']) ? $matches['port'] : 80; if($post) { $out = "POST $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; //$out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $out .= "Content-Type: application/x-www-form-urlencoded\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= 'Content-Length: '.strlen($post)."\r\n"; $out .= "Connection: Close\r\n"; $out .= "Cache-Control: no-cache\r\n"; $out .= "Cookie: $cookie\r\n\r\n"; $out .= $post; } else { $out = "GET $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; //$out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= "Connection: Close\r\n"; $out .= "Cookie: $cookie\r\n\r\n"; } $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout); if(!$fp) { return ''; } else { stream_set_blocking($fp, $block); stream_set_timeout($fp, $timeout); @fwrite($fp, $out); $status = stream_get_meta_data($fp); if(!$status['timed_out']) { while (!feof($fp)) { if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) { break; } } $stop = false; while(!feof($fp) && !$stop) { $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit)); $return .= $data; if($limit) { $limit -= strlen($data); $stop = $limit <= 0; } } } @fclose($fp); return $return; } } function uc_app_ls() { $return = call_user_func(UC_API_FUNC, 'app', 'ls', array()); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_feed_add($icon, $uid, $username, $title_template='', $title_data='', $body_template='', $body_data='', $body_general='', $target_ids='', $images = array()) { return call_user_func(UC_API_FUNC, 'feed', 'add', array( 'icon'=>$icon, 'appid'=>UC_APPID, 'uid'=>$uid, 'username'=>$username, 'title_template'=>$title_template, 'title_data'=>$title_data, 'body_template'=>$body_template, 'body_data'=>$body_data, 'body_general'=>$body_general, 'target_ids'=>$target_ids, 'image_1'=>$images[0]['url'], 'image_1_link'=>$images[0]['link'], 'image_2'=>$images[1]['url'], 'image_2_link'=>$images[1]['link'], 'image_3'=>$images[2]['url'], 'image_3_link'=>$images[2]['link'], 'image_4'=>$images[3]['url'], 'image_4_link'=>$images[3]['link'] ) ); } function uc_feed_get($limit = 100, $delete = TRUE) { $return = call_user_func(UC_API_FUNC, 'feed', 'get', array('limit'=>$limit, 'delete'=>$delete)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_friend_add($uid, $friendid, $comment='') { return call_user_func(UC_API_FUNC, 'friend', 'add', array('uid'=>$uid, 'friendid'=>$friendid, 'comment'=>$comment)); } function uc_friend_delete($uid, $friendids) { return call_user_func(UC_API_FUNC, 'friend', 'delete', array('uid'=>$uid, 'friendids'=>$friendids)); } function uc_friend_totalnum($uid, $direction = 0) { return call_user_func(UC_API_FUNC, 'friend', 'totalnum', array('uid'=>$uid, 'direction'=>$direction)); } function uc_friend_ls($uid, $page = 1, $pagesize = 10, $totalnum = 10, $direction = 0) { $return = call_user_func(UC_API_FUNC, 'friend', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'totalnum'=>$totalnum, 'direction'=>$direction)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_user_register($username, $password, $email, $questionid = '', $answer = '') { return call_user_func(UC_API_FUNC, 'user', 'register', array('username'=>$username, 'password'=>$password, 'email'=>$email, 'questionid'=>$questionid, 'answer'=>$answer)); } function uc_user_login($username, $password, $isuid = 0, $checkques = 0, $questionid = '', $answer = '') { $isuid = intval($isuid); $return = call_user_func(UC_API_FUNC, 'user', 'login', array('username'=>$username, 'password'=>$password, 'isuid'=>$isuid, 'checkques'=>$checkques, 'questionid'=>$questionid, 'answer'=>$answer)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_user_synlogin($uid) { $uid = intval($uid); $return = uc_api_post('user', 'synlogin', array('uid'=>$uid)); return $return; } function uc_user_synlogout() { $return = uc_api_post('user', 'synlogout', array()); return $return; } function uc_user_edit($username, $oldpw, $newpw, $email, $ignoreoldpw = 0, $questionid = '', $answer = '') { return call_user_func(UC_API_FUNC, 'user', 'edit', array('username'=>$username, 'oldpw'=>$oldpw, 'newpw'=>$newpw, 'email'=>$email, 'ignoreoldpw'=>$ignoreoldpw, 'questionid'=>$questionid, 'answer'=>$answer)); } function uc_user_delete($uid) { return call_user_func(UC_API_FUNC, 'user', 'delete', array('uid'=>$uid)); } function uc_user_deleteavatar($uid) { uc_api_post('user', 'deleteavatar', array('uid'=>$uid)); } function uc_user_checkname($username) { return call_user_func(UC_API_FUNC, 'user', 'check_username', array('username'=>$username)); } function uc_user_checkemail($email) { return call_user_func(UC_API_FUNC, 'user', 'check_email', array('email'=>$email)); } function uc_user_addprotected($username, $admin='') { return call_user_func(UC_API_FUNC, 'user', 'addprotected', array('username'=>$username, 'admin'=>$admin)); } function uc_user_deleteprotected($username) { return call_user_func(UC_API_FUNC, 'user', 'deleteprotected', array('username'=>$username)); } function uc_user_getprotected() { $return = call_user_func(UC_API_FUNC, 'user', 'getprotected', array('1'=>1)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_get_user($username, $isuid=0) { $return = call_user_func(UC_API_FUNC, 'user', 'get_user', array('username'=>$username, 'isuid'=>$isuid)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_user_merge($oldusername, $newusername, $uid, $password, $email) { return call_user_func(UC_API_FUNC, 'user', 'merge', array('oldusername'=>$oldusername, 'newusername'=>$newusername, 'uid'=>$uid, 'password'=>$password, 'email'=>$email)); } function uc_user_merge_remove($username) { return call_user_func(UC_API_FUNC, 'user', 'merge_remove', array('username'=>$username)); } function uc_user_getcredit($appid, $uid, $credit) { return uc_api_post('user', 'getcredit', array('appid'=>$appid, 'uid'=>$uid, 'credit'=>$credit)); } function uc_pm_location($uid, $newpm = 0) { $apiurl = uc_api_url('pm_client', 'ls', "uid=$uid", ($newpm ? '&folder=newbox' : '')); @header("Expires: 0"); @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); @header("location: $apiurl"); } function uc_pm_checknew($uid, $more = 0) { $return = call_user_func(UC_API_FUNC, 'pm', 'check_newpm', array('uid'=>$uid, 'more'=>$more)); return (!$more || UC_CONNECT == 'mysql') ? $return : uc_unserialize($return); } function uc_pm_send($fromuid, $msgto, $subject, $message, $instantly = 1, $replypmid = 0, $isusername = 0) { if($instantly) { $replypmid = @is_numeric($replypmid) ? $replypmid : 0; return call_user_func(UC_API_FUNC, 'pm', 'sendpm', array('fromuid'=>$fromuid, 'msgto'=>$msgto, 'subject'=>$subject, 'message'=>$message, 'replypmid'=>$replypmid, 'isusername'=>$isusername)); } else { $fromuid = intval($fromuid); $subject = urlencode($subject); $msgto = urlencode($msgto); $message = urlencode($message); $replypmid = @is_numeric($replypmid) ? $replypmid : 0; $replyadd = $replypmid ? "&pmid=$replypmid&do=reply" : ''; $apiurl = uc_api_url('pm_client', 'send', "uid=$fromuid", "&msgto=$msgto&subject=$subject&message=$message$replyadd"); @header("Expires: 0"); @header("Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE); @header("Pragma: no-cache"); @header("location: ".$apiurl); } } function uc_pm_delete($uid, $folder, $pmids) { return call_user_func(UC_API_FUNC, 'pm', 'delete', array('uid'=>$uid, 'folder'=>$folder, 'pmids'=>$pmids)); } function uc_pm_deleteuser($uid, $touids) { return call_user_func(UC_API_FUNC, 'pm', 'deleteuser', array('uid'=>$uid, 'touids'=>$touids)); } function uc_pm_readstatus($uid, $uids, $pmids = array(), $status = 0) { return call_user_func(UC_API_FUNC, 'pm', 'readstatus', array('uid'=>$uid, 'uids'=>$uids, 'pmids'=>$pmids, 'status'=>$status)); } function uc_pm_list($uid, $page = 1, $pagesize = 10, $folder = 'inbox', $filter = 'newpm', $msglen = 0) { $uid = intval($uid); $page = intval($page); $pagesize = intval($pagesize); $return = call_user_func(UC_API_FUNC, 'pm', 'ls', array('uid'=>$uid, 'page'=>$page, 'pagesize'=>$pagesize, 'folder'=>$folder, 'filter'=>$filter, 'msglen'=>$msglen)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_pm_ignore($uid) { $uid = intval($uid); return call_user_func(UC_API_FUNC, 'pm', 'ignore', array('uid'=>$uid)); } function uc_pm_view($uid, $pmid, $touid = 0, $daterange = 1) { $uid = intval($uid); $touid = intval($touid); $pmid = @is_numeric($pmid) ? $pmid : 0; $return = call_user_func(UC_API_FUNC, 'pm', 'view', array('uid'=>$uid, 'pmid'=>$pmid, 'touid'=>$touid, 'daterange'=>$daterange)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_pm_viewnode($uid, $type = 0, $pmid = 0) { $uid = intval($uid); $pmid = @is_numeric($pmid) ? $pmid : 0; $return = call_user_func(UC_API_FUNC, 'pm', 'viewnode', array('uid'=>$uid, 'pmid'=>$pmid, 'type'=>$type)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_pm_blackls_get($uid) { $uid = intval($uid); return call_user_func(UC_API_FUNC, 'pm', 'blackls_get', array('uid'=>$uid)); } function uc_pm_blackls_set($uid, $blackls) { $uid = intval($uid); return call_user_func(UC_API_FUNC, 'pm', 'blackls_set', array('uid'=>$uid, 'blackls'=>$blackls)); } function uc_pm_blackls_add($uid, $username) { $uid = intval($uid); return call_user_func(UC_API_FUNC, 'pm', 'blackls_add', array('uid'=>$uid, 'username'=>$username)); } function uc_pm_blackls_delete($uid, $username) { $uid = intval($uid); return call_user_func(UC_API_FUNC, 'pm', 'blackls_delete', array('uid'=>$uid, 'username'=>$username)); } function uc_domain_ls() { $return = call_user_func(UC_API_FUNC, 'domain', 'ls', array('1'=>1)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_credit_exchange_request($uid, $from, $to, $toappid, $amount) { $uid = intval($uid); $from = intval($from); $toappid = intval($toappid); $to = intval($to); $amount = intval($amount); return uc_api_post('credit', 'request', array('uid'=>$uid, 'from'=>$from, 'to'=>$to, 'toappid'=>$toappid, 'amount'=>$amount)); } function uc_tag_get($tagname, $nums = 0) { $return = call_user_func(UC_API_FUNC, 'tag', 'gettag', array('tagname'=>$tagname, 'nums'=>$nums)); return UC_CONNECT == 'mysql' ? $return : uc_unserialize($return); } function uc_avatar($uid, $type = 'virtual', $returnhtml = 1) { $uid = intval($uid); $uc_input = uc_api_input("uid=$uid"); $uc_avatarflash = UC_API.'/images/camera.swf?inajax=1&appid='.UC_APPID.'&input='.$uc_input.'&agent='.md5($_SERVER['HTTP_USER_AGENT']).'&ucapi='.urlencode(str_replace('http://', '', UC_API)).'&avatartype='.$type; if($returnhtml) { return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="447" height="477" id="mycamera" align="middle"> <param name="allowScriptAccess" value="always" /> <param name="scale" value="exactfit" /> <param name="wmode" value="transparent" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="movie" value="'.$uc_avatarflash.'" /> <param name="menu" value="false" /> <embed src="'.$uc_avatarflash.'" quality="high" bgcolor="#ffffff" width="447" height="477" name="mycamera" align="middle" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object>'; } else { return array( 'width', '447', 'height', '477', 'scale', 'exactfit', 'src', $uc_avatarflash, 'id', 'mycamera', 'name', 'mycamera', 'quality','high', 'bgcolor','#ffffff', 'wmode','transparent', 'menu', 'false', 'swLiveConnect', 'true', 'allowScriptAccess', 'always' ); } } function uc_mail_queue($uids, $emails, $subject, $message, $frommail = '', $charset = 'gbk', $htmlon = FALSE, $level = 1) { return call_user_func(UC_API_FUNC, 'mail', 'add', array('uids' => $uids, 'emails' => $emails, 'subject' => $subject, 'message' => $message, 'frommail' => $frommail, 'charset' => $charset, 'htmlon' => $htmlon, 'level' => $level)); } function uc_check_avatar($uid, $size = 'middle', $type = 'virtual') { $url = UC_API."/avatar.php?uid=$uid&size=$size&type=$type&check_file_exists=1"; $res = uc_fopen2($url, 500000, '', '', TRUE, UC_IP, 20); if($res == 1) { return 1; } else { return 0; } } function uc_check_version() { $return = uc_api_post('version', 'check', array()); $data = uc_unserialize($return); return is_array($data) ? $data : $return; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/client.php
PHP
asf20
19,412
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: uccode.class.php 753 2008-11-14 06:48:25Z cnteacher $ */ class uccode { var $uccodes; function uccode() { $this->uccode = array( 'pcodecount' => -1, 'codecount' => 0, 'codehtml' => '' ); } function codedisp($code) { $this->uccode['pcodecount']++; $code = str_replace('\\"', '"', preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $code)); $this->uccode['codehtml'][$this->uccode['pcodecount']] = $this->tpl_codedisp($code); $this->uccode['codecount']++; return "[\tUCENTER_CODE_".$this->uccode[pcodecount]."\t]"; } function complie($message) { $message = htmlspecialchars($message); if(strpos($message, '[/code]') !== FALSE) { $message = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "\$this->codedisp('\\1')", $message); } if(strpos($message, '[/url]') !== FALSE) { $message = preg_replace("/\[url(=((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/|www\.)([^\[\"']+?))?\](.+?)\[\/url\]/ies", "\$this->parseurl('\\1', '\\5')", $message); } if(strpos($message, '[/email]') !== FALSE) { $message = preg_replace("/\[email(=([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+))?\](.+?)\[\/email\]/ies", "\$this->parseemail('\\1', '\\4')", $message); } $message = str_replace(array( '[/color]', '[/size]', '[/font]', '[/align]', '[b]', '[/b]', '[i]', '[/i]', '[u]', '[/u]', '[list]', '[list=1]', '[list=a]', '[list=A]', '[*]', '[/list]', '[indent]', '[/indent]', '[/float]' ), array( '</font>', '</font>', '</font>', '</p>', '<strong>', '</strong>', '<i>', '</i>', '<u>', '</u>', '<ul>', '<ul type="1">', '<ul type="a">', '<ul type="A">', '<li>', '</ul>', '<blockquote>', '</blockquote>', '</span>' ), preg_replace(array( "/\[color=([#\w]+?)\]/i", "/\[size=(\d+?)\]/i", "/\[size=(\d+(\.\d+)?(px|pt|in|cm|mm|pc|em|ex|%)+?)\]/i", "/\[font=([^\[\<]+?)\]/i", "/\[align=(left|center|right)\]/i", "/\[float=(left|right)\]/i" ), array( "<font color=\"\\1\">", "<font size=\"\\1\">", "<font style=\"font-size: \\1\">", "<font face=\"\\1 \">", "<p align=\"\\1\">", "<span style=\"float: \\1;\">" ), $message)); if(strpos($message, '[/quote]') !== FALSE) { $message = preg_replace("/\s*\[quote\][\n\r]*(.+?)[\n\r]*\[\/quote\]\s*/is", $this->tpl_quote(), $message); } if(strpos($message, '[/img]') !== FALSE) { $message = preg_replace(array( "/\[img\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies", "/\[img=(\d{1,4})[x|\,](\d{1,4})\]\s*([^\[\<\r\n]+?)\s*\[\/img\]/ies" ), array( "\$this->bbcodeurl('\\1', '<img src=\"%s\" border=\"0\" alt=\"\" />')", "\$this->bbcodeurl('\\3', '<img width=\"\\1\" height=\"\\2\" src=\"%s\" border=\"0\" alt=\"\" />')" ), $message); } for($i = 0; $i <= $this->uccode['pcodecount']; $i++) { $message = str_replace("[\tUCENTER_CODE_$i\t]", $this->uccode['codehtml'][$i], $message); } return nl2br(str_replace(array("\t", ' ', ' '), array('&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'), $message)); } function parseurl($url, $text) { if(!$url && preg_match("/((https?|ftp|gopher|news|telnet|rtsp|mms|callto|bctp|ed2k|thunder|synacast){1}:\/\/|www\.)[^\[\"']+/i", trim($text), $matches)) { $url = $matches[0]; $length = 65; if(strlen($url) > $length) { $text = substr($url, 0, intval($length * 0.5)).' ... '.substr($url, - intval($length * 0.3)); } return '<a href="'.(substr(strtolower($url), 0, 4) == 'www.' ? 'http://'.$url : $url).'" target="_blank">'.$text.'</a>'; } else { $url = substr($url, 1); if(substr(strtolower($url), 0, 4) == 'www.') { $url = 'http://'.$url; } return '<a href="'.$url.'" target="_blank">'.$text.'</a>'; } } function parseemail($email, $text) { if(!$email && preg_match("/\s*([a-z0-9\-_.+]+)@([a-z0-9\-_]+[.][a-z0-9\-_.]+)\s*/i", $text, $matches)) { $email = trim($matches[0]); return '<a href="mailto:'.$email.'">'.$email.'</a>'; } else { return '<a href="mailto:'.substr($email, 1).'">'.$text.'</a>'; } } function bbcodeurl($url, $tags) { if(!preg_match("/<.+?>/s", $url)) { if(!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://'))) { $url = 'http://'.$url; } return str_replace(array('submit', 'logging.php'), array('', ''), sprintf($tags, $url, addslashes($url))); } else { return '&nbsp;'.$url; } } function tpl_codedisp($code) { return '<div class="blockcode"><code id="code'.$this->uccodes['codecount'].'">'.$code.'</code></div>'; } function tpl_quote() { return '<div class="quote"><blockquote>\\1</blockquote></div>'; } } /* Usage: $str = <<<EOF 1 2 3 EOF; require_once 'lib/uccode.class.php'; $this->uccode = new uccode(); echo $this->uccode->complie($str); */ ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/lib/uccode.class.php
PHP
asf20
5,020
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: db.class.php 753 2008-11-14 06:48:25Z cnteacher $ */ class db { var $querynum = 0; var $link; var $histories; var $dbhost; var $dbuser; var $dbpw; var $dbcharset; var $pconnect; var $tablepre; var $time; var $goneaway = 5; function connect($dbhost, $dbuser, $dbpw, $dbname = '', $dbcharset = '', $pconnect = 0, $tablepre='', $time = 0) { $this->dbhost = $dbhost; $this->dbuser = $dbuser; $this->dbpw = $dbpw; $this->dbname = $dbname; $this->dbcharset = $dbcharset; $this->pconnect = $pconnect; $this->tablepre = $tablepre; $this->time = $time; if($pconnect) { if(!$this->link = mysql_pconnect($dbhost, $dbuser, $dbpw)) { $this->halt('Can not connect to MySQL server'); } } else { if(!$this->link = mysql_connect($dbhost, $dbuser, $dbpw)) { $this->halt('Can not connect to MySQL server'); } } if($this->version() > '4.1') { if($dbcharset) { mysql_query("SET character_set_connection=".$dbcharset.", character_set_results=".$dbcharset.", character_set_client=binary", $this->link); } if($this->version() > '5.0.1') { mysql_query("SET sql_mode=''", $this->link); } } if($dbname) { mysql_select_db($dbname, $this->link); } } function fetch_array($query, $result_type = MYSQL_ASSOC) { return mysql_fetch_array($query, $result_type); } function result_first($sql) { $query = $this->query($sql); return $this->result($query, 0); } function fetch_first($sql) { $query = $this->query($sql); return $this->fetch_array($query); } function fetch_all($sql, $id = '') { $arr = array(); $query = $this->query($sql); while($data = $this->fetch_array($query)) { $id ? $arr[$data[$id]] = $data : $arr[] = $data; } return $arr; } function cache_gc() { $this->query("DELETE FROM {$this->tablepre}sqlcaches WHERE expiry<$this->time"); } function query($sql, $type = '', $cachetime = FALSE) { $func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ? 'mysql_unbuffered_query' : 'mysql_query'; if(!($query = $func($sql, $this->link)) && $type != 'SILENT') { $this->halt('MySQL Query Error', $sql); } $this->querynum++; $this->histories[] = $sql; return $query; } function affected_rows() { return mysql_affected_rows($this->link); } function error() { return (($this->link) ? mysql_error($this->link) : mysql_error()); } function errno() { return intval(($this->link) ? mysql_errno($this->link) : mysql_errno()); } function result($query, $row) { $query = @mysql_result($query, $row); return $query; } function num_rows($query) { $query = mysql_num_rows($query); return $query; } function num_fields($query) { return mysql_num_fields($query); } function free_result($query) { return mysql_free_result($query); } function insert_id() { return ($id = mysql_insert_id($this->link)) >= 0 ? $id : $this->result($this->query("SELECT last_insert_id()"), 0); } function fetch_row($query) { $query = mysql_fetch_row($query); return $query; } function fetch_fields($query) { return mysql_fetch_field($query); } function version() { return mysql_get_server_info($this->link); } function close() { return mysql_close($this->link); } function halt($message = '', $sql = '') { $error = mysql_error(); $errorno = mysql_errno(); if($errorno == 2006 && $this->goneaway-- > 0) { $this->connect($this->dbhost, $this->dbuser, $this->dbpw, $this->dbname, $this->dbcharset, $this->pconnect, $this->tablepre, $this->time); $this->query($sql); } else { $s = '<b>Error:</b>'.$error.'<br />'; $s .= '<b>Errno:</b>'.$errorno.'<br />'; $s .= '<b>SQL:</b>:'.$sql; exit($s); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/lib/db.class.php
PHP
asf20
3,977
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: sendmail.inc.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); if($mail_setting['mailsilent']) { error_reporting(0); } $maildelimiter = $mail_setting['maildelimiter'] == 1 ? "\r\n" : ($mail_setting['maildelimiter'] == 2 ? "\r" : "\n"); $mailusername = isset($mail_setting['mailusername']) ? $mail_setting['mailusername'] : 1; $appname = $this->base->cache['apps'][$mail['appid']]['name']; $mail['subject'] = '=?'.$mail['charset'].'?B?'.base64_encode(str_replace("\r", '', str_replace("\n", '', '['.$appname.'] '.$mail['subject']))).'?='; $mail['message'] = chunk_split(base64_encode(str_replace("\r\n.", " \r\n..", str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $mail['message']))))))); $email_from = $mail['frommail'] == '' ? '=?'.$mail['charset'].'?B?'.base64_encode($appname)."?= <$mail_setting[maildefault]>" : (preg_match('/^(.+?) \<(.+?)\>$/',$email_from, $from) ? '=?'.$mail['charset'].'?B?'.base64_encode($from[1])."?= <$from[2]>" : $mail['frommail']); foreach(explode(',', $mail['email_to']) as $touser) { $tousers[] = preg_match('/^(.+?) \<(.+?)\>$/',$touser, $to) ? ($mailusername ? '=?'.$mail['charset'].'?B?'.base64_encode($to[1])."?= <$to[2]>" : $to[2]) : $touser; } $mail['email_to'] = implode(',', $tousers); $headers = "From: $email_from{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: Discuz! $version{$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/".($mail['htmlon'] ? 'html' : 'plain')."; charset=$mail[charset]{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}"; $mail_setting['mailport'] = $mail_setting['mailport'] ? $mail_setting['mailport'] : 25; if($mail_setting['mailsend'] == 1 && function_exists('mail')) { return @mail($mail['email_to'], $mail['subject'], $mail['message'], $headers); } elseif($mail_setting['mailsend'] == 2) { if(!$fp = fsockopen($mail_setting['mailserver'], $mail_setting['mailport'], $errno, $errstr, 30)) { return false; } stream_set_blocking($fp, true); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != '220') { return false; } fputs($fp, ($mail_setting['mailauth'] ? 'EHLO' : 'HELO')." discuz\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) { return false; } while(1) { if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) { break; } $lastmessage = fgets($fp, 512); } if($mail_setting['mailauth']) { fputs($fp, "AUTH LOGIN\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { return false; } fputs($fp, base64_encode($mail_setting['mailauth_username'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { return false; } fputs($fp, base64_encode($mail_setting['mailauth_password'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 235) { return false; } $email_from = $mail_setting['mailfrom']; } fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { return false; } } $email_tos = array(); foreach(explode(',', $mail['email_to']) as $touser) { $touser = trim($touser); if($touser) { fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $touser).">\r\n"); $lastmessage = fgets($fp, 512); return false; } } } fputs($fp, "DATA\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 354) { return false; } $headers .= 'Message-ID: <'.gmdate('YmdHs').'.'.substr(md5($mail['message'].microtime()), 0, 6).rand(100000, 999999).'@'.$_SERVER['HTTP_HOST'].">{$maildelimiter}"; fputs($fp, "Date: ".gmdate('r')."\r\n"); fputs($fp, "To: ".$mail['email_to']."\r\n"); fputs($fp, "Subject: ".$mail['subject']."\r\n"); fputs($fp, $headers."\r\n"); fputs($fp, "\r\n\r\n"); fputs($fp, "$mail[message]\r\n.\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { return false; } fputs($fp, "QUIT\r\n"); return true; } elseif($mail_setting['mailsend'] == 3) { ini_set('SMTP', $mail_setting['mailserver']); ini_set('smtp_port', $mail_setting['mailport']); ini_set('sendmail_from', $email_from); return @mail($mail['email_to'], $mail['subject'], $mail['message'], $headers); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/lib/sendmail.inc.php
PHP
asf20
5,010
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: xml.class.php 846 2008-12-08 05:37:05Z zhaoxiongfei $ */ function xml_unserialize(&$xml, $isnormal = FALSE) { $xml_parser = new XML($isnormal); $data = $xml_parser->parse($xml); $xml_parser->destruct(); return $data; } function xml_serialize($arr, $htmlon = FALSE, $isnormal = FALSE, $level = 1) { $s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : ''; $space = str_repeat("\t", $level); foreach($arr as $k => $v) { if(!is_array($v)) { $s .= $space."<item id=\"$k\">".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n"; } else { $s .= $space."<item id=\"$k\">\r\n".xml_serialize($v, $htmlon, $isnormal, $level + 1).$space."</item>\r\n"; } } $s = preg_replace("/([\x01-\x09\x0b-\x0c\x0e-\x1f])+/", ' ', $s); return $level == 1 ? $s."</root>" : $s; } class XML { var $parser; var $document; var $stack; var $data; var $last_opened_tag; var $isnormal; var $attrs = array(); var $failed = FALSE; function __construct($isnormal) { $this->XML($isnormal); } function XML($isnormal) { $this->isnormal = $isnormal; $this->parser = xml_parser_create('ISO-8859-1'); xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, false); xml_set_object($this->parser, $this); xml_set_element_handler($this->parser, 'open','close'); xml_set_character_data_handler($this->parser, 'data'); } function destruct() { xml_parser_free($this->parser); } function parse(&$data) { $this->document = array(); $this->stack = array(); return xml_parse($this->parser, $data, true) && !$this->failed ? $this->document : ''; } function open(&$parser, $tag, $attributes) { $this->failed = FALSE; if(!$this->isnormal) { if(isset($attributes['id']) && !is_string($this->document[$attributes['id']])) { $this->document = &$this->document[$attributes['id']]; } else { $this->failed = TRUE; } } else { if(!is_string($this->document[$tag])) { $this->document = &$this->document[$tag]; } else { $this->failed = TRUE; } } $this->stack[] = &$this->document; $this->last_opened_tag = $tag; $this->attrs = $attributes; } function data(&$parser, $data) { if($this->last_opened_tag != NULL) { $this->data = $data; } else { $this->data = ''; } } function close(&$parser, $tag) { if($this->last_opened_tag == $tag) { $this->document = $this->data; $this->last_opened_tag = NULL; } array_pop($this->stack); if($this->stack) { $this->document = &$this->stack[count($this->stack)-1]; } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/lib/xml.class.php
PHP
asf20
2,771
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: mail.php 848 2008-12-08 05:43:39Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); define('UC_MAIL_REPEAT', 5); class mailmodel { var $db; var $base; var $apps; function __construct(&$base) { $this->mailmodel($base); } function mailmodel(&$base) { $this->base = $base; $this->db = $base->db; $this->apps = &$this->base->cache['apps']; } function get_total_num() { $data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."mailqueue"); return $data; } function get_list($page, $ppp, $totalnum) { $start = $this->base->page_get_start($page, $ppp, $totalnum); $data = $this->db->fetch_all("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid ORDER BY dateline DESC LIMIT $start, $ppp"); foreach((array)$data as $k => $v) { $data[$k]['subject'] = htmlspecialchars($v['subject']); $data[$k]['tomail'] = empty($v['tomail']) ? $v['email'] : $v['tomail']; $data[$k]['dateline'] = $v['dateline'] ? $this->base->date($data[$k]['dateline']) : ''; $data[$k]['appname'] = $this->base->cache['apps'][$v['appid']]['name']; } return $data; } function delete_mail($ids) { $ids = $this->base->implode($ids); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."mailqueue WHERE mailid IN ($ids)"); return $this->db->affected_rows(); } function add($mail) { if($mail['level']) { $sql = "INSERT INTO ".UC_DBTABLEPRE."mailqueue (touid, tomail, subject, message, frommail, charset, htmlon, level, dateline, failures, appid) VALUES "; $values_arr = array(); foreach($mail['uids'] as $uid) { if(empty($uid)) continue; $values_arr[] = "('$uid', '', '$mail[subject]', '$mail[message]', '$mail[frommail]', '$mail[charset]', '$mail[htmlon]', '$mail[level]', '$mail[dateline]', '0', '$mail[appid]')"; } foreach($mail['emails'] as $email) { if(empty($email)) continue; $values_arr[] = "('', '$email', '$mail[subject]', '$mail[message]', '$mail[frommail]', '$mail[charset]', '$mail[htmlon]', '$mail[level]', '$mail[dateline]', '0', '$mail[appid]')"; } $sql .= implode(',', $values_arr); $this->db->query($sql); $insert_id = $this->db->insert_id(); $insert_id && $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='mailexists', value='1'"); return $insert_id; } else { $mail['email_to'] = array(); $uids = 0; foreach($mail['uids'] as $uid) { if(empty($uid)) continue; $uids .= ','.$uid; } $users = $this->db->fetch_all("SELECT uid, username, email FROM ".UC_DBTABLEPRE."members WHERE uid IN ($uids)"); foreach($users as $v) { $mail['email_to'][] = $v['username'].'<'.$v['email'].'>'; } foreach($mail['emails'] as $email) { if(empty($email)) continue; $mail['email_to'][] = $email; } $mail['message'] = str_replace('\"', '"', $mail['message']); $mail['email_to'] = implode(',', $mail['email_to']); return $this->send_one_mail($mail); } } function send() { register_shutdown_function(array($this, '_send')); } function _send() { $mail = $this->_get_mail(); if(empty($mail)) { $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='mailexists', value='0'"); return NULL; } else { $mail['email_to'] = $mail['tomail'] ? $mail['tomail'] : $mail['username'].'<'.$mail['email'].'>'; if($this->send_one_mail($mail)) { $this->_delete_one_mail($mail['mailid']); return true; } else { $this->_update_failures($mail['mailid']); return false; } } } function send_by_id($mailid) { if ($this->send_one_mail($this->_get_mail_by_id($mailid))) { $this->_delete_one_mail($mailid); return true; } } function send_one_mail($mail) { if(empty($mail)) return; $mail['email_to'] = $mail['email_to'] ? $mail['email_to'] : $mail['username'].'<'.$mail['email'].'>'; $mail_setting = $this->base->settings; return include UC_ROOT.'lib/sendmail.inc.php'; } function _get_mail() { $data = $this->db->fetch_first("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid WHERE failures<'".UC_MAIL_REPEAT."' ORDER BY level DESC, mailid ASC LIMIT 1"); return $data; } function _get_mail_by_id($mailid) { $data = $this->db->fetch_first("SELECT m.*, u.username, u.email FROM ".UC_DBTABLEPRE."mailqueue m LEFT JOIN ".UC_DBTABLEPRE."members u ON m.touid=u.uid WHERE mailid='$mailid'"); return $data; } function _delete_one_mail($mailid) { $mailid = intval($mailid); return $this->db->query("DELETE FROM ".UC_DBTABLEPRE."mailqueue WHERE mailid='$mailid'"); } function _update_failures($mailid) { $mailid = intval($mailid); return $this->db->query("UPDATE ".UC_DBTABLEPRE."mailqueue SET failures=failures+1 WHERE mailid='$mailid'"); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/mail.php
PHP
asf20
5,074
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: base.php 837 2008-12-05 03:14:47Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); if(!function_exists('getgpc')) { function getgpc($k, $var='G') { switch($var) { case 'G': $var = &$_GET; break; case 'P': $var = &$_POST; break; case 'C': $var = &$_COOKIE; break; case 'R': $var = &$_REQUEST; break; } return isset($var[$k]) ? $var[$k] : NULL; } } class base { var $time; var $onlineip; var $db; var $key; var $settings = array(); var $cache = array(); var $app = array(); var $user = array(); var $input = array(); function __construct() { $this->base(); } function base() { $this->init_var(); $this->init_db(); $this->init_cache(); $this->init_note(); $this->init_mail(); } function init_var() { $this->time = time(); $cip = getenv('HTTP_CLIENT_IP'); $xip = getenv('HTTP_X_FORWARDED_FOR'); $rip = getenv('REMOTE_ADDR'); $srip = $_SERVER['REMOTE_ADDR']; if($cip && strcasecmp($cip, 'unknown')) { $this->onlineip = $cip; } elseif($xip && strcasecmp($xip, 'unknown')) { $this->onlineip = $xip; } elseif($rip && strcasecmp($rip, 'unknown')) { $this->onlineip = $rip; } elseif($srip && strcasecmp($srip, 'unknown')) { $this->onlineip = $srip; } preg_match("/[\d\.]{7,15}/", $this->onlineip, $match); $this->onlineip = $match[0] ? $match[0] : 'unknown'; $this->app['appid'] = UC_APPID; } function init_input() { } function init_db() { require_once UC_ROOT.'lib/db.class.php'; $this->db = new db(); $this->db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, '', UC_DBCHARSET, UC_DBCONNECT, UC_DBTABLEPRE); } function load($model, $base = NULL) { $base = $base ? $base : $this; if(empty($_ENV[$model])) { require_once UC_ROOT."./model/$model.php"; eval('$_ENV[$model] = new '.$model.'model($base);'); } return $_ENV[$model]; } function date($time, $type = 3) { if(!$this->settings) { $this->settings = $this->cache('settings'); } $format[] = $type & 2 ? (!empty($this->settings['dateformat']) ? $this->settings['dateformat'] : 'Y-n-j') : ''; $format[] = $type & 1 ? (!empty($this->settings['timeformat']) ? $this->settings['timeformat'] : 'H:i') : ''; return gmdate(implode(' ', $format), $time + $this->settings['timeoffset']); } function page_get_start($page, $ppp, $totalnum) { $totalpage = ceil($totalnum / $ppp); $page = max(1, min($totalpage,intval($page))); return ($page - 1) * $ppp; } function implode($arr) { return "'".implode("','", (array)$arr)."'"; } function &cache($cachefile) { static $_CACHE = array(); if(!isset($_CACHE[$cachefile])) { $cachepath = UC_DATADIR.'./cache/'.$cachefile.'.php'; if(!file_exists($cachepath)) { $this->load('cache'); $_ENV['cache']->updatedata($cachefile); } else { include_once $cachepath; } } return $_CACHE[$cachefile]; } function get_setting($k = array(), $decode = FALSE) { $return = array(); $sqladd = $k ? "WHERE k IN (".$this->implode($k).")" : ''; $settings = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."settings $sqladd"); if(is_array($settings)) { foreach($settings as $arr) { $return[$arr['k']] = $decode ? unserialize($arr['v']) : $arr['v']; } } return $return; } function init_cache() { $this->settings = $this->cache('settings'); $this->cache['apps'] = $this->cache('apps'); if(PHP_VERSION > '5.1') { $timeoffset = intval($this->settings['timeoffset'] / 3600); @date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset))); } } function cutstr($string, $length, $dot = ' ...') { if(strlen($string) <= $length) { return $string; } $string = str_replace(array('&amp;', '&quot;', '&lt;', '&gt;'), array('&', '"', '<', '>'), $string); $strcut = ''; if(strtolower(UC_CHARSET) == 'utf-8') { $n = $tn = $noc = 0; while($n < strlen($string)) { $t = ord($string[$n]); if($t == 9 || $t == 10 || (32 <= $t && $t <= 126)) { $tn = 1; $n++; $noc++; } elseif(194 <= $t && $t <= 223) { $tn = 2; $n += 2; $noc += 2; } elseif(224 <= $t && $t < 239) { $tn = 3; $n += 3; $noc += 2; } elseif(240 <= $t && $t <= 247) { $tn = 4; $n += 4; $noc += 2; } elseif(248 <= $t && $t <= 251) { $tn = 5; $n += 5; $noc += 2; } elseif($t == 252 || $t == 253) { $tn = 6; $n += 6; $noc += 2; } else { $n++; } if($noc >= $length) { break; } } if($noc > $length) { $n -= $tn; } $strcut = substr($string, 0, $n); } else { for($i = 0; $i < $length; $i++) { $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i]; } } $strcut = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $strcut); return $strcut.$dot; } function init_note() { if($this->note_exists()) { $this->load('note'); $_ENV['note']->send(); } } function note_exists() { $noteexists = $this->db->fetch_first("SELECT value FROM ".UC_DBTABLEPRE."vars WHERE name='noteexists".UC_APPID."'"); if(empty($noteexists)) { return FALSE; } else { return TRUE; } } function init_mail() { if($this->mail_exists() && !getgpc('inajax')) { $this->load('mail'); $_ENV['mail']->send(); } } function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { return uc_authcode($string, $operation, $key, $expiry); } /* function serialize() { } */ function unserialize($s) { return uc_unserialize($s); } function input($k) { return isset($this->input[$k]) ? (is_array($this->input[$k]) ? $this->input[$k] : trim($this->input[$k])) : NULL; } function mail_exists() { $mailexists = $this->db->fetch_first("SELECT value FROM ".UC_DBTABLEPRE."vars WHERE name='mailexists'"); if(empty($mailexists)) { return FALSE; } else { return TRUE; } } function dstripslashes($string) { if(is_array($string)) { foreach($string as $key => $val) { $string[$key] = $this->dstripslashes($val); } } else { $string = stripslashes($string); } return $string; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/base.php
PHP
asf20
6,440
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: pm.php 908 2008-12-26 07:27:51Z monkey $ */ !defined('IN_UC') && exit('Access Denied'); class pmmodel { var $db; var $base; function __construct(&$base) { $this->pmmodel($base); } function pmmodel(&$base) { $this->base = $base; $this->db = $base->db; } function pmintval($pmid) { return @is_numeric($pmid) ? $pmid : 0; } function get_pm_by_pmid($uid, $pmid) { $arr = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE pmid='$pmid' AND (msgtoid IN ('$uid','0') OR msgfromid='$uid')"); return $arr; } function get_pm_by_touid($uid, $touid, $starttime, $endtime) { $arr1 = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' AND msgtoid='$touid' AND dateline>='$starttime' AND dateline<'$endtime' AND related>'0' AND delstatus IN (0,2) ORDER BY dateline"); $arr2 = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$touid' AND msgtoid='$uid' AND dateline>='$starttime' AND dateline<'$endtime' AND related>'0' AND delstatus IN (0,1) ORDER BY dateline"); $arr = array_merge($arr1, $arr2); uasort($arr, 'pm_datelinesort'); return $arr; } function get_pmnode_by_pmid($uid, $pmid, $type = 0) { $arr = array(); if($type == 1) { $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' and folder='inbox' ORDER BY dateline DESC LIMIT 1"); } elseif($type == 2) { $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' and folder='inbox' ORDER BY dateline DESC LIMIT 1"); } else { $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."pms WHERE pmid='$pmid'"); } return $arr; } function set_pm_status($uid, $touid, $pmid = 0, $status = 0) { if(!$status) { $oldstatus = 1; $newstatus = 0; } else { $oldstatus = 0; $newstatus = 1; } if($touid) { $ids = is_array($touid) ? $this->base->implode($touid) : $touid; $this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET new='$newstatus' WHERE msgfromid IN ($ids) AND msgtoid='$uid' AND new='$oldstatus'", 'UNBUFFERED'); } if($pmid) { $ids = is_array($pmid) ? $this->base->implode($pmid) : $pmid; $this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET new='$newstatus' WHERE pmid IN ($ids) AND msgtoid='$uid' AND new='$oldstatus'", 'UNBUFFERED'); } } function get_pm_num() { } function get_num($uid, $folder, $filter = '') { switch($folder) { case 'newbox': $sql = "SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' AND (related='0' AND msgfromid>'0' OR msgfromid='0') AND folder='inbox' AND new='1'"; $num = $this->db->result_first($sql); return $num; case 'outbox': case 'inbox': if($filter == 'newpm') { $filteradd = "msgtoid='$uid' AND (related='0' AND msgfromid>'0' OR msgfromid='0') AND folder='inbox' AND new='1'"; } elseif($filter == 'systempm') { $filteradd = "msgtoid='$uid' AND msgfromid='0' AND folder='inbox'"; } elseif($filter == 'privatepm') { $filteradd = "msgtoid='$uid' AND related='0' AND msgfromid>'0' AND folder='inbox'"; } elseif($filter == 'announcepm') { $filteradd = "msgtoid='0' AND folder='inbox'"; } else { $filteradd = "msgtoid='$uid' AND related='0' AND folder='inbox'"; } $sql = "SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE $filteradd"; break; case 'savebox': break; } $num = $this->db->result_first($sql); return $num; } function get_pm_list($uid, $pmnum, $folder, $filter, $start, $ppp = 10) { $ppp = $ppp ? $ppp : 10; switch($folder) { case 'newbox': $folder = 'inbox'; $filter = 'newpm'; case 'outbox': case 'inbox': if($filter == 'newpm') { $filteradd = "pm.msgtoid='$uid' AND (pm.related='0' AND pm.msgfromid>'0' OR pm.msgfromid='0') AND pm.folder='inbox' AND pm.new='1'"; } elseif($filter == 'systempm') { $filteradd = "pm.msgtoid='$uid' AND pm.msgfromid='0' AND pm.folder='inbox'"; } elseif($filter == 'privatepm') { $filteradd = "pm.msgtoid='$uid' AND pm.related='0' AND pm.msgfromid>'0' AND pm.folder='inbox'"; } elseif($filter == 'announcepm') { $filteradd = "pm.msgtoid='0' AND pm.folder='inbox'"; } else { $filteradd = "pm.msgtoid='$uid' AND pm.related='0' AND pm.folder='inbox'"; } $sql = "SELECT pm.*,m.username as msgfrom FROM ".UC_DBTABLEPRE."pms pm LEFT JOIN ".UC_DBTABLEPRE."members m ON pm.msgfromid = m.uid WHERE $filteradd ORDER BY pm.dateline DESC LIMIT $start, $ppp"; break; case 'searchbox': $filteradd = "msgtoid='$uid' AND folder='inbox' AND message LIKE '%".(str_replace('_', '\_', addcslashes($filter, '%_')))."%'"; $sql = "SELECT * FROM ".UC_DBTABLEPRE."pms WHERE $filteradd ORDER BY dateline DESC LIMIT $start, $ppp"; break; case 'savebox': break; } $query = $this->db->query($sql); $array = array(); $today = $this->base->time - $this->base->time % 86400; while($data = $this->db->fetch_array($query)) { $daterange = 5; if($data['dateline'] >= $today) { $daterange = 1; } elseif($data['dateline'] >= $today - 86400) { $daterange = 2; } elseif($data['dateline'] >= $today - 172800) { $daterange = 3; } elseif($data['dateline'] >= $today - 604800) { $daterange = 4; } $data['daterange'] = $daterange; $data['subject'] = htmlspecialchars($data['subject']); if($filter == 'announcepm') { unset($data['msgfromid'], $data['msgfrom']); } $data['touid'] = $uid == $data['msgfromid'] ? $data['msgtoid'] : $data['msgfromid']; $array[] = $data; } if($folder == 'inbox') { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'", 'UNBUFFERED'); } return $array; } function sendpm($subject, $message, $msgfrom, $msgto, $related = 0) { if($msgfrom['uid'] && $msgfrom['uid'] == $msgto) { return 0; } $_CACHE['badwords'] = $this->base->cache('badwords'); if($_CACHE['badwords']['findpattern']) { $subject = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $subject); $message = @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $message); } $box = 'inbox'; $subject = trim($subject); if($subject == '' && !$related) { $subject = $this->removecode(trim($message), 75); } else { $subject = $this->base->cutstr(trim($subject), 75, ' '); } if($msgfrom['uid']) { $sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'"); if(!$sessionexist || $sessionexist > 1) { if($sessionexist > 1) { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'"); } $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES ('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')"); $lastpmid = $this->db->insert_id(); } else { $this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET subject='$subject', message='$message', dateline='".$this->base->time."', new='1', fromappid='".$this->base->app['appid']."' WHERE msgfromid='$msgfrom[uid]' AND msgtoid='$msgto' AND folder='inbox' AND related='0'"); } if(!$savebox) { $sessionexist = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$msgto' AND msgtoid='$msgfrom[uid]' AND folder='inbox' AND related='0'"); if($msgfrom['uid'] && !$sessionexist) { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES ('".$msgfrom['username']."','$msgto','".$msgfrom['uid']."','$box','0','$subject','".$this->base->time."','0','$message','0')"); } $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES ('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','1','$message','".$this->base->app['appid']."')"); $lastpmid = $this->db->insert_id(); } } else { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."pms (msgfrom,msgfromid,msgtoid,folder,new,subject,dateline,related,message,fromappid) VALUES ('".$msgfrom['username']."','".$msgfrom['uid']."','$msgto','$box','1','$subject','".$this->base->time."','0','$message','".$this->base->app['appid']."')"); $lastpmid = $this->db->insert_id(); } $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."newpm (uid) VALUES ('$msgto')"); return $lastpmid; } function set_ignore($uid) { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'"); } function check_newpm($uid, $more) { if($more < 2) { $newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."newpm WHERE uid='$uid'"); if($newpm) { $newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'"); if($more) { $newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'"); return array('newpm' => $newpm, 'newprivatepm' => $newprvpm); } else { return $newpm; } } } else { $newpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE (related='0' AND msgfromid>'0' OR msgfromid='0') AND msgtoid='$uid' AND folder='inbox' AND new='1'"); $newprvpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgfromid>'0' AND msgtoid='$uid' AND folder='inbox' AND new='1'"); if($more == 2 || $more == 3) { $annpm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='0' AND folder='inbox'"); $syspm = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."pms WHERE related='0' AND msgtoid='$uid' AND folder='inbox' AND msgfromid='0'"); } if($more == 2) { return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm); } if($more == 4) { return array('newpm' => $newpm, 'newprivatepm' => $newprvpm); } else { $pm = $this->db->fetch_first("SELECT pm.dateline,pm.msgfromid,m.username as msgfrom,pm.message FROM ".UC_DBTABLEPRE."pms pm LEFT JOIN ".UC_DBTABLEPRE."members m ON pm.msgfromid = m.uid WHERE (pm.related='0' OR pm.msgfromid='0') AND pm.msgtoid='$uid' AND pm.folder='inbox' ORDER BY pm.dateline DESC LIMIT 1"); return array('newpm' => $newpm, 'newprivatepm' => $newprvpm, 'announcepm' => $annpm, 'systempm' => $syspm, 'lastdate' => $pm['dateline'], 'lastmsgfromid' => $pm['msgfromid'], 'lastmsgfrom' => $pm['msgfrom'], 'lastmsg' => $pm['message']); } } } function deletepm($uid, $pmids) { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgtoid='$uid' AND pmid IN (".$this->base->implode($pmids).")"); $delnum = $this->db->affected_rows(); return $delnum; } function deleteuidpm($uid, $ids) { $delnum = 0; if($ids) { $delnum = 1; $deluids = $this->base->implode($ids); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND related='0'", 'UNBUFFERED'); $this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=2 WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED'); $this->db->query("UPDATE ".UC_DBTABLEPRE."pms SET delstatus=1 WHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND folder='inbox' AND delstatus=0", 'UNBUFFERED'); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgfromid IN ($deluids) AND msgtoid='$uid' AND delstatus=1 AND folder='inbox'", 'UNBUFFERED'); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."pms WHERE msgtoid IN ($deluids) AND msgfromid='$uid' AND delstatus=2 AND folder='inbox'", 'UNBUFFERED'); } return $delnum; } function get_blackls($uid, $uids = array()) { if(!$uids) { $blackls = $this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'"); } else { $uids = $this->base->implode($uids); $blackls = array(); $query = $this->db->query("SELECT uid, blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid IN ($uids)"); while($data = $this->db->fetch_array($query)) { $blackls[$data['uid']] = explode(',', $data['blacklist']); } } return $blackls; } function set_blackls($uid, $blackls) { $this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'"); return $this->db->affected_rows(); } function update_blackls($uid, $username, $action = 1) { $username = !is_array($username) ? array($username) : $username; if($action == 1) { if(!in_array('{ALL}', $username)) { $usernames = $this->base->implode($username); $query = $this->db->query("SELECT username FROM ".UC_DBTABLEPRE."members WHERE username IN ($usernames)"); $usernames = array(); while($data = $this->db->fetch_array($query)) { $usernames[addslashes($data['username'])] = addslashes($data['username']); } if(!$usernames) { return 0; } $blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'")); if($blackls) { $list = explode(',', $blackls); foreach($list as $k => $v) { if(in_array($v, $usernames)) { unset($usernames[$v]); } } } if(!$usernames) { return 1; } $listnew = implode(',', $usernames); $blackls .= $blackls !== '' ? ','.$listnew : $listnew; } else { $blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'")); $blackls .= ',{ALL}'; } } else { $blackls = addslashes($this->db->result_first("SELECT blacklist FROM ".UC_DBTABLEPRE."memberfields WHERE uid='$uid'")); $list = $blackls = explode(',', $blackls); foreach($list as $k => $v) { if(in_array($v, $username)) { unset($blackls[$k]); } } $blackls = implode(',', $blackls); } $this->db->query("UPDATE ".UC_DBTABLEPRE."memberfields SET blacklist='$blackls' WHERE uid='$uid'"); return 1; } function removecode($str, $length) { return trim($this->base->cutstr(preg_replace(array( "/\[(email|code|quote|img)=?.*\].*?\[\/(email|code|quote|img)\]/siU", "/\[\/?(b|i|url|u|color|size|font|align|list|indent|float)=?.*\]/siU", "/\r\n/", ), '', $str), $length)); } function count_pm_by_fromuid($uid, $timeoffset = 86400) { $dateline = $this->base->time - intval($timeoffset); return $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."pms WHERE msgfromid='$uid' AND dateline>'$dateline'"); } function is_reply_pm($uid, $touids) { $touid_str = implode("', '", $touids); $pm_reply = $this->db->fetch_all("SELECT msgfromid, msgtoid FROM ".UC_DBTABLEPRE."pms WHERE msgfromid IN ('$touid_str') AND msgtoid='$uid' AND related=1", 'msgfromid'); foreach($touids as $val) { if(!isset($pm_reply[$val])) { return false; } } return true; } } function pm_datelinesort($a, $b) { if ($a['dateline'] == $b['dateline']) { return 0; } return ($a['dateline'] < $b['dateline']) ? -1 : 1; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/pm.php
PHP
asf20
16,049
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: domain.php 848 2008-12-08 05:43:39Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); class domainmodel { var $db; var $base; function __construct(&$base) { $this->domainmodel($base); } function domainmodel(&$base) { $this->base = $base; $this->db = $base->db; } function add_domain($domain, $ip) { if($domain) { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip'"); } return $this->db->insert_id(); } function get_total_num() { $data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."domains"); return $data; } function get_list($page, $ppp, $totalnum) { $start = $this->base->page_get_start($page, $ppp, $totalnum); $data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."domains LIMIT $start, $ppp"); return $data; } function delete_domain($arr) { $domainids = $this->base->implode($arr); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."domains WHERE id IN ($domainids)"); return $this->db->affected_rows(); } function update_domain($domain, $ip, $id) { $this->db->query("UPDATE ".UC_DBTABLEPRE."domains SET domain='$domain', ip='$ip' WHERE id='$id'"); return $this->db->affected_rows(); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/domain.php
PHP
asf20
1,391
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: note.php 916 2009-01-19 05:56:07Z monkey $ */ !defined('IN_UC') && exit('Access Denied'); define('UC_NOTE_REPEAT', 5); define('UC_NOTE_TIMEOUT', 15); define('UC_NOTE_GC', 10000); define('API_RETURN_FAILED', '-1'); class notemodel { var $db; var $base; var $apps; var $operations = array(); var $notetype = 'HTTP'; function __construct(&$base) { $this->notemodel($base); } function notemodel(&$base) { $this->base = $base; $this->db = $base->db; $this->apps = $this->base->cache('apps'); $this->operations = array( 'test'=>array('', 'action=test'), 'deleteuser'=>array('', 'action=deleteuser'), 'renameuser'=>array('', 'action=renameuser'), 'deletefriend'=>array('', 'action=deletefriend'), 'gettag'=>array('', 'action=gettag', 'tag', 'updatedata'), 'getcreditsettings'=>array('', 'action=getcreditsettings'), 'getcredit'=>array('', 'action=getcredit'), 'updatecreditsettings'=>array('', 'action=updatecreditsettings'), 'updateclient'=>array('', 'action=updateclient'), 'updatepw'=>array('', 'action=updatepw'), 'updatebadwords'=>array('', 'action=updatebadwords'), 'updatehosts'=>array('', 'action=updatehosts'), 'updateapps'=>array('', 'action=updateapps'), 'updatecredit'=>array('', 'action=updatecredit'), ); } function get_total_num($all = TRUE) { } function get_list($page, $ppp, $totalnum, $all = TRUE) { } function delete_note($ids) { } function add($operation, $getdata='', $postdata='', $appids=array(), $pri = 0) { $extra = $varextra = ''; $appadd = $varadd = array(); foreach((array)$this->apps as $appid => $app) { $appid = $app['appid']; if($appid == intval($appid)) { if($appids && !in_array($appid, $appids)) { $appadd[] = 'app'.$appid."='1'"; } else { $varadd[] = "('noteexists{$appid}', '1')"; } } } if($appadd) { $extra = implode(',', $appadd); $extra = $extra ? ', '.$extra : ''; } if($varadd) { $varextra = implode(', ', $varadd); $varextra = $varextra ? ', '.$varextra : ''; } $getdata = addslashes($getdata); $postdata = addslashes($postdata); $this->db->query("INSERT INTO ".UC_DBTABLEPRE."notelist SET getdata='$getdata', operation='$operation', pri='$pri', postdata='$postdata'$extra"); $insert_id = $this->db->insert_id(); $insert_id && $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars (name, value) VALUES ('noteexists', '1')$varextra"); return $insert_id; } function send() { register_shutdown_function(array($this, '_send')); } function _send() { $note = $this->_get_note(); if(empty($note)) { $this->db->query("REPLACE INTO ".UC_DBTABLEPRE."vars SET name='noteexists".UC_APPID."', value='0'"); return NULL; } $this->sendone(UC_APPID, 0, $note); $this->_gc(); } function sendone($appid, $noteid = 0, $note = '') { require_once UC_ROOT.'./lib/xml.class.php'; $return = FALSE; $app = $this->apps[$appid]; if($noteid) { $note = $this->_get_note_by_id($noteid); } $this->base->load('misc'); $apifilename = isset($app['apifilename']) && $app['apifilename'] ? $app['apifilename'] : 'uc.php'; if($app['extra']['apppath'] && @include $app['extra']['apppath'].'./api/'.$apifilename) { $uc_note = new uc_note(); $method = $note['operation']; if(is_string($method) && !empty($method)) { parse_str($note['getdata'], $note['getdata']); if(get_magic_quotes_gpc()) { $note['getdata'] = $this->base->dstripslashes($note['getdata']); } $note['postdata'] = xml_unserialize($note['postdata']); $response = $uc_note->$method($note['getdata'], $note['postdata']); } unset($uc_note); } else { $url = $this->get_url_code($note['operation'], $note['getdata'], $appid); $note['postdata'] = str_replace(array("\n", "\r"), '', $note['postdata']); $response = trim($_ENV['misc']->dfopen2($url, 0, $note['postdata'], '', 1, $app['ip'], UC_NOTE_TIMEOUT, TRUE)); } $returnsucceed = $response != '' && ($response == 1 || is_array(xml_unserialize($response))); $closedsqladd = $this->_close_note($note, $this->apps, $returnsucceed, $appid) ? ",closed='1'" : '';// if($returnsucceed) { if($this->operations[$note['operation']][2]) { $this->base->load($this->operations[$note['operation']][2]); $func = $this->operations[$note['operation']][3]; $_ENV[$this->operations[$note['operation']][2]]->$func($appid, $response); } $this->db->query("UPDATE ".UC_DBTABLEPRE."notelist SET app$appid='1', totalnum=totalnum+1, succeednum=succeednum+1, dateline='{$this->base->time}' $closedsqladd WHERE noteid='$note[noteid]'", 'SILENT'); $return = TRUE; } else { $this->db->query("UPDATE ".UC_DBTABLEPRE."notelist SET app$appid = app$appid-'1', totalnum=totalnum+1, dateline='{$this->base->time}' $closedsqladd WHERE noteid='$note[noteid]'", 'SILENT'); $return = FALSE; } return $return; } function _get_note() { $app_field = 'app'.UC_APPID; $data = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."notelist WHERE closed='0' AND $app_field<'1' AND $app_field>'-".UC_NOTE_REPEAT."' LIMIT 1"); return $data; } function _gc() { rand(0, UC_NOTE_GC) == 0 && $this->db->query("DELETE FROM ".UC_DBTABLEPRE."notelist WHERE closed='1'"); } function _close_note($note, $apps, $returnsucceed, $appid) { $note['app'.$appid] = $returnsucceed ? 1 : $note['app'.$appid] - 1; $appcount = count($apps); foreach($apps as $key => $app) { $appstatus = $note['app'.$app['appid']]; if(!$app['recvnote'] || $appstatus == 1 || $appstatus <= -UC_NOTE_REPEAT) { $appcount--; } } if($appcount < 1) { return TRUE; //$closedsqladd = ",closed='1'"; } } function _get_note_by_id($noteid) { $data = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."notelist WHERE noteid='$noteid'"); return $data; } function get_url_code($operation, $getdata, $appid) { $app = $this->apps[$appid]; $authkey = UC_KEY; $url = $app['url']; $apifilename = isset($app['apifilename']) && $app['apifilename'] ? $app['apifilename'] : 'uc.php'; $action = $this->operations[$operation][1]; $code = urlencode($this->base->authcode("$action&".($getdata ? "$getdata&" : '')."time=".$this->base->time, 'ENCODE', $authkey)); return $url."/api/$apifilename?code=$code"; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/note.php
PHP
asf20
6,591
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: user.php 878 2008-12-15 03:27:41Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); class usermodel { var $db; var $base; function __construct(&$base) { $this->usermodel($base); } function usermodel(&$base) { $this->base = $base; $this->db = $base->db; } function get_user_by_uid($uid) { $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE uid='$uid'"); return $arr; } function get_user_by_username($username) { $arr = $this->db->fetch_first("SELECT * FROM ".UC_DBTABLEPRE."members WHERE username='$username'"); return $arr; } function check_username($username) { $guestexp = '\xA1\xA1|\xAC\xA3|^Guest|^\xD3\xCE\xBF\xCD|\xB9\x43\xAB\xC8'; $len = strlen($username); if($len > 15 || $len < 3 || preg_match("/\s+|^c:\\con\\con|[%,\*\"\s\<\>\&]|$guestexp/is", $username)) { return FALSE; } else { return TRUE; } } function check_mergeuser($username) { $data = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."mergemembers WHERE appid='".$this->base->app['appid']."' AND username='$username'"); return $data; } function check_usernamecensor($username) { $_CACHE['badwords'] = $this->base->cache('badwords'); $censorusername = $this->base->get_setting('censorusername'); $censorusername = $censorusername['censorusername']; $censorexp = '/^('.str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote(($censorusername = trim($censorusername)), '/')).')$/i'; $usernamereplaced = isset($_CACHE['badwords']['findpattern']) && !empty($_CACHE['badwords']['findpattern']) ? @preg_replace($_CACHE['badwords']['findpattern'], $_CACHE['badwords']['replace'], $username) : $username; if(($usernamereplaced != $username) || ($censorusername && preg_match($censorexp, $username))) { return FALSE; } else { return TRUE; } } function check_usernameexists($username) { $data = $this->db->result_first("SELECT username FROM ".UC_DBTABLEPRE."members WHERE username='$username'"); return $data; } function check_emailformat($email) { return strlen($email) > 6 && preg_match("/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/", $email); } function check_emailaccess($email) { $setting = $this->base->get_setting(array('accessemail', 'censoremail')); $accessemail = $setting['accessemail']; $censoremail = $setting['censoremail']; $accessexp = '/('.str_replace("\r\n", '|', preg_quote(trim($accessemail), '/')).')$/i'; $censorexp = '/('.str_replace("\r\n", '|', preg_quote(trim($censoremail), '/')).')$/i'; if($accessemail || $censoremail) { if(($accessemail && !preg_match($accessexp, $email)) || ($censoremail && preg_match($censorexp, $email))) { return FALSE; } else { return TRUE; } } else { return TRUE; } } function check_emailexists($email, $username = '') { $sqladd = $username !== '' ? "AND username<>'$username'" : ''; $email = $this->db->result_first("SELECT email FROM ".UC_DBTABLEPRE."members WHERE email='$email' $sqladd"); return $email; } function check_login($username, $password, &$user) { $user = $this->get_user_by_username($username); if(empty($user['username'])) { return -1; } elseif($user['password'] != md5(md5($password).$user['salt'])) { return -2; } return $user['uid']; } function add_user($username, $password, $email, $uid = 0, $questionid = '', $answer = '') { $salt = substr(uniqid(rand()), -6); $password = md5(md5($password).$salt); $sqladd = $uid ? "uid='".intval($uid)."'," : ''; $sqladd .= $questionid > 0 ? " secques='".$this->quescrypt($questionid, $answer)."'," : " secques='',"; $this->db->query("INSERT INTO ".UC_DBTABLEPRE."members SET $sqladd username='$username', password='$password', email='$email', regip='".$this->base->onlineip."', regdate='".$this->base->time."', salt='$salt'"); $uid = $this->db->insert_id(); $this->db->query("INSERT INTO ".UC_DBTABLEPRE."memberfields SET uid='$uid'"); return $uid; } function edit_user($username, $oldpw, $newpw, $email, $ignoreoldpw = 0, $questionid = '', $answer = '') { $data = $this->db->fetch_first("SELECT username, uid, password, salt FROM ".UC_DBTABLEPRE."members WHERE username='$username'"); if($ignoreoldpw) { $isprotected = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid = '$data[uid]'"); if($isprotected) { return -8; } } if(!$ignoreoldpw && $data['password'] != md5(md5($oldpw).$data['salt'])) { return -1; } $sqladd = $newpw ? "password='".md5(md5($newpw).$data['salt'])."'" : ''; $sqladd .= $email ? ($sqladd ? ',' : '')." email='$email'" : ''; if($questionid !== '') { if($questionid > 0) { $sqladd .= ($sqladd ? ',' : '')." secques='".$this->quescrypt($questionid, $answer)."'"; } else { $sqladd .= ($sqladd ? ',' : '')." secques=''"; } } if($sqladd || $emailadd) { $this->db->query("UPDATE ".UC_DBTABLEPRE."members SET $sqladd WHERE username='$username'"); return $this->db->affected_rows(); } else { return -7; } } function delete_user($uidsarr) { $uidsarr = (array)$uidsarr; $uids = $this->base->implode($uidsarr); $arr = $this->db->fetch_all("SELECT uid FROM ".UC_DBTABLEPRE."protectedmembers WHERE uid IN ($uids)"); $puids = array(); foreach((array)$arr as $member) { $puids[] = $member['uid']; } $uids = $this->base->implode(array_diff($uidsarr, $puids)); if($uids) { $this->db->query("DELETE FROM ".UC_DBTABLEPRE."members WHERE uid IN($uids)"); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."memberfields WHERE uid IN($uids)"); uc_user_deleteavatar($uidsarr); $this->base->load('note'); $_ENV['note']->add('deleteuser', "ids=$uids"); return $this->db->affected_rows(); } else { return 0; } } function get_total_num($sqladd = '') { $data = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."members $sqladd"); return $data; } function get_list($page, $ppp, $totalnum, $sqladd) { $start = $this->base->page_get_start($page, $ppp, $totalnum); $data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."members $sqladd LIMIT $start, $ppp"); return $data; } function name2id($usernamesarr) { $usernamesarr = uc_addslashes($usernamesarr, 1, TRUE); $usernames = $this->base->implode($usernamesarr); $query = $this->db->query("SELECT uid FROM ".UC_DBTABLEPRE."members WHERE username IN($usernames)"); $arr = array(); while($user = $this->db->fetch_array($query)) { $arr[] = $user['uid']; } return $arr; } function quescrypt($questionid, $answer) { return $questionid > 0 && $answer != '' ? substr(md5($answer.md5($questionid)), 16, 8) : ''; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/user.php
PHP
asf20
6,981
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: friend.php 773 2008-11-26 08:45:08Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); class friendmodel { var $db; var $base; function __construct(&$base) { $this->friendmodel($base); } function friendmodel(&$base) { $this->base = $base; $this->db = $base->db; } function add($uid, $friendid, $comment='') { $direction = $this->db->result_first("SELECT direction FROM ".UC_DBTABLEPRE."friends WHERE uid='$friendid' AND friendid='$uid' LIMIT 1"); if($direction == 1) { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."friends SET uid='$uid', friendid='$friendid', comment='$comment', direction='3'", 'SILENT'); $this->db->query("UPDATE ".UC_DBTABLEPRE."friends SET direction='3' WHERE uid='$friendid' AND friendid='$uid'"); return 1; } elseif($direction == 2) { return 1; } elseif($direction == 3) { return -1; } else { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."friends SET uid='$uid', friendid='$friendid', comment='$comment', direction='1'", 'SILENT'); return $this->db->insert_id(); } } function delete($uid, $friendids) { $friendids = $this->base->implode($friendids); $this->db->query("DELETE FROM ".UC_DBTABLEPRE."friends WHERE uid='$uid' AND friendid IN ($friendids)"); $affectedrows = $this->db->affected_rows(); if($affectedrows > 0) { $this->db->query("UPDATE ".UC_DBTABLEPRE."friends SET direction=1 WHERE uid IN ($friendids) AND friendid='$uid' AND direction='3'"); } return $affectedrows; } function get_totalnum_by_uid($uid, $direction = 0) { $sqladd = ''; if($direction == 0) { $sqladd = "uid='$uid'"; } elseif($direction == 1) { $sqladd = "uid='$uid' AND direction='1'"; } elseif($direction == 2) { $sqladd = "friendid='$uid' AND direction='1'"; } elseif($direction == 3) { $sqladd = "uid='$uid' AND direction='3'"; } $totalnum = $this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."friends WHERE $sqladd"); return $totalnum; } function get_list($uid, $page, $pagesize, $totalnum, $direction = 0) { $start = $this->base->page_get_start($page, $pagesize, $totalnum); $sqladd = ''; if($direction == 0) { $sqladd = "f.uid='$uid'"; } elseif($direction == 1) { $sqladd = "f.uid='$uid' AND f.direction='1'"; } elseif($direction == 2) { $sqladd = "f.friendid='$uid' AND f.direction='1'"; } elseif($direction == 3) { $sqladd = "f.uid='$uid' AND f.direction='3'"; } if($sqladd) { $data = $this->db->fetch_all("SELECT f.*, m.username FROM ".UC_DBTABLEPRE."friends f LEFT JOIN ".UC_DBTABLEPRE."members m ON f.friendid=m.uid WHERE $sqladd LIMIT $start, $pagesize"); return $data; } else { return array(); } } function is_friend($uid, $friendids, $direction = 0) { $friendid_str = implode("', '", $friendids); $sqladd = ''; if($direction == 0) { $sqladd = "uid='$uid'"; } elseif($direction == 1) { $sqladd = "uid='$uid' AND friendid IN ('$friendid_str') AND direction='1'"; } elseif($direction == 2) { $sqladd = "friendid='$uid' AND uid IN ('$friendid_str') AND direction='1'"; } elseif($direction == 3) { $sqladd = "uid='$uid' AND friendid IN ('$friendid_str') AND direction='3'"; } if($this->db->result_first("SELECT COUNT(*) FROM ".UC_DBTABLEPRE."friends WHERE $sqladd") == count($friendids)) { return true; } else { return false; } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/friend.php
PHP
asf20
3,574
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: app.php 846 2008-12-08 05:37:05Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); class appmodel { var $db; var $base; function __construct(&$base) { $this->appmodel($base); } function appmodel(&$base) { $this->base = $base; $this->db = $base->db; } function get_apps($col = '*', $where = '') { $arr = $this->db->fetch_all("SELECT $col FROM ".UC_DBTABLEPRE."applications".($where ? ' WHERE '.$where : ''), 'appid'); foreach($arr as $k => $v) { isset($v['extra']) && !empty($v['extra']) && $v['extra'] = unserialize($v['extra']); unset($v['authkey']); $arr[$k] = $v; } return $arr; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/app.php
PHP
asf20
783
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: misc.php 846 2008-12-08 05:37:05Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); define('UC_ARRAY_SEP_1', 'UC_ARRAY_SEP_1'); define('UC_ARRAY_SEP_2', 'UC_ARRAY_SEP_2'); class miscmodel { var $db; var $base; function __construct(&$base) { $this->miscmodel($base); } function miscmodel(&$base) { $this->base = $base; $this->db = $base->db; } function get_apps($col = '*', $where = '') { $arr = $this->db->fetch_all("SELECT $col FROM ".UC_DBTABLEPRE."applications".($where ? ' WHERE '.$where : '')); return $arr; } function delete_apps($appids) { } function update_app($appid, $name, $url, $authkey, $charset, $dbcharset) { } //private function alter_app_table($appid, $operation = 'ADD') { } function get_host_by_url($url) { } function check_url($url) { } function check_ip($url) { } function test_api($url, $ip = '') { } function dfopen2($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE') { $__times__ = isset($_GET['__times__']) ? intval($_GET['__times__']) + 1 : 1; if($__times__ > 2) { return ''; } $url .= (strpos($url, '?') === FALSE ? '?' : '&')."__times__=$__times__"; return $this->dfopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype); } function dfopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE , $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE') { //error_log("[uc_client]\r\nurl: $url\r\npost: $post\r\n\r\n", 3, 'c:/log/php_fopen.txt'); $return = ''; $matches = parse_url($url); $host = $matches['host']; $path = $matches['path'] ? $matches['path'].($matches['query'] ? '?'.$matches['query'] : '') : '/'; $port = !empty($matches['port']) ? $matches['port'] : 80; if($post) { $out = "POST $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; //$out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $boundary = $encodetype == 'URLENCODE' ? '' : ';'.substr($post, 0, trim(strpos($post, "\n"))); $out .= $encodetype == 'URLENCODE' ? "Content-Type: application/x-www-form-urlencoded\r\n" : "Content-Type: multipart/form-data$boundary\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= 'Content-Length: '.strlen($post)."\r\n"; $out .= "Connection: Close\r\n"; $out .= "Cache-Control: no-cache\r\n"; $out .= "Cookie: $cookie\r\n\r\n"; $out .= $post; } else { $out = "GET $path HTTP/1.0\r\n"; $out .= "Accept: */*\r\n"; //$out .= "Referer: $boardurl\r\n"; $out .= "Accept-Language: zh-cn\r\n"; $out .= "User-Agent: $_SERVER[HTTP_USER_AGENT]\r\n"; $out .= "Host: $host\r\n"; $out .= "Connection: Close\r\n"; $out .= "Cookie: $cookie\r\n\r\n"; } $fp = @fsockopen(($ip ? $ip : $host), $port, $errno, $errstr, $timeout); if(!$fp) { return ''; } else { stream_set_blocking($fp, $block); stream_set_timeout($fp, $timeout); @fwrite($fp, $out); $status = stream_get_meta_data($fp); if(!$status['timed_out']) { while (!feof($fp)) { if(($header = @fgets($fp)) && ($header == "\r\n" || $header == "\n")) { break; } } $stop = false; while(!feof($fp) && !$stop) { $data = fread($fp, ($limit == 0 || $limit > 8192 ? 8192 : $limit)); $return .= $data; if($limit) { $limit -= strlen($data); $stop = $limit <= 0; } } } @fclose($fp); return $return; } } function array2string($arr) { $s = $sep = ''; if($arr && is_array($arr)) { foreach($arr as $k => $v) { $s .= $sep.$k.UC_ARRAY_SEP_1.$v; $sep = UC_ARRAY_SEP_2; } } return $s; } function string2array($s) { $arr = explode(UC_ARRAY_SEP_2, $s); $arr2 = array(); foreach($arr as $k => $v) { list($key, $val) = explode(UC_ARRAY_SEP_1, $v); $arr2[$key] = $val; } return $arr2; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/misc.php
PHP
asf20
4,191
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: tag.php 753 2008-11-14 06:48:25Z cnteacher $ */ !defined('IN_UC') && exit('Access Denied'); class tagmodel { var $db; var $base; function __construct(&$base) { $this->tagmodel($base); } function tagmodel(&$base) { $this->base = $base; $this->db = $base->db; } function get_tag_by_name($tagname) { $arr = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."tags WHERE tagname='$tagname'"); return $arr; } function get_template($appid) { $result = $this->db->result_first("SELECT tagtemplates FROM ".UC_DBTABLEPRE."applications WHERE appid='$appid'"); return $result; } function updatedata($appid, $data) { $appid = intval($appid); include_once UC_ROOT.'lib/xml.class.php'; $data = xml_unserialize($data); $this->base->load('app'); $data[0] = addslashes($data[0]); $datanew = array(); if(is_array($data[1])) { foreach($data[1] as $r) { $datanew[] = $_ENV['misc']->array2string($r); } } $tmp = $_ENV['app']->get_apps('type', "appid='$appid'"); $datanew = addslashes($tmp[0]['type']."\t".implode("\t", $datanew)); if(!empty($data[0])) { $return = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."tags WHERE tagname='$data[0]' AND appid='$appid'"); if($return) { $this->db->query("UPDATE ".UC_DBTABLEPRE."tags SET data='$datanew', expiration='".$this->base->time."' WHERE tagname='$data[0]' AND appid='$appid'"); } else { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."tags (tagname, appid, data, expiration) VALUES ('$data[0]', '$appid', '$datanew', '".$this->base->time."')"); } } } function formatcache($appid, $tagname) { $return = $this->db->result_first("SELECT count(*) FROM ".UC_DBTABLEPRE."tags WHERE tagname='$tagname' AND appid='$appid'"); if($return) { $this->db->query("UPDATE ".UC_DBTABLEPRE."tags SET expiration='0' WHERE tagname='$tagname' AND appid='$appid'"); } else { $this->db->query("INSERT INTO ".UC_DBTABLEPRE."tags (tagname, appid, expiration) VALUES ('$tagname', '$appid', '0')"); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/tag.php
PHP
asf20
2,212
<?php /* [UCenter] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: cache.php 846 2008-12-08 05:37:05Z zhaoxiongfei $ */ !defined('IN_UC') && exit('Access Denied'); if(!function_exists('file_put_contents')) { function file_put_contents($filename, $s) { $fp = @fopen($filename, 'w'); @fwrite($fp, $s); @fclose($fp); } } class cachemodel { var $db; var $base; var $map; function __construct(&$base) { $this->cachemodel($base); } function cachemodel(&$base) { $this->base = $base; $this->db = $base->db; $this->map = array( 'settings' => array('settings'), 'badwords' => array('badwords'), 'apps' => array('apps') ); } //public function updatedata($cachefile = '') { if($cachefile) { foreach((array)$this->map[$cachefile] as $modules) { $s = "<?php\r\n"; foreach((array)$modules as $m) { $method = "_get_$m"; $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n"; } $s .= "\r\n?>"; @file_put_contents(UC_DATADIR."./cache/$cachefile.php", $s); } } else { foreach((array)$this->map as $file => $modules) { $s = "<?php\r\n"; foreach($modules as $m) { $method = "_get_$m"; $s .= '$_CACHE[\''.$m.'\'] = '.var_export($this->$method(), TRUE).";\r\n"; } $s .= "\r\n?>"; @file_put_contents(UC_DATADIR."./cache/$file.php", $s); } } } function updatetpl() { } //private function _get_badwords() { $data = $this->db->fetch_all("SELECT * FROM ".UC_DBTABLEPRE."badwords"); $return = array(); if(is_array($data)) { foreach($data as $k => $v) { $return['findpattern'][$k] = $v['findpattern']; $return['replace'][$k] = $v['replacement']; } } return $return; } //private function _get_apps() { $this->base->load('app'); $apps = $_ENV['app']->get_apps(); $apps2 = array(); if(is_array($apps)) { foreach($apps as $v) { $v['extra'] = unserialize($v['extra']); $apps2[$v['appid']] = $v; } } return $apps2; } function _get_settings() { return $this->base->get_setting(); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/uc_client/model/cache.php
PHP
asf20
2,206
<?php if(!defined('IN_DISCUZ')) { exit('Access Denied'); } define('DISCUZ_VERSION', '7.0.0'); define('DISCUZ_RELEASE', '20090121'); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/discuz_version.php
PHP
asf20
147
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: post.php 17458 2008-12-23 12:06:32Z monkey $ */ define('CURSCRIPT', 'post'); define('NOROBOT', TRUE); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./include/post.func.php'; $_DTYPE = $checkoption = $optionlist = array(); if($sortid) { threadsort_checkoption(); } if(empty($action)) { showmessage('undefined_action', NULL, 'HALTED'); }elseif($action == 'threadsorts') { threadsort_optiondata(); $template = intval($operate) ? 'search_sortoption' : 'post_sortoption'; include template($template); exit; } elseif(($forum['simple'] & 1) || $forum['redirect']) { showmessage('forum_disablepost'); } require_once DISCUZ_ROOT.'./include/discuzcode.func.php'; $customaddfeed = $customaddfeed ? $customaddfeed : $uchome['addfeed']; if($action == 'reply') { $addfeedcheck = $customaddfeed & 4 ? 'checked="checked"': ''; } elseif(!empty($special) && $action != 'reply') { $addfeedcheck = $customaddfeed & 2 ? 'checked="checked"': ''; } else { $addfeedcheck = $customaddfeed & 1 ? 'checked="checked"': ''; } $navigation = $navtitle = $thread = ''; if(!empty($cedit)) { unset($inajax, $infloat, $ajaxtarget, $handlekey); } if($action == 'edit' || $action == 'reply') { if($thread = $db->fetch_first("SELECT * FROM {$tablepre}threads WHERE tid='$tid'".($auditstatuson ? '' : " AND displayorder>='0'"))) { $navigation = "&raquo; <a href=\"viewthread.php?tid=$tid\">$thread[subject]</a>"; $navtitle = $thread['subject'].' - '; if($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) { showmessage('thread_nopermission', NULL, 'NOPERM'); } $fid = $thread['fid']; $special = $thread['special']; } else { showmessage('thread_nonexistence'); } if($action == 'reply' && ($thread['closed'] == 1) && !$forum['ismoderator']) { showmessage('post_thread_closed'); } } $navigation = "&raquo; <a href=\"forumdisplay.php?fid=$fid".($extra ? '&'.preg_replace("/^(&)*/", '', $extra) : '')."\">$forum[name]</a> $navigation"; $navtitle = $navtitle.strip_tags($forum['name']).' - '; if($forum['type'] == 'sub') { $fup = $db->fetch_first("SELECT name, fid FROM {$tablepre}forums WHERE fid='$forum[fup]'"); $navigation = "&raquo; <a href=\"forumdisplay.php?fid=$fup[fid]\">$fup[name]</a> $navigation"; $navtitle = $navtitle.strip_tags($fup['name']).' - '; } periodscheck('postbanperiods'); if($forum['password'] && $forum['password'] != $_DCOOKIE['fidpw'.$fid]) { showmessage('forum_passwd', "forumdisplay.php?fid=$fid"); } if(empty($forum['allowview'])) { if(!$forum['viewperm'] && !$readaccess) { showmessage('group_nopermission', NULL, 'NOPERM'); } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) { showmessage('forum_nopermission', NULL, 'NOPERM'); } } elseif($forum['allowview'] == -1) { showmessage('forum_access_view_disallow'); } formulaperm($forum['formulaperm']); if(!$adminid && $newbiespan && (!$lastpost || $timestamp - $lastpost < $newbiespan * 3600)) { if($timestamp - ($db->result_first("SELECT regdate FROM {$tablepre}members WHERE uid='$discuz_uid'")) < $newbiespan * 3600) { showmessage('post_newbie_span'); } } $special = empty($special) || !is_numeric($special) || $special < 0 || $special > 6 ? 0 : intval($special); $allowpostattach = $forum['allowpostattach'] != -1 && ($forum['allowpostattach'] == 1 || (!$forum['postattachperm'] && $allowpostattach) || ($forum['postattachperm'] && forumperm($forum['postattachperm']))); $attachextensions = $forum['attachextensions'] ? $forum['attachextensions'] : $attachextensions; $enctype = $allowpostattach ? 'enctype="multipart/form-data"' : ''; $maxattachsize_mb = $maxattachsize / 1048576 >= 1 ? round(($maxattachsize / 1048576), 1).'M' : round(($maxattachsize / 1024)).'K'; $postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post']; $replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply']; $digestcredits = $forum['digestcredits'] ? $forum['digestcredits'] : $creditspolicy['digest']; $postattachcredits = $forum['postattachcredits'] ? $forum['postattachcredits'] : $creditspolicy['postattach']; $maxprice = isset($extcredits[$creditstrans]) ? $maxprice : 0; $extra = rawurlencode($extra); $notifycheck = empty($emailnotify) ? '' : 'checked="checked"'; $stickcheck = empty($sticktopic) ? '' : 'checked="checked"'; $digestcheck = empty($addtodigest) ? '' : 'checked="checked"'; $subject = isset($subject) ? dhtmlspecialchars(censor(trim($subject))) : ''; $subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject; $message = isset($message) ? censor(trim($message)) : ''; $polloptions = isset($polloptions) ? censor(trim($polloptions)) : ''; $readperm = isset($readperm) ? intval($readperm) : 0; $price = isset($price) ? intval($price) : 0; $tagstatus = $tagstatus && $forum['allowtag'] ? ($tagstatus == 2 ? 2 : $forum['allowtag']) : 0; if(empty($bbcodeoff) && !$allowhidecode && !empty($message) && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\](.+?)\[\/code\])/is", ' ', $message))) { showmessage('post_hide_nopermission'); } if(periodscheck('postmodperiods', 0)) { $modnewthreads = $modnewreplies = 1; } else { $censormod = censormod($subject."\t".$message); $modnewthreads = (!$allowdirectpost || $allowdirectpost == 1) && ($forum['modnewposts'] || $censormod) ? 1 : 0; $modnewreplies = (!$allowdirectpost || $allowdirectpost == 2) && ($forum['modnewposts'] == 2 || $censormod) ? 1 : 0; } $urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = ''; $seccodecheck = ($seccodestatus & 4) && (!$seccodedata['minposts'] || $posts < $seccodedata['minposts']); $secqaacheck = $secqaa['status'][2] && (!$secqaa['minposts'] || $posts < $secqaa['minposts']); $allowpostpoll = $allowpost && $allowpostpoll && ($forum['allowpostspecial'] & 1); $allowposttrade = $allowpost && $allowposttrade && ($forum['allowpostspecial'] & 2); $allowpostreward = $allowpost && $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]); $allowpostactivity = $allowpost && $allowpostactivity && ($forum['allowpostspecial'] & 8); $allowpostdebate = $allowpost && $allowpostdebate && ($forum['allowpostspecial'] & 16); $allowpostvideo = $allowpost && $allowpostvideo && ($forum['allowpostspecial'] & 32) && $videoopen; $usesigcheck = $discuz_uid && $sigstatus ? 'checked="checked"' : ''; $allowanonymous = $forum['allowanonymous'] || $allowanonymous ? 1 : 0; if($action == 'newthread' && $forum['allowspecialonly'] && !$special) { if($allowpostpoll) { $special = 1; } elseif($allowposttrade) { $special = 2; } elseif($allowpostreward) { $special = 3; } elseif($allowpostactivity) { $special = 4; } elseif($allowpostdebate) { $special = 5; } elseif($allowpostvideo) { $special = 6; } if(!$special) { showmessage('undefined_action', NULL, 'HALTED'); } } $editorid = 'e'; $editoroptions = str_pad(decbin($editoroptions), 2, 0, STR_PAD_LEFT); $editormode = $editormode == 2 ? $editoroptions{0} : $editormode; $allowswitcheditor = $editoroptions{1}; $swfupload = $swfupload && $allowpostattach; if($swfupload) { require_once DISCUZ_ROOT.'./include/swfupload.func.php'; $swfattachs = getswfattach(); } if(!empty($infloat)) { $policyarray = array(); foreach($creditspolicy as $operation => $policy) { if(in_array($operation, array('post', 'reply', 'digest', 'postattach', 'getattach'))) { $policyarray[$operation] = $policy; if($forum) { $policyarray[$operation] = $forum[$operation.'credits'] ? $forum[$operation.'credits'] : $creditspolicy[$operation]; } } } $creditsarray = array(); for($i = 1; $i <= 8; $i++) { if(isset($extcredits[$i])) { foreach($policyarray as $operation => $policy) { $addcredits = in_array($operation, array('getattach', 'forum_getattach')) ? -$policy[$i] : $policy[$i]; $creditsarray[$operation][$i] = empty($policy[$i]) ? 0 : (is_numeric($policy[$i]) ? '<b>'.($addcredits > 0 ? '+'.$addcredits : $addcredits).'</b> '.$extcredits[$i]['unit'] : $policy[$i]); } } } } $posturl = "action=$action&fid=$fid". (!empty($tid) ? "&tid=$tid" : ''). (!empty($pid) ? "&pid=$pid" : ''). (!empty($special) ? "&special=$special" : ''). (!empty($sortid) ? "&sortid=$sortid" : ''). (!empty($typeid) ? "&sortid=$typeid" : ''). (!empty($firstpid) ? "&firstpid=$firstpid" : ''). (!empty($addtrade) ? "&addtrade=$addtrade" : ''); if($action == 'newthread') { ($forum['allowpost'] == -1) && showmessage('forum_access_disallow'); require_once DISCUZ_ROOT.'./include/newthread.inc.php'; } elseif($action == 'reply') { ($forum['allowreply'] == -1) && showmessage('forum_access_disallow'); require_once DISCUZ_ROOT.'./include/newreply.inc.php'; } elseif($action == 'edit') { ($forum['allowpost'] == -1) && showmessage('forum_access_disallow'); require_once DISCUZ_ROOT.'./include/editpost.inc.php'; } elseif($action == 'newtrade') { ($forum['allowpost'] == -1) && showmessage('forum_access_disallow'); require_once DISCUZ_ROOT.'./include/newtrade.inc.php'; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/post.php
PHP
asf20
9,471
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: topic.php 16688 2008-11-14 06:41:07Z cnteacher $ */ define('CURSCRIPT', 'topic'); require_once './include/common.inc.php'; $randnum = !empty($qihoo['relate']['webnum']) ? rand(1, 1000) : ''; $statsdata = $statsdata ? dhtmlspecialchars($statsdata) : ''; if($url && $randnum) { $url = dhtmlspecialchars($url); $md5 = dhtmlspecialchars($md5); $fid = substr($statsdata, 0, strpos($statsdata, '||')); } else { if(empty($keyword)) { showmessage('undefined_action'); } $tpp = intval($tpp); $page = max(1, intval($page)); $start = ($page - 1) * $tpp; $site = site(); $length = intval($length); $stype = empty($stype) ? 0 : 'title'; $relate = in_array($relate, array('score', 'pdate', 'rdate')) ? $relate : 'score'; $keyword = dhtmlspecialchars(stripslashes($keyword)); $topic = $topic ? dhtmlspecialchars(stripslashes($topic)) : $keyword; } include template('topic'); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/topic.php
PHP
asf20
1,047
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: my.php 17336 2008-12-15 06:54:54Z monkey $ */ define('NOROBOT', TRUE); define('CURSCRIPT', 'my'); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; $discuz_action = 8; if(!$discuz_uid) { showmessage('not_loggedin', NULL, 'NOPERM'); } $page = max(1, intval($page)); $start_limit = ($page - 1) * $tpp; $threadlist = $postlist = array(); $tids = $comma = $threadadd = $postadd = $forumname = $extrafid = $extra = $multipage = ''; if($srchfid = empty($srchfid) ? 0 : intval($srchfid)) { $threadadd = "AND t.fid='$srchfid'"; $postadd = "AND p.fid='$srchfid'"; $forumname = $_DCACHE['forums'][$srchfid]['name']; $extrafid = '&amp;srchfid='.$srchfid; } $item = isset($item) ? trim($item) : ''; if(empty($item)) { $query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.lastposter, t.lastpost, t.closed FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT 5"); while($thread = $db->fetch_array($query)) { $thread['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $thread['forumname'] = $_DCACHE['forums'][$thread['fid']]['name']; $thread['lastposterenc'] = rawurlencode($thread['lastposter']); $threadlist[] = $thread; } $query = $db->query("SELECT m.*, p.fid, p.invisible FROM {$tablepre}myposts m INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd INNER JOIN {$tablepre}threads t ON t.tid=m.tid WHERE m.uid = '$discuz_uid' ORDER BY m.dateline DESC LIMIT 5"); while($post = $db->fetch_array($query)) { $post['forumname'] = $_DCACHE['forums'][$post['fid']]['name']; $postlist[$post['tid']] = $post; $tids .= $comma.$post['tid']; $comma = ', '; } if($tids) { $query = $db->query("SELECT tid, subject, lastposter, lastpost FROM {$tablepre}threads WHERE tid IN ($tids)"); while($thread = $db->fetch_array($query)) { $postlist[$thread['tid']]['subject'] = $thread['subject']; $postlist[$thread['tid']]['lastposter'] = $thread['lastposter']; $postlist[$thread['tid']]['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $postlist[$thread['tid']]['lastposterenc'] = rawurlencode($thread['lastposter']); } } } elseif($item == 'grouppermission') { require_once './include/forum.func.php'; $searchgroupid = isset($searchgroupid) ? intval($searchgroupid) : $groupid; $grouplist = array(); $query = $db->query("SELECT groupid, type, grouptitle FROM {$tablepre}usergroups ORDER BY (creditshigher<>'0' || creditslower<>'0'), creditslower"); while($group = $db->fetch_array($query)) { $grouplist[$group['type']] .= '<li><a href="my.php?item=grouppermission&amp;type='.$group['type'].'&amp;searchgroupid='.$group['groupid'].'">'.$group['grouptitle'].'</a></li>'; } $group = $db->fetch_first("SELECT * FROM {$tablepre}usergroups u LEFT JOIN {$tablepre}admingroups a ON u.groupid=a.admingid WHERE u.groupid='$searchgroupid'"); if(!$group) { showmessage('usergroups_nonexistence'); } $group['maxattachsize'] = $group['maxattachsize'] / 1024; $group['maxsizeperday'] = $group['maxsizeperday'] / 1024; $group['maxbiosize'] = $group['maxbiosize'] ? $group['maxbiosize'] : 200; include template('my_grouppermission'); exit; } elseif($item == 'threads') { if($filter == 'recyclebin') { $threadadd .= " AND t.displayorder='-1'"; } elseif($filter == 'aduit') { $threadadd .= " AND t.displayorder='-2'"; } elseif($filter == 'close') { $threadadd .= " AND t.closed='1'"; } elseif($filter == 'common') { $threadadd .= " AND t.displayorder>='0' AND t.closed='0'"; } $fidadd = $srchfid ? "&amp;srchfid=$srchfid" : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid='$discuz_uid' $threadadd AND m.tid=t.tid"); $multipage = multi($num, $tpp, $page, 'my.php?item=threads'.$fidadd.$extrafid); $query = $db->query("SELECT m.*, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid = '$discuz_uid' $threadadd AND m.tid=t.tid ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($thread = $db->fetch_array($query)) { $thread['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $thread['forumname'] = $_DCACHE['forums'][$thread['fid']]['name']; $thread['lastposterenc'] = rawurlencode($thread['lastposter']); $threadlist[] = $thread; } } elseif($item == 'posts') { if($filter == 'recyclebin') { $postadd .= " AND p.invisible='-1'"; } elseif($filter == 'aduit') { $postadd .= " AND p.invisible='-2'"; } elseif($filter == 'close') { $threadadd .= " AND t.closed='1'"; } elseif($filter == 'common') { $postadd .= " AND p.invisible='0'"; $threadadd .= " AND t.displayorder>='0' AND t.closed='0'"; } $fidadd = $srchfid ? "&amp;srchfid=$srchfid" : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}myposts m INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd INNER JOIN {$tablepre}threads t ON t.tid=m.tid $threadadd WHERE m.uid = '$discuz_uid'"); $multipage = multi($num, $tpp, $page, 'my.php?item=posts'.$fidadd.$extrafid); $query = $db->query("SELECT m.uid, m.tid, m.pid, p.fid, p.invisible, p.dateline FROM {$tablepre}myposts m INNER JOIN {$tablepre}posts p ON p.pid=m.pid $postadd INNER JOIN {$tablepre}threads t ON t.tid=m.tid $threadadd WHERE m.uid = '$discuz_uid' ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($post = $db->fetch_array($query)) { $post['forumname'] = $_DCACHE['forums'][$post['fid']]['name']; $postlist[$post['tid']] = $post; $tids .= $comma.$post['tid']; $comma = ', '; } if($tids) { $query = $db->query("SELECT tid, subject AS tsubject, lastposter, lastpost, closed FROM {$tablepre}threads WHERE tid IN ($tids)"); while($thread = $db->fetch_array($query)) { $postlist[$thread['tid']]['tsubject'] = $thread['tsubject']; $postlist[$thread['tid']]['lastposter'] = $thread['lastposter']; $postlist[$thread['tid']]['closed'] = $thread['closed']; $postlist[$thread['tid']]['lastpost'] = dgmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600); $postlist[$thread['tid']]['lastposterenc'] = rawurlencode($thread['lastposter']); } } } elseif(in_array($item, array('favorites', 'subscriptions'))) { if($fid && empty($forum['allowview'])) { if(!$forum['viewperm'] && !$readaccess) { showmessage('group_nopermission', NULL, 'NOPERM'); } elseif($forum['viewperm'] && !forumperm($forum['viewperm'])) { showmessage('forum_nopermission', NULL, 'NOPERM'); } } if($item == 'favorites') { $ftid = $type == 'thread' || $tid ? 'tid' : 'fid'; $type = $type == 'thread' || $tid ? 'thread' : 'forum'; $extra .= $srchfid ? '&amp;type='.$type : ''; if(($fid || $tid) && !submitcheck('favsubmit')) { if($db->result_first("SELECT COUNT(*) FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid>'0'") >= $maxfavorites) { showmessage('favorite_is_full', 'my.php?item=favorites&type='.$type); } if($db->result_first("SELECT $ftid FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $ftid='${$ftid}' LIMIT 1")) { showmessage('favorite_exists'); } else { $db->query("INSERT INTO {$tablepre}favorites (uid, $ftid) VALUES ('$discuz_uid', '${$ftid}')"); showmessage('favorite_add_succeed', dreferer()); } } elseif(!$fid && !$tid) { if(!submitcheck('favsubmit')) { $favlist = array(); if($type == 'forum') { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}favorites fav, {$tablepre}forums f WHERE fav.uid = '$discuz_uid' AND fav.fid=f.fid"); $multipage = multi($num, $tpp, $page, "my.php?item=favorites&amp;type=forum$extrafid"); $query = $db->query("SELECT f.fid, f.name, f.threads, f.posts, f.todayposts, f.lastpost FROM {$tablepre}favorites fav, {$tablepre}forums f WHERE fav.fid=f.fid AND fav.uid='$discuz_uid' ORDER BY f.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 { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}favorites fav, {$tablepre}threads t WHERE fav.uid = '$discuz_uid' AND fav.tid=t.tid AND t.displayorder>='0' $threadadd"); $multipage = multi($num, $tpp, $page, "my.php?item=favorites&amp;type=thread$extrafid"); $query = $db->query("SELECT t.tid, t.fid, t.subject, t.replies, t.lastpost, t.lastposter, f.name 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'); } showmessage('favorite_update_succeed', dreferer()); } } } else { if(isset($subadd) && !submitcheck('subsubmit')) { $subadd = intval($subadd); if($pricethread = $db->result_first("SELECT price FROM {$tablepre}threads WHERE tid='$subadd'")) { $query = $db->query("SELECT tid FROM {$tablepre}paymentlog WHERE tid='$subadd' AND uid='$discuz_uid'"); if(!$db->num_rows($query)) { showmessage('subscription_nopermission'); } } if($db->result_first("SELECT COUNT(*) FROM {$tablepre}subscriptions WHERE uid='$discuz_uid'") >= $maxsubscriptions) { showmessage('subscription_is_full', 'my.php?item=subscriptions'); } if($db->result_first("SELECT tid FROM {$tablepre}subscriptions WHERE tid='$subadd' AND uid='$discuz_uid' LIMIT 1")) { showmessage('subscription_exists'); } else { $db->query("UPDATE {$tablepre}threads SET subscribed='1' WHERE tid='$subadd'"); $db->query("INSERT INTO {$tablepre}subscriptions (uid, tid, lastnotify) VALUES ('$discuz_uid', '$subadd', '')"); showmessage('subscription_add_succeed', dreferer()); } } elseif(empty($subadd)) { if(!submitcheck('subsubmit')) { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}subscriptions s, {$tablepre}threads t WHERE s.uid = '$discuz_uid' AND s.tid=t.tid $threadadd"); $multipage = multi($num, $tpp, $page, "my.php?item=subscriptions$extrafid"); $subslist = array(); $query = $db->query("SELECT t.tid, t.fid, t.subject, t.replies, t.lastpost, t.lastposter, f.name FROM {$tablepre}subscriptions s, {$tablepre}threads t, {$tablepre}forums f WHERE t.tid=s.tid AND t.displayorder>='0' AND f.fid=t.fid AND s.uid='$discuz_uid' $threadadd ORDER BY t.lastpost DESC LIMIT $start_limit, $tpp"); while($subs = $db->fetch_array($query)) { $subs['lastposterenc'] = rawurlencode($subs['lastposter']); $subs['lastpost'] = dgmdate("$dateformat $timeformat", $subs['lastpost'] + $timeoffset * 3600); $subslist[] = $subs; } } else { if($ids = implodeids($delete)) { $db->query("DELETE FROM {$tablepre}subscriptions WHERE uid='$discuz_uid' AND tid IN ($ids)", 'UNBUFFERED'); } showmessage('subscription_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; case 'eccredit' : $typestatus = 'eccredittrades'; $sqlfilter .= $item == 'selltrades' ? 'AND (tl.ratestatus=0 OR tl.ratestatus=1) ' : 'AND (tl.ratestatus=0 OR tl.ratestatus=2) '; break; case 'all' : $typestatus = ''; break; case 'success' : $typestatus = 'successtrades'; break; case 'closed' : $typestatus = 'closedtrades'; break; case 'refund' : $typestatus = 'refundtrades'; break; case 'unstart' : $typestatus = 'unstarttrades'; break; default : $typestatus = 'tradingtrades'; $filter = ''; } $sqlfilter .= $typestatus ? 'AND tl.status IN (\''.trade_typestatus($typestatus).'\')' : ''; if(!empty($srchkey)) { $sqlkey = 'AND tl.subject like \'%'.str_replace('*', '%', addcslashes($srchkey, '%_')).'%\''; $extrasrchkey = '&srchkey='.rawurlencode($srchkey); $srchkey = dhtmlspecialchars($srchkey); } else { $sqlkey = $extrasrchkey = $srchkey = ''; } $pid = intval($pid); $sqltid = $tid ? 'AND tl.tid=\''.$tid.'\''.($pid ? ' AND tl.pid=\''.$pid.'\'' : '') : ''; $extra .= $srchfid ? '&amp;filter='.$filter : ''; $extratid = $tid ? "&amp;tid=$tid".($pid ? "&amp;pid=$pid" : '') : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}tradelog tl, {$tablepre}threads t WHERE tl.tid=t.tid AND tl.$sqlfield='$discuz_uid' $threadadd $sqltid $sqlkey $sqlfilter"); $multipage = multi($num, $tpp, $page, "my.php?item=$item$extratid$extrafid".($filter ? "&amp;filter=$filter" : '').$extrafid.$extrasrchkey); $query = $db->query("SELECT tl.*, tr.aid, t.subject AS threadsubject FROM {$tablepre}tradelog tl, {$tablepre}threads t, {$tablepre}trades tr WHERE tl.tid=t.tid AND tr.pid=tl.pid AND tr.tid=tl.tid AND tl.$sqlfield='$discuz_uid' $threadadd $sqltid $sqlkey $sqlfilter ORDER BY tl.lastupdate DESC LIMIT $start_limit, $tpp"); $tradeloglist = array(); while($tradelog = $db->fetch_array($query)) { $tradelog['lastupdate'] = dgmdate("$dateformat $timeformat", $tradelog['lastupdate'] + $timeoffset * 3600); $tradelog['attend'] = trade_typestatus($item, $tradelog['status']); $tradelog['status'] = trade_getstatus($tradelog['status']); $tradeloglist[] = $tradelog; } } elseif($item == 'tradestats') { $extrasrchkey = $extratid = ''; require_once DISCUZ_ROOT.'./include/trade.func.php'; $buystats = $db->fetch_first("SELECT COUNT(*) AS totalitems, SUM(price) AS tradesum FROM {$tablepre}tradelog WHERE buyerid='$discuz_uid' AND status IN ('".trade_typestatus('successtrades')."')"); $sellstats = $db->fetch_first("SELECT COUNT(*) AS totalitems, SUM(price) AS tradesum FROM {$tablepre}tradelog WHERE sellerid='$discuz_uid' AND status IN ('".trade_typestatus('successtrades')."')"); $query = $db->query("SELECT status FROM {$tablepre}tradelog WHERE buyerid='$discuz_uid' AND status IN ('".trade_typestatus('buytrades')."')"); $buyerattend = $db->num_rows($query); $attendstatus = array(); while($status = $db->fetch_array($query)) { @$attendstatus[$status['status']]++; } $query = $db->query("SELECT status FROM {$tablepre}tradelog WHERE sellerid='$discuz_uid' AND status IN ('".trade_typestatus('selltrades')."')"); $sellerattend = $db->num_rows($query); while($status = $db->fetch_array($query)) { @$attendstatus[$status['status']]++; } $goodsbuyer = $db->result_first("SELECT COUNT(*) FROM {$tablepre}tradelog WHERE buyerid='$discuz_uid' AND status IN ('".trade_typestatus('tradingtrades')."')"); $goodsseller = $db->result_first("SELECT COUNT(*) FROM {$tablepre}trades WHERE sellerid='$discuz_uid' AND closed='0'"); $eccreditbuyer = $db->result_first("SELECT COUNT(*) FROM {$tablepre}tradelog WHERE status IN ('".trade_typestatus('eccredittrades')."') AND buyerid='$discuz_uid' AND (ratestatus=0 OR ratestatus=2)"); $eccreditseller = $db->result_first("SELECT COUNT(*) FROM {$tablepre}tradelog WHERE status IN ('".trade_typestatus('eccredittrades')."') AND sellerid='$discuz_uid' AND (ratestatus=0 OR ratestatus=1)"); } elseif($item == 'tradethreads') { if(!empty($srchkey)) { $sqlkey = 'AND subject like \'%'.str_replace('*', '%', addcslashes($srchkey, '%_')).'%\''; $extrasrchkey = '&srchkey='.rawurlencode($srchkey); $srchkey = dhtmlspecialchars($srchkey); } else { $sqlkey = $extrasrchkey = $srchkey = ''; } $sqltid = $tid ? 'AND tid ='.$tid : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}trades WHERE sellerid='$discuz_uid' $sqltid $sqlkey"); $extratid = $tid ? "&amp;tid=$tid" : ''; $multipage = multi($num, $tpp, $page, "my.php?item=tradethreads$extratid$extrafid$extrasrchkey"); $tradelist = array(); $query = $db->query("SELECT * FROM {$tablepre}trades WHERE sellerid='$discuz_uid' $sqltid $sqlkey ORDER BY tradesum DESC, totalitems DESC LIMIT $start_limit, $tpp"); while($tradethread = $db->fetch_array($query)) { $tradethread['lastupdate'] = dgmdate("$dateformat $timeformat", $tradethread['lastupdate'] + $timeoffset * 3600); $tradethread['lastbuyer'] = rawurlencode($tradethread['lastbuyer']); if($tradethread['expiration']) { $tradethread['expiration'] = ($tradethread['expiration'] - $timestamp) / 86400; if($tradethread['expiration'] > 0) { $tradethread['expirationhour'] = floor(($tradethread['expiration'] - floor($tradethread['expiration'])) * 24); $tradethread['expiration'] = floor($tradethread['expiration']); } else { $tradethread['expiration'] = -1; } } $tradelist[] = $tradethread; } } elseif($item == 'reward') { $rewardloglist = Array(); if($type == 'stats') { $questions = $db->fetch_first("SELECT COUNT(*) AS total, SUM(ABS(netamount)) AS totalprice FROM {$tablepre}rewardlog WHERE authorid='$discuz_uid'"); $questions['total'] = $questions['total'] ? $questions['total'] : 0; $questions['totalprice'] = $questions['totalprice'] ? $questions['totalprice'] : 0; $questions['solved'] = $db->result_first("SELECT COUNT(*) FROM {$tablepre}rewardlog WHERE authorid='$discuz_uid' and answererid>0"); $questions['percent'] = number_format(($questions['total'] != 0) ? round($questions['solved'] / $questions['total'] * 100, 2) : 0, 2, '.', ''); $answers['total'] = $db->result_first("SELECT COUNT(*) FROM {$tablepre}rewardlog WHERE answererid='$discuz_uid'"); $answeradopted = $db->fetch_first("SELECT COUNT(*) AS tids, SUM(ABS(t.price)) AS totalprice FROM {$tablepre}rewardlog r LEFT JOIN {$tablepre}threads t USING(tid) WHERE r.authorid>0 and r.answererid='$discuz_uid'"); $answers['adopted'] = $answeradopted['tids']; $answers['totalprice'] = $answeradopted['totalprice'] ? $answeradopted['totalprice'] : 0; $answers['percent'] = number_format(($answers['total'] != 0) ? round($answers['adopted'] / $answers['total'] * 100, 2) : 0, 2, '.', ''); } elseif($type == 'answer') { $extra .= $srchfid ? '&amp;type=answer' : ''; $filter = isset($filter) && in_array($filter, array('adopted', 'unadopted')) ? $filter : ''; $sqlfilter = empty($filter) ? '' : ($filter == 'adopted' ? 'AND r.authorid>0' : 'AND r.authorid=0'); $page = max(1, intval($page)); $start_limit = ($page - 1) * $tpp; $multipage = multi($db->result_first("SELECT COUNT(*) FROM {$tablepre}rewardlog r WHERE answererid='$discuz_uid'"), $tpp, $page, "my.php?item=reward&amp;type=answer$extrafid"); $query = $db->query("SELECT r.*, t.subject, t.price, m.uid, m.username, f.fid, f.name FROM {$tablepre}rewardlog r LEFT JOIN {$tablepre}threads t ON t.tid=r.tid LEFT JOIN {$tablepre}forums f ON f.fid=t.fid LEFT JOIN {$tablepre}members m ON m.uid=t.authorid WHERE r.answererid='$discuz_uid' $threadadd $sqlfilter ORDER BY r.dateline DESC LIMIT $start_limit, $tpp"); while($rewardlog = $db->fetch_array($query)) { $rewardlog['dateline'] = dgmdate("$dateformat $timeformat", $rewardlog['dateline'] + $timeoffset * 3600); $rewardlog['price'] = abs($rewardlog['price']); $rewardloglist[] = $rewardlog; } } elseif($type == 'question') { $extra .= $srchfid ? '&amp;type=question' : ''; $filter = in_array($filter, array('solved', 'unsolved')) ? $filter : ''; $sqlfilter = empty($filter) ? '' : ($filter == 'solved' ? 'AND r.answererid>0' : 'AND r.answererid=0'); $page = max(1, intval($page)); $start_limit = ($page - 1) * $tpp; $multipage = multi($db->result_first("SELECT COUNT(*) FROM {$tablepre}rewardlog r WHERE authorid='$discuz_uid' $sqlfilter"), $tpp, $page, "my.php?item=reward&amp;type=question&amp;filter=$filter$extrafid"); $query = $db->query("SELECT r.*, t.subject, t.price, m.uid, m.username, f.fid, f.name FROM {$tablepre}rewardlog r LEFT JOIN {$tablepre}threads t ON t.tid=r.tid LEFT JOIN {$tablepre}forums f ON f.fid=t.fid LEFT JOIN {$tablepre}members m ON m.uid=r.answererid WHERE r.authorid='$discuz_uid' $threadadd $sqlfilter ORDER BY r.dateline DESC LIMIT $start_limit, $tpp"); while($rewardlog = $db->fetch_array($query)) { $rewardlog['dateline'] = dgmdate("$dateformat $timeformat", $rewardlog['dateline'] + $timeoffset * 3600); $rewardlog['price'] = abs($rewardlog['price']); $rewardloglist[] = $rewardlog; } } else { showmessage('undefined_action'); } } elseif($item == 'activities') { $ended = isset($ended) && in_array($ended, array('yes', 'no')) ? $ended : ''; $sign = $ascadd = ''; $activity = array(); if($type == 'orig') { if($ended == 'yes') { $sign = " AND starttimefrom<'$timestamp'"; $ascadd = 'DESC'; } elseif($ended == 'no') { $sign = " AND starttimefrom>='$timestamp'"; } $extra .= $srchfid ? '&amp;type=orig' : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}activities a LEFT JOIN {$tablepre}threads t USING(tid) WHERE a.uid='$discuz_uid' AND t.special='4' $threadadd $sign"); $multipage = multi($num, $tpp, $page, "my.php?item=activities&amp;type=orig&amp;ended=$ended$extrafid"); $query = $db->query("SELECT a.*, t.subject FROM {$tablepre}activities a LEFT JOIN {$tablepre}threads t USING(tid) WHERE a.uid='$discuz_uid' AND t.special='4' $threadadd $sign ORDER BY starttimefrom $ascadd LIMIT $start_limit, $tpp"); while($tempact = $db->fetch_array($query)) { $tempact['starttimefrom'] = dgmdate("$dateformat $timeformat", $tempact['starttimefrom'] + $timeoffset * 3600); $activity[] = $tempact; } } else { if($ended == 'yes') { $sign = " AND verified='1'"; } elseif($ended == 'no') { $sign = " AND verified='0'"; } $extra .= $srchfid ? '&amp;type='.$type : ''; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}activityapplies aa LEFT JOIN {$tablepre}activities a USING(tid) LEFT JOIN {$tablepre}threads t USING(tid) WHERE a.uid='$discuz_uid' $threadadd$sign"); $multipage = multi($num, $tpp, $page, "my.php?item=activities&amp;type=apply&amp;ended=$ended$extrafid"); $query = $db->query("SELECT aa.verified, aa.tid, starttimefrom, a.place, a.cost, t.subject FROM {$tablepre}activityapplies aa LEFT JOIN {$tablepre}activities a USING(tid) LEFT JOIN {$tablepre}threads t USING(tid) WHERE aa.uid='$discuz_uid' $threadadd$sign ORDER BY starttimefrom $ascadd LIMIT $start_limit, $tpp"); while($tempact = $db->fetch_array($query)) { $tempact['starttimefrom'] = dgmdate("$dateformat $timeformat", $tempact['starttimefrom'] + $timeoffset * 3600); $activity[] = $tempact; } } } elseif($item == 'polls'){ $polllist = array(); if($type == 'poll') { if($srchfid = intval($srchfid)) { $threadadd = "AND fid='$srchfid'"; } $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='1' $threadadd AND m.tid=t.tid"); $multipage = multi($num, $tpp, $page, "my.php?item=polls&amp;type=poll$extrafid"); $query = $db->query("SELECT t.tid, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}threads t, {$tablepre}mythreads m WHERE m.uid='$discuz_uid' AND m.special='1' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($poll = $db->fetch_array($query)) { $poll['lastpost'] = dgmdate("$dateformat $timeformat", $poll['lastpost'] + $timeoffset * 3600); $poll['lastposterenc'] = rawurlencode($poll['lastposter']); $poll['forumname'] = $_DCACHE['forums'][$poll['fid']]['name']; $polllist[] = $poll; } } else { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}myposts m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='1' $threadadd AND m.tid=t.tid"); $multipage = multi($num, $tpp, $page, "my.php?item=polls&amp;type=join$extrafid"); $query = $db->query("SELECT m.dateline, t.tid, t.fid, t.subject, t.displayorder, t.closed FROM {$tablepre}myposts m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='1' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($poll = $db->fetch_array($query)) { $poll['dateline'] = dgmdate("$dateformat $timeformat", $poll['dateline'] + $timeoffset * 3600); $poll['forumname'] = $_DCACHE['forums'][$poll['fid']]['name']; $polllist[] = $poll; } } } elseif($item == 'promotion' && ($creditspolicy['promotion_visit'] || $creditspolicy['promotion_register'])) { $promotion_visit = $promotion_register = $space = ''; foreach(array('promotion_visit', 'promotion_register') as $val) { if(!empty($creditspolicy[$val]) && is_array($creditspolicy[$val])) { foreach($creditspolicy[$val] as $id => $policy) { $$val .= $space.$extcredits[$id]['title'].' +'.$policy; $space = '&nbsp;'; } } } } elseif($item == 'debate') { $debatelist = array(); if($type == 'orig') { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='5' $threadadd AND m.tid=t.tid"); $multipage = multi($num, $tpp, $page, "my.php?item=debate&amp;type=orig$extrafid"); $query = $db->query("SELECT t.tid, t.subject, t.fid, t.displayorder, t.closed, t.lastposter, t.lastpost FROM {$tablepre}threads t, {$tablepre}mythreads m WHERE m.uid='$discuz_uid' AND m.special='5' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($debate = $db->fetch_array($query)) { $debate['lastpost'] = dgmdate("$dateformat $timeformat", $debate['lastpost'] + $timeoffset * 3600); $debate['lastposterenc'] = rawurlencode($debate['lastposter']); $debate['forumname'] = $_DCACHE['forums'][$debate['fid']]['name']; $debatelist[] = $debate; } } elseif($type == 'reply') { $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}myposts m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='5' $threadadd AND m.tid=t.tid"); $multipage = multi($num, $tpp, $page, "my.php?item=debate&amp;type=reply$extrafid"); $query = $db->query("SELECT m.dateline, t.tid, t.fid, t.subject, t.displayorder, t.closed FROM {$tablepre}myposts m, {$tablepre}threads t WHERE m.uid='$discuz_uid' AND m.special='5' AND m.tid=t.tid $threadadd ORDER BY m.dateline DESC LIMIT $start_limit, $tpp"); while($debate = $db->fetch_array($query)) { $debate['dateline'] = dgmdate("$dateformat $timeformat", $debate['dateline'] + $timeoffset * 3600); $debate['forumname'] = $_DCACHE['forums'][$debate['fid']]['name']; $debatelist[] = $debate; } } } elseif($item == 'video') { require_once DISCUZ_ROOT.'./api/video.php'; $videolist = array(); $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}videos WHERE uid='$discuz_uid'"); $multipage = multi($num, $tpp, $page, "my.php?item=video"); $query = $db->query("SELECT * FROM {$tablepre}videos WHERE uid='$discuz_uid' ORDER BY dateline DESC LIMIT $start_limit, $tpp"); while($video = $db->fetch_array($query)) { $video['vthumb'] = !$videoinfo['vthumb'] ? VideoClient_Util::getThumbUrl($video['vid'], 'small') : $videoinfo['vthumb']; $video['dateline'] = dgmdate("$dateformat $timeformat", $video['dateline'] + $timeoffset * 3600); $video['vtime'] = $video['vtime'] ? sprintf("%02d", intval($video['vtime'] / 60)).':'.sprintf("%02d", intval($video['vtime'] % 60)) : ''; $videolist[] = $video; } $videonum = count($videolist); $videoendrows = ''; if($colspan = $videonum % 2) { while(($colspan - 2) < 0) { $videoendrows .= '<td></td>'; $colspan ++; } $videoendrows .= '</tr>'; } } elseif($item == 'buddylist') { include_once DISCUZ_ROOT.'./uc_client/client.php'; $buddynum = uc_friend_totalnum($discuz_uid); if(!submitcheck('buddysubmit', 1)) { $buddylist = array(); $buddies = $buddynum ? uc_friend_ls($discuz_uid, $page, $tpp, $buddynum) : array(); $multipage = multi($buddynum, $tpp, $page, "my.php?item=buddylist"); if($buddies) { foreach($buddies as $key => $buddy) { $buddylist[$buddy['friendid']] = $buddy; } unset($buddies); $query = $db->query("SELECT m.uid, m.gender, mf.msn, s.uid AS online FROM {$tablepre}members m LEFT JOIN {$tablepre}sessions s ON s.uid=m.uid LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid WHERE m.uid IN (".implodeids(array_keys($buddylist)).")"); while($member = $db->fetch_array($query)) { $uid = $member['uid']; if(isset($buddylist[$uid])) { $buddylist[$uid]['avatar'] = discuz_uc_avatar($uid, 'small'); $buddylist[$uid]['gender'] = $member['gender']; $buddylist[$uid]['online'] = $member['online']; $buddylist[$uid]['msn'] = explode("\t", $member['msn']); } else { unset($buddylist[$uid]); } } } } else { $buddyarray = $buddynum ? uc_friend_ls($discuz_uid, 1, $buddynum, $buddynum) : array(); if($action == 'edit') { if($comment = cutstr(dhtmlspecialchars($comment), 255)) { $friendid = intval($friendid); uc_friend_delete($discuz_uid, array($friendid)); uc_friend_add($discuz_uid, $friendid, $comment); } } elseif($action == 'delete') { $friendid = intval($friendid); uc_friend_delete($discuz_uid, array($friendid)); } else { $buddyarraynew = array(); if($buddyarray) { foreach($buddyarray as $buddy) { $buddyarraynew[$buddy['friendid']] = $buddy; } } $buddyarray = $buddyarraynew;unset($buddyarraynew); if(($newbuddy && $newbuddy != $discuz_userss) || ($newbuddyid && $newbuddyid != $discuz_uid)) { $newbuddyid && $newbuddy = $db->result_first("SELECT username FROM {$tablepre}members WHERE uid='$newbuddyid'", 0); if($buddyid = uc_get_user($newbuddy)) { if(isset($buddyarray[$buddyid[0]])) { showmessage('buddy_add_invalid'); } if(uc_friend_add($discuz_uid, $buddyid[0], cutstr(dhtmlspecialchars($newdescription), 255))) { if($ucappopen['UCHOME']) { sendpm($buddyid[0], 'buddy_new_subject', 'buddy_new_uch_message', 0); } else { sendpm($buddyid[0], 'buddy_new_subject', 'buddy_new_message', 0); } } else { showmessage('buddy_add_ignore'); } } else { showmessage('username_nonexistence'); } } } showmessage('buddy_update_succeed', 'my.php?item=buddylist'); } } else { showmessage('undefined_action', NULL, 'HALTED'); } include template('my'); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/my.php
PHP
asf20
31,809
<? /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: plugin.php 16688 2008-11-14 06:41:07Z cnteacher $ */ require_once './include/common.inc.php'; $pluginmodule = isset($pluginlinks[$identifier][$module]) ? $pluginlinks[$identifier][$module] : ''; if(empty($identifier) || empty($module) || !preg_match("/^[a-z0-9_\-]+$/i", $module) || !$pluginmodule) { showmessage('undefined_action'); } elseif($pluginmodule['adminid'] && ($adminid < 1 || ($adminid > 0 && $pluginmodule['adminid'] < $adminid))) { showmessage('plugin_nopermission'); } elseif(@!file_exists(DISCUZ_ROOT.($modfile = './plugins/'.$pluginmodule['directory'].((!empty($pluginmodule['directory']) && substr($pluginmodule['directory'], -1) != '/') ? '/' : '') .$module.'.inc.php'))) { showmessage('plugin_module_nonexistence'); } include DISCUZ_ROOT.$modfile; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/plugin.php
PHP
asf20
909
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: sitemap.php 16688 2008-11-14 06:41:07Z cnteacher $ */ error_reporting(0); define('IN_DISCUZ', TRUE); define('DISCUZ_ROOT', './'); if(PHP_VERSION < '4.1.0') { $_GET = &$HTTP_GET_VARS; $_SERVER = &$HTTP_SERVER_VARS; } require_once DISCUZ_ROOT.'./config.inc.php'; require_once DISCUZ_ROOT.'./include/global.func.php'; require_once DISCUZ_ROOT.'./include/db_'.$database.'.class.php'; require_once DISCUZ_ROOT.'./forumdata/cache/cache_settings.php'; require_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; $maxitemnum = 500; $timestamp = time(); $PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; $boardurl = 'http://'.$_SERVER['HTTP_HOST'].substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1); $db = new dbstuff; $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect); if(!$_DCACHE['settings']['baidusitemap']) { exit('Baidu Sitemaps is closed!'); } $sitemapfile = DISCUZ_ROOT.'./forumdata/sitemap.xml'; $xmlfiletime = @filemtime($sitemapfile); header("Content-type: application/xml"); $xmlcontent = "<?xml version=\"1.0\" encoding=\"$charset\"?>\n". "<document xmlns:bbs=\"http://www.baidu.com/search/bbs_sitemap.xsd\">\n"; if($timestamp - $xmlfiletime >= $_DCACHE['settings']['baidusitemap_life'] * 3600) { $groupid = 7; $extgroupids = ''; $xmlfiletime = $timestamp - $_DCACHE['settings']['baidusitemap_life'] * 3600; $fidarray = array(); foreach($_DCACHE['forums'] as $fid => $forum) { if(sitemapforumperm($forum)) { $fidarray[] = $fid; } } $query = $db->query("SELECT tid, fid, subject, dateline, lastpost, replies, views, digest FROM {$tablepre}threads WHERE dateline > $xmlfiletime AND fid IN (".implode(',', $fidarray).") AND displayorder >= 0 LIMIT $maxitemnum"); $xmlcontent .= " <webSite>$boardurl</webSite>\n". " <webMaster>$adminemail</webMaster>\n". " <updatePeri>".$_DCACHE['settings']['baidusitemap_life']."</updatePeri>\n". " <updatetime>".gmdate('Y-m-d H:i:s', $timestamp + $_DCACHE['settings']['timeoffset'] * 3600)."</updatetime>\n". " <version>Discuz! {$_DCACHE['settings']['version']}</version>\n"; while($thread = $db->fetch_array($query)) { $xmlcontent .= " <item>\n". " <link>".(!$_DCACHE['settings']['rewritestatus'] ? "{$boardurl}viewthread.php?tid=$thread[tid]" : "{$boardurl}thread-$thread[tid]-1-1.html")."</link>\n". " <title>".dhtmlspecialchars($thread['subject'])."</title>\n". " <pubDate>".gmdate('Y-m-d H:i:s', $thread['dateline'] + $_DCACHE['settings']['timeoffset'] * 3600)."</pubDate>\n". " <bbs:lastDate>".gmdate('Y-m-d H:i:s', $thread['lastpost'] + $_DCACHE['settings']['timeoffset'] * 3600)."</bbs:lastDate>\n". " <bbs:reply>$thread[replies]</bbs:reply>\n". " <bbs:hit>$thread[views]</bbs:hit>\n". " <bbs:boardid>$thread[fid]</bbs:boardid>\n". " <bbs:pick>".(empty($thread['digest']) ? 0 : 1)."</bbs:pick>\n". " </item>\n"; } $xmlcontent .= "</document>"; if($fp = @fopen($sitemapfile, 'w')) { fwrite($fp, $xmlcontent); flock($fp, 2); fclose($fp); } echo $xmlcontent; } else { @readfile($sitemapfile); } function sitemapforumperm($forum) { return $forum['type'] != 'group' && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm']))); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/sitemap.php
PHP
asf20
3,524
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: index.php 16722 2008-11-17 04:38:57Z cnteacher $ */ define('CURSCRIPT', 'wap'); require_once '../include/common.inc.php'; if(preg_match('/(mozilla|m3gate|winwap|openwave)/i', $_SERVER['HTTP_USER_AGENT'])) { dheader("Location: {$boardurl}index.php"); } require_once './include/global.func.php'; require_once DISCUZ_ROOT.'./include/forum.func.php'; require_once DISCUZ_ROOT.'./include/chinese.class.php'; @include_once(DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'); $discuz_action = 191; $action = isset($action) ? $action : 'home'; if($action == 'goto' && !empty($url)) { header("Location: $url"); exit(); } else { wapheader($bbname); } include language('wap'); if(!$wapstatus) { wapmsg('wap_disabled'); } elseif($bbclosed) { wapmsg('board_closed'); } $sdb = loadmultiserver('wap'); $chs = ''; if(in_array($action, array('home', 'login', 'register', 'search', 'stats', 'my', 'myphone', 'goto', 'forum', 'thread', 'post'))) { require_once './include/'.$action.'.inc.php'; } else { wapmsg('undefined_action'); } wapfooter(); ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/index.php
PHP
asf20
1,208
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: thread.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 193; $breaked = 0; $threadposts = ''; $start = isset($start) ? intval($start) : 0; $offset = isset($offset) ? intval($offset) : 0; $do = !empty($do) ? $do : ''; $thread = $sdb->fetch_first("SELECT * FROM {$tablepre}threads WHERE tid='$tid' AND displayorder>='0'"); if(!$thread) { wapmsg('thread_nonexistence'); } if(($thread['readperm'] && $thread['readperm'] > $readaccess && !$forum['ismoderator'] && $thread['authorid'] != $discuz_uid) || (empty($forum['allowview']) && ((!$forum['viewperm'] && !$readaccess) || ($forum['viewperm'] && !forumperm($forum['viewperm'])))) || $forum['password'] || $forum['redirect']) { wapmsg('thread_nopermission'); } elseif($thread['price'] > 0) { if($maxchargespan && $timestamp - $thread['dateline'] >= $maxchargespan * 3600) { $db->query("UPDATE {$tablepre}threads SET price='0' WHERE tid='$tid'"); $thread['price'] = 0; } elseif(!$discuz_uid || (!$forum['ismoderator'] && $thread['authorid'] != $discuz_uid && !$db->num_rows($db->query("SELECT tid FROM {$tablepre}paymentlog WHERE tid='$tid' AND uid='$discuz_uid'")))) { wapmsg('thread_nopermission'); } } if(empty($do)) { echo "<p>$lang[subject]$thread[subject]<br />". "$lang[author]<a href=\"index.php?action=my&amp;uid=$thread[authorid]\">$thread[author]</a><br />". "$lang[dateline]".gmdate("$wapdateformat $timeformat", $thread['dateline'] + $timeoffset * 3600)."<br /><br />"; $page = max(1, intval($page)); $start_limit = $number = ($page - 1) * $wapppp; if($page < 2) { $end_limit = $wapppp + 1; } else { $start_limit = $start_limit + 1; $end_limit = $wapppp; } $query = $sdb->query("SELECT * FROM {$tablepre}posts WHERE tid='$tid' AND invisible='0' ORDER BY dateline LIMIT $start_limit, $end_limit"); while($post = $sdb->fetch_array($query)) { $post['message'] = wapcode($post['message']); if($post['first']) { if($offset > 0) { $str = $post['message']; for($i = $offset; $i > $offset - $wapmps + 2; $i --) { if(ord($str[$i-1]) > 127) { $i --; } } $offset_last = $i; $post['message'] = substr($post['message'], $offset); } else { $offset = 0; } if(strlen($post['message']) > $wapmps) { $post['message'] = wapcutstr($post['message'], $wapmps); $offset_next = $offset + $wapmps; $breaked = 1; } else { $breaked = 0; } $post['author'] = !$post['anonymous'] ? $post['author'] : $lang['anonymous']; $threadposts .= nl2br(trim($post['message'])); } else { $postlist[] = $post; } } echo $threadposts.(!$breaked ? '' : "<br /><a href=\"index.php?action=thread&amp;tid=$tid&amp;offset=$offset_next\">$lang[next_page]</a> "). (!$offset ? '' : "<a href=\"index.php?action=thread&amp;tid=$tid&amp;offset=$offset_last\">$lang[last_page]</a>")."<br />\n". "<br /><a href=\"index.php?action=post&amp;do=reply&amp;fid=$forum[fid]&amp;tid=$thread[tid]\">$lang[post_reply]</a>|<a href=\"index.php?action=post&amp;do=newthread&amp;fid=$forum[fid]\">$lang[post_new]</a>\n"; if(!empty($postlist)) { echo "<br /><br />$lang[thread_replylist] ($thread[replies])<br />"; foreach($postlist as $post) { $waptlength = 30; echo "<a href=\"index.php?action=thread&amp;do=reply&amp;tid=$post[tid]&amp;pid=$post[pid]\">#".++$number." ".wapcutstr(trim($post['message']), $waptlength)."</a>". "<br />[".(!$post['anonymous'] ? $post['author'].' ' : $lang['anonymous'].' ').gmdate("$wapdateformat $timeformat", $post['dateline'] + $timeoffset * 3600)."]<br />"; } echo wapmulti($thread['replies'], $wapppp, $page, "index.php?action=thread&amp;tid=$thread[tid]"); } } elseif($do == 'reply') { echo "<p>$lang[thread_reply]<a href=\"index.php?action=thread&amp;tid=$thread[tid]\">$thread[subject]</a><br />"; $post = $db->fetch_first("SELECT * FROM {$tablepre}posts WHERE pid='$pid' AND invisible='0'"); if($offset > 0) { $post['message'] = '..'.substr($post['message'], $offset - 4); } if(strlen($threadposts) + strlen($post['message']) - $wapmps > 0) { $length = $wapmps - strlen($threadposts); $post['message'] = wapcutstr($post['message'], $length); $offset += $length; $breaked = 1; } $post['author'] = !$post['anonymous'] ? $post['author'] : $lang['anonymous']; $post['message'] = wapcode($post['message']); echo $lang['author'].(!$post['anonymous'] ? "<a href=\"index.php?action=my&amp;uid=$post[authorid]\">$post[author]</a>" : $lang['anonymous'])."<br />\n". "<br />".nl2br(trim($post['message']))."\n"; if(!$breaked) { $start++; $offset = 0; } } echo "<br />". (!empty($allowreply) ? "<br /><input type=\"text\" name=\"message\" value=\"\" size=\"6\" emptyok=\"true\"/>\n". "<anchor title=\"$lang[submit]\">$lang[thread_quickreply]". "<go method=\"post\" href=\"index.php?action=post&amp;do=reply&amp;fid=$forum[fid]&amp;tid=$thread[tid]&amp;sid=$sid\">\n". "<postfield name=\"message\" value=\"$(message)\"/>\n". "<postfield name=\"formhash\" value=\"".formhash()."\" />\n". "</go></anchor><br />\n". "<a href=\"index.php?action=my&amp;do=fav&amp;favid=$thread[tid]&amp;type=thread\">$lang[my_addfav]</a><br />\n" : ''). "<br />&lt;&lt;<a href=\"index.php?action=goto&amp;do=next&amp;tid=$thread[tid]&amp;fid=$thread[fid]\">$lang[next_thread]</a>". "<br />&gt;&gt;<a href=\"index.php?action=goto&amp;do=last&amp;tid=$thread[tid]&amp;fid=$thread[fid]\">$lang[last_thread]</a><br />". "<a href=\"index.php?action=forum&amp;fid=$forum[fid]\">$lang[return_forum]</a></p>"; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/thread.inc.php
PHP
asf20
5,836
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: post.inc.php 17403 2008-12-18 01:31:43Z tiger $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once DISCUZ_ROOT.'./include/discuzcode.func.php'; require_once DISCUZ_ROOT.'./include/post.func.php'; require_once DISCUZ_ROOT.'./include/forum.func.php'; if(empty($forum) || $forum['type'] == 'group') { wapmsg('forum_nonexistence'); } if(empty($forum['allowview']) && ((!$forum['viewperm'] && !$readaccess) || ($forum['viewperm'] && !forumperm($forum['viewperm'])))) { wapmsg('forum_nopermission'); } if(empty($bbcodeoff) && !$allowhidecode && preg_match("/\[hide=?\d*\].+?\[\/hide\]/is", preg_replace("/(\[code\].*\[\/code\])/is", '', $message))) { wapmsg('post_hide_nopermission'); } if(!$adminid && $newbiespan && (!$lastpost || $timestamp - $lastpost < $newbiespan * 3600)) { $regdate = $db->result_first("SELECT regdate FROM {$tablepre}members WHERE uid='$discuz_uid'"); if($timestamp - $regdate < $newbiespan * 3600) { showmessage('post_newbie_span'); } } $postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post']; $replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply']; $modnewthreads = (!$allowdirectpost || $allowdirectpost == 1) && ($forum['modnewposts'] || !empty($censormod)) ? 1 : 0; $modnewreplies = (!$allowdirectpost || $allowdirectpost == 2) && ($forum['modnewposts'] == 2 || !empty($censormod)) ? 1 : 0; $subject = wapconvert($subject); $subject = ($subject != '') ? dhtmlspecialchars(censor(trim($subject))) : ''; $message = wapconvert($message); $message = ($message != '') ? censor(trim($message)) : ''; if($do == 'newthread') { $discuz_action = 195; if(!$discuz_uid && !((!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])))) { wapmsg('post_newthread_nopermission'); } if(empty($subject) || empty($message)) { $typeselect = isset($forum['threadtypes']['required']) ? typeselect() : ''; echo "<p>".($typeselect ? "$lang[type]$typeselect<br />\n" : ''). "$lang[subject]<input type=\"text\" name=\"subject\" value=\"\" maxlength=\"80\" format=\"M*m\" /><br />\n". "$lang[message]<input type=\"text\" name=\"message\" value=\"\" format=\"M*m\" /><br />\n". "<anchor title=\"$lang[submit]\">$lang[submit]". "<go method=\"post\" href=\"index.php?action=post&amp;do=newthread&amp;fid=$fid&amp;sid=$sid\">\n". "<postfield name=\"subject\" value=\"$(subject)\" />\n". "<postfield name=\"message\" value=\"$(message)\" />\n". "<postfield name=\"formhash\" value=\"".formhash()."\" />\n". ($typeselect ? "<postfield name=\"typeid\" value=\"$(typeid)\" />\n" : ''). "</go></anchor>\n<br /><br />". "<a href=\"index.php?action=forum&amp;fid=$fid\">$lang[return_forum]</a></p>\n"; } else { if($post_invalid = checkpost()) { wapmsg($post_invalid); } if($formhash != formhash()) { wapmsg('wap_submit_invalid'); } if(checkflood()) { wapmsg('post_flood_ctrl'); } $typeid = isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0; if(empty($typeid) && !empty($forum['threadtypes']['required'])) { wapmsg('post_type_isnull'); } $displayorder = $pinvisible = $modnewthreads ? -2 : 0; $db->query("INSERT INTO {$tablepre}threads (fid, readperm, iconid, typeid, author, authorid, subject, dateline, lastpost, lastposter, displayorder, digest, special, attachment, moderated) VALUES ('$fid', '0', '0', '$typeid', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$timestamp', '$discuz_user', '$displayorder', '0', '0', '0', '0')"); $tid = $db->insert_id(); $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$subject', '$timestamp', '$message', '$onlineip', '$pinvisible', '0', '0', '0', '0', '0', '0')"); $pid = $db->insert_id(); $db->query("REPLACE INTO {$tablepre}mythreads (uid, tid, dateline) VALUES ('$discuz_uid', '$tid', '$timestamp')", 'UNBUFFERED'); if($modnewthreads) { wapmsg('post_mod_succeed', array('title' => 'post_mod_forward', 'link' => "index.php?action=forum&amp;tid=$fid")); } else { updatepostcredits('+', $discuz_uid, $postcredits); $lastpost = "$tid\t$subject\t$timestamp\t$discuz_user"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); } wapmsg('post_newthread_succeed', array('title' => 'post_newthread_forward', 'link' => "index.php?action=thread&amp;tid=$tid")); } } } elseif($do == 'reply') { $discuz_action = 196; $thread = $db->fetch_first("SELECT * FROM {$tablepre}threads WHERE tid='$tid'"); if(!$thread) { wapmsg('thread_nonexistence'); } if(empty($forum['allowreply']) && ((!$forum['replyperm'] && !$allowreply) || ($forum['replyperm'] && !forumperm($forum['replyperm'])))) { wapmsg('post_newreply_nopermission'); } if($thread['closed'] && !$forum['ismoderator']) { wapmsg('post_thread_closed'); } if($post_autoclose = checkautoclose()) { wapmsg($post_autoclose); } if(empty($message)) { echo "<p>$lang[message]<input type=\"text\" name=\"message\" value=\"\" format=\"M*m\" /><br />\n". "<anchor title=\"$lang[submit]\">$lang[submit]". "<go method=\"post\" href=\"index.php?action=post&amp;do=reply&amp;fid=$fid&amp;tid=$tid&amp;sid=$sid\">\n". "<postfield name=\"subject\" value=\"$(subject)\" />\n". "<postfield name=\"message\" value=\"$(message)\" />\n". "<postfield name=\"formhash\" value=\"".formhash()."\" />\n". "</go></anchor><br /><br />\n". "<a href=\"index.php?action=thread&amp;tid=$tid\">$lang[return_thread]</a><br />\n". "<a href=\"index.php?action=forum&amp;fid=$fid\">$lang[return_forum]</a></p>\n"; } else { if($message == '') { wapmsg('post_sm_isnull'); } if($post_invalid = checkpost()) { wapmsg($post_invalid); } if($formhash != formhash()) { wapmsg('wap_submit_invalid'); } if(checkflood()) { wapmsg('post_flood_ctrl'); } $pinvisible = $modnewreplies ? -2 : 0; $db->query("INSERT INTO {$tablepre}posts (fid, tid, first, author, authorid, dateline, message, useip, invisible, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment) VALUES ('$fid', '$tid', '0', '$discuz_user', '$discuz_uid', '$timestamp', '$message', '$onlineip', '$pinvisible', '1', '0', '0', '0', '0', '0')"); $pid = $db->insert_id(); $db->query("REPLACE INTO {$tablepre}myposts (uid, tid, pid, position, dateline) VALUES ('$discuz_uid', '$tid', '$pid', '".($thread['replies'] + 1)."', '$timestamp')", 'UNBUFFERED'); if($modnewreplies) { wapmsg('post_mod_succeed', array('title' => 'post_mod_forward', 'link' => "index.php?action=forum&amp;fid=$fid")); } else { $db->query("UPDATE {$tablepre}threads SET lastposter='$discuz_user', lastpost='$timestamp', replies=replies+1 WHERE tid='$tid' AND fid='$fid'", 'UNBUFFERED'); updatepostcredits('+', $discuz_uid, $replycredits); $lastpost = "$thread[tid]\t".addslashes($thread['subject'])."\t$timestamp\t$discuz_user"; $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost', posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED'); if($forum['type'] == 'sub') { $db->query("UPDATE {$tablepre}forums SET lastpost='$lastpost' WHERE fid='$forum[fup]'", 'UNBUFFERED'); } wapmsg('post_newreply_succeed', array('title' => 'post_newreply_forward', 'link' => "index.php?action=thread&amp;tid=$tid&amp;page=".(@ceil(($thread['replies'] + 2) / $wapppp)))); } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/post.inc.php
PHP
asf20
8,131
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: goto.inc.php 16721 2008-11-17 04:30:43Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 194; $do = !empty($do) && in_array($do, array('last', 'next')) ? $do : ''; if($do == 'last') { if($fid && $tid) { $this_lastpost = $sdb->result_first("SELECT lastpost FROM {$tablepre}threads WHERE tid='$tid' AND displayorder>='0'"); if($next = $sdb->fetch_first("SELECT tid FROM {$tablepre}threads WHERE fid='$fid' AND displayorder>='0' AND lastpost>'$this_lastpost' ORDER BY lastpost ASC LIMIT 1")) { $tid = $next['tid']; header("Location: index.php?action=thread&tid=$tid"); exit(); } else { wapmsg('goto_last_nonexistence'); } } else { wapmsg('undefined_action'); } } elseif($do == 'next') { if($fid && $tid) { $this_lastpost = $sdb->result_first("SELECT lastpost FROM {$tablepre}threads WHERE tid='$tid' AND displayorder>='0'"); if($last = $sdb->fetch_first("SELECT tid FROM {$tablepre}threads WHERE fid='$fid' AND displayorder>='0' AND lastpost<'$this_lastpost' ORDER BY lastpost DESC LIMIT 1")) { $tid = $last['tid']; header("Location: index.php?action=thread&tid=$tid"); exit(); } else { wapmsg('goto_next_nonexistence'); } } else { wapmsg('undefined_action'); } } else { echo "<p>$lang[goto]:<br />\n". "<input title=\"url\" name=\"url\" type=\"text\" value=\"http://\" /><br />\n". "<anchor title=\"$lang[submit]\">$lang[submit]<go href=\"index.php?action=goto&amp;url=$(url:escape)\" /></anchor></p>\n"; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/goto.inc.php
PHP
asf20
1,683
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: myphone.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 194; echo "<p>$lang[my_phone]<br />".dhtmlspecialchars($_SERVER[HTTP_USER_AGENT])."<br /><br />"; if(function_exists('getallheaders')) { foreach(getallheaders() as $key => $value) { echo strtoupper($key).": $value<br/>\n"; } } else { foreach(array('REMOTE_ADDR', 'REMOTE_PORT', 'REMOTE_USER', 'GATEWAY_INTERFACE', 'SERVER_PROTOCOL', 'HTTP_CONNECTION', 'HTTP_VIA') as $key) { if(!empty($_SERVER[$key])) { echo "<br />$key: ".dhtmlspecialchars($_SERVER[$key])."\n"; } } } echo '</p>'; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/myphone.inc.php
PHP
asf20
778
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: stats.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 194; $members = $totalmembers; @extract($sdb->fetch_first("SELECT SUM(threads) AS threads, SUM(posts) AS posts FROM {$tablepre}forums WHERE status>0")); echo "<p>$lang[stats]<br /><br />\n". "$lang[stats_members]: $members<br />\n". "$lang[stats_threads]: $threads<br />\n". "$lang[stats_posts]: $posts</p>\n"; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/stats.inc.php
PHP
asf20
589
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: home.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000; $onlinemem = $onlineguest = $forumnum = 0; echo "<p>$bbname<br />\n"; if($discuz_uid) { echo (!empty($allowsearch) ? "<br /><a href=\"index.php?action=search&amp;srchfrom=$newthreads&amp;do=submit\">$lang[home_newthreads]</a><br /><a href=\"index.php?action=search\">$lang[search]</a><br />" : ''). "<a href=\"index.php?action=my&amp;do=fav\">$lang[my_favorites]</a><br />". "<a href=\"index.php?action=my\">$lang[my]</a><br />"; } echo "<br />$lang[home_forums]<br />"; $sql = !empty($accessmasks) ? "SELECT f.fid, f.name, ff.viewperm, a.allowview FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder" : "SELECT f.fid, f.name, ff.viewperm FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff USING(fid) WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder"; $query = $sdb->query($sql); while($forum = $sdb->fetch_array($query)) { if(forum($forum) && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t") && $forum['viewperm']))) { echo "<a href=\"index.php?action=forum&amp;fid=$forum[fid]\">".strip_tags($forum['name'])."</a><br/>"; } if($forumnum ++ >= 10) { break; } } echo ($forumnum > 10 ? "<a href=\"index.php?action=forum\">$lang[more]</a><br /><br />" : ''). "$lang[home_tools]<br />". "<a href=\"index.php?action=stats\">$lang[stats]</a><br />". "<a href=\"index.php?action=goto\">$lang[goto]</a>". (!empty($allowsearch) ? "<br /><br /><input type=\"text\" name=\"srchtxt\" value=\"\" size=\"8\" emptyok=\"true\" /> ". "<anchor title=\"submit\">$lang[search]\n". "<go method=\"post\" href=\"index.php?action=search&amp;do=submit\" />\n". "<postfield name=\"srchtxt\" value=\"$(srchtxt)\" /></anchor>" : ''); $query = $db->query("SELECT uid, COUNT(*) AS count FROM {$tablepre}sessions GROUP BY uid='0'"); while($online = $db->fetch_array($query)) { $online['uid'] ? $onlinemem = $online['count'] : $onlineguest = $online['count']; } echo "<br /><br />$lang[home_online]".($onlinemem + $onlineguest)."({$onlinemem} $lang[home_members])</p>\n"; ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/home.inc.php
PHP
asf20
2,580
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: forum.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $discuz_action = 192; $page = max(1, intval($page)); $start_limit = $number = ($page - 1) * $waptpp; if(!empty($fid)) { require_once DISCUZ_ROOT.'./include/forum.func.php'; if(empty($forum)) { wapmsg('forum_nonexistence'); } if(($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) || $forum['redirect'] || $forum['password']) { wapmsg('forum_nopermission'); } echo "<p>".strip_tags($forum['name'])."<br />". "<a href=\"index.php?action=post&amp;do=newthread&amp;fid=$forum[fid]\">$lang[post_new]</a> ". "<a href=\"index.php?action=forum&amp;do=digest&amp;fid=$forum[fid]\">$lang[digest]</a><br /><br />". "$lang[forum_list] <a href=\"index.php?action=forum&amp;fid=$forum[fid]\">$lang[reload]</a><br />"; $do = !empty($do) ? 'digest' : ''; $filteradd = $do == 'digest' ? 'AND digest>\'0\'' : ''; $threadcount = $sdb->result_first("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'"); $thread['prefix'] = ''; $query = $sdb->query("SELECT * FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0' ORDER BY displayorder DESC, lastpost DESC LIMIT $start_limit, $waptpp"); while($thread = $sdb->fetch_array($query)) { $thread['prefix'] .= $thread['displayorder'] > 0 ? $lang['forum_thread_sticky'] : ''; $thread['prefix'] .= $thread['digest'] ? $lang['forum_thread_digest'] : ''; echo "<a href=\"index.php?action=thread&amp;tid=$thread[tid]\">#".++$number." ".cutstr($thread['subject'], 30)."</a>$thread[prefix]<br />\n". "<small>[$thread[author] $lang[replies]$thread[replies] $lang[views]$thread[views]]</small><br />\n"; } echo wapmulti($threadcount, $waptpp, $page, "index.php?action=forum&amp;fid=$forum[fid]&amp;sid=$sid"); if($do != 'digest') { $subforums = ''; foreach($_DCACHE['forums'] as $subforum) { if($subforum['type'] == 'sub' && $subforum['fup'] == $fid && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t")))) { $subforums .= "<a href=\"index.php?action=forum&amp;fid=$subforum[fid]\">".strip_tags($subforum['name'])."</a><br />"; } } if(!empty($subforums)) { echo "<br /><br />$lang[forum_sublist]<br />".$subforums; } } echo (!empty($allowsearch) ? "<br /><br /><a href=\"index.php?action=post&amp;do=newthread&amp;fid=$forum[fid]\">$lang[post_new]</a><br />". "<a href=\"index.php?action=my&amp;do=fav&amp;favid=$forum[fid]&amp;type=forum\">$lang[my_addfav]</a><br />". "<input type=\"text\" name=\"srchtxt\" value=\"\" size=\"6\" format=\"M*m\" emptyok=\"true\"/>". "<anchor title=\"submit\">$lang[search]\n". "<go method=\"post\" href=\"index.php?action=search&amp;srchfid=$forum[fid]&amp;do=submit&amp;sid=$sid\">\n". "<postfield name=\"srchtxt\" value=\"$(srchtxt)\" />\n". "</go></anchor><br />" : ''). "</p>"; } else { echo "<p>$lang[home_forums]<br />"; $forumcount = $db->result_first("SELECT COUNT(*) FROM {$tablepre}forums WHERE status>0 AND type='forum'"); $sql = !empty($accessmasks) ? "SELECT f.fid, f.name, ff.viewperm, a.allowview FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder LIMIT $start_limit, $waptpp" : "SELECT f.fid, f.name, ff.viewperm FROM {$tablepre}forums f LEFT JOIN {$tablepre}forumfields ff USING(fid) WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder LIMIT $start_limit, $waptpp"; $query = $sdb->query($sql); while($forum = $sdb->fetch_array($query)) { if(forum($forum) && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t") && $forum['viewperm']))) { echo "<a href=\"index.php?action=forum&amp;fid=$forum[fid]\">".strip_tags($forum['name'])."</a><br/>"; } } echo wapmulti($forumcount, $waptpp, $page, "index.php?action=forum&amp;sid=$sid"); echo "</p>"; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/forum.inc.php
PHP
asf20
4,316
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: global.func.php 16718 2008-11-17 03:48:41Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } function wapheader($title) { global $action, $_SERVER; header("Content-type: text/vnd.wap.wml; charset=utf-8"); /* header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); */ echo "<?xml version=\"1.0\"?>\n". "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n". "<wml>\n". "<head>\n". "<meta http-equiv=\"cache-control\" content=\"max-age=180,private\" />\n". "</head>\n". "<card id=\"discuz_wml\" title=\"$title\">\n"; // newcontext=\"true\" } function wapfooter() { global $discuz_uid, $discuz_user, $lang, $action, $settings, $timestamp, $timeoffset, $wapdateformat, $timeformat; echo "<p>".gmdate("$wapdateformat $timeformat", $timestamp + ($timeoffset * 3600))."<br />". ($action != 'home' ? "<anchor title=\"confirm\"><prev/>$lang[return]</anchor> <a href=\"index.php\">$lang[home_page]</a><br />" : ''). ($discuz_uid ? "<a href=\"index.php?action=login&amp;logout=yes&amp;formhash=".FORMHASH."\">$discuz_user:$lang[logout]</a>" : "<a href=\"index.php?action=login\">$lang[login]</a> <a href=\"index.php?action=register\">$lang[register]</a>")."<br /><br />\n". "<small>Powered by Discuz!</small></p>\n". //"<do type=\"prev\" label=\"$lang[return]\"><exit /></do>\n". "</card>\n". "</wml>"; updatesession(); wmloutput(); } function wapmsg($message, $forward = array()) { extract($GLOBALS, EXTR_SKIP); if(isset($lang[$message])) { eval("\$message = \"".$lang[$message]."\";"); } echo "<p>$message". ($forward ? "<br /><a href=\"$forward[link]\">".(isset($lang[$forward['title']]) ? $lang[$forward['title']] : $forward['title'])."</a>" : ''). "</p>\n"; wapfooter(); exit(); } function wapmulti($num, $perpage, $curpage, $mpurl) { global $lang; $multipage = ''; $mpurl .= strpos($mpurl, '?') ? '&amp;' : '?'; if($num > $perpage) { $page = 3; $offset = 2; $realpages = @ceil($num / $perpage); $pages = $realpages; if($page > $pages) { $from = 1; $to = $pages; } else { $from = $curpage - $offset; $to = $from + $page - 1; if($from < 1) { $to = $curpage + 1 - $from; $from = 1; if($to - $from < $page) { $to = $page; } } elseif($to > $pages) { $from = $pages - $page + 1; $to = $pages; } } $multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="'.$mpurl.'page=1">'.$lang['home_page'].'</a>' : ''). ($curpage > 1 ? ' <a href="'.$mpurl.'page='.($curpage - 1).'">'.$lang['last_page'].'</a>' : ''); for($i = $from; $i <= $to; $i++) { $multipage .= $i == $curpage ? ' '.$i : ' <a href="'.$mpurl.'page='.$i.'">'.$i.'</a>'; } $multipage .= ($curpage < $pages ? ' <a href="'.$mpurl.'page='.($curpage + 1).'">'.$lang['next_page'].'</a>' : ''). ($to < $pages ? ' <a href="'.$mpurl.'page='.$pages.'">'.$lang['end_page'].'</a>' : ''); $multipage .= $realpages > $page ? '<br />'.$curpage.'/'.$realpages.$lang['page'].'<input type="text" name="page" size="2" emptyok="true" /> '. '<anchor title="submit">'.$lang['turn_page'].'<go method="post" href="'.$mpurl.'">'. '<postfield name="page" value="$(page)" />'. '</go></anchor>' : ''; } return $multipage; } function wapcutstr($string, &$length) { $strcut = ''; if(strlen($string) > $length) { for($i = 0; $i < $length - 3; $i++) { $strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i]; } $length = $i; return $strcut.' ..'; } else { return $string; } } function wapcode($string) { global $lang; $string = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string); $string = preg_replace("/\[hide\](.+?)\[\/hide\]/is", $lang['post_hide_reply_hidden'], $string); $string = preg_replace("/\[hide=(\d+)\]\s*(.+?)\s*\[\/hide\]/ies", $lang['post_hide_reply_hidden'], $string); for($i = 0; $i < 5; $i++) { $string = preg_replace("/\[(\w+)[^\]]*?\](.*?)\[\/\\1\]/is", "\\2", $string); } return $string; } function wmloutput() { global $sid, $charset, $wapcharset; static $chs; $content = preg_replace("/\<a(\s*[^\>]+\s*)href\=([\"|\']?)([^\"\'\s]+)/ies", "transsid('\\3','<a\\1href=\\2',1)", ob_get_contents()); ob_end_clean(); if($charset != 'utf-8') { $target = $wapcharset == 1 ? 'UTF-8' : 'UNICODE'; if(empty($chs)) { $chs = new Chinese($charset, $target); } else { $chs->config['SourceLang'] = $chs->_lang($charset); $chs->config['TargetLang'] = $target; } echo ($wapcharset == 1 ? $chs->Convert($content) : str_replace(array('&#x;', '&#x0;'), array('??', ''), $chs->Convert($content))); } else { echo $content; } } function wapconvert($str) { static $chs; if($str != '' && !is_numeric($str) && $GLOBALS['charset'] != 'utf-8') { $chs = empty($chs) ? new Chinese('UTF-8', $GLOBALS['charset']) : $chs; if(is_array($str)) { foreach($str as $key => $val) { $str[$key] = wapconvert($val); } } else { $str = addslashes($chs->Convert(stripslashes($str))); } } return $str; } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/global.func.php
PHP
asf20
5,522
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: search.inc.php 16718 2008-11-17 03:48:41Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } $cachelife_time = 300; // Life span for cache of searching in specified range of time $cachelife_text = 3600; // Life span for cache of text searching if(!$allowsearch) { wapmsg('search_group_nopermission'); } $do = !empty($do) ? $do : ''; if($do != 'submit') { echo "<p>$lang[search]<br />". "$lang[keywords]:<input type=\"text\" name=\"srchtxt\" value=\"\" maxlength=\"15\" format=\"M*m\" /><br />\n". "$lang[username]:<input type=\"text\" name=\"srchuname\" value=\"\" format=\"M*m\" /><br />\n". "<anchor title=\"$lang[submit]\">$lang[submit]". "<go method=\"post\" href=\"index.php?action=search&amp;do=submit\">\n". "<postfield name=\"sid\" value=\"$sid\" />\n". "<postfield name=\"srchtxt\" value=\"$(srchtxt)\" />\n". "<postfield name=\"srchuname\" value=\"$(srchuname)\" />\n". "</go></anchor></p>"; } else { if(isset($searchid)) { $page = max(1, intval($page)); $start_limit = $number = ($page - 1) * $waptpp; $index = $db->fetch_first("SELECT searchstring, keywords, threads, tids FROM {$tablepre}searchindex WHERE searchid='$searchid'"); if(!$index) { wapmsg('search_id_invalid'); } $index['keywords'] = rawurlencode($index['keywords']); $index['searchtype'] = preg_replace("/^([a-z]+)\|.*/", "\\1", $index['searchstring']); $searchnum = $db->result_first("SELECT COUNT(*) FROM {$tablepre}threads WHERE tid IN ($index[tids]) AND displayorder>='0'"); if($searchnum) { echo "<p>$lang[search_result]<br />"; $query = $db->query("SELECT * FROM {$tablepre}threads WHERE tid IN ($index[tids]) AND displayorder>='0' ORDER BY dateline DESC LIMIT $start_limit, $waptpp"); while($thread = $db->fetch_array($query)) { echo "<a href=\"index.php?action=thread&amp;tid=$thread[tid]\">#".++$number." ".cutstr($thread['subject'], 24)."</a>($thread[views]/$thread[replies])<br />\n"; } echo wapmulti($searchnum, $waptpp, $page, "index.php?action=search&amp;searchid=$searchid&amp;do=submit&amp;sid=$sid"); echo '</p>'; } else { wapmsg('search_invalid'); } } else { $srchtxt = trim(wapconvert($srchtxt)); $srchuname = trim(wapconvert($srchuname)); $srchuid = intval($srchuid); $searchstring = 'title|'.addslashes($srchtxt).'|'.$srchuid.'|'.$srchuname; $searchindex = array('id' => 0, 'dateline' => '0'); $query = $db->query("SELECT searchid, dateline, ('$searchctrl'<>'0' AND ".(empty($discuz_uid) ? "useip='$onlineip'" : "uid='$discuz_uid'")." AND $timestamp-dateline<$searchctrl) AS flood, (searchstring='$searchstring' AND expiration>'$timestamp') AS indexvalid FROM {$tablepre}searchindex WHERE ('$searchctrl'<>'0' AND ".(empty($discuz_uid) ? "useip='$onlineip'" : "uid='$discuz_uid'")." AND $timestamp-dateline<$searchctrl) OR (searchstring='$searchstring' AND expiration>'$timestamp') ORDER BY flood"); while($index = $db->fetch_array($query)) { if($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) { $searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']); break; } elseif($index['flood']) { wapmsg('search_ctrl'); } } if($searchindex['id']) { $searchid = $searchindex['id']; } else { if(empty($srchfid)) { $srchfid = 'all'; } if(!$srchtxt && !empty($srchuid) && !$srchuname && !$srchfrom) { wapmsg('search_invalid'); } if(!empty($srchfrom) && empty($srchtxt) && empty($srchuid) && empty($srchuname)) { $searchfrom = !empty($before) ? '<=' : '>='; $searchfrom .= $timestamp - $srchfrom; $sqlsrch = "FROM {$tablepre}threads t WHERE t.displayorder>='0' AND t.lastpost$searchfrom"; $expiration = $timestamp + $cachelife_time; $keywords = ''; } else { if(!empty($mytopics) && $srchuid) { $srchfrom = 2592000; $srchuname = $srchtxt = $before = ''; } $sqlsrch = "FROM {$tablepre}threads t WHERE t.displayorder>='0'"; if($srchuname) { $srchuid = $comma = ''; $srchuname = str_replace('*', '%', addcslashes($srchuname, '%_')); $query = $db->query("SELECT uid FROM {$tablepre}members WHERE username LIKE '".str_replace('_', '\_', $srchuname)."' LIMIT 50"); while($member = $db->fetch_array($query)) { $srchuid .= "$comma'$member[uid]'"; $comma = ', '; } if(!$srchuid) { $sqlsrch .= ' AND 0'; } } elseif($srchuid) { $srchuid = "'$srchuid'"; } $sqltxtsrch = ''; if($srchtxt) { $srchtxt = str_replace('*', '%', addcslashes($srchtxt, '%_')); $sqltxtsrch .= "t.subject LIKE '%$srchtxt%'"; $sqlsrch .= " AND ($sqltxtsrch)"; } if($srchuid) { $sqlsrch .= " AND authorid IN ($srchuid)"; } if($srchfid != 'all' && $srchfid) { $sqlsrch .= " AND fid='$srchfid'"; } $keywords = str_replace('%', '+', $srchtxt).(trim($srchuname) ? '+'.str_replace('%', '+', $srchuname) : ''); $expiration = $timestamp + $cachelife_text; } $threads = $tids = 0; $query = $sdb->query("SELECT DISTINCT t.tid, t.closed $sqlsrch ORDER BY tid DESC LIMIT $maxsearchresults"); while($thread = $sdb->fetch_array($query)) { if($thread['closed'] <= 1) { $tids .= ','.$thread['tid']; $threads++; } } $db->free_result($query); $db->query("INSERT INTO {$tablepre}searchindex (keywords, searchstring, useip, uid, dateline, expiration, threads, tids) VALUES ('$keywords', '$searchstring', '$onlineip', '$discuz_uid', '$timestamp', '$expiration', '$threads', '$tids')"); $searchid = $db->insert_id(); } header("Location: index.php?action=search&searchid=$searchid&do=submit&sid=$sid"); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/search.inc.php
PHP
asf20
6,010
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: register.inc.php 16724 2008-11-17 04:41:22Z tiger $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if($discuz_uid) { wapmsg('login_succeed'); } if(!$wapregister) { wapmsg('register_disable'); } $groupinfo = $db->fetch_first("SELECT groupid FROM {$tablepre}usergroups WHERE ".($regverify ? "groupid='8'" : "creditshigher<=".intval($initcredits)." AND ".intval($initcredits)."<creditslower LIMIT 1")); if(empty($username)) { echo "<p>$lang[register_username]:<input type=\"text\" name=\"username\" value=\"\" maxlength=\"15\" /><br />\n". "$lang[password]: <input type=\"password\" name=\"password\" value=\"\" /><br />\n". "$lang[email]: <input type=\"text\" name=\"email\" value=\"\" /><br />\n". ($regverify == 2 ? "$lang[register_reason]: <input type=\"text\" name=\"regmessage\" value=\"\" />\n" : ''). "<anchor title=\"$lang[submit]\">$lang[submit]". "<go method=\"post\" href=\"index.php?action=register&amp;sid=$sid\">\n". "<postfield name=\"username\" value=\"$(username)\" />\n". "<postfield name=\"password\" value=\"$(password)\" />\n". "<postfield name=\"email\" value=\"$(email)\" />\n". "</go></anchor></p>\n"; } else { require_once DISCUZ_ROOT.'./uc_client/client.php'; $email = trim(wapconvert($email)); $username = trim(wapconvert($username)); $regmessage = dhtmlspecialchars(wapconvert($regmessage)); if(uc_get_user($username) && !$db->result_first("SELECT uid FROM {$tablepre}members WHERE username='$username'")) { wapmsg('register_activation_message'); } if($regstatus == 2) { wapmsg('register_invite'); } if($ipregctrl) { foreach(explode("\n", $ipregctrl) as $ctrlip) { if(preg_match("/^(".preg_quote(($ctrlip = trim($ctrlip)), '/').")/", $onlineip)) { $ctrlip = $ctrlip.'%'; $regctrl = 72; break; } } } else { $ctrlip = $onlineip; } if($regctrl) { $query = $db->query("SELECT ip FROM {$tablepre}regips WHERE ip LIKE '$ctrlip' AND count='-1' AND dateline>$timestamp-'$regctrl'*3600 LIMIT 1"); if($db->num_rows($query)) { wapmsg('register_ctrl', NULL, 'HALTED'); } } if($regfloodctrl) { if($regattempts = $db->result_first("SELECT count FROM {$tablepre}regips WHERE ip='$onlineip' AND count>'0' AND dateline>'$timestamp'-86400")) { if($regattempts >= $regfloodctrl) { wapmsg('register_flood_ctrl'); } else { $db->query("UPDATE {$tablepre}regips SET count=count+1 WHERE ip='$onlineip' AND count>'0'"); } } else { $db->query("INSERT INTO {$tablepre}regips (ip, count, dateline) VALUES ('$onlineip', '1', '$timestamp')"); } } $uid = uc_user_register($username, $password, $email); if($uid <= 0) { if($uid == -1) { wapmsg('profile_username_illegal'); } elseif($uid == -2) { wapmsg('profile_username_protect'); } elseif($uid == -3) { wapmsg('profile_username_duplicate'); } elseif($uid == -4) { wapmsg('profile_email_illegal'); } elseif($uid == -5) { wapmsg('profile_email_domain_illegal'); } elseif($uid == -6) { wapmsg('profile_email_duplicate'); } else { wapmsg('undefined_action'); } } $password = md5(random(10)); $idstring = random(6); $authstr = $regverify == 1 ? "$timestamp\t2\t$idstring" : ''; $db->query("REPLACE INTO {$tablepre}members (uid, username, password, secques, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, posts, credits, extcredits1, extcredits2, extcredits3, extcredits4, extcredits5, extcredits6, extcredits7, extcredits8, email, bday, sigstatus, tpp, ppp) VALUES ('$uid', '$username', '$password', '', '', '0', '$groupinfo[groupid]', '$onlineip', '$timestamp', '$timestamp', '$timestamp', '0', $initcredits, '$email', '', '', '20', '20')"); $db->query("REPLACE INTO {$tablepre}memberfields (uid, authstr) VALUES ('$uid', '$authstr')"); if($regverify == 2) { $db->query("REPLACE INTO {$tablepre}validating (uid, submitdate, moddate, admin, submittimes, status, message, remark) VALUES ('$uid', '$timestamp', '0', '', '1', '0', '$regmessage', '')"); } $discuz_uid = $uid; $discuz_user = $username; $discuz_userss = stripslashes($discuz_user); $discuz_pw = $password; $groupid = $groupinfo['groupid']; $styleid = $styleid ? $styleid : $_DCACHE['settings']['styleid']; switch($regverify) { case 1: sendmail("$discuz_userss <$email>", 'email_verify_subject', 'email_verify_message'); wapmsg('profile_email_verify'); break; case 2: wapmsg('register_manual_verify'); break; default: wapmsg('register_succeed'); break; } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/register.inc.php
PHP
asf20
4,766
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: login.inc.php 16718 2008-11-17 03:48:41Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } require_once DISCUZ_ROOT.'./include/misc.func.php'; if(empty($logout)) { if(empty($username)) { echo "<p>$lang[login_username]:<input type=\"text\" name=\"username\" maxlength=\"15\" format=\"M*m\" /><br />\n". "$lang[password]: <input type=\"password\" name=\"password\" value=\"\" format=\"M*m\" /><br />\n". "$lang[security_question]: <select name=\"questionid\"> <option value=\"0\">$lang[security_question_0]</option> <option value=\"1\">$lang[security_question_1]</option> <option value=\"2\">$lang[security_question_2]</option> <option value=\"3\">$lang[security_question_3]</option> <option value=\"4\">$lang[security_question_4]</option> <option value=\"5\">$lang[security_question_5]</option> <option value=\"6\">$lang[security_question_6]</option> <option value=\"7\">$lang[security_question_7]</option> </select><br />\n". "$lang[security_answer]: <input type=\"answer\" name=\"answer\" value=\" \" format=\"M*m\" /><br />\n". "<anchor title=\"$lang[submit]\">$lang[submit]". "<go method=\"post\" href=\"index.php?action=login&amp;sid=$sid\">\n". "<postfield name=\"questionid\" value=\"$(questionid)\" />\n". "<postfield name=\"answer\" value=\"$(answer)\" />\n". "<postfield name=\"username\" value=\"$(username)\" />\n". "<postfield name=\"password\" value=\"$(password)\" />\n". "</go></anchor></p>\n"; } else { $loginperm = logincheck(); if(!$loginperm) { wapmsg('login_strike'); } $answer = wapconvert($answer); $username = wapconvert($username); require_once DISCUZ_ROOT.'./uc_client/client.php'; $ucresult = uc_user_login($username, $password, preg_match("/^\d+$/", $username), 1, $questionid, $answer); list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email']) = daddslashes($ucresult, 1); $ucresult = $tmp; if($ucresult['uid'] > 0) { $member = $db->fetch_first("SELECT uid AS discuz_uid, username AS discuz_user, password AS discuz_pw, secques AS discuz_secques, groupid, invisible FROM {$tablepre}members WHERE uid='$ucresult[uid]'"); if(!$member) { if(!$wapregister) { wapmsg('activation_disable'); } $groupinfo = $db->fetch_first("SELECT groupid FROM {$tablepre}usergroups WHERE ".($regverify ? "groupid='8'" : "creditshigher<=".intval($initcredits)." AND ".intval($initcredits)."<creditslower LIMIT 1")); $idstring = random(6); $password = md5(random(10)); $authstr = $regverify == 1 ? "$timestamp\t2\t$idstring" : ''; $regmessage = dhtmlspecialchars($regmessage); $ucresult['username'] = addslashes($ucresult['username']); $db->query("REPLACE INTO {$tablepre}members (uid, username, password, secques, gender, adminid, groupid, regip, regdate, lastvisit, lastactivity, posts, credits, extcredits1, extcredits2, extcredits3, extcredits4, extcredits5, extcredits6, extcredits7, extcredits8, email, bday, sigstatus, tpp, ppp) VALUES ('$ucresult[uid]', '$ucresult[username]', '$password', '', '', '0', '$groupinfo[groupid]', '$onlineip', '$timestamp', '$timestamp', '$timestamp', '0', $initcredits, '$ucresult[email]', '', '', '20', '20')"); $db->query("REPLACE INTO {$tablepre}memberfields (uid, authstr) VALUES ('$ucresult[uid]', '$authstr')"); if($regverify == 2) { $db->query("REPLACE INTO {$tablepre}validating (uid, submitdate, moddate, admin, submittimes, status, message, remark) VALUES ('$ucresult[uid]', '$timestamp', '0', '', '1', '0', '$regmessage', '')"); } $member = $db->fetch_first("SELECT uid AS discuz_uid, username AS discuz_user, password AS discuz_pw, secques AS discuz_secques, groupid, invisible FROM {$tablepre}members WHERE uid='$ucresult[uid]'"); @extract($member); dsetcookie('auth', authcode("$discuz_pw\t$discuz_secques\t$discuz_uid", 'ENCODE'), 2592000, 1, true); wapmsg('login_succeed'); } @extract($member); dsetcookie('auth', authcode("$discuz_pw\t$discuz_secques\t$discuz_uid", 'ENCODE'), 2592000, 1, true); wapmsg('login_succeed'); } else { $errorlog = dhtmlspecialchars( $timestamp."\t". ($member['discuz_user'] ? $member['discuz_user'] : stripslashes($username))."\t". $password."\t". ($secques ? "Ques #".intval($questionid) : '')."\t". $onlineip); writelog('illegallog', $errorlog); wapmsg('login_invalid'); } } } elseif(!empty($formhash) && $formhash == FORMHASH) { $discuz_uid = 0; $discuz_user = ''; $groupid = 7; wapmsg('logout_succeed'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/login.inc.php
PHP
asf20
4,835
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: my.inc.php 16688 2008-11-14 06:41:07Z cnteacher $ */ if(!defined('IN_DISCUZ')) { exit('Access Denied'); } if(empty($discuz_uid)) { wapmsg('not_loggedin'); } $uid = !empty($uid) ? intval($uid) : $discuz_uid; $username = !empty($username) ? dhtmlspecialchars($username) : ''; $usernameadd = $uid ? "m.uid='$uid'" : "m.username='$username'"; if(empty($do)) { $member = $sdb->fetch_first("SELECT m.*, mf.* FROM {$tablepre}members m LEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid WHERE $usernameadd LIMIT 1"); if(!$member) { wapmsg('my_nonexistence'); } if($member['gender'] == '1') { $member['gender'] = $lang['my_male']; } elseif($member['gender'] == '2') { $member['gender'] = $lang['my_female']; } else { $member['gender'] = $lang['my_secrecy']; } echo "<p>$lang[my]<br /><br />". "$lang[my_uid] $member[uid]<br />". "$lang[my_username] $member[username]<br />". "$lang[my_gender] $member[gender]<br />". ($member['bday'] != '0000-00-00' ? "$lang[my_bday] $member[bday]<br />" : ''). ($member['location'] ? "$lang[my_location] $member[location]<br />" : ''). ($member['bio'] ? "$lang[my_bio] $member[bio]<br /><br />" : ''); if($uid == $discuz_uid) { echo "<a href=\"index.php?action=myphone\">$lang[my_phone]</a><br />". "<a href=\"index.php?action=my&amp;do=fav\">$lang[my_favorites]</a><br />"; } echo '</p>'; } else { if($do == 'fav') { if(!empty($favid)) { $selectid = $type == 'thread' ? 'tid' : 'fid'; if($db->result_first("SELECT $selectid FROM {$tablepre}favorites WHERE uid='$discuz_uid' AND $selectid='$favid' LIMIT 1")) { wapmsg('fav_existence'); } else { $db->query("INSERT INTO {$tablepre}favorites (uid, $selectid) VALUES ('$discuz_uid', '$favid')"); wapmsg('fav_add_succeed'); } } else { echo "<p>$lang[my_threads]<br />"; $query = $sdb->query("SELECT m.*, t.subject FROM {$tablepre}mythreads m, {$tablepre}threads t WHERE m.uid = '$discuz_uid' AND m.tid = t.tid ORDER BY m.dateline DESC LIMIT 0, 3"); while($mythread = $sdb->fetch_array($query)) { echo "<a href=\"index.php?action=thread&amp;tid=$mythread[tid]\">".cutstr($mythread['subject'], 15)."</a><br />"; } echo "<br />$lang[my_replies]<br />"; $query = $sdb->query("SELECT m.*, t.subject FROM {$tablepre}myposts m, {$tablepre}threads t WHERE m.uid = '$discuz_uid' AND m.tid = t.tid ORDER BY m.dateline DESC LIMIT 0, 3"); while($mypost = $sdb->fetch_array($query)) { echo "<a href=\"index.php?action=thread&amp;tid=$mypost[tid]\">".cutstr($mypost['subject'], 15)."</a><br />"; } echo "<br />$lang[my_fav_thread]<br />"; $query = $sdb->query("SELECT t.tid, t.subject FROM {$tablepre}favorites fav, {$tablepre}threads t WHERE fav.tid=t.tid AND t.displayorder>='0' AND fav.uid='$discuz_uid' ORDER BY t.lastpost DESC LIMIT 0, 3"); while($favthread = $sdb->fetch_array($query)) { echo "<a href=\"index.php?action=thread&amp;tid=$favthread[tid]\">".cutstr($favthread['subject'], 24)."</a><br />"; } echo "<br />$lang[my_fav_forum]<br />"; $query = $sdb->query("SELECT f.fid, f.name FROM {$tablepre}favorites fav, {$tablepre}forums f WHERE fav.uid='$discuz_uid' AND fav.fid=f.fid ORDER BY f.displayorder DESC LIMIT 0, 3"); while($favforum = $sdb->fetch_array($query)) { echo "<a href=\"index.php?action=forum&amp;fid=$favforum[fid]\">$favforum[name]</a><br />"; } echo '</p>'; } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/wap/include/my.inc.php
PHP
asf20
3,651
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: eccredit.php 16688 2008-11-14 06:41:07Z cnteacher $ */ define('NOROBOT', TRUE); define('CURSCRIPT', 'eccredit'); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./include/ec_credit.func.php'; if(empty($action)) { $uid = intval($uid); $allowviewpro = $discuz_uid && $uid == $discuz_uid ? 1 : $allowviewpro; if(!$allowviewpro) { showmessage('group_nopermission', NULL, 'NOPERM'); } include_once DISCUZ_ROOT.'./forumdata/cache/cache_usergroups.php'; $discuz_action = 62; $member = $db->fetch_first("SELECT m.uid, mf.customstatus, m.username, m.groupid, mf.taobao, mf.alipay, mf.avatar, mf.avatarwidth, mf.avatarheight, mf.buyercredit, mf.sellercredit, m.regdate FROM {$tablepre}members m LEFT JOIN {$tablepre}memberfields mf USING(uid) WHERE m.uid='$uid'"); if(!$member) { showmessage('member_nonexistence', NULL, 'NOPERM'); } $member['avatar'] = '<div class="avatar">'.discuz_uc_avatar($member['uid']); if($_DCACHE['usergroups'][$member['groupid']]['groupavatar']) { $member['avatar'] .= '<br /><img src="'.$_DCACHE['usergroups'][$member['groupid']]['groupavatar'].'" border="0" alt="" />'; } $member['avatar'] .= '</div>'; $member['taobaoas'] = addslashes($member['taobao']); $member['regdate'] = gmdate($dateformat, $member['regdate'] + $timeoffset * 3600); $member['usernameenc'] = rawurlencode($member['username']); $member['buyerrank'] = 0; if($member['buyercredit']){ foreach($ec_credit['rank'] AS $level => $credit) { if($member['buyercredit'] <= $credit) { $member['buyerrank'] = $level; break; } } } $member['sellerrank'] = 0; if($member['sellercredit']){ foreach($ec_credit['rank'] AS $level => $credit) { if($member['sellercredit'] <= $credit) { $member['sellerrank'] = $level; break; } } } $query = $db->query("SELECT variable, value, expiration FROM {$tablepre}spacecaches WHERE uid='$uid' AND variable IN ('buyercredit', 'sellercredit')"); $caches = array(); while($cache = $db->fetch_array($query)) { $caches[$cache['variable']] = unserialize($cache['value']); $caches[$cache['variable']]['expiration'] = $cache['expiration']; } foreach(array('buyercredit', 'sellercredit') AS $type) { if(!isset($caches[$type]) || $timestamp > $caches[$type]['expiration']) { $caches[$type] = updatecreditcache($uid, $type, 1); } } @$buyerpercent = $caches['buyercredit']['all']['total'] ? sprintf('%0.2f', $caches['buyercredit']['all']['good'] * 100 / $caches['buyercredit']['all']['total']) : 0; @$sellerpercent = $caches['sellercredit']['all']['total'] ? sprintf('%0.2f', $caches['sellercredit']['all']['good'] * 100 / $caches['sellercredit']['all']['total']) : ''; include template('ec_credit'); } elseif($action == 'list') { $from = !empty($from) && in_array($from, array('buyer', 'seller', 'myself')) ? $from : ''; $uid = !empty($uid) ? intval($uid) : ''; $sql = $from == 'myself' ? "raterid='$uid'" : "rateeid='$uid'"; $sql .= $from == 'buyer' ? ' AND type=0' : ($from == 'seller' ? ' AND type=1' : ''); $filter = !empty($filter) ? $filter : ''; switch($filter) { case 'thisweek': $sql .= " AND dateline>=$timestamp - 604800"; break; case 'thismonth': $sql .= " AND dateline>=$timestamp - 2592000"; break; case 'halfyear': $sql .= " AND dateline>=$timestamp - 15552000"; break; case 'before': $sql .= " AND dateline<$timestamp - 15552000"; break; default: $filter = ''; } $level = !empty($level) ? $level : ''; switch($level) { case 'good': $sql .= ' AND score=1'; break; case 'soso': $sql .= ' AND score=0'; break; case 'bad': $sql .= ' AND score=-1'; break; default: $level = ''; } $page = max(1, intval($page)); $start_limit = ($page - 1) * 10; $num = $db->result_first("SELECT COUNT(*) FROM {$tablepre}tradecomments WHERE $sql"); $multipage = multi($num, 10, $page, "eccredit.php?action=list&uid=$uid".($from ? "&from=$from" : NULL).($filter ? "&filter=$filter" : NULL).($level ? "&level=$level" : NULL)); $comments = array(); $query = $db->query("SELECT tc.*, tl.subject, tl.baseprice FROM {$tablepre}tradecomments tc LEFT JOIN {$tablepre}tradelog tl ON tl.orderid=tc.orderid WHERE $sql ORDER BY dateline DESC LIMIT $start_limit, 10"); while($comment = $db->fetch_array($query)) { $comment['expiration'] = dgmdate("$dateformat $timeformat", $comment['dateline'] + $timeoffset * 3600 + 30 * 86400); $comment['dbdateline'] = $comment['dateline']; $comment['dateline'] = dgmdate("$dateformat $timeformat", $comment['dateline'] + $timeoffset * 3600); $comment['baseprice'] = sprintf('%0.2f', $comment['baseprice']); $comments[] = $comment; } include template('ec_list'); } elseif($action == 'rate' && $orderid && isset($type)) { require_once DISCUZ_ROOT.'./include/trade.func.php'; $type = intval($type); if(!$type) { $raterid = 'buyerid'; $ratee = 'seller'; $rateeid = 'sellerid'; } else { $raterid = 'sellerid'; $ratee = 'buyer'; $rateeid = 'buyerid'; } $order = $db->fetch_first("SELECT * FROM {$tablepre}tradelog WHERE orderid='$orderid' AND $raterid='$discuz_uid'"); if(!$order) { showmessage('eccredit_order_notfound'); } elseif($order['ratestatus'] == 3 || ($type == 0 && $order['ratestatus'] == 1) || ($type == 1 && $order['ratestatus'] == 2)) { showmessage('eccredit_rate_repeat'); } elseif(!trade_typestatus('successtrades', $order['status']) && !trade_typestatus('refundsuccess', $order['status'])) { showmessage('eccredit_nofound'); } $uid = $discuz_uid == $order['buyerid'] ? $order['sellerid'] : $order['buyerid']; if(!submitcheck('ratesubmit')) { include template('ec_rate'); } else { $score = intval($score); $message = cutstr(dhtmlspecialchars($message), 200); $level = $score == 1 ? 'good' : ($score == 0 ? 'soso' : 'bad'); $pid = intval($order['pid']); $order = daddslashes($order, 1); $db->query("INSERT INTO {$tablepre}tradecomments (pid, orderid, type, raterid, rater, ratee, rateeid, score, message, dateline) VALUES ('$pid', '$orderid', '$type', '$discuz_uid', '$discuz_user', '$order[$ratee]', '$order[$rateeid]', '$score', '$message', '$timestamp')"); if(!$order['offline']) { if($db->result_first("SELECT COUNT(score) FROM {$tablepre}tradecomments WHERE raterid='$discuz_uid' AND type='$type'") < $ec_credit['maxcreditspermonth']) { updateusercredit($uid, $type ? 'sellercredit' : 'buyercredit', $level); } } if($type == 0) { $ratestatus = $order['ratestatus'] == 2 ? 3 : 1; } else { $ratestatus = $order['ratestatus'] == 1 ? 3 : 2; } $db->query("UPDATE {$tablepre}tradelog SET ratestatus='$ratestatus' WHERE orderid='$order[orderid]'"); if($ratestatus != 3) { sendpm($order[$rateeid], 'eccredit_subject', 'eccredit_message', 0); } showmessage('eccredit_succees'); } } elseif($action == 'explain' && $id) { $id = intval($id); if(!submitcheck('explainsubmit', 1)) { include template('ec_explain'); } else { $comment = $db->fetch_first("SELECT explanation, dateline FROM {$tablepre}tradecomments WHERE id='$id' AND rateeid='$discuz_uid'"); if(!$comment) { showmessage('eccredit_nofound'); } elseif($comment['explanation']) { showmessage('eccredit_reexplanation_repeat'); } elseif($comment['dateline'] < $timestamp - 30 * 86400) { showmessage('eccredit_reexplanation_closed'); } $explanation = cutstr(dhtmlspecialchars($explanation), 200); $db->query("UPDATE {$tablepre}tradecomments SET explanation='$explanation' WHERE id='$id'"); include_once language('misc'); showmessage("<script type=\"text/javascript\">\$('ecce_$id').innerHTML = '<font class=\"lighttxt\">$language[eccredit_explain]: ".addslashes($explanation)."</font>';hideMenu();</script>"); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/eccredit.php
PHP
asf20
8,082
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: admincp.php 16688 2008-11-14 06:41:07Z cnteacher $ */ define('IN_ADMINCP', TRUE); define('NOROBOT', TRUE); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./admin/global.func.php'; require_once DISCUZ_ROOT.'./admin/cpanel.share.php'; require_once DISCUZ_ROOT.'./include/cache.func.php'; include language('admincp'); $discuz_action = 211; $admincp['checkip'] && $onlineip = empty($_SERVER['REMOTE_ADDR']) ? getenv('REMOTE_ADDR') : $_SERVER['REMOTE_ADDR']; $adminsession = new AdminSession($discuz_uid, $groupid, $adminid, $onlineip); $dactionarray = $adminsession->get('dactionarray'); if($dactionarray === null) { $dactionarray = array(); if($radminid != $groupid) { $tmp = unserialize($db->result_first("SELECT disabledactions FROM {$tablepre}adminactions WHERE admingid='$groupid'")); $dactionarray = $tmp ? $tmp : array(); } $adminsession->set('dactionarray', $dactionarray, true); } $cpaccess = $adminsession->cpaccess; if($cpaccess == 0 || (!$discuz_secques && $admincp['forcesecques'])) { require_once DISCUZ_ROOT.'./admin/login.inc.php'; } elseif($cpaccess == 1) { if($admin_password != '') { require_once DISCUZ_ROOT.'./uc_client/client.php'; $ucresult = uc_user_login($discuz_uid, $admin_password, 1, 1, $admin_questionid, $admin_answer); if($ucresult[0] > 0) { $adminsession->errorcount = -1; $adminsession->update(); dheader('Location: '.$BASESCRIPT.'?'.cpurl('url', array('sid'))); } else { $adminsession->errorcount ++; $adminsession->update(); writelog('cplog', dhtmlspecialchars("$timestamp\t$discuz_userss\t$adminid\t$onlineip\t$action\tAUTHENTIFICATION(PASSWORD)")); } } require_once DISCUZ_ROOT.'./admin/login.inc.php'; } else { $username = !empty($username) ? dhtmlspecialchars($username) : ''; $action = !empty($action) && is_string($action) ? trim($action) : ''; $operation = !empty($operation) && is_string($operation) ? trim($operation) : ''; $page = isset($page) ? intval((max(1, $page))) : 0; if(!empty($action) && !in_array($action, array('main', 'logs'))) { switch($cpaccess) { case 1: $extralog = 'AUTHENTIFICATION(ERROR #'.intval($adminsession['errorcount']).')'; break; case 3: $extralog = implodearray(array('GET' => $_GET, 'POST' => $_POST), array('formhash', 'submit', 'addsubmit', 'admin_password', 'sid', 'action')); break; default: $extralog = ''; } $extralog = trim(str_replace(array('GET={};', 'POST={};'), '', $extralog)); $extralog = (($action == 'home' && isset($securyservice)) || ($action == 'insenz' && in_array($operation, array('register', 'binding')))) ? '' : $extralog; writelog('cplog', implode("\t", clearlogstring(array($timestamp,$discuz_userss,$adminid,$onlineip,$action,$extralog)))); unset($extralog); } $isfounder = $adminsession->isfounder = isfounder(); if(empty($action) || isset($frames)) { $extra = cpurl('url'); $extra = $extra && $action ? $extra : (!empty($runwizard) ? 'action=runwizard' : 'action=home'); require_once DISCUZ_ROOT.'./admin/main.inc.php'; } elseif($action == 'logout') { $adminsession ->destroy(); dheader("Location: $indexname"); } else { checkacpaction($action, $operation); if(in_array($action, array('home', 'settings', 'members', 'profilefields', 'admingroups', 'usergroups', 'ranks', 'forums', 'threadtypes', 'threads', 'moderate', 'attach', 'smilies', 'recyclebin', 'prune', 'styles', 'plugins', 'tasks', 'magics', 'medals', 'google', 'qihoo', 'video', 'announce', 'faq', 'ec', 'tradelog', 'creditwizard', 'jswizard', 'project', 'counter', 'misc', 'adv', 'insenz', 'logs', 'tools', 'checktools', 'search', 'upgrade')) || ($isfounder && in_array($action, array('runwizard', 'templates', 'db')))) { require_once DISCUZ_ROOT.'./admin/'.$action.'.inc.php'; $title = 'cplog_'.$action.($operation ? '_'.$operation : ''); if(!in_array($action, array('home', 'custommenu')) && lang($title, false)) { (strtolower($_SERVER['REQUEST_METHOD']) == 'get') && admincustom($title, cpurl('url')); } } else { cpheader(); cpmsg('noaccess'); } cpfooter(); } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/admincp.php
PHP
asf20
4,306
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: logging.php 17399 2008-12-17 09:13:08Z monkey $ */ define('NOROBOT', TRUE); define('CURSCRIPT', 'logging'); require_once './include/common.inc.php'; require_once DISCUZ_ROOT.'./include/misc.func.php'; require_once DISCUZ_ROOT.'./uc_client/client.php'; if($action == 'logout' && !empty($formhash)) { if($_DCACHE['settings']['frameon'] && $_DCOOKIE['frameon'] == 'yes') { $extrahead .= '<script>if(top != self) {parent.leftmenu.location.reload();}</script>'; } if($formhash != FORMHASH) { showmessage('logout_succeed', dreferer()); } $ucsynlogout = $allowsynlogin ? uc_user_synlogout() : ''; clearcookies(); $groupid = 7; $discuz_uid = 0; $discuz_user = $discuz_pw = ''; $styleid = $_DCACHE['settings']['styleid']; showmessage('logout_succeed', dreferer()); } elseif($action == 'login') { if($discuz_uid) { $ucsynlogin = ''; showmessage('login_succeed', $indexname); } $field = $loginfield == 'uid' ? 'uid' : 'username'; if(!($loginperm = logincheck())) { showmessage('login_strike'); } $seccodecheck = $seccodestatus & 2; if($seccodecheck && $seccodedata['loginfailedcount']) { $seccodecheck = $db->result_first("SELECT count(*) FROM {$tablepre}failedlogins WHERE ip='$onlineip' AND count>='$seccodedata[loginfailedcount]' AND $timestamp-lastupdate<=900"); } if(!submitcheck('loginsubmit', 1, $seccodecheck)) { $discuz_action = 6; $referer = dreferer(); $thetimenow = '(GMT '.($timeoffset > 0 ? '+' : '').$timeoffset.') '. dgmdate("$dateformat $timeformat", $timestamp + $timeoffset * 3600). $styleselect = ''; $query = $db->query("SELECT styleid, name FROM {$tablepre}styles WHERE available='1'"); while($styleinfo = $db->fetch_array($query)) { $styleselect .= "<option value=\"$styleinfo[styleid]\">$styleinfo[name]</option>\n"; } $cookietimecheck = !empty($_DCOOKIE['cookietime']) ? 'checked="checked"' : ''; if($seccodecheck) { $seccode = random(6, 1) + $seccode{0} * 1000000; } $username = !empty($_DCOOKIE['loginuser']) ? htmlspecialchars($_DCOOKIE['loginuser']) : ''; include template('login'); } else { if(isset($loginauth)) { list($username, $password) = daddslashes(explode("\t", authcode($loginauth, 'DECODE')), 1); } $ucresult = uc_user_login($username, $password, $loginfield == 'uid', 1, $questionid, $answer); list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = daddslashes($ucresult, 1); $ucresult = $tmp; if($duplicate && $ucresult['uid'] > 0) { if($olduid = $db->result_first("SELECT uid FROM {$tablepre}members WHERE username='".addslashes($ucresult['username'])."'")) { require_once DISCUZ_ROOT.'./include/membermerge.func.php'; membermerge($olduid, $ucresult['uid']); uc_user_merge_remove($ucresult['username']); } else { $ucresult['uid'] = -1; } } $discuz_uid = 0; $discuz_user = $discuz_pw = $discuz_secques = ''; $member = array(); if($ucresult['uid'] > 0) { $member = $db->fetch_first("SELECT m.uid AS discuz_uid, m.username AS discuz_user, m.password AS discuz_pw, m.secques AS discuz_secques, m.email, m.adminid, m.groupid, m.styleid AS styleidmem, m.lastvisit, m.lastpost, u.allowinvisible FROM {$tablepre}members m LEFT JOIN {$tablepre}usergroups u USING (groupid) WHERE m.uid='$ucresult[uid]'"); if(!$member) { $ucresult['username'] = addslashes($ucresult['username']); $auth = authcode("$ucresult[username]\t".FORMHASH, 'ENCODE'); if($inajax) { $message = 2; $location = $regname.'?action=activation&auth='.rawurlencode($auth); include template('login'); } else { showmessage('login_activation', $regname.'?action=activation&auth='.rawurlencode($auth)); } } extract($member); $discuz_userss = $discuz_user; $discuz_user = addslashes($discuz_user); if(addslashes($email) != $ucresult['email']) { $db->query("UPDATE {$tablepre}members SET email='$ucresult[email]' WHERE uid='$ucresult[uid]'"); } if($questionid > 0 && empty($discuz_secques)) { $discuz_secques = random(8); $db->query("UPDATE {$tablepre}members SET secques='$discuz_secques' WHERE uid='$ucresult[uid]'"); } $styleid = intval(empty($_POST['styleid']) ? ($styleidmem ? $styleidmem : $_DCACHE['settings']['styleid']) : $_POST['styleid']); $cookietime = intval(isset($_POST['cookietime']) ? $_POST['cookietime'] : 0); dsetcookie('cookietime', $cookietime, 31536000); dsetcookie('auth', authcode("$discuz_pw\t$discuz_secques\t$discuz_uid", 'ENCODE'), $cookietime, 1, true); dsetcookie('loginuser'); dsetcookie('activationauth'); dsetcookie('pmnum'); $sessionexists = 0; if($_DCACHE['settings']['frameon'] && $_DCOOKIE['frameon'] == 'yes') { $extrahead .= '<script>if(top != self) {parent.leftmenu.location.reload();}</script>'; } $ucsynlogin = $allowsynlogin ? uc_user_synlogin($discuz_uid) : ''; if(!empty($inajax)) { $msgforward = unserialize($msgforward); $mrefreshtime = intval($msgforward['refreshtime']) * 1000; include_once DISCUZ_ROOT.'./forumdata/cache/cache_usergroups.php'; $usergroups = $_DCACHE['usergroups'][$groupid]['grouptitle']; $message = 1; include template('login'); } else { if($groupid == 8) { showmessage('login_succeed_inactive_member', 'memcp.php'); } else { showmessage('login_succeed', dreferer()); } } } else { $password = preg_replace("/^(.{".round(strlen($password) / 4)."})(.+?)(.{".round(strlen($password) / 6)."})$/s", "\\1***\\3", $password); $errorlog = dhtmlspecialchars( $timestamp."\t". ($ucresult['username'] ? $ucresult['username'] : stripslashes($username))."\t". $password."\t". ($secques ? "Ques #".intval($questionid) : '')."\t". $onlineip); writelog('illegallog', $errorlog); loginfailed($loginperm); $fmsg = $ucresult['uid'] == '-3' ? (empty($questionid) || $answer == '' ? 'login_question_empty' : 'login_question_invalid') : 'login_invalid'; showmessage($fmsg, 'logging.php?action=login'); } } } else { showmessage('undefined_action'); } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/logging.php
PHP
asf20
6,410
<?php /* [Discuz!] (C)2001-2009 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: rss.php 17423 2008-12-19 07:34:20Z monkey $ */ //error_reporting(E_ERROR | E_WARNING | E_PARSE); error_reporting(0); define('IN_DISCUZ', TRUE); define('DISCUZ_ROOT', ''); $timestamp = time(); $fidarray = array(); if(PHP_VERSION < '4.1.0') { $_GET = &$HTTP_GET_VARS; $_SERVER = &$HTTP_SERVER_VARS; } require_once DISCUZ_ROOT.'./config.inc.php'; require_once DISCUZ_ROOT.'./include/global.func.php'; require_once DISCUZ_ROOT.'./include/db_'.$database.'.class.php'; require_once DISCUZ_ROOT.'./forumdata/cache/cache_settings.php'; require_once DISCUZ_ROOT.'./forumdata/cache/cache_forums.php'; require_once DISCUZ_ROOT.'./forumdata/cache/style_'.intval($_DCACHE['settings']['styleid']).'.php'; if(!$_DCACHE['settings']['rssstatus']) { exit('RSS Disabled'); } $ttl = $_DCACHE['settings']['rssttl'] ? $_DCACHE['settings']['rssttl']: 30; $num = 20; $db = new dbstuff; $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset); unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect); $groupid = 7; $discuz_uid = 0; $discuz_user = $discuz_pw = $discuz_secques = ''; if(!empty($_GET['auth'])) { list($uid, $fid, $auth) = explode("\t", authcode($_GET['auth'], 'DECODE', md5($_DCACHE['settings']['authkey']))); $member = $db->fetch_first("SELECT uid AS discuz_uid, username AS discuz_user, password AS discuz_pw, secques AS discuz_secques, groupid FROM {$tablepre}members WHERE uid='".intval($uid)."'"); if($member) { if($auth == substr(md5($member['discuz_pw'].$member['discuz_secques']), 0, 8)) { extract($member); } } } $PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']; $boardurl = 'http://'.$_SERVER['HTTP_HOST'].substr($PHP_SELF, 0, strrpos($PHP_SELF, '/') + 1); $bbname = dhtmlspecialchars(strip_tags($_DCACHE['settings']['bbname'])); $rssfid = empty($_GET['fid']) ? 0 : intval($_GET['fid']); $forumname = ''; if(empty($rssfid)) { foreach($_DCACHE['forums'] as $fid => $forum) { if(rssforumperm($forum)) { $fidarray[] = $fid; } } } else { $forum = isset($_DCACHE['forums'][$rssfid]) && $_DCACHE['forums'][$rssfid]['type'] != 'group' ? $_DCACHE['forums'][$rssfid] : array(); if($forum && rssforumperm($forum)) { $fidarray = array($rssfid); $forumname = dhtmlspecialchars($_DCACHE['forums'][$rssfid]['name']); } else { exit('Specified forum not found'); } } dheader("Content-type: application/xml"); echo "<?xml version=\"1.0\" encoding=\"".$charset."\"?>\n". "<rss version=\"2.0\">\n". " <channel>\n". (count($fidarray) > 1 ? " <title>$bbname</title>\n". " <link>{$boardurl}".$_DCACHE[settings][indexname]."</link>\n". " <description>Latest $num threads of all forums</description>\n" : " <title>$bbname - $forumname</title>\n". " <link>{$boardurl}forumdisplay.php?fid=$rssfid</link>\n". " <description>Latest $num threads of $forumname</description>\n" ). " <copyright>Copyright(C) $bbname</copyright>\n". " <generator>Discuz! Board by Comsenz Inc.</generator>\n". " <lastBuildDate>".gmdate('r', $timestamp)."</lastBuildDate>\n". " <ttl>$ttl</ttl>\n". " <image>\n". " <url>{$boardurl}images/logo.gif</url>\n". " <title>$bbname</title>\n". " <link>{$boardurl}</link>\n". " </image>\n"; if($fidarray) { $query = $db->query("SELECT * FROM {$tablepre}rsscaches WHERE fid IN (".implode(',', $fidarray).") ORDER BY dateline DESC LIMIT $num"); if($db->num_rows($query)) { while($thread = $db->fetch_array($query)) { if($timestamp - $thread['lastupdate'] > $ttl * 60) { updatersscache(); break; } else { echo " <item>\n". " <title>".dhtmlspecialchars($thread['subject'])."</title>\n". " <link>{$boardurl}viewthread.php?tid=$thread[tid]</link>\n". " <description><![CDATA[$thread[description]]]></description>\n". " <category>".dhtmlspecialchars($thread['forum'])."</category>\n". " <author>".dhtmlspecialchars($thread['author'])."</author>\n". " <pubDate>".gmdate('r', $thread['dateline'])."</pubDate>\n". " </item>\n"; } } } else { updatersscache(); } } echo " </channel>\n". "</rss>"; function rssforumperm($forum) { global $groupid, $discuz_uid; return $forum['type'] != 'group' && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || $accessmasks); } function updatersscache() { global $_DCACHE, $timestamp, $num, $tablepre, $db; $db->query("DELETE FROM {$tablepre}rsscaches"); foreach($_DCACHE['forums'] as $fid => $forum) { if($forum['type'] != 'group') { $query = $db->query("SELECT t.tid, t.readperm, t.price, t.author, t.dateline, t.subject, p.message, p.status FROM {$tablepre}threads t LEFT JOIN {$tablepre}posts p ON p.tid=t.tid AND p.first='1' WHERE t.fid='$fid' AND t.displayorder>='0' ORDER BY t.dateline DESC LIMIT $num"); while($thread = $db->fetch_array($query)) { $forum['name'] = addslashes($forum['name']); $thread['author'] = $thread['author'] != '' ? addslashes($thread['author']) : 'Anonymous'; $thread['subject'] = addslashes($thread['subject']); $thread['description'] = $thread['readperm'] > 0 || $thread['price'] > 0 || $thread['status'] & 1 ? '' : addslashes(cutstr(dhtmlspecialchars(preg_replace("/(\[\w{1,10}?\])/s", '', strip_tags(nl2br($thread['message'])))), 255)); $db->query("REPLACE INTO {$tablepre}rsscaches (lastupdate, fid, tid, dateline, forum, author, subject, description) VALUES ('$timestamp', '$fid', '$thread[tid]', '$thread[dateline]', '$forum[name]', '$thread[author]', '$thread[subject]', '$thread[description]')"); } } } } ?>
zyyhong
trunk/jiaju001/51shangcheng.cn/htdocs/rss.php
PHP
asf20
5,907
/*------------------------------------------------------------------------------ ** Ident: Innovation en Inspiration > Google Android ** Author: rene ** Copyright: (c) Jan 22, 2009 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.tests; import junit.framework.TestSuite; import nl.sogeti.android.gpstracker.tests.actions.ExportGPXTest; import nl.sogeti.android.gpstracker.tests.db.GPStrackingProviderTest; import nl.sogeti.android.gpstracker.tests.gpsmock.MockGPSLoggerServiceTest; import nl.sogeti.android.gpstracker.tests.logger.GPSLoggerServiceTest; import nl.sogeti.android.gpstracker.tests.userinterface.LoggerMapTest; import android.test.InstrumentationTestRunner; import android.test.InstrumentationTestSuite; /** * Perform unit tests Run on the adb shell: * * <pre> * am instrument -w nl.sogeti.android.gpstracker.tests/.GPStrackingInstrumentation * </pre> * * @version $Id$ * @author rene (c) Jan 22, 2009, Sogeti B.V. */ public class GPStrackingInstrumentation extends InstrumentationTestRunner { /** * (non-Javadoc) * @see android.test.InstrumentationTestRunner#getAllTests() */ @Override public TestSuite getAllTests() { TestSuite suite = new InstrumentationTestSuite( this ); suite.setName( "GPS Tracking Testsuite" ); suite.addTestSuite( GPStrackingProviderTest.class ); suite.addTestSuite( MockGPSLoggerServiceTest.class ); suite.addTestSuite( GPSLoggerServiceTest.class ); suite.addTestSuite( ExportGPXTest.class ); suite.addTestSuite( LoggerMapTest.class ); // suite.addTestSuite( OpenGPSTrackerDemo.class ); // The demo recorded for youtube // suite.addTestSuite( MapStressTest.class ); // The stress test of the map viewer return suite; } /** * (non-Javadoc) * @see android.test.InstrumentationTestRunner#getLoader() */ @Override public ClassLoader getLoader() { return GPStrackingInstrumentation.class.getClassLoader(); } }
zzy20080920-gps
OpenGPSTracker/test/src/nl/sogeti/android/gpstracker/tests/GPStrackingInstrumentation.java
Java
gpl3
3,313
/*------------------------------------------------------------------------------ ** Ident: Innovation en Inspiration > Google Android ** Author: rene ** Copyright: (c) Jan 22, 2009 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.tests.utils; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Calendar; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import android.content.Context; import android.content.res.XmlResourceParser; import android.util.Log; /** * Feeder of GPS-location information * * @version $Id$ * @author Maarten van Berkel (maarten.van.berkel@sogeti.nl / +0586) */ public class MockGPSLoggerDriver implements Runnable { private static final String TAG = "MockGPSLoggerDriver"; private boolean running = true; private int mTimeout; private Context mContext; private TelnetPositionSender sender; private ArrayList<SimplePosition> positions; private int mRouteResource; /** * Constructor: create a new MockGPSLoggerDriver. * * @param context context of the test package * @param route resource identifier for the xml route * @param timeout time to idle between waypoints in miliseconds */ public MockGPSLoggerDriver(Context context, int route, int timeout) { this(); this.mTimeout = timeout; this.mRouteResource = route;// R.xml.denhaagdenbosch; this.mContext = context; } public MockGPSLoggerDriver() { this.sender = new TelnetPositionSender(); } public int getPositions() { return this.positions.size(); } private void prepareRun( int xmlResource ) { this.positions = new ArrayList<SimplePosition>(); XmlResourceParser xmlParser = this.mContext.getResources().getXml( xmlResource ); doUglyXMLParsing( this.positions, xmlParser ); xmlParser.close(); } public void run() { prepareRun( this.mRouteResource ); while( this.running && ( this.positions.size() > 0 ) ) { SimplePosition position = this.positions.remove( 0 ); //String nmeaCommand = createGPGGALocationCommand(position.getLongitude(), position.getLatitude(), 0); String nmeaCommand = createGPRMCLocationCommand( position.lng, position.lat, 0, 0 ); String checksum = calulateChecksum( nmeaCommand ); this.sender.sendCommand( "geo nmea $" + nmeaCommand + "*" + checksum + "\r\n" ); try { Thread.sleep( this.mTimeout ); } catch( InterruptedException e ) { Log.w( TAG, "Interrupted" ); } } } public static String calulateChecksum( String nmeaCommand ) { byte[] chars = null; try { chars = nmeaCommand.getBytes( "ASCII" ); } catch( UnsupportedEncodingException e ) { e.printStackTrace(); } byte xor = 0; for( int i = 0; i < chars.length; i++ ) { xor ^= chars[i]; } return Integer.toHexString( (int) xor ).toUpperCase(); } public void stop() { this.running = false; } private void doUglyXMLParsing( ArrayList<SimplePosition> positions, XmlResourceParser xmlParser ) { int eventType; try { eventType = xmlParser.getEventType(); SimplePosition lastPosition = null; boolean speed = false; while( eventType != XmlPullParser.END_DOCUMENT ) { if( eventType == XmlPullParser.START_TAG ) { if( xmlParser.getName().equals( "trkpt" ) || xmlParser.getName().equals( "rtept" ) || xmlParser.getName().equals( "wpt" ) ) { lastPosition = new SimplePosition( xmlParser.getAttributeFloatValue( 0, 12.3456F ), xmlParser.getAttributeFloatValue( 1, 12.3456F ) ); positions.add( lastPosition ); } if( xmlParser.getName().equals( "speed" ) ) { speed = true; } } else if( eventType == XmlPullParser.END_TAG ) { if( xmlParser.getName().equals( "speed" ) ) { speed = false; } } else if( eventType == XmlPullParser.TEXT ) { if( lastPosition != null && speed ) { lastPosition.speed = Float.parseFloat( xmlParser.getText() ); } } eventType = xmlParser.next(); } } catch( XmlPullParserException e ) { /* ignore */ } catch( IOException e ) {/* ignore */ } } /** * Create a NMEA GPRMC sentence * * @param longitude * @param latitude * @param elevation * @param speed in mps * @return */ public static String createGPRMCLocationCommand( double longitude, double latitude, double elevation, double speed ) { speed *= 0.51; // from m/s to knots final String COMMAND_GPS = "GPRMC," + "%1$02d" + // hh c.get(Calendar.HOUR_OF_DAY) "%2$02d" + // mm c.get(Calendar.MINUTE) "%3$02d." + // ss. c.get(Calendar.SECOND) "%4$03d,A," + // ss, c.get(Calendar.MILLISECOND) "%5$03d" + // llll latDegree "%6$09.6f," + // latMinute "%7$c," + // latDirection (N or S) "%8$03d" + // longDegree "%9$09.6f," + // longMinutett "%10$c," + // longDirection (E or W) "%14$.2f," + // Speed over ground in knot "0," + // Track made good in degrees True "%11$02d" + // dd "%12$02d" + // mm "%13$02d," + // yy "0," + // Magnetic variation degrees (Easterly var. subtracts from true course) "E," + // East/West "mode"; // Just as workaround.... Calendar c = Calendar.getInstance(); double absLong = Math.abs( longitude ); int longDegree = (int) Math.floor( absLong ); char longDirection = 'E'; if( longitude < 0 ) { longDirection = 'W'; } double longMinute = ( absLong - Math.floor( absLong ) ) * 60; double absLat = Math.abs( latitude ); int latDegree = (int) Math.floor( absLat ); char latDirection = 'N'; if( latitude < 0 ) { latDirection = 'S'; } double latMinute = ( absLat - Math.floor( absLat ) ) * 60; String command = String.format( COMMAND_GPS, c.get( Calendar.HOUR_OF_DAY ), c.get( Calendar.MINUTE ), c.get( Calendar.SECOND ), c.get( Calendar.MILLISECOND ), latDegree, latMinute, latDirection, longDegree, longMinute, longDirection, c.get( Calendar.DAY_OF_MONTH ), c.get( Calendar.MONTH ), c.get( Calendar.YEAR ) - 2000 , speed); return command; } public static String createGPGGALocationCommand( double longitude, double latitude, double elevation ) { final String COMMAND_GPS = "GPGGA," + // $--GGA, "%1$02d" + // hh c.get(Calendar.HOUR_OF_DAY) "%2$02d" + // mm c.get(Calendar.MINUTE) "%3$02d." + // ss. c.get(Calendar.SECOND) "%4$03d," + // sss, c.get(Calendar.MILLISECOND) "%5$03d" + // llll latDegree "%6$09.6f," + // latMinute "%7$c," + // latDirection "%8$03d" + // longDegree "%9$09.6f," + // longMinutett "%10$c," + // longDirection "1,05,02.1,00545.5,M,-26.0,M,,"; Calendar c = Calendar.getInstance(); double absLong = Math.abs( longitude ); int longDegree = (int) Math.floor( absLong ); char longDirection = 'E'; if( longitude < 0 ) { longDirection = 'W'; } double longMinute = ( absLong - Math.floor( absLong ) ) * 60; double absLat = Math.abs( latitude ); int latDegree = (int) Math.floor( absLat ); char latDirection = 'N'; if( latitude < 0 ) { latDirection = 'S'; } double latMinute = ( absLat - Math.floor( absLat ) ) * 60; String command = String.format( COMMAND_GPS, c.get( Calendar.HOUR_OF_DAY ), c.get( Calendar.MINUTE ), c.get( Calendar.SECOND ), c.get( Calendar.MILLISECOND ), latDegree, latMinute, latDirection, longDegree, longMinute, longDirection ); return command; } class SimplePosition { public float speed; public double lat, lng; public SimplePosition(float latitude, float longtitude) { this.lat = latitude; this.lng = longtitude; } } public void sendSMS( String string ) { this.sender.sendCommand( "sms send 31886606607 " + string + "\r\n" ); } }
zzy20080920-gps
OpenGPSTracker/test/src/nl/sogeti/android/gpstracker/tests/utils/MockGPSLoggerDriver.java
Java
gpl3
10,654
/*------------------------------------------------------------------------------ ** Ident: Innovation en Inspiration > Google Android ** Author: rene ** Copyright: (c) Jan 22, 2009 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.tests.utils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException; import android.util.Log; /** * Translates SimplePosition objects to a telnet command and sends the commands to a telnet session with an android emulator. * * @version $Id$ * @author Bram Pouwelse (c) Jan 22, 2009, Sogeti B.V. * */ public class TelnetPositionSender { private static final String TAG = "TelnetPositionSender"; private static final String TELNET_OK_FEEDBACK_MESSAGE = "OK\r\n"; private static String HOST = "10.0.2.2"; private static int PORT = 5554; private Socket socket; private OutputStream out; private InputStream in; /** * Constructor */ public TelnetPositionSender() { } /** * Setup a telnet connection to the android emulator */ private void createTelnetConnection() { try { this.socket = new Socket(HOST, PORT); this.in = this.socket.getInputStream(); this.out = this.socket.getOutputStream(); Thread.sleep(500); // give the telnet session half a second to // respond } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } readInput(); // read the input to throw it away the first time :) } private void closeConnection() { try { this.out.close(); this.in.close(); this.socket.close(); } catch (IOException e) { e.printStackTrace(); } } /** * read the input buffer * @return */ private String readInput() { StringBuffer sb = new StringBuffer(); try { byte[] bytes = new byte[this.in.available()]; this.in.read(bytes); for (byte b : bytes) { sb.append((char) b); } } catch (Exception e) { System.err.println("Warning: Could not read the input from the telnet session"); } return sb.toString(); } /** * When a new position is received it is sent to the android emulator over the telnet connection. * * @param position the position to send */ public void sendCommand(String telnetString) { createTelnetConnection(); Log.v( TAG, "Sending command: "+telnetString); byte[] sendArray = telnetString.getBytes(); for (byte b : sendArray) { try { this.out.write(b); } catch (IOException e) { System.out.println("IOException: " + e.getMessage()); } } String feedback = readInput(); if (!feedback.equals(TELNET_OK_FEEDBACK_MESSAGE)) { System.err.println("Warning: no OK mesage message was(" + feedback + ")"); } closeConnection(); } }
zzy20080920-gps
OpenGPSTracker/test/src/nl/sogeti/android/gpstracker/tests/utils/TelnetPositionSender.java
Java
gpl3
4,544
/*------------------------------------------------------------------------------ ** Ident: Innovation en Inspiration > Google Android ** Author: rene ** Copyright: (c) Jan 22, 2009 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.tests.demo; import nl.sogeti.android.gpstracker.logger.GPSLoggerServiceManager; import nl.sogeti.android.gpstracker.tests.utils.MockGPSLoggerDriver; import nl.sogeti.android.gpstracker.viewer.map.CommonLoggerMap; import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.SmallTest; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; /** * @version $Id$ * @author rene (c) Jan 22, 2009, Sogeti B.V. */ public class OpenGPSTrackerDemo extends ActivityInstrumentationTestCase2<CommonLoggerMap> { private static final int ZOOM_LEVEL = 16; private static final Class<CommonLoggerMap> CLASS = CommonLoggerMap.class; private static final String PACKAGE = "nl.sogeti.android.gpstracker"; private CommonLoggerMap mLoggermap; private GPSLoggerServiceManager mLoggerServiceManager; private MapView mMapView; private MockGPSLoggerDriver mSender; public OpenGPSTrackerDemo() { super( PACKAGE, CLASS ); } @Override protected void setUp() throws Exception { super.setUp(); this.mLoggermap = getActivity(); this.mMapView = (MapView) this.mLoggermap.findViewById( nl.sogeti.android.gpstracker.R.id.myMapView ); this.mSender = new MockGPSLoggerDriver(); } protected void tearDown() throws Exception { this.mLoggerServiceManager.shutdown( getActivity() ); super.tearDown(); } /** * Start tracking and allow it to go on for 30 seconds * * @throws InterruptedException */ @LargeTest public void testTracking() throws InterruptedException { a_introSingelUtrecht30Seconds(); c_startRoute10Seconds(); d_showDrawMethods30seconds(); e_statistics10Seconds(); f_showPrecision30seconds(); g_stopTracking10Seconds(); h_shareTrack30Seconds(); i_finish10Seconds(); } @SmallTest public void a_introSingelUtrecht30Seconds() throws InterruptedException { this.mMapView.getController().setZoom( ZOOM_LEVEL); Thread.sleep( 1 * 1000 ); // Browse the Utrecht map sendMessage( "Selecting a previous recorded track" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "MENU DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "L" ); Thread.sleep( 2 * 1000 ); sendMessage( "The walk around the \"singel\" in Utrecht" ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 2 * 1000 ); Thread.sleep( 2 * 1000 ); sendMessage( "Scrolling about" ); this.mMapView.getController().animateTo( new GeoPoint( 52095829, 5118599 ) ); Thread.sleep( 2 * 1000 ); this.mMapView.getController().animateTo( new GeoPoint( 52096778, 5125090 ) ); Thread.sleep( 2 * 1000 ); this.mMapView.getController().animateTo( new GeoPoint( 52085117, 5128255 ) ); Thread.sleep( 2 * 1000 ); this.mMapView.getController().animateTo( new GeoPoint( 52081517, 5121646 ) ); Thread.sleep( 2 * 1000 ); this.mMapView.getController().animateTo( new GeoPoint( 52093535, 5116711 ) ); Thread.sleep( 2 * 1000 ); this.sendKeys( "G G" ); Thread.sleep( 5 * 1000 ); } @SmallTest public void c_startRoute10Seconds() throws InterruptedException { sendMessage( "Lets start a new route" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "MENU DPAD_RIGHT DPAD_LEFT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "T" );//Toggle start/stop tracker Thread.sleep( 1 * 1000 ); this.mMapView.getController().setZoom( ZOOM_LEVEL); this.sendKeys( "D E M O SPACE R O U T E ENTER" ); Thread.sleep( 5 * 1000 ); sendMessage( "The GPS logger is already running as a background service" ); Thread.sleep( 5 * 1000 ); this.sendKeys( "ENTER" ); this.sendKeys( "T T T T" ); Thread.sleep( 30 * 1000 ); this.sendKeys( "G G" ); } @SmallTest public void d_showDrawMethods30seconds() throws InterruptedException { sendMessage( "Track drawing color has different options" ); this.mMapView.getController().setZoom( ZOOM_LEVEL ); this.sendKeys( "MENU DPAD_RIGHT DPAD_RIGHT DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "S" ); Thread.sleep( 3 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_UP DPAD_UP DPAD_UP DPAD_UP" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "BACK" ); sendMessage( "Plain green" ); Thread.sleep( 15 * 1000 ); this.sendKeys( "MENU DPAD_RIGHT DPAD_RIGHT DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "S" ); Thread.sleep( 3 * 1000 ); this.sendKeys( "MENU" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_UP DPAD_UP DPAD_UP DPAD_UP" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_DOWN DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_UP"); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "BACK" ); sendMessage( "Average speeds drawn" ); Thread.sleep( 15 * 1000 ); } @SmallTest public void e_statistics10Seconds() throws InterruptedException { // Show of the statistics screen sendMessage( "Lets look at some statistics" ); this.sendKeys( "MENU DPAD_RIGHT DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "E" ); Thread.sleep( 2 * 1000 ); sendMessage( "Shows the basics on time, speed and distance" ); Thread.sleep( 10 * 1000 ); this.sendKeys( "BACK" ); } @SmallTest public void f_showPrecision30seconds() throws InterruptedException { this.mMapView.getController().setZoom( ZOOM_LEVEL ); sendMessage( "There are options on the precision of tracking" ); this.sendKeys( "MENU DPAD_RIGHT DPAD_RIGHT DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "S" ); Thread.sleep( 3 * 1000 ); this.sendKeys( "DPAD_DOWN DPAD_DOWN" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_UP DPAD_UP" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_DOWN DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_UP" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "BACK" ); sendMessage( "Course will drain the battery the least" ); Thread.sleep( 5 * 1000 ); sendMessage( "Fine will store the best track" ); Thread.sleep( 10 * 1000 ); } @SmallTest public void g_stopTracking10Seconds() throws InterruptedException { this.mMapView.getController().setZoom( ZOOM_LEVEL ); Thread.sleep( 5 * 1000 ); // Stop tracking sendMessage( "Stopping tracking" ); this.sendKeys( "MENU DPAD_RIGHT DPAD_LEFT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "T" ); Thread.sleep( 2 * 1000 ); sendMessage( "Is the track stored?" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "MENU DPAD_RIGHT" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "L" ); this.sendKeys( "DPAD_DOWN DPAD_DOWN" ); Thread.sleep( 2 * 1000 ); this.sendKeys( "DPAD_CENTER" ); Thread.sleep( 2 * 1000 ); } private void h_shareTrack30Seconds() { // TODO Auto-generated method stub } @SmallTest public void i_finish10Seconds() throws InterruptedException { this.mMapView.getController().setZoom( ZOOM_LEVEL ); this.sendKeys( "G G" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "G G" ); Thread.sleep( 1 * 1000 ); this.sendKeys( "G G" ); sendMessage( "Thank you for watching this demo." ); Thread.sleep( 10 * 1000 ); Thread.sleep( 5 * 1000 ); } private void sendMessage( String string ) { this.mSender.sendSMS( string ); } }
zzy20080920-gps
OpenGPSTracker/test/src/nl/sogeti/android/gpstracker/tests/demo/OpenGPSTrackerDemo.java
Java
gpl3
10,188
<html><head></head><body> <p> Open GPS Tracker is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. </p><p> Open GPS Tracker is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. </p><p> You should have received a copy of the GNU General Public License along with Open GPS Tracker. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>. </p> </body></html>
zzy20080920-gps
OpenGPSTracker/application/assets/license_short.html
HTML
gpl3
729
</html><head></head> <body> <div class="section-copyrights"> <h3>Copyright (c) 2008 Google Inc.</h3> <h4>Apache License Version 2.0</h4> <ul> <li>UnicodeReader.java</li> </ul> <hr/> <h3>Copyright (c) 2005-2008, The Android Open Source Project</h3> <h4>Apache License Version 2.0</h4> <ul> <li>compass_arrow.png</li> <li>compass_base.png</li> <li>ic_maps_indicator_current_position.png</li> <li>ic_media_play_mirrored.png</li> <li>ic_media_play.png</li> <li>ic_menu_info_details.png</li> <li>ic_menu_mapmode.png</li> <li>ic_menu_movie.png</li> <li>ic_menu_picture.png</li> <li>ic_menu_preferences.png</li> <li>ic_menu_show_list.png</li> <li>ic_menu_view.png</li> <li>icon.png</li> <li>speedindexbar.png</li> <li>stip.gif</li> <li>stip2.gif</li> </ul> <hr/> <h3>Copyright 1999-2011 The Apache Software Foundation</h3> <h4>Apache License Version 2.0</h4> <ul> <li>Apache HttpComponents Client</li> <li>Apache HttpComponents Core</li> <li>Apache HttpComponents Mime</li> </ul> <hr/> <h3>Copyright (c) 2009 Matthias Kaeppler</h3> <h4>Apache License Version 2.0</h4> <ul> <li>OAuth Signpost</li> </ul> <hr/> </div> <div class="section-content"><p>Apache License<br></br>Version 2.0, January 2004<br></br> <a href="http://www.apache.org/licenses/">http://www.apache.org/licenses/</a> </p> <p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p> <p><strong><a name="definitions">1. Definitions</a></strong>.</p> <p>"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.</p> <p>"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.</p> <p>"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p> <p>"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.</p> <p>"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.</p> <p>"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.</p> <p>"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).</p> <p>"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.</p> <p>"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."</p> <p>"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.</p> <p><strong><a name="copyright">2. Grant of Copyright License</a></strong>. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.</p> <p><strong><a name="patent">3. Grant of Patent License</a></strong>. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.</p> <p><strong><a name="redistribution">4. Redistribution</a></strong>. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:</p> <ol> <li> <p>You must give any other recipients of the Work or Derivative Works a copy of this License; and</p> </li> <li> <p>You must cause any modified files to carry prominent notices stating that You changed the files; and</p> </li> <li> <p>You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and</p> </li> <li> <p>If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.</p> </li> </ol> <p><strong><a name="contributions">5. Submission of Contributions</a></strong>. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.</p> <p><strong><a name="trademarks">6. Trademarks</a></strong>. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.</p> <p><strong><a name="no-warranty">7. Disclaimer of Warranty</a></strong>. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.</p> <p><strong><a name="no-liability">8. Limitation of Liability</a></strong>. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.</p> <p><strong><a name="additional">9. Accepting Warranty or Additional Liability</a></strong>. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.</p> <p>END OF TERMS AND CONDITIONS</p> </body></html>
zzy20080920-gps
OpenGPSTracker/application/assets/notices.html
HTML
gpl3
10,965
</html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head> <body> <h4>Translations</h4> Translations hosted by <a href="http://www.getlocalization.com/">Get Localization</a>. <ul> <li>Chinese: 安智网汉化, NetDragon Websoft</li> <li>Danish: Martin Larsen</li> <li>Dutch: René de Groot, zwets</li> <li>English: René de Groot</li> <li>French: Paul Meier, mvl87, Fabrice Veniard</li> <li>Finnish: Jani Pesonen</li> <li>German: Werner Bogula, SkryBav, doopdoop</li> <li>Hindi: vibin_nair</li> <li>Italian: Paul Meier</li> <li>Polish: Marcin Kost, Michał Podbielski, Wojciech Maj</li> <li>Russian: Yuri Zaitsev </li> <li>Spanish: Alfonso Montero López, Diego</li> <li>Swedish: Jesper Falk</li> </ul> <h4>Code</h4> Code hosted by <a href="http://code.google.com/p/open-gpstracker/">Google Code</a>. <ul> <li>Application: René de Groot</li> <li>Start at boot: Tom Van Braeckel</li> </ul> <h4>Images</h4> <ul> <li>Bubbles icons: ICONS etc. MySiteMyWay</li> </ul> </body></html>
zzy20080920-gps
OpenGPSTracker/application/assets/contributions.html
HTML
gpl3
1,021
/*------------------------------------------------------------------------------ ** Ident: Sogeti Smart Mobile Solutions ** Author: rene ** Copyright: (c) Apr 24, 2011 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.db; import java.util.Date; import nl.sogeti.android.gpstracker.db.GPStracking.Media; import nl.sogeti.android.gpstracker.db.GPStracking.MediaColumns; import nl.sogeti.android.gpstracker.db.GPStracking.MetaData; import nl.sogeti.android.gpstracker.db.GPStracking.Segments; import nl.sogeti.android.gpstracker.db.GPStracking.Tracks; import nl.sogeti.android.gpstracker.db.GPStracking.TracksColumns; import nl.sogeti.android.gpstracker.db.GPStracking.Waypoints; import nl.sogeti.android.gpstracker.db.GPStracking.WaypointsColumns; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.location.Location; import android.net.Uri; import android.util.Log; /** * Class to hold bare-metal database operations exposed as functionality blocks * To be used by database adapters, like a content provider, that implement a * required functionality set * * @version $Id$ * @author rene (c) Jan 22, 2009, Sogeti B.V. */ public class DatabaseHelper extends SQLiteOpenHelper { private Context mContext; private final static String TAG = "OGT.DatabaseHelper"; public DatabaseHelper(Context context) { super(context, GPStracking.DATABASE_NAME, null, GPStracking.DATABASE_VERSION); this.mContext = context; } /* * (non-Javadoc) * @see * android.database.sqlite.SQLiteOpenHelper#onCreate(android.database.sqlite * .SQLiteDatabase) */ @Override public void onCreate(SQLiteDatabase db) { db.execSQL(Waypoints.CREATE_STATEMENT); db.execSQL(Segments.CREATE_STATMENT); db.execSQL(Tracks.CREATE_STATEMENT); db.execSQL(Media.CREATE_STATEMENT); db.execSQL(MetaData.CREATE_STATEMENT); } /** * Will update version 1 through 5 to version 8 * * @see android.database.sqlite.SQLiteOpenHelper#onUpgrade(android.database.sqlite.SQLiteDatabase, * int, int) * @see GPStracking.DATABASE_VERSION */ @Override public void onUpgrade(SQLiteDatabase db, int current, int targetVersion) { Log.i(TAG, "Upgrading db from " + current + " to " + targetVersion); if (current <= 5) // From 1-5 to 6 (these before are the same before) { current = 6; } if (current == 6) // From 6 to 7 ( no changes ) { current = 7; } if (current == 7) // From 7 to 8 ( more waypoints data ) { for (String statement : Waypoints.UPGRADE_STATEMENT_7_TO_8) { db.execSQL(statement); } current = 8; } if (current == 8) // From 8 to 9 ( media Uri data ) { db.execSQL(Media.CREATE_STATEMENT); current = 9; } if (current == 9) // From 9 to 10 ( metadata ) { db.execSQL(MetaData.CREATE_STATEMENT); current = 10; } } public void vacuum() { new Thread() { @Override public void run() { SQLiteDatabase sqldb = getWritableDatabase(); sqldb.execSQL("VACUUM"); } }.start(); } int bulkInsertWaypoint(long trackId, long segmentId, ContentValues[] valuesArray) { if (trackId < 0 || segmentId < 0) { throw new IllegalArgumentException("Track and segments may not the less then 0."); } int inserted = 0; SQLiteDatabase sqldb = getWritableDatabase(); sqldb.beginTransaction(); try { for (ContentValues args : valuesArray) { args.put(Waypoints.SEGMENT, segmentId); long id = sqldb.insert(Waypoints.TABLE, null, args); if (id >= 0) { inserted++; } } sqldb.setTransactionSuccessful(); } finally { if (sqldb.inTransaction()) { sqldb.endTransaction(); } } return inserted; } /** * Creates a waypoint under the current track segment with the current time * on which the waypoint is reached * * @param track track * @param segment segment * @param latitude latitude * @param longitude longitude * @param time time * @param speed the measured speed * @return */ long insertWaypoint(long trackId, long segmentId, Location location) { if (trackId < 0 || segmentId < 0) { throw new IllegalArgumentException("Track and segments may not the less then 0."); } SQLiteDatabase sqldb = getWritableDatabase(); ContentValues args = new ContentValues(); args.put(WaypointsColumns.SEGMENT, segmentId); args.put(WaypointsColumns.TIME, location.getTime()); args.put(WaypointsColumns.LATITUDE, location.getLatitude()); args.put(WaypointsColumns.LONGITUDE, location.getLongitude()); args.put(WaypointsColumns.SPEED, location.getSpeed()); args.put(WaypointsColumns.ACCURACY, location.getAccuracy()); args.put(WaypointsColumns.ALTITUDE, location.getAltitude()); args.put(WaypointsColumns.BEARING, location.getBearing()); long waypointId = sqldb.insert(Waypoints.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints"); resolver.notifyChange(notifyUri, null); // Log.d( TAG, "Waypoint stored: "+notifyUri); return waypointId; } /** * Insert a URI for a given waypoint/segment/track in the media table * * @param trackId * @param segmentId * @param waypointId * @param mediaUri * @return */ long insertMedia(long trackId, long segmentId, long waypointId, String mediaUri) { if (trackId < 0 || segmentId < 0 || waypointId < 0) { throw new IllegalArgumentException("Track, segments and waypoint may not the less then 0."); } SQLiteDatabase sqldb = getWritableDatabase(); ContentValues args = new ContentValues(); args.put(MediaColumns.TRACK, trackId); args.put(MediaColumns.SEGMENT, segmentId); args.put(MediaColumns.WAYPOINT, waypointId); args.put(MediaColumns.URI, mediaUri); // Log.d( TAG, "Media stored in the datebase: "+mediaUri ); long mediaId = sqldb.insert(Media.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints/" + waypointId + "/media"); resolver.notifyChange(notifyUri, null); // Log.d( TAG, "Notify: "+notifyUri ); resolver.notifyChange(Media.CONTENT_URI, null); // Log.d( TAG, "Notify: "+Media.CONTENT_URI ); return mediaId; } /** * Insert a key/value pair as meta-data for a track and optionally narrow the * scope by segment or segment/waypoint * * @param trackId * @param segmentId * @param waypointId * @param key * @param value * @return */ long insertOrUpdateMetaData(long trackId, long segmentId, long waypointId, String key, String value) { long metaDataId = -1; if (trackId < 0 && key != null && value != null) { throw new IllegalArgumentException("Track, key and value must be provided"); } if (waypointId >= 0 && segmentId < 0) { throw new IllegalArgumentException("Waypoint must have segment"); } ContentValues args = new ContentValues(); args.put(MetaData.TRACK, trackId); args.put(MetaData.SEGMENT, segmentId); args.put(MetaData.WAYPOINT, waypointId); args.put(MetaData.KEY, key); args.put(MetaData.VALUE, value); String whereClause = MetaData.TRACK + " = ? AND " + MetaData.SEGMENT + " = ? AND " + MetaData.WAYPOINT + " = ? AND " + MetaData.KEY + " = ?"; String[] whereArgs = new String[] { Long.toString(trackId), Long.toString(segmentId), Long.toString(waypointId), key }; SQLiteDatabase sqldb = getWritableDatabase(); int updated = sqldb.update(MetaData.TABLE, args, whereClause, whereArgs); if (updated == 0) { metaDataId = sqldb.insert(MetaData.TABLE, null, args); } else { Cursor c = null; try { c = sqldb.query(MetaData.TABLE, new String[] { MetaData._ID }, whereClause, whereArgs, null, null, null); if( c.moveToFirst() ) { metaDataId = c.getLong(0); } } finally { if (c != null) { c.close(); } } } ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri; if (segmentId >= 0 && waypointId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints/" + waypointId + "/metadata"); } else if (segmentId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/metadata"); } else { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/metadata"); } resolver.notifyChange(notifyUri, null); resolver.notifyChange(MetaData.CONTENT_URI, null); return metaDataId; } /** * Deletes a single track and all underlying segments, waypoints, media and * metadata * * @param trackId * @return */ int deleteTrack(long trackId) { SQLiteDatabase sqldb = getWritableDatabase(); int affected = 0; Cursor cursor = null; long segmentId = -1; long metadataId = -1; try { sqldb.beginTransaction(); // Iterate on each segement to delete each cursor = sqldb.query(Segments.TABLE, new String[] { Segments._ID }, Segments.TRACK + "= ?", new String[] { String.valueOf(trackId) }, null, null, null, null); if (cursor.moveToFirst()) { do { segmentId = cursor.getLong(0); affected += deleteSegment(sqldb, trackId, segmentId); } while (cursor.moveToNext()); } else { Log.e(TAG, "Did not find the last active segment"); } // Delete the track affected += sqldb.delete(Tracks.TABLE, Tracks._ID + "= ?", new String[] { String.valueOf(trackId) }); // Delete remaining meta-data affected += sqldb.delete(MetaData.TABLE, MetaData.TRACK + "= ?", new String[] { String.valueOf(trackId) }); cursor = sqldb.query(MetaData.TABLE, new String[] { MetaData._ID }, MetaData.TRACK + "= ?", new String[] { String.valueOf(trackId) }, null, null, null, null); if (cursor.moveToFirst()) { do { metadataId = cursor.getLong(0); affected += deleteMetaData(metadataId); } while (cursor.moveToNext()); } sqldb.setTransactionSuccessful(); } finally { if (cursor != null) { cursor.close(); } if (sqldb.inTransaction()) { sqldb.endTransaction(); } } ContentResolver resolver = this.mContext.getContentResolver(); resolver.notifyChange(Tracks.CONTENT_URI, null); resolver.notifyChange(ContentUris.withAppendedId(Tracks.CONTENT_URI, trackId), null); return affected; } /** * @param mediaId * @return */ int deleteMedia(long mediaId) { SQLiteDatabase sqldb = getWritableDatabase(); Cursor cursor = null; long trackId = -1; long segmentId = -1; long waypointId = -1; try { cursor = sqldb.query(Media.TABLE, new String[] { Media.TRACK, Media.SEGMENT, Media.WAYPOINT }, Media._ID + "= ?", new String[] { String.valueOf(mediaId) }, null, null, null, null); if (cursor.moveToFirst()) { trackId = cursor.getLong(0); segmentId = cursor.getLong(0); waypointId = cursor.getLong(0); } else { Log.e(TAG, "Did not find the media element to delete"); } } finally { if (cursor != null) { cursor.close(); } } int affected = sqldb.delete(Media.TABLE, Media._ID + "= ?", new String[] { String.valueOf(mediaId) }); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints/" + waypointId + "/media"); resolver.notifyChange(notifyUri, null); notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/media"); resolver.notifyChange(notifyUri, null); notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/media"); resolver.notifyChange(notifyUri, null); resolver.notifyChange(ContentUris.withAppendedId(Media.CONTENT_URI, mediaId), null); return affected; } int deleteMetaData(long metadataId) { SQLiteDatabase sqldb = getWritableDatabase(); Cursor cursor = null; long trackId = -1; long segmentId = -1; long waypointId = -1; try { cursor = sqldb.query(MetaData.TABLE, new String[] { MetaData.TRACK, MetaData.SEGMENT, MetaData.WAYPOINT }, MetaData._ID + "= ?", new String[] { String.valueOf(metadataId) }, null, null, null, null); if (cursor.moveToFirst()) { trackId = cursor.getLong(0); segmentId = cursor.getLong(0); waypointId = cursor.getLong(0); } else { Log.e(TAG, "Did not find the media element to delete"); } } finally { if (cursor != null) { cursor.close(); } } int affected = sqldb.delete(MetaData.TABLE, MetaData._ID + "= ?", new String[] { String.valueOf(metadataId) }); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri; if (trackId >= 0 && segmentId >= 0 && waypointId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints/" + waypointId + "/media"); resolver.notifyChange(notifyUri, null); } if (trackId >= 0 && segmentId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/media"); resolver.notifyChange(notifyUri, null); } notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/media"); resolver.notifyChange(notifyUri, null); resolver.notifyChange(ContentUris.withAppendedId(Media.CONTENT_URI, metadataId), null); return affected; } /** * Delete a segment and all member waypoints * * @param sqldb The SQLiteDatabase in question * @param trackId The track id of this delete * @param segmentId The segment that needs deleting * @return */ int deleteSegment(SQLiteDatabase sqldb, long trackId, long segmentId) { int affected = sqldb.delete(Segments.TABLE, Segments._ID + "= ?", new String[] { String.valueOf(segmentId) }); // Delete all waypoints from segments affected += sqldb.delete(Waypoints.TABLE, Waypoints.SEGMENT + "= ?", new String[] { String.valueOf(segmentId) }); // Delete all media from segment affected += sqldb.delete(Media.TABLE, Media.TRACK + "= ? AND " + Media.SEGMENT + "= ?", new String[] { String.valueOf(trackId), String.valueOf(segmentId) }); // Delete meta-data affected += sqldb.delete(MetaData.TABLE, MetaData.TRACK + "= ? AND " + MetaData.SEGMENT + "= ?", new String[] { String.valueOf(trackId), String.valueOf(segmentId) }); ContentResolver resolver = this.mContext.getContentResolver(); resolver.notifyChange(Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId), null); resolver.notifyChange(Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments"), null); return affected; } int updateTrack(long trackId, String name) { int updates; String whereclause = Tracks._ID + " = " + trackId; ContentValues args = new ContentValues(); args.put(Tracks.NAME, name); // Execute the query. SQLiteDatabase mDb = getWritableDatabase(); updates = mDb.update(Tracks.TABLE, args, whereclause, null); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri = ContentUris.withAppendedId(Tracks.CONTENT_URI, trackId); resolver.notifyChange(notifyUri, null); return updates; } /** * Insert a key/value pair as meta-data for a track and optionally narrow the * scope by segment or segment/waypoint * * @param trackId * @param segmentId * @param waypointId * @param key * @param value * @return */ int updateMetaData(long trackId, long segmentId, long waypointId, long metadataId, String selection, String[] selectionArgs, String value) { { if ((metadataId < 0 && trackId < 0)) { throw new IllegalArgumentException("Track or meta-data id be provided"); } if (trackId >= 0 && (selection == null || !selection.contains("?") || selectionArgs.length != 1)) { throw new IllegalArgumentException("A where clause selection must be provided to select the correct KEY"); } if (trackId >= 0 && waypointId >= 0 && segmentId < 0) { throw new IllegalArgumentException("Waypoint must have segment"); } SQLiteDatabase sqldb = getWritableDatabase(); String[] whereParams; String whereclause; if (metadataId >= 0) { whereclause = MetaData._ID + " = ? "; whereParams = new String[] { Long.toString(metadataId) }; } else { whereclause = MetaData.TRACK + " = ? AND " + MetaData.SEGMENT + " = ? AND " + MetaData.WAYPOINT + " = ? AND " + MetaData.KEY + " = ? "; whereParams = new String[] { Long.toString(trackId), Long.toString(segmentId), Long.toString(waypointId), selectionArgs[0] }; } ContentValues args = new ContentValues(); args.put(MetaData.VALUE, value); int updates = sqldb.update(MetaData.TABLE, args, whereclause, whereParams); ContentResolver resolver = this.mContext.getContentResolver(); Uri notifyUri; if (trackId >= 0 && segmentId >= 0 && waypointId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/waypoints/" + waypointId + "/metadata"); } else if (trackId >= 0 && segmentId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments/" + segmentId + "/metadata"); } else if (trackId >= 0) { notifyUri = Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/metadata"); } else { notifyUri = Uri.withAppendedPath(MetaData.CONTENT_URI, "" + metadataId); } resolver.notifyChange(notifyUri, null); resolver.notifyChange(MetaData.CONTENT_URI, null); return updates; } } /** * Move to a fresh track with a new first segment for this track * * @return */ long toNextTrack(String name) { long currentTime = new Date().getTime(); ContentValues args = new ContentValues(); args.put(TracksColumns.NAME, name); args.put(TracksColumns.CREATION_TIME, currentTime); SQLiteDatabase sqldb = getWritableDatabase(); long trackId = sqldb.insert(Tracks.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); resolver.notifyChange(Tracks.CONTENT_URI, null); return trackId; } /** * Moves to a fresh segment to which waypoints can be connected * * @return */ long toNextSegment(long trackId) { SQLiteDatabase sqldb = getWritableDatabase(); ContentValues args = new ContentValues(); args.put(Segments.TRACK, trackId); long segmentId = sqldb.insert(Segments.TABLE, null, args); ContentResolver resolver = this.mContext.getContentResolver(); resolver.notifyChange(Uri.withAppendedPath(Tracks.CONTENT_URI, trackId + "/segments"), null); return segmentId; } }
zzy20080920-gps
OpenGPSTracker/application/src/nl/sogeti/android/gpstracker/db/DatabaseHelper.java
Java
gpl3
22,575
/*------------------------------------------------------------------------------ ** Ident: Sogeti Smart Mobile Solutions ** Author: rene ** Copyright: (c) Apr 24, 2011 Sogeti Nederland B.V. All Rights Reserved. **------------------------------------------------------------------------------ ** Sogeti Nederland B.V. | No part of this file may be reproduced ** Distributed Software Engineering | or transmitted in any form or by any ** Lange Dreef 17 | means, electronic or mechanical, for the ** 4131 NJ Vianen | purpose, without the express written ** The Netherlands | permission of the copyright holder. *------------------------------------------------------------------------------ * * This file is part of OpenGPSTracker. * * OpenGPSTracker is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenGPSTracker is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenGPSTracker. If not, see <http://www.gnu.org/licenses/>. * */ package nl.sogeti.android.gpstracker.db; import android.content.ContentUris; import android.net.Uri; import android.net.Uri.Builder; import android.provider.BaseColumns; /** * The GPStracking provider stores all static information about GPStracking. * * @version $Id$ * @author rene (c) Jan 22, 2009, Sogeti B.V. */ public final class GPStracking { /** The authority of this provider: nl.sogeti.android.gpstracker */ public static final String AUTHORITY = "nl.sogeti.android.gpstracker"; /** The content:// style Uri for this provider, content://nl.sogeti.android.gpstracker */ public static final Uri CONTENT_URI = Uri.parse( "content://" + GPStracking.AUTHORITY ); /** The name of the database file */ static final String DATABASE_NAME = "GPSLOG.db"; /** The version of the database schema */ static final int DATABASE_VERSION = 10; /** * This table contains tracks. * * @author rene */ public static final class Tracks extends TracksColumns implements android.provider.BaseColumns { /** The MIME type of a CONTENT_URI subdirectory of a single track. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.track"; /** The MIME type of CONTENT_URI providing a directory of tracks. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.track"; /** The content:// style URL for this provider, content://nl.sogeti.android.gpstracker/tracks */ public static final Uri CONTENT_URI = Uri.parse( "content://" + GPStracking.AUTHORITY + "/" + Tracks.TABLE ); /** The name of this table */ public static final String TABLE = "tracks"; static final String CREATE_STATEMENT = "CREATE TABLE " + Tracks.TABLE + "(" + " " + Tracks._ID + " " + Tracks._ID_TYPE + "," + " " + Tracks.NAME + " " + Tracks.NAME_TYPE + "," + " " + Tracks.CREATION_TIME + " " + Tracks.CREATION_TIME_TYPE + ");"; } /** * This table contains segments. * * @author rene */ public static final class Segments extends SegmentsColumns implements android.provider.BaseColumns { /** The MIME type of a CONTENT_URI subdirectory of a single segment. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.segment"; /** The MIME type of CONTENT_URI providing a directory of segments. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.segment"; /** The name of this table, segments */ public static final String TABLE = "segments"; static final String CREATE_STATMENT = "CREATE TABLE " + Segments.TABLE + "(" + " " + Segments._ID + " " + Segments._ID_TYPE + "," + " " + Segments.TRACK + " " + Segments.TRACK_TYPE + ");"; } /** * This table contains waypoints. * * @author rene */ public static final class Waypoints extends WaypointsColumns implements android.provider.BaseColumns { /** The MIME type of a CONTENT_URI subdirectory of a single waypoint. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.waypoint"; /** The MIME type of CONTENT_URI providing a directory of waypoints. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.waypoint"; /** The name of this table, waypoints */ public static final String TABLE = "waypoints"; static final String CREATE_STATEMENT = "CREATE TABLE " + Waypoints.TABLE + "(" + " " + BaseColumns._ID + " " + WaypointsColumns._ID_TYPE + "," + " " + WaypointsColumns.LATITUDE + " " + WaypointsColumns.LATITUDE_TYPE + "," + " " + WaypointsColumns.LONGITUDE + " " + WaypointsColumns.LONGITUDE_TYPE + "," + " " + WaypointsColumns.TIME + " " + WaypointsColumns.TIME_TYPE + "," + " " + WaypointsColumns.SPEED + " " + WaypointsColumns.SPEED + "," + " " + WaypointsColumns.SEGMENT + " " + WaypointsColumns.SEGMENT_TYPE + "," + " " + WaypointsColumns.ACCURACY + " " + WaypointsColumns.ACCURACY_TYPE + "," + " " + WaypointsColumns.ALTITUDE + " " + WaypointsColumns.ALTITUDE_TYPE + "," + " " + WaypointsColumns.BEARING + " " + WaypointsColumns.BEARING_TYPE + ");"; static final String[] UPGRADE_STATEMENT_7_TO_8 = { "ALTER TABLE " + Waypoints.TABLE + " ADD COLUMN " + WaypointsColumns.ACCURACY + " " + WaypointsColumns.ACCURACY_TYPE +";", "ALTER TABLE " + Waypoints.TABLE + " ADD COLUMN " + WaypointsColumns.ALTITUDE + " " + WaypointsColumns.ALTITUDE_TYPE +";", "ALTER TABLE " + Waypoints.TABLE + " ADD COLUMN " + WaypointsColumns.BEARING + " " + WaypointsColumns.BEARING_TYPE +";" }; /** * Build a waypoint Uri like: * content://nl.sogeti.android.gpstracker/tracks/2/segments/1/waypoints/52 * using the provided identifiers * * @param trackId * @param segmentId * @param waypointId * * @return */ public static Uri buildUri(long trackId, long segmentId, long waypointId) { Builder builder = Tracks.CONTENT_URI.buildUpon(); ContentUris.appendId(builder, trackId); builder.appendPath(Segments.TABLE); ContentUris.appendId(builder, segmentId); builder.appendPath(Waypoints.TABLE); ContentUris.appendId(builder, waypointId); return builder.build(); } } /** * This table contains media URI's. * * @author rene */ public static final class Media extends MediaColumns implements android.provider.BaseColumns { /** The MIME type of a CONTENT_URI subdirectory of a single media entry. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.media"; /** The MIME type of CONTENT_URI providing a directory of media entry. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.media"; /** The name of this table */ public static final String TABLE = "media"; static final String CREATE_STATEMENT = "CREATE TABLE " + Media.TABLE + "(" + " " + BaseColumns._ID + " " + MediaColumns._ID_TYPE + "," + " " + MediaColumns.TRACK + " " + MediaColumns.TRACK_TYPE + "," + " " + MediaColumns.SEGMENT + " " + MediaColumns.SEGMENT_TYPE + "," + " " + MediaColumns.WAYPOINT + " " + MediaColumns.WAYPOINT_TYPE + "," + " " + MediaColumns.URI + " " + MediaColumns.URI_TYPE + ");"; public static final Uri CONTENT_URI = Uri.parse( "content://" + GPStracking.AUTHORITY + "/" + Media.TABLE ); } /** * This table contains media URI's. * * @author rene */ public static final class MetaData extends MetaDataColumns implements android.provider.BaseColumns { /** The MIME type of a CONTENT_URI subdirectory of a single metadata entry. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.nl.sogeti.android.metadata"; /** The MIME type of CONTENT_URI providing a directory of media entry. */ public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.nl.sogeti.android.metadata"; /** The name of this table */ public static final String TABLE = "metadata"; static final String CREATE_STATEMENT = "CREATE TABLE " + MetaData.TABLE + "(" + " " + BaseColumns._ID + " " + MetaDataColumns._ID_TYPE + "," + " " + MetaDataColumns.TRACK + " " + MetaDataColumns.TRACK_TYPE + "," + " " + MetaDataColumns.SEGMENT + " " + MetaDataColumns.SEGMENT_TYPE + "," + " " + MetaDataColumns.WAYPOINT + " " + MetaDataColumns.WAYPOINT_TYPE + "," + " " + MetaDataColumns.KEY + " " + MetaDataColumns.KEY_TYPE + "," + " " + MetaDataColumns.VALUE + " " + MetaDataColumns.VALUE_TYPE + ");"; /** * content://nl.sogeti.android.gpstracker/metadata */ public static final Uri CONTENT_URI = Uri.parse( "content://" + GPStracking.AUTHORITY + "/" + MetaData.TABLE ); } /** * Columns from the tracks table. * * @author rene */ public static class TracksColumns { public static final String NAME = "name"; public static final String CREATION_TIME = "creationtime"; static final String CREATION_TIME_TYPE = "INTEGER NOT NULL"; static final String NAME_TYPE = "TEXT"; static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT"; } /** * Columns from the segments table. * * @author rene */ public static class SegmentsColumns { /** The track _id to which this segment belongs */ public static final String TRACK = "track"; static final String TRACK_TYPE = "INTEGER NOT NULL"; static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT"; } /** * Columns from the waypoints table. * * @author rene */ public static class WaypointsColumns { /** The latitude */ public static final String LATITUDE = "latitude"; /** The longitude */ public static final String LONGITUDE = "longitude"; /** The recorded time */ public static final String TIME = "time"; /** The speed in meters per second */ public static final String SPEED = "speed"; /** The segment _id to which this segment belongs */ public static final String SEGMENT = "tracksegment"; /** The accuracy of the fix */ public static final String ACCURACY = "accuracy"; /** The altitude */ public static final String ALTITUDE = "altitude"; /** the bearing of the fix */ public static final String BEARING = "bearing"; static final String LATITUDE_TYPE = "REAL NOT NULL"; static final String LONGITUDE_TYPE = "REAL NOT NULL"; static final String TIME_TYPE = "INTEGER NOT NULL"; static final String SPEED_TYPE = "REAL NOT NULL"; static final String SEGMENT_TYPE = "INTEGER NOT NULL"; static final String ACCURACY_TYPE = "REAL"; static final String ALTITUDE_TYPE = "REAL"; static final String BEARING_TYPE = "REAL"; static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT"; } /** * Columns from the media table. * * @author rene */ public static class MediaColumns { /** The track _id to which this segment belongs */ public static final String TRACK = "track"; static final String TRACK_TYPE = "INTEGER NOT NULL"; public static final String SEGMENT = "segment"; static final String SEGMENT_TYPE = "INTEGER NOT NULL"; public static final String WAYPOINT = "waypoint"; static final String WAYPOINT_TYPE = "INTEGER NOT NULL"; public static final String URI = "uri"; static final String URI_TYPE = "TEXT"; static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT"; } /** * Columns from the media table. * * @author rene */ public static class MetaDataColumns { /** The track _id to which this segment belongs */ public static final String TRACK = "track"; static final String TRACK_TYPE = "INTEGER NOT NULL"; public static final String SEGMENT = "segment"; static final String SEGMENT_TYPE = "INTEGER"; public static final String WAYPOINT = "waypoint"; static final String WAYPOINT_TYPE = "INTEGER"; public static final String KEY = "key"; static final String KEY_TYPE = "TEXT NOT NULL"; public static final String VALUE = "value"; static final String VALUE_TYPE = "TEXT NOT NULL"; static final String _ID_TYPE = "INTEGER PRIMARY KEY AUTOINCREMENT"; } }
zzy20080920-gps
OpenGPSTracker/application/src/nl/sogeti/android/gpstracker/db/GPStracking.java
Java
gpl3
13,886