Changeset 390
- Timestamp:
- 04/05/08 14:29:00 (5 years ago)
- Location:
- buddyloo
- Files:
-
- 8 modified
-
files/js/buddylooSocial.js (modified) (1 diff)
-
files/lib/action/BuddylooSocialAction.class.php (modified) (4 diffs)
-
files/lib/data/user/BuddylooSocialData.class.php (modified) (2 diffs)
-
files/lib/system/event/listener/BuddylooUserPageListener.class.php (modified) (1 diff)
-
files/lib/system/event/listener/BuddylooUserProfileMenuListener.class.php (modified) (3 diffs)
-
install.sql (modified) (1 diff)
-
templates/buddylooSocial.tpl (modified) (3 diffs)
-
update.sql (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
buddyloo/files/js/buddylooSocial.js
r389 r390 21 21 function buddylooLockSocial(ob) { 22 22 locked = (locked+1) % 3; 23 $.post('index.php?action=BuddylooSocial&handle=lockSocial&userID='+userID+'&socialID='+socialID, ' locked='+locked, function(data) {23 $.post('index.php?action=BuddylooSocial&handle=lockSocial&userID='+userID+'&socialID='+socialID, 'socialAccess='+locked, function(data) { 24 24 buddylooMessage('Info', language['wcf.buddyloo.social.page.access.'+locked]); 25 25 ob.src = RELATIVE_WCF_DIR+'icon/'+buddylooAccessIcons[locked]+'.png'; -
buddyloo/files/lib/action/BuddylooSocialAction.class.php
r389 r390 18 18 public $visible = -1; 19 19 public $handle = ""; 20 public $socialAccess = 0; 20 21 21 22 /** … … 37 38 if (isset($_REQUEST['handle'])) $this->handle = $_REQUEST['handle']; 38 39 39 if (isset($_REQUEST['socialTitle'])) $this->socialTitle = $_REQUEST['socialTitle']; 40 if (isset($_REQUEST['socialTitle'])) $this->socialTitle = $_REQUEST['socialTitle']; 41 if (isset($_REQUEST['socialAccess'])) $this->socialAccess = intval($_REQUEST['socialAccess']); 40 42 41 43 // remove or hide … … 71 73 throw new PermissionDeniedException(); 72 74 } 73 75 74 76 // check users settings 75 77 //TODO … … 104 106 SET socialTitle = '".escapeString($this->socialTitle)."' 105 107 WHERE socialID = ".$this->socialID; 108 WCF::getDB()->sendQuery($sql); 109 break; 110 case 'lockSocial': 111 $sql = "UPDATE wcf".WCF_N."_buddyloo_social 112 SET socialAccess = ".$this->socialAccess." 113 WHERE socialID = ".$this->socialID; 114 echo $sql; 106 115 WCF::getDB()->sendQuery($sql); 107 116 break; -
buddyloo/files/lib/data/user/BuddylooSocialData.class.php
r389 r390 35 35 FROM wcf'.WCF_N.'_buddyloo_user_to_social us 36 36 NATURAL JOIN wcf'.WCF_N.'_buddyloo_social s 37 WHERE su.socialID = '.$this->socialID.'38 AND su.userID = '.$this->userID;37 WHERE us.socialID = '.$this->socialID.' 38 AND us.userID = '.$this->userID; 39 39 $row = WCF::getDB()->getFirstRow($sql); 40 40 $this->access = $row['socialAccess']; 41 41 42 42 $access = $this->getPermission(); 43 43 if(!$access) $access = $this->access>0 && $this->isFriend($this->userID); 44 if(!$access) $access = $this->access >1 && WCF::getUser()->getPermission('user.profile.canSocial');44 if(!$access) $access = $this->access == 1 && WCF::getUser()->getPermission('user.profile.canSocial'); 45 45 if($access) $this->fetchColumns(); 46 46 } … … 57 57 */ 58 58 public function getPermission() { 59 return WCF::getUser()->userID == $this->userID || $this->userID === null;59 return WCF::getUser()->userID == $this->userID; 60 60 } 61 61 -
buddyloo/files/lib/system/event/listener/BuddylooUserPageListener.class.php
r342 r390 66 66 } 67 67 } 68 if( count($this->eventObj->categories[$keys[$i]]['options']) == 0) {68 if(isset($keys[$i]) && isset($this->eventObj->categories[$keys[$i]]['options']) && count($this->eventObj->categories[$keys[$i]]['options']) == 0) { 69 69 unset($this->eventObj->categories[$keys[$i]]); 70 70 } -
buddyloo/files/lib/system/event/listener/BuddylooUserProfileMenuListener.class.php
r375 r390 20 20 $this->eventObj = $eventObj; 21 21 $this->className = $className; 22 23 if(!WCF::getUser()->getPermission('user.profile.canSocial') || !$this->getPermission()) return;24 22 25 23 switch ($eventName) { … … 70 68 } 71 69 } 70 71 /** 72 * checks if i am in the friendlist of the user 73 */ 74 protected function isFriend($userID) { 75 WCF::getCache()->addResource('buddyloo.friendships', 76 WCF_DIR.'cache/cache.buddyloo.friendships.php', 77 WCF_DIR.'lib/system/cache/CacheBuilderBuddylooFriendships.class.php'); 78 79 $cache = WCF::getCache()->get('buddyloo.friendships'); 80 return isset($cache[$userID]) && in_array(WCF::getUser()->userID, $cache[$userID]); 81 } 72 82 73 83 /** … … 89 99 FROM wcf'.WCF_N.'_buddyloo_user_to_social us 90 100 NATURAL JOIN wcf'.WCF_N.'_buddyloo_social s 91 JOIN wcf'.WCF_N.'_user u92 ON us.userID = u.userID93 101 WHERE us.userID = '.$this->eventObj->userID.' 102 AND ( 103 '.($this->getPermission()?1:0).' 104 OR ( 105 s.socialAccess = 1 106 OR ( 107 s.socialAccess = 2 AND '.($this->isFriend($this->eventObj->userID)?1:0).' 108 ) 109 ) 110 ) 94 111 ORDER BY icolumn ASC'; 95 112 $result = WCF::getDB()->sendQuery($sql); -
buddyloo/install.sql
r389 r390 19 19 socialID int(10) unsigned NOT NULL auto_increment, 20 20 socialTitle varchar(80) NOT NULL, 21 socialAccess tinyint(1) NOT NULL DEFAULT 0,21 socialAccess tinyint(1) unsigned NOT NULL DEFAULT 0, 22 22 PRIMARY KEY (socialID) 23 23 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -
buddyloo/templates/buddylooSocial.tpl
r389 r390 13 13 var userID = {$user->userID}; 14 14 var language = new Array(); 15 var locked = {$social-> socialAccess};15 var locked = {$social->access}; 16 16 language['wcf.buddyloo.social.page.access.0'] = '{lang}wcf.buddyloo.social.page.access.0{/lang}'; 17 17 language['wcf.buddyloo.social.page.access.1'] = '{lang}wcf.buddyloo.social.page.access.1{/lang}'; … … 34 34 35 35 <div id="main"> 36 {if $social->getPermission()} 36 37 <div class="largeButtons"> 37 38 <ul> … … 42 43 </ul> 43 44 </div> 45 {/if} 44 46 45 47 {capture append=userMessages} -
buddyloo/update.sql
r389 r390 4 4 socialID int(10) unsigned NOT NULL auto_increment, 5 5 socialTitle varchar(80) NOT NULL, 6 socialAccess tinyint(1) NOT NULL DEFAULT 0,6 socialAccess tinyint(1) unsigned NOT NULL DEFAULT 0, 7 7 PRIMARY KEY (socialID) 8 8 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
