mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
Added user selectable templates, and put the system template into the config database. Updated mysql_schema as well
git-svn-id: file:///svn/phpbb/trunk@200 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
e150b48726
commit
42039bc31a
@ -1,38 +1,38 @@
|
||||
<?php
|
||||
/***************************************************************************
|
||||
* common.php
|
||||
* -------------------
|
||||
* begin : Saturday, Feb 23, 2001
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
* email : support@phpbb.com
|
||||
*
|
||||
/***************************************************************************
|
||||
* common.php
|
||||
* -------------------
|
||||
* begin : Saturday, Feb 23, 2001
|
||||
* copyright : (C) 2001 The phpBB Group
|
||||
* email : support@phpbb.com
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
/***************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
include('config.'.$phpEx);
|
||||
include('includes/constants.'.$phpEx);
|
||||
|
||||
//
|
||||
// Default variable values - most if not all
|
||||
// of these have equivalents in a DB table but
|
||||
// of these have equivalents in a DB table but
|
||||
// for situations where the DB cannot be read or where
|
||||
// data is missing this data is used instead
|
||||
//
|
||||
//$date_format = "m-d-Y H:i:s"; // American datesformat
|
||||
$date_format = "d M Y h:i:s a"; // European datesformat
|
||||
$date_format = "D, M d Y h:i:s a"; // European datesformat
|
||||
|
||||
$url_images = "images";
|
||||
$image_quote = "$url_images/quote.gif";
|
||||
@ -54,9 +54,7 @@ $image_msnm = "$url_images/msnm.gif";
|
||||
// Find Users real IP (if possible)
|
||||
$user_ip = ($HTTP_X_FORWARDED_FOR) ? $HTTP_X_FORWARDED_FOR : $REMOTE_ADDR;
|
||||
|
||||
// Setup what template to use. Currently just use default
|
||||
include('includes/template.inc');
|
||||
$template = new Template("./templates/Default");
|
||||
|
||||
include('includes/error.'.$phpEx);
|
||||
include('includes/sessions.'.$phpEx);
|
||||
@ -74,9 +72,11 @@ $sql = "SELECT *
|
||||
WHERE selected = 1";
|
||||
if(!$result = $db->sql_query($sql))
|
||||
{
|
||||
// Our template class hasn't been instantiated so we do it here.
|
||||
$template = new Template("templates/Default");
|
||||
error_die(SQL_QUERY, "Could not query config information.", __LINE__, __FILE__);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$config = $db->sql_fetchrow($result);
|
||||
$sitename = stripslashes($config["sitename"]);
|
||||
@ -93,7 +93,8 @@ else
|
||||
$default_lang = $config["default_lang"];
|
||||
$require_activation = $config["require_activation"];
|
||||
$sys_timezone = $config["system_timezone"];
|
||||
$sys_lang = $default_lang;
|
||||
$sys_template = $config['sys_template'];
|
||||
$sys_lang = $default_lang;
|
||||
}
|
||||
|
||||
include('language/lang_'.$default_lang.'.'.$phpEx);
|
||||
|
@ -1,7 +1,7 @@
|
||||
# $id$
|
||||
# Some basic inserts to get you started.
|
||||
|
||||
INSERT INTO phpbb_config VALUES (1,'Test forum',1,1,1,1,1,25,10,50,0,0,'With regards, the Admin','admin@yoursite.com','d M Y h:i:s a','english',0);
|
||||
INSERT INTO phpbb_config VALUES (1,'Test forum',1,1,1,1,1,25,10,50,0,0,'With regards, the Admin','admin@yoursite.com','d M Y h:i:s a','english',0,'Default');
|
||||
|
||||
INSERT INTO phpbb_categories VALUES (1,'Test category 1','1');
|
||||
|
||||
@ -9,5 +9,5 @@ INSERT INTO phpbb_forums VALUES (1,'Test Forum 1','This is just a test forum, no
|
||||
|
||||
INSERT INTO phpbb_forum_mods VALUES (1,1,0);
|
||||
|
||||
INSERT INTO phpbb_users VALUES (1,'admin','Jan 09, 2001','21232f297a57a5a743894a0e4a801fc3','admin@yourdomain.com','','','','','','This is just a stupid sig',1,1,'','','',0,1,0,0,0,0,'',4,'','','',0,'-8',1);
|
||||
INSERT INTO phpbb_users VALUES (-1,'Anonymous','May 12, 1978','','','','','','','','',0,0,'','','',0,0,0,0,0,0,'',0,'','','',0,'-8',1);
|
||||
INSERT INTO phpbb_users VALUES (1,'admin',NOW(),'21232f297a57a5a743894a0e4a801fc3','admin@yourdomain.com','','','','','','This is just a stupid sig',1,1,'','','',0,1,0,0,0,0,'',4,'','','',0,'-8',1, '');
|
||||
INSERT INTO phpbb_users VALUES (-1,'Anonymous',NOW(),'','','','','','','','',0,0,'','','',0,0,0,0,0,0,'',0,'','','',0,'-8',1,'Default');
|
||||
|
@ -1,26 +1,9 @@
|
||||
# ***************************************************************************
|
||||
# * mysql_schema.sql
|
||||
# * -------------------
|
||||
# * begin : Thursday, Apr 19, 2001
|
||||
# * copyright : (C) 2001 The phpBB Group
|
||||
# * email : support@phpbb.com
|
||||
# *
|
||||
# * $Id$
|
||||
# *
|
||||
# *
|
||||
# ***************************************************************************
|
||||
#
|
||||
#
|
||||
# ***************************************************************************
|
||||
# *
|
||||
# * 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.
|
||||
# *
|
||||
# *
|
||||
# ***************************************************************************
|
||||
# MySQL dump 8.13
|
||||
#
|
||||
# Host: localhost Database: phpBBtest
|
||||
#--------------------------------------------------------
|
||||
# Server version 3.23.35
|
||||
|
||||
#
|
||||
# Table structure for table 'phpbb_banlist'
|
||||
#
|
||||
@ -28,7 +11,7 @@
|
||||
CREATE TABLE phpbb_banlist (
|
||||
ban_id int(10) NOT NULL auto_increment,
|
||||
ban_userid int(10) default NULL,
|
||||
ban_ip char(8) default NULL,
|
||||
ban_ip int(11) default NULL,
|
||||
ban_start int(10) default NULL,
|
||||
ban_end int(10) default NULL,
|
||||
ban_time_type int(10) default NULL,
|
||||
@ -68,6 +51,7 @@ CREATE TABLE phpbb_config (
|
||||
default_dateformat varchar(20) default NULL,
|
||||
default_lang varchar(255) default NULL,
|
||||
system_timezone smallint(6) default NULL,
|
||||
sys_template varchar(20) default NULL,
|
||||
PRIMARY KEY (config_id),
|
||||
UNIQUE KEY selected (selected)
|
||||
) TYPE=MyISAM;
|
||||
@ -144,7 +128,7 @@ CREATE TABLE phpbb_posts (
|
||||
forum_id int(10) NOT NULL default '0',
|
||||
poster_id int(10) NOT NULL default '0',
|
||||
post_time int(10) NOT NULL default '0',
|
||||
poster_ip char(8) NOT NULL default '0',
|
||||
poster_ip int(10) NOT NULL default '0',
|
||||
bbcode_uid varchar(10) NOT NULL default '',
|
||||
PRIMARY KEY (post_id),
|
||||
KEY forum_id (forum_id),
|
||||
@ -171,7 +155,7 @@ CREATE TABLE phpbb_priv_msgs (
|
||||
from_userid int(10) NOT NULL default '0',
|
||||
to_userid int(10) NOT NULL default '0',
|
||||
msg_time int(10) NOT NULL default '0',
|
||||
poster_ip char(8) NOT NULL default '0',
|
||||
poster_ip int(10) NOT NULL default '0',
|
||||
msg_status int(10) NOT NULL default '0',
|
||||
msg_text text NOT NULL,
|
||||
PRIMARY KEY (msg_id),
|
||||
@ -203,7 +187,7 @@ CREATE TABLE phpbb_session (
|
||||
session_id int(10) unsigned NOT NULL default '0',
|
||||
session_user_id int(10) NOT NULL default '0',
|
||||
session_time int(10) unsigned NOT NULL default '0',
|
||||
session_ip char(8) default NULL,
|
||||
session_ip char(10) default NULL,
|
||||
session_page int(10) NOT NULL default '0',
|
||||
session_logged_in tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (session_id)
|
||||
@ -290,8 +274,9 @@ CREATE TABLE phpbb_users (
|
||||
user_actkey varchar(32) default NULL,
|
||||
user_newpasswd varchar(32) default NULL,
|
||||
user_notify tinyint(3) default NULL,
|
||||
user_timezone int(4) default NULL,
|
||||
user_timezone float default NULL,
|
||||
user_active int(2) default NULL,
|
||||
user_template varchar(20) default NULL,
|
||||
PRIMARY KEY (user_id),
|
||||
KEY user_id (user_id)
|
||||
) TYPE=MyISAM;
|
||||
|
@ -140,6 +140,31 @@ function make_jumpbox()
|
||||
return($boxstring);
|
||||
}
|
||||
|
||||
// NOTE: This function should check is_dir($file), however the is_dir function seems to be buggy on my
|
||||
// system so its not currently implemented that way
|
||||
// - James
|
||||
function template_select($default)
|
||||
{
|
||||
$dir = opendir("templates");
|
||||
$template_select = "<select name=\"selected_template\">\n";
|
||||
while($file = readdir($dir))
|
||||
{
|
||||
unset($selected);
|
||||
|
||||
if($file != "." && $file != ".." && $file != "CVS")
|
||||
{
|
||||
if($file == $default)
|
||||
{
|
||||
$selected = " SELECTED";
|
||||
}
|
||||
$template_select .= "<option value=\"$file\"$selected>$file</option>\n";
|
||||
}
|
||||
}
|
||||
$template_select .= "</select>";
|
||||
closedir($dir);
|
||||
return($template_select);
|
||||
}
|
||||
|
||||
function language_select($default, $name="language", $dirname="language/")
|
||||
{
|
||||
global $phpEx;
|
||||
@ -163,7 +188,7 @@ function language_select($default, $name="language", $dirname="language/")
|
||||
function theme_select($default)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
$sql = "SELECT theme_id, theme_name FROM ".THEMES_TABLE." ORDER BY theme_name";
|
||||
if($result = $db->sql_query($sql))
|
||||
{
|
||||
@ -197,7 +222,7 @@ function theme_select($default)
|
||||
function init_userprefs($userdata)
|
||||
{
|
||||
|
||||
global $override_user_theme;
|
||||
global $override_user_theme, $template, $sys_template;
|
||||
global $bgcolor, $table_bgcolor, $textcolor, $category_title, $table_header;
|
||||
global $color1, $color2, $header_image, $newtopic_image;
|
||||
global $reply_locked_image, $reply_image, $linkcolor, $vlinkcolor;
|
||||
@ -247,6 +272,16 @@ function init_userprefs($userdata)
|
||||
$sys_timezone = $userdata["user_timezone"];
|
||||
}
|
||||
|
||||
// Setup user's Template
|
||||
if($userdata['user_template'] != '')
|
||||
{
|
||||
$template = new Template("templates/".$userdata['user_template']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$template = new Template("templates/".$sys_template);
|
||||
}
|
||||
|
||||
// Include the appropriate language file ... if it exists.
|
||||
if(!strstr($PHP_SELF, "admin"))
|
||||
{
|
||||
|
@ -133,6 +133,8 @@ $l_itemsreq = "Items marked with a * are required";
|
||||
$l_nouserid = "You must supply a user ID number in order to view profile data.";
|
||||
$l_viewingprofile = "Viewing profile of ";
|
||||
$l_hidden = "hidden";
|
||||
$l_boardtemplate = "Select Template";
|
||||
|
||||
|
||||
// Viewforum
|
||||
$l_viewforum = "View Forum";
|
||||
|
@ -201,6 +201,7 @@ switch($mode)
|
||||
user_bbcode,
|
||||
user_timezone,
|
||||
user_lang,
|
||||
user_template,
|
||||
user_active,
|
||||
user_actkey)
|
||||
VALUES (
|
||||
@ -226,6 +227,7 @@ switch($mode)
|
||||
'$alwaysbbcode',
|
||||
'$timezone',
|
||||
'$lang',
|
||||
'$selected_template',
|
||||
";
|
||||
if($require_activation || $coppa)
|
||||
{
|
||||
@ -286,6 +288,11 @@ switch($mode)
|
||||
{
|
||||
$coppa = FALSE;
|
||||
}
|
||||
|
||||
if(!isset($selected_template))
|
||||
{
|
||||
$selected_template = $sys_template;
|
||||
}
|
||||
$template->assign_vars(array("COPPA" => $coppa,
|
||||
"L_SUBMIT" => $l_submit,
|
||||
"USERNAME" => $username,
|
||||
@ -314,6 +321,7 @@ switch($mode)
|
||||
"LANGUAGE_SELECT" => language_select($default_lang, "lang"),
|
||||
"THEME_SELECT" => theme_select($theme, $db),
|
||||
"TIMEZONE_SELECT" => tz_select($timezone),
|
||||
"TEMPLATE_SELECT" => template_select($selected_template),
|
||||
"L_ICQNUMBER" => $l_icqnumber,
|
||||
"L_STORECOOKIE" => $l_storecookie,
|
||||
"L_MESSENGER" => $l_messenger,
|
||||
@ -325,6 +333,7 @@ switch($mode)
|
||||
"L_ALWAYSSMILE" => $l_alwayssmile,
|
||||
"L_BOARDLANG" => $l_boardlang,
|
||||
"L_BOARDTHEME" => $l_boardtheme,
|
||||
"L_BOARDTEMPLATE" => $l_boardtemplate,
|
||||
"L_TIMEZONE" => $l_timezone,
|
||||
"L_YES" => $l_yes,
|
||||
"L_NO" => $l_no,
|
||||
|
@ -103,6 +103,10 @@
|
||||
<td bgcolor="#DDDDDD"><b>{L_BOARDTHEME}:</b></td>
|
||||
<td bgcolor="#CCCCCC">{THEME_SELECT}</td>
|
||||
</tr>
|
||||
<tr class="tablebody">
|
||||
<td bgcolor="#DDDDDD"><b>{L_BOARDTEMPLATE}:</b></td>
|
||||
<td bgcolor="#CCCCCC">{TEMPLATE_SELECT}</td>
|
||||
</tr>
|
||||
<tr class="tablebody">
|
||||
<td bgcolor="#DDDDDD"><b>{L_TIMEZONE}:</b></td>
|
||||
<td bgcolor="#CCCCCC">{TIMEZONE_SELECT}</td>
|
||||
@ -111,7 +115,7 @@
|
||||
<td align="center" colspan="2">
|
||||
<input type="hidden" name="mode" value="{MODE}">
|
||||
<input type="hidden" name="agreed" value="true">
|
||||
<input type="hidden" name="coppa" value="{COPPA}">
|
||||
<input type="hidden" name="coppa" value="{COPPA}">
|
||||
<input type="submit" name="submit" value="{L_SUBMIT}">
|
||||
</tr>
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user