Ejemplo n.º 1
0
	function index_middle() {
		if($GLOBALS['indextype'] != 'classics') {
			return;
		}
		@include_once DISCUZ_ROOT . './forumdata/cache/plugin_manyou.php';
		$this->recommendlimit = $_DPLUGIN['manyou']['vars']['limit'];
		if(!$this->recommendlimit) {
			return;
		}
		$cachefile = DISCUZ_ROOT.'./forumdata/cache/manyou_recommend.php';
		if((@!include($cachefile)) || $limit != $limitcache) {
			require_once DISCUZ_ROOT.'./include/request.func.php';
			global $db, $tablepre;
			$query = $db->query("SELECT appid, appname FROM {$tablepre}myapp ORDER BY rand() DESC LIMIT ".$this->recommendlimit);
			$applist = array();
			while($app = $db->fetch_array($query)) {
				$applist[] = $app;
			}
			writetorequestcache($cachefile, 0, "\$limitcache = ".$this->recommendlimit.";\n\$applist = ".var_export($applist, 1).';');
		}
		include template('manyou_recommend');
		return $return;
	}
Ejemplo n.º 2
0
function parse_request($requestdata, $cachefile, $mode, $specialfid = 0, $key = '')
{
    global $_DCACHE;
    $requesttemplate = '';
    $nocachedata = array();
    $requestcachelife = isset($requestdata['cachelife']) && $requestdata['cachelife'] !== '' ? $requestdata['cachelife'] : (isset($_DCACHE['settings']['jscachelife']) ? $_DCACHE['settings']['jscachelife'] : 1800);
    !empty($requestdata['jstemplate']) && ($requesttemplate = stripslashes($requestdata['jstemplate']));
    get_magic_quotes_gpc() && ($requesttemplate = stripslashes($requesttemplate));
    $nocache = !empty($requestdata['nocache']) ? 1 : 0;
    $mode && ($requestcharset = $requestdata['jscharset']);
    if (!in_array($requestdata['function'], array('custom', 'side'))) {
        $requesttemplatebody = '';
        if (preg_match("/\\[node\\](.+?)\\[\\/node\\]/is", $requesttemplate, $node)) {
            $requesttemplatebody = $requesttemplate;
            $requesttemplate = $node[1];
        }
        $parsedata = updaterequest($requestdata, $requesttemplatebody, $requesttemplate, $specialfid, $mode, $key, $nocache);
        if ($mode) {
            $datalist = $writedata = jsprocdata($parsedata, $requestcharset);
        } else {
            $datalist = $writedata = $parsedata;
        }
    } else {
        $requestcachelife = isset($requestdata['cachelife']) && $requestdata['cachelife'] != '' ? $requestdata['cachelife'] : (isset($_DCACHE['settings']['jscachelife']) ? $_DCACHE['settings']['jscachelife'] : 1800);
        $writedata = preg_match_all("/\\[module\\](.+?)\\[\\/module\\]/s", $requesttemplate, $modulelist);
        $modulelist = array_unique($modulelist[1]);
        $datalist = $writedata = $requesttemplate = str_replace('\\"', '"', $requesttemplate);
        foreach ($modulelist as $key) {
            $find = '[module]' . $key . '[/module]';
            if (!empty($_DCACHE['request'][$key]['url'])) {
                parse_str($_DCACHE['request'][$key]['url'], $requestdata);
                $function = isset($requestdata['function']) ? $requestdata['function'] : NULL;
                $requesttemplate = $requestdata['jstemplate'];
                !empty($requesttemplate) && ($requesttemplate = stripslashes($requesttemplate));
                get_magic_quotes_gpc() && ($requesttemplate = stripslashes($requesttemplate));
                $requesttemplatebody = '';
                if (preg_match("/\\[node\\](.+?)\\[\\/node\\]/is", $requesttemplate, $node)) {
                    $requesttemplatebody = $requesttemplate;
                    $requesttemplate = $node[1];
                }
                $modulenocache = 0;
                $parsedata = updaterequest($requestdata, $requesttemplatebody, $requesttemplate, $specialfid, $mode, $key, $modulenocache);
                $datalist = str_replace($find, $parsedata, $datalist);
                if ($modulenocache || $requestdata['cachelife'] === '0') {
                    $nocachedata[$key] = '[module]' . $key . '[/module]';
                    $writedata = str_replace($find, $nocachedata[$key], $writedata);
                } else {
                    $writedata = str_replace($find, $parsedata, $writedata);
                }
            }
        }
        if ($mode) {
            $datalist = jsprocdata($datalist, $requestcharset);
            $writedata = jsprocdata($writedata, $requestcharset);
        }
    }
    $writedata = addcslashes($writedata, "'\\");
    if (!$nocache) {
        $writedata = "\$datalist = '" . $writedata . "';";
        if ($nocachedata) {
            $writedata .= "\n\$nocachedata = " . var_export($nocachedata, 1) . ';';
        }
        writetorequestcache($cachefile, $requestcachelife, $writedata);
    }
    if ($mode) {
        return $datalist;
    } else {
        return eval("return '" . addcslashes($datalist, "'\\") . "';");
    }
}
Ejemplo n.º 3
0
/*
	[Discuz!] (C)2001-2009 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$Id: birthday.inc.php 16697 2008-11-14 07:36:51Z monkey $
*/
if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}
if ($requestrun) {
    $limit = !empty($settings['limit']) ? intval($settings['limit']) : 12;
    $cachefile = DISCUZ_ROOT . './forumdata/cache/requestscript_birthday.php';
    $today = gmdate('m-d', $timestamp + $timeoffset * 3600);
    if (@(!(include $cachefile)) || $today != $todaycache || $limit != $limitcache) {
        $query = $db->query("SELECT username, uid FROM {$tablepre}members WHERE RIGHT(bday, 5)='" . $today . "' ORDER BY bday LIMIT {$limit}");
        $birthdaymembers = array();
        while ($member = $db->fetch_array($query)) {
            $member['username'] = htmlspecialchars($member['username']);
            $birthdaymembers[] = $member;
        }
        $cachefile = DISCUZ_ROOT . './forumdata/cache/requestscript_birthday.php';
        writetorequestcache($cachefile, 0, "\$limitcache = {$limit};\n\$todaycache = '" . $today . "';\n\$birthdaymembers = " . var_export($birthdaymembers, 1) . ';');
    }
    include template('request_birthday');
} else {
    $request_version = '1.0';
    $request_name = $requestlang['birthday_name'];
    $request_description = $requestlang['birthday_desc'];
    $request_copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
    $request_settings = array('limit' => array($requestlang['birthday_limit'], $requestlang['birthday_limit_comment'], 'text'));
}