But how can I define the other Style in this File??Ptirhiik wrote:All the links are generated within includes/class_calendar_backport.php, class calendar_class_config, method url().
Code: Select all
class calendar_class_config
{
var $data;
var $root, $ext, $SID;
function calendar_class_config()
{
global $board_config, $phpbb_root_path, $phpEx, $SID;
$this->data = &$board_config;
$this->root = $phpbb_root_path;
$this->ext = $phpEx;
$this->SID = '';
}
function url($basename, $parms=array(), $add_sid=false, $fragments='', $force=false, $external=false)
{
static $script_path;
$url_parms = '';
if ( empty($parms) )
{
$parms = array();
}
if ( $add_sid && empty($parms['sid']) )
{
$parms['sid'] = substr($this->SID, strlen('sid='));
}
if ( !empty($parms) )
{
foreach ( $parms as $key => $val )
{
if ( !empty($key) && (!empty($val) || $force) )
{
$url_parms .= (empty($url_parms) ? '?' : '&') . $key . '=' . $val;
}
}
}
if ( !empty($fragments) )
{
$url_parms .= (empty($url_parms) ? '?#' : '#') . $fragments;
}
if ( $external && empty($script_path) )
{
$script_path = $this->get_script_path();
}
return ($external ? $script_path : (trim(substr($this->root, 0, 2) == './') && $add_sid ? substr($this->root, 2) : $this->root)) . $basename . '.' . $this->ext . $url_parms;
}
function get_script_path()
{
$server_protocol = empty($this->data['cookie_secure']) ? 'http://' : 'https://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($this->data['server_name']));
$server_port = ($this->data['server_port'] == 80 ? '' : ':' . trim($this->data['server_port'])) . '/';
$script_path = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($this->data['script_path']));
$script_path = $server_protocol . $server_name . $server_port . (empty($script_path) ? '' : $script_path . '/');
return $script_path;
}
}
Code: Select all
##############################################################
## MOD Title: Switch Style From URL
## MOD Author: spooky2280 < [email protected] > (Christian Fecteau) http://portfolio.christianfecteau.com/
## MOD Description: This MOD interprets a style=x argument in the URL and displays your board using the theme
## with id=x in the db. All links in the page have the style=x argument appended.
## A Style Switcher (using a frameset) is included with the MOD.
## See the MOD in action: http://christianfecteau.com/ssu
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5 Minutes
##
## Files To Edit: 3
## common.php
## includes/functions.php
## includes/sessions.php
##
## Included Files: styles.html
## styles.php
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## This MOD uses the superglobals $_GET and $_POST introduced in PHP 4.1.0
## You will need to adapt the code for earlier versions of PHP:
## use $HTTP_GET_VARS and $HTTP_POST_VARS and declare them as globals within functions.
##
## The URL for the style switcher is "http://www.example.com/yourboard/styles.html"
## If you try to load "http://www.example.com/yourboard/styles.php", there is a JavaScript
## redirection to "http://www.example.com/yourboard/styles.html"
##
## This MOD is like the Styles Demo at phpBB.com except that you can also submit and register.
## In other words, the board is fully functional while you're in the demo (a frameset).
## You don't actually need the demo. The style is changed if the style=x argument is found
## in the URL, whether you're in the frameset or not. But in the demo, the MOD uses JavaScript
## to keep you at the exact same URL when you switch style, instead of bringing you back to the
## index page like at phpBB.com
##
## The 2 included files are indeed optional. You can manually add
## a style=x argument to the URL and the MOD will display the style
## with id=x in the db. And all links in the page will have the
## argument appended so the user keeps the style from page to
## page. Only the admin and moderator links don't have the argument
## appended.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## Credits must be given with my full name (Christian Fecteau)
## and a link to my portfolio: http://portfolio.christianfecteau.com/
##
## Removal or alteration of this notice is strongly prohibited.
##
##############################################################
## MOD History:
##
## 2005-02-13 - Version 1.0.0
## - style argument is not appended anymore upon submission of profile
## - Added a warning in the Author Notes about versions of PHP
## prior to 4.1.0 and the use of the superglobals $_GET and $_POST in this MOD.
## - Added a commented TITLE element in styles.php and styles.html:
## <!-- title>Uncomment and put the title that you want</title -->
##
## 2005-02-12 - Version 0.1.0 BETA
## - First release, tested with phpBB 2.0.11 and EasyMod 0.1.13
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
copy styles.html to styles.html
copy styles.php to styles.php
#
#-----[ OPEN ]------------------------------------------
#
common.php
#
#-----[ FIND ]------------------------------------------
#
# around line 177
#
$gen_simple_header
#
#-----[ AFTER, ADD ]------------------------------------------
#
//---------start mod: Switch Style From URL-------------------------
$ssu_get = false;
//---------fin mod: Switch Style From URL-------------------------
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
# around line 227
#
global $nav_links
#
#-----[ IN-LINE FIND ]------------------------------------------
#
global
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$ssu_get, $db,
#
#-----[ FIND ]------------------------------------------
#
# around line 267
#
!$board_config['override_user_style']
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//---------start mod: Switch Style From URL-------------------------
if (isset($_GET['style']))
{
$sql = "SELECT themes_id, template_name
FROM " . THEMES_TABLE . "
ORDER BY template_name";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not get style information!", "", __LINE__, __FILE__, $sql);
}
$style_rowset = $db->sql_fetchrowset($result);
foreach ($style_rowset as $ssu_sel)
{
if (strval($ssu_sel['themes_id']) === strval($_GET['style']))
{
$board_config['default_style'] = strval($ssu_sel['themes_id']);
$ssu_get = strval($ssu_sel['themes_id']);
break;
}
$ssu_get = false;
}
}
//---------fin mod: Switch Style From URL-------------------------
#
#-----[ IN-LINE FIND ]------------------------------------------
#
!$board_config['override_user_style']
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
&& !$ssu_get
#
#-----[ FIND ]------------------------------------------
#
# around line 324
#
$row['template_name']
#
#-----[ AFTER, ADD ]------------------------------------------
#
$board_config['ssu_current'] = $row['themes_id'];
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
# around line 390
#
global $SID
#
#-----[ IN-LINE FIND ]------------------------------------------
#
global
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$ssu_get,
#
#-----[ FIND ]------------------------------------------
#
# around line 397
#
return $url;
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//---------start mod: Switch Style From URL-------------------------
if (($ssu_get) && !preg_match('#style=#', $url) && !isset($_POST['style']))
{
$url .= ((strpos($url, '?') != false) ? (($non_html_amp) ? '&' : '&') : '?') . 'style=' . $ssu_get;
}
//---------fin mod: Switch Style From URL-------------------------
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Code: Select all
//-- mod : calendar ------------------------------------------------------------
//-- add
global $user, $config, $calendar_api;
$user->set();
$calendar_api->set();
if ( !defined('IN_CALENDAR') && !defined('HAS_DIED') && (intval($config->data['calendar_header_cells']) || (intval($user->data['user_calendar_header_cells']) && !intval($config->data['calendar_header_cells_over']))) )
{
include($config->url('includes/class_calendar_handler'));
calendar_extend_template();
$calendar_header_box = new calendar_header_box('index');
$calendar_header_box->display();
$calendar_header_box->destroy();
unset($calendar_header_box);
calendar_extend_template();
}
$template->assign_vars(array(
'L_CALENDAR' => $user->lang('Calendar'),
'I_CALENDAR' => $user->img('menu_calendar'),
'U_CALENDAR' => $config->url('calendar', '', true),
));
//-- fin mod : calendar --------------------------------------------------------
Code: Select all
include($config->url('includes/class_calendar_handler'));
calendar_extend_template();
$calendar_header_box = new calendar_header_box('index');
$calendar_header_box->display();
$calendar_header_box->destroy();
unset($calendar_header_box);
calendar_extend_template();
I've done nothing yet, because the install instructions for the latest version show various edits to files, and when I look at those same files to see if they have similar edits, no edits exist for the old version, so I am concerned about having an existing, old version, and simply installing the new version without knowing where/how the old version knows what to do since the files I checked show no previous edits for the mod.Ptirhiik wrote:TC has always been adding new files in the templates/ directory: have you ensured you have copied them ? Also, there are some modifications to add to your template for the mod : did you add them to your new one ?