} $item['author']['uri'] = panther_link($panther_url['profile'], array($cur_topic['poster_id'])); } else { if ($cur_topic['poster_email'] != '' && !$panther_user['is_guest']) { $item['author']['email'] = $cur_topic['poster_email']; } } $feed['items'][] = $item; } // Output feed as PHP code if (isset($cache_id)) { if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) { require PANTHER_ROOT . 'include/cache.php'; } $content = '<?php' . "\n\n" . '$feed = ' . var_export($feed, true) . ';' . "\n\n" . '$cache_expire = ' . ($now + $panther_config['o_feed_ttl'] * 60) . ';' . "\n\n" . '?>'; panther_write_cache_file('cache_' . $cache_id . '.php', $content); } } // If we only want to show a few items but due to caching we have too many if (count($feed['items']) > $show) { $feed['items'] = array_slice($feed['items'], 0, $show); } // Prepend the current base URL onto some links. Done after caching to handle http/https correctly $feed['link'] = $feed['link']; foreach ($feed['items'] as $key => $item) { $feed['items'][$key]['link'] = panther_htmlspecialchars_decode($item['link']); if (isset($item['author']['uri'])) { $feed['items'][$key]['author']['uri'] = $item['author']['uri']; } } $output_func = 'output_' . $type;
function generate_extensions_cache() { global $db; $output = '<?php' . "\n\n" . 'if (!defined(\'PANTHER\')) exit;' . "\n" . "\n\n" . 'define(\'PANTHER_EXTENSIONS_LOADED\', 1);' . "\n\n" . '$panther_extensions = array();' . "\n\n"; $ps = $db->run('SELECT c.hook, c.code FROM ' . $db->prefix . 'extension_code AS c INNER JOIN ' . $db->prefix . 'extensions AS e ON c.extension_id=e.id WHERE e.enabled=1'); // If it's not even enabled, then why on earth attempt to run it and add extra work? foreach ($ps as $cur_extension) { $output .= '$panther_extensions[\'' . $cur_extension['hook'] . '\'][] = ' . var_export($cur_extension['code'], true) . ';' . "\n\n"; } panther_write_cache_file('cache_extensions.php', $output); }