checks to see if a user has exceeded their limit for sending private messages.

@param int $uID

@return bool
350884
public static function isOverLimit($uID)
    {
        if (Config::get('concrete.user.private_messages.throttle_max') == 0) {
            return false;
        }
        if (Config::get('concrete.user.private_messages.throttle_max_timespan') == 0) {
            return false;
        }
        $db = Loader::db();
        $dt = new DateTime();
        $dt->modify('-'.Config::get('concrete.user.private_messages.throttle_max_timespan').' minutes');
        $v = array($uID, $dt->format('Y-m-d H:i:s'));
        $q = "SELECT COUNT(msgID) as sent_count FROM UserPrivateMessages WHERE uAuthorID = ? AND msgDateCreated >= ?";
        $count = $db->getOne($q, $v);

        if ($count > Config::get('concrete.user.private_messages.throttle_max')) {
            self::notifyAdmin($uID);

            return true;
        } else {
            return false;
        }
    }
920171
public function show($uid)
    {
        $options = $this->getParams('includes');

        $user = Subbly::api('subbly.user')->find($uid, $options);

        return $this->jsonResponse(array(
            'user' => $this->presenter->single($user),
        ));
    }
1138111
protected function isAllowed()
    {
        if ($this->verifyCookie() || $this->allowAdmins() || $this->allowUsers() || $this->allowedIpAddress()) {
            return true;
        }

        return false;
    }
942741
def _check_child_limits(self, child_pid):
        """"""
        if self.max_children is not None and \
                self.children.count() >= self.max_children:
            raise PIDRelationConsistencyError(
                "Max number of children is set to {}.".
                format(self.max_children))
        if self.max_parents is not None and \
                PIDRelation.query.filter_by(
                    child=child_pid,
                    relation_type=self.relation_type.id)\
                .count() >= self.max_parents:
            raise PIDRelationConsistencyError(
                "This pid already has the maximum number of parents.")
467141
public static function removeUserFromGroups($uid)
	{
		$db = \App::get('db');
		$tables = array('#__xgroups_members', '#__xgroups_managers', '#__xgroups_invitees', '#__xgroups_applicants');

		foreach ($tables as $table)
		{
			$sql = "DELETE FROM `".$table."` WHERE uidNumber=" . $db->quote($uid);
			$db->setQuery($sql);
			$db->query();
		}

		return true;
	}
102224
public function copy_message($uids, $to_mbox, $from_mbox='')
    {
        if (!strlen($from_mbox)) {
            $from_mbox = $this->folder;
        }

        list($uids, $all_mode) = $this->parse_uids($uids);

        // exit if no message uids are specified
        if (empty($uids)) {
            return false;
        }

        if (!$this->check_connection()) {
            return false;
        }

        // copy messages
        $copied = $this->conn->copy($uids, $from_mbox, $to_mbox);

        if ($copied) {
            $this->clear_messagecount($to_mbox);
        }

        return $copied;
    }
812886
protected function sendToUid($uid, $data)
    {
        if (Start::$testUnity) {
            $this->testUnitSendStack[] = ['action' => 'sendToUid', 'uid' => $this->uid, 'data' => $data];
        } else {
            get_instance()->sendToUid($uid, $data);
        }
    }
1150934
public function shouldPushToDescriptor(int $fd): bool
    {
        if (!$this->server->exist($fd)) {
            return false;
        }

        return $this->broadcast ? $this->sender !== (int) $fd : true;
    }
438937
private function checkDaemonLimits(): void
    {
        if ($this->isShutdown) {
            throw new ShutdownException($this->shutdownMessage);
        }

        pcntl_signal_dispatch();

        if (DaemonOptions::NO_LIMIT !== $this->requestLimit) {
            if ($this->requestLimit <= $this->requestCount) {
                throw new ShutdownException('Daemon request limit reached ('.$this->requestCount.' of '.$this->requestLimit.')');
            }
        }

        if (DaemonOptions::NO_LIMIT !== $this->memoryLimit) {
            $memoryUsage = memory_get_usage(true);

            if ($this->memoryLimit <= $memoryUsage) {
                throw new ShutdownException('Daemon memory limit reached ('.$memoryUsage.' of '.$this->memoryLimit.' bytes)');
            }
        }
    }
1358367
public static function tooMany($userId)
    {
        $sessionKey = 'messages.' . $userId;
        if (Yii::$app->session->has($sessionKey)) {
            $sentAlready = explode('|', Yii::$app->session->get($sessionKey));
            $validated = [];
            foreach ($sentAlready as $t) {
                if (preg_match('/^[0-9]+$/', $t)) {
                    if ($t > time() - self::SPAM_WAIT * 60) {
                        $validated[] = $t;
                    }
                }
            }
            Yii::$app->session->set($sessionKey, implode('|', $validated));
            if (count($validated) >= self::SPAM_MESSAGES) {
                return true;
            }
        }
        return false;
    }
361489
public function can_reply_privately_to_post(stdClass $user, post_entity $post) : bool {
        if ($post->is_private_reply()) {
            // You cannot reply privately to a post which is, itself, a private reply.
            return false;
        }

        return has_capability('mod/forum:postprivatereply', $this->get_context(), $user);
    }
569118
public function delete_message($uids, $folder='')
    {
        if (!strlen($folder)) {
            $folder = $this->folder;
        }

        list($uids, $all_mode) = $this->parse_uids($uids);

        // exit if no message uids are specified
        if (empty($uids)) {
            return false;
        }

        if (!$this->check_connection()) {
            return false;
        }

        $deleted = $this->conn->flag($folder, $uids, 'DELETED');

        if ($deleted) {
            // send expunge command in order to have the deleted message
            // really deleted from the folder
            $this->expunge_message($uids, $folder, false);
            $this->clear_messagecount($folder);

            // unset threads internal cache
            unset($this->icache['threads']);

            $this->set_search_dirty($folder);

            // remove message ids from search set
            if ($this->search_set && $folder == $this->folder) {
                // threads are too complicated to just remove messages from set
                if ($this->search_threads || $all_mode) {
                    $this->refresh_search();
                }
                else if (!$this->search_set->incomplete) {
                    $this->search_set->filter(explode(',', $uids));
                }
            }

            // remove cached messages
            $this->clear_message_cache($folder, $all_mode ? null : explode(',', $uids));
        }

        return $deleted;
    }
355
private function checkLevel(int $level)
    {
        if ($level <= 0 || $level > self::MAX_LEVEL_DEPTH) {
            throw new OutOfBounds(
                sprintf('Administrative level should be an integer in [1,%d], %d given', self::MAX_LEVEL_DEPTH, $level)
            );
        }
    }
1172569
public function getLimit($user_id)
    {
        if (empty($user_id) || !is_numeric($user_id)) {
            return (int) $this->config->get('user_address_limit_anonymous', 1);
        }

        return (int) $this->config->get('user_address_limit', 4);
    }
915178
public static function checkGuidExists($guid)
    {
        if (is_string($guid)) {
            if (strlen($guid) == 16) {
                $binary = new Binary($guid, Binary::TYPE_UUID);
            } elseif (preg_match(Number::GUID_REGEX, $guid)) {
                $binary = new Binary(Number::guid_bin($guid), Binary::TYPE_UUID);
            } else {
                return false;
            }
            return static::findOne($binary) !== null;
        }
        if ($guid instanceof Binary) {
            return static::findOne($guid) !== null;
        }
        return false;
    }
901098
public function searchByUid($uid) {
		$results = $this->ldap->search($this->basedn,
			$this->search_username . '=' . $uid);
		return $results;
	}
84919
public function comments($uid) {
	  // check passed data
	  if(!is_string($uid)) {
	    // bad data passed
		  throw new LinkedInException('LinkedIn->comments(): bad data passed, $uid must be of type string.');
	  }
		
		// construct and send the request
    $query    = self::_URL_API . '/v1/people/~/network/updates/key=' . $uid . '/update-comments';
    $response = $this->fetch('GET', $query);
    
  	/**
	   * Check for successful request (a 200 response from LinkedIn server) 
	   * per the documentation linked in method comments above.
	   */ 
    return $this->checkResponse(200, $response);
	}