summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.htaccess5
-rw-r--r--BitPermUser.php736
-rw-r--r--BitUser.php1550
-rw-r--r--admin/admin_login_inc.php287
-rw-r--r--admin/admin_userfiles_inc.php16
-rw-r--r--admin/admin_users_inc.php95
-rw-r--r--admin/assign_user.php80
-rw-r--r--admin/edit_group.php168
-rw-r--r--admin/index.php162
-rw-r--r--admin/schema_inc.php329
-rw-r--r--admin/upgrade_inc.php263
-rw-r--r--assigned_modules.php107
-rw-r--r--bit_setup_inc.php232
-rw-r--r--bookmark_lib.php135
-rw-r--r--bookmarks.php109
-rw-r--r--cached_bookmark.php29
-rw-r--r--change_password.php54
-rw-r--r--confirm.php16
-rw-r--r--custom_home.php31
-rw-r--r--display_bituser_inc.php8
-rw-r--r--download_userfile.php25
-rw-r--r--edit_personal_page.php58
-rw-r--r--files.php137
-rwxr-xr-xicons/assume_user.gifbin0 -> 476 bytes
-rw-r--r--icons/batch_assign.gifbin0 -> 255 bytes
-rw-r--r--icons/flags/American_Samoa.gifbin0 -> 1020 bytes
-rw-r--r--icons/flags/Angola.gifbin0 -> 85 bytes
-rw-r--r--icons/flags/Antigua.gifbin0 -> 107 bytes
-rw-r--r--icons/flags/Argentina.gifbin0 -> 851 bytes
-rw-r--r--icons/flags/Armenia.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Australia.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Austria.gifbin0 -> 81 bytes
-rw-r--r--icons/flags/Bahamas.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Bahrain.gifbin0 -> 92 bytes
-rw-r--r--icons/flags/Bangladesh.gifbin0 -> 119 bytes
-rw-r--r--icons/flags/Barbados.gifbin0 -> 103 bytes
-rw-r--r--icons/flags/Belgium.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Bermuda.gifbin0 -> 102 bytes
-rw-r--r--icons/flags/Bolivia.gifbin0 -> 88 bytes
-rw-r--r--icons/flags/Brazil.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Brunei.gifbin0 -> 122 bytes
-rw-r--r--icons/flags/Canada.gifbin0 -> 102 bytes
-rw-r--r--icons/flags/Cayman_Islands.gifbin0 -> 114 bytes
-rw-r--r--icons/flags/Chile.gifbin0 -> 93 bytes
-rw-r--r--icons/flags/China.gifbin0 -> 85 bytes
-rw-r--r--icons/flags/Colombia.gifbin0 -> 88 bytes
-rw-r--r--icons/flags/Cook_Islands.gifbin0 -> 1014 bytes
-rw-r--r--icons/flags/Costa_Rica.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Croatia.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Cuba.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Cyprus.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Czech_Republic.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Denmark.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Dominican_Republic.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Ecuador.gifbin0 -> 126 bytes
-rw-r--r--icons/flags/Egypt.gifbin0 -> 95 bytes
-rw-r--r--icons/flags/El_Salvador.gifbin0 -> 856 bytes
-rw-r--r--icons/flags/Estonia.gifbin0 -> 86 bytes
-rw-r--r--icons/flags/Federated_States_of_Micronesia.gifbin0 -> 1020 bytes
-rw-r--r--icons/flags/Fiji.gifbin0 -> 1091 bytes
-rw-r--r--icons/flags/Finland.gifbin0 -> 96 bytes
-rw-r--r--icons/flags/France.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/French_Polynesia.gifbin0 -> 1052 bytes
-rw-r--r--icons/flags/Germany.gifbin0 -> 86 bytes
-rw-r--r--icons/flags/Greece.gifbin0 -> 92 bytes
-rw-r--r--icons/flags/Guam.gifbin0 -> 1068 bytes
-rw-r--r--icons/flags/Guatemala.gifbin0 -> 102 bytes
-rw-r--r--icons/flags/Haiti.gifbin0 -> 564 bytes
-rw-r--r--icons/flags/Honduras.gifbin0 -> 85 bytes
-rw-r--r--icons/flags/Hungary.gifbin0 -> 88 bytes
-rw-r--r--icons/flags/Iceland.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/India.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Indonesia.gifbin0 -> 79 bytes
-rw-r--r--icons/flags/Iran.gifbin0 -> 92 bytes
-rw-r--r--icons/flags/Iraq.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Ireland.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Israel.gifbin0 -> 89 bytes
-rw-r--r--icons/flags/Italy.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Jamaica.gifbin0 -> 102 bytes
-rw-r--r--icons/flags/Japan.gifbin0 -> 86 bytes
-rw-r--r--icons/flags/Jordan.gifbin0 -> 103 bytes
-rw-r--r--icons/flags/Kazakstan.gifbin0 -> 99 bytes
-rw-r--r--icons/flags/Kenya.gifbin0 -> 107 bytes
-rw-r--r--icons/flags/Kiribati.gifbin0 -> 1069 bytes
-rw-r--r--icons/flags/Kuwait.gifbin0 -> 102 bytes
-rw-r--r--icons/flags/Latvia.gifbin0 -> 81 bytes
-rw-r--r--icons/flags/Lebanon.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Lithuania.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Malawi.gifbin0 -> 95 bytes
-rw-r--r--icons/flags/Malaysia.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Malta.gifbin0 -> 111 bytes
-rw-r--r--icons/flags/Marshall_Islands.gifbin0 -> 1068 bytes
-rw-r--r--icons/flags/Mauritius.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Mexico.gifbin0 -> 324 bytes
-rw-r--r--icons/flags/Morocco.gifbin0 -> 82 bytes
-rw-r--r--icons/flags/Mozambique.gifbin0 -> 116 bytes
-rw-r--r--icons/flags/Nauru.gifbin0 -> 1079 bytes
-rw-r--r--icons/flags/Nepal.gifbin0 -> 165 bytes
-rw-r--r--icons/flags/Netherlands.gifbin0 -> 86 bytes
-rw-r--r--icons/flags/New_Caledonia.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/New_Zealand.gifbin0 -> 104 bytes
-rw-r--r--icons/flags/Nicaragua.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Nigeria.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Niue.gifbin0 -> 1047 bytes
-rw-r--r--icons/flags/None.gifbin0 -> 55 bytes
-rw-r--r--icons/flags/Norway.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Other.gifbin0 -> 128 bytes
-rw-r--r--icons/flags/Pakistan.gifbin0 -> 99 bytes
-rw-r--r--icons/flags/Panama.gifbin0 -> 103 bytes
-rw-r--r--icons/flags/Papua_New_Guinea.gifbin0 -> 1068 bytes
-rw-r--r--icons/flags/Paraguay.gifbin0 -> 98 bytes
-rw-r--r--icons/flags/Peru.gifbin0 -> 89 bytes
-rw-r--r--icons/flags/Phillippines.gifbin0 -> 117 bytes
-rw-r--r--icons/flags/Poland.gifbin0 -> 79 bytes
-rw-r--r--icons/flags/Portugal.gifbin0 -> 103 bytes
-rw-r--r--icons/flags/Puerto_Rico.gifbin0 -> 100 bytes
-rw-r--r--icons/flags/Quatar.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Romania.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Russia.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Samoa.gifbin0 -> 1064 bytes
-rw-r--r--icons/flags/Saudi_Arabia.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Singapore.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Slovakia.gifbin0 -> 99 bytes
-rw-r--r--icons/flags/Slovenia.gifbin0 -> 101 bytes
-rw-r--r--icons/flags/Solomon_Islands.gifbin0 -> 105 bytes
-rw-r--r--icons/flags/Somalia.gifbin0 -> 93 bytes
-rw-r--r--icons/flags/South_Africa.gifbin0 -> 109 bytes
-rw-r--r--icons/flags/South_Korea.gifbin0 -> 107 bytes
-rw-r--r--icons/flags/Spain.gifbin0 -> 82 bytes
-rw-r--r--icons/flags/Sri_Lanka.gifbin0 -> 151 bytes
-rw-r--r--icons/flags/St_Vincent_Grenadines.gifbin0 -> 152 bytes
-rw-r--r--icons/flags/Surinam.gifbin0 -> 93 bytes
-rw-r--r--icons/flags/Sweden.gifbin0 -> 91 bytes
-rw-r--r--icons/flags/Switzerland.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Taiwan.gifbin0 -> 94 bytes
-rw-r--r--icons/flags/Thailand.gifbin0 -> 87 bytes
-rw-r--r--icons/flags/Tonga.gifbin0 -> 1065 bytes
-rw-r--r--icons/flags/Trinidad_Tobago.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/Turkey.gifbin0 -> 95 bytes
-rw-r--r--icons/flags/Tuvalu.gifbin0 -> 1069 bytes
-rw-r--r--icons/flags/Ukraine.gifbin0 -> 79 bytes
-rw-r--r--icons/flags/United_Arab_Emirates.gifbin0 -> 97 bytes
-rw-r--r--icons/flags/United_Kingdom.gifbin0 -> 115 bytes
-rw-r--r--icons/flags/United_States.gifbin0 -> 100 bytes
-rw-r--r--icons/flags/Uruguay.gifbin0 -> 99 bytes
-rw-r--r--icons/flags/Vanuatu.gifbin0 -> 1063 bytes
-rw-r--r--icons/flags/Venezuela.gifbin0 -> 93 bytes
-rw-r--r--icons/flags/Wales.gifbin0 -> 142 bytes
-rw-r--r--icons/flags/Yugoslavia.gifbin0 -> 113 bytes
-rw-r--r--icons/flags/Zambia.gifbin0 -> 131 bytes
-rw-r--r--icons/flags/Zimbabwe.gifbin0 -> 114 bytes
-rw-r--r--icons/flags/index.php6
-rw-r--r--icons/home.pngbin0 -> 608 bytes
-rw-r--r--icons/index.php6
-rw-r--r--icons/my_admin.gifbin0 -> 1357 bytes
-rw-r--r--icons/my_bitweaver.gifbin0 -> 1614 bytes
-rw-r--r--icons/my_bookmarks.gifbin0 -> 1557 bytes
-rw-r--r--icons/my_files.gifbin0 -> 1458 bytes
-rw-r--r--icons/my_homepage.gifbin0 -> 1311 bytes
-rw-r--r--icons/my_messages.gifbin0 -> 1547 bytes
-rw-r--r--icons/my_minical.gifbin0 -> 1506 bytes
-rw-r--r--icons/my_modules.gifbin0 -> 1375 bytes
-rw-r--r--icons/my_news.gifbin0 -> 1488 bytes
-rw-r--r--icons/my_notes.gifbin0 -> 1437 bytes
-rw-r--r--icons/my_prefs.gifbin0 -> 996 bytes
-rw-r--r--icons/my_tasks.gifbin0 -> 401 bytes
-rw-r--r--icons/my_watches.gifbin0 -> 1315 bytes
-rw-r--r--icons/my_webmail.gifbin0 -> 1425 bytes
-rw-r--r--icons/pkg_users.pngbin0 -> 3660 bytes
-rw-r--r--icons/send_msg_small.gifbin0 -> 135 bytes
-rw-r--r--icons/unknown_user.jpgbin0 -> 766 bytes
-rw-r--r--icons/unwatch.gifbin0 -> 374 bytes
-rw-r--r--icons/users.pngbin0 -> 870 bytes
-rw-r--r--icons/watch.gifbin0 -> 539 bytes
-rw-r--r--index.php65
-rw-r--r--login.php21
-rw-r--r--logout.php20
-rw-r--r--lookup_user_inc.php46
-rw-r--r--menu.php106
-rw-r--r--module_controls_inc.php50
-rw-r--r--modules/index.php4
-rw-r--r--modules/mod_login_box.tpl104
-rw-r--r--modules/mod_online_users.php6
-rw-r--r--modules/mod_online_users.tpl16
-rw-r--r--modules/mod_since_last_visit.php4
-rw-r--r--modules/mod_since_last_visit.tpl12
-rw-r--r--modules/mod_user_bookmarks.php69
-rw-r--r--modules/mod_user_bookmarks.tpl24
-rw-r--r--modules/mod_user_image_galleries.php4
-rw-r--r--modules/mod_user_image_galleries.tpl19
-rw-r--r--modules/mod_user_pages.php4
-rw-r--r--modules/mod_user_pages.tpl19
-rw-r--r--modules/mod_user_profile.php13
-rw-r--r--modules/mod_user_profile.tpl19
-rw-r--r--modules/mod_user_tasks.php30
-rw-r--r--modules/mod_user_tasks.tpl23
-rw-r--r--modules/mod_who_is_there.php7
-rw-r--r--modules/mod_who_is_there.tpl22
-rw-r--r--modules/user_module.tpl4
-rw-r--r--my.php192
-rw-r--r--my_files.php21
-rw-r--r--my_groups.php151
-rw-r--r--my_images.php69
-rw-r--r--preferences.php282
-rw-r--r--random_num_img.php27
-rw-r--r--register.php82
-rw-r--r--remind_password.php41
-rw-r--r--show_user_avatar.php19
-rw-r--r--task_lib.php96
-rw-r--r--tasks.php162
-rw-r--r--templates/admin_group_edit.tpl196
-rw-r--r--templates/admin_groups_list.tpl65
-rw-r--r--templates/admin_login.tpl409
-rw-r--r--templates/admin_permission.tpl22
-rw-r--r--templates/admin_userfiles.tpl16
-rw-r--r--templates/admin_users.tpl61
-rw-r--r--templates/assignuser.tpl87
-rw-r--r--templates/center_user_wiki_page.php11
-rw-r--r--templates/center_user_wiki_page.tpl57
-rw-r--r--templates/change_password.tpl29
-rw-r--r--templates/custom_home.tpl101
-rw-r--r--templates/custom_home_2.tpl60
-rw-r--r--templates/group_list_members.tpl28
-rw-r--r--templates/index.php6
-rw-r--r--templates/index_list.tpl12
-rw-r--r--templates/login.tpl23
-rw-r--r--templates/login_inc.tpl98
-rw-r--r--templates/menu_users.tpl64
-rw-r--r--templates/menu_users_admin.tpl8
-rw-r--r--templates/my_bitweaver.tpl84
-rw-r--r--templates/my_bitweaver_bar.tpl70
-rw-r--r--templates/my_files.tpl39
-rw-r--r--templates/my_group_edit.tpl224
-rw-r--r--templates/my_groups_list.tpl75
-rw-r--r--templates/my_images.tpl89
-rw-r--r--templates/new_user_notification.tpl3
-rw-r--r--templates/password_reminder.tpl5
-rw-r--r--templates/register.tpl126
-rw-r--r--templates/remind_password.tpl29
-rw-r--r--templates/user_activity.tpl0
-rw-r--r--templates/user_assigned_modules.tpl347
-rw-r--r--templates/user_bookmarks.tpl97
-rw-r--r--templates/user_information_inc.tpl89
-rw-r--r--templates/user_menu.tpl35
-rw-r--r--templates/user_preferences.tpl356
-rw-r--r--templates/user_tasks.tpl141
-rw-r--r--templates/user_validation_mail.tpl9
-rw-r--r--templates/user_watches.tpl56
-rw-r--r--templates/userfiles.tpl115
-rw-r--r--templates/usermenu.tpl86
-rw-r--r--templates/users_admin.tpl119
-rw-r--r--templates/users_list.tpl53
-rw-r--r--templates/userversions.tpl34
-rw-r--r--theme.php283
-rw-r--r--user_menu_lib.php80
-rw-r--r--userfiles_lib.php61
-rw-r--r--validate.php81
-rw-r--r--versions.php45
-rw-r--r--watches.php37
259 files changed, 10718 insertions, 0 deletions
diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000..f0a90cc
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+ RewriteEngine on
+ RewriteBase /users/
+ RewriteRule ^([A-Za-z0-9_]+)$ index.php?home=$1 [L,QSA]
+</IfModule>
diff --git a/BitPermUser.php b/BitPermUser.php
new file mode 100644
index 0000000..369bc15
--- /dev/null
+++ b/BitPermUser.php
@@ -0,0 +1,736 @@
+<?php
+// Lib for user administration, groups and permissions
+// This lib uses pear so the constructor requieres
+// a pear DB object
+
+require_once( USERS_PKG_PATH.'BitUser.php' );
+
+class BitPermUser extends BitUser {
+# var $db; // The PEAR db object used to access the database
+ // change this to an email address to receive debug emails from the LDAP code
+ var $debug = false;
+ var $usergroups_cache;
+ var $groupperm_cache;
+
+ function BitPermUser( $pUserId=NULL, $pContentId=NULL ) {
+ BitUser::BitUser( $pUserId, $pContentId );
+ // Initialize caches
+ $this->usergroups_cache = array();
+ $this->groupperm_cache = array(array());
+ }
+
+ function load( $pFull=FALSE, $pUserName=NULL ) {
+ if( BitUser::load( $pFull, $pUserName ) ) {
+ if( $pFull ) {
+ $this->loadGroups();
+ $this->loadPermissions();
+ }
+ }
+ return( $this->mUserId != NULL );
+ }
+
+ // Used to hide sensitive information when it is unneccessary (i.e. $gQueryUser)
+ function sanitizeUserInfo() {
+ if (!empty($this->mInfo)) {
+ if (!empty($this->mInfo['provpass'])) {
+ unset($this->mInfo['provpass']);
+ }
+ if (!empty($this->mInfo['hash'])) {
+ unset($this->mInfo['hash']);
+ }
+ if (!empty($this->mInfo['challenge'])) {
+ unset($this->mInfo['challenge']);
+ }
+ if (!empty($this->mInfo['password'])) {
+ unset($this->mInfo['password']);
+ }
+ }
+ }
+
+ function store( &$pParamHash ) {
+ global $gBitSystem;
+ // keep track of newUser before calling base class
+ $newUser = !$this->isRegistered();
+ $this->mDb->StartTrans();
+ if( BitUser::store( $pParamHash ) && $newUser ) {
+ $defaultGroups = $this->getDefaultGroup();
+ $this->addUserToGroup( $this->mUserId, $defaultGroups );
+ if( $gBitSystem->isFeatureActive( 'eponymousGroups' ) ) {
+ // Create a group just for this user, for permissions assignment.
+ $groupParams = array(
+ 'user_id' => $this->mUserId,
+ 'name' => $pParamHash['user_store']['login'],
+ 'desc' => "Personal group for ".(!empty( $pParamHash['user_store']['real_name'] ) ? $pParamHash['user_store']['real_name'] : $pParamHash['user_store']['login'])
+ );
+ if( $this->storeGroup( $groupParams ) ) {
+ $this->addUserToGroup( $this->mUserId, $groupParams['group_id'] );
+ }
+ }
+ $this->load( TRUE );
+ }
+ $this->mDb->CompleteTrans();
+ return( count( $this->mErrors ) == 0 );
+ }
+
+ function groupExists( $pGroupName, $pUserId=ROOT_USER_ID ) {
+ static $rv = array();
+ if( !isset( $rv[$pUserId][$pGroupName] ) ) {
+ $bindVars = array( $pGroupName );
+ $whereSql = '';
+ if( $pUserId != '*' ) {
+ $whereSql = 'AND `user_id`=?';
+ $bindVars[] = $pUserId;
+ }
+ $query = "SELECT ug.`group_name`, ug.`group_id`, ug.`user_id`
+ FROM `".BIT_DB_PREFIX."users_groups` ug
+ WHERE `group_name`=? $whereSql";
+ if( $result = $this->getAssoc( $query, $bindVars ) ) {
+ if( empty( $rv[$pUserId] ) ) {
+ $rv[$pUserId] = array();
+ }
+ $rv[$pUserId][$pGroupName] = $result[$pGroupName];
+ }
+ }
+ return( $rv[$pUserId][$pGroupName]['group_id'] );
+ }
+
+ // removes user and associated private data
+ function expunge( $pUserId ) {
+ global $gBitSystem;
+ $this->mDb->StartTrans();
+ if( $_REQUEST["user_id"] != ANONYMOUS_USER_ID ) {
+ $userTables = array(
+ 'users_groups_map',
+ );
+ foreach( $userTables as $table ) {
+ $query = "delete from `".BIT_DB_PREFIX.$table."` where `user_id` = ?";
+ $result = $this->query($query, array( $pUserId ) );
+ }
+ return BitUser::expunge( $pUserId );
+ } else {
+ $this->mDb->RollbackTrans();
+ $gBitSystem->fatalError( tra( 'The anonymous user cannot be deleted' ) );
+ }
+ $this->mDb->CompleteTrans();
+ }
+ // =-=-=-=-=-=-=-=-=-=-=-= GROUP FUNCTIONS =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ function loadGroups($pForceRefresh = FALSE) {
+ if( $this->isValid() ) {
+ $this->mGroups = $this->getGroups(NULL, $pForceRefresh);
+ }
+ }
+
+ function isInGroup( $pGroupMixed ) {
+ $ret = FALSE;
+ if( $this->isAdmin() ) {
+ $ret = TRUE;
+ } if( $this->isValid() ) {
+ if( empty( $this->mGroups ) ) {
+ $this->loadGroups();
+ }
+ if( preg_match( '/A-Za-z/', $pGroupMixed ) ) {
+ // Old style group name passed in
+ $ret = in_array( $pGroupMixed, $this->mGroups );
+ } else {
+ $ret = isset( $this->mGroups[$pGroupMixed] );
+ }
+ }
+ return $ret;
+ }
+
+ function getAllGroups( &$pListHash ) {
+ $this->prepGetList( $pListHash );
+ if( empty( $pListHash['sort_mode'] ) ) {
+ $pListHash['sort_mode'] = 'group_name_asc';
+ }
+
+ $sortMode = $this->convert_sortmode( $pListHash['sort_mode'] );
+ if( !empty( $pListHash['find'] ) ) {
+ $mid = " WHERE UPPER(`group_name`) like ?";
+ $bindvars[] = "%".strtoupper( $pListHash['find'] )."%";
+ } else {
+ $mid = '';
+ $bindvars = array();
+ }
+
+ if (!empty($pListHash['hide_root_groups'])) {
+ if (strlen($mid) > 0) {
+ $mid .= ' AND `user_id` <> '.ROOT_USER_ID;
+ } else {
+ $mid = " WHERE `user_id` <> ".ROOT_USER_ID;
+ }
+ }
+
+ $query = "SELECT `user_id`, `group_id`, `group_name` , `group_desc`, `group_home`, `is_default`
+ FROM `".BIT_DB_PREFIX."users_groups` $mid
+ ORDER BY $sortMode";
+ $ret = array();
+ if( $rs = $this->query( $query, $bindvars ) ) {
+ while( !$rs->EOF ) {
+ $groupId = $rs->fields['group_id'];
+ $ret[$groupId] = $rs->fields;
+ $ret[$groupId]['perms'] = $this->getGroupPermissions( $groupId );
+ $inc = array();
+ $this->getIncludedGroups( $groupId, $inc );
+ $ret[$groupId]['included'] = $inc;
+ $rs->MoveNext();
+ }
+ }
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."users_groups`";
+ $cant = $this->getOne($query_cant, false);
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+
+ function getAllUserGroups( $pUserId=NULL ) {
+ if( empty( $pUserId ) ) {
+ $pUserId = $this->mUserId;
+ }
+
+ $sql = "SELECT ug.`group_id`, ug.* FROM `".BIT_DB_PREFIX."users_groups` ug
+ WHERE `user_id`=?
+ ORDER BY ug.`group_name` ASC";
+ return $this->mDb->GetAssoc($sql, array( $pUserId ) );
+ }
+
+ function get_user_id( $pUserName ) {
+ if( !empty( $pUserName ) ) {
+ $id = $this->getOne("select `user_id` from `".BIT_DB_PREFIX."users_users` where `login`=?", array($pUserName));
+ $id = ($id === NULL) ? -1 : $id;
+ return $id;
+ }
+ }
+/*
+ function get_included_groups($pGroupId) {
+ $query = "SELECT `include_group_id`, ug.`group_name`
+ FROM `".BIT_DB_PREFIX."users_groups_inclusion` ugi INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON (ug.`group_id`=ugi.`group_id`)
+ WHERE ugi.`group_id`=?";
+ return( $this->mDb->GetAssoc( $query, array($pGroupId) ) );
+ }
+
+ function get_user_groups( $pUserId ) {
+ if (!is_numeric($pUserId)) {
+ // For legacy calls still using $user as the parameter
+ $pUserId = $this->get_user_id($pUserId);
+ }
+ if (!isset($this->usergroups_cache[$pUserId])) {
+ //$userid = $this->get_user_id($user);
+ $query = "SELECT ug.`group_id`, ug.`group_name`
+ FROM `".BIT_DB_PREFIX."users_groups_map` ugm INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON (ug.`group_id`=ugm.`group_id`)
+ WHERE ugm.`user_id`=? OR ug.`group_name`='Anonymous'";
+ $ret = $this->mDb->GetAssoc($query, array((int)$pUserId));
+ // cache it
+ $this->usergroups_cache[$pUserId] = $ret;
+ return $ret;
+ } else {
+ return $this->usergroups_cache[$pUserId];
+ }
+ }
+*/
+
+ // we cannot remove the anonymous group
+ function remove_group($pGroupId) {
+ if( $pGroupId != ANONYMOUS_GROUP_ID ) {
+ $query = "DELETE FROM `".BIT_DB_PREFIX."users_groups_inclusion`
+ WHERE `group_id` = ? OR `include_group_id` = ?";
+ $result = $this->query($query, array($pGroupId, $pGroupId));
+ $query = "delete from `".BIT_DB_PREFIX."users_grouppermissions` where `group_id` = ?";
+ $result = $this->query($query, array($pGroupId));
+ $query = "delete from `".BIT_DB_PREFIX."users_groups` where `group_id` = ?";
+ $result = $this->query($query, array($pGroupId));
+ return true;
+ }
+ }
+
+ function getGroups( $pUserId=NULL, $pForceRefresh = FALSE ) {
+ $pUserId = !empty( $pUserId ) ? $pUserId : $this->mUserId;
+ if (!isset($this->usergroups_cache[$pUserId]) || $pForceRefresh) {
+ $query = "SELECT ug.`group_id`, ug.`group_name`, ug.`user_id` as group_owner_user_id
+ FROM `".BIT_DB_PREFIX."users_groups_map` ugm INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON (ug.`group_id`=ugm.`group_id`)
+ WHERE ugm.`user_id`=? OR ugm.`group_id`=".ANONYMOUS_GROUP_ID;
+ $ret = $this->mDb->GetAssoc($query, array((int)$pUserId));
+ if( $ret ) {
+ foreach( array_keys( $ret ) as $groupId ) {
+ $this->getIncludedGroups( $groupId, $ret );
+ }
+ }
+ // cache it
+ $this->usergroups_cache[$pUserId] = $ret;
+ return $ret;
+ } else {
+ return $this->usergroups_cache[$pUserId];
+ }
+ }
+
+ function getIncludedGroups( $pGroupId, &$pIncludes ) {
+ $query = "SELECT ugi.`include_group_id`, ug.`group_name`
+ FROM `".BIT_DB_PREFIX."users_groups_inclusion` ugi
+ INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON ( ugi.`include_group_id`=ug.`group_id` )
+ WHERE ugi.`group_id`=?";
+ $ret = $this->GetAssoc($query, array($pGroupId));
+ if( $ret ) {
+ foreach( array_keys( $ret ) as $groupId ) {
+ if( empty( $pIncludes[$groupId] ) ) {
+ $pIncludes[$groupId] = $ret[$groupId];
+ $this->getIncludedGroups( $groupId, $pIncludes );
+ }
+ }
+ }
+ }
+
+ function addGroupInclusion( $pGroupId, $pIncludeId ) {
+ if( is_numeric( $pGroupId ) && is_numeric( $pIncludeId ) ) {
+ $query = "INSERT INTO `".BIT_DB_PREFIX."users_groups_inclusion` (`group_id`,`include_group_id`)
+ VALUES(?,?)";
+ $this->query($query, array($pGroupId, $pIncludeId));
+ }
+ }
+
+ function removeGroupInclusions( $pGroupId ) {
+ if( is_numeric( $pGroupId ) ) {
+ $query = "DELETE FROM `".BIT_DB_PREFIX."users_groups_inclusion` where `group_id` = ?";
+ $result = $this->query($query, array($pGroupId));
+ }
+ return true;
+ }
+
+
+ // pass in pGroupId to make conditional function
+ function getDefaultGroup( $pGroupId=NULL ) {
+ $bindvars = NULL;
+ $whereSql = '';
+ if( !empty( $pGroupId ) ) {
+ $whereSql = "AND `group_id`=? ";
+ $bindvars = array( $pGroupId );
+ }
+ return( $this->mDb->getAssoc("select `group_id`, `group_name` from `".BIT_DB_PREFIX."users_groups` where `is_default` = 'y' $whereSql ", $bindvars ) );
+ }
+
+ function get_group_users( $pGroupId ) {
+ $query = "select uu.`user_id` AS uid, uu.`login` AS `user`, uu.`real_name`, uu.`user_id` from `".BIT_DB_PREFIX."users_users` uu, `".BIT_DB_PREFIX."users_groups_map` ug where uu.`user_id`=ug.`user_id` and `group_id`=?";
+ return( $this->mDb->GetAssoc($query,array($pGroupId)) );
+ }
+
+ function getGroupHome( $pGroupId ) {
+ $ret = FALSE;
+ $query = "SELECT `group_home` FROM `".BIT_DB_PREFIX."users_groups` WHERE `group_id`=?";
+ $result = $this->query( $query,array( $pGroupId ) );
+ while($res = $result->fetchRow()) {
+ $ret = $res['group_home'];
+ }
+ return $ret;
+ }
+
+ function storeUserDefaultGroup( $pUserId, $pGroupId ) {
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `default_group_id` = ?
+ WHERE `user_id` = ?";
+ $this->query($query, array( $pGroupId, $pUserId ) );
+ }
+
+ function batchAssignUsersToGroup( $pGroupId ) {
+ $users = $this->get_group_users($pGroupId);
+ $rs = $this->mDb->getCol( "select uu.`user_id` FROM `".BIT_DB_PREFIX."users_users` uu" );
+ foreach( $rs as $userId ) {
+ if( empty( $users[$userId] ) && ($userId != ANONYMOUS_USER_ID) ) {
+ $this->addUserToGroup( $userId, $pGroupId );
+ }
+ }
+ }
+
+ function batch_set_user_default_group( $pGroupId ) {
+ $users = $this->get_group_users($pGroupId);
+ foreach( array_keys( $users ) as $userId ) {
+ $this->storeUserDefaultGroup( $userId,$pGroupId );
+ }
+ }
+
+ function getGroupInfo( $pGroupId ) {
+ $query = "select * from `".BIT_DB_PREFIX."users_groups` where `group_id`=?";
+ $result = $this->query($query, array($pGroupId));
+ $res = $result->fetchRow();
+ $perms = $this->getGroupPermissions($pGroupId, NULL, NULL, 'up.perm_name_asc');
+ $sql = "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `group_id` = ?";
+ $res['num_members'] = $this->getOne($sql, array($pGroupId));
+ $res["perms"] = $perms;
+ return $res;
+ }
+ function addUserToGroup( $pUserId, $pGroupMixed ) {
+ $result = TRUE;
+ $addGroups = array();
+ if( is_array( $pGroupMixed ) ) {
+ $addGroups = array_keys( $pGroupMixed );
+ } elseif( is_numeric($pGroupMixed) ) {
+ $addGroups = array( $pGroupMixed );
+ }
+ foreach( $addGroups AS $groupId ) {
+ if ( !$this->isInGroup( $groupId ) ) {
+ $query = "insert into `".BIT_DB_PREFIX."users_groups_map`(`user_id`,`group_id`) values(?,?)";
+ $result = $this->query($query, array( $pUserId, $groupId ), -1, -1);
+ }
+ }
+ return $result;
+ }
+
+ function removeUserFromGroup( $pUserId, $pGroupId ) {
+ $query = "delete from `".BIT_DB_PREFIX."users_groups_map` where `user_id` = ? and
+ `group_id` = ?";
+ $result = $this->query($query, array($pUserId, $pGroupId));
+ if( $pGroupId == key( $this->getDefaultGroup() ) ) {
+ $query = "update `".BIT_DB_PREFIX."users_users` set `default_group_id` = NULL where `user_id` = ?";
+ $this->query($query, array( $pUserId ) );
+ }
+ }
+
+ function verifyGroup( &$pParamHash ) {
+ if( !empty( $pParamHash['group_id'] ) ) {
+ if( !is_numeric( $pParamHash['group_id'] ) ) {
+ $this->mErrors['groups'] = 'Unknown Group';
+ } else {
+ $pParamHash['group_store']['group_id'] = $pParamHash['group_id'];
+ }
+ }
+
+ if( !empty( $pParamHash["name"] ) ) {
+ $pParamHash['group_store']['group_name'] = substr( $pParamHash["name"], 0, 30 );
+ }
+ if( !empty( $pParamHash["desc"] ) ) {
+ $pParamHash['group_store']['group_desc'] = $pParamHash["desc"];
+ }
+ $pParamHash['group_store']['group_home'] = !empty( $pParamHash["home"] ) ? $pParamHash["home"] : '';
+ $pParamHash['group_store']['is_default'] = !empty( $pParamHash["is_default"] ) ? $pParamHash["is_default"] : NULL;
+ $pParamHash['group_store']['user_id'] = !empty( $pParamHash["user_id"] ) ? $pParamHash["user_id"] : $this->mUserId;
+
+ return( count( $this->mErrors ) == 0 );
+ }
+
+ function storeGroup( &$pParamHash ) {
+ global $gBitSystem;
+ if( $this->verifyGroup( $pParamHash ) ) {
+ $this->mDb->StartTrans();
+ if( empty( $pParamHash['group_id'] ) ) {
+ $pParamHash['group_id'] = $this->mDb->GenID( 'users_groups_id_seq' );
+ $pParamHash['group_store']['group_id'] = $pParamHash['group_id'];
+ $result = $this->associateInsert( BIT_DB_PREFIX.'users_groups', $pParamHash['group_store'] );
+ } else {
+ $sql = "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."users_groups` WHERE `group_id` = ?";
+ $groupExists = $this->getOne($sql, array($pParamHash['group_id']));
+ if ($groupExists) {
+ $groupPrimary = array ( "name" => "group_id", "value" => $pParamHash['group_id'] );
+ $result = $this->associateUpdate( BIT_DB_PREFIX.'users_groups', $pParamHash['group_store'], $groupPrimary );
+ } else {
+ // A group_id was specified but that group does not exist yet
+ $pParamHash['group_store']['group_id'] = $pParamHash['group_id'];
+ $result = $this->associateInsert(BIT_DB_PREFIX.'users_groups', $pParamHash['group_store']);
+ }
+ }
+
+ $this->removeGroupInclusions( $pParamHash['group_id'] );
+ if (isset($pParamHash["include_groups"])) {
+ foreach( $pParamHash["include_groups"] as $includeId ) {
+ if( $pParamHash["group_id"] != $includeId ) {
+ $this->addGroupInclusion( $pParamHash['group_id'], $includeId );
+ }
+ }
+ }
+ if (isset($_REQUEST['batch_set_default']) and $_REQUEST['batch_set_default'] == 'on') {
+ $gBitUser->batch_set_user_default_group( $pParamHash['group_id'] );
+ }
+ $this->mDb->CompleteTrans();
+ }
+ return ( count( $this->mErrors ) == 0 );
+ }
+
+
+ // damian aka damosoft
+ function count_users($group) {
+ static $rv = array();
+ if (!isset($rv[$group])) {
+ if ($group == '') {
+ $query = "select count(login) from `".BIT_DB_PREFIX."users_users`";
+ $result = $this->getOne($query);
+ } else {
+ $query = "select count(user_id) from `".BIT_DB_PREFIX."users_groups_map` where `group_name` = ?";
+ $result = $this->getOne($query, array($group));
+ }
+ $rv[$group] = $result;
+ }
+ return $rv[$group];
+ }
+
+ // =-=-=-=-=-=-=-=-=-=-=-= PERMISSION FUNCTIONS =-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ function loadPermissions() {
+ if( $this->isValid() && empty( $this->mPerms ) ) {
+ $this->mPerms = array();
+ /* **** NOTICE **** This query is dog slow! I get much better performance with the alternative method below - drewslater
+ */
+ // the double up.`perm_name` is intentional - the first is for hash key, the second is for hash value
+ $query = "SELECT up.`perm_name` AS `hash_key`, up.`perm_name`, up.`perm_desc`, up.`level`, up.`package`
+ FROM `".BIT_DB_PREFIX."users_permissions` up
+ INNER JOIN `".BIT_DB_PREFIX."users_grouppermissions` ugp ON ( ugp.`perm_name`=up.`perm_name` )
+ INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON ( ug.`group_id`=ugp.`group_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."users_groups_map` ugm ON ( ugm.`group_id`=ugp.`group_id` AND ugm.`user_id` = ?)
+ WHERE ug.`group_id`= ".ANONYMOUS_GROUP_ID." OR ugm.`group_id`=ug.`group_id`";
+ $this->mPerms = $this->mDb->GetAssoc( $query, array( $this->mUserId ) );
+/*
+ // This is uglier, but much faster!
+ $this->loadGroups();
+ $groupIdsString = '';
+ $groupCount = 1;
+ foreach ($this->mGroups as $groupId => $groupName) {
+ $groupIdsString .= $groupId.($groupCount++ >= count($this->mGroups) ? '' : ', ');
+ }
+ if ( $groupCount > 1)
+ { $sql = "SELECT up.`perm_name`, up.`perm_desc`, up.`level`, up.`package` FROM `".BIT_DB_PREFIX."users_permissions` up
+ INNER JOIN `".BIT_DB_PREFIX."users_grouppermissions` ugp ON (ugp.`perm_name` = up.`perm_name`)
+ WHERE ugp.`group_id` IN ($groupIdsString)";
+ $this->mPerms = $this->mDb->getAssoc( $sql );
+ }
+*/
+ }
+ return( count( $this->mPerms ) );
+ }
+
+
+ function isAdmin() {
+ return( isset( $this->mPerms['bit_p_admin'] ) );
+ }
+
+ function hasPermission( $perm ) {
+ $ret = FALSE;
+ if( $this->isAdmin() ) {
+ $ret = TRUE;
+ } elseif( $this->isValid() ) {
+ $ret = isset( $this->mPerms[$perm] );
+ }
+ return ( $ret );
+ }
+
+
+ function getGroupPermissions( $pGroupId=NULL, $pPackage = '', $find = '', $pSortMode = NULL ) {
+ $values = array();
+ $mid = NULL;
+ $selectSql = '';
+ $fromSql = '';
+ if( !empty( $pSortMode ) ) {
+ $sortMode = $this->convert_sortmode( $pSortMode );
+ } else {
+ $sortMode = 'up.`package`, up.`perm_name` ASC';
+ }
+ if ($pPackage) {
+ $mid = ' WHERE `package`= ? ';
+ $values[] = $pPackage;
+ }
+ if( is_numeric( $pGroupId ) ) {
+ $selectSql = ', ugp.`value` AS `hasPerm` ';
+ $fromSql = ' INNER JOIN `'.BIT_DB_PREFIX.'users_grouppermissions` ugp ON ( ugp.`perm_name`=up.`perm_name` ) ';
+ if ($mid) {
+ $mid .= " AND ugp.`group_id`=?";
+ } else {
+ $mid .= " WHERE ugp.`group_id`=?";
+ }
+ $values[] = $pGroupId;
+ }
+ if ($find) {
+ if ($mid) {
+ $mid .= " AND `perm_name` like ?";
+ } else {
+ $mid .= " WHERE `perm_name` like ?";
+ }
+ $values[] = '%'.$find.'%';
+ }
+ // the double up.`perm_name` is intentional - the first is for hash key, the second is for hash value
+ $query = "SELECT up.`perm_name` AS `hash_key`, up.`perm_name`, up.`perm_desc`, up.`level`, up.`package` $selectSql
+ FROM `".BIT_DB_PREFIX."users_permissions` up $fromSql $mid
+ ORDER BY $sortMode";
+ return( $this->GetAssoc( $query, $values ) );
+ }
+
+
+ function assign_object_permission($pGroupId, $object_id, $object_type, $perm_name) {
+ //$object_id = md5($object_type . $object_id);
+ $query = "DELETE FROM `".BIT_DB_PREFIX."users_objectpermissions`
+ WHERE `group_id` = ? AND `perm_name` = ? AND `object_id` = ?";
+ $result = $this->query($query, array($pGroupId, $perm_name, $object_id), -1, -1);
+ $query = "insert into `".BIT_DB_PREFIX."users_objectpermissions`
+ (`group_id`,`object_id`, `object_type`, `perm_name`)
+ VALUES ( ?, ?, ?, ? )";
+ $result = $this->query($query, array($pGroupId, $object_id,$object_type, $perm_name));
+ return true;
+ }
+
+ function object_has_permission( $pUserId = NULL, $object_id, $object_type, $perm_name, $pForceRefresh = FALSE ) {
+ $ret = FALSE;
+ $groups = $this->getGroups($pUserId, $pForceRefresh);
+
+ foreach ( $groups as $groupId => $group_name ) {
+ $query = "SELECT count(*)
+ FROM `".BIT_DB_PREFIX."users_objectpermissions`
+ WHERE `group_id` = ? and `object_id` = ? and `object_type` = ? and `perm_name` = ?";
+ //pvd($query);pvd($sd="groupid: $groupId | object_id: $object_id | object_type: $object_type | permname: $perm_name");
+ $bindvars = array($groupId, $object_id, $object_type, $perm_name);
+ $result = $this->getOne( $query, $bindvars );
+ if ($result>0) {
+ $ret = true;
+ }
+ }
+ return $ret;
+ }
+
+
+ function remove_object_permission($pGroupId, $object_id, $object_type, $perm_name) {
+ //$object_id = md5($object_type . $object_id);
+ $query = "delete from `".BIT_DB_PREFIX."users_objectpermissions`
+ where `group_id` = ? and `object_id` = ?
+ and `object_type` = ? and `perm_name` = ?";
+ $bindvars = array($pGroupId, $object_id, $object_type, $perm_name);
+ $result = $this->query($query, $bindvars);
+ return true;
+ }
+
+
+ function copy_object_permissions($object_id,$destinationObjectId,$object_type) {
+ //$object_id = md5($object_type.$object_id);
+ $query = "select `perm_name`, `group_name`
+ from `".BIT_DB_PREFIX."users_objectpermissions`
+ where `object_id` =? and
+ `object_type` = ?";
+ $bindvars = array($object_id, $object_type);
+ $result = $this->query($query, $bindvars);
+ while($res = $result->fetchRow()) {
+ $this->assign_object_permission($res["group_name"],$destinationObjectId,$object_type,$res["perm_name"]);
+ }
+ return true;
+ }
+
+
+ function get_object_permissions($object_id, $object_type) {
+ //$object_id = md5($object_type . $object_id);
+ $query = "select ug.`group_id`, ug.`group_name`, uop.`perm_name`
+ FROM `".BIT_DB_PREFIX."users_objectpermissions` uop
+ INNER JOIN `".BIT_DB_PREFIX."users_groups` ug ON( uop.`group_id`=ug.`group_id` )
+ WHERE uop.`object_id` = ? AND uop.`object_type` = ?";
+ $bindvars = array($object_id, $object_type);
+ $result = $this->query($query, $bindvars);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+ return $ret;
+ }
+
+
+ function object_has_one_permission( $object_id, $object_type ) {
+ $ret = NULL;
+ if( !empty( $object_id ) && !empty( $object_type ) ) {
+ //$object_id = md5($object_type . $object_id);
+ $query = "select count(*) from `".BIT_DB_PREFIX."users_objectpermissions` where `object_id`=? and `object_type`=?";
+ $ret = $this->getOne($query, array( $object_id, $object_type ));
+ }
+ return $ret;
+ }
+
+
+ function change_permission_level($perm, $level) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $query = "update `".BIT_DB_PREFIX."users_permissions` set `level` = ?
+ where `perm_name` = ?";
+ $this->query($query, array($level, $perm));
+ }
+
+
+ function assign_level_permissions( $pGroupId, $level, $pPackage=NULL) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $bindvars = array($level);
+ $whereSql = '';
+ if( !empty( $pPackage ) ) {
+ $whereSql = ' AND `package`=?';
+ array_push( $bindvars, $pPackage );
+ }
+ $query = "SELECT `perm_name` FROM `".BIT_DB_PREFIX."users_permissions` WHERE `level` = ? $whereSql";
+ $result = $this->query($query, $bindvars);
+ $ret = array();
+ if( $result ) {
+ while ($res = $result->fetchRow()) {
+ $this->assignPermissionToGroup($res['perm_name'], $pGroupId );
+ }
+ }
+ }
+
+
+ function remove_level_permissions($group, $level) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $query = "select `perm_name` from `".BIT_DB_PREFIX."users_permissions` where `level` = ?";
+ $result = $this->query($query, array($level));
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $this->remove_permission_from_group($res['perm_name'], $group);
+ }
+ }
+
+
+ function create_dummy_level($level) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $query = "delete from `".BIT_DB_PREFIX."users_permissions` where `perm_name` = ?";
+ $result = $this->query($query, array(''));
+ $query = "insert into `".BIT_DB_PREFIX."users_permissions` (`perm_name`, `perm_desc`,
+ `package`, `level`) VALUES ('','','',?)";
+ $this->query($query, array($level));
+ }
+
+
+ function get_permission_levels() {
+ $query = "select distinct(`level`) from `".BIT_DB_PREFIX."users_permissions`";
+ $result = $this->query($query);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res['level'];
+ }
+ return $ret;
+ }
+
+
+ function assignPermissionToGroup( $perm, $pGroupId ) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $query = "delete from `".BIT_DB_PREFIX."users_grouppermissions` where `group_id` = ?
+ and `perm_name` = ?";
+ $result = $this->query($query, array($pGroupId, $perm));
+ $query = "insert into `".BIT_DB_PREFIX."users_grouppermissions`(`group_id`, `perm_name`)
+ values(?, ?)";
+ $result = $this->query($query, array($pGroupId, $perm));
+ return true;
+ }
+
+
+ function group_has_permission( $pGroupId, $perm ) {
+ if (!isset($perm, $this->groupperm_cache[$pGroupId][$perm])) {
+ $query = "SELECT count(*)
+ FROM `".BIT_DB_PREFIX."users_grouppermissions`
+ WHERE `group_id`=? AND `perm_name`=?";
+ $result = $this->getOne( $query, array( $pGroupId, $perm ) );
+ $this->groupperm_cache[$pGroupId][$perm] = $result;
+ return $result;
+ } else {
+ return $this->groupperm_cache[$pGroupId][$perm];
+ }
+ }
+
+
+ function remove_permission_from_group($perm, $pGroupId) {
+ $gBitCache = new BitCache();
+ $gBitCache->removeCached("allperms");
+ $query = "delete from `".BIT_DB_PREFIX."users_grouppermissions` where `perm_name` = ? and `group_id` = ?";
+ $result = $this->query($query, array($perm, $pGroupId));
+ return true;
+ }
+
+}
+
+?>
diff --git a/BitUser.php b/BitUser.php
new file mode 100644
index 0000000..8ff7b39
--- /dev/null
+++ b/BitUser.php
@@ -0,0 +1,1550 @@
+<?php
+// +----------------------------------------------------------------------+
+// | 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/
+// +----------------------------------------------------------------------+
+// | Authors: spider <spider@steelsun.com>
+// +----------------------------------------------------------------------+
+//
+// $Id: BitUser.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+require_once( LIBERTY_PKG_PATH.'LibertyAttachable.php' );
+define( 'AVATAR_TYPE_CENTRALIZED', 'c' );
+define( 'AVATAR_TYPE_USER_DB', 'u' );
+define( 'AVATAR_TYPE_LIBRARY', 'l' );
+
+// Column sizes for users_users table
+define('REAL_NAME_COL_SIZE', 64);
+
+define('BITUSER_CONTENT_TYPE_GUID', 'bituser' );
+
+// some definitions for helping with authentication
+define("USER_VALID", 2);
+define("SERVER_ERROR", -1);
+define("PASSWORD_INCORRECT", -3);
+define("USER_NOT_FOUND", -5);
+define("ACCOUNT_DISABLED", -6);
+
+/**
+* Class that holds all information for a given user
+*
+* @author spider <spider@steelsun.com>
+* @version $Revision: 1.1 $
+* @package BitUser
+*/
+class BitUser extends LibertyAttachable {
+/**
+* associative hash of all entries from tiki_user_preferences
+* @access public
+*/
+ var $mUserPrefs;
+ var $mUserId;
+ var $mUsername;
+ var $mGroups;
+ var $mInfo;
+ var $mTicket;
+ // used by LDAP to hold email and real_name temporarily
+ var $mTmpStore;
+
+/**
+* Constructor - will automatically load all relevant data if passed a user string
+*
+* @access public
+* @author author<author@phpshop.org>
+* @return returnString
+*/
+ function BitUser( $pUserId=NULL, $pContentId=NULL ) {
+ LibertyAttachable::LibertyAttachable();
+ $this->registerContentType( BITUSER_CONTENT_TYPE_GUID, array(
+ 'content_type_guid' => BITUSER_CONTENT_TYPE_GUID,
+ 'content_description' => 'User Information',
+ 'handler_class' => 'BitUser',
+ 'handler_package' => 'users',
+ 'handler_file' => 'BitUser.php',
+ 'maintainer_url' => 'http://www.bitweaver.org'
+ ) );
+ $this->mUserId = (is_numeric( $pUserId ) ? $pUserId : NULL);
+ $this->mContentId = $pContentId;
+ }
+
+ function assumeUser( $pUserId ) {
+ global $gBitUser, $user_cookie_site;
+ $ret = FALSE;
+ // make double sure the current logged in user has permission
+ if( $gBitUser->hasPermission( 'bit_p_admin_users' ) ) {
+ $_SESSION[$user_cookie_site] = $pUserId;
+ $ret = TRUE;
+ }
+ return $ret;
+ }
+
+/**
+* load - loads all settings & preferences for this user
+*
+* @access public
+* @author Chrstian Fowler <spider@steelsun.com>
+* @return returnString
+*/
+ function load( $pFull=FALSE, $pUserName=NULL ) {
+ $this->mInfo = NULL;
+ if( isset( $this->mUserId ) ) {
+ $whereSql = "WHERE uu.`user_id`=?";
+ $bindVars = array( $this->mUserId );
+ } elseif( isset( $this->mContentId ) ) {
+ $whereSql = "WHERE uu.`content_id`=?";
+ $bindVars = array( $this->mContentId );
+ } elseif( !empty( $pUserName ) ) {
+ $whereSql = "WHERE uu.`login`=?";
+ $bindVars = array( $pUserName );
+ }
+ if( isset( $whereSql ) ) {
+ $fullSelect = '';
+ $fullJoin = '';
+ if( $pFull ) {
+ $fullSelect = ' , tc.* ';
+ $fullJoin = " LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON ( uu.`content_id`=tc.`content_id` )";
+ }
+ // uu.`user_id` AS `uu_user_id` is last and aliases to avoid possible column name collisions
+ $query = "select uu.*, uu.`login` AS `user`, tf_ava.`storage_path` AS `avatar_storage_path`, tf_por.`storage_path` AS `portrait_storage_path`, tf_logo.`storage_path` AS `logo_storage_path` $fullSelect, uu.`user_id` AS `uu_user_id`
+ FROM `".BIT_DB_PREFIX."users_users` uu
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_attachments` ta_ava ON ( uu.`avatar_attachment_id`=ta_ava.`attachment_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_files` tf_ava ON ( tf_ava.`file_id`=ta_ava.`foreign_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_attachments` ta_por ON ( uu.`portrait_attachment_id`=ta_por.`attachment_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_files` tf_por ON ( tf_por.`file_id`=ta_por.`foreign_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_attachments` ta_logo ON ( uu.`logo_attachment_id`=ta_logo.`attachment_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_files` tf_logo ON ( tf_logo.`file_id`=ta_logo.`foreign_id` )
+ $fullJoin
+ $whereSql";
+
+ if( ($result = $this->query( $query, $bindVars )) && $result->numRows() ) {
+ $this->mInfo = $result->fields;
+ $this->mInfo['valid'] = !empty( $result->fields['uu_user_id'] );
+ $this->mInfo['user_id'] = $result->fields['uu_user_id'];
+ $this->mUserId = $result->fields['uu_user_id'];
+ $this->mContentId = $result->fields['content_id'];
+ $this->mUsername = $result->fields['login'];
+ $this->mInfo['is_registered'] = $this->isRegistered();
+ $this->mInfo['avatar_url'] = (!empty($this->mInfo['avatar_storage_path']) ? BIT_ROOT_URL.$this->mInfo['avatar_storage_path'] : NULL);
+ $this->mInfo['portrait_url'] = (!empty($this->mInfo['portrait_storage_path']) ? BIT_ROOT_URL.$this->mInfo['portrait_storage_path']: NULL);
+ $this->mInfo['logo_url'] = (!empty($this->mInfo['logo_storage_path']) ? BIT_ROOT_URL.$this->mInfo['logo_storage_path'] : NULL);
+ $this->mInfo['avatar_path'] = (!empty($this->mInfo['avatar_storage_path']) ? BIT_ROOT_PATH.$this->mInfo['avatar_storage_path'] : NULL);
+ $this->mInfo['avatar_path'] = (!empty($this->mInfo['portrait_storage_path']) ? BIT_ROOT_PATH.$this->mInfo['portrait_storage_path']: NULL);
+ $this->mInfo['avatar_path'] = (!empty($this->mInfo['logo_storage_path']) ? BIT_ROOT_PATH.$this->mInfo['logo_storage_path'] : NULL);
+ // a few random security conscious unset's - SPIDER
+ unset( $this->mInfo['password'] );
+ unset( $this->mInfo['hash'] );
+ if( $pFull ) {
+ $query = "SELECT `pref_name`, `value` FROM `".BIT_DB_PREFIX."tiki_user_preferences` WHERE `user_id`=?";
+ $this->mUserPrefs = $this->getAssoc( $query, array( $this->mUserId ) );
+ if( isset( $this->mUserPrefs['country'] ) ) {
+ $this->mUserPrefs['flag'] = $this->mUserPrefs['country'];
+ $this->mUserPrefs['country'] = str_replace( '_', ' ', $this->mUserPrefs['country']);
+ }
+ $this->mInfo['display_name'] = ((!empty($this->mInfo['real_name']) ? $this->mInfo['real_name'] :
+ (!empty($this->mUsername) ? $this->mUsername :
+ (!empty($this->mInfo['email']) ? substr($this->mInfo['email'],0, strpos($this->mInfo['email'],'@')) :
+ $this->mUserId))));
+ //print("displayName: ".$this->mInfo['display_name']);
+ $this->defaults();
+ $this->mInfo['publicEmail'] = scrambleEmail( $this->mInfo['email'], (isset($this->mUserPrefs['email is public']) ? $this->mUserPrefs['email is public'] : NULL) );
+ }
+ $this->mTicket = substr(md5(rand() . $this->mUserId), 0, 20);
+ } else {
+ $this->mUserId = NULL;
+ }
+ }
+ return( $this->isValid() );
+ }
+
+
+ function storePreference( $pPrefName, $pPrefValue ) {
+ $ret = FALSE;
+ if( $this->isValid() ) {
+ $this->mUserPrefs[$pPrefName] = $pPrefValue;
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_preferences` where `user_id`=? and `pref_name`=?";
+ $bindvars=array( $this->mUserId, $pPrefName );
+ $result = $this->query($query, $bindvars);
+ $query = "insert into `".BIT_DB_PREFIX."tiki_user_preferences`(`user_id`,`pref_name`,`value`) values(?, ?, ?)";
+ $bindvars[]=$pPrefValue;
+ $result = $this->query($query, $bindvars);
+ $ret = TRUE;
+ }
+ return $ret;
+ }
+
+
+ function getPreference( $pPrefName, $pPrefDefault=NULL, $pUserId = NULL ) {
+ // ATS - Added ability to query a preference for any user
+ $ret = NULL;
+ if (!$pUserId) {
+ $pUserId = $this->mUserId;
+ }
+
+ if ($pUserId && ($pUserId != $this->mUserId) && !empty($pPrefName)) {
+ // Get a user preference for an arbitrary user
+ $sql = "SELECT `value` FROM `".BIT_DB_PREFIX."tiki_user_preferences` WHERE `pref_name` = ? and `user_id` = ?";
+
+ $rs = $this->query($sql, array($pPrefName, $pUserId));
+ $ret = (!empty($rs->fields['value'])) ? $rs->fields['value'] : $pPrefDefault;
+ } else {
+ if( isset( $this->mUserPrefs ) && isset( $this->mUserPrefs[$pPrefName] ) ) {
+ $ret = $this->mUserPrefs[$pPrefName];
+ } else {
+ $ret = $pPrefDefault;
+ }
+ }
+ return $ret;
+ }
+
+
+ function defaults() {
+ global $gBitSystem;
+ if( empty( $this->mUserPrefs['user_information'] ) ) { $this->mUserPrefs['user_information'] = 'public'; }
+ if( empty( $this->mUserPrefs['allowMsgs'] ) ) { $this->mUserPrefs['allowMsgs'] = 'y'; }
+ if( empty( $this->mUserPrefs['display_timezone'] ) ) {
+ $server_time = new Date();
+ $this->mUserPrefs['display_timezone'] = $server_time->tz->getID();
+ }
+ if( empty( $this->mUserPrefs['userbreadCrumb'] ) ) {
+ $this->mUserPrefs['userbreadCrumb'] = $gBitSystem->getPreference('userbreadCrumb',4);
+ }
+ if( empty( $this->mUserPrefs['tikilanguage'] ) ) {
+ global $gBitLanguage;
+ $this->mUserPrefs['tikilanguage'] = $gBitLanguage->mLanguage;
+ }
+ if( empty( $this->mUserPrefs['theme'] ) ) {
+ global $site_style;
+ $this->mUserPrefs['theme'] = $site_style;
+ }
+ }
+
+
+ // =-=-=-=-=-=-=-=-=-=-=-=-=-= Session & Authentication Related Functions
+
+
+ function updateSession( $pSessionId ) {
+ $now = date("U");
+ $oldy = $now - (5 * 60);
+ $bindVars = array( $now, $pSessionId );
+ $userDelSql = '';
+
+ if( $this->isRegistered() ) {
+ array_push( $bindVars, $this->mUserId );
+ $userDelSql = ' OR `user_id`=?';
+ }
+ $hasSession = $this->getOne( "SELECT `timestamp` FROM `".BIT_DB_PREFIX."tiki_sessions` WHERE `session_id`=? ", array( $pSessionId ) );
+ if( $hasSession ) {
+ $ret = $this->query( "UPDATE `".BIT_DB_PREFIX."tiki_sessions` SET `timestamp`=? WHERE `session_id`=? $userDelSql", $bindVars );
+ } else {
+ if( $this->isRegistered() ) {
+ $query = "insert into `".BIT_DB_PREFIX."tiki_sessions`(`timestamp`,`session_id`,`user_id`) values(?,?,?)";
+ $result = $this->query($query, $bindVars);
+ }
+ }
+ $query = "DELETE from `".BIT_DB_PREFIX."tiki_sessions` where `timestamp`<?";
+ $result = $this->query($query, array($oldy));
+
+ return true;
+ }
+
+ function count_sessions() {
+ $query = "select count(*) from `".BIT_DB_PREFIX."tiki_sessions`";
+ $cant = $this->getOne($query,array());
+ return $cant;
+ }
+
+ function logout() {
+ global $user_cookie_site, $gBitSystem;
+ setcookie($user_cookie_site, '', -3600, $gBitSystem->getPreference('cookie_path'), $gBitSystem->getPreference('cookie_domain') );
+ //session_unregister ('user');
+ unset ($_SESSION[$user_cookie_site]);
+ session_destroy();
+ $this->mUserId = NULL;
+ }
+
+ function isRegistered() {
+ return ( $this->mUserId > ANONYMOUS_USER_ID );
+ }
+
+ function isValid() {
+ return ( !empty( $this->mUserId ) );
+ }
+
+ function isAdmin() {
+// print "PURE VIRTUAL BASE FUNCTION";
+// die;
+ return FALSE;
+ }
+
+ function verify( &$pParamHash ) {
+ global $gBitSystem;
+
+ trim_array( $pParamHash );
+
+ // perhaps someone is importing users and *knows* what they are doing
+ if( !empty( $pParamHash['user_id'] ) && is_numeric( $pParamHash['user_id'] ) ) {
+ $pParamHash['user_store']['user_id'] = $pParamHash['user_id'];
+ }
+ if( !empty( $pParamHash['login'] ) ) {
+ if( $this->userExists( array( 'login' => $pParamHash['login'] ) ) ) {
+ $this->mErrors['login'] = 'The username "'.$pParamHash['login'].'" is already in use';
+ } elseif( preg_match( '/[^A-Za-z0-9_.]/', $pParamHash["login"] ) ) {
+ $this->mErrors['login'] = tra( "Your username can only contain numbers, characters, and underscores." );
+ } else {
+ // LOWER CASE all logins
+ $pParamHash['login'] = strtolower( $pParamHash['login'] );
+ $pParamHash['user_store']['login'] = $pParamHash['login'];
+ }
+ }
+ if( !empty( $pParamHash['real_name'] ) ) {
+ $pParamHash['user_store']['real_name'] = substr( $pParamHash['real_name'], 0, 64 );
+ }
+ if( !empty( $pParamHash['email'] ) ) {
+ // LOWER CASE all emails
+ $pParamHash['email'] = strtolower( $pParamHash['email'] );
+ if( $this->verifyEmail( $pParamHash['email'] ) ) {
+ $pParamHash['user_store']['email'] = strtolower( substr( $pParamHash['email'], 0, 200 ) );
+ }
+ }
+ // check some new user requirements
+ if( !$this->isRegistered() ) {
+ /*if( empty( $pParamHash['login'] ) ) {
+ $this->mErrors['login'] = 'You must enter a username';
+ }*/
+ if( empty( $pParamHash['registration_date'] ) ) {
+ $pParamHash['registration_date'] = date( "U" );
+ }
+ $pParamHash['user_store']['registration_date'] = $pParamHash['registration_date'];
+ if( empty( $pParamHash['email'] ) ) {
+ $this->mErrors['email'] = tra( 'You must enter your email address' );
+ }
+ if( $gBitSystem->isFeatureActive( 'validateUsers' ) ) {
+ $pParamHash['password'] = $this->genPass();
+ $pParamHash['user_store']['provpass'] = substr( md5( $pParamHash['password'] ), 0, 30 );
+ $pParamHash['pass_due'] = 0;
+ } elseif( empty( $pParamHash['password'] ) ) {
+ $this->mErrors['password'] = tra( 'Your password should be at least '.$gBitSystem->getPreference( 'min_pass_length', 4 ).' characters long' );
+ }
+ }
+
+
+ //Validate password here
+ if( !empty( $pParamHash['password'] ) ) {
+ $minPassword = $gBitSystem->getPreference( 'min_pass_length', 4 );
+ if(strlen( $pParamHash['password'] ) < $minPassword ) {
+ $this->mErrors['password'] = tra( 'Your password should be at least '.$minPassword.' characters long' );
+ } elseif( !empty( $pParamHash['password2'] ) && ($pParamHash['password'] != $pParamHash['password2']) ) {
+ $this->mErrors['password'] = tra( 'The passwords do not match' );
+ } elseif( $gBitSystem->isFeatureActive( 'pass_chr_num' ) &&
+ (!preg_match_all( "/[0-9]+/",$pParamHash["password"],$foo ) || !preg_match_all("/[A-Za-z]+/",$pParamHash["password"],$foo)) ) {
+ $this->mErrors['password'] = tra( 'Password must contain both letters and numbers' );
+ } else {
+ // Generate a unique hash
+ $pParamHash['user_store']['hash'] = md5( $pParamHash['login'].$pParamHash['password'].$pParamHash['email'] );
+ $now = date("U");
+ if( !isset( $pParamHash['pass_due'] ) && $gBitSystem->getPreference('pass_due') ) {
+ $pParamHash['user_store']['pass_due'] = $now + (60 * 60 * 24 * $gBitSystem->getPreference('pass_due') );
+ } elseif( isset( $pParamHash['pass_due'] ) ) {
+ // renew password only next half year ;)
+ $pParamHash['user_store']['pass_due'] = $now + (60 * 60 * 24 * $pParamHash['pass_due']);
+ }
+ if( $gBitSystem->isFeatureActive( 'feature_clear_passwords' ) || !empty( $pParamHash['user_store']['provpass'] ) ) {
+ $pParamHash['user_store']['password'] = $pParamHash['password'];
+ }
+ }
+ }
+ return( count( $this->mErrors ) == 0 );
+ }
+
+ function verifyEmail( $pEmail, $pValidate = FALSE ) {
+ global $gBitSystem, $gDebug;
+ $HTTP_HOST=$_SERVER['SERVER_NAME'];
+ $ret = FALSE;
+ if( !empty( $this ) ) {
+ $errors = &$this->mErrors;
+ } else {
+ $errors = array();
+ }
+ if( !empty( $this ) && is_object( $this ) ) {
+ // we might be having this called statically
+ $userInfo = $this->getUserInfo( array( 'email' => $pEmail ) );
+ }
+ if( !eregi (
+ '^[-!#$%&\`*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
+ '(localhost|[-!$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
+ '[-!$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+)$'
+ , $pEmail ) ) {
+ $errors['email'] = 'The email address "'.$pEmail.'" is invalid.';
+ } elseif( !empty( $userInfo['user_id'] ) ) {
+ $errors['email'] = 'The email address "'.$pEmail.'" has already been registered.';
+ } elseif( $gBitSystem->isFeatureActive( 'validateUsers' ) ) {
+ list ( $Username, $domain ) = split ("@",$pEmail);
+ // That MX(mail exchanger) record exists in domain check .
+ // checkdnsrr function reference : http://www.php.net/manual/en/function.checkdnsrr.php
+ if ( checkdnsrr ( $domain, "MX" ) ) {
+ if($gDebug) echo "Confirmation : MX record about {$domain} exists.<br>";
+ // If MX record exists, save MX record address.
+ // getmxrr function reference : http://www.php.net/manual/en/function.getmxrr.php
+ if ( getmxrr ($domain, $MXHost)) {
+ if($gDebug) {
+ echo "Confirmation : Is confirming address by MX LOOKUP.<br>";
+ for ( $i = 0,$j = 1; $i < count ( $MXHost ); $i++,$j++ ) {
+ echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Result($j) - $MXHost[$i]<BR>";
+ }
+ }
+ }
+ // Getmxrr function does to store MX record address about $domain in arrangement form to $MXHost.
+ // $ConnectAddress socket connection address.
+ $ConnectAddress = $MXHost[0];
+ } else {
+ // If there is no MX record simply @ to next time address socket connection do .
+ $ConnectAddress = $domain;
+ if ($gDebug) echo "Confirmation : MX record about {$domain} does not exist.<br>";
+ }
+ if( !$pValidate ) { // Skip the connecting test if it didn't work the first time
+ // fsockopen function reference : http://www.php.net/manual/en/function.fsockopen.php
+ $Connect = @fsockopen ( $ConnectAddress, 25 );
+ // Success in socket connection
+ if ($Connect) {
+ if ($gDebug) echo "Connection succeeded to {$ConnectAddress} SMTP.<br>";
+ // Judgment is that service is preparing though begin by 220 getting string after connection .
+ // fgets function reference : http://www.php.net/manual/en/function.fgets.php
+ // A "Real domain name required for sender address"
+ if ( ereg ( "^220", $Out = fgets ( $Connect, 1024 ) ) ) {
+ // Inform client's reaching to server who connect.
+ if( $gBitSystem->hasValidSenderEmail() ) {
+ $senderEmail = $gBitSystem->getPreference( 'sender_email' );
+ fputs ( $Connect, "HELO $HTTP_HOST\r\n" );
+if ($gDebug) echo "Run : HELO $HTTP_HOST<br>";
+ $Out = fgets ( $Connect, 1024 ); // Receive server's answering cord.
+ // Inform sender's address to server.
+ fputs ( $Connect, "MAIL FROM: <{$senderEmail}>\r\n" );
+if ($gDebug) echo "Run : MAIL FROM: &lt;{$senderEmail}&gt;<br>";
+ $From = fgets ( $Connect, 1024 ); // Receive server's answering cord.
+ // Inform listener's address to server.
+ fputs ( $Connect, "RCPT TO: <{$pEmail}>\r\n" );
+if ($gDebug) echo "Run : RCPT TO: &lt;{$pEmail}&gt;<br>";
+ $To = fgets ( $Connect, 1024 ); // Receive server's answering cord.
+ // Finish connection.
+ fputs ( $Connect, "QUIT\r\n");
+if ($gDebug) echo "Run : QUIT<br>";
+ fclose($Connect);
+ // Server's answering cord about MAIL and TO command checks.
+ // Server about listener's address reacts to 550 codes if there does not exist
+ // checking that mailbox is in own E-Mail account.
+ if ( !ereg ( "^250", $From ) || !ereg ( "^250", $To )) {
+ $errors['email'] = $pEmail." is not recognized by the mail server";
+ }
+ }
+ }
+ } else {
+ $errors['email'] = "Cannot connect to mail server ({$ConnectAddress}).";
+ }
+ }
+ }
+ return( count( $errors ) == 0 );
+ }
+
+
+ function store( &$pParamHash ) {
+ if( $this->verify( $pParamHash ) ) {
+ $this->mDb->StartTrans();
+ $pParamHash['content_type_guid'] = BITUSER_CONTENT_TYPE_GUID;
+
+ if( !empty( $pParamHash['user_store'] ) && count( $pParamHash['user_store'] ) ) {
+ if( $this->isValid() ) {
+ $userId = array ( "name" => "user_id", "value" => $this->mUserId );
+ $result = $this->associateUpdate( BIT_DB_PREFIX.'users_users', $pParamHash['user_store'], $userId );
+ } else {
+ if( empty( $pParamHash['user_store']['user_id'] ) ) {
+ $pParamHash['user_store']['user_id'] = $this->GenID( 'users_users_user_id_seq' );
+ }
+ $this->mUserId = $pParamHash['user_store']['user_id'];
+ $result = $this->associateInsert( BIT_DB_PREFIX.'users_users', $pParamHash['user_store'] );
+ }
+ }
+ // Prevent liberty from assuming ANONYMOUS_USER_ID while storing
+ $pParamHash['user_id'] = $this->mUserId;
+
+ if( LibertyContent::store( $pParamHash ) ) {
+ if( empty( $this->mInfo['content_id'] ) || ($pParamHash['content_id'] != $this->mInfo['content_id']) ) {
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `content_id`=? WHERE `user_id`=?";
+ $result = $this->query( $query, array( $pParamHash['content_id'], $this->mUserId ) );
+ $this->mInfo['content_id'] = $pParamHash['content_id'];
+ }
+ }
+ $pParamHash['upload']['thumbnail'] = FALSE;
+ if( isset($_FILES['fPortraitFile']) && is_uploaded_file( $_FILES['fPortraitFile']['tmp_name'] ) ) {
+ $pParamHash['upload'] = $_FILES['fPortraitFile'];
+ if( !$this->storePortrait( $pParamHash, (!empty( $pParamHash['fAutoAvatar'] ) ? TRUE : FALSE) ) ) {
+ }
+ }
+
+ if( isset($_FILES['fAvatarFile']) && is_uploaded_file($_FILES['fAvatarFile']['tmp_name']) && $_FILES['fAvatarFile']['size'] > 0 ) {
+ $pParamHash['upload'] = $_FILES['fAvatarFile'];
+ $pParamHash['upload']['source_file'] = $_FILES['fAvatarFile']['tmp_name'];
+ if( !$this->storeAvatar( $pParamHash ) ) {
+ }
+ }
+
+ if( isset($_FILES['fLogoFile']) && is_uploaded_file($_FILES['fLogoFile']['tmp_name']) && $_FILES['fLogoFile']['size'] > 0 ) {
+ $pParamHash['upload'] = $_FILES['fLogoFile'];
+ $pParamHash['upload']['source_file'] = $_FILES['fLogoFile']['tmp_name'];
+ if( !$this->storeLogo( $pParamHash ) ) {
+ }
+ }
+
+ $this->mDb->CompleteTrans();
+ $this->load( TRUE );
+ }
+ return( count( $this->mErrors ) == 0 );
+ }
+
+
+
+ // removes user and associated private data
+ function expunge( $pUserId ) {
+ global $gBitSystem;
+ $this->mDb->StartTrans();
+ if( $_REQUEST["user_id"] != ANONYMOUS_USER_ID ) {
+ $userTables = array(
+ 'users_groups_map',
+ 'tiki_semaphores',
+ 'tiki_user_bookmarks_urls',
+ 'tiki_user_bookmarks_folders',
+ 'tiki_user_menus',
+ 'tiki_user_tasks',
+ 'tiki_user_preferences',
+ 'tiki_user_watches',
+ 'users_users',
+ );
+ foreach( $userTables as $table ) {
+ $query = "delete from `".BIT_DB_PREFIX.$table."` where `user_id` = ?";
+ $result = $this->query($query, array( $pUserId ) );
+ }
+ $this->mDb->CompleteTrans();
+ return TRUE;
+ } else {
+ $this->mDb->RollbackTrans();
+ $gBitSystem->fatalError( tra( 'The anonymous user cannot be deleted' ) );
+ }
+ }
+
+ function genPass( $pLength=NULL ) {
+ global $gBitSystem;
+ // AWC: enable mixed case and digits, don't return too short password
+ global $min_pass_length;
+ $vocales = "AaEeIiOoUu13580";
+ $consonantes = "BbCcDdFfGgHhJjKkLlMmNnPpQqRrSsTtVvWwXxYyZz24679";
+ $r = '';
+ if( empty( $pLength ) || !is_numeric( $pLength ) ) {
+ $pLength = $gBitSystem->getPreference( 'min_pass_length', 4 );
+ }
+ for ($i = 0; $i < $pLength; $i++) {
+ if ($i % 2) {
+ $r .= $vocales{rand(0, strlen($vocales) - 1)};
+ } else {
+ $r .= $consonantes{rand(0, strlen($consonantes) - 1)};
+ }
+ }
+ return $r;
+ }
+
+ function generateChallenge() {
+ return( md5(BitSystem::genPass()) );
+ }
+
+ function validate_hash($user, $hash) {
+ return $this->mDb->getOne( "select count(*) from `".BIT_DB_PREFIX."users_users` where " . $this->convert_binary(). " `login` = ? and `hash`=?", array($user, $hash) );
+ }
+
+ function login( $pLogin, $pPassword, $pChallenge=NULL, $pResponse=NULL ) {
+ global $gBitSystem, $user_cookie_site;
+ $isvalid = false;
+ // Verify user is valid
+ if( $this->validate_user($pLogin, $pPassword, $pChallenge, $pResponse) ) {
+ $loginCol = strpos( $pLogin, '@' ) ? 'email' : 'login';
+ $userInfo = $this->getUserInfo( array( $loginCol => $pLogin ) );
+ // If the password is valid but it is due then force the user to change the password by
+ // sending the user to the new password change screen without letting him use tiki
+ // The user must re-nter the old password so no secutiry risk here
+ if( $this->isPasswordDue() ) {
+ // Redirect the user to the screen where he must change his password.
+ // Note that the user is not logged in he's just validated to change his password
+ // The user must re-enter his old password so no secutiry risk involved
+ $url = USERS_PKG_URL.'change_password.php?user_id='.$userInfo['user_id']. '&oldpass=' . urlencode($pPassword);
+ } elseif( $userInfo['user_id'] != ANONYMOUS_USER_ID ) {
+ // User is valid and not due to change pass.. start session
+ //session_register('user',$user);
+ $_SESSION[$user_cookie_site] = $userInfo['user_id']; // ATS - It appears this should be user_id here (instead of $pUserName like it was)
+ $url = isset($_SESSION['loginfrom']) ? $_SESSION['loginfrom'] : $gBitSystem->getDefaultPage();
+ //unset session variable in case user su's
+ unset($_SESSION['loginfrom']);
+ // Now if the remember me feature is on and the user checked the rememberme checkbox then ...
+ if ($gBitSystem->isFeatureActive( 'rememberme' ) ) {
+ if (isset($_REQUEST['rme']) && $_REQUEST['rme'] == 'on') {
+ setcookie($user_cookie_site, $userInfo['hash'], (int)(time() + $gBitSystem->getPreference( 'remembertime' )), $gBitSystem->getPreference('cookie_path'), $gBitSystem->getPreference('cookie_domain') );
+ }
+ } else {
+ setcookie(BIT_SESSION_NAME, $userInfo['hash']);
+ }
+ }
+ } else {
+ $url = USERS_PKG_URL.'login.php?error=' . urlencode(tra('Invalid username or password'));
+ }
+ $https_mode = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
+ if ($https_mode) {
+ $stay_in_ssl_mode = isset($_REQUEST['stay_in_ssl_mode']) && $_REQUEST['stay_in_ssl_mode'] == 'on';
+ if (!$stay_in_ssl_mode) {
+ $http_domain = $gBitSystem->getPreference('http_domain', false);
+ $http_port = $gBitSystem->getPreference('http_port', 80);
+ $http_prefix = $gBitSystem->getPreference('http_prefix', '/');
+ if ($http_domain) {
+ $prefix = 'http://' . $http_domain;
+ if ($http_port != 80)
+ $prefix .= ':' . $http_port;
+ $prefix .= $https_prefix;
+ $url = $prefix . $url;
+ if (SID)
+ $url .= '?' . SID;
+ }
+ }
+ }
+ return( $url );
+ }
+
+ function validate_user($user, $pass, $challenge, $response) {
+ global $gBitSystem;
+ // these will help us keep tabs of what is going on
+ $userTikiValid = false;
+ $userTikiPresent = false;
+ $userAuthValid = false;
+ $userAuthPresent = false;
+ // see if we are to use PEAR::Auth
+ $auth_pear = ($gBitSystem->getPreference("auth_method", "tiki") == "auth");
+ $create_tiki = ($gBitSystem->getPreference("auth_create_gBitDbUser", "n") == "y");
+ $create_auth = ($gBitSystem->getPreference("auth_create_user_auth", "n") == "y");
+ $skip_admin = ($gBitSystem->getPreference("auth_skip_admin", "n") == "y");
+ // first attempt a login via the standard Tiki system
+ $userId = $this->validate_gBitDbUser($user, $pass, $challenge, $response);
+ if ($userId) {
+ $userTikiValid = true;
+ $userTikiPresent = true;
+ } elseif ($this->mErrors['login'] == 'Password incorrect') {
+ $userTikiPresent = true;
+ } elseif ($this->mErrors['login'] == 'User not found') {
+ }
+ // if we aren't using LDAP this will be quick
+ if ( !$auth_pear || ($user == "admin" && $skip_admin) ) {
+ // TODO nothing here yet, as skip_admin is broken - wolff_borg
+ } elseif ( $auth_pear ) {
+ // next see if we need to check LDAP
+ // check the user account
+ $result = $this->validate_user_auth($user, $pass);
+ switch ($result) {
+ case USER_VALID:
+ unset($this->mErrors['login']);
+ $userAuthValid = true;
+ $userAuthPresent = true;
+ break;
+ case PASSWORD_INCORRECT:
+ $this->mErrors['login'] = 'Password incorrect';
+ $userAuthPresent = true;
+ break;
+ case USER_NOT_FOUND:
+ // disable this error as user may have an account in Tiki only - wolff_borg
+ //$this->mErrors['login'] = 'User not found';
+ break;
+
+ }
+ }
+/*
+echo "userId: $userId<br>";
+echo "auth_pear: $auth_pear<br>";
+echo "create_tiki: $create_tiki<br>";
+echo "create_auth: $create_auth<br>";
+echo "skip_admin: $skip_admin<br>";
+echo "userTikiValid: $userTikiValid<br>";
+echo "userAuthValid: $userAuthValid<br>";
+echo "userTikiPresent: $userTikiPresent<br>";
+echo "userAuthPresent: $userAuthPresent<br>";
+*/
+ // start off easy
+ // if the user verified in Tiki and Auth, or
+ // was not present in either, than skip all this
+ if ( $auth_pear ) {
+//echo "1<br>";
+ // if the user was logged into Tiki but not found in Auth
+ // see if we can create a new account
+ if ( $create_auth && $userTikiPresent && !$userAuthPresent ) {
+//echo "2<br>";
+ // need to make this better! *********************************************************
+ $result = $this->create_user_auth($user, $pass);
+ // if the server didn't work, do something!
+ if ($result == SERVER_ERROR || $result != USER_VALID) {
+ $this->mErrors['login'] = 'Auth server error creating user';
+ }
+ }
+ // if the user was logged into Auth but not found in Tiki
+ // see if we can create a new account
+ elseif( $create_tiki && $userAuthValid && !$userTikiPresent ) {
+//echo "3<br>";
+//echo "user: $user<br>";
+//echo "pass: $pass<br>";
+ // need to make this better! *********************************************************
+ // if it worked ok, just log in
+ $authUserInfo = array( 'login' => $user, 'password' => $pass, 'real_name' => $this->mTmpStore['real_name'], 'email' => $this->mTmpStore['email'] );
+ // TODO somehow, mUserId gets set to -1 at this point - no idea how
+ // set to NULL to prevent overwriting Guest user - wolff_borg
+ $this->mUserId = NULL;
+//echo "mUserId: ".$this->mUserId."<br>";
+ if ( $this->store( $authUserInfo ) ) {
+ $userId = $this->mUserId;
+ }
+ }
+ // if the user was logged into Auth but not found in Tiki
+ // see if we can create a new account
+ elseif( $userAuthValid && $userTikiPresent ) {
+//echo "4<br>";
+//echo "user: $user<br>";
+ $real_name = $this->mTmpStore['real_name'];
+ $email = $this->mTmpStore['email'];
+ $userInfo = $this->getUserInfo(array('login' => $user ));
+//vd($userInfo);
+ $this->mUserId = $userInfo['user_id'];
+ $authUserInfo = array( 'login' => $user, 'password' => $pass, 'real_name' => $real_name, 'email' => $email );
+ $this->store( $authUserInfo );
+ # TODO: Fix this - if user is an LDAP user, with a TIKI user already created,
+ # storing user info causes errors. NEED TO FIX - wolff_borg
+ $this->mErrors = array();
+ }
+ }
+ if( $userId ) {
+//echo "5<br>";
+ $this->update_lastlogin( $userId );
+ $this->mUserId = $userId;
+ }
+//echo "6<br>";
+//vd($this->mErrors);
+ return( count( $this->mErrors ) == 0 );
+ }
+ // validate the user in the PEAR::Auth system
+ function validate_user_auth($user, $pass) {
+ global $gBitSystem;
+ require_once (UTIL_PKG_PATH."pear/Auth/Auth.php");
+ // just make sure we're supposed to be here
+ if ($gBitSystem->getPreference("auth_method", "tiki") != "auth")
+ return false;
+ // get all of the LDAP options from the database
+ $options["host"] = $gBitSystem->getPreference("auth_ldap_host", "localhost");
+ $options["port"] = $gBitSystem->getPreference("auth_ldap_port", "389");
+ $options["scope"] = $gBitSystem->getPreference("auth_ldap_scope", "sub");
+ $options["basedn"] = $gBitSystem->getPreference("auth_ldap_basedn", "");
+ $options["userdn"] = $gBitSystem->getPreference("auth_ldap_userdn", "");
+ $options["userattr"] = $gBitSystem->getPreference("auth_ldap_userattr", "uid");
+ $options["useroc"] = $gBitSystem->getPreference("auth_ldap_useroc", "posixAccount");
+ $options["groupdn"] = $gBitSystem->getPreference("auth_ldap_groupdn", "");
+ $options["groupattr"] = $gBitSystem->getPreference("auth_ldap_groupattr", "cn");
+ $options["groupoc"] = $gBitSystem->getPreference("auth_ldap_groupoc", "groupOfUniqueNames");
+ $options["memberattr"] = $gBitSystem->getPreference("auth_ldap_memberattr", "uniqueMember");
+ $options["memberisdn"] = ($gBitSystem->getPreference("auth_ldap_memberisdn", "y") == "y");
+ $options["adminuser"] = $gBitSystem->getPreference("auth_ldap_adminuser", "");
+ $options["adminpass"] = $gBitSystem->getPreference("auth_ldap_adminpass", "");
+
+ // set the Auth options
+ $a = new Auth("LDAP", $options, "", false, $user, $pass);
+ // check if the login correct
+ $a->login();
+ $ret = '';
+ switch ($a->getStatus()) {
+ case AUTH_LOGIN_OK:
+ $ret=USER_VALID;
+ $ds=ldap_connect($options["host"], $options["port"]); // Connects to LDAP Server
+ if ($ds) {
+ $r=ldap_bind($ds, $options["adminuser"], $options["adminpass"]);
+ $attrs = array("cn", "mail");
+ $sr=ldap_search($ds, $options["basedn"], "(".$options["userattr"]."=".$user.")", $attrs); // Search
+ $info = ldap_get_entries($ds, $sr);
+ $this->mTmpStore["real_name"] = $info[0]["cn"][0];
+ $this->mTmpStore["email"] = $info[0]["mail"][0];
+ ldap_close($ds);
+ }
+ break;
+ case AUTH_USER_NOT_FOUND:
+ $ret=USER_NOT_FOUND;
+ break;
+ case AUTH_WRONG_LOGIN:
+ $ret=PASSWORD_INCORRECT;
+ break;
+ default:
+ $ret=SERVER_ERROR;
+ break;
+ }
+ return $ret;
+ }
+
+ // validate the user in the Tiki database
+ function validate_gBitDbUser( $pLogin, $pass, $challenge, $response ) {
+ global $gBitSystem;
+ $ret = NULL;
+ if( empty( $pLogin ) ) {
+ $this->mErrors['login'] = 'User not found';
+ } elseif( empty( $pass ) ) {
+ $this->mErrors['login'] = 'Password incorrect';
+ } else {
+ $loginCol = strpos( $pLogin, '@' ) ? 'email' : 'login';
+ // first verify that the user exists
+ $query = "select `email`, `login`, `user_id`, `password` from `".BIT_DB_PREFIX."users_users` where " . $this->convert_binary(). " UPPER(`$loginCol`) = ?";
+ $result = $this->query( $query, array( strtoupper($pLogin) ) );
+ if( !$result->numRows() ) {
+ $this->mErrors['login'] = 'User not found';
+ } else {
+ $res = $result->fetchRow();
+ $userId = $res['user_id'];
+ $user = $res['login'];
+ $hash = md5($user . $pass . trim($res['email']));
+ $hash2 = md5($pass);
+ // next verify the password with 2 hashes methods, the old one (pass)) and the new one (login.pass;email)
+ // TODO - this needs cleaning up - wolff_borg
+ if( !$gBitSystem->isFeatureActive( 'feature_challenge' ) || empty($response) ) {
+ $query = "select `user_id` from `".BIT_DB_PREFIX."users_users` where " . $this->convert_binary(). " `$loginCol` = ? and (`hash`=? or `hash`=?)";
+ $result = $this->query( $query, array( $pLogin, $hash, $hash2 ) );
+ if ($result->numRows()) {
+ $query = "update `".BIT_DB_PREFIX."users_users` set `last_login`=`current_login`, `current_login`=? where `user_id`=?";
+ $result = $this->query($query, array( (int)date("U"), $userId ));
+ $ret = $userId;
+ } else {
+ $this->mErrors['login'] = 'Password incorrect';
+ }
+ } else {
+ // Use challenge-reponse method
+ // Compare pass against md5(user,challenge,hash)
+ $hash = $this->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $this->convert_binary(). " `$loginCol`=?", array( $pLogin ) );
+ if (!isset($_SESSION["challenge"])) {
+ $this->mErrors['login'] = 'Invalid challenge';
+ }
+ //print("pass: $pass user: $user hash: $hash <br/>");
+ //print("challenge: ".$_SESSION["challenge"]." challenge: $challenge<br/>");
+ //print("response : $response<br/>");
+ if ($response == md5($user . $hash . $_SESSION["challenge"])) {
+ $ret = $userId;
+ $this->update_lastlogin( $userId );
+ } else {
+ $this->mErrors['login'] = 'Invalid challenge';
+ }
+ }
+ }
+ }
+ return( $ret );
+ }
+ // update the lastlogin status on this user
+ function update_lastlogin( $pUserId ) {
+ $ret = FALSE;
+ if( is_numeric( $pUserId ) ) {
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `last_login`=`current_login`, `current_login`=?
+ WHERE `user_id`=?";
+ $result = $this->query( $query, array( (int)date("U"), $pUserId ) );
+ $ret = TRUE;
+ }
+ return $ret;
+ }
+ // create a new user in the Auth directory
+ function create_user_auth($user, $pass) {
+ global $gBitSystem;
+ $options = array();
+ $options["host"] = $gBitSystem->getPreference("auth_ldap_host", "localhost");
+ $options["port"] = $gBitSystem->getPreference("auth_ldap_port", "389");
+ $options["scope"] = $gBitSystem->getPreference("auth_ldap_scope", "sub");
+ $options["basedn"] = $gBitSystem->getPreference("auth_ldap_basedn", "");
+ $options["userdn"] = $gBitSystem->getPreference("auth_ldap_userdn", "");
+ $options["userattr"] = $gBitSystem->getPreference("auth_ldap_userattr", "uid");
+ $options["useroc"] = $gBitSystem->getPreference("auth_ldap_useroc", "posixAccount");
+ $options["groupdn"] = $gBitSystem->getPreference("auth_ldap_groupdn", "");
+ $options["groupattr"] = $gBitSystem->getPreference("auth_ldap_groupattr", "cn");
+ $options["groupoc"] = $gBitSystem->getPreference("auth_ldap_groupoc", "groupOfUniqueNames");
+ $options["memberattr"] = $gBitSystem->getPreference("auth_ldap_memberattr", "uniqueMember");
+ $options["memberisdn"] = ($gBitSystem->getPreference("auth_ldap_memberisdn", "y") == "y");
+ $options["adminuser"] = $gBitSystem->getPreference("auth_ldap_adminuser", "");
+ $options["adminpass"] = $gBitSystem->getPreference("auth_ldap_adminpass", "");
+ // set additional attributes here
+ $userattr = array();
+ $userattr["email"] = $this->getOne("select `email` from `".BIT_DB_PREFIX."users_users`
+ where `login`=?", array($user));
+ // set the Auth options
+ $a = new Auth("LDAP", $options);
+ // check if the login correct
+ if ($a->addUser($user, $pass, $userattr) === true)
+ $status = USER_VALID;
+ // otherwise use the error status given back
+ else
+ $status = $a->getStatus();
+ return $status;
+ }
+
+ function get_users_names($offset = 0, $maxRecords = -1, $sort_mode = 'login_desc', $find = '') {
+ // Return an array of users indicating name, email, last changed pages, versions, last_login
+ if ($find) {
+ $findesc = '%' . strtoupper( $find ) . '%';
+ $mid = " where UPPER(`login`) like ?";
+ $bindvars = array($findesc);
+ } else {
+ $mid = '';
+ $bindvars=array();
+ }
+ $query = "select `login` from `".BIT_DB_PREFIX."users_users` $mid order by ".$this->convert_sortmode($sort_mode);
+ $result = $this->query($query,$bindvars,$maxRecords,$offset);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res["login"];
+ }
+ return ($ret);
+ }
+
+ function confirmRegistration( $pUser, $pProvpass ) {
+ $query = "select `user_id`, `provpass`, `password`, `login`, `email` FROM `".BIT_DB_PREFIX."users_users`
+ WHERE `login`=? AND `provpass`=?";
+ return( $this->mDb->GetRow($query, array( $pUser, $pProvpass ) ) );
+ }
+
+
+
+ function change_user_email( $pUserId, $pUsername, $pEmail, $pPass ) {
+ $hash = md5( $pUsername . $pPass . $pEmail );
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `email`=?, `hash`=? WHERE " . $this->convert_binary(). " `user_id`=?";
+ $result = $this->query( $query, array( $pEmail, $hash, $pUserId ) );
+ $query = "UPDATE `".BIT_DB_PREFIX."tiki_user_watches` SET `email`=? WHERE " . $this->convert_binary(). " `user_id`=?";
+ $result = $this->query( $query, array( $pEmail, $pUserId ) );
+ return TRUE;
+ }
+
+
+ function lookupHomepage( $iHomepage ) {
+ $ret = NULL;
+ if (is_numeric($iHomepage)) {
+ // iHomepage is the user_id for the user...
+ $key = 'user_id';
+ } elseif (substr($iHomepage,0,7) == 'mailto:') {
+ // iHomepage is the email address of the user...
+ $key = 'email';
+ } else {
+ // iHomepage is the 'login' of the user...
+ $key = 'login';
+ }
+ $tmpUser = $this->getUserInfo( array( $key => $iHomepage ) );
+ if (!empty($tmpUser['user_id'])) {
+ $ret = $tmpUser['user_id'];
+ }
+ return $ret;
+ }
+
+ // specify lookup where by hash key lik 'login' or 'user_id' or 'email'
+ function getUserInfo( $pUserMixed ) {
+ $ret = NULL;
+ if( is_array( $pUserMixed ) ) {
+ $query = "SELECT uu.* FROM `".BIT_DB_PREFIX."users_users` uu LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_content` tc ON (tc.`content_id`=uu.`content_id`)
+ WHERE uu.`".key( $pUserMixed )."` = ?";
+ $ret = $this->mDb->GetRow( $query, array( current( $pUserMixed ) ) );
+ }
+ return $ret;
+ }
+/*
+ // all of these methods have been replaced by the single getUserInfo method
+ function get_user_info($user, $iCaseSensitive = TRUE) {
+ if (!$iCaseSensitive) {
+ $query = "SELECT * FROM `".BIT_DB_PREFIX."users_users` where LOWER(`login`) = ?";
+ } else {
+ $query = "select * from `".BIT_DB_PREFIX."users_users` where `login`=?";
+ }
+ $result = $this->query($query,array($iCaseSensitive ? $user : strtolower($user)));
+ $res = $result->fetchRow();
+ $groups = $this->getGroups( $res['user_id'] );
+ $res["groups"] = $groups;
+ return $res;
+ }
+ function get_user_info_from_email($email) {
+ $query = "select * from `".BIT_DB_PREFIX."users_users` where `email`=?";
+ $result = $this->query($query,array($email));
+ $res = $result->fetchRow();
+ return $res;
+ }
+ function get_user_password($user) {
+ $query = "select `password` from `".BIT_DB_PREFIX."users_users` where " . $this->convert_binary(). " `login`=?";
+ $pass = $this->getOne($query, array($user));
+ return $pass;
+ }
+ function get_user_hash($user) {
+ $query = "select `hash` from `".BIT_DB_PREFIX."users_users` where " .
+ $this->convert_binary(). " `login` = ?";
+ $pass = $this->getOne($query, array($user));
+ return $pass;
+ }
+*/
+ function getByHash( $hash ) {
+ $query = "select `user_id` from `".BIT_DB_PREFIX."users_users` where `hash`=?";
+ return $this->getOne( $query, array($hash) );
+ }
+
+ // NULL password due means *no* expiration
+ function isPasswordDue() {
+ $ret = FALSE;
+ if( $this->isRegistered() ) {
+ // get user_id to avoid NULL and zero confusion
+ $query = "SELECT `user_id`, `pass_due`
+ FROM `".BIT_DB_PREFIX."users_users`
+ WHERE `pass_due` IS NOT NULL AND `login`=? ";
+ $due = $this->GetAssoc( $query, array( $this->mUserId ) );
+ if( !empty( $due['user_id'] ) ) {
+ $ret = $due['pass_due'] <= date("U");
+ }
+ }
+ return $ret;
+ }
+ function renew_user_password($user) {
+ $pass = BitSystem::genPass();
+ $query = "select `email` from `".BIT_DB_PREFIX."users_users` where `login` = ?";
+ $email = $this->getOne($query, array($user));
+ $hash = md5($user . $pass . $email);
+ // Note that tiki-generated passwords are due inmediatley
+ $now = date("U");
+ $query = "update `".BIT_DB_PREFIX."users_users` set `password` = ?, `hash` = ?, `pass_due` = ? where ".$this->convert_binary()." `login` = ?";
+ $result = $this->query($query, array($pass, $hash, $now, $user));
+ return $pass;
+ }
+
+ function change_user_password( $user, $pass ) {
+ global $gBitSystem;
+ $query = "select `email` from `".BIT_DB_PREFIX."users_users` where `login` = ?";
+ $email = $this->getOne($query, array($user));
+ $email=trim($email);
+ $hash = md5($user . $pass . $email);
+ $now = date("U");
+ $new_pass_due = $now + (60 * 60 * 24 * $gBitSystem->getPreference( 'pass_due' ) );
+ if( !$gBitSystem->isFeatureActive( 'feature_clear_passwords' ) ) {
+ $pass = '';
+ }
+ $query = "update `".BIT_DB_PREFIX."users_users` set `hash`=? ,`password`=? ,`pass_due`=? where " . $this->convert_binary(). " `login`=?";
+ $result = $this->query($query, array($hash,$pass,$new_pass_due,$user));
+ return TRUE;
+ }
+
+ function get_users($offset = 0, $maxRecords = -1, $sort_mode = 'login_desc', $find = '') {
+ $sort_mode = $this->convert_sortmode($sort_mode);
+ // Return an array of users indicating name, email, last changed pages, versions, last_login
+ if ($find) {
+ $findesc = '%' . strtoupper( $find ) . '%';
+ $mid = " where UPPER(`login`) like ?";
+ $bindvars = array($findesc);
+ } else {
+ $mid = '';
+ $bindvars = array();
+ }
+ $query = "select * from `".BIT_DB_PREFIX."users_users` $mid order by $sort_mode";
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."users_users`";
+ $result = $this->query($query, $bindvars, $maxRecords, $offset);
+ $cant = $this->getOne($query_cant, array());
+ $ret = array();
+ while( $res = $result->fetchRow() ) {
+ //$res["groups"] = $this->get_user_groups( $res['login'] );
+ $res["groups"] = $this->getGroups( $res['user_id'] );
+ array_push( $ret, $res );
+ }
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+ /*shared*/
+ function get_online_users() {
+ global $gBitSystem;
+ $query = "select ts.`user_id`, `login` AS `user`, `real_name` ,`timestamp`
+ FROM `".BIT_DB_PREFIX."tiki_sessions` ts INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON (ts.`user_id`=uu.`user_id`)
+ WHERE ts.`user_id` IS NOT NULL";
+ $result = $this->query($query);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $res['user_information'] = $this->getPreference( 'user_information', 'public', $res['user_id'] );
+ $ret[] = $res;
+ }
+ return $ret;
+ }
+
+
+
+
+
+
+
+
+
+
+ // ============= image and file functions
+
+ function storePortrait( &$pStorageHash, $pGenerateAvatar=FALSE ) {
+ if( !empty( $this->mUserId ) && count( $pStorageHash ) ) {
+ // setup the hash for central storage functions
+ $pStorageHash['upload']['max_width'] = PORTRAIT_MAX_DIM;
+ $pStorageHash['upload']['max_height'] = PORTRAIT_MAX_DIM;
+// $pStorageHash['upload']['dest_base_name'] = 'portrait';
+ $pStorageHash['upload']['dest_path'] = $this->getStorageBranch( 'self',$this->mUserId );
+ $pStorageHash['storage_type'] = STORAGE_IMAGE;
+ $pStorageHash['content_type_guid'] = BITUSER_CONTENT_TYPE_GUID;
+
+ $pStorageHash['attachment_id'] = $this->mInfo['portrait_attachment_id'];
+ if( $pGenerateAvatar ) {
+ copy($pStorageHash['upload']['tmp_name'],$pStorageHash['upload']['tmp_name'].'.av');
+ }
+
+ if( LibertyAttachable::store( $pStorageHash ) ) {
+ if($this->mInfo['portrait_attachment_id'] != $pStorageHash['attachment_id'] ) {
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `portrait_attachment_id` = ? WHERE `user_id`=?";
+ $result = $this->query( $query, array( $pStorageHash['attachment_id'], $this->mUserId ) );
+ $this->mInfo['portrait_attachment_id'] = $pStorageHash['attachment_id'];
+ $pStorageHash['portrait_storage_path'] = $pStorageHash['upload']['dest_path'];
+ }
+ if( $pGenerateAvatar ) {
+ $pStorageHash['upload']['tmp_name'] = $pStorageHash['upload']['tmp_name'].'.av';
+ $this->storeAvatar( $pStorageHash );
+ }
+ } else {
+ $this->mErrors['file'] = 'File '.$pStorageHash['name'].' could not be stored.';
+ }
+ }
+ return( count( $this->mErrors ) == 0 );
+ }
+
+
+ function storeAvatar( &$pStorageHash ) {
+ if( !empty( $this->mUserId ) && count( $pStorageHash ) ) {
+ // setup the hash for central storage functions
+ $pStorageHash['upload']['max_width'] = AVATAR_MAX_DIM;
+ $pStorageHash['upload']['max_height'] = AVATAR_MAX_DIM;
+// $pStorageHash['upload']['dest_base_name'] = 'avatar';
+ $pStorageHash['upload']['dest_path'] = $this->getStorageBranch( 'self',$this->mUserId );
+ $pStorageHash['storage_type'] = STORAGE_IMAGE;
+ $pStorageHash['content_type_guid'] = BITUSER_CONTENT_TYPE_GUID;
+
+ $pStorageHash['attachment_id'] = $this->mInfo['avatar_attachment_id'];
+ if( LibertyAttachable::store( $pStorageHash ) ) {
+ if( $this->mInfo['avatar_attachment_id'] != $pStorageHash['attachment_id'] ) {
+ $this->mInfo['avatar_storage_path'] = $pStorageHash['upload']['dest_path'];
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `avatar_attachment_id` = ? WHERE `user_id`=?";
+ $result = $this->query( $query, array( $pStorageHash['attachment_id'], $this->mUserId ) );
+ $this->mInfo['avatar_attachment_id'] = $pStorageHash['attachment_id'];
+ }
+ } else {
+ $this->mErrors['file'] = 'File '.$pStorageHash['upload']['name'].' could not be stored.';
+ }
+ }
+ return( count( $this->mErrors ) == 0 );
+ }
+
+
+ function storeLogo( &$pStorageHash ) {
+ if( !empty( $this->mUserId ) && count( $pStorageHash ) ) {
+ // setup the hash for central storage functions
+ $pStorageHash['upload']['max_width'] = LOGO_MAX_DIM;
+ $pStorageHash['upload']['max_height'] = LOGO_MAX_DIM;
+ $pStorageHash['upload']['dest_path'] = $this->getStorageBranch( 'self',$this->mUserId );
+ $pStorageHash['storage_type'] = STORAGE_IMAGE;
+ $pStorageHash['content_type_guid'] = BITUSER_CONTENT_TYPE_GUID;
+
+ $pStorageHash['attachment_id'] = $this->mInfo['logo_attachment_id'];
+
+ if( LibertyAttachable::store( $pStorageHash ) ) {
+ if($this->mInfo['logo_attachment_id'] != $pStorageHash['attachment_id'] ) {
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `logo_attachment_id` = ? WHERE `user_id`=?";
+ $result = $this->query( $query, array( $pStorageHash['attachment_id'], $this->mUserId ) );
+ $this->mInfo['logo_attachment_id'] = $pStorageHash['attachment_id'];
+ }
+ } else {
+ $this->mErrors['file'] = 'File '.$pStorageHash['name'].' could not be stored.';
+ }
+ }
+ return( count( $this->mErrors ) == 0 );
+ }
+
+ function purgeImage( $pType ) {
+ if( !empty( $this->mUserId ) && !empty( $this->mInfo[$pType.'_attachment_id'] ) ) {
+ $this->mDb->StartTrans();
+ $query = "UPDATE `".BIT_DB_PREFIX."users_users` SET `".$pType."_attachment_id` = NULL WHERE `user_id`=?";
+ $result = $this->query( $query, array( $this->mUserId ) );
+ if( file_exists( $this->mInfo[$pType.'_storage_path'] ) ) {
+ unlink( $this->mInfo[$pType.'_storage_path'] );
+ }
+ unset( $this->mInfo[$pType.'_storage_path'] );
+ unset( $this->mInfo[$pType.'_attachment_id'] );
+ $this->mDb->CompleteTrans();
+ }
+ }
+
+
+ function purgePortrait() {
+ $this->purgeImage( 'portrait' );
+ }
+
+
+ function purgeAvatar() {
+ $this->purgeImage( 'avatar' );
+ }
+
+
+ function purgeLogo() {
+ $this->purgeImage( 'logo' );
+ }
+
+ // Get a list of attachments this user owns
+ function getUserFiles() {
+ global $gLibertySystem;
+ $ret = array();
+ $ret['files'] = NULL;
+ $ret['diskUsage'] = 0;
+
+ if ($this->mUserId) {
+ $query = "SELECT ta.`attachment_id`, ta.`foreign_id`
+ FROM `".BIT_DB_PREFIX."tiki_attachments` ta
+ WHERE ta.`user_id` = ? AND ta.`attachment_plugin_guid` = 'tiki_files'";
+ $result = $this->query($query, array($this->mUserId));
+ $attachmentIds = $result->getRows();
+
+ $bit_files_load_func = $gLibertySystem->getPluginFunction( 'bitfile', 'load_function' );
+ if ($bit_files_load_func && count($attachmentIds) > 0) {
+ $files = array();
+ foreach ($attachmentIds as $attachmentId) {
+ if ($attachmentId != $this->mInfo['portrait_attachment_id'] && $attachmentId != $this->mInfo['avatar_attachment_id'] && $attachmentId != $this->mInfo['logo_attachment_id']) {
+ $fileInfo = $bit_files_load_func($attachmentId);
+ $ret['diskUsage'] += $fileInfo['size'];
+ $files[] = $fileInfo;
+ }
+ }
+ $ret['files'] = $files;
+ }
+ }
+ return $ret;
+ }
+
+ function getUserAttachments() {
+ global $gLibertySystem;
+ $ret = NULL;
+
+ if ($this->mUserId) {
+ $query = "SELECT ta.*
+ FROM `".BIT_DB_PREFIX."tiki_attachments` ta
+ WHERE ta.`user_id` = ?";
+ $result = $this->query($query, array($this->mUserId));
+
+ $attachments = $result->getRows();
+ $ret = array();
+ foreach ($attachments as $attachment) {
+ $loadFunc = $gLibertySystem->getPluginFunction($attachment['attachment_plugin_guid'], 'load_function' );
+ $ret[] = $loadFunc($attachment);
+ }
+ }
+ return $ret;
+ }
+
+ // ============= watch functions
+ /*shared*/
+ function storeWatch( $event, $object, $type, $title, $url ) {
+ global $userlib;
+ if( $this->isValid() ) {
+ $hash = md5(uniqid('.'));
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_watches` where `user_id`=? and `event`=? and `object`=?";
+ $this->query($query,array( $this->mUserId, $event, $object ) );
+ $query = "insert into `".BIT_DB_PREFIX."tiki_user_watches`(`user_id` ,`event` ,`object` , `email`, `hash`, `type`, `title`, `url`) ";
+ $query.= "values(?,?,?,?,?,?,?,?)";
+ $this->query( $query, array( $this->mUserId, $event, $object, $this->mInfo['email'], $hash, $type, $title, $url ) );
+ return true;
+ }
+ }
+
+ function getWatches( $pEvent = '' ) {
+ $ret = NULL;
+ if( !empty( $this->mUserId ) ) {
+ $mid = '';
+ $bindvars=array( $this->mUserId );
+ if ($pEvent) {
+ $mid = " and `event`=? ";
+ $bindvars[]=$pEvent;
+ }
+
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_watches` where `user_id`=? $mid";
+ $result = $this->query($query,$bindvars);
+ $ret = array();
+
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+ }
+ return $ret;
+ }
+
+ /*shared*/
+ function getEventWatches( $event, $object ) {
+ $ret = NULL;
+ if( $this->isValid() ) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_watches` WHERE `user_id`=? and `event`=? and `object`=?";
+ $result = $this->query($query,array( $this->mUserId, $event, $object ) );
+ if ( $result->numRows() ) {
+ $ret = $result->fetchRow();
+ }
+ }
+ return $ret;
+ }
+
+ /*shared*/
+ function get_event_watches($event, $object) {
+ $ret = array();
+
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_watches` tw INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON ( tw.`user_id`=uu.`user_id` ) where `event`=? and `object`=?";
+ $result = $this->query($query,array($event,$object));
+
+ if (!$result->numRows())
+ return $ret;
+
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+
+ return $ret;
+ }
+
+ /*shared*/
+ function remove_user_watch_by_hash($hash) {
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_watches` where `hash`=?";
+ $this->query($query,array($hash));
+ }
+
+ /*shared*/
+ function get_watches_events() {
+ $query = "select distinct `event` from `".BIT_DB_PREFIX."tiki_user_watches`";
+ $result = $this->query($query,array());
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res['event'];
+ }
+ return $ret;
+ }
+
+
+
+
+ function getUserId() {
+ return( !empty( $this->mUserId ) ? $this->mUserId : ANONYMOUS_USER_ID );
+ }
+
+ function getDisplayUrl( $pUserName=NULL, $pMixed=NULL ) {
+// function getDisplayUrl( $pUserName=NULL ) {
+ if( empty( $pUserName ) && !empty( $this ) ) {
+ $pUserName = $this->mUsername;
+ }
+ if( function_exists( 'override_user_url' ) ) {
+ $ret = override_user_url( $pUserName );
+ } else {
+ global $gBitSystem;
+
+ if( $gBitSystem->isFeatureActive( 'pretty_urls' ) ) {
+ $ret = USERS_PKG_URL.$pUserName;
+ } else {
+ $ret = USERS_PKG_URL.'index.php?home='.$pUserName;
+ }
+ }
+ return $ret;
+ }
+
+ function getDisplayLink( $pUserName, $pDisplayHash ) {
+ return BitUser::getDisplayName( TRUE, $pDisplayHash );
+ }
+
+ function getTitle( $pHash = NULL ) {
+ return $this->getDisplayName( FALSE, $pHash );
+ }
+
+ function getDisplayName($pUseLink = FALSE, $pHash=NULL) {
+ global $gBitSystem;
+ $ret = NULL;
+ if( empty( $pHash ) && !empty( $this->mInfo ) ) {
+ $pHash = &$this->mInfo;
+ }
+ if( !empty( $pHash ) ) {
+ $displayName = (((!empty($pHash['real_name']) && $gBitSystem->getPreference( 'display_name', 'real_name' ) == 'real_name') ? $pHash['real_name'] :
+ (!empty($pHash['user']) ? $pHash['user'] :
+ (!empty($pHash['login']) ? $pHash['login'] :
+ (!empty($pHash['email']) ? substr($pHash['email'],0, strpos($pHash['email'],'@')) : $pHash['user_id'])))));
+ if (!empty($pHash['user'])) {
+ $iHomepage = $pHash['user'];
+ } elseif (!empty($pHash['login'])) {
+ // user of 'login' is deprecated and eventually should go away!
+ $iHomepage = $pHash['login'];
+ } elseif (!empty($pHash['user_id'])) {
+ $iHomepage = $pHash['user_id'];
+ } elseif (!empty($pHash['email'])) {
+ $iHomepage = $pHash['email'];
+ } else {
+ // this won't work right now, we need to alter userslib::interpret_home() to interpret a real name
+ $iHomepage = $pHash['real_name'];
+ }
+
+ if( $pUseLink ) {
+ $ret = '<a class="username" href="'.BitUser::getDisplayUrl( $iHomepage ).'">'.$displayName.'</a>';
+ } else {
+ $ret = $displayName;
+ }
+ } else {
+ $ret = "Anonymous";
+ }
+ return $ret;
+
+ }
+
+ /**
+ * Returns include file that will
+ * @return the fully specified path to file to be included
+ */
+ function getRenderFile() {
+ return USERS_PKG_PATH."display_bituser_inc.php";
+ }
+
+ function storeRealName($newRealName) {
+ if (strlen($newRealName) > REAL_NAME_COL_SIZE) {
+ $newRealName = substr($newRealName,0,REAL_NAME_COL_SIZE);
+ }
+ if ($this->mUserId) {
+ $sql = "UPDATE `".BIT_DB_PREFIX."users_users` SET `real_name` = ? WHERE `user_id` = ?";
+ $this->query($sql, array($newRealName, $this->mUserId));
+ }
+ }
+
+ function getList( &$pParamHash ) {
+
+ if ( !isset( $pParamHash['sort_mode']) or $pParamHash['sort_mode'] == '' ) $pParamHash['sort_mode'] = 'registration_date_desc';
+ $pParamHash['max_records'] = 20;
+ LibertyContent::prepGetList( $pParamHash );
+ $sort_mode = $this->convert_sortmode($pParamHash['sort_mode']);
+ // Return an array of users indicating name, email, last changed pages, versions, last_login
+ if ( $pParamHash['find'] ) {
+ $mid = " where UPPER(uu.`login`) LIKE ? OR UPPER(uu.real_name) LIKE ? OR UPPER(uu.email) LIKE ? ";
+ $bindvars = array('%'.strtoupper( $pParamHash['find'] ).'%', '%'.strtoupper( $pParamHash['find'] ).'%', '%'.strtoupper( $pParamHash['find'] ).'%');
+ } else {
+ $mid = '';
+ $bindvars = array();
+ }
+ $query = "SELECT uu.*, tf_ava.`storage_path` AS `avatar_storage_path`
+ FROM `".BIT_DB_PREFIX."users_users` uu
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_attachments` ta_ava ON ( uu.`avatar_attachment_id`=ta_ava.`attachment_id` )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."tiki_files` tf_ava ON ( tf_ava.`file_id`=ta_ava.`foreign_id` )
+ $mid order by $sort_mode";
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."users_users` uu $mid";
+ $result = $this->query($query, $bindvars, $pParamHash['max_records'], $pParamHash['offset']);
+
+ $ret = array();
+ while( $res = $result->fetchRow() ) {
+ if( !empty($res['avatar_storage_path'] ) ) {
+ $res['avatar_url'] = BIT_ROOT_URL.$res['avatar_storage_path'];
+ $res['thumbnail_url'] = dirname( $res['avatar_url'] ).'/small.jpg';
+ }
+ $res["groups"] = $this->getGroups( $res['user_id'] );
+ array_push( $ret, $res );
+ }
+ $retval = array();
+ $pParamHash["data"] = $ret;
+
+ $pParamHash["cant"] = $this->getOne($query_cant,$bindvars);
+
+ LibertyContent::postGetList( $pParamHash );
+ }
+
+ function isSemaphoreSet( $pSemName, $pLimit ) {
+ $now = date("U");
+ $lim = $now - $pLimit;
+ $query = "delete from `".BIT_DB_PREFIX."tiki_semaphores` where `sem_name`=? and `created`<?";
+ $result = $this->query($query,array( $pSemName, (int)$lim) );
+ $query = "select `sem_name` from `".BIT_DB_PREFIX."tiki_semaphores` where `sem_name`=?";
+ $result = $this->query($query,array($pSemName));
+ return $result->numRows();
+ }
+
+ function hasSemaphoreConflict( $pSemName, $pLimit ) {
+ $ret = NULL;
+ $userId = $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID;
+ $now = date("U");
+ $lim = $now - $pLimit;
+ $query = "delete from `".BIT_DB_PREFIX."tiki_semaphores` where `sem_name`=? and `created`<?";
+ $result = $this->query($query,array( $pSemName, (int)$lim) );
+ $query = "SELECT uu.`login`, uu.`real_name`, uu.`email`, uu.`user_id`
+ FROM `".BIT_DB_PREFIX."tiki_semaphores` ts INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON( uu.`user_id`=ts.`user_id`)
+ WHERE `sem_name`=? AND ts.`user_id`!='?'";
+ $result = $this->query( $query, array( $pSemName, (int)$userId ) );
+ if( $result->fields ) {
+ $ret = $result->fields;
+ $ret['nolink'] = TRUE;
+ }
+ return( $ret );
+ }
+
+ function storeSemaphore( $pSemName ) {
+ if( !empty( $pSemName ) ) {
+ $userId = $this->isValid() ? $this->mUserId : ANONYMOUS_USER_ID;
+ $now = date("U");
+ // $cant=$this->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_semaphores` where `sem_name`='$pSemName'");
+ $query = "delete from `".BIT_DB_PREFIX."tiki_semaphores` where `sem_name`=?";
+ $this->query($query,array($pSemName));
+ $query = "insert into `".BIT_DB_PREFIX."tiki_semaphores`(`sem_name`,`created`,`user_id`) values(?,?,?)";
+ $result = $this->query($query,array($pSemName, (int)$now, $userId));
+ return $now;
+ }
+ }
+
+ // PURE VIRTUAL FUNCTIONS
+ function getGroups () {
+ print "CALL TO PURE VIRTUAL FUNCTIONS"; bt(); die;
+ }
+
+ function userExists( $pUserMixed ) {
+ $ret = FALSE;
+ if ( is_array( $pUserMixed ) ) {
+ if( $cur = current( $pUserMixed ) ) {
+ $query = "SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE UPPER(`".key( $pUserMixed )."`) = ?";
+ $ret = $this->getOne( $query, array( strtoupper( $cur ) ) );
+ }
+ }
+ return $ret;
+ }
+
+
+}
+
+function scrambleEmail($email, $method='unicode') {
+ switch ($method) {
+ case 'strtr':
+ $trans = array( "@" => tra(" AT "),
+ "." => tra(" DOT ")
+ );
+ $ret = strtr($email, $trans);
+ break;
+ case 'x' :
+ $encoded = $email;
+ for ($i = strpos($email, "@") + 1; $i < strlen($email); $i++) {
+ if ($encoded[$i] != ".") $encoded[$i] = 'x';
+ }
+ $ret = $encoded;
+ break;
+ case 'unicode':
+ case 'y':// for previous compatibility
+ $encoded = '';
+ for ($i = 0; $i < strlen($email); $i++) {
+ $encoded .= '&#' . ord($email[$i]). ';';
+ }
+ $ret = $encoded;
+ break;
+ default:
+ $ret = NULL;
+ break;
+ }
+ return $ret;
+}
+
+?>
diff --git a/admin/admin_login_inc.php b/admin/admin_login_inc.php
new file mode 100644
index 0000000..02b96c2
--- /dev/null
+++ b/admin/admin_login_inc.php
@@ -0,0 +1,287 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/admin/admin_login_inc.php,v 1.1 2005/06/19 05:12:24 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+if (isset($_REQUEST["loginprefs"])) {
+
+ if (isset($_REQUEST["eponymousGroups"]) && $_REQUEST["eponymousGroups"] == "on") {
+ $gBitSystem->storePreference("eponymousGroups", 'y');
+ $smarty->assign('eponymousGroups', 'y');
+ } else {
+ $gBitSystem->storePreference("eponymousGroups", 'n');
+ $smarty->assign('eponymousGroups', 'n');
+ }
+ if (isset($_REQUEST["allowRegister"]) && $_REQUEST["allowRegister"] == "on") {
+ $gBitSystem->storePreference("allowRegister", 'y');
+ $smarty->assign('allowRegister', 'y');
+ } else {
+ $gBitSystem->storePreference("allowRegister", 'n');
+ $smarty->assign('allowRegister', 'n');
+ }
+ if (isset($_REQUEST["webserverauth"]) && $_REQUEST["webserverauth"] == "on") {
+ $gBitSystem->storePreference("webserverauth", 'y');
+ $smarty->assign('webserverauth', 'y');
+ } else {
+ $gBitSystem->storePreference("webserverauth", 'n');
+ $smarty->assign('webserverauth', 'n');
+ }
+ if (isset($_REQUEST["useRegisterPasscode"]) && $_REQUEST["useRegisterPasscode"] == "on") {
+ $gBitSystem->storePreference("useRegisterPasscode", 'y');
+ $smarty->assign('useRegisterPasscode', 'y');
+ } else {
+ $gBitSystem->storePreference("useRegisterPasscode", 'n');
+ $smarty->assign('useRegisterPasscode', 'n');
+ }
+ $gBitSystem->storePreference("registerPasscode", $_REQUEST["registerPasscode"]);
+ $smarty->assign('registerPasscode', $_REQUEST["registerPasscode"]);
+ $gBitSystem->storePreference("min_pass_length", $_REQUEST["min_pass_length"]);
+ $smarty->assign('min_pass_length', $_REQUEST["min_pass_length"]);
+ if (isset($_REQUEST["user_password_generator"]) && $_REQUEST["user_password_generator"] == "on") {
+ $gBitSystem->storePreference("user_password_generator", 'y');
+ $smarty->assign('user_password_generator', 'y');
+ } else {
+ $gBitSystem->storePreference("user_password_generator", 'n');
+ $smarty->assign('user_password_generator', 'n');
+ }
+ if (isset($_REQUEST["validateUsers"]) && $_REQUEST["validateUsers"] == "on") {
+ $gBitSystem->storePreference("validateUsers", 'y');
+ $smarty->assign('validateUsers', 'y');
+ } else {
+ $gBitSystem->storePreference("validateUsers", 'n');
+ $smarty->assign('validateUsers', 'n');
+ }
+ if (isset($_REQUEST["validateEmail"]) && $_REQUEST["validateEmail"] == "on" && $gBitSystem->hasValidSenderEmail() ) {
+ $gBitSystem->storePreference("validateEmail", 'y');
+ $smarty->assign('validateEmail', 'y');
+ } else {
+ $gBitSystem->storePreference("validateEmail", 'n');
+ $smarty->assign('validateEmail', 'n');
+ }
+ if (isset($_REQUEST["rnd_num_reg"]) && $_REQUEST["rnd_num_reg"] == "on") {
+ $gBitSystem->storePreference("rnd_num_reg", 'y');
+ $smarty->assign('rnd_num_reg', 'y');
+ } else {
+ $gBitSystem->storePreference("rnd_num_reg", 'n');
+ $smarty->assign('rnd_num_reg', 'n');
+ }
+ if (isset($_REQUEST["pass_chr_num"]) && $_REQUEST["pass_chr_num"] == "on") {
+ $gBitSystem->storePreference("pass_chr_num", 'y');
+ $smarty->assign('pass_chr_num', 'y');
+ } else {
+ $gBitSystem->storePreference("pass_chr_num", 'n');
+ $smarty->assign('pass_chr_num', 'n');
+ }
+ if (isset($_REQUEST["feature_challenge"]) && $_REQUEST["feature_challenge"] == "on") {
+ $gBitSystem->storePreference("feature_challenge", 'y');
+ $smarty->assign('feature_challenge', 'y');
+ } else {
+ $gBitSystem->storePreference("feature_challenge", 'n');
+ $smarty->assign('feature_challenge', 'n');
+ }
+ if (isset($_REQUEST["feature_clear_passwords"]) && $_REQUEST["feature_clear_passwords"] == "on") {
+ $gBitSystem->storePreference("feature_clear_passwords", 'y');
+ $smarty->assign('feature_clear_passwords', 'y');
+ } else {
+ $gBitSystem->storePreference("feature_clear_passwords", 'n');
+ $smarty->assign('feature_clear_passwords', 'n');
+ }
+ if (isset($_REQUEST["forgotPass"]) && $_REQUEST["forgotPass"] == "on") {
+ $gBitSystem->storePreference("forgotPass", 'y');
+ $smarty->assign('forgotPass', 'y');
+ } else {
+ $gBitSystem->storePreference("forgotPass", 'n');
+ $smarty->assign('forgotPass', 'n');
+ }
+ if (isset($_REQUEST["rememberme"]) && $_REQUEST["rememberme"] == "on") {
+ $gBitSystem->storePreference("rememberme", 'y');
+ $smarty->assign('rememberme', 'y');
+ } else {
+ $gBitSystem->storePreference("rememberme", 'n');
+ $smarty->assign('rememberme', 'n');
+ }
+ $gBitSystem->storePreference("pass_due", $_REQUEST["pass_due"]);
+ $smarty->assign('pass_due', $_REQUEST["pass_due"]);
+ $gBitSystem->storePreference('remembertime', $_REQUEST['remembertime']);
+ $smarty->assign('remembertime', $_REQUEST['remembertime']);
+ $v = isset($_REQUEST['cookie_domain']) ? $_REQUEST['cookie_domain'] : $_SERVER['SERVER_NAME'];
+ $gBitSystem->storePreference('cookie_domain', $v);
+ $smarty->assign('cookie_domain', $v);
+ if ( isset($_REQUEST['cookie_path']) ) {
+ $v = $_REQUEST['cookie_path'];
+ $v = ( preg_match( "/^\//", $v ) ) ? $v : "/" . $v;
+ } else {
+ $v = BIT_ROOT_URL;
+ }
+ $gBitSystem->storePreference('cookie_path', $v);
+ $smarty->assign('cookie_path', $v);
+ if (isset($_REQUEST["auth_method"])) {
+ $gBitSystem->storePreference('auth_method', $_REQUEST['auth_method']);
+ $smarty->assign('auth_method', $_REQUEST['auth_method']);
+ }
+ $b = (isset($_REQUEST['feature_ticketlib']) && $_REQUEST['feature_ticketlib'] == 'on') ? 'y' : 'n';
+ $gBitSystem->storePreference('feature_ticketlib', $b);
+ $smarty->assign('feature_ticketlib', $b);
+}
+if (isset($_REQUEST["httpprefs"])) {
+ $b = (isset($_REQUEST['https_login']) && $_REQUEST['https_login'] == 'on') ? 'y' : 'n';
+ $gBitSystem->storePreference('https_login', $b);
+ $smarty->assign('https_login', $b);
+ $b = (isset($_REQUEST['https_login_required']) && $_REQUEST['https_login_required'] == 'on') ? 'y' : 'n';
+ $gBitSystem->storePreference('https_login_required', $b);
+ $smarty->assign('https_login_required', $b);
+ /* # not implemented
+ $b = isset($_REQUEST['http_basic_auth']) && $_REQUEST['http_basic_auth'] == 'on';
+ $gBitSystem->storePreference('http_basic_auth', $b);
+ $smarty->assign('http_basic_auth', $b);
+ */
+ $v = isset($_REQUEST['http_domain']) ? $_REQUEST['http_domain'] : '';
+ $gBitSystem->storePreference('http_domain', $v);
+ $smarty->assign('http_domain', $v);
+ $v = isset($_REQUEST['http_port']) ? $_REQUEST['http_port'] : 80;
+ $gBitSystem->storePreference('http_port', $v);
+ $smarty->assign('http_port', $v);
+ $v = isset($_REQUEST['http_prefix']) ? $_REQUEST['http_prefix'] : BIT_ROOT_URL;
+ $gBitSystem->storePreference('http_prefix', $v);
+ $smarty->assign('http_prefix', $v);
+ $v = isset($_REQUEST['https_domain']) ? $_REQUEST['https_domain'] : '';
+ $gBitSystem->storePreference('https_domain', $v);
+ $smarty->assign('https_domain', $v);
+ $v = isset($_REQUEST['https_port']) ? $_REQUEST['https_port'] : 443;
+ $gBitSystem->storePreference('https_port', $v);
+ $smarty->assign('https_port', $v);
+ $v = isset($_REQUEST['https_prefix']) ? $_REQUEST['https_prefix'] : BIT_ROOT_URL;
+ $gBitSystem->storePreference('https_prefix', $v);
+ $smarty->assign('https_prefix', $v);
+}
+if (isset($_REQUEST["auth_pear"])) {
+
+ if (isset($_REQUEST["auth_create_gBitDbUser"]) && $_REQUEST["auth_create_gBitDbUser"] == "on") {
+ $gBitSystem->storePreference("auth_create_gBitDbUser", 'y');
+ $smarty->assign("auth_create_gBitDbUser", 'y');
+ } else {
+ $gBitSystem->storePreference("auth_create_gBitDbUser", 'n');
+ $smarty->assign("auth_create_gBitDbUser", 'n');
+ }
+ if (isset($_REQUEST["auth_create_user_auth"]) && $_REQUEST["auth_create_user_auth"] == "on") {
+ $gBitSystem->storePreference("auth_create_user_auth", 'y');
+ $smarty->assign("auth_create_user_auth", 'y');
+ } else {
+ $gBitSystem->storePreference("auth_create_user_auth", 'n');
+ $smarty->assign("auth_create_user_auth", 'n');
+ }
+ if (isset($_REQUEST["auth_skip_admin"]) && $_REQUEST["auth_skip_admin"] == "on") {
+ $gBitSystem->storePreference("auth_skip_admin", 'y');
+ $smarty->assign("auth_skip_admin", 'y');
+ } else {
+ $gBitSystem->storePreference("auth_skip_admin", 'n');
+ $smarty->assign("auth_skip_admin", 'n');
+ }
+ if (isset($_REQUEST["auth_ldap_host"])) {
+ $gBitSystem->storePreference("auth_ldap_host", $_REQUEST["auth_ldap_host"]);
+ $smarty->assign('auth_ldap_host', $_REQUEST["auth_ldap_host"]);
+ }
+ if (isset($_REQUEST["auth_ldap_port"])) {
+ $gBitSystem->storePreference("auth_ldap_port", $_REQUEST["auth_ldap_port"]);
+ $smarty->assign('auth_ldap_port', $_REQUEST["auth_ldap_port"]);
+ }
+ if (isset($_REQUEST["auth_ldap_scope"])) {
+ $gBitSystem->storePreference("auth_ldap_scope", $_REQUEST["auth_ldap_scope"]);
+ $smarty->assign('auth_ldap_scope', $_REQUEST["auth_ldap_scope"]);
+ }
+ if (isset($_REQUEST["auth_ldap_basedn"])) {
+ $gBitSystem->storePreference("auth_ldap_basedn", $_REQUEST["auth_ldap_basedn"]);
+ $smarty->assign('auth_ldap_basedn', $_REQUEST["auth_ldap_basedn"]);
+ }
+ if (isset($_REQUEST["auth_ldap_userdn"])) {
+ $gBitSystem->storePreference("auth_ldap_userdn", $_REQUEST["auth_ldap_userdn"]);
+ $smarty->assign('auth_ldap_userdn', $_REQUEST["auth_ldap_userdn"]);
+ }
+ if (isset($_REQUEST["auth_ldap_userattr"])) {
+ $gBitSystem->storePreference("auth_ldap_userattr", $_REQUEST["auth_ldap_userattr"]);
+ $smarty->assign('auth_ldap_userattr', $_REQUEST["auth_ldap_userattr"]);
+ }
+ if (isset($_REQUEST["auth_ldap_useroc"])) {
+ $gBitSystem->storePreference("auth_ldap_useroc", $_REQUEST["auth_ldap_useroc"]);
+ $smarty->assign('auth_ldap_useroc', $_REQUEST["auth_ldap_useroc"]);
+ }
+ if (isset($_REQUEST["auth_ldap_groupdn"])) {
+ $gBitSystem->storePreference("auth_ldap_groupdn", $_REQUEST["auth_ldap_groupdn"]);
+ $smarty->assign('auth_ldap_groupdn', $_REQUEST["auth_ldap_groupdn"]);
+ }
+ if (isset($_REQUEST["auth_ldap_groupattr"])) {
+ $gBitSystem->storePreference("auth_ldap_groupattr", $_REQUEST["auth_ldap_groupattr"]);
+ $smarty->assign('auth_ldap_groupattr', $_REQUEST["auth_ldap_groupattr"]);
+ }
+ if (isset($_REQUEST["auth_ldap_groupoc"])) {
+ $gBitSystem->storePreference("auth_ldap_groupoc", $_REQUEST["auth_ldap_groupoc"]);
+ $smarty->assign('auth_ldap_groupoc', $_REQUEST["auth_ldap_groupoc"]);
+ }
+ if (isset($_REQUEST["auth_ldap_memberattr"])) {
+ $gBitSystem->storePreference("auth_ldap_memberattr", $_REQUEST["auth_ldap_memberattr"]);
+ $smarty->assign('auth_ldap_ldap_memberattr', $_REQUEST["auth_ldap_memberattr"]);
+ }
+ if (isset($_REQUEST["auth_ldap_memberisdn"]) && $_REQUEST["auth_ldap_memberisdn"] == "on") {
+ $gBitSystem->storePreference("auth_ldap_memberisdn", 'y');
+ $smarty->assign("auth_ldap_memberisdn", 'y');
+ } else {
+ $gBitSystem->storePreference("auth_ldap_memberisdn", 'n');
+ $smarty->assign("auth_ldap_memberisdn", 'n');
+ }
+ if (isset($_REQUEST["auth_ldap_adminuser"])) {
+ $gBitSystem->storePreference("auth_ldap_adminuser", $_REQUEST["auth_ldap_adminuser"]);
+ $smarty->assign('auth_ldap_adminuser', $_REQUEST["auth_ldap_adminuser"]);
+ }
+ if (isset($_REQUEST["auth_ldap_adminpass"])) {
+ $gBitSystem->storePreference("auth_ldap_adminpass", $_REQUEST["auth_ldap_adminpass"]);
+ $smarty->assign('auth_ldap_adminpass', $_REQUEST["auth_ldap_adminpass"]);
+ }
+}
+$smarty->assign("change_theme", $gBitSystem->getPreference("change_theme", "n"));
+$smarty->assign("change_language", $gBitSystem->getPreference("change_language", "n"));
+$smarty->assign("eponymousGroups", $gBitSystem->getPreference("eponymousGroups", 'n'));
+$smarty->assign("allowRegister", $gBitSystem->getPreference("allowRegister", 'n'));
+$smarty->assign("webserverauth", $gBitSystem->getPreference("webserverauth", 'n'));
+$smarty->assign("useRegisterPasscode", $gBitSystem->getPreference("useRegisterPasscode", 'n'));
+$smarty->assign("registerPasscode", $gBitSystem->getPreference("registerPasscode", ''));
+$smarty->assign("min_pass_length", $gBitSystem->getPreference("min_pass_length", '1'));
+$smarty->assign("pass_due", $gBitSystem->getPreference("pass_due", '999'));
+$smarty->assign("validateUsers", $gBitSystem->getPreference("validateUsers", 'n'));
+$smarty->assign("validateEmail", $gBitSystem->getPreference("validateEmail", 'n'));
+$smarty->assign("rnd_num_reg", $gBitSystem->getPreference("rnd_num_reg", 'n'));
+$smarty->assign("pass_chr_num", $gBitSystem->getPreference("pass_chr_num", 'n'));
+$smarty->assign("feature_challenge", $gBitSystem->getPreference("feature_challenge", 'n'));
+$smarty->assign("feature_clear_passwords", $gBitSystem->getPreference("feature_clear_passwords", 'n'));
+$smarty->assign("forgotPass", $gBitSystem->getPreference("forgotPass", 'n'));
+$smarty->assign("https_login", $gBitSystem->getPreference("https_login", 'n'));
+$smarty->assign("https_login_required", $gBitSystem->getPreference("https_login_required", 'n'));
+$smarty->assign("http_domain", $gBitSystem->getPreference("http_domain", ''));
+$smarty->assign("http_port", $gBitSystem->getPreference("http_port", '80'));
+$smarty->assign("http_prefix", $gBitSystem->getPreference("http_prefix", BIT_ROOT_URL));
+$smarty->assign("https_domain", $gBitSystem->getPreference("https_domain", ''));
+$smarty->assign("https_port", $gBitSystem->getPreference("https_port", '443'));
+$smarty->assign("https_prefix", $gBitSystem->getPreference("https_prefix", BIT_ROOT_URL));
+$smarty->assign("remembertime", $gBitSystem->getPreference("remembertime", 2592000));
+$smarty->assign("cookie_domain", $gBitSystem->getPreference("cookie_domain", $_SERVER['SERVER_NAME']));
+$smarty->assign("cookie_path", $gBitSystem->getPreference("cookie_path", BIT_ROOT_URL));
+$smarty->assign("auth_method", $gBitSystem->getPreference("auth_method", 'tiki'));
+$smarty->assign("feature_ticketlib", $gBitSystem->getPreference("feature_ticketlib", 'n'));
+$smarty->assign("auth_create_gBitDbUser", $gBitSystem->getPreference("auth_create_gBitDbUser", 'n'));
+$smarty->assign("auth_create_user_auth", $gBitSystem->getPreference("auth_create_user_auth", 'n'));
+$smarty->assign("auth_skip_admin", $gBitSystem->getPreference("auth_skip_admin", 'y'));
+$smarty->assign("auth_ldap_host", $gBitSystem->getPreference("auth_ldap_host", 'localhost'));
+$smarty->assign("auth_ldap_port", $gBitSystem->getPreference("auth_ldap_port", '389'));
+$smarty->assign("auth_ldap_scope", $gBitSystem->getPreference("auth_ldap_scope", 'sub'));
+$smarty->assign("auth_ldap_basedn", $gBitSystem->getPreference("auth_ldap_basedn", ''));
+$smarty->assign("auth_ldap_userdn", $gBitSystem->getPreference("auth_ldap_userdn", ''));
+$smarty->assign("auth_ldap_userattr", $gBitSystem->getPreference("auth_ldap_userattr", 'uid'));
+$smarty->assign("auth_ldap_useroc", $gBitSystem->getPreference("auth_ldap_useroc", 'inetOrgPerson'));
+$smarty->assign("auth_ldap_groupdn", $gBitSystem->getPreference("auth_ldap_groupdn", ''));
+$smarty->assign("auth_ldap_groupattr", $gBitSystem->getPreference("auth_ldap_groupattr", 'cn'));
+$smarty->assign("auth_ldap_groupoc", $gBitSystem->getPreference("auth_ldap_groupoc", 'groupOfUniqueNames'));
+$smarty->assign("auth_ldap_ldap_memberattr", $gBitSystem->getPreference("auth_ldap_ldap_memberattr", 'uniqueMember'));
+$smarty->assign("auth_ldap_memberisdn", $gBitSystem->getPreference("auth_ldap_memberisdn", 'y'));
+$smarty->assign("auth_ldap_adminuser", $gBitSystem->getPreference("auth_ldap_adminuser", ''));
+$smarty->assign("auth_ldap_adminpass", $gBitSystem->getPreference("auth_ldap_adminpass", ''));
+
+?>
diff --git a/admin/admin_userfiles_inc.php b/admin/admin_userfiles_inc.php
new file mode 100644
index 0000000..8247468
--- /dev/null
+++ b/admin/admin_userfiles_inc.php
@@ -0,0 +1,16 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/admin/admin_userfiles_inc.php,v 1.1 2005/06/19 05:12:23 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+if (isset($_REQUEST["userfilesprefs"])) {
+
+ $gBitSystem->storePreference("uf_use_db", $_REQUEST["uf_use_db"]);
+ $gBitSystem->storePreference("uf_use_dir", $_REQUEST["uf_use_dir"]);
+ $gBitSystem->storePreference("userfiles_quota", $_REQUEST["userfiles_quota"]);
+ $smarty->assign('uf_use_db', $_REQUEST["uf_use_db"]);
+ $smarty->assign('uf_use_dir', $_REQUEST["uf_use_dir"]);
+ $smarty->assign('userfiles_quota', $_REQUEST['userfiles_quota']);
+}
+
+?> \ No newline at end of file
diff --git a/admin/admin_users_inc.php b/admin/admin_users_inc.php
new file mode 100644
index 0000000..0276661
--- /dev/null
+++ b/admin/admin_users_inc.php
@@ -0,0 +1,95 @@
+<?php
+$formFeatures = array(
+ 'feature_tasks' => array(
+ 'label' => 'User Tasks',
+ 'note' => 'Make notes of tasks with due date and priority.',
+ 'page' => 'UserTasks',
+ ),
+ 'feature_user_bookmarks' => array(
+ 'label' => 'User Bookmarks',
+ 'note' => 'Users can create their own list of private bookmarks.',
+ 'page' => 'UserBookmarks',
+ ),
+ 'feature_userfiles' => array(
+ 'label' => 'User Files',
+ 'note' => 'Users can upload private user files.',
+ 'page' => 'UserFiles',
+ ),
+ 'feature_usermenu' => array(
+ 'label' => 'User menu',
+ 'note' => 'Users can customise their own menus.',
+ 'page' => 'UserMenu',
+ ),
+ 'feature_userPreferences' => array(
+ 'label' => 'User Preferences',
+ 'note' => 'Users can view and modify their personal preferences.',
+ 'page' => 'UserPreferences',
+ ),
+ 'change_language' => array(
+ 'label' => 'Registered users can change language',
+ 'note' => 'Allows users to view a translated version of the site.'
+ ),
+ 'feature_user_watches' => array(
+ 'label' => 'User Watches',
+ 'note' => 'Users can mark pages to be watched. If a watched page is modified, the user is informed.',
+ 'page' => 'UserWatches',
+ ),
+ 'case_sensitive_login' => array(
+ 'label' => 'Case-Sensitive Login',
+ 'note' => 'This determines whether user login names are case-sensitive.'
+ ),
+);
+
+if( $gBitSystem->isPackageActive( 'notepad' ) ) {
+ $formFeatures['feature_notepad'] = array(
+ 'label' => 'User Notepad',
+ 'note' => 'Allow users to make notes.',
+ 'page' => 'UserNotepad'
+ );
+}
+
+$smarty->assign( 'formFeatures', $formFeatures );
+
+if( isset( $_REQUEST['fTiki'] ) ) {
+ foreach ( array_keys( $formFeatures ) as $feature) {
+ $gBitSystem->storePreference( $feature, (isset( $_REQUEST['fTiki'][$feature][0] ) ? $_REQUEST['fTiki'][$feature][0] : 'n') );
+ }
+
+ if( $customFields = explode( ',', $_REQUEST['fTiki']['custom_user_fields'] ) ) {
+ trim_array( $customFields );
+ $customFields = implode( ',', $customFields );
+ }
+ $gBitSystem->storePreference( 'custom_user_fields', $customFields );
+ $gBitSystem->storePreference( 'display_name', (isset( $_REQUEST['fTiki']['display_name'] ) ? $_REQUEST['fTiki']['display_name'] : 'real_name') );
+ $gBitSystem->storePreference( 'feature_user_theme', (isset( $_REQUEST['fTiki']['feature_user_theme'][0] ) ? $_REQUEST['fTiki']['feature_user_theme'][0] : 'n') );
+ $gBitSystem->storePreference( 'feature_user_layout', (isset( $_REQUEST['fTiki']['feature_user_layout'][0] ) ? $_REQUEST['fTiki']['feature_user_layout'][0] : 'n') );
+}
+
+// Handle Admin Password Change Request
+// doesn't seem to be working at the moment
+if (isset($_REQUEST["newadminpass"]) ) {
+
+ if ($_REQUEST["adminpass"] <> $_REQUEST["again"]) {
+ $smarty->assign("msg", tra("The passwords don't match"));
+
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+
+ // Validate password here
+ if (strlen($_REQUEST["adminpass"]) < $min_pass_length) {
+ $text = tra("Password should be at least");
+
+ $text .= " " . $min_pass_length . " ";
+ $text .= tra("characters long");
+ $smarty->assign("msg", $text);
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+
+ $gBitUser->change_user_password("admin", $_REQUEST["adminpass"]);
+ $smarty->assign('pagetop_msg', tra("Your admin password has been changed"));
+}
+
+
+?>
diff --git a/admin/assign_user.php b/admin/assign_user.php
new file mode 100644
index 0000000..ea38b3f
--- /dev/null
+++ b/admin/assign_user.php
@@ -0,0 +1,80 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/admin/assign_user.php,v 1.1 2005/06/19 05:12:23 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// This script is used to assign groups to a particular user
+// ASSIGN USER TO GROUPS
+// Initialization
+require_once( '../../bit_setup_inc.php' );
+
+$gBitSystem->verifyPermission( 'bit_p_admin' );
+
+if (!$gBitUser->userExists( array( 'user_id' => $_REQUEST["assign_user"] ) ) ) {
+ $gBitSystem->fatalError( "User doesnt exist" );
+}
+
+$assignUser = new BitPermUser( $_REQUEST["assign_user"] );
+$assignUser->load( TRUE );
+
+if( isset( $_REQUEST["action"] ) ) {
+ if ($_REQUEST["action"] == 'assign') {
+ $assignUser->addUserToGroup( $assignUser->mUserId, $_REQUEST["group_id"] );
+ } elseif ($_REQUEST["action"] == 'removegroup') {
+ $gBitUser->removeUserFromGroup($_REQUEST["assign_user"], $_REQUEST["group_id"]);
+ }
+ header( 'Location: '.$_SERVER['PHP_SELF'].'?assign_user='.$assignUser->mUserId );
+ die;
+}elseif(isset($_REQUEST['set_default'])) {
+ $assignUser->storeUserDefaultGroup( $assignUser->mUserId, $_REQUEST['default_group'] );
+ $assignUser->load( TRUE );
+}
+$smarty->assign_by_ref( 'assignUser', $assignUser );
+
+$listHash = array( 'sort_mode' => 'group_name_asc' );
+$groupList = $gBitUser->getAllGroups( $listHash );
+
+/*
+// If offset is set use it if not then use offset =0
+// use the maxRecords php variable to set the limit
+// if sortMode is not set then use last_modified_desc
+if (!isset($_REQUEST["offset"])) {
+ $offset = 0;
+} else {
+ $offset = $_REQUEST["offset"];
+}
+if (isset($_REQUEST['page'])) {
+ $page = &$_REQUEST['page'];
+ $offset = ($page - 1) * $maxRecords;
+}
+$smarty->assign_by_ref('offset', $offset);
+if (isset($_REQUEST["find"])) {
+ $find = $_REQUEST["find"];
+} else {
+ $find = '';
+}
+$smarty->assign('find', $find);
+$cant_pages = ceil($users["cant"] / $maxRecords);
+$smarty->assign_by_ref('cant_pages', $cant_pages);
+$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
+if ($users["cant"] > ($offset + $maxRecords)) {
+ $smarty->assign('next_offset', $offset + $maxRecords);
+} else {
+ $smarty->assign('next_offset', -1);
+}
+// If offset is > 0 then prev_offset
+if ($offset > 0) {
+ $smarty->assign('prev_offset', $offset - $maxRecords);
+} else {
+ $smarty->assign('prev_offset', -1);
+}
+*/
+
+// Get users (list of users)
+$smarty->assign('groups', $groupList['data']);
+
+$gBitSystem->setBrowserTitle( 'Edit User: '.$assignUser->mUsername );
+
+// Display the template
+$gBitSystem->display( 'bitpackage:users/assignuser.tpl');
+?>
diff --git a/admin/edit_group.php b/admin/edit_group.php
new file mode 100644
index 0000000..2df3028
--- /dev/null
+++ b/admin/edit_group.php
@@ -0,0 +1,168 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/admin/edit_group.php,v 1.1 2005/06/19 05:12:24 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../../bit_setup_inc.php' );
+
+
+// PERMISSIONS: NEEDS admin
+$gBitSystem->verifyPermission( 'bit_p_admin' );
+
+$successMsg = NULL;
+$errorMsg = NULL;
+
+// We need to scan for defaults
+global $gBitInstaller;
+$gBitInstaller = &$gBitSystem;
+$gBitSystem->verifyInstalledPackages();
+
+if( !empty( $_REQUEST['group_id'] ) ) {
+ $allPerms = $gBitUser->getGroupPermissions( NULL, NULL, NULL, !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : NULL );
+ // get grouplist separately from the $users stuff to avoid splitting of data due to pagination
+ $listHash = array( 'sort_mode' => 'group_name_asc' );
+ $groupList = $gBitUser->getAllGroups( $listHash );
+} else {
+ // get grouplist separately from the $users stuff to avoid splitting of data due to pagination
+ $listHash = array( 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' );
+ $groupList = $gBitUser->getAllGroups( $listHash );
+}
+
+$smarty->assign( 'package',isset( $_REQUEST['package'] ) ? $_REQUEST['package'] : 'all' );
+
+if( !empty( $_REQUEST["cancel"] ) ) {
+ header( 'Location: '.USERS_PKG_URL.'admin/edit_group.php' );
+ die;
+} elseif( isset($_REQUEST["batch_assign"] ) ) {
+ $groupInfo = $gBitUser->getGroupInfo( $_REQUEST['batch_assign'] );
+ if( isset( $_REQUEST["confirm"] ) ) {
+$gBitUser->batchAssignUsersToGroup( $_REQUEST['batch_assign'] );
+ } else {
+ $gBitSystem->setBrowserTitle( tra( 'Confirm Batch Group Assignment' ) );
+ $formHash['batch_assign'] = $_REQUEST["batch_assign"];
+ $msgHash = array(
+ 'label' => tra( 'Batch Assign Users to Group' ),
+ 'confirm_item' => $groupInfo['group_name'],
+ 'warning' => tra( 'This will assign every user on the site to the group' ).' <strong>'.$groupInfo['group_name'].'</strong>',
+ );
+ $gBitSystem->confirmDialog( $formHash,$msgHash );
+ }
+
+} elseif( isset($_REQUEST["members"] ) ) {
+ $groupInfo = $gBitUser->getGroupInfo( $_REQUEST["members"] );
+ $smarty->assign_by_ref( 'groupInfo', $groupInfo );
+ $groupMembers = $gBitUser->get_group_users( $_REQUEST["members"] );
+ $smarty->assign_by_ref( 'groupMembers', $groupMembers );
+ $mid = "bitpackage:users/group_list_members.tpl";
+ $gBitSystem->setBrowserTitle( tra( 'Group Members' ).': '.$groupInfo['group_name'] );
+} elseif( isset($_REQUEST["save"] ) ) {
+ if( empty($_REQUEST["name"] ) ) {
+ $_REQUEST["name"] = $_REQUEST["olgroup"];
+ }
+ // modification
+
+ $_REQUEST['user_id'] = ROOT_USER_ID;
+ if( $gBitUser->storeGroup( $_REQUEST ) ) {
+ $successMsg = "Group changes were saved sucessfully.";
+ } else {
+ $errorMsg = $gBitUser->mErrors['groups'];
+ }
+ if( !empty( $_REQUEST['default_home_group'] ) ) {
+ $gBitSystem->storePreference( 'default_home_group', $_REQUEST['group_id'] );
+ } elseif( $_REQUEST['group_id'] == $gBitSystem->getPreference( 'default_home_group' ) ) {
+ // the default home group was unchecked.
+ $gBitSystem->storePreference( 'default_home_group', NULL );
+ }
+
+// $mid = 'bitpackage:users/admin_groups_list.tpl';
+} elseif (isset($_REQUEST['allper'])) {
+
+ if ($_REQUEST['oper'] == 'assign') {
+ $gBitUser->assign_level_permissions($_REQUEST['group_id'], $_REQUEST['level']);
+ } else {
+ $gBitUser->remove_level_permissions($_REQUEST['group_id'], $_REQUEST['level']);
+ }
+} elseif (isset($_REQUEST["createlevel"])) {
+ $gBitUser->create_dummy_level($_REQUEST['level']);
+} elseif (isset($_REQUEST['updateperms'])) {
+
+ $updatePerms = $gBitUser->getgroupPermissions( $_REQUEST['group_id'] );
+ foreach (array_keys($_REQUEST['level'])as $per) {
+ if( $allPerms[$per]['level'] != $_REQUEST['level'][$per] ) {
+ // we changed level. perm[] checkbox is not taken into account
+ $gBitUser->change_permission_level($per, $_REQUEST['level'][$per]);
+ }
+ if( isset($_REQUEST['perm'][$per]) && !isset($updatePerms[$per]) ) {
+ // we have an unselected perm that is now selected
+ $gBitUser->assignPermissionToGroup($per, $_REQUEST['group_id']);
+ } elseif( empty($_REQUEST['perm'][$per]) && isset($updatePerms[$per]) ) {
+ // we have a selected perm that is now UNselected
+ $gBitUser->remove_permission_from_group($per, $_REQUEST['group_id']);
+ }
+ }
+ // let's reload just to be safe.
+ $allPerms = $gBitUser->getGroupPermissions();
+} elseif (isset($_REQUEST["action"])) {
+// Process a form to remove a group
+
+ if( $_REQUEST["action"] == 'delete' ) {
+ if( $_REQUEST['group_id'] == $gBitSystem->getPreference( 'default_home_group' ) ) {
+ $gBitSystem->setPreference( 'default_home_group', NULL );
+ }
+ $gBitUser->remove_group($_REQUEST['group_id']);
+ $successMsg = "The group ".$_REQUEST['group_id']." was deleted.";
+ unset( $_REQUEST['group_id'] );
+ } elseif ($_REQUEST["action"] == 'remove') {
+ $gBitUser->remove_permission_from_group( $_REQUEST["permission"], $_REQUEST['group_id'] );
+ $successMsg = 'The permission '.$_REQUEST['permission'].' was removed successflly. <a href="'.USERS_PKG_URL.'admin/edit_group.php?action=assign&amp;perm='.$_REQUEST['permission'].'&amp;group_id='.$_REQUEST['group_id'].'&amp;pacakge='.$_REQUEST['package'].'">Undo last action.</a>';
+ } elseif( $_REQUEST["action"] == 'create' ) {
+ $mid = 'bitpackage:users/admin_group_edit.tpl';
+ $gBitSystem->setBrowserTitle( tra( 'Create New Group' ) );
+ } elseif ($_REQUEST["action"] == 'assign') {
+ $gBitUser->assignPermissionToGroup($_REQUEST["perm"], $_REQUEST['group_id']);
+ }
+}
+
+// get content and pass it on to the template
+include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' );
+$cList['NULL'] = '';
+foreach( $contentList['data'] as $cItem ) {
+ $cList[$contentTypes[$cItem['content_type_guid']]][$cItem['content_id']] = $cItem['title'].' [id: '.$cItem['content_id'].']';
+}
+$smarty->assign( 'contentList', $cList );
+
+$inc = array();
+if( empty( $mid ) ) {
+ if( !empty( $_REQUEST['group_id'] ) ) {
+ $groupInfo = $gBitUser->getGroupInfo( $_REQUEST['group_id'] );
+ $rs = array();
+ $gBitUser->getIncludedGroups( $_REQUEST['group_id'], $rs );
+ foreach( array_keys( $groupList["data"] ) as $groupId ) {
+ $groupList["data"][$groupId]['included'] = isset( $rs[$groupId] ) ? 'y' : 'n';
+ }
+ $levels = $gBitUser->get_permission_levels();
+ sort($levels);
+ $smarty->assign('levels', $levels);
+ $smarty->assign_by_ref('defaultGroupId', $gBitSystem->getPreference( 'default_home_group' ) );
+ $smarty->assign_by_ref('groupInfo', $groupInfo);
+ $smarty->assign_by_ref( 'allPerms', $allPerms );
+
+ $gBitSystem->setBrowserTitle( tra( 'Admininster Group' ).': '.$groupInfo['group_name'].' '.(isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : '') );
+ $mid = 'bitpackage:users/admin_group_edit.tpl';
+ } else {
+ $gBitSystem->setBrowserTitle( tra( 'Admin List Groups' ) );
+ $_REQUEST['group_id'] = 0;
+ $mid = 'bitpackage:users/admin_groups_list.tpl';
+ }
+}
+$smarty->assign('groups', $groupList['data']);
+$smarty->assign('successMsg',$successMsg);
+$smarty->assign('errorMsg',$errorMsg);
+// probably obsolete now
+//$smarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'edit').'TabSelect', 'tdefault' );
+
+
+// Display the template for group administration
+$gBitSystem->display( $mid );
+?>
diff --git a/admin/index.php b/admin/index.php
new file mode 100644
index 0000000..49471a2
--- /dev/null
+++ b/admin/index.php
@@ -0,0 +1,162 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/admin/index.php,v 1.1 2005/06/19 05:12:23 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../../bit_setup_inc.php' );
+
+function batchImportUsers() {
+ global $smarty;
+ $fname = $_FILES['csvlist']['tmp_name'];
+ $fhandle = fopen($fname, "r");
+ //Get the field names
+ $fields = fgetcsv($fhandle, 1000);
+ //any?
+ if (!$fields[0]) {
+ $smarty->assign('msg', tra("The file is not a CSV file or has not a correct syntax"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ //now load the users in a table
+ while (!feof($fhandle)) {
+ if( $data = fgetcsv($fhandle, 1000) ) {
+ for ($i = 0; $i < count($fields); $i++) {
+ @$ar[$fields[$i]] = $data[$i];
+ }
+ $userrecs[] = $ar;
+ }
+ }
+ fclose ($fhandle);
+ // any?
+ if (!is_array($userrecs)) {
+ $smarty->assign('msg', tra("No records were found. Check the file please!"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ // Process user array
+ $added = 0;
+ $i = 1;
+ foreach ($userrecs as $u) {
+ $newUser = new BitUser();
+ //untested - spiderr
+ if( $newUser->store( $u ) ) {
+ if( !empty( $u['groups'] ) ) {
+ $grps = explode(",", $u['groups']);
+ foreach ($grps as $grp) {
+ if( $groupId = $newUser->group_exists( $grp, ROOT_USER_ID ) ) {
+ $newUser->addUserToGroup( $newUser->mUserId, $groupId );
+ }
+ }
+ }
+ $added++;
+ } else {
+ $discarded[$i] = implode( ',', $newUser->mErrors );
+ }
+ unset( $newUser );
+ $i++;
+ }
+
+ $smarty->assign('added', $added);
+ if (@is_array($discarded)) {
+ $smarty->assign('discarded', count($discarded));
+ }
+ @$smarty->assign_by_ref('discardlist', $discarded);
+}
+
+$gBitSystem->verifyPermission( 'bit_p_admin_users' );
+
+$feedback = array();
+
+// Process the form to add a user here
+if (isset($_REQUEST["newuser"])) {
+
+ $newUser = new BitPermUser();
+ // Check if the user already exists
+ if( $newUser->store( $_REQUEST ) ) {
+ $smarty->assign( 'addSuccess', "User Added Successfully" );
+ } else {
+ $smarty->assign_by_ref( 'newUser', $_REQUEST );
+ $smarty->assign( 'errors', $newUser->mErrors );
+ }
+ // if no user data entered, check if it's a batch upload
+} elseif( isset( $_REQUEST["batchimport"]) ) {
+ if( $_FILES['csvlist']['size'] && is_uploaded_file($_FILES['csvlist']['tmp_name'] ) ) {
+ batchImportUsers();
+ }
+} elseif( isset( $_REQUEST["assume_user"]) ) {
+ $userInfo = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST["assume_user"] ) );
+ if( isset( $_REQUEST["confirm"] ) ) {
+ if( $gBitUser->assumeUser( $_REQUEST["assume_user"] ) ) {
+ header( 'Location: '.USERS_PKG_URL.'my.php' );
+ die;
+ }
+ } else {
+ $gBitSystem->setBrowserTitle( 'Assumer User Identity' );
+ $formHash['assume_user'] = $_REQUEST['assume_user'];
+ $msgHash = array(
+ 'confirm_item' => tra( 'This will log you in as the user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
+ );
+ $gBitSystem->confirmDialog( $formHash,$msgHash );
+ }
+} elseif( !empty( $_REQUEST['find'] ) ) {
+ $title = 'Find Users';
+}
+
+// Process actions here
+// Remove user or remove user from group
+if (isset($_REQUEST["action"])) {
+
+ $formHash['action'] = $_REQUEST['action'];
+ if ($_REQUEST["action"] == 'delete') {
+ $formHash['user_id'] = $_REQUEST['user_id'];
+ $userInfo = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST["user_id"] ) );
+ if( !empty( $userInfo['user_id'] ) ) {
+ if( isset( $_REQUEST["confirm"] ) ) {
+ if( $gBitUser->expunge( $_REQUEST["user_id"] ) ) {
+ $feedback['success'][] = tra( 'User Deleted' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>";
+ }
+ } else {
+ $gBitSystem->setBrowserTitle( 'Delete user' );
+ $msgHash = array(
+ 'confirm_item' => tra( 'Are you sure you want to remove the user?' ),
+ 'warning' => tra( 'This will permentally delete the user' )." <strong>$userInfo[real_name] ($userInfo[login])</strong>",
+ );
+ $gBitSystem->confirmDialog( $formHash,$msgHash );
+ }
+ } else {
+ $feedback['error'][] = tra( 'User not found' );
+ }
+ }
+ if ($_REQUEST["action"] == 'removegroup') {
+ $gBitUser->removeUserFromGroup($_REQUEST["user"], $_REQUEST["group"]);
+ }
+}
+
+// get default group and pass it to tpl
+foreach( $gBitUser->getDefaultGroup() as $defaultGroupId => $defaultGroupName ) {
+ $smarty->assign('defaultGroupId', $defaultGroupId );
+ $smarty->assign('defaultGroupName', $defaultGroupName );
+}
+
+$_REQUEST['max_records'] = 20;
+$gBitUser->getList( $_REQUEST );
+$smarty->assign_by_ref('users', $_REQUEST["data"]);
+if (isset($_REQUEST["numrows"]))
+ $_REQUEST["control"]["numrows"] = $_REQUEST["numrows"];
+else
+ $_REQUEST["control"]["numrows"] = 10;
+$_REQUEST["control"]["URL"] = USERS_PKG_URL."admin/index.php";
+$smarty->assign_by_ref('control', $_REQUEST["control"]);
+
+
+// Get groups (list of groups)
+$grouplist = $gBitUser->getGroups('', '', 'group_name_asc');
+$smarty->assign( 'grouplist', $grouplist );
+$smarty->assign( 'feedback', $feedback );
+
+$smarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'userlist').'TabSelect', 'tdefault' );
+
+// Display the template
+$gBitSystem->display( 'bitpackage:users/users_admin.tpl', (!empty( $title ) ? $title : 'Edit Users' ) );
+?>
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
new file mode 100644
index 0000000..70ebb24
--- /dev/null
+++ b/admin/schema_inc.php
@@ -0,0 +1,329 @@
+<?php
+
+$tables = array(
+
+'sessions' => "
+ expiry I8 unsigned NOTNULL,
+ sesskey C(32) NOTNULL,
+ expireref C(64),
+ session_data X
+",
+
+'users_users' => "
+ user_id I4 PRIMARY,
+ content_id I4,
+ email C(200),
+ login C(40),
+ real_name C(64),
+ password C(32),
+ provpass C(32),
+ default_group_id I4,
+ last_login I8,
+ current_login I8,
+ registration_date I8 NOTNULL,
+ challenge C(32),
+ pass_due I8,
+ hash C(32),
+ created I8,
+ avatar_attachment_id I4,
+ portrait_attachment_id I4,
+ logo_attachment_id I4", /* temporarily removed do to indterminate scan order
+ CONSTRAINT ', CONSTRAINT `tiki_avatar_attach_ref` FOREIGN KEY (`avatar_attachment_id`) REFERENCES `".BIT_DB_PREFIX."tiki_attachments` (`attachment_id`)
+ , CONSTRAINT `tiki_users_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."tiki_content` (`content_id`)
+ , CONSTRAINT `tiki_portrait_attach_ref` FOREIGN KEY (`portrait_attachment_id`) REFERENCES `".BIT_DB_PREFIX."tiki_attachments` (`attachment_id`)
+ , CONSTRAINT `tiki_logo_attach_ref` FOREIGN KEY (`logo_attachment_id`) REFERENCES `".BIT_DB_PREFIX."tiki_attachments` (`attachment_id`)'
+",*/
+
+'tiki_sessions' => "
+ session_id C(32) PRIMARY,
+ user_id I4,
+ timestamp I8
+",
+
+'tiki_user_bookmarks_urls' => "
+ url_id I4 AUTO PRIMARY,
+ name C(30),
+ url C(250),
+ data X,
+ last_updated I8,
+ folder_id I4 NOTNULL,
+ user_id I4 NOTNULL
+ CONSTRAINTS ', CONSTRAINT `tiki_user_bookmarks_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_menus' => "
+ menu_id I4 AUTO PRIMARY,
+ user_id I4 NOTNULL,
+ url C(250),
+ name C(40),
+ position I4,
+ mode C(1)
+ CONSTRAINTS ', CONSTRAINT `tiki_user_menus_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_tasks' => "
+ task_id I4 AUTO PRIMARY,
+ user_id I4 NOTNULL,
+ title C(250),
+ description X,
+ date I8,
+ status C(1),
+ priority I4,
+ completed I8,
+ percentage I4
+ CONSTRAINTS ', CONSTRAINT `tiki_user_tasks_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_watches' => "
+ user_id I4 PRIMARY,
+ event C(40) PRIMARY,
+ object C(120) PRIMARY,
+ hash C(32),
+ title C(250),
+ type C(200),
+ url C(250),
+ email C(200)
+ CONSTRAINTS ', CONSTRAINT `tiki_user_watches_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_userfiles' => "
+ file_id I4 AUTO PRIMARY,
+ user_id I4 NOTNULL,
+ name C(200),
+ filename C(200),
+ filetype C(200),
+ filesize C(200),
+ data B,
+ hits I4,
+ is_file C(1),
+ path C(255),
+ created I8
+ CONSTRAINTS ', CONSTRAINT `tiki_userfiles_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'users_permissions' => "
+ perm_name C(30) PRIMARY,
+ perm_desc C(250),
+ level C(80),
+ package C(100)
+",
+
+'users_groups' => "
+ group_id I4 PRIMARY,
+ user_id I4 NOTNULL,
+ group_name C(30),
+ is_default C(1),
+ group_desc C(255),
+ group_home C(255)
+ CONSTRAINTS ', CONSTRAINT `users_groups_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'users_groups_inclusion' => "
+ group_id I4 PRIMARY,
+ include_group_id I4 PRIMARY
+",
+
+'users_grouppermissions' => "
+ group_id I4 PRIMARY,
+ perm_name C(30) PRIMARY,
+ value C(1) default ''
+ CONSTRAINTS ', CONSTRAINT `users_groupperm_group_ref` FOREIGN KEY (`group_id`) REFERENCES `".BIT_DB_PREFIX."users_groups` (`group_id`)
+ , CONSTRAINT `users_groupperm_perm_ref` FOREIGN KEY (`perm_name`) REFERENCES `".BIT_DB_PREFIX."users_permissions` (`perm_name`)'
+",
+
+'users_objectpermissions' => "
+ group_id I4 PRIMARY,
+ perm_name C(30) PRIMARY,
+ object_type C(20) PRIMARY,
+ object_id I4 PRIMARY
+ CONSTRAINTS ', CONSTRAINT `users_objectperm_group_ref` FOREIGN KEY (`group_id`) REFERENCES `".BIT_DB_PREFIX."users_groups` (`group_id`)
+ , CONSTRAINT `users_objectperm_perm_ref` FOREIGN KEY (`perm_name`) REFERENCES `".BIT_DB_PREFIX."users_permissions` (`perm_name`)'
+",
+
+'users_groups_map' => "
+ user_id I4 PRIMARY,
+ group_id I4 PRIMARY
+ CONSTRAINTS ', CONSTRAINT `users_groups_map_group_ref` FOREIGN KEY (`group_id`) REFERENCES `".BIT_DB_PREFIX."users_groups` (`group_id`)
+ , CONSTRAINT `users_groups_map_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'users_cnxn' => "
+ user_id I4,
+ cookie C(64),
+ ip C(16),
+ last_get I8,
+ connect_time I8,
+ get_count I8,
+ user_agent C(128),
+ current_view X
+ CONSTRAINTS ', CONSTRAINT `users_cnxn_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_bookmarks_folders' => "
+ folder_id I4 AUTO PRIMARY,
+ parent_id I4,
+ user_id I4 PRIMARY,
+ name C(30)
+",
+
+'tiki_user_modules' => "
+ name C(200) PRIMARY,
+ title C(40),
+ data X
+",
+
+'tiki_user_postings' => "
+ user_id I4 PRIMARY,
+ posts I8,
+ last I8,
+ first I8,
+ level I4
+ CONSTRAINTS ', CONSTRAINT `tiki_user_postings_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_preferences' => "
+ user_id I4 PRIMARY,
+ pref_name C(40) PRIMARY,
+ value C(250)
+ CONSTRAINTS ', CONSTRAINT `tiki_user_preferences_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_user_votings' => "
+ user_id I4 PRIMARY,
+ id C(160) PRIMARY
+ CONSTRAINTS ', CONSTRAINT `tiki_user_votings_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+'tiki_userpoints' => "
+ user_id I4,
+ points decimal(8,2),
+ voted I4 DEFAULT NULL
+ CONSTRAINTS ', CONSTRAINT `tiki_userpoints_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+"
+);
+
+global $gBitInstaller;
+
+foreach( array_keys( $tables ) AS $tableName ) {
+ $gBitInstaller->registerSchemaTable( USERS_PKG_DIR, $tableName, $tables[$tableName], TRUE );
+}
+
+$indices = array (
+ 'users_users_email_idx' => array( 'table' => 'users_users', 'cols' => 'email', 'opts' => array('UNIQUE') ),
+ 'users_users_login_idx' => array( 'table' => 'users_users', 'cols' => 'login', 'opts' => array('UNIQUE') ),
+ 'users_permissions_name_idx' => array( 'table' => 'users_permissions', 'cols' => 'perm_name', 'opts' => array('UNIQUE') ),
+ 'users_users_avatar_atment_idx' => array( 'table' => 'users_users', 'cols' => 'avatar_attachment_id', 'opts' => NULL ),
+ 'users_groups_user_idx' => array( 'table' => 'users_groups', 'cols' => 'user_id', 'opts' => NULL ),
+ 'users_groups_user_name_idx' => array( 'table' => 'users_groups', 'cols' => 'user_id,group_name', 'opts' => array('UNIQUE') ),
+ 'users_groupperm_group_idx' => array( 'table' => 'users_grouppermissions', 'cols' => 'group_id', 'opts' => NULL ),
+ 'users_groupperm_perm_idx' => array( 'table' => 'users_grouppermissions', 'cols' => 'perm_name', 'opts' => NULL ),
+ 'users_objectperm_group_idx' => array( 'table' => 'users_objectpermissions', 'cols' => 'group_id', 'opts' => NULL ),
+ 'users_objectperm_perm_idx' => array( 'table' => 'users_objectpermissions', 'cols' => 'perm_name', 'opts' => NULL ),
+ 'users_objectperm_object_idx' => array( 'table' => 'users_objectpermissions', 'cols' => 'object_id', 'opts' => NULL ),
+ 'users_permissions_perm_idx' => array( 'table' => 'users_permissions', 'cols' => 'perm_name', 'opts' => NULL ),
+ 'users_groups_map_user_idx' => array( 'table' => 'users_groups_map', 'cols' => 'user_id', 'opts' => NULL ),
+ 'users_groups_map_group_idx' => array( 'table' => 'users_groups_map', 'cols' => 'group_id', 'opts' => NULL )
+);
+
+
+
+$gBitInstaller->registerSchemaIndexes( USERS_PKG_DIR, $indices );
+
+$gBitInstaller->registerPackageInfo( USERS_PKG_NAME, array(
+ 'description' => "The users package contains all user information and gives you the possiblity to assign permissions to groups of users.",
+ 'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
+ 'version' => '0.1',
+ 'state' => 'experimental',
+ 'dependencies' => '',
+) );
+
+// ### Sequences
+$sequences = array (
+ 'users_users_user_id_seq' => array( 'start' => 2 ),
+ 'users_groups_id_seq' => array( 'start' => 4 )
+);
+$gBitInstaller->registerSchemaSequences( USERS_PKG_DIR, $sequences );
+
+// ### Default MenuOptions
+$gBitInstaller->registerMenuOptions( USERS_PKG_NAME, array(
+ array(42,'o','My files', USERS_PKG_DIR.'userfiles.php',95,'feature_userfiles','bit_p_userfiles','Registered')
+) );
+
+// ### Default Preferences
+$gBitInstaller->registerPreferences( USERS_PKG_NAME, array(
+ array('users','webserverauth','n'),
+ array('users','auth_create_user_auth','n'),
+ array('users','auth_create_gBitDbUser','n'),
+ array('users','auth_ldap_adminpass',''),
+ array('users','auth_ldap_adminuser',''),
+ array('users','auth_ldap_basedn',''),
+ array('users','auth_ldap_groupattr','cn'),
+ array('users','auth_ldap_groupdn',''),
+ array('users','auth_ldap_groupoc','groupOfUniqueNames'),
+ array('users','auth_ldap_host','localhost'),
+ array('users','auth_ldap_memberattr','uniqueMember'),
+ array('users','auth_ldap_memberisdn','n'),
+ array('users','auth_ldap_port','389'),
+ array('users','auth_ldap_scope','sub'),
+ array('users','auth_ldap_userattr','uid'),
+ array('users','auth_ldap_userdn',''),
+ array('users','auth_ldap_useroc','inetOrgPerson'),
+ array('users','auth_method','tiki'),
+ array('users','auth_skip_admin','y'),
+ array('users','allowRegister','y'),
+ array('users','feature_userfiles','n'),
+ array('users','forgotPass','y'),
+ array('users','eponymousGroups','n'),
+ array('users','modallgroups','y'),
+ array('users','pass_chr_num','n'),
+ array('users','pass_due','999'),
+ array('users','registerPasscode',''),
+ array('users','rememberme','disabled'),
+ array('users','remembertime','7200'),
+ array('users','rnd_num_reg','n'),
+ array('users','userfiles_quota','30'),
+ array('users','uf_use_db','y'),
+ array('users','uf_use_dir',''),
+ array('users','useRegisterPasscode','n'),
+ array('users','validateUsers','n'),
+ array('users','validateEmail','n'),
+ array('users','feature_challenge','n'),
+ array('users','min_pass_length','4'),
+ array('users','feature_clear_passwords','n'),
+ array('users','feature_custom_home','n'),
+ array('users','feature_user_bookmarks','n'),
+ array('users','feature_tasks','n'),
+ array('users','feature_usermenu','n'),
+ array('users','feature_userPreferences','y'),
+ array('users','change_theme','y'),
+ array('users','display_name','real_name'),
+ array('users','change_language','y'),
+ array('users','case_sensitive_login','y'),
+ array('common', 'feature_user_watches','n'),
+) );
+
+// ### Default Permissions
+$gBitInstaller->registerUserPermissions( USERS_PKG_NAME, array(
+ array('bit_p_userfiles', 'Can upload personal files', 'registered', 'users'),
+ array('bit_p_user_group_perms', 'Can assign permissions to personal groups', 'editors', 'users'),
+ array('bit_p_user_group_members', 'Can assign users to personal groups', 'registered', 'users'),
+ array('bit_p_user_group_subgroups', 'Can include other groups in groups', 'editors', 'users'),
+ array('bit_p_create_bookmarks', 'Can create user bookmarksche user bookmarks', 'registered', 'users'),
+ array('bit_p_configure_modules', 'Can configure modules', 'registered', 'users'),
+ array('bit_p_cache_bookmarks', 'Can cache user bookmarks', 'admin', 'users'),
+ array('bit_p_usermenu', 'Can create items in personal menu', 'registered', 'users'),
+ array('bit_p_tasks', 'Can use tasks', 'registered', 'users'),
+ array('bit_p_assume_users', 'Can assume the identity of other users', 'admin', 'users'),
+ array('bit_p_admin_users', 'Can edit the information for other users', 'admin', 'users'),
+ array('bit_p_view_tabs_and_tools', 'Can view tab and tool links', 'basic', 'users'),
+) );
+
+
+$gBitInstaller->registerSchemaDefault( USERS_PKG_NAME, array(
+ "INSERT INTO `".BIT_DB_PREFIX."users_groups` (`user_id`, `group_id`, `group_name`,`group_desc`) VALUES ( ".ROOT_USER_ID.", 1, 'Administrators','Site operators')",
+ "INSERT INTO `".BIT_DB_PREFIX."users_groups` (`user_id`, `group_id`, `group_name`,`group_desc`) VALUES ( ".ROOT_USER_ID.", -1, 'Anonymous','Public users not logged')",
+ "INSERT INTO `".BIT_DB_PREFIX."users_groups` (`user_id`, `group_id`, `group_name`,`group_desc`) VALUES ( ".ROOT_USER_ID.", 2, 'Editors','Site Editors')",
+ "INSERT INTO `".BIT_DB_PREFIX."users_groups` (`user_id`, `group_id`, `group_name`,`group_desc`,`is_default`) VALUES ( ".ROOT_USER_ID.", 3, 'Registered', 'Users logged into the system', 'y')",
+) );
+
+?>
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php
new file mode 100644
index 0000000..7cceffa
--- /dev/null
+++ b/admin/upgrade_inc.php
@@ -0,0 +1,263 @@
+<?php
+global $gBitSystem, $gUpgradeFrom, $gUpgradeTo;
+
+$upgrades = array(
+
+'BONNIE' => array(
+ 'CLYDE' => array(
+
+// STEP 1
+array( 'QUERY' =>
+ array( 'MYSQL' => array(
+ "ALTER TABLE `".BIT_DB_PREFIX."tiki_user_preferences` DROP PRIMARY KEY",
+ "ALTER TABLE `".BIT_DB_PREFIX."users_usergroups` DROP PRIMARY KEY",
+ "ALTER TABLE `".BIT_DB_PREFIX."users_grouppermissions` DROP PRIMARY KEY",
+ "ALTER TABLE `".BIT_DB_PREFIX."tiki_group_inclusion` DROP PRIMARY KEY",
+ )),
+),
+
+// STEP 1
+array( 'DATADICT' => array(
+array( 'RENAMETABLE' => array(
+ 'users_usergroups' => 'users_groups_map',
+ 'tiki_group_inclusion' => 'users_groups_inclusion',
+ )
+),
+array( 'RENAMECOLUMN' => array(
+ 'users_users' => array(
+ '`userId`' => '`user_id` I4',
+ '`lastLogin`' => '`last_login` I8',
+ '`currentLogin`' => '`current_login` I8',
+ '`registrationDate`' => '`registration_date` I8',
+// '`avatarName`' => '`avatar_name`',
+// '`avatarSize`' => '`avatar_size`',
+// '`avatarFileType`' => '`avatar_file_type`',
+// '`avatarData`' => '`avatar_data`',
+// '`avatarLibName`' => '`avatar_lib_name`',
+// '`avatarType`' => '`avatar_type`',
+ ),
+ 'users_groups_map' => array(
+ '`userId`' => '`user_id` I4'
+ ),
+ 'tiki_user_preferences' => array(
+ '`prefName`' => '`pref_name` C(40)'
+ ),
+// 'users_groups_inclusion' => array('`groupName`', '`group_name`'),
+// 'users_groups_inclusion' => array('`includeGroup`', '`include_group`'),
+ 'tiki_user_bookmarks_folders' => array(
+ '`folderId`' => '`folder_id` I4',
+ '`parentId`' => '`parent_id` I4',
+ ),
+ 'tiki_user_bookmarks_urls' => array(
+ '`urlId`' => '`url_id` I4',
+ '`lastUpdated`' => '`last_updated` I8',
+ '`folderId`' => '`folder_id` I4',
+ ),
+ 'tiki_user_menus' => array(
+ '`menuId`' => '`menu_id` I4',
+ ),
+ 'users_grouppermissions' => array(
+ '`permName`' => '`perm_name` C(30)',
+ ),
+ 'users_groups' => array(
+ '`groupName`' => '`group_name` C(30)',
+ '`groupDesc`' => '`group_desc` C(255)',
+ '`groupHome`' => '`group_home` C(255)',
+ ),
+ 'users_groups_map' => array(
+ '`userId`' => '`user_id` I4'
+ ),
+ 'users_objectpermissions' => array(
+ '`permName`' => '`perm_name` C(30)',
+ '`objectType`' => '`object_type` C(20)',
+ ),
+ 'users_permissions' => array(
+ '`permName`' => '`perm_name` C(30)',
+ '`permDesc`' => '`perm_desc` C(250)',
+ '`type`' => '`package` C(100)',
+ ),
+ 'tiki_userfiles' => array(
+ '`fileId`' => '`file_id` I4',
+ '`isFile`' => '`is_file` C(1)',
+ ),
+ 'tiki_user_tasks' => array(
+ '`taskId`' => '`task_id` I4' ,
+ )
+)),
+
+array( 'ALTER' => array(
+ 'users_users' => array(
+ 'content_id' => array( '`content_id`', 'I4' ), // , 'NOTNULL' ),
+ 'default_group_id' => array( '`default_group_id`', 'I4' ), // , 'NOTNULL' ),
+ 'real_name' => array( '`real_name`', 'VARCHAR(64)'),
+ 'avatar_attachment_id' => array( '`avatar_attachment_id`', 'I4' ), // , 'NOTNULL' ),
+ 'portrait_attachment_id' => array( '`portrait_attachment_id`', 'I4' ), // , 'NOTNULL' ),
+ 'logo_attachment_id' => array( '`logo_attachment_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_sessions' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ 'session_id' => array( '`session_id`', 'VARCHAR(32)' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_bookmarks_folders' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_bookmarks_urls' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_menus' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_preferences' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_tasks' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'tiki_user_watches' => array(
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'users_groups' => array(
+ 'group_id' => array( '`group_id`', 'I4' ), // , 'NOTNULL' ),
+ 'user_id' => array( '`user_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'users_grouppermissions' => array(
+ 'group_id' => array( '`group_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'users_objectpermissions' => array(
+ 'group_id' => array( '`group_id`', 'I4' ), // , 'NOTNULL' ),
+ 'object_id' => array( '`object_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'users_groups_map' => array(
+ 'group_id' => array( '`group_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+ 'users_groups_inclusion' => array(
+ 'group_id' => array( '`group_id`', 'I4' ), // , 'NOTNULL' ),
+ 'include_group_id' => array( '`include_group_id`', 'I4' ), // , 'NOTNULL' ),
+ ),
+)),
+
+array( 'CREATE' => array (
+'users_cnxn' => "
+ user_id I4,
+ cookie C(64),
+ ip C(16),
+ last_get I8,
+ connect_time I8,
+ get_count I8,
+ user_agent C(128),
+ current_view X
+ CONSTRAINTS ', CONSTRAINT `users_cnxn_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)'
+",
+
+)),
+
+)),
+
+// STEP 2
+array( 'PHP' => '
+ global $gBitSystem;
+ $max = $gBitSystem->GetOne( "SELECT MAX(user_id) FROM `'.BIT_DB_PREFIX.'users_users`" );
+ $gBitSystem->mDb->mDb->CreateSequence( "users_users_user_id_seq", $max + 1 );
+ $gBitSystem->mDb->mDb->CreateSequence( "users_groups_id_seq", 1 );
+ $gBitSystem->query( "UPDATE `'.BIT_DB_PREFIX.'users_groups` SET `group_id`=-1 WHERE group_name=\'Anonymous\'" );
+ $gBitSystem->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_groups_map` (`group_id`,`user_id`,`groupName`) VALUES ( -1, '.ANONYMOUS_USER_ID.',\'Anonymous\' )" );
+ $groupNames = $gBitSystem->mDb->GetCol( "SELECT `group_name` FROM `'.BIT_DB_PREFIX.'users_groups` WHERE `group_name` != \'Anonymous\'" );
+ foreach( $groupNames as $name ) {
+ $id = $gBitSystem->mDb->mDb->GenID( "users_groups_id_seq" );
+ $gBitSystem->query( "UPDATE `'.BIT_DB_PREFIX.'users_groups` SET group_id=? WHERE group_name=?", array( $id, $name ) );
+ }
+' ),
+
+// STEP 3
+array( 'QUERY' =>
+ array( 'SQL92' => array(
+ "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email`, `user_id` ) VALUES ('Anonymous', 'anonymous', 'anonymous@localhost', ".ANONYMOUS_USER_ID.")",
+// TikiWiki assigns the creator user foreign key as 'system' even if there is now 'system' user - XOXO spiderr
+// In order for all pages to upgrade, there must be at least an 'admin' and 'system' user
+ "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email`, `user_id` ) VALUES ('Administrator', 'admin', 'root@localhost', ".ROOT_USER_ID.")",
+ "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email` ) VALUES ('System', 'system', 'system@localhost' )",
+ "UPDATE `".BIT_DB_PREFIX."users_users` SET `login`='system' WHERE `user_id`=".ROOT_USER_ID,
+ "UPDATE `".BIT_DB_PREFIX."tiki_sessions` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_sessions`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_preferences` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_preferences`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_bookmarks_folders`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_bookmarks_urls`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_menus` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_menus`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_tasks` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_tasks`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."tiki_user_watches` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_user_watches`.`user`)",
+ "UPDATE `".BIT_DB_PREFIX."users_groups_map` SET `group_id`=(SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups` WHERE `".BIT_DB_PREFIX."users_groups`.`group_name`=`".BIT_DB_PREFIX."users_groups_map`.`groupName`)",
+ "UPDATE `".BIT_DB_PREFIX."users_grouppermissions` SET `group_id`=(SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups` WHERE `".BIT_DB_PREFIX."users_groups`.`group_name`=`".BIT_DB_PREFIX."users_grouppermissions`.`groupName`)",
+ "UPDATE `".BIT_DB_PREFIX."users_objectpermissions` SET `group_id`=(SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups` WHERE `".BIT_DB_PREFIX."users_groups`.`group_name`=`".BIT_DB_PREFIX."users_objectpermissions`.`groupName`)",
+ "UPDATE `".BIT_DB_PREFIX."users_groups_inclusion` SET `group_id`=(SELECT `group_id` FROM users_groups WHERE `group_name`=`".BIT_DB_PREFIX."users_groups_inclusion`.`groupName`)",
+ "UPDATE `".BIT_DB_PREFIX."users_groups_inclusion` SET `include_group_id`=(SELECT `group_id` FROM users_groups WHERE `group_name`=`includeGroup`)",
+ "UPDATE `".BIT_DB_PREFIX."users_groups` SET `user_id`=1",
+ "UPDATE `".BIT_DB_PREFIX."users_groups` SET `is_default`='y' WHERE `group_name`='Registered'",
+ ),
+)),
+
+// STEP 4
+array( 'DATADICT' => array(
+array( 'DROPCOLUMN' => array(
+ 'tiki_sessions' => array( '`user`', '`sessionId`' ),
+ 'users_groups_map' => array( '`groupName`' ),
+ 'users_grouppermissions' => array( '`groupName`' ),
+ 'users_objectpermissions' => array( '`groupName`' ),
+ 'users_groups_inclusion' => array( '`groupName`' ),
+ 'tiki_user_bookmarks_folders' => array( '`user`' ),
+ 'tiki_user_bookmarks_urls' => array( '`user`' ),
+ 'tiki_user_menus' => array( '`user`' ),
+ 'tiki_user_preferences' => array( '`user`' ),
+ 'tiki_user_tasks' => array( '`user`' ),
+ 'tiki_user_watches' => array( '`user`' ),
+ )),
+)),
+
+// STEP 5
+array( 'SQL92' =>
+ array( 'QUERY' => array(
+ "INSERT INTO `".BIT_DB_PREFIX."users_groups_map` (`group_id`, `user_id` ) VALUES ( -1, ".ANONYMOUS_USER_ID." )",
+ ),
+)),
+
+// STEP 2
+array( 'PHP' => '
+ global $gBitSystem;
+ $adminGroup = $gBitSystem->GetOne( "SELECT `group_id` FROM `'.BIT_DB_PREFIX.'users_grouppermissions` where perm_name=\'bit_p_admin\'" );
+ if( empty( $adminGroup ) ) {
+ $adminGroup = $gBitSystem->GetOne( "SELECT `group_id` FROM `'.BIT_DB_PREFIX.'users_groups` where LOWER(`group_name`) LIKE \'administrator%\'" );
+ if( empty( $adminGroup ) ) {
+ $adminGroup = $gBitSystem->mDb->mDb->GenID( "users_groups_id_seq" );
+ $gBitSystem->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_groups` (`group_id`,`group_name`) VALUES ( $adminGroup, \'Administrators\' )" );
+ }
+ $gBitSystem->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_groups_map` (`group_id`,`user_id`) VALUES ( $adminGroup, '.ROOT_USER_ID.' )" );
+ $gBitSystem->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_grouppermissions` (`perm_name`, `group_id`) VALUES( \'bit_p_admin\', $adminGroup )" );
+ }
+' ),
+
+// STEP 4
+array( 'DATADICT' => array(
+array( 'CREATEINDEX' => array(
+ 'tiki_user_prefs_idx' => array( 'tiki_user_preferences', '`user_id`', array() ),
+ 'tiki_user_prefs_un_idx' => array( 'tiki_user_preferences', '`user_id`,`pref_name`', array( 'UNIQUE' ) ),
+ 'users_groups_map_user_idx' => array( 'users_groups_map', '`user_id`', array() ),
+ 'users_groups_map_group_idx' => array( 'users_groups_map', '`group_id`', array() ),
+ 'users_groups_map_ug_idx' => array( 'users_groups_map', '`user_id`,`group_id`', array( 'UNIQUE' ) ),
+ 'users_groupperms_group_idx' => array( 'users_grouppermissions', '`group_id`', array() ),
+ 'users_groupperms_group_idx' => array( 'users_grouppermissions', '`group_id`,`perm_name`', array( 'UNIQUE' ) ),
+ 'users_groups_inc_group_idx' => array( 'users_groups_inclusion', '`group_id`', array() ),
+ 'users_groups_inc_gi_idx' => array( 'users_groups_inclusion', '`group_id`,`include_group_id`', array( 'UNIQUE' ) ),
+ )),
+)),
+
+
+
+ )
+)
+
+);
+
+if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) {
+ $gBitSystem->registerUpgrade( USERS_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] );
+}
+
+
+?>
diff --git a/assigned_modules.php b/assigned_modules.php
new file mode 100644
index 0000000..1c166dd
--- /dev/null
+++ b/assigned_modules.php
@@ -0,0 +1,107 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/assigned_modules.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+global $gEditMode;
+$gEditMode = 'layout';
+require_once( '../bit_setup_inc.php' );
+include_once( KERNEL_PKG_PATH.'mod_lib.php' );
+
+$gBitSystem->verifyPermission('bit_p_configure_modules');
+
+if ($gBitSystem->getPreference('feature_user_layout') != 'y' && $gBitSystem->getPreference('feature_user_layout') != 'h' && $gBitSystem->getPreference('feature_user_theme') != 'y' && $gBitSystem->getPreference('feature_user_theme') != 'h') {
+ $smarty->assign('msg', tra("This feature is disabled").": user layout");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+if (!$gBitUser->isRegistered()) {
+ $smarty->assign('msg', tra("Permission denied: You are not logged in"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+include_once(USERS_PKG_PATH.'lookup_user_inc.php');
+
+if ($gQueryUser->mUserId != $gBitUser->mUserId && !$gBitUser->object_has_permission($gBitUser->mUserId, $gQueryUser->mInfo['content_id'], 'bituser', 'bit_p_admin_user')) {
+ $smarty->assign('msg', tra('You do not have permission to edit this user\'s theme'));
+ $gBitSystem->display('error.tpl');
+ die;
+}
+
+$_REQUEST['fLayout'] = HOMEPAGE_LAYOUT; //we hardcode to a single layout for all users.... for now >:-)
+if (isset($_REQUEST['fSubmitSetTheme'] ) ) {
+ if( ($gBitSystem->getPreference('feature_user_theme') == 'y' || $gBitSystem->getPreference('feature_user_theme') == 'h') && isset( $_REQUEST["style"]) ) {
+
+ $gQueryUser->storePreference( 'theme', $_REQUEST["style"]);
+ $assignStyle = $_REQUEST["style"];
+ }
+} elseif (isset($_REQUEST['fSubmitSetHeading'] ) ) {
+
+ $homeHeader = substr( trim( $_REQUEST['homeHeaderData']), 0, 250 );
+ $gQueryUser->storePreference( 'homepage_header', $homeHeader );
+} elseif( isset( $_REQUEST["fSubmitAssign"] ) ) {
+
+ $fAssign = &$_REQUEST['fAssign'];
+ $fAssign['user_id'] = $gQueryUser->mUserId;
+ $fAssign['layout'] = $_REQUEST['fLayout'];
+ $modlib->storeLayout( $fAssign );
+ $smarty->assign_by_ref( 'fAssign', $fAssign );
+} elseif (isset($_REQUEST["fMove"])) {
+
+ if( isset( $_REQUEST["fMove"] ) && isset( $_REQUEST["fModule"] ) ) {
+ switch( $_REQUEST["fMove"] ) {
+ case "unassign":
+ $modlib->unassignModule( $_REQUEST['fModule'], $gQueryUser->mUserId, $_REQUEST['fLayout'] );
+ break;
+ case "up":
+ $modlib->moduleUp( $_REQUEST['fModule'], $gQueryUser->mUserId, $_REQUEST['fLayout'] );
+ break;
+ case "down":
+ $modlib->moduleDown( $_REQUEST['fModule'], $gQueryUser->mUserId, $_REQUEST['fLayout'] );
+ break;
+ case "left":
+ $modlib->modulePosition( $_REQUEST['fModule'], $gQueryUser->mUserId, $_REQUEST['fLayout'], 'l' );
+ break;
+ case "right":
+ $modlib->modulePosition( $_REQUEST['fModule'], $gQueryUser->mUserId, $_REQUEST['fLayout'], 'r' );
+ break;
+ }
+ }
+}
+$orders = array();
+for ($i = 1; $i < 20; $i++) {
+ $orders[] = $i;
+}
+$smarty->assign_by_ref('orders', $orders);
+$smarty->assign( 'homeHeaderData', $gQueryUser->getPreference( 'homepage_header' ) );
+// get styles
+if( $gBitSystem->getPreference('feature_user_theme') ) {
+ include_once( THEMES_PKG_PATH.'theme_control_lib.php' );
+ $styles = &$tcontrollib->getStyles( NULL, TRUE, TRUE );
+ $smarty->assign_by_ref( 'styles', $styles );
+ if(!isset($_REQUEST["style"])){
+ $assignStyle = $gQueryUser->getPreference( 'theme' );
+ }
+ $smarty->assign( 'assignStyle', $assignStyle );
+}
+$assignables = $modlib->getAssignableModules();
+if (count($assignables) > 0) {
+ $smarty->assign('canassign', 'y');
+} else {
+ $smarty->assign('canassign', 'n');
+}
+$modules = $gBitSystem->getLayout( $gQueryUser->mUserId, HOMEPAGE_LAYOUT, FALSE );
+$modlib->generateModuleNames( $modules );
+//print_r($modules);
+$smarty->assign_by_ref('assignables', $assignables);
+$layoutAreas = array( 'left'=>'l', 'center'=>'c', 'right'=>'r' );
+$smarty->assign_by_ref( 'layoutAreas', $layoutAreas );
+$smarty->assign_by_ref('modules', $modules);
+//print_r($modules);
+
+
+$gBitSystem->display( 'bitpackage:users/user_assigned_modules.tpl', 'Edit Layout');
+?>
diff --git a/bit_setup_inc.php b/bit_setup_inc.php
new file mode 100644
index 0000000..8037535
--- /dev/null
+++ b/bit_setup_inc.php
@@ -0,0 +1,232 @@
+<?php
+global $gBitSystem, $gBitUser, $smarty;
+
+$gBitSystem->registerPackage( 'users', dirname( __FILE__).'/', FALSE );
+
+$gBitSystem->registerAppMenu( 'login', 'Login', '', '', 'login');
+
+$gBitSystem->registerNotifyEvent( array( "user_registers" => tra("A user registers") ) );
+
+if( $gBitSystem->isFeatureActive( 'feature_userfiles' ) ) {
+ $gBitSystem->registerAppMenu( 'userfiles', 'User Files', '', '', 'userfiles');
+}
+
+if( !defined( 'AVATAR_MAX_DIM' ) ) {
+ define( 'AVATAR_MAX_DIM', 100 );
+}
+if( !defined( 'PORTRAIT_MAX_DIM' ) ) {
+ define( 'PORTRAIT_MAX_DIM', 300 );
+}
+if( !defined( 'LOGO_MAX_DIM' ) ) {
+ define( 'LOGO_MAX_DIM', 600 );
+}
+
+
+ // ********** USER ************
+ require_once(USERS_PKG_PATH . 'BitPermUser.php');
+ $gBitUser = new BitPermUser();
+
+ $cookie_path = $gBitSystem->getPreference('cookie_path', BIT_ROOT_URL);
+ $cookie_path = ($cookie_path == '') ? $cookie_path : BIT_ROOT_URL;
+ $gBitLoc['cookie_path'] = $cookie_path;
+
+ // set session lifetime
+ $session_lifetime = $gBitSystem->getPreference('session_lifetime', '0');
+ if ($session_lifetime > 0)
+ {
+ ini_set('session.gc_maxlifetime', $session_lifetime * 60);
+ }
+ // is session data stored in DB or in filesystem?
+ if( $gBitSystem->isFeatureActive( 'y' ) && !empty( $gBitDbType ) )
+ {
+ include(UTIL_PKG_PATH . 'adodb/session/adodb-session.php');
+ ADODB_Session::dataFieldName('session_data');
+ ADODB_Session::driver($gBitDbType);
+ ADODB_Session::host($gBitDbHost);
+ ADODB_Session::user($gBitDbUser);
+ ADODB_Session::password($gBitDbPassword);
+ ADODB_Session::database($gBitDbName);
+ ADODB_Session::table(BIT_DB_PREFIX.'sessions');
+ ini_set('session.save_handler', 'user');
+ }
+
+ session_name( BIT_SESSION_NAME );
+ if ($gBitSystem->isFeatureActive('rememberme')) {
+ session_set_cookie_params($session_lifetime, $cookie_path, $gBitSystem->getPreference('cookie_domain'));
+ }
+ session_start();
+
+ // in the case of tikis on same domain we have to distinguish the realm
+ // changed cookie and session variable name by a name made with siteTitle
+ $cookie_site = strtolower( ereg_replace("[^a-zA-Z0-9]", "", $gBitSystem->getPreference('siteTitle', 'Tikipro')) );
+ global $user_cookie_site;
+ $user_cookie_site = 'tiki-user-' . $cookie_site;
+
+
+ if( function_exists( 'tiki_login_override' ) ) {
+ $gBitUser->mUserId = tiki_login_override();
+ if ($gBitUser->mUserId) {
+ $gBitUser->load();
+ $gBitUser->loadPermissions();
+ }
+
+ } else {
+ // if remember me is enabled, check for cookie where auth hash is stored
+ // user gets logged in as the first user in the db with a matching hash
+ if ( $gBitSystem->isFeatureActive('rememberme') ) {
+ if (isset($_COOKIE[$user_cookie_site])) {
+ if ( !isset( $_SESSION[$user_cookie_site] ) ) {
+ $_SESSION[$user_cookie_site] = $gBitUser->getByHash( $_COOKIE[$user_cookie_site] );
+ }
+ }
+ }
+ // check what auth metod is selected. default is for the 'tiki' to auth users
+ $auth_method = $gBitSystem->getPreference('auth_method', 'tiki');
+ // if the auth method is 'web site', look for the username in $_SERVER
+ if ($auth_method == 'ws') {
+ if (isset($_SERVER['REMOTE_USER'])) {
+ if ($gBitUser->exists($_SERVER['REMOTE_USER'])) {
+ $_SESSION[$user_cookie_site] = $_SERVER['REMOTE_USER'];
+ }
+ }
+ }
+ if (isset($_SESSION[$user_cookie_site])) {
+ $sessionUser = $_SESSION[$user_cookie_site];
+ }
+ }
+
+ $full = FALSE;
+ // if the username is already saved in the session, pull it from there
+ if ( isset( $_SESSION[$user_cookie_site] ) ) {
+ if( is_numeric( $_SESSION[$user_cookie_site] ) ) {
+ // For cases where a login override returns the userId and not the username
+ // We will load the BitUser using the user_id rather than their login
+ $gBitUser->mUserId = $_SESSION[$user_cookie_site];
+ $gBitUser->load( TRUE );
+ srand(time());
+ $gTicket = substr( md5(rand() . $gBitUser->mUserId ), 0, 20);
+ } else {
+ // old tiki session used username
+ $_SESSION[$user_cookie_site] = NULL;
+ }
+ }
+
+ if( !$gBitUser->isValid() ) {
+ $gBitUser->mUserId = ANONYMOUS_USER_ID;
+ $gBitUser->load( TRUE );
+ }
+
+ if (isset($_REQUEST[BIT_SESSION_NAME])) {
+ $gBitUser->updateSession( $_REQUEST[BIT_SESSION_NAME] );
+ } elseif (function_exists("session_id")) {
+ $gBitUser->updateSession(session_id());
+ }
+
+ $smarty->assign_by_ref('gBitUser', $gBitUser);
+ $smarty->register_object('gBitUser', $gBitUser, array(), true, array('hasPermission'));
+
+ $allowRegister = $gBitSystem->getPreference("allowRegister", 'y');
+ $validateUsers = $gBitSystem->getPreference("validateUsers", 'n');
+ $forgotPass = $gBitSystem->getPreference("forgotPass", 'y');
+ $eponymousGroups = $gBitSystem->getPreference("eponymousGroups", 'n');
+ $useRegisterPasscode = $gBitSystem->getPreference("useRegisterPasscode", 'n');
+ $registerPasscode = $gBitSystem->getPreference("registerPasscode", '');
+ $urlIndex = $gBitSystem->getPreference("urlIndex", '');
+ $use_proxy = $gBitSystem->getPreference("use_proxy", 'n');
+ $proxy_host = $gBitSystem->getPreference("proxy_host", '');
+ $proxy_port = $gBitSystem->getPreference("proxy_port", '');
+ $session_db = $gBitSystem->getPreference("session_db", 'n');
+ $session_lifetime = $gBitSystem->getPreference("session_lifetime", 0);
+ $remembertime = $gBitSystem->getPreference('remembertime', 7200);
+ $https_login = $gBitSystem->getPreference('https_login', 'n');
+ $https_login_required = $gBitSystem->getPreference('https_login_required', 'n');
+ $change_language = $gBitSystem->getPreference("change_language", 'y');
+
+ $smarty->assign('allowRegister', $allowRegister);
+ $smarty->assign('urlIndex', $urlIndex);
+ $smarty->assign('use_proxy', $use_proxy);
+ $smarty->assign('proxy_host', $proxy_host);
+ $smarty->assign('proxy_port', $proxy_port);
+ $smarty->assign('change_language', $change_language);
+ $smarty->assign('eponymousGroups', $eponymousGroups);
+
+ $user_assigned_modules = 'n';
+ $smarty->assign('remembertime', $remembertime);
+ $smarty->assign('webserverauth', 'n');
+ $smarty->assign('uf_use_db', 'y');
+ $smarty->assign('uf_use_dir', '');
+ $smarty->assign('userfiles_quota', 30);
+ $smarty->assign('registerPasscode', $registerPasscode);
+ $smarty->assign('useRegisterPasscode', $useRegisterPasscode);
+ $smarty->assign('min_pass_length', 1);
+ $smarty->assign('pass_chr_num', 'n');
+ $smarty->assign('pass_due', 999);
+ $smarty->assign('rnd_num_reg', 'n');
+ // PEAR::Auth support
+ $smarty->assign('auth_method', "tiki");
+ $smarty->assign('auth_pear', "tiki");
+ $smarty->assign('auth_create_gBitDbUser', 'n');
+ $smarty->assign('auth_create_user_auth', 'n');
+ $smarty->assign('auth_skip_admin', 'y');
+ $smarty->assign('auth_ldap_host', 'localhost');
+ $smarty->assign('auth_ldap_port', '389');
+ $smarty->assign('auth_ldap_scope', 'sub');
+ $smarty->assign('auth_ldap_basedn', '');
+ $smarty->assign('auth_ldap_userdn', '');
+ $smarty->assign('auth_ldap_userattr', 'uid');
+ $smarty->assign('auth_ldap_useroc', 'inetOrgPerson');
+ $smarty->assign('auth_ldap_groupdn', '');
+ $smarty->assign('auth_ldap_groupattr', 'cn');
+ $smarty->assign('auth_ldap_groupoc', 'groupOfUniqueNames');
+ $smarty->assign('auth_ldap_memberattr', 'uniqueMember');
+ $smarty->assign('auth_ldap_memberisdn', 'y');
+ $smarty->assign('auth_ldap_adminuser', '');
+ $smarty->assign('auth_ldap_adminpass', '');
+
+ // Permissions
+ // Get group permissions here
+ if (is_array($gBitUser->mPerms)) { // This avoids php warning during install
+ foreach( array_keys( $gBitUser->mPerms ) as $perm ) {
+ // print("Asignando permiso global : $perm<br/>");
+ $smarty->assign("$perm", 'y');
+ $$perm = 'y';
+ }
+ }
+
+ if( $gBitUser->isRegistered() && $gBitSystem->getPreference('feature_usermenu') == 'y' ) {
+ if (!isset($_SESSION['usermenu'])) {
+ include_once(USERS_PKG_PATH . 'user_menu_lib.php');
+
+ $user_menus = $usermenulib->list_usermenus($gBitUser->mUserId, 0, -1, 'position_asc', '');
+ $smarty->assign('usr_user_menus', $user_menus['data']);
+ $_SESSION['usermenu'] = $user_menus['data'];
+ } else {
+ $user_menus = $_SESSION['usermenu'];
+ $smarty->assign('usr_user_menus', $user_menus);
+ }
+ }
+ // If we are processing a login then do not generate the challenge
+ // if we are in any other case then yes.
+ if( !empty( $_SERVER["REQUEST_URI"] ) && !strstr($_SERVER["REQUEST_URI"], USERS_PKG_URL . 'validate')) {
+ if ($gBitSystem->getPreference('feature_challenge') == 'y') {
+ $chall = $gBitUser->generateChallenge();
+
+ $_SESSION["challenge"] = $chall;
+ $smarty->assign('challenge', $chall);
+ }
+ }
+
+ $smarty->assign('user_dbl', 'y');
+
+ $allowMsgs = 'n';
+ if( $gBitUser->isRegistered() ) {
+ global $tasks_use_dates, $tasks_maxRecords, $allowMsgs;
+ $allowMsgs = $gBitUser->getPreference( 'allowMsgs', 'y');
+ $tasks_use_dates = $gBitUser->getPreference( 'tasks_use_dates');
+ $tasks_maxRecords = $gBitUser->getPreference( 'tasks_maxRecords');
+ $smarty->assign('tasks_use_dates', $tasks_use_dates);
+ $smarty->assign('tasks_maxRecords', $tasks_maxRecords);
+ $smarty->assign('allowMsgs', $allowMsgs);
+ }
+
+?>
diff --git a/bookmark_lib.php b/bookmark_lib.php
new file mode 100644
index 0000000..3e36be2
--- /dev/null
+++ b/bookmark_lib.php
@@ -0,0 +1,135 @@
+<?php
+class BookmarkLib extends BitBase {
+ function BookmarkLib() {
+ BitBase::BitBase();
+ }
+ function get_folder_path($folder_id, $user_id) {
+ $path = '';
+ $info = $this->get_folder($folder_id, $user_id);
+ $path = '<a href='.USERS_PKG_URL.'bookmarks.php?parent_id="' . $info["folder_id"] . '">' . $info["name"] . '</a>';
+ while ($info["parent_id"] != 0) {
+ $info = $this->get_folder($info["parent_id"], $user_id);
+ $path
+ = $path = '<a href='.USERS_PKG_URL.'bookmarks.php?parent_id="' . $info["folder_id"] . '">' . $info["name"] . '</a>' . '>' . $path;
+ }
+ return $path;
+ }
+ function get_folder($folder_id, $user_id) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` where `folder_id`=? and `user_id`=?";
+ $result = $this->query($query,array($folder_id,$user_id));
+ if (!$result->numRows())
+ return false;
+ $res = $result->fetchRow();
+ return $res;
+ }
+ function get_url($url_id) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `url_id`=?";
+ $result = $this->query($query,array($url_id));
+ if (!$result->numRows())
+ return false;
+ $res = $result->fetchRow();
+ return $res;
+ }
+ function remove_url($url_id, $user_id) {
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `url_id`=? and `user_id`=?";
+ $result = $this->query($query,array($url_id,$user_id));
+ return true;
+ }
+ function remove_folder($folder_id, $user_id) {
+ // Delete the category
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` where `folder_id`=? and `user_id`=?";
+ $result = $this->query($query,array($folder_id,$user_id));
+ // Remove objects for this category
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `folder_id`=? and `user_id`=?";
+ $result = $this->query($query,array($folder_id,$user_id));
+ // SUbfolders
+ $query = "select `folder_id` from `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` where `parent_id`=? and `user_id`=?";
+ $result = $this->query($query,array($folder_id,$user_id));
+ while ($res = $result->fetchRow()) {
+ // Recursively remove the subcategory
+ $this->remove_folder($res["folder_id"], $user_id);
+ }
+ return true;
+ }
+ function update_folder($folder_id, $name, $user_id) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` set `name`=? where `folder_id`=? and `user_id`=?";
+ $result = $this->query($query,array($name,$folder_id,$user_id));
+ }
+ function add_folder($parent_id, $name, $user_id) {
+ // Don't allow empty/blank folder names.
+ if (empty($name))
+ return false;
+ $query = "insert into `".BIT_DB_PREFIX."tiki_user_bookmarks_folders`(`name`,`parent_id`,`user_id`) values(?,?,?)";
+ $result = $this->query($query,array($name,$parent_id,$user_id));
+ }
+ function replace_url($url_id, $folder_id, $name, $url, $user_id) {
+ $id = NULL;
+ if( strlen( $url ) < 250 ) {
+ $now = date("U");
+ if ($url_id) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` set `user_id`=?,`last_updated`=?,`folder_id`=?,`name`=?,`url`=? where `url_id`=?";
+ $bindvars=array($user_id,(int) $now,$folder_id,$name,$url,$url_id);
+ } else {
+ $query = " insert into `".BIT_DB_PREFIX."tiki_user_bookmarks_urls`(`name`,`url`,`data`,`last_updated`,`folder_id`,`user_id`)
+ values(?,?,?,?,?,?)";
+ $bindvars=array($name,$url,'',(int) $now,$folder_id,$user_id);
+ }
+ $result = $this->query($query,$bindvars);
+ $id = $this->getOne("select max(`url_id`) from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `url`=? and `last_updated`=?",array($url,(int) $now));
+ }
+ return $id;
+ }
+ function refresh_url($url_id) {
+ $info = $this->get_url($url_id);
+ if (strstr($info["url"], 'tiki_') || strstr($info["url"], 'messu_'))
+ return false;
+ @$fp = fopen($info["url"], "r");
+ if (!$fp)
+ return;
+ $data = '';
+ while (!feof($fp)) {
+ $data .= fread($fp, 4096);
+ }
+ fclose ($fp);
+ $now = date("U");
+ $query = "update `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` set `last_updated`=?, `data`=? where `url_id`=?";
+ $result = $this->query($query,array((int) $now,BitDb::db_byte_encode( $data ),$url_id));
+ return true;
+ }
+ function list_folder($folder_id, $offset, $maxRecords, $sort_mode = 'name_asc', $find, $user_id) {
+ if ($find) {
+ $findesc = '%' . strtoupper( $find ) . '%';
+ $mid = " and UPPER(`name`) like ? or UPPER(`url`) like ?";
+ $bindvars=array($folder_id,$user_id,$findesc,$findesc);
+ } else {
+ $mid = "";
+ $bindvars=array($folder_id,$user_id);
+ }
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `folder_id`=? and `user_id`=? $mid order by ".$this->convert_sortmode($sort_mode);
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `folder_id`=? and `user_id`=? $mid";
+ $result = $this->query($query,$bindvars,$maxRecords,$offset);
+ $cant = $this->getOne($query_cant,$bindvars);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $res["datalen"] = strlen($res["data"]);
+ $ret[] = $res;
+ }
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+ function get_child_folders($folder_id, $user_id) {
+ $ret = array();
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` where `parent_id`=? and `user_id`=?";
+ $result = $this->query($query,array($folder_id,$user_id));
+ while ($res = $result->fetchRow()) {
+ $cant = $this->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` where `folder_id`=?",array($res["folder_id"]));
+ $res["urls"] = $cant;
+ $ret[] = $res;
+ }
+ return $ret;
+ }
+}
+$bookmarklib = new BookmarkLib();
+?>
diff --git a/bookmarks.php b/bookmarks.php
new file mode 100644
index 0000000..88b4515
--- /dev/null
+++ b/bookmarks.php
@@ -0,0 +1,109 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/bookmarks.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'bookmark_lib.php' );
+if (!$gBitUser->hasPermission( 'bit_p_create_bookmarks' )) {
+ $smarty->assign('msg', tra("You dont have permission to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->mUserId) {
+ $smarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ($feature_user_bookmarks != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_user_bookmarks");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!isset($_REQUEST["parent_id"])) {
+ $_REQUEST["parent_id"] = 0;
+}
+if ($_REQUEST["parent_id"]) {
+ $path = $bookmarklib->get_folder_path($_REQUEST["parent_id"], $gBitUser->mUserId);
+ $p_info = $bookmarklib->get_folder($_REQUEST["parent_id"], $gBitUser->mUserId);
+ $father = $p_info["parent_id"];
+} else {
+ $path = tra("TOP");
+ $father = 0;
+}
+$smarty->assign('parent_id', $_REQUEST["parent_id"]);
+$smarty->assign('path', $path);
+//chekck for edit folder
+if (isset($_REQUEST["editfolder"])) {
+ $folder_info = $bookmarklib->get_folder($_REQUEST["editfolder"], $gBitUser->mUserId);
+} else {
+ $folder_info["name"] = '';
+ $_REQUEST["editfolder"] = 0;
+}
+$smarty->assign('foldername', $folder_info["name"]);
+$smarty->assign('editfolder', $_REQUEST["editfolder"]);
+if (isset($_REQUEST["editurl"])) {
+ $url_info = $bookmarklib->get_url($_REQUEST["editurl"]);
+} else {
+ $url_info["name"] = '';
+ $url_info["url"] = '';
+ $_REQUEST["editurl"] = 0;
+}
+$smarty->assign('urlname', $url_info["name"]);
+$smarty->assign('urlurl', $url_info["url"]);
+$smarty->assign('editurl', $_REQUEST["editurl"]);
+// Create a folder inside the parentFolder here
+if (isset($_REQUEST["addfolder"])) {
+
+ if ($_REQUEST["editfolder"]) {
+ $bookmarklib->update_folder($_REQUEST["editfolder"], $_REQUEST["foldername"], $gBitUser->mUserId);
+ $smarty->assign('editfolder', 0);
+ $smarty->assign('foldername', '');
+ } else {
+ $bookmarklib->add_folder($_REQUEST["parent_id"], $_REQUEST["foldername"], $gBitUser->mUserId);
+ }
+}
+if (isset($_REQUEST["removefolder"])) {
+
+ $bookmarklib->remove_folder($_REQUEST["removefolder"], $gBitUser->mUserId);
+}
+if (isset($_REQUEST["refreshurl"])) {
+
+ $bookmarklib->refresh_url($_REQUEST["refreshurl"]);
+}
+if (isset($_REQUEST["addurl"])) {
+
+ if( $urlid = $bookmarklib->replace_url($_REQUEST["editurl"], $_REQUEST["parent_id"], $_REQUEST["urlname"], $_REQUEST["urlurl"], $gBitUser->mUserId) ) {
+ if ($_REQUEST["editurl"] == 0 && $gBitUser->hasPermission( 'bit_p_cache_bookmarks' )) {
+ $bookmarklib->refresh_url($urlid);
+ }
+ $smarty->assign('editurl', 0);
+ $smarty->assign('urlname', '');
+ $smarty->assign('urlurl', '');
+ } else {
+ $smarty->assign( 'bookmarkError', "URL CANNOT BE MORE THAN 250 characters" );
+ }
+}
+if (isset($_REQUEST["removeurl"])) {
+
+ $bookmarklib->remove_url($_REQUEST["removeurl"], $gBitUser->mUserId);
+}
+$urls = $bookmarklib->list_folder($_REQUEST["parent_id"], 0, -1, 'name_asc', '', $gBitUser->mUserId);
+$smarty->assign('urls', $urls["data"]);
+$folders = $bookmarklib->get_child_folders($_REQUEST["parent_id"], $gBitUser->mUserId);
+$pf = array(
+ "name" => "..",
+ "folder_id" => $father,
+ "parent_id" => 0,
+ "user_id" => $gBitUser->mUserId
+);
+$pfs = array($pf);
+if ($_REQUEST["parent_id"]) {
+ $folders = array_merge($pfs, $folders);
+}
+$smarty->assign('folders', $folders);
+
+// Display the template
+$gBitSystem->display( 'bitpackage:users/user_bookmarks.tpl');
+?>
diff --git a/cached_bookmark.php b/cached_bookmark.php
new file mode 100644
index 0000000..2775f9d
--- /dev/null
+++ b/cached_bookmark.php
@@ -0,0 +1,29 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/cached_bookmark.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'bookmark_lib.php' );
+if (!$gBitUser->mUserId) {
+ $smarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ($feature_user_bookmarks != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_user_bookmarks");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!isset($_REQUEST["urlid"])) {
+ $smarty->assign('msg', tra("No url indicated"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+// Get a list of last changes to the Wiki database
+$info = $bookmarklib->get_url($_REQUEST["urlid"]);
+$smarty->assign_by_ref('info', $info);
+$info["refresh"] = $info["last_updated"];
+$gBitSystem->display( 'bitpackage:kernel/view_cache.tpl');
+?>
diff --git a/change_password.php b/change_password.php
new file mode 100644
index 0000000..0108560
--- /dev/null
+++ b/change_password.php
@@ -0,0 +1,54 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/change_password.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+if (!isset($_REQUEST['login']))
+ $_REQUEST['login'] = '';
+if (!isset($_REQUEST["oldpass"]))
+ $_REQUEST["oldpass"] = '';
+$smarty->assign('login', $_REQUEST['login']);
+$smarty->assign('oldpass', $_REQUEST["oldpass"]);
+if (isset($_REQUEST["change"])) {
+
+ if ($_REQUEST["pass"] != $_REQUEST["pass2"]) {
+ $smarty->assign('msg', tra("The passwords didn't match"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ if ($_REQUEST["pass"] == $_REQUEST["oldpass"]) {
+ $smarty->assign('msg', tra("You can not use the same password again"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ if (!$gBitUser->validate_user($_REQUEST['login'], $_REQUEST["oldpass"], '', '')) {
+ if(!$gBitUser->validate_user("admin",substr($_REQUEST["oldpass"],6,200),'','') or (!$gBitUser->isAdmin())) {
+ $smarty->assign('msg', tra("Invalid old password"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ }
+ //Validate password here
+ if (strlen($_REQUEST["pass"]) < $min_pass_length) {
+ $smarty->assign('msg', tra("Password should be at least"). ' ' . $min_pass_length . ' ' . tra("characters long"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ // Check this code
+ if ($pass_chr_num == 'y') {
+ if (!preg_match_all("/[0-9]+/", $_REQUEST["pass"], $foo) || !preg_match_all("/[A-Za-z]+/", $_REQUEST["pass"], $foo)) {
+ $smarty->assign('msg', tra("Password must contain both letters and numbers"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ }
+ $gBitUser->change_user_password($_REQUEST['login'], $_REQUEST["pass"]);
+ $url = $gBitUser->login( $_REQUEST['login'], $_REQUEST["pass"] );
+ header ( "location: ".$url );
+}
+
+// Display the template
+$gBitSystem->display( 'bitpackage:users/change_password.tpl');
+?>
diff --git a/confirm.php b/confirm.php
new file mode 100644
index 0000000..3c2b420
--- /dev/null
+++ b/confirm.php
@@ -0,0 +1,16 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/confirm.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+
+if( $userInfo = $gBitUser->confirmRegistration( $_REQUEST["user"], $_REQUEST["pass"] ) ) {
+ $smarty->assign_by_ref( 'userInfo', $userInfo );
+ $gBitSystem->display( 'bitpackage:users/change_password.tpl' );
+} else {
+ $smarty->assign('msg', tra("Invalid username or password"));
+ $gBitSystem->display( 'error.tpl' );
+}
+?>
diff --git a/custom_home.php b/custom_home.php
new file mode 100644
index 0000000..bf512a4
--- /dev/null
+++ b/custom_home.php
@@ -0,0 +1,31 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/custom_home.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+//ini_set('include_path','.;pear/');
+//include('foobar.php');
+/*
+hfd
+require_once "lib/NNTP.php";
+$nntp = new Net_NNTP;
+$ret = $nntp->connect("news.php.net");
+$groups = $nntp->getGroups();
+//print_r($groups);
+$z = $nntp->selectGroup('php.announce');
+print_r($z);
+$h = $nntp->splitHeaders(1);
+print_r($h);
+$b = $nntp->getBody(1);
+print_r($b);
+*/
+if ($feature_custom_home != 'y') {
+ $smarty->assign('msg', tra("This feature has been disabled"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+// Display the template
+$gBitSystem->display( 'bitpackage:users/custom_home_2.tpl');
+?> \ No newline at end of file
diff --git a/display_bituser_inc.php b/display_bituser_inc.php
new file mode 100644
index 0000000..c9eda47
--- /dev/null
+++ b/display_bituser_inc.php
@@ -0,0 +1,8 @@
+<?php
+
+ // this first version is a bit incomplete, but at least things work now. - spiderr
+
+ include USERS_PKG_PATH.'templates/center_user_wiki_page.php';
+ $gBitSystem->display( 'bitpackage:users/center_user_wiki_page.tpl' );
+
+?>
diff --git a/download_userfile.php b/download_userfile.php
new file mode 100644
index 0000000..f2cf93e
--- /dev/null
+++ b/download_userfile.php
@@ -0,0 +1,25 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/download_userfile.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once (USERS_PKG_PATH.'userfiles_lib.php');
+if (!isset($_REQUEST["file_id"])) {
+ die;
+}
+$uf_use_db = $gBitSystem->getPreference('uf_use_db', 'y');
+$uf_use_dir = $gBitSystem->getPreference('uf_use_dir', '');
+$info = $userfileslib->get_userfile($gBitUser->mUserId, $_REQUEST["file_id"]);
+$type = &$info["filetype"];
+$file = &$info["filename"];
+$content = &$info["data"];
+header ("Content-type: $type");
+header ("Content-Disposition: inline; filename=\"$file\"");
+if ($info["path"]) {
+ readfile ($uf_use_dir . $info["path"]);
+} else {
+ echo "$content";
+}
+?>
diff --git a/edit_personal_page.php b/edit_personal_page.php
new file mode 100644
index 0000000..234ceb3
--- /dev/null
+++ b/edit_personal_page.php
@@ -0,0 +1,58 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/edit_personal_page.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+// Copyright (c) 2004 bitweaver.org - Christian Fowler, Stephan Borgm, Andrew Slater, et. al.
+// 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.
+require_once( '../bit_setup_inc.php' );
+
+// Check if the page has changed
+if (isset($_REQUEST["fSavePage"])) {
+ $gBitUser->store( $_REQUEST );
+ header( "Location:".USERS_PKG_URL."index.php?home=".$gBitUser->mUsername );
+ die;
+}
+
+if ($gBitSystem->getPreference('package_quicktags','n') == 'y') {
+ include_once( QUICKTAGS_PKG_PATH.'quicktags_inc.php' );
+}
+
+// see if we should show the attachments tab at all
+foreach( $gLibertySystem->mPlugins as $plugin ) {
+ if( ( $plugin['plugin_type'] == 'storage' ) && ( $plugin['is_active'] == 'y' ) ) {
+ $smarty->assign( 'show_attachments','y' );
+ }
+}
+
+$smarty->assign('preview',0);
+// If we are in preview mode then preview it!
+if(isset($_REQUEST["preview"])) {
+ $smarty->assign('preview',1);
+ $gBitUser->mInfo['title'] = $_REQUEST["title"];
+ if(isset($_REQUEST["description"])) {
+ $gBitUser->mInfo['description'] = $_REQUEST["description"];
+ }
+ $gBitUser->mInfo['data'] = $_REQUEST["edit"];
+
+ $parsed = $gBitUser->parseData($_REQUEST["edit"], (!empty( $_REQUEST['format_guid'] ) ? $_REQUEST['format_guid'] :
+ ( isset($gBitUser->mInfo['format_guid']) ? $gBitUser->mInfo['format_guid'] : 'tikiwiki' ) ) );
+ /* SPELLCHECKING INITIAL ATTEMPT */
+ //This nice function does all the job!
+ if ($wiki_spellcheck == 'y') {
+ if (isset($_REQUEST["spellcheck"]) && $_REQUEST["spellcheck"] == 'on') {
+ $parsed = $gBitSystem->spellcheckreplace($edit_data, $parsed, $gBitLanguage->mLanguage, 'editwiki');
+ $smarty->assign('spellcheck', 'y');
+ } else {
+ $smarty->assign('spellcheck', 'n');
+ }
+ }
+ $smarty->assign( 'parsed', $parsed );
+}
+
+$smarty->assign_by_ref( 'pageInfo', $gBitUser->mInfo );
+$smarty->assign_by_ref( 'gContent', $gBitUser );
+
+$smarty->assign('show_page_bar', 'y');
+$gBitSystem->mPrefs['feature_wiki_description'] = 'n';
+
+$gBitSystem->display( 'bitpackage:wiki/edit_page.tpl');
+?>
diff --git a/files.php b/files.php
new file mode 100644
index 0000000..ab5fa2a
--- /dev/null
+++ b/files.php
@@ -0,0 +1,137 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/files.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+require_once( '../bit_setup_inc.php' );
+include_once ( USERS_PKG_PATH.'userfiles_lib.php');
+if ($feature_userfiles != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_userfiles");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ( !$gBitUser->isValid() ) {
+ $smarty->assign('msg', tra("Must be logged to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->hasPermission( 'bit_p_userfiles' )) {
+ $smarty->assign('msg', tra("Permission denied to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+$quota = $userfileslib->userfiles_quota( $gBitUser->mUserId );
+$limit = $userfiles_quota * 1024 * 1000;
+if ($limit == 0)
+ $limit = 999999999;
+$percentage = ($quota / $limit) * 100;
+$cellsize = round($percentage / 100 * 200);
+$percentage = round($percentage);
+$smarty->assign('cellsize', $cellsize);
+$smarty->assign('percentage', $percentage);
+// Process upload here
+for ($i = 0; $i < 5; $i++) {
+ if (isset($_FILES["userfile$i"]) && is_uploaded_file($_FILES["userfile$i"]['tmp_name'])) {
+
+ $fp = fopen($_FILES["userfile$i"]['tmp_name'], "rb");
+ $data = '';
+ $fhash = '';
+ $name = $_FILES["userfile$i"]['name'];
+ if ($uf_use_db == 'n') {
+ $fhash = md5(uniqid('.'));
+ $fw = fopen($uf_use_dir . $fhash, "wb");
+ if (!$fw) {
+ $smarty->assign('msg', tra('Cannot write to this file:'). $fhash);
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ }
+ while (!feof($fp)) {
+ if ($uf_use_db == 'y') {
+ $data .= fread($fp, 8192 * 16);
+ } else {
+ $data = fread($fp, 8192 * 16);
+ fwrite($fw, $data);
+ }
+ }
+ fclose ($fp);
+ if ($uf_use_db == 'n') {
+ fclose ($fw);
+ $data = '';
+ }
+ $size = $_FILES["userfile$i"]['size'];
+ $name = $_FILES["userfile$i"]['name'];
+ $type = $_FILES["userfile$i"]['type'];
+ if ($quota + $size > $limit) {
+ $smarty->assign('msg', tra('Cannot upload this file not enough quota'));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ $userfileslib->upload_userfile($gBitUser->mUserId, '', $name, $type, $size, $data, $fhash);
+ }
+}
+// Process removal here
+if (isset($_REQUEST["delete"]) && isset($_REQUEST["userfile"])) {
+
+ foreach (array_keys($_REQUEST["userfile"])as $file) {
+ $userfileslib->remove_userfile($gBitUser->mUserId, $file);
+ }
+}
+$quota = $userfileslib->userfiles_quota($gBitUser->mUserId);
+$limit = $userfiles_quota * 1024 * 1000;
+if ($limit == 0)
+ $limit = 999999999;
+$percentage = $quota / $limit * 100;
+$cellsize = round($percentage / 100 * 200);
+$percentage = round($percentage);
+if ($cellsize == 0)
+ $cellsize = 1;
+$smarty->assign('cellsize', $cellsize);
+$smarty->assign('percentage', $percentage);
+if ( empty( $_REQUEST["sort_mode"] ) ) {
+ $sort_mode = 'created_desc';
+} else {
+ $sort_mode = $_REQUEST["sort_mode"];
+}
+if (!isset($_REQUEST["offset"])) {
+ $offset = 0;
+} else {
+ $offset = $_REQUEST["offset"];
+}
+if (isset($_REQUEST['page'])) {
+ $page = &$_REQUEST['page'];
+ $offset = ($page - 1) * $maxRecords;
+}
+$smarty->assign_by_ref('offset', $offset);
+if (isset($_REQUEST["find"])) {
+ $find = $_REQUEST["find"];
+} else {
+ $find = '';
+}
+$smarty->assign('find', $find);
+$smarty->assign_by_ref('sort_mode', $sort_mode);
+if (isset($_SESSION['thedate'])) {
+ $pdate = $_SESSION['thedate'];
+} else {
+ $pdate = date("U");
+}
+$channels = $userfileslib->list_userfiles($gBitUser->mUserId, $offset, $maxRecords, $sort_mode, $find);
+$cant_pages = ceil($channels["cant"] / $maxRecords);
+$smarty->assign_by_ref('cant_pages', $cant_pages);
+$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
+if ($channels["cant"] > ($offset + $maxRecords)) {
+ $smarty->assign('next_offset', $offset + $maxRecords);
+} else {
+ $smarty->assign('next_offset', -1);
+}
+// If offset is > 0 then prev_offset
+if ($offset > 0) {
+ $smarty->assign('prev_offset', $offset - $maxRecords);
+} else {
+ $smarty->assign('prev_offset', -1);
+}
+$smarty->assign_by_ref('channels', $channels["data"]);
+$smarty->assign('tasks_use_dates', $tasks_use_dates);
+
+$gBitSystem->display( 'bitpackage:users/userfiles.tpl');
+?>
diff --git a/icons/assume_user.gif b/icons/assume_user.gif
new file mode 100755
index 0000000..23bb757
--- /dev/null
+++ b/icons/assume_user.gif
Binary files differ
diff --git a/icons/batch_assign.gif b/icons/batch_assign.gif
new file mode 100644
index 0000000..efc8d24
--- /dev/null
+++ b/icons/batch_assign.gif
Binary files differ
diff --git a/icons/flags/American_Samoa.gif b/icons/flags/American_Samoa.gif
new file mode 100644
index 0000000..b5b6bde
--- /dev/null
+++ b/icons/flags/American_Samoa.gif
Binary files differ
diff --git a/icons/flags/Angola.gif b/icons/flags/Angola.gif
new file mode 100644
index 0000000..44a4074
--- /dev/null
+++ b/icons/flags/Angola.gif
Binary files differ
diff --git a/icons/flags/Antigua.gif b/icons/flags/Antigua.gif
new file mode 100644
index 0000000..12bf744
--- /dev/null
+++ b/icons/flags/Antigua.gif
Binary files differ
diff --git a/icons/flags/Argentina.gif b/icons/flags/Argentina.gif
new file mode 100644
index 0000000..e47e496
--- /dev/null
+++ b/icons/flags/Argentina.gif
Binary files differ
diff --git a/icons/flags/Armenia.gif b/icons/flags/Armenia.gif
new file mode 100644
index 0000000..4f0be48
--- /dev/null
+++ b/icons/flags/Armenia.gif
Binary files differ
diff --git a/icons/flags/Australia.gif b/icons/flags/Australia.gif
new file mode 100644
index 0000000..63dacdb
--- /dev/null
+++ b/icons/flags/Australia.gif
Binary files differ
diff --git a/icons/flags/Austria.gif b/icons/flags/Austria.gif
new file mode 100644
index 0000000..7cf652b
--- /dev/null
+++ b/icons/flags/Austria.gif
Binary files differ
diff --git a/icons/flags/Bahamas.gif b/icons/flags/Bahamas.gif
new file mode 100644
index 0000000..1261d32
--- /dev/null
+++ b/icons/flags/Bahamas.gif
Binary files differ
diff --git a/icons/flags/Bahrain.gif b/icons/flags/Bahrain.gif
new file mode 100644
index 0000000..859f596
--- /dev/null
+++ b/icons/flags/Bahrain.gif
Binary files differ
diff --git a/icons/flags/Bangladesh.gif b/icons/flags/Bangladesh.gif
new file mode 100644
index 0000000..3408edb
--- /dev/null
+++ b/icons/flags/Bangladesh.gif
Binary files differ
diff --git a/icons/flags/Barbados.gif b/icons/flags/Barbados.gif
new file mode 100644
index 0000000..2e0f783
--- /dev/null
+++ b/icons/flags/Barbados.gif
Binary files differ
diff --git a/icons/flags/Belgium.gif b/icons/flags/Belgium.gif
new file mode 100644
index 0000000..b620ffa
--- /dev/null
+++ b/icons/flags/Belgium.gif
Binary files differ
diff --git a/icons/flags/Bermuda.gif b/icons/flags/Bermuda.gif
new file mode 100644
index 0000000..8f4f60c
--- /dev/null
+++ b/icons/flags/Bermuda.gif
Binary files differ
diff --git a/icons/flags/Bolivia.gif b/icons/flags/Bolivia.gif
new file mode 100644
index 0000000..26fbeb3
--- /dev/null
+++ b/icons/flags/Bolivia.gif
Binary files differ
diff --git a/icons/flags/Brazil.gif b/icons/flags/Brazil.gif
new file mode 100644
index 0000000..1b9ff62
--- /dev/null
+++ b/icons/flags/Brazil.gif
Binary files differ
diff --git a/icons/flags/Brunei.gif b/icons/flags/Brunei.gif
new file mode 100644
index 0000000..acee46b
--- /dev/null
+++ b/icons/flags/Brunei.gif
Binary files differ
diff --git a/icons/flags/Canada.gif b/icons/flags/Canada.gif
new file mode 100644
index 0000000..0107f35
--- /dev/null
+++ b/icons/flags/Canada.gif
Binary files differ
diff --git a/icons/flags/Cayman_Islands.gif b/icons/flags/Cayman_Islands.gif
new file mode 100644
index 0000000..6970e99
--- /dev/null
+++ b/icons/flags/Cayman_Islands.gif
Binary files differ
diff --git a/icons/flags/Chile.gif b/icons/flags/Chile.gif
new file mode 100644
index 0000000..712d10f
--- /dev/null
+++ b/icons/flags/Chile.gif
Binary files differ
diff --git a/icons/flags/China.gif b/icons/flags/China.gif
new file mode 100644
index 0000000..fa15d5d
--- /dev/null
+++ b/icons/flags/China.gif
Binary files differ
diff --git a/icons/flags/Colombia.gif b/icons/flags/Colombia.gif
new file mode 100644
index 0000000..52bbad3
--- /dev/null
+++ b/icons/flags/Colombia.gif
Binary files differ
diff --git a/icons/flags/Cook_Islands.gif b/icons/flags/Cook_Islands.gif
new file mode 100644
index 0000000..249ec71
--- /dev/null
+++ b/icons/flags/Cook_Islands.gif
Binary files differ
diff --git a/icons/flags/Costa_Rica.gif b/icons/flags/Costa_Rica.gif
new file mode 100644
index 0000000..b237233
--- /dev/null
+++ b/icons/flags/Costa_Rica.gif
Binary files differ
diff --git a/icons/flags/Croatia.gif b/icons/flags/Croatia.gif
new file mode 100644
index 0000000..048155a
--- /dev/null
+++ b/icons/flags/Croatia.gif
Binary files differ
diff --git a/icons/flags/Cuba.gif b/icons/flags/Cuba.gif
new file mode 100644
index 0000000..ee53bec
--- /dev/null
+++ b/icons/flags/Cuba.gif
Binary files differ
diff --git a/icons/flags/Cyprus.gif b/icons/flags/Cyprus.gif
new file mode 100644
index 0000000..ad06ad7
--- /dev/null
+++ b/icons/flags/Cyprus.gif
Binary files differ
diff --git a/icons/flags/Czech_Republic.gif b/icons/flags/Czech_Republic.gif
new file mode 100644
index 0000000..77f8030
--- /dev/null
+++ b/icons/flags/Czech_Republic.gif
Binary files differ
diff --git a/icons/flags/Denmark.gif b/icons/flags/Denmark.gif
new file mode 100644
index 0000000..8ce0400
--- /dev/null
+++ b/icons/flags/Denmark.gif
Binary files differ
diff --git a/icons/flags/Dominican_Republic.gif b/icons/flags/Dominican_Republic.gif
new file mode 100644
index 0000000..a4b9c38
--- /dev/null
+++ b/icons/flags/Dominican_Republic.gif
Binary files differ
diff --git a/icons/flags/Ecuador.gif b/icons/flags/Ecuador.gif
new file mode 100644
index 0000000..c1369aa
--- /dev/null
+++ b/icons/flags/Ecuador.gif
Binary files differ
diff --git a/icons/flags/Egypt.gif b/icons/flags/Egypt.gif
new file mode 100644
index 0000000..711562e
--- /dev/null
+++ b/icons/flags/Egypt.gif
Binary files differ
diff --git a/icons/flags/El_Salvador.gif b/icons/flags/El_Salvador.gif
new file mode 100644
index 0000000..28e007e
--- /dev/null
+++ b/icons/flags/El_Salvador.gif
Binary files differ
diff --git a/icons/flags/Estonia.gif b/icons/flags/Estonia.gif
new file mode 100644
index 0000000..1404285
--- /dev/null
+++ b/icons/flags/Estonia.gif
Binary files differ
diff --git a/icons/flags/Federated_States_of_Micronesia.gif b/icons/flags/Federated_States_of_Micronesia.gif
new file mode 100644
index 0000000..bbd1cc8
--- /dev/null
+++ b/icons/flags/Federated_States_of_Micronesia.gif
Binary files differ
diff --git a/icons/flags/Fiji.gif b/icons/flags/Fiji.gif
new file mode 100644
index 0000000..f0106f4
--- /dev/null
+++ b/icons/flags/Fiji.gif
Binary files differ
diff --git a/icons/flags/Finland.gif b/icons/flags/Finland.gif
new file mode 100644
index 0000000..62b83d7
--- /dev/null
+++ b/icons/flags/Finland.gif
Binary files differ
diff --git a/icons/flags/France.gif b/icons/flags/France.gif
new file mode 100644
index 0000000..f2ec8d3
--- /dev/null
+++ b/icons/flags/France.gif
Binary files differ
diff --git a/icons/flags/French_Polynesia.gif b/icons/flags/French_Polynesia.gif
new file mode 100644
index 0000000..479ff10
--- /dev/null
+++ b/icons/flags/French_Polynesia.gif
Binary files differ
diff --git a/icons/flags/Germany.gif b/icons/flags/Germany.gif
new file mode 100644
index 0000000..e91cc76
--- /dev/null
+++ b/icons/flags/Germany.gif
Binary files differ
diff --git a/icons/flags/Greece.gif b/icons/flags/Greece.gif
new file mode 100644
index 0000000..7f0bafd
--- /dev/null
+++ b/icons/flags/Greece.gif
Binary files differ
diff --git a/icons/flags/Guam.gif b/icons/flags/Guam.gif
new file mode 100644
index 0000000..c2a06e9
--- /dev/null
+++ b/icons/flags/Guam.gif
Binary files differ
diff --git a/icons/flags/Guatemala.gif b/icons/flags/Guatemala.gif
new file mode 100644
index 0000000..b855618
--- /dev/null
+++ b/icons/flags/Guatemala.gif
Binary files differ
diff --git a/icons/flags/Haiti.gif b/icons/flags/Haiti.gif
new file mode 100644
index 0000000..a863620
--- /dev/null
+++ b/icons/flags/Haiti.gif
Binary files differ
diff --git a/icons/flags/Honduras.gif b/icons/flags/Honduras.gif
new file mode 100644
index 0000000..cb5d38c
--- /dev/null
+++ b/icons/flags/Honduras.gif
Binary files differ
diff --git a/icons/flags/Hungary.gif b/icons/flags/Hungary.gif
new file mode 100644
index 0000000..770024f
--- /dev/null
+++ b/icons/flags/Hungary.gif
Binary files differ
diff --git a/icons/flags/Iceland.gif b/icons/flags/Iceland.gif
new file mode 100644
index 0000000..2651485
--- /dev/null
+++ b/icons/flags/Iceland.gif
Binary files differ
diff --git a/icons/flags/India.gif b/icons/flags/India.gif
new file mode 100644
index 0000000..c3048e7
--- /dev/null
+++ b/icons/flags/India.gif
Binary files differ
diff --git a/icons/flags/Indonesia.gif b/icons/flags/Indonesia.gif
new file mode 100644
index 0000000..b8ad5bb
--- /dev/null
+++ b/icons/flags/Indonesia.gif
Binary files differ
diff --git a/icons/flags/Iran.gif b/icons/flags/Iran.gif
new file mode 100644
index 0000000..a5a6ee4
--- /dev/null
+++ b/icons/flags/Iran.gif
Binary files differ
diff --git a/icons/flags/Iraq.gif b/icons/flags/Iraq.gif
new file mode 100644
index 0000000..640fab7
--- /dev/null
+++ b/icons/flags/Iraq.gif
Binary files differ
diff --git a/icons/flags/Ireland.gif b/icons/flags/Ireland.gif
new file mode 100644
index 0000000..eff3515
--- /dev/null
+++ b/icons/flags/Ireland.gif
Binary files differ
diff --git a/icons/flags/Israel.gif b/icons/flags/Israel.gif
new file mode 100644
index 0000000..3c372fa
--- /dev/null
+++ b/icons/flags/Israel.gif
Binary files differ
diff --git a/icons/flags/Italy.gif b/icons/flags/Italy.gif
new file mode 100644
index 0000000..d2804ee
--- /dev/null
+++ b/icons/flags/Italy.gif
Binary files differ
diff --git a/icons/flags/Jamaica.gif b/icons/flags/Jamaica.gif
new file mode 100644
index 0000000..2966852
--- /dev/null
+++ b/icons/flags/Jamaica.gif
Binary files differ
diff --git a/icons/flags/Japan.gif b/icons/flags/Japan.gif
new file mode 100644
index 0000000..9bfb575
--- /dev/null
+++ b/icons/flags/Japan.gif
Binary files differ
diff --git a/icons/flags/Jordan.gif b/icons/flags/Jordan.gif
new file mode 100644
index 0000000..eab1696
--- /dev/null
+++ b/icons/flags/Jordan.gif
Binary files differ
diff --git a/icons/flags/Kazakstan.gif b/icons/flags/Kazakstan.gif
new file mode 100644
index 0000000..e6e93ff
--- /dev/null
+++ b/icons/flags/Kazakstan.gif
Binary files differ
diff --git a/icons/flags/Kenya.gif b/icons/flags/Kenya.gif
new file mode 100644
index 0000000..97ed355
--- /dev/null
+++ b/icons/flags/Kenya.gif
Binary files differ
diff --git a/icons/flags/Kiribati.gif b/icons/flags/Kiribati.gif
new file mode 100644
index 0000000..e87e845
--- /dev/null
+++ b/icons/flags/Kiribati.gif
Binary files differ
diff --git a/icons/flags/Kuwait.gif b/icons/flags/Kuwait.gif
new file mode 100644
index 0000000..7809511
--- /dev/null
+++ b/icons/flags/Kuwait.gif
Binary files differ
diff --git a/icons/flags/Latvia.gif b/icons/flags/Latvia.gif
new file mode 100644
index 0000000..74219ce
--- /dev/null
+++ b/icons/flags/Latvia.gif
Binary files differ
diff --git a/icons/flags/Lebanon.gif b/icons/flags/Lebanon.gif
new file mode 100644
index 0000000..ee14a11
--- /dev/null
+++ b/icons/flags/Lebanon.gif
Binary files differ
diff --git a/icons/flags/Lithuania.gif b/icons/flags/Lithuania.gif
new file mode 100644
index 0000000..c3737be
--- /dev/null
+++ b/icons/flags/Lithuania.gif
Binary files differ
diff --git a/icons/flags/Malawi.gif b/icons/flags/Malawi.gif
new file mode 100644
index 0000000..d03155d
--- /dev/null
+++ b/icons/flags/Malawi.gif
Binary files differ
diff --git a/icons/flags/Malaysia.gif b/icons/flags/Malaysia.gif
new file mode 100644
index 0000000..b6e52f5
--- /dev/null
+++ b/icons/flags/Malaysia.gif
Binary files differ
diff --git a/icons/flags/Malta.gif b/icons/flags/Malta.gif
new file mode 100644
index 0000000..40fc03d
--- /dev/null
+++ b/icons/flags/Malta.gif
Binary files differ
diff --git a/icons/flags/Marshall_Islands.gif b/icons/flags/Marshall_Islands.gif
new file mode 100644
index 0000000..cb57b5d
--- /dev/null
+++ b/icons/flags/Marshall_Islands.gif
Binary files differ
diff --git a/icons/flags/Mauritius.gif b/icons/flags/Mauritius.gif
new file mode 100644
index 0000000..0f59e00
--- /dev/null
+++ b/icons/flags/Mauritius.gif
Binary files differ
diff --git a/icons/flags/Mexico.gif b/icons/flags/Mexico.gif
new file mode 100644
index 0000000..c00b03f
--- /dev/null
+++ b/icons/flags/Mexico.gif
Binary files differ
diff --git a/icons/flags/Morocco.gif b/icons/flags/Morocco.gif
new file mode 100644
index 0000000..3ca4757
--- /dev/null
+++ b/icons/flags/Morocco.gif
Binary files differ
diff --git a/icons/flags/Mozambique.gif b/icons/flags/Mozambique.gif
new file mode 100644
index 0000000..2a7b961
--- /dev/null
+++ b/icons/flags/Mozambique.gif
Binary files differ
diff --git a/icons/flags/Nauru.gif b/icons/flags/Nauru.gif
new file mode 100644
index 0000000..0d49018
--- /dev/null
+++ b/icons/flags/Nauru.gif
Binary files differ
diff --git a/icons/flags/Nepal.gif b/icons/flags/Nepal.gif
new file mode 100644
index 0000000..3031f5b
--- /dev/null
+++ b/icons/flags/Nepal.gif
Binary files differ
diff --git a/icons/flags/Netherlands.gif b/icons/flags/Netherlands.gif
new file mode 100644
index 0000000..cc582cc
--- /dev/null
+++ b/icons/flags/Netherlands.gif
Binary files differ
diff --git a/icons/flags/New_Caledonia.gif b/icons/flags/New_Caledonia.gif
new file mode 100644
index 0000000..f2ec8d3
--- /dev/null
+++ b/icons/flags/New_Caledonia.gif
Binary files differ
diff --git a/icons/flags/New_Zealand.gif b/icons/flags/New_Zealand.gif
new file mode 100644
index 0000000..4750f87
--- /dev/null
+++ b/icons/flags/New_Zealand.gif
Binary files differ
diff --git a/icons/flags/Nicaragua.gif b/icons/flags/Nicaragua.gif
new file mode 100644
index 0000000..5bc806e
--- /dev/null
+++ b/icons/flags/Nicaragua.gif
Binary files differ
diff --git a/icons/flags/Nigeria.gif b/icons/flags/Nigeria.gif
new file mode 100644
index 0000000..d15a342
--- /dev/null
+++ b/icons/flags/Nigeria.gif
Binary files differ
diff --git a/icons/flags/Niue.gif b/icons/flags/Niue.gif
new file mode 100644
index 0000000..5e69f8c
--- /dev/null
+++ b/icons/flags/Niue.gif
Binary files differ
diff --git a/icons/flags/None.gif b/icons/flags/None.gif
new file mode 100644
index 0000000..1ca9269
--- /dev/null
+++ b/icons/flags/None.gif
Binary files differ
diff --git a/icons/flags/Norway.gif b/icons/flags/Norway.gif
new file mode 100644
index 0000000..60d124e
--- /dev/null
+++ b/icons/flags/Norway.gif
Binary files differ
diff --git a/icons/flags/Other.gif b/icons/flags/Other.gif
new file mode 100644
index 0000000..1611258
--- /dev/null
+++ b/icons/flags/Other.gif
Binary files differ
diff --git a/icons/flags/Pakistan.gif b/icons/flags/Pakistan.gif
new file mode 100644
index 0000000..70bab44
--- /dev/null
+++ b/icons/flags/Pakistan.gif
Binary files differ
diff --git a/icons/flags/Panama.gif b/icons/flags/Panama.gif
new file mode 100644
index 0000000..a1812b7
--- /dev/null
+++ b/icons/flags/Panama.gif
Binary files differ
diff --git a/icons/flags/Papua_New_Guinea.gif b/icons/flags/Papua_New_Guinea.gif
new file mode 100644
index 0000000..5e3cd95
--- /dev/null
+++ b/icons/flags/Papua_New_Guinea.gif
Binary files differ
diff --git a/icons/flags/Paraguay.gif b/icons/flags/Paraguay.gif
new file mode 100644
index 0000000..9be04e1
--- /dev/null
+++ b/icons/flags/Paraguay.gif
Binary files differ
diff --git a/icons/flags/Peru.gif b/icons/flags/Peru.gif
new file mode 100644
index 0000000..42ba7cc
--- /dev/null
+++ b/icons/flags/Peru.gif
Binary files differ
diff --git a/icons/flags/Phillippines.gif b/icons/flags/Phillippines.gif
new file mode 100644
index 0000000..10facf1
--- /dev/null
+++ b/icons/flags/Phillippines.gif
Binary files differ
diff --git a/icons/flags/Poland.gif b/icons/flags/Poland.gif
new file mode 100644
index 0000000..0b7fbcc
--- /dev/null
+++ b/icons/flags/Poland.gif
Binary files differ
diff --git a/icons/flags/Portugal.gif b/icons/flags/Portugal.gif
new file mode 100644
index 0000000..28bbb1d
--- /dev/null
+++ b/icons/flags/Portugal.gif
Binary files differ
diff --git a/icons/flags/Puerto_Rico.gif b/icons/flags/Puerto_Rico.gif
new file mode 100644
index 0000000..86530db
--- /dev/null
+++ b/icons/flags/Puerto_Rico.gif
Binary files differ
diff --git a/icons/flags/Quatar.gif b/icons/flags/Quatar.gif
new file mode 100644
index 0000000..f32186a
--- /dev/null
+++ b/icons/flags/Quatar.gif
Binary files differ
diff --git a/icons/flags/Romania.gif b/icons/flags/Romania.gif
new file mode 100644
index 0000000..67cf3fb
--- /dev/null
+++ b/icons/flags/Romania.gif
Binary files differ
diff --git a/icons/flags/Russia.gif b/icons/flags/Russia.gif
new file mode 100644
index 0000000..f44d6f2
--- /dev/null
+++ b/icons/flags/Russia.gif
Binary files differ
diff --git a/icons/flags/Samoa.gif b/icons/flags/Samoa.gif
new file mode 100644
index 0000000..ac959e2
--- /dev/null
+++ b/icons/flags/Samoa.gif
Binary files differ
diff --git a/icons/flags/Saudi_Arabia.gif b/icons/flags/Saudi_Arabia.gif
new file mode 100644
index 0000000..2b33c82
--- /dev/null
+++ b/icons/flags/Saudi_Arabia.gif
Binary files differ
diff --git a/icons/flags/Singapore.gif b/icons/flags/Singapore.gif
new file mode 100644
index 0000000..58cf618
--- /dev/null
+++ b/icons/flags/Singapore.gif
Binary files differ
diff --git a/icons/flags/Slovakia.gif b/icons/flags/Slovakia.gif
new file mode 100644
index 0000000..8172d02
--- /dev/null
+++ b/icons/flags/Slovakia.gif
Binary files differ
diff --git a/icons/flags/Slovenia.gif b/icons/flags/Slovenia.gif
new file mode 100644
index 0000000..2c72c17
--- /dev/null
+++ b/icons/flags/Slovenia.gif
Binary files differ
diff --git a/icons/flags/Solomon_Islands.gif b/icons/flags/Solomon_Islands.gif
new file mode 100644
index 0000000..ec90b82
--- /dev/null
+++ b/icons/flags/Solomon_Islands.gif
Binary files differ
diff --git a/icons/flags/Somalia.gif b/icons/flags/Somalia.gif
new file mode 100644
index 0000000..189d283
--- /dev/null
+++ b/icons/flags/Somalia.gif
Binary files differ
diff --git a/icons/flags/South_Africa.gif b/icons/flags/South_Africa.gif
new file mode 100644
index 0000000..c4925e4
--- /dev/null
+++ b/icons/flags/South_Africa.gif
Binary files differ
diff --git a/icons/flags/South_Korea.gif b/icons/flags/South_Korea.gif
new file mode 100644
index 0000000..c4aeba3
--- /dev/null
+++ b/icons/flags/South_Korea.gif
Binary files differ
diff --git a/icons/flags/Spain.gif b/icons/flags/Spain.gif
new file mode 100644
index 0000000..623bc98
--- /dev/null
+++ b/icons/flags/Spain.gif
Binary files differ
diff --git a/icons/flags/Sri_Lanka.gif b/icons/flags/Sri_Lanka.gif
new file mode 100644
index 0000000..32e8fe9
--- /dev/null
+++ b/icons/flags/Sri_Lanka.gif
Binary files differ
diff --git a/icons/flags/St_Vincent_Grenadines.gif b/icons/flags/St_Vincent_Grenadines.gif
new file mode 100644
index 0000000..45208bb
--- /dev/null
+++ b/icons/flags/St_Vincent_Grenadines.gif
Binary files differ
diff --git a/icons/flags/Surinam.gif b/icons/flags/Surinam.gif
new file mode 100644
index 0000000..ae785a1
--- /dev/null
+++ b/icons/flags/Surinam.gif
Binary files differ
diff --git a/icons/flags/Sweden.gif b/icons/flags/Sweden.gif
new file mode 100644
index 0000000..3f02577
--- /dev/null
+++ b/icons/flags/Sweden.gif
Binary files differ
diff --git a/icons/flags/Switzerland.gif b/icons/flags/Switzerland.gif
new file mode 100644
index 0000000..4ba5a7f
--- /dev/null
+++ b/icons/flags/Switzerland.gif
Binary files differ
diff --git a/icons/flags/Taiwan.gif b/icons/flags/Taiwan.gif
new file mode 100644
index 0000000..1b30b63
--- /dev/null
+++ b/icons/flags/Taiwan.gif
Binary files differ
diff --git a/icons/flags/Thailand.gif b/icons/flags/Thailand.gif
new file mode 100644
index 0000000..5f82a75
--- /dev/null
+++ b/icons/flags/Thailand.gif
Binary files differ
diff --git a/icons/flags/Tonga.gif b/icons/flags/Tonga.gif
new file mode 100644
index 0000000..3c11049
--- /dev/null
+++ b/icons/flags/Tonga.gif
Binary files differ
diff --git a/icons/flags/Trinidad_Tobago.gif b/icons/flags/Trinidad_Tobago.gif
new file mode 100644
index 0000000..0bb395c
--- /dev/null
+++ b/icons/flags/Trinidad_Tobago.gif
Binary files differ
diff --git a/icons/flags/Turkey.gif b/icons/flags/Turkey.gif
new file mode 100644
index 0000000..dc6b748
--- /dev/null
+++ b/icons/flags/Turkey.gif
Binary files differ
diff --git a/icons/flags/Tuvalu.gif b/icons/flags/Tuvalu.gif
new file mode 100644
index 0000000..53de840
--- /dev/null
+++ b/icons/flags/Tuvalu.gif
Binary files differ
diff --git a/icons/flags/Ukraine.gif b/icons/flags/Ukraine.gif
new file mode 100644
index 0000000..5bf3fb6
--- /dev/null
+++ b/icons/flags/Ukraine.gif
Binary files differ
diff --git a/icons/flags/United_Arab_Emirates.gif b/icons/flags/United_Arab_Emirates.gif
new file mode 100644
index 0000000..bb465e9
--- /dev/null
+++ b/icons/flags/United_Arab_Emirates.gif
Binary files differ
diff --git a/icons/flags/United_Kingdom.gif b/icons/flags/United_Kingdom.gif
new file mode 100644
index 0000000..e67ebcf
--- /dev/null
+++ b/icons/flags/United_Kingdom.gif
Binary files differ
diff --git a/icons/flags/United_States.gif b/icons/flags/United_States.gif
new file mode 100644
index 0000000..cfc615e
--- /dev/null
+++ b/icons/flags/United_States.gif
Binary files differ
diff --git a/icons/flags/Uruguay.gif b/icons/flags/Uruguay.gif
new file mode 100644
index 0000000..6013b91
--- /dev/null
+++ b/icons/flags/Uruguay.gif
Binary files differ
diff --git a/icons/flags/Vanuatu.gif b/icons/flags/Vanuatu.gif
new file mode 100644
index 0000000..23fed67
--- /dev/null
+++ b/icons/flags/Vanuatu.gif
Binary files differ
diff --git a/icons/flags/Venezuela.gif b/icons/flags/Venezuela.gif
new file mode 100644
index 0000000..59c450b
--- /dev/null
+++ b/icons/flags/Venezuela.gif
Binary files differ
diff --git a/icons/flags/Wales.gif b/icons/flags/Wales.gif
new file mode 100644
index 0000000..7fb1b4f
--- /dev/null
+++ b/icons/flags/Wales.gif
Binary files differ
diff --git a/icons/flags/Yugoslavia.gif b/icons/flags/Yugoslavia.gif
new file mode 100644
index 0000000..32a244b
--- /dev/null
+++ b/icons/flags/Yugoslavia.gif
Binary files differ
diff --git a/icons/flags/Zambia.gif b/icons/flags/Zambia.gif
new file mode 100644
index 0000000..026bd71
--- /dev/null
+++ b/icons/flags/Zambia.gif
Binary files differ
diff --git a/icons/flags/Zimbabwe.gif b/icons/flags/Zimbabwe.gif
new file mode 100644
index 0000000..9b32969
--- /dev/null
+++ b/icons/flags/Zimbabwe.gif
Binary files differ
diff --git a/icons/flags/index.php b/icons/flags/index.php
new file mode 100644
index 0000000..3e305fe
--- /dev/null
+++ b/icons/flags/index.php
@@ -0,0 +1,6 @@
+<?php
+
+ // This is not a package.
+ header ("location: ../index.php");
+
+?> \ No newline at end of file
diff --git a/icons/home.png b/icons/home.png
new file mode 100644
index 0000000..26f9863
--- /dev/null
+++ b/icons/home.png
Binary files differ
diff --git a/icons/index.php b/icons/index.php
new file mode 100644
index 0000000..3e305fe
--- /dev/null
+++ b/icons/index.php
@@ -0,0 +1,6 @@
+<?php
+
+ // This is not a package.
+ header ("location: ../index.php");
+
+?> \ No newline at end of file
diff --git a/icons/my_admin.gif b/icons/my_admin.gif
new file mode 100644
index 0000000..a0bf5ff
--- /dev/null
+++ b/icons/my_admin.gif
Binary files differ
diff --git a/icons/my_bitweaver.gif b/icons/my_bitweaver.gif
new file mode 100644
index 0000000..0d4baa7
--- /dev/null
+++ b/icons/my_bitweaver.gif
Binary files differ
diff --git a/icons/my_bookmarks.gif b/icons/my_bookmarks.gif
new file mode 100644
index 0000000..b2a0172
--- /dev/null
+++ b/icons/my_bookmarks.gif
Binary files differ
diff --git a/icons/my_files.gif b/icons/my_files.gif
new file mode 100644
index 0000000..58ebb96
--- /dev/null
+++ b/icons/my_files.gif
Binary files differ
diff --git a/icons/my_homepage.gif b/icons/my_homepage.gif
new file mode 100644
index 0000000..a297b2b
--- /dev/null
+++ b/icons/my_homepage.gif
Binary files differ
diff --git a/icons/my_messages.gif b/icons/my_messages.gif
new file mode 100644
index 0000000..0f435dd
--- /dev/null
+++ b/icons/my_messages.gif
Binary files differ
diff --git a/icons/my_minical.gif b/icons/my_minical.gif
new file mode 100644
index 0000000..ffa412a
--- /dev/null
+++ b/icons/my_minical.gif
Binary files differ
diff --git a/icons/my_modules.gif b/icons/my_modules.gif
new file mode 100644
index 0000000..5699d16
--- /dev/null
+++ b/icons/my_modules.gif
Binary files differ
diff --git a/icons/my_news.gif b/icons/my_news.gif
new file mode 100644
index 0000000..2fb3cdd
--- /dev/null
+++ b/icons/my_news.gif
Binary files differ
diff --git a/icons/my_notes.gif b/icons/my_notes.gif
new file mode 100644
index 0000000..535c715
--- /dev/null
+++ b/icons/my_notes.gif
Binary files differ
diff --git a/icons/my_prefs.gif b/icons/my_prefs.gif
new file mode 100644
index 0000000..37c3245
--- /dev/null
+++ b/icons/my_prefs.gif
Binary files differ
diff --git a/icons/my_tasks.gif b/icons/my_tasks.gif
new file mode 100644
index 0000000..9b75a68
--- /dev/null
+++ b/icons/my_tasks.gif
Binary files differ
diff --git a/icons/my_watches.gif b/icons/my_watches.gif
new file mode 100644
index 0000000..01d8bed
--- /dev/null
+++ b/icons/my_watches.gif
Binary files differ
diff --git a/icons/my_webmail.gif b/icons/my_webmail.gif
new file mode 100644
index 0000000..43c4f2a
--- /dev/null
+++ b/icons/my_webmail.gif
Binary files differ
diff --git a/icons/pkg_users.png b/icons/pkg_users.png
new file mode 100644
index 0000000..b1fd4eb
--- /dev/null
+++ b/icons/pkg_users.png
Binary files differ
diff --git a/icons/send_msg_small.gif b/icons/send_msg_small.gif
new file mode 100644
index 0000000..b45e57a
--- /dev/null
+++ b/icons/send_msg_small.gif
Binary files differ
diff --git a/icons/unknown_user.jpg b/icons/unknown_user.jpg
new file mode 100644
index 0000000..c1cacc1
--- /dev/null
+++ b/icons/unknown_user.jpg
Binary files differ
diff --git a/icons/unwatch.gif b/icons/unwatch.gif
new file mode 100644
index 0000000..069d8b0
--- /dev/null
+++ b/icons/unwatch.gif
Binary files differ
diff --git a/icons/users.png b/icons/users.png
new file mode 100644
index 0000000..9f47019
--- /dev/null
+++ b/icons/users.png
Binary files differ
diff --git a/icons/watch.gif b/icons/watch.gif
new file mode 100644
index 0000000..4464cf2
--- /dev/null
+++ b/icons/watch.gif
Binary files differ
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..dfd0f7b
--- /dev/null
+++ b/index.php
@@ -0,0 +1,65 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/index.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// we need to do this before _ANYTHING_ else so we can limit all module queries to this homepage
+global $gQueryUserId, $gBitSystem;
+// Initialization
+define('ACTIVE_PACKAGE', 'users'); // Todo: use a different $_SERVER variable to properly determine the active package
+require_once( '../bit_setup_inc.php' );
+global $gBitSystem;
+require_once( LIBERTY_PKG_PATH."LibertyStructure.php" );
+
+require_once( USERS_PKG_PATH.'lookup_user_inc.php' );
+if( !empty( $_REQUEST['home'] ) ) {
+ $smarty->assign( 'home', $_REQUEST['home'] );
+ $gQueryUserId = $_REQUEST['home'];
+ if( $gQueryUser->isValid() ) {
+ $smarty->assign( 'gQueryUserId', $gQueryUserId );
+ }
+
+ if( $gBitSystem->getPreference('feature_user_theme') ) {
+ $userHomeStyle = $gQueryUser->getPreference( 'theme' );
+ if( isset( $userHomeStyle ) ) {
+ $gBitSystem->setStyle($userHomeStyle );
+ $gBitLoc['styleSheet'] = $gBitSystem->getStyleCss( $userHomeStyle, $_REQUEST['home'] );
+ $smarty->assign( 'userStyle', $userHomeStyle );
+ }
+ }
+ $userHomeTitle = $gQueryUser->getPreference( 'homepage_title' );
+ if (!$userHomeTitle) {
+ $userHomeTitle = $gQueryUser->getDisplayName()."'s Homepage";
+ }
+ $browserTitle = $userHomeTitle;
+ //$_REQUEST['page'] = $userHomeTitle; // $_REQUEST['page'] should be used for requesting a page #! - drewslater
+
+// need to loadLayout prematurely (usually happens in modules_inc.php) so we can see if we have any center pieces
+ if( $gBitSystem->getPreference('feature_user_layout') == 'h' ) {
+ $user_name = $_REQUEST['home'];
+ } elseif( $gBitSystem->getPreference('feature_user_layout') == 'y' ) {
+ $user_name = $gBitUser->mUserId;
+ } else {
+ $user_name = ROOT_USER_ID;
+ }
+ $layout = HOMEPAGE_LAYOUT;
+ if( isset( $layout ) ) {
+ $gBitSystem->loadLayout( $user_name, $layout, ACTIVE_PACKAGE, TRUE );
+ }
+ global $gCenterPieces;
+ $centerDisplay = ( count( $gCenterPieces ) ? 'bitpackage:kernel/dynamic.tpl' : 'bitpackage:users/center_user_wiki_page.tpl' );
+} else {
+ $gQueryUser->getList( $_REQUEST );
+ $smarty->assign_by_ref('users', $_REQUEST["data"]);
+ if (isset($_REQUEST["numrows"]))
+ $_REQUEST["control"]["numrows"] = $_REQUEST["numrows"];
+ else
+ $_REQUEST["control"]["numrows"] = 50;
+ $_REQUEST["control"]["URL"] = USERS_PKG_URL."index.php";
+ $smarty->assign_by_ref('control', $_REQUEST["control"]);
+ $centerDisplay = 'bitpackage:users/index_list.tpl';
+ $browserTitle = $siteTitle.' '.tra( 'Members' );
+}
+
+$gBitSystem->display( $centerDisplay, $browserTitle );
+?>
diff --git a/login.php b/login.php
new file mode 100644
index 0000000..db54930
--- /dev/null
+++ b/login.php
@@ -0,0 +1,21 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/login.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+# $Header: /cvsroot/bitweaver/_bit_users/login.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+include_once ("../bit_setup_inc.php");
+
+if( $gBitUser->isRegistered() ) {
+ header( 'Location: '.USERS_PKG_URL.'my.php' );
+ die;
+}
+
+if( !empty( $_REQUEST['error'] ) ) {
+ $smarty->assign( 'error', $_REQUEST['error'] );
+}
+
+$gBitSystem->display( 'bitpackage:users/login.tpl');
+
+$gBitSystem->setBrowserTitle( $gBitSystem->getPreference( 'siteTitle' ).' Login' );
+?>
diff --git a/logout.php b/logout.php
new file mode 100644
index 0000000..749816f
--- /dev/null
+++ b/logout.php
@@ -0,0 +1,20 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/logout.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+$bypass_siteclose_check = 'y';
+require_once( '../bit_setup_inc.php' );
+global $gBitSystem;
+// go offline in Live Support
+if ($gBitSystem->isPackageActive( 'LIVE_SUPPORT_PKG_NAME' ) ) {
+ include_once( LIVE_SUPPORT_PKG_PATH.'ls_lib.php' );
+ if ($lslib->get_operator_status($user) != 'offline') {
+ $lslib->set_operator_status($user, 'offline');
+ }
+}
+$gBitUser->logout();
+header ("location: ".$gBitSystem->getDefaultPage());
+exit;
+?>
diff --git a/lookup_user_inc.php b/lookup_user_inc.php
new file mode 100644
index 0000000..1268190
--- /dev/null
+++ b/lookup_user_inc.php
@@ -0,0 +1,46 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/lookup_user_inc.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+// Copyright (c) 2004, bitweaver, Christian Fowler, Brian Todoroff, et. al.
+// 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.
+//
+// This is a centralized include file to setup $gQueryUser var if you need to display detailed information about any arbitrary user.
+//
+global $gQueryUser;
+
+// Keep backward compatability
+if (isset($_REQUEST['fHomepage'])) {
+ $_REQUEST['home'] = $_REQUEST['fHomepage'];
+}
+if (isset($_REQUEST['home'])) {
+ $_REQUEST['fHomepage'] = $_REQUEST['home'];
+}
+
+if (isset($_REQUEST['home'])) {
+ // this allows for a numeric user_id or alpha_numeric user_id
+ $queryUserId = $gBitUser->lookupHomepage($_REQUEST['home'], $gBitSystem->getPreference('case_sensitive_login', 'y') == 'y');
+ $_REQUEST['home'] = $queryUserId;
+ $gQueryUser = new BitPermUser( $queryUserId );
+ $gQueryUser->load( TRUE );
+} elseif( $gBitUser->isValid() ) {
+ // We are looking at ourself, use our existing BitUser
+ global $gBitUser;
+ $gQueryUser = &$gBitUser;
+}
+
+if (!$gBitUser->isAdmin()) {
+ if( $gQueryUser->mUserPrefs['user_information'] == 'private') {
+ $gBitSystem->fatalError( tra("The user has choosen to make his information private") );
+ die;
+ }
+}
+
+$gQueryUser->sanitizeUserInfo();
+$smarty->assign_by_ref('gQueryUser', $gQueryUser);
+
+if( $gQueryUser->isValid() ) {
+ $smarty->assign_by_ref( 'userInfo', $gQueryUser->mInfo );
+ $smarty->assign_by_ref( 'userPrefs', $gQueryUser->mUserPrefs );
+ $smarty->assign( 'homepage_header', $gQueryUser->getPreference( 'homepage_header' ) );
+}
+?>
diff --git a/menu.php b/menu.php
new file mode 100644
index 0000000..978c872
--- /dev/null
+++ b/menu.php
@@ -0,0 +1,106 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/menu.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+require_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'user_menu_lib.php' );
+if ($feature_usermenu != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_usermenu");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->mUserId) {
+ $smarty->assign('msg', tra("Must be logged to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->hasPermission( 'bit_p_usermenu' )) {
+ $smarty->assign('msg', tra("Permission denied to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!isset($_REQUEST["menu_id"]))
+ $_REQUEST["menu_id"] = 0;
+if (isset($_REQUEST["delete"]) && isset($_REQUEST["menu"])) {
+
+ foreach (array_keys($_REQUEST["menu"])as $men) {
+ $usermenulib->remove_usermenu($gBitUser->mUserId, $men);
+ }
+ if (isset($_SESSION['usermenu']))
+ unset ($_SESSION['usermenu']);
+}
+if (isset($_REQUEST['addbk'])) {
+
+ $usermenulib->add_bk($gBitUser->mUserId);
+ if (isset($_SESSION['usermenu']))
+ unset ($_SESSION['usermenu']);
+}
+if ($_REQUEST["menu_id"]) {
+ $info = $usermenulib->get_usermenu($gBitUser->mUserId, $_REQUEST["menu_id"]);
+} else {
+ $info = array();
+ $info['name'] = '';
+ $info['url'] = isset($_REQUEST['url']) ? $_REQUEST['url'] : '';
+ $info['mode'] = 'w';
+ $info['position'] = $usermenulib->get_max_position($gBitUser->mUserId) + 1;
+}
+if (isset($_REQUEST['save'])) {
+
+ $usermenulib->replace_usermenu(
+ $gBitUser->mUserId, $_REQUEST["menu_id"], $_REQUEST["name"], $_REQUEST["url"], $_REQUEST['position'], $_REQUEST['mode']);
+ $info = array();
+ $info['name'] = '';
+ $info['url'] = '';
+ $info['position'] = 1;
+ $_REQUEST["menu_id"] = 0;
+ unset ($_SESSION['usermenu']);
+}
+$smarty->assign('menu_id', $_REQUEST["menu_id"]);
+$smarty->assign('info', $info);
+if ( empty( $_REQUEST["sort_mode"] ) ) {
+ $sort_mode = 'position_asc';
+} else {
+ $sort_mode = $_REQUEST["sort_mode"];
+}
+if (!isset($_REQUEST["offset"])) {
+ $offset = 0;
+} else {
+ $offset = $_REQUEST["offset"];
+}
+if (isset($_REQUEST['page'])) {
+ $page = &$_REQUEST['page'];
+ $offset = ($page - 1) * $maxRecords;
+}
+$smarty->assign_by_ref('offset', $offset);
+if (isset($_REQUEST["find"])) {
+ $find = $_REQUEST["find"];
+} else {
+ $find = '';
+}
+$smarty->assign('find', $find);
+$smarty->assign_by_ref('sort_mode', $sort_mode);
+if (isset($_SESSION['thedate'])) {
+ $pdate = $_SESSION['thedate'];
+} else {
+ $pdate = date("U");
+}
+$channels = $usermenulib->list_usermenus($gBitUser->mUserId, $offset, $maxRecords, $sort_mode, $find);
+$cant_pages = ceil($channels["cant"] / $maxRecords);
+$smarty->assign_by_ref('cant_pages', $cant_pages);
+$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
+if ($channels["cant"] > ($offset + $maxRecords)) {
+ $smarty->assign('next_offset', $offset + $maxRecords);
+} else {
+ $smarty->assign('next_offset', -1);
+}
+// If offset is > 0 then prev_offset
+if ($offset > 0) {
+ $smarty->assign('prev_offset', $offset - $maxRecords);
+} else {
+ $smarty->assign('prev_offset', -1);
+}
+$smarty->assign_by_ref('channels', $channels["data"]);
+
+$gBitSystem->display( 'bitpackage:users/usermenu.tpl');
+?>
diff --git a/module_controls_inc.php b/module_controls_inc.php
new file mode 100644
index 0000000..6433db4
--- /dev/null
+++ b/module_controls_inc.php
@@ -0,0 +1,50 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/module_controls_inc.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+$check_req = (isset($_REQUEST["mc_unassign"])
+ || isset($_REQUEST["mc_up"])
+ || isset($_REQUEST["mc_down"])
+ || isset($_REQUEST["mc_move"]));
+if (!$gBitUser->hasPermission( 'bit_p_configure_modules' ) && $check_req) {
+ $smarty->assign('msg', tra("You dont have permission to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ($user_assigned_modules != 'y' && $check_req) {
+ $smarty->assign('msg', tra("This feature is disabled").": user_assigned_modules");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if ( !$gBitUser->isRegistered() && $check_req) {
+ $smarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+$url = $_SERVER["REQUEST_URI"];
+if ($check_req) {
+// global $debugger;
+// $debugger->msg('Module control clicked: '.$check_req);
+ // Make defaults if user still ot configure modules for himself
+ if (!$usermoduleslib->user_has_assigned_modules($user))
+ $usermoduleslib->create_user_assigned_modules($user);
+ // Handle control icon click
+ if (isset($_REQUEST["mc_up"]))
+ $usermoduleslib->swap_up_user_module($_REQUEST["mc_up"], $user);
+ elseif (isset($_REQUEST["mc_down"]))
+ $usermoduleslib->swap_down_user_module($_REQUEST["mc_down"], $user);
+ elseif (isset($_REQUEST["mc_move"]))
+ $usermoduleslib->move_module($_REQUEST["mc_move"], $user);
+ else
+ $usermoduleslib->unassign_user_module($_REQUEST["mc_unassign"], $user);
+ // Remove module movemet paramaters from an URL
+ // \todo What if 'mc_xxx' arg was not at the end? (if smbd fix URL by hands...)
+ // should I handle this very special (hack?) case?
+ $url = preg_replace('/(.*)(\?|&){1}(mc_up|mc_down|mc_move|mc_unassign)=[^&]*/','\1', $url);
+}
+// Fix locaton if parameter was removed...
+if ($url != $_SERVER["REQUEST_URI"]) header('location: '.$url);
+$smarty->assign('current_location', $url);
+$smarty->assign('mpchar', (strpos($url, '?') ? '&' : '?'));
+?>
diff --git a/modules/index.php b/modules/index.php
new file mode 100644
index 0000000..80f6d40
--- /dev/null
+++ b/modules/index.php
@@ -0,0 +1,4 @@
+<?php
+ // This is not a package.
+ header ("location: ../index.php");
+?> \ No newline at end of file
diff --git a/modules/mod_login_box.tpl b/modules/mod_login_box.tpl
new file mode 100644
index 0000000..d62a644
--- /dev/null
+++ b/modules/mod_login_box.tpl
@@ -0,0 +1,104 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/mod_login_box.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{bitmodule title="$moduleTitle" name="login_box"}
+ {if $gBitUser->IsRegistered()}
+ {tr}Logged in as{/tr}: {$gBitUser->getDisplayName()}<br />
+ <a href="{$gBitLoc.USERS_PKG_URL}logout.php">{tr}Logout{/tr}</a><br />
+ {if $gBitUser->isAdmin()}
+ {form action=$login_url}
+ <label for="login-switchuser">{tr}user{/tr}:</label>
+ <input type="text" name="username" id="login-switchuser" size="8" />
+ <input type="submit" name="su" value="{tr}set{/tr}" />
+ {/form}
+ {/if}
+ {else}
+ <form name="loginbox" action="{$login_url}" method="post" {if $gBitSystemPrefs.feature_challenge eq 'y'}onsubmit="doChallengeResponse()"{/if}>
+ {if $gBitSystemPrefs.feature_challenge eq 'y'}
+ <script language="javascript" type="text/javascript" src="lib/md5.js"></script>
+ {literal}
+ <script language="Javascript" type="text/javascript">
+ <!--
+ function doChallengeResponse() {
+ hashstr = document.loginbox.user.value +
+ document.loginbox.pass.value +
+ document.loginbox.email.value;
+ str = document.loginbox.user.value +
+ MD5(hashstr) +
+ document.loginbox.challenge.value;
+ document.loginbox.response.value = MD5(str);
+ document.loginbox.pass.value='';
+ /*
+ document.login.password.value = "";
+ document.logintrue.username.value = document.login.username.value;
+ document.logintrue.response.value = MD5(str);
+ document.logintrue.submit();
+ */
+ document.loginbox.submit();
+ return false;
+ }
+ // -->
+ </script>
+ {/literal}
+ <input type="hidden" name="challenge" value="{$challenge|escape}" />
+ <input type="hidden" name="response" value="" />
+ {/if}
+
+ <div class="row">
+ {forminput}
+ <input type="text" name="user" alt="username" size="20" value="username" onFocus="this.value=''" />
+ {/forminput}
+ </div>
+
+ {if $gBitSystemPrefs.feature_challenge eq 'y'}
+ <div class="row">
+ {forminput}
+ <input type="text" name="email" alt="email address" size="20" value="email" onFocus="this.value=''" />
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {forminput}
+ <input type="password" name="pass" alt="password" size="20" value="password" onFocus="this.value=''" />
+ {if $forgotPass eq 'y'}
+ <br /><a href="`$gBitLoc.USERS_PKG_URL`remind_password.php">I forgot my password</a>
+ {/if}
+ {/forminput}
+ </div>
+
+ {if $rememberme ne 'disabled'}
+ <div class="row">
+ {forminput}
+ <input type="checkbox" name="rme" value="on" checked=checked/>
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $http_login_url ne '' or $https_login_url ne ''}
+ <div class="row">
+ {forminput}
+ <a href="{$http_login_url}" title="{tr}Click here to login using the default security protocol{/tr}">{tr}standard{/tr}</a> |
+ <a href="{$https_login_url}" title="{tr}Click here to login using a secure protocol{/tr}">{tr}secure{/tr}</a>
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $show_stay_in_ssl_mode eq 'y'}
+ <div class="row">
+ {formlabel label="stay in ssl mode" for="stay_in_ssl_mode"}
+ {forminput}
+ <input type="checkbox" name="stay_in_ssl_mode" id="stay_in_ssl_mode" {if $stay_in_ssl_mode eq 'y'}checked="checked"{/if} />
+ {/forminput}
+ </div>
+ {else}
+ <input type="hidden" name="stay_in_ssl_mode" value="{$stay_in_ssl_mode|escape}" />
+ {/if}
+
+ <div class="row submit">
+ <input type="submit" name="login" value="{tr}login{/tr}" />
+ {if $allowRegister eq 'y'}
+ <a href="{$gBitLoc.USERS_PKG_URL}register.php">{tr}register{/tr}</a>
+ {/if}
+ </div>
+ </form>
+{/if}
+{/bitmodule}
diff --git a/modules/mod_online_users.php b/modules/mod_online_users.php
new file mode 100644
index 0000000..080aec0
--- /dev/null
+++ b/modules/mod_online_users.php
@@ -0,0 +1,6 @@
+<?php
+global $gBitUser;
+$online_users = $gBitUser->get_online_users();
+$smarty->assign('online_users', $online_users);
+$smarty->assign('logged_users', count( $online_users ) );
+?>
diff --git a/modules/mod_online_users.tpl b/modules/mod_online_users.tpl
new file mode 100644
index 0000000..7cf5651
--- /dev/null
+++ b/modules/mod_online_users.tpl
@@ -0,0 +1,16 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/mod_online_users.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+{bitmodule title="$moduleTitle" name="online_users"}
+ {if $logged_users > 1}
+ {tr}We have {$logged_users} online users{/tr}
+ {elseif $logged_users == 1}
+ {tr}We have {$logged_users} online user{/tr}
+ {/if}
+ <ol>
+ {section name=ix loop=$online_users}
+ {if $online_users[ix].user_information ne 'public'}{assign var=nolink value=1}{else}{assign var=nolink value=0}{/if}
+ <li>{displayname hash=$online_users[ix] nolink=$nolink}</li>
+ {/section}
+ </ol>
+{/bitmodule}
+{/strip}
diff --git a/modules/mod_since_last_visit.php b/modules/mod_since_last_visit.php
new file mode 100644
index 0000000..7120987
--- /dev/null
+++ b/modules/mod_since_last_visit.php
@@ -0,0 +1,4 @@
+<?php
+$nvi_info = $gBitSystem->get_news_from_last_visit($user);
+$smarty->assign('nvi_info', $nvi_info);
+?> \ No newline at end of file
diff --git a/modules/mod_since_last_visit.tpl b/modules/mod_since_last_visit.tpl
new file mode 100644
index 0000000..c194af9
--- /dev/null
+++ b/modules/mod_since_last_visit.tpl
@@ -0,0 +1,12 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/mod_since_last_visit.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{if $user}
+ {bitmodule title="$moduleTitle" name="since_last_visit"}
+ {tr}Since your last visit on{/tr}<br />
+ <b>{$nvi_info.lastVisit|bit_short_datetime|replace:"[":""|replace:"]":""}</b><br />
+ {$nvi_info.images} {tr}new images{/tr}<br />
+ {$nvi_info.pages} {tr}wiki pages changed{/tr}<br />
+ {$nvi_info.files} {tr}new files{/tr}<br />
+ {$nvi_info.comments} {tr}new comments{/tr}<br />
+ {$nvi_info.users} {tr}new users{/tr}<br />
+ {/bitmodule}
+{/if} \ No newline at end of file
diff --git a/modules/mod_user_bookmarks.php b/modules/mod_user_bookmarks.php
new file mode 100644
index 0000000..4d22aed
--- /dev/null
+++ b/modules/mod_user_bookmarks.php
@@ -0,0 +1,69 @@
+<?php
+if( $gBitSystem->isFeatureActive( 'feature_user_bookmarks' ) && $gBitUser->isRegistered() && $gBitUser->hasPermission( 'bit_p_create_bookmarks' ) ) {
+
+ include_once( USERS_PKG_PATH.'bookmark_lib.php' );
+
+ $setup_parsed_uri = parse_url($_SERVER["REQUEST_URI"]);
+ if (isset($setup_parsed_uri["query"])) {
+ parse_str($setup_parsed_uri["query"], $setup_query_data);
+ } else {
+ $setup_query_data = array();
+ }
+
+ // check the session to get the parent or create parent =0
+ $smarty->assign('ownurl', httpPrefix(). $_SERVER["REQUEST_URI"]);
+ if (!isset($_SESSION["bookmarks_parent"])) {
+ $_SESSION["bookmarks_parent"] = 0;
+ }
+ if (isset($_REQUEST["bookmarks_parent"])) {
+ $_SESSION["bookmarks_parent"] = $_REQUEST["bookmarks_parent"];
+ }
+ $ownurl = httpPrefix(). $_SERVER["REQUEST_URI"];
+ // Now build urls
+ if (strstr($ownurl, '?')) {
+ $modb_sep = '&amp;';
+ } else {
+ $modb_sep = '?';
+ }
+ $smarty->assign('modb_sep', $modb_sep);
+ if (isset($_REQUEST["bookmark_removeurl"])) {
+ $bookmarklib->remove_url($_REQUEST["bookmark_removeurl"], $gBitUser->mUserId );
+ header( 'Location: '.$_SERVER['HTTP_REFERER'] );
+ die;
+ } elseif (isset($_REQUEST["bookmark_create_folder"])) {
+ $bookmarklib->add_folder($_SESSION["bookmarks_parent"], $_REQUEST['bookmark_urlname'], $gBitUser->mUserId );
+ } elseif (isset($_REQUEST["bookmark_mark"])) {
+ if (empty($_REQUEST["bookmark_urlname"])) {
+ global $gContent, $gBitSystem;
+ if( $gContent && $gContent->getTitle() ) {
+ $_REQUEST["bookmark_urlname"] = $gContent->getTitle();
+ } elseif( $gBitSystem->getBrowserTitle() ) {
+ $_REQUEST["bookmark_urlname"] = $gBitSystem->getBrowserTitle();
+ } else {
+ $_REQUEST["bookmark_urlname"] = basename( $_SERVER['REQUEST_URI'] );
+ }
+ }
+ if (!empty($_REQUEST["bookmark_urlname"])) {
+ $bookmarklib->replace_url(0, $_SESSION["bookmarks_parent"], $_REQUEST["bookmark_urlname"], $ownurl, $gBitUser->mUserId );
+ }
+ }
+ $modb_p_info = $bookmarklib->get_folder($_SESSION["bookmarks_parent"], $gBitUser->mUserId );
+ $modb_father = $modb_p_info["parent_id"];
+ // get folders for the parent
+ $modb_urls = $bookmarklib->list_folder($_SESSION["bookmarks_parent"], 0, -1, 'name_asc', '', $gBitUser->mUserId );
+ $smarty->assign('modb_urls', $modb_urls["data"]);
+ $modb_folders = $bookmarklib->get_child_folders($_SESSION["bookmarks_parent"], $gBitUser->mUserId );
+ $modb_pf = array(
+ "name" => "..",
+ "folder_id" => $modb_father,
+ "parent_id" => 0,
+ "user_id" => $gBitUser->mUserId
+ );
+ $modb_pfs = array($modb_pf);
+ if ($_SESSION["bookmarks_parent"]) {
+ $modb_folders = array_merge($modb_pfs, $modb_folders);
+ }
+ $smarty->assign('modb_folders', $modb_folders);
+// get urls for the parent
+}
+?>
diff --git a/modules/mod_user_bookmarks.tpl b/modules/mod_user_bookmarks.tpl
new file mode 100644
index 0000000..7704495
--- /dev/null
+++ b/modules/mod_user_bookmarks.tpl
@@ -0,0 +1,24 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/Attic/mod_user_bookmarks.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{if $gBitSystem->isFeatureActive( 'feature_user_bookmarks' ) and $gBitUser->isRegistered() and $gBitUser->hasPermission( 'bit_p_create_bookmarks' )}
+ {bitmodule title="$moduleTitle" name="user_bookmarks"}
+ <table class="module box">
+ {section name=ix loop=$modb_folders}
+ <tr><td valign="bottom">
+ <a href="{$ownurl}{$modb_sep}bookmarks_parent={$modb_folders[ix].folder_id}">{biticon ipackage=liberty iname="folder" iexplain="folder"}</a>{$modb_folders[ix].name}
+ </td></tr>
+ {/section}
+ {section name=ix loop=$modb_urls}
+ <tr><td>
+ <a href="{$modb_urls[ix].url}">{$modb_urls[ix].name}</a>
+ {if $gBitUser->hasPermission( 'bit_p_cache_bookmarks' ) and $urls[ix].datalen > 0}
+ (<a href="{$gBitLoc.USERS_PKG_URL}cached_bookmark.php?urlid={$modb_urls[ix].url_id}">{tr}cache{/tr}</a>)
+ {/if}
+ <a href="{$ownurl}{$modb_sep}bookmark_removeurl={$modb_urls[ix].url_id}">{biticon ipackage=liberty iname="delete_small" iexplain="remove"}</a>
+ </td></tr>
+ {/section}
+ </table><br />
+ {form action=$ownurl}
+ <input type="submit" name="bookmark_mark" value="{tr}mark{/tr}" />
+ {/form}
+ {/bitmodule}
+{/if}
diff --git a/modules/mod_user_image_galleries.php b/modules/mod_user_image_galleries.php
new file mode 100644
index 0000000..3395b87
--- /dev/null
+++ b/modules/mod_user_image_galleries.php
@@ -0,0 +1,4 @@
+<?php
+$ranking = $gBitSystem->get_user_galleries($user, $module_rows);
+$smarty->assign('modUserG', $ranking);
+?>
diff --git a/modules/mod_user_image_galleries.tpl b/modules/mod_user_image_galleries.tpl
new file mode 100644
index 0000000..0be7500
--- /dev/null
+++ b/modules/mod_user_image_galleries.tpl
@@ -0,0 +1,19 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/Attic/mod_user_image_galleries.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{if $user}
+ {if $gBitSystemPrefs.feature_galleries eq 'y'}
+ {bitmodule title="$moduleTitle" name="user_image_galleries"}
+ <table class="module box">
+ {section name=ix loop=$modUserG}
+ <tr>
+ {if $nonums != 'y'}
+ <td valign="top">{$smarty.section.ix.index_next})</td>
+ {/if}
+ <td>
+ <a href="{$gBitLoc.IMAGEGALS_PKG_URL}browse_gallery.php?gallery_id={$modUserG[ix].gallery_id}">{$modUserG[ix].name}</a>
+ </td>
+ </tr>
+ {/section}
+ </table>
+ {/bitmodule}
+ {/if}
+{/if}
diff --git a/modules/mod_user_pages.php b/modules/mod_user_pages.php
new file mode 100644
index 0000000..d60ae01
--- /dev/null
+++ b/modules/mod_user_pages.php
@@ -0,0 +1,4 @@
+<?php
+$ranking = $gBitSystem->get_user_pages($user, $module_rows);
+$smarty->assign('modUserPages', $ranking);
+?>
diff --git a/modules/mod_user_pages.tpl b/modules/mod_user_pages.tpl
new file mode 100644
index 0000000..765f124
--- /dev/null
+++ b/modules/mod_user_pages.tpl
@@ -0,0 +1,19 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/mod_user_pages.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{if $user}
+ {if $gBitSystemPrefs.feature_wiki eq 'y'}
+ {bitmodule title="$moduleTitle" name="user_pages"}
+ <table class="module box">
+ {section name=ix loop=$modUserPages}
+ <tr>
+ {if $nonums != 'y'}
+ <td valign="top">{$smarty.section.ix.index_next})</td>
+ {/if}
+ <td>
+ <a href="{$gBitLoc.WIKI_PKG_URL}index.php?page={$modUserPages[ix].page_name|escape:"url"}">{$modUserPages[ix].page_name}</a>
+ </td>
+ </tr>
+ {/section}
+ </table>
+ {/bitmodule}
+ {/if} {* $gBitSystemPrefs.feature_wiki eq 'y' *}
+{/if} {* $user *} \ No newline at end of file
diff --git a/modules/mod_user_profile.php b/modules/mod_user_profile.php
new file mode 100644
index 0000000..405be7b
--- /dev/null
+++ b/modules/mod_user_profile.php
@@ -0,0 +1,13 @@
+<?php
+// +----------------------------------------------------------------------
+// | PHP Source
+// +----------------------------------------------------------------------
+// | Copyright (C) 2004 by Tikipro - cfowler, btodoroff, et al
+// +----------------------------------------------------------------------
+global $gQueryUser, $gBitUser, $smarty;
+if( !empty( $gQueryUser->mInfo ) ) {
+ $smarty->assign_by_ref('userInfo', $gQueryUser->mInfo );
+} elseif( !empty( $gBitUser->mInfo ) ) {
+ $smarty->assign_by_ref('userInfo', $gBitUser->mInfo );
+}
+?>
diff --git a/modules/mod_user_profile.tpl b/modules/mod_user_profile.tpl
new file mode 100644
index 0000000..7342979
--- /dev/null
+++ b/modules/mod_user_profile.tpl
@@ -0,0 +1,19 @@
+{strip}
+ {bitmodule title="$moduleTitle"}
+ <h2 style="text-align:center;">
+ {displayname hash=$userInfo}
+ {if $gQueryUserId and $gBitSystem->isPackageActive( 'messu' ) and $gBitUser->hasPermission( 'bit_p_messages' ) and $userPrefs.allowMsgs eq 'y'}
+ &nbsp;<a href="{$gBitLoc.MESSU_PKG_URL}compose.php?to={$userInfo.login}">{biticon ipackage="messu" iname="send_mail" iexplain="Send user a personal message"}</a>
+ {/if}
+ </h2>
+ <p style="text-align:center;">
+ {if $userInfo.avatar_url}
+ <img src="{$userInfo.avatar_url}" class="thumb" title="{tr}Avatar{/tr}" alt="{tr}Avatar{/tr}"/>
+ {else}
+ {biticon ipackage=users iname='unknown_user' class='thumb' iexplain='no user avatar uploaded'}
+ {/if}
+ <br />
+ {tr}Last login{/tr}: {$userInfo.last_login|bit_short_date}
+ </p>
+ {/bitmodule}
+{/strip}
diff --git a/modules/mod_user_tasks.php b/modules/mod_user_tasks.php
new file mode 100644
index 0000000..1a600ba
--- /dev/null
+++ b/modules/mod_user_tasks.php
@@ -0,0 +1,30 @@
+<?php
+require_once(USERS_PKG_PATH."task_lib.php");
+global $user, $feature_tasks, $bit_p_tasks, $tasklib;
+
+if ($user && isset($feature_tasks) && $feature_tasks == 'y' && isset($bit_p_tasks) && $gBitUser->hasPermission( 'bit_p_tasks' )) {
+ if (isset($_SESSION['thedate'])) {
+ $pdate = $_SESSION['thedate'];
+ } else {
+ $pdate = date("U");
+ }
+ if (isset($_REQUEST["modTasksDel"])) {
+ foreach (array_keys($_REQUEST["modTasks"])as $task) {
+ $tasklib->remove_task($user, $task);
+ }
+ }
+ if (isset($_REQUEST["modTasksCom"])) {
+ foreach (array_keys($_REQUEST["modTasks"])as $task) {
+ $tasklib->complete_task($user, $task);
+ }
+ }
+ if (isset($_REQUEST["modTasksSave"])) {
+ $tasklib->replace_task($user, 0, $_REQUEST['modTasksTitle'], $_REQUEST['modTasksTitle'], date("U"), 'o', 3, 0, 0);
+ }
+ $ownurl =/*httpPrefix().*/ $_SERVER["REQUEST_URI"];
+ $smarty->assign('ownurl', $ownurl);
+ $tasks_use_dates = $gBitSystem->get_user_preference($user, 'tasks_use_dates');
+ $modTasks = $gBitSystem->list_tasks($user, 0, -1, 'priority_desc', '', $tasks_use_dates, $pdate);
+ $smarty->assign('modTasks', $modTasks['data']);
+}
+?>
diff --git a/modules/mod_user_tasks.tpl b/modules/mod_user_tasks.tpl
new file mode 100644
index 0000000..9ad5d96
--- /dev/null
+++ b/modules/mod_user_tasks.tpl
@@ -0,0 +1,23 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/Attic/mod_user_tasks.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{if $gBitSystemPrefs.feature_tasks eq 'y' and $user}
+ {bitmodule title="$moduleTitle" name="user_tasks"}
+ {form action=$ownurl}
+ <input type="text" name="modTasksTitle" />
+ <input type="submit" name="modTasksSave" value="{tr}add{/tr}" />
+ {/form}
+ {form action=$ownurl}
+ <table class="module box">
+ {section name=ix loop=$modTasks}
+ <tr><td>
+ <input type="checkbox" name="modTasks[{$modTasks[ix].task_id}]" />
+ <a {if $modTasks[ix].status eq 'c'}style="text-decoration:line-through;"{/if} href="{$gBitLoc.USERS_PKG_URL}tasks.php?task_id={$modTasks[ix].task_id}">{$modTasks[ix].title}</a> ({$modTasks[ix].percentage}%)
+ </td></tr>
+ {sectionelse}
+ <tr><td>&nbsp;</td></tr>
+ {/section}
+ </table>
+ <input type="submit" name="modTasksCom" value="{tr}Done{/tr}" />
+ <input type="submit" name="modTasksDel" value="{tr}Delete{/tr}" />
+ {/form}
+ {/bitmodule}
+{/if}
diff --git a/modules/mod_who_is_there.php b/modules/mod_who_is_there.php
new file mode 100644
index 0000000..f96ea56
--- /dev/null
+++ b/modules/mod_who_is_there.php
@@ -0,0 +1,7 @@
+<?php
+global $userlib;
+$logged_users = $gBitUser->count_sessions();
+$online_users = $gBitUser->get_online_users();
+$smarty->assign('online_users', $online_users);
+$smarty->assign('logged_users', $logged_users);
+?>
diff --git a/modules/mod_who_is_there.tpl b/modules/mod_who_is_there.tpl
new file mode 100644
index 0000000..586737e
--- /dev/null
+++ b/modules/mod_who_is_there.tpl
@@ -0,0 +1,22 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/mod_who_is_there.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{bitmodule title="$moduleTitle" name="who_is_there"}
+ <div>
+ {$logged_users}
+ {if $logged_users>1}
+ {tr}online users{/tr}
+ {elseif $logged_users>0}
+ {tr}online user{/tr}
+ {/if}
+ </div>
+ {section name=ix loop=$online_users}
+ {if $user and $gBitSystemPrefs.feature_messages eq 'y' and $gBitUser->hasPermission( 'bit_p_messages' )}
+ <a href="{$gBitLoc.MESSU_PKG_URL}compose.php?to={$online_users[ix].user}" title="{tr}Send a message to{/tr} {$online_users[ix].user}">{biticon ipackage="users" iname="send_msg_small" iexplain="send message"}</a>
+ {/if}
+ {if $online_users[ix].user_information eq 'public'}
+ {math equation="x - y" x=$smarty.now y=$online_users[ix].timestamp assign=idle}
+ <a href="{$gBitLoc.USERS_PKG_URL}index.php?home={$online_users[ix].user}" title="{tr}More info about{/tr} {$online_users[ix].user} ({tr}idle{/tr} {$idle} {tr}seconds{/tr})">{$online_users[ix].user}</a><br />
+ {else}
+ {$online_users[ix].user}<br />
+ {/if}
+ {/section}
+{/bitmodule}
diff --git a/modules/user_module.tpl b/modules/user_module.tpl
new file mode 100644
index 0000000..2d82533
--- /dev/null
+++ b/modules/user_module.tpl
@@ -0,0 +1,4 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/modules/user_module.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{bitmodule title=$user_title name=$user_module_name}
+ {eval var=$user_data}
+{/bitmodule} \ No newline at end of file
diff --git a/my.php b/my.php
new file mode 100644
index 0000000..53c09b1
--- /dev/null
+++ b/my.php
@@ -0,0 +1,192 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/my.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'task_lib.php' );
+
+if( !$gBitUser->isRegistered() ) {
+ Header( 'Location: '.USERS_PKG_URL.'login.php' );
+ die;
+}
+
+// some content specific offsets and pagination settings
+if( !empty( $_REQUEST['sort_mode'] ) ) {
+ $content_sort_mode = $_REQUEST['sort_mode'];
+ $smarty->assign( 'sort_mode', $content_sort_mode );
+}
+
+$max_content = $gBitSystem->mPrefs['maxRecords'];
+$offset_content = !empty( $_REQUEST['offset'] ) ? $_REQUEST['offset'] : 0;
+$smarty->assign( 'page', $page = !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : 1 );
+$offset_content = ( $page - 1 ) * $gBitSystem->mPrefs['maxRecords'];
+
+// set the user_id to only display content viewing user
+$_REQUEST['user_id'] = $gBitUser->mUserId;
+
+// now that we have all the offsets, we can get the content list
+include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' );
+
+// calculate page number
+$numPages = ceil( $contentList['cant'] / $gBitSystem->mPrefs['maxRecords'] );
+$smarty->assign( 'numPages', $numPages );
+
+//$smarty->assign_by_ref('offset', $offset);
+$smarty->assign( 'contentSelect', $contentSelect );
+$smarty->assign( 'contentTypes', $contentTypes );
+$smarty->assign( 'contentList', $contentList['data'] );
+// end of content listing
+
+$gBitSystem->setBrowserTitle( 'My '.$gBitSystem->getPreference( 'siteTitle' ) );
+$gBitSystem->display( 'bitpackage:users/my_bitweaver.tpl');
+
+
+
+// none of the below is currently being used by my_bitweaver.tpl - xing
+
+/*
+// User preferences screen
+if ($feature_userPreferences != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_userPreferences");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+*/
+
+/* Don't think this is needed - could not find Smarty refs to url_edit or url_visit - wolff_borg
+$foo = parse_url($_SERVER["REQUEST_URI"]);
+$foo1 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."edit", $foo["path"]);
+$foo2 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."index", $foo["path"]);
+$smarty->assign('url_edit', httpPrefix(). $foo1);
+$smarty->assign('url_visit', httpPrefix(). $foo2);
+*/
+/* none of this is being used in the my_bitweaver.tpl file - xing
+if (isset($_REQUEST['messprefs'])) {
+
+ $gBitUser->setPreference('mess_maxRecords', $_REQUEST['mess_maxRecords']);
+ $gBitUser->setPreference('minPrio', $_REQUEST['minPrio']);
+ if (isset($_REQUEST['allowMsgs']) && $_REQUEST['allowMsgs'] == 'on') {
+ $gBitUser->setPreference('allowMsgs', 'y');
+ } else {
+ $gBitUser->setPreference('allowMsgs', 'n');
+ }
+}
+if (isset($_REQUEST['tasksprefs'])) {
+
+ $gBitUser->setPreference('tasks_maxRecords', $_REQUEST['tasks_maxRecords']);
+ if (isset($_REQUEST['tasks_use_dates']) && $_REQUEST['tasks_use_dates'] == 'on') {
+ $gBitUser->setPreference('tasks_use_dates', 'y');
+ } else {
+ $gBitUser->setPreference('tasks_use_dates', 'n');
+ }
+}
+$tasks_maxRecords = $gBitUser->getPreference('tasks_maxRecords');
+$tasks_use_dates = $gBitUser->getPreference('tasks_use_dates');
+$smarty->assign('tasks_maxRecords', $tasks_maxRecords);
+$smarty->assign('tasks_use_dates', $tasks_use_dates);
+$mess_maxRecords = $gBitUser->getPreference('mess_maxRecords', 20);
+$smarty->assign('mess_maxRecords', $mess_maxRecords);
+$allowMsgs = $gBitUser->getPreference('allowMsgs', 'y');
+$smarty->assign('allowMsgs', $allowMsgs);
+$minPrio = $gBitUser->getPreference('minPrio', 6);
+$smarty->assign('minPrio', $minPrio);
+$smarty->assign_by_ref('userinfo', $gBitUser->mInfo);
+$styles = array();
+$h = opendir( THEMES_PKG_PATH.'styles/' );
+while ($file = readdir($h)) {
+ if (strstr($file, "css")) {
+ $styles[] = $file;
+ }
+}
+closedir ($h);
+$smarty->assign_by_ref('styles', $styles);
+$languages = array();
+$h = opendir( LANGUAGES_PKG_PATH.'lang/' );
+while ($file = readdir($h)) {
+ if ($file != '.' && $file != '..' && is_dir('lang/' . $file) && strlen($file) == 2) {
+ $languages[] = $file;
+ }
+}
+closedir ($h);
+$smarty->assign_by_ref('languages', $languages);
+// Get user pages
+if (isset($_REQUEST["by"]) && ($_REQUEST["by"]=='creator')) $who = 'creator';
+*/
+/* userwatch isn't working at the moment
+if( $gBitSystem->isPackageActive( 'blogs' ) ) {
+ require_once( BLOGS_PKG_PATH.'BitBlog.php' );
+ $user_blogs = $gBlog->list_user_blogs($userwatch,false);
+ $smarty->assign_by_ref('user_blogs', $user_blogs);
+}
+if( $gBitSystem->isPackageActive( 'wiki') && !empty( $userwatchId ) ) {
+ require_once( WIKI_PKG_PATH.'BitPage.php' );
+ global $wikilib;
+ $user_pages = $wikilib->get_user_pages( $userwatchId, -1 );
+ $smarty->assign_by_ref('user_pages', $user_pages);
+}
+if( $gBitSystem->isPackageActive( 'imagegals' ) ) {
+ $user_galleries = $gBitSystem->get_user_galleries($userwatch, -1);
+ $smarty->assign_by_ref('user_galleries', $user_galleries);
+}
+if( $gBitSystem->isPackageActive( 'trackers' ) ) {
+ $user_items = $gBitSystem->get_user_items($userwatch);
+ $smarty->assign_by_ref('user_items', $user_items);
+}
+if( $gBitSystem->isPackageActive( 'messu' ) ) {
+ require_once( MESSU_PKG_PATH.'messu_lib.php' );
+ $msgs = $messulib->list_user_messages($user, 0, -1, 'date_desc', '', 'is_read', 'n');
+ $smarty->assign('msgs', $msgs['data']);
+}
+*/
+// Get flags here
+/* none of this is being used by my_bitweaver.tpl
+$flags = array();
+$h = opendir( USERS_PKG_PATH.'icons/flags/' );
+while ($file = readdir($h)) {
+ if (strstr($file, ".gif")) {
+ $parts = explode('.', $file);
+ $flags[] = $parts[0];
+ }
+}
+closedir ($h);
+$smarty->assign('flags', $flags);
+// Get preferences
+$gBitLanguage->mLanguage = $gBitUser->getPreference('tikilanguage', $gBitLanguage->mLanguage);
+$real_name = $gBitUser->getPreference('real_name', '');
+$country = $gBitUser->getPreference('country', 'Other');
+$smarty->assign('country', $country);
+$anonpref = $gBitUser->getPreference('userbreadCrumb', 4);
+$userbreadCrumb = $gBitUser->getPreference('userbreadCrumb', $anonpref);
+$smarty->assign_by_ref('real_name', $real_name);
+$smarty->assign_by_ref('userbreadCrumb', $userbreadCrumb);
+$homePage = $gBitUser->getPreference('homePage', '');
+$smarty->assign_by_ref('homePage', $homePage);
+//Get tasks
+if (isset($_SESSION['thedate'])) {
+ $pdate = $_SESSION['thedate'];
+} else {
+ $pdate = date("U");
+}
+$tasks_use_dates = $gBitUser->getPreference('tasks_use_dates');
+$tasks = $tasklib->list_tasks($gBitUser->mUserId, 0, -1, 'priority_desc', '', $tasks_use_dates, $pdate);
+$smarty->assign('tasks', $tasks['data']);
+$user_information = $gBitUser->getPreference('user_information', 'public');
+$smarty->assign('user_information', $user_information);
+$timezone_options = $gBitSystem->get_timezone_list(true);
+$smarty->assign_by_ref('timezone_options', $timezone_options);
+$server_time = new Date();
+$display_timezone = $gBitUser->getPreference('display_timezone', $server_time->tz->getID());
+$smarty->assign_by_ref('display_timezone', $display_timezone);
+$smarty->assign('mybitweaver_pages', $gBitUser->getPreference('mybitweaver_pages'), 'y');
+$smarty->assign('mybitweaver_blogs', $gBitUser->getPreference('mybitweaver_blogs'), 'y');
+$smarty->assign('mybitweaver_gals', $gBitUser->getPreference('mybitweaver_gals'), 'y');
+$smarty->assign('mybitweaver_items', $gBitUser->getPreference('mybitweaver_items'), 'y');
+$smarty->assign('mybitweaver_msgs', $gBitUser->getPreference('mybitweaver_msgs'), 'y');
+$smarty->assign('mybitweaver_tasks', $gBitUser->getPreference('mybitweaver_tasks'), 'y');
+$section = 'mybitweaver';
+include_once ( KERNEL_PKG_PATH.'menu_register_inc.php' );
+
+*/
+?>
diff --git a/my_files.php b/my_files.php
new file mode 100644
index 0000000..ff64523
--- /dev/null
+++ b/my_files.php
@@ -0,0 +1,21 @@
+<?php
+require_once("../bit_setup_inc.php");
+global $gBitSystem;
+
+if (!$gBitUser->mUserId) {
+ $smarty->assign('msg', tra("You are not logged in"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+$userFiles = $gBitUser->getUserFiles();
+$smarty->assign_by_ref('userFiles', $userFiles['files']);
+$smarty->assign('numUserFiles', count($userFiles['files']));
+$smarty->assign('diskUsage', $userFiles['diskUsage']);
+
+if (!empty($_REQUEST['deleteAttachment'])) {
+ $attachmentId = $_REQUEST['deleteAttachment'];
+}
+
+$gBitSystem->display('bitpackage:users/my_files.tpl');
+?>
diff --git a/my_groups.php b/my_groups.php
new file mode 100644
index 0000000..53e60d0
--- /dev/null
+++ b/my_groups.php
@@ -0,0 +1,151 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/my_groups.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+
+
+// PERMISSIONS: registered user required
+if( !$gBitUser->isRegistered() ) {
+ $gBitSystem->fatalError( 'You must be logged in to edit your groups.' );
+}
+
+$successMsg = NULL;
+$errorMsg = NULL;
+
+// We need to scan for defaults
+global $gBitInstaller;
+$gBitInstaller = &$gBitSystem;
+$gBitSystem->verifyInstalledPackages();
+
+if( !empty( $_REQUEST['group_id'] ) ) {
+ $allPerms = $gBitUser->getGroupPermissions( NULL, NULL, NULL, !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : NULL );
+ // get grouplist separately from the $users stuff to avoid splitting of data due to pagination
+ $listHash = array( 'sort_mode' => 'group_name_asc' );
+ $groupList = $gBitUser->getAllGroups( $listHash );
+} else {
+ // get grouplist separately from the $users stuff to avoid splitting of data due to pagination
+ $listHash = array( 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' );
+ $groupList = $gBitUser->getAllGroups( $listHash );
+}
+
+$smarty->assign( 'package',isset( $_REQUEST['package'] ) ? $_REQUEST['package'] : 'all' );
+
+if( !empty( $_REQUEST["cancel"] ) ) {
+ header( 'Location: '.USERS_PKG_URL.'my_groups.php' );
+ die;
+} elseif( isset($_REQUEST["save"] ) ) {
+ if( empty($_REQUEST["name"] ) ) {
+ $_REQUEST["name"] = $_REQUEST["olgroup"];
+ }
+ if( $gBitUser->storeGroup( $_REQUEST ) ) {
+ $successMsg = "Group changes were saved sucessfully.";
+ } else {
+ $errorMsg = $gBitUser->mErrors['groups'];
+ }
+} elseif (isset($_REQUEST['allper'])) {
+ if ($_REQUEST['oper'] == 'assign') {
+ $gBitUser->assign_level_permissions($_REQUEST['group_id'], $_REQUEST['level']);
+ } else {
+ $gBitUser->remove_level_permissions($_REQUEST['group_id'], $_REQUEST['level']);
+ }
+} elseif (isset($_REQUEST["createlevel"])) {
+ $gBitUser->create_dummy_level($_REQUEST['level']);
+} elseif (isset($_REQUEST['updateperms'])) {
+
+ $updatePerms = $gBitUser->getgroupPermissions( $_REQUEST['group_id'] );
+ foreach (array_keys($_REQUEST['level'])as $per) {
+ if( $allPerms[$per]['level'] != $_REQUEST['level'][$per] ) {
+ // we changed level. perm[] checkbox is not taken into account
+ $gBitUser->change_permission_level($per, $_REQUEST['level'][$per]);
+ }
+ if( isset($_REQUEST['perm'][$per]) && !isset($updatePerms[$per]) ) {
+ // we have an unselected perm that is now selected
+ $gBitUser->assignPermissionToGroup($per, $_REQUEST['group_id']);
+ } elseif( empty($_REQUEST['perm'][$per]) && isset($updatePerms[$per]) ) {
+ // we have a selected perm that is now UNselected
+ $gBitUser->remove_permission_from_group($per, $_REQUEST['group_id']);
+ }
+ }
+ // let's reload just to be safe.
+ $allPerms = $gBitUser->getGroupPermissions();
+} elseif (isset($_REQUEST["action"])) {
+// Process a form to remove a group
+ if( $_REQUEST["action"] == 'delete' ) {
+ if( $gBitUser->getDefaultGroup( $_REQUEST['group_id'] ) ) {
+ $errorMsg = "You cannot remove this Group, as it is currently set as your 'Default' group";
+ } else {
+ $gBitUser->remove_group($_REQUEST['group_id']);
+ $successMsg = "The group ".$_REQUEST['group_id']." was deleted.";
+ unset( $_REQUEST['group_id'] );
+ }
+ } elseif ($_REQUEST["action"] == 'remove') {
+ $gBitUser->remove_permission_from_group( $_REQUEST["permission"], $_REQUEST['group_id'] );
+ $successMsg = "Permission Removed";
+ } elseif( $_REQUEST["action"] == 'create' ) {
+ $mid = 'bitpackage:users/my_group_edit.tpl';
+ $gBitSystem->setBrowserTitle( 'Create New Group' );
+ } elseif ($_REQUEST["action"] == 'assign') {
+ $gBitUser->assignPermissionToGroup($_REQUEST["perm"], $_REQUEST['group_id']);
+ }
+} elseif (!empty($_REQUEST['submitUserSearch'])) {
+ $searchParams = array('find' => $_REQUEST['find']);
+ $gBitUser->getList($searchParams);
+ $foundUsers = $searchParams['data'];
+ $smarty->assign_by_ref('foundUsers', $foundUsers);
+} elseif (!empty($_REQUEST['assignuser'])) {
+ if( !empty($_REQUEST['group_id'] ) ) {
+ // need some security here people!
+ $gBitUser->addUserToGroup( $_REQUEST['assignuser'], $_REQUEST['group_id'] );
+ }
+// $mid = 'bitpackage:users/my_group_edit.tpl';
+}
+
+// get pagination url
+// get grouplist separately from the $users stuff to avoid splitting of data due to pagination
+$listHash = array( 'sort_mode' => 'group_name_asc' );
+$groupList = $gBitUser->getAllUserGroups();
+
+if( empty( $groupList ) ) {
+ $mid = 'bitpackage:users/my_group_edit.tpl';
+} else {
+ $inc = array();
+ if( empty( $mid ) ) {
+ if( !empty( $_REQUEST['group_id'] ) ) {
+ // we don't want our own group listed when editing
+ if( !empty( $groupList[$_REQUEST['group_id']] ) ) {
+ unset( $groupList[$_REQUEST['group_id']] );
+ }
+ $groupInfo = $gBitUser->getGroupInfo( $_REQUEST['group_id'] );
+ $rs = array();
+ $gBitUser->getIncludedGroups( $_REQUEST['group_id'], $rs );
+ foreach( array_keys( $groupList ) as $groupId ) {
+ $groupList["data"][$groupId]['included'] = isset( $rs[$groupId] ) ? 'y' : 'n';
+ }
+ $levels = $gBitUser->get_permission_levels();
+ sort($levels);
+ $smarty->assign('levels', $levels);
+ $groupUsers = $gBitUser->get_group_users( $_REQUEST['group_id'] );
+ $smarty->assign_by_ref('groupUsers', $groupUsers);
+ $smarty->assign_by_ref('groupInfo', $groupInfo);
+ $smarty->assign_by_ref( 'allPerms', $allPerms );
+ $gBitSystem->setBrowserTitle( 'Admininster Group: '.$groupInfo['group_name'].' '.(isset( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : '') );
+ $mid = 'bitpackage:users/my_group_edit.tpl';
+ } else {
+ $gBitSystem->setBrowserTitle( 'Edit User Groups' );
+ $_REQUEST['group_id'] = 0;
+ $mid = 'bitpackage:users/my_groups_list.tpl';
+ }
+ }
+ $smarty->assign('groups', $groupList);
+}
+$smarty->assign('successMsg',$successMsg);
+$smarty->assign('errorMsg',$errorMsg);
+$smarty->assign( (!empty( $_REQUEST['tab'] ) ? $_REQUEST['tab'] : 'edit').'TabSelect', 'tdefault' );
+
+
+// Display the template for group administration
+$gBitSystem->display( $mid );
+?>
diff --git a/my_images.php b/my_images.php
new file mode 100644
index 0000000..99a1c35
--- /dev/null
+++ b/my_images.php
@@ -0,0 +1,69 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/my_images.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+
+global $gEditMode;
+$gEditMode = 'images';
+
+require_once( '../bit_setup_inc.php' );
+
+// User preferences screen
+if ($feature_userPreferences != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_userPreferences");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->isValid()) {
+ $smarty->assign('msg', tra("You are not logged in"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!isset($_REQUEST["showall"])) {
+ $_REQUEST["showall"] = 'n';
+}
+
+
+include_once(USERS_PKG_PATH.'lookup_user_inc.php');
+
+if ($gQueryUser->mUserId != $gBitUser->mUserId && !$gBitUser->object_has_permission($gBitUser->mUserId, $gQueryUser->mInfo['content_id'], 'bituser', 'bit_p_admin_user')) {
+ $smarty->assign('msg', tra('You do not have permission to edit this user\'s images'));
+ $gBitSystem->display('error.tpl');
+ die;
+}
+
+$smarty->assign('showall', $_REQUEST["showall"]);
+$userwatch = $gQueryUser->mUsername;
+$smarty->assign('userwatch', $userwatch);
+$_REQUEST["user_id"]=$gQueryUser->mUserId;
+
+// Upload avatar is processed here
+if( !empty( $_REQUEST['fSubmitBio'] ) ) {
+ $gQueryUser->store( $_REQUEST );
+} elseif( isset( $_REQUEST['fSubmitDeletePortait'] ) ) {
+ $gQueryUser->purgePortrait();
+} elseif( isset( $_REQUEST['fSubmitDeleteAvatar'] ) ) {
+ $gQueryUser->purgeAvatar();
+} elseif( isset( $_REQUEST['fSubmitDeleteLogo'] ) ) {
+ $gQueryUser->purgeLogo();
+}
+
+if (isset($_REQUEST["uselib"])) {
+ $avatarHash['type'] = AVATAR_TYPE_LIBRARY;
+ $avatarHash['avatar_lib_name'] = $_REQUEST["avatar"];
+ $avatarHash['avatar_name'] = NULL;
+ $avatarHash['avatar_size'] = NULL;
+ $avatarHash['avatar_type'] = NULL;
+ $avatarHash['avatar_data'] = NULL;
+ $gQueryUser->storeAvatar( $avatarHash );
+}
+
+// For some reason, we have to reassign here to make our changes to gBitUser->mInfo present in smarty.
+// dunno why, but this fixes the bug. XOXO spiderr
+$smarty->assign_by_ref('gQueryUser', $gQueryUser);
+
+$gBitSystem->display( 'bitpackage:users/my_images.tpl');
+
+?>
diff --git a/preferences.php b/preferences.php
new file mode 100644
index 0000000..062ed0a
--- /dev/null
+++ b/preferences.php
@@ -0,0 +1,282 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/preferences.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once( KERNEL_PKG_PATH.'mod_lib.php' );
+if( $gBitSystem->isPackageActive( 'wiki' ) ) {
+ include_once( WIKI_PKG_PATH.'BitPage.php' );
+}
+if( $gBitSystem->isPackageActive( 'blogs' ) ) {
+ include_once( BLOGS_PKG_PATH.'BitBlog.php' );
+}
+// User preferences screen
+if ($feature_userPreferences != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_userPreferences");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (empty($gBitUser->mUserId)) {
+ $smarty->assign('msg', tra("You are not logged in"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if( !empty( $_REQUEST["view_user"] ) && $_REQUEST["view_user"] <> $gBitUser->mUserId) {
+ $gBitSystem->verifyPermission( 'bit_p_admin_users' );
+ $editUser = new BitUser( $_REQUEST["view_user"] );
+ $editUser->load( TRUE );
+ $smarty->assign('view_user', $_REQUEST["view_user"]);
+} else {
+ $editUser = &$gBitUser;
+}
+global $gQueryUserId;
+$gQueryUserId = &$editUser->mUserId;
+
+$foo = parse_url($_SERVER["REQUEST_URI"]);
+if( $gBitSystem->isPackageActive( 'wiki' ) ) {
+ $foo1 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."edit", $foo["path"] );
+ $foo2 = str_replace( USERS_PKG_URL."user_preferences", WIKI_PKG_URL."index", $foo["path"] );
+ $smarty->assign('url_edit', httpPrefix(). $foo1);
+ $smarty->assign('url_visit', httpPrefix(). $foo2);
+}
+if( !empty( $gBitSystem->mPrefs['custom_user_fields'] ) ) {
+ $customFields= explode( ',', $gBitSystem->mPrefs['custom_user_fields'] );
+ $smarty->assign('customFields', $customFields);
+}
+
+$gBitLanguage->mLanguage = $editUser->getPreference( 'tikilanguage', $gBitLanguage->mLanguage);
+$smarty->assign( 'gBitLanguage', $gBitLanguage );
+if (isset($_REQUEST["prefs"])) {
+ // setting preferences
+ // if (isset($_REQUEST["email"])) $gBitUser->change_user_email($userwatch,$_REQUEST["email"]);
+ if (isset($_REQUEST["real_name"]))
+ $editUser->store( $_REQUEST );
+ if (isset($_REQUEST["userbreadCrumb"]))
+ $editUser->storePreference( 'userbreadCrumb', $_REQUEST["userbreadCrumb"]);
+ if (isset($_REQUEST["homePage"]))
+ $editUser->storePreference( 'homePage', $_REQUEST["homePage"]);
+ if ($change_language == 'y') {
+ if (isset($_REQUEST["language"])) {
+ $editUser->storePreference( 'tikilanguage', $_REQUEST["language"]);
+ }
+ }
+ if (isset($_REQUEST["style"]))
+ $smarty->assign('style', $_REQUEST["style"]);
+ if (isset($_REQUEST['display_timezone'])) {
+ $editUser->storePreference( 'display_timezone', $_REQUEST['display_timezone']);
+ $smarty->assign_by_ref('display_timezone', $_REQUEST['display_timezone']);
+ }
+ $editUser->storePreference( 'country', $_REQUEST["country"]);
+ $editUser->storePreference( 'user_information', $_REQUEST['user_information']);
+ if (isset($_REQUEST['user_dbl']) && $_REQUEST['user_dbl'] == 'on') {
+ $editUser->storePreference( 'user_dbl', 'y');
+ $smarty->assign('user_dbl', 'y');
+ } else {
+ $editUser->storePreference( 'user_dbl', 'n');
+ $smarty->assign('user_dbl', 'n');
+ }
+ if( isset( $customFields ) && is_array( $customFields ) ) {
+ foreach( $customFields as $f ) {
+ if( isset( $_REQUEST['CUSTOM'][$f] ) ) {
+ $editUser->storePreference( trim( $f ), trim( $_REQUEST['CUSTOM'][$f] ) );
+ }
+ }
+ }
+
+ $email_isPublic = isset($_REQUEST['email_isPublic']) ? $_REQUEST['email_isPublic']: 'n';
+ $editUser->storePreference( 'email is public', $email_isPublic);
+ if (isset($_REQUEST['view_user'])) {
+ header ("location: ".USERS_PKG_URL."preferences.php?view_user=$editUser->mUserId");
+ } else {
+ header ("location: ".USERS_PKG_URL."preferences.php");
+ }
+ die;
+}
+if (isset($_REQUEST['chgemail'])) {
+
+ // check user's password
+ if (!$editUser->validate_user($editUser->mUsername, $_REQUEST['pass'], '', '')) {
+ $smarty->assign('msg', tra("Invalid password. You current password is required to change your email address."));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ if( $editUser->change_user_email( $editUser->mUserId, $editUser->mUsername, $_REQUEST['email'], $_REQUEST['pass'] ) ) {
+ $smarty->assign( 'successMsg', tra( 'Your email address was updated successfully' ) );
+ }
+}
+if (isset($_REQUEST["chgpswd"])) {
+
+ if( $_REQUEST["pass1"] != $_REQUEST["pass2"] ) {
+ $smarty->assign('msg', tra("The passwords didn't match"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ if( $gBitUser->isAdmin() ) {
+ if( !$editUser->validate_user( $editUser->mUsername, $_REQUEST["old"], '', '' ) && empty( $_REQUEST['view_user'] ) ) {
+ $smarty->assign('msg', tra( "Invalid old password" ) );
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ } else {
+ if( !$editUser->validate_user( $editUser->mUsername, $_REQUEST["old"], '', '' ) ) {
+ $smarty->assign('msg', tra( "Invalid old password" ) );
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ }
+ //Validate password here
+ if (strlen($_REQUEST["pass1"]) < $min_pass_length) {
+ $smarty->assign('msg', tra("Password should be at least"). ' ' . $min_pass_length . ' ' . tra("characters long"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ // Check this code
+ if ($pass_chr_num == 'y') {
+ if (!preg_match_all("/[0-9]+/", $_REQUEST["pass1"], $foo) || !preg_match_all("/[A-Za-z]+/", $_REQUEST["pass1"], $foo)) {
+ $smarty->assign('msg', tra("Password must contain both letters and numbers"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+ }
+ if( $gBitUser->change_user_password($editUser->mUsername, $_REQUEST["pass1"]) ) {
+ $smarty->assign( 'successMsg', tra( 'The password was updated successfully' ) );
+ }
+}
+if (isset($_REQUEST['messprefs'])) {
+
+ $editUser->storePreference( 'mess_maxRecords', $_REQUEST['mess_maxRecords']);
+ $editUser->storePreference( 'minPrio', $_REQUEST['minPrio']);
+ if (isset($_REQUEST['allowMsgs']) && $_REQUEST['allowMsgs'] == 'on') {
+ $editUser->storePreference( 'allowMsgs', 'y');
+ } else {
+ $editUser->storePreference( 'allowMsgs', 'n');
+ }
+}
+if (isset($_REQUEST['mybitweaverprefs'])) {
+
+ if (isset($_REQUEST['mybitweaver_pages']) && $_REQUEST['mybitweaver_pages'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_pages', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_pages', 'n');
+ }
+ if (isset($_REQUEST['mybitweaver_blogs']) && $_REQUEST['mybitweaver_blogs'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_blogs', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_blogs', 'n');
+ }
+ if (isset($_REQUEST['mybitweaver_gals']) && $_REQUEST['mybitweaver_gals'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_gals', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_gals', 'n');
+ }
+ if (isset($_REQUEST['mybitweaver_msgs']) && $_REQUEST['mybitweaver_msgs'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_msgs', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_msgs', 'n');
+ }
+ if (isset($_REQUEST['mybitweaver_tasks']) && $_REQUEST['mybitweaver_tasks'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_tasks', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_tasks', 'n');
+ }
+ if (isset($_REQUEST['mybitweaver_items']) && $_REQUEST['mybitweaver_items'] == 'on') {
+ $editUser->storePreference( 'mybitweaver_items', 'y');
+ } else {
+ $editUser->storePreference( 'mybitweaver_items', 'n');
+ }
+}
+if (isset($_REQUEST['tasksprefs'])) {
+
+ $editUser->storePreference( 'tasks_maxRecords', $_REQUEST['tasks_maxRecords']);
+ if (isset($_REQUEST['tasks_use_dates']) && $_REQUEST['tasks_use_dates'] == 'on') {
+ $editUser->storePreference( 'tasks_use_dates', 'y');
+ } else {
+ $editUser->storePreference( 'tasks_use_dates', 'n');
+ }
+}
+
+$tasks_use_dates = $editUser->getPreference( 'tasks_use_dates');
+$smarty->assign('tasks_maxRecords', $tasks_maxRecords);
+$smarty->assign('tasks_use_dates', $tasks_use_dates);
+$mess_maxRecords = $editUser->getPreference( 'mess_maxRecords', 20);
+$smarty->assign('mess_maxRecords', $mess_maxRecords);
+$allowMsgs = $editUser->getPreference( 'allowMsgs', 'y');
+$smarty->assign('allowMsgs', $allowMsgs);
+$minPrio = $editUser->getPreference( 'minPrio', 3 );
+$smarty->assign('minPrio', $minPrio);
+$smarty->assign_by_ref('userInfo', $editUser->mInfo );
+$smarty->assign_by_ref('userPrefs', $editUser->mUserPrefs );
+$languages = array();
+$languages = $gBitLanguage->listLanguages();
+$smarty->assign_by_ref('languages', $languages);
+// Get user pages
+if( $gBitSystem->isPackageActive( 'messu' ) ) {
+ $smarty->assign('mybitweaver_msgs', $editUser->getPreference( 'mybitweaver_msgs'), 'y');
+}
+if( $gBitSystem->isPackageActive( 'wiki' ) ) {
+ $smarty->assign('mybitweaver_pages', $editUser->getPreference( 'mybitweaver_pages'), 'y');
+ $user_pages = $wikilib->get_user_pages($editUser->mUserId, -1);
+ $smarty->assign_by_ref('user_pages', $user_pages);
+}
+if( $gBitSystem->isPackageActive( 'blogs' ) ) {
+ $smarty->assign('mybitweaver_blogs', $editUser->getPreference( 'mybitweaver_blogs'), 'y');
+ $user_blogs = $gBlog->list_user_blogs($editUser->mUserId, false);
+ $smarty->assign_by_ref('user_blogs', $user_blogs);
+}
+if( $gBitSystem->isPackageActive( 'imagegals' ) ) {
+ $smarty->assign('mybitweaver_gals', $editUser->getPreference( 'mybitweaver_gals'), 'y');
+ $user_galleries = $gBitSystem->get_user_galleries($editUser->mUsername, -1);
+ $smarty->assign_by_ref('user_galleries', $user_galleries);
+}
+if( $gBitSystem->isPackageActive( 'trackers' ) ) {
+ $smarty->assign('mybitweaver_items', $editUser->getPreference( 'mybitweaver_items'), 'y');
+ $user_items = $gBitSystem->get_user_items($editUser->mUsername);
+ $smarty->assign_by_ref('user_items', $user_items);
+ $smarty->assign('mybitweaver_tasks', $editUser->getPreference( 'mybitweaver_tasks'), 'y');
+}
+
+// Get flags here
+$flags = array();
+$h = opendir( USERS_PKG_PATH.'icons/flags/' );
+while ($file = readdir($h)) {
+ if (strstr($file, ".gif")) {
+ $parts = explode('.', $file);
+ $flags[] = $parts[0];
+ }
+}
+closedir ($h);
+sort ($flags);
+
+$editUser->mInfo['userbreadCrumb'] = $editUser->getPreference( 'userbreadCrumb', $gBitSystem->getPreference('userbreadCrumb', 4) );
+$editUser->mInfo['homePage'] = $editUser->getPreference( 'homePage', '');
+
+$smarty->assign('flags', $flags);
+$smarty->assign( 'editUser', $editUser->mInfo );
+
+// Get preferences
+//SPIDERKILL $style = $editUser->getPreference( 'theme', $style);
+//SPIDERKILL $smarty->assign_by_ref('style', $style);
+$real_name = $editUser->mInfo["real_name"];
+$country = $editUser->getPreference( 'country', 'Other');
+$smarty->assign('country', $country);
+$smarty->assign('email_isPublic', $editUser->getPreference( 'email is public', 'n'));
+$scramblingMethods = array("n", "strtr", "unicode", "x"); // email_isPublic utilizes 'n'
+$smarty->assign_by_ref('scramblingMethods', $scramblingMethods);
+$scramblingEmails = array(tra("no"), scrambleEmail($editUser->mInfo['email'], 'strtr'), scrambleEmail($editUser->mInfo['email'], 'unicode')."-".tra("unicode"), scrambleEmail($editUser->mInfo['email'], 'x'));
+$smarty->assign_by_ref('scramblingEmails', $scramblingEmails);
+$user_information = $editUser->getPreference( 'user_information', 'public');
+$smarty->assign('user_information', $user_information);
+$user_dbl = $editUser->getPreference( 'user_dbl', 'y');
+$smarty->assign('user_dbl', $user_dbl);
+//$timezone_options = $gBitSystem->get_timezone_list(true);
+//$smarty->assign_by_ref('timezone_options',$timezone_options);
+//$server_time = new Date();
+$display_timezone = $editUser->getPreference( 'display_timezone', "UTC");
+if ($display_timezone != "UTC")
+ $display_timezone = "Local";
+$smarty->assign_by_ref('display_timezone', $display_timezone);
+
+$gBitSystem->display( 'bitpackage:users/user_preferences.tpl', 'Edit User Preferences');
+?>
diff --git a/random_num_img.php b/random_num_img.php
new file mode 100644
index 0000000..5c13223
--- /dev/null
+++ b/random_num_img.php
@@ -0,0 +1,27 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/random_num_img.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+//session_start();
+// hmm. to many session tweaks in setup_smarty ... we need to call this
+require_once( '../bit_setup_inc.php' );
+//random_number.php
+$img_number = imagecreate(95, 30);
+$white = imagecolorallocate($img_number, 255, 255, 255);
+$black = imagecolorallocate($img_number, 0, 0, 0);
+$grey_shade = imagecolorallocate($img_number, 204, 204, 204);
+imagefill($img_number, 0, 0, $grey_shade);
+srand (time());
+$number = get_random();
+$_SESSION['random_number'] = $number;
+for ($i = 0; $i < 5; $i++) {
+ Imagestring($img_number, 5, 10 + 17 * $i + rand(0, 2), 1 + rand(0, 10), substr($number, $i, 1), $black);
+}
+header ("Content-type: image/jpeg");
+imagejpeg ($img_number);
+function get_random() {
+ # return a 5 digit value
+ return rand(10000, 99999);
+}
+?> \ No newline at end of file
diff --git a/register.php b/register.php
new file mode 100644
index 0000000..be66d6e
--- /dev/null
+++ b/register.php
@@ -0,0 +1,82 @@
+<?php
+// Initialization
+require_once( '../bit_setup_inc.php' );
+require_once( KERNEL_PKG_PATH.'BitBase.php' );
+include_once( KERNEL_PKG_PATH.'notification_lib.php' );
+
+// Permission: needs p_register
+$gBitSystem->verifyFeature( 'allowRegister' );
+
+if( isset( $_REQUEST["register"] ) ) {
+ $reg = $_REQUEST['REG'];
+ // novalidation is set to yes if a user confirms his email is correct after tiki fails to validate it
+ if( $gBitSystem->isFeatureActive( 'rnd_num_reg' ) ) {
+ if( (empty( $reg['novalidation'] ) || $reg['novalidation'] != 'yes')
+ && (!isset( $_SESSION['random_number'] ) || $_SESSION['random_number']!=$reg['regcode'])) {
+ $errors['rnd_num_reg'] = "Wrong registration code";
+ }
+ }
+
+ // Check the mode
+ if( $gBitSystem->isFeatureActive( 'useRegisterPasscode' ) ) {
+ if( $reg["passcode"] != $gBitSystem->getPreference( "registerPasscode",md5( $gBitUser->genPass() ) ) ) {
+ $errors['passcode'] = 'Wrong passcode! You need to know the passcode to register at this site';
+ }
+ }
+
+ if( empty( $errors ) ) {
+ $newUser = new BitPermUser();
+ if( $newUser->store( $reg ) ) {
+ $emails = $notificationlib->get_mail_events('user_registers','*');
+ foreach($emails as $email) {
+ $smarty->assign('mail_user',$reg['login']);
+ $smarty->assign('mail_date',date("U"));
+ $smarty->assign('mail_site',$_SERVER["SERVER_NAME"]);
+ $mail_data = $smarty->fetch('bitpackage:users/new_user_notification.tpl');
+ mail( $reg['email'], tra('New user registration'),$mail_data,"From: ".$gBitSystem->getPreference('sender_email')."\r\nContent-type: text/plain;charset=utf-8\r\n");
+ }
+ if( !empty( $_REQUEST['CUSTOM'] ) ) {
+ foreach( $_REQUEST['CUSTOM'] as $field=>$value ) {
+ $newUser->storePreference( $field, $value );
+ }
+ }
+ if( $gBitSystem->isFeatureActive( 'validateUsers' ) ) {
+ // $apass = addslashes(substr(md5($gBitSystem->genPass()),0,25));
+ $apass = $reg['user_store']['provpass'];
+ $foo = parse_url($_SERVER["REQUEST_URI"]);
+ $foo1=str_replace("register","confirm",$foo["path"]);
+ $machine = httpPrefix().$foo1;
+
+ // Send the mail
+ $smarty->assign('msg',tra('You will receive an email with information to login for the first time into this site'));
+ $smarty->assign('mail_machine',$machine);
+ $smarty->assign('mail_site',$_SERVER["SERVER_NAME"]);
+ $smarty->assign('mail_user',$reg['login']);
+ $smarty->assign('mail_apass',$apass);
+ $mail_data = $smarty->fetch('bitpackage:users/user_validation_mail.tpl');
+ mail($reg["email"], tra('Your Tiki information registration'),$mail_data,"From: ".$gBitSystem->getPreference('sender_email')."\r\nContent-type: text/plain;charset=utf-8\r\n");
+ $smarty->assign('showmsg','y');
+ } else {
+ $url = $newUser->login( $reg['login'], $reg['password'], FALSE, FALSE );
+ header( 'Location: '.$url );
+ exit;
+ }
+ } else {
+ $smarty->assign_by_ref( 'errors', $newUser->mErrors );
+ }
+ } else {
+ $smarty->assign_by_ref( 'errors', $errors );
+ }
+ $smarty->assign_by_ref( 'reg', $reg );
+
+} else {
+ if( !empty( $gBitSystem->mPrefs['custom_user_fields'] ) ) {
+ $fields= explode( ',', $gBitSystem->mPrefs['custom_user_fields'] );
+ trim_array( $fields );
+ $smarty->assign('customFields', $fields);
+ }
+}
+
+$gBitSystem->display('bitpackage:users/register.tpl', 'Register' );
+
+?>
diff --git a/remind_password.php b/remind_password.php
new file mode 100644
index 0000000..bcbed4d
--- /dev/null
+++ b/remind_password.php
@@ -0,0 +1,41 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/remind_password.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+if ($forgotPass != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": forgotPass");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (isset($_REQUEST["remind"])) {
+ if( $userInfo = $gBitUser->getUserInfo( array( 'login' => $_REQUEST["username"] ) ) ) {
+ if ( $gBitSystem->isFeatureActive( 'feature_clear_passwords' ) && !empty($userInfo['password']) ) {
+ $pass = $userInfo['password'];
+ $tmp['success'] = tra("A password reminder email has been sent ");
+ } else {
+ $pass = $gBitUser->renew_user_password($_REQUEST["username"]);
+ $tmp['success'] = tra("A new password has been sent ");
+ }
+ $tmp['success'] .= tra("to the registered email address for")." " . $_REQUEST["username"] . ".";
+
+ $smarty->assign('mail_site', $_SERVER["SERVER_NAME"]);
+ $smarty->assign('mail_user', $_REQUEST["username"]);
+ $smarty->assign('mail_same', $gBitSystem->isFeatureActive( 'feature_clear_passwords' ));
+ $smarty->assign('mail_pass', $pass);
+ $mail_data = $smarty->fetch('bitpackage:users/password_reminder.tpl');
+ $subject = "Your password for ".$gBitSystem->getPreference( 'siteTitle', $_SERVER['HTTP_HOST'] );
+ mail( $userInfo['email'], $subject, $mail_data, "From: ".$gBitSystem->getPreference( 'sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n");
+ // Just show "success" message and no form
+ } else {
+ // Show error message (and leave form visible so user can fix problem)
+ $smarty->assign('showmsg', 'e');
+ $tmp['error'] = tra("Invalid or unknown username").": ".$_REQUEST["username"];
+ }
+ $smarty->assign('msg', $tmp);
+}
+// Display the template
+$gBitSystem->display( 'bitpackage:users/remind_password.tpl');
+?>
diff --git a/show_user_avatar.php b/show_user_avatar.php
new file mode 100644
index 0000000..0ec4185
--- /dev/null
+++ b/show_user_avatar.php
@@ -0,0 +1,19 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/show_user_avatar.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+# $Header: /cvsroot/bitweaver/_bit_users/show_user_avatar.php,v 1.1 2005/06/19 05:12:21 bitweaver Exp $
+include_once( USERS_PKG_PATH.'userprefs_lib.php' );
+// application to display an image from the database with
+// option to resize the image dynamically creating a thumbnail on the fly.
+// you have to check if the user has permission to see this gallery
+if (!isset($_REQUEST["user"])) {
+ die;
+}
+$info = $userprefslib->get_user_avatar_img($_REQUEST["user"]);
+$type = $info["avatar_file_type"];
+$content = $info["avatar_data"];
+header ("Content-type: $type");
+echo "$content";
+?>
diff --git a/task_lib.php b/task_lib.php
new file mode 100644
index 0000000..28784d6
--- /dev/null
+++ b/task_lib.php
@@ -0,0 +1,96 @@
+<?php
+/* Task properties:
+ user, task_id, title, description, date, status, priority, completed, percentage
+*/
+class TaskLib extends BitBase {
+
+ function TaskLib() {
+ BitBase::BitBase();
+ }
+ function get_task( $pUserId, $task_id) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_tasks` where `user_id`=? and `task_id`=?";
+ $result = $this->query($query,array( $pUserId, (int)$task_id));
+ $res = $result->fetchRow();
+ return $res;
+ }
+
+ function update_task_percentage( $pUserId, $task_id, $perc) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_tasks` set `percentage`=? where `user_id`=? and `task_id`=?";
+ $this->query($query,array((int)$perc, $pUserId, (int)$task_id));
+ }
+
+ function open_task( $pUserId, $task_id) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_tasks` set `completed`=?, `status`=?, `percentage`=? where `user_id`=? and `task_id`=?";
+ $this->query($query, array(0,'o',0, $pUserId, (int)$task_id));
+ }
+
+ function replace_task( $pUserId, $task_id, $title, $description, $date, $status, $priority, $completed, $percentage) {
+ if ($task_id != 0) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_tasks` set `title` = ?, `description` = ?, `date` = ?, `status` = ?, `priority` = ?, ";
+ $query.= "`percentage` = ?, `completed` = ? where `user_id`=? and `task_id`=?";
+ $this->query($query,array($title,$description,$date,$status,$priority,$percentage,$completed, $pUserId, $task_id));
+ return $task_id;
+ } else {
+ $query = "insert into `".BIT_DB_PREFIX."tiki_user_tasks`(`user_id`,`title`,`description`,`date`,`status`,`priority`,`completed`,`percentage`) ";
+ $query.= " values(?,?,?,?,?,?,?,?)";
+ $this->query($query,array($pUserId,$title,$description,$date,$status,$priority,$completed,$percentage));
+ $task_id = $this->getOne( "select max(`task_id`) from `".BIT_DB_PREFIX."tiki_user_tasks` where `user_id`=? and `title`=? and `date`=?",array( $pUserId, $title,$date));
+ return $task_id;
+ }
+ }
+
+ function complete_task( $pUserId, $task_id) {
+ $now = date("U");
+ $query = "update `".BIT_DB_PREFIX."tiki_user_tasks` set `completed`=?, `status`='c', `percentage`=100 where `user_id`=? and `task_id`=?";
+ $this->query($query,array((int)$now, $pUserId, (int)$task_id));
+ }
+
+ function remove_task( $pUserId, $task_id) {
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_tasks` where `user_id`=? and `task_id`=?";
+ $this->query($query,array( $pUserId, (int)$task_id));
+ }
+
+ function list_tasks( $pUserId, $offset, $maxRecords, $sort_mode, $find, $use_date, $pdate) {
+ $now = date("U");
+ $bindvars=array($pUserId);
+ if ($use_date == 'y') {
+ $prio = " and date<=? ";
+ $bindvars2=$pdate;
+ }
+ else {
+ $prio = '';
+ }
+
+ if ($find) {
+ $findesc = '%' . strtoupper( $find ). '%';
+ $mid = " and (UPPER(`title`) like ? or UPPER(`description`) like ?)";
+ $bindvars[]=$findesc;
+ $bindvars[]=$findesc;
+ } else {
+ $mid = "" ;
+ }
+
+ $mid.=$prio;
+ if (isset($bindvars2))
+ $bindvars[]=$bindvars2;
+
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_tasks` where `user_id`=? $mid order by ".$this->convert_sortmode($sort_mode).",`task_id` desc";
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_user_tasks` where `user_id`=? $mid";
+ $result = $this->query($query,$bindvars,$maxRecords,$offset);
+ $cant = $this->getOne($query_cant,$bindvars);
+ $ret = array();
+
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+
+}
+global $tasklib;
+$tasklib = new TaskLib();
+?>
diff --git a/tasks.php b/tasks.php
new file mode 100644
index 0000000..af24c91
--- /dev/null
+++ b/tasks.php
@@ -0,0 +1,162 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/tasks.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+require_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'task_lib.php' );
+if ($feature_tasks != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_tasks");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->mUserId) {
+ $smarty->assign('msg', tra("Must be logged to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->hasPermission( 'bit_p_tasks' )) {
+ $smarty->assign('msg', tra("Permission denied to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+$comp_array = array();
+$comp_array_p = array();
+for ($i = 0; $i < 101; $i += 10) {
+ $comp_array[] = $i;
+ $comp_array_p[] = $i . '%';
+}
+$smarty->assign('comp_array', $comp_array);
+$smarty->assign('comp_array_p', $comp_array_p);
+if (!isset($_REQUEST["task_id"]))
+ $_REQUEST["task_id"] = 0;
+if (isset($_REQUEST["complete"]) && isset($_REQUEST["task"])) {
+
+ foreach (array_keys($_REQUEST["task"])as $task) {
+ $tasklib->complete_task($gBitUser->mUserId, $task);
+ }
+}
+if (isset($_REQUEST["open"]) && isset($_REQUEST["task"])) {
+
+ foreach (array_keys($_REQUEST["task"])as $task) {
+ $tasklib->open_task($gBitUser->mUserId, $task);
+ }
+}
+if (isset($_REQUEST["delete"]) && isset($_REQUEST["task"])) {
+
+ foreach (array_keys($_REQUEST["task"])as $task) {
+ $tasklib->remove_task($gBitUser->mUserId, $task);
+ }
+}
+if (isset($_REQUEST["update"])) {
+
+ foreach ($_REQUEST["task_perc"] as $task => $perc) {
+ $tasklib->update_task_percentage($gBitUser->mUserId, $task, $perc);
+ }
+}
+if (isset($_REQUEST["tasks_use_dates"])) {
+ $tasks_use_dates = $_REQUEST["tasks_use_dates"];
+} else {
+ $tasks_use_dates = $gBitUser->getPreference( 'tasks_use_dates' );
+}
+$tasks_maxRecords = $gBitUser->getPreference('tasks_maxRecords', $maxRecords);
+$maxRecords = $tasks_maxRecords;
+$smarty->assign('tasks_use_dates', $tasks_use_dates);
+$smarty->assign('tasks_maxRecords', $tasks_maxRecords);
+if ($_REQUEST["task_id"]) {
+ $info = $tasklib->get_task($gBitUser->mUserId, $_REQUEST["task_id"]);
+} else {
+ $info = array();
+ $info['title'] = '';
+ $info['description'] = '';
+ $info['priority'] = 3;
+ $info['status'] = 'o';
+ $info['date'] = date("U");
+}
+if (isset($_REQUEST['save'])) {
+ $dc = &$gBitSystem->get_date_converter($gBitUser->mUserId);
+ $date = $dc->getServerDateFromDisplayDate(mktime(0, 0, 0, $_REQUEST["Date_Month"], $_REQUEST["Date_Day"], $_REQUEST["Date_Year"]));
+ if ($_REQUEST['status'] == 'c') {
+ $_REQUEST['percentage'] = 100;
+ $completed = $date;
+ } else {
+ $completed = 0;
+ }
+ if ($_REQUEST['percentage'] == 100) {
+ $completed = $date;
+ $_REQUEST['status'] = 'c';
+ } else {
+ $_REQUEST['status'] = 'o';
+ $completed = 0;
+ }
+ $tasklib->replace_task($gBitUser->mUserId, $_REQUEST["task_id"], $_REQUEST["title"], $_REQUEST["description"], $date, $_REQUEST['status'], $_REQUEST['priority'], $completed, $_REQUEST['percentage']);
+ $info = array();
+ $info['title'] = '';
+ $info['description'] = '';
+ $info['priority'] = 3;
+ $info['status'] = 'o';
+ $info['date'] = date("U");
+ $_REQUEST["task_id"] = 0;
+}
+$smarty->assign('task_id', $_REQUEST["task_id"]);
+$smarty->assign('info', $info);
+$smarty->assign('Date_Month', date("m", $info['date']));
+$smarty->assign('Date_Day', date("d", $info['date']));
+$smarty->assign('Date_Year', date("Y", $info['date']));
+if ( empty( $_REQUEST["sort_mode"] ) ) {
+ $sort_mode = 'priority_desc';
+} else {
+ $sort_mode = $_REQUEST["sort_mode"];
+}
+if (!isset($_REQUEST["offset"])) {
+ $offset = 0;
+} else {
+ $offset = $_REQUEST["offset"];
+}
+if (isset($_REQUEST['page'])) {
+ $page = &$_REQUEST['page'];
+ $offset = ($page - 1) * $maxRecords;
+}
+$smarty->assign_by_ref('offset', $offset);
+if (isset($_REQUEST["find"])) {
+ $find = $_REQUEST["find"];
+} else {
+ $find = '';
+}
+$smarty->assign('find', $find);
+$smarty->assign_by_ref('sort_mode', $sort_mode);
+if (isset($_SESSION['thedate'])) {
+ $pdate = $_SESSION['thedate'];
+} else {
+ $pdate = date("U");
+}
+$channels = $tasklib->list_tasks($gBitUser->mUserId, $offset, $maxRecords, $sort_mode, $find, $tasks_use_dates, $pdate);
+if($maxRecords == 0) {
+ $cant_pages = 0;
+ $smarty->assign('actual_page', '1');
+} else {
+ $cant_pages = ceil($channels["cant"] / $maxRecords);
+ $smarty->assign('actual_page', 1 + ($offset / $maxRecords));
+}
+$smarty->assign_by_ref('cant_pages', $cant_pages);
+if ($channels["cant"] > ($offset + $maxRecords)) {
+ $smarty->assign('next_offset', $offset + $maxRecords);
+} else {
+ $smarty->assign('next_offset', -1);
+}
+// If offset is > 0 then prev_offset
+if ($offset > 0) {
+ $smarty->assign('prev_offset', $offset - $maxRecords);
+} else {
+ $smarty->assign('prev_offset', -1);
+}
+$smarty->assign_by_ref('channels', $channels["data"]);
+$smarty->assign('tasks_use_dates', $tasks_use_dates);
+$percs = array();
+for ($i = 0; $i <= 100; $i += 10) {
+ $percs[] = $i;
+}
+$smarty->assign_by_ref('percs', $percs);
+
+$gBitSystem->display( 'bitpackage:users/user_tasks.tpl');
+?>
diff --git a/templates/admin_group_edit.tpl b/templates/admin_group_edit.tpl
new file mode 100644
index 0000000..e8cbc06
--- /dev/null
+++ b/templates/admin_group_edit.tpl
@@ -0,0 +1,196 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/admin_group_edit.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+
+<div class="floaticon">
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/edit_group.php">{tr}&laquo; Group List{/tr}</a>
+ {bithelp}
+</div>
+
+<div class="admin groups">
+ <div class="header">
+ <h1>{if $groupInfo.group_name}{tr}Administer Group{/tr}: {$groupInfo.group_name}{else}{tr}Create New Group{/tr}{/if}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback success=$successMsg error=$errorMsg}
+
+ {jstabs}
+ {jstab title="Edit Group"}
+ {form legend="Add or Edit a Group"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <div class="row">
+ {formlabel label="Group" for="groups_group"}
+ {forminput}
+ <input type="text" name="name" id="groups_group" size="30" maxlength="30" value="{$groupInfo.group_name}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Description" for="group_desc"}
+ {forminput}
+ <textarea rows="5" cols="20" name="desc" id="group_desc">{$groupInfo.group_desc}</textarea>
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Include" for="groups_inc"}
+ {forminput}
+ <select name="include_groups[]" id="groups_inc" multiple="multiple" size="4">
+ {foreach from=$groups key=groupId item=group}
+ {if $groupId != $groupInfo.group_id}
+ <option value="{$groupId}" {if $group.included eq 'y'} selected="selected"{/if}>{$group.group_name}</option>
+ {/if}
+ {/foreach}
+ </select>
+ {formhelp note="If you include a group, this group will inherit all permissions of the included group."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Group home page" for="groups_home"}
+ {forminput}
+ {html_options name="dummy" options=$contentList selected=`$groupInfo.group_home` onchange="document.getElementById('groups_home').value=options[selectedIndex].value;"}
+ <br />
+ <input type="text" name="home" id="groups_home" value="{$groupInfo.group_home|escape}" />
+ {formhelp note="Here you can enter the content id of any page, the wiki page name or the absolute path of any page you wish to use as a group home page"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Default home page" for="default_home"}
+ {forminput}
+ <input type="checkbox" id="default_home" name="default_home_group" {if $groupInfo.group_id eq $defaultGroupId}checked="checked"{/if} value="y" />
+ {formhelp note="This is the home page if a user belongs to many groups. Only one group may be the default home. If none is selected, users/my.php is the default."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Auto members" for="is_default"}
+ {forminput}
+ <input type="checkbox" name="is_default" value="y" {if $groupInfo.is_default eq 'y'}checked="checked"{/if} id="is_default" />
+ {formhelp note="Users are automatically added to this group when registering at your site."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="cancel" value="{tr}Cancel{/tr}" />&nbsp;
+ <input type="submit" name="save" value="{tr}Save Group{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {if $groupInfo.group_id}
+ {*jstab title="Current Permissions"}
+ {form legend="Permissions currently assigned to this group"}
+ <table class="data">
+ <tr>
+ <th>{tr}Permission{/tr}</th>
+ <th>{tr}Description{/tr}</th>
+ </tr>
+ {foreach from=$groupInfo.perms key=permName item=perm}
+ <tr class="{cycle values="odd,even"}">
+ <td>
+ {smartlink ititle="Remove" ibiticon="liberty/delete_small" package=$package group_id=$groupInfo.group_id action=remove permission=$permName}
+ &nbsp;{$permName}
+ </td>
+ <td>{$perm.perm_desc}</td>
+ </tr>
+ {/foreach}
+ </table>
+ {/form}
+ {/jstab*}
+
+ {jstab title="Assign Permissions"}
+ {form legend="Assign permissions and / or set level"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+ <input type="hidden" name="tab" value="assign" />
+ <input type="hidden" name="perm_name[{$perms[user].perm_name}]" />
+
+ <div class="row">
+ {formlabel label="Display permissions of package"}
+ {forminput}
+ {smartlink ititle="All packages" group_id=$groupInfo.group_id}
+ {foreach from=$gBitSystem->mPackages key=packageKey item=packageItem}
+ {if $packageItem.installed and $packageItem.defaults}
+ &nbsp;&bull; {smartlink ititle=$gBitSystem->mPackages.$packageKey.name group_id=$groupInfo.group_id package=$packageKey}
+ {/if}
+ {/foreach}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ <table class="data">
+ <tr>
+ <th>&nbsp;</th>
+ <th>{smartlink ititle="Name" isort="up.perm_name" group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ <th>{tr}Level{/tr}</th>
+ <th>{smartlink ititle="Package" isort=package group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ <th>{smartlink ititle="Description" isort="up.perm_desc" group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ </tr>
+ {foreach key=permName item=perm from=$allPerms}
+ {if $package eq $perm.package or $package eq 'all'}
+ <tr class="{cycle values="even,odd"}">
+ <td><input type="checkbox" id="{$permName}" name="perm[{$permName}]"{if $groupInfo.perms.$permName} checked="checked"{/if} /></td>
+ <td><label for="{$permName}">{$permName}</label></td>
+ <td><select name="level[{$permName}]">{html_options output=$levels values=$levels selected=$perm.level}</select></td>
+ <td>{tr}{$perm.package}{/tr}</td>
+ <td>{tr}{$perm.perm_desc}{/tr}</td>
+ </tr>
+ {/if}
+ {/foreach}
+ </table>
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="updateperms" value="{tr}Update{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Batch Assign"}
+ {form legend="Batch assign permissions"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+
+ <div class="row">
+ <select name="oper">
+ <option value="assign">{tr}assign{/tr}</option>
+ <option value="remove">{tr}remove{/tr}</option>
+ </select>
+ {tr}all permissions in level{/tr}
+ <select name="level">
+ {html_options output=$levels values=$levels selected=$perms[user].level}
+ </select>
+ {tr}to {$groupInfo.group_name}{/tr}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="allper" value="{tr}Update{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Create Level"}
+ {form legend="Create a new level"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+ <div class="row">
+ {formlabel label="Level" for="level"}
+ {forminput}
+ <input type="text" name="level" id="level" />
+ {formhelp note="Levels can be used to group certain permissions and thus easily assign a set of permissions to a group. Assinging a permission to a level has no outcome on the users or groups. It's merely a way to organise permissions."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="createlevel" value="{tr}Create{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+ {/if}
+ {/jstabs}
+ </div><!-- end .body -->
+</div><!-- end .users -->
+
+{/strip}
diff --git a/templates/admin_groups_list.tpl b/templates/admin_groups_list.tpl
new file mode 100644
index 0000000..dc48351
--- /dev/null
+++ b/templates/admin_groups_list.tpl
@@ -0,0 +1,65 @@
+<div class="listing users">
+ <div class="header">
+ <h1>{tr}List of existing groups{/tr}</h1>
+ </div>
+
+ <div class="body">
+ {smartlink ititle="Add a new group" ipackage=users ifile="admin/edit_group.php" action=create}
+
+ <div class="navbar">
+ <ul>
+ <li>{biticon ipackage=liberty iname=sort iexplain="sort by"}</li>
+ <li>{smartlink ititle="Name" isort="group_name" offset=$offset idefault=1}</li>
+ <li>{smartlink ititle="Description" isort="group_desc" offset=$offset}</li>
+ <li>{smartlink ititle="Home Page" isort="group_home" offset=$offset}</li>
+ </ul>
+ </div><!-- end .navbar -->
+
+ <div class="clear"></div>
+
+ {formfeedback success=$successMsg error=$errorMsg}
+
+ <ul class="data">
+ {foreach from=$groups key=groupId item=group}
+ <li class="item {cycle values='odd,even'}">
+ <div class="floaticon">
+ {smartlink ititle="Edit" ipackage="users" ifile="admin/edit_group.php" ibiticon="liberty/edit" group_id=$groupId}
+ {smartlink ititle="Group Members" ipackage="users" ifile="admin/edit_group.php" ibiticon="users/users" members=$groupId}
+ {if $groupId ne -1}{* sorry for hardcoding, really need php define ANONYMOUS_GROUP_ID - spiderr *}
+ {smartlink ititle="Batch assign" ipackage="users" ifile="admin/edit_group.php" ibiticon="users/batch_assign" batch_assign=$groupId}
+ {smartlink ititle="Remove" ipackage="users" ifile="admin/edit_group.php" ibiticon="liberty/delete" action=delete group_id=$groupId ionclick="return confirm( '{tr}Are you sure you want to remove this group?{/tr}' )"}
+ {/if}
+ </div>
+
+ <h2>{$group.group_name}</h2>
+ <div style="float:left;width:30%;">
+ {$group.group_desc}<br />
+ {if $group.is_default eq 'y'}<small class="warning"> *{tr}Default group{/tr}*</small><br/>{/if}
+ {if $group.group_home}{tr}Home Page{/tr}:<strong> {$group.group_home}</strong><br />{/if}
+ {if $group.included}
+ <br />{tr}Included Groups{/tr}
+ <ul class="data small">
+ {foreach from=$group.included key=incGroupId item=incGroupName}
+ <li class="{cycle values="odd,even"} item">wow: {$incGroupName}</li>
+ {/foreach}
+ </ul>
+ {/if}
+ </div>
+
+ <div style="float:right;width:70%;">
+ {tr}Permissions{/tr}
+ <ul class="small">
+ {foreach from=$group.perms key=permName item=perm}
+ <li>{$perm.perm_desc}</li>
+ {foreachelse}
+ <li>{tr}none{/tr}</li>
+ {/foreach}
+ </ul>
+ </div>
+ <div class="clear"></div>
+ </li>
+ {/foreach}
+ </ul>
+ {pagination}
+ </div><!-- end .body -->
+</div><!-- end .users -->
diff --git a/templates/admin_login.tpl b/templates/admin_login.tpl
new file mode 100644
index 0000000..8988879
--- /dev/null
+++ b/templates/admin_login.tpl
@@ -0,0 +1,409 @@
+{jstabs}
+ {jstab title="User Registration and Login"}
+ {form legend="User Registration and Login"}
+ <input type="hidden" name="page" value="{$page}" />
+ <div class="row">
+ {formlabel label="Authentication method" for="auth_method"}
+ {forminput}
+ <select name="auth_method" id="auth_method">
+ <option value="tiki" {if $auth_method eq 'tiki'} selected="selected"{/if}>{tr}Just Tiki{/tr}</option>
+ <option value="ws" {if $auth_method eq 'ws'} selected="selected"{/if}>{tr}Web Server{/tr}</option>
+ <option value="auth" {if $auth_method eq 'auth'} selected="selected"{/if}>{tr}Tiki and PEAR::Auth{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Users can register" for="allowRegister"}
+ {forminput}
+ <input type="checkbox" name="allowRegister" id="allowRegister" {if $allowRegister eq 'y'}checked="checked"{/if}/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Create a group for each user" for="eponymousGroups"}
+ {forminput}
+ <input type="checkbox" name="eponymousGroups" id="eponymousGroups" {if $eponymousGroups eq 'y'}checked="checked"{/if}/>
+ {formhelp note="This will create a group for each user with the same name as the user. This might be useful if you want to assign different permission settings to every user."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Request passcode to register" for="useRegisterPasscode"}
+ {forminput}
+ <input type="checkbox" name="useRegisterPasscode" id="useRegisterPasscode" {if $useRegisterPasscode eq 'y'}checked="checked"{/if}/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Passcode" for="registerPasscode"}
+ {forminput}
+ <input type="text" name="registerPasscode" id="registerPasscode" value="{$registerPasscode|escape}"/>
+ {formhelp note="Enter the Passcode that is required for users to register with your site."}
+ {/forminput}
+ </div>
+
+{php}
+if (!function_exists("gd_info"))
+ $this->assign( 'warning','PHP GD library is required for this feature (not found on your system)' );
+{/php}
+
+ <div class="row">
+ {formfeedback warning=$warning}
+ {formlabel label="Prevent automatic/robot registration" for="rnd_num_reg"}
+ {forminput}
+ <input type="checkbox" name="rnd_num_reg" id="rnd_num_reg" {if $rnd_num_reg eq 'y'}checked="checked"{/if}/>
+ {formhelp note="This will generate a random number as an image, the user has to confirm during the registration step."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Validate users by email" for="validateUsers"}
+ {forminput}
+ <input type="checkbox" name="validateUsers" id="validateUsers" {if $validateUsers eq 'y'}checked="checked"{/if}/>
+ {formhelp note="Send an email to the user, to validate registration."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {if !$gBitSystem->hasValidSenderEmail()}
+ {formfeedback error="Site <a href=\"`$gBitLoc.BIT_ROOT_URL`kernel/admin/index.php?page=general\">emailer return address</a> is not valid!"}
+ {/if}
+ {formlabel label="Validate email address" for="validateEmail"}
+ {forminput}
+ <input type="checkbox" name="validateEmail" id="validateEmail" {if !$gBitSystem->hasValidSenderEmail()}disabled="disabled"{elseif $validateEmail eq 'y'}checked="checked"{/if} />
+ {formhelp note="This feature should be used only when you need the maximum security and should be used with discretion. If a visitor's email server is not responding, they will not be able to register. You also must have a valid sender email to use this feature (This setting can be found in Administration --&gt; Kernel --&gt; General Settings"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Remind passwords by email" for="forgotPass"}
+ {forminput}
+ <input type="checkbox" name="forgotPass" id="forgotPass" {if $forgotPass eq 'y'}checked="checked"{/if}/>
+ {formhelp note="This will display a 'forgot password' link on the login page and allow users to have their password sent to their registered email address."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Password invalid after days" for="pass_due"}
+ {forminput}
+ <input type="text" name="pass_due" id="pass_due" value="{$pass_due|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Store plaintext passwords" for="feature_clear_passwords"}
+ {forminput}
+ <input type="checkbox" name="feature_clear_passwords" id="feature_clear_passwords" {if $gBitSystemPrefs.feature_clear_passwords eq 'y'}checked="checked"{/if}/>
+ {formhelp note="Passwords will be visible in the database. If a user requests a password, their password will *not* be reset and simply emailed to them in plain text. This option is less secure, but better suited to sites with a wide variety of users."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Password generator" for="user_password_generator"}
+ {forminput}
+ <input type="checkbox" name="user_password_generator" id="user_password_generator" {if $gBitSystemPrefs.user_password_generator eq 'y'}checked="checked"{/if}/>
+ {formhelp note="Display password generator on registration page that creates secure passwords."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Use challenge/response authentication" for="feature_challenge"}
+ {forminput}
+ <input type="checkbox" name="feature_challenge" id="feature_challenge" {if $gBitSystemPrefs.feature_challenge eq 'y'}checked="checked"{/if}/>
+ {formhelp note="Some javascript stuff."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Force to use characters <b>and</b> numbers in passwords" for="pass_chr_num"}
+ {forminput}
+ <input type="checkbox" name="pass_chr_num" id="pass_chr_num" {if $pass_chr_num eq 'y'}checked="checked"{/if}/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Minimum password length" for="min_pass_length"}
+ {forminput}
+ <input type="text" name="min_pass_length" id="min_pass_length" value="{$min_pass_length|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Remember me feature" for="rememberme"}
+ {forminput}
+ <input type="checkbox" name="rememberme" id="rememberme" {if $gBitSystem->isFeatureActive('rememberme')}checked="checked"{/if}/>
+ {formhelp note="Registered users will stay logged even if they close their browser."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Duration of 'Remember me' feature" for="remembertime"}
+ {forminput}
+ <select name="remembertime" id="remembertime">
+ <option value="300" {if $remembertime eq 300} selected="selected"{/if}>5 {tr}minutes{/tr}</option>
+ <option value="900" {if $remembertime eq 900} selected="selected"{/if}>15 {tr}minutes{/tr}</option>
+ <option value="1800" {if $remembertime eq 1800} selected="selected"{/if}>30 {tr}minutes{/tr}</option>
+ <option value="3600" {if $remembertime eq 3600} selected="selected"{/if}>1 {tr}hour{/tr}</option>
+ <option value="7200" {if $remembertime eq 7200} selected="selected"{/if}>2 {tr}hours{/tr}</option>
+ <option value="43200" {if $remembertime eq 43200} selected="selected"{/if}>12 {tr}hours{/tr}</option>
+ <option value="86400" {if $remembertime eq 86400} selected="selected"{/if}>1 {tr}day{/tr}</option>
+ <option value="604800" {if $remembertime eq 604800} selected="selected"{/if}>1 {tr}week{/tr}</option>
+ <option value="2592000" {if $remembertime eq 2592000} selected="selected"{/if}>1 {tr}month{/tr}</option>
+ <option value="15724800" {if $remembertime eq 15724800} selected="selected"{/if}>6 {tr}months{/tr}</option>
+ <option value="2147483648" {if $remembertime eq 2147483648} selected="selected"{/if}>{tr}Forever{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Remember me domain" for="cookie_domain"}
+ {forminput}
+ <input type="text" name="cookie_domain" id="cookie_domain" value="{$cookie_domain|escape}" size="50" />
+ {formhelp note="Remember to use a '.' wildcard prefix if you want domain wide cookies."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Remember me path" for="cookie_path"}
+ {forminput}
+ <input type="text" name="cookie_path" id="cookie_path" value="{$cookie_path|escape}" size="50" />
+ {formhelp note="The path '/foo' would match '/foobar' and '/foo/bar.html'"}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="loginprefs" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="HTTP Settings"}
+ {form legend="HTTP Settings"}
+ <input type="hidden" name="page" value="{$page}" />
+ <div class="row">
+ {formlabel label="Allow secure (https) login" for="https_login"}
+ {forminput}
+ <input type="checkbox" name="https_login" id="https_login" {if $https_login eq 'y'}checked="checked"{/if}/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Require secure (https) login" for="https_login_required"}
+ {forminput}
+ <input type="checkbox" name="https_login_required" id="https_login_required" {if $https_login_required eq 'y'}checked="checked"{/if}/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTP server name" for="http_domain"}
+ {forminput}
+ <input type="text" name="http_domain" id="http_domain" value="{$http_domain|escape}" size="50" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTP port" for="http_port"}
+ {forminput}
+ <input type="text" name="http_port" id="http_port" size="5" value="{$http_port|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTP URL prefix" for="http_prefix"}
+ {forminput}
+ <input type="text" name="http_prefix" id="http_prefix" value="{$http_prefix|escape}" size="50" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTPS server name" for="https_domain"}
+ {forminput}
+ <input type="text" name="https_domain" id="https_domain" value="{$https_domain|escape}" size="50" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTPS port" for="https_port"}
+ {forminput}
+ <input type="text" name="https_port" id="https_port" size="5" value="{$https_port|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HTTPS URL prefix" for="https_prefix"}
+ {forminput}
+ <input type="text" name="https_prefix" id="https_prefix" value="{$https_prefix|escape}" size="50" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="httpprefs" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="PEAR::Auth"}
+ {form legend="PEAR::Auth"}
+ <input type="hidden" name="page" value="{$page}" />
+ <div class="row">
+ {formlabel label="Create user if not in Tiki" for="auth_create_gBitDbUser"}
+ {forminput}
+ <input type="checkbox" name="auth_create_gBitDbUser" id="auth_create_gBitDbUser" {if $auth_create_gBitDbUser eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Create user if not in Auth" for="auth_create_user_auth"}
+ {forminput}
+ <input type="checkbox" name="auth_create_user_auth" id="auth_create_user_auth" {if $auth_create_user_auth eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Just use Tiki auth for admin" for="auth_skip_admin"}
+ {forminput}
+ <input type="checkbox" name="auth_skip_admin" id="auth_skip_admin" {if $auth_skip_admin eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Host" for="auth_ldap_host"}
+ {forminput}
+ <input type="text" name="auth_ldap_host" id="auth_ldap_host" value="{$auth_ldap_host|escape}" size="50" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Port" for="auth_ldap_port"}
+ {forminput}
+ <input type="text" name="auth_ldap_port" id="auth_ldap_port" value="{$auth_ldap_port|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Scope" for="auth_ldap_scope"}
+ {forminput}
+ <select name="auth_ldap_scope" id="auth_ldap_scope">
+ <option value="sub" {if $auth_ldap_scope eq "sub"} selected="selected"{/if}>sub</option>
+ <option value="one" {if $auth_ldap_scope eq "one"} selected="selected"{/if}>one</option>
+ <option value="base" {if $auth_ldap_scope eq "base"} selected="selected"{/if}>base</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Base DN" for="auth_ldap_basedn"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_basedn" id="auth_ldap_basedn" value="{$auth_ldap_basedn|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP User DN" for="auth_ldap_userdn"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_userdn" id="auth_ldap_userdn" value="{$auth_ldap_userdn|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP User Attribute" for="auth_ldap_userattr"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_userattr" id="auth_ldap_userattr" value="{$auth_ldap_userattr|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP User OC" for="auth_ldap_useroc"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_useroc" id="auth_ldap_useroc" value="{$auth_ldap_useroc|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Group DN" for="auth_ldap_groupdn"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_groupdn" id="auth_ldap_groupdn" value="{$auth_ldap_groupdn|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Group Atribute" for="auth_ldap_groupattr"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_groupattr" id="auth_ldap_groupattr" value="{$auth_ldap_groupattr|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Group OC" for="auth_ldap_groupoc"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_groupoc" id="auth_ldap_groupoc" value="{$auth_ldap_groupoc|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Member Attribute" for="auth_ldap_memberattr"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_memberattr" id="auth_ldap_memberattr" value="{$auth_ldap_memberattr|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Member Is DN" for="auth_ldap_memberisdn"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_memberisdn" id="auth_ldap_memberisdn" value="{$auth_ldap_memberisdn|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Admin User" for="auth_ldap_adminuser"}
+ {forminput}
+ <input size="50" type="text" name="auth_ldap_adminuser" id="auth_ldap_adminuser" value="{$auth_ldap_adminuser|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="LDAP Admin Pwd" for="auth_ldap_adminpass"}
+ {forminput}
+ <input size="50" type="password" name="auth_ldap_adminpass" id="auth_ldap_adminpass" value="{$auth_ldap_adminpass|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="auth_pear" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+{/jstabs}
diff --git a/templates/admin_permission.tpl b/templates/admin_permission.tpl
new file mode 100644
index 0000000..db94c07
--- /dev/null
+++ b/templates/admin_permission.tpl
@@ -0,0 +1,22 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/Attic/admin_permission.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+
+<div class="floaticon">{bithelp}</div>
+
+<div class="admin groups">
+ <div class="header">
+ <h1>{tr}Assign permissions{/tr}</h1>
+ </div>
+
+ <h2>{tr}{$group} permissions{/tr}</h2>
+
+ <div class="navbar">
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/admin_groups.php">{tr}Back to groups{/tr}</a>
+ </div>
+
+ <div class="body">
+
+ </div><!-- end .body -->
+</div><!-- end .users -->
+
+{/strip}
diff --git a/templates/admin_userfiles.tpl b/templates/admin_userfiles.tpl
new file mode 100644
index 0000000..949f2b5
--- /dev/null
+++ b/templates/admin_userfiles.tpl
@@ -0,0 +1,16 @@
+<div class="admin box">
+ <div class="boxtitle">{tr}User files{/tr}</div>
+ <div class="boxcontent">
+ <form action="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=userfiles" method="post">
+ <table class="panel">
+ <tr><td>{tr}Quota (Mb){/tr}</td><td>
+ <input type="text" name="userfiles_quota" value="{$userfiles_quota|escape}" size="5" />
+ </td></tr>
+ <tr><td>{tr}Use database to store userfiles{/tr}:</td><td><input type="radio" name="uf_use_db" value="y" {if $uf_use_db eq 'y'}checked="checked"{/if}/></td></tr>
+ <tr><td>{tr}Use a directory to store userfiles{/tr}:</td><td><input type="radio" name="uf_use_db" value="n" {if $uf_use_db eq 'n'}checked="checked"{/if}/></td></tr>
+ <tr><td align="right">{tr}Path{/tr}:</td><td><input type="text" name="uf_use_dir" value="{$uf_use_dir|escape}" size="50" /> </td></tr>
+ <tr class="panelsubmitrow"><td colspan="2"><input type="submit" name="userfilesprefs" value="{tr}Change preferences{/tr}" /></td></tr>
+ </table>
+ </form>
+ </div>
+</div>
diff --git a/templates/admin_users.tpl b/templates/admin_users.tpl
new file mode 100644
index 0000000..f37d3d9
--- /dev/null
+++ b/templates/admin_users.tpl
@@ -0,0 +1,61 @@
+{strip}
+{form legend="User Settings"}
+ <input type="hidden" name="page" value="{$page}" />
+ {foreach from=$formFeatures key=feature item=output}
+ <div class="row">
+ {formlabel label=`$output.label` for=$feature}
+ {forminput}
+ {html_checkboxes name="fTiki[$feature]" values="y" checked=`$gBitSystemPrefs.$feature` labels=false id=$feature}
+ {formhelp note=`$output.note` page=`$output.link`}
+ {/forminput}
+ </div>
+ {/foreach}
+
+ <div class="row">
+ {formlabel label="Display" for="display_name"}
+ {forminput}
+ <select name="fTiki[display_name]" id="display_name">
+ <option value="real_name" {if $gBitSystemPrefs.display_name eq 'real_name'}selected="selected"{/if}>{tr}Real Name{/tr}</option>
+ <option value="login" {if $gBitSystemPrefs.display_name eq 'login'}selected="selected"{/if}>{tr}Login / Nick Name{/tr}</option>
+ </select>
+ {formhelp note="Decide what name should be displayed throughout your site, login name or real name"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Users Can Customize Their Layout" for="feature_user_layout"}
+ {forminput}
+ <select name="fTiki[feature_user_layout]" id="feature_user_layout">
+ <option value="n">Never</option>
+ <option value="h" {if $gBitSystemPrefs.feature_user_layout eq 'h'}selected="selected"{/if}>{tr}Just For Their Homepage{/tr}</option>
+ </select>
+ {formhelp note="Allows users to position and display their own set of modules" page="UsersConfigureModules"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Users Can Change Their Theme" for="feature_user_theme"}
+ {forminput}
+ <select name="fTiki[feature_user_theme]" id="feature_user_theme">
+ <option value="n">Never</option>
+ <option value="h" {if $gBitSystemPrefs.feature_user_theme eq 'h'}selected="selected"{/if}>{tr}Just For Their Homepage{/tr}</option>
+ <option value="y" {if $gBitSystemPrefs.feature_user_theme eq 'y'}selected="selected"{/if}>{tr}For the Entire Site{/tr}</option>
+ </select>
+ {formhelp note="Allows users to choose their own theme." page="UserTheme"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Custom User Fields" for="custom_user_fields"}
+ {forminput}
+ <input type="text" name="fTiki[custom_user_fields]" value="{$gBitSystemPrefs.custom_user_fields}" maxlength="250" id="custom_user_fields" />
+ {formhelp note="Comma separated list of field names for custom user registration" }
+ {/forminput}
+ </div>
+
+
+ <div class="row submit">
+ <input type="submit" name="features" value="{tr}Change preferences{/tr}" />
+ </div>
+{/form}
+{/strip}
diff --git a/templates/assignuser.tpl b/templates/assignuser.tpl
new file mode 100644
index 0000000..37c2c0c
--- /dev/null
+++ b/templates/assignuser.tpl
@@ -0,0 +1,87 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/Attic/assignuser.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+<div class="floaticon">{bithelp}</div>
+<div class="floaticon"><a href="{$gBitLoc.USERS_PKG_URL}admin/index.php">{biticon ipackage=liberty iname=back iexplain="back to users"}</a></div>
+
+<div class="admin users">
+ <div class="header">
+ <h1>{tr}Assign user to groups{/tr}</h1>
+ <h2>Assign and remove groups for user {$assignUser->mInfo.login}</h2>
+ </div>
+
+ <div class="body">
+ {form legend="User Information" action="`$gBitLoc.USERS_PKG_URL`admin/assign_user.php?assign_user=$assign_user"}
+ <input type="hidden" value="{$assignUser->mUserId}" name="assign_user" />
+
+ <div class="row">
+ {formlabel label="Username"}
+ {forminput}
+ {$assignUser->mInfo.login}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Email"}
+ {forminput}
+ {$assignUser->mInfo.email}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Groups"}
+ {forminput}
+ {foreach from=$assignUser->mGroups key=groupId item=group}
+ {if $groupId eq $assignUser->mInfo.default_group_id}<strong>{/if}
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/edit_group.php?group_id={$groupId}">{$group.group_name}
+ {if $groupId eq $assignUser->mInfo.default_group_id}</strong>{/if}
+ {if $groupId != -1}
+ &nbsp;<a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?action=removegroup&amp;group_id={$groupId}&amp;assign_user={$assignUser->mUserId}">{biticon ipackage="liberty" iname="delete_small" iexplain="remove group"}</a>
+ {/if}
+ <br />
+ {/foreach}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Default Group" for="default_group"}
+ {forminput}
+ <select name="default_group" id="default_group">
+ {foreach from=$assignUser->mGroups key=groupId item=group}
+ <option value="{$groupId}" {if $groupId eq $assignUser->mInfo.default_group_id}selected="selected"{/if}>{$group.group_name}</option>
+ {/foreach}
+ </select>
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" value="{tr}set{/tr}" name="set_default" />
+ </div>
+ {/form}
+
+ <table class="data">
+ <tr>
+ <th><a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?assign_user={$assignUser->mUserId}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'group_name_desc'}group_name_asc{else}group_name_desc{/if}">{tr}Group Name{/tr}</a></th>
+ <th><a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?assign_user={$assignUser->mUserId}&amp;offset={$offset}&amp;sort_mode={if $sort_mode eq 'group_desc_desc'}group_desc_asc{else}group_desc_desc{/if}">{tr}Description{/tr}</a></th>
+ <th>{tr}action{/tr}</th>
+ </tr>
+ {cycle values="even,odd" print=false}
+ {foreach from=$groups key=groupId item=group}
+ {if !$assignUser->mGroups.$groupId && $groupId != -1}
+ <tr class="{cycle}">
+ <td>{$group.group_name}</td>
+ <td>{$group.group_desc}</td>
+ <td class="actionicon">
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;action=assign&amp;group_id={$groupId}&amp;assign_user={$assignUser->mUserId}">{biticon ipackage="liberty" iname="assign" iexplain="assign"}</a>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ </table>
+
+ {pagination assign_user=$assign_user}
+
+ {minifind}
+
+ </div><!-- end .body -->
+</div><!-- end .users -->
+{/strip}
diff --git a/templates/center_user_wiki_page.php b/templates/center_user_wiki_page.php
new file mode 100644
index 0000000..d535697
--- /dev/null
+++ b/templates/center_user_wiki_page.php
@@ -0,0 +1,11 @@
+<?php
+
+require_once( WIKI_PKG_PATH.'BitPage.php' );
+
+global $wikilib, $user, $gQueryUser;
+
+include_once( USERS_PKG_PATH.'lookup_user_inc.php' );
+
+$smarty->assign_by_ref( 'parsed', $gQueryUser->parseData() );
+
+?>
diff --git a/templates/center_user_wiki_page.tpl b/templates/center_user_wiki_page.tpl
new file mode 100644
index 0000000..3089ee7
--- /dev/null
+++ b/templates/center_user_wiki_page.tpl
@@ -0,0 +1,57 @@
+{strip}
+<div class="display wiki user">
+ {if $gBitUser->hasPermission( 'bit_p_admin_users' )}
+ <div class="floaticon">
+ {if $gBitUser->mUserId ne $gQueryUser->mUserId}
+ {smartlink ipackage=users ifile="admin/index.php" assume_user=$userInfo.user_id ititle="Assume user identity" ibiticon="users/assume_user"}
+ {else}
+ {smartlink ipackage=users ifile="preferences.php" ititle="Edit your personal profile" ibiticon="liberty/edit"}
+ {/if}
+ </div>
+ {/if}
+
+ <div class="header">
+ <h1 >{displayname hash=$userInfo nolink=true}</h1>
+ </div>
+
+ {if $userInfo.last_modified ne $userInfo.last_modified}
+ <div style="text-align:right">
+ {tr}Updated{/tr} {$userInfo.created|bit_date_format}
+ </div>
+ {/if}
+
+ {legend legend="User Information"}
+ {include file="bitpackage:users/user_information_inc.tpl" userData=$gQueryUser}
+ {/legend}
+
+ <div class="content">
+ <div class="body">
+ {if $parsed}
+ {if $gBitUser->mUserId eq $gQueryUser->mUserId}
+ <div class="floaticon">
+ {smartlink ipackage=users ifile="edit_personal_page.php" ititle="Edit your personal wiki page" ibiticon="liberty/edit"}
+ </div>
+ {/if}
+
+ <div class="header">
+ <h1>{$userInfo.title}</h1>
+ </div>
+ {else}
+ <p>
+ {if $gBitUser->mUserId ne $gQueryUser->mUserId}
+ {tr}This user has not entered any information yet.{/tr}
+ {else}
+ {tr}To enter some information here, please <a href="{$gBitLoc.USERS_PKG_URL}edit_personal_page.php">edit your personal homepage</a>.{/tr}
+ {/if}
+ </p>
+ {/if}
+
+ {if $userInfo.portrait_url}
+ <img src="{$userInfo.portrait_url}" class="portrait" title="{tr}Portrait{/tr}" alt="{tr}Portrait{/tr}" />
+ {/if}
+
+ {$parsed}
+ </div><!-- end .body -->
+ </div><!-- end .content -->
+</div><!-- end .user -->
+{/strip}
diff --git a/templates/change_password.tpl b/templates/change_password.tpl
new file mode 100644
index 0000000..a59175e
--- /dev/null
+++ b/templates/change_password.tpl
@@ -0,0 +1,29 @@
+<h1>{tr}Change password enforced{/tr}</h1>
+<form method="post" action="{$gBitLoc.USERS_PKG_URL}change_password.php">
+<table class="panel">
+<tr>
+ <td>{tr}User{/tr}:</td>
+ <td><input type="text" name="login" value="{$userInfo.login}" /></td>
+</tr>
+{if $userInfo.password}
+ <input type="hidden" name="oldpass" value="{$userInfo.password|escape}" /></td>
+{else}
+<tr>
+ <td>{tr}Old password{/tr}:</td>
+ <td><input type="password" name="oldpass" /></td>
+</tr>
+{/if}
+<tr>
+ <td>{tr}New password{/tr}:</td>
+ <td><input type="password" name="pass" /></td>
+</tr>
+<tr>
+ <td>{tr}Again please{/tr}:</td>
+ <td><input type="password" name="pass2" /></td>
+</tr>
+<tr>
+ <td>&nbsp;</td>
+ <td><input type="submit" name="change" value="{tr}change{/tr}" /></td>
+</tr>
+</table>
+</form>
diff --git a/templates/custom_home.tpl b/templates/custom_home.tpl
new file mode 100644
index 0000000..304241c
--- /dev/null
+++ b/templates/custom_home.tpl
@@ -0,0 +1,101 @@
+<!--
+<textarea id="fooz">Hola a todos</textarea>
+<input type="button" value="set" onMouseOver="return overlib('das');" onMouseOut="nd();" />
+-->
+<!-- onClick='return overlib(\"".$repl."\",STICKY,CAPTION,\"Spellchecker suggestions\");'-->
+<div class="display customhome">
+<div class="header">
+<h1>{$browserTitle} Home</h1>
+</div>
+
+<div class="body">
+
+<table class="other">
+<tr>
+<td style="width: 50%; vertical-align: top;">
+ <div class="box">
+ <div class="boxtitle">
+ What is Tiki?
+ </div>
+ <div class="boxcontent">
+ Tiki is a powerful Content Management System easy to customize and
+ configure designed to create Portals, community sites, intranets,
+ and general web applications.
+ </div>
+ </div>
+</td>
+<td style="width: 50%; vertical-align: top;">
+ <div class="box">
+ <div class="boxtitle">News</div>
+ <div class="boxcontent">
+ {content id=1}
+ </div>
+ </div>
+</td>
+</tr>
+</table>
+
+<div class="box">
+<div class="boxtitle">
+Download!
+</div>
+<div class="boxcontent">
+Our last stable release of bitweaver is 1.2 - Bonnie - you can download bitweaver from <a href="http://www.sourceforge.net/projects/tikipro/">Sourceforge</a>
+</div>
+</div>
+
+<div class="box">
+<div class="boxtitle">
+Join us!
+</div>
+<div class="boxcontent">
+bitweaver is a fairly young project and needs all the help we can get.
+There are many ways of contributing - the first step is to learn more. Our site is located at <a href="http://www.bitweaver.org/wiki/index.php"> bitweaver CMS Home</a> or join our projects <a href="http://sourceforge.net/mail/?group_id=64258">mailing list</a>
+</div>
+</div>
+<div class="box">
+<div class="boxtitle">
+Some of the many features in bitweaver
+</div>
+<div class="boxcontent">
+<ul>
+<li>A wiki system where users can edit pages using a powerful syntax</li>
+<li>Articles, reviews, topics and user submissions</li>
+<li>Forums</li>
+<li>Weblogs</li>
+<li>Image galleries</li>
+<li>File galleries</li>
+<li>Chatrooms</li>
+<li>FAQs</li>
+<li>Polls</li>
+<li>Send and receive objects to/from other Tiki sites</li>
+<li>Powerful permission system with users/groups for all the sections and features</li>
+</ul>
+</div>
+</div>
+
+<div class="box">
+<div class="boxtitle">
+Testing Tiki
+</div>
+<div class="boxcontent">
+<ol>
+<li>May be you want to start reading the tiki <a href="{$gBitLoc.FAQS_PKG_URL}index.php">FAQ</a></li>
+<li>Test the wiki following this <a href="{$gBitLoc.WIKI_PKG_URL}index.php">link</a></li>
+<li>Visit the <a href="{$gBitLoc.BITFORUMS_PKG_URL}index.php">forums</a>, write a topic or reply to an existing topic if you want</li>
+<li>At the <a href="{$gBitLoc.IMAGEGALS_PKG_URL}index.php">images galleries</a> section you can see some images try <a href="{$gBitLoc.IMAGEGALS_PKG_URL}upload_image.php?gallery_id=2">uploading images</a> to our public gallery</li>
+<li>You can download some tiki-add-ons from the <a href="{$gBitLoc.FILEGALS_PKG_URL}list_file_gallery.php?gallery_id=1">tiki-add-ons file gallery</a></li>
+<li>Visit the <a href="{$gBitLoc.CATEGORIES_PKG_URL}index.php">category browser</a> to test the tiki categorizing system</li>
+<li>You can enter the <a href="{$gBitLoc.CHAT_PKG_URL}index.php">chatrooms</a> to test our chatting system maybe you should invite a friend to test it</li>
+<li>From the <a href="{$gBitLoc.GAMES_PKG_URL}index.php">games</a> section you can play some flash games</li>
+<li>If you are not logged you can <a href="{$gBitLoc.USERS_PKG_URL}register.php">register</a> as a new user and test features available to registered users such as setting user preferences, user bookmarks or configuring modules</li>
+<li>If you are curious visit the <a href="{$gBitLoc.STATS_PKG_URL}index.php">stats</a> page</li>
+<li>The <a href="{$gBitLoc.ARTICLES_PKG_URL}index.php">articles</a> section will show a demo article that you can read and comment</li>
+<li>If you want to test editing an article or review you can <a href="{$gBitLoc.ARTICLES_PKG_URL}edit_submission.php">write a submission</a></li>
+<li>From the <a href="{$gBitLoc.BLOGS_PKG_URL}index.php">weblogs</a> section you can create a weblog and test writing to your weblog</li>
+</ol>
+</div>
+</div>
+
+</div><!-- end .body -->
+</div><!-- end .customhome -->
diff --git a/templates/custom_home_2.tpl b/templates/custom_home_2.tpl
new file mode 100644
index 0000000..1480f4b
--- /dev/null
+++ b/templates/custom_home_2.tpl
@@ -0,0 +1,60 @@
+<div class="display customhome">
+<div class="header">
+<h1>{$browserTitle} Home</h1>
+</div>
+
+<div class="body">
+
+<h1>bitweaver - Custom Home 2</h1>
+<div align="center">
+{include file="bitpackage:users/my_bitweaver_bar.tpl"}
+<table class="other">
+<tr style="height: 180px;">
+ <td style="text-align: center; vertical-align: middle;">
+ <a href="{$gBitLoc.ARTICLES_PKG_URL}index.php"><img class="icon" alt="articles" src="{$gBitLoc.IMG_PKG_URL}custom/article4.jpeg" width="119" height="88" /></a><br />
+ Articles
+ </td>
+ <td height="180" valign="middle" align="center">
+ <a href="{$gBitLoc.BLOGS_PKG_URL}index.php"><img class="icon" alt="galleries" src="{$gBitLoc.IMG_PKG_URL}custom/weblog3.jpeg" width="119" height="88" /></a><br />
+ <small><b>BLOGS</b></small>
+ </td>
+ <td height="180" valign="middle" align="center">
+ <a href="{$gBitLoc.CHAT_PKG_URL}index.php"><img class="icon" alt="chat" src="{$gBitLoc.IMG_PKG_URL}custom/chat.jpeg" width="119" height="88" /></a><br />
+ Chat
+ </td>
+</tr>
+<tr>
+ <td height="180" valign="middle" align="center">
+ <a href="{$gBitLoc.FILEGALS_PKG_URL}index.php"><img class="icon" alt="files" src="{$gBitLoc.IMG_PKG_URL}custom/filegal.jpeg" width="119" height="88" /></a><br />
+ Files
+ </td>
+</tr>
+<tr style="height: 180px;">
+ <td style="text-align: center; vertical-align: middle;">
+ <a href="{$gBitLoc.BITFORUMS_PKG_URL}index.php"><img class="icon" alt="forums" src="{$gBitLoc.IMG_PKG_URL}custom/forums3.jpeg" width="119" height="88" /></a><br />
+ <small><b>FORUMS</b></small>
+ </td>
+ <td height="180" valign="middle" align="center">
+ <a href="{$gBitLoc.IMAGEGALS_PKG_URL}index.php"><img class="icon" alt="galleries" src="{$gBitLoc.IMG_PKG_URL}custom/galleries5.jpeg" width="119" height="88" /></a><br />
+ Image Galleriess
+ </td>
+</tr>
+<tr>
+ <td height="180" valign="middle" align="center">
+ <a href="{$gBitLoc.DIRECTORY_PKG_URL}index.php"><img class="icon" alt="prefs" src="{$gBitLoc.IMG_PKG_URL}custom/links.jpg" width="119" height="88" /></a><br />
+ <small><b>Links Directory</b></small>
+ </td>
+ <td style="text-align: center; vertical-align: middle;">
+ <a href="{$gBitLoc.WIKI_PKG_URL}index.php"><img class="icon" alt="wiki" src="{$gBitLoc.IMG_PKG_URL}custom/wiki5.jpeg" width="119" height="88" /></a><br />
+ Wiki
+ </td>
+ <td style="text-align: center; vertical-align: middle;">
+ <a href="{$gBitLoc.USERS_PKG_URL}preferences.php"><img class="icon" alt="prefs" src="{$gBitLoc.IMG_PKG_URL}custom/users.jpg" width="119" height="88" /></a><br />
+ User Preferences
+ </td>
+</tr>
+</table>
+</div>
+
+</div>
+</div>
diff --git a/templates/group_list_members.tpl b/templates/group_list_members.tpl
new file mode 100644
index 0000000..6356c80
--- /dev/null
+++ b/templates/group_list_members.tpl
@@ -0,0 +1,28 @@
+{strip}
+<div class="floaticon">
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/edit_group.php">{tr}&laquo; Group List{/tr}</a>
+ {bithelp}
+</div>
+
+<div class="listing users">
+ <div class="header">
+ <h1>{tr}Group Members{/tr}: {$groupInfo.group_name}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback success=$successMsg error=$errorMsg}
+
+ <ol class="data">
+ {foreach from=$groupMembers key=userId item=member}
+ <li>{displayname hash=$member}
+ {if $groupId != -1}
+ &nbsp;<a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?action=removegroup&amp;group_id={$groupInfo.group_id}&amp;assign_user={$member.user_id}">{biticon ipackage="liberty" iname="delete_small" iexplain="remove group"}</a>
+ {/if}
+ </li>
+ {foreachelse}
+ <li>{tr}The group has no members.{/tr}</li>
+ {/foreach}
+ </ol>
+ </div>
+</div>
+{/strip}
diff --git a/templates/index.php b/templates/index.php
new file mode 100644
index 0000000..3e305fe
--- /dev/null
+++ b/templates/index.php
@@ -0,0 +1,6 @@
+<?php
+
+ // This is not a package.
+ header ("location: ../index.php");
+
+?> \ No newline at end of file
diff --git a/templates/index_list.tpl b/templates/index_list.tpl
new file mode 100644
index 0000000..d714053
--- /dev/null
+++ b/templates/index_list.tpl
@@ -0,0 +1,12 @@
+<div class="display users listing">
+<div class="header">
+<h1>{$siteTitle} {tr}Members{/tr}</h1>
+</div>
+
+<div class="body">
+
+{include file="bitpackage:users/users_list.tpl"}
+
+</div> {* end .body *}
+
+</div> {* end .admin *}
diff --git a/templates/login.tpl b/templates/login.tpl
new file mode 100644
index 0000000..7d8950f
--- /dev/null
+++ b/templates/login.tpl
@@ -0,0 +1,23 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/login.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+
+<div class="display login">
+ <div class="header">
+ <h1>{tr}Login Page{/tr}</h1>
+ </div>
+
+ <div class="body">
+
+ {include file=bitpackage:users/login_inc.tpl}
+
+ {box}
+ <ul>
+ {if $forgotPass eq 'y'}
+ <li><a href="{$gBitLoc.USERS_PKG_URL}remind_password.php">{tr}Click here to retrieve your password.{/tr}</a></li>
+ {/if}
+ {if $allowRegister eq 'y'}
+ <li><a href="{$gBitLoc.USERS_PKG_URL}register.php">{tr}Click here to register with us.{/tr}</a></li>
+ {/if}
+ </ul>
+ {/box}
+ </div><!-- end .body -->
+</div><!-- end .login -->
diff --git a/templates/login_inc.tpl b/templates/login_inc.tpl
new file mode 100644
index 0000000..eb9be3d
--- /dev/null
+++ b/templates/login_inc.tpl
@@ -0,0 +1,98 @@
+{strip}
+<form name="loginbox" action="{$gBitLoc.USERS_PKG_URL}validate.php" method="post" {if $gBitSystemPrefs.feature_challenge eq 'y'}onsubmit="doChallengeResponse()"{/if}>
+ {if $gBitSystemPrefs.feature_challenge eq 'y'}
+ {literal}
+ <script language="javascript" type="text/javascript" src="lib/md5.js"></script>
+ <script language="Javascript" type="text/javascript">
+ <!--
+ function doChallengeResponse() {
+ hashstr = document.loginbox.user.value +
+ document.loginbox.pass.value +
+ document.loginbox.email.value;
+ str = document.loginbox.user.value +
+ MD5(hashstr) +
+ document.loginbox.challenge.value;
+ document.loginbox.response.value = MD5(str);
+ document.loginbox.pass.value='';
+ /*
+ document.login.password.value = "";
+ document.logintrue.username.value = document.login.username.value;
+ document.logintrue.response.value = MD5(str);
+ document.logintrue.submit();
+ */
+ document.loginbox.submit();
+ return false;
+ }
+ // -->
+ </script>
+ {/literal}
+ <input type="hidden" name="challenge" value="{$challenge|escape}" />
+ <input type="hidden" name="response" value="" />
+ {/if}
+
+ {legend legend="Sign in with your username or email to continue"}
+ <div class="row">
+ {formfeedback error="$error"}
+ {formlabel label="Username or Email" for="user"}
+ {forminput}
+ <input type="text" name="user" id="user" size="25" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ {if $gBitSystemPrefs.feature_challenge eq 'y'}
+ <div class="row">
+ {formlabel label="email" for="email"}
+ {forminput}
+ <input type="text" name="email" id="email" size="25" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {formlabel label="Password" for="pass"}
+ {forminput}
+ <input type="password" name="pass" id="pass" size="25" />
+ {/forminput}
+ </div>
+
+ {if $gBitSystem->isFeatureActive('rememberme')}
+ <div class="row">
+ {formlabel label="Remember me" for="rme"}
+ {forminput}
+ <input type="checkbox" name="rme" id="rme" value="on" checked=checked/>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $http_login_url ne '' or $https_login_url ne ''}
+ <div class="row">
+ {formlabel label="" for=""}
+ {forminput}
+ <a href="{$http_login_url}" title="{tr}Click here to login using the default security protocol{/tr}">{tr}standard{/tr}</a> |
+ <a href="{$https_login_url}" title="{tr}Click here to login using a secure protocol{/tr}">{tr}secure{/tr}</a>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $show_stay_in_ssl_mode eq 'y'}
+ <div class="row">
+ {formlabel label="stay in ssl mode" for="stay_in_ssl_mode"}
+ {forminput}
+ <input type="checkbox" name="stay_in_ssl_mode" id="stay_in_ssl_mode" {if $stay_in_ssl_mode eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {else}
+ <input type="hidden" name="stay_in_ssl_mode" value="{$stay_in_ssl_mode|escape}" />
+ {/if}
+
+ <div class="row submit">
+ <input type="submit" name="login" value="{tr}Log in to {$siteName|default:"this site"}{/tr}" />
+ </div>
+ {/legend}
+</form>
+{/strip}
diff --git a/templates/menu_users.tpl b/templates/menu_users.tpl
new file mode 100644
index 0000000..b6b2859
--- /dev/null
+++ b/templates/menu_users.tpl
@@ -0,0 +1,64 @@
+{strip}
+<ul>
+ {if $gBitUser->isRegistered()}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}my.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}My {$siteTitle|default:Site}{/tr}</a></li>
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}index.php?home={$gBitUser->mInfo.login}">{biticon ipackage=users iname=home iexplain="Home" iforce=icon} {tr}View My Homepage{/tr}</a></li>
+ {if $gBitSystem->isPackageActive( 'wiki' )}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}edit_personal_page.php">{biticon ipackage=liberty iname=edit iforce=icon} {tr}Edit My Homepage{/tr}</a></li>
+ {/if}
+ <li><a class="item" href="{$gBitLoc.LIBERTY_PKG_URL}list_content.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}All available Content{/tr}</a></li>
+ {if $gBitSystemPrefs.feature_user_layout eq 'h'}
+ {assign var="myLayoutConfig" value="My Homepage"}
+ {else if $gBitSystemPrefs.feature_user_layout eq 'y'}
+ {assign var="myLayoutConfig" value="My Site Layout"}
+ {/if}
+ {if $gBitSystemPrefs.feature_user_layout eq 'y' or $gBitSystemPrefs.feature_user_layout eq 'h'
+ or $gBitSystemPrefs.feature_user_theme eq 'y' || $gBitSystemPrefs.feature_user_theme eq 'h' }
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}assigned_modules.php">{biticon ipackage=liberty iname=config iexplain=Configure iforce=icon} {tr}Configure {$myLayoutConfig}{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.feature_userPreferences eq 'y'}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}preferences.php">{biticon ipackage=liberty iname=settings iexplain=Preferences iforce=icon} {tr}Preferences{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.feature_user_bookmarks eq 'y' and $gBitUser->hasPermission( 'bit_p_create_bookmarks' )}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Bookmarks{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.package_messages eq 'y' and $gBitUser->hasPermission( 'bit_p_messages' )}
+ <li><a class="item" href="{$gBitLoc.MESSU_PKG_URL}message_box.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Messages{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.package_minical eq 'y'}
+ <li><a class="item" href="{$gBitLoc.MINICAL_PKG_URL}index.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Mini calendar{/tr}</a></li>
+ {/if}
+ {if $gBitUser->isRegistered() && $gBitSystem->isPackageActive('gatekeeper')}
+ <li><a class="item" href="{$gBitLoc.GATEKEEPER_PKG_URL}">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Security{/tr}</a></li>
+ {/if}
+ {if $gBitSystem->isPackageActive( 'quota' )}
+ <li><a class="item" href="{$gBitLoc.QUOTA_PKG_URL}">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}My Quota and Usage{/tr}</a></li>
+ {/if}
+ {if $gBitSystem->isFeatureActive('feature_user_watches') }
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}watches.php">{biticon ipackage=users iname=watch iexplain="My Watches" iforce=icon} {tr}My watches{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.package_newsreader eq 'y' and $gBitUser->hasPermission( 'bit_p_newsreader' )}
+ <li><a class="item" href="{$gBitLoc.NEWSREADER_PKG_URL}index.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Newsreader{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.package_notepad eq 'y' and $gBitUser->hasPermission( 'bit_p_notepad' )}
+ <li><a class="item" href="{$gBitLoc.NOTEPAD_PKG_URL}index.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Notepad{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.feature_tasks eq 'y' and $gBitUser->hasPermission( 'bit_p_tasks' )}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}tasks.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Tasks{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.feature_usermenu eq 'y'}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}menu.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}User menu{/tr}</a></li>
+ {/if}
+ {if $gBitSystemPrefs.package_webmail eq 'y' and $gBitUser->hasPermission( 'bit_p_use_webmail' )}
+ <li><a class="item" href="{$gBitLoc.WEBMAIL_PKG_URL}index.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Webmail{/tr}</a></li>
+ {/if}
+ {if $gBitSystem->isPackageActive( 'messu' )}
+ <li><a class="item" href="{$gBitLoc.MESSU_PKG_URL}message_box.php">{biticon ipackage=messu iname=recieve_mail iforce=icon} {tr}Message Box{/tr} {if $unreadMsgs}<strong>[ {$unreadMsgs} ]</strong>{/if}</a></li>
+ <li><a class="item" href="{$gBitLoc.MESSU_PKG_URL}compose.php">{biticon ipackage=messu iname=send_mail iforce=icon} {tr}Compose Message{/tr}</a></li>
+ {/if}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}my_groups.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}My User Groups{/tr}</a></li>
+ {else}
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}login.php">{biticon ipackage=liberty iname=spacer iforce=icon} {tr}Login{/tr}</a></li>
+ {/if}
+</ul>
+{/strip}
diff --git a/templates/menu_users_admin.tpl b/templates/menu_users_admin.tpl
new file mode 100644
index 0000000..0c8841b
--- /dev/null
+++ b/templates/menu_users_admin.tpl
@@ -0,0 +1,8 @@
+{strip}
+<ul>
+ <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=users">{tr}Users Settings{/tr}</a></li>
+ <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=login">{tr}Login Settings{/tr}</a></li>
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}admin/index.php">{tr}Edit Users{/tr}</a></li>
+ <li><a class="item" href="{$gBitLoc.USERS_PKG_URL}admin/edit_group.php">{tr}Groups &amp; Permissions{/tr}</a></li>
+</ul>
+{/strip}
diff --git a/templates/my_bitweaver.tpl b/templates/my_bitweaver.tpl
new file mode 100644
index 0000000..2340dca
--- /dev/null
+++ b/templates/my_bitweaver.tpl
@@ -0,0 +1,84 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/my_bitweaver.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+
+<div class="floaticon">{bithelp}</div>
+<div class="display my">
+ <div class="header">
+ <h1>{tr}My {$siteTitle|default:'Site'}{/tr}</h1>
+ </div>
+
+ {*include file="bitpackage:users/my_bitweaver_bar.tpl"*}
+
+ <div class="body">
+
+{*
+ this is where we should add the following tabs:
+ file manager
+ quota manager - currently on seperate page, but i believe this would be good in here.
+ listing of submitted / edited stuff - similar to the old tiki personal tiki stuff.
+*}
+
+ {jstabs}
+ {jstab title="My Navigation Pane"}
+ <table width="100%" class="menutable">
+ <tr>
+ {assign var="i" value="1"}
+ {foreach key=key item=menu from=$appMenu}
+ {if $menu.title and $menu.template}
+ <td style="width:33%;vertical-align:top;">
+ {box class="`$key`menu menu box" ipackage=$key iname="pkg_`$key`" iexplain="$key" idiv="menuicon" title="`$gBitSystem->mPackages.$key.dir`"}
+ {include file=$menu.template}
+ {/box}
+ </td>
+ {if not ($i++ mod 3)}
+ </tr><tr>
+ {/if}
+ {/if}
+ {/foreach}
+ </tr>
+ </table>
+ {/jstab}
+
+ {jstab title="My Information"}
+ {legend legend="User Information"}
+ {include file="bitpackage:users/user_information_inc.tpl" userData=$gBitUser}
+
+ {if $gBitUser->mInfo.avatar_url}
+ <div class="row">
+ {formlabel label="Avatar"}
+ {forminput}
+ <img src="{$gBitUser->mInfo.avatar_url}" alt="{tr}avatar{/tr}" />
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $gBitUser->mInfo.portrait_url}
+ <div class="row">
+ {formlabel label="Portrait"}
+ {forminput}
+ <img src="{$gBitUser->mInfo.portrait_url}" alt="{tr}portrait{/tr}" />
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $gBitUser->mInfo.logo_url}
+ <div class="row">
+ {formlabel label="Logo"}
+ {forminput}
+ <img src="{$gBitUser->mInfo.logo_url}" alt="{tr}logo{/tr}" />
+ {/forminput}
+ </div>
+ {/if}
+
+ {formhelp note="If you wish to change any of this information, please visit your personal preferences page" link="users/preferences.php/Personal Preferences"}
+ {/legend}
+ {/jstab}
+
+ {jstab title="My Content"}
+ {include file="bitpackage:liberty/list_content_inc.tpl"}
+ {/jstab}
+ {/jstabs}
+ </div><!-- end .body -->
+</div><!-- end .my -->
+
+{/strip}
diff --git a/templates/my_bitweaver_bar.tpl b/templates/my_bitweaver_bar.tpl
new file mode 100644
index 0000000..ac2aa65
--- /dev/null
+++ b/templates/my_bitweaver_bar.tpl
@@ -0,0 +1,70 @@
+{*
+<table>
+<tr>
+
+{if $user}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}index.php?home={$user}" title="{tr}My homepage{/tr}">
+{biticon ipackage="users" iname="my_homepage" iexplain="My homepage"}</a></td>
+{/if}
+
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}my.php" title="{tr}MyTiki{/tr}">
+{biticon ipackage="users" iname="my_bitweaver" iexplain="MyTiki"}</a></td>
+
+{if $gBitSystemPrefs.feature_userPreferences eq 'y'}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}preferences.php" title="{tr}Preferences{/tr}">
+{biticon ipackage="users" iname="my_prefs" iexplain="Preferences"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_messages eq 'y' and $gBitUser->hasPermission( 'bit_p_messages' )}
+<td valign="top" align="center"><a href="{$gBitLoc.MESSU_PKG_URL}message_box.php" title="{tr}Messages{/tr}">
+{biticon ipackage="users" iname="my_messages" iexplain="Messages"}<div align="center"><small>{$unreadMsgs}</small></div></a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_tasks eq 'y' and $gBitUser->hasPermission( 'bit_p_tasks' )}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}tasks.php" title="{tr}Tasks{/tr}">
+{biticon ipackage="users" iname="my_tasks" iexplain="Tasks"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_user_bookmarks eq 'y' and $gBitUser->hasPermission( 'bit_p_create_bookmarks' )}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}bookmarks.php" title="{tr}Bookmarks{/tr}">
+{biticon ipackage="users" iname="my_bookmarks" iexplain="Bookmarks"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_user_layout eq 'y' and $gBitUser->hasPermission( 'bit_p_configure_modules' )}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}assigned_modules.php" title="{tr}Modules{/tr}">
+{biticon ipackage="users" iname="my_modules" iexplain="Modules"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_newsreader eq 'y' and $gBitUser->hasPermission( 'bit_p_newsreader' )}
+<td valign="top" align="center"><a href="{$gBitLoc.NEWSREADER_PKG_URL}index.php" title="{tr}Newsreader{/tr}">
+{biticon ipackage="users" iname="my_news" iexplain="Newsreader"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_webmail eq 'y' and $gBitUser->hasPermission( 'bit_p_use_webmail' )}
+<td valign="top" align="center"><a href="{$gBitLoc.WEBMAIL_PKG_URL}index.php" title="{tr}Webmail{/tr}">
+{biticon ipackage="users" iname="my_webmail" iexplain="Webmail"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.package_notepad eq 'y' and $gBitUser->hasPermission( 'bit_p_notepad' )}
+<td valign="top" align="center"><a href="{$gBitLoc.NOTEPAD_PKG_URL}index.php" title="{tr}Notepad{/tr}">
+{biticon ipackage="users" iname="my_notes" iexplain="Notepad"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_userfiles eq 'y' and $gBitUser->hasPermission( 'bit_p_userfiles' )}
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}files.php" title="{tr}MyFiles{/tr}">
+{biticon ipackage="users" iname="my_files" iexplain="My Files"}</a></td>
+{/if}
+
+{if $gBitSystemPrefs.feature_minical eq 'y'}
+<td valign="top" align="center"><a href="{$gBitLoc.MINICAL_PKG_URL}index.php" title="{tr}Mini Calendar{/tr}">
+{biticon ipackage="users" iname="my_minical" iexplain="Mini Calendar"}</a></td>
+{/if}
+
+{if $gBitSystem->isFeatureActive('feature_user_watches') }
+<td valign="top" align="center"><a href="{$gBitLoc.USERS_PKG_URL}watches.php" title="{tr}My watches{/tr}">
+{biticon ipackage="users" iname="my_watches" iexplain="My watches"}</a></td>
+{/if}
+
+</tr>
+</table>
+*}
diff --git a/templates/my_files.tpl b/templates/my_files.tpl
new file mode 100644
index 0000000..2bba10e
--- /dev/null
+++ b/templates/my_files.tpl
@@ -0,0 +1,39 @@
+{literal}
+<script type="text/javascript">
+function confirmDelete(fileName, location) {
+ if (confirm("Are you sure you want to delete " + fileName + "? It will be removed from all content it is attached to.")) {
+ document.location = location;
+ }
+}
+</script>
+{/literal}
+
+<div class="admin userfiles">
+<div class="header">
+ <h1>{tr}My Files{/tr}</h1>
+</div>
+
+<div class="body">
+<div class="help box">
+ <div class="boxcontent">
+ {tr}These are all files you have uploaded{/tr}
+ </div>
+</div>
+{if $numUserFiles < 1}No files found{/if}
+
+<table class="panel">
+ <tr><th>Thumbnail</th><th>Attachment Tag</th><th>Actions</th></tr>
+ {foreach from=$userFiles item=userFile}
+ <tr>
+ <td><a href="{$userFile.source_url}"><img src="{$userFile.thumbnail_url.small}"/></a></td>
+ <td>{$userFile.wiki_plugin_link}</td>
+ <td><a href="javascript:confirmDelete('{$userFile.filename}','{$gBitLoc.USERS_PKG_URL}my_files.php?deleteAttachment={$userFile.attachment_id}')">{biticon ipackage="liberty" iname="delete" iexplain="Delete"}</a></td>
+ </tr>
+ <tr><td colspan="3">{$userFile.filename}</td></tr>
+ <tr><td colspan="3">&nbsp;</td></tr>
+ {/foreach}
+</table>
+<h2>Total Disk Usage: {$diskUsage} bytes</h2>
+</div>
+
+</div>
diff --git a/templates/my_group_edit.tpl b/templates/my_group_edit.tpl
new file mode 100644
index 0000000..df7cdb5
--- /dev/null
+++ b/templates/my_group_edit.tpl
@@ -0,0 +1,224 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/my_group_edit.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+
+<div class="floaticon">
+ <a href="{$gBitLoc.USERS_PKG_URL}my_groups.php">{tr}&laquo; Group List{/tr}</a>
+ {bithelp}
+</div>
+
+<div class="admin groups">
+ <div class="header">
+ <h1>{if $groupInfo.group_name}{tr}Administer Group{/tr}: {$groupInfo.group_name}{else}{tr}Create New Group{/tr}{/if}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback success=$successMsg error=$errorMsg}
+
+ {jstabs}
+ {jstab title="Edit Group"}
+ {form legend="Add or Edit a Group"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <div class="row">
+ {formlabel label="Group" for="groups_group"}
+ {forminput}
+ <input type="text" name="name" id="groups_group" value="{$groupInfo.group_name}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Description" for="group_desc"}
+ {forminput}
+ <textarea rows="5" cols="20" name="desc" id="group_desc">{$groupInfo.group_desc}</textarea>
+ {/forminput}
+ </div>
+
+ {if $groups && $gBitUser->hasPermission( 'bit_p_user_group_subgroups' )}
+ <div class="row">
+ {formlabel label="Include" for="groups_inc"}
+ {forminput}
+ <select name="include_groups[]" id="groups_inc" multiple="multiple" size="4">
+ {foreach from=$groups key=groupId item=group}
+ {if $groupId != $groupInfo.group_id}
+ <option value="{$groupId}" {if $group.included eq 'y'} selected="selected"{/if}>{$group.group_name}</option>
+ {/if}
+ {/foreach}
+ </select>
+ {formhelp note="If you include a group, this group will inherit all permissions of the included group."}
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row submit">
+ <input type="submit" name="cancel" value="{tr}Cancel{/tr}" />&nbsp;
+ <input type="submit" name="save" value="{tr}Save Group{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {if $gBitUser->hasPermission( 'bit_p_user_group_members' )}
+ {jstab title="Members"}
+ <ul>
+ {foreach from=$groupUsers key=userId item=userHash}
+ <li>{displayname hash=$userHash}</li>
+ {foreachelse}
+ <li><strong>{tr}none{/tr}</strong> - {tr}You are the only user.{/tr}</li>
+ {/foreach}
+ </ul>
+
+ <div>
+ {form legend="User Search"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="tab" value="members" />
+ <div class="row">
+ {formlabel label="Username" for="username"}
+ {forminput}
+ <input type="text" id="username" name="find" value="{$find}"/>
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="submitUserSearch" value="Search"/>
+ </div>
+ {/form}
+ </div>
+
+ {if $foundUsers}
+ <table>
+ <caption>{tr}Search Results{/tr}</caption>
+ <tr>
+ <th>{tr}Username{/tr}</th>
+ <th>{tr}Real Name{/tr}</th>
+ <th>{tr}User Id{/tr}</th>
+ <th>{tr}Actions{/tr}</th>
+ </tr>
+ {section name=ix loop=$foundUsers}
+ <tr class="{cycle values='odd,even'}">
+ <td>{$foundUsers[ix].login}</td>
+ <td>{$foundUsers[ix].real_name}</td>
+ <td>{$foundUsers[ix].user_id}</td>
+ <td class="actionicon">{smartlink ititle="Select User" group_id=`$groupInfo.group_id` assignuser=`$foundUsers[ix].user_id`}</td>
+ </tr>
+ {/section}
+ </table>
+ {/if}
+ {/jstab}
+ {/if}
+
+ {if $gBitUser->hasPermission( 'bit_p_user_group_perms' )}
+ {if $groupInfo.group_id}
+ {jstab title="Permissions"}
+ {form legend="Permissions currently assigned to `$groupInfo.group_name`"}
+ <table class="data">
+ <tr>
+ <th>{tr}Permission{/tr}</th>
+ <th>{tr}Description{/tr}</th>
+ </tr>
+ {foreach from=$groupInfo.perms key=permName item=perm}
+ <tr class="{cycle values="odd,even"}">
+ <td>
+ {smartlink ititle="Remove" ibiticon="liberty/delete_small" package=$package group_id=$groupInfo.group_id action=remove permission=$permName}
+ &nbsp;{$permName}
+ </td>
+ <td>{$perm.perm_desc}</td>
+ </tr>
+ {/foreach}
+ </table>
+ {/form}
+ {/jstab}
+
+ {jstab title="Assign Permissions"}
+ {form legend="Assign permissions and / or set level"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+ <input type="hidden" name="tab" value="assign" />
+ <input type="hidden" name="perm_name[{$perms[user].perm_name}]" />
+
+ <div class="row">
+ {formlabel label="Display permissions of package"}
+ {forminput}
+ {smartlink ititle="All packages" group_id=$groupInfo.group_id}
+ {foreach from=$gBitSystem->mPackages key=packageKey item=packageItem}
+ {if $packageItem.installed and $packageItem.defaults}
+ &nbsp;&bull; {smartlink ititle=$gBitSystem->mPackages.$packageKey.name group_id=$groupInfo.group_id package=$packageKey}
+ {/if}
+ {/foreach}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ <table class="data">
+ <tr>
+ <th>&nbsp;</th>
+ <th>{smartlink ititle="Name" isort=perm_name group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ <th>{tr}Level{/tr}</th>
+ <th>{smartlink ititle="Package" isort=package group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ <th>{smartlink ititle="Description" isort=perm_desc group_id=$groupInfo.group_id offset=$offset package=$package}</th>
+ <th>&nbsp;</th>
+ </tr>
+ {foreach key=permName item=perm from=$allPerms}
+ {if $package eq $perm.package or $package eq 'all'}
+ <tr class="{cycle values="even,odd"}">
+ <td><input type="checkbox" id="{$permName}" name="perm[{$permName}]"{if $groupInfo.perms.$permName} checked="checked"{/if} /></td>
+ <td><label for="{$permName}">{$permName}</label></td>
+ <td><select name="level[{$permName}]">{html_options output=$levels values=$levels selected=$perm.level}</select></td>
+ <td>{tr}{$perm.package}{/tr}</td>
+ <td>{tr}{$perm.perm_desc}{/tr}</td>
+ </tr>
+ {/if}
+ {/foreach}
+ </table>
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="updateperms" value="{tr}Update{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Batch Assign"}
+ {form legend="Batch assign permissions"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+
+ <div class="row">
+ <select name="oper">
+ <option value="assign">{tr}assign{/tr}</option>
+ <option value="remove">{tr}remove{/tr}</option>
+ </select>
+ {tr}all permissions in level{/tr}
+ <select name="level">
+ {html_options output=$levels values=$levels selected=$perms[user].level}
+ </select>
+ {tr}to {$groupInfo.group_name}{/tr}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="allper" value="{tr}Update{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Create Level"}
+ {form legend="Create a new level"}
+ <input type="hidden" name="group_id" value="{$groupInfo.group_id}" />
+ <input type="hidden" name="package" value="{$package|escape}" />
+ <div class="row">
+ {formlabel label="Level" for="level"}
+ {forminput}
+ <input type="text" name="level" id="level" />
+ {formhelp note="Levels can be used to group certain permissions and thus easily assign a set of permissions to a group. Assinging a permission to a level has no outcome on the users or groups. It's merely a way to organise permissions."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="createlevel" value="{tr}Create{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+ {/if}
+ {/if}
+ {/jstabs}
+ </div><!-- end .body -->
+</div><!-- end .users -->
+
+{/strip}
diff --git a/templates/my_groups_list.tpl b/templates/my_groups_list.tpl
new file mode 100644
index 0000000..b8b3f9e
--- /dev/null
+++ b/templates/my_groups_list.tpl
@@ -0,0 +1,75 @@
+<div class="admin users">
+ <div class="header">
+ <h1>{tr}List of existing groups{/tr}</h1>
+ </div>
+
+ <div class="body">
+ {formfeedback success=$successMsg error=$errorMsg}
+
+ <a href="{$gBitLoc.USERS_PKG_URL}my_groups.php?action=create">{tr}Add new group{/tr}</a>
+
+ <table class="data">
+ <tr>
+ <th>
+ <a href="{$gBitLoc.USERS_PKG_URL}my_groups.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'group_name_desc'}group_name_asc{else}group_name_desc{/if}">{tr}Name{/tr}</a>, &amp;
+ {tr}Description{/tr}</a>
+ </th>
+ {if $gBitUser->hasPermission( 'bit_p_user_group_members' )}
+ <th>{tr}Members{/tr}</th>
+ {/if}
+ {if $gBitUser->hasPermission( 'bit_p_user_group_perms' )}
+ <th>{tr}Permissions{/tr}</th>
+ {/if}
+ <th>{tr}Action{/tr}</th>
+ </tr>
+
+ {foreach from=$groups key=groupId item=group}
+ <tr class="{cycle values="odd,even"}">
+ <td>
+ <strong>{$group.group_name}</strong>{if $group.is_default eq 'y'}<em class="warning"> *{tr}Default group{/tr}*</em>{/if}<br />
+ {$group.group_desc}<br />
+ {if $group.group_home}{tr}Home Page{/tr}:<strong> {$group.group_home}</strong><br />{/if}
+ {if $group.included}
+ {tr}Included Groups{/tr}
+ <ul>
+ {foreach from=$group.included key=incGroupId item=incGroupName}
+ <li>{$incGroupName}</li>
+ {/foreach}
+ </ul>
+ {/if}
+ </td>
+
+ {if $gBitUser->hasPermission( 'bit_p_user_group_members' )}
+ <td>
+ {foreach from=$groupUsers key=userId item=user}
+ &nbsp;{displayname hash=$user}<br />
+ {foreachelse}
+ <strong>{tr}none{/tr}</strong>
+ {/foreach}
+ </td>
+ {/if}
+
+ {if $gBitUser->hasPermission( 'bit_p_user_group_perms' )}
+ <td>
+ {foreach from=$group.perms key=permName item=perm}
+ &nbsp;{$perm.perm_desc}<br />
+ {foreachelse}
+ <strong>{tr}none{/tr}</strong>
+ {/foreach}
+ </td>
+ {/if}
+
+ <td class="actionicon">
+ <a href="{$gBitLoc.USERS_PKG_URL}my_groups.php?group_id={$groupId}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
+ {if $groupId ne -1}{* sorry for hardcoding, really need php define ANONYMOUS_GROUP_ID - spiderr *}
+ <a href="{$gBitLoc.USERS_PKG_URL}my_groups.php?offset={$offset}&amp;sort_mode={$sort_mode}&amp;action=delete&amp;group_id={$groupId}"
+ onclick="return confirmTheLink(this,'{tr}Are you sure you want to delete this group?{/tr}')">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a>
+ {/if}
+ </td>
+ </tr>
+ {/foreach}
+ </table>
+
+ {pagination}
+ </div><!-- end .body -->
+</div><!-- end .users -->
diff --git a/templates/my_images.tpl b/templates/my_images.tpl
new file mode 100644
index 0000000..21442f3
--- /dev/null
+++ b/templates/my_images.tpl
@@ -0,0 +1,89 @@
+<div class="admin userimages">
+ <div class="header">
+ <h1>{tr}Upload Your Images{/tr}</h1>
+ </div>
+
+ {formfeedback error=$errorMsg success=$successMsg}
+
+ {include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+ <div class="body">
+ {form enctype="multipart/form-data" method="post" legend="Upload personal Portrait, Avatar and Logo"}
+ {if $fHomepage}
+ <input type="hidden" name="fHomepage" value="{$fHomepage}"/>
+ {/if}
+ <div class="row">
+ {formlabel label="Self Portrait" for="fPortraitFile"}
+ {if $gBitUser->mInfo.portrait_url}
+ {forminput}
+ <img src="{$gQueryUser->minfo.portrait_url}?{php}print time();{/php}" alt="{tr}self portrait{/tr}" /><br />
+ <input type="submit" value="{tr}delete self portrait{/tr}" name="fSubmitDeletePortait" id="fSubmitDeletePortait"/>
+ {/forminput}
+ {/if}
+ {forminput}
+ <input name="fPortraitFile" id="fPortraitFile" type="file" />
+ {formhelp note="Upload a personal photo to be displayed on your `$siteTitle` homepage."}
+ {/forminput}
+ </div>
+
+ <div class="row" id="avatarfilerow">
+ {formlabel label="Upload Avatar" for="avatarfile"}
+ {forminput}
+ <input name="fAvatarFile" type="file" id="avatarfile" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Avatar" for="fAutoAvatar"}
+ {if $gQueryUser->mInfo.avatar_url}
+ {forminput}
+ <img src="{$gQueryUser->mInfo.avatar_url}?{php}print time();{/php}" alt="{tr}avatar{/tr}" /><br />
+ <input type="submit" value="{tr}delete avatar{/tr}" name="fSubmitDeleteAvatar" />
+ {/forminput}
+ {/if}
+ {forminput}
+ <label>{tr}Create avatar automatically from self portrait{/tr}&nbsp;
+ <input type="checkbox" name="fAutoAvatar" checked="checked" id="fAutoAvatar" onclick="showHideAvatar(this.form );" /></label>
+ {formhelp note="Upload a small image or icon to be displayed next to your name on your forum and blog postings."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Logo" for="fLogoFile"}
+ {if $gBitUser->mInfo.logo_url}
+ {forminput}
+ <img src="{$gQueryUser->mInfo.logo_url}?{php}print time();{/php}" alt="{tr}logo{/tr}" /><br />
+ <input type="submit" value="{tr}delete logo{/tr}" id="fSubmitDeleteLogo" name="fSubmitDeleteLogo" />
+ {/forminput}
+ {/if}
+ {forminput}
+ <input name="fLogoFile" id="fLogoFile" type="file" />
+ {formhelp note="Upload an image that will be shown on your personal page. This could possibly be a corporate image."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="fSubmitBio" value="{tr}Save Changes{/tr}" />
+ </div>
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .userimages -->
+
+{* this javascript MUST go after the picform above! xoxo spider *}
+{literal}
+<script type='text/javascript'>
+<!--
+ function showHideAvatar() {
+ var viz;
+ if( document.getElementById( "fAutoAvatar" ).checked ) {
+ vis = "hidden";
+ } else {
+ vis = "visible";
+ }
+ document.getElementById( "avatarfilerow" ).style.visibility = vis;
+ }
+ showHideAvatar();
+-->
+</script>
+{/literal}
diff --git a/templates/new_user_notification.tpl b/templates/new_user_notification.tpl
new file mode 100644
index 0000000..1c3bfed
--- /dev/null
+++ b/templates/new_user_notification.tpl
@@ -0,0 +1,3 @@
+{tr}The user{/tr} {$mail_user} {tr}registered at your site{/tr} {$mail_site}
+{tr}at{/tr}: {$mail_date|bit_short_datetime}
+ \ No newline at end of file
diff --git a/templates/password_reminder.tpl b/templates/password_reminder.tpl
new file mode 100644
index 0000000..8ad70c8
--- /dev/null
+++ b/templates/password_reminder.tpl
@@ -0,0 +1,5 @@
+{tr}Hi{/tr}, {$mail_user}
+
+{tr}someone from{/tr} {$mail_site} {tr}requested a reminder of the password for the account{/tr} {$mail_user}.
+
+{tr}Since this is your registered email address we inform that the password for this account is:{/tr} {$mail_pass}
diff --git a/templates/register.tpl b/templates/register.tpl
new file mode 100644
index 0000000..f9ff0ee
--- /dev/null
+++ b/templates/register.tpl
@@ -0,0 +1,126 @@
+{strip}
+
+<div class="display login">
+ <div class="header">
+ <h1>{tr}Register as a new user{/tr}</h1>
+ {if $showmsg eq 'y'}<h2>{$msg}</h2>{/if}
+ </div>
+
+ <div class="body">
+ <p>{tr}If you are already registered, please{/tr} <a href="{$gBitLoc.USERS_PKG_URL}login.php">{tr}login{/tr}</a></p>
+ {form legend="Please fill in the following details"}
+ {if $notrecognized eq 'y'}
+ <input type="hidden" name="REG[login]" value="{$reg.login}"/>
+ <input type="hidden" name="REG[password]" value="{$reg.password}"/>
+ <input type="hidden" name="REG[novalidation]" value="yes"/>
+
+ <div class="row">
+ {formfeedback error=$errors.validate}
+ {formlabel label="Username" for="email"}
+ {forminput}
+ <input type="text" name="REG[email]" id="email" value="{$reg.email}"/>
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="REG[register]" value="{tr}register{/tr}" />
+ </div>
+ {elseif $showmsg ne 'y'}
+ {if $gBitSystem->mPrefs.rnd_num_reg eq 'y'}
+ <div class="row">
+ {formfeedback error=$errors.rnd_num_reg}
+ {formlabel label="Your registration code"}
+ {forminput}
+ <img src="{$gBitLoc.USERS_PKG_URL}random_num_img.php" alt="{tr}Random Image{/tr}"/>
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Registration code" for="regcode"}
+ {forminput}
+ <input type="text" maxlength="8" size="8" name="REG[regcode]" id="regcode" />
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {formlabel label="Real name" for="real_name"}
+ {forminput}
+ <input type="text" name="REG[real_name]" id="real_name" value="{$reg.real_name}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formfeedback error=$errors.login}
+ {formlabel label="Username" for="login"}
+ {forminput}
+ <input type="text" name="REG[login]" id="login" value="{$reg.login}" />
+ {formhelp note="Your username can only contain numbers, characters, and underscores."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formfeedback error=$errors.email}
+ {formlabel label="Email" for="email"}
+ {forminput}
+ <input type="text" name="REG[email]" id="email" value="{$reg.email}" />
+ {/forminput}
+ </div>
+
+ {if $gBitSystem->mPrefs.useRegisterPasscode eq 'y'}
+ <div class="row">
+ {formfeedback error=$errors.passcode}
+ {formlabel label="Passcode to register<br />(not your user password)" for="passcode"}
+ {forminput}
+ <input type="password" name="REG[passcode]" id="passcode" />
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $gBitSystem->isFeatureActive( 'validateUsers' )}
+ <div class="row">
+ {formfeedback warning="A confirmation email will be sent to you with instructions how to login"}
+ </div>
+ {else}
+ <div class="row">
+ {formfeedback error=$errors.password}
+ {formlabel label="Password" for="pass"}
+ {forminput}
+ <input id="pass1" type="password" name="REG[password]" value="{$reg.password}" />
+ {/forminput}
+ </div>
+ <div class="row">
+ {formlabel label="Repeat password" for="password2"}
+ {forminput}
+ <input id="password2" type="password" name="REG[password2]" />
+ {/forminput}
+ </div>
+ {if $gBitSystem->isFeatureActive( 'user_password_generator' )}
+ <div class="row">
+ {formlabel label="<a href=\"javascript:genPass('genepass','pass1','pass2');\">{tr}Generate a password{/tr}</a>" for="email"}
+ {forminput}
+ <input id="genepass" type="text" />
+ {formhelp note="You can use this link to create a random password. Make sure you make a note of it somewhere to log in to this site in the future."}
+ {/forminput}
+ </div>
+ {/if}
+ {/if}
+
+ {section name=f loop=$customFields}
+ <div class="row">
+ {formlabel label="$customFields[f]}
+ {forminput}
+ <input type="text" name="CUSTOM[{$customFields[f]|escape}]" />
+ {/forminput}
+ </div>
+ {/section}
+
+ <div class="row submit">
+ <input type="submit" name="register" value="{tr}register{/tr}" />
+ </div>
+ {/if}
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .login -->
+
+{/strip}
diff --git a/templates/remind_password.tpl b/templates/remind_password.tpl
new file mode 100644
index 0000000..8e4a691
--- /dev/null
+++ b/templates/remind_password.tpl
@@ -0,0 +1,29 @@
+{strip}
+
+<div class="display login">
+ <div class="header">
+ <h1>{tr}Retrieve Password{/tr}</h1>
+ </div>
+
+ <div class="body">
+ {if $msg.success}
+ {formfeedback success=$msg.success}
+ {else}
+ {form legend="Please send me my password"}
+ <div class="row">
+ {formfeedback warning=$msg.error}
+ {formlabel label="Username" for="username"}
+ {forminput}
+ <input type="text" name="username" id="username" />
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="remind" id="remind" value="{tr}Send me my password{/tr}" />
+ </div>
+ {/form}
+ {/if}
+ </div><!-- end .body -->
+</div><!-- end .login -->
+
+{/strip}
diff --git a/templates/user_activity.tpl b/templates/user_activity.tpl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/templates/user_activity.tpl
diff --git a/templates/user_assigned_modules.tpl b/templates/user_assigned_modules.tpl
new file mode 100644
index 0000000..4f3d462
--- /dev/null
+++ b/templates/user_assigned_modules.tpl
@@ -0,0 +1,347 @@
+{strip}
+<div class="floaticon">{bithelp}</div>
+
+<div class="admin user modules">
+ <div class="header">
+ <h1>{tr}Configure Homepage Layout{/tr}</h1>
+ </div>
+
+ {include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+ <div class="body">
+
+ {if $gBitSystemPrefs.feature_user_layout eq 'y' or $gBitSystemPrefs.feature_user_layout eq 'h'}
+ <table style="width:100%" cellpadding="5" cellspacing="0" border="0">
+ <caption>{tr}Your HomePage Layout{/tr}</caption>
+ <tr>
+ {foreach from=$layoutAreas item=area key=colkey }
+ <td style="width:33%" valign="top">
+ <table class="data" style="width:100%">
+ <caption>{tr}{$colkey} column{/tr}</caption>
+ <tr>
+ <th>{tr}Module{/tr}</th>
+ </tr>
+ {section name=ix loop=$modules.$area}
+ <tr class="{cycle values="even,odd"}">
+ <td>
+ {tr}Position {$modules.$area[ix].ord}{/tr}<br />
+ {$modules.$area[ix].name}
+ <div style="text-align:center;">
+ {smartlink ititle="Up" ibiticon="liberty/move_up" fMove=up fPackage=$fPackage fModule=`$modules.$area[ix].module_id`}
+ {smartlink ititle="Down" ibiticon="liberty/move_down" fMove=down fPackage=$fPackage fModule=`$modules.$area[ix].module_id`}
+ {if $colkey ne 'center'}
+ {smartlink ititle="Move to Right" ibiticon="liberty/move_$colkey" fMove=$colkey fPackage=$fPackage fModule=`$modules.$area[ix].module_id`}
+ {/if}
+ {if $column[ix].type ne 'P'}
+ {smartlink ititle="Unassign" ibiticon="liberty/delete_small" ionclick="return confirm('Are you sure you want to remove `$modules.$area[ix].name`?');" fMove=unassign fPackage=$fPackage fModule=`$modules.$area[ix].module_id`}
+ {/if}
+ </div>
+ </td>
+ </tr>
+ {sectionelse}
+ <tr class="{cycle}" >
+ <td colspan="3" align="center">
+ {if $colkey eq 'center'}{tr}Default{/tr}{else}{tr}None{/tr}{/if}
+ </td>
+ </tr>
+ {/section}
+ </table>
+ </td>
+ {/foreach}
+ </tr>
+ </table>
+ {/if}
+
+ {jstabs}
+ {if $gBitSystemPrefs.feature_user_layout eq 'y' or $gBitSystemPrefs.feature_user_layout eq 'h' and $canassign eq 'y'}
+ {jstab title="Assign Side Piece"}
+ {form legend="Assign Side Piece"}
+ {if $fEdit && $fAssign.name}
+ <input type="hidden" name="assign_name" value="{$fAssign.name}" />{$assign.name}
+ {else}
+ <div class="row">
+ {formlabel label="Module" for="module_rsrc"}
+ {forminput}
+ <select name="fAssign[module_rsrc]">
+ {section name=ix loop=$assignables.border}
+ <option value="{$assignables.border[ix].module_rsrc|escape}">{$assignables.border[ix].name}</option>
+ {sectionelse}
+ <option>{tr}No records found{/tr}</option>
+ {/section}
+ </select>
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {formlabel label="Position" for="pos"}
+ {forminput}
+ <select name="fAssign[pos]" id="pos">
+ <option value="l" {if $fAssign.pos eq 'l'}selected="selected"{/if}>{tr}left column{/tr}</option>
+ <option value="r" {if $fAssign.pos eq 'r'}selected="selected"{/if}>{tr}right column{/tr}</option>
+ </select>
+ {formhelp note="Select the column this module should be displayed in."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Order" for="ord"}
+ {forminput}
+ <select name="fAssign[ord]" id="ord">
+ {section name=ix loop=$orders}
+ <option value="{$orders[ix]|escape}" {if $fAssign.ord eq $orders[ix]}selected="selected"{/if}>{$orders[ix]}</option>
+ {/section}
+ </select>
+ {formhelp note="Select where within the column the module should be displayed."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="fSubmitAssign" value="{tr}Add Module{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Assign center piece"}
+ {form legend="Assign center piece"}
+ <input type="hidden" name="fAssign[pos]" value="c" />
+
+ <div class="row">
+ {formlabel label="Center Piece" for="module"}
+ {forminput}
+ <select name="fAssign[module_rsrc]">
+ {section name=ix loop=$assignables.center}
+ <option value="{$assignables.center[ix].module_rsrc|escape}">{$assignables.center[ix].name}</option>
+ {sectionelse}
+ <option>{tr}No records found{/tr}</option>
+ {/section}
+ </select>
+ {formhelp note="Pick the center bit you want to display when accessing this package."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Position"}
+ {forminput}
+ {tr}Center{/tr}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Order" for="c_ord"}
+ {forminput}
+ <select name="fAssign[ord]" id="c_ord">
+ {section name=ix loop=$orders}
+ <option value="{$orders[ix]|escape}" {if $assign_order eq $orders[ix]}selected="selected"{/if}>{$orders[ix]}</option>
+ {/section}
+ </select>
+ {formhelp note="Select where within the column the module should be displayed."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="fSubmitAssign" value="{tr}Add Module{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Select Theme"}
+ {form legend="Select Theme"}
+ <div class="row">
+ {formlabel label="Theme" for="style"}
+ {forminput}
+ <select name="style" id="style">
+ {section name=ix loop=$styles}
+ <option value="{$styles[ix]|escape}" {if $assignStyle eq $styles[ix]}selected="selected"{/if}>{$styles[ix]}</option>
+ {/section}
+ </select>
+ {formhelp note="Pick the theme for your personal Homepage."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" value="{tr}Apply Theme{/tr}" name="fSubmitSetTheme">
+ </div>
+ {/form}
+ {/jstab}
+ {/if}
+ {/jstabs}
+ </div> {* end .body *}
+</div> {* end .usermodules *}
+
+{/strip}
+
+
+{* old code. left here in case we need something... xing
+for instance, i don't know where the page heading stuff is used.
+
+<table width="100%">
+{if $gBitSystemPrefs.feature_user_layout eq 'y' or $gBitSystemPrefs.feature_user_layout eq 'h'}
+
+{if $canassign eq 'y'}
+<tr>
+ <td valign="top">
+
+<form action="{$gBitLoc.USERS_PKG_URL}assigned_modules.php" method="post">
+<table class="panel">
+<caption>{tr}Assign Left Column{/tr}</caption>
+<tr>
+ <td>{tr}Module{/tr}:</td>
+ <td>
+ <select name="fAssign[module_rsrc]">
+ {section name=ix loop=$assignables.border}
+ <option value="{$assignables.border[ix].module_rsrc|escape}">{$assignables.border[ix].name}</option>
+ {sectionelse}
+ <option>{tr}No records found{/tr}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr>
+ <td>
+{tr}Column{/tr}:</td><td>
+ <input type="hidden" name="fAssign[pos]" value="l" />
+ {tr}left{/tr}
+ </td>
+</tr>
+<tr>
+ <td>{tr}Order{/tr}:</td>
+ <td>
+ <select name="fAssign[ord]">
+ {section name=ix loop=$orders}
+ <option value="{$orders[ix]|escape}">{$orders[ix]}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="fSubmitAssign" value="{tr}assign{/tr}" /></td>
+</tr>
+</table>
+</form>
+
+ </td>
+ <td valign="top">
+
+<form action="{$gBitLoc.USERS_PKG_URL}assigned_modules.php" method="post">
+<table class="panel">
+<caption>{tr}Assign Center Column{/tr}</caption>
+<tr>
+ <td>{tr}Center Piece{/tr}:</td>
+ <td>
+ <select name="fAssign[module_rsrc]">
+ {section name=ix loop=$assignables.center}
+ <option value="{$assignables.center[ix].module_rsrc|escape}">{$assignables.center[ix].name}</option>
+ {sectionelse}
+ <option>{tr}No records found{/tr}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr>
+ <td>{tr}Column{/tr}:</td>
+ <td>{tr}Center{/tr}
+ <input type="hidden" name="fAssign[pos]" value="c" />
+ </td>
+</tr>
+<tr>
+ <td>{tr}Order{/tr}:</td>
+ <td>
+ <select name="fAssign[ord]">
+ {section name=ix loop=$orders}
+ <option value="{$orders[ix]|escape}">{$orders[ix]}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="fSubmitAssign" value="{tr}assign{/tr}" /></td>
+</tr>
+</table>
+</form>
+
+ </td>
+ <td valign="top">
+
+<form action="{$gBitLoc.USERS_PKG_URL}assigned_modules.php" method="post">
+<table class="panel">
+<caption>{tr}Assign Right Column{/tr}</caption>
+<tr>
+ <td>{tr}Module{/tr}:</td>
+ <td>
+ <select name="fAssign[module_rsrc]">
+ {section name=ix loop=$assignables.border}
+ <option value="{$assignables.border[ix].module_rsrc|escape}">{$assignables.border[ix].name}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr>
+ <td>
+{tr}Column{/tr}:</td><td>
+ <input type="hidden" name="fAssign[pos]" value="r" />
+{tr}right{/tr}
+ </td>
+</tr>
+<tr>
+ <td>{tr}Order{/tr}:</td>
+ <td>
+ <select name="fAssign[ord]">
+ {section name=ix loop=$orders}
+ <option value="{$orders[ix]|escape}">{$orders[ix]}</option>
+ {sectionelse}
+ <option>{tr}No records found{/tr}</option>
+ {/section}
+ </select>
+ </td>
+</tr>
+<tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="fSubmitAssign" value="{tr}assign{/tr}" /></td>
+</tr>
+</table>
+</form>
+
+{/if}
+
+ </td>
+</tr>
+<tr><td colspan="3"><hr /></td></tr>
+{/if}
+<tr>
+ <td colspan="2" valign="top">
+
+ <form action="{$gBitLoc.USERS_PKG_URL}assigned_modules.php" method="post">
+<table class="panel">
+<caption>{tr}Enter Homepage Heading{/tr}</caption>
+<tr><td>{tr}Enter a maximum of 250 characters. You can include Wiki syntax.{/tr}</td></tr>
+<tr>
+ <td><textarea name="homeHeaderData" cols="60" rows="3">{$homeHeaderData}</textarea></td>
+</tr>
+<tr class="panelsubmitrow">
+ <td><input type="submit" name="fSubmitSetHeading" value="{tr}Set Heading{/tr}" /></td>
+</tr>
+</table>
+ </form>
+</td>
+<td style="vertical-align:top;">
+{if $gBitSystemPrefs.feature_user_theme eq 'y' || $gBitSystemPrefs.feature_user_theme eq 'h' }
+
+ <form method="POST" action="{$gBitLoc.USERS_PKG_URL}assigned_modules.php">
+ <table class="panel">
+ <caption>{tr}Select Theme for your Homepage{/tr}</caption>
+ <tr><td>
+ <select name="style">
+ {section name=ix loop=$styles}
+ <option value="{$styles[ix]|escape}" {if $assignStyle eq $styles[ix]}selected="selected"{/if}>{$styles[ix]}</option>
+ {/section}
+ </select>
+ </td><td>
+ <input type="submit" value="Change Theme" name="fSubmitSetTheme">
+ </td></tr></table>
+ </form>
+{/if}
+ </td>
+</tr>
+</table>
+
+*}
diff --git a/templates/user_bookmarks.tpl b/templates/user_bookmarks.tpl
new file mode 100644
index 0000000..8a5ace5
--- /dev/null
+++ b/templates/user_bookmarks.tpl
@@ -0,0 +1,97 @@
+<div class="floaticon">{bithelp}</div>
+<div class="display userbookmarks">
+<div class="header">
+<h1>{tr}User Bookmarks{/tr}</h1>
+</div>
+
+{include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+<div class="body">
+
+<div class="path">
+ {tr}Current folder{/tr}: {if $parent_id>0}<a href="{$gBitLoc.USERS_PKG_URL}bookmarks.php">{tr}top{/tr}</a>&gt;{/if}{$path}</h2>
+</div>
+
+<table class="panel">
+<tr>
+ <th>{tr}name{/tr}</td>
+ <th>{tr}action{/tr}</td>
+</tr>
+{cycle values="even,odd" print=false}
+{section name=ix loop=$folders}
+<tr class="{cycle}">
+ <td><a href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$folders[ix].folder_id}">{biticon ipackage=liberty iname="folder" iexplain="folder"}</a>&nbsp;{$folders[ix].name} ({$folders[ix].urls})</td>
+ <td align="right" nowrap="nowrap">
+ <a title="{tr}remove folder{/tr}" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;removefolder={$folders[ix].folder_id}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a>
+ <a title="{tr}edit{/tr}" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;editfolder={$folders[ix].folder_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
+ </td>
+</tr>
+{/section}
+</table>
+
+<h2>{tr}Bookmarks{/tr}</h2>
+<table class="panel">
+<tr>
+ <th>{tr}name{/tr}</td>
+ <th>{tr}url{/tr}</td>
+ <th>{tr}action{/tr}</td>
+</tr>
+{cycle values="even,odd" print=false}
+{section name=ix loop=$urls}
+<tr class="{cycle}">
+ <td><a href="{$urls[ix].url}">{$urls[ix].name}</a>
+ {if $gBitUser->hasPermission( 'bit_p_cache_bookmarks' ) and $urls[ix].datalen > 0}
+ (<a href="{$gBitLoc.USERS_PKG_URL}cached_bookmark.php?urlid={$urls[ix].url_id}">{tr}cache{/tr}</a>)
+ {/if}
+ </td>
+ <td>{$urls[ix].url|truncate:50}</td>
+ <td>
+ <a title="{tr}remove bookmark{/tr}" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;removeurl={$urls[ix].url_id}">{biticon ipackage=liberty iname="delete" iexplain="remove"}</a>
+ <a title="{tr}edit{/tr}" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;editurl={$urls[ix].url_id}">{biticon ipackage=liberty iname="edit" iexplain="edit"}</a>
+ {if $gBitUser->hasPermission( 'bit_p_cache_bookmarks' ) and $urls[ix].datalen > 0}
+ <a title="{tr}refresh cache{/tr}" href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;refreshurl={$urls[ix].url_id}">{biticon ipackage=liberty iname="refresh" iexplain="refresh cache"}</a>
+ {/if}
+ </td>
+</tr>
+{/section}
+</table>
+
+<br />
+
+<h2>{tr}Admin folders and bookmarks{/tr}</h2>
+{formfeedback error=$bookmarkError}
+<table><tr><td width="50%" valign="top">
+ <form action="{$gBitLoc.USERS_PKG_URL}bookmarks.php" method="post">
+ <table class="panel">
+ <input type="hidden" name="editfolder" value="{$editfolder|escape}" />
+ <input type="hidden" name="parent_id" value="{$parent_id|escape}" />
+ <tr><th colspan="2">{tr}Add or edit a folder{/tr}</th></tr>
+ <tr><td>{tr}Name{/tr}:</td>
+ <td><input type="text" name="foldername" value="{$foldername|escape}" /></td>
+ </tr>
+ <tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="addfolder" value="{tr}add{/tr}" /> <a href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;editfolder=0">{tr}new{/tr}</a></td>
+ </tr>
+ </table>
+ </form>
+</td><td width="50%" valign="top">
+ <form action="{$gBitLoc.USERS_PKG_URL}bookmarks.php" method="post">
+ <table class="panel">
+ <input type="hidden" name="editurl" value="{$editurl|escape}" />
+ <input type="hidden" name="parent_id" value="{$parent_id|escape}" />
+ <tr><th colspan="2">{tr}Add or edit a URL{/tr}</th></tr>
+ <tr><td>{tr}Name{/tr}:</td>
+ <td><input type="text" name="urlname" value="{$urlname|escape}" /></td>
+ </tr>
+ <tr><td>{tr}URL{/tr}:</td>
+ <td><input type="text" name="urlurl" value="{$urlurl|escape}" /></td>
+ </tr>
+ <tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="addurl" value="{tr}add{/tr}" /> <a href="{$gBitLoc.USERS_PKG_URL}bookmarks.php?parent_id={$parent_id}&amp;editurl=0">{tr}new{/tr}</a></td>
+ </tr>
+ </form>
+ </table>
+</td></tr></table>
+
+</div> {* end .body *}
+</div> {* end .bookmarks *}
diff --git a/templates/user_information_inc.tpl b/templates/user_information_inc.tpl
new file mode 100644
index 0000000..23a04af
--- /dev/null
+++ b/templates/user_information_inc.tpl
@@ -0,0 +1,89 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/user_information_inc.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+{if $userData->mUserPrefs.user_information eq 'public' or $gBitUser.mUserId eq $userData.mUserId}
+ <div class="row">
+ {formlabel label="Login"}
+ {forminput}
+ {if $gBitSystemPrefs.display_name eq 'login'}<strong>{/if}
+ {$userData->mInfo.login}
+ {if $gBitSystemPrefs.display_name eq 'login'}</strong>{/if}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Real Name"}
+ {forminput}
+ {if $gBitSystemPrefs.display_name eq 'real_name'}<strong>{/if}
+ {$userData->mInfo.real_name}
+ {if $gBitSystemPrefs.display_name eq 'real_name'}</strong>{/if}
+ {/forminput}
+ </div>
+
+ {if $userData->mUserPrefs.country}
+ <div class="row">
+ {formlabel label="Country"}
+ {forminput}
+ {biticon ipackage="users" ipath="flags/" iname="`$userData->mUserPrefs.flag`" iexplain="`$userData->mUserPrefs.flag`"} {$userData->mUserPrefs.country}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Language"}
+ {forminput}
+ {$userData->mUserPrefs.tikilanguage}
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $gBitUser->isAdmin()}
+ <div class="row">
+ {formlabel label="User ID"}
+ {forminput}
+ {$userData->mInfo.user_id}
+ {/forminput}
+ </div>
+ <div class="row">
+ {formlabel label="Registered Email"}
+ {forminput}
+ {$userData->mInfo.email}
+ {/forminput}
+ </div>
+ {/if}
+
+ {if $userData->mInfo.publicEmail}
+ <div class="row">
+ {formlabel label="Email Address"}
+ {forminput}
+ {$userData->mInfo.publicEmail}
+ {/forminput}
+ </div>
+ {/if}
+
+ <div class="row">
+ {formlabel label="Member since"}
+ {forminput}
+ {$userData->mInfo.registration_date|bit_long_date}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Last Login"}
+ {forminput}
+ {$userData->mInfo.last_login|bit_long_datetime}
+ {/forminput}
+ </div>
+
+ {if $gBitSystem->isPackageActive( 'messu' ) and $userData->mUserPrefs.allowMsgs ne 'n' and $gBitUser->mUserId ne $userData->mUserId}
+ <div class="row">
+ {formlabel label="Send Message"}
+ {forminput}
+ {tr}Send a <a href="{$gBitLoc.MESSU_PKG_URL}compose.php?to={$userInfo.login}">personal message</a> to this user{/tr}
+ {/forminput}
+ </div>
+ {/if}
+{else}
+ <div class="norecords">
+ {tr}This users information is not publically viewable.{/tr}
+ </div>
+{/if}
+{/strip}
diff --git a/templates/user_menu.tpl b/templates/user_menu.tpl
new file mode 100644
index 0000000..5c49825
--- /dev/null
+++ b/templates/user_menu.tpl
@@ -0,0 +1,35 @@
+{assign var=opensec value='n'}
+
+{if $menu_info.type eq 'e' or $menu_info.type eq 'd'}
+ {foreach key=pos item=chdata from=$channels}
+ {assign var=cname value=$menu_info.menuId|cat:'__'|cat:$chdata.position}
+ {if $chdata.type eq 's'}
+ {if $opensec eq 'y'}</div>{/if}
+
+ {if $gBitSystemPrefs.feature_menusfolderstyle eq 'y'}
+ <a class="menuhead" href="javascript:icntoggle('menu{$cname}');">{biticon ipackage=liberty iname="folder" name="menu`$cname`img" iexplain="folder"}
+ {else}
+ <a class="menuhead" href="javascript:toggle('menu{$cname}');">
+ {/if}
+ {tr}{$chdata.name}{/tr}</a>
+ {assign var=opensec value='y'}
+ <div {if $menu_info.type eq 'd' and $smarty.cookies.$cname ne 'o'}style="display:none;"{else}style="display:block;"{/if} id="menu{$cname}">
+ {else}
+ <a class="menuoption" href="{$chdata.url|escape}">{tr}{$chdata.name}{/tr}</a>
+ {/if}
+ <script language="Javascript" type="text/javascript">
+ {if $gBitSystemPrefs.feature_menusfolderstyle eq 'y'}
+ setfoldericonstate('menu{$menu_info.menuId|cat:'__'|cat:$chdata.position}', '{$menu_info.type}');
+ {/if}
+ </script>
+ {/foreach}
+
+{else}
+ {foreach key=pos item=chdata from=$channels}
+ {if $chdata.type eq 's'}
+ <a class="menuhead" href="{$chdata.url|escape}">{tr}{$chdata.name}{/tr}</a>
+ {else}
+ <a class="menuoption" href="{$chdata.url|escape}">{tr}{$chdata.name}{/tr}</a>
+ {/if}
+ {/foreach}
+{/if}
diff --git a/templates/user_preferences.tpl b/templates/user_preferences.tpl
new file mode 100644
index 0000000..ac9d191
--- /dev/null
+++ b/templates/user_preferences.tpl
@@ -0,0 +1,356 @@
+{strip}
+
+<div class="floaticon">{bithelp}</div>
+<div class="display userpreferences">
+ <div class="header">
+ <h1>{tr}User Preferences{/tr}</h1>
+ </div>
+
+ {include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+ <div class="body">
+ {formfeedback warning=$warningMsg success=$successMsg error=$errorMsg}
+ {jstabs}
+ {jstab title="User Information"}
+ {form legend="User Information"}
+ <input type="hidden" name="view_user" value="{$editUser.user_id}" />
+
+ <div class="row">
+ {formlabel label="Real Name" for="real_name"}
+ {forminput}
+ <input type="text" name="real_name" id="real_name" value="{$editUser.real_name|escape}" />
+ {if !$gBitSystemPrefs.display_name or $gBitSystemPrefs.display_name eq 'real_name'}
+ {formhelp note="This is the name that is visible to other users when viewing information added by you."}
+ {/if}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Username"}
+ {forminput}
+ {$editUser.login}
+ {if $gBitSystemPrefs.display_name eq 'login'}
+ {formhelp note="This is the name that is visible to other users when viewing information added by you."}
+ {/if}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Last login"}
+ {forminput}
+ {$editUser.last_login|bit_long_datetime}
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Is email public?" for="email_isPublic"}
+ {forminput}
+ <select name="email_isPublic" id="email_isPublic">
+ {section name=ix loop=$scramblingMethods}
+ <option value="{$scramblingMethods[ix]|escape}" {if $email_isPublic eq $scramblingMethods[ix]}selected="selected"{/if}>{$scramblingEmails[ix]}</option>
+ {/section}
+ </select>
+ {formhelp note="Pick the scrambling method to prevent spam."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Country" for="country"}
+ {forminput}
+ {if $userPrefs.flag}{biticon iforce=icon ipackage="users" ipath="flags/" iname="`$userPrefs.flag`" iexplain="`$userPrefs.flag`"}{/if}
+ <select name="country" id="country">
+ <option value="" />
+ {sortlinks}
+ {section name=ix loop=$flags}
+ <option value="{$flags[ix]|escape}" {if $userPrefs.flag eq $flags[ix]}selected="selected"{/if}>{tr}{$flags[ix]}{/tr}</option>
+ {/section}
+ {/sortlinks}
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ {if $change_language eq 'y'}
+ <div class="row">
+ {formlabel label="Language" for="language"}
+ {forminput}
+ <select name="language" id="language">
+ {foreach from=$languages key=langCode item=lang}
+ <option value="{$langCode}"{if $gBitLanguage->mLanguage eq $langCode} selected="selected"{/if}>
+ {$lang.full_name}
+ </option>
+ {/foreach}
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/if}
+
+ {foreach from=$customFields key=i item=field}
+ <div class="row">
+ {formlabel label="$field}
+ {forminput}
+ <input type="text" name="CUSTOM[{$field}]" value="{$userPrefs.$field}" maxlength="250" />
+ {/forminput}
+ </div>
+ {/foreach}
+
+ <div class="row">
+ {formlabel label="User information" for="user_information"}
+ {forminput}
+ <select name="user_information" id="user_information">
+ <option value="private" {if $user_information eq 'private'}selected="selected"{/if}>{tr}private{/tr}</option>
+ <option value="public" {if $user_information eq 'public'}selected="selected"{/if}>{tr}public{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Number of visited pages to remember" for="userbreadCrumb"}
+ {forminput}
+ <select name="userbreadCrumb" id="userbreadCrumb">
+ <option value="1" {if $editUser.userbreadCrumb eq 1}selected="selected"{/if}>{tr}1{/tr}</option>
+ <option value="2" {if $editUser.userbreadCrumb eq 2}selected="selected"{/if}>{tr}2{/tr}</option>
+ <option value="3" {if $editUser.userbreadCrumb eq 3}selected="selected"{/if}>{tr}3{/tr}</option>
+ <option value="4" {if $editUser.userbreadCrumb eq 4}selected="selected"{/if}>{tr}4{/tr}</option>
+ <option value="5" {if $editUser.userbreadCrumb eq 5}selected="selected"{/if}>{tr}5{/tr}</option>
+ <option value="10" {if $editUser.userbreadCrumb eq 10}selected="selected"{/if}>{tr}10{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="HomePage" for="homePage"}
+ {forminput}
+ <input size="54" type="text" name="homePage" id="homePage" value="{$editUser.homePage|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Displayed time zone"}
+ {forminput}
+ <label><input type="radio" name="display_timezone" value="UTC" {if $display_timezone eq 'UTC'}checked="checked"{/if} />{tr}UTC{/tr}</label>
+ <br />
+ <label><input type="radio" name="display_timezone" value="Local" {if $display_timezone ne 'UTC'}checked="checked"{/if} />{tr}Local{/tr}</label>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Use double-click to edit pages" for="user_dbl"}
+ {forminput}
+ <input type="checkbox" name="user_dbl" id="user_dbl" {if $user_dbl eq 'y'}checked="checked"{/if} />
+ {formhelp note="Enabling this feature will allow you to double click on any wiki page and it will automatically take you to the edit page. Note that this does not work in all browsers."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="prefs" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Pictures and Icons"}
+ {legend legend="Pictures and Icons"}
+ <div class="row">
+ {formlabel label="Pictures"}
+ {forminput}
+ <a href="{$gBitLoc.USERS_PKG_URL}my_images.php">{tr}Upload new pictures{/tr}</a>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Avatar"}
+ {forminput}
+ {if $editUser.avatar_url}
+ <img src="{$editUser.avatar_url}" />
+ {/if}
+ {formhelp note="Small icon used for your posts or comments."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Self Portrait"} {forminput}
+ {if $editUser.portrait_url}
+ <img src="{$editUser.portrait_url}" />
+ {/if}
+ {formhelp note="Larger picture used on your bio page."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Logo" for=""}
+ {forminput}
+ {if $editUser.logo_url}
+ <img src="{$editUser.logo_url}" /><br />
+ {/if}
+ {formhelp note="Image used for your organization."}
+ {/forminput}
+ </div>
+ {/legend}
+ {/jstab}
+
+ {jstab title="e-mail"}
+ {form legend="Change your email address"}
+ <input type="hidden" name="view_user" value="{$editUser.user_id}" />
+ <div class="row">
+ {formlabel label="Email" for="email"}
+ {forminput}
+ <input size="54" type="text" name="email" id="email" value="{$editUser.email|escape}" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Password" for="pass"}
+ {forminput}
+ <input type="password" name="pass" id="pass" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="chgemail" value="{tr}change email{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Password"}
+ {form legend="Change your password"}
+ <input type="hidden" name="view_user" value="{$editUser.user_id}" />
+
+ {if !$view_user or ( $gBitUser->isAdmin and $view_user )}
+ <div class="row">
+ {formlabel label="Old password" for="old"}
+ {forminput}
+ <input type="password" name="old" id="old" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {else}
+ <input type="hidden" name="old" value="" />
+ {/if}
+
+ <div class="row">
+ {formlabel label="New password" for="pass1"}
+ {forminput}
+ <input type="password" name="pass1" id="pass1" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Again please" for="pass2"}
+ {forminput}
+ <input type="password" name="pass2" id="pass2" />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="chgpswd" value="{tr}change password{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+
+ {if $gBitSystem->isPackageActive( 'messu' )}
+ {jstab title="User Messages"}
+ {form legend="User Messages"}
+ <div class="row">
+ {formlabel label="Personal Messages" for=""}
+ {forminput}
+ <a href="{$gBitLoc.MESSU_PKG_URL}message_box.php">
+ {tr}You have <strong>{$unreadMsgs|default:no} unread</strong> {if $unreadMsgs eq '1'}message{else}messages{/if}{/tr}
+ </a>
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Messages per page" for="mess_maxRecords"}
+ {forminput}
+ <select name="mess_maxRecords" id="mess_maxRecords">
+ <option value="2" {if $mess_maxRecords eq 2}selected="selected"{/if}>{tr}2{/tr}</option>
+ <option value="5" {if $mess_maxRecords eq 5}selected="selected"{/if}>{tr}5{/tr}</option>
+ <option value="10" {if $mess_maxRecords eq 10}selected="selected"{/if}>{tr}10{/tr}</option>
+ <option value="20" {if $mess_maxRecords eq 20}selected="selected"{/if}>{tr}20{/tr}</option>
+ <option value="30" {if $mess_maxRecords eq 30}selected="selected"{/if}>{tr}30{/tr}</option>
+ <option value="40" {if $mess_maxRecords eq 40}selected="selected"{/if}>{tr}40{/tr}</option>
+ <option value="50" {if $mess_maxRecords eq 50}selected="selected"{/if}>{tr}50{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Allow messages from other users" for="allowMsgs"}
+ {forminput}
+ <input type="checkbox" name="allowMsgs" id="allowMsgs" {if $allowMsgs eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Send an email" for="minPrio"}
+ {forminput}
+ <select name="minPrio" id="minPrio">
+ <option value="1" {if $minPrio eq 1}selected="selected"{/if}>{tr}at least priority:{/tr} 1</option>
+ <option value="2" {if $minPrio eq 2}selected="selected"{/if}>{tr}at least priority:{/tr} 2</option>
+ <option value="3" {if $minPrio eq 3}selected="selected"{/if}>{tr}at least priority:{/tr} 3</option>
+ <option value="4" {if $minPrio eq 4}selected="selected"{/if}>{tr}at least priority:{/tr} 4</option>
+ <option value="5" {if $minPrio eq 5}selected="selected"{/if}>{tr}at least priority:{/tr} 5</option>
+ <option value="6" {if $minPrio eq 6}selected="selected"{/if}>{tr}never send message{/tr}</option>
+ </select>
+ {formhelp note="Here you can indicate when an email should be sent to you when you recieve a personal message."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="messprefs" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+ {/if}
+
+ {if $gBitSystemPrefs.feature_tasks eq 'y'}
+ {jstab title="User Tasks"}
+ {form legend="User Tasks"}
+ <div class="row">
+ {formlabel label="Tasks per page" for="tasks_maxRecords"}
+ {forminput}
+ <select name="tasks_maxRecords" id="tasks_maxRecords">
+ <option value="2" {if $tasks_maxRecords eq 2}selected="selected"{/if}>{tr}2{/tr}</option>
+ <option value="5" {if $tasks_maxRecords eq 5}selected="selected"{/if}>{tr}5{/tr}</option>
+ <option value="10" {if $tasks_maxRecords eq 10}selected="selected"{/if}>{tr}10{/tr}</option>
+ <option value="20" {if $tasks_maxRecords eq 20}selected="selected"{/if}>{tr}20{/tr}</option>
+ <option value="30" {if $tasks_maxRecords eq 30}selected="selected"{/if}>{tr}30{/tr}</option>
+ <option value="40" {if $tasks_maxRecords eq 40}selected="selected"{/if}>{tr}40{/tr}</option>
+ <option value="50" {if $tasks_maxRecords eq 50}selected="selected"{/if}>{tr}50{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Use dates" for="tasks_use_dates"}
+ {forminput}
+ <input type="checkbox" name="tasks_use_dates" id="tasks_use_dates" {if $tasks_use_dates eq 'y'}checked="checked"{/if} />
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="tasksprefs" value="{tr}Change preferences{/tr}" />
+ </div>
+ {/form}
+ {/jstab}
+ {/if}
+ {/jstabs}
+ </div><!-- end .body -->
+</div><!-- end .userpreferences -->
+
+{/strip}
diff --git a/templates/user_tasks.tpl b/templates/user_tasks.tpl
new file mode 100644
index 0000000..a1d8367
--- /dev/null
+++ b/templates/user_tasks.tpl
@@ -0,0 +1,141 @@
+{strip}
+<div class="floaticon">{bithelp}</div>
+
+<div class="display usertasks">
+ <div class="header">
+ <h1>{tr}Tasks{/tr}</h1>
+ </div>
+
+ {include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+ <div class="body">
+ <div class="navbar">
+ <ul>
+ <li><a href="{$gBitLoc.USERS_PKG_URL}tasks.php?tasks_use_dates=y">{tr}Use dates{/tr}</a></li>
+ <li><a href="{$gBitLoc.USERS_PKG_URL}tasks.php?tasks_use_dates=n">{tr}All tasks{/tr}</a></li>
+ </ul>
+ </div>
+
+ <div class="clear"></div>
+
+ {form}
+ <table class="data">
+ <caption>{tr}Your Tasks{/tr}</caption>
+ <tr>
+ <th style="width:2%;">&nbsp;</th>
+ <th style="width:55%;">{smartlink ititle="Title" isort=title offset=$offset tasks_use_dates=$tasks_use_dates}</th>
+ <th style="width:15%;">{smartlink ititle="Start" isort=date offset=$offset tasks_use_dates=$tasks_use_dates}</th>
+ <th style="width:3%;">{smartlink ititle="Priority" isort=priority offset=$offset tasks_use_dates=$tasks_use_dates idefault=1 iorder=desc}</th>
+ <th style="width:25%;">{smartlink ititle="Percentage Done" isort=percentage offset=$offset tasks_use_dates=$tasks_use_dates}</th>
+ </tr>
+
+ {section name=user loop=$channels}
+ <tr {if $channels[user].status eq 'c'}style="text-decoration:line-through;"{/if} class="{cycle values='odd,even'} prio{$channels[user].priority}">
+ <td><input type="checkbox" name="task[{$channels[user].task_id}]" /></td>
+ <td><a href="{$gBitLoc.USERS_PKG_URL}tasks.php?task_use_dates={$task_use_dates}&amp;task_id={$channels[user].task_id}&amp;offset={$offset}&amp;sort_mode={$sort_mode}&amp;find={$find}#tasks">{$channels[user].title}</a></td>
+ <td {if $channels[user].status eq 'c'}style="text-decoration:line-through;"{/if} class="prio{$channels[user].priority}">{$channels[user].date|bit_short_date}</td>
+ <td style="text-align:right;{if $channels[user].status eq 'c'}text-decoration:line-through;{/if}" class="prio{$channels[user].priority}">{$channels[user].priority}</td>
+ <td style="text-align:right;{if $channels[user].status eq 'c'}text-decoration:line-through;{/if}" class="prio{$channels[user].priority}">
+ <select name="task_perc[{$channels[user].task_id}]">
+ {section name=zz loop=$percs}
+ <option value="{$percs[zz]|escape}" {if $channels[user].percentage eq $percs[zz]}selected="selected"{/if}>{$percs[zz]}%</option>
+ {/section}
+ </select>
+ </td>
+ </tr>
+ {sectionelse}
+ <tr class="norecords">
+ <td colspan="6">{tr}No tasks entered{/tr}</td>
+ </tr>
+ {/section}
+
+ <tr>
+ <td colspan="4">
+ <input type="submit" name="delete" value="{tr}Delete{/tr}" />
+ <input type="submit" name="complete" value="{tr}Done{/tr}" />
+ <input type="submit" name="open" value="{tr}Not Done{/tr}" />
+ </td>
+ <td align="right">
+ <input type="submit" name="update" value="{tr}Update{/tr}" />
+ </td>
+ </tr>
+ </table>
+ {/form}
+
+ {pagination}
+
+ {minifind}
+
+ <a name="tasks"></a>
+ {form legend="Add or Edit a Task"}
+ <input type="hidden" name="task_id" value="{$task_id}" />
+ <input type="hidden" name="tasks_use_dates" value="{$tasks_use_dates}" />
+ <input type="hidden" name="Date_Day" value="{$Date_Day}" />
+ <input type="hidden" name="Date_Month" value="{$Date_Month}" />
+ <input type="hidden" name="Date_Year" value="{$Date_Year}" />
+
+
+ <div class="row">
+ {formlabel label="Title" for="title"}
+ {forminput}
+ <input type="text" name="title" id="title" value="{$info.title|escape}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Description" for="description"}
+ {forminput}
+ <textarea rows="10" cols="80" id="description" name="description">{$info.description|escape}</textarea>
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Start Date"}
+ {forminput}
+ {html_select_date time=$info.date end_year="+1"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Status" for="status"}
+ {forminput}
+ <select name="status" id="status">
+ <option value="o" {if $info.status eq 'o'}selected="selected"{/if}>{tr}open{/tr}</option>
+ <option value="c" {if $info.status eq 'c'}selected="selected"{/if}>{tr}completed{/tr}</option>
+ </select>
+ {if $info.status eq 'c'}
+ {$info.completed|bit_short_date}
+ {/if}
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Priority" for="priority"}
+ {forminput}
+ <select name="priority" id="priority">
+ <option value="1" {if $info.priority eq 1}selected="selected"{/if}>{tr}1{/tr}</option>
+ <option value="2" {if $info.priority eq 2}selected="selected"{/if}>{tr}2{/tr}</option>
+ <option value="3" {if $info.priority eq 3}selected="selected"{/if}>{tr}3{/tr}</option>
+ <option value="4" {if $info.priority eq 4}selected="selected"{/if}>{tr}4{/tr}</option>
+ <option value="5" {if $info.priority eq 5}selected="selected"{/if}>{tr}5{/tr}</option>
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Percentage Completed" for="percentage"}
+ {forminput}
+ {html_options values="$comp_array" output="$comp_array_p" name=percentage selected="$info.percentage" id=percentage}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="save" value="{tr}Save{/tr}" />
+ </div>
+ {/form}
+
+ </div><!-- end .body -->
+</div><!-- end .tasks -->
+{/strip}
diff --git a/templates/user_validation_mail.tpl b/templates/user_validation_mail.tpl
new file mode 100644
index 0000000..ea2179e
--- /dev/null
+++ b/templates/user_validation_mail.tpl
@@ -0,0 +1,9 @@
+{tr}Hi{/tr} {$mail_user},
+
+{tr}you or someone registered this email address at{/tr} {$mail_site}
+
+{tr}If you want to be a registered user in this site you will have to use the following link to login for the first time:{/tr}
+
+{$mail_machine}?user={$mail_user}&pass={$mail_apass}
+
+{tr}Enjoy the site!{/tr}
diff --git a/templates/user_watches.tpl b/templates/user_watches.tpl
new file mode 100644
index 0000000..7f66c5f
--- /dev/null
+++ b/templates/user_watches.tpl
@@ -0,0 +1,56 @@
+{strip}
+<div class="floaticon">{bithelp}</div>
+<div class="listing userwatches">
+ <div class="header">
+ <h1>{tr}User Watches{/tr}</h1>
+ </div>
+
+ {include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+ <div class="body">
+ {form id='formi' legend="Content type selection"}
+ <div class="row">
+ {formlabel label="List content type" for="event"}
+ {forminput}
+ <select name="event" id="event" onchange="javascript:document.getElementById('formi').submit();">
+ <option value="" {if $smarty.request.event eq ''}selected="selected"{/if}>{tr}All{/tr}</option>
+ {section name=ix loop=$events}
+ <option value="{$events[ix]|escape}" {if $events[ix] eq $smarty.request.event}selected="selected"{/if}>{$events[ix]}</option>
+ {/section}
+ </select>
+ {formhelp note=""}
+ {/forminput}
+ </div>
+ {/form}
+
+ {form}
+ <table class="panel">
+ <caption>{tr}Active watches{/tr}</caption>
+ <tr>
+ <th>{tr}Event{/tr}</th>
+ <th>{tr}GUID{/tr}</th>
+ <th>{tr}Object{/tr}</th>
+ </tr>
+
+ {section name=ix loop=$watches}
+ <tr class="{cycle values="odd,even"}">
+ <td><label><input type="checkbox" name="watch[{$watches[ix].hash}]" /> {$watches[ix].event}</label></td>
+ <td>{$watches[ix].type}</td>
+ <td><a href="{$watches[ix].url}">{$watches[ix].title}</a></td>
+ </tr>
+ {sectionelse}
+ <tr>
+ <td class="norecords" colspan="3">no records found</td>
+ </tr>
+ {/section}
+
+ {if $watches}
+ <tr>
+ <td><input src="{biticon ipackage=liberty iname=delete iexplain=remove url=TRUE}" type="image" name="delete" value="{tr}delete{/tr}" /></td>
+ </tr>
+ {/if}
+ </table>
+ {/form}
+ </div><!-- end .body -->
+</div><!-- end .userwatches -->
+{/strip}
diff --git a/templates/userfiles.tpl b/templates/userfiles.tpl
new file mode 100644
index 0000000..81636e2
--- /dev/null
+++ b/templates/userfiles.tpl
@@ -0,0 +1,115 @@
+<div class="floaticon">{bithelp}</div>
+<div class="display userfiles">
+<div class="header">
+<h1>{tr}User Files{/tr}</h1>
+</div>
+
+{include file="bitpackage:users/my_bitweaver_bar.tpl"}
+
+<div class="body">
+
+<h2>{tr}User Files{/tr}</h2>
+
+<table class="data">
+ <tr>
+ <th colspan='2'>
+ <small>{tr}quota{/tr}</small>
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <table class="icon" height="20"
+ width="200" style='background-color:#666666;'>
+ <tr>
+ <td style='background-color:red;' width="{$cellsize}">&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <small>{$percentage}%</small>
+ </td>
+ </tr>
+</table>
+
+<br />
+
+<form action="{$gBitLoc.USERS_PKG_URL}files.php" method="post">
+<table class="panel">
+<tr>
+<th>&nbsp;</th>
+<th><a href="{$gBitLoc.USERS_PKG_URL}files.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'filename_desc'}filename_asc{else}filename_desc{/if}">{tr}name{/tr}</a></th>
+<th><a href="{$gBitLoc.USERS_PKG_URL}files.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'created_desc'}created_asc{else}created_desc{/if}">{tr}created{/tr}</a></th>
+<th><a href="{$gBitLoc.USERS_PKG_URL}files.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'filesize_desc'}filesize_asc{else}filesize_desc{/if}">{tr}size{/tr}</a></th>
+</tr>
+{cycle values="even,odd" print=false}
+{section name=user loop=$channels}
+<tr class="{cycle}">
+<td style="text-align:center;">
+<input type="checkbox" name="userfile[{$channels[user].file_id}]" />
+</td>
+<td>{$channels[user].filename|iconify}<a href="{$gBitLoc.USERS_PKG_URL}download_userfile.php?file_id={$channels[user].file_id}">{$channels[user].filename}</a></td>
+<td>{$channels[user].created|bit_short_datetime}</td>
+<td style="text-align:right;">{$channels[user].filesize|kbsize}</td>
+</tr>
+{sectionelse}
+<tr class="panelsubmitrow">
+<td class="norecords" colspan="4">no records found</td>
+</tr>
+{/section}
+<tr class="panelsubmitrow">
+<td colspan="4"><input type="submit" name="delete" value="{tr}delete{/tr}" /></td>
+</tr>
+</table>
+</form>
+
+</div> {* end .body *}
+
+<div class="pagination">
+{if $prev_offset >= 0}
+[<a href="{$gBitLoc.USERS_PKG_URL}files.php?find={$find}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}prev{/tr}</a>]&nbsp;
+{/if}
+{tr}Page{/tr}: {$actual_page}/{$cant_pages}
+{if $next_offset >= 0}
+&nbsp;[<a href="{$gBitLoc.USERS_PKG_URL}files.php?find={$find}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}next{/tr}</a>]
+{/if}
+{if $direct_pagination eq 'y'}
+<br />
+{section loop=$cant_pages name=foo}
+{assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords}
+<a href="{$gBitLoc.USERS_PKG_URL}files.php?find={$find}&amp;offset={$selector_offset}&amp;sort_mode={$sort_mode}">
+{$smarty.section.foo.index_next}</a>&nbsp;
+{/section}
+{/if}
+</div>
+
+<div class="body">
+
+<h3>{tr}Upload file{/tr}</h3>
+<form enctype="multipart/form-data" action="{$gBitLoc.USERS_PKG_URL}files.php" method="post">
+<table class="panel">
+<!--
+<tr>
+ <td>{tr}Name{/tr}:</td><td><input type="text" name="name" /></td>
+</tr>
+-->
+ <tr>
+ <td rowspan="3">{tr}Upload file{/tr}:</td><td>
+ <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000" /><input size="25" name="userfile1" type="file" />
+ </td><td>
+ <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000" /><input size="25" name="userfile2" type="file" />
+ </td></tr><tr><td>
+ <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000" /><input size="25" name="userfile3" type="file" />
+ </td><td>
+ <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000" /><input size="25" name="userfile4" type="file" />
+ </td></tr><tr><td colspan="2">
+ <input type="hidden" name="MAX_FILE_SIZE" value="10000000000000" /><input size="25" name="userfile5" type="file" />
+ </td></tr><tr class="panelsubmitrow"><td colspan="3">
+ <input type="submit" name="upload" value="{tr}upload{/tr}" />
+ </td>
+</tr>
+</table>
+</form>
+
+</div> {* end .body *}
+</div> {* end .userfiles *}
diff --git a/templates/usermenu.tpl b/templates/usermenu.tpl
new file mode 100644
index 0000000..da86330
--- /dev/null
+++ b/templates/usermenu.tpl
@@ -0,0 +1,86 @@
+{*Smarty template*}
+<a class="pagetitle" href="{$gBitLoc.USERS_PKG_URL}menu.php">{tr}User Menu{/tr}</a><br /><br />
+{include file="bitpackage:users/my_bitweaver_bar.tpl"}
+<br />
+{if $gBitSystemPrefs.feature_user_bookmarks eq 'y' and $gBitUser->hasPermission( 'bit_p_create_bookmarks' )}
+<a title="({tr}May need to refresh twice to see changes{/tr})" href="{$gBitLoc.USERS_PKG_URL}menu.php?addbk=1">{tr}Add top level bookmarks to menu{/tr}</a>
+{/if}
+<br /><br />
+<table class="find">
+<tr><td>{tr}Find{/tr}</td>
+ <td>
+ <form method="get" action="{$gBitLoc.USERS_PKG_URL}menu.php">
+ <input type="text" name="find" value="{$find|escape}" />
+ <input type="submit" value="{tr}find{/tr}" name="search" />
+ <input type="hidden" name="sort_mode" value="{$sort_mode|escape}" />
+ </form>
+ </td>
+</tr>
+</table>
+<form action="{$gBitLoc.USERS_PKG_URL}menu.php" method="post">
+<table class="panel">
+<tr>
+<td class="heading"><input type="submit" name="delete" value="Delete" title="{tr}delete selected{/tr}" /></td>
+<td class="heading"><a href="{$gBitLoc.USERS_PKG_URL}menu.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'position_desc'}position_asc{else}position_desc{/if}">{tr}Pos{/tr}</a></td>
+<td class="heading"><a href="{$gBitLoc.USERS_PKG_URL}menu.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'name_desc'}name_asc{else}name_desc{/if}">{tr}Name{/tr}</a></td>
+<td class="heading"><a href="{$gBitLoc.USERS_PKG_URL}menu.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'url_desc'}url_asc{else}url_desc{/if}">{tr}URL{/tr}</a></td>
+<td class="heading"><a href="{$gBitLoc.USERS_PKG_URL}menu.php?offset={$offset}&amp;sort_mode={if $sort_mode eq 'mode_desc'}mode_asc{else}mode_desc{/if}">{tr}Mode{/tr}</a></td>
+</tr>
+{cycle values="even,odd" print=false}
+{section name=user loop=$channels}
+<tr>
+<td style="text-align:center;" class="{cycle advance=false}">
+<input type="checkbox" name="menu[{$channels[user].menu_id}]" />
+</td>
+<td class="{cycle advance=false}">{$channels[user].position}</td>
+<td class="{cycle advance=false}"><a href="{$gBitLoc.USERS_PKG_URL}menu.php?menu_id={$channels[user].menu_id}&amp;offset={$offset}&amp;sort_mode={$sort_mode}&amp;find={$find}">{$channels[user].name}</a></td>
+<td class="{cycle advance=false}">{$channels[user].url|truncate:40:"...":true}</td>
+<td style="text-align:center;" class="{cycle advance=false}">{$channels[user].mode}</td>
+</tr>
+{/section}
+</table>
+</form>
+
+<div class="pagination">
+{if $prev_offset >= 0}
+[<a href="{$gBitLoc.USERS_PKG_URL}menu.php?find={$find}&amp;offset={$prev_offset}&amp;sort_mode={$sort_mode}">{tr}prev{/tr}</a>]&nbsp;
+{/if}
+{tr}Page{/tr}: {$actual_page}/{$cant_pages}
+{if $next_offset >= 0}
+&nbsp;[<a href="{$gBitLoc.USERS_PKG_URL}menu.php?find={$find}&amp;offset={$next_offset}&amp;sort_mode={$sort_mode}">{tr}next{/tr}</a>]
+{/if}
+{if $direct_pagination eq 'y'}
+<br />
+{section loop=$cant_pages name=foo}
+{assign var=selector_offset value=$smarty.section.foo.index|times:$maxRecords}
+<a href="{$gBitLoc.USERS_PKG_URL}menu.php?find={$find}&amp;offset={$selector_offset}&amp;sort_mode={$sort_mode}">
+{$smarty.section.foo.index_next}</a>&nbsp;
+{/section}
+{/if}
+</div>
+
+<h3>{tr}Add or edit an item{/tr}</h3>
+<form action="{$gBitLoc.USERS_PKG_URL}menu.php" method="post">
+<input type="hidden" name="menu_id" value="{$menu_id|escape}" />
+<table class="panel">
+ <tr><td>{tr}Name{/tr}</td>
+ <td><input type="text" name="name" value="{$info.name|escape}" /></td>
+ </tr>
+ <tr><td>{tr}URL{/tr}</td>
+ <td><input type="text" name="url" value="{$info.url|escape}" /></td> </tr>
+ <tr><td>{tr}Position{/tr}</td>
+ <td><input type="text" name="position" value="{$info.position|escape}" /></td>
+ </tr>
+ <tr><td>{tr}Mode{/tr}</td>
+ <td>
+ <select name="mode">
+ <option value="n" {if $info.mode eq 'n'}selected="selected"{/if}>{tr}new window{/tr}</option>
+ <option value="w" {if $info.mode eq 'w'}selected="selected"{/if}>{tr}replace window{/tr}</option>
+ </select>
+ </td>
+ </tr>
+ <tr class="panelsubmitrow">
+ <td colspan="2"><input type="submit" name="save" value="{tr}save{/tr}" /></td>
+ </tr>
+</table>
+</form>
diff --git a/templates/users_admin.tpl b/templates/users_admin.tpl
new file mode 100644
index 0000000..f19dda4
--- /dev/null
+++ b/templates/users_admin.tpl
@@ -0,0 +1,119 @@
+{* $Header: /cvsroot/bitweaver/_bit_users/templates/users_admin.tpl,v 1.1 2005/06/19 05:12:23 bitweaver Exp $ *}
+{strip}
+
+<div class="floaticon">{bithelp}</div>
+
+<div class="admin users">
+ <div class="header">
+ <h1>{tr}Admin users{/tr}</h1>
+ </div>
+
+ <div class="body">
+ {if (($added ne "") || ($discarded ne "")) }
+ <h2>{tr}Batch Upload Results{/tr}</h2>
+ {if $added}
+ {formfeedback success="`$added` Users Added"}
+ {/if}
+
+ {if $discarded ne '' }
+ {formfeedback error="`$discarded` Users Rejected"}
+ <table class="data" style="width:400px">
+ <tr class="error"><th>{tr}Row{/tr}</th><th>{tr}Reason{/tr}</th></tr>
+ {foreach key=row from=$discardlist item=reason}
+ <tr class="{cycle values="odd,even"}"><td>{$row}</td><td>{$reason}</td></tr>
+ {/foreach}
+ </table>
+ <br />
+ {/if}
+ {/if}
+
+ {jstabs}
+ {jstab title="List of Users"}
+ {include file="bitpackage:users/users_list.tpl"}
+ {/jstab}
+
+ {jstab title="Add User"}
+ {formfeedback success=$addSuccess}
+ {form legend="Add a new user"}
+ <input type="hidden" name="tab" value="useradd" />
+ <div class="row">
+ {formlabel label="Real Name" for="real_name"}
+ {forminput}
+ <input type="text" name="real_name" id="real_name" value="{$newUser.real_name}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formfeedback error=$errors.login}
+ {formlabel label="User" for="login"}
+ {forminput}
+ <input type="text" name="login" id="login" value="{$newUser.login}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formfeedback error=$errors.password}
+ {formlabel label="Password" for="password"}
+ {forminput}
+ <input type="password" name="password" id="password" value="{$newUser.password}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Repeat Password" for="password2"}
+ {forminput}
+ <input type="password" name="password2" id="password2" value="{$newUser.password2}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formfeedback error=$errors.email}
+ {formlabel label="Email" for="email"}
+ {forminput}
+ <input type="text" name="email" id="email" size="30" value="{$newUser.email}" />
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {if $defaultGroupId eq ''}
+ {formfeedback error="No default group is currently set. Please set one in the Administration --&gt; Users --&gt; <a href=\"`$gBitLoc.USERS_PKG_URL`admin/edit_group.php\">Groups and Permissions</a> page"}
+ {/if}
+ {formlabel label="User will be added to the following group" for=""}
+ {forminput}
+ {$defaultGroupName} <a href="{$gBitLoc.USERS_PKG_URL}admin/edit_group.php?group_id={$defaultGroupId}">{biticon ipackage=liberty iname="edit" iexplain="change settings"}</a>
+ {formhelp note="This is the group that is selected as the default group. If you would like to change the default group, please click on the edit icon and set a different group as default group."}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="<a href=\"javascript:genPass('genepass','password','password2');\">{tr}Generate a password{/tr}</a>" for="email"}
+ {forminput}
+ <input id="genepass" type="text" />
+ {formhelp note="You can use this link to create a random password. Make sure you pass the information on to the user."}
+ {/forminput}
+ </div>
+
+ <div class="row submit">
+ <input type="submit" name="newuser" value="{tr}Add User{/tr}"{if $defaultGroupId eq ''} disabled="disabled"{/if} />
+ </div>
+ {/form}
+ {/jstab}
+
+ {jstab title="Advanced"}
+ {form legend="Batch user addition" enctype="multipart/form-data"}
+ <div class="row">
+ {formlabel label="Batch upload (CSV file)" for="csvlist"}
+ {forminput}
+ <input type="file" name="csvlist" id="csvlist" /><br />
+ <label><input type="checkbox" name="overwrite" checked="checked" /> {tr}Overwrite existing users{/tr}</label>
+ {formhelp note="You can batch import users by uploading a CSV (comma-separated values) file. The CSV file needs to have the column names in the first record. The column titles must match with fields in 'users_users' table. Login, password and email are required fields. If an unexistant field is specified, it's ignored."}
+ <input type="submit" name="batchimport" value="{tr}import{/tr}" />
+ {/forminput}
+ </div>
+ {/form}
+ {/jstab}
+ {/jstabs}
+ </div><!-- end .body -->
+</div><!-- end .users -->
+
+{/strip}
diff --git a/templates/users_list.tpl b/templates/users_list.tpl
new file mode 100644
index 0000000..b28c4a5
--- /dev/null
+++ b/templates/users_list.tpl
@@ -0,0 +1,53 @@
+{strip}
+<div class="navbar">
+ <ul>
+ <li>{biticon ipackage=liberty iname=sort iexplain="sort by"}</li>
+ <li>{smartlink iurl=$control.URL offset=$control.offset numrows=$control.numrows ititle="Username" isort="login"}</li>
+ <li>{smartlink iurl=$control.URL offset=$control.offset numrows=$control.numrows ititle="Real name" isort="real_name"}</li>
+ <li>{smartlink iurl=$control.URL offset=$control.offset numrows=$control.numrows ititle="Registration Date" isort="registration_date"}</li>
+ <li>{smartlink iurl=$control.URL offset=$control.offset numrows=$control.numrows ititle="Last Login" isort="current_login"}</li>
+ </ul>
+</div>
+
+<div class="clear"></div>
+
+{formfeedback hash=$feedback}
+
+<ul class="data">
+ {section name=user loop=$users}
+ <li class="item {cycle values='even,odd'}">
+ {if $gBitUser->hasPermission( 'bit_p_admin_users' )}
+ <div class="floaticon">
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/index.php?assume_user={$users[user].user_id}" title="{tr}Assume User Identity{/tr}">{biticon ipackage=users iname="assume_user" iexplain="assume user identity"}</a>
+ <a href="{$gBitLoc.USERS_PKG_URL}preferences.php?view_user={$users[user].user_id}" title="{tr}Edit User Information{/tr}">{biticon ipackage=liberty iname="edit" iexplain="Edit User Information"}</a>
+ {if $gBitUser->isAdmin()}
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/assign_user.php?assign_user={$users[user].user_id}" title="{tr}Assign Group{/tr}">{biticon ipackage=liberty iname="permissions" iexplain="assign group"}</a>
+ {if $users[user].user_id != -1}{* TODO: evil hardcoding *}
+ <a href="{$gBitLoc.USERS_PKG_URL}admin/index.php?offset={$control.offset}&amp;numrows={$control.numrows}&amp;sort_mode={$control.sort_mode}&amp;action=delete&amp;user_id={$users[user].user_id}" title="{tr}Remove{/tr}">{biticon ipackage=liberty iname="delete" iexplain="remove user"}</a>
+ {/if}
+ {/if}
+ </div>
+ {/if}
+ {if $users[user].real_name}
+ <h2><a href="{$gBitLoc.USERS_PKG_URL}index.php?home={$users[user].login}">{$users[user].real_name}</a> <small>({$users[user].login})</small></h2>
+ {else}
+ <h2><a href="{$gBitLoc.USERS_PKG_URL}index.php?home={$users[user].login}">{$users[user].login}</a></h2>
+ {/if}
+ {if $users[user].thumbnail_url}
+ <img alt="{tr}user portrait{/tr}" title="{$users[user].login} {tr}user portrait{/tr}" src="{$users[user].thumbnail_url}" class="thumb" />
+ {/if}
+ {if $gBitUser->hasPermission( 'bit_p_admin_users' )}{$users[user].email} ({tr}User ID{/tr}: {$users[user].user_id})<br/>{/if}
+ {tr}Member since{/tr}: {$users[user].registration_date|bit_short_date}<br/>
+ {if $users[user].current_login }{tr}Last seen{/tr}: {$users[user].current_login|bit_short_date}<br/>{/if}
+ <div class="clear"></div>
+ </li>
+ {/section}
+</ul>
+
+<div class="clear"></div>
+
+{pagination_c numrows=$numrows}
+
+{minifind}
+
+{/strip}
diff --git a/templates/userversions.tpl b/templates/userversions.tpl
new file mode 100644
index 0000000..b2e0402
--- /dev/null
+++ b/templates/userversions.tpl
@@ -0,0 +1,34 @@
+<h2>{tr}User_versions_for{/tr}: {$ruser}</h2>
+{if $preview}
+<h2>{tr}Version{/tr}: {$version}</h2>
+<div class="wikibody">{$preview.data}</div>
+<br />
+{/if}
+<br />
+<div align="center">
+<table>
+<tr>
+<th>{tr}Date{/tr}</th>
+<th>{tr}Page{/tr}</th>
+<th>{tr}Version{/tr}</th>
+<th>{tr}Ip{/tr}</th>
+<th>{tr}Comment{/tr}</th>
+<th>{tr}Action{/tr}</th>
+</tr>
+{cycle values="even,odd" print=false}
+{section name=hist loop=$history}
+<tr class="{cycle}">
+<td>{$history[hist].last_modified|bit_long_datetime}</td>
+<td><a href="{$gBitLoc.WIKI_PKG_URL}index.php?page={$history[hist].page_name|escape:"url"}">{$history[hist].page_name}</a></td>
+<td>{$history[hist].version}</td>
+<td>{$history[hist].ip}</td>
+<td>{$history[hist].comment}</td>
+<td><a href="{$gBitLoc.USERS_PKG_URL}versions.php?ruser={$ruser}&amp;page={$history[hist].page_name|escape:"url"}&amp;preview=1&amp;version={$history[hist].version}">{tr}view{/tr}</a></td>
+</tr>
+{sectionelse}
+<tr class="norecords"><td colspan="6">
+{tr}No records found{/tr}
+</td></tr>
+{/section}
+</table>
+</div>
diff --git a/theme.php b/theme.php
new file mode 100644
index 0000000..bd3a753
--- /dev/null
+++ b/theme.php
@@ -0,0 +1,283 @@
+<?php
+global $gEditMode;
+$gEditMode = 'theme';
+include_once( '../bit_setup_inc.php' );
+include_once( USERS_PKG_PATH.'BitUser.php' );
+include_once( THEMES_PKG_PATH.'css_lib.php' );
+include_once( THEMES_PKG_PATH.'theme_control_lib.php' );
+include_once( KERNEL_PKG_PATH.'BitSystem.php' );
+
+global $gBitUser;
+global $gBitSystem;
+
+if (!$gBitUser->isRegistered()) {
+ $smarty->assign('msg', tra("Permission denied: You are not logged in"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+include_once(USERS_PKG_PATH.'lookup_user_inc.php');
+
+if ($gQueryUser->mUserId != $gBitUser->mUserId && !$gBitUser->object_has_permission($gBitUser->mUserId, $gQueryUser->mInfo['content_id'], 'bituser', 'bit_p_admin_user')) {
+ $smarty->assign('msg', tra('You do not have permission to edit this user\'s theme'));
+ $gBitSystem->display('error.tpl');
+ die;
+}
+
+//******* HELPER FUNCTIONS *******
+// get an array of filesnames in the given directory
+function ls_a($wh)
+{
+ $files = NULL;
+ if (is_dir($wh) && $handle = opendir($wh))
+ {
+ while (false !== ($file = readdir($handle)))
+ {
+ if ($file !== "." && $file !== ".." )
+ {
+ if(!isset($files)) $files=$file;
+ else $files = $file."\r\n".$files;
+ }
+ }
+ closedir($handle);
+ }
+ $arr=explode("\r\n", $files);
+ return $arr;
+}
+
+function delete($dir, $pattern = "*.*")
+{
+ $deleted = false;
+ $pattern = str_replace(array("\*","\?"), array(".*","."), preg_quote($pattern));
+ if (substr($dir,-1) != "/") $dir.= "/";
+ if (is_dir($dir)) {
+ $d = opendir($dir);
+ while ($file = readdir($d)) {
+ if (is_file($dir.$file) && ereg("^".$pattern."$", $file)){
+ if (unlink($dir.$file))
+ $deleted[] = $file;
+ }
+ }
+ closedir($d);
+ return $deleted;
+ }
+ else return 0;
+}
+
+// it copies $wf to $wto
+function copy_dirs($wf, $wto)
+{
+ if (!file_exists($wto))
+ {
+ mkdir($wto, 0777);
+ }
+ $arr=ls_a($wf);
+ foreach ($arr as $fn)
+ {
+ if($fn)
+ {
+ $fl=$wf."/".$fn;
+ $flto=$wto."/".$fn;
+ if(is_dir($fl)) copy_dirs($fl, $flto);
+ else // begin 2nd improvement
+ {
+ @copy($fl, $flto);
+ chmod($flto, 0666);
+ } // end 2nd improvement
+ }
+ }
+}
+
+//******** END HELPER FUNCTIONS **********
+
+// Permission checks
+if (!isset($feature_editcss))
+ $feature_editcss = 'n';
+
+if (!isset($bit_p_create_css))
+ $bit_p_create_css = 'n';
+
+$F = array();
+$errorMsg = array();
+
+// Special case: the admin has turned of custom user themes but this user currently uses his/her custom theme
+if ($gQueryUser->mUserPrefs['theme'] == 'custom' && $feature_custom_user_themes == 'n') {
+ $gQueryUser->storePreference('theme', NULL); // Set their homepage theme to fall back to the site's themeImages
+ $gQueryUser->mUserPrefs['theme'] = NULL; // Update their mPrefs
+}
+
+$usingCustomTheme = ($gQueryUser->mUserPrefs['theme'] == 'custom' ? true : false);
+$smarty->assign_by_ref('usingCustomTheme', $usingCustomTheme);
+
+if ($feature_user_theme == 'n') {
+ $smarty->assign('msg', tra("Feature disabled"));
+
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+$customCSSPath = $gQueryUser->getStoragePath('theme', $gQueryUser->mUserId, NULL); // Path to this user's storage directory
+
+$customCSSFile = $customCSSPath.'custom.css'; // Path to this user's custom stylesheet
+$customCSSImageURL = $gQueryUser->getStorageURL().'/theme/images/';
+$smarty->assign_by_ref('customCSSImageURL',$customCSSImageURL);
+
+// Create a custom.css for this user if they do not already have one
+if (!file_exists($customCSSFile)) {
+ if (!copy(THEMES_PKG_PATH.'/styles/basic/basic.css', $customCSSFile)) {
+ $smarty->assign('msg', tra("Unable to create a custom CSS file for you!"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+}
+
+if (isset($_REQUEST['fUseStandardTheme']) && $_REQUEST['fUseStandardTheme']) {
+ $gQueryUser->storePreference('theme', NULL);
+ $usingCustomTheme = false;
+}
+
+if (isset($_REQUEST['fUseCustomTheme']) && $_REQUEST['fUseCustomTheme']) {
+ $gQueryUser->storePreference('theme', 'custom');
+ $usingCustomTheme = true;
+}
+
+if ($usingCustomTheme) {
+ $assignStyle = 'basic';
+
+ // Action Responses
+ if (isset($_REQUEST["fSaveCSS"])and $_REQUEST["fSaveCSS"]) {
+ // Save any changes the user made to their CSS
+ $fp = fopen($customCSSFile, "w");
+
+ if (!$fp) {
+ $smarty->assign('msg', tra("You dont have permission to write the style sheet"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+
+ fwrite($fp, $_REQUEST["textData"]);
+ fclose ($fp);
+ $successMsg[] = "CSS Updated and Saved";
+
+ } elseif (isset($_REQUEST["fCancelCSS"]) && $_REQUEST['fCancelCSS']) {
+ // Cancel (e.g. do nothing)
+ $successMsg[] = "Changes have been cancelled";
+
+ } elseif (isset($_REQUEST['fResetCSS'])) {
+ // Reset CSS (e.g. copy an existing style as a base for their custom style)
+ $resetStyle = $_REQUEST['resetStyle'];
+ $cssData = $csslib->load_css2_file(THEMES_PKG_PATH."styles/$resetStyle/$resetStyle.css");
+ if (file_exists($customCSSPath.'/images')) {
+ $tcontrollib->expunge_dir($customCSSPath.'/images/');
+ } else {
+ mkdir_p($customCSSPath.'/images');
+ }
+ if (file_exists(THEMES_PKG_PATH."styles/$resetStyle/images")) {
+ copy_dirs(THEMES_PKG_PATH."styles/$resetStyle/images", $customCSSPath.'/images/');
+ }
+
+ $fp = fopen($customCSSFile, "w");
+
+ if (!$fp) {
+ $smarty->assign('msg', tra("You dont have permission to write the style sheet"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+ }
+
+ fwrite($fp, $cssData);
+ fclose ($fp);
+ $successMsg[] = "Your CSS has been reset to the $resetStyle theme.";
+
+ } elseif (isset($_REQUEST['fUpload'])) {
+ if (!ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($_FILES['fImgUpload']['name']))) {
+ $errorMsg[] = "Your image must be one of the following types: .jpg, .png, .gif, .bmp";
+ } else {
+ //vd($_FILES['fImgUpload']['tmp_name']." -- ".$customCSSPath.'/images/'.$_FILES['fImgUpload']['name']);
+ /*vd($_FILES['fImgUpload']['error'] == UPLOAD_ERR_OK);
+ vd($_FILES['fImgUpload']['tmp_name']);
+ vd($customCSSPath.'/images/'.$_FILES['fImgUpload']['name']);*/
+ if (!file_exists($customCSSPath.'/images')) {
+ mkdir_p($customCSSPath.'/images');
+ }
+ if ($_FILES['fImgUpload']['error'] == UPLOAD_ERR_OK && copy($_FILES['fImgUpload']['tmp_name'], $customCSSPath.'/images/'.$_FILES['fImgUpload']['name'])) {
+ $successMsg[] = $_FILES['fImgUpload']['name']." successfully added.";
+ }
+ else {
+ $errorMsg[] = "There was a problem uploading your image.";
+ }
+ }
+
+ } elseif (isset($_REQUEST['fDeleteImg'])) {
+ /*$imgArray = $_REQUEST['fDeleteImg'];
+ foreach($imgArray as $key => $value) {
+ $imgPath = $customCSSPath.'/images/'.$key;
+ if (file_exists($imgPath)) {
+ unlink($imgPath);
+ $successMsg[] = "$key successfully deleted";
+ } else {
+ $errorMsg[] = "$key does not exists!";
+ }
+ }*/
+ $imgName = $_REQUEST['fDeleteImg'];
+ $imgPath = $customCSSPath.'/images/'.$imgName;
+ if (file_exists($imgPath)) {
+ unlink($imgPath);
+ $successMsg[] = "$imgName successfully deleted";
+ } else {
+ $errorMsg[] = "$imgName does not exists!";
+ }
+ } else {
+ $action = 'edit';
+ }
+} else {
+ // User is selecting from the standard themes
+ if (isset($_REQUEST['fChangeTheme']) && $_REQUEST['fChangeTheme']) {
+ $gQueryUser->storePreference('theme', $_REQUEST['fStyleChoice']);
+ $successMsg[] = "Theme successfully changed to ".$_REQUEST['fStyleChoice'];
+ $assignStyle = $_REQUEST['fStyleChoice'];
+ }
+}
+
+// Get the list of themes the user can choose to derive from (aka Reset to)
+$styles = &$tcontrollib->getStyles( NULL, ($usingCustomTheme ? FALSE : TRUE), FALSE );
+$smarty->assign_by_ref( 'styles', $styles );
+
+// $assignStyle is the default style which will be selected in the drop down list
+if (!isset($assignStyle)) {
+ $assignStyle = $gQueryUser->getPreference('theme', 'basic');
+}
+$smarty->assign_by_ref( 'assignStyle', $assignStyle);
+
+// Read in this user's custom.css to display in the textarea
+$lines = file($customCSSFile);
+$data = '';
+foreach ($lines as $line) {
+ $data .= $line;
+}
+
+$smarty->assign('data', $data);
+
+// Export success/error messages for display in the tpl.
+if (isset($successMsg))
+ $smarty->assign_by_ref('successMsg',$successMsg);
+if (isset($errorMsg))
+ $smarty->assign_by_ref('errorMsg', $errorMsg);
+
+// Get the list of images used by this user's custom theme
+$imageList = ls_a($customCSSPath.'images/');
+$themeImages = array();
+if( count( $imageList ) ) {
+ foreach ($imageList as $image) {
+ if (ereg(".JPG$|.PNG$|.GIF$|.BMP$",strtoupper($image))) {
+ $themeImages[] = $image;
+ }
+ }
+}
+
+$smarty->assign('imagesCount', count($themeImages));
+$smarty->assign_by_ref('themeImages',$themeImages);
+$smarty->assign('PHP_SELF', $_SERVER['PHP_SELF']);
+$smarty->assign_by_ref('gQueryUser', $gQueryUser);
+
+$gBitSystem->display( 'bitpackage:users/user_theme.tpl');
+?>
diff --git a/user_menu_lib.php b/user_menu_lib.php
new file mode 100644
index 0000000..df1c146
--- /dev/null
+++ b/user_menu_lib.php
@@ -0,0 +1,80 @@
+<?php
+class UserMenuLib extends BitBase {
+ function UserMenuLib() {
+ BitBase::BitBase();
+ }
+ function add_bk($user) {
+ $query = "select tubu.`name`,`url` from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` tubu, `".BIT_DB_PREFIX."tiki_user_bookmarks_folders` tubf where tubu.`folder_id`=tubf.`folder_id` and tubf.`parent_id`=? and tubu.`user_id`=?";
+ $result = $this->query($query,array(0,$user));
+ $start = $this->get_max_position($user) + 1;
+ while ($res = $result->fetchRow()) {
+ // Check for duplicate URL
+ if (!$this->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_user_menus` where `url`=?",array($res['url']))) {
+ $this->replace_usermenu($user, 0, $res['name'], $res['url'], $start, 'w');
+ $start++;
+ } else {
+ }
+ }
+ $query = "select tubu.`name`,`url` from `".BIT_DB_PREFIX."tiki_user_bookmarks_urls` tubu where tubu.`folder_id`=? and tubu.user=?";
+ $result = $this->query($query,array(0,$user));
+ $start = $this->get_max_position($user) + 1;
+ while ($res = $result->fetchRow()) {
+ // Check for duplicate URL
+ if (!$this->getOne("select count(*) from `".BIT_DB_PREFIX."tiki_user_menus` where `url`=?",array($res['url']))) {
+ $this->replace_usermenu($user, 0, $res['name'], $res['url'], $start, 'w');
+ $start++;
+ } else {
+ }
+ }
+ }
+ function list_usermenus($user, $offset, $maxRecords, $sort_mode, $find) {
+ if ($find) {
+ $findesc = '%' . $find . '%';
+ $mid = " and (`name` like ? or url like ?)";
+ $bindvars=array($user,$findesc,$findesc);
+ } else {
+ $mid = " ";
+ $bindvars=array($user);
+ }
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=? $mid order by ".$this->convert_sortmode($sort_mode);
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=? $mid";
+ $result = $this->query($query,$bindvars,$maxRecords,$offset);
+ $cant = $this->getOne($query_cant,$bindvars);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+ function get_usermenu($user, $menu_id) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=? and `menu_id`=?";
+ $result = $this->query($query,array($user,$menu_id));
+ $res = $result->fetchRow();
+ return $res;
+ }
+ function get_max_position($user) {
+ return $this->getOne("select max(`position`) from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=?",array($user));
+ }
+ function replace_usermenu($user, $menu_id, $name, $url, $position, $mode) {
+ $now = date("U");
+ if ($menu_id) {
+ $query = "update `".BIT_DB_PREFIX."tiki_user_menus` set `name`=?, `position`=?, `url`=?, `mode`=? where `user_id`=? and `menu_id`=?";
+ $this->query($query,array($name,$position,$url,$mode,$user,$menu_id));
+ return $menu_id;
+ } else {
+ $query = "insert into `".BIT_DB_PREFIX."tiki_user_menus`(`user_id`,`name`,`url`,`position`,`mode`) values(?,?,?,?,?)";
+ $this->query($query,array($user,$name,$url,$position,$mode));
+ $Id = $this->getOne("select max(`menu_id`) from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=? and `url`=? and `name`=?",array($user,$url,$name));
+ return $Id;
+ }
+ }
+ function remove_usermenu($user, $menu_id) {
+ $query = "delete from `".BIT_DB_PREFIX."tiki_user_menus` where `user_id`=? and `menu_id`=?";
+ $this->query($query,array($user,$menu_id));
+ }
+}
+$usermenulib = new UserMenuLib();
+?>
diff --git a/userfiles_lib.php b/userfiles_lib.php
new file mode 100644
index 0000000..13c045a
--- /dev/null
+++ b/userfiles_lib.php
@@ -0,0 +1,61 @@
+<?php
+class UserFilesLib extends BitBase {
+ function UserFilesLib() {
+ BitBase::BitBase();
+ }
+ function userfiles_quota($user) {
+ global $bit_p_admin;
+ if ($gBitUser->hasPermission( 'bit_p_admin' )) {
+ return 0;
+ }
+ $part1 = $this->getOne("select sum(`filesize`) from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=?",array($user));
+ $part2 = $this->getOne("select sum(`size`) from `".BIT_DB_PREFIX."tiki_user_notes` where `user_id`=?",array($user));
+ return $part1 + $part2;
+ }
+ function upload_userfile($user, $name, $filename, $filetype, $filesize, $data, $path) {
+ $now = date("U");
+ $query = "insert into `".BIT_DB_PREFIX."tiki_userfiles`(`user_id`,`name`,`filename`,`filetype`,`filesize`,`data`,`created`,`hits`,`path`)
+ values(?,?,?,?,?,?,?,?,?)";
+ $this->query($query,array($user,$name,$filename,$filetype,(int) $filesize,$this->mDb->db_byte_encode($data),(int) $now,0,$path));
+ }
+ function list_userfiles($user, $offset, $maxRecords, $sort_mode, $find) {
+ if ($find) {
+ $findesc = '%' . strtoupper( $find ). '%';
+ $mid = " and (UPPER(`filename`) like ?)";
+ $bindvars=array($user,$findesc);
+ } else {
+ $mid = " ";
+ $bindvars=array($user);
+ }
+ $query = "select `file_id`,`user_id`,`name`,`filename`,`filetype`,`filesize`,`created`,`hits` from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=? $mid order by ".$this->convert_sortmode($sort_mode);
+ $query_cant = "select count(*) from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=? $mid";
+ $result = $this->query($query,$bindvars,$maxRecords,$offset);
+ $cant = $this->getOne($query_cant,$bindvars);
+ $ret = array();
+ while ($res = $result->fetchRow()) {
+ $ret[] = $res;
+ }
+ $retval = array();
+ $retval["data"] = $ret;
+ $retval["cant"] = $cant;
+ return $retval;
+ }
+ function get_userfile($user, $file_id) {
+ $query = "select * from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=? and `file_id`=?";
+ $result = $this->query($query,array($user,(int) $file_id));
+ $res = $result->fetchRow();
+ $res['data'] = $this->mDb->db_byte_decode( $res['data'] );
+ return $res;
+ }
+ function remove_userfile($user, $file_id) {
+ global $uf_use_dir;
+ $path = $this->getOne("select `path` from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=? and `file_id`=?",array($user,(int) $file_id));
+ if ($path) {
+ @unlink ($uf_use_dir . $path);
+ }
+ $query = "delete from `".BIT_DB_PREFIX."tiki_userfiles` where `user_id`=? and file_id=?";
+ $this->query($query,array($user,(int) $file_id));
+ }
+}
+$userfileslib = new UserFilesLib();
+?>
diff --git a/validate.php b/validate.php
new file mode 100644
index 0000000..2a1fb1d
--- /dev/null
+++ b/validate.php
@@ -0,0 +1,81 @@
+<?php
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+$bypass_siteclose_check = 'y';
+require_once( '../bit_setup_inc.php' );
+global $gBitSystem;
+/*
+if (!isset($_REQUEST["login"])) {
+ header("location: $HTTP_REFERER");
+ die;
+}
+*/
+/* SPIDERKILL - nuked this since it seems to go off at odd times
+// Alert user if cookies are switched off
+if (ini_get('session.use_cookies') == 1) {
+vd( $_COOKIE );
+ if(!isset($_COOKIE[BIT_SESSION_NAME])) {
+ $url = KERNEL_PKG_URL.'error.php?error=' . urlencode(tra('You have to enable cookies to be able to login to this site'));
+ header("location: $url");
+ die;
+ }
+}
+*/
+
+//Remember where user is logging in from and send them back later; using session variable for those of us who use WebISO services
+if( empty( $_SESSION['loginfrom'] ) ) {
+ if( isset( $_SERVER['HTTP_REFERER'] ) && !strpos( $_SERVER['HTTP_REFERER'], 'login.php' ) && !strpos( $_SERVER['HTTP_REFERER'], 'register.php' ) ) {
+ $from = (parse_url($_SERVER['HTTP_REFERER']));
+ $_SESSION['loginfrom'] = $from['path'];
+ }
+}
+if ($gBitUser->hasPermission( 'bit_p_admin' )) {
+ if (isset($_REQUEST["su"])) {
+ if ($gBitUser->userExists( array( 'login' => $_REQUEST['username'] ) ) ) {
+ $_SESSION["$user_cookie_site"] = $_REQUEST["username"];
+ $smarty->assign_by_ref('user', $_REQUEST["username"]);
+ }
+ $url = $_SESSION['loginfrom'];
+ //unset session variable for the next su
+ unset($_SESSION['loginfrom']);
+ header("location: $url");
+ die;
+ }
+}
+
+$https_mode = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
+$https_login_required = $gBitSystem->getPreference('https_login_required', 'n');
+if ($https_login_required == 'y' && !$https_mode) {
+ $url = 'https://' . $https_domain;
+ if ($https_port != 443)
+ $url .= ':' . $https_port;
+ $url .= $https_prefix . $gBitSystem->getDefaultPage();
+ if (SID)
+ $url .= '?' . SID;
+ header("Location " . $url);
+ exit;
+}
+
+$user = isset($_REQUEST['user']) ? $_REQUEST['user'] : false;
+$pass = isset($_REQUEST['pass']) ? $_REQUEST['pass'] : false;
+$challenge = isset($_REQUEST['challenge']) ? $_REQUEST['challenge'] : false;
+$response = isset($_REQUEST['response']) ? $_REQUEST['response'] : false;
+
+$url = $gBitUser->login( $user, $pass, $challenge, $response );
+
+// if $referer is set, we return the user to whence he came
+if( !strpos( $url, 'login.php?' ) ) {
+ if( isset( $_REQUEST['referer'] ) ) {
+ $url = $_REQUEST['referer'];
+ } elseif( !empty( $_SERVER['HTTP_REFERER'] ) ) {
+ $url = $_SERVER['HTTP_REFERER'];
+ } else {
+ $url = BIT_ROOT_URL;
+ }
+}
+
+header('location: ' . $url);
+exit;
+?>
diff --git a/versions.php b/versions.php
new file mode 100644
index 0000000..2cb58d3
--- /dev/null
+++ b/versions.php
@@ -0,0 +1,45 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/Attic/versions.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+// Initialization
+require_once( '../bit_setup_inc.php' );
+include_once( WIKI_PKG_PATH.'hist_lib.php');
+if ($feature_wiki != 'y') {
+ $smarty->assign('msg', tra("This feature is disabled").": feature_wiki");
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+// Only an admin can use this script
+if (!$gBitUser->isAdmin()) {
+ $smarty->assign('msg', tra("You dont have permission to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+// We have to get the variable ruser as the user to check
+if (!isset($_REQUEST["ruser"])) {
+ $smarty->assign('msg', tra("No user indicated"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+if (!$gBitUser->userExists( array( 'login' => $_REQUEST["ruser"] ) ) ) {
+ $smarty->assign('msg', tra("Unexistant user"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+$smarty->assign_by_ref('ruser', $_REQUEST["ruser"]);
+$smarty->assign('preview', false);
+if (isset($_REQUEST["preview"])) {
+ $version = $histlib->get_version($_REQUEST["page"], $_REQUEST["version"]);
+ $version["data"] = $gBitSystem->parseData($version["data"]);
+ if ($version) {
+ $smarty->assign_by_ref('preview', $version);
+ $smarty->assign_by_ref('version', $_REQUEST["version"]);
+ }
+}
+$history = $histlib->get_user_versions($_REQUEST["ruser"]);
+$smarty->assign_by_ref('history', $history);
+
+$gBitSystem->display( 'bitpackage:users/userversions.tpl');
+?>
diff --git a/watches.php b/watches.php
new file mode 100644
index 0000000..62c9f06
--- /dev/null
+++ b/watches.php
@@ -0,0 +1,37 @@
+<?php
+// $Header: /cvsroot/bitweaver/_bit_users/watches.php,v 1.1 2005/06/19 05:12:22 bitweaver Exp $
+// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
+// 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.
+include_once( '../bit_setup_inc.php' );
+$user = $gBitUser->mUserId;
+if (!$user) {
+ $smarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSystem->display( 'error.tpl' );
+ die;
+}
+
+$gBitSystem->verifyFeature( 'feature_user_watches' );
+
+if (isset($_REQUEST['hash'])) {
+
+ $gBitUser->remove_user_watch_by_hash($_REQUEST['hash']);
+}
+if (isset($_REQUEST['watch'])) {
+
+ foreach (array_keys($_REQUEST["watch"])as $item) {
+ $gBitUser->remove_user_watch_by_hash($item);
+ }
+}
+// Get watch events and put them in watch_events
+$events = $gBitUser->get_watches_events();
+$smarty->assign('events', $events);
+// if not set event type then all
+if (!isset($_REQUEST['event']))
+ $_REQUEST['event'] = '';
+// get all the information for the event
+$watches = $gBitUser->getWatches( $_REQUEST['event'] );
+$smarty->assign('watches', $watches);
+
+$gBitSystem->display( 'bitpackage:users/user_watches.tpl');
+?>