|
From: <and...@us...> - 2007-10-14 15:53:39
|
Revision: 73
http://thevr.svn.sourceforge.net/thevr/?rev=73&view=rev
Author: andrewbelcher
Date: 2007-10-14 08:53:41 -0700 (Sun, 14 Oct 2007)
Log Message:
-----------
Added files for the UCP Module controlling site registration.
Added Paths:
-----------
mods/pms/branches/permissions/includes/ucp/info/ucp_sites.php
mods/pms/branches/permissions/includes/ucp/ucp_sites.php
mods/pms/branches/permissions/language/en/sites.php
mods/pms/branches/permissions/styles/prosilver/template/ucp_sites.html
Added: mods/pms/branches/permissions/includes/ucp/info/ucp_sites.php
===================================================================
--- mods/pms/branches/permissions/includes/ucp/info/ucp_sites.php (rev 0)
+++ mods/pms/branches/permissions/includes/ucp/info/ucp_sites.php 2007-10-14 15:53:41 UTC (rev 73)
@@ -0,0 +1,37 @@
+<?php
+/**
+*
+* @package ucp
+* @version $Id: ucp_groups.php,v 1.2 2006/05/01 19:45:42 grahamje Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package module_install
+*/
+class ucp_sites_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'ucp_sites',
+ 'title' => 'UCP_SITES',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'main' => array('title' => 'UCP_SITES_MAIN', 'auth' => '', 'cat' => array('UCP_SITES')),
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+?>
\ No newline at end of file
Added: mods/pms/branches/permissions/includes/ucp/ucp_sites.php
===================================================================
--- mods/pms/branches/permissions/includes/ucp/ucp_sites.php (rev 0)
+++ mods/pms/branches/permissions/includes/ucp/ucp_sites.php 2007-10-14 15:53:41 UTC (rev 73)
@@ -0,0 +1,117 @@
+<?php
+/**
+*
+* @package ucp
+* @version $Id: ucp_groups.php,v 1.63 2007/07/22 20:10:09 acydburn Exp $
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* ucp_groups
+* @package ucp
+*/
+class ucp_sites
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ global $config, $phpbb_root_path, $phpEx;
+ global $db, $user, $auth, $cache, $template;
+
+ $user->add_lang('sites');
+
+ $return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
+
+ $action = request_var('action', '');
+
+ switch ($mode)
+ {
+ case 'main':
+
+ $site_id = request_var('selected', '');
+ if (isset($_POST['submit']) && $site_id <> '')
+ {
+ $user_sites = array();
+ if ($user->data['user_sites'] <> '')
+ {
+ $user_sites = explode(',', $user->data['user_sites']);
+ }
+
+ switch ($action)
+ {
+ case 'join':
+ if (!in_array($site_id, $user_sites))
+ {
+ $user_sites[] = $site_id;
+ }
+ break;
+
+ case 'leave':
+ $leave_key = array_search($site_id, $user_sites);
+ if ($leave_key !== false)
+ {
+ unset($user_sites[$leave_key]);
+ }
+ break;
+ }
+
+ $user_sites_new = implode(',', $user_sites);
+
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET user_sites = '$user_sites_new'
+ WHERE user_id = 2
+ LIMIT 1";
+ $result = $db->sql_query($sql);
+
+ trigger_error((($action == 'join') ? $user->lang['MSG_JOIN_SUCCESS']: $user->lang['MSG_LEAVE_SUCCESS']) . $return_page);
+ }
+
+
+ // Build List of Sites
+ $member_sites = explode(',', $user->data['user_sites']);
+
+ $sql = 'SELECT s.site_id, s.name, s.description, s.home, s.site_all, su.domain
+ FROM ' . SITES_TABLE . ' AS s, ' . SITE_URL_TABLE . ' AS su
+ WHERE s.site_id = su.site_id
+ AND s.default_url = su.id
+ ORDER BY s.name ASC';
+ $result = $db->sql_query($sql);
+
+ $row_count_m = 0;
+ $row_count_nm = 0;
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ if (in_array($row['site_id'], $member_sites))
+ {
+ $block_name = 'member';
+ $row_count = $row_count_m++;
+ }
+ else
+ {
+ $block_name = 'nonmember';
+ $row_count = $row_count_nm++;
+ }
+
+ $template->assign_block_vars($block_name, array(
+ 'NAME' => $row['name'],
+ 'DESC' => $row['description'],
+ 'ID' => $row['site_id'],
+ 'URL' => append_sid($row['domain'] . $phpbb_root_path . $row['home']),
+ 'ALL' => $row['site_all'],
+
+ 'S_ROW_COUNT' => $row_count)
+ );
+ }
+
+ break;
+ }
+
+ $this->tpl_name = 'ucp_sites';
+ }
+}
+
+?>
\ No newline at end of file
Added: mods/pms/branches/permissions/language/en/sites.php
===================================================================
--- mods/pms/branches/permissions/language/en/sites.php (rev 0)
+++ mods/pms/branches/permissions/language/en/sites.php 2007-10-14 15:53:41 UTC (rev 73)
@@ -0,0 +1,45 @@
+<?php
+/**
+*
+* ucp [English]
+*
+* @package language
+* @version $Id: ucp.php,v 1.134 2007/08/21 15:09:52 acydburn 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
+
+$lang = array_merge($lang, array(
+ 'JOIN_SELECTED' => 'Join Selected Site',
+ 'LEAVE_SELECTED' => 'Leave Selected Site',
+ 'MANAGE_SITES' => 'Manage Site Membership',
+ 'SITES_EXPLAIN' => 'This site is one of a number of sites sharing the same system. Below you can manage which of these sites you are registered with. These sites will appear on any \'all\' sites.',
+ 'SITES_MEMBER' => 'Member Sites',
+ 'SITES_NONMEMBER' => 'Non-member Sites',
+
+ 'MSG_JOIN_SUCCESS' => 'Site joined succesfully.',
+ 'MSG_LEAVE_SUCCESS' => 'Site left successfully.',
+));
+
+?>
\ No newline at end of file
Added: mods/pms/branches/permissions/styles/prosilver/template/ucp_sites.html
===================================================================
--- mods/pms/branches/permissions/styles/prosilver/template/ucp_sites.html (rev 0)
+++ mods/pms/branches/permissions/styles/prosilver/template/ucp_sites.html 2007-10-14 15:53:41 UTC (rev 73)
@@ -0,0 +1,84 @@
+<!-- INCLUDE ucp_header.html -->
+
+<h2>{L_MANAGE_SITES}</h2>
+
+<form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}>
+
+<div class="panel">
+ <div class="inner"><span class="corners-top"><span></span></span>
+
+ <p>{L_SITES_EXPLAIN}</p>
+ <!-- IF .member -->
+ <ul class="topiclist">
+ <li class="header">
+ <dl>
+ <dt>{L_SITES_MEMBER}</dt>
+ <dd class="mark">{L_SELECT}</dd>
+ </dl>
+ </li>
+ </ul>
+ <ul class="topiclist cplist">
+
+ <!-- BEGIN member -->
+ <li class="row<!-- IF member.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
+ <dl>
+ <dt>
+ <a href="{member.URL}" class="forumtitle">{member.NAME}</a>
+ <!-- IF member.DESC --><br />{member.DESC}<!-- ENDIF -->
+ </dt>
+ <dd class="mark"><input type="radio" name="selected" value="{member.ID}" /></dd>
+ </dl>
+ </li>
+ <!-- END member -->
+ </ul>
+ <!-- ENDIF -->
+ <span class="corners-bottom"><span></span></span></div>
+</div>
+
+
+<!-- IF .nonmember -->
+<div class="panel">
+ <div class="inner"><span class="corners-top"><span></span></span>
+ <ul class="topiclist">
+ <li class="header">
+ <dl>
+ <dt>{L_SITES_NONMEMBER}</dt>
+ <dd class="mark">{L_SELECT}</dd>
+ </dl>
+ </li>
+ </ul>
+ <ul class="topiclist cplist">
+
+ <!-- BEGIN nonmember -->
+ <li class="row<!-- IF nonmember.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
+ <dl>
+ <dt>
+ <a href="{nonmember.URL}" class="forumtitle">{nonmember.NAME}</a>
+ <!-- IF nonmember.DESC --><br />{nonmember.DESC}<!-- ENDIF -->
+ </dt>
+ <dd class="mark"><input type="radio" name="selected" value="{nonmember.ID}" /></dd>
+ </dl>
+ </li>
+ <!-- END nonmember -->
+ </ul>
+ <span class="corners-bottom"><span></span></span></div>
+ </div>
+<!-- ENDIF -->
+
+
+ <fieldset>
+ <div class="right-box">
+ <label for="action">{L_SELECT}:</label>
+ <select name="action" id="action">
+ <option value="join">{L_JOIN_SELECTED}</option>
+ <option value="leave">{L_LEAVE_SELECTED}</option>
+ </select>
+ <input class="button2" type="submit" name="submit" value="{L_SUBMIT}" />
+ </div>
+ </fieldset>
+
+
+
+</form>
+
+<!-- INCLUDE ucp_footer.html -->
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|