summaryrefslogtreecommitdiff
path: root/liberty_plugins
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2008-07-08 07:13:57 +0000
committerMax Kremmel <xing@synapse.plus.com>2008-07-08 07:13:57 +0000
commitf12bcf45787ed0ee4e79a985633885c6e5f34a52 (patch)
treee80a2d80355fd4d603aa6faa7b0a3231962ea288 /liberty_plugins
parente8ba94e1001e365e3e5a5a5de162cc5c1231f67b (diff)
downloadusers-f12bcf45787ed0ee4e79a985633885c6e5f34a52.tar.gz
users-f12bcf45787ed0ee4e79a985633885c6e5f34a52.tar.bz2
users-f12bcf45787ed0ee4e79a985633885c6e5f34a52.zip
move some plugins to their new homes
Diffstat (limited to 'liberty_plugins')
-rwxr-xr-xliberty_plugins/data.userlink.php102
-rw-r--r--liberty_plugins/data.userlist.php202
2 files changed, 304 insertions, 0 deletions
diff --git a/liberty_plugins/data.userlink.php b/liberty_plugins/data.userlink.php
new file mode 100755
index 0000000..0817a8f
--- /dev/null
+++ b/liberty_plugins/data.userlink.php
@@ -0,0 +1,102 @@
+<?php
+/**
+ * @version $Revision: 1.1 $
+ * @package liberty
+ * @subpackage plugins_data
+ * @author bigwasp bigwasp@sourceforge.net
+ */
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2005, bitweaver.org
+// +----------------------------------------------------------------------+
+// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
+// |
+// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
+// | -> see http://phpdocu.sourceforge.net/
+// +----------------------------------------------------------------------+
+// | Author (TikiWiki): Damian Parker <damosoft@users.sourceforge.net>
+// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
+// | by: StarRider <starrrider@sourceforge.net>
+// | Reworked from: wikiplugin_usercount.php - see deprecated code below
+// +----------------------------------------------------------------------+
+// $Id: data.userlink.php,v 1.1 2008/07/08 07:13:57 squareing Exp $
+
+/**
+ * definitions
+ */
+define( 'PLUGIN_GUID_DATAUSERLINK', 'datauserlink' );
+global $gLibertySystem;
+$pluginParams = array (
+ 'tag' => 'USERLINK',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => FALSE,
+ 'load_function' => 'data_userlink',
+ 'title' => 'UserLink shows a link to the UserPage for a given login or email',
+ 'help_page' => 'DataPluginUserLink',
+ 'description' => tra("Will show a link to the userpage"),
+ 'help_function' => 'data_userlink_help',
+ 'syntax' => "{USERLINK login='bigwasp'}",
+ 'path' => LIBERTY_PKG_PATH.'plugins/data.userlink.php',
+ 'security' => 'registered',
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAUSERLINK, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAUSERLINK );
+
+// Help Function
+function data_userlink_help() {
+ $help =
+ '<table class="data help">'
+ .'<tr>'
+ .'<th>' . tra( "Key" ) . '</th>'
+ .'<th>' . tra( "Type" ) . '</th>'
+ .'<th>' . tra( "Comments") . '</th>'
+ .'</tr>'
+ .'<tr class="odd">'
+ .'<td>login</td>'
+ .'<td>' . tra( "string" ) . '<br />' . tra( "(optional)") . '</td>'
+ .'<td>' . tra( "The login name to generate the link" ) . '</td>'
+ .'</tr>'
+ .'<tr class="even">'
+ .'<td>email</td>'
+ .'<td>' . tra( "string" ) . '<br />' . tra( "(optional)") . '</td>'
+ .'<td>' . tra( "The e-mail address to generate the link" ) . '</td>'
+ .'</tr>'
+ .'<tr class="odd">'
+ .'<td>label</td>'
+ .'<td>' . tra( "string" ) . '<br />' . tra( "(optional)") . '</td>'
+ .'<td>' . tra( "The label to show; default is user's name" ) . '</td>'
+ .'</tr>'
+ .'</table>'
+ .tra("Example: ") . "{USERLINK login='admin' label='Site Administrator'}";
+ return $help;
+}
+
+// Load Function
+function data_userlink($data, $params) {
+ global $gBitUser;
+
+ $myHash = array();
+ $ret = '';
+ extract ($params, EXTR_SKIP);
+
+ if ( isset( $login ) ) {
+ $myHash['login'] = $login;
+ } else if ( isset( $email ) ) {
+ $myHash['email'] = $email;
+ } else if ( isset( $user_id ) ) {
+ $myHash['user_id'] = $user_id;
+ }
+
+ $user = $gBitUser->userExists($myHash);
+
+ if( $user != Null ) {
+ $tmpUser = $gBitUser->getUserInfo( array( 'user_id' => $user ) );
+ if ( isset( $label ) ) {
+ $tmpUser['link_label'] = $label;
+ }
+ $ret = $gBitUser->getDisplayName( TRUE, $tmpUser );
+ }
+ return $ret;
+}
+?>
diff --git a/liberty_plugins/data.userlist.php b/liberty_plugins/data.userlist.php
new file mode 100644
index 0000000..c46fe72
--- /dev/null
+++ b/liberty_plugins/data.userlist.php
@@ -0,0 +1,202 @@
+<?php
+/**
+ * @version $Revision: 1.1 $
+ * @package liberty
+ * @subpackage plugins_data
+ */
+// +----------------------------------------------------------------------+
+// | Copyright (c) 2004, bitweaver.org
+// +----------------------------------------------------------------------+
+// | All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
+// |
+// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
+// | -> see http://phpdocu.sourceforge.net/
+// +----------------------------------------------------------------------+
+// | Author (TikiWiki): sQuare
+// | Reworked & Undoubtedly Screwed-Up for (Bitweaver)
+// | by: StarRider <starrrider@sourceforge.net>
+// | Reworked from: wikiplugin_userlist.php - see deprecated code below
+// +----------------------------------------------------------------------+
+// $Id: data.userlist.php,v 1.1 2008/07/08 07:13:57 squareing Exp $
+
+/**
+ * definitions
+ */
+define( 'PLUGIN_GUID_DATAUSERLIST', 'datauserlist' );
+global $gLibertySystem;
+$pluginParams = array (
+ 'tag' => 'USERLIST',
+ 'auto_activate' => FALSE,
+ 'requires_pair' => TRUE,
+ 'load_function' => 'data_userlist',
+ 'title' => 'UserList - This plugin is not yet functional.', // Remove this line when the plugin becomes operational
+// 'title' => 'UserList',, // and Remove the comment from the start of this line
+ 'help_page' => 'DataPluginUserList',
+ 'description' => tra("This plugin will displays an alphabetically sorted list of registered users. A Group Name can be included to filter Groups to be listed."),
+ 'help_function' => 'data_userlist_help',
+ 'syntax' => "{USERLIST num= userspage= alpha= total= email= }GroupName{USERLIST}",
+ 'path' => LIBERTY_PKG_PATH.'plugins/data.userlist.php',
+ 'security' => 'registered',
+ 'plugin_type' => DATA_PLUGIN
+);
+$gLibertySystem->registerPlugin( PLUGIN_GUID_DATAUSERLIST, $pluginParams );
+$gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAUSERLIST );
+
+// Help Function
+function data_userlist_help() {
+ $back = tra("^__Parameter Syntax:__ ") . "~np~{USERLIST" . tra("(key=>value)}~/np~\n");
+ $back.= tra("||__::key::__ | __::value::__ | __::Comments::__\n");
+ $back.= "::num::" . tra(" | ::boolean:: | if True then the listing is numbered. __Optional__ - can be omitted - the __Default = False__ (any value = True) .\n");
+ $back.= "::userspage::" . tra(" | ::boolean:: | if True then a link is provided to each user that has a personal userpage. __Optional__ - can be omitted - the __Default = True__ (any value = False).\n");
+ $back.= "::alpha::" . tra(" | ::boolean:: | if True then the listing is sectioned alphabetically - using the first letter in the users name. __Optional__ - can be omitted - the __Default = True__ (any value = False) .\n");
+ $back.= "::email::" . tra(" | ::boolean:: | shows the email address of each user - if their email address is public. __Optional__ - can be omitted - the __Default = False__ (any value = True).\n");
+ $back.= "::total::" . tra(" | ::boolean:: | shows the total number of users in list at the bottom of the listing. __Optional__ - can be omitted - the __Default = True__ (any value = False).||^");
+ $back.= tra("^__Example:__ ") . "~np~{USERLIST(num=>1,email=>1)}{USERLIST} ~/np~^";
+ return $back;
+}
+
+// Load Function
+function data_userlist($data, $params) {
+ $ret = "This plugin has not been completed as yet. ";
+ return $ret;
+}
+/******************************************************************************
+The code below is from the deprecated USERLIST plugin. All comments and the help routines have been removed. - StarRider
+
+include_once( WIKI_PKG_PATH.'BitPage.php');
+
+function wikiplugin_userprint($num,$user,$userspage,$email,$wp_user_count) {
+ global $wikilib,$gBitUser, $gBitSystem;
+ // alternate class of every row
+ if ($wp_user_count % 2) {
+ $class = 'even';
+ }
+ else {
+ $class = 'odd';
+ }
+ $ret = ('<tr class="'.$class.'">');
+
+ // get email address and check if it's public
+ $user_info = $gBitUser->getUserInfo( array( 'login' => $user ) );
+ $eml = scrambleEmail($user_info['email']);
+ $public = FALSE; // cheap hack from spiderr to get things working. $wikilib->get_user_preference($user,'users_is_email_public');
+
+ if ($num) {
+ $ret .= ('<td>__'.$wp_user_count.'__</td>');
+ }
+
+ if( $gBitSystem->isPackageActive( 'messages' ) ) {
+ $messages_img = ('<a class="wiki" href="'.MESSAGES_PKG_URL.'compose.php?to='.$user.'" title="'.tra('Send a message to').' '.$user.'"><img src="'.IMG_PKG_URL.'icons/icon_ultima.gif" width="20" height="10" border="0" alt="'.tra('Send message').'" /></a> ');
+ } else {
+ $messages_img = ('');
+ }
+ $ret .= ('<td>'.$messages_img.$user.'</td>');
+
+ // if you want to show all email addresses indstead of only public ones, uncomment following line
+ $public = 'y';
+
+ if ($email) {
+ if ($public == 'y' && $eml != '') {
+ $ret .= '<td>[mailto:'.$eml.'|'.$eml.']</td>';
+ }
+ else {
+ $ret .= '<td>&nbsp;</td>';
+ }
+ }
+
+ if ($userspage) {
+ if ($wikilib->pageExists('userPage'.$user)) {
+ $ret .= '<td>((userPage'.$user.'|'.$user.' Homepage))</td>';
+ }
+ else {
+ $ret .= '<td>&nbsp;</td>';
+ }
+ }
+
+ $ret .= ("</tr>\r");
+
+ return $ret;
+}
+
+// function used to sort an array - NOT case-sensitive
+function wikiplugin_compare_users($a, $b) {
+ return strcmp(strtolower($a), strtolower($b));
+}
+
+function wikiplugin_userlist($data, $params) {
+ global $gBitUser, $gBitSystem;
+
+ extract ($params, EXTR_SKIP);
+ $num = (isset($num)) ? True : False; // Default = False
+ $userspage = (!isset($userspage)) ? True : False; // Default = True
+ $alpha = (!isset($alpha)) ? True : False; // Default = True
+ $total = (!isset($total)) ? True : False; // Default = True
+ $email = (isset($email)) ? True : False; // Default = False
+
+ $colcount = 1;
+
+ $ret = '<table class="normal">';
+ $ret .= '<tr>';
+
+ if ($num) {
+ $ret .= '<th>&nbsp;</th>';
+ $colcount++;
+ }
+
+ $ret .= '<th>'.tra('__UserName__').'</th>';
+
+ if ($email) {
+ $ret .= '<th>'.tra('__email Address__').'</th>';
+ $colcount++;
+ }
+
+ if ($userspage) {
+ $ret .= '<th>'.tra('__UserPage__').'</th>';
+ $colcount++;
+ }
+
+ $ret .= '</tr>';
+
+ if (!$data) {
+ $userdata = $gBitUser->get_users(0);
+
+ foreach ($userdata['data'] as $usertemp) {
+ $users[] = $usertemp['login'];
+ }
+ } else {
+ $users = $gBitUser->get_group_users($data);
+ }
+
+ usort($users, 'wikiplugin_compare_users'); // sort the users
+
+ $wp_user_count = 0;
+ foreach ($users as $user) {
+ if ($wp_user_count >= 1) {
+ $prev_user = $users[$wp_user_count-1];
+ }
+ else {
+ $prev_user = 0;
+ }
+ $wp_user_count++;
+
+ if ($alpha) {
+ if (strtolower($prev_user[0]) != strtolower($user[0])) {
+ $ret .= ("<tr><th colspan='".$colcount."'>__::Section - ".strtoupper($user[0])."::__</th></tr>\r");
+ }
+ }
+
+ $ret .= (wikiplugin_userprint($num,$user,$userspage,$email,$wp_user_count));
+ }
+
+ if ($total) {
+ $ret .= ("<tr><td class='odd' colspan='".$colcount."'>&nbsp;</td></tr>\r");
+ $ret .= ("<tr><td class='odd' colspan='".$colcount."'>".tra('__Total number of users').": ".$wp_user_count."__</td></tr>\r");
+ }
+
+ $ret .= ('</table>');
+
+ return $ret;
+}
+*/
+?>