/** * @param $tag * @param $result * @return unknown_type */ function ifUpdateCache($md5key) { if (file_exists($this->filepath)) { $dcache = L::config(null, $this->filename); $overtime = (int) ($dcache['_overtime'] + 60 * 10); $nowtime = PwStrtoTime(get_date(time(), "Y-m-d H:i:s")); if ($overtime <= $nowtime || $md5key != $dcache['_md5key']) { return true; } return false; } else { return true; } }
function _getHotArticle($type, $columnid, $num) { global $timestamp; $date = PwStrtoTime(get_date($timestamp, 'Y-m-d')); $tempDate = $type == 'hotday' ? 1 : 30; $date = $date - $tempDate * 86400; $datanalyseService = $this->_getDatanalyseService(); $_action = array(); foreach ($columnid as $value) { $_action[] = 'article_' . $value; } if (!$columnid) { $_action = $datanalyseService->getAllActions('article'); } return $datanalyseService->getHotArticleByAction('article', $_action, $num, $date); }
/** * 更新到pw_searchstatistic表中 */ function _updateDb() { $fileContent = $this->_getAllKeywords(); $data = s::isArray($fileContent) ? array_count_values($fileContent) : array(); $nowtime = PwStrtoTime(get_date($this->_timestamp, 'Y-m-d')); $sql = array(); foreach ($data as $key => $val) { $key = trim($this->_filterCheckKeyword($key)); if (!$key) { continue; } $sql[] = array($key, $val, $nowtime); } if (!$sql) { return false; } $this->_db->query("INSERT INTO pw_searchstatistic(keyword,num,created_time) VALUES " . S::sqlMulti($sql)); $deleteTime = $this->_timestamp - 86400 * 90; $this->_db->query("DELETE FROM pw_searchstatistic WHERE created_time < {$deleteTime}"); return true; }
function _setData() { $this->data['subject'] = S::escapeChar(S::getGP('act_subject', 'P')); $this->data['location'] = S::escapeChar(S::getGP('act_location', 'P')); $this->data['sexneed'] = intval(S::getGP('act_sex')); $act_starttime = S::escapeChar(S::getGP('act_starttime')); $act_deadline = S::escapeChar(S::getGP('act_deadline')); $act_endtime = S::escapeChar(S::getGP('act_endtime')); $act_num = intval(S::getGP('act_num')); $act_costs = intval(S::getGP('act_costs')); !($this->data['subject'] && $act_starttime && $act_deadline) && Showmsg('active_data_empty'); $act_starttime = PwStrtoTime($act_starttime); $act_endtime = PwStrtoTime($act_endtime); $act_deadline = PwStrtoTime($act_deadline); $act_num < 1 && ($act_num = 0); $act_costs < 1 && ($act_costs = 0); $this->data['starttime'] = $act_starttime; $this->data['deadline'] = $act_deadline; $this->data['endtime'] = $act_endtime; $this->data['num'] = $act_num; $this->data['costs'] = $act_costs; }
function _setData() { global $timestamp; $endtime = S::escapeChar(S::getGP('endtime')); $obtitle = S::escapeChar(S::getGP('obtitle')); $retitle = S::escapeChar(S::getGP('retitle')); $umpire = S::escapeChar(S::getGP('umpire')); $endtime = PwStrtoTime($endtime); $endtime < $timestamp && Showmsg('debate_time'); if (empty($obtitle) || empty($retitle)) { Showmsg('debate_notitle'); } elseif (strlen($obtitle) > 255 || strlen($retitle) > 255) { Showmsg('debate_titlelen'); } if ($umpire) { $umpireuid = $this->db->get_value("SELECT uid FROM pw_members WHERE username=" . S::sqlEscape($umpire)); empty($umpireuid) && Showmsg('debate_noumpire'); } $this->data['endtime'] = $endtime; $this->data['obtitle'] = $obtitle; $this->data['retitle'] = $retitle; $this->data['umpire'] = $umpire; $this->data['postdate'] = $timestamp; }
} $pagePosition = getPosition($articleModule->columnId, '', '', $cms_sitename); $columnService = C::loadClass('columnservice'); /* @var $columnService PW_columnService */ $columns = $columnService->getAllOrderColumns(0, $windid); $attach = initAttach($articleModule->attach); $postdate = get_date($articleModule->postDate); $atc_content = $articleModule->getPageContent($page); $articleModule->showError(); $pages = $articleModule->getPages($page, CMS_BASEURL . 'q=post&action=edit&id=' . $id . '&'); list($attachAllow, $imageAllow) = initFileTypeInfo($db_uploadfiletype); require_once M_P . 'require/header.php'; } else { S::gp(array('cms_subject', 'atc_content', 'cms_descrip'), 'P', 0); S::gp(array('cms_sourcetype', 'cms_sourceid', 'cid', 'cms_jumpurl', 'cms_author', 'cms_frominfo', 'cms_fromurl', 'cms_relate', 'flashatt', 'oldatt_desc', 'addnewpage', 'cms_timelimit')); $cms_timelimit = $cms_timelimit && (isGM($windid) || checkEditPurview($windid)) ? PwStrtoTime($cms_timelimit) : $timestamp; $cms_jumpurl = $cms_jumpurl && (isGM($windid) || checkEditPurview($windid)) ? $cms_jumpurl : ''; PostCheck(); $articleModule->setSubject($cms_subject); $articleModule->setContent($atc_content, $page); $articleModule->setDescrip($cms_descrip); $articleModule->setColumnId($cid); $articleModule->setJumpUrl($cms_jumpurl); $articleModule->setPostDate($cms_timelimit); $articleModule->setModifyDate($timestamp); $articleModule->setFromInfo($cms_frominfo); $articleModule->setFromUrl($cms_fromurl); $articleModule->setAuthor($cms_author); $articleModule->setUser($windid); $articleModule->setUserId($winduid); $articleModule->setRelate($cms_relate);
/** * 获取当日帖子 * @param $page * @param $perpage * @return unknown_type */ function _getTodayThreads($page, $perpage = 50) { $page = intval($page); $perpage = intval($perpage); if (1 > $page || 1 > $perpage) { return false; } $offset = ($page - 1) * $perpage; $posttime = PwStrtoTime(get_date($this->_timestamp, 'Y-m-d')); $threadsDao = $this->getThreadsDao(); if (!($total = $threadsDao->getThreadsCountByPostdate($posttime))) { return array(false, false); } $result = $threadsDao->getThreadsByPostdate($offset, $perpage, $posttime); return array($total, $this->_buildThreads($result, array())); }
/** * 处理日期 * * @param string $day 'Y-m-d' * @return int */ function _getdate($day) { $this->day = $day == null ? get_date($GLOBALS['timestamp'], 'Y-m-d') : get_date(PwStrtoTime($day), 'Y-m-d'); }
Showmsg('illegal_customimg'); } $proicon = $httpurl[0]; $httpurl[1] = ''; $httpurl[2] = ''; $httpurl[3] = (int) $httpurl[3]; $httpurl[4] = (int) $httpurl[4]; list($user_a[2], $user_a[3]) = flexlen($httpurl[1], $httpurl[2], $httpurl[3], $httpurl[4]); $usericon = setIcon($proicon, $facetype, $user_a); unset($httpurl); } pwFtpClose($ftp); $usericon && ($upmembers['icon'] = $usericon); $bday = $year . "-" . $month . "-" . $day; //$rvrc*=10; $regdate = PwStrtoTime($regdate); if ($oldinfo['username'] != stripcslashes($username)) { if (!$username) { Showmsg('username_empty'); } if (strlen($username) > 15) { adminmsg('用户名长度不能大于15个字符'); } $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $isUsernameExist = $userService->getUserIdByUserName($username); if ($isUsernameExist > 0) { adminmsg('username_exists'); } $uc_edit['username'] = $username; }
function attachcheck($file) { global $cache_file, $attachdir, $admin_pwd, $filename, $filesize, $ifless, $postdate1, $postdate2, $direct, $attachdir; if ($filename && strpos($file, $filename) === false) { return; } if ($filesize) { if ($ifless && filesize("{$attachdir}/{$file}") >= $filesize * 1024) { return; } elseif (!$ifless && filesize("{$attachdir}/{$file}") <= $filesize * 1024) { return; } } if ($postdate1) { $visittime = PwStrtoTime($postdate1); if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") < $visittime) { return; } } if ($postdate2) { $visittime = PwStrtoTime($postdate2); if (is_numeric($visittime) && fileatime("{$attachdir}/{$file}") > $visittime) { return; } } if ($_POST['direct']) { P_unlink("{$attachdir}/{$file}"); P_unlink("{$attachdir}/thumb/{$file}"); } else { strlen($file) > 49 && ($file = substr($file, 0, 49)); writeover($cache_file, str_pad($file, 49) . "\n", "ab"); //* pwCache::setData($cache_file,str_pad($file,49)."\n", false, "ab"); } }
$a = 'toptopic'; require_once PrintEot('m_ajax'); footer(); } else { if (is_numeric($seltid)) { ${'topped_' . intval($threaddb[$seltid]['topped'])} = 'checked'; } require_once PrintEot('m_topicadmin'); footer(); } } else { S::gp(array('ifmsg', 'timelimit')); PostCheck(); is_null($topped) && Showmsg('mawhole_notopped'); $msgdb = $logdb = array(); $timelimit = PwStrtoTime($timelimit); $toolfield = $timelimit > $timestamp && $topped ? $timelimit : ''; $query = $db->query("SELECT t.tid,t.fid,t.postdate,t.author,t.authorid,t.subject,a.topped,a.toolfield FROM pw_threads t LEFT JOIN pw_argument a ON t.tid=a.tid WHERE t.tid IN(" . S::sqlImplode($selids) . ")"); $tid_fid = array(); while ($rt = $db->fetch_array($query)) { $tid_fid[$rt['tid']] = $rt['fid']; if ($topped && $topped != $rt['topped']) { if ($ifmsg) { $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'top_title'), 'content' => getLangInfo('writemsg', 'top_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content)))); } $logdb[] = array('type' => 'topped', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $tid, 'field3' => '', 'descrip' => 'topped_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'topped' => $topped, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content)); } elseif ($rt['topped'] && !$topped) { if ($ifmsg) { $msgdb[] = array('toUser' => $rt['author'], 'title' => getLangInfo('writemsg', 'untop_title'), 'content' => getLangInfo('writemsg', 'untop_content', array('manager' => $windid, 'fid' => $fid, 'tid' => $rt['tid'], 'subject' => $rt['subject'], 'postdate' => get_date($rt['postdate']), 'forum' => strip_tags($forum[$fid]['name']), 'admindate' => get_date($timestamp), 'reason' => stripslashes($atc_content)))); } $logdb[] = array('type' => 'topped', 'username1' => $rt['author'], 'username2' => $windid, 'field1' => $fid, 'field2' => $rt['tid'], 'field3' => '', 'descrip' => 'untopped_descrip', 'timestamp' => $timestamp, 'ip' => $onlineip, 'tid' => $rt['tid'], 'subject' => substrs($rt['subject'], 28), 'forum' => $forum[$fid]['name'], 'reason' => stripslashes($atc_content));
adminmsg('advert_flash_error'); } if ($config['type'] == 'flash') { $config['width'] = $config['width'] == "" ? "120" : $config['width']; $config['height'] = $config['height'] == "" ? "120" : $config['height']; } if (empty($advert['descrip'])) { if ($config['type'] == 'code') { $advert['descrip'] = substrs(strip_tags($config['htmlcode']), 250); } elseif ($config['type'] == 'txt') { $advert['descrip'] = substrs($config['title'], 250); } empty($advert['descrip']) && ($basename = "javascript:history.go(-1);" && adminmsg('advert_descrip')); } $advert['stime'] = PwStrtoTime($advert['stime']); $advert['etime'] = PwStrtoTime($advert['etime']) + 86399; if ($advert['stime'] > $advert['etime']) { $basename = "javascript:history.go(-1);"; adminmsg('advert_time_error'); } $config['ddate'] = $config['dweek'] = $config['dtime'] = ''; if (is_array($ddate)) { $config['ddate'] = implode(',', $ddate); } if (is_array($dweek)) { $config['dweek'] = implode(',', $dweek); } if (is_array($dtime) && count($dtime) < 24) { $config['dtime'] = implode(',', $dtime); } $advert['orderby'] = (int) $advert['orderby'];
/** * 生成字段保存于数据库的值 * @param string $fieldType 字段类型 * @param mix $data 值 * @return string 保存于数据库的值 */ function getValueForDb($fieldType, $data) { $returnValue = $data; switch ($fieldType) { case 'number': case 'range': break; case 'text': case 'textarea': break; case 'radio': //radio和select使用同一方法 //radio和select使用同一方法 case 'select': $returnValue = (int) $data; break; case 'checkbox': $returnValue = ''; foreach ($data as $selection) { $returnValue .= (int) $selection . ','; } break; case 'calendar': $returnValue = PwStrtoTime($data); break; case 'email': case 'url': case 'img': case 'upload': default: break; } return $returnValue; }
$online = 'no'; } else { $db_online = intval($db_online); include_once Pcv(R_P . "require/online_{$db_online}.php"); } } Cookie('online', $online); } $usertotal = $guestinbbs + $userinbbs; $showgroup = $db_showgroup ? explode(',', $db_showgroup) : array(); // Share union if ($db_indexmqshare && $sharelink[1]) { $sharelink[1] = "<marquee scrolldelay=\"100\" scrollamount=\"4\" onmouseout=\"if (document.all!=null){this.start()}\" onmouseover=\"if (document.all!=null){this.stop()}\" behavior=\"alternate\">{$sharelink['1']}</marquee>"; } //update pw_feed if ($winduid && PwStrtoTime(get_date($lastvisit, 'Y-m-d')) < $tdtime && $db_hostweb == 1 && !$cateid && $groupid != 'guest' && !defined('M_P')) { $_flag = $db->get_value("SELECT id FROM pw_feed WHERE uid = " . pwEscape($winduid) . " ORDER BY id DESC LIMIT 29,1"); $_flag && $db->update("DELETE FROM pw_feed WHERE uid = " . pwEscape($winduid) . " AND id < " . pwEscape($_flag)); } if ($tdtcontrol < $tdtime && $db_hostweb == 1 && !$cateid && $groupid != 'guest' && !defined('M_P')) { require_once R_P . 'require/updateforum.php'; updateshortcut(); $db->update("UPDATE pw_bbsinfo SET" . pwSqlSingle(array('yposts' => $tposts, 'tdtcontrol' => $tdtime, 'o_tpost' => 0)) . "WHERE id='1'"); $db->update("UPDATE pw_forumdata SET tpost=0 WHERE tpost<>'0'"); // $db->update("DELETE FROM pw_feed WHERE timestamp<".pwEscape($tdtime - 604800)); } // update posts hits if ($c_htm || $db_hithour) { $db_hithour == 0 && ($db_hithour = 4); $hit_wtime = $hit_control * $db_hithour; $hit_wtime > 24 && ($hit_wtime = 0);
/** * 开始时间是否早于结束时间 * @param string $start 开始时间,如'2010-04-09 11:00:00' * @param string $end 结束时间,如'2010-04-09 12:00:00' * @access protected * @return bool 时间是否有效 */ function _isValidStartAndEndTime($start, $end) { if ($this->getCalendarError($start) || $this->getCalendarError($end)) { return false; } else { $startTimestamp = PwStrtoTime($start); $endTimestamp = PwStrtoTime($end); if ($startTimestamp > $endTimestamp) { return false; } else { return true; } } }
//管理列表 S::gp(array('username', 'starttime', 'endtime')); S::gp(array('fid', 'status'), 'gp', 2); $forumcache = getSelectedForumCache($fid); $params = array(); $status > 0 && ($params['status'] = $status); $fid > 0 && ($params['fid'] = $fid); if ($username) { $userService = L::loadClass('userservice', 'user'); /* @var $userService PW_UserService */ $userInfo = $userService->getByUserName($username); $userInfo && ($params['uid'] = $userInfo['uid']); } if ($starttime && $endtime) { $params['starttime'] = PwStrtoTime($starttime); $params['endtime'] = PwStrtoTime($endtime) + 86400; } //get data $count = (int) $kmdService->countKmdInfosWithCondition($params); if ($count) { $kmdInfos = $kmdService->getKmdInfosWithCondition($params, $offset, $pagesize); } $pages = numofpage($count, $page, ceil($count / $pagesize), "{$basename}&username={$username}&fid={$fid}&starttime={$starttime}&endtime={$endtime}&"); require_once PrintApp('set'); } } else { if ($adminitem == 'usermanage') { //用户管理 S::gp(array('username')); $params = array(); if ($username) {
if ($query['uid']) { $where[] = "uid=" . pwEscape($query['uid'], false); } if ($query['keyword']) { $where[] = "subject LIKE " . pwEscape('%' . $query['keyword'] . '%', false); } if (isset($query['imgsrc'])) { if ($query['imgsrc']) { $where[] = "imgsrc!=''"; } else { $where[] = "imgsrc=''"; } } if ($query['stime']) { if (!is_numeric($query['stime'])) { $query['stime'] = PwStrtoTime($query['stime']); } $where[] = "stime>" . pwEscape($query['stime'], false); } $where = $where ? ' WHERE ' . implode(' AND ', $where) : ''; $page = getGP('page'); (!is_numeric($page) || $page < 1) && ($page = 1); $limit = pwLimit(($page - 1) * $db_perpage, $db_perpage); $count = $db->get_value("SELECT COUNT(*) FROM pw_pushdata WHERE {$where}"); $pages = numofpage($count, $page, ceil($count / $db_perpage), "{$basename}&query=" . base64_encode(serialize($query)) . '&'); $rs = $db->query("SELECT * FROM pw_pushdata {$where} ORDER BY id DESC {$limit}"); while ($rt = $db->fetch_array($rs)) { $pushdata[] = $rt; } include PrintEot('pushdata'); exit;
} elseif ($by == 2) { S::gp(array('starttime', 'endtime'), 'P'); $stime = PwStrtoTime($starttime); $etime = PwStrtoTime($endtime); if ($stime > $etime) { $tmp = $etime; $etime = $stime; $stime = $tmp; } $pwSendmail['info'] = array('stime' => $stime, 'etime' => $etime); $pwSendmail['count'] = $db->get_value("SELECT COUNT(*) FROM pw_members WHERE regdate BETWEEN" . S::sqlEscape($stime) . "AND" . S::sqlEscape($etime)); } elseif ($by == 3) { //增加按最后登录时间发送邮件@modify panjl@2010-11-3 S::gp(array('loginstarttime', 'loginendtime'), 'P'); $lostime = PwStrtoTime($loginstarttime); $loetime = PwStrtoTime($loginendtime); if ($lostime > $loetime) { $lotmp = $loetime; $loetime = $lostime; $lostime = $lotmp; } $pwSendmail['info'] = array('lostime' => $lostime, 'loetime' => $loetime); $pwSendmail['count'] = $db->get_value("SELECT COUNT(*) FROM pw_memberdata WHERE lastvisit BETWEEN" . S::sqlEscape($lostime) . "AND" . S::sqlEscape($loetime)); } elseif ($by == 4) { //增加输入用户名发送邮件@modify panjl@2010-11-3 S::gp(array('touser'), 'P'); !$touser && adminmsg('operate_error'); $userService = L::loadClass('UserService', 'user'); $to_a_temp = explode(',', $touser); $to_a = $to_a_err = array(); foreach ($to_a_temp as $value) {
/** * 热门点击排行 * * @param string $type * @param string $fid * @param int $num * @param int $special * @return array */ function hitSortInterface($type = 'hitsort', $fid = 0, $num = 0, $special = 0) { !$type && ($type = 'hitsort'); !in_array($type, array('hitsort', 'hitsortday', 'hitsortweek')) && Showmsg('undefined_action'); $num = intval($num) ? intval($num) : $this->defaultnum; $fid = $this->_cookFid($fid); if ($type == 'hitsort' && $this->ifpwcache & 16 || $type == 'hitsortday' && $this->ifpwcache & 32 || $type == 'hitsortweek' && $this->ifpwcache & 64) { $sqladd = ''; $sort = array(); $fid && ($sqladd .= " AND e.mark IN ({$fid}) "); if ($type == 'hitsortday') { $dayTime = PwStrtoTime(get_date(time(), 'Ymd')); $sqladd .= " AND t.postdate >= {$dayTime}"; } $query = $this->db->query("SELECT t.tid,t.fid,t.author,t.authorid,t.subject,t.type,t.postdate,t.hits,t.replies,t.lastpost FROM pw_elements e LEFT JOIN pw_threads t ON e.id=t.tid WHERE e.type=" . S::sqlEscape($type) . " {$sqladd} AND t.ifshield != 1 AND t.locked != 2 ORDER BY t.hits DESC " . S::sqlLimit($num)); while ($rt = $this->db->fetch_array($query)) { if (!$rt['tid']) { continue; } $post = array(); $post['url'] = 'read.php?tid=' . $rt['tid']; $post['title'] = $rt['subject']; $post['value'] = $rt['hits']; $post['image'] = ''; $post['authorurl'] = 'u.php?uid=' . $rt['authorid']; $post['forumname'] = getForumName($rt['fid']); $post['forumurl'] = getForumUrl($rt['fid']); list($post['topictypename'], $post['topictypeurl']) = getTopicType($rt['type'], $rt['fid']); $post['addition'] = $rt; $sort[] = $post; } } else { $info = $this->singLeton(true, $num); switch ($type) { case 'hitsort': $time = 0; break; case 'hitsortday': $time = 24; break; case 'hitsortweek': $time = 7 * 24; break; default: $time = 0; } $sort = $info->getPostList('hitsort', $fid, $info->cachenum, $time); } return $sort; }
$keyword = trim($keyword); $keywordarray = explode(",", $keyword); foreach ($keywordarray as $value) { $value = str_replace('*', '%', $value); $keywhere .= 'OR'; $keywhere .= " d.content LIKE " . S::sqlEscape("%{$value}%") . "OR d.subject LIKE " . S::sqlEscape("%{$value}%"); } $keywhere = substr_replace($keywhere, "", 0, 3); $sql .= " AND ({$keywhere}) "; } if ($postdate_s) { $date1 = PwStrtoTime($postdate_s); $sql .= " AND d.postdate>" . S::sqlEscape($date1); } if ($postdate_e) { $date2 = PwStrtoTime($postdate_e) + 86400; $sql .= " AND d.postdate<" . S::sqlEscape($date2); } $hits && ($sql .= " AND d.r_num<" . S::sqlEscape($hits)); $replies && ($sql .= " AND d.c_num<" . S::sqlEscape($replies)); if ($tcounts) { $sql .= " AND char_length(d.content)>" . S::sqlEscape($tcounts); } elseif ($counts) { $sql .= " AND char_length(d.content)<" . S::sqlEscape($counts); } $sc != 'asc' && ($sc = 'desc'); $order = " ORDER BY d.postdate {$sc}"; (int) $page < 1 && ($page = 1); $limit = S::sqlLimit(($page - 1) * $perpage, $perpage); $query = $db->query("SELECT d.* FROM pw_diary d LEFT JOIN pw_members m ON d.uid=m.uid {$sql} {$order} {$by} {$limit}"); while ($rt = $db->fetch_array($query)) {
InitGP(array('username', 'starttime', 'endtime', 't_type')); $sql = $url_a = ''; if ($db_plist && count($db_plist) > 1) { !is_numeric($ptable) && ($ptable = $db_ptable); foreach ($db_plist as $key => $val) { $name = $val ? $val : ($key != 0 ? getLangInfo('other', 'posttable') . $key : getLangInfo('other', 'posttable')); $p_table .= "<option value=\"{$key}\">" . $name . "</option>"; } $p_table = str_replace("<option value=\"{$ptable}\">", "<option value=\"{$ptable}\" selected>", $p_table); $url_a .= "ptable={$ptable}&"; $pw_posts = GetPtable($ptable); } else { $pw_posts = 'pw_posts'; } $starttime && ($starttime = PwStrtoTime($starttime)); $endtime && ($endtime = PwStrtoTime($endtime)); if ($username) { $sql .= ' AND p.author=' . pwEscape($username); $url_a .= "username="******"&"; } if ($starttime) { $sql .= ' AND p.postdate>' . pwEscape($starttime); $url_a .= "starttime={$starttime}&"; } if ($endtime) { $sql .= ' AND p.postdate<' . pwEscape($endtime); $url_a .= "endtime={$endtime}&"; } if ($t_type) { switch ($t_type) { case 'digest':
$tucoolForums = $forumService->getTucoolForums(); $tucoolForumsHtml = getTucoolForumsHtml($tucoolForums); S::gp(array('action')); if (empty($action)) { S::gp(array('starttime', 'endtime', 'fids')); $starttime = $starttime ? $starttime : get_date(PwStrtoTime('-1 month'), 'Y-m-d'); $endtime = $endtime ? $endtime : get_date($timestamp, 'Y-m-d'); include PrintEot('tucool'); } elseif ($action == 'process') { @set_time_limit(300); S::gp(array('starttime', 'endtime', 'fids', 'step', 'totalNums', 'offset', 'haveBuild')); if (!$fids && !$step) { adminmsg('请先选择需要生成的图酷版块', $basename); } $startTime = $starttime && !is_numeric($starttime) ? PwStrtoTime($starttime) : $starttime; $endTime = $endtime && !is_numeric($endtime) ? PwStrtoTime($endtime) : $endtime; if (!$starttime || !$endtime || $startTime > $endTime) { adminmsg('时间范围输入有误', $basename); } $stepSize = 2; if (!$step) { $step = $offset = 0; $endTime = $endTime + 86400; foreach ($fids as $fid) { $fid = intval($fid); if ($fid < 1) { continue; } } } else { $fids = trim($fids);
$messageServer = L::loadClass('message', 'message'); if (empty($action)) { include PrintEot('superdel'); exit; } elseif ($action == 'del') { S::gp(array('stime', 'etime', 'fromuser', 'keyword', 'lines', 'direct', 'page')); if (!empty($fromuser)) { $userService = L::loadClass('UserService', 'user'); /* @var $userService PW_UserService */ $userdb = $userService->getByUserName($fromuser); empty($userdb) && adminmsg('输入的用户不存在'); } $lines && ($lines = intval($lines)); $page = intval($page) ? intval($page) : 1; $stime && !is_numeric($stime) && ($stime = PwStrtoTime($stime)); $etime && !is_numeric($etime) && ($etime = PwStrtoTime($etime)); $url = $basename . "&action=del&stime=" . $stime . "&etime=" . $etime . "&fromuser={$fromuser}&lines={$lines}&keyword=" . rawurlencode($keyword) . "&"; if (empty($_POST['step'])) { !$lines && ($lines = $db_perpage); $etime < $stime && adminmsg('开始时间需要小于结束时间'); list($searchCount, $searchList) = $messageServer->manageMessage($keyword, $stime, $etime, $fromuser, $direct, $page, $lines); $totalPages = ceil($searchCount / $lines); $page = $page < 0 ? 1 : ($page > $totalPages ? $totalPages : $page); $pages = numofpage($searchCount, $page, $totalPages, "{$url}"); if ($direct) { adminmsg('operate_success'); } else { include PrintEot('superdel'); exit; } }
/** * 根据生日找出好友列表服务 * * @param int $uid 用户uid * @param int $nums 排序个数 * @param int $page 起始数 * @param int $perpage 查找个数 * @return array */ function findUserFriendsBirthdayInPage($uid, $nums = 3, $page = 1, $perpage = 25) { global $timestamp; $uid = intval($uid); if (!$uid) { return null; } $page = intval($page); $perpage = intval($perpage); if ($page <= 0 || $perpage <= 0) { return array(); } $offset = ($page - 1) * $perpage; $birthdayInfo = array(); $query = $this->_db->query("SELECT m.uid,m.username,m.bday,m.icon as face " . " FROM pw_friends f" . " LEFT JOIN pw_members m ON f.friendid=m.uid" . " WHERE DAYOFYEAR( m.bday ) - DAYOFYEAR(CURDATE()) between 0 and 2 AND f.uid=" . S::sqlEscape($uid) . " AND f.status=0 " . $sqlAdd . S::sqlLimit($offset, $perpage)); while ($rt = $this->_db->fetch_array($query)) { $bday = get_date(PwStrtoTime($rt['bday']), 'm-d'); $nowday = get_date($timestamp, 'm-d'); if ($bday >= $nowday) { $birthdayInfo[] = $rt; } } return $this->getBirthdaysByFriends($birthdayInfo, $nums); }
$addsql = ''; if ($keyword) { $keyword = trim($keyword); $keywordarray = explode(",", $keyword); foreach ($keywordarray as $value) { $value = str_replace('*', '%', $value); $keywhere .= " OR keyword LIKE " . S::sqlEscape("%{$value}%"); } $keywhere = substr_replace($keywhere, "", 0, 3); $addsql .= " AND ({$keywhere}) "; } if ($createtime_s) { $addsql .= " AND created_time >= " . s::sqlEscape(PwStrtoTime($createtime_s)); } if ($createtime_e) { $addsql .= " AND created_time <= " . s::sqlEscape(PwStrtoTime($createtime_e)); } $statisticDb = array(); $sql = "SELECT keyword, sum( num ) AS times FROM `pw_searchstatistic` WHERE 1 {$addsql} GROUP BY keyword ORDER BY times DESC LIMIT 0 , 500"; $qurey = $db->query($sql); while ($rt = $db->fetch_array($qurey)) { $rt['keyword'] = str_replace(array(" ", "=", " ", "<", "<", ">", ">", "(", ")", ")"), array(" "), $rt['keyword']); $statisticDb[] = $rt; } } include PrintEot('searcher'); exit; /** * 更新缓存 */ function updatecache_search()
$updatecache = true; } } $updatecache && updatecache_conf('o', true); adminmsg('operate_success'); } } elseif ($action == 'share') { if (empty($job)) { require_once PrintApp('share'); } elseif ($job == 'list') { InitGP(array('type', 'ifhidden', 'username', 'postdate_s', 'postdate_e', 'ordertype', 'page', 'lines')); if (empty($type) && empty($username) && empty($postdate_s) && empty($postdate_e)) { adminmsg('noenough_condition', "{$basename}&action=share"); } $postdate_s && !is_numeric($postdate_s) && ($postdate_s = PwStrtoTime($postdate_s)); $postdate_e && !is_numeric($postdate_e) && ($postdate_e = PwStrtoTime($postdate_e)); $sql = $urladd = ''; if ($type) { $sql .= $sql ? ' AND' : ''; $sql .= ' type=' . pwEscape($type); $urladd .= '&type=' . $type; } if ($ifhidden != -1) { $sql .= $sql ? ' AND' : ''; $sql .= ' ifhidden=' . pwEscape($ifhidden); $urladd .= '&ifhidden=' . $ifhidden; } if ($username) { $username = str_replace('*', '%', $username); $sql .= $sql ? ' AND' : ''; $sql .= ' username LIKE ' . pwEscape($username);
} if ($bantype) { $sql .= " AND b.type=" . pwEscape($bantype); $url .= "&bantype={$bantype}"; } if ($adminban) { $sql .= " AND b.admin=" . pwEscape($adminban); $url .= "&adminban=" . rawurlencode($adminban); } if ($starttime) { !is_numeric($starttime) && ($starttime = PwStrtoTime($starttime)); $sql .= " AND b.startdate>" . pwEscape($starttime); $url .= "&starttime={$starttime}"; } if ($endtime) { !is_numeric($endtime) && ($endtime = PwStrtoTime($endtime)); $sql .= " AND b.startdate<" . pwEscape($endtime); $url .= "&endtime={$endtime}"; } if ($count < 1) { @extract($db->get_one("SELECT COUNT(*) AS count FROM pw_banuser b {$sql}")); } $pages = numofpage($rt['sum'], $page, ceil($count / $db_perpage), "{$url}&"); $bandb = $ids = $uids1 = $uids2 = array(); $query = $db->query("SELECT b.*, m.username FROM pw_banuser b LEFT JOIN pw_members m ON b.uid=m.uid {$sql} ORDER BY b.uid DESC {$limit}"); while ($rt = $db->fetch_array($query)) { if ($rt['type'] == 1 && $timestamp - $rt['startdate'] > $rt['days'] * 86400) { $ids[] = $rt['id']; if ($rt['fid']) { $uids2[] = $rt['uid']; } else {
function getSearchvalue($field, $type, $alltidtype = false, $backtype = false) { /*获取搜索结果*/ global $db_perpage, $page, $modelid, $fid, $basename; $field = unserialize(StrCode($field, 'DECODE')); $sqladd = ''; $fid && ($sqladd .= " fid=" . S::sqlEscape($fid)); $fielddb = postTopic::getFieldData($modelid, $type); foreach ($field as $key => $value) { if ($value) { if (in_array($fielddb[$key]['type'], array('number', 'radio', 'select'))) { $sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . "=" . S::sqlEscape($value) : $fielddb[$key]['fieldname'] . "=" . S::sqlEscape($value); } elseif ($fielddb[$key]['type'] == 'checkbox') { $checkboxs = ''; foreach ($value as $cv) { $checkboxs .= $checkboxs ? ',' . $cv : $cv; } $value = '%,' . $checkboxs . ',%'; $sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . " LIKE(" . S::sqlEscape($value) . ")" : $fielddb[$key]['fieldname'] . " LIKE(" . S::sqlEscape($value) . ")"; } elseif ($fielddb[$key]['type'] == 'calendar' && ($value['start'] || $value['end'])) { $value['start'] && ($value['start'] = PwStrtoTime($value['start'])); $value['end'] && ($value['end'] = PwStrtoTime($value['end'])); if ($value['start'] > $value['end'] && $value['start'] && $value['end']) { Showmsg('calendar_error'); } $sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . ">=" . S::sqlEscape($value['start']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . S::sqlEscape($value['end']) : $fielddb[$key]['fieldname'] . ">=" . S::sqlEscape($value['start']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . S::sqlEscape($value['end']); } elseif (in_array($fielddb[$key]['type'], array('text', 'url', 'email', 'textarea'))) { $value = '%' . $value . '%'; $sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . " LIKE(" . S::sqlEscape($value) . ")" : $fielddb[$key]['fieldname'] . " LIKE(" . S::sqlEscape($value) . ")"; } elseif ($fielddb[$key]['type'] == 'range' && $value['min'] && $value['max']) { $sqladd .= $sqladd ? " AND " . $fielddb[$key]['fieldname'] . ">=" . S::sqlEscape($value['min']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . S::sqlEscape($value['max']) : $fielddb[$key]['fieldname'] . ">=" . S::sqlEscape($value['min']) . " AND " . $fielddb[$key]['fieldname'] . "<=" . S::sqlEscape($value['max']); } else { $sqladd .= ''; } } } if ($sqladd) { !$page && ($page = 1); $start = ($page - 1) * $db_perpage; $limit = S::sqlLimit($start, $db_perpage); $tablename = GetTopcitable($modelid); $sqladd .= $sqladd ? " AND ifrecycle=0" : " ifrecycle=0"; $count = $this->db->get_value("SELECT COUNT(*) as count FROM {$tablename} WHERE {$sqladd}"); $query = $this->db->query("SELECT tid FROM {$tablename} WHERE {$sqladd} {$limit}"); while ($rt = $this->db->fetch_array($query)) { $tiddb[] = $rt['tid']; } if ($alltidtype) { $query = $this->db->query("SELECT tid FROM {$tablename} WHERE {$sqladd}"); while ($rt = $this->db->fetch_array($query)) { $alltiddb[] = $rt['tid']; } } !$count && ($count = -1); } else { if ($backtype) { adminmsg('topic_search_none', "{$basename}&action=topic&modelid={$modelid}"); } Showmsg('topic_search_none'); } return array($count, $tiddb, $alltiddb); }
$basename = "javascript:history.go(-1);"; adminmsg('advert_txt_error'); } $config['title'] = str_replace(array('<', '>'), array('<', '>'), $config['title']); } elseif ($config['type'] == 'img' && (!$config['url'] || !$config['link'])) { $basename = "javascript:history.go(-1);"; adminmsg('advert_img_error'); } if (empty($advert['descrip'])) { if ($config['type'] == 'txt') { $advert['descrip'] = substrs($config['title'], 250); } empty($advert['descrip']) && ($basename = "javascript:history.go(-1);" && adminmsg('advert_descrip')); } $advert['stime'] = PwStrtoTime($advert['stime']); $advert['etime'] = PwStrtoTime($advert['etime']); if ($advert['stime'] > $advert['etime']) { $basename = "javascript:history.go(-1);"; adminmsg('advert_time_error'); } $advert['orderby'] = (int) $advert['orderby']; $advert['ifshow'] = $advert['ifshow'] ? 1 : 0; if (is_array($fids) && !in_array('-1', $fids)) { $config['fid'] = implode(',', $fids); } if (is_array($pages) && !in_array('page', $pages)) { $config['page'] = implode(',', $pages); } foreach ($config as $key => $value) { if ($config['type'] == 'img' && in_array($key, array('url', 'link'))) { $tmp = array();
/** * get user sort * $type must in array('money','rvrc','credit','currency','todaypost','monthpost','postnum','monoltime','onlinetime','digests') * or is_numeric and must in $GLOBALS['_CREDITDB'] * * @param string or int $type * @param int $num * @return array */ function userSort($type, $num) { global $db_uidblacklist; $ifOverflow = 0; $marktype = $this->_getUserMark(); if (!in_array($type, $marktype) && !is_numeric($type)) { return false; } $num = (int) $num; !$num && ($num = $this->cachenum); $this->reality == true && (require_once R_P . 'require/showimg.php'); $sqladd = $this->_getBlackList('md.uid', $db_uidblacklist); if (in_array($type, array('postnum', 'onlinetime', 'rvrc', 'money', 'credit', 'currency', 'digests'))) { if ($this->reality == false) { $sql = "SELECT md.uid as id,md.{$type} as value,m.username as addition FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.postnum>0{$sqladd} ORDER BY md.{$type} DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.{$type} as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.postnum>0{$sqladd} ORDER BY md.{$type} DESC " . S::sqlLimit($num); } } elseif ($type == 'f_num') { if ($this->reality == false) { $sql = "SELECT md.uid AS id, COUNT(*) AS value, m.username AS addition FROM pw_friends md LEFT JOIN pw_members m USING(uid) WHERE 1{$sqladd} GROUP BY md.uid ORDER BY value DESC" . S::sqlLimit($num); } else { $sql = "SELECT md.uid, COUNT(*) AS value, m.username, m.icon, m.gender, m.groupid, m.memberid FROM pw_friends md LEFT JOIN pw_members m USING(uid) WHERE 1{$sqladd} GROUP BY md.uid ORDER BY value DESC" . S::sqlLimit($num); } } elseif ($type == 'todaypost') { $tdtime = PwStrtoTime(get_date($GLOBALS['timestamp'], 'Y-m-d')); if ($this->reality == false) { $sql = "SELECT md.uid as id,md.todaypost as value,m.username as addition FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . S::sqlEscape($tdtime) . " AND md.postnum>0{$sqladd} ORDER BY md.todaypost DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.todaypost as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . S::sqlEscape($tdtime) . " AND md.postnum>0{$sqladd} ORDER BY md.todaypost DESC " . S::sqlLimit($num); } } elseif ($type == 'monthpost') { $montime = PwStrtoTime(get_date($GLOBALS['timestamp'], 'Y-m') . '-1'); if ($this->reality == false) { $sql = "SELECT md.uid as id,md.monthpost as value,m.username as addition FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . S::sqlEscape($montime) . " AND md.postnum>0{$sqladd} ORDER BY md.monthpost DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.monthpost as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastpost>" . S::sqlEscape($montime) . " AND md.postnum>0{$sqladd} ORDER BY md.monthpost DESC " . S::sqlLimit($num); } } elseif ($type == 'monoltime') { $montime = PwStrtoTime(get_date($GLOBALS['timestamp'], 'Y-m') . '-1'); if ($this->reality == false) { $sql = "SELECT md.uid as id,md.monoltime as value,m.username as addition FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastvisit>" . S::sqlEscape($montime) . " AND md.postnum>0{$sqladd} ORDER BY md.monoltime DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.monoltime as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_memberdata md LEFT JOIN pw_members m USING(uid) WHERE md.lastvisit>" . S::sqlEscape($montime) . " AND md.postnum>0{$sqladd} ORDER BY md.monoltime DESC " . S::sqlLimit($num); } } elseif (is_numeric($type) && $GLOBALS['_CREDITDB'][$type]) { if ($this->reality == false) { $sql = "SELECT md.uid as id,md.value,m.username as addition FROM pw_membercredit md LEFT JOIN pw_members m USING(uid) WHERE md.cid=" . S::sqlEscape($type) . "{$sqladd} ORDER BY md.value DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_membercredit md LEFT JOIN pw_members m USING(uid) WHERE md.cid=" . S::sqlEscape($type) . "{$sqladd} ORDER BY md.value DESC " . S::sqlLimit($num); } } elseif ($type == 'newUser') { if ($this->reality == false) { $sql = "SELECT md.uid as id,md.uid as value,m.username as addition FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) ORDER BY m.uid DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,md.uid as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_members m LEFT JOIN pw_memberdata md USING(uid) ORDER BY m.uid DESC " . S::sqlLimit($num); } } elseif ($type == 'postMostUser') { global $timestamp; $sqlAdd = ''; $week = $timestamp - 3600 * 24 * 7; $sqlAdd .= " t.postdate BETWEEN {$week} AND {$timestamp}"; $sqlAdd .= " AND (tpcstatus & 16) = 16 "; if ($this->reality == false) { $sql = "SELECT md.uid as id,COUNT(*) as value,m.username as addition FROM pw_threads t LEFT JOIN pw_members m ON t.authorid = m.uid LEFT JOIN pw_memberdata md USING(uid) WHERE {$sqlAdd} GROUP BY t.authorid ORDER BY value DESC " . S::sqlLimit($num); } else { $sql = "SELECT md.uid,COUNT(*) as value,m.username,m.icon,m.gender,m.groupid,m.memberid FROM pw_threads t LEFT JOIN pw_members m ON t.authorid = m.uid LEFT JOIN pw_memberdata md USING(uid) WHERE {$sqlAdd} GROUP BY t.authorid ORDER BY value DESC " . S::sqlLimit($num); } } else { return false; } $member = array(); $query = $this->db->query($sql); while ($rt = $this->db->fetch_array($query)) { if ($rt['value'] > PW_OVERFLOW_NUM) { $ifOverflow = 1; } if ($type == 'rvrc') { $rt['value'] = floor($rt['value'] / 10); } elseif ($type == 'onlinetime' || $type == 'monoltime') { $rt['value'] = floor($rt['value'] / 3600); } if ($this->reality == false) { $rt['type'] = 'usersort'; $rt['mark'] = $type; $member[] = $rt; } else { $tem = array(); $tem['url'] = USER_URL . $rt['uid']; $tem['uid'] = $rt['uid']; $tem['title'] = $rt['username']; $tem['value'] = $rt['value']; if (!$rt['icon']) { switch ($rt['gender']) { case 0: $rt['icon'] = 'none.gif|1|||'; break; case 1: $rt['icon'] = '2.gif|1|||'; break; case 2: $rt['icon'] = '0.gif|1|||'; break; default: $rt['icon'] = 'none.gif|1|||'; break; } } $pic = showfacedesign($rt['icon'], true); if (is_array($pic)) { $tem['image'] = $pic[0]; } else { $tem['image'] = ''; } $tem['addition'] = $rt; $member[] = $tem; } } if ($ifOverflow && $this->_excuteOverflow($type)) { return $this->userSort($type, $num); } return $member; }