Esempio n. 1
0
<?php

require_once '../init.php';
require_once '../pager.php';
require_once getCacheFilePath('folders.php');
require_once './../../' . ADMIN_DIR . '/language/language.php';
if (!isAdmin()) {
    exit($_AL['all.notlogin']);
}
$curPage = intval($_GET["page"]);
$folderid = intval($_GET["folderid"]);
if ($folderid > 0) {
    setCookies("lastfolderid", $folderid);
} else {
    $folderid = intval(getCookies("lastfolderid"));
}
//preview
setCookies("lastfoldertype", 2);
$pagerlink = "files.php?page={page}&folderid={$folderid}";
$condition = "folderid={$folderid}";
$orderstr = "id desc";
$pager = new Pager();
$pager->init(10, $curPage, $pagerlink);
$attachements = $pager->queryRows($db, "attachments", $condition, "*", $orderstr);
foreach ($attachements as $key => $att) {
    $att['shortfilename'] = htmlFilter(cutStr($att['filename'], 12));
    $att['filename'] = htmlFilter($att['filename']);
    $att['uploadtime'] = getDateStr($att['uploadtime']);
    $attachements[$key] = $att;
}
$folderrow = $cache_folders[$folderid];
Esempio n. 2
0
if (!array_key_exists($_SYS['alangid'], $cache_langs)) {
    $def_cache_lang = array_slice($cache_langs, 0, 1);
    $_SYS['alangid'] = $def_cache_lang[0]['id'];
    setCookies("alangid", $_SYS['alangid'], 3600 * 24 * 365);
    unset($def_cache_lang);
}
$_SYS['alangid'] = intval($_SYS['alangid']);
//根据语言加载不同的缓存文件
$_cachelangid = stristr($_SERVER['REQUEST_URI'], '/' . ADMIN_DIR . '/') || isset($_GET['preview']) ? $_SYS['alangid'] : $_SYS['langid'];
require_once getCacheFilePath('settings.php', $_cachelangid);
require_once getCacheFilePath('channels.php', $_cachelangid);
require_once getCacheFilePath('procates.php', $_cachelangid);
require_once getCacheFilePath('contacts.php', $_cachelangid);
require_once getCacheFilePath('links.php', $_cachelangid);
require_once getCacheFilePath('votes.php', $_cachelangid);
require_once getCacheFilePath('templatevars.php', $_cachelangid);
//是否启用gzip
if ($cache_settings['isgzip'] == '1' && function_exists('ob_gzhandler')) {
    ob_start('ob_gzhandler');
}
ob_start("_vars_");
ob_start("_clear_");
//是否关闭网站
if ($cache_settings['isoff'] == '1' && !stristr($_SERVER['PHP_SELF'], '/' . ADMIN_DIR . '/')) {
    exit('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>' . $cache_settings['webname'] . '</title></head><body>' . $cache_settings['offdetails'] . '</body></html>');
}
//初始化
$timer_begin = getmicrotime();
$db = new db();
$db->connect($_DB);
$webcore = new WebCore();
Esempio n. 3
0
<?php

require_once getCacheFilePath('users.php');
function getSettings($langid = -1)
{
    global $db, $_SYS;
    $langid = $langid == -1 ? $_SYS['alangid'] : intval($langid);
    $rows = $db->row_select("settings", "langid={$langid}", 0, "*", "property");
    $row = array();
    foreach ($rows as $tmprow) {
        $row["{$tmprow['property']}"] = $tmprow['setvalue'];
    }
    return $row;
}
function saveSettings($setpp, $langid = -1)
{
    global $db, $_SYS;
    $langid = $langid == -1 ? $_SYS['alangid'] : intval($langid);
    foreach ($setpp as $key => $value) {
        $db->row_delete("settings", "property='{$key}' and langid={$langid}");
        $db->query_unbuffered("INSERT INTO `{$db->pre}settings` (property, setvalue, langid) VALUES ('{$key}','{$value}',{$langid})");
    }
}
function sizeFormat($filesize, $type = '')
{
    if ($type == 'GB') {
        $filesize = round($filesize / 1073741824 * 100) / 100 . ' GB';
    } elseif ($type == 'MB') {
        $filesize = round($filesize / 1048576 * 100) / 100 . ' MB';
    } elseif ($type == 'KB') {
        $filesize = round($filesize / 1024 * 100) / 100 . ' KB';
Esempio n. 4
0
function writeFoldersCache()
{
    global $db;
    $rows = $db->row_select("folders", "", 0, "*", "id");
    $folders = array();
    $folders_option = "";
    foreach ($rows as $row) {
        $folders[$row['id']] = $row;
        $folders_option .= "<option value=\"{$row['id']}\">{$row['title']}</option>";
    }
    $str = "<?php \r\n \$cache_folders = " . varToStr($folders) . "; \r\n";
    $str .= "\$cache_foldersoption = " . varToStr($folders_option) . "; \r\n";
    $str .= "?>";
    writeFile(getCacheFilePath("folders.php"), $str);
}