Пример #1
0
    $cache_id = create_cache_id('data.dropdown_form', array($user_info[$user_table_fields['user_id']], $config['template_dir'], $config['language_dir']));
    if (!($category_dropdown_form = get_cache_file($cache_id))) {
        // Always append session id if cache is enabled
        $old_session_mode = $site_sess->mode;
        $site_sess->mode = 'get';
        $category_dropdown_form = $site_template->parse_template("category_dropdown_form");
        $site_sess->mode = $old_session_mode;
        save_cache_file($cache_id, $category_dropdown_form);
    }
}
$site_template->register_vars("category_dropdown_form", $category_dropdown_form);
unset($category_dropdown_form);
//-----------------------------------------------------
//--- Random Image ------------------------------------
//-----------------------------------------------------
$random_image = defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['setperpage'])) {
    $setperpage = intval($HTTP_POST_VARS['setperpage']);
    if ($setperpage) {
        $site_sess->set_session_var("perpage", $setperpage);
        $session_info['perpage'] = $setperpage;
    }
}
if (isset($session_info['perpage'])) {
    $perpage = $session_info['perpage'];
} else {
Пример #2
0
    $media_dir = '../../../../media_apvn/page/background/';
    $ext_array = array('.png', '.gif', '.jpg');
    $bilder_arr = array();
    if (file_exists($media_dir)) {
        $handle = opendir($media_dir);
        while (false !== ($file = readdir($handle))) {
            // Pfad und Datei
            $mediafile = $media_dir . $file;
            $extension = strrchr($file, ".");
            if (is_file($mediafile) && in_array($extension, $ext_array)) {
                array_push($bilder_arr, $mediafile);
            }
        }
        /* Zufallsgenerator waehlt ein Bild */
        if (count($bilder_arr) > 0) {
            $numr = array_rand($bilder_arr, 1);
            $bild = $bilder_arr[$numr];
            $html = $bild != '' ? '<img src="' . HOST . $bild . '" border="0" alt="" />' : '';
        }
        return $bild;
    }
}
?>

