Changeset 323
- Timestamp:
- 03/12/08 22:32:09 (5 years ago)
- Location:
- buddyloo/files/lib/system
- Files:
-
- 2 added
- 3 modified
-
cache (added)
-
cache/CacheBuilderBuddylooWhitelist.class.php (added)
-
event/listener/BuddylooAbstractPageListener.class.php (modified) (1 diff)
-
event/listener/BuddylooRegisterFormListener.class.php (modified) (1 diff)
-
event/listener/BuddylooWhiteListEditFormListener.class.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
buddyloo/files/lib/system/event/listener/BuddylooAbstractPageListener.class.php
r217 r323 19 19 20 20 self::$check = true; 21 22 WCF::getCache()->addResource('buddyloo.whitelist', 23 WCF_DIR.'cache/cache.buddyloo.whitelist.php', 24 WCF_DIR.'lib/system/cache/CacheBuilderBuddylooWhiteList.class.php'); 21 25 22 $sql = "SELECT COUNT(*) as c 23 FROM wcf".WCF_N."_buddyloo 24 WHERE whiteUserID = ".WCF::getUser()->userID; 25 $row = WCF::getDB()->getFirstRow($sql); 26 $cache = WCF::getCache()->get('buddyloo.whitelist'); 26 27 27 if( $row['c'] > 0) {28 $text = $ row['c'] > 1 ?29 WCF::getLanguage()->get('wcf.buddyloo.awaitingconfirmations', array('$count'=>$ row['c'])) :28 if(isset($cache[WCF::getUser()->userID])) { 29 $text = $cache[WCF::getUser()->userID] > 1 ? 30 WCF::getLanguage()->get('wcf.buddyloo.awaitingconfirmations', array('$count'=>$cache[WCF::getUser()->userID])) : 30 31 WCF::getLanguage()->get('wcf.buddyloo.awaitingconfirmation'); 31 32 -
buddyloo/files/lib/system/event/listener/BuddylooRegisterFormListener.class.php
r319 r323 90 90 WHERE email = '".escapeString($this->eventObj->user->email)."'; "; 91 91 WCF::getDB()->sendQuery($sql); 92 93 $this->updateCache(); 92 94 } 95 } 96 97 98 99 /** 100 * updates cache 101 */ 102 protected function updateCache() { 103 // clear cache 104 WCF::getCache()->clear(WBB_DIR.'cache', 'cache.buddyloo.*.php'); 105 106 // add resource 107 WCF::getCache()->addResource('buddyloo.whitelist', 108 WCF_DIR.'cache/cache.buddyloo.whitelist.php', 109 WCF_DIR.'lib/system/cache/CacheBuilderBuddylooWhiteList.class.php'); 93 110 } 94 111 } -
buddyloo/files/lib/system/event/listener/BuddylooWhiteListEditFormListener.class.php
r319 r323 77 77 78 78 /** 79 * validation method80 */81 protected function myValidate($id) {82 $user = new User(intval($id));83 $u = 0;84 if (isset($_GET['u'])) $u = intval($_GET['u']);85 if ($u != WCF::getUser()->userID || !$user->userID) {86 throw new IllegalLinkException();87 }88 return $user;89 }90 91 /**92 79 * we want a friendship accepted from both sides. 93 80 * if this user cancels his friendship, the other will do same … … 110 97 AND ".$this->eventObj->listType."UserID = ".WCF::getUser()->userID; 111 98 WCF::getDB()->sendQuery($sql); 99 $this->updateCache(); 112 100 113 101 // show success message … … 125 113 AND ".$this->eventObj->listType."UserID = ".WCF::getUser()->userID; 126 114 WCF::getDB()->sendQuery($sql); 115 $this->updateCache(); 127 116 128 117 // show success message … … 137 126 AND ".$this->eventObj->listType."UserID = ".$user->userID; 138 127 WCF::getDB()->sendQuery($sql); 128 $this->updateCache(); 139 129 140 130 // show success message … … 175 165 VALUES ".$inserts; 176 166 WCF::getDB()->sendQuery($sql); 167 $this->updateCache(); 177 168 178 169 $this->sendNotification(); … … 180 171 // reset session 181 172 Session::resetSessions(WCF::getUser()->userID, true, false); 182 } 173 } 174 175 /** 176 * validation method 177 */ 178 protected function myValidate($id) { 179 $user = new User(intval($id)); 180 $u = 0; 181 if (isset($_GET['u'])) $u = intval($_GET['u']); 182 if ($u != WCF::getUser()->userID || !$user->userID) { 183 throw new IllegalLinkException(); 184 } 185 return $user; 186 } 183 187 184 188 /** … … 271 275 // enable user language 272 276 WCF::getLanguage()->setLocale(); 277 } 278 279 /** 280 * updates cache 281 */ 282 protected function updateCache() { 283 // clear cache 284 WCF::getCache()->clear(WBB_DIR.'cache', 'cache.buddyloo.*.php'); 285 286 // add resource 287 WCF::getCache()->addResource('buddyloo.whitelist', 288 WCF_DIR.'cache/cache.buddyloo.whitelist.php', 289 WCF_DIR.'lib/system/cache/CacheBuilderBuddylooWhiteList.class.php'); 273 290 } 274 291 }
