} $attachdir = jieqi_uploadpath($jieqiConfigs['article']['attachdir'], 'article'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= jieqi_getsubdir($chapter->getVar('articleid')); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . $chapter->getVar('articleid'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . $chapter->getVar('chapterid'); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } //判断是否加水印 $make_image_water = false; if (function_exists('gd_info') && $jieqiConfigs['article']['attachwater'] > 0 && JIEQI_MODULE_VTYPE != '' && JIEQI_MODULE_VTYPE != 'Free') { if (strpos($jieqiConfigs['article']['attachwimage'], '/') === false && strpos($jieqiConfigs['article']['attachwimage'], '\\') === false) { $water_image_file = $jieqiModules['article']['path'] . '/images/' . $jieqiConfigs['article']['attachwimage']; } else { $water_image_file = $jieqiConfigs['article']['attachwimage']; } if (is_file($water_image_file)) { $make_image_water = true; include_once JIEQI_ROOT_PATH . '/lib/image/imagewater.php'; } } foreach ($attachary as $k => $v) {
function getDir($dirtype = 'txtdir', $idasdir = true, $automake = true) { global $jieqiConfigs; $retdir = jieqi_uploadpath($jieqiConfigs['article'][$dirtype], 'article'); if ($automake && !file_exists($retdir)) { jieqi_createdir($retdir); } $retdir .= jieqi_getsubdir($this->id); if ($automake && !file_exists($retdir)) { jieqi_createdir($retdir); } if ($idasdir) { $retdir .= '/' . $this->id; if ($automake && !file_exists($retdir)) { jieqi_createdir($retdir); } } return $retdir; }
function makestaticinfo($article_id) { global $jieqiConfigs; global $jieqiSort; global $jieqiTpl; global $jieqiBlocks; global $jieqi_file_postfix; global $jieqiOption; if (!is_object($jieqiTpl)) { $jieqiTpl =& JieqiTpl::getInstance(); } if (empty($article_id) || !is_numeric($article_id)) { return false; } $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $article = $article_handler->get($article_id); if (!$article) { return false; } //包含区块参数(定制) jieqi_getconfigs(JIEQI_MODULE_NAME, 'sort'); jieqi_getconfigs(JIEQI_MODULE_NAME, 'configs'); $jieqi_pagetitle = $article->getVar('articlename'); if ($article->getVar('lastvolume') != '') { $jieqi_pagetitle .= '-' . $article->getVar('lastvolume'); } $jieqi_pagetitle .= '-' . $article->getVar('lastchapter') . '-' . JIEQI_SITE_NAME; $jieqiTpl->assign('jieqi_pagetitle', $jieqi_pagetitle); $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); $jieqiTpl->assign('articlename', $article->getVar('articlename')); $jieqiTpl->assign('postdate', date('Y-m-d', $article->getVar('postdate'))); $jieqiTpl->assign('lastupdate', date('Y-m-d', $article->getVar('lastupdate'))); if ($article->getVar('authorid') > 0) { $jieqiTpl->assign('author', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('authorid')) . '" target="_blank">' . $article->getVar('author') . '</a>'); } else { $jieqiTpl->assign('author', $article->getVar('author')); } if ($article->getVar('agentid') > 0) { $jieqiTpl->assign('agent', '<a href="' . jieqi_geturl('system', 'user', $article->getVar('agentid')) . '" target="_blank">' . $article->getVar('agent') . '</a>'); } else { $jieqiTpl->assign('agent', $article->getVar('agent')); } $jieqiTpl->assign('sortid', $article->getVar('sortid')); $jieqiTpl->assign('sort', $jieqiSort['article'][$article->getVar('sortid')]['caption']); $jieqiTpl->assign('intro', $article->getVar('intro')); $jieqiTpl->assign('notice', $article->getVar('notice')); $imgflag = $article->getVar('imgflag'); //小图 if (($imgflag & 1) > 0) { $jieqiTpl->assign('hasimage', 1); $jieqiTpl->assign('url_simage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']); } else { $jieqiTpl->assign('hasimage', 0); $jieqiTpl->assign('url_simage', ''); } //大图 if (($imgflag & 2) > 0) { $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 'l' . $jieqiConfigs['article']['imagetype']); } elseif (($imgflag & 1) > 0) { $jieqiTpl->assign('url_limage', jieqi_uploadurl($jieqiConfigs['article']['imagedir'], $jieqiConfigs['article']['imageurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . '/' . $article->getVar('articleid') . 's' . $jieqiConfigs['article']['imagetype']); } else { $jieqiTpl->assign('url_limage', ''); } $lastchapter = $article->getVar('lastchapter'); if ($lastchapter != '') { if ($article->getVar('lastvolume') != '') { $lastchapter = $article->getVar('lastvolume') . ' ' . $lastchapter; } $jieqiTpl->assign('url_lastchapter', jieqi_geturl('article', 'chapter', $article->getVar('lastchapterid'), $article->getVar('articleid'))); } else { $jieqiTpl->assign('url_lastchapter', ''); } //显示多个最新章节 if (is_numeric($jieqiConfigs['article']['infochapternum']) && intval($jieqiConfigs['article']['infochapternum']) > 0) { $jieqiConfigs['article']['infochapternum'] = intval($jieqiConfigs['article']['infochapternum']); include_once $GLOBALS['jieqiModules']['article']['path'] . '/class/chapter.php'; $chapter_handler =& JieqiChapterHandler::getInstance('JieqiChapterHandler'); $criteria = new CriteriaCompo(new Criteria('articleid', $article->getVar('articleid'), '=')); $criteria->setSort('chapterorder'); $criteria->setOrder('DESC'); $criteria->setLimit($jieqiConfigs['article']['infochapternum'] + ceil($jieqiConfigs['article']['infochapternum'] / 4)); $chapter_handler->queryObjects($criteria); $chapterrows = array(); $k = 0; $volumename = $article->getVar('lastvolume'); while ($chapter = $chapter_handler->getObject()) { if ($chapter->getVar('chaptertype') == 1) { $volumename = $chapter->getVar('chaptername'); } else { $chapterrows[$k]['volumename'] = $volumename; $chapterrows[$k]['chaptername'] = $chapter->getVar('chaptername'); if ($chapterrows[$k]['volumename'] != '') { $chapterrows[$k]['chapter'] = $chapterrows[$k]['volumename'] . ' ' . $chapterrows[$k]['chaptername']; } else { $chapterrows[$k]['chapter'] = $chapterrows[$k]['chaptername']; } $chapterrows[$k]['chapterid'] = $chapter->getVar('chapterid'); $chapterrows[$k]['url_chapter'] = jieqi_geturl('article', 'chapter', $chapter->getVar('chapterid'), $article->getVar('articleid')); $k++; if ($k >= $jieqiConfigs['article']['infochapternum']) { break; } } } $jieqiTpl->assign_by_ref('chapterrows', $chapterrows); } $jieqiTpl->assign('lastchapter', $lastchapter); $jieqiTpl->assign('size', $article->getVar('size')); $jieqiTpl->assign('size_k', ceil($article->getVar('size') / 1024)); $jieqiTpl->assign('size_c', ceil($article->getVar('size') / 2)); $jieqiTpl->assign('dayvisit', $article->getVar('dayvisit')); $jieqiTpl->assign('weekvisit', $article->getVar('weekvisit')); $jieqiTpl->assign('monthvisit', $article->getVar('monthvisit')); $jieqiTpl->assign('allvisit', $article->getVar('allvisit')); $jieqiTpl->assign('dayvote', $article->getVar('dayvote')); $jieqiTpl->assign('weekvote', $article->getVar('weekvote')); $jieqiTpl->assign('monthvote', $article->getVar('monthvote')); $jieqiTpl->assign('allvote', $article->getVar('allvote')); $jieqiTpl->assign('goodnum', $article->getVar('goodnum')); $jieqiTpl->assign('badnum', $article->getVar('badnum')); jieqi_getconfigs('article', 'option', 'jieqiOption'); $tmpvar = $article->getVar('fullflag'); if (isset($jieqiOption['article']['fullflag']['items'][$tmpvar])) { $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$tmpvar]); } else { $jieqiTpl->assign('fullflag', $jieqiOption['article']['fullflag']['items'][$jieqiOption['article']['fullflag']['default']]); } $tmpvar = $article->getVar('permission'); if (isset($jieqiOption['article']['permission']['items'][$tmpvar])) { $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$tmpvar]); } else { $jieqiTpl->assign('permission', $jieqiOption['article']['permission']['items'][$jieqiOption['article']['permission']['default']]); } $tmpvar = $article->getVar('firstflag'); if (isset($jieqiOption['article']['firstflag']['items'][$tmpvar])) { $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$tmpvar]); } else { $jieqiTpl->assign('firstflag', $jieqiOption['article']['firstflag']['items'][$jieqiOption['article']['firstflag']['default']]); } //管理 $jieqiTpl->assign('url_manage', $article_static_url . '/articlemanage.php?id=' . $article->getVar('articleid')); //举报 $tmpstr = sprintf($jieqiLang['article']['article_report_reason'], jieqi_geturl('article', 'article', $article->getVar('articleid'), 'info')); $jieqiTpl->assign('url_report', $article_dynamic_url . '/newmessage.php?tosys=1&title=' . urlencode(sprintf($jieqiLang['article']['article_report_title'], $article->getVar('articlename', 'n'))) . '&content=' . urlencode($tmpstr)); //采集 $setting = unserialize($article->getVar('setting', 'n')); $url_collect = $article_static_url . '/collect.php?toid=' . $article->getVar('articleid', 'n'); if (is_numeric($setting['fromarticle'])) { $url_collect .= '&fromid=' . $setting['fromarticle']; } if (is_numeric($setting['fromsite'])) { $url_collect .= '&siteid=' . $setting['fromsite']; } $jieqiTpl->assign('url_collect', $url_collect); //文章序号 $jieqiTpl->assign('articleid', $article->getVar('articleid')); //点击阅读,全文阅读 if ($article->getVar('chapters', 'n') > 0) { $jieqiTpl->assign('url_read', jieqi_geturl('article', 'article', $article->getVar('articleid'), 'index')); if ($jieqiConfigs['article']['makefull'] == 0 || JIEQI_CHAR_SET != JIEQI_SYSTEM_CHARSET) { $jieqiTpl->assign('url_fullpage', $article_static_url . '/reader.php?aid=' . $article->getVar('articleid')); } else { $jieqiTpl->assign('url_fullpage', jieqi_uploadurl($jieqiConfigs['article']['fulldir'], $jieqiConfigs['article']['fullurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqiConfigs['article']['htmlfile']); } } else { $jieqiTpl->assign('url_read', '#'); $jieqiTpl->assign('url_fullpage', '#'); } //放入书架 $jieqiTpl->assign('url_bookcase', $article_dynamic_url . '/addbookcase.php?bid=' . $article->getVar('articleid')); //推荐本书 $jieqiTpl->assign('url_uservote', $article_dynamic_url . '/uservote.php?id=' . $article->getVar('articleid')); //作家专栏 if ($article->getVar('authorid') > 0) { $jieqiTpl->assign('url_authorpage', $article_dynamic_url . '/authorpage.php?id=' . $article->getVar('authorid')); } else { $jieqiTpl->assign('url_authorpage', '#'); } //打包下载 if ($article->getVar('chapters', 'n') > 0) { if ($jieqiConfigs['article']['makehtml'] == 0) { $jieqiTpl->assign('url_download', '#'); } else { $jieqiTpl->assign('url_download', jieqi_uploadurl($jieqiConfigs['article']['zipdir'], $jieqiConfigs['article']['zipurl'], 'article', $article_static_url) . jieqi_getsubdir($article->getVar('articleid')) . '/' . $article->getVar('articleid') . $jieqi_file_postfix['zip']); } } else { $jieqiTpl->assign('url_download', '#'); } //电子书部分 $articletype = intval($article->getVar('articletype')); if (($articletype & 1) > 0) { $hasebook = 1; } else { $hasebook = 0; } if (($articletype & 2) > 0) { $hasobook = 1; } else { $hasobook = 0; } if (($articletype & 4) > 0) { $hastbook = 1; } else { $hastbook = 0; } if ($hasobook == 1) { include_once $GLOBALS['jieqiModules']['obook']['path'] . '/class/obook.php'; $obook_handler =& JieqiObookHandler::getInstance('JieqiObookHandler'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('articleid', $article->getVar('articleid'), '=')); $obook_handler->queryObjects($criteria); $obook = $obook_handler->getObject(); if (is_object($obook) && $obook->getVar('display') == 0 && $obook->getVar('size') > 0) { $jieqiTpl->assign('obook_obookid', $obook->getVar('obookid')); $jieqiTpl->assign('obook_lastvolume', $obook->getVar('lastvolume')); $jieqiTpl->assign('obook_lastvolumeid', $obook->getVar('lastvolumeid')); $jieqiTpl->assign('obook_lastchapter', $obook->getVar('lastchapter')); $jieqiTpl->assign('obook_lastchapterid', $obook->getVar('lastchapterid')); $jieqiTpl->assign('obook_lastupdate', date(JIEQI_DATE_FORMAT, $obook->getVar('lastupdate'))); $jieqiTpl->assign('obook_size', $obook->getVar('size')); $jieqiTpl->assign('obook_publishid', $obook->getVar('publishid')); } else { $hasobook = 0; } } $jieqiTpl->assign('articletype', $articletype); $jieqiTpl->assign('hasebook', $hasebook); $jieqiTpl->assign('hasobook', $hasobook); $jieqiTpl->assign('hastbook', $hastbook); $jieqiTpl->assign('url_goodreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=good'); $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid') . '&type=all'); $jieqiTpl->assign('url_review', $article_dynamic_url . '/review.php?aid=' . $article->getVar('articleid')); if (!empty($_SESSION['jieqiUserId'])) { $jieqiTpl->assign('enablepost', 1); } else { $jieqiTpl->assign('enablepost', 0); } $jieqiTpl->setCaching(0); $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/staticinfo.html')); ob_start(); include JIEQI_ROOT_PATH . '/footer.php'; $pagecontent = ob_get_contents(); ob_end_clean(); if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = JIEQI_ROOT_PATH . '/' . $jieqiConfigs['article']['fakeprefix'] . 'info'; } else { $dirname = JIEQI_ROOT_PATH . '/files/article/info'; } if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname = $dirname . jieqi_getsubdir($article->getVar('articleid', 'n')); if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname .= '/' . $article->getVar('articleid', 'n') . $jieqiConfigs['article']['fakefile']; jieqi_writefile($dirname, $pagecontent); return true; }
/** * 附件文件保存 * * @param array $post_set 发帖信息设置 * @param array $attachary 附件信息数组 * @param array $configs 配置参数 * @access public * @return void */ function jieqi_post_attachfile(&$post_set, &$attachary, $configs) { //判断是否加水印 $make_image_water = false; if (function_exists('gd_info') && $configs['attachwater'] > 0 && JIEQI_MODULE_VTYPE != '' && JIEQI_MODULE_VTYPE != 'Free') { if (strpos($configs['attachwimage'], '/') === false && strpos($configs['attachwimage'], '\\') === false) { $water_image_file = $GLOBALS['jieqiModules'][$post_set['module']]['path'] . '/images/' . $configs['attachwimage']; } else { $water_image_file = $configs['attachwimage']; } if (is_file($water_image_file)) { $make_image_water = true; include_once JIEQI_ROOT_PATH . '/lib/image/imagewater.php'; } } $attachdir = jieqi_uploadpath($configs['attachdir'], $post_set['module']); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } $attachdir .= '/' . date('Ymd', $post_set['posttime']); if (!file_exists($attachdir)) { jieqi_createdir($attachdir); } foreach ($attachary as $k => $v) { $attach_save_path = $attachdir . '/' . $post_set['postid'] . '_' . $attachary[$k]['attachid'] . '.' . $attachary[$k]['postfix']; $tmp_attachfile = dirname($_FILES['attachfile']['tmp_name'][$v['order']]) . '/' . basename($attach_save_path); @move_uploaded_file($_FILES['attachfile']['tmp_name'][$v['order']], $tmp_attachfile); //图片加水印 if ($make_image_water && eregi("\\.(gif|jpg|jpeg|png)\$", $tmp_attachfile)) { $img = new ImageWater(); $img->save_image_file = $tmp_attachfile; $img->codepage = JIEQI_SYSTEM_CHARSET; $img->wm_image_pos = $configs['attachwater']; $img->wm_image_name = $water_image_file; $img->wm_image_transition = $configs['attachwtrans']; $img->jpeg_quality = $configs['attachwquality']; $img->create($tmp_attachfile); unset($img); } jieqi_copyfile($tmp_attachfile, $attach_save_path, 0777, true); } }
$obook->setVar('imgflag', $imgflag); if (!$obook_handler->insert($obook)) { jieqi_printfail($jieqiLang['obook']['edit_obook_failure']); } else { $_REQUEST['id'] = $obook->getVar('obookid'); $imagedir = jieqi_uploadpath($jieqiConfigs['obook']['imagedir'], 'obook'); if (!file_exists($imagedir)) { jieqi_createdir($imagedir); } $imagedir .= jieqi_getsubdir($_REQUEST['id']); if (!file_exists($imagedir)) { jieqi_createdir($imagedir); } $imagedir .= '/' . $_REQUEST['id']; if (!file_exists($imagedir)) { jieqi_createdir($imagedir); } //保存小图 if (!empty($_FILES['obookspic']['name'])) { if (strstr(strtolower($_FILES['obookspic']['name']), strtolower($jieqiConfigs['obook']['imagetype'])) == strtolower($jieqiConfigs['obook']['imagetype'])) { jieqi_copyfile($_FILES['obookspic']['tmp_name'], $imagedir . '/' . $_REQUEST['id'] . 's' . $jieqiConfigs['obook']['imagetype'], 0777, true); } } //保存大图 if (!empty($_FILES['obooklpic']['name'])) { if (strstr(strtolower($_FILES['obooklpic']['name']), strtolower($jieqiConfigs['obook']['imagetype'])) == strtolower($jieqiConfigs['obook']['imagetype'])) { jieqi_copyfile($_FILES['obooklpic']['tmp_name'], $imagedir . '/' . $_REQUEST['id'] . 'l' . $jieqiConfigs['obook']['imagetype'], 0777, true); } } jieqi_jumppage($obook_static_url . '/obookmanage.php?id=' . $_REQUEST['id'], LANG_DO_SUCCESS, $jieqiLang['obook']['edit_obook_success']); }
/** * 检查目录是否存在,不存在尝试自动建立 * * @param string $dirname 目录名 * @param bool $autocreate 目录不存在是否尝试自动建立,默认否 * @access public * @return bool 成功返回true,失败返回false */ function jieqi_checkdir($dirname, $autocreate = false) { if (is_dir($dirname)) { return true; } else { if (empty($autocreate)) { return false; } else { return jieqi_createdir($dirname, 0777, true); } } }
function getsubdir($dirname, $id) { global $jieqiConfigs; $retdir = ''; if (!empty($dirname) && is_numeric($id)) { $retdir .= jieqi_getsubdir($id); if (!file_exists($retdir)) { jieqi_createdir($retdir); } } return $retdir; }
jieqi_loadlang('database', JIEQI_MODULE_NAME); if ($jieqiUsersStatus != JIEQI_GROUP_ADMIN) { jieqi_printfail(LANG_NEED_ADMIN); } @set_time_limit(0); @session_write_close(); jieqi_includedb(); $query_handler = JieqiQueryHandler::getInstance('JieqiQueryHandler'); include_once JIEQI_ROOT_PATH . '/admin/header.php'; include_once JIEQI_ROOT_PATH . '/lib/html/formloader.php'; //定义常量 if (!defined('MYSQL_BACKUP_PATH')) { define('MYSQL_BACKUP_PATH', JIEQI_ROOT_PATH . '/files/system/dbbackup'); } if (!jieqi_checkdir(MYSQL_BACKUP_PATH, true)) { jieqi_createdir(MYSQL_BACKUP_PATH, 0777, TRUE); } define('MYSQL_SERVER_INFO', mysql_get_server_info()); if ($_REQUEST['option'] == 'export') { if (isset($_REQUEST['method']) && $_REQUEST['method'] == 'backup') { //表单数据合法性 $exporttype = $_REQUEST['exporttype'] == 'select' ? 'select' : 'all'; $exporttables = $_REQUEST['tablearray']; $exportmode = $_REQUEST['exportmode'] == 'mysqldump' ? 'mysqldump' : 'multivol'; $sqlcompat = $_REQUEST['exportversion'] ? $_REQUEST['exportversion'] == 'MYSQL40' ? 'MYSQL40' : 'MYSQL41' : ''; $sqlcharset = in_array($_REQUEST['exportcharset'], array('gbk', 'big5', 'utf8')) ? $_REQUEST['exportcharset'] : ''; $dumpcharset = $sqlcharset ? $sqlcharset : str_replace('-', '', JIEQI_CHAR_SET); $extendins = $_REQUEST['exportinsert'] == 1 ? 1 : 0; $sizelimit = intval(trim($_REQUEST['exportsize'])); if ($sizelimit < 100) { $sizelimit = 100;
function makestatictoplist($sort = '', $class = '', $thispage = 0, $maxpage = 0) { global $jieqiConfigs; global $jieqiSort; global $jieqiTpl; global $jieqiBlocks; if (!is_object($jieqiTpl)) { $jieqiTpl =& JieqiTpl::getInstance(); } //排序方式 if (empty($sort)) { $sort = 'lastupdate'; } //类别 if (empty($class) || !is_numeric($class)) { $class = 0; } //页码 if (empty($thispage) || !is_numeric($thispage)) { $thispage = 1; } //是否缓存 $content_used_cache = false; $jieqiTpl->setCaching(0); $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); //是否使用伪静态页面 $jieqiTpl->assign('fakefile', $jieqiConfigs['article']['fakefile']); $jieqiTpl->assign('fakeinfo', $jieqiConfigs['article']['fakeinfo']); $jieqiTpl->assign('fakesort', $jieqiConfigs['article']['fakesort']); $jieqiTpl->assign('fakeinitial', $jieqiConfigs['article']['fakeinitial']); $jieqiTpl->assign('faketoplist', $jieqiConfigs['article']['faketoplist']); $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $criteria = new CriteriaCompo(new Criteria('display', '0', '=')); $criteria->add(new Criteria('size', '0', '>')); //类别 jieqi_getconfigs('article', 'sort'); if (!empty($class) && is_numeric($class)) { $criteria->add(new Criteria('sortid', $class, '=')); $classinfo = ' - ' . $jieqiSort['article'][$class]['caption']; } else { $class = 0; $classinfo = ''; } $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 'allvisit': $criteria->setSort('allvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_allvisit_title'], $classinfo)); break; case 'monthvisit': $criteria->add(new Criteria('lastvisit', $monthstart, '>=')); $criteria->setSort('monthvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_monthvisit_title'], $classinfo)); break; case 'weekvisit': $criteria->add(new Criteria('lastvisit', $weekstart, '>=')); $criteria->setSort('weekvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_weekvisit_title'], $classinfo)); break; case 'dayvisit': $criteria->add(new Criteria('lastvisit', $daystart, '>=')); $criteria->setSort('dayvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_dayvisit_title'], $classinfo)); break; case 'allauthorvisit': $criteria->add(new Criteria('authorid', '0', '>')); $criteria->setSort('allvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avall_title'], $classinfo)); break; case 'monthauthorvisit': $criteria->add(new Criteria('lastvisit', $monthstart, '>=')); $criteria->add(new Criteria('authorid', '0', '>')); $criteria->setSort('monthvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avmonth_title'], $classinfo)); break; case 'weekauthorvisit': $criteria->add(new Criteria('lastvisit', $weekstart, '>=')); $criteria->add(new Criteria('authorid', '0', '>')); $criteria->setSort('weekvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avweek_title'], $classinfo)); break; case 'dayauthorvisit': $criteria->add(new Criteria('lastvisit', $daystart, '>=')); $criteria->add(new Criteria('authorid', '0', '>')); $criteria->setSort('dayvisit'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_avday_title'], $classinfo)); break; case 'allvote': $criteria->setSort('allvote'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteall_title'], $classinfo)); break; case 'monthvote': $criteria->add(new Criteria('lastvote', $monthstart, '>=')); $criteria->setSort('monthvote'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_votemonth_title'], $classinfo)); break; case 'weekvote': $criteria->add(new Criteria('lastvote', $weekstart, '>=')); $criteria->setSort('weekvote'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteweek_title'], $classinfo)); break; case 'dayvote': $criteria->add(new Criteria('lastvote', $daystart, '>=')); $criteria->setSort('dayvote'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_voteday_titile'], $classinfo)); break; case 'postdate': $criteria->setSort('postdate'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_postdate_title'], $classinfo)); break; case 'toptime': $criteria->setSort('toptime'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_toptime_title'], $classinfo)); break; case 'goodnum': $criteria->setSort('goodnum'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_goodnum_title'], $classinfo)); break; case 'size': $criteria->setSort('size'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_size_title'], $classinfo)); break; case 'authorupdate': $criteria->setSort('lastupdate'); $criteria->add(new Criteria('authorid', '0', '>')); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_authorupdate_title'], $classinfo)); break; case 'masterupdate': $criteria->setSort('lastupdate'); $criteria->add(new Criteria('authorid', '0', '=')); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_masterupdate_title'], $classinfo)); break; case 'lastupdate': default: $_REQUEST['sort'] = 'lastupdate'; $criteria->setSort('lastupdate'); $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['top_lastupdate_title'], $classinfo)); break; } $criteria->setOrder('DESC'); $criteria->setLimit($jieqiConfigs['article']['pagenum']); $criteria->setStart(($thispage - 1) * $jieqiConfigs['article']['pagenum']); $article_handler->queryObjects($criteria); $articlerows = array(); $k = 0; while ($v = $article_handler->getObject()) { $articlerows[$k] = jieqi_article_vars($v); $k++; } $jieqiTpl->assign_by_ref('articlerows', $articlerows); //处理页面跳转 $toplistrows = $article_handler->getCount($criteria); $truemaxpage = ceil($toplistrows / $jieqiConfigs['article']['pagenum']); $maxpage = intval($maxpage); if (!empty($maxpage) && $maxpage < $truemaxpage) { $toplistrows = $maxpage * $jieqiConfigs['article']['pagenum']; } else { $maxpage = $truemaxpage; } $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']); if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'top' . $sort; } else { $dirname = '/files/article/top' . $sort; } $jumppage->setlink($article_dynamic_url . $dirname); $jieqiTpl->assign('url_jumppage', $jumppage->whole_bar()); $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/toplist.html')); ob_start(); include JIEQI_ROOT_PATH . '/footer.php'; $pagecontent = ob_get_contents(); ob_end_clean(); $dirname = JIEQI_ROOT_PATH . $dirname; if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname = $dirname . jieqi_getsubdir($thispage); if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname .= '/' . $thispage . $jieqiConfigs['article']['fakefile']; jieqi_writefile($dirname, $pagecontent); return $maxpage; }
function makestaticindex($class, $initial, $fullflag, $thispage, $maxpage = 0) { global $jieqiConfigs; global $jieqiSort; global $jieqiTpl; global $jieqiBlocks; if (!is_object($jieqiTpl)) { $jieqiTpl =& JieqiTpl::getInstance(); } //文章类别 if (empty($class) || !is_numeric($class)) { $class = 0; } //页码 if (empty($thispage) || !is_numeric($thispage)) { $thispage = 1; } if (empty($fullflag)) { $fullflag = 0; } else { $fullflag = 1; } //cache名称 $cache_id = $fullflag; if (isset($initial) && trim(strval($initial)) != '') { if ($initial == '~' || $initial == '0') { $cache_id .= '_i0'; } else { $cache_id .= '_i' . $initial; } } else { $cache_id .= '_s' . $class; } $pagecacheid = $cache_id; $cache_id .= '_p' . $thispage; if (!empty($class)) { $jieqi_pagetitle = $jieqiSort['article'][$class]['caption'] . '>>' . JIEQI_SITE_NAME; $jieqiTpl->assign('jieqi_pagetitle', $jieqi_pagetitle); } $jieqiTpl->setCaching(0); $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); //是否使用伪静态页面 $jieqiTpl->assign('fakefile', $jieqiConfigs['article']['fakefile']); $jieqiTpl->assign('fakeinfo', $jieqiConfigs['article']['fakeinfo']); $jieqiTpl->assign('fakesort', $jieqiConfigs['article']['fakesort']); $jieqiTpl->assign('fakeinitial', $jieqiConfigs['article']['fakeinitial']); $jieqiTpl->assign('faketoplist', $jieqiConfigs['article']['faketoplist']); $article_handler =& JieqiArticleHandler::getInstance('JieqiArticleHandler'); $criteria = new CriteriaCompo(new Criteria('display', '0', '=')); $criteria->add(new Criteria('size', '0', '>')); if (!empty($fullflag)) { $criteria->add(new Criteria('fullflag', '1', '=')); $fulltitle = $jieqiLang['article']['list_full_title']; } else { $fulltitle = ''; } if (!empty($initial)) { $criteria->add(new Criteria('initial', strtoupper($initial), '=')); if ($initial == '1') { $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_numeric_title'], $fulltitle)); } elseif ($initial == '~') { $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_other_title'], $fulltitle)); } else { $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_char_title'], $initial, $fulltitle)); } $criteria->setSort('articlename'); $criteria->setOrder('ASC'); } elseif (!empty($class)) { $criteria->add(new Criteria('sortid', $class, '=')); $jieqiTpl->assign('articletitle', $jieqiSort['article'][$class]['caption'] . $fulltitle); $criteria->setSort('lastupdate'); $criteria->setOrder('DESC'); } else { $jieqiTpl->assign('articletitle', sprintf($jieqiLang['article']['list_all_title'], $fulltitle)); $criteria->setSort('lastupdate'); $criteria->setOrder('DESC'); } $criteria->setLimit($jieqiConfigs['article']['pagenum']); $criteria->setStart(($thispage - 1) * $jieqiConfigs['article']['pagenum']); $article_handler->queryObjects($criteria); $articlerows = array(); $k = 0; while ($v = $article_handler->getObject()) { $articlerows[$k] = jieqi_article_vars($v); $k++; } $jieqiTpl->assign_by_ref('articlerows', $articlerows); $jieqiTpl->assign('url_initial', $article_dynamic_url . '/index.php?initial='); //处理页面跳转 $toplistrows = $article_handler->getCount($criteria); $truemaxpage = ceil($toplistrows / $jieqiConfigs['article']['pagenum']); $maxpage = intval($maxpage); if (!empty($maxpage) && $maxpage < $truemaxpage) { $toplistrows = $maxpage * $jieqiConfigs['article']['pagenum']; } else { $maxpage = $truemaxpage; } if (!empty($initial)) { $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']); if ($initial == '~') { $tmpvar = '0'; } else { $tmpvar = $initial; } if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'initial' . $tmpvar; } else { $dirname = '/files/article/initial' . $tmpvar; } $jumppage->setlink($article_dynamic_url . $dirname); } else { $jumppage = new JieqiPage($toplistrows, $jieqiConfigs['article']['pagenum'], $thispage, 10, $jieqiConfigs['article']['fakefile']); if (!empty($class)) { $tmpvar = $class; } else { $tmpvar = ''; } if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = '/' . $jieqiConfigs['article']['fakeprefix'] . 'sort' . $tmpvar; } else { $dirname = '/files/article/sort' . $tmpvar; } $jumppage->setlink($article_dynamic_url . $dirname); } $jieqiTpl->assign('url_jumppage', $jumppage->whole_bar()); $jieqiTpl->assign('jieqi_contents', $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/articlelist.html')); ob_start(); include JIEQI_ROOT_PATH . '/footer.php'; $pagecontent = ob_get_contents(); ob_end_clean(); $dirname = JIEQI_ROOT_PATH . $dirname; if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname = $dirname . jieqi_getsubdir($thispage); if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname .= '/' . $thispage . $jieqiConfigs['article']['fakefile']; jieqi_writefile($dirname, $pagecontent); return $maxpage; }
$jieqiTpl->setCaching(0); $jieqiTset['jieqi_contents_template'] = $jieqiModules['obook']['path'] . '/templates/obookmanage.html'; include_once JIEQI_ROOT_PATH . '/footer.php'; //如果关联文章,则生成文章的vip章节目录,更新阅读目录index.html if (count($chapterary) > 0 && is_dir($jieqiModules['obook']['path'] . '/')) { $updatearticle = false; $articleid = $obook->getVar('articleid', 'n'); if ($articleid > 0) { //有关联文章 $linkfile = JIEQI_ROOT_PATH . '/files/obook/articlelink'; if (!file_exists($linkfile)) { jieqi_createdir($linkfile); } $linkfile .= jieqi_getsubdir($articleid); if (!file_exists($linkfile)) { jieqi_createdir($linkfile); } $linkfile .= '/' . $articleid . '.php'; if (!empty($_REQUEST['updatelink']) || !file_exists($linkfile) || filemtime($linkfile) < $obook->getVar('lastupdate')) { $obookinfo = array(); $obookinfo['obookid'] = $obook->getVar('obookid', 'n'); $obookinfo['postdate'] = $obook->getVar('postdate', 'n'); $obookinfo['lastupdate'] = $obook->getVar('lastupdate', 'n'); $obookinfo['obookname'] = $obook->getVar('obookname', 'n'); $obookinfo['sortid'] = $obook->getVar('sortid', 'n'); $obookinfo['lastvolumeid'] = $obook->getVar('lastvolumeid', 'n'); $obookinfo['lastvolume'] = $obook->getVar('lastvolume', 'n'); $obookinfo['lastchapterid'] = $obook->getVar('lastchapterid', 'n'); $obookinfo['lastchapter'] = $obook->getVar('lastchapter', 'n'); $obookinfo['chapters'] = $obook->getVar('chapters', 'n'); $obookinfo['size'] = $obook->getVar('size', 'n');
$old_avatar = $jieqiUsers->getVar('avatar', 'n'); $jieqiUsers->unsetNew(); $jieqiUsers->setVar('avatar', $image_type); if (!$users_handler->insert($jieqiUsers)) { jieqi_printfail($jieqiLang['system']['avatar_set_failure']); } else { //<!--jieqi insert license check--> //保存图片 if (!empty($_FILES['avatarimage']['name'])) { $imagefile = jieqi_uploadpath($jieqiConfigs['system']['avatardir'], 'system'); if (!file_exists($retdir)) { jieqi_createdir($imagefile); } $imagefile .= jieqi_getsubdir($jieqiUsers->getVar('uid', 'n')); if (!file_exists($retdir)) { jieqi_createdir($imagefile); } if ($old_avatar > 0 && isset($jieqi_image_type[$old_avatar])) { $old_imagefile = $imagefile . '/' . $jieqiUsers->getVar('uid', 'n') . $jieqi_image_type[$old_avatar]; if (is_file($old_imagefile)) { jieqi_delfile($old_imagefile); } } $imagefile .= '/' . $jieqiUsers->getVar('uid', 'n') . $image_postfix; jieqi_copyfile($_FILES['avatarimage']['tmp_name'], $imagefile, 0777, true); } jieqi_jumppage(JIEQI_URL . '/setavatar.php', LANG_DO_SUCCESS, $jieqiLang['system']['avatar_set_success']); } } } else { jieqi_printfail($errtext);
function makestaticreview($article_id) { global $jieqiConfigs; global $jieqiTpl; global $article_dynamic_url; global $article_static_url; if (!is_object($jieqiTpl)) { $jieqiTpl =& JieqiTpl::getInstance(); } if (empty($article_id) || !is_numeric($article_id)) { return false; } $review_handler =& JieqiReviewHandler::getInstance('JieqiReviewHandler'); $criteria = new CriteriaCompo(new Criteria('ownerid', $article_id)); $criteria->setSort('topflag DESC, topicid'); $criteria->setOrder('DESC'); $criteria->setLimit($jieqiConfigs['article']['reviewnew']); $criteria->setStart(0); $review_handler->queryObjects($criteria); $reviewrows = array(); $k = 0; while ($v = $review_handler->getObject()) { $start = 3; if ($v->getVar('topflag') == 1) { $reviewrows[$k]['topflag'] = 1; $start += 4; } else { $reviewrows[$k]['topflag'] = 0; } if ($v->getVar('goodflag') == 1) { $reviewrows[$k]['goodflag'] = 1; $start += 4; } else { $reviewrows[$k]['goodflag'] = 0; } if ($jieqiConfigs['article']['reviewenter'] == '0') { $reviewrows[$k]['content'] = jieqi_htmlstr(jieqi_limitwidth(str_replace(array("\r", "\n"), array('', ' '), $v->getVar('reviewtext', 'n')), $jieqiConfigs['article']['reviewwidth'], $start)); } else { $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 . '/review.php?aid=' . $article_id . '&type=good'); $jieqiTpl->assign('url_allreview', $article_dynamic_url . '/review.php?aid=' . $article_id . '&type=all'); $jieqiTpl->assign('url_review', $article_dynamic_url . '/review.php?aid=' . $article_id); $jieqiTpl->setCaching(0); $reviewjs = $jieqiTpl->fetch($GLOBALS['jieqiModules']['article']['path'] . '/templates/staticreview.html'); $reviewjs = "document.write('" . jieqi_setslashes(str_replace(array("\n", "\r"), "", $reviewjs), '"') . "');"; if (!empty($jieqiConfigs['article']['fakeprefix'])) { $dirname = JIEQI_ROOT_PATH . '/' . $jieqiConfigs['article']['fakeprefix'] . 'info'; } else { $dirname = JIEQI_ROOT_PATH . '/files/article/info'; } if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname = $dirname . jieqi_getsubdir($article_id); if (!file_exists($dirname)) { jieqi_createdir($dirname); } $dirname .= '/' . $article_id . 'r.js'; jieqi_writefile($dirname, $reviewjs); return true; }