_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q24000
Controller.getThemeViewTemplate
train
public function getThemeViewTemplate() { if (isset($this->view)) { $templateFromView = $this->view->getViewTemplateFile(); } if (isset($this->themeViewTemplate) && $templateFromView == FILENAME_THEMES_VIEW) { return $this->themeViewTemplate; }
php
{ "resource": "" }
q24001
InstallerOptions.getServerTimeZone
train
public function getServerTimeZone($fallbackToDefault) { $timeZoneId = $this->getServerTimeZoneId(); if ($timeZoneId === '') { if (!$fallbackToDefault) { throw new UserMessageException(t('The server time zone has not been defined.')); } $timeZoneId ...
php
{ "resource": "" }
q24002
InstallerOptions.load
train
public function load() { if (!$this->filesystem->isFile(DIR_CONFIG_SITE . '/site_install.php')) { throw new UserMessageException(t('File %s could not be found.', DIRNAME_APPLICATION . '/' . DIRNAME_CONFIG . '/site_install.php')); } if (!$this->filesystem->isFile(DIR_CONFIG_SITE ....
php
{ "resource": "" }
q24003
InstallerOptions.save
train
public function save() { $render = new Renderer($this->configuration); $siteInstall = $render->render(); $render = new Renderer([ 'userEmail' => $this->getUserEmail(), 'userPasswordHash' => $this->getUserPasswordHash(), 'startingPointHandle' => $this->getS...
php
{ "resource": "" }
q24004
PageView.setCustomPageTheme
train
public function setCustomPageTheme(PageTheme $pt) { $this->themeObject = $pt;
php
{ "resource": "" }
q24005
Attributes.add_attribute
train
public function add_attribute() { $allowed = $this->assignment->getAttributesAllowedArray(); $ak = CollectionAttributeKey::getByID($_REQUEST['akID']); if (is_object($ak) && in_array($ak->getAttributeKeyID(), $allowed)) { $obj = $this->getAttributeJSONRepresentation($ak, 'add'); ...
php
{ "resource": "" }
q24006
CsvWriter.insertEntryList
train
public function insertEntryList(EntryList $list) { $list = clone $list;
php
{ "resource": "" }
q24007
CsvWriter.projectList
train
private function projectList(EntryList $list) { $headers = array_keys(iterator_to_array($this->getHeaders($list->getEntity()))); $statement = $list->deliverQueryObject()->execute();
php
{ "resource": "" }
q24008
CsvWriter.projectEntry
train
private function projectEntry(Entry $entry) { $date = $entry->getDateCreated(); if ($date) { yield 'ccm_date_created' => $this->dateFormatter->formatCustom(\DateTime::ATOM, $date); } else { yield 'ccm_date_created' => null;
php
{ "resource": "" }
q24009
PackageService.getAvailablePackages
train
public function getAvailablePackages($onlyNotInstalled = true) { $dh = $this->application->make('helper/file'); $packages = $dh->getDirectoryContents(DIR_PACKAGES); if ($onlyNotInstalled) { $handles = $this->getInstalledHandles(); $packages = array_diff($packages, $ha...
php
{ "resource": "" }
q24010
PackageService.getLocalUpgradeablePackages
train
public function getLocalUpgradeablePackages() { $packages = $this->getAvailablePackages(false); $upgradeables = []; foreach ($packages as $p) { $entity = $this->getByHandle($p->getPackageHandle()); if ($entity) { if (version_compare($p->getPackageVersi...
php
{ "resource": "" }
q24011
PackageService.getInstalledHandles
train
public function getInstalledHandles() { $query = 'select p.pkgHandle from \\Concrete\\Core\\Entity\\Package p'; $r = $this->entityManager->createQuery($query); $result = $r->getArrayResult();
php
{ "resource": "" }
q24012
PackageService.getRemotelyUpgradeablePackages
train
public function getRemotelyUpgradeablePackages() { $packages = $this->getInstalledList(); $upgradeables = []; foreach ($packages as
php
{ "resource": "" }
q24013
PackageService.bootPackageEntityManager
train
public function bootPackageEntityManager(Package $p, $clearCache = false) { $configUpdater = new EntityManagerConfigUpdater($this->entityManager); $providerFactory = new PackageProviderFactory($this->application, $p); $provider = $providerFactory->getEntityManagerProvider(); $configU...
php
{ "resource": "" }
q24014
PackageService.getClass
train
public function getClass($pkgHandle) { $cache = $this->application->make('cache/request'); $item = $cache->getItem('package/class/' . $pkgHandle); $cl = $item->get(); if ($item->isMiss()) { $item->lock(); // loads and instantiates the object $cl =...
php
{ "resource": "" }
q24015
Stats.getFileDisplayName
train
public function getFileDisplayName() { $base = str_replace(DIRECTORY_SEPARATOR, '/', DIR_BASE); if (strpos($this->filename, $base) === 0) { $path = substr($this->filename, strlen($base) + 1); } else {
php
{ "resource": "" }
q24016
DeactivateUser.create
train
public static function create(UserEntity $userEntity, UserEntity $actorEntity = null, DateTime $dateCreated = null) {
php
{ "resource": "" }
q24017
Mime.mimeFromExtension
train
public function mimeFromExtension($ext) { $ext = strtolower($ext); if (array_key_exists($ext, self::$mime_types_and_extensions))
php
{ "resource": "" }
q24018
LocalizationEssentialServiceProvider.register
train
public function register() { if (!$this->app->bound(TranslatorAdapterFactoryInterface::class)) { $this->app->bind(TranslatorAdapterFactoryInterface::class, function ($app, $params) { $config = $app->make('config'); $loaders = $config->get('i18n.adapters.zend.loade...
php
{ "resource": "" }
q24019
CkeditorEditor.getEditorInitJSFunction
train
public function getEditorInitJSFunction($dynamicOptions = []) { $pluginManager = $this->getPluginManager(); if ($this->allowFileManager()) { $pluginManager->select(['concrete5filemanager', 'concrete5uploadimage']); } else { $pluginManager->deselect(['concrete5fileman...
php
{ "resource": "" }
q24020
CkeditorEditor.outputInlineEditorInitJSFunction
train
public function outputInlineEditorInitJSFunction() { $pluginManager = $this->getPluginManager(); if ($pluginManager->isSelected('autogrow')) {
php
{ "resource": "" }
q24021
CkeditorEditor.outputStandardEditorInitJSFunction
train
public function outputStandardEditorInitJSFunction() { $options = [ 'disableAutoInline' => true, ]; $pluginManager = $this->getPluginManager(); if ($pluginManager->isSelected('sourcearea')) {
php
{ "resource": "" }
q24022
CkeditorEditor.getLanguageOption
train
protected function getLanguageOption() { $langPath = DIR_BASE_CORE . '/js/ckeditor4/vendor/lang/'; $useLanguage = 'en'; $language = strtolower(str_replace('_', '-', Localization::activeLocale())); if (file_exists($langPath .
php
{ "resource": "" }
q24023
CkeditorEditor.getEditorSnippetsAndClasses
train
private function getEditorSnippetsAndClasses() { $obj = new stdClass(); $obj->snippets = []; $u = new User(); if ($u->isRegistered()) { $snippets = \Concrete\Core\Editor\Snippet::getActiveList(); foreach ($snippets as $sns) { $menu = new stdCla...
php
{ "resource": "" }
q24024
RedisStashDriver.setOptions
train
protected function setOptions(array $options = []) { $options += $this->getDefaultOptions(); $this->prefix = !empty($options['prefix']) ? $options['prefix'] : null; // Normalize Server Options $servers = []; foreach ($this->getRedisServers(array_get($options, 'servers', [])) ...
php
{ "resource": "" }
q24025
RedisStashDriver.makeKeyString
train
protected function makeKeyString($key, $path = false) { $key = \Stash\Utilities::normalizeKeys($key); $keyString = 'cache:::'; $pathKey = ':pathdb::'; foreach ($key as $name) { //a. cache:::name //b. cache:::name0:::sub $keyString .= $name; ...
php
{ "resource": "" }
q24026
ConfigStore.get
train
public function get($cfKey, $pkgID = null) { if ($pkgID > 0 && isset($this->rows["{$cfKey}.{$pkgID}"])) { return $this->rowToConfigValue($this->rows["{$cfKey}.{$pkgID}"]); } else { foreach ($this->rows as $row) {
php
{ "resource": "" }
q24027
Editor.getByID
train
public static function getByID($cnvEditorID) { $db = Database::connection(); $r = $db->fetchAssoc( 'select * from ConversationEditors
php
{ "resource": "" }
q24028
Editor.getByHandle
train
public static function getByHandle($cnvEditorHandle) { $db = Database::connection(); $r = $db->fetchAssoc( 'select * from ConversationEditors
php
{ "resource": "" }
q24029
Editor.createFromRecord
train
protected static function createFromRecord($record) { if (is_array($record) && $record['cnvEditorHandle']) { /** @var \Concrete\Core\Utility\Service\Text $textHelper */ $textHelper = Core::make('helper/text'); $class = '\\Concrete\\Core\\Conversation\\Editor\\' . $textHel...
php
{ "resource": "" }
q24030
Editor.outputConversationEditorAddMessageForm
train
public function outputConversationEditorAddMessageForm() { \View::element(DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' .
php
{ "resource": "" }
q24031
Editor.outputConversationEditorReplyMessageForm
train
public function outputConversationEditorReplyMessageForm() { \View::element(DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' .
php
{ "resource": "" }
q24032
Editor.formatConversationMessageBody
train
public function formatConversationMessageBody($cnv, $cnvMessageBody, $config = array()) { /** @var \Concrete\Core\Html\Service\Html $htmlHelper */ $htmlHelper = Core::make('helper/html'); $cnvMessageBody = $htmlHelper->noFollowHref($cnvMessageBody); if (isset($config['htmlawed'])) {...
php
{ "resource": "" }
q24033
Editor.add
train
public static function add($cnvEditorHandle, $cnvEditorName, $pkg = false) { $pkgID = 0; if (is_object($pkg)) { $pkgID = $pkg->getPackageID(); } $db = Database::connection();
php
{ "resource": "" }
q24034
Editor.getList
train
public static function getList($pkgID = null) { $db = Database::connection(); $queryBuilder = $db->createQueryBuilder() ->select('e.*') ->from('ConversationEditors', 'e') ->orderBy('cnvEditorHandle', 'asc'); if ($pkgID !== null) { $queryBuilder...
php
{ "resource": "" }
q24035
Editor.hasOptionsForm
train
public function hasOptionsForm() { $env = Environment::get(); $rec = $env->getRecord( DIRNAME_ELEMENTS . '/' . DIRNAME_CONVERSATIONS . '/' . DIRNAME_CONVERSATION_EDITOR . '/' .
php
{ "resource": "" }
q24036
MetadataGenerator.getCustomEntityRepositories
train
public function getCustomEntityRepositories() { $result = []; $app = ApplicationFacade::getFacadeApplication(); $pev = new PackageEntitiesEvent(); $app->make('director')->dispatch('on_list_package_entities', $pev); $entityManagers = array_merge([$app->make(EntityManagerInterf...
php
{ "resource": "" }
q24037
IndexSearchAll.queueMessages
train
protected function queueMessages() { $pages = $users = $files = $sites = 0; foreach ($this->pagesToQueue() as $id) { yield "P{$id}"; $pages++; } foreach ($this->usersToQueue() as $id) { yield "U{$id}"; $users++; } forea...
php
{ "resource": "" }
q24038
IndexSearchAll.clearIndex
train
protected function clearIndex($index) { $index->clear(Page::class);
php
{ "resource": "" }
q24039
IndexSearchAll.pagesToQueue
train
protected function pagesToQueue() { $qb = $this->connection->createQueryBuilder(); // Find all pages that need indexing $query = $qb ->select('p.cID') ->from('Pages', 'p') ->leftJoin('p', 'CollectionSearchIndexAttributes', 'a', 'p.cID = a.cID') ...
php
{ "resource": "" }
q24040
IndexSearchAll.usersToQueue
train
protected function usersToQueue() { /** @var Connection $db */ $db = $this->connection; $query = $db->executeQuery('SELECT uID FROM Users WHERE uIsActive = 1');
php
{ "resource": "" }
q24041
IndexSearchAll.filesToQueue
train
protected function filesToQueue() { /** @var Connection $db */ $db = $this->connection; $query = $db->executeQuery('SELECT fID FROM Files');
php
{ "resource": "" }
q24042
IndexSearchAll.sitesToQueue
train
protected function sitesToQueue() { /** @var Connection $db */ $db = $this->connection; $query = $db->executeQuery('SELECT siteID FROM Sites');
php
{ "resource": "" }
q24043
LinkAbstractor.translateFromEditMode
train
public static function translateFromEditMode($text) { $app = Application::getFacadeApplication(); $entityManager = $app->make(EntityManagerInterface::class); $resolver = $app->make(ResolverManagerInterface::class); $appUrl = Application::getApplicationURL(); $text = preg_rep...
php
{ "resource": "" }
q24044
LinkAbstractor.replacePlaceholder
train
protected static function replacePlaceholder($text, $pattern, callable $resolver, $caseSensitive = false) { $regex = "/{$pattern}/"; if (!$caseSensitive) { $regex .= 'i'; } if (!preg_match_all($regex, $text, $matches)) { return $text;
php
{ "resource": "" }
q24045
Type.getList
train
public static function getList() { $app = Application::getFacadeApplication(); $em = $app->make(EntityManagerInterface::class);
php
{ "resource": "" }
q24046
Type.getVersionList
train
public static function getVersionList() { $app = Application::getFacadeApplication(); $config = $app->make('config'); $createHightDPIVersions = (bool) $config->get('concrete.file_manager.images.create_high_dpi_thumbnails'); $types = static::getList(); $versions = []; ...
php
{ "resource": "" }
q24047
Type.exportList
train
public static function exportList($node) { $child = $node->addChild('thumbnailtypes'); $list = static::getList(); foreach ($list as $link) { $linkNode = $child->addChild('thumbnailtype'); $linkNode->addAttribute('name', $link->getName()); $linkNode->addAtt...
php
{ "resource": "" }
q24048
Type.getByID
train
public static function getByID($id) { if ($id) { $app = Application::getFacadeApplication(); $em =
php
{ "resource": "" }
q24049
Type.getByHandle
train
public static function getByHandle($ftTypeHandle) { $ftTypeHandle = (string) $ftTypeHandle; $app = Application::getFacadeApplication(); $cache = $app->make('cache/request'); $item = $cache->getItem('file/image/thumbnail/' . $ftTypeHandle); if ($item->isMiss()) { $...
php
{ "resource": "" }
q24050
Limit.isOverLimit
train
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(); ...
php
{ "resource": "" }
q24051
Channels.getCoreChannels
train
public static function getCoreChannels() { return [ self::CHANNEL_EMAIL, self::CHANNEL_EXCEPTIONS, self::CHANNEL_PACKAGES, self::CHANNEL_SECURITY, self::CHANNEL_AUTHENTICATION, self::CHANNEL_PERMISSIONS,
php
{ "resource": "" }
q24052
Channels.getChannels
train
public static function getChannels() { $app = Facade::getFacadeApplication(); $db = $app->make(Connection::class); $channels
php
{ "resource": "" }
q24053
Channels.getChannelDisplayName
train
public static function getChannelDisplayName($channel) { $text = new Text(); switch ($channel) { case self::CHANNEL_APPLICATION: return tc('Log channel', 'Application'); case self::CHANNEL_AUTHENTICATION: return tc('Log channel', 'Authenticatio...
php
{ "resource": "" }
q24054
ValidationHash.removeExpired
train
protected static function removeExpired($type) { switch ($type) { case UVTYPE_CHANGE_PASSWORD: $lifetime = USER_CHANGE_PASSWORD_URL_LIFETIME; break; case UVTYPE_LOGIN_FOREVER: $lifetime = USER_FOREVER_COOKIE_LIFETIME; br...
php
{ "resource": "" }
q24055
ValidationHash.add
train
public static function add($uID, $type, $singeHashAllowed = false, $hashLength = 64) { self::removeExpired($type); $hash = self::generate($hashLength); $db = Database::connection(); if ($singeHashAllowed) { $db->executeQuery("DELETE FROM UserValidationHashes WHERE uID = ?...
php
{ "resource": "" }
q24056
ValidationHash.getUserID
train
public static function getUserID($hash, $type) { self::removeExpired($type); $db = Database::connection(); $uID = $db->fetchColumn("SELECT uID FROM UserValidationHashes WHERE uHash = ? AND type = ?", array($hash, $type));
php
{ "resource": "" }
q24057
ValidationHash.getType
train
public static function getType($hash) { $db = Database::connection(); $type = $db->fetchColumn("SELECT type FROM UserValidationHashes WHERE uHash = ? ", array($hash)); if (is_numeric($type)
php
{ "resource": "" }
q24058
ValidationHash.isValid
train
public static function isValid($hash) { $type = self::getType($hash);
php
{ "resource": "" }
q24059
Validation.addUploadedImage
train
public function addUploadedImage($field, $errorMsg = null, $emptyIsOk = true) { $const = ($emptyIsOk) ? self::VALID_UPLOADED_IMAGE
php
{ "resource": "" }
q24060
Validation.addUploadedFile
train
public function addUploadedFile($field, $errorMsg = null, $emptyIsOk = true) { $const = ($emptyIsOk) ? self::VALID_UPLOADED_FILE
php
{ "resource": "" }
q24061
Validation.addInteger
train
public function addInteger($field, $errorMsg = null, $emptyIsOk = true) { $const = ($emptyIsOk) ? self::VALID_INTEGER
php
{ "resource": "" }
q24062
Validation.addRequiredEmail
train
public function addRequiredEmail($field, $errorMsg = null) {
php
{ "resource": "" }
q24063
Plugin.requireAsset
train
public function requireAsset($assetType, $assetHandle = false) { $list = AssetList::getInstance(); if ($assetType instanceof AssetInterface) { $this->requiredAssetGroup->addAsset($assetType); } elseif ($assetType && $assetHandle) {
php
{ "resource": "" }
q24064
LoginService.login
train
public function login($username, $password) { /** * @todo Invert this so that the `new User` constructor login relies on this service */ $className = $this->userClass; $user = new $className($username, $password); if ($user->isError()) {
php
{ "resource": "" }
q24065
LoginService.failLogin
train
public function failLogin($username, $password) { $ipFailed = false; $userFailed = false; // Track both failed logins from this IP and attempts to login to this user account $this->ipService->logFailedLogin(); $this->loginAttemptService->trackAttempt($username, $password); ...
php
{ "resource": "" }
q24066
LoginService.logLoginAttempt
train
public function logLoginAttempt($username, array $errors = []) { if ($this->app) { $entry = $this->app->make(LoginAttempt::class, [ $username, $this->request ? $this->request->getPath() : '',
php
{ "resource": "" }
q24067
LoginService.getGroups
train
private function getGroups($username) { if (!$this->entityManager) { return []; } $db = $this->entityManager->getConnection(); $queryBuilder = $db->createQueryBuilder(); $rows = $queryBuilder ->select('g.gName', 'u.uID')->from($db->getDatabasePlatfor...
php
{ "resource": "" }
q24068
LoginService.handleUserError
train
protected function handleUserError($errorNum) { switch ($errorNum) { case USER_INACTIVE: throw new NotActiveException(t($this->config->get('concrete.user.deactivation.message'))); case USER_SESSION_EXPIRED: throw new SessionExpiredException(t('Your se...
php
{ "resource": "" }
q24069
SanitizerOptions.normalizeStringList
train
protected function normalizeStringList($value) { if (is_string($value)) { $strings = preg_split('/\s+/', $value, -1, PREG_SPLIT_NO_EMPTY); } elseif (is_array($value)) { $strings = array_map('trim', array_map('strval', $value)); }
php
{ "resource": "" }
q24070
LabelFormatter.format
train
public function format($mask, callable $matchHandler) { try { // Run a regular expression to match the mask return preg_replace_callback('/%(.*?)%/i', function ($matches) use ($matchHandler) { // Return the result returned from the matchHandler return ...
php
{ "resource": "" }
q24071
AbstractView.post
train
public function post($key, $defaultValue = null) {
php
{ "resource": "" }
q24072
AbstractView.setThemeByPath
train
public function setThemeByPath($path, $theme = null, $wrapper = FILENAME_THEMES_VIEW) { $l = Router::get();
php
{ "resource": "" }
q24073
Client.setConsentType
train
public function setConsentType($consentType) { if ($consentType !== self::CONSENT_SIMPLE && $consentType !==
php
{ "resource": "" }
q24074
UserSelector.selectUser
train
public function selectUser($fieldName, $uID = false) { $v = View::getRequestInstance(); $v->requireAsset('core/users'); $request = $this->app->make(Request::class); if ($request->request->has($fieldName)) { $selectedUID = $request->request->get($fieldName); } els...
php
{ "resource": "" }
q24075
UserSelector.quickSelect
train
public function quickSelect($fieldName, $uID = false, $miscFields = []) { $v = View::getRequestInstance(); $v->requireAsset('selectize'); $request = $this->app->make(Request::class); if ($request->request->has($fieldName)) { $selectedUID = $request->request->get($fieldNa...
php
{ "resource": "" }
q24076
UserSelector.selectMultipleUsers
train
public function selectMultipleUsers($fieldName, $users = []) { $identifier = $this->app->make(Identifier::class)->getString(32); $i18n = [ 'username' => t('Username'), 'emailAddress' => t('Email Address'), 'chooseUser' => t('Choose User'), 'noUsers' =>...
php
{ "resource": "" }
q24077
Controller.highlightedMarkup
train
public function highlightedMarkup($fulltext, $highlight) { if (!$highlight) { return $fulltext; } $this->hText = $fulltext; $this->hHighlight = $highlight;
php
{ "resource": "" }
q24078
Controller.view
train
public function view() { $this->set('title', $this->title); $this->set('buttonText', $this->buttonText); $this->set('baseSearchPath', $this->baseSearchPath); $this->set('postTo_cID', $this->postTo_cID); if ((string) $this->resultsURL !== '') { $resultsPage = null...
php
{ "resource": "" }
q24079
Type.getUsedExtensionList
train
public static function getUsedExtensionList() { $app = Application::getFacadeApplication(); $db = $app->make('database')->connection(); $stm = $db->executeQuery("select distinct fvExtension from FileVersions where fvIsApproved = 1 and fvExtension is not null and fvExtension <> ''");
php
{ "resource": "" }
q24080
Type.getUsedTypeList
train
public static function getUsedTypeList() { $app = Application::getFacadeApplication(); $db = $app->make('database')->connection(); $stm = $db->query('select distinct fvType from FileVersions where fvIsApproved = 1 and fvType is not null and fvType <> 0');
php
{ "resource": "" }
q24081
Type.getThumbnail
train
public function getThumbnail($fullImageTag = true) { $app = Application::getFacadeApplication(); $config = $app->make('config'); $type = ThumbnailType::getByHandle($config->get('concrete.icons.file_manager_listing.handle')); if (file_exists(DIR_AL_ICONS . '/' . $this->getExtension() ...
php
{ "resource": "" }
q24082
Type.getGenericTypeText
train
public static function getGenericTypeText($type) { switch ($type) { case static::T_IMAGE: return t('Image'); break; case static::T_VIDEO: return t('Video'); break; case static::T_TEXT: return ...
php
{ "resource": "" }
q24083
RefreshTokenRepository.revokeRefreshToken
train
public function revokeRefreshToken($tokenId) { $this->getEntityManager()->transactional(function(EntityManagerInterface $em) use ($tokenId) { $token =
php
{ "resource": "" }
q24084
ImageInspector.updateSize
train
private function updateSize(Version $fv, ImageInterface $image) { $result = false; try { $size = $image->getSize(); } catch (Exception $x) { $size = null; } catch (Throwable $x) { $size = null; } if ($size !== null) { $a...
php
{ "resource": "" }
q24085
IPService.logFailedLogin
train
public function logFailedLogin(AddressInterface $ip = null, $ignoreConfig = false) { if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) { if ($ip === null) { $ip = $this->getRequestIPAddress(); } $comparableIP = $ip->getComparable...
php
{ "resource": "" }
q24086
IPService.failedLoginsThresholdReached
train
public function failedLoginsThresholdReached(AddressInterface $ip = null, $ignoreConfig = false) { $result = false; if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) { if ($ip === null) { $ip = $this->getRequestIPAddress(); } ...
php
{ "resource": "" }
q24087
IPService.addToBlacklistForThresholdReached
train
public function addToBlacklistForThresholdReached(AddressInterface $ip = null, $ignoreConfig = false) { if ($ignoreConfig || $this->config->get('concrete.security.ban.ip.enabled')) { if ($ip === null) { $ip = $this->getRequestIPAddress(); } $banDurationMin...
php
{ "resource": "" }
q24088
IPService.createRange
train
public function createRange(RangeInterface $range, $type, DateTime $expiration = null) { $dateTimeFormat = $this->connection->getDatabasePlatform()->getDateTimeFormatString(); $this->connection->executeQuery( ' INSERT INTO LoginControlIpRanges (lcirIpF...
php
{ "resource": "" }
q24089
IPService.getRanges
train
public function getRanges($type, $includeExpired = false) { $sql = 'SELECT * FROM LoginControlIpRanges WHERE lcirType = ?'; $params = [(int) $type]; if (!$includeExpired) { $sql .= ' AND (lcirExpires IS NULL OR lcirExpires > ' . $this->connection->getDatabasePlatform()->getNowExp...
php
{ "resource": "" }
q24090
IPService.getRangeByID
train
public function getRangeByID($id) { $result = null; if ($id) { $rs = $this->connection->executeQuery( 'SELECT * FROM LoginControlIpRanges WHERE lcirID = ? LIMIT 1', [$id] ); $row = $rs->fetch(); $rs->closeCursor(); ...
php
{ "resource": "" }
q24091
IPService.deleteRange
train
public function deleteRange($range) { if ($range instanceof IPRange) { $id = $range->getID(); } else { $id = (int) $range; } if ($id)
php
{ "resource": "" }
q24092
IPService.deleteFailedLoginAttempts
train
public function deleteFailedLoginAttempts($maxAge = null) { $sql = 'DELETE FROM FailedLoginAttempts'; if ($maxAge) { $platform = $this->connection->getDatabasePlatform(); $sql .= ' WHERE flaTimestamp <=
php
{ "resource": "" }
q24093
IPService.deleteAutomaticBlacklist
train
public function deleteAutomaticBlacklist($onlyExpired = true) { $sql = 'DELETE FROM LoginControlIpRanges WHERE lcirType = ' . (int) static::IPRANGETYPE_BLACKLIST_AUTOMATIC; if ($onlyExpired) { $platform = $this->connection->getDatabasePlatform();
php
{ "resource": "" }
q24094
Gettext.fixPlurals
train
private function fixPlurals($filename, TextDomain $textDomain, Language $localeInfo) { $expectedNumPlurals = count($localeInfo->categories); $pluralRule = $textDomain->getPluralRule(false); if ($pluralRule === null) { // Build the plural rules $pluralRule = Rule::from...
php
{ "resource": "" }
q24095
UserList.getResultIDs
train
public function getResultIDs() { $results = $this->executeGetResults(); $ids = []; foreach ($results
php
{ "resource": "" }
q24096
UserList.filterByIsActive
train
public function filterByIsActive($isActive) { $this->includeInactiveUsers(); $this->query->andWhere('u.uIsActive
php
{ "resource": "" }
q24097
UserList.filterByIsValidated
train
public function filterByIsValidated($isValidated) { $this->includeInactiveUsers(); if (!$isValidated) { $this->includeUnvalidatedUsers();
php
{ "resource": "" }
q24098
UserList.filterByFuzzyUserName
train
public function filterByFuzzyUserName($username) { $this->query->andWhere( $this->query->expr()->like('u.uName', ':uName')
php
{ "resource": "" }
q24099
UserList.checkGroupJoin
train
private function checkGroupJoin() { $query = $this->getQueryObject(); $params = $query->getQueryPart('join'); $isGroupSet = false; $isUserGroupSet = false; // Loop twice as params returns an array of arrays foreach ($params as $param) { foreach ($param as $set...
php
{ "resource": "" }