PHP User::refreshUserGroups Examples

PHP User::refreshUserGroups - 2 examples found. These are the top rated real world PHP examples of User::refreshUserGroups extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public function checkLogin()
 {
     $aeu = Config::get('ACCESS_ENTITY_UPDATED');
     if ($aeu && $aeu > $_SESSION['accessEntitiesUpdated']) {
         User::refreshUserGroups();
     }
     if ($_SESSION['uID'] > 0) {
         $db = Loader::db();
         $row = $db->GetRow("select uID, uIsActive from Users where uID = ? and uName = ?", array($_SESSION['uID'], $_SESSION['uName']));
         $checkUID = $row['uID'];
         if ($checkUID == $_SESSION['uID']) {
             if (!$row['uIsActive']) {
                 return false;
             }
             $_SESSION['uOnlineCheck'] = time();
             if ($_SESSION['uOnlineCheck'] - $_SESSION['uLastOnline'] > ONLINE_NOW_TIMEOUT / 2) {
                 $db = Loader::db();
                 $db->query("update Users set uLastOnline = {$_SESSION['uOnlineCheck']} where uID = {$this->uID}");
                 $_SESSION['uLastOnline'] = $_SESSION['uOnlineCheck'];
             }
             return true;
         } else {
             return false;
         }
     }
 }
Example #2
0
	public static function add($filename, $prefix, $data = array()) {
		$db = Loader::db();
		$dh = Loader::helper('date');
		$date = $dh->getSystemDateTime(); 
		
		$uID = 0;
		$u = new User();
		if (isset($data['uID'])) {
			$uID = $data['uID'];
		} else if ($u->isRegistered()) {
			$uID = $u->getUserID();
		}
		
		$db->Execute('insert into Files (fDateAdded, uID) values (?, ?)', array($date, $uID));
		
		$fID = $db->Insert_ID();
		
		$f = File::getByID($fID);
		
		$fv = $f->addVersion($filename, $prefix, $data);
		Events::fire('on_file_add', $f, $fv);
		
		$entities = $u->getUserAccessEntityObjects();
		$hasUploader = false;
		foreach($entities as $obj) {
			if ($obj instanceof FileUploaderPermissionAccessEntity) {
				$hasUploader = true;
			}
		}
		if (!$hasUploader) {
			$u->refreshUserGroups();
		}
		return $fv;
	}