Esempio n. 1
0
 if (is_array($matchvar)) {
     $aidsary = $matchvar;
 } else {
     $aidsary = array();
 }
 //下一页参数
 $nextpageid = '';
 if ($jieqiCollect['listcollect'][$_REQUEST['collectname']]['nextpageid'] == '++') {
     $nextpageid = intval($startpageid) + 1;
 } else {
     $pregstr = jieqi_collectstoe($jieqiCollect['listcollect'][$_REQUEST['collectname']]['nextpageid']);
     if (!empty($pregstr)) {
         $matchvar = jieqi_cmatchone($pregstr, $source);
     }
     if (!empty($matchvar)) {
         $nextpageid = trim(jieqi_textstr($matchvar));
     }
 }
 //更新每一篇文章
 include_once $jieqiModules['article']['path'] . '/class/article.php';
 include_once $jieqiModules['article']['path'] . '/class/package.php';
 $aid = 0;
 echo '                                                                                                                                                                                                                                                                ';
 echo sprintf($jieqiLang['article']['page_collect_doing'], $jieqiCollect['sitename'], $jieqiCollect['listcollect'][$_REQUEST['collectname']]['title'], $_REQUEST['collectpagenum'], count($aidsary));
 ob_flush();
 flush();
 $cpoint = 1;
 foreach ($aidsary as $v) {
     $aid = trim($v);
     echo sprintf($jieqiLang['article']['page_checkid_doing'], $cpoint, $aid);
     ob_flush();
Esempio n. 2
0
     if (is_numeric($jieqiConfigs['obook']['codegroupnum']) && is_numeric($jieqiConfigs['obook']['codecharnum']) && is_string($jieqiConfigs['obook']['codechars'])) {
         $addcode = true;
     } else {
         $addcode = false;
     }
 } else {
     $addcode = false;
 }
 $k = 0;
 for ($i = 0; $i < $arynum; $i++) {
     if ($contentrows[$i] == '') {
         unset($contentrows[$i]);
     } else {
         $k++;
         if ($addcode && $k == $jieqiConfigs['obook']['codegroupnum']) {
             $tmpstr = str_replace(array("\r", "\n"), "", jieqi_textstr($contentrows[$i]));
             $strlen = strlen($tmpstr);
             $m = 0;
             $n = 0;
             while ($m < $strlen && $n < $jieqiConfigs['obook']['codecharnum']) {
                 if (ord($tmpstr[$m]) > 0x80) {
                     $m++;
                     $n++;
                 } else {
                     if ($tmpstr[$m] != ' ') {
                         $n++;
                     }
                 }
                 $m++;
             }
             if ($m <= $strlen && $n == $jieqiConfigs['obook']['codecharnum']) {
Esempio n. 3
0
                     }
                 } else {
                     $tmpdir = dirname($url);
                     while (strpos($imageurl, '../') === 0) {
                         $tmpdir = dirname($tmpdir);
                         $imageurl = substr($imageurl, 3);
                     }
                     $imageurl = $tmpdir . '/' . $imageurl;
                 }
                 $chaptercontent = str_replace($v, $imageurl, $chaptercontent);
             }
         }
     }
 }
 //转换成文本
 $chaptercontent = jieqi_textstr($chaptercontent, true);
 //内容排版
 $chaptercontent = $texttypeset->doTypeset($chaptercontent);
 //如果是插入章节,则原来章节的序号加一位
 if ($q < $tonum) {
     $criteria = new CriteriaCompo(new Criteria('articleid', $_REQUEST['toid']));
     $criteria->add(new Criteria('chapterorder', $q, '>'));
     $chapter_handler->updatefields('chapterorder=chapterorder+1', $criteria);
     unset($criteria);
 }
 $newChapter = $chapter_handler->create();
 $newChapter->setVar('siteid', JIEQI_SITE_ID);
 $chaptersize = strlen(str_replace(array(" ", " ", "\r", "\n"), '', $chaptercontent));
 $newChapter->setVar('articleid', $_REQUEST['toid']);
 $newChapter->setVar('articlename', $article->getVar('articlename', 'n'));
 $newChapter->setVar('volumeid', 0);
Esempio n. 4
0
function jieqi_splitchapter($str)
{
    $ret = array('vid' => 0, 'vname' => '', 'fcid' => 0, 'fcname' => '', 'cid' => 0, 'cname' => '', 'sid' => 0, 'sname' => '', 'pnum' => 0);
    $numary = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '百', '千', '万', '上', '中', '下');
    $vary = array('卷', '部', '集', '篇');
    $cary = array('章', '节', '回');
    $sary = array(')', ')', '>');
    $aary = array('第', ':', '(', '(');
    $splitary = array_merge($vary, $cary, $sary, $aary);
    $str = trim($str);
    $str = str_replace(array('<', '>'), array('<', '>'), $str);
    $str = jieqi_textstr($str);
    $slen = strlen($str);
    //寻找分卷
    $i = 0;
    $nstart = 0;
    while ($i < $slen) {
        $tmpstr = $str[$i];
        if (ord($str[$i]) > 0x80 && $i < $slen - 1) {
            $tmpstr .= $str[$i + 1];
            $cl = 2;
        } else {
            $cl = 1;
        }
        $i += $cl;
        if (in_array($tmpstr, $vary)) {
            //找到分卷标记
            if ($i - $cl == 0) {
                //卷标记在前
                $k = $i;
                $numstr = '';
                while ($k < $slen) {
                    $tmpstr = $str[$k];
                    if (ord($str[$k]) > 0x80 && $k < $slen - 1) {
                        $tmpstr .= $str[$k + 1];
                        $k++;
                    }
                    $k++;
                    if (in_array($tmpstr, $numary)) {
                        $numstr .= $tmpstr;
                    } elseif ($tmpstr == ' ') {
                    } else {
                        break;
                    }
                }
                $ret['vid'] = jieqi_numcntoab($numstr);
                $nstart = $k;
            } else {
                //卷标记在后
                $k = $i - $cl;
                $numstr = '';
                while ($k > 0) {
                    if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
                        $tmpstr = $str[$k - 2] . $str[$k - 1];
                        $k -= 2;
                    } else {
                        $tmpstr = $str[$k - 1];
                        $k--;
                    }
                    if (in_array($tmpstr, $numary)) {
                        $numstr = $tmpstr . $numstr;
                    } elseif ($tmpstr == ' ') {
                    } else {
                        break;
                    }
                }
                $ret['vid'] = jieqi_numcntoab($numstr);
                $nstart = $i;
            }
            break;
        }
    }
    if ($i >= $slen) {
        $i = 0;
    }
    //*********************************************************
    //检查卷会不会在章后面
    if ($i > 0) {
        $j = 0;
        while ($j < $i) {
            $tmpstr = $str[$j];
            if (ord($str[$j]) > 0x80 && $j < $slen - 1) {
                $tmpstr .= $str[$j + 1];
                $j++;
            }
            $j++;
            if (in_array($tmpstr, $cary)) {
                $i = 0;
                $nstart = 0;
                $ret['vid'] = 0;
                break;
            }
        }
    }
    //寻找章节
    while ($i < $slen) {
        $tmpstr = $str[$i];
        if (ord($str[$i]) > 0x80 && $i < $slen - 1) {
            $tmpstr .= $str[$i + 1];
            $cl = 2;
        } else {
            $cl = 1;
        }
        $i += $cl;
        if (in_array($tmpstr, $cary)) {
            //找到章节标记
            $k = $i - $cl;
            $numstr = '';
            while ($k > $nstart) {
                if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
                    $tmpstr = $str[$k - 2] . $str[$k - 1];
                    $j = 2;
                } else {
                    $tmpstr = $str[$k - 1];
                    $j = 1;
                }
                if (in_array($tmpstr, $numary)) {
                    $numstr = $tmpstr . $numstr;
                } elseif ($tmpstr == ' ') {
                } else {
                    break;
                }
                $k -= $j;
            }
            $ret['cid'] = jieqi_numcntoab($numstr);
            //查找有没起始章节
            if ($tmpstr != '第' && $tmpstr != ' ') {
                $k -= $j;
                $numstr = '';
                while ($k > $nstart) {
                    if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
                        $tmpstr = $str[$k - 2] . $str[$k - 1];
                        $j = 2;
                    } else {
                        $tmpstr = $str[$k - 1];
                        $j = 1;
                    }
                    if (in_array($tmpstr, $numary)) {
                        $numstr = $tmpstr . $numstr;
                    } elseif ($tmpstr == ' ') {
                    } else {
                        break;
                    }
                    $k -= $j;
                }
                if (!empty($numstr)) {
                    $ret['fcid'] = jieqi_numcntoab($numstr);
                }
            }
            //取分卷名称
            if ($k > $nstart) {
                $ret['vname'] = jieqi_usefultitle(substr($str, $nstart, $k - $nstart));
            }
            $nstart = $i;
            break;
        }
    }
    if ($i >= $slen) {
        $i = 0;
    }
    //*********************************************************
    //继续寻找终止章节
    $baki = $i;
    while ($i < $slen) {
        $tmpstr = $str[$i];
        if (ord($str[$i]) > 0x80 && $i < $slen - 1) {
            $tmpstr .= $str[$i + 1];
            $cl = 2;
        } else {
            $cl = 1;
        }
        $i += $cl;
        if (in_array($tmpstr, $cary)) {
            //找到章节标记
            $k = $i - $cl;
            $numstr = '';
            while ($k > $nstart) {
                if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
                    $tmpstr = $str[$k - 2] . $str[$k - 1];
                    $j = 2;
                } else {
                    $tmpstr = $str[$k - 1];
                    $j = 1;
                }
                if (in_array($tmpstr, $numary)) {
                    $numstr = $tmpstr . $numstr;
                } elseif ($tmpstr == ' ') {
                } else {
                    break;
                }
                $k -= $j;
            }
            if (!empty($numstr)) {
                $ret['fcid'] = $ret['cid'];
                $ret['cid'] = jieqi_numcntoab($numstr);
                //取起始章节名称
                if ($k > $nstart) {
                    $ret['fcname'] = jieqi_usefultitle(substr($str, $nstart, $k - $nstart));
                }
            }
            $nstart = $i;
            break;
        }
    }
    if ($i >= $slen) {
        $i = $baki;
    }
    //*********************************************************
    //寻找分段
    $k = $slen;
    $tmpstr = '';
    while ($k >= 2 && $k > $nstart) {
        if (ord($str[$k - 1]) > 0x80) {
            $tmpstr = $str[$k - 2] . $str[$k - 1];
            $cl = 2;
        } else {
            $tmpstr = $str[$k - 1];
            $cl = 1;
        }
        $k -= $cl;
        if (in_array($tmpstr, $sary)) {
            $numstr = '';
            while ($k > $i) {
                if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
                    $tmpstr = $str[$k - 2] . $str[$k - 1];
                    $k -= 2;
                } else {
                    $tmpstr = $str[$k - 1];
                    $k--;
                }
                if (in_array($tmpstr, $numary)) {
                    $numstr = $tmpstr . $numstr;
                } elseif ($tmpstr == ' ') {
                } else {
                    break;
                }
            }
            if (!empty($numstr)) {
                $ret['sid'] = jieqi_numcntoab($numstr);
            } else {
                $k = $slen;
            }
            break;
        }
    }
    if ($k <= $nstart) {
        $k = $slen;
    }
    //取章节名称
    while ($k > $nstart) {
        if ($k >= 2 && ord($str[$k - 1]) > 0x80) {
            $tmpstr = $str[$k - 2] . $str[$k - 1];
            $j = 2;
        } else {
            $tmpstr = $str[$k - 1];
            $j = 1;
        }
        if (!in_array($tmpstr, $aary)) {
            break;
        }
        $k -= $j;
    }
    if ($k > $nstart) {
        $ret['cname'] = jieqi_usefultitle(substr($str, $nstart, $k - $nstart));
    }
    //分卷序号不能大于100, 正文表示第一卷
    if ($ret['vid'] >= 100) {
        $ret['vid'] = 0;
    } elseif (substr($str, 0, 5) == '正文 ') {
        $ret['vid'] = 1;
    }
    //标题是第几章第几节情况
    if ($ret['vid'] == 0 && $ret['cid'] > 0 && strpos($str, '章') > 0 && strpos($str, '节') > 0) {
        $numstr1 = jieqi_getsnumbyid($str, '章');
        $numstr2 = jieqi_getsnumbyid($str, '节');
        if (!empty($numstr1) && !empty($numstr2)) {
            $ret['vid'] = jieqi_numcntoab($numstr1);
            $ret['cid'] = jieqi_numcntoab($numstr2);
        }
    }
    //如果章节没有,有分段,把分段作为章节
    if ($ret['cid'] == 0 && $ret['sid'] > 0) {
        $ret['cid'] = $ret['sid'];
        $ret['sid'] = 0;
    }
    //根据其他标志找章节
    if ($ret['cid'] == 0) {
        $numstr = jieqi_getsnumbyid($str, array('、', ':', '.', ':', ' '));
        if (!empty($numstr)) {
            $ret['cid'] = jieqi_numcntoab($numstr);
        } else {
            if (!empty($ret['vid'])) {
                $numstr = jieqi_getsnumbyid($str, array('集', '卷'));
                if (!empty($numstr)) {
                    $ret['cid'] = jieqi_numcntoab($numstr);
                }
            }
        }
    }
    //整个章节名称就是数字的情况
    if ($ret['vid'] == 0 && $ret['cid'] == 0 && $ret['sid'] == 0) {
        $ret['cid'] = jieqi_numcntoab($str);
    }
    //章节序号不能大于10000
    if ($ret['cid'] >= 10000) {
        $ret['cid'] = $ret['cid'] % 10000;
    }
    //分段序号不能大于100
    if ($ret['sid'] >= 100) {
        $ret['sid'] = $ret['sid'] % 100;
    }
    //求权重
    $ret['pnum'] = $ret['vid'] * 1000000 + $ret['cid'] * 100 + $ret['sid'];
    return $ret;
}