_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q259400
UserController.putActivate
test
public function putActivate($userId) { try { $user = Sentry::getUserProvider()->findById($userId); $activationCode = $user->getActivationCode(); $user->attemptActivation($activationCode); } catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) { ret...
php
{ "resource": "" }
q259401
UserController.getShow
test
public function getShow($userId) { try { $user = Sentry::getUserProvider()->findById($userId); $throttle = Sentry::getThrottleProvider()->findByUserId($userId); $groups = Sentry::getGroupProvider()->findAll(); // get user permissions $permissions ...
php
{ "resource": "" }
q259402
GroupController.getIndex
test
public function getIndex() { $emptyGroup = Sentry::getGroupProvider()->createModel(); // Ajax search $groupId = Input::get('groupIdSearch'); if(!empty($groupId)) { $emptyGroup = $emptyGroup->where('id', $groupId); } $groupname = Input::get('groupnameSear...
php
{ "resource": "" }
q259403
GroupController.putShow
test
public function putShow($groupId) { $groupname = Input::get('groupname'); $permissions = array(); $errors = $this->_validateGroup(Input::get('permission'), $groupname, $permissions); if(!empty($errors)) { return Response::json(array('groupUpdated' => false, 'errorMessage...
php
{ "resource": "" }
q259404
GroupController.deleteUserFromGroup
test
public function deleteUserFromGroup($groupId, $userId) { try { $user = Sentry::getUserProvider()->findById($userId); $group = Sentry::getGroupProvider()->findById($groupId); $user->removeGroup($group); return Response::json(array('userDeleted' => true, 'messa...
php
{ "resource": "" }
q259405
GroupController.addUserInGroup
test
public function addUserInGroup() { try { $user = Sentry::getUserProvider()->findById(Input::get('userId')); $group = Sentry::getGroupProvider()->findById(Input::get('groupId')); $user->addGroup($group); return Response::json(array('userAdded' => true, 'messag...
php
{ "resource": "" }
q259406
GroupController._validateGroup
test
protected function _validateGroup($permissionsValues, $groupname, &$permissions) { $errors = array(); // validate permissions if(!empty($permissionsValues)) { foreach($permissionsValues as $key => $permission) { $permissions[$key] = 1; } } ...
php
{ "resource": "" }
q259407
SyntaraServiceProvider.loadIncludes
test
private function loadIncludes() { // Add file names without the `php` extension to this list as needed. $filesToLoad = array( 'composers', 'filters', 'routes', ); // Run through $filesToLoad array. foreach ($filesToLoad as $file) { ...
php
{ "resource": "" }
q259408
SyntaraServiceProvider.registerHelpers
test
public function registerHelpers() { // register breadcrumbs $this->app['breadcrumbs'] = $this->app->share(function () { return new \MrJuliuss\Syntara\Helpers\Breadcrumbs(); }); // shortcut so developers don't need to add an Alias in app/config/app.php $this->app-...
php
{ "resource": "" }
q259409
DashboardController.getIndex
test
public function getIndex() { $this->layout = View::make(Config::get('syntara::views.dashboard-index')); $this->layout->title = trans('syntara::all.titles.index'); $this->layout->breadcrumb = Config::get('syntara::breadcrumbs.dashboard'); }
php
{ "resource": "" }
q259410
DashboardController.postLogin
test
public function postLogin() { try { $validator = new UserValidator(Input::all(), 'login'); $loginAttribute = Config::get('cartalyst/sentry::users.login_attribute'); if(!$validator->passes()) { return Response::json(array('logged' => false, 'errorMessages...
php
{ "resource": "" }
q259411
PermissionController.getIndex
test
public function getIndex() { $permissions = PermissionProvider::createModel(); $permissionId = Input::get('permissionIdSearch'); if(!empty($permissionId)) { $permissions = $permissions->where('id', $permissionId); } $permissionName = Input::get('permissionNameSear...
php
{ "resource": "" }
q259412
PermissionController.postCreate
test
public function postCreate() { try { $validator = new PermissionValidator(Input::all()); if(!$validator->passes()) { return Response::json(array('permissionCreated' => false, 'errorMessages' => $validator->getErrors())); } // create permission...
php
{ "resource": "" }
q259413
PermissionController.delete
test
public function delete($permissionId) { try { $permission = PermissionProvider::findById($permissionId); $permission->delete(); } catch (\MrJuliuss\Syntara\Models\Permissions\PermissionNotFoundException $e) { return Response::json(array('deletePermission' => false...
php
{ "resource": "" }
q259414
PdfView.paginate
test
private function paginate() { $canvas = $this->pdf->get_canvas(); $c = array_merge($this->_pagination, $this->config['paginate']); $canvas->page_text($c['x'], $c['y'], $c['text'], $c['font'], $c['size'], $c['color']); }
php
{ "resource": "" }
q259415
Permissions.authenticate
test
public function authenticate($username, $password) { $response = $this->post('Permissions.Authenticate', array( 'login' => $username, 'password' => $password, )); return $this->returnResponse($response); }
php
{ "resource": "" }
q259416
Wsse.getNonce
test
protected function getNonce() { return sprintf('%04x%04x-%04x-%03x4-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 4095), bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '01', 6, 2)), mt_rand(0, 6...
php
{ "resource": "" }
q259417
OptionParser.__isset
test
public function __isset($flag) { try { $this->checkFlag($flag); } catch (\Exception $e) { return false; } $ruleIndex = $this->_flags[$flag]; return isset($this->_options[$ruleIndex]); }
php
{ "resource": "" }
q259418
OptionParser.getRule
test
public function getRule($flag) { try { $this->checkFlag($flag); } catch (Exception $e) { return null; } $ruleIndex = $this->_flags[$flag]; return $this->_rules[$ruleIndex]; }
php
{ "resource": "" }
q259419
OptionParser.expectsParameter
test
public function expectsParameter($flag) { $rule = $this->getRule($flag); return $rule && $rule['required'] !== self::PARAM_NOTREQUIRED; }
php
{ "resource": "" }
q259420
OptionParser.isRequired
test
public function isRequired($flag) { $rule = $this->getRule($flag); return $rule && $rule['required'] === self::PARAM_REQUIRED; }
php
{ "resource": "" }
q259421
OptionParser.isOptional
test
public function isOptional($flag) { $rule = $this->getRule($flag); return $rule && $rule['required'] === self::PARAM_OPTIONAL; }
php
{ "resource": "" }
q259422
OptionParser.parse
test
public function parse(array &$argv=null) { $this->_options = array(); if ($argv === null) { if (isset($_SERVER['argv'])) { $argv = $_SERVER['argv']; } else { $argv = array(); } } $this->_programName = array_shift($...
php
{ "resource": "" }
q259423
OptionParser.isParam
test
protected function isParam($string) { if ($this->_config & self::CONF_DASHDASH && $string == '--') { return false; } return !$this->isFlag($string); }
php
{ "resource": "" }
q259424
SoapClient.orderParameters
test
protected function orderParameters($parameters, $template) { foreach ($parameters as $key => $value) { // if a parameter appears to be a nested type if (is_array($value) && !empty($value) && !isset($value[0])) { $parameters[$key] = $this->orderParameters($parameters[$...
php
{ "resource": "" }
q259425
Client.authenticate
test
public function authenticate() { $auth = $this->getHttpClient()->getAuthService(); $args = func_get_args(); // php 5.2 requires this be on a separate line call_user_func_array(array($auth, 'authenticate'), $args); return $this; }
php
{ "resource": "" }
q259426
Client.getReportApi
test
public function getReportApi($options = array()) { if(!isset($this->apis['report'])) { $this->apis['report'] = new Api\Report($this, $options); } return $this->apis['report']; }
php
{ "resource": "" }
q259427
Client.getPermissionsApi
test
public function getPermissionsApi($options = array()) { if(!isset($this->apis['permissions'])) { $this->apis['permissions'] = new Api\Permissions($this, $options); } return $this->apis['permissions']; }
php
{ "resource": "" }
q259428
Client.getCompanyApi
test
public function getCompanyApi($options = array()) { if(!isset($this->apis['company'])) { $this->apis['company'] = new Api\Company($this, $options); } return $this->apis['company']; }
php
{ "resource": "" }
q259429
Client.getOAuthApi
test
public function getOAuthApi($options = array()) { if(!isset($this->apis['oauth'])) { $this->apis['oauth'] = new Api\OAuth($this, $options); } return $this->apis['oauth']; }
php
{ "resource": "" }
q259430
HttpClient.request
test
public function request($path, array $parameters = array(), $httpMethod = 'GET', array $options = array()) { $options = array_merge($this->options, $options); // create full url $url = strtr($options['url'], array( ':api_version' => $this->options['api_version'], ':proto...
php
{ "resource": "" }
q259431
Report.getElements
test
public function getElements($reportSuiteID, $returnAsIdArray = false) { $response = $this->post('Report.GetElements', array('reportSuiteID' => $reportSuiteID)); if ($returnAsIdArray) { $filtered = array(); foreach ($response as $element) { $filtered[$element['...
php
{ "resource": "" }
q259432
Report.getMetrics
test
public function getMetrics($reportSuiteID, $returnAsIdArray = false) { $response = $this->post('Report.GetMetrics', array('reportSuiteID' => $reportSuiteID)); if ($returnAsIdArray) { $filtered = array(); foreach ($response as $metric) { $filtered[$metric['id']...
php
{ "resource": "" }
q259433
Report.retryWhileNotReady
test
protected function retryWhileNotReady($reportId) { $attempts = 0; do { $report = $this->post('Report.Get', array( 'reportID' => $reportId, )); $sleep = $this->getSleepSeconds(++$attempts, 50); if ($sleep !== false) { sle...
php
{ "resource": "" }
q259434
Report.getSleepSeconds
test
protected function getSleepSeconds($attempts, $maxAttempts = null) { if ($maxAttempts && $attempts >= $maxAttempts) { return false; } // very complex. return $attempts * $attempts; }
php
{ "resource": "" }
q259435
PixabayClient.parseOptions
test
private function parseOptions(array $options, $resetOptions = false) { foreach ($this->optionsList as $option) { if (isset($options[$option])) { $this->options[$option] = $options[$option]; } elseif ($resetOptions && isset($this->options[$option])) { ...
php
{ "resource": "" }
q259436
PixabayClient.get
test
public function get(array $options = [], $returnObject = false, $resetOptions = false, $segment = self::SEGMENT_IMAGES) { $this->parseOptions($options, $resetOptions); $response = $this->client->request('GET', self::API_ROOT . $segment, ['query' => $this->options]); $data = $response->getBod...
php
{ "resource": "" }
q259437
PixabayClient.getImages
test
public function getImages(array $options = [], $returnObject = false, $resetOptions = false) { return $this->get($options, $returnObject, $resetOptions, self::SEGMENT_IMAGES); }
php
{ "resource": "" }
q259438
PixabayClient.getVideos
test
public function getVideos(array $options = [], $returnObject = false, $resetOptions = false) { return $this->get($options, $returnObject, $resetOptions, self::SEGMENT_VIDEOS); }
php
{ "resource": "" }
q259439
AbstractOutput.stdout
test
public static function stdout($string) { $args = func_get_args(); array_shift($args); if (empty($args)) { return Console::stdout($string); } $string = Console::ansiFormat($string, $args); return Console::stdout($string); }
php
{ "resource": "" }
q259440
Schema.getTable
test
public function getTable(TableSchema $table, $indent = 0) { $definition = $this->getCreateTable($table->name, $indent) . $this->getColumns($table->columns, $indent + 1) . $this->getTableOptions($table, $indent) ; return $definition; }
php
{ "resource": "" }
q259441
Schema.getDropTable
test
public function getDropTable(TableSchema $table, $indent = 0) { // Do not run this sql: "drop table `tableName`", it will drop the table that has exists before running "./yii migrate" $textIndent = $this->textIndent($indent); $tableName = static::removePrefix($table->name, $this->db->tableP...
php
{ "resource": "" }
q259442
Schema.getDropTableData
test
public function getDropTableData(TableSchema $table, $indent = 0) { // Do not use "truncate tableName", it will delete all data of table, include data before you run "./yii migrate" commond $definition = $this->textIndent($indent); $definition .= "\$this->_transaction->rollBack();"; ...
php
{ "resource": "" }
q259443
Schema.getKey
test
public function getKey(TableSchema $table, $indent = 0) { $definition = ''; $textIndent = $this->textIndent($indent); $tablePrefix = $this->db->tablePrefix; $tableName = static::removePrefix($table->name, $tablePrefix); $data = $this->db->createCommand('SHOW KEYS FROM ' . $t...
php
{ "resource": "" }
q259444
Schema.getDropKey
test
public function getDropKey(TableSchema $table, $indent = 0) { $textIndent = $this->textIndent($indent); $tableName = static::removePrefix($table->name, $this->db->tablePrefix); $definition = <<<DEFINITION {$textIndent}foreach (\$this->runSuccess as \$keyName => \$value) { {$textIndent} i...
php
{ "resource": "" }
q259445
Schema.getFK
test
public function getFK(TableSchema $table, $indent = 0) { if (empty($table->foreignKeys)) { return ''; } $string = $this->db->createCommand("SHOW CREATE TABLE {$table->name}")->queryAll(); $onParams = $this->FKOnParams($string[0]['Create Table']); $textIndent = $...
php
{ "resource": "" }
q259446
Schema.getDropFK
test
public function getDropFK(TableSchema $table, $indent = 0) { if (empty($table->foreignKeys)) { return ''; } $textIndent = $this->textIndent($indent); $tableName = static::removePrefix($table->name, $this->db->tablePrefix); $definition = <<<DEFINITION {$textInden...
php
{ "resource": "" }
q259447
Schema.getColumns
test
public function getColumns(array $columns, $indent = 0) { $definition = ''; $textIndent = $this->textIndent($indent); foreach ($columns as $column) { $tmp = sprintf("'%s' => \$this->%s%s," . self::ENTER, $column->name, static::getSchemaType($column), static::other...
php
{ "resource": "" }
q259448
Schema.getPrimaryKey
test
public function getPrimaryKey(array $pk, array $columns, $indent = 0) { if (empty($pk)) { return ''; } // Composite primary keys if (2 <= count($pk)) { $compositePk = implode(', ', $pk); return $this->textIndent($indent) . "'PRIMARY KEY ($composit...
php
{ "resource": "" }
q259449
Schema.getTableComment
test
public function getTableComment(TableSchema $table, $indent = 0) { if (null === $this->_tableStatus) { try { // 不知 “SHOW TABLE STATUS” sql语句在其他数据库中是否会执行成功,所以用try catch捕获异常 $this->_tableStatus = $this->db->createCommand('SHOW TABLE STATUS')->queryAll(); ...
php
{ "resource": "" }
q259450
Schema.getSchemaType
test
public static function getSchemaType(ColumnSchema $column) { // boolean if ('tinyint(1)' === $column->dbType) { return 'boolean()'; } // enum if (null !== $column->enumValues) { // https://github.com/yiisoft/yii2/issues/9797 $enumValues = ...
php
{ "resource": "" }
q259451
Schema.other
test
public static function other(ColumnSchema $column) { $definition = ''; // unsigned if ($column->unsigned) { $definition .= '->unsigned()'; } // null if ($column->allowNull) { $definition .= '->null()'; } else { $definition...
php
{ "resource": "" }
q259452
DumpController.actionList
test
public function actionList() { $tableList = $this->schema->getTableList($this->db, $this->sparactor) . "\n"; return $this->output->stdout($tableList, 0, Console::FG_YELLOW); }
php
{ "resource": "" }
q259453
DumpController.actionGenerate
test
public function actionGenerate() { $this->output->startPrintf('Process'); $tableOptions = $this->getOptions($this->table); $filterOptions = $this->getOptions($this->filter); $info = Yii::t('dump', 'Generate Migration File'); foreach ($this->db->getSchema()->getTableSchemas()...
php
{ "resource": "" }
q259454
DumpController.actionCreate
test
public function actionCreate() { $this->output->startPrintf('Process'); $tableOptions = $this->getOptions($this->table); $filterOptions = $this->getOptions($this->filter); $createTableInfo = Yii::t('dump', 'Create Table'); $insertDataInfo = Yii::t('dump', 'Insert Data Of Tab...
php
{ "resource": "" }
q259455
DumpController.actionDrop
test
public function actionDrop() { $this->output->startPrintf('Process'); $tableOptions = $this->getOptions($this->table); $filterOptions = $this->getOptions($this->filter); $dropTableInfo = Yii::t('dump', 'Drop Table'); $dropDataInfo = Yii::t('dump', 'Drop Data Of Table'); ...
php
{ "resource": "" }
q259456
DumpController.generateFile
test
public function generateFile(TableSchema $table, $functionName, $tip = null, $indent = 0) { $params = $this->getParams($table, $functionName, $indent); if ( empty($params['safeUp']) || empty($params['safeDown']) || empty($params['className']) ) { ...
php
{ "resource": "" }
q259457
DumpController.printf
test
public function printf(TableSchema $table, $functionName, $tip = null, $indent = 0) { $params = []; $params[] = &$table; $params[] = $indent; $functionName = ucfirst($functionName); $functionName = 'get' . $functionName; if ('getTableData' === $functionName) { ...
php
{ "resource": "" }
q259458
DumpController.getParams
test
public function getParams(TableSchema $table, $functionName, $indent = 0) { $params = []; $params[] = &$table; $params[] = $indent; $ucFunctionName = ucfirst($functionName); $get = 'get' . $ucFunctionName; $drop = 'getDrop' . $ucFunctionName; $order = $this->...
php
{ "resource": "" }
q259459
Output.startPrintf
test
public function startPrintf($string) { if (empty($string)) { return ''; } $this->startTime[$string] = microtime(true); $this->stdout('/*** Begin '. $string . " ***/" . self::ENTER, 0, Console::FG_YELLOW); return 0; }
php
{ "resource": "" }
q259460
Output.endPrintf
test
public function endPrintf($string) { if (empty($string)) { return ''; } $this->endTime[$string] = microtime(true); $time = $this->endTime[$string] - $this->startTime[$string]; $this->stdout( '/*** End ' . $string . ' ... done (time: ' . sprintf("%.3f"...
php
{ "resource": "" }
q259461
Output.conclusion
test
public function conclusion($handleTable, $filterTable) { $enter = self::ENTER; $handleNumber = count($handleTable); $filterNumber = count($filterTable); $handleTableString = implode($handleTable, ', '); $filterTableString = implode($filterTable, ', '); $tables = Yii::...
php
{ "resource": "" }
q259462
Webservices._Fetch
test
private function _Fetch() { $this->_setWebservicesUrl(); $response = @file_get_contents($this->getWebservicesUrl()); $this->response = $response; }
php
{ "resource": "" }
q259463
Webservices._Populate
test
private function _Populate() { $this->data = json_decode($this->response); // getStatus() FALSE upon receiving status ERR or a non-zero error // else set as TRUE if (is_array($this->data->data)) { $this->status = TRUE; } else { if (isset($this->data->status) && isset($this->data->error)) { if (($...
php
{ "resource": "" }
q259464
Webservices._setWebservicesUrl
test
private function _setWebservicesUrl() { $ws_url = $this->url . '&format=json'; if ($this->token) { $ws_url .= '&h=' . $this->token; } if ($this->username) { $ws_url .= '&u=' . $this->username; } if ($this->password) { $ws_url .= '&p=' . $this->password; } if ($this->operation) { ...
php
{ "resource": "" }
q259465
LDAPService.getGroups
test
public function getGroups($cached = true, $attributes = [], $indexBy = 'dn') { $searchLocations = $this->config()->groups_search_locations ?: [null]; $cache = self::get_cache(); $results = $cache->load('groups' . md5(implode('', array_merge($searchLocations, $attributes)))); if (!$r...
php
{ "resource": "" }
q259466
LDAPService.getGroupByDN
test
public function getGroupByDN($dn, $attributes = []) { $searchLocations = $this->config()->groups_search_locations ?: [null]; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getGroupByDN($dn, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); ...
php
{ "resource": "" }
q259467
LDAPService.getUsers
test
public function getUsers($attributes = []) { $searchLocations = $this->config()->users_search_locations ?: [null]; $results = []; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getUsers($searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); ...
php
{ "resource": "" }
q259468
LDAPService.getUserByGUID
test
public function getUserByGUID($guid, $attributes = []) { $searchLocations = $this->config()->users_search_locations ?: [null]; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getUserByGUID($guid, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); ...
php
{ "resource": "" }
q259469
LDAPService.getUserByDN
test
public function getUserByDN($dn, $attributes = []) { $searchLocations = $this->config()->users_search_locations ?: [null]; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getUserByDN($dn, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes); ...
php
{ "resource": "" }
q259470
LDAPService.getUserByEmail
test
public function getUserByEmail($email, $attributes = []) { $searchLocations = $this->config()->users_search_locations ?: [null]; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getUserByEmail($email, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attribute...
php
{ "resource": "" }
q259471
LDAPService.getUserByUsername
test
public function getUserByUsername($username, $attributes = []) { $searchLocations = $this->config()->users_search_locations ?: [null]; foreach ($searchLocations as $searchLocation) { $records = $this->gateway->getUserByUsername($username, $searchLocation, Zend\Ldap\Ldap::SEARCH_SCOPE_SUB...
php
{ "resource": "" }
q259472
LDAPService.getUsernameByEmail
test
public function getUsernameByEmail($email) { $data = $this->getUserByEmail($email); if (empty($data)) { return null; } return $this->gateway->getCanonicalUsername($data); }
php
{ "resource": "" }
q259473
LDAPService.getLDAPGroupMembers
test
public function getLDAPGroupMembers($dn) { $groupObj = Group::get()->filter('DN', $dn)->first(); $groupData = $this->getGroupByGUID($groupObj->GUID); $members = !empty($groupData['member']) ? $groupData['member'] : []; // If a user belongs to a single group, this comes through as a s...
php
{ "resource": "" }
q259474
LDAPService.updateGroupFromLDAP
test
public function updateGroupFromLDAP(Group $group, $data) { if (!$this->enabled()) { return false; } // Synchronise specific guaranteed fields. $group->Code = $data['samaccountname']; $group->Title = $data['samaccountname']; if (!empty($data['description']...
php
{ "resource": "" }
q259475
LDAPService.createLDAPUser
test
public function createLDAPUser(Member $member) { if (!$this->enabled()) { return; } if (empty($member->Username)) { throw new ValidationException('Member missing Username. Cannot create LDAP user'); } if (!$this->config()->new_users_dn) { t...
php
{ "resource": "" }
q259476
LDAPService.createLDAPGroup
test
public function createLDAPGroup(Group $group) { if (!$this->enabled()) { return; } if (empty($group->Title)) { throw new ValidationException('Group missing Title. Cannot create LDAP group'); } if (!$this->config()->new_groups_dn) { throw new Ex...
php
{ "resource": "" }
q259477
LDAPService.updateLDAPFromMember
test
public function updateLDAPFromMember(Member $member) { if (!$this->enabled()) { return; } if (!$member->GUID) { throw new ValidationException('Member missing GUID. Cannot update LDAP user'); } $data = $this->getUserByGUID($member->GUID); if (e...
php
{ "resource": "" }
q259478
LDAPService.updateLDAPGroupsForMember
test
public function updateLDAPGroupsForMember(Member $member) { if (!$this->enabled()) { return; } if (!$member->GUID) { throw new ValidationException('Member missing GUID. Cannot update LDAP user'); } $addGroups = []; $removeGroups = []; ...
php
{ "resource": "" }
q259479
LDAPService.setPassword
test
public function setPassword(Member $member, $password, $oldPassword = null) { $validationResult = ValidationResult::create(true); $this->extend('onBeforeSetPassword', $member, $password, $validationResult); if (!$member->GUID) { SS_Log::log(sprintf('Cannot update Member ID %s, ...
php
{ "resource": "" }
q259480
LDAPService.deleteLDAPMember
test
public function deleteLDAPMember(Member $member) { if (!$this->enabled()) { return; } if (!$member->GUID) { throw new ValidationException('Member missing GUID. Cannot delete LDAP user'); } $data = $this->getUserByGUID($member->GUID); if (empty($dat...
php
{ "resource": "" }
q259481
WriteHandler.update
test
public function update($compare, $keys, $values, $limit = 1, $begin = 0) { $sk = $this->keys; if (is_array($keys)) { foreach ($sk as &$value) { if (!isset($keys[$value])) { break; } $value = $keys[$value]; }...
php
{ "resource": "" }
q259482
ReadSocket.connect
test
public function connect($server = 'localhost', $port = 9998) { $addr = "tcp://$server:$port"; $this->socket = stream_socket_client($addr, $errc, $errs, STREAM_CLIENT_CONNECT); if (!$this->socket) { throw new IOException("Connection to $server:$port failed"); } }
php
{ "resource": "" }
q259483
ReadSocket.disconnect
test
public function disconnect() { if ($this->socket !== NULL) { @fclose($this->socket); } $this->socket = NULL; $this->indexes = array(); $this->currentIndex = 1; }
php
{ "resource": "" }
q259484
ReadSocket.recvStr
test
protected function recvStr($read = true) { $str = @fgets($this->socket); if (!$str) { $this->disconnect(); throw new IOException('Cannot read from socket'); } return substr($str, 0, -1); }
php
{ "resource": "" }
q259485
ReadSocket.sendStr
test
protected function sendStr($string) { if (!$this->isConnected()) { throw new IOException('No active connection'); } $string = (string)$string; while ($string) { $bytes = @fwrite($this->socket, $string); if ($bytes === false) { $thi...
php
{ "resource": "" }
q259486
ReadSocket.encodeString
test
protected function encodeString($string) { if (is_null($string)) { return self::NULL; } else { return strtr($string, self::$encodeMap); } }
php
{ "resource": "" }
q259487
ReadSocket.decodeString
test
protected function decodeString($encoded) { if ($encoded === self::NULL) { return NULL; } else { return strtr($encoded, self::$decodeMap); } }
php
{ "resource": "" }
q259488
ReadSocket.readResponse
test
public function readResponse() { $response = $this->recvStr(); $vals = explode(self::SEP, $response); if ($vals[0] != 0) { //error occured return new ErrorMessage(isset($vals[2]) ? $vals[2] : '', $vals[0]); } else { array_shift($vals); // skip erro...
php
{ "resource": "" }
q259489
ReadSocket.authenticate
test
public function authenticate($authkey) { $this->sendStr(implode(self::SEP, array('A', $this->encodeString($authkey) )) . self:: EOL ); $ret = $this->readResponse(); if (! $ret instanceof ErrorMessage) { return TRUE; } else { throw $ret; } }
php
{ "resource": "" }
q259490
LDAPLoginForm.consistentResponseTime
test
protected function consistentResponseTime($startTime) { if (!Config::inst()->get('LDAPLoginForm', 'consistent_password_times')) { return; } $timeTaken = microtime(true) - $startTime; if ($timeTaken < self::RESPONSE_TIME) { $sleepTime = self::RESPONSE_TIME - $...
php
{ "resource": "" }
q259491
LDAPMemberExtension.onBeforeWrite
test
public function onBeforeWrite() { if ($this->owner->LDAPMemberExtension_NoSync) { return; } $service = Injector::inst()->get('LDAPService'); if ( !$service->enabled() || !$this->owner->config()->create_users_in_ldap || !$this->owner->U...
php
{ "resource": "" }
q259492
LDAPMemberExtension.writeWithoutSync
test
public function writeWithoutSync() { $this->owner->LDAPMemberExtension_NoSync = true; try { $this->owner->write(); } catch (Exception $e) { $this->owner->LDAPMemberExtension_NoSync = false; throw $e; } $this->owner->LDAPMemberExtension_NoSync =...
php
{ "resource": "" }
q259493
SAMLLoginForm.getMessageFromSession
test
protected function getMessageFromSession() { // The "MemberLoginForm.force_message session" is set in Security#permissionFailure() // and displays messages like "You don't have access to this page" // if force isn't set, it will just display "You're logged in as {name}" if (($member ...
php
{ "resource": "" }
q259494
LDAPSecurityController.LostPasswordForm
test
public function LostPasswordForm() { $email = new EmailField('Email', _t('Member.EMAIL', 'Email')); $action = new FormAction('forgotPassword', _t('Security.BUTTONSEND', 'Send me the password reset link')); return LDAPLoginForm::create($this, 'LostPasswordForm', new Fi...
php
{ "resource": "" }
q259495
LDAPSecurityController.passwordsent
test
public function passwordsent($request) { $controller = $this->getResponseController(_t('Security.LOSTPASSWORDHEADER', 'Lost Password')); // if the controller calls Director::redirect(), this will break early if (($response = $controller->getResponse()) && $response->isFinished()) { ...
php
{ "resource": "" }
q259496
LDAPGateway.search
test
protected function search($filter, $baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = [], $sort = '') { $records = $this->ldap->search($filter, $baseDn, $scope, $attributes, $sort); $results = []; foreach ($records as $record) { foreach ($record as $attribu...
php
{ "resource": "" }
q259497
LDAPGateway.getGroupByGUID
test
public function getGroupByGUID($guid, $baseDn = null, $scope = Zend\Ldap\Ldap::SEARCH_SCOPE_SUB, $attributes = []) { return $this->search( sprintf('(&(objectClass=group)(objectGUID=%s))', LDAPUtil::str_to_hex_guid($guid, true)), $baseDn, $scope, $attributes ...
php
{ "resource": "" }
q259498
LDAPGateway.changePassword
test
public function changePassword($dn, $password, $oldPassword) { if (!function_exists('ldap_modify_batch')) { // Password change is unsupported - missing PHP API method. $this->resetPassword($dn, $password); return; } $modifications = [ [ ...
php
{ "resource": "" }
q259499
LDAPGateway.resetPassword
test
public function resetPassword($dn, $password) { try { $this->update( $dn, ['unicodePwd' => iconv('UTF-8', 'UTF-16LE', sprintf('"%s"', $password))] ); } catch(\Zend\Ldap\Exception\LdapException $e) { throw new Exception($this->getLas...
php
{ "resource": "" }