/*
Private: Check if user has recently visited article

Returns boolean
557454
private function recentlyVisited()
    {
        $app = App::getInstance();

        if ($app['currentuser']->isLoggedIn()) {
            $sql = $app['safesql']->query(
                "SELECT
					COUNT(id)
				FROM
					`article_visit`
				WHERE user = '%s'
				AND article = '%s'
				AND `article_visit`.deleted = 0
				AND timestamp >= NOW() - INTERVAL 4 WEEK",
                array(
                    $app['currentuser']->getUser()->getUsername(),
                    $this->getId()
                )
            );
            return $app['db']->get_var($sql);
        } else {
            $sql = $app['safesql']->query(
                "SELECT
					COUNT(id)
				FROM
					`article_visit`
				WHERE IP = '%s'
				AND browser = '%s'
				AND article = %i
				AND `article_visit`.deleted = 0
				AND timestamp >= NOW() - INTERVAL 4 WEEK",
                array(
                    $app['env']['REMOTE_ADDR'],
                    $app['env']['HTTP_USER_AGENT'],
                    $this->getId()
                )
            );

            return $app['db']->get_var($sql);
        }
    }
675666
private function checkVisitorDataIsReliable()
    {
        $data = $this->getVisitorData();

        foreach (['user_id', 'client_ip', 'user_agent'] as $key) {
            if ($this->checkDataIsUnreliable($data, $key)) return false;
        }

        return true;
    }
1136932
def present?
      displayed = display_check
      if displayed.nil? && display_check
        Watir.logger.deprecate 'Checking `#present? == false` to determine a stale element',
                               '`#stale? == true`',
                               reference: 'http://watir.com/staleness-changes',
                               ids: [:stale_present]
      end
      displayed
    rescue UnknownObjectException, UnknownFrameException
      false
    end
1360954
def get_current_url(self):
		'''
		

		'''
		res = self.Page_getNavigationHistory()
		assert 'result' in res
		assert 'currentIndex' in res['result']
		assert 'entries' in res['result']

		return res['result']['entries'][res['result']['currentIndex']]['url']
759745
function wasLastClickRecent() {
        if (recentClicks.length === 0) {
            return null;
        }
        var now = new Date().getTime();
        return (now - recentClicks[recentClicks.length - 1].when) < settings.clickRecency;
    }
1344859
public function commentExists()
    {
        $comments = (new CommentManager())
            ->filter('article = %i', array($this->getArticle()->getId()))
            ->filter("comment = '%s'", array($this->getComment()))
            ->filter("name = '%s'", array($this->fields['name']->getValue()));

        $count = $comments->count();
        return (boolean) $count;
    }
907229
public function seen()
    {
        $this->post_seen = self::POST_SEEN;
        if (!$this->save()) {
            return false;
        }
        Podium::getInstance()->podiumCache->deleteElement('user.subscriptions', User::loggedId());
        return true;
    }
338491
function () {
            var state = this.state,
                currentPage = state.pages[state.currentPage - 1],
                rowIndex = currentPage.rowIndex,
                prevRow = state.rows[rowIndex - 1];
            return prevRow && prevRow[0] + 1 || state.currentPage;
        }
469558
function checkUser( &$siteBasics, $uri )
    {
        $http = eZHTTPTool::instance();
        $check = array( "module" => "user",
                        "function" => "login" );
        if ( eZSession::issetkey( 'eZUserLoggedInID', false ) &&
             $http->sessionVariable( "eZUserLoggedInID" ) != '' &&
             $http->sessionVariable( "eZUserLoggedInID" ) != self::anonymousId() )
        {
            $currentUser = eZUser::currentUser();
            if ( !$currentUser->isEnabled() )
            {
                eZUser::logoutCurrent();
                $currentUser = eZUser::currentUser();
            }
            else
            {
                return null;
            }
        }

        $ini        = eZINI::instance();
        $moduleName = $uri->element();
        $viewName   = $uri->element( 1 );
        $anonymousAccessList = $ini->variable( "SiteAccessSettings", "AnonymousAccessList" );
        foreach ( $anonymousAccessList as $anonymousAccess )
        {
            $elements = explode( '/', $anonymousAccess );
            if ( !isset( $elements[1] ) )
            {
                if ( $moduleName == $elements[0] )
                {
                    return null;
                }
            }
            else
            {
                if ( $moduleName == $elements[0] and
                     $viewName == $elements[1] )
                {
                    return null;
                }
            }
        }

        return $check;
    }
868701
function getPageRefreshed() {
  try {
    if (performance && performance.navigation) {
      return performance.navigation.type === performance.navigation.TYPE_RELOAD;
    }
  } catch (e) { }
  return false;
}
1282515
function userExists(user) {
  if (_.isEmpty(findUser(user, {refresh: true, throwIfNotFound: false}))) {
    return false;
  } else {
    return true;
  }
}
938942
def list_recent(self):
        '''
        
        '''
        recs = MPost.query_recent(20)
        kwd = {
            'pager': '',
            'title': '',
        }
        self.render('user/info_list/list.html',
                    kwd=kwd,
                    rand_eqs=MPost.query_random(),
                    recs=recs,
                    userinfo=self.userinfo)
679971
def check(self, action, page=None, lang=None, method=None):
        """"""
        if self.user.is_superuser:
            return True

        if action == 'change':
            return self.has_change_permission(page, lang, method)

        if action == 'delete':
            if not self.delete_page():
                return False
            return True
        if action == 'add':
            if not self.add_page():
                return False
            return True
        if action == 'freeze':
            perm = self.user.has_perm('pages.can_freeze')
            if perm:
                return True
            return False
        if action == 'publish':
            perm = self.user.has_perm('pages.can_publish')
            if perm:
                return True
            return False

        return False
279407
def instant_articles(self, **kwargs):
        
        eqs = self.search(**kwargs).sort('-last_modified', '-published')
        return eqs.filter(InstantArticle())
1185262
public function isNewsSubscribed()
    {
        if ($this->_blNewsSubscribed === null) {
            if (($isSubscribedToNews = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('blnewssubscribed')) === null) {
                $isSubscribedToNews = false;
            }
            if (($user = $this->getUser())) {
                $isSubscribedToNews = $user->getNewsSubscription()->getOptInStatus();
            }
            $this->_blNewsSubscribed = $isSubscribedToNews;
        }

        if (is_null($this->_blNewsSubscribed)) {
            $this->_blNewsSubscribed = false;
        }

        return $this->_blNewsSubscribed;
    }
354641
function _has_item(in_arg_key){
	var retval = false;
	if( typeof anchor.current_data[in_arg_key] != 'undefined' ){
	    retval = true;
	}
	return retval;
    }
1149481
function has(id, cb) {
        // Do we have it in the local cache?
        if (sessionIdCache[id]) {
            cb(true);
        }

        // Looking in the database
        else {
            db.collection('trackedUsersCache').find({
                    _id: id
                })
                .toArray((err, docs) => {
                    if (errorHandler.dbErrorCatcher(err)) { return; }

                    // We did not find anything
                    if (!docs || docs.length < 1) {
                        cb(false);
                    }

                    // We found it. Let's cache it and return true
                    else {
                        sessionIdCache[id] = docs[0].info;
                        cb(true);
                    }
                });
        }
    }