Exemplo n.º 1
0
 //章节内容替换
 $editCollect['contentreplace'] = trim($_POST['contentreplace']);
 //是否采集图片
 $editCollect['collectimage'] = trim($_POST['collectimage']);
 //是否允许图片处理
 $editCollect['imagetranslate'] = trim($_POST['imagetranslate']);
 //是否加水印
 $editCollect['addimagewater'] = trim($_POST['addimagewater']);
 //图片背景色
 $editCollect['imagebgcolor'] = trim($_POST['imagebgcolor']);
 //按区域清理
 $editCollect['imageareaclean'] = trim($_POST['imageareaclean']);
 //按颜色清理
 $editCollect['imagecolorclean'] = trim($_POST['imagecolorclean']);
 $editCollect['listcollect'] = $jieqiCollect['listcollect'];
 $configstr = "<?php\n" . jieqi_extractvars('jieqiCollect', $editCollect) . "\n?>";
 jieqi_writefile(JIEQI_ROOT_PATH . '/configs/article/site_' . $_POST['config'] . '.php', $configstr);
 $siteid = -1;
 reset($jieqiCollectsite);
 while (list($k, $v) = each($jieqiCollectsite)) {
     if ($v['config'] == $_POST['config']) {
         $siteid = $k;
         break;
     }
 }
 if ($siteid >= 0) {
     $jieqiCollectsite[$siteid] = array('name' => $editCollect['sitename'], 'config' => $_POST['config'], 'url' => $editCollect['siteurl'], 'subarticleid' => $editCollect['subarticleid'], 'enable' => '1');
 } else {
     $jieqiCollectsite[] = array('name' => $editCollect['sitename'], 'config' => $_POST['config'], 'url' => $editCollect['siteurl'], 'subarticleid' => $editCollect['subarticleid'], 'enable' => '1');
 }
 jieqi_setconfigs('collectsite', 'jieqiCollectsite', $jieqiCollectsite, JIEQI_MODULE_NAME);
Exemplo n.º 2
0
/**
 * 保存缓存变量
 * 
 * @param      string     $fname 文件名,不带后缀
 * @param      string     $varname 变量名
 * @param      mixed      $vars 要保存的变量
 * @param      string     $module 模块名,默认'system'
 * @param      int        $cacheid 缓存id
 * @access     public
 * @return     bool
 */
function jieqi_setcachevars($fname = '', $varname, &$vars, $module = 'system', $cacheid = 0)
{
    global $jieqiModules;
    global $jieqiCache;
    if (empty($fname) || empty($varname)) {
        return false;
    }
    $cachefile = JIEQI_CACHE_PATH . '/cachevars';
    if (isset($jieqiModules[$module])) {
        $cachefile .= '/' . $module;
    }
    if (empty($cacheid)) {
        $cachefile .= '/' . $fname . '.php';
    } else {
        $cacheid = intval($cacheid);
        $cachefile .= '/' . $fname . jieqi_getsubdir($cacheid) . '/' . $cacheid . '.php';
    }
    if (is_a($jieqiCache, 'JieqiCacheMemcached')) {
        return $jieqiCache->set($cachefile, $vars);
    } else {
        $varstring = "<?php\n" . jieqi_extractvars($varname, $vars) . "\n?>";
        return $jieqiCache->set($cachefile, $varstring);
    }
}
Exemplo n.º 3
0
    $obook_handler->db->query('UPDATE ' . jieqi_dbprefix('obook_ochapter') . ' SET display=state WHERE obookid=' . intval($_REQUEST['id']));
    if (!empty($linkfile) && file_exists($linkfile)) {
        global $jieqiObookdata;
        include_once $linkfile;
        $jieqiObookdata['obook']['display'] = 0;
        $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;
Exemplo n.º 4
0
/**
 * 获取远程网页内容
 * 
 * @param      string      $url 网址
 * @param      array       $params 相关参数
 * @access     public
 * @return     string
 */
function jieqi_urlcontents($url, $params = array())
{
    $ret = '';
    $count = 0;
    if (is_numeric($params)) {
        $params = array('repeat' => $params);
    }
    if (!isset($params['repeat']) || !is_numeric($params['repeat'])) {
        $params['repeat'] = 1;
    }
    if (!isset($params['delay'])) {
        $params['delay'] = 0;
    }
    if (!isset($params['charset'])) {
        $params['charset'] = 'auto';
    }
    while (empty($ret) && $count < $params['repeat']) {
        $count++;
        if ($count > 1 && $params['delay'] > 0) {
            sleep($params['delay']);
        }
        if (!empty($params['proxy_host']) && !empty($params['proxy_port']) || !empty($params['referer']) || !empty($params['cookiefile'])) {
            //socket采集
            if (!defined('LIB_REQUEST_INCLUDE')) {
                include_once JIEQI_ROOT_PATH . '/lib/net/client.php';
                define('LIB_REQUEST_INCLUDE', 1);
            }
            $client = new JieqiClient();
            $client->enableHistory(false);
            //User-Agent
            if (!empty($params['useragent'])) {
                $client->setDefaultHeader('User-Agent', $params['useragent']);
            }
            //referer设置
            if (!empty($params['referer']) && substr($params['referer'], 0, 4) == 'http') {
                $client->setDefaultHeader('Referer', $params['referer']);
            }
            //代理采集设置
            if (!empty($params['proxy_host']) && !empty($params['proxy_port'])) {
                $client->setRequestParameter('proxy_host', $params['proxy_host']);
                $client->setRequestParameter('proxy_port', $params['proxy_port']);
                if (!empty($params['proxy_user'])) {
                    $client->setRequestParameter('proxy_user', $params['proxy_user']);
                    $client->setDefaultHeader('Proxy-Authorization', 'Basic ' . base64_encode($params['proxy_user'] . ':' . $params['proxy_pass']));
                }
                if (!empty($params['proxy_pass'])) {
                    $client->setRequestParameter('proxy_pass', $params['proxy_pass']);
                }
            }
            //检查cookie
            $jieqiCollectCookies = array();
            if (!empty($params['cookiefile']) && preg_match('/^[\\w\\.\\/\\\\:]+$/', $params['cookiefile']) && is_file($params['cookiefile']) && preg_match('/\\.php$/i', @realpath($params['cookiefile'])) && JIEQI_NOW_TIME - filemtime($params['cookiefile']) < $params['cookielife']) {
                include_once $params['cookiefile'];
                $client->setDefaultCookies($jieqiCollectCookies);
            }
            $client->get($url);
            $res = $client->currentResponse();
            $ret = '';
            if ($res['code'] == '200' && !empty($res['body'])) {
                $ret = $res['body'];
                if (!empty($params['cookiefile'])) {
                    //更新cookie
                    $jieqiCollectCookies = $client->getDefaultCookies();
                    $filedata = jieqi_extractvars('jieqiCollectCookies', $jieqiCollectCookies);
                    $filedata = "<?php\r\n" . $filedata . "\r\n?>";
                    jieqi_writefile($params['cookiefile'], $filedata);
                }
            }
            unset($client);
        } else {
            //普通采集
            $ret = @file_get_contents($url);
        }
    }
    if (!empty($ret) && in_array($params['charset'], array('auto', 'gb2312', 'gbk', 'gb', 'big5', 'utf8', 'utf-8'))) {
        if ($params['charset'] == 'auto') {
            preg_match('/\\<meta[^\\<\\>]*content[\\s]*=[\\s]*(\'|")?[^\\/;]*\\/[^\\/;]*;[\\s]*charset[\\s]*=[\\s]*(gb2312|gbk|big5|utf-8)(\'|")?[^\\<\\>]*\\>/is', $ret, $matches);
            if (!empty($matches[2])) {
                $pagecherset = strtolower(trim($matches[2]));
            } else {
                $pagecherset = strtolower(JIEQI_SYSTEM_CHARSET);
            }
        } else {
            $pagecherset = $params['charset'];
        }
        $defaultcharset = strtolower(JIEQI_SYSTEM_CHARSET);
        $charsetary = array('gb2312' => 'gb', 'gbk' => 'gb', 'gb' => 'gb', 'big5' => 'big5', 'utf-8' => 'utf8', 'utf8' => 'utf8');
        //需要编码转换
        if ($pagecherset != $defaultcharset && isset($charsetary[$pagecherset]) && isset($charsetary[$defaultcharset])) {
            include_once JIEQI_ROOT_PATH . '/include/changecode.php';
            $funname = 'jieqi_' . $charsetary[$pagecherset] . '2' . $charsetary[$defaultcharset];
            if (function_exists($funname)) {
                $ret = call_user_func($funname, $ret);
            }
        }
    }
    return $ret;
}
Exemplo n.º 5
0
            if (isset($_SESSION['mysql_pass'])) {
                $db_query->execute("UPDATE " . jieqi_dbprefix('system_configs') . " SET cvalue = '" . jieqi_dbslashes($_SESSION['mysql_pass']) . "' WHERE modname='system' AND cname='JIEQI_DB_PASS';");
            }
            if (isset($_SESSION['mysql_charset'])) {
                $db_query->execute("UPDATE " . jieqi_dbprefix('system_configs') . " SET cvalue = '" . jieqi_dbslashes($_SESSION['mysql_charset']) . "' WHERE modname='system' AND cname='JIEQI_DB_CHARSET';");
            }
            unset($_SESSION);
        }
        if (empty($errorinfo)) {
            $jieqiTpl->assign('admin_page', JIEQI_URL . '/admin/');
            $jieqiTpl->assign('index_page', JIEQI_URL);
            $jieqiTpl->assign('status', 1);
            $jieqiTpl->assign('step_content', $jieqiLang[JIEQI_MODULE_NAME]['execute_sql_success']);
            $lockdata = '';
            if ($upmodules) {
                $varstring = "<?php\n" . jieqi_extractvars('jieqiModules', $jieqiModules) . "\n?>";
                jieqi_writefile(JIEQI_ROOT_PATH . '/configs/modules.php', $varstring);
            }
            jieqi_writefile(JIEQI_ROOT_PATH . '/configs/install.lock', $lockdata);
        } else {
            $jieqiTpl->assign('status', 0);
            $jieqiTpl->assign('step_content', $errorinfo);
        }
    }
}
$jieqiTpl->setCaching(0);
$jieqiTpl->assign('jieqi_content', $jieqiTpl->fetch(JIEQI_ROOT_PATH . '/' . JIEQI_MODULE_NAME . '/templates/step' . CURRENT_STEP . '.html'));
include_once JIEQI_ROOT_PATH . '/' . JIEQI_MODULE_NAME . '/footer.php';
//SQL分割函数
function jieqi_splitsqlfile(&$ret, $sql, $release = 32270)
{