_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q249500 | OAuth.getResourceAttribute | validation | protected function getResourceAttribute($name, $resourceOwner)
{
// Call resource owner getter first
$method = "get" . $name;
if (is_callable(array($resourceOwner, $method))) {
$res = $resourceOwner->$method();
return $res;
} else {
$resourceArray... | php | {
"resource": ""
} |
q249501 | OAuth.saveLoginInfo | validation | protected function saveLoginInfo($resourceOwner)
{
// Initialize the user
$u = new User();
$u->setAuthenticated(true);
$u->setAuthenticator($this->getName());
// Get user id from the Resource Owner
$attrMap = $this->providerConfig['attributeMap'];
$userIdAttr... | php | {
"resource": ""
} |
q249502 | OAuth.saveAfterLogin | validation | protected function saveAfterLogin(Request $httpRequest)
{
$referer = $httpRequest->headers->get("referer", null, true);
$afterLogin = Utils::getRefererQueryParam($referer, "afterLogin");
if ($afterLogin && Utils::isValidPageId($afterLogin)) {
$this->session->set("afterLogin", $af... | php | {
"resource": ""
} |
q249503 | OAuth.isValidCallback | validation | protected function isValidCallback(Request $httpRequest)
{
return $this->session->has("provider")
&& $httpRequest->query->has("state")
&& $this->session->has("oauth2state")
&& is_string($this->session->get("oauth2state"))
&& (strlen($this->session->get("oauth2... | php | {
"resource": ""
} |
q249504 | OAuth.onStateMismatch | validation | protected function onStateMismatch()
{
$this->logger->warning(
"OAuth2 response state mismatch: provider: {provider} from {addr}",
array(
"provider" => get_class($this->provider),
"addr" => $_SERVER['REMOTE_ADDR']
)
);
$this... | php | {
"resource": ""
} |
q249505 | OAuth.onOAuthError | validation | protected function onOAuthError($errorCode)
{
$errorCode = strlen($errorCode > 100) ? substr($errorCode, 0, 100) : $errorCode;
$this->logger->notice(
"OAuth2 error response: code {code}, provider {provider}",
array(
"code" => $errorCode,
"prov... | php | {
"resource": ""
} |
q249506 | OAuth.onOauthResourceError | validation | protected function onOauthResourceError(IdentityProviderException $e)
{
$this->logger->critical(
"OAuth2 IdentityProviderException: {e}, provider {provider}",
array(
"e" => $e->getMessage(),
"provider" => get_class($this->provider),
)
... | php | {
"resource": ""
} |
q249507 | File.lock | validation | public function lock($lockType)
{
if (!$this->isOpened()) {
return false;
}
if ($this->options["blocking"]) {
return flock($this->handle, $lockType);
} else {
$tries = 0;
do {
if (flock($this->handle, $lockType | LOCK_N... | php | {
"resource": ""
} |
q249508 | File.close | validation | public function close()
{
if (!$this->isOpened()) {
return;
}
$this->unlock();
if ($this->handle && !fclose($this->handle)) {
throw new \RuntimeException("Could not close file " . $this->filePath);
}
} | php | {
"resource": ""
} |
q249509 | FileReader.open | validation | public function open()
{
if ($this->isOpened()) {
return;
}
if (!file_exists($this->filePath)) {
throw new \RuntimeException($this->filePath . " does not exist");
}
$this->handle = @fopen($this->filePath, self::OPEN_MODE);
if ($this->handle =... | php | {
"resource": ""
} |
q249510 | FileReader.read | validation | public function read()
{
$this->open();
// Better performance than fread() from the existing handle
// but it doesn't respect flock
$data = file_get_contents($this->filePath);
if ($data === false) {
throw new \RuntimeException("Could not read from file " . $this... | php | {
"resource": ""
} |
q249511 | PageLock.isUnlocked | validation | protected function isUnlocked($lockId)
{
$unlocked = $this->session->get("unlocked");
if ($unlocked && in_array($lockId, $unlocked)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q249512 | PageLock.getKeyEncoder | validation | protected function getKeyEncoder($lockData)
{
if (isset($lockData['encoder']) && is_string($lockData['encoder'])) {
$name = $lockData['encoder'];
} else {
$name = $this->config["encoder"];
}
try {
$instance = $this->picoAuth->getContainer()->get($... | php | {
"resource": ""
} |
q249513 | LocalAuthConfigurator.validateUsersSection | validation | public function validateUsersSection(&$config)
{
if (!isset($config["users"])) {
// No users are specified in the configuration file
return;
}
$this->assertArray($config, "users");
foreach ($config["users"] as $username => $userData) {
$th... | php | {
"resource": ""
} |
q249514 | LocalAuthConfigurator.validateUserData | validation | public function validateUserData($userData)
{
$this->assertRequired($userData, "pwhash");
$this->assertString($userData, "pwhash");
// All remaining options are optional
$this->assertString($userData, "email");
$this->assertArray($userData, "attributes");
$th... | php | {
"resource": ""
} |
q249515 | LocalAuthConfigurator.assertUsername | validation | public function assertUsername($username, $config)
{
if (!is_string($username)) {
throw new ConfigurationException("Username $username must be a string.");
}
$len = strlen($username);
$minLen=$config["registration"]["nameLenMin"];
$maxLen=$config["registration"]["... | php | {
"resource": ""
} |
q249516 | PicoAuthPlugin.handleEvent | validation | public function handleEvent($eventName, array $params)
{
if (method_exists($this, $eventName)) {
call_user_func_array(array($this, $eventName), $params);
}
} | php | {
"resource": ""
} |
q249517 | PicoAuthPlugin.triggerEvent | validation | public function triggerEvent($eventName, array $params = array())
{
foreach ($this->modules as $module) {
$module->handleEvent($eventName, $params);
}
} | php | {
"resource": ""
} |
q249518 | PicoAuthPlugin.onConfigLoaded | validation | public function onConfigLoaded(array &$config)
{
$config[self::PLUGIN_NAME] = $this->loadDefaultConfig($config);
$this->config = $config[self::PLUGIN_NAME];
$this->createContainer();
$this->initLogger();
} | php | {
"resource": ""
} |
q249519 | PicoAuthPlugin.onRequestUrl | validation | public function onRequestUrl(&$url)
{
$this->requestUrl = $url;
try {
// Plugin initialization
$this->init();
// Check submissions in all modules and apply their routers
$this->triggerEvent('onPicoRequest', [$url, $this->request]);
} catch (\... | php | {
"resource": ""
} |
q249520 | PicoAuthPlugin.onRequestFile | validation | public function onRequestFile(&$file)
{
// A special case for an error state of the plugin
if ($this->errorOccurred) {
$file = $this->requestFile;
return;
}
try {
// Resolve a normalized version of the url
$realUrl = ($this->requestFil... | php | {
"resource": ""
} |
q249521 | PicoAuthPlugin.onPagesLoaded | validation | public function onPagesLoaded(array &$pages)
{
unset($pages["403"]);
if (!$this->config["alterPageArray"]) {
return;
}
// Erase all pages if an error occurred
if ($this->errorOccurred) {
$pages = array();
return;
}
foreac... | php | {
"resource": ""
} |
q249522 | PicoAuthPlugin.onTwigRegistered | validation | public function onTwigRegistered(&$twig)
{
// If a theme is not found, it will be searched for in PicoAuth/theme
$twig->getLoader()->addPath($this->pluginDir . '/theme');
$this_instance = $this;
$twig->addFunction(
new \Twig_SimpleFunction(
'csrf_token',
... | php | {
"resource": ""
} |
q249523 | PicoAuthPlugin.onPageRendering | validation | public function onPageRendering(&$templateName, array &$twigVariables)
{
$twigVariables['auth']['plugin'] = $this;
$twigVariables['auth']['vars'] = $this->output;
// Variables useful only in successful execution
if (!$this->errorOccurred) {
$twigVariables['auth']['user']... | php | {
"resource": ""
} |
q249524 | PicoAuthPlugin.resolveRealUrl | validation | protected function resolveRealUrl($fileName)
{
$fileNameClean = str_replace("\0", '', $fileName);
$realPath = realpath($fileNameClean);
if ($realPath === false) {
// the page doesn't exist or realpath failed
return $this->requestUrl;
}
// Get... | php | {
"resource": ""
} |
q249525 | PicoAuthPlugin.init | validation | protected function init()
{
$this->loadModules();
$this->session = $this->container->get('session');
$this->csrf = new CSRF($this->session);
$this->user = $this->getUserFromSession();
$this->request = Request::createFromGlobals();
// Auto regenerate_id on s... | php | {
"resource": ""
} |
q249526 | PicoAuthPlugin.sessionTimeoutCheck | validation | protected function sessionTimeoutCheck($configKey, $sessKey, $clear, $alwaysUpdate = false)
{
if ($this->config[$configKey] !== false) {
$t = time();
if ($this->session->has($sessKey)) {
if ($this->session->get($sessKey) < $t - $this->config[$configKey]) {
... | php | {
"resource": ""
} |
q249527 | PicoAuthPlugin.loadDefaultConfig | validation | protected function loadDefaultConfig(array $config)
{
$configurator = new PluginConfigurator;
$validConfig = $configurator->validate(
isset($config[self::PLUGIN_NAME]) ? $config[self::PLUGIN_NAME] : null
);
return $validConfig;
} | php | {
"resource": ""
} |
q249528 | PicoAuthPlugin.createContainer | validation | protected function createContainer()
{
$configDir = $this->pico->getConfigDir();
$userContainer = $configDir . "PicoAuth/container.php";
// If a user provided own container definiton, it is used
if (is_file($userContainer) && is_readable($userContainer)) {
$this->contain... | php | {
"resource": ""
} |
q249529 | PicoAuthPlugin.loadModules | validation | protected function loadModules()
{
foreach ($this->config["authModules"] as $name) {
try {
$instance = $this->container->get($name);
} catch (\League\Container\Exception\NotFoundException $e) {
if (!class_exists($name)) {
throw new ... | php | {
"resource": ""
} |
q249530 | PicoAuthPlugin.authRoutes | validation | protected function authRoutes()
{
switch ($this->requestUrl) {
case 'login':
// Redirect already authenticated user visiting login page
if ($this->user->getAuthenticated()) {
$this->redirectToPage($this->config["afterLogin"]);
}... | php | {
"resource": ""
} |
q249531 | PicoAuthPlugin.checkLogoutSubmission | validation | protected function checkLogoutSubmission()
{
$post = $this->request->request;
if ($post->has("logout")) {
if (!$this->isValidCSRF($post->get("csrf_token"), self::LOGOUT_CSRF_ACTION)) {
$this->redirectToPage("logout");
}
$this->logout();
}
... | php | {
"resource": ""
} |
q249532 | PicoAuthPlugin.logout | validation | protected function logout()
{
$oldUser = $this->user;
$this->user = new User();
// Removes all session data (and invalidates all CSRF tokens)
$this->session->invalidate();
$this->triggerEvent("afterLogout", [$oldUser]);
// After logout redirect to main page... | php | {
"resource": ""
} |
q249533 | PicoAuthPlugin.checkAccess | validation | protected function checkAccess($url)
{
foreach ($this->modules as $module) {
if (false === $module->handleEvent('checkAccess', [$url])) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q249534 | PicoAuthPlugin.errorHandler | validation | protected function errorHandler(\Exception $e, $url = "")
{
$this->errorOccurred = true;
$this->requestFile = $this->pluginDir . '/content/error.md';
if ($this->config["debug"] === true) {
$this->addOutput("_exception", (string)$e);
}
$this->logger->critical(
... | php | {
"resource": ""
} |
q249535 | RateLimitFileStorage.openTransactionFile | validation | private function openTransactionFile($id)
{
if (!isset($this->tFiles[$id])) {
self::preparePath($this->dir, self::DATA_DIR);
$fileName = $this->dir . static::DATA_DIR . $id;
$handle = @fopen($fileName, 'c+');
if ($handle === false) {
throw new... | php | {
"resource": ""
} |
q249536 | FileWriter.open | validation | public function open()
{
if ($this->isOpened()) {
return;
}
$this->handle = @fopen($this->filePath, self::OPEN_MODE);
if ($this->handle === false) {
throw new \RuntimeException("Could not open file for writing: " . $this->filePath);
}
if (!$t... | php | {
"resource": ""
} |
q249537 | FileWriter.write | validation | public function write($data)
{
if (!is_string($data)) {
throw new \InvalidArgumentException("The data is not a string.");
}
$this->open();
if (!ftruncate($this->handle, 0)) {
$this->writeErrors = true;
throw new \RuntimeException("Could not trunc... | php | {
"resource": ""
} |
q249538 | FileWriter.createBkFile | validation | protected function createBkFile()
{
if (!is_writable(dirname($this->filePath))) {
return;
}
$this->bkFilePath = $this->filePath . '.' . date("y-m-d-H-i-s") . '.bak';
$bkHandle = @fopen($this->bkFilePath, 'x+');
if ($bkHandle === false) {
$this... | php | {
"resource": ""
} |
q249539 | FileWriter.removeBkFile | validation | protected function removeBkFile()
{
if (!$this->options["backup"]) {
return;
}
// Remove backup file if the write was successful
if (!$this->writeErrors && $this->bkFilePath) {
unlink($this->bkFilePath);
}
} | php | {
"resource": ""
} |
q249540 | PageACL.addRule | validation | public function addRule($url, $rule)
{
if (!is_string($url) || !is_array($rule)) {
throw new \InvalidArgumentException("addRule() expects a string and an array.");
}
$this->runtimeRules[$url] = $rule;
} | php | {
"resource": ""
} |
q249541 | PicoAuth.handleEvent | validation | public function handleEvent($eventName, array $params)
{
parent::handleEvent($eventName, $params);
if ($this->isEnabled()) {
$this->picoAuthPlugin->handleEvent($eventName, $params);
}
} | php | {
"resource": ""
} |
q249542 | EditAccount.handleAccountPage | validation | public function handleAccountPage(Request $httpRequest)
{
// Check if the functionality is enabled by the configuration
if (!$this->config["enabled"]) {
return;
}
$user = $this->picoAuth->getUser();
$this->picoAuth->addAllowed("account");
$this->picoAuth-... | php | {
"resource": ""
} |
q249543 | AbstractConfigurator.assertArray | validation | public function assertArray($config, $key)
{
if (array_key_exists($key, $config) && !is_array($config[$key])) {
throw new ConfigurationException($key." section must be an array.");
}
return $this;
} | php | {
"resource": ""
} |
q249544 | AbstractConfigurator.assertBool | validation | public function assertBool($config, $key)
{
if (array_key_exists($key, $config) && !is_bool($config[$key])) {
throw new ConfigurationException($key." must be a boolean value.");
}
return $this;
} | php | {
"resource": ""
} |
q249545 | AbstractConfigurator.assertInteger | validation | public function assertInteger($config, $key, $lowest = null, $highest = null)
{
if (array_key_exists($key, $config)) {
if (!is_int($config[$key])) {
throw new ConfigurationException($key." must be an integer.");
}
if ($lowest !== null && $config[$key] < $l... | php | {
"resource": ""
} |
q249546 | AbstractConfigurator.assertGreaterThan | validation | public function assertGreaterThan($config, $keyGreater, $keyLower)
{
if (!isset($config[$keyLower])
|| !isset($config[$keyGreater])
|| $config[$keyLower] >= $config[$keyGreater]) {
throw new ConfigurationException($keyGreater." must be greater than ".$keyLower);
}... | php | {
"resource": ""
} |
q249547 | AbstractConfigurator.assertString | validation | public function assertString($config, $key)
{
if (array_key_exists($key, $config) && !is_string($config[$key])) {
throw new ConfigurationException($key." must be a string.");
}
return $this;
} | php | {
"resource": ""
} |
q249548 | AbstractConfigurator.assertStringContaining | validation | public function assertStringContaining($config, $key, $searchedPart)
{
$this->assertString($config, $key);
if (array_key_exists($key, $config) && strpos($config[$key], $searchedPart) === false) {
throw new ConfigurationException($key." must contain ".$searchedPart);
}
ret... | php | {
"resource": ""
} |
q249549 | AbstractConfigurator.assertArrayOfStrings | validation | public function assertArrayOfStrings($config, $key)
{
if (!array_key_exists($key, $config)) {
return $this;
}
if (!is_array($config[$key])) {
throw new ConfigurationException($key." section must be an array.");
}
foreach ($config[$key] as $value) {
... | php | {
"resource": ""
} |
q249550 | AbstractConfigurator.assertIntOrFalse | validation | public function assertIntOrFalse($config, $key, $lowest = null, $highest = null)
{
try {
$this->assertInteger($config, $key, $lowest, $highest);
} catch (ConfigurationException $e) {
if ($config[$key]!==false) {
throw new ConfigurationException(
... | php | {
"resource": ""
} |
q249551 | AbstractConfigurator.standardizeUrlFormat | validation | public function standardizeUrlFormat(&$rules, $pageUrl)
{
if (!is_string($pageUrl) || $pageUrl==="" || !is_array($rules) ||
!array_key_exists($pageUrl, $rules) ) {
return;
}
$oldIndex=$pageUrl;
if ($pageUrl[0] !== '/') {
$pageUrl='/'.$... | php | {
"resource": ""
} |
q249552 | AbstractConfigurator.applyDefaults | validation | public function applyDefaults($config, array $defaults, $depth = 1)
{
if (!is_int($depth) || $depth < 0) {
throw new \InvalidArgumentException("Depth must be non-negative integer.");
}
if (!is_array($config)) {
return $defaults;
}
if ... | php | {
"resource": ""
} |
q249553 | PasswordReset.handlePasswordReset | validation | public function handlePasswordReset(Request $httpRequest)
{
$this->httpRequest = $httpRequest;
// Check if a valid reset link is present
$this->checkResetLink();
// Check if the user already has a password reset session
$resetData = $this->session->get("pwreset");
... | php | {
"resource": ""
} |
q249554 | PasswordReset.beginPasswordReset | validation | protected function beginPasswordReset()
{
// Check if password reset is enabled
if (!$this->config["enabled"]) {
return;
}
$this->picoAuth->addAllowed("password_reset");
$this->picoAuth->setRequestFile($this->picoAuth->getPluginPath() . '/content/pwbeginreset.md')... | php | {
"resource": ""
} |
q249555 | PasswordReset.finishPasswordReset | validation | protected function finishPasswordReset(array $resetData)
{
if (time() > $resetData['validity']) {
$this->session->remove("pwreset");
$this->session->addFlash("error", "Page validity expired, please try again.");
$this->picoAuth->redirectToLogin();
}
$this... | php | {
"resource": ""
} |
q249556 | PasswordReset.checkResetLink | validation | protected function checkResetLink()
{
// Check if the reset links are enabled, if token is present,
// if it has a valid format and length
if (!$this->config["enabled"]
|| !($token = $this->httpRequest->query->get("confirm", false))
|| !preg_match("/^[a-f0-9]+$/", $to... | php | {
"resource": ""
} |
q249557 | PasswordReset.startPasswordResetSession | validation | public function startPasswordResetSession($user)
{
$this->session->migrate(true);
$this->session->set("pwreset", array(
'user' => $user,
'validity' => time() + $this->config["resetTimeout"]
));
} | php | {
"resource": ""
} |
q249558 | PasswordReset.sendResetMail | validation | protected function sendResetMail($userData)
{
if (!$this->mailer) {
$this->getLogger()->critical("Sending mail but no mailer is set!");
return;
}
$url = $this->createResetToken($userData['name']);
// Replaces Pico-specific placeholders... | php | {
"resource": ""
} |
q249559 | PasswordPolicy.minLength | validation | public function minLength($n)
{
$this->constraints[] = (function (Password $str) use ($n) {
if (mb_strlen($str) < $n) {
return sprintf("Minimum password length is %d characters.", $n);
} else {
return true;
}
});
return $thi... | php | {
"resource": ""
} |
q249560 | PasswordPolicy.matches | validation | public function matches($regexp, $message)
{
if (!is_string($regexp) || !is_string($message)) {
throw new \InvalidArgumentException("Both arguments must be string.");
}
$this->constraints[] = (function (Password $str) use ($regexp, $message) {
if (!preg_match($regexp,... | php | {
"resource": ""
} |
q249561 | Client.getCaptchaResultBulk | validation | public function getCaptchaResultBulk(array $captchaIds)
{
$response = $this->getHttpClient()->request('GET', '/res.php?' . http_build_query([
'key' => $this->apiKey,
'action' => 'get',
'ids' => join(',', $captchaIds)
]));
$captchaTexts = $... | php | {
"resource": ""
} |
q249562 | Client.badCaptcha | validation | public function badCaptcha($captchaId)
{
$response = $this
->getHttpClient()
->request('GET', "/res.php?key={$this->apiKey}&action=reportbad&id={$captchaId}");
$responseText = $response->getBody()->__toString();
if ($responseText === self::STATUS_OK_REPORT_RECORDED)... | php | {
"resource": ""
} |
q249563 | Client.getLoad | validation | public function getLoad($paramsList = ['waiting', 'load', 'minbid', 'averageRecognitionTime'])
{
$parser = $this->getLoadXml();
if (is_string($paramsList)) {
return $parser->$paramsList->__toString();
}
$statusData = [];
foreach ($paramsList as $item) {
... | php | {
"resource": ""
} |
q249564 | Client.addPingback | validation | public function addPingback($url)
{
$response = $this
->getHttpClient()
->request('GET', "/res.php?key={$this->apiKey}&action=add_pingback&addr={$url}");
$responseText = $response->getBody()->__toString();
if ($responseText === self::STATUS_OK) {
return ... | php | {
"resource": ""
} |
q249565 | Client.getPingbacks | validation | public function getPingbacks()
{
$response = $this
->getHttpClient()
->request('GET', "/res.php?key={$this->apiKey}&action=get_pingback");
$responseText = $response->getBody()->__toString();
if (strpos($responseText, 'OK|') !== false) {
$data = explode('... | php | {
"resource": ""
} |
q249566 | Client.deletePingback | validation | public function deletePingback($uri)
{
$response = $this
->getHttpClient()
->request('GET', "/res.php?key={$this->apiKey}&action=del_pingback&addr={$uri}");
$responseText = $response->getBody()->__toString();
if ($responseText === self::STATUS_OK) {
retu... | php | {
"resource": ""
} |
q249567 | Client.sendRecaptchaV2 | validation | public function sendRecaptchaV2($googleKey, $pageUrl, $extra = [])
{
$this->getLogger()->info("Try send google key (recaptcha) on {$this->serverBaseUri}/in.php");
if ($this->softId && !isset($extra[Extra::SOFT_ID])) {
$extra[Extra::SOFT_ID] = $this->softId;
}
$response... | php | {
"resource": ""
} |
q249568 | Client.recognizeRecaptchaV2 | validation | public function recognizeRecaptchaV2($googleKey, $pageUrl, $extra = [])
{
$captchaId = $this->sendRecaptchaV2($googleKey, $pageUrl, $extra);
$startTime = time();
while (true) {
$this->getLogger()->info("Waiting {$this->rTimeout} sec.");
sleep($this->recaptchaRTimeou... | php | {
"resource": ""
} |
q249569 | Client.getCaptchaResult | validation | public function getCaptchaResult($captchaId)
{
$response = $this
->getHttpClient()
->request('GET', "/res.php?key={$this->apiKey}&action=get&id={$captchaId}&json=1");
$responseData = json_decode($response->getBody()->__toString(), true);
if (JSON_ERROR_NONE !== json... | php | {
"resource": ""
} |
q249570 | Builder.whereExists | validation | public function whereExists(Closure $callback, $boolean = 'and', $not = false)
{
$type = $not ? 'NotExists' : 'Exists';
$this->wheres[] = compact('type', 'callback', 'boolean');
return $this;
} | php | {
"resource": ""
} |
q249571 | Driver.connect | validation | public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
if (PlatformHelper::isWindows()) {
return $this->connectWindows($params, $username, $password, $driverOptions);
}
return $this->connectUnix($params, $username, $password, $driv... | php | {
"resource": ""
} |
q249572 | Driver.constructPdoDsn | validation | public function constructPdoDsn(array $params)
{
if (PlatformHelper::isWindows()) {
return $this->constructPdoDsnWindows($params);
}
return $this->constructPdoDsnUnix($params);
} | php | {
"resource": ""
} |
q249573 | DblibSchemaManager.listSequences | validation | public function listSequences($database = null)
{
$query = "SELECT name FROM sysobjects WHERE xtype = 'U'";
$tableNames = $this->_conn->fetchAll($query);
return array_map([$this->_conn->formatter, 'fixSequenceName'], $tableNames);
} | php | {
"resource": ""
} |
q249574 | PdoSessionHandler.getSelectSql | validation | private function getSelectSql()
{
if (self::LOCK_TRANSACTIONAL === $this->lockMode) {
$this->beginTransaction();
switch ($this->driver) {
case 'mysql':
case 'oci':
case 'pgsql':
return "SELECT $this->dataCol, $this-... | php | {
"resource": ""
} |
q249575 | Scope.addScope | validation | public function addScope($scope)
{
if($this->isValidScope($scope)){
$this->scope[$scope] = $scope;
}
return $this;
} | php | {
"resource": ""
} |
q249576 | Scope.removeScope | validation | public function removeScope($scope)
{
if($this->isValidScope($scope) && $this->hasScope($scope)){
unset($this->scope[$scope]);
}
return $this;
} | php | {
"resource": ""
} |
q249577 | InNestedArray.setValueMutator | validation | public function setValueMutator(callable $callback) : self
{
$this->valueMutator = $callback;
$this->value = ($this->valueMutator)($this->value);
return $this;
} | php | {
"resource": ""
} |
q249578 | Insert.values | validation | public function values($values)
{
if (is_array($values) === true) {
if (is_numeric(key($values)) === true) {
$this->values = array(
null,
implode(', ', $values)
);
} else {
$this->values = array('... | php | {
"resource": ""
} |
q249579 | Insert.returning | validation | public function returning($returning)
{
if (is_array($returning) === true) {
$this->returning = implode(', ', $returning);
} else {
$this->returning = $returning;
}
return $this;
} | php | {
"resource": ""
} |
q249580 | Config.get | validation | public static function get(string $fileName) : array
{
if (isset(self::$files[$fileName]) === false) {
if (($content = file_get_contents($fileName)) === false) {
throw new FileNotReadable('file "' . $fileName . '" can\'t be read');
}
$content = (string) $c... | php | {
"resource": ""
} |
q249581 | Config.set | validation | public static function set(string $fileName, array $content)
{
try {
$json = Yaml::dump($content, 2);
if (file_put_contents($fileName, $json) === false) {
throw new FileNotWritable('can\'t write to "' . $fileName . '"');
}
} catch (DumpException $e... | php | {
"resource": ""
} |
q249582 | ErrorPage.init | validation | public static function init()
{
if (self::$isInit === false) {
self::$prettyPageHandler = new PrettyPageHandler();
self::$prettyPageHandler->setPageTitle('I just broke a string... - strayFw');
$whoops = new Run();
$whoops->pushHandler(new JsonResponseHandler()... | php | {
"resource": ""
} |
q249583 | ErrorPage.addData | validation | public static function addData(string $title, array $data)
{
if (self::$isInit === true) {
self::$prettyPageHandler->AddDataTable($title, $data);
}
} | php | {
"resource": ""
} |
q249584 | Http.init | validation | public static function init()
{
if (self::$isInit === false) {
self::$rawRequest = null;
self::$routes = array();
self::$isInit = true;
if (defined('STRAY_IS_HTTP') === true && constant('STRAY_IS_HTTP') === true) {
self::$rawRequest = new RawRe... | php | {
"resource": ""
} |
q249585 | Http.run | validation | public static function run()
{
if (self::$isInit === true) {
if ((self::$rawRequest instanceof RawRequest) === false) {
throw new RuntimeException('Raw request was not specified!');
}
self::$request = new Request(self::$rawRequest, self::$routes);
... | php | {
"resource": ""
} |
q249586 | Http.prefix | validation | public static function prefix(string $namespace, $subdomain = null, string $uri = null)
{
self::$namespace = $namespace;
self::$subdomain = is_array($subdomain) ? $subdomain : [ $subdomain ];
self::$uri = $uri;
} | php | {
"resource": ""
} |
q249587 | Http.route | validation | public static function route($method, $path, $action)
{
if (self::$isInit === true) {
self::$routes[] = array(
'type' => 'route',
'method' => $method,
'path' => $path,
'action' => $action,
'namespace' => self::$names... | php | {
"resource": ""
} |
q249588 | PostVoter.canEdit | validation | public function canEdit(GroupableInterface $post, TokenInterface $token): bool
{
$user = $token->getUser();
if ($post->getAuthor() == $user->getUsername()) {
return true;
}
foreach ($post->getGroups() as $group) {
if ($this->decision_manager->decide($token, [... | php | {
"resource": ""
} |
q249589 | Enum.setValue | validation | public function setValue(string $v) : string
{
if (static::isValid($v) === false) {
throw new BadUse('"' . $v . '" is not recognized as a possible value');
}
$this->value = $v;
} | php | {
"resource": ""
} |
q249590 | Enum.toArray | validation | public static function toArray() : array
{
if (static::$array == null) {
$ref = new \ReflectionClass(static::class);
$consts = $ref->getConstants();
static::$array = array();
foreach ($consts as $key => $value) {
if (stripos($key, 'VALUE_') ===... | php | {
"resource": ""
} |
q249591 | EmailJob.perform | validation | public function perform(array $args = []): int
{
// Create a transport
$transport = new Swift_SmtpTransport(
$args['smtp']['host'],
$args['smtp']['port']
);
$transport->setUsername($args['smtp']['username']);
$transport->setPassword($args['smtp']['pass... | php | {
"resource": ""
} |
q249592 | Condition.toSqlLevel | validation | protected function toSqlLevel(array $tree) : string
{
if (count($tree) == 0) {
return '';
}
$sql = '(';
reset($tree);
if (is_numeric(key($tree)) === true) {
foreach ($tree as $elem) {
$sql .= $elem . ' AND ';
}
$... | php | {
"resource": ""
} |
q249593 | SignalHandler.handle | validation | public function handle(int $signal)
{
// If this signal is already being handled, return a Failure Promise and don't do anything
if (isset($this->handlers[$signal]) && $this->handlers[$signal] === true) {
return new Failure(new Exception('Signal is already being processed.'));
}
... | php | {
"resource": ""
} |
q249594 | SignalHandler.shutdown | validation | private function shutdown($signal = 9)
{
// Iterate through all the existing processes, and send the appropriate signal to the process
foreach ($this->dispatcher->getProcesses() as $pid => $process) {
$this->logger->debug('Sending signal to process', [
'signal' => $signal... | php | {
"resource": ""
} |
q249595 | Schema.buildEnum | validation | private function buildEnum(string $enumName, array $enumDefinition)
{
$mapping = Mapping::get($this->mapping);
$definition = $this->getDefinition();
$database = GlobalDatabase::get($mapping['config']['database']);
$enumRealName = null;
if (isset($enumDefinition['name']) === ... | php | {
"resource": ""
} |
q249596 | Schema.buildModel | validation | private function buildModel(string $modelName, array $modelDefinition)
{
$mapping = Mapping::get($this->mapping);
$definition = $this->getDefinition();
$database = GlobalDatabase::get($mapping['config']['database']);
$tableName = null;
if (isset($modelDefinition['name']) ===... | php | {
"resource": ""
} |
q249597 | Schema.generateModels | validation | public function generateModels()
{
$definition = $this->getDefinition();
foreach ($definition as $modelName => $modelDefinition) {
$type = 'model';
if (isset($modelDefinition['type']) === true && in_array($modelDefinition['type'], [ 'enum', 'model' ]) === true) {
... | php | {
"resource": ""
} |
q249598 | Helper.extractDomain | validation | public static function extractDomain(RawRequest $rawRequest)
{
$domain = null;
if (preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/i", $rawRequest->getHost(), $matches)) {
$domain = $matches['domain'];
}
return $domain;
} | php | {
"resource": ""
} |
q249599 | Helper.niceUrl | validation | public static function niceUrl(string $url)
{
$nice = null;
if (($pos = stripos($url, '.')) !== false) {
list($subDomain, $url) = explode('.', $url);
$request = Http::getRequest();
$nice = $request->getRawRequest()->getScheme() . '://';
if ($subDomain ... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.