Changeset 1248
- Timestamp:
- 11/05/07 19:05:17 (1 year ago)
- Files:
-
- devel/mod/activity (added)
- devel/mod/activity/INSTALL (added)
- devel/mod/activity/LICENSE (added)
- devel/mod/activity/TODO.deprecated (added)
- devel/mod/activity/index.php (added)
- devel/mod/activity/lib (added)
- devel/mod/activity/lib.php (added)
- devel/mod/activity/lib/recent.php (added)
- devel/mod/admin (added)
- devel/mod/admin/INSTALL (added)
- devel/mod/admin/LICENSE (added)
- devel/mod/admin/NOTES (added)
- devel/mod/admin/antispam.php (added)
- devel/mod/admin/flags.php (added)
- devel/mod/admin/index.php (added)
- devel/mod/admin/languages (added)
- devel/mod/admin/languages/es_CO (added)
- devel/mod/admin/languages/es_CO/LC_MESSAGES (added)
- devel/mod/admin/languages/es_CO/LC_MESSAGES/elgg.mo (added)
- devel/mod/admin/languages/es_CO/LC_MESSAGES/es_CO.po (added)
- devel/mod/admin/lib (added)
- devel/mod/admin/lib.php (added)
- devel/mod/admin/lib/admin_actions.php (added)
- devel/mod/admin/lib/admin_admin_users.php (added)
- devel/mod/admin/lib/admin_banned_users.php (added)
- devel/mod/admin/lib/admin_contentflags.php (added)
- devel/mod/admin/lib/admin_main.php (added)
- devel/mod/admin/lib/admin_spam.php (added)
- devel/mod/admin/lib/admin_userdetails.php (added)
- devel/mod/admin/lib/admin_users.php (added)
- devel/mod/admin/lib/admin_users_add.php (added)
- devel/mod/admin/lib/admin_users_panel.php (added)
- devel/mod/admin/lib/display_content_flag_form.php (added)
- devel/mod/admin/lib/permissions_check.php (added)
- devel/mod/admin/lib/spam_check.php (added)
- devel/mod/admin/users.php (added)
- devel/mod/admin/users_add.php (added)
- devel/mod/community/INSTALL (added)
- devel/mod/community/LICENSE (added)
- devel/mod/community/README (added)
- devel/mod/community/addgroup.php (modified) (1 diff)
- devel/mod/community/lib.php (modified) (7 diffs)
- devel/mod/community/lib/communities_access_levels.php (modified) (2 diffs)
- devel/mod/community/lib/communities_actions.php (modified) (6 diffs)
- devel/mod/community/lib/communities_config.php (modified) (2 diffs)
- devel/mod/community/lib/communities_edit.php (modified) (1 diff)
- devel/mod/community/lib/communities_members.php (modified) (1 diff)
- devel/mod/community/lib/communities_moderator_of.php (modified) (1 diff)
- devel/mod/community/lib/community_member_add.php (added)
- devel/mod/community/lib/community_member_remove.php (added)
- devel/mod/community/lib/community_members_count.php (added)
- devel/mod/community/lib/community_members_data.php (added)
- devel/mod/community/lib/community_membership.php (added)
- devel/mod/community/lib/community_membership_check.php (added)
- devel/mod/community/lib/community_membership_data.php (added)
- devel/mod/community/lib/community_memberships.php (modified) (2 diffs)
- devel/mod/community/lib/permissions_check.php (modified) (3 diffs)
- devel/mod/community/lib/user_info_menu.php (added)
- devel/mod/community/lib/user_info_menu_text.php (modified) (1 diff)
- devel/mod/community/requests.php (modified) (1 diff)
- devel/mod/community/templates/community_membership_view.html (modified) (1 diff)
- devel/mod/contenttoolbar/js/edit.js (modified) (1 diff)
- devel/mod/display (added)
- devel/mod/display/INSTALL (added)
- devel/mod/display/LICENSE (added)
- devel/mod/display/TODO.deprecated (added)
- devel/mod/display/lib (added)
- devel/mod/display/lib.php (added)
- devel/mod/display/lib/function_init.php (added)
- devel/mod/display/lib/function_input_field_display.php (added)
- devel/mod/display/lib/function_log_on_pane.php (added)
- devel/mod/display/lib/function_output_field_display.php (added)
- devel/mod/file/edit_file.php (modified) (1 diff)
- devel/mod/file/edit_folder.php (modified) (1 diff)
- devel/mod/file/index.php (modified) (1 diff)
- devel/mod/file/lib.php (modified) (4 diffs)
- devel/mod/file/lib/edit_file.php (modified) (1 diff)
- devel/mod/file/lib/edit_folder.php (modified) (1 diff)
- devel/mod/file/lib/files_actions.php (modified) (6 diffs)
- devel/mod/file/lib/files_view.php (modified) (4 diffs)
- devel/mod/file/lib/function_search.php (modified) (2 diffs)
- devel/mod/file/lib/permissions_check.php (modified) (1 diff)
- devel/mod/friend/INSTALL (added)
- devel/mod/friend/LICENSE (added)
- devel/mod/friend/README (added)
- devel/mod/friend/css.css (added)
- devel/mod/friend/default_template.php (added)
- devel/mod/friend/foaf.php (added)
- devel/mod/friend/friendsof.php (added)
- devel/mod/friend/gfx (added)
- devel/mod/friend/gfx/friend.gif (added)
- devel/mod/friend/gfx/unfriend.gif (added)
- devel/mod/friend/index.php (added)
- devel/mod/friend/lib (added)
- devel/mod/friend/lib.php (modified) (5 diffs)
- devel/mod/friend/lib/friends_actions.php (added)
- devel/mod/friend/lib/friends_config.php (added)
- devel/mod/friend/lib/friends_edit.php (added)
- devel/mod/friend/lib/friends_edit_wrapper.php (added)
- devel/mod/friend/lib/friends_init.php (added)
- devel/mod/friend/lib/friends_of_edit.php (added)
- devel/mod/friend/lib/friends_of_edit_wrapper.php (added)
- devel/mod/friend/lib/generate_foaf.php (added)
- devel/mod/friend/lib/get_friends.php (added)
- devel/mod/friend/lib/metatags.php (added)
- devel/mod/friend/lib/profile_friends.php (added)
- devel/mod/friend/lib/user_friends.php (added)
- devel/mod/friend/lib/user_friendship_requests.php (added)
- devel/mod/friend/lib/user_info_menu.php (added)
- devel/mod/friend/lib/user_info_menu_text.php (added)
- devel/mod/friend/requests.php (added)
- devel/mod/friend/templates (added)
- devel/mod/friend/templates/friends_friend.html (added)
- devel/mod/gettext/INSTALL (added)
- devel/mod/gettext/LICENSE (added)
- devel/mod/gettext/NOTES (added)
- devel/mod/gettext/lib (added)
- devel/mod/gettext/lib.php (modified) (1 diff)
- devel/mod/gettext/lib/data (added)
- devel/mod/gettext/lib/data/language.properties (added)
- devel/mod/gettext/lib/data/languageNames.properties (added)
- devel/mod/gettext/lib/data/parser.php (added)
- devel/mod/gettext/lib/data/regionNames.properties (added)
- devel/mod/gettext/lib/gettext_userdetails_actions.php (added)
- devel/mod/gettext/lib/gettext_userdetails_edit_details.php (added)
- devel/mod/gettext/lib/langpack.php (added)
- devel/mod/gettext/lib/languages.cache (added)
- devel/mod/gettext/lib/library.php (added)
- devel/mod/icons (added)
- devel/mod/icons/INSTALL (added)
- devel/mod/icons/LICENSE (added)
- devel/mod/icons/data (added)
- devel/mod/icons/data/default.png (added)
- devel/mod/icons/icon.php (added)
- devel/mod/icons/index.php (added)
- devel/mod/icons/lib (added)
- devel/mod/icons/lib.php (added)
- devel/mod/icons/lib/function_actions.php (added)
- devel/mod/icons/lib/function_add_icons.php (added)
- devel/mod/icons/lib/function_edit_icons.php (added)
- devel/mod/icons/lib/function_get_icon.php (added)
- devel/mod/icons/lib/permissions_check.php (added)
- devel/mod/permissions (added)
- devel/mod/permissions/INSTALL (added)
- devel/mod/permissions/LICENSE (added)
- devel/mod/permissions/TODO.deprecated (added)
- devel/mod/permissions/lib (added)
- devel/mod/permissions/lib.php (added)
- devel/mod/permissions/lib/function_check.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/mod/community/addgroup.php
r1080 r1248 21 21 // protect(1); 22 22 23 $title = run("profile:display:name"). " :: ". __gettext("Invite a Community");23 $title = user_info("name", page_owner()) . " :: ". __gettext("Invite a Community"); 24 24 25 25 echo templates_page_draw(array( devel/mod/community/lib.php
r1179 r1248 26 26 global $CFG; 27 27 global $USER; 28 global $metatags;29 28 30 29 require_once (dirname(__FILE__)."/default_template.php"); 31 30 require_once (dirname(__FILE__)."/lib/communities_config.php"); 32 31 33 $metatags .= "<link rel=\"stylesheet\" href=\"" . $CFG->wwwroot . "mod/community/css.css\" type=\"text/css\" media=\"screen\" />";34 35 32 $page_owner = $profile_id; 36 33 … … 38 35 39 36 $username= user_info('username', $page_owner); 37 38 if (isloggedin()) { 39 if(COMMUNITY_CONTEXT!="network"){ 40 if (defined("context") && context == COMMUNITY_CONTEXT /*&& $page_owner == $_SESSION['userid']*/) { 41 $PAGE->menu[] = array( 'name' => 'community', 42 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" class=\"selected\" >" .__gettext("Your Communities").'</a></li>'); 43 } else{ 44 $PAGE->menu[] = array( 'name' => 'community', 45 'html' => "<li><a href=\"{$CFG->wwwroot}{$_SESSION['username']}/communities\" >" .__gettext("Your Communities").'</a></li>'); 46 } 47 } 48 } 40 49 41 50 if ($usertype == "community") { … … 78 87 } 79 88 } 80 81 if (defined("context") && context == "profile") {82 83 if (run("permissions:check", "profile")) {84 85 if (!empty($CFG->uses_YUI)) {86 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:manage',87 'html' => '<a href="'.$CFG->wwwroot.'mod/widget/manage_widgets.php?owner='.$page_owner.'">'88 . __gettext("Manage widgets") . '</a>');89 } else {90 $PAGE->menu_sub[] = array( 'name' => 'profile:widget:add',91 'html' => '<a href="'.$CFG->wwwroot.'mod/profile/add.php?owner='.$page_owner.'">'92 . __gettext("Add widget") . '</a>');93 94 }95 96 }97 }98 99 89 } else if ($usertype == "person") { 100 90 … … 135 125 136 126 // Add communities to access levels 137 include($CFG->dirroot . "mod/community/lib/communities_access_levels.php");127 $function['init'][] = $CFG->dirroot . "mod/community/lib/communities_access_levels.php"; 138 128 $function['userdetails:init'][] = $CFG->dirroot . "mod/community/lib/userdetails_actions.php"; 139 129 … … 142 132 $function['communities:init'][] = $CFG->dirroot . "mod/community/lib/communities_actions.php"; 143 133 144 // Communities modifications of friends actions145 //$function['friends:init'][] = $CFG->dirroot . "mod/community/lib/communities_actions.php";146 147 134 // Communities bar down the right hand side 148 135 $function['display:sidebar'][] = $CFG->dirroot . "mod/community/lib/communities_owned.php"; … … 150 137 151 138 // 'Communities' aspect to the little menus beneath peoples' icons 139 $function['community:infobox:menu'][] = $CFG->dirroot . "mod/community/lib/user_info_menu.php"; 152 140 $function['users:infobox:menu:text'][] = $CFG->dirroot . "mod/community/lib/user_info_menu_text.php"; 153 141 … … 178 166 $function['userdetails:edit'][] = $CFG->dirroot . "mod/community/lib/userdetails_edit.php"; 179 167 168 // Get the community members 169 $function['community:members:data'][] = $CFG->dirroot ."mod/community/lib/community_members_data.php"; 170 $function['community:members:count'][] = $CFG->dirroot ."mod/community/lib/community_members_count.php"; 171 $function['community:membership'][] = $CFG->dirroot ."mod/community/lib/community_membership.php"; 172 $function['community:membership:check'][] = $CFG->dirroot ."mod/community/lib/community_membership_check.php"; 173 $function['community:membership:data'][] = $CFG->dirroot ."mod/community/lib/community_membership_data.php"; 174 175 // Add/ Remove community members 176 $function['community:member:add'][] = $CFG->dirroot ."mod/community/lib/community_member_add.php"; 177 $function['community:member:remove'][] = $CFG->dirroot ."mod/community/lib/community_member_remove.php"; 178 179 // Add owner as member 180 listen_for_event("community","publish","community_owner_as_member"); 181 180 182 // Delete users 181 183 listen_for_event("user","delete","community_user_delete"); 182 183 // Register file river hook (if there) 184 if (function_exists('river_save_event')) 185 { 186 listen_for_event('community','publish', 'community_river_hook'); 187 listen_for_event('community','delete', 'community_river_hook'); 188 189 river_register_friendlyname_hook('community::community', 'community_get_friendly_name'); 190 } 191 192 } 193 194 function community_get_friendly_name($object_type, $object_id) 195 { 196 global $CFG; 197 198 if ($object_type == 'community::community') 199 { 200 $record = get_record_sql("SELECT * from {$CFG->prefix}users where ident=$object_id and user_type = 'community'"); 201 202 if ($record) 203 { 204 $community = user_info("name", $record->ident); 205 $url = river_get_userurl($record->ident); 206 207 return sprintf(__gettext("the community <a href=\"$url\">%s</a>"), $community); 208 } 209 } 210 211 return ""; 212 } 213 214 function community_river_hook( $object_type, $event, $object) 215 { 216 global $CFG; 217 218 $userid = ($_SESSION['userid'] == "" ? -1 : $_SESSION['userid']); 219 $object_id = $object->ident; 220 $object_owner = $object->owner; 221 $title = trim($object->name); 222 223 $username = user_info("name", $userid); 224 $weblogname = "<a href=\"" . river_get_userurl($userid) . "\">". user_info("name", $object_id) . "</a>'s"; 225 if ($userid == $object_owner) $weblogname = __gettext("their"); 226 227 if ($username == false) $username = __gettext("Anonymous user"); 228 229 if ($event == "publish") 230 river_save_event($userid, $object_id, $object_owner, $object_type, "<a href=\"" . river_get_userurl($userid) . "\">$username</a> created the community <a href=\"{$CFG->wwwroot}{$object->username}\">{$object->name}</a>."); 231 232 return $object; 184 } 185 186 function community_owner_as_member($object_type,$event,$object){ 187 global $messages; 188 if($object_type=="community" && $event=="publish" && !empty($object->ident)){ 189 $_messages = run('community:member:add',array($object->ident)); 190 $messages = array_merge($messages,$_messages); 191 192 } 193 return $object; 233 194 } 234 195 devel/mod/community/lib/communities_access_levels.php
r1124 r1248 5 5 global $USER; 6 6 global $CFG; 7 global $data;8 7 9 8 if ($communities = get_records_select('users','owner = ? AND user_type = ?',array($USER->ident,'community'))) { … … 13 12 } 14 13 15 if ($communities = get_records_sql("SELECT u.* FROM ".$CFG->prefix."friends f14 if ($communities = get_records_sql("SELECT u.* FROM ".$CFG->prefix."friends f 16 15 JOIN ".$CFG->prefix.'users u ON u.ident = f.friend 17 16 WHERE u.user_type = ? AND u.owner <> ? AND f.owner = ?', devel/mod/community/lib/communities_actions.php
r1161 r1248 14 14 15 15 switch($action) { 16 16 17 17 // Create a new community 18 18 case "community:create": … … 38 38 $cid = insert_record('users',$c); 39 39 $c->ident = $cid; 40 40 41 41 $rssresult = run("weblogs:rss:publish", array($cid, false)); 42 42 $rssresult = run("files:rss:publish", array($cid, false)); 43 43 $rssresult = run("profile:rss:publish", array($cid, false)); 44 45 $f = new StdClass; 46 $f->owner = $USER->ident; 47 $f->friend = $cid; 48 insert_record('friends',$f); 44 49 45 plugin_hook("community","publish",$c); 50 46 $messages[] = __gettext("Your community was created and you were added as its first member."); … … 55 51 } 56 52 } 57 53 58 54 // There is deliberately not a break here - creating a community should automatically make you a member. 59 55 60 56 // Friend someone 61 57 case "friend": 62 if (!empty($friend_id) && logged_on) { 63 if (user_info("user_type",$friend_id) == "community") { 64 if ($friend = get_record('users','ident',$friend_id)) { 65 $owner = get_record('users','ident',$friend->owner); 66 if ($friend->moderation == "no") { 67 $messages[] = sprintf(__gettext("You joined %s."), stripslashes($friend->name)); 68 if (user_flag_get("emailnotifications",$owner->ident)) { 69 $message_body = sprintf(__gettext("%s has joined %s!\n\nTo visit this user's profile, click on the following link:\n\n\t". 70 "%s\n\nTo view all community members, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."), 71 $_SESSION['name'], $friend->name, $CFG->wwwroot . user_info("username",$USER->ident) . "/", $CFG->wwwroot . "_communities/members.php?owner=" . $friend_id,$CFG->sitename); 72 $title = sprintf(__gettext("New %s member"), $friend->name); 73 notify_user($owner->ident,$title,$message_body); 74 } 75 } else if ($friend->moderation == "yes") { 76 $messages[] = sprintf(__gettext("Membership of %s needs to be approved. Your request has been added to the list."), stripslashes($friend->name)); 77 if (user_flag_get("emailnotifications",$owner->ident)) { 78 $message_body = sprintf(__gettext("%s has applied to join %s!\n\nTo visit this user's profile, click on the following link:\n\n\t". 79 "%s\n\nTo view all membership requests and approve or deny this user, click here:\n\n\t%s\n\nRegards,\n\nThe %s team."), 80 $_SESSION['name'], $friend->name, $CFG->wwwroot . user_info("username",$USER->ident) . "/", $CFG->wwwroot . "_communities/members.php?owner=" . $friend_id,$CFG->sitename); 81 $title = sprintf(__gettext("New %s member request"), $friend->name); 82 notify_user($owner->ident,$title,$message_body); 83 } 84 } else if ($friend->moderation == "priv") { 85 $messages[] = sprintf(__gettext("%s is a private community. Your membership request has been declined."), stripslashes($friend->name)); 86 } 87 } 88 } 89 } 58 $_messages = run('community:member:add',array($friend_id)); 59 $messages = array_merge($messages,$_messages); 90 60 break; 91 61 92 62 // Unfriend someone 93 63 case "unfriend": 94 if (!empty($friend_id) && logged_on) { 95 if (user_type($friend_id) == "community") { 96 $name = user_info('username', $friend_id); 97 $messages[] = sprintf(__gettext("You left %s."), $name); 98 } 99 } 64 $_messages = run('community:member:remove',array($friend_id)); 65 $messages = array_merge($messages,$_messages); 100 66 break; 101 67 102 68 case "community:delete": 103 $community_id = optional_param('community_id',0,PARAM_INT); 104 if (run("permissions:check",array("userdetails:change", $community_id))) { 105 if (user_delete($community_id)) { 106 // plugin_hook("community","publish",$community_id); 69 if (run("permissions:check",array("userdetails:change", $page_owner))) { 70 if (user_delete($page_owner)) { 71 plugin_hook("community","publish",$page_owner); 107 72 $messages[] = __gettext("The community was deleted."); 108 73 } else { 109 74 $messages[] = __gettext("Error: the community could not be deleted."); 110 75 } 111 $_SESSION['messages'] = $messages; 76 $_SESSION['messages'] = $messages; 112 77 header("Location: ".$CFG->wwwroot.$USER->username."/communities"); 113 78 exit; 114 79 } 115 80 break; 81 82 case "leave": 83 $community_name = user_info('name',$profile_id); 116 84 case "separate": 117 85 if(!empty($friend_id)){ 118 if(user_type($profile_id) == "community"){ 119 $name = user_info("username",$friend_id); 120 if(delete_records("friends","owner",$friend_id,"friend",$profile_id)){ 121 $messages[] = sprintf(__gettext("%s was removed from your community"),$name); 122 } 123 else{ 124 $messages = sprintf(__gettext("%s coundn't be removed from your community"),$name); 125 } 126 } 86 $_messages = run('community:member:remove',array($friend_id,$action,$profile_id)); 87 $messages = array_merge($messages,$_messages); 127 88 } 128 89 break; 129 90 130 91 case "weblogs:post:add": 131 92 if (user_type($page_owner) == "community") { … … 133 94 } 134 95 break; 135 96 136 97 // Approve a membership request 137 98 case "community:approve:request": … … 156 117 $messages[] = __gettext("An error occurred: the membership request could not be found."); 157 118 } 158 119 159 120 } 160 121 break; 161 122 162 123 // Reject a membership request 163 124 case "community:decline:request": … … 175 136 $messages[] = __gettext("An error occurred: the membership request could not be found."); 176 137 } 177 138 178 139 } 179 140 break; 180 141 181 142 } 182 143 183 144 } 184 145 ?> devel/mod/community/lib/communities_config.php
r1095 r1248 6 6 * Created on Apr 9, 2007 7 7 * 8 * @author Diego Andr és Ramírez Aragón <diego@somosmas.org>8 * @author Diego Andrᅵs Ramᅵrez Aragᅵn <diego@somosmas.org> 9 9 */ 10 10 /** … … 40 40 * Type: boolean 41 41 */ 42 define('COMMUNITY_ALLOW_COMMUNITY_TYPE_MEMBERS', false);42 define('COMMUNITY_ALLOW_COMMUNITY_TYPE_MEMBERS',true); 43 43 ?> devel/mod/community/lib/communities_edit.php
r1095 r1248 7 7 $user_id = (int) $parameter[0]; 8 8 9 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 10 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 11 WHERE f.owner = ? AND u.user_type = ?', array($user_id,'community')); 9 $result = run('community:membership:data',array($user_id,true)); 10 12 11 $i = 1; 13 12 if (!empty($result)) { devel/mod/community/lib/communities_members.php
r1095 r1248 10 10 $community_owner = user_info('owner',$community_id); 11 11 12 if(COMMUNITY_ALLOW_COMMUNITY_TYPE_MEMBERS){ 13 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 14 JOIN '.$CFG->prefix.'users u ON u.ident = f.owner 15 WHERE f.friend = ?',array($community_id)); 16 17 } 18 else{ 19 $result = get_records_sql('SELECT u.*, f.ident AS friendident FROM '.$CFG->prefix.'friends f 20 JOIN '.$CFG->prefix.'users u ON u.ident = f.owner 21 WHERE f.friend = ? AND u.user_type = ?',array($community_id,'person')); 22 } 12 $result = run('community:members:data',array($community_id)); 23 13 24 14 $i = 1; devel/mod/community/lib/communities_moderator_of.php
r1235 r1248 17 17 $info->icon = run("icons:get",$info->ident); 18 18 $friends_menu = run("community:infobox:menu",array($info)); 19 if (run("permissions:check",array("userdetails:change", $info->ident))) {20 $friends_menu .= "<a href=\"{$CFG->wwwroot}mod/community/index.php?community_id=".$info->ident."&action=community:delete\" onClick=\"return confirm('".__gettext('Are you sure you want to delete this community?')."');\">Delete community</a>";21 }22 19 $friends_icon = user_icon_html($info->ident,COMMUNITY_ICON_SIZE); 23 20 $link = $CFG->wwwroot.$info->username."/"; devel/mod/community/lib/community_memberships.php
r1095 r1248 2 2 global $CFG; 3 3 global $page_owner; 4 4 5 5 if ($page_owner != -1) { 6 6 if (user_type($page_owner) == "person" || user_type($page_owner) == "external") { 7 if ($result = get_records_sql('SELECT DISTINCT u.ident,u.username,u.name FROM '.$CFG->prefix.'friends f 8 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 9 WHERE f.owner = ? AND u.user_type = ? AND u.owner != ?', 10 array($page_owner,'community',$page_owner))) { 7 if ($result = run('community:membership:data',array($page_owner))) { 11 8 $body = "<ul>"; 12 9 foreach($result as $row) { … … 28 25 } else if (user_type($page_owner) == "community") { 29 26 $friends = array(); 30 if ($result = get_records_sql('SELECT DISTINCT u.ident,1 FROM '.$CFG->prefix.'friends f 31 JOIN '.$CFG->prefix.'users u ON u.ident = f.owner 32 WHERE f.friend = ? LIMIT 8',array($page_owner))) { 27 if ($result = run('community:members:data',array($page_owner,8))) { 33 28 foreach($result as $row) { 34 29 $friends[] = (int)$row->ident; devel/mod/community/lib/permissions_check.php
r1144 r1248 3 3 global $CFG; 4 4 global $page_owner; 5 global $messages; 5 6 6 if (isset($parameter) && $page_owner != -1) { 7 7 if (!is_array($parameter)) { 8 8 switch($parameter) { 9 10 case "profile": 9 10 case "profile": 11 11 if (record_exists('users','ident',$page_owner,'owner',$USER->ident,'user_type','community')) { 12 12 $run_result = true; … … 17 17 if (record_exists('users','ident',$page_owner,'owner',$USER->ident,'user_type','community')) { 18 18 $run_result = true; 19 } 19 } 20 20 if (empty($run_result)) { 21 if (count_records_sql('SELECT count(u.ident) FROM '.$CFG->prefix.'friends f 22 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 23 WHERE u.ident = ? AND f.owner = ? AND u.user_type = ?', 24 array($page_owner,$USER->ident,'community'))) { 21 if(run('community:membership',array($page_owner,$USER->ident))>0){ 25 22 $run_result = true; 26 23 } … … 41 38 switch($parameter[0]) { 42 39 case "files:edit": 43 case "weblog:edit": 40 case "weblog:edit": 44 41 $owner = $parameter[1]; 45 42 if (record_exists('users','ident',$owner,'owner',$USER->ident,'user_type','community')) { 46 43 $run_result = true; 47 } 44 } 48 45 if (empty($run_result)) { 49 /* 50 if (count_records_sql('SELECT count(u.ident) FROM '.$CFG->prefix.'friends f 51 JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 52 WHERE u.ident = ? AND f.owner = ? AND u.user_type = ?', 53 array($owner,$USER->ident,'community'))) { 46 if(run('community:membership',array($page_owner,$USER->ident))){ 54 47 $run_result = true; 55 48 } 56 */57 49 } 58 50 break; devel/mod/community/lib/user_info_menu_text.php
r1080 r1248 1 1 <?php 2 global $CFG, $USER;2 global $CFG, $USER; 3 3 global $user_type; 4 4 5 5 // If we've been passed a valid user ID as a parameter ... 6 if (isset ($parameter) && (isset($parameter[0])) && ($parameter[0] != $_SESSION['userid']) && logged_on) {6 if (isset ($parameter) && (isset ($parameter[0])) && ($parameter[0] != $_SESSION['userid']) && logged_on) { 7 7 8 $user_id= (int) $parameter[0];8 $user_id= (int) $parameter[0]; 9 9 10 if (user_type($user_id) == "community") { 11 $result = count_records_sql('SELECT COUNT(u.ident) FROM '.$CFG->prefix.'friends f 12 LEFT JOIN '.$CFG->prefix.'users u ON u.ident = f.friend 13 WHERE f.owner = ? AND f.friend = ?', 14 array($USER->ident,$user_id)); 15 if ($result == 0) { 16 $moderation = user_info('moderation',$user_id); 17 switch($moderation) { 18 case "no": $run_result = "<a href=\"".url."mod/community/index.php?friends_name=".$_SESSION['username']."&action=friend&friend_id=$user_id\" onclick=\"return confirm('". __gettext("Are you sure you want to join this community?") ."')\">" . __gettext("Click here to join this community."). "</a>"; 19 break; 20 case "yes": $run_result = "<a href=\"".url."mod/community/index.php?friends_name=".$_SESSION['username']."&action=friend&friend_id=$user_id\" onclick=\"return confirm('". __gettext("Are you sure you want to apply to join this community?") ."')\">" . __gettext("Click here to apply to join this community."). "</a>"; 21 break; 22 case "priv": $run_result = ""; 23 break; 24 } 25 } else { 26 $run_result = "<a href=\"".url."mod/community/index.php?friends_name=".$_SESSION['username']."&action=unfriend&friend_id=$user_id\" onclick=\"return confirm('". __gettext("Are you sure you want to leave this community?") ."')\">" . __gettext("Click here to leave this community."). "</a>"; 27 } 10 if (user_type($user_id) == "community") { 11 $result= run('community:membership:check', array ( 12 $USER->ident, 13 $user_id 14 )); 15 if ($result == 0) { 16 $moderation= user_info('moderation', $user_id); 17 switch ($moderation) { 18 case "no" : 19 $run_result= "<a href=\"" . $CFG->wwwroot .$_SESSION['username']. "/community/add/".$user_id."\" onclick=\"return confirm('" . __gettext("Are you sure you want to join this community?") . "')\">" . __gettext("Click here to join this community.") . "</a>"; 20 break; 21 case "yes" : 22 $run_result= "<a href=\"" . $CFG->wwwroot .$_SESSION['username']. "/community/add/".$user_id."\" onclick=\"return confirm('" . __gettext("Are you sure you want to apply to join this community?") . "')\">" . __gettext("Click here to apply to join this community.") . "</a>"; 23 break; 24 case "priv" : 25 $run_result= ""; 26 break; 27 } 28 } else { 29 $run_result= "<a href=\"" . $CFG->wwwroot . user_info('username', $user_id) . "/community/leave/" . $_SESSION['userid'] . "\" onclick=\"return confirm('" . __gettext("Are you sure you want to leave this community?") . "')\">" . __gettext("Click here to leave this community.") . "</a>"; 28 30 } 31 } 29 32 } 30 31 33 ?> devel/mod/community/requests.php
r1080 r1248 9 9 run("userdetails:init"); 10 10 run("profile:init"); 11 run("friends:init"); 11 12 run("communities:init"); 12 13 devel/mod/community/templates/community_membership_view.html
r1231 r1248 1 1 <td align="left"> 2 <span class="member_icon"><a href="{{link}}">{{icon}}</a></span> 3 <div class="member_info"> 4 <ul> 5 <li>{{name}}</li> 6 {{functions}} 7 </ul> 8 </div> 2 <span class="member_icon"> 3 <a href="{{link}}">{{icon}}</a> 4 </span> 5 <div class="member_info"> 6 <ul> 7 <li>{{name}}</li> 8 {{functions}} 9 </ul> 10 </div> 9 11 </td> devel/mod/contenttoolbar/js/edit.js
r1164 r1248 324 324 */ 325 325 function parseEmbed(text){ 326 var embedpattern = /< embed[\w\s\"=;:.&\?\/-]*>\s*<\/embed>/;326 var embedpattern = /<(embed|object)[\w\s\"=;:.&\?\/-]*>.*<\/(embed|object)>/; 327 327 var urlpattern = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?\"/; 328 328 var embed = text.match(embedpattern); devel/mod/file/edit_file.php
r1081 r1248 17 17 18 18 global $page_owner; 19  