#page_margins
{
  background:  url("<?php 
echo get_random_image();
?>
") #ffffff no-repeat left top; 
}
        return $data;
    }
}
// Stargate Random Banner mod //
global $k_config, $template, $phpbb_root_path, $user;
if ($k_config['rand_banner'] != 0) {
    $image = get_random_image($phpbb_root_path . 'images/rand_banner', true);
    $template->assign_vars(array('RAND_BANNER' => $image, 'RAND_BANNER_POSITION' => $k_config['rand_banner']));
}
if ($k_config['rand_header'] == 1) {
    global $user, $template, $config, $k_config;
    // get an image but don't parse it...
    // we now use the styles own folder...
    // as this file may be called for one or more functions the $user->theme['theme_path'] may not be visible so hide errors //
    @($path = $phpbb_root_path . 'styles/' . $user->theme['theme_path'] . '/theme/images/headers');
    $image = get_random_image($path, false, 'header_', true);
    $template->assign_vars(array('RAND_HEADER_IMG' => $image, 'RAND_HEADER_OPT' => $k_config['rand_header']));
}
/*
if (!function_exists('sgp_delete_cookies'))
{
	function sgp_delete_cookies()
	{
		global $user, $phpbb_root_path, $phpEx;

		if (confirm_box(true))
		{
			$user->set_cookie('sgp_right', '', 1);
			$user->set_cookie('sgp_center', '', 1);
			$user->set_cookie('sgp_left', '', 1);
			$user->set_cookie('sgp_block_cache', '0', 1);
Пример #4
0
function get_categories($cat_id = 0)
{
    global $site_template, $site_db, $site_sess, $config, $lang;
    global $cat_cache, $cat_parent_cache, $new_image_cache, $subcat_ids;
    $cattable_width = ceil(intval($config['cat_table_width']) / $config['cat_cells']);
    if (substr($config['cat_table_width'], -1) == "%") {
        $cattable_width .= "%";
    }
    if (!isset($cat_parent_cache[$cat_id])) {
        return "";
    }
    $visible_cat_cache = array();
    foreach ($cat_parent_cache[$cat_id] as $key => $val) {
        if (check_permission("auth_viewcat", $val)) {
            $visible_cat_cache[$key] = $val;
        }
    }
    if (empty($visible_cat_cache)) {
        return "";
    }
    $total = sizeof($visible_cat_cache);
    $table_columns = intval($config['cat_cells']) ? intval($config['cat_cells']) : 2;
    if ($total <= $table_columns) {
        $table_rows = 1;
    } else {
        $table_rows = $total / $table_columns;
        if ($total >= $table_columns && !is_integer($table_rows)) {
            $table_rows = intval($table_rows) + 1;
        }
    }
    $categories = "\n<table width=\"" . $config['cat_table_width'] . "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td valign=\"top\" width=\"" . $cattable_width . "\" class=\"catbgcolor\">\n";
    $categories .= "<table border=\"0\" cellpadding=\"" . $config['cat_table_cellpadding'] . "\" cellspacing=\"" . $config['cat_table_cellspacing'] . "\">\n";
    $count = 0;
    $count2 = 0;
    foreach ($visible_cat_cache as $key => $category_id) {
        $categories .= "<tr>\n<td valign=\"top\">\n";
        $is_new = isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0 ? 1 : 0;
        $num_images = isset($cat_cache[$category_id]['num_images']) ? $cat_cache[$category_id]['num_images'] : 0;
        $subcat_ids = array();
        get_subcat_ids($category_id, $category_id, $cat_parent_cache);
        if (isset($subcat_ids[$category_id])) {
            foreach ($subcat_ids[$category_id] as $val) {
                if (isset($new_image_cache[$val]) && $new_image_cache[$val] > 0) {
                    $is_new = 1;
                }
                if (isset($cat_cache[$val]['num_images'])) {
                    $num_images += $cat_cache[$val]['num_images'];
                }
            }
        }
        if (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0 || defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0) {
            $random_cat_image_file = "";
        } else {
            $random_cat_image_file = get_random_image($category_id, 0, 1);
        }
        $site_template->register_vars(array("cat_id" => $category_id, "cat_name" => format_text($cat_cache[$category_id]['cat_name'], 2), "cat_description" => format_text($cat_cache[$category_id]['cat_description'], 1), "cat_hits" => $cat_cache[$category_id]['cat_hits'], "cat_is_new" => $is_new, "lang_new" => $lang['new'], "sub_cats" => get_subcategories($category_id), "cat_url" => $site_sess->url(ROOT_PATH . "categories.php?" . URL_CAT_ID . "=" . $category_id), "random_cat_image_file" => $random_cat_image_file, "num_images" => $num_images));
        $categories .= $site_template->parse_template("category_bit");
        $count++;
        $count2++;
        $categories .= "</td>\n</tr>\n";
        if ($count == $table_rows && $count2 < sizeof($visible_cat_cache)) {
            $categories .= "</table></td>\n";
            $categories .= "<td valign=\"top\" width=\"" . $cattable_width . "\" class=\"catbgcolor\">\n";
            $categories .= "<table border=\"0\" cellpadding=\"" . $config['cat_table_cellpadding'] . "\" cellspacing=\"" . $config['cat_table_cellspacing'] . "\">\n";
            $total = $total - $count2;
            $table_columns = $table_columns - 1;
            /*if ($total <= $table_columns && $table_columns > 1) {
                $table_rows = 1;
              }
              else {
                $table_rows = $total / $table_columns;
                if ($total >= $table_columns && !is_integer($table_rows)) {
                  $table_rows = intval($table_rows) + 1;
                }
              }*/
            $count = 0;
        }
    }
    $categories .= "</table>\n</td>\n</tr>\n</table>\n";
    return $categories;
}
Пример #5
0
<?php

/**
*
* @package Stargate Portal
* @author  Michael O'Toole - aka Michaelo
* @begin   Saturday, Jan 22, 2005
* @copyright (c) 2005-2008 phpbbireland
* @home    http://www.phpbbireland.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @note: Do not remove this copyright. Just append yours if you have modified it,
*        this is part of the Stargate Portal copyright agreement...
*
* @version $Id: block_books.php 336 2009-01-23 02:06:37Z Michealo $
* Generate a random image used with the books block...
* Updated: 28 January 2008
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB')) {
    exit;
}
$queries = $cached_queries = 0;
global $phpbb_root_path;
$rand_image = get_random_image($phpbb_root_path . 'images/books', false, '');
$template->assign_vars(array('BOOKSCONTENT' => $rand_image, 'BOOKS_DEBUG' => sprintf($user->lang['PORTAL_DEBUG_QUERIES'], $queries ? $queries : '0', $cached_queries ? $cached_queries : '0', $total_queries ? $total_queries : '0')));