Ejemplo n.º 1
0
function generate_admins_cache()
{
    global $db;
    // Get admins from the DB
    $result = $db->query('SELECT id FROM ' . $db->prefix . 'users WHERE group_id=' . PUN_ADMIN) or error('Unable to fetch users info', __FILE__, __LINE__, $db->error());
    $output = array();
    while ($row = $db->fetch_row($result)) {
        $output[] = $row[0];
    }
    // Output admin list as PHP code
    $content = '<?php' . "\n\n" . 'define(\'PUN_ADMINS_LOADED\', 1);' . "\n\n" . '$pun_admins = ' . var_export($output, true) . ';' . "\n\n" . '?>';
    fluxbb_write_cache_file('cache_admins.php', $content);
}
Ejemplo n.º 2
0
             }
             $item['author']['uri'] = '/profile.php?id=' . $cur_topic['poster_id'];
         } else {
             if ($cur_topic['poster_email'] != '' && !$pun_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 PUN_ROOT . 'include/cache.php';
         }
         $content = '<?php' . "\n\n" . '$feed = ' . var_export($feed, true) . ';' . "\n\n" . '$cache_expire = ' . ($now + $pun_config['o_feed_ttl'] * 60) . ';' . "\n\n" . '?>';
         fluxbb_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'] = get_base_url(true) . $feed['link'];
 foreach ($feed['items'] as $key => $item) {
     $feed['items'][$key]['link'] = get_base_url(true) . $item['link'];
     if (isset($item['author']['uri'])) {
         $feed['items'][$key]['author']['uri'] = get_base_url(true) . $item['author']['uri'];
     }
 }
 $output_func = 'output_' . $type;