Example #1
0
             if ($cur_thread['email_setting'] == '0' && !$luna_user['is_guest']) {
                 $item['author']['email'] = $cur_thread['email'];
             }
             $item['author']['uri'] = '/profile.php?id=' . $cur_thread['commenter_id'];
         } elseif ($cur_thread['commenter_email'] != '' && !$luna_user['is_guest']) {
             $item['author']['email'] = $cur_thread['commenter_email'];
         }
         $feed['items'][] = $item;
     }
     // Output feed as PHP code
     if (isset($cache_id)) {
         if (!defined('LUNA_CACHE_FUNCTIONS_LOADED')) {
             require LUNA_ROOT . 'include/cache.php';
         }
         $content = '<?php' . "\n\n" . '$feed = ' . var_export($feed, true) . ';' . "\n\n" . '$cache_expire = ' . ($now + $luna_config['o_feed_ttl'] * 60) . ';' . "\n\n" . '?>';
         luna_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;
Example #2
0
function generate_admins_cache()
{
    global $db;
    // Get admins from the DB
    $result = $db->query('SELECT id FROM ' . $db->prefix . 'users WHERE group_id=' . FORUM_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(\'FORUM_ADMINS_LOADED\', 1);' . "\n\n" . '$luna_admins = ' . var_export($output, true) . ';' . "\n\n" . '?>';
    luna_write_cache_file('cache_admins.php', $content);
}