예제 #1
0
파일: funstatic.php 프로젝트: thu0ng91/jmc
function article_make_ptoplist($sort, $page = 1, $static = true, $output = false)
{
    global $jieqiConfigs;
    if (!isset($jieqiConfigs['article'])) {
        jieqi_getconfigs('article', 'configs');
    }
    if (is_numeric($jieqiConfigs['article']['faketoplist'])) {
        if (!empty($jieqiConfigs['article']['fakeprefix'])) {
            $jieqiConfigs['article']['faketoplist'] = '/' . $jieqiConfigs['article']['fakeprefix'] . 'top<{$sort}><{$page|subdirectory}>/<{$page}>' . $jieqiConfigs['article']['fakefile'];
        } else {
            $jieqiConfigs['article']['faketoplist'] = '/files/article/top<{$sort}><{$page|subdirectory}>/<{$page}>' . $jieqiConfigs['article']['fakefile'];
        }
    }
    $jieqiConfigs['article']['faketoplist'] = preg_replace('/https?:\\/\\/[^\\/]+/is', '', $jieqiConfigs['article']['faketoplist']);
    if (substr($jieqiConfigs['article']['faketoplist'], 0, 1) != '/') {
        $jieqiConfigs['article']['faketoplist'] = '/' . $jieqiConfigs['article']['faketoplist'];
    }
    $tmpary = explode('/', $jieqiConfigs['article']['faketoplist']);
    $tmpcot = count($tmpary) - 2;
    if (strpos($jieqiConfigs['article']['faketoplist'], '<{$page|subdirectory}>') > 0) {
        $tmpcot++;
    }
    $globalfile = str_repeat('../', $tmpcot) . 'global.php';
    $repfrom = array('<{$sort}>', '<{$page|subdirectory}>', '<{$page}>');
    $repto = array($sort, jieqi_getsubdir($page), $page);
    $fname = JIEQI_ROOT_PATH . trim(str_replace($repfrom, $repto, $jieqiConfigs['article']['faketoplist']));
    jieqi_checkdir(dirname($fname), true);
    if ($static) {
        $content = file_get_contents($GLOBALS['jieqiModules']['article']['url'] . '/toplist.php?sort=' . $sort . '&page=' . $page);
    } else {
        $content = '<?php
define(\'JIEQI_MODULE_NAME\', \'article\');
$jieqi_fake_state = 1;
include_once(\'' . $globalfile . '\');
$_REQUEST[\'sort\'] = "' . $sort . '";
$_REQUEST[\'page\'] = ' . $page . ';
include_once($jieqiModules[\'article\'][\'path\'].\'/toplist.php\');
?>';
    }
    jieqi_writefile($fname, $content);
    if ($output) {
        echo $page . ' ';
        ob_flush();
        flush();
    }
}
예제 #2
0
파일: template.php 프로젝트: thu0ng91/jmc
 /**
  * 写编译文件
  * 
  * @param      string      $resource_name 模板名
  * @param      string      $compile_path 编译路径
  * @access     private
  * @return     bool
  */
 function _compile_resource($resource_name, $compile_path)
 {
     if (!is_file($resource_name)) {
         echo 'Template file (' . str_replace(JIEQI_ROOT_PATH, '', $resource_name) . ') is not exists!';
         return false;
     }
     $_resource_timestamp = filemtime($resource_name);
     $this->_compile_source($resource_name, $_compiled_content, $_compiled_include);
     $_compile_file = $compile_path . $this->_compile_prefix;
     if (jieqi_checkdir(dirname($_compile_file), true)) {
         $ret = jieqi_writefile($_compile_file, $_compiled_content);
         if ($ret && $_resource_timestamp) {
             @touch($_compile_file, $_resource_timestamp);
         }
     }
     if (strlen($_compiled_include) > 0) {
         $_compile_infile = $compile_path . $this->_include_prefix;
         if (jieqi_checkdir(dirname($_compile_infile), true)) {
             $ret1 = jieqi_writefile($_compile_infile, $_compiled_include);
             if ($ret1 && $_resource_timestamp) {
                 @touch($_compile_infile, $_resource_timestamp);
             }
         }
     } else {
         $this->_unlink($compile_path . $this->_include_prefix);
     }
     if ($ret && $_resource_timestamp) {
         @clearstatcache();
     }
     return $ret;
 }
예제 #3
0
파일: global.php 프로젝트: thu0ng91/jmc
 /**
  * 设置缓存
  * 
  * @param      string      $name 缓存的键名(这里是文件名)
  * @param      string      $value 缓存的内容
  * @param      int         $ttl 缓存时间
  * @access     public
  * @return     bool
  */
 function set($name, $value, $ttl = 0, $over = 0)
 {
     if (jieqi_checkdir(dirname($name), true)) {
         return jieqi_writefile($name, $value);
     } else {
         return false;
     }
 }
예제 #4
0
파일: dbmanage.php 프로젝트: thu0ng91/jmc
jieqi_checklogin();
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) {
예제 #5
0
파일: funstat.php 프로젝트: thu0ng91/jmc
/**
 * 返回点击统计数组,支持点击缓存
 * 
 * @param      int         $id 点击对象ID
 * @param      string      $vname 点击标志变量名
 * @param      int         $lastvisit 上一次更新访问统计时间(需要分周月总统计时候用到)
 * @access     public
 * @return     mixed       如果缓存本点击,返回false,否则返回数组,类似array('1'=>array('visitnum'=>2, 'lastvisit'=>'12345678'), '5'=>array('visitnum'=>1, 'lastvisit'=>'12345678')),这里的键值表示记录ID,visitnum表示被访问了几次,lastvisit是最后更新访问统计的时间
 */
function jieqi_visit_ids($id, $vname, $lastvisit = -1)
{
    if (!is_numeric($id) || intval($id) <= 0) {
        return false;
    }
    if (!preg_match('/^\\w+$/is', $vname)) {
        return false;
    }
    $vname = strtolower($vname);
    $ret = array();
    if (JIEQI_ENABLE_CACHE) {
        $logfile = JIEQI_CACHE_PATH . '/cachevars/cachevisit/' . $vname . '.php';
        jieqi_checkdir(dirname($logfile), true);
        //启用缓存,百分之一机会更新缓存
        if (rand(1, 100) == 1) {
            $visitary = @file($logfile);
            if ($fp = @fopen($logfile, 'w')) {
                @fclose($fp);
            }
            $visitary[] = $lastvisit >= 0 ? $id . '|' . $lastvisit : $id;
            foreach ($visitary as $v) {
                $v = trim($v);
                $tmpary = explode('|', $v);
                $tmpary[0] = intval($tmpary[0]);
                if (!empty($tmpary[0])) {
                    if (key_exists($tmpary[0], $ret)) {
                        $ret[$tmpary[0]]['visitnum']++;
                    } else {
                        $ret[$tmpary[0]]['visitnum'] = 1;
                    }
                    if (isset($tmpary[1])) {
                        $ret[$tmpary[0]]['lastvisit'] = intval($tmpary[1]);
                    } else {
                        $ret[$tmpary[0]]['lastvisit'] = -1;
                    }
                }
            }
        } else {
            if ($fp = @fopen($logfile, 'a')) {
                @flock($filenum, LOCK_EX);
                if ($lastvisit >= 0) {
                    @fwrite($fp, $id . '|' . $lastvisit . "\r\n");
                } else {
                    @fwrite($fp, $id . "\r\n");
                }
                @flock($filenum, LOCK_UN);
                @fclose($fp);
                @chmod($logfile, 0777);
            }
        }
    } else {
        $ret[$id] = array('visitnum' => 1, 'lastvisit' => $lastvisit);
    }
    return empty($ret) ? false : $ret;
}
예제 #6
0
파일: createfake.php 프로젝트: thu0ng91/jmc
                    $cot = intval($row['cot']);
                    $pnum = intval($jieqiConfigs['article']['toppagenum']);
                    if (empty($pnum)) {
                        $pnum = 10;
                    }
                    $_REQUEST['stopid'] = ceil($cot / $pnum);
                }
            }
            echo sprintf($jieqiLang['article']['create_toplist_info'], $v);
            ob_flush();
            flush();
            for ($i = $_REQUEST['startid']; $i <= $_REQUEST['stopid']; $i++) {
                $repfrom = array('<{$sort}>', '<{$page|subdirectory}>', '<{$page}>');
                $repto = array($k, jieqi_getsubdir($i), $i);
                $fname = JIEQI_ROOT_PATH . trim(str_replace($repfrom, $repto, $jieqiConfigs['article']['faketoplist']));
                jieqi_checkdir(dirname($fname), true);
                if ($_REQUEST['filetype'] == 'static') {
                    $content = file_get_contents($jieqiModules['article']['url'] . '/toplist.php?sort=' . $k . '&page=' . $i);
                } else {
                    $content = '<?php
define(\'JIEQI_MODULE_NAME\', \'article\');
$jieqi_fake_state = 1;
include_once(\'' . $globalfile . '\');
$_REQUEST[\'sort\'] = "' . $k . '";
$_REQUEST[\'page\'] = ' . $i . ';
include_once($jieqiModules[\'article\'][\'path\'].\'/toplist.php\');
?>';
                }
                jieqi_writefile($fname, $content);
                if (($i - $_REQUEST['startid']) % 100 == 0) {
                    echo $i . '...';
예제 #7
0
파일: blocks.php 프로젝트: thu0ng91/jmc
 function saveContent($bid, $modname, $contenttype, &$content)
 {
     global $jieqiCache;
     $ret = false;
     if (strlen($bid) > 0 && strlen($modname) > 0) {
         $val = '';
         $fname = '';
         switch ($contenttype) {
             case JIEQI_CONTENT_TXT:
                 $val = jieqi_htmlstr($content);
                 $fname = '.html';
                 break;
             case JIEQI_CONTENT_HTML:
                 $val = $content;
                 $fname = '.html';
                 break;
             case JIEQI_CONTENT_JS:
                 $val = $content;
                 $fname = '.html';
                 break;
             case JIEQI_CONTENT_MIX:
                 $val = $content;
                 $fname = '.html';
                 break;
                 /*
                 //为增加安全性,程序类型自定义区块暂时不支持
                 case JIEQI_CONTENT_PHP:
                 $val=$content;
                 $fname='.php';
                 break;
                 */
         }
         if (strlen($fname) > 0) {
             $cache_file = JIEQI_CACHE_PATH;
             if (strlen($modname) > 0 && $modname != 'system') {
                 $cache_file .= '/modules/' . $modname;
             }
             if (is_numeric($bid)) {
                 $cache_file .= '/templates/blocks/block_custom' . $bid . $fname;
             } else {
                 $cache_file .= '/templates/blocks/' . $bid . '.html';
             }
             if ($fname != '.php') {
                 $jieqiCache->set($cache_file, $val);
             } else {
                 jieqi_checkdir(dirname($cache_file), true);
                 jieqi_writefile($cache_file, $val);
             }
             $ret = true;
         }
     }
     return $ret;
 }