function jieqi_upbookcasevisit() { if (!empty($_REQUEST['bid'])) { include_once $jieqiModules['article']['path'] . '/class/bookcase.php'; $bookcase_handler =& JieqiBookcaseHandler::getInstance('JieqiBookcaseHandler'); $bookcase_handler->db->query('UPDATE ' . jieqi_dbprefix('article_bookcase') . ' SET lastvisit=' . JIEQI_NOW_TIME . ' WHERE caseid=' . $_REQUEST['bid']); } }
function setContent($isreturn = false) { global $jieqiTpl; global $jieqiConfigs; jieqi_getconfigs('article', 'configs'); $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl']; $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl']; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); jieqi_includedb(); $query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $criteria = new CriteriaCompo(); $criteria->setFields("r.*,a.articlename"); $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid"); if ($this->exevars['istop'] == 1) { $criteria->add(new Criteria('r.istop', '1')); } elseif ($this->exevars['istop'] == 2) { $criteria->add(new Criteria('r.istop', '0')); } if ($this->exevars['isgood'] == 1) { $criteria->add(new Criteria('r.isgood', '1')); } elseif ($this->exevars['isgood'] == 2) { $criteria->add(new Criteria('r.isgood', '0')); } $criteria->setSort('r.topicid'); $criteria->setOrder('DESC'); $criteria->setLimit($this->exevars['listnum']); $criteria->setStart(0); $query->queryObjects($criteria); $reviewrows = array(); $i = 0; while ($v = $query->getObject()) { $reviewrows[$i]['reviewtitle'] = jieqi_htmlstr(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('title', 'n'))); $reviewrows[$i]['ownerid'] = $v->getVar('ownerid'); $reviewrows[$i]['articlename'] = $v->getVar('articlename'); $reviewrows[$i]['topicid'] = $v->getVar('topicid'); $reviewrows[$i]['url_review'] = $article_dynamic_url . '/reviews.php?aid=' . $v->getVar('ownerid'); $reviewrows[$i]['poster'] = $v->getVar('poster'); $reviewrows[$i]['posterid'] = $v->getVar('posterid'); $reviewrows[$i]['postdate'] = date('m-d H:i', $v->getVar('posttime')); $reviewrows[$i]['posttime'] = $v->getVar('posttime'); $reviewrows[$i]['replytime'] = $v->getVar('replytime'); $reviewrows[$i]['views'] = $v->getVar('views'); $reviewrows[$i]['replies'] = $v->getVar('replies'); $reviewrows[$i]['islock'] = $v->getVar('islock'); $reviewrows[$i]['istop'] = $v->getVar('istop'); $reviewrows[$i]['isgood'] = $v->getVar('isgood'); $reviewrows[$i]['topictype'] = $v->getVar('topictype'); $reviewrows[$i]['url_articleinfo'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'info'); $reviewrows[$i]['url_articleindex'] = jieqi_geturl('article', 'article', $v->getVar('ownerid'), 'index'); $reviewrows[$i]['url_articleread'] = $reviewrows[$i]['url_articleindex']; $i++; } $jieqiTpl->assign_by_ref('reviewrows', $reviewrows); $jieqiTpl->assign('url_more', $article_dynamic_url . '/reviewslist.php'); }
function setContent($isreturn = false) { global $jieqiTpl; global $jieqiConfigs; global $jieqiSort; include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php'; //载入相关处理函数 include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/funarticle.php'; jieqi_getconfigs('article', 'configs'); jieqi_getconfigs('article', 'sort'); $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl']; $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl']; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); $articlerows = array(); if (count($this->exevars) > 0) { $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $sql = 'SELECT * FROM ' . jieqi_dbprefix('article_article') . ' WHERE articleid IN (0,' . implode(',', $this->exevars) . ')'; $sql .= ' LIMIT 0, 100'; $res = $article_handler->db->query($sql); $k = 0; while ($v = $article_handler->getObject($res)) { $articlerows[$k] = jieqi_article_vars($v); $articlerows[$k]['order'] = $k + 1; $k++; } } $i = 0; $maxrow = count($articlerows); $sortrows = array(); foreach ($this->exevars as $aid) { $k = 0; while ($k < $maxrow && $articlerows[$k]['articleid'] != $aid) { $k++; } if ($k < $maxrow) { $articlerows[$k]['order'] = $i + 1; $sortrows[$i] =& $articlerows[$k]; $i++; } } $jieqiTpl->assign_by_ref('articlerows', $sortrows); }
function makefulltext($dynamic = false, $show = false, $vid = 0) { if (JIEQI_MODULE_VTYPE == '' || JIEQI_MODULE_VTYPE == 'Free') { return true; } global $jieqiConfigs; global $jieqiSort; global $jieqiTpl; global $jieqi_file_postfix; if (!isset($jieqiSort['article'])) { jieqi_getconfigs('article', 'sort'); } if (!in_array($jieqiConfigs['article']['htmlfile'], array('.html', '.htm', '.shtml'))) { $jieqiConfigs['article']['htmlfile'] = '.html'; } if (!is_object($jieqiTpl)) { include_once JIEQI_ROOT_PATH . '/lib/template/template.php'; $jieqiTpl =& JieqiTpl::getInstance(); } if (!$this->isload) { $this->loadOPF(); } //生成index.html $articlename = jieqi_htmlstr($this->metas['dc:Title']); $jieqiTpl->assign('dynamic_url', ARTICLE_DYNAMIC_URL); $jieqiTpl->assign('static_url', ARTICLE_STATIC_URL); $jieqiTpl->assign('article_title', $articlename); $jieqiTpl->assign('book_title', '<a name="articletitle">' . $articlename . '</a>'); $jieqiTpl->assign('copy_info', JIEQI_META_COPYRIGHT); $jieqiTpl->assign('sortid', intval($this->metas['dc:Sortid'])); if (!empty($jieqiSort['article'][$this->metas['dc:Sortid']]['caption'])) { $jieqiTpl->assign('sortname', $jieqiSort['article'][$this->metas['dc:Sortid']]['caption']); } $jieqiTpl->assign('articleid', $this->id); $jieqiTpl->assign('chapterid', 0); $jieqiTpl->assign('authorid', intval($this->metas['dc:Creatorid'])); $jieqiTpl->assign('author', jieqi_htmlstr($this->metas['dc:Creator'])); $jieqiTpl->assign('fullflag', intval($this->metas['dc:Fullflag'])); $jieqiTpl->assign('keywords', jieqi_htmlstr($this->metas['dc:Subject'])); $jieqiTpl->assign('intro', jieqi_htmlstr($this->metas['dc:Description'])); $jieqiTpl->assign('posterid', intval($this->metas['dc:Contributorid'])); $jieqiTpl->assign('poster', jieqi_htmlstr($this->metas['dc:Contributor'])); $jieqiTpl->assign('typeid', intval($this->metas['dc:Typeid'])); $jieqiTpl->assign('permission', intval($this->metas['dc:Permission'])); $jieqiTpl->assign('firstflag', intval($this->metas['dc:Firstflag'])); $jieqiTpl->assign('imgflag', intval($this->metas['dc:Imgflag'])); $jieqiTpl->assign('power', intval($this->metas['dc:Power'])); $articletype = intval($this->metas['dc:Articletype']); $jieqiTpl->assign('articletype', $articletype); if (($articletype & 1) > 0) { $jieqiTpl->assign('hasebook', 1); } else { $jieqiTpl->assign('hasebook', 0); } if (($articletype & 2) > 0) { $jieqiTpl->assign('hasobook', 1); } else { $jieqiTpl->assign('hasobook', 0); } if (($articletype & 4) > 0) { $jieqiTpl->assign('hastbook', 1); } else { $jieqiTpl->assign('hastbook', 0); } $jieqiTpl->assign('new_url', JIEQI_LOCAL_URL); //目录阅读 $jieqiTpl->assign('url_indexpage', jieqi_uploadurl($jieqiConfigs['article']['htmldir'], $jieqiConfigs['article']['htmlurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . '/index' . $jieqiConfigs['article']['htmlfile']); //全文阅读 $jieqiTpl->assign('url_fullpage', jieqi_uploadurl($jieqiConfigs['article']['fulldir'], $jieqiConfigs['article']['fullurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . $jieqiConfigs['article']['htmlfile']); //打包下载 $jieqiTpl->assign('url_download', jieqi_uploadurl($jieqiConfigs['article']['zipdir'], $jieqiConfigs['article']['zipurl'], 'article', ARTICLE_STATIC_URL) . jieqi_getsubdir($this->id) . '/' . $this->id . $jieqi_file_postfix['zip']); //自己页面 if ($show) { $jieqiTpl->assign('url_thispage', ARTICLE_STATIC_URL . '/reader.php?aid=' . $this->id); } else { $jieqiTpl->assign('url_thispage', $this->getDir('fulldir', false) . '/' . $this->id . $jieqiConfigs['article']['htmlfile']); } $indexrows = array(); $idx = 0; $i = 0; if (isset($jieqiConfigs['article']['indexcols']) && $jieqiConfigs['article']['indexcols'] > 0) { $cols = $jieqiConfigs['article']['indexcols']; } else { $cols = 4; } $chapters = array(); $n = 0; $txtdir = $this->getDir('txtdir', true, false); $vname = ''; if ($vid > 0) { $cstart = false; } else { $cstart = true; } foreach ($this->chapters as $k => $chapter) { //分卷 $chapterid = $this->getCid($this->chapters[$k]['href']); if ($vid > 0) { if ($chapterid == $vid) { $cstart = true; } elseif ($cstart == true && $chapter['content-type'] == 'volume') { $cstart = false; } if (!$cstart) { continue; } } if ($chapter['content-type'] == 'volume') { if ($i > 0) { $idx++; } $i = 0; $indexrows[$idx]['ctype'] = 'volume'; $indexrows[$idx]['vurl'] = ''; $indexrows[$idx]['vname'] = $chapter['id']; $idx++; if ($chapter['id'] != $vname) { $vname = $chapter['id']; } } else { $i++; $indexrows[$idx]['ctype'] = 'chapter'; $indexrows[$idx]['cname' . $i] = $chapter['id']; $indexrows[$idx]['curl' . $i] = '#' . $chapterid; if ($i == $cols) { $idx++; $i = 0; } if (!empty($vname)) { $tmpvar = $vname . ' '; } else { $tmpvar = ''; } $chapters[$n]['title'] = '<a name="' . $chapterid . '">' . $tmpvar . $chapter['id'] . '</a>'; if (file_exists($txtdir . '/' . $chapterid . $jieqi_file_postfix['txt'])) { $chapters[$n]['content'] = jieqi_htmlstr(jieqi_readfile($txtdir . '/' . $chapterid . $jieqi_file_postfix['txt'])); //使链接可点击 $patterns = array("/([^]_a-z0-9-=\"'\\/])([a-z]+?):\\/\\/([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/])www\\.([a-z0-9\\-]+)\\.([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/])ftp\\.([a-z0-9\\-]+)\\.([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i", "/([^]_a-z0-9-=\"'\\/:\\.])([a-z0-9\\-_\\.]+?)@([a-z0-9\\/\\-_+=.~!%@?#%&;:\$\\│]+)/i"); $replacements = array("\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", "\\1<a href=\"http://www.\\2.\\3\" target=\"_blank\">www.\\2.\\3</a>", "\\1<a href=\"ftp://ftp.\\2.\\3\" target=\"_blank\">ftp.\\2.\\3</a>", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>"); $chapters[$n]['content'] = preg_replace($patterns, $replacements, $chapters[$n]['content']); } else { $chapters[$n]['content'] = ''; } $attachurl = jieqi_uploadurl($jieqiConfigs['article']['attachdir'], $jieqiConfigs['article']['attachurl'], 'article') . jieqi_getsubdir($this->id) . '/' . $this->id . '/' . $chapterid; if (!$jieqiConfigs['article']['packdbattach']) { //检查附件(从文件) $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article') . jieqi_getsubdir($this->id) . '/' . $this->id . '/' . $chapterid; if (is_dir($attachdir)) { $attachimage = ''; $attachfile = ''; $files = array(); $dirhandle = @opendir($attachdir); while ($file = @readdir($dirhandle)) { if ($file != '.' && $file != '..') { $files[] = $file; } } @closedir($dirhandle); sort($files); foreach ($files as $file) { if (is_file($attachdir . '/' . $file)) { $url = $attachurl . '/' . $file; if (eregi("\\.(gif|jpg|jpeg|png|bmp)\$", $file)) { $attachimage .= '<div class="divimage" id="' . $file . '" title="' . $url . '"><a style="cursor: pointer;" onclick="imgclickshow(\'' . $file . '\', \'' . $url . '\')">' . $url . '</a>(' . ceil(filesize($attachdir . '/' . $file) / 1024) . 'K)</div>'; } else { $attachfile .= '<strong>file:</strong><a href="' . $url . '">' . $url . '</a>(' . ceil(filesize($attachdir . '/' . $file) / 1024) . 'K)<br /><br />'; } } } if (!empty($attachimage) || !empty($attachfile)) { if (!empty($chapters[$n]['content'])) { $chapters[$n]['content'] .= '<br /><br />'; } $chapters[$n]['content'] .= $attachimage . $attachfile; } } } else { //检查附件,从数据库 global $package_query; $sql = "SELECT attachment FROM " . jieqi_dbprefix('article_chapter') . " WHERE chapterid=" . intval($chapterid); $res = $package_query->execute($sql); $row = $package_query->db->fetchArray($res); $attachary = array(); if (!empty($row['attachment'])) { $attachary = unserialize($row['attachment']); } if (is_array($attachary) && count($attachary) > 0) { $attachimage = ''; $attachfile = ''; foreach ($attachary as $attachvar) { $url = $attachurl . '/' . $attachvar['attachid'] . '.' . $attachvar['postfix']; if ($attachvar['class'] == 'image') { $attachimage .= '<strong>image:</strong><a href="' . $url . '" target="_blank">' . $url . '</a>(' . ceil($attachvar['size'] / 1024) . 'K)<br /><br />'; } else { $attachfile .= '<strong>file:</strong><a href="' . $url . '">' . $url . '</a>(' . ceil($attachvar['size'] / 1024) . 'K)<br /><br />'; } } if (!empty($attachimage) || !empty($attachfile)) { if (!empty($chapters[$n]['content'])) { $chapters[$n]['content'] .= '<br /><br />'; } $chapters[$n]['content'] .= $attachimage . $attachfile; } } } $n++; } } $jieqiTpl->assign_by_ref('indexrows', $indexrows); $jieqiTpl->assign_by_ref('chapters', $chapters); $jieqiTpl->assign('articlesubdir', jieqi_getsubdir($this->id)); $jieqiTpl->assign('url_articleinfo', jieqi_geturl('article', 'article', $this->id, 'info')); $jieqiTpl->assign('url_bookroom', ARTICLE_DYNAMIC_URL . '/'); $jieqiTpl->setCaching(0); if ($show) { $jieqiTpl->display($GLOBALS['jieqiModules']['article']['path'] . '/templates/fulltext.html'); } else { $htmldir = $this->getDir('fulldir', false); $jieqiTpl->assign('jieqi_charset', JIEQI_SYSTEM_CHARSET); jieqi_writefile($htmldir . '/' . $this->id . $jieqiConfigs['article']['htmlfile'], $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/fulltext.html')); } }
jieqi_printfail(sprintf($jieqiLang['system']['day_message_limit'], $maxdaymsg)); } } include_once JIEQI_ROOT_PATH . '/header.php'; //获得允许消息数和现有消息数 jieqi_getconfigs('system', 'honors'); jieqi_getconfigs(JIEQI_MODULE_NAME, 'right'); $maxmessage = $jieqiConfigs['system']['messagelimit']; $honorid = jieqi_gethonorid($_SESSION['jieqiUserScore'], $jieqiHonors); if ($honorid && isset($jieqiRight['system']['maxmessages']['honors'][$honorid]) && is_numeric($jieqiRight['system']['maxmessages']['honors'][$honorid])) { $maxmessage = intval($jieqiRight['system']['maxmessages']['honors'][$honorid]); } //根据头衔设置的消息数 include_once JIEQI_ROOT_PATH . '/class/message.php'; $message_handler = JieqiMessageHandler::getInstance('JieqiMessageHandler'); $sql = "SELECT COUNT(*) AS msgnum FROM " . jieqi_dbprefix('system_message') . " WHERE (fromid=" . $_SESSION['jieqiUserId'] . " AND fromdel=0) OR (toid=" . $_SESSION['jieqiUserId'] . " AND todel=0)"; $res = $message_handler->db->query($sql); $row = $message_handler->getRow($res); $nowmessage = (int) $row['msgnum']; if ($nowmessage >= $maxmessage) { $jieqiTpl->setCaching(0); $jieqiTpl->assign('jieqi_contents', jieqi_msgbox($jieqiLang['system']['message_is_full'], $jieqiLang['system']['message_box_full'])); } else { $jieqiTpl->assign('maxdaymsg', $maxdaymsg); $jieqiTpl->assign('nowmessage', $nowmessage); $jieqiTpl->assign('maxmessage', $maxmessage); $jieqiTpl->assign('url_newmessage', JIEQI_URL . '/newmessage.php?do=submit'); $message = false; if (!empty($_REQUEST['reid']) || !empty($_REQUEST['fwid'])) { include_once JIEQI_ROOT_PATH . '/class/message.php'; $message_handler = JieqiMessageHandler::getInstance('JieqiMessageHandler');
/** * 用户登录后处理 * * @param object $jieqiUsers 用户对象 * @access public * @return bool */ function jieqi_loginprocess($jieqiUsers, $usecookie = 0) { global $jieqiConfigs; global $jieqiHonors; global $jieqiGroups; if (!isset($jieqiConfigs['system'])) { jieqi_getconfigs('system', 'configs'); } include_once JIEQI_ROOT_PATH . '/class/users.php'; $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler'); //更新在线用户表 include_once JIEQI_ROOT_PATH . '/class/online.php'; $online_handler =& JieqiOnlineHandler::getInstance('JieqiOnlineHandler'); $criteria = new CriteriaCompo(new Criteria('uid', $jieqiUsers->getVar('uid', 'n'))); $criteria->setSort('updatetime'); $criteria->setOrder('DESC'); $online_handler->queryObjects($criteria); $online = $online_handler->getObject(); //读cookie信息 $jieqi_user_info = array(); if (!empty($_COOKIE['jieqiUserInfo'])) { $jieqi_user_info = jieqi_strtosary($_COOKIE['jieqiUserInfo']); } else { $jieqi_user_info = array(); } $jieqi_visit_info = array(); if (!empty($_COOKIE['jieqiVisitInfo'])) { $jieqi_visit_info = jieqi_strtosary($_COOKIE['jieqiVisitInfo']); } else { $jieqi_visit_info = array(); } if (is_object($online)) { $ip = jieqi_userip(); if (JIEQI_SESSION_EXPRIE > 0) { $exprie_time = JIEQI_SESSION_EXPRIE; } else { $exprie_time = @ini_get('session.gc_maxlifetime'); } if (empty($exprie_time)) { $exprie_time = 1800; } if (defined('JIEQI_DENY_RELOGIN') && JIEQI_DENY_RELOGIN == 1 && JIEQI_NOW_TIME - $online->getVar('updatetime') < $exprie_time && $online->getVar('ip', 'n') != $ip && $jieqi_visit_info['jieqiUserId'] != $jieqiUsers->getVar('uid')) { return -8; } $tmpvar = strlen($jieqiUsers->getVar('name', 'q')) > 0 ? $jieqiUsers->getVar('name', 'q') : $jieqiUsers->getVar('uname', 'q'); $sql = "UPDATE " . jieqi_dbprefix('system_online') . " SET uid=" . $jieqiUsers->getVar('uid', 'q') . ", sid='" . jieqi_dbslashes(session_id()) . "', uname='" . $jieqiUsers->getVar('uname', 'q') . "', name='" . $tmpvar . "', pass='******'pass', 'q') . "',email='" . $jieqiUsers->getVar('email', 'q') . "', groupid=" . $jieqiUsers->getVar('groupid', 'q') . ", updatetime=" . JIEQI_NOW_TIME . ", ip='" . jieqi_dbslashes($ip) . "' WHERE uid=" . $jieqiUsers->getVar('uid', 'q') . " OR sid='" . jieqi_dbslashes(session_id()) . "'"; $online_handler->db->query($sql); } else { include_once JIEQI_ROOT_PATH . '/include/visitorinfo.php'; $online = $online_handler->create(); $online->setVar('uid', $jieqiUsers->getVar('uid', 'n')); $online->setVar('siteid', JIEQI_SITE_ID); $online->setVar('sid', session_id()); $online->setVar('uname', $jieqiUsers->getVar('uname', 'n')); $tmpvar = strlen($jieqiUsers->getVar('name', 'n')) > 0 ? $jieqiUsers->getVar('name', 'n') : $jieqiUsers->getVar('uname', 'n'); $online->setVar('name', $tmpvar); $online->setVar('pass', $jieqiUsers->getVar('pass', 'n')); $online->setVar('email', $jieqiUsers->getVar('email', 'n')); $online->setVar('groupid', $jieqiUsers->getVar('groupid', 'n')); $tmpvar = JIEQI_NOW_TIME; $online->setVar('logintime', $tmpvar); $online->setVar('updatetime', $tmpvar); $online->setVar('operate', ''); $tmpvar = VisitorInfo::getIp(); $online->setVar('ip', $tmpvar); $online->setVar('browser', VisitorInfo::getBrowser()); $online->setVar('os', VisitorInfo::getOS()); $location = VisitorInfo::getIpLocation($tmpvar); if (JIEQI_SYSTEM_CHARSET == 'big5') { include_once JIEQI_ROOT_PATH . '/include/changecode.php'; $location = jieqi_gb2big5($location); } $online->setVar('location', $location); $online->setVar('state', '0'); $online->setVar('flag', '0'); $online_handler->insert($online); } //删除过期的在线用户 unset($criteria); $criteria = new CriteriaCompo(new Criteria('updatetime', JIEQI_NOW_TIME - $jieqiConfigs['system']['onlinetime'], '<')); $online_handler->delete($criteria); //检查短消息 include_once JIEQI_ROOT_PATH . '/class/message.php'; $message_handler = JieqiMessageHandler::getInstance('JieqiMessageHandler'); $criteria = new CriteriaCompo(new Criteria('toid', $jieqiUsers->getVar('uid'), '=')); $criteria->add(new Criteria('isread', 0, '=')); $criteria->add(new Criteria('todel', 0, '=')); $newmsgnum = $message_handler->getCount($criteria); unset($criteria); //有短消息 //用户信息 $previewlogin = intval($jieqiUsers->getVar('lastlogin')); $jieqiUsers->setVar('lastlogin', JIEQI_NOW_TIME); $userset = unserialize($jieqiUsers->getVar('setting', 'n')); if (!isset($userset['lastip']) || $userset['lastip'] != jieqi_userip()) { $userset['lastip'] = jieqi_userip(); } if (!isset($userset['logindate']) || $userset['logindate'] != date('Y-m-d')) { $userset['logindate'] = date('Y-m-d'); //增加登陆积分 $jieqiUsers->setVar('experience', $jieqiUsers->getVar('experience') + $jieqiConfigs['system']['scorelogin']); $jieqiUsers->setVar('score', $jieqiUsers->getVar('score') + $jieqiConfigs['system']['scorelogin']); } //如果换月了,清空月积分 //if(date('Y-m', $previewlogin) != date('Y-m', JIEQI_NOW_TIME)) $jieqiUsers->setVar('monthscore', 0); $jieqiUsers->setVar('setting', serialize($userset)); $jieqiUsers->unsetNew(); $users_handler->insert($jieqiUsers); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); //设置SESSION jieqi_setusersession($jieqiUsers); if ($newmsgnum > 0) { $_SESSION['jieqiNewMessage'] = $newmsgnum; } //后台登录状态 $jieqi_online_info = empty($_COOKIE['jieqiOnlineInfo']) ? array() : jieqi_strtosary($_COOKIE['jieqiOnlineInfo']); if (isset($jieqi_online_info['jieqiAdminLogin']) && $jieqi_online_info['jieqiAdminLogin'] == 1) { $_SESSION['jieqiAdminLogin'] = 1; } $jieqi_user_info['jieqiUserId'] = $_SESSION['jieqiUserId']; $jieqi_user_info['jieqiUserUname'] = $_SESSION['jieqiUserUname']; $jieqi_user_info['jieqiUserName'] = $_SESSION['jieqiUserName']; $jieqi_user_info['jieqiUserGroup'] = $_SESSION['jieqiUserGroup']; $jieqi_user_info['jieqiUserGroupName'] = $jieqiGroups[$_SESSION['jieqiUserGroup']]; $jieqi_user_info['jieqiUserVip'] = $_SESSION['jieqiUserVip']; $jieqi_user_info['jieqiUserHonorId'] = $_SESSION['jieqiUserHonorId']; $jieqi_user_info['jieqiUserHonor'] = $_SESSION['jieqiUserHonor']; if ($newmsgnum > 0) { $jieqi_user_info['jieqiNewMessage'] = $newmsgnum; } if ($usecookie) { $jieqi_user_info['jieqiUserPassword'] = $jieqiUsers->getVar('pass', 'n'); } include_once JIEQI_ROOT_PATH . '/include/changecode.php'; if (JIEQI_SYSTEM_CHARSET == 'gbk') { $jieqi_user_info['jieqiUserUname_un'] = jieqi_gb2unicode($_SESSION['jieqiUserUname']); $jieqi_user_info['jieqiUserName_un'] = jieqi_gb2unicode($_SESSION['jieqiUserName']); $jieqi_user_info['jieqiUserHonor_un'] = jieqi_gb2unicode($_SESSION['jieqiUserHonor']); $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]); } else { $jieqi_user_info['jieqiUserUname_un'] = jieqi_big52unicode($_SESSION['jieqiUserUname']); $jieqi_user_info['jieqiUserName_un'] = jieqi_big52unicode($_SESSION['jieqiUserName']); $jieqi_user_info['jieqiUserHonor_un'] = jieqi_big52unicode($_SESSION['jieqiUserHonor']); $jieqi_user_info['jieqiUserGroupName_un'] = jieqi_gb2unicode($jieqiGroups[$_SESSION['jieqiUserGroup']]); } $jieqi_user_info['jieqiUserLogin'] = JIEQI_NOW_TIME; if ($usecookie < 0) { $usecookie = 0; } elseif ($usecookie == 1) { $usecookie = 315360000; } if ($usecookie) { $cookietime = JIEQI_NOW_TIME + $usecookie; } else { $cookietime = 0; } @setcookie('jieqiUserInfo', jieqi_sarytostr($jieqi_user_info), $cookietime, '/', JIEQI_COOKIE_DOMAIN, 0); $jieqi_visit_info['jieqiUserLogin'] = $jieqi_user_info['jieqiUserLogin']; $jieqi_visit_info['jieqiUserId'] = $jieqi_user_info['jieqiUserId']; @setcookie('jieqiVisitInfo', jieqi_sarytostr($jieqi_visit_info), JIEQI_NOW_TIME + 99999999, '/', JIEQI_COOKIE_DOMAIN, 0); //更新在线用户 include_once JIEQI_ROOT_PATH . '/lib/template/template.php'; $jieqiTpl =& JieqiTpl::getInstance(); $jieqiTpl->clear_cache(JIEQI_ROOT_PATH . '/templates/online.html'); return 0; }
function setContent($isreturn = false) { global $jieqiTpl; global $jieqiConfigs; global $jieqiSort; include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/article.php'; //载入相关处理函数 include_once $GLOBALS['jieqiModules']['article']['path'] . '/include/funarticle.php'; jieqi_getconfigs('article', 'configs'); jieqi_getconfigs('article', 'sort'); $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl']; $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl']; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); $tmpvar = explode('-', date('Y-m-d', JIEQI_NOW_TIME)); $daystart = mktime(0, 0, 0, (int) $tmpvar[1], (int) $tmpvar[2], (int) $tmpvar[0]); $monthstart = mktime(0, 0, 0, (int) $tmpvar[1], 1, (int) $tmpvar[0]); $tmpvar = date('w', JIEQI_NOW_TIME); if ($tmpvar == 0) { $tmpvar = 7; } //星期天是0,国人习惯作为作为一星期的最后一天 $weekstart = $daystart; if ($tmpvar > 1) { $weekstart -= ($tmpvar - 1) * 86400; } $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $sql = 'SELECT * FROM ' . jieqi_dbprefix('article_article') . ' WHERE display=0 AND size>0'; if (!empty($this->exevars['sortid'])) { $sortstr = ''; $sortnum = 0; $sortary = explode('|', $this->exevars['sortid']); foreach ($sortary as $v) { if (is_numeric($v)) { if (!empty($sortstr)) { $sortstr .= ' OR '; } $sortstr .= 'sortid=' . intval($v); $sortnum++; } } if ($sortnum == 1) { $sql .= ' AND ' . $sortstr; } elseif ($sortnum > 1) { $sql .= ' AND (' . $sortstr . ')'; } } if ($this->exevars['isauthor'] == 1) { $sql .= ' AND authorid>0'; } elseif ($this->exevars['isauthor'] == 2) { $sql .= ' AND authorid=0'; } if ($this->exevars['isfull'] == 1) { $sql .= ' AND fullflag=1'; } elseif ($this->exevars['isfull'] == 2) { $sql .= ' AND fullflag=0'; } //授权许可 if (strlen($this->exevars['permission']) > 0) { $perstr = ''; $pernum = 0; $perary = explode('|', $this->exevars['permission']); foreach ($perary as $v) { if (is_numeric($v)) { if (!empty($perstr)) { $perstr .= ' OR '; } $perstr .= 'permission=' . intval($v); $pernum++; } } if ($pernum == 1) { $sql .= ' AND ' . $perstr; } elseif ($pernum > 1) { $sql .= ' AND (' . $perstr . ')'; } } //是否首发 if (strlen($this->exevars['firstflag']) > 0) { $sql .= ' AND firstflag=' . intval($this->exevars['firstflag']); } //状态标志 if (strlen($this->exevars['power']) > 0) { $sql .= ' AND power=' . intval($this->exevars['power']); } switch ($this->exevars['field']) { case 'monthvisit': $sql .= ' AND lastvisit>=' . $monthstart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'monthvote': $sql .= ' AND lastvote>=' . $monthstart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'weekvisit': $sql .= ' AND lastvisit>=' . $weekstart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'weekvote': $sql .= ' AND lastvote>=' . $weekstart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'dayvisit': $sql .= ' AND lastvisit>=' . $daystart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'dayvote': $sql .= ' AND lastvote>=' . $daystart; $sql .= ' ORDER BY ' . $this->exevars['field']; break; case 'goodnew': $sql .= ' AND postdate>=' . (JIEQI_NOW_TIME - 3600 * 24 * 30); $sql .= ' ORDER BY allvisit + allvote * 10 + goodnum * 20'; break; default: $sql .= ' ORDER BY ' . $this->exevars['field']; break; } if ($this->exevars['asc'] == 1) { $sql .= ' ASC'; } else { $sql .= ' DESC'; } $sql .= ' LIMIT 0, ' . $this->exevars['listnum']; $res = $article_handler->db->query($sql); $articlerows = array(); $k = 0; while ($v = $article_handler->getObject($res)) { $articlerows[$k] = jieqi_article_vars($v); $articlerows[$k]['order'] = $k + 1; if ($this->exevars['field'] == 'goodnew') { $articlerows[$k]['visitnum'] = $v->getVar('allvisit'); } else { $articlerows[$k]['visitnum'] = $v->getVar($this->exevars['field']); } if ($this->exevars['field'] == 'size') { $articlerows[$k]['visitnum'] = ceil($articlerows[$k]['visitnum'] / 1024) . 'K'; } elseif ($this->exevars['field'] == 'lastupdate' || $this->exevars['field'] == 'postdate' || $this->exevars['field'] == 'toptime' || $this->exevars['field'] == 'lastvote') { $articlerows[$k]['visitnum'] = date('m-d', $articlerows[$k]['visitnum']); } $k++; } $jieqiTpl->assign_by_ref('articlerows', $articlerows); $topsort = $this->exevars['field']; if ($topsort == 'lastupdate') { if ($this->exevars['isauthor'] == 1) { $topsort = 'authorupdate'; } elseif ($this->exevars['isauthor'] == 2) { $topsort = 'masterupdate'; } } $jieqiTpl->assign('url_more', jieqi_geturl('article', 'toplist', 1, $topsort)); }
/** * 批量更新数据 * * @param mixed $fields 更新的字段,字符串或者数组 * @param object $criteria 查询对象 * @access public * @return bool */ function updatefields($fields, $criteria = NULL) { $sql = 'UPDATE ' . jieqi_dbprefix($this->dbname, $this->fullname) . ' SET '; $start = true; if (is_array($fields)) { foreach ($fields as $k => $v) { if (!$start) { $sql .= ', '; } else { $start = false; } if (is_numeric($v)) { $sql .= $k . '=' . $this->db->quoteString($v); } else { $sql .= $k . '=' . $this->db->quoteString($v); } } } else { $sql .= $fields; } if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' ' . $criteria->renderWhere(); } if (!($result = $this->db->query($sql))) { return false; } return true; }
if ($obookcase->getVar('userid') == $_SESSION['jieqiUserId']) { include_once $jieqiModules['obook']['path'] . '/class/obook.php'; $obook_handler =& JieqiobookHandler::getInstance('JieqiobookHandler'); $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_obook') . ' SET goodnum=goodnum-1 WHERE obookid=' . $obookcase->getVar('obookid', 'n')); $obookcase_handler->delete($_REQUEST['delid']); } } unset($obookcase); } //最大收藏数 $maxnum = $jieqiConfigs['obook']['bookcasenum']; $jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">'); jieqi_includedb(); $obookcase_query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $criteria = new CriteriaCompo(new Criteria('c.userid', $_SESSION['jieqiUserId'])); $criteria->setTables(jieqi_dbprefix('obook_obookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('obook_obook') . ' a ON c.obookid=a.obookid'); $criteria->setFields('c.*, a.obookid, a.articleid, a.lastupdate, a.obookname, a.lastchapterid, a.lastchapter'); $criteria->setSort('a.lastupdate'); $criteria->setOrder('DESC'); $obookcase_query->queryObjects($criteria); unset($criteria); $obookcaserows = array(); $k = 0; while ($v = $obookcase_query->getObject()) { $obookcaserows[$k]['ocaseid'] = $v->getVar('ocaseid'); $obookcaserows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . $v->getVar('oocaseid') . '">'; $tmpvar = $v->getVar('obookname'); if (!empty($tmpvar)) { $obookcaserows[$k]['url_obookinfo'] = $obook_dynamic_url . '/readbookcase.php?oid=' . $v->getVar('obookid') . '&bid=' . $v->getVar('ocaseid'); $obookcaserows[$k]['url_index'] = $obookcaserows[$k]['url_obookinfo'] . '&indexflag=1'; $obookcaserows[$k]['obookname'] = $v->getVar('obookname');
$varstring = "<?php\n" . jieqi_extractvars('jieqiObookdata', $jieqiObookdata) . "\n?>"; jieqi_writefile($linkfile, $varstring); } } elseif ($_REQUEST['action'] == 'unsale') { $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_obook') . ' SET display=2 WHERE obookid=' . intval($_REQUEST['id'])); $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_ochapter') . ' SET state=display, display=2 WHERE obookid=' . intval($_REQUEST['id'])); if (!empty($linkfile) && file_exists($linkfile)) { global $jieqiObookdata; include_once $linkfile; $jieqiObookdata['obook']['display'] = 2; $varstring = "<?php\n" . jieqi_extractvars('jieqiObookdata', $jieqiObookdata) . "\n?>"; jieqi_writefile($linkfile, $varstring); } } elseif ($_REQUEST['action'] == 'delete') { $obook_handler->db->query('DELETE FROM ' . jieqi_dbprefix('obook_obook') . ' WHERE obookid=' . intval($_REQUEST['id'])); $obook_handler->db->query('DELETE FROM ' . jieqi_dbprefix('obook_ochapter') . ' WHERE obookid=' . intval($_REQUEST['id'])); if (!empty($linkfile) && file_exists($linkfile)) { jieqi_delfile($linkfile); } } //更新最新电子书 jieqi_getcachevars('obook', 'obookuplog'); if (!is_array($jieqiObookuplog)) { $jieqiObookuplog = array('obookuptime' => 0, 'chapteruptime' => 0); } $jieqiObookuplog['obookuptime'] = JIEQI_NOW_TIME; jieqi_setcachevars('obookuplog', 'jieqiObookuplog', $jieqiObookuplog, 'obook'); jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs'); $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['staticurl']; $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['dynamicurl']; //减少电子书和章节积分
} } $sql='DELETE FROM '.jieqi_dbprefix('article_review').' WHERE '.$where; $reviews_handler->db->query($sql); } */ } include_once JIEQI_ROOT_PATH . '/admin/header.php'; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); include_once JIEQI_ROOT_PATH . '/lib/text/textfunction.php'; $jieqiTpl->assign('url_review', $article_dynamic_url . '/admin/reviews.php'); $jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">'); $criteria = new CriteriaCompo(); $criteria->setFields("r.*,a.articlename"); $criteria->setTables(jieqi_dbprefix('article_reviews') . " AS r LEFT JOIN " . jieqi_dbprefix('article_article') . " AS a ON r.ownerid=a.articleid"); if (!empty($_REQUEST['keyword'])) { $_REQUEST['keyword'] = trim($_REQUEST['keyword']); if ($_REQUEST['keytype'] == 1) { $criteria->add(new Criteria('r.poster', $_REQUEST['keyword'], '=')); } else { $criteria->add(new Criteria('a.articlename', $_REQUEST['keyword'], '=')); } } if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'good') { //精华书评 $criteria->add(new Criteria('isgood', 1)); } else { $_REQUEST['type'] = 'all'; } //页码
function setContent($isreturn = false) { global $jieqiTpl; global $jieqiConfigs; jieqi_getconfigs('article', 'configs'); jieqi_getconfigs('article', 'sort'); $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['staticurl']; $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $GLOBALS['jieqiModules']['article']['url'] : $jieqiConfigs['article']['dynamicurl']; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); jieqi_includedb(); $bookcase_query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('c.userid', intval($this->blockvars['cacheid']))); if ($this->exevars['flag'] == 1) { $criteria->add(new Criteria('flag', 1)); } elseif ($this->exevars['flag'] == 2) { $criteria->add(new Criteria('flag', 0)); } $criteria->setTables(jieqi_dbprefix('article_bookcase') . ' c LEFT JOIN ' . jieqi_dbprefix('article_article') . ' a ON c.articleid=a.articleid'); $criteria->setFields('c.*, a.articleid, a.lastupdate, a.articlename, a.authorid, a.author, a.sortid, a.typeid, a.lastchapterid, a.lastchapter'); $tmpary = array('articleid' => 'a.articleid', 'lastupdate' => 'a.lastupdate', 'caseid' => 'c.caseid', 'joindate' => 'c.joindate', 'lastvisit' => 'c.lastvisit'); $criteria->setSort($tmpary[$this->exevars['field']]); if ($this->exevars['asc'] == 1) { $criteria->setOrder('ASC'); } else { $criteria->setOrder('DESC'); } $criteria->setLimit($this->exevars['listnum']); $criteria->setStart(0); $bookcase_query->queryObjects($criteria); unset($criteria); $bookcaserows = array(); $k = 0; while ($v = $bookcase_query->getObject()) { $bookcaserows[$k]['caseid'] = $v->getVar('caseid'); $bookcaserows[$k]['articleid'] = $v->getVar('articleid'); $bookcaserows[$k]['lastchapterid'] = $v->getVar('lastchapterid'); $bookcaserows[$k]['chapterid'] = $v->getVar('chapterid'); $bookcaserows[$k]['sortid'] = $v->getVar('sortid'); $bookcaserows[$k]['typeid'] = $v->getVar('typeid'); $bookcaserows[$k]['sort'] = $jieqiSort['article'][$v->getVar('sortid')]['shortname']; $bookcaserows[$k]['type'] = $bookcaserows[$k]['sort']; //$bookcaserows[$k]['type']=$jieqiSort['article'][$v->getVar('sortid')]['types'][$v->getVar('typeid')]; $bookcaserows[$k]['authorid'] = $v->getVar('authorid'); $bookcaserows[$k]['author'] = $v->getVar('author'); $bookcaserows[$k]['checkbox'] = '<input type="checkbox" id="checkid[]" name="checkid[]" value="' . $v->getVar('caseid') . '">'; $tmpvar = $v->getVar('articlename'); if (!empty($tmpvar)) { $bookcaserows[$k]['url_articleinfo'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid'); $bookcaserows[$k]['url_index'] = $bookcaserows[$k]['url_articleinfo'] . '&indexflag=1'; $bookcaserows[$k]['articlename'] = $v->getVar('articlename'); } else { $bookcaserows[$k]['url_articleinfo'] = '#'; $bookcaserows[$k]['url_index'] = '#'; $bookcaserows[$k]['articlename'] = $jieqiLang['article']['articlemark_has_deleted']; } if ($v->getVar('lastchapter') == '') { $bookcaserows[$k]['lastchapter'] = ''; $bookcaserows[$k]['url_lastchapter'] = '#'; } else { $bookcaserows[$k]['lastchapter'] = $v->getVar('lastchapter'); $bookcaserows[$k]['url_lastchapter'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid') . '&cid=' . $v->getVar('lastchapterid'); } if ($v->getVar('lastupdate') > $v->getVar('lastvisit')) { $bookcaserows[$k]['hasnew'] = 1; } else { $bookcaserows[$k]['hasnew'] = 0; } if ($v->getVar('chaptername') == '') { $bookcaserows[$k]['articlemark'] = ''; $bookcaserows[$k]['url_articlemark'] = '#'; } else { $bookcaserows[$k]['articlemark'] = $v->getVar('chaptername'); $bookcaserows[$k]['url_articlemark'] = $article_dynamic_url . '/readbookcase.php?aid=' . $v->getVar('articleid') . '&bid=' . $v->getVar('caseid') . '&cid=' . $v->getVar('chapterid'); } $bookcaserows[$k]['lastupdate'] = $v->getVar('lastupdate'); $bookcaserows[$k]['url_delete'] = jieqi_addurlvars(array('delid' => $v->getVar('caseid'))); $k++; } $jieqiTpl->assign_by_ref('bookcaserows', $bookcaserows); $jieqiTpl->assign('ownerid', $this->blockvars['cacheid']); }
function setContent($isreturn = false) { global $jieqiTpl; global $jieqiConfigs; global $jieqiSort; include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php'; jieqi_getconfigs('obook', 'configs'); $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['staticurl']; $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $GLOBALS['jieqiModules']['obook']['url'] : $jieqiConfigs['obook']['dynamicurl']; $jieqiTpl->assign('obook_static_url', $obook_static_url); $jieqiTpl->assign('obook_dynamic_url', $obook_dynamic_url); $tmpvar = explode('-', date('Y-m-d', JIEQI_NOW_TIME)); $daystart = mktime(0, 0, 0, (int) $tmpvar[1], (int) $tmpvar[2], (int) $tmpvar[0]); $monthstart = mktime(0, 0, 0, (int) $tmpvar[1], 1, (int) $tmpvar[0]); $tmpvar = date('w', JIEQI_NOW_TIME); if ($tmpvar == 0) { $tmpvar = 7; } //星期天是0,国人习惯作为作为一星期的最后一天 $weekstart = $daystart; if ($tmpvar > 1) { $weekstart -= ($tmpvar - 1) * 86400; } $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler'); $sql = 'SELECT * FROM ' . jieqi_dbprefix('obook_obook') . ' WHERE display=0 AND size>0'; if (!empty($this->exevars['sortid'])) { $sortstr = ''; $sortnum = 0; $sortary = explode('|', $this->exevars['sortid']); foreach ($sortary as $v) { if (is_numeric($v)) { if (!empty($sortstr)) { $sortstr .= ' OR '; } $sortstr .= 'sortid=' . intval($v); $sortnum++; } } if ($sortnum == 1) { $sql .= ' AND ' . $sortstr; } elseif ($sortnum > 1) { $sql .= ' AND (' . $sortstr . ')'; } } if (isset($this->exevars['publishid']) && $this->exevars['publishid'] !== '') { $publishstr = ''; $publishnum = 0; $publishary = explode('|', $this->exevars['publishid']); foreach ($publishary as $v) { if (is_numeric($v)) { if (!empty($publishstr)) { $publishstr .= ' OR '; } $publishstr .= 'publishid=' . intval($v); $publishnum++; } } if ($publishnum == 1) { $sql .= ' AND ' . $publishstr; } elseif ($publishnum > 1) { $sql .= ' AND (' . $publishstr . ')'; } } if ($this->exevars['isfull'] == 1) { $sql .= ' AND fullflag=1'; } elseif ($this->exevars['isfull'] == 2) { $sql .= ' AND fullflag=0'; } switch ($this->exevars['field']) { case 'monthsale': $sql .= ' AND lastsale>=' . $monthstart; break; case 'weeksale': $sql .= ' AND lastsale>=' . $weekstart; break; case 'daysale': $sql .= ' AND lastsale>=' . $daystart; break; } $sql .= ' ORDER BY ' . $this->exevars['field']; if ($this->exevars['asc'] == 1) { $sql .= ' ASC'; } else { $sql .= ' DESC'; } $sql .= ' LIMIT 0, ' . $this->exevars['listnum']; $res = $obook_handler->db->query($sql); jieqi_getconfigs('obook', 'sort'); $obookrows = array(); $k = 0; while ($v = $obook_handler->getObject($res)) { $obookrows[$k]['order'] = $k + 1; $obookrows[$k]['obookid'] = $v->getVar('obookid'); //文章序号 $obookrows[$k]['obookname'] = $v->getVar('obookname'); //文章名称 $obookrows[$k]['articleid'] = $v->getVar('articleid'); //文章序号 if ($jieqiConfigs['obook']['fakeinfo'] == 1) { $obookrows[$k]['obooksubdir'] = jieqi_getsubdir($v->getVar('obookid')); //子目录 if (!empty($jieqiConfigs['obook']['fakeprefix'])) { $tmpvar = '/' . $jieqiConfigs['obook']['fakeprefix'] . 'info'; } else { $tmpvar = '/files/obook/info'; } $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . $tmpvar . $obookrows[$k]['obooksubdir'] . '/' . $v->getVar('obookid') . $jieqiConfigs['obook']['fakefile']; //子目录 } else { $obookrows[$k]['obooksubdir'] = ''; $obookrows[$k]['url_obookinfo'] = $obook_dynamic_url . '/obookinfo.php?id=' . $v->getVar('obookid'); //子目录 } if ($v->getVar('lastchapter') == '') { $obookrows[$k]['lastchapterid'] = 0; //章节序号 $obookrows[$k]['lastchapter'] = ''; //章节名称 $obookrows[$k]['url_lastchapter'] = ''; //章节地址 } else { $obookrows[$k]['lastchapterid'] = $v->getVar('lastchapterid'); $obookrows[$k]['lastchapter'] = $v->getVar('lastchapter'); $obookrows[$k]['url_lastchapter'] = $obook_static_url . '/reader.php?aid=' . $v->getVar('obookid') . '&cid=' . $v->getVar('lastchapterid'); } //公众章节 if ($obookrows[$k]['articleid'] > 0) { if ($jieqiConfigs['article']['makehtml'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) { $obookrows[$k]['url_read'] = $article_static_url . '/reader.php?aid=' . $obookrows[$k]['articleid']; } else { $obookrows[$k]['url_read'] = jieqi_uploadurl($jieqiConfigs['article']['htmldir'], $jieqiConfigs['article']['htmlurl'], 'article', $article_static_url) . jieqi_getsubdir($obookrows[$k]['articleid']) . '/' . $obookrows[$k]['articleid'] . '/index' . $jieqiConfigs['article']['htmlfile']; } } $obookrows[$k]['lastvolume'] = $v->getVar('lastvolumeid'); //分卷序号 $obookrows[$k]['lastvolume'] = $v->getVar('lastvolume'); //分卷名称 $obookrows[$k]['authorid'] = $v->getVar('authorid'); //作者 $obookrows[$k]['author'] = $v->getVar('author'); $obookrows[$k]['posterid'] = $v->getVar('posterid'); //发表者 $obookrows[$k]['poster'] = $v->getVar('poster'); $obookrows[$k]['agentid'] = $v->getVar('agentid'); //代理者 $obookrows[$k]['agent'] = $v->getVar('agent'); $obookrows[$k]['sortid'] = $v->getVar('sortid'); //类别序号 $obookrows[$k]['sort'] = $jieqiSort['obook'][$v->getVar('sortid')]['shortname']; //类别 $obookrows[$k]['size'] = $v->getVar('size'); $obookrows[$k]['size_k'] = ceil($v->getVar('size') / 1024); $obookrows[$k]['size_c'] = ceil($v->getVar('size') / 2); $obookrows[$k]['daysale'] = $v->getVar('daysale'); $obookrows[$k]['weeksale'] = $v->getVar('weeksale'); $obookrows[$k]['monthsale'] = $v->getVar('monthsale'); $obookrows[$k]['sumegold'] = $v->getVar('sumegold'); $obookrows[$k]['sumesilver'] = $v->getVar('sumesilver'); $obookrows[$k]['sumemoney'] = $obookrows[$k]['sumegold'] + $obookrows[$k]['sumesilver']; $obookrows[$k]['payprice'] = $v->getVar('payprice'); $obookrows[$k]['allsale'] = $v->getVar('allsale'); $obookrows[$k]['lastupdate'] = date('y-m-d', $v->getVar('lastupdate')); //最后更新日期 $obookrows[$k]['update'] = date('m-d', $v->getVar('lastupdate')); //最后更新日期 $obookrows[$k]['display'] = $v->getVar('display'); $obookrows[$k]['url_image'] = jieqi_uploadurl($jieqiConfigs['obook']['imagedir'], $jieqiConfigs['obook']['imageurl'], 'obook', $obook_static_url) . jieqi_getsubdir($v->getVar('obookid')) . '/' . $v->getVar('obookid') . '/' . $v->getVar('obookid') . 's' . $jieqiConfigs['obook']['imagetype']; $k++; } $jieqiTpl->assign_by_ref('obookrows', $obookrows); $toptype = $this->exevars['field']; if ($jieqiConfigs['obook']['faketoplist'] == 1) { if (!empty($jieqiConfigs['obook']['fakeprefix'])) { $tmpvar = '/' . $jieqiConfigs['obook']['fakeprefix'] . 'top' . $toptype; } else { $tmpvar = '/files/obook/top' . $toptype; } $jieqiTpl->assign('url_more', $obook_dynamic_url . $tmpvar . '/0/1' . $jieqiConfigs['obook']['fakefile']); } else { $jieqiTpl->assign('url_more', $obook_dynamic_url . '/obooklist.php?sort=' . $toptype); } }
//°üº¬Îļþ require_once '../global.php'; include_once JIEQI_ROOT_PATH . '/' . JIEQI_MODULE_NAME . '/lang/language.php'; include_once JIEQI_ROOT_PATH . '/' . JIEQI_MODULE_NAME . '/header.php'; $jieqiTpl->assign('step_title', $jieqiLang[JIEQI_MODULE_NAME]['step' . CURRENT_STEP . '_title']); $jieqiTpl->assign('step_summary', $jieqiLang[JIEQI_MODULE_NAME]['step' . CURRENT_STEP . '_summary']); $jieqiTpl->assign('next_page', 'step' . (CURRENT_STEP + 1) . '.php'); $jieqiTpl->assign('current_step', CURRENT_STEP); //¼ì²éÒÑ°²×°Ä£¿é //°üº¬Êý¾Ý¿âÀà jieqi_includedb(); $inmodules = array(); $db_query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $res = $db_query->execute("SHOW TABLES LIKE '" . jieqi_dbprefix('system_modules') . "'"); if ($db_query->getRow($res)) { $res = $db_query->execute('SELECT * FROM ' . jieqi_dbprefix('system_modules')); $inmodules = array(); if ($res) { $inmodules[] = 'system'; while ($row = $db_query->getRow($res)) { $inmodules[] = $row['name']; } } } //¼ì²â°²×°Îļþ $i = 0; $sql_dir = 'sql'; $mod_array = array(); $jieqiDir = dir($sql_dir); while ($mod_dir = $jieqiDir->read()) { if (is_dir($sql_dir . '/' . $mod_dir) && $mod_dir !== "." && $mod_dir !== "..") {
exit; } jieqi_loadlang('share', JIEQI_MODULE_NAME); jieqi_getconfigs(JIEQI_MODULE_NAME, 'publisher'); jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs'); $obook_static_url = empty($jieqiConfigs['obook']['staticurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['staticurl']; $obook_dynamic_url = empty($jieqiConfigs['obook']['dynamicurl']) ? $jieqiModules['obook']['url'] : $jieqiConfigs['obook']['dynamicurl']; include_once $jieqiModules['obook']['path'] . '/class/obook.php'; $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler'); include_once JIEQI_ROOT_PATH . '/admin/header.php'; $jieqiTpl->assign('obook_static_url', $obook_static_url); $jieqiTpl->assign('obook_dynamic_url', $obook_dynamic_url); jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort'); jieqi_getconfigs(JIEQI_MODULE_NAME, 'publisher'); //计算总销售额 $sql = "SELECT sum(sumegold) as totalegold, sum(sumesilver) as totalesilver FROM " . jieqi_dbprefix('obook_obook') . " WHERE publishid='" . intval($_SESSION['jieqiPublishid']) . "'"; $res = $obook_handler->db->query($sql); $totalrow = $obook_handler->db->fetchArray($res); $jieqiTpl->assign('totalegold', $totalrow['totalegold']); $jieqiTpl->assign('totalesilver', $totalrow['totalesilver']); $jieqiTpl->assign('totalemoney', $totalrow['totalegold'] + $totalrow['totalesilver']); //页码 if (empty($_REQUEST['page']) || !is_numeric($_REQUEST['page'])) { $_REQUEST['page'] = 1; } $criteria = new CriteriaCompo(); if (!empty($_REQUEST['keyword'])) { $_REQUEST['keyword'] = trim($_REQUEST['keyword']); if ($_REQUEST['keytype'] == 1) { $criteria->add(new Criteria('author', $_REQUEST['keyword'], '=')); } elseif ($_REQUEST['keytype'] == 2) {
} unset($criteria); } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == "batchdel" && is_array($_REQUEST['applyid']) && count($_REQUEST['applyid']) > 0) { //批量删除 $where = ''; foreach ($_REQUEST['applyid'] as $v) { if (is_numeric($v)) { $v = intval($v); if (!empty($where)) { $where .= ', '; } $where .= $v; } } if (!empty($where)) { $sql = 'DELETE FROM ' . jieqi_dbprefix('article_applywriter') . ' WHERE applyid IN (' . $where . ')'; $apply_handler->execute($sql); } } //显示列表 include_once JIEQI_ROOT_PATH . '/admin/header.php'; //页码 if (empty($_REQUEST['page']) || !is_numeric($_REQUEST['page'])) { $_REQUEST['page'] = 1; } $criteria = new CriteriaCompo(); switch ($_REQUEST['display']) { case 'ready': $criteria->add(new Criteria('applyflag', 0)); break; case 'success':
$i = $useitem + 1; while ($i <= 10) { $avote->setVar('item' . $i, ''); $i++; } $avote->setVar('useitem', $useitem); if ($avote->getVar('ispublish', 'n') != $_POST['ispublish']) { $changepublish = true; } else { $changepublish = false; } if ($changepublish) { if ($_POST['ispublish'] == 1) { $avote->setVar('ispublish', 1); $avote->setVar('starttime', JIEQI_NOW_TIME); $sql = "UPDATE " . jieqi_dbprefix('article_avote') . " SET ispublish=0, endtime=" . intval(JIEQI_NOW_TIME) . " WHERE articleid=" . $_REQUEST['aid'] . " AND ispublish=1"; $query->execute($sql); $setting = unserialize($article->getVar('setting', 'n')); $setting['avoteid'] = $_REQUEST['id']; $article->setVar('setting', serialize($setting)); $article_handler->insert($article); } else { $avote->setVar('ispublish', 0); $avote->setVar('endtime', JIEQI_NOW_TIME); $setting = unserialize($article->getVar('setting', 'n')); $setting['avoteid'] = 0; $article->setVar('setting', serialize($setting)); $article_handler->insert($article); } } if ($_POST['mulselect'] == 1) {
$reviewrows[$k]['content'] = jieqi_htmlstr(jieqi_limitwidth($v->getVar('reviewtext', 'n'), $jieqiConfigs['article']['reviewwidth'], $start)); } $reviewrows[$k]['postdate'] = date(JIEQI_DATE_FORMAT . ' ' . JIEQI_TIME_FORMAT, $v->getVar('postdate')); $reviewrows[$k]['userid'] = $v->getVar('userid'); $reviewrows[$k]['username'] = $v->getVar('username'); $k++; } $jieqiTpl->assign_by_ref('reviewrows', $reviewrows); $jieqiTpl->assign('url_goodreview', $article_dynamic_url . '/reviews.php?aid=' . $article->getVar('articleid') . '&type=good'); $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/reviews.php?aid=' . $article->getVar('articleid') . '&type=all'); $jieqiTpl->assign('url_review', $article_dynamic_url . '/reviews.php?aid=' . $article->getVar('articleid')); } elseif ($jieqiConfigs['article']['reviewtype'] == 2) { $query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $criteria = new CriteriaCompo(new Criteria('t.ownerid', $article->getVar('articleid'))); $criteria->add(new Criteria('p.istopic', 1)); $criteria->setTables(jieqi_dbprefix('article_reviews') . ' t LEFT JOIN ' . jieqi_dbprefix('article_replies') . ' p ON t.topicid=p.topicid'); $criteria->setSort('t.istop DESC, t.topicid'); $criteria->setOrder('DESC'); $criteria->setLimit($jieqiConfigs['article']['reviewnew']); $criteria->setStart(0); $query->queryObjects($criteria); $reviewrows = array(); $k = 0; while ($v = $query->getObject()) { $reviewrows[$k] = jieqi_topic_vars($v); $k++; } /* $sql="SELECT * FROM ".jieqi_dbprefix('article_userchap')." WHERE articleid=".jieqi_dbslashes($article->getVar('articleid', 'n'))." ORDER BY userchapid DESC LIMIT 0, ".intval($jieqiConfigs['article']['userchapnew']); $ret=$query->execute($sql);
//检查权限 include_once JIEQI_ROOT_PATH . '/class/power.php'; $power_handler =& JieqiPowerHandler::getInstance('JieqiPowerHandler'); $power_handler->getSavedVars($_REQUEST['mod']); jieqi_checkpower($jieqiPower[$_REQUEST['mod']]['adminpower'], $jieqiUsersStatus, $jieqiUsersGroup, false, true); //载入语言 jieqi_loadlang('power', JIEQI_MODULE_NAME); if (count($jieqiPower[$_REQUEST['mod']]) > 0) { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') { foreach ($jieqiPower[$_REQUEST['mod']] as $k => $v) { if (!isset($_POST[$k])) { $_POST[$k] = ''; } if ($v['groups'] != $_POST[$k]) { $jieqiPower[$_REQUEST['mod']][$k]['groups'] = $_POST[$k]; $power_handler->db->query("UPDATE " . jieqi_dbprefix('system_power') . " SET pgroups='" . jieqi_dbslashes(serialize($_POST[$k])) . "' WHERE modname='" . jieqi_dbslashes($_REQUEST['mod']) . "' AND pname='" . jieqi_dbslashes($k) . "'"); } } jieqi_setconfigs('power', 'jieqiPower', $jieqiPower, $_REQUEST['mod']); //记录日志 include_once JIEQI_ROOT_PATH . '/class/logs.php'; $logs_handler = JieqiLogsHandler::getInstance('JieqiLogsHandler'); $logdata = array('logtype' => 3, 'logdata' => 'module:' . $_REQUEST['mod'], 'todata' => serialize($_REQUEST)); $logs_handler->addlog($logdata); jieqi_msgwin(LANG_DO_SUCCESS, $jieqiLang['system']['edit_power_success']); } else { //显示权限设置 include_once JIEQI_ROOT_PATH . '/admin/header.php'; include_once JIEQI_ROOT_PATH . '/lib/html/formloader.php'; include_once JIEQI_ROOT_PATH . '/class/groups.php'; $groups_handler =& JieqiGroupsHandler::getInstance('JieqiGroupsHandler');
jieqi_printfail($jieqiLang['obook']['obook_not_exists']); } $criteria = new CriteriaCompo(new Criteria('userid', $jieqiUsers->getVar('uid'))); $criteria->add(new Criteria('obookid', $obook->getVar('obookid'))); $obookcase_handler->queryObjects($criteria); $obookcase = $obookcase_handler->getObject(); if ($obookcase) { //已经在书架 jieqi_printfail($jieqiLang['obook']['obook_has_incase']); } else { //没有在书架 if ($cot >= $maxnum) { jieqi_printfail(sprintf($jieqiLang['obook']['bookcase_is_full'], $maxnum)); } //增加文章的收藏量 $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_obook') . ' SET goodnum=goodnum+1 WHERE obookid=' . $_REQUEST['oid']); $obookcase = $obookcase_handler->create(); $obookcase->setVar('joindate', JIEQI_NOW_TIME); $obookcase->setVar('lastvisit', JIEQI_NOW_TIME); $obookcase->setVar('flag', 0); } $obookcase->setVar('obookid', $obook->getVar('obookid', 'n')); $obookcase->setVar('articleid', $obook->getVar('articleid', 'n')); $obookcase->setVar('obookname', $obook->getVar('obookname', 'n')); $obookcase->setVar('userid', $jieqiUsers->getVar('uid', 'n')); $obookcase->setVar('username', $jieqiUsers->getVar('uname', 'n')); $obookcase->setVar('ochapterid', 0); $obookcase->setVar('chaptername', ''); $obookcase->setVar('chapterorder', 0); if (!$obookcase_handler->insert($obookcase)) { jieqi_printfail($jieqiLang['obook']['add_obookmark_failure']);
$uidarray = array(); $query->execute("SELECT * FROM " . jieqi_dbprefix('system_promotions')); while ($promotion = $query->getRow()) { if (is_numeric($promotion['uid'])) { $uidarray[] = intval($promotion['uid']); } } if ($uidarray) { $countarray = array(); foreach (array_count_values($uidarray) as $uid => $count) { $countarray[$count][] = $uid; } foreach ($countarray as $count => $uids) { $query->execute("UPDATE " . jieqi_dbprefix('system_users') . " SET credit=credit+" . intval($count * JIEQI_PROMOTION_VISIT) . " WHERE uid IN (" . implode(',', $uids) . ")"); } $query->execute("DELETE FROM " . jieqi_dbprefix('system_promotions')); } } //载入页面结束的钩子 if (function_exists('jieqi_hooks_end')) { jieqi_hooks_end(); } //结束相关连接 jieqi_freeresource(); //显示DEBUG信息 if (defined('JIEQI_DEBUG_MODE') && JIEQI_DEBUG_MODE > 0) { $runtime = explode(' ', microtime()); $debuginfo = 'Processed in ' . round($runtime[1] + $runtime[0] - JIEQI_START_TIME, 6) . ' second(s), '; if (function_exists('memory_get_usage')) { $debuginfo .= 'Memory usage ' . round(memory_get_usage() / 1024) . 'K, '; }
include_once JIEQI_ROOT_PATH . '/class/power.php'; $power_handler =& JieqiPowerHandler::getInstance('JieqiPowerHandler'); $power_handler->getSavedVars($_REQUEST['mod']); jieqi_checkpower($jieqiPower[$_REQUEST['mod']]['adminpower'], $jieqiUsersStatus, $jieqiUsersGroup, false, true); //载入权利设置 include_once JIEQI_ROOT_PATH . '/class/right.php'; $right_handler =& JieqiRightHandler::getInstance('JieqiRightHandler'); $right_handler->getSavedVars($_REQUEST['mod']); //载入语言 jieqi_loadlang('right', JIEQI_MODULE_NAME); if (count($jieqiRight[$_REQUEST['mod']]) > 0) { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'update') { foreach ($jieqiRight[$_REQUEST['mod']] as $k => $v) { if (isset($_POST[$k]) && $v['honors'] != $_POST[$k]) { $jieqiRight[$_REQUEST['mod']][$k]['honors'] = $_POST[$k]; $right_handler->db->query("UPDATE " . jieqi_dbprefix('system_right') . " SET rhonors='" . jieqi_dbslashes(serialize($_POST[$k])) . "' WHERE modname='" . jieqi_dbslashes($_REQUEST['mod']) . "' AND rname='" . jieqi_dbslashes($k) . "'"); } } jieqi_setconfigs('right', 'jieqiRight', $jieqiRight, $_REQUEST['mod']); //记录日志 include_once JIEQI_ROOT_PATH . '/class/logs.php'; $logs_handler = JieqiLogsHandler::getInstance('JieqiLogsHandler'); $logdata = array('logtype' => 4, 'logdata' => 'module:' . $_REQUEST['mod'], 'todata' => serialize($_REQUEST)); $logs_handler->addlog($logdata); jieqi_msgwin(LANG_DO_SUCCESS, $jieqiLang['system']['edit_right_success']); } else { //显示权限设置 include_once JIEQI_ROOT_PATH . '/admin/header.php'; include_once JIEQI_ROOT_PATH . '/lib/html/formloader.php'; include_once JIEQI_ROOT_PATH . '/class/honors.php'; $honors_handler =& JieqiHonorsHandler::getInstance('JieqiHonorsHandler');
function article_make_stoplist($sort, $fid = 1, $tid = 0, $static = true, $output = false) { global $jieqiConfigs; global $query; if (!isset($jieqiConfigs['article'])) { jieqi_getconfigs('article', 'configs'); } if (empty($tid) && JIEQI_MAX_PAGES > 0) { $tid = JIEQI_MAX_PAGES; } if (empty($tid)) { if (!is_a($query, 'JieqiQueryHandler')) { jieqi_includedb(); $query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); } $sql = "SELECT count(*) AS cot FROM " . jieqi_dbprefix('article_article') . " WHERE display=0 AND size>0"; $tmpvar = explode('-', date('Y-m-d', JIEQI_NOW_TIME)); $daystart = mktime(0, 0, 0, (int) $tmpvar[1], (int) $tmpvar[2], (int) $tmpvar[0]); $monthstart = mktime(0, 0, 0, (int) $tmpvar[1], 1, (int) $tmpvar[0]); $tmpvar = date('w', JIEQI_NOW_TIME); if ($tmpvar == 0) { $tmpvar = 7; } //星期天是0,国人习惯作为作为一星期的最后一天 $weekstart = $daystart; if ($tmpvar > 1) { $weekstart -= ($tmpvar - 1) * 86400; } switch ($sort) { case 'monthvisit': case 'mouthvisit': $sql .= " AND lastvisit >= " . $monthstart; break; case 'weekvisit': $sql .= " AND lastvisit >= " . $weekstart; break; case 'dayvisit': $sql .= " AND lastvisit >= " . $daystart; break; case 'allauthorvisit': $sql .= " AND authorid > 0"; break; case 'monthauthorvisit': case 'mouthauthorvisit': $sql .= " AND authorid > 0 AND lastvisit >= " . $monthstart; break; case 'weekauthorvisit': $sql .= " AND authorid > 0 AND lastvisit >= " . $weekstart; break; case 'dayauthorvisit': $sql .= " AND authorid > 0 AND lastvisit >= " . $daystart; break; case 'monthvote': case 'mouthvote': $sql .= " AND lastvote >= " . $monthstart; break; case 'weekvote': $sql .= " AND lastvote >= " . $weekstart; break; case 'dayvote': $sql .= " AND lastvote >= " . $daystart; break; case 'authorupdate': $sql .= " AND authorid > 0"; break; case 'masterupdate': $sql .= " AND authorid = 0"; break; } $query->execute($sql); if ($row = $query->getRow()) { $cot = intval($row['cot']); $pnum = intval($jieqiConfigs['article']['toppagenum']); if (empty($pnum)) { $pnum = 10; } $tid = ceil($cot / $pnum); } if ($tid < 1) { $tid = 1; } } if ($fid > $tid) { return false; } for ($page = $fid; $page <= $tid; $page++) { article_make_ptoplist($sort, $page, $static, $output); } }
} $where .= $review_handler->autoid . '=' . $v; } } if (!empty($where)) { $sql = 'SELECT reviewid, userid FROM ' . jieqi_dbprefix('article_review') . ' WHERE ' . $where; $res = $review_handler->db->query($sql); while ($actreview = $review_handler->getObject($res)) { //删除书评减少积分 if ($actreview->getVar('userid') == $_SESSION['jieqiUserId']) { $users_handler->changeScore($_SESSION['jieqiUserId'], $jieqiConfigs['article']['scorereview'], false); } else { $users_handler->changeScore($actreview->getVar('userid'), $jieqiConfigs['article']['scorereview'], false); } } $sql = 'DELETE FROM ' . jieqi_dbprefix('article_review') . ' WHERE ' . $where; $review_handler->db->query($sql); } } include_once JIEQI_ROOT_PATH . '/admin/header.php'; $jieqiTpl->assign('article_static_url', $article_static_url); $jieqiTpl->assign('article_dynamic_url', $article_dynamic_url); include_once JIEQI_ROOT_PATH . '/lib/text/textfunction.php'; $jieqiTpl->assign('url_review', $article_dynamic_url . '/admin/review.php'); $jieqiTpl->assign('checkall', '<input type="checkbox" id="checkall" name="checkall" value="checkall" onclick="javascript: for (var i=0;i<this.form.elements.length;i++){ if (this.form.elements[i].name != \'checkkall\') this.form.elements[i].checked = form.checkall.checked; }">'); $criteria = new CriteriaCompo(); if (!empty($_REQUEST['keyword'])) { $_REQUEST['keyword'] = trim($_REQUEST['keyword']); if ($_REQUEST['keytype'] == 1) { $criteria->add(new Criteria('username', $_REQUEST['keyword'], '=')); } else {
* @package article * @copyright Copyright (c) Hangzhou Jieqi Network Technology Co.,Ltd. (http://www.jieqi.com) * @author $Author: juny $ * @version $Id: voteresult.php 332 2009-02-23 09:15:08Z juny $ */ define('JIEQI_MODULE_NAME', 'article'); require_once '../../global.php'; if (empty($_REQUEST['id'])) { jieqi_printfail(LANG_ERROR_PARAMETER); } jieqi_loadlang('avote', JIEQI_MODULE_NAME); $_REQUEST['id'] = intval($_REQUEST['id']); jieqi_includedb(); $query = JieqiQueryHandler::getInstance('JieqiQueryHandler'); $criteria = new CriteriaCompo(); $criteria->setTables(jieqi_dbprefix('article_avote') . " AS v LEFT JOIN " . jieqi_dbprefix('article_avstat') . " AS s ON v.voteid=s.voteid"); $criteria->add(new Criteria('v.voteid', $_REQUEST['id'], '=')); $criteria->setLimit(1); $criteria->setSort('v.voteid'); $criteria->setOrder('DESC'); $query->queryObjects($criteria); $voteres = $query->getObject(); if (!$voteres) { jieqi_printfail($jieqiLang['article']['avote_not_exists']); } //包含区块参数 jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs'); include_once JIEQI_ROOT_PATH . '/header.php'; $article_static_url = empty($jieqiConfigs['article']['staticurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['staticurl']; $article_dynamic_url = empty($jieqiConfigs['article']['dynamicurl']) ? $jieqiModules['article']['url'] : $jieqiConfigs['article']['dynamicurl']; $jieqiTpl->assign('article_static_url', $article_static_url);
if (!file_exists($txtdir)) { jieqi_createdir($txtdir); } if ($fromrows[$k]['type'] == 1) { jieqi_writefile($txtdir . '/' . $newid . $jieqi_file_postfix['txt'], $chaptercontent); $lastvolume = $fromrows[$k]['title']; $lastvolumeid = $newid; } else { jieqi_writefile($txtdir . '/' . $newid . $jieqi_file_postfix['txt'], $chaptercontent); $lastchapter = $fromrows[$k]['title']; $lastchapterid = $newid; $size += $chaptersize; } //处理图片附件 if ($attachnum > 0 && is_object($attachs_handler)) { $attachs_handler->db->query("UPDATE " . jieqi_dbprefix('article_attachs') . " SET chapterid=" . $newChapter->getVar('chapterid') . " WHERE articleid=" . $_REQUEST['toid'] . " AND chapterid=0"); $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= jieqi_getsubdir($newChapter->getVar('articleid')); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . $newChapter->getVar('articleid'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . $newChapter->getVar('chapterid'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir);
break; case 'delete': if (!empty($_REQUEST['ulid'])) { $sql = "DELETE FROM " . jieqi_dbprefix('system_userlink') . " WHERE userid=" . intval($_SESSION['jieqiUserId']) . " AND ulid=" . intval($_REQUEST['ulid']); $userlink_handler->db->query($sql); } break; case 'top': if (!empty($_REQUEST['ulid'])) { $sql = "UPDATE " . jieqi_dbprefix('system_userlink') . " SET toptime=" . intval(JIEQI_NOW_TIME) . " WHERE userid=" . intval($_SESSION['jieqiUserId']) . " AND ulid=" . intval($_REQUEST['ulid']); $userlink_handler->db->query($sql); } break; case 'untop': if (!empty($_REQUEST['ulid'])) { $sql = "UPDATE " . jieqi_dbprefix('system_userlink') . " SET toptime=0 WHERE userid=" . intval($_SESSION['jieqiUserId']) . " AND ulid=" . intval($_REQUEST['ulid']); $userlink_handler->db->query($sql); } break; } } include_once JIEQI_ROOT_PATH . '/header.php'; $criteria = new CriteriaCompo(new Criteria('userid', $_SESSION['jieqiUserId'])); $criteria->setSort('toptime'); $criteria->setOrder('DESC'); $userlink_handler->queryObjects($criteria); $linkrows = array(); $k = 0; while ($userlink = $userlink_handler->getObject()) { $linkrows[$k]['ulid'] = $userlink->getVar('ulid'); $linkrows[$k]['ultitle'] = $userlink->getVar('ultitle');
//主题处理相关函数 include_once JIEQI_ROOT_PATH . '/include/funpost.php'; switch ($_REQUEST['action']) { case 'update': //校验错误信息数组 $check_errors = array(); //检查和过滤提交变量 $post_set = array('module' => JIEQI_MODULE_NAME, 'ownerid' => intval($ppost->getVar('ownerid')), 'topicid' => intval($ppost->getVar('topicid')), 'postid' => intval($ppost->getVar('postid')), 'posttime' => intval($ppost->getVar('posttime', 'n')), 'topictitle' => &$_POST['ptitle'], 'posttext' => &$_POST['pcontent'], 'attachment' => '', 'emptytitle' => true, 'isnew' => false, 'istopic' => intval($ppost->getVar('istopic')), 'istop' => 0, 'sname' => 'jieqiSystemParlorTime', 'attachfile' => '', 'oldattach' => '', 'checkcode' => $_POST['checkcode']); jieqi_post_checkvar($post_set, $jieqiConfigs['system'], $check_errors); if (empty($check_errors)) { $oldtitle = $ppost->getVar('subject', 'n'); //更新帖子表 jieqi_post_upedit($post_set, jieqi_dbprefix('system_pposts')); //如果是主题则更新主题表 if ($ppost->getVar('istopic') == 1 && $post_set['topictitle'] != $oldtitle) { jieqi_topic_upedit($post_set, jieqi_dbprefix('system_ptopics')); } jieqi_jumppage(JIEQI_URL . '/ptopicshow.php?tid=' . $ppost->getVar('topicid'), LANG_DO_SUCCESS, $jieqiLang['system']['ppost_edit_success']); } else { jieqi_printfail(implode('<br />', $check_errors)); } break; case 'edit': default: include_once JIEQI_ROOT_PATH . '/header.php'; $jieqiTpl->assign('subject', $ppost->getVar('subject')); $jieqiTpl->assign('topicid', $ppost->getVar('topicid')); $jieqiTpl->assign('postid', $ppost->getVar('postid')); $jieqiTpl->assign('url_ppostedit', 'ppostedit.php?do=submit'); $jieqiTpl->assign('ptitle', $ppost->getVar('subject', 'e')); $jieqiTpl->assign('pcontent', $ppost->getVar('posttext', 'e'));
if (count($payary) > 0) { $money = 0; $egold = 0; $pids = ''; foreach ($payary as $v) { $money += $v['money']; $egold += $v['egold']; if (!empty($pids)) { $pids .= ', '; } $pids .= $v['payid']; } $buyname = $_SESSION['jieqiUserName']; $buyid = $_SESSION['jieqiUserId']; include_once JIEQI_ROOT_PATH . '/class/users.php'; $users_handler =& JieqiUsersHandler::getInstance('JieqiUsersHandler'); if (isset($jieqiPayset[JIEQI_PAY_TYPE]['scorerate'])) { $addscore = ceil($egold * $jieqiPayset[JIEQI_PAY_TYPE]['scorerate']); } else { $addscore = 0; } $ret = $users_handler->income($buyid, $egold, $jieqiPayset[JIEQI_PAY_TYPE]['paysilver'], $addscore); $sql = "UPDATE " . jieqi_dbprefix('pay_paylog') . " SET buyid='" . intval($buyid) . "', buyname='" . jieqi_dbslashes($buyname) . "', rettime='" . intval(JIEQI_NOW_TIME) . "', payflag='1' WHERE payid IN (" . $pids . ')'; $ret = $paylog_handler->db->query($sql); if (!$ret) { jieqi_printfail($jieqiLang['pay']['save_paylog_failure']); } jieqi_msgwin(LANG_DO_SUCCESS, sprintf($jieqiLang['pay']['call_cinfirm_success'], jieqi_htmlstr($buyname), sprintf('%0.2f', $money / 100), $egold, JIEQI_EGOLD_NAME)); } else { jieqi_printfail($jieqiLang['pay']['no_buy_record']); }
} else { $sql .= ', weeksale=weeksale+' . $addnum; } if (substr($nowdate, 0, 7) == substr($lastdate, 0, 7)) { $sql .= ', monthsale=monthsale+' . $addnum; } else { $sql .= ', monthsale=' . $addnum; } } $sql .= ', allsale=allsale+' . $addnum . ', normalsale=normalsale+' . $addnum . ', totalsale=totalsale+' . $addnum . ', lastsale=' . JIEQI_NOW_TIME; if ($pricetype == 1) { $sql .= ', sumesilver=sumesilver+' . $v['saleprice']; } else { $sql .= ', sumegold=sumegold+' . $v['saleprice']; } $sql = "UPDATE " . jieqi_dbprefix('obook_ochapter') . " SET " . $sql . " WHERE ochapterid=" . $v['ochapterid']; $query->execute($sql); } //改变电子书信息里面的销售状态 include_once $jieqiModules['obook']['path'] . '/class/obook.php'; $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler'); $obook = $obook_handler->get($_REQUEST['oid']); if (is_object($obook)) { $lastsale = $obook->getVar('lastsale', 'n'); $lastdate = date('Y-m-d', $lastsale); $nowdate = date('Y-m-d', JIEQI_NOW_TIME); $nowweek = date('w', JIEQI_NOW_TIME); $addnum = $chapternum; if ($nowdate == $lastdate) { $daysale = $obook->getVar('daysale', 'n') + $addnum; $weeksale = $obook->getVar('weeksale', 'n') + $addnum;