function sgp_build_minimods()
 {
     global $phpbb_root_path, $user, $template, $db, $k_config, $config, $k_config, $phpEx;
     $block_cache_time = $k_config['block_cache_time_default'];
     $queries = $cached_queries = $i = $j = 0;
     $same_mod_count = 1;
     $stored_mod_type = $mod_type = '';
     $mod_bbcode_bitfield = '';
     $filename = '';
     $select_allow = $config['override_user_style'] ? false : true;
     $sql = "SELECT * FROM " . K_MODULES_TABLE . "\n\t\t\tWHERE mod_status > 0\n\t\t\t\tORDER BY mod_type, mod_origin DESC ";
     if (!($result1 = $db->sql_query($sql, $block_cache_time))) {
         trigger_error($user->lang['ERROR_PORTAL_MENUS'] . basename(dirname(__FILE__)) . '/' . basename(__FILE__) . ', line ' . __LINE__);
     }
     $mod = array();
     while ($row = $db->sql_fetchrow($result1)) {
         $mods[] = $row;
     }
     foreach ($mods as $mod) {
         $mod_type = $mod['mod_type'];
         switch ($mod['mod_download_count']) {
             case 0:
                 $mod['mod_download_count'] = sprintf($user->lang['DOWNLOAD_COUNT_NONE'], $mod['mod_download_count']);
                 break;
             case 1:
                 $mod['mod_download_count'] = sprintf($user->lang['DOWNLOAD_COUNT'], $mod['mod_download_count']);
                 break;
             default:
                 $mod['mod_download_count'] = sprintf($user->lang['DOWNLOAD_COUNTS'], $mod['mod_download_count']);
                 break;
         }
         if ($mod_type == $stored_mod_type) {
             $same_mod_count++;
         } else {
             $same_mod_count = 1;
         }
         $info = process_for_vars(htmlspecialchars_decode($mod['mod_details']));
         $info = acronym_pass($info);
         $mod_bbcode_bitfield = $mod_bbcode_bitfield | base64_decode($mod['mod_bbcode_bitfield']);
         // Instantiate BBCode class
         if (!isset($bbcode) && $mod_bbcode_bitfield !== '') {
             if (!class_exists('bbcode')) {
                 include $phpbb_root_path . 'includes/bbcode.' . $phpEx;
             }
             $bbcode = new bbcode(base64_encode($mod_bbcode_bitfield));
         }
         if ($mod['mod_bbcode_bitfield']) {
             $bbcode->bbcode_second_pass($info, $mod['mod_bbcode_uid'], $mod['mod_bbcode_bitfield']);
         }
         $info = bbcode_nl2br($info);
         $info = smiley_text($info);
         $filename = $phpbb_root_path . 'download/file.php?name=' . $mod['mod_filename'] . '.zip';
         // separate out our mods //
         if ($mod['mod_origin']) {
             $template->assign_block_vars('our_mod_' . $mod['mod_type'] . '_row', array('MOD_NAME' => $mod['mod_name'], 'MOD_TYPE' => $mod['mod_type'], 'MOD_ORIGIN' => $mod['mod_origin'], 'MOD_VERSION' => $mod['mod_version'], 'MOD_IMG' => $phpbb_root_path . 'images/style_thumbs/' . $mod['mod_thumb'], 'MOD_THUMB' => $phpbb_root_path . 'images/style_thumbs/thumbs/' . $mod['mod_thumb'], 'MOD_UPDATED' => $mod['mod_last_update'], 'MOD_AUTHOR' => $mod['mod_author'], 'MOD_AUTHOR_CO' => $mod['mod_author_co'], 'MOD_DETAILS' => $info, 'MOD_THIS' => $i++, 'MOD_COUNT' => $mod['mod_type'] == 'style' ? $j++ : $j, 'MOD_DOWNLOAD_COUNT' => $mod['mod_download_count'], 'MOD_STATUS' => k_progress_bar($mod['mod_status']), 'MOD_COUNT' => $same_mod_count, 'U_MOD_FILENAME' => $filename, 'U_MOD_LINK' => htmlspecialchars_decode($mod['mod_link']), 'U_MOD_SUPPORT' => htmlspecialchars_decode($mod['mod_support_link']), 'U_MOD_TEST_IT' => $mod['mod_link_id'] && $select_allow ? $phpbb_root_path . 'portal.php?style=' . $mod['mod_link_id'] : ''));
         } else {
             $template->assign_block_vars('mod_' . $mod['mod_type'] . '_row', array('MOD_NAME' => $mod['mod_name'], 'MOD_TYPE' => $mod['mod_type'], 'MOD_ORIGIN' => $mod['mod_origin'], 'MOD_VERSION' => $mod['mod_version'], 'MOD_IMG' => $phpbb_root_path . 'images/style_thumbs/' . $mod['mod_thumb'], 'MOD_THUMB' => $phpbb_root_path . 'images/style_thumbs/thumbs/' . $mod['mod_thumb'], 'MOD_UPDATED' => $mod['mod_last_update'], 'MOD_AUTHOR' => $mod['mod_author'], 'MOD_AUTHOR_CO' => $mod['mod_author_co'], 'MOD_DETAILS' => $info, 'MOD_THIS' => $i++, 'MOD_COUNT' => $mod['mod_type'] == 'style' ? $j++ : $j, 'MOD_DOWNLOAD_COUNT' => $mod['mod_download_count'], 'MOD_STATUS' => k_progress_bar($mod['mod_status']), 'MOD_COUNT' => $same_mod_count, 'U_MOD_FILENAME' => $filename, 'U_MOD_LINK' => htmlspecialchars_decode($mod['mod_link']), 'U_MOD_SUPPORT' => htmlspecialchars_decode($mod['mod_support_link']), 'U_MOD_TEST_IT' => $mod['mod_link_id'] && $select_allow ? $phpbb_root_path . 'portal.php?style=' . $mod['mod_link_id'] : ''));
         }
         $stored_mod_type = $mod['mod_type'];
     }
     $template->assign_vars(array('DOWNLOAD_IMG' => '<img src="' . $phpbb_root_path . 'images/2download-box-32.png" title="Download" alt="" />', 'TEST_IT_IMG' => '<img src="' . $phpbb_root_path . 'images/gnome-view-fullscreen-32.png" title="Check it out!" alt="" />', 'PINFO_IMG' => '<img src="' . $phpbb_root_path . 'images/information-32.png" title="Info" alt="" />'));
 }
Exemplo n.º 2
0
//-- News Items are seen by everyone! Reply is restricted...
global $k_config;
$block_cache_time = $k_config['block_cache_time_default'];
$sql = 'SELECT config_name, config_value
		FROM ' . K_BLOCKS_CONFIG_VAR_TABLE . '';
$result = $db->sql_query($sql, $block_cache_time);
while ($row = $db->sql_fetchrow($result)) {
    $config[$row['config_name']] = $row['config_value'];
}
$db->sql_freeresult($result);
$number_of_news_items = $config['number_of_news_items_to_display'];
$max_news_length = $config['max_news_item_length'];
$news_forum = $config['news_forum_id'];
$allow_news = $config['allow_news'];
// Stargate Portal progress bar function + a useful function for creating text bar graph //
$template->assign_vars(array('PORTAL_PROGRESS' => k_progress_bar(95)));
// or for more use //$template->assign_block_vars('rept',array('PORTAL_PROGRESS' => progress_bar(65)));
// Fetch Posts from News Forum code borrowed from MD's IM Portal news block //
global $forum_id, $locked;
$fetch_news = phpbb_fetch_news($news_forum, $number_of_news_items, $max_news_length, 0, 0 ? 'all' : 'normal');
//$fetch_news = phpbb_fetch_news($news_forum, $number_of_news_items, $max_news_length, 0, true);
if (count($fetch_news) == 0) {
    $template->assign_block_vars('news_row', array('S_NO_TOPICS' => true, 'S_NOT_LAST' => false));
} else {
    for ($i = 0; $i < count($fetch_news); $i++) {
        if (isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true) {
            $open_bracket = '[ ';
            $close_bracket = ' ]';
            $read_full = $user->lang['READ_FULL'];
        } else {
            $open_bracket = '';
$select_theme = "<select class=\"inputbox autowidth\" onchange=\"this.form.submit();\" name=\"style\" >\n";
while ($row = $db->sql_fetchrow($result)) {
    if ($new_style) {
        $selected = $new_style == $row['style_id'] ? " selected=\"selected\"" : "";
    } else {
        $selected = $style == $row['style_id'] ? " selected=\"selected\"" : "";
    }
    $class = "\"list_release\"";
    $row['style_name'] = sgp_checksize($row['style_name'], 16);
    $select_theme .= "<option class=" . $class . " value=\"" . $row['style_id'] . "\"" . $selected . ">" . $row['style_name'] . "</option>";
}
$select_theme .= "</select>\n";
$select_theme_ok = $user->lang['WARNING_LOGIN_STYLE_SELECT'];
$s_hidden = '<input type="hidden"  id="change" name="change" value="' . $row['style_id'] . '" />';
// as $new_style will be empty for first call we need to set it to something else it will not work on first call //
if (!$new_style) {
    $new_style = $current_style;
}
switch ($style_download_count) {
    case 0:
        $style_download_count = sprintf($user->lang['DOWNLOAD_COUNT_NONE'], $style_download_count);
        break;
    case 1:
        $style_download_count = sprintf($user->lang['DOWNLOAD_COUNT'], $style_download_count);
        break;
    default:
        $style_download_count = sprintf($user->lang['DOWNLOAD_COUNTS'], $style_download_count);
        break;
}
$template->assign_vars(array('S_CH' => $select_style, 'S_MOD_ID' => $mod_id, 'S_EXTERNAL' => $mod_origin ? false : true, 'S_COPYRIGHT' => $style_copyright, 'S_SELECT_ALLOW' => $allow_style_change, 'S_SELECT_STYLE' => $select_theme, 'S_SELECT_CHANGE' => $s_hidden, 'S_SELECT_ACTION' => $s_select_action, 'S_TOTAL_STYLES' => $styles_num, 'S_CURRENT_STYLE' => $stylename, 'S_UPDATED' => $style_last_update, 'S_AUTHOR' => $style_author, 'S_AUTHOR_CO' => $style_ported_by, 'S_DETAILS' => htmlspecialchars_decode($style_details), 'S_LINK' => htmlspecialchars_decode($style_link), 'S_SUPPORT' => htmlspecialchars_decode($style_support_link), 'S_DOWNLOAD_COUNT' => $style_download_count, 'S_COMPETED' => k_progress_bar($style_status), 'S_DOWNLOAD_IMG' => '<img src="' . $phpbb_root_path . 'images/download.png" alt="" />', 'S_ANIMGIF_IMG' => '<img src="' . $phpbb_root_path . 'images/theme_thumbs.gif" style="padding-bottom:6px;" width="120" height="84" alt="" />', 'STYLE_USERS' => sprintf($user->lang['STYLE_USERS'], $style_count, $style_count == 1 ? '' : 's'), 'STYLE_SELECT_DEBUG' => sprintf($user->lang['PORTAL_DEBUG_QUERIES'], $queries ? $queries : '0', $cached_queries ? $cached_queries : '0', $total_queries ? $total_queries : '0')));