|
From: <Yau...@us...> - 2007-08-29 02:50:18
|
Revision: 19
http://thevr.svn.sourceforge.net/thevr/?rev=19&view=rev
Author: Yautja_cetanu
Date: 2007-08-28 19:50:18 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Initial Upload and mods for TheVR PMS stuff using dom's modx version 0.1.1c. This needs to be checked against the CVS for any errors. (before CVS is complete)
Modified Paths:
--------------
mods/pms/trunk/adm/style/acp_forums.html
mods/pms/trunk/common.php
mods/pms/trunk/includes/acp/acp_forums.php
mods/pms/trunk/includes/auth.php
mods/pms/trunk/includes/constants.php
mods/pms/trunk/includes/functions_user.php
mods/pms/trunk/language/en/acp/board.php
mods/pms/trunk/language/en/acp/common.php
mods/pms/trunk/language/en/acp/forums.php
Added Paths:
-----------
mods/pms/trunk/adm/style/acp_siteconfig.html
mods/pms/trunk/adm/style/acp_sites.html
mods/pms/trunk/includes/acp/acp_siteconfig.php
mods/pms/trunk/includes/acp/acp_sites.php
mods/pms/trunk/includes/acp/info/acp_siteconfig.php
mods/pms/trunk/includes/acp/info/acp_sites.php
mods/pms/trunk/includes/functions_thevr.php
mods/pms/trunk/language/en/acp/siteconfig.php
mods/pms/trunk/language/en/acp/sites.php
mods/pms/trunk/language/en/mods/permissions_sites.php
Modified: mods/pms/trunk/adm/style/acp_forums.html
===================================================================
--- mods/pms/trunk/adm/style/acp_forums.html 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/adm/style/acp_forums.html 2007-08-29 02:50:18 UTC (rev 19)
@@ -175,6 +175,11 @@
<dt><label for="forum_perm_from">{L_COPY_PERMISSIONS}:</label><br /><span>{L_COPY_PERMISSIONS_EXPLAIN}</span></dt>
<dd><select id="forum_perm_from" name="forum_perm_from"><option value="0">{L_NO_PERMISSIONS}</option>{S_FORUM_OPTIONS}</select></dd>
</dl>
+ <dl>
+ <dt><label for="forum_site_id">{L_SITE_ID}:</label><br /><span>{L_SITE_ID_EXPLAIN}</span></dt>
+ <dd><select id="forum_site_id" name="forum_site_id"><option value="0">{L_SITE_GLOBAL}</option>{S_SITE_OPTIONS}</select></dd>
+ </dl>
+
</fieldset>
<div id="forum_cat_options">
Added: mods/pms/trunk/adm/style/acp_siteconfig.html
===================================================================
--- mods/pms/trunk/adm/style/acp_siteconfig.html (rev 0)
+++ mods/pms/trunk/adm/style/acp_siteconfig.html 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,53 @@
+<!-- INCLUDE overall_header.html -->
+
+<a name="maincontent"></a>
+
+<h1>{L_TITLE}</h1>
+
+<p>{L_TITLE_EXPLAIN}</p>
+
+<!-- IF S_ERROR -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+
+ </div>
+<!-- ENDIF -->
+
+<form id="acp_siteconfig" method="post" action="{U_ACTION}">
+
+<!-- BEGIN options -->
+ <!-- IF options.S_LEGEND -->
+ <!-- IF not options.S_FIRST_ROW -->
+ </fieldset>
+ <!-- ENDIF -->
+ <fieldset>
+
+ <legend>{options.LEGEND}</legend>
+ <!-- ELSE -->
+
+ <dl>
+ <dt><label for="{options.KEY}">{options.TITLE}:</label><!-- IF options.S_EXPLAIN --><br /><span>{options.TITLE_EXPLAIN}</span><!-- ENDIF --></dt>
+ <dd>{options.CONTENT}</dd>
+ </dl>
+
+ <!-- ENDIF -->
+<!-- END options -->
+
+<!-- IF S_AUTH -->
+ <!-- BEGIN auth_tpl -->
+ {auth_tpl.TPL}
+ <!-- END auth_tpl -->
+<!-- ENDIF -->
+</fieldset>
+
+<fieldset class="submit-buttons">
+ <legend>{L_SUBMIT}</legend>
+
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
+ <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
+</fieldset>
+
+</form>
+
+<!-- INCLUDE overall_footer.html -->
\ No newline at end of file
Added: mods/pms/trunk/adm/style/acp_sites.html
===================================================================
--- mods/pms/trunk/adm/style/acp_sites.html (rev 0)
+++ mods/pms/trunk/adm/style/acp_sites.html 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,314 @@
+<!-- INCLUDE overall_header.html -->
+
+<a name="maincontent"></a>
+<!-- IF S_ADD_SITE -->
+
+ <script type="text/javascript">
+ </script>
+
+ <h1>{EDIT_TITLE}</h1>
+
+ <p>{L_SITE_EDIT_EXPLAIN}</p>
+
+ <form id="siteedit" method="post" action="{U_ACTION}">
+ <fieldset>
+ <legend>{L_SITE_SETTINGS}</legend>
+ <dl>
+ <dt><label for="name">{L_SITE_NAME}:</label></dt>
+ <dd><input class="medium" type="text" id="name" name="name" onchange="display_options(this.options[this.selectedIndex].value);" value="{SITE_NAME}" maxlength="255"></dd>
+ </dl>
+ <!-- IF S_EDIT_SITE -->
+
+ <!-- ELSE -->
+ <dl>
+ <dt><label for="domain">{L_SITE_DOMAIN}:</label></dt>
+ <dd><input class="medium" type="text" id="domain" name="domain" onchange="display_options(this.options[this.selectedIndex].value);" maxlength="255"></dd>
+ </dl>
+ <!-- ENDIF -->
+ <dl>
+ <dt><label for="desc">{L_SITE_DESC}:</label></dt>
+
+ <dd><textarea rows="5" cols="45" id="desc" name="desc" maxlength="255">{SITE_DESC}</textarea></dd>
+ </dl>
+ <dl>
+ <dt><label for="home">{L_SITE_HOME}:</label></dt>
+ <dd><input class="medium" type="text" id="home" name="home" onchange="display_options(this.options[this.selectedIndex].value);" value="{SITE_HOME}" maxlength="255"></dd>
+ </dl>
+ <dl>
+ <dt><label for="style">{L_SITE_STYLE}:</label></dt>
+
+ <dd><select id="style" name="style"><option value="0">{L_DEFAULT_STYLE}</option>{S_STYLES_OPTIONS}</select></dd>
+ </dl>
+ <!-- IF S_EDIT_SITE -->
+ <input id="id" name="id" type="hidden" value="{SITE_ID}">
+ <!-- ENDIF -->
+ </fieldset>
+
+ <fieldset class="submit-buttons">
+
+ <legend>{L_SUBMIT}</legend>
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
+ <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
+ </fieldset>
+ </form>
+
+<!-- ELSEIF S_DELETE_SITE -->
+
+ <h1>{L_SITE_DELETE}</h1>
+
+ <p>{L_SITE_DELETE_EXPLAIN}</p>
+
+ <!-- IF S_ERROR -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+ </div>
+
+ <!-- ENDIF -->
+
+ <form id="site_delete" method="post" action="{U_ACTION}">
+
+ <fieldset>
+ <legend>{L_SITE_DELETE}</legend>
+ <dl>
+ <dt><label>{L_SITE_NAME}:</label></dt>
+ <dd><b>{SITE_NAME}</b></dd>
+
+ <dl>
+ <p class="quick">
+ <input id="id" name="id" type="hidden" value="{SITE_ID}">
+ <input class="button1" type="submit" name="submit" value="{L_SUBMIT}" />
+ </p>
+ </fieldset>
+
+ </form>
+<!-- ELSEIF S_LIST_SITES -->
+
+ <h1>{L_SITE_ADMIN}</h1>
+
+ <p>{L_SITE_ADMIN_EXPLAIN}</p>
+
+ <!-- IF ERROR_MSG -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+
+ </div>
+ <!-- ENDIF -->
+
+ <!-- IF .sites -->
+ <table cellspacing="1">
+ <col class="row1" /><col class="row1" /><col class="row2" />
+ <tbody>
+ <!-- BEGIN sites -->
+ <tr>
+
+ <td>
+ <strong>{sites.SITE_NAME}</strong>
+ <br /><span>{sites.SITE_DESC}</span>
+ </td>
+ <td>
+ <!-- BEGIN urls -->
+ {sites.urls.SITE_DOMAIN}<br/>
+
+ <!-- BEGINELSE -->
+ {L_NO_DOMAINS}
+ <!-- END urls -->
+ </td>
+ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
+ <a href="{sites.U_EDIT}">{ICON_EDIT}</a>
+ <a href="{sites.U_DELETE}">{ICON_DELETE}</a>
+ </td>
+
+ </tr>
+ <!-- BEGINELSE -->
+ <tr>
+ <td class="row1" colspan="5" align="center"><p class="gensmall">{L_NO_SITES}</p></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- END sites -->
+
+ </tbody>
+ </table>
+ <!-- ENDIF -->
+ <form id="sites" method="post" action="{U_ADD}">
+
+ <fieldset class="quick">
+ <input type="hidden" name="action" value="add" />
+
+ <input type="text" name="name" value="" maxlength="255" />
+ <input class="button2" name="addsite" type="submit" value="{L_CREATE_SITE}" />
+
+ </fieldset>
+
+ </form>
+<!-- ELSEIF S_ADD_URL -->
+
+ <script type="text/javascript">
+ </script>
+
+ <h1>{EDIT_TITLE}</h1>
+
+ <p>{L_SITE_URL_EDIT_EXPLAIN}</p>
+
+ <form id="siteedit" method="post" action="{U_ACTION}">
+ <fieldset>
+ <legend>{L_SITE_URL_SETTINGS}</legend>
+ <dl>
+ <dt><label for="name">{L_URL_DOMAIN}:</label></dt>
+ <dd><input class="medium" type="text" id="domain" name="domain" onchange="display_options(this.options[this.selectedIndex].value);" value="{URL_DOMAIN}" maxlength="255"></dd>
+ </dl>
+
+ <dl>
+ <dt><label for="site_id">{L_URL_SITE}:</label></dt>
+ <dd><select id="site_id" name="site_id">{S_SITES_OPTIONS}</select></dd>
+ </dl>
+ <!-- IF S_EDIT_URL -->
+ <input id="id" name="id" type="hidden" value="{URL_ID}">
+ <!-- ENDIF -->
+ </fieldset>
+
+ <fieldset class="submit-buttons">
+ <legend>{L_SUBMIT}</legend>
+ <input class="button1" type="submit" id="submit" name="submit" value="{L_SUBMIT}" />
+ <input class="button2" type="reset" id="reset" name="reset" value="{L_RESET}" />
+ </fieldset>
+ </form>
+<!-- ELSEIF S_DELETE_URL -->
+
+ <h1>{L_SITE_URL_DELETE}</h1>
+
+ <p>{L_SITE_URL_DELETE_EXPLAIN}</p>
+
+ <!-- IF S_ERROR -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+ </div>
+
+ <!-- ENDIF -->
+
+ <form id="site_delete" method="post" action="{U_ACTION}">
+
+ <fieldset>
+ <legend>{L_SITE_URL_DELETE}</legend>
+ <dl>
+ <dt><label>{L_URL_DOMAIN}:</label></dt>
+ <dd><b>{URL_DOMAIN}</b></dd>
+
+ <dl>
+ <p class="quick">
+ <input id="id" name="id" type="hidden" value="{URL_ID}">
+ <input class="button1" type="submit" name="submit" value="{L_SUBMIT}" />
+ </p>
+ </fieldset>
+
+ </form>
+
+<!-- ELSEIF S_LIST_URL_CATS -->
+
+ <h1>{L_SITE_URL_ADMIN}</h1>
+
+ <p>{L_SITE_URL_ADMIN_EXPLAIN}</p>
+
+ <!-- IF ERROR_MSG -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+
+ </div>
+ <!-- ENDIF -->
+
+ <!-- IF .sites -->
+ <table cellspacing="1">
+ <col class="row1" /><col class="row1" /><col class="row2" />
+ <tbody>
+ <!-- BEGIN sites -->
+ <tr>
+
+ <td style="width: 5%;">{sites.SITE_ICON}</td>
+ <td>
+ <a href="{sites.U_URLS}"><strong>{sites.SITE_NAME}</strong></a>
+ <br /><span>{sites.SITE_DESC}</span>
+ </td>
+ <td>
+ <!-- BEGIN urls -->
+
+ {sites.urls.SITE_DOMAIN}<br/>
+ <!-- BEGINELSE -->
+ {L_NO_DOMAINS}
+ <!-- END urls -->
+ </td>
+ </tr>
+ <!-- BEGINELSE -->
+ <tr>
+ <td class="row1" colspan="5" align="center"><p class="gensmall">{L_NO_SITES}</p></td>
+
+ <td></td>
+ <td></td>
+ </tr>
+ <!-- END sites -->
+ </tbody>
+ </table>
+ <!-- ENDIF -->
+
+
+<!-- ELSEIF S_LIST_URLS -->
+
+ <h1>{L_SITE_URL_ADMIN} :: {SITE_NAME}</h1>
+
+ <p>{L_SITE_URL_ADMIN_EXPLAIN}</p>
+
+ <!-- IF ERROR_MSG -->
+ <div class="errorbox">
+ <h3>{L_WARNING}</h3>
+ <p>{ERROR_MSG}</p>
+
+ </div>
+ <!-- ENDIF -->
+
+ <!-- IF .urls -->
+ <table cellspacing="1">
+ <col class="row1" /><col class="row2" />
+ <tbody>
+ <!-- BEGIN urls -->
+ <tr>
+
+ <td>
+ <strong>{urls.URL_DOMAIN}</strong>
+ </td>
+ <td style="vertical-align: top; width: 100px; text-align: right; white-space: nowrap;">
+ <a href="{urls.URL_EDIT}">{ICON_EDIT}</a>
+ <a href="{urls.URL_DELETE}">{ICON_DELETE}</a>
+ </td>
+
+ </tr>
+ <!-- BEGINELSE -->
+ <tr>
+ <td class="row1" colspan="5" align="center"><p class="gensmall">{L_NO_URLS}</p></td>
+ <td></td>
+ </tr>
+ <!-- END urls -->
+ </tbody>
+
+ </table>
+ <!-- ENDIF -->
+
+ <form id="urls" method="post" action="{URL_ADD}">
+
+ <fieldset class="quick">
+ <input type="hidden" name="action" value="add" />
+
+ <input type="text" name="domain" value="" maxlength="255" />
+ <input class="button2" name="addurl" type="submit" value="{L_CREATE_URL}" />
+
+ </fieldset>
+
+ </form>
+
+
+
+<!-- ENDIF -->
+
+<!-- INCLUDE overall_footer.html -->
Modified: mods/pms/trunk/common.php
===================================================================
--- mods/pms/trunk/common.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/common.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -170,6 +170,7 @@
require($phpbb_root_path . 'includes/constants.' . $phpEx);
require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx);
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
+require($phpbb_root_path . 'includes/functions_thevr.' . $phpEx);
// Set PHP error handler to ours
set_error_handler('msg_handler');
@@ -190,4 +191,92 @@
// Grab global variables, re-cache if necessary
$config = $cache->obtain_config();
+/***** START
+ADDED by andrewbelcher for thevr.co.uk
+This processes the URL so the correct site settings can be used.
+*****/
+
+$domain = $_SERVER['SERVER_NAME']; // Get the domain information out of the server url (eg www.thevr.co.uk)
+
+$domain_bits = explode('.', $domain);
+$bits = count($domain_bits) - 1;
+
+$domains = array(0 => $domain_bits[$bits]);
+$i = 1;
+while ($i <= $bits)
+{
+ $domains[$i] = $domain_bits[$bits - $i] . '.' . $domains[$i - 1];
+
+ $i++;
+}
+
+$sql = 'SELECT s.*, su.domain
+ FROM ' . SITES_TABLE . ' s INNER JOIN ' . SITE_URL_TABLE . ' su ON s.site_id = su.site_id
+ WHERE su.domain IN ';
+
+foreach ($domains AS $key => $value)
+{
+ $sql .= ($notfirst == false) ? '(': ', ';
+ $sql .= "'$value'";
+
+ $notfirst = true;
+}
+
+$sql .= ')
+ ORDER BY length(domain) DESC
+ LIMIT 1';
+
+$result = $db->sql_query($sql);
+$row = $db->sql_fetchrow($result);
+
+ if (empty($row['site_id']))
+ {
+ $config['site_id'] = -1;
+ }
+ else
+ {
+ // Store the information in a config array $config
+ $config = array_merge($config, array(
+ 'site_id' => $row['site_id'],
+ 'site_uname' => $row['name'],
+ 'site_desc' => $row['description'],
+ 'site_group_id' => $row['group_id'],
+ 'site_home' => $row['home'],
+ 'site_domain' => $domain,
+ 'site_file' => $filename,
+ 'site_vars' => $vars)
+
+ );
+ }
+ //Fetch site specific config data:
+ $sql = 'SELECT * FROM ' . SITE_CONFIG_TABLE . ' WHERE site_id = ' . $config['site_id'] . ' AND overide=1';
+ $result = $db->sql_query($sql);
+
+ while ( $row = $db->sql_fetchrow($result) )
+ {
+ $config[$row['config_name']] = $row['config_value'];
+ }
+
+ if ($domain_bits[0] == 'm' OR $domain_bits[0] == 'mobile')
+ {
+ define('MOBILE_VERSION', true);
+ }
+/***** END *****/
+
+// Temporary addition until cookies are sorted:
+ if (strpos($domain, 'thevr.co.uk') == false AND $domain != 'thevr.co.uk')
+ {
+ $sql = 'SELECT su.domain
+ FROM ' . SITE_URL_TABLE . " AS su
+ WHERE su.site_id = '" . $config['site_id'] . "'
+ AND su.domain LIKE '%thevr.co.uk'
+ LIMIT 1";
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+
+ header('Location: http://' . $row['domain'] . $_SERVER['REQUEST_URI']);
+ }
+
+
+
?>
\ No newline at end of file
Modified: mods/pms/trunk/includes/acp/acp_forums.php
===================================================================
--- mods/pms/trunk/includes/acp/acp_forums.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/includes/acp/acp_forums.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -131,6 +131,7 @@
'prune_sticky' => request_var('prune_sticky', false),
'forum_password' => request_var('forum_password', '', true),
'forum_password_confirm'=> request_var('forum_password_confirm', '', true),
+ 'forum_site_id' => request_var('forum_site_id', 0),
);
// Use link_display_on_index setting if forum type is link
@@ -464,6 +465,7 @@
'forum_flags' => FORUM_FLAG_POST_REVIEW,
'forum_password' => '',
'forum_password_confirm'=> '',
+ 'forum_site_id' => 0,
);
}
}
@@ -546,6 +548,20 @@
);
}
$db->sql_freeresult($result);
+ $site_list = '';
+
+ $sql = 'SELECT *
+ FROM ' . SITES_TABLE;
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $site_list .= '<option value="' . $row['site_id'] . '"';
+ $site_list .= ($forum_data['site_id'] == $row['site_id']) ? ' selected="selected"': '';
+ $site_list .= '>' . $row['name'] . '</option>';
+ }
+ $db->sql_freeresult($result);
+
// Subforum move options
if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT)
@@ -638,6 +654,7 @@
'S_STATUS_OPTIONS' => $statuslist,
'S_PARENT_OPTIONS' => $parents_list,
'S_STYLES_OPTIONS' => $styles_list,
+ 'S_SITE_OPTIONS' => $site_list,
'S_FORUM_OPTIONS' => make_forum_select(($action == 'add') ? $forum_data['parent_id'] : false, ($action == 'edit') ? $forum_data['forum_id'] : false, false, false, false),
'S_SHOW_DISPLAY_ON_INDEX' => $s_show_display_on_index,
'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
Added: mods/pms/trunk/includes/acp/acp_siteconfig.php
===================================================================
--- mods/pms/trunk/includes/acp/acp_siteconfig.php (rev 0)
+++ mods/pms/trunk/includes/acp/acp_siteconfig.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,211 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id: acp_siteconfig.php,v 1.3 2007/06/08 14:48:19 yautja_cetanu Exp $
+* @copyright (c) 2007 thevr
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+class acp_siteconfig
+{
+ var $u_action;
+ var $new_config = array();
+
+ function main($id, $mode)
+ {
+ global $config, $db, $user, $auth, $template, $cache;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
+
+ include($phpbb_root_path.'/includes/functions_user.php');
+ include_once($phpbb_root_path.'/includes/functions_thevr.php');
+
+ $user->add_lang('acp/siteconfig');
+ $user->add_lang('acp/board');
+
+ $action = request_var('action', '');
+ $site_id = request_var('site', $config['site_id']);
+ $submit = (isset($_POST['submit'])) ? true : false;
+
+ switch ($mode)
+ {
+ case 'settings':
+ $display_vars = array(
+ 'title' => 'ACP_SITE_SETTINGS',
+ 'vars' => array(
+ 'legend1' => 'ACP_SITE_SETTINGS',
+ 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
+ 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false),
+ 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true),
+ 'board_disable_msg' => false,
+ 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'string', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
+ 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true),
+ 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => false),
+
+ 'legend2' => 'WARNINGS',
+ 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int', 'type' => 'text:3:4', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
+ )
+ );
+ }
+
+ if (isset($display_vars['lang']))
+ {
+ $user->add_lang($display_vars['lang']);
+ }
+
+ $this->new_config = $config;
+ $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
+ $error = array();
+
+ // We validate the complete config if whished
+ validate_config_vars($display_vars['vars'], $cfg_array, $error);
+
+ // Do not write values if there is an error
+ if (sizeof($error))
+ {
+ $submit = false;
+ }
+
+ // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
+ foreach ($display_vars['vars'] as $config_name => $null)
+ {
+ if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
+ {
+ continue;
+ }
+
+ if ($config_name == 'auth_method')
+ {
+ continue;
+ }
+
+ $this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
+
+ if ($config_name == 'email_function_name')
+ {
+ $this->new_config['email_function_name'] = trim(str_replace(array('(', ')'), array('', ''), $this->new_config['email_function_name']));
+ $this->new_config['email_function_name'] = (empty($this->new_config['email_function_name']) || !function_exists($this->new_config['email_function_name'])) ? 'mail' : $this->new_config['email_function_name'];
+ $config_value = $this->new_config['email_function_name'];
+ }
+
+ if ($submit)
+ {
+ set_site_config($config_name, $config_value, $site_id);
+ }
+ }
+
+ if ($submit)
+ {
+ add_log('admin', 'LOG_CONFIG_' . strtoupper($mode));
+
+ trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
+ }
+
+ $this->tpl_name = 'acp_siteconfig';
+ $this->page_title = $display_vars['title'];
+
+ $template->assign_vars(array(
+ 'L_TITLE' => $user->lang[$display_vars['title']],
+ 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'],
+
+ 'S_ERROR' => (sizeof($error)) ? true : false,
+ 'ERROR_MSG' => implode('<br />', $error),
+
+ 'U_ACTION' => $this->u_action)
+ );
+
+ // Output relevant page
+ foreach ($display_vars['vars'] as $config_key => $vars)
+ {
+ if (!is_array($vars) && strpos($config_key, 'legend') === false)
+ {
+ continue;
+ }
+
+ if (strpos($config_key, 'legend') !== false)
+ {
+ $template->assign_block_vars('options', array(
+ 'S_LEGEND' => true,
+ 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
+ );
+
+ continue;
+ }
+
+ $type = explode(':', $vars['type']);
+
+ $l_explain = '';
+ if ($vars['explain'] && isset($vars['lang_explain']))
+ {
+ $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
+ }
+ else if ($vars['explain'])
+ {
+ $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
+ }
+
+ $template->assign_block_vars('options', array(
+ 'KEY' => $config_key,
+ 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
+ 'S_EXPLAIN' => $vars['explain'],
+ 'TITLE_EXPLAIN' => $l_explain,
+ 'CONTENT' => build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars),
+ )
+ );
+
+ unset($display_vars['vars'][$config_key]);
+ }
+ }
+
+ /**
+ * Board disable option and message
+ */
+ function board_disable($value, $key)
+ {
+ global $user;
+
+ $radio_ary = array(1 => 'YES', 0 => 'NO');
+
+ return h_radio('config[board_disable]', $radio_ary, $value) . '<br /><input id="' . $key . '" type="text" name="config[board_disable_msg]" maxlength="255" size="40" value="' . $this->new_config['board_disable_msg'] . '" />';
+ }
+
+ /**
+ * Select default dateformat
+ */
+ function dateformat_select($value, $key)
+ {
+ global $user, $config;
+
+ // Let the format_date function operate with the acp values
+ $old_tz = $user->timezone;
+ $old_dst = $user->dst;
+
+ $user->timezone = $config['board_timezone'];
+ $user->dst = $config['board_dst'];
+
+ $dateformat_options = '';
+
+ foreach ($user->lang['dateformats'] as $format => $null)
+ {
+ $dateformat_options .= '<option value="' . $format . '"' . (($format == $value) ? ' selected="selected"' : '') . '>';
+ $dateformat_options .= $user->format_date(time(), $format, true) . ((strpos($format, '|') !== false) ? ' [' . $user->lang['RELATIVE_DAYS'] . ']' : '');
+ $dateformat_options .= '</option>';
+ }
+
+ $dateformat_options .= '<option value="custom"';
+ if (!in_array($value, array_keys($user->lang['dateformats'])))
+ {
+ $dateformat_options .= ' selected="selected"';
+ }
+ $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
+
+ // Reset users date options
+ $user->timezone = $old_tz;
+ $user->dst = $old_dst;
+
+ return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('$key').value = '$value'; } else { document.getElementById('$key').value = this.value; }\">$dateformat_options</select>
+ <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />";
+ }
+}
+?>
\ No newline at end of file
Added: mods/pms/trunk/includes/acp/acp_sites.php
===================================================================
--- mods/pms/trunk/includes/acp/acp_sites.php (rev 0)
+++ mods/pms/trunk/includes/acp/acp_sites.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,635 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id: acp_sites.php,v 1.3 2007/06/08 11:42:21 reekingofrandom Exp $
+* @copyright (c) 2007 thevr
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package acp
+*/
+
+/****** REEKINGOFRANDOMNESS ******
+*
+* It's fairly complete (for 0.1)....
+* A couple of things to look into early on:
+* > When a site is deleted, transfering its members to a different group?
+* > Automatically setting site group attributes.
+*********************************/
+class acp_sites
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ global $config, $db, $user, $auth, $template, $cache;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix, $file_uploads;
+
+ include($phpbb_root_path.'/includes/functions_user.php');
+ include_once($phpbb_root_path.'/includes/functions_thevr.php');
+
+ $user->add_lang('acp/sites');
+ $this->tpl_name = 'acp_sites';
+
+ switch ($mode)
+ {
+ case 'manage':
+ $this->page_title = 'ACP_SITES_MANAGEMENT';
+
+ $action = request_var('action','');
+ $submit = (isset($_POST['submit'])) ? true : false;
+ $site = array();
+ $temp_data = array();
+
+ //Get vars that may be required later on.
+ $site_id = request_var('id','');
+
+ // If the site id is set take the site data from the database ready to use.
+ if ($site_id != '')
+ {
+ $temp_data = $this->fetch_site_data($site_id);
+
+ $site['name'] = request_var('name', $temp_data['name']);
+ $site['domain'] = request_var('domain', $temp_data['domain']);
+ $site['desc'] = request_var('desc', $temp_data['description']);
+ $site['group_id'] = request_var('group_id', $temp_data['group_id']);
+ $site['home'] = request_var('home', $temp_data['home']);
+ $site['style'] = request_var('style', $temp_data['default_style']);
+ }
+ else
+ {
+ $site['name'] = request_var('name', '');
+ $site['domain'] = request_var('domain', '');
+ $site['desc'] = request_var('desc', '');
+ $site['group_id'] = request_var('group_id', '');
+ $site['home'] = request_var('home', '');
+ $site['style'] = request_var('style', '');
+ }
+
+ if ($submit)
+ {
+ switch ($action)
+ {
+ case 'add':
+ if (!$this->add_site($site))
+ {
+ trigger_error($user->lang['SITE_ADD_FAIL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ else
+ {
+ trigger_error($user->lang['ADDED_SITE'] . adm_back_link($this->u_action));
+ }
+
+ break;
+
+ case 'edit':
+ if (!$this->edit_site($site_id,$site))
+ {
+ trigger_error($user->lang['SITE_EDIT_FAIL'] . adm_back_link($this->u_action . '&id=' . $site_id), E_USER_WARNING);
+ }
+ else
+ {
+ trigger_error($user->lang['EDITED_SITE'] . adm_back_link($this->u_action));
+ }
+ break;
+
+ case 'delete':
+ if (!$this->delete_site($site_id))
+ {
+ trigger_error($user->lang['SITE_DELETE_FAIL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ else
+ {
+ trigger_error($user->lang['DELETED_SITE'] . adm_back_link($this->u_action));
+ }
+ break;
+ }
+ }
+
+ switch ($action)
+ {
+ case 'add':
+ case 'edit':
+
+ $this->page_title = ($action == 'edit') ? 'Edit '.$site['name'] : 'Add new site';
+
+ $styles_list = style_select($site['style'], true);
+
+ $template->assign_vars(array(
+ 'S_EDIT_SITE' => ($action == 'edit') ? true : false,
+ 'S_ADD_SITE' => true,
+ 'U_ACTION' => $this->u_action.'&action='.$action,
+
+ 'EDIT_TITLE' => ($action == 'edit') ? 'Edit '.$site['name'] : 'Add site',
+
+ 'SITE_ID' => $site_id,
+ 'SITE_NAME' => $site['name'],
+ 'SITE_DESC' => $site['desc'],
+ 'SITE_GROUP' => $site['group_id'],
+ 'SITE_HOME' => $site['home'],
+ 'S_STYLES_OPTIONS' => $styles_list
+ ));
+ break;
+
+ case 'delete':
+
+ if (!is_numeric($site_id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $this->page_title = 'Delete ' . $site['name'];
+
+ $template->assign_vars(array(
+ 'S_DELETE_SITE' => true,
+ 'U_ACTION' => $this->u_action.'&action='.$action,
+
+ 'SITE_NAME' => $site['name'],
+ 'SITE_ID' => $site_id
+ ));
+ break;
+
+ case '':
+
+ $this->page_title = 'Manage Sites';
+
+ $sql = 'SELECT * FROM '.SITES_TABLE;
+ $result = $db->sql_query($sql);
+
+ while($data = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('sites', array(
+ 'SITE_ID' => $data['site_id'],
+ 'SITE_NAME' => $data['name'],
+ 'SITE_DESC' => $data['description'],
+
+ 'U_DELETE' => $this->u_action.'&action=delete&id='.$data['site_id'],
+ 'U_EDIT' => $this->u_action.'&action=edit&id='.$data['site_id'],
+ 'U_ADD' => $this->u_action.'&action=add'
+ ));
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE site_id='.$data['site_id'];
+ $tmp_result = $db->sql_query($sql);
+ while($tmp = $db->sql_fetchrow($tmp_result))
+ {
+ $template->assign_block_vars('sites.urls', array(
+ 'SITE_DOMAIN' => $tmp['domain']
+ ));
+
+ }
+ }
+
+ $template->assign_vars(array(
+ 'S_LIST_SITES' => true
+ ));
+
+ break;
+ }
+
+ break;
+ case 'manage_url':
+
+ $this->page_title = 'ACP_SITES_MANAGEMENT';
+ $action = request_var('action','');
+ $site_id = request_var('site','');
+ $domain = request_var('domain','');
+ $submit = (isset($_POST['submit'])) ? true : false;
+ $site_url = array();
+ $temp_data = array();
+
+ $site_url['id'] = request_var('id','');
+ if ($site_url['id'] != '')
+ {
+ $tmp = $this->fetch_url_data($site_url['id']);
+ $site_url['site_id'] = request_var('site_id',$tmp['site_id']);
+ $site_url['domain'] = request_var('domain',$tmp['domain']);
+ }
+ else
+ {
+ $site_url['site_id'] = request_var('site_id',$site_id);
+ $site_url['domain'] = request_var('domain',$domain);
+ }
+
+
+ if ($submit)
+ {
+ switch ($action)
+ {
+ case 'add':
+ if ($this->add_url($site_url))
+ {
+ trigger_error($user->lang['SITE_URL_ADDED'] . adm_back_link($this->u_action . '&site=' . $site_url['site_id']));
+ }
+ break;
+ case 'edit':
+ if ($this->edit_url($site_url['id'],$site_url))
+ {
+ trigger_error($user->lang['SITE_URL_EDITED'] . adm_back_link($this->u_action . '&site=' . $site_url['site_id']));
+ }
+ break;
+ case 'delete':
+ if ($this->delete_url($site_url['id']))
+ {
+ trigger_error($user->lang['SITE_URL_DELETED'] . adm_back_link($this->u_action));
+ }
+ break;
+ }
+ }
+
+ switch ($action)
+ {
+ case 'add':
+ case 'edit':
+
+ $this->page_title = ($action == 'edit') ? 'Edit '.$site_url['domain'] : 'Add new URL';
+
+ $site_select = site_select($site_url['site_id']);
+
+ $template->assign_vars(array(
+ 'S_EDIT_URL' => ($action == 'edit') ? true : false,
+ 'S_ADD_URL' => true,
+ 'U_ACTION' => $this->u_action.'&action='.$action,
+
+ 'EDIT_TITLE' => ($action == 'edit') ? 'Edit '.$site_url['domain'] : 'Add URL',
+
+ 'URL_ID' => $site_url['id'],
+ 'URL_DOMAIN' => $site_url['domain'],
+ 'S_SITES_OPTIONS' => $site_select
+ ));
+ break;
+
+ case 'delete':
+
+ if (!is_numeric($site_url['id']))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $this->page_title = 'Delete ' . $site_url['domain'];
+
+ $template->assign_vars(array(
+ 'S_DELETE_URL' => true,
+ 'U_ACTION' => $this->u_action.'&action='.$action,
+
+ 'URL_DOMAIN' => $site_url['domain'],
+ 'URL_ID' => $site_url['id']
+ ));
+ break;
+
+ case '':
+ $this->page_title = 'Manage Site URLs';
+
+ if(!$site_id)
+ {
+ $sql = 'SELECT * FROM '.SITES_TABLE;
+ $result = $db->sql_query($sql);
+
+ while($data = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('sites', array(
+ 'U_URLS' => $this->u_action.'&site='.$data['site_id'],
+
+ 'SITE_ID' => $data['site_id'],
+ 'SITE_NAME' => $data['name'],
+ 'SITE_DESC' => $data['description'],
+ 'SITE_ICON' => '<img src="images/icon_subfolder.gif" width="46" height="25"/>'
+ ));
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE site_id='.$data['site_id'];
+ $tmp_result = $db->sql_query($sql);
+ while($tmp = $db->sql_fetchrow($tmp_result))
+ {
+ $template->assign_block_vars('sites.urls', array(
+ 'SITE_DOMAIN' => $tmp['domain']
+ ));
+
+ }
+ }
+
+ $template->assign_vars( array(
+ 'S_LIST_URL_CATS' => true
+ ));
+
+
+ }
+ else
+ {
+ $sql = 'SELECT * FROM '.SITES_TABLE.' WHERE site_id='.$site_id;
+ $site_name = $db->sql_fetchfield('name',0,$db->sql_query($sql));
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE site_id='.$site_id;
+ $result = $db->sql_query($sql);
+ while($row = $db->sql_fetchrow($result))
+ {
+ $template->assign_block_vars('urls', array(
+ 'URL_DOMAIN' => $row['domain'],
+ 'URL_ADD' => $this->u_action.'&action=add&site='.$site_id,
+ 'URL_EDIT' => $this->u_action.'&action=edit&id='.$row['id'],
+ 'URL_DELETE' => $this->u_action.'&action=delete&id='.$row['id']
+ ));
+ }
+
+ $template->assign_vars( array(
+ 'S_LIST_URLS' => true,
+
+ 'SITE_NAME' => $site_name,
+ 'SITE_ID' => $site_id
+ ));
+ }
+ break;
+ }
+
+ break;
+ }
+
+
+
+ }
+
+ function fetch_site_data($id)
+ {
+ global $db, $user;
+
+ if (!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT']. adm_back_link($this->u_action), E_USER_WARNING);
+ return false;
+ }
+
+ $sql = 'SELECT * FROM '.SITES_TABLE.' WHERE site_id='.$id;
+
+ if (!$result = $db->sql_query($sql))
+ {
+ trigger_error($user->lang['NO_SITE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ return false;
+ }
+ else
+ {
+ $row = $db->sql_fetchrow($result);
+ $row['domain'] = array();
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE site_id='.$id;
+ $result = $db->sql_query($sql);
+ while($tmp = $db->sql_fetchrow($result))
+ {
+ $row['domain'][] = $tmp;
+ }
+
+ return $row;
+ }
+ }
+
+ function fetch_url_data($id)
+ {
+ global $db, $user;
+
+ if (!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT']. adm_back_link($this->u_action), E_USER_WARNING);
+ return false;
+ }
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE id='.$id;
+ if (!$result = $db->sql_query($sql))
+ {
+ trigger_error($user->lang['NO_URL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ else
+ {
+ $row = $db->sql_fetchrow($result);
+ return $row;
+ }
+ }
+
+
+
+ function add_site($data)
+ {
+ global $db, $user;
+
+ if (!is_array($data))
+ {
+ trigger_error($user->lang['VAR_NOT_ARRAY'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ if ( $data['domain'] == '' )
+ {
+ trigger_error($user->lang['NO_DOMAIN_SUPPLIED'] . adm_back_link($this->u_action.'&action=add'));
+ }
+
+ //Check if the name or domain name already exist.
+ $sql = 'SELECT * FROM '.SITES_TABLE.' WHERE name=\''.$data['name'].'\'';
+ $result = $db->sql_query($sql);
+ if (sizeof($db->sql_fetchrowset($result)) > 0)
+ {
+ trigger_error($user->lang['DUPLI_NAME'] . adm_back_link($this->u_action . '&action=add'));
+ }
+
+ //Vars for group creation:
+ $g_type = 'GROUP_CLOSED';
+ $g_name = 'registered_'.preg_replace('/\s\s+/','_',$data['name']);
+ $g_desc = 'The members of '.$data['name'];
+ $g_att = array('group_legend' => 0);
+
+
+ if (group_create($group_id,$g_type,$g_name,$g_desc,$g_att))
+ {
+ trigger_error($user->lang['GRP_ADD_FAIL'] . adm_back_link($this->u_action . '&action=add'));
+ }
+ else
+ {
+ $sql = 'SELECT * FROM '.GROUPS_TABLE.' WHERE group_name=\'registered_'.$data['name'].'\'';
+ $data['group_id'] = $db->sql_fetchfield('group_id',0,$db->sql_query($sql));
+
+ $site_ins = array ( 'name' => $data['name'],
+ 'description' => $data['desc'],
+ 'group_id' => $data['group_id'],
+ 'home' => $data['home'],
+ 'default_style' => $data['style'] );
+
+ //Insert into sites table.
+ if( !$db->sql_query('INSERT INTO '.SITES_TABLE.' '.$db->sql_build_array('INSERT',$site_ins)))
+ {
+ trigger_error($user->lang['SITE_ADD_FAIL'] . adm_back_link($this->u_action . '&action=add'));
+ }
+
+ $sql = 'SELECT * FROM '.SITES_TABLE.' WHERE name=\''.$data['name'].'\'';
+ $data['site_id'] = $db->sql_fetchfield('site_id',0,$db->sql_query($sql));
+
+ if( $this->add_url($data))
+ {
+ return $data['site_id'];
+ }
+
+ }
+ }
+
+ function edit_site($id,$data)
+ {
+ global $db, $user;
+
+ if (!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ else if (!is_array($data))
+ {
+ trigger_error($user->lang['VAR_NOT_ARRAY'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $site_upd = array(
+ 'name' => $data['name'],
+ 'description' => $data['desc'],
+ 'group_id' => $data['group_id'],
+ 'home' => $data['home'],
+ 'default_style' => $data['style']
+ );
+
+ $sql = 'UPDATE '.SITES_TABLE.' SET '.$db->sql_build_array('UPDATE',$site_upd).' WHERE site_id='.$id;
+ if (!$db->sql_query($sql))
+ {
+ trigger_error($user->lang['SITE_EDIT_FAIL'] . adm_back_link($this->u_action . '&action=edit&id='.$id));
+ }
+ else
+ {
+ //Vars for group editing
+ $g_type = 'GROUP_CLOSED';
+ $g_name = 'registered_'.preg_replace('/\s\s+/','_',$data['name']);
+ $g_desc = 'The members of '.$data['name'];
+ $g_att = array('group_legend' => 0);
+
+ if(group_create($data['group_id'],$g_type,$g_name,$g_desc,$g_att))
+ {
+ trigger_error($user->lang['GRP_ADD_FAIL'] . adm_back_link($this->u_action . '&action=add&id='.$id));
+ }
+
+ return true;
+ }
+ }
+
+ function delete_site($id)
+ {
+ global $db, $user;
+
+ if(!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ //Fetch group id from site id table.
+ $temp = $this->fetch_site_data($id);
+ $group_id = $temp['group_id'];
+ unset($temp);
+
+ group_delete($group_id);
+
+ $sql = 'DELETE FROM '.SITES_TABLE.' WHERE site_id='.$id;
+ if(!$db->sql_query($sql))
+ {
+ trigger_error($user->lang['SITE_DEL_FAIL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $sql = 'DELETE FROM '.SITE_URL_TABLE.' WHERE site_id='.$id;
+ if(!$db->sql_query($sql))
+ {
+ trigger_error($user->lang['SITE_URL_DEL_FAIL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ return true;
+ }
+
+ function add_url($data)
+ {
+ global $db, $user;
+
+ if (!is_array($data))
+ {
+ trigger_error($user->lang['VAR_NOT_ARRAY'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ //Check if domain already exists.
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE domain=\''.$data['domain'].'\'';
+ $result = $db->sql_query($sql);
+ if (sizeof($db->sql_fetchrowset($result)) > 0)
+ {
+ trigger_error($user->lang['DUPLI_DOMAIN'] . adm_back_link($this->u_action . '&action=add'));
+ }
+
+ $siteurl_ins = array ( 'site_id' => $data['site_id'],
+ 'domain' => $data['domain'] );
+
+ if( !$db->sql_query('INSERT INTO '.SITE_URL_TABLE.' '.$db->sql_build_array('INSERT',$siteurl_ins)))
+ {
+ trigger_error($user->lang['SITE_URL_ADD_FAIL'] . adm_back_link($this->u_action . '&action=add'));
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ function edit_url($id,$data)
+ {
+ global $db, $user;
+
+ if (!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+ else if (!is_array($data))
+ {
+ trigger_error($user->lang['VAR_NOT_ARRAY'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ $siteurl_upd = array(
+ 'site_id' => $data['site_id'],
+ 'domain' => $data['domain']
+ );
+
+ $sql = 'UPDATE '.SITE_URL_TABLE.' SET '.$db->sql_build_array('UPDATE',$siteurl_upd).' WHERE id='.$id;
+
+ if (!$db->sql_query($sql))
+ {
+ trigger_error($user->lang['SITE_URL_EDIT_FAIL'] . adm_back_link($this->u_action . '&action=edit&id='.$id));
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+ function delete_url($id)
+ {
+ global $db, $user;
+
+ if(!is_numeric($id))
+ {
+ trigger_error($user->lang['VAR_NOT_INT'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ //Check that this isnt the last URL for a particular site.
+ $tmp = $this->fetch_url_data($id);
+
+ $sql = 'SELECT * FROM '.SITE_URL_TABLE.' WHERE site_id='.$tmp['site_id'];
+ $result = $db->sql_query($sql);
+ if (sizeof($db->sql_fetchrowset($result)) == 1)
+ {
+ trigger_error($user->lang['LAST_DOMAIN'].adm_back_link($this->u_action));
+ }
+
+ $sql = 'DELETE FROM '.SITE_URL_TABLE.' WHERE id='.$id;
+ if(!$db->sql_query($sql))
+ {
+ trigger_error($user->lang['SITE_URL_DEL_FAIL'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
+ return true;
+ }
+}
+
+
+
+?>
\ No newline at end of file
Added: mods/pms/trunk/includes/acp/info/acp_siteconfig.php
===================================================================
--- mods/pms/trunk/includes/acp/info/acp_siteconfig.php (rev 0)
+++ mods/pms/trunk/includes/acp/info/acp_siteconfig.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,39 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id: acp_siteconfig.php,v 1.2 2007/06/08 11:42:22 reekingofrandom Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package module_install
+*/
+class acp_siteconfig_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'acp_siteconfig',
+ 'title' => 'ACP_SITE_SETTINGS',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'settings' => array('title' => 'ACP_SITE_SETTINGS', 'auth' => 'acl_a_server', 'cat' => array('ACP_MANAGE_SITES')),
+
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+
+?>
\ No newline at end of file
Added: mods/pms/trunk/includes/acp/info/acp_sites.php
===================================================================
--- mods/pms/trunk/includes/acp/info/acp_sites.php (rev 0)
+++ mods/pms/trunk/includes/acp/info/acp_sites.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,39 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id: acp_sites.php,v 1.2 2007/06/08 11:42:22 reekingofrandom Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package module_install
+*/
+class acp_sites_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'acp_sites',
+ 'title' => 'ACP_SITES_MANAGEMENT',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'manage' => array('title' => 'ACP_MANAGE_SITES', 'auth' => 'acl_a_server', 'cat' => array('ACP_MANAGE_SITES')),
+ 'manage_url'=> array('title' => 'ACP_MANAGE_SITE_URLS', 'auth' => 'acl_a_server', 'cat' => array('ACP_MANAGE_SITE_URLS'))
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+
+?>
\ No newline at end of file
Modified: mods/pms/trunk/includes/auth.php
===================================================================
--- mods/pms/trunk/includes/auth.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/includes/auth.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -124,7 +124,13 @@
if (isset($this->acl[$f]) && isset($this->acl[$f][$this->acl_options['local'][$opt]]))
{
$this->cache[$f][$opt] |= $this->acl[$f][$this->acl_options['local'][$opt]];
+ }
+ if (check_forum($f) == false)
+ {
+ $this->cache[$f][$opt] = false;
}
+
+
}
}
Modified: mods/pms/trunk/includes/constants.php
===================================================================
--- mods/pms/trunk/includes/constants.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/includes/constants.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -224,6 +224,11 @@
define('ZEBRA_TABLE', $table_prefix . 'zebra');
// Additional tables
+//TheVR
+define('SITES_TABLE', $table_prefix . 'sites');
+define('SITE_URL_TABLE', $table_prefix . 'site_urls');
+define('SITE_CONFIG_TABLE', $table_prefix . 'site_config');
+
?>
\ No newline at end of file
Added: mods/pms/trunk/includes/functions_thevr.php
===================================================================
--- mods/pms/trunk/includes/functions_thevr.php (rev 0)
+++ mods/pms/trunk/includes/functions_thevr.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,122 @@
+<?php
+/**
+*
+* @package phpBB3
+* @version $Id: functions_thevr.php,v 1.2 2007/06/08 12:33:56 reekingofrandom Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+function check_forum($f)
+{
+ global $db, $config, $auth;
+ if (isset($auth->cache['site_forums']))
+ {
+ $forums = $auth->cache['site_forums'];
+
+ if (isset($forums[$f]))
+ {
+ return (isset($forums[$f])) ? true: false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ else
+ {
+ $sql = 'SELECT f.forum_id, f.site_id
+ FROM ' . FORUMS_TABLE . " as f
+ WHERE ( f.site_id = '" . $config['site_id'] . "'
+ OR f.site_id = '0' )";
+ $result = $db->sql_query($sql);
+
+ $forums = array();
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $forums[$row['forum_id']] = $row['site_id'];
+ }
+
+ $auth->cache['site_forums'] = $forums;
+
+ if (isset($forums[$f]))
+ {
+ return (isset($forums[$f])) ? true: false;
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
+
+/*********************************
+* Basically a clone of the function style_select().
+* It creates a select box from all the sites
+********************************/
+
+function site_select($default = '')
+{
+ global $db;
+
+ $sql = 'SELECT site_id, name
+ FROM ' . SITES_TABLE . '
+ ORDER BY name';
+ $result = $db->sql_query($sql);
+
+ $site_options = '';
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $selected = ($row['site_id'] == $default) ? ' selected="selected"' : '';
+ $site_options .= '<option value="' . $row['site_id'] . '"' . $selected . '>' . $row['name'] . '</option>';
+ }
+ $db->sql_freeresult($result);
+
+ return $site_options;
+}
+
+/**
+* Set site config value. Creates missing config entry.
+*/
+function set_site_config($config_name, $config_value, $site_id, $overide = 1, $is_dynamic = false)
+{
+ global $db, $cache, $config;
+
+ //Only a temporary fix.
+ if($config[$config_name] == $config_value)
+ {
+ return;
+ }
+
+ $sql = 'UPDATE ' . SITE_CONFIG_TABLE . "
+ SET config_value = '" . $db->sql_escape($config_value) . "', overide = " . $overide . "
+ WHERE config_name = '" . $db->sql_escape($config_name) . "'
+ AND site_id = " . $site_id;
+ $db->sql_query($sql);
+
+ if (!$db->sql_affectedrows() /*&& !isset($config[$config_name])*/)
+ {
+ $sql = 'INSERT INTO ' . SITE_CONFIG_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'config_name' => $config_name,
+ 'config_value' => $config_value,
+ 'is_dynamic' => ($is_dynamic) ? 1 : 0,
+ 'site_id' => $site_id,
+ 'overide' => $overide));
+ $db->sql_query($sql);
+ }
+
+ if ($overide == 1)
+ {
+ $config[$config_name] = $config_value;
+ }
+
+ if (!$is_dynamic)
+ {
+ $cache->destroy('config');
+ }
+}
+
+
+?>
\ No newline at end of file
Modified: mods/pms/trunk/includes/functions_user.php
===================================================================
--- mods/pms/trunk/includes/functions_user.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/includes/functions_user.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -258,7 +258,22 @@
// Now make it the users default group...
group_set_user_default($user_row['group_id'], array($user_id), false);
+ /***** START
+ADDED by reekingofrandomness for thevr.co.uk
+This Automatically adds a member to there sites group
+*****/
+ // Place into appropriate group...
+ $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'user_id' => (int) $user_id,
+ 'group_id' => (int) $config['site_group_id'],
+ 'user_pending' => 0)
+ );
+ $db->sql_query($sql);
+
+/***** END *****/
+
+
// set the newest user and adjust the user count if the user is a normal user and no activation mail is sent
if ($user_row['user_type'] == USER_NORMAL)
{
Modified: mods/pms/trunk/language/en/acp/board.php
===================================================================
--- mods/pms/trunk/language/en/acp/board.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/language/en/acp/board.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -53,7 +53,6 @@
// Board Features
$lang = array_merge($lang, array(
'ACP_BOARD_FEATURES_EXPLAIN' => 'Here you can enable/disable several board features.',
-
'ALLOW_ATTACHMENTS' => 'Allow attachments',
'ALLOW_BIRTHDAYS' => 'Allow birthdays',
'ALLOW_BIRTHDAYS_EXPLAIN' => 'Allow birthdays to be entered and age being displayed in profiles. Please note the birthday list within the board index is controlled by a separate load setting.',
Modified: mods/pms/trunk/language/en/acp/common.php
===================================================================
--- mods/pms/trunk/language/en/acp/common.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/language/en/acp/common.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -32,6 +32,12 @@
// Common
$lang = array_merge($lang, array(
+/** Added for thevr **/
+ 'ACP_SITES_MANAGEMENT' => 'Site Management',
+ 'ACP_MANAGE_SITES' => 'Manage Sites',
+ 'ACP_SITE_SETTINGS' => 'Edit Site Configuration',
+ 'ACP_SITE_SETTINGS_EXPLAIN' => '',
+/** End added **/
'ACP_ADMINISTRATORS' => 'Administrators',
'ACP_ADMIN_LOGS' => 'Admin log',
'ACP_ADMIN_ROLES' => 'Admin roles',
Modified: mods/pms/trunk/language/en/acp/forums.php
===================================================================
--- mods/pms/trunk/language/en/acp/forums.php 2007-08-29 02:47:59 UTC (rev 18)
+++ mods/pms/trunk/language/en/acp/forums.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -130,7 +130,9 @@
'PRUNE_OLD_POLLS_EXPLAIN' => 'Removes topics with polls not voted in for post age days.',
'REDIRECT_ACL' => 'Now you are able to %sset permissions%s for this forum.',
-
+ 'SITE_ID' => 'Site',
+ 'SITE_ID_EXPLAIN' => 'Select which site this is part of.',
+ 'SITE_GLOBAL' => 'Global Forum',
'SYNC_IN_PROGRESS' => 'Synchronizing forum',
'SYNC_IN_PROGRESS_EXPLAIN' => 'Currently resyncing topic range %1$d/%2$d.',
Added: mods/pms/trunk/language/en/acp/siteconfig.php
===================================================================
--- mods/pms/trunk/language/en/acp/siteconfig.php (rev 0)
+++ mods/pms/trunk/language/en/acp/siteconfig.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,38 @@
+<?php
+/**
+*
+* acp_siteconfig [English]
+*
+* @package language
+* @version $Id: siteconfig.php,v 1.1 2007/06/08 00:19:38 yautja_cetanu Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* DO NOT CHANGE
+*/
+if (empty($lang) || !is_array($lang))
+{
+ $lang = array();
+}
+
+// DEVELOPERS PLEASE NOTE
+//
+// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
+//
+// Placeholders can now contain order information, e.g. instead of
+// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
+// translators to re-order the output of data while ensuring it remains correct
+//
+// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
+// equally where a string contains only two placeholders which are used to wrap text
+// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
+
+// Sites ADmin
+$lang = array_merge($lang, array(
+ ));
+
+
+?>
\ No newline at end of file
Added: mods/pms/trunk/language/en/acp/sites.php
===================================================================
--- mods/pms/trunk/language/en/acp/sites.php (rev 0)
+++ mods/pms/trunk/language/en/acp/sites.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,99 @@
+<?php
+/**
+*
+* acp_sites [English]
+*
+* @package language
+* @version $Id: sites.php,v 1.1 2007/06/08 00:19:38 yautja_cetanu Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* DO NOT CHANGE
+*/
+if (empty($lang) || !is_array($lang))
+{
+ $lang = array();
+}
+
+// DEVELOPERS PLEASE NOTE
+//
+// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
+//
+// Placeholders can now contain order information, e.g. instead of
+// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
+// translators to re-order the output of data while ensuring it remains correct
+//
+// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
+// equally where a string contains only two placeholders which are used to wrap text
+// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
+
+// Sites ADmin
+$lang = array_merge($lang, array(
+ //general Errors
+ 'VAR_NOT_INT' => 'Wrong variable type. Expected an Integer.',
+ 'VAR_NOT_ARRAY' => 'Wrong variable type. Expected an Array.',
+ 'NO_SITE' => 'There is no site with the supplied Id.',
+ 'NO_URL' => 'There is no URL with the supplied ID.',
+
+ //Site add notices.
+ 'SITE_ADD_FAIL' => 'Failed to insert site data into the sites table.',
+ 'SITE_URL_ADD_FAIL' => 'Failed to insert site URL information into the sites table.',
+ 'DUPLI_NAME' => 'Sorry that name is already in use. Site names must be unique',
+ 'DUPLI_DOMAIN' => 'Sorry that domain is already registered to a site.',
+ 'GRP_ADD_FAIL' => 'Failed to insert group data into the database.',
+ 'ADDED_SITE' => 'Site added successfully',
+ 'NO_DOMAIN_SUPPLIED'=> 'You must give a domain when creating a new site.',
+
+ //Site edit notices
+ 'SITE_EDIT_FAIL' => 'Failed to update the sites table',
+ 'SITE_URL_EDIT_FAIL'=> 'Failed to update the URL information',
+ 'EDITED_SITE' => 'Changes successful',
+
+ //Site delete Notices
+ 'DELETED_SITE' => 'Site deleted successfully',
+ 'SITE_DEL_FAIL' => 'Failed to delete site data',
+ 'SITE_URL_DEL_FAIL' => 'Failed to delete site url data',
+
+ //URL add notices
+ 'SITE_URL_ADDED' => 'URL Successfully added',
+ 'SITE_URL_ADD_FAIL' => 'Failed to add url',
+
+ //URL Edit Notices
+ 'SITE_URL_EDITED' => 'URL Successfully Edited',
+ 'SITE_URL_EDIT_FAIL'=> 'Failed to edit url',
+
+ //URL delete notices
+ 'LAST_DOMAIN' => 'All sites must have atleast on domain asociated with them.',
+ 'SITE_URL_DEL_FAIL' => 'Failed to delete URL',
+ 'SITE_URL_DELETED' => 'URL Deleted',
+
+ //Titles/Forms Etc
+ 'CREATE_SITE' => 'Create new site',
+ 'CREATE_URL' => 'Add new URL',
+ 'DEFAULT_STYLE' => 'Default style',
+ 'SITE_NAME' => 'Name',
+ 'SITE_DOMAIN' => 'Domain',
+ 'SITE_DESC' => 'Description',
+ 'SITE_HOME' => 'Home page',
+ 'SITE_STYLE' => 'Style',
+ 'SITE_SETTINGS' => 'Basic site settings',
+ 'SITE_EDIT_EXPLAIN' => '',
+ 'SITE_ADMIN' => 'Manage Sites',
+ 'SITE_ADMIN_EXPLAIN' => '',
+ 'SITE_DELETE' => 'Delete site',
+ 'SITE_DELETE_EXPLAIN' => '',
+ 'SITE_URL_ADMIN' => 'Manage Site URLs',
+ 'SITE_URL_ADMIN_EXPLAIN'=> '',
+ 'SITE_URL_DELETE' => 'Delete URL',
+ 'SITE_URL_DELETE_EXPLAIN'=>'',
+ 'SITE_URL_EDIT_EXPLAIN' => '',
+ 'SITE_URL_SETTINGS' => 'Basic URL Settings',
+ 'URL_DOMAIN' => 'Domain',
+ 'URL_SITE' => 'Site'
+
+));
+
+?>
\ No newline at end of file
Added: mods/pms/trunk/language/en/mods/permissions_sites.php
===================================================================
--- mods/pms/trunk/language/en/mods/permissions_sites.php (rev 0)
+++ mods/pms/trunk/language/en/mods/permissions_sites.php 2007-08-29 02:50:18 UTC (rev 19)
@@ -0,0 +1,34 @@
+<?php
+/**
+* DO NOT CHANGE
+*/
+if (empty($lang) || !is_array($lang))
+{
+ $lang = array();
+}
+
+// DEVELOPERS PLEASE NOTE
+//
+// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
+//
+// Placeholders can now contain order information, e.g. instead of
+// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
+// translators to re-order the output of data while ensuring it remains correct
+//
+// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
+// equally where a string contains only two placeholders which are used to wrap text
+// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
+
+// Adding ...
[truncated message content] |