Пример #1
0
             if ($cur_topic['email_setting'] == '0' && !$feather->user->is_guest) {
                 $item['author']['email'] = $cur_topic['email'];
             }
             $item['author']['uri'] = get_link('user/' . $cur_topic['poster_id'] . '/');
         } elseif ($cur_topic['poster_email'] != '' && !$feather->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 FEATHER_ROOT . 'include/cache.php';
         }
         $content = '<?php' . "\n\n" . '$feed = ' . var_export($feed, true) . ';' . "\n\n" . '$cache_expire = ' . ($now + $feather_config['o_feed_ttl'] * 60) . ';' . "\n\n" . '?>';
         featherbb_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;
Пример #2
0
function generate_admins_cache()
{
    // Get admins from the DB
    $result = \DB::for_table('users')->select('id')->where('group_id', FEATHER_ADMIN)->find_array();
    $output = array();
    foreach ($result as $row) {
        $output[] = $row['id'];
    }
    // Output admin list as PHP code
    $content = '<?php' . "\n\n" . 'define(\'FEATHER_ADMINS_LOADED\', 1);' . "\n\n" . '$feather_admins = ' . var_export($output, true) . ';' . "\n\n" . '?>';
    featherbb_write_cache_file('cache_admins.php', $content);
}