_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q264600
|
JsonDecodeFile.parse
|
test
|
protected static function parse($json, $assoc = false)
{
$falgs = JsonParser::DETECT_KEY_CONFLICTS;
if ($assoc) {
$falgs |= JsonParser::PARSE_TO_ASSOC;
}
|
php
|
{
"resource": ""
}
|
q264601
|
JsonDecodeFile.call
|
test
|
public static function call($path, $assoc = false)
{
return
|
php
|
{
"resource": ""
}
|
q264602
|
AbstractNavigationRenderer.normalizeId
|
test
|
protected function normalizeId(string $value): string
{
if (strstr($value, '[')) {
if ('[]' == substr($value, -2)) {
$value = substr($value, 0, strlen($value) - 2);
}
$value = trim($value, ']');
|
php
|
{
"resource": ""
}
|
q264603
|
AbstractNavigationRenderer.cleanAttributes
|
test
|
protected function cleanAttributes(array $input, array $valid): array
{
foreach ($input as $key => $value) {
|
php
|
{
"resource": ""
}
|
q264604
|
Label.setValue
|
test
|
public function setValue($value)
{
if ($this->element) {
|
php
|
{
"resource": ""
}
|
q264605
|
Collection.add
|
test
|
public function add(ElementInterface $element)
{
$id = $element->id;
if ($id === null) $id = $this->generateId();
$element->id = $id;
$this->checkId($id);
$this->objects[] = $element;
if (count($this->objects) === 1) {
|
php
|
{
"resource": ""
}
|
q264606
|
Collection.getTopLevelWindow
|
test
|
public function getTopLevelWindow()
{
foreach ($this->objects as $object) {
if ($object instanceof Frame
|
php
|
{
"resource": ""
}
|
q264607
|
Collection.remove
|
test
|
public function remove($element)
{
$trueId = $this->getTrueId($element);
$this->objects[$trueId]->destroy();
|
php
|
{
"resource": ""
}
|
q264608
|
Collection.getElementById
|
test
|
public function getElementById($id)
{
$id = $this->getTrueId($id);
|
php
|
{
"resource": ""
}
|
q264609
|
BaseConfigurationModel.loadState
|
test
|
public function loadState($statePath)
{
$filename = Yii::getAlias($statePath . $this->stateFilename() . '.php');
if (is_readable($filename) === true)
|
php
|
{
"resource": ""
}
|
q264610
|
BaseConfigurationModel.saveState
|
test
|
public function saveState($statePath)
{
$filename = Yii::getAlias($statePath . $this->stateFilename() . '.php');
$writer = new ApplicationConfigWriter([
|
php
|
{
"resource": ""
}
|
q264611
|
Column.setDataType
|
test
|
public function setDataType($type)
{
$types = array('integer', 'string', 'string');
$shorthand = array('int', 'varchar', 'text');
$index = array_search($type, $shorthand);
|
php
|
{
"resource": ""
}
|
q264612
|
Connection.onChannelCreated
|
test
|
function onChannelCreated($command)
{
$channelId = $command->getResult();
$channel = $this->server->request('channelinfo cid='.$channelId)->toList();
$channel['cid']
|
php
|
{
"resource": ""
}
|
q264613
|
ExtensionDataHelper.getLocalizedVersionedDataField
|
test
|
public static function getLocalizedVersionedDataField($data, $type, $field)
{
$string = '';
$langId = Yii::$app->language;
if (false === empty($data['package']['versions'][self::$currentVersion]['extra'][$type][$field . '_' . $langId])) {
$string = $data['package']['versions'][self::$currentVersion]['extra'][$type][$field . '_' . $langId];
} elseif (false === empty($data['package']['versions'][self::$currentVersion]['extra'][$type][$field])) {
$string = $data['package']['versions'][self::$currentVersion]['extra'][$type][$field];
|
php
|
{
"resource": ""
}
|
q264614
|
ExtensionDataHelper.getLocalizedDataField
|
test
|
public static function getLocalizedDataField($data, $type, $field)
{
$string = '';
$langId = Yii::$app->language;
if (false === empty($data['extra'][$type][$field . '_' . $langId])) {
$string = $data['extra'][$type][$field . '_' . $langId];
} elseif (false === empty($data['extra'][$type][$field])) {
|
php
|
{
"resource": ""
}
|
q264615
|
ExtensionDataHelper.getOtherPackageVersionedData
|
test
|
public static function getOtherPackageVersionedData($data, $key, $asArray = true)
{
$out = [];
if (false === empty($data['package']['versions'][self::$currentVersion][$key])) {
$out = $data['package']['versions'][self::$currentVersion][$key];
}
if (true ===
|
php
|
{
"resource": ""
}
|
q264616
|
ExtensionDataHelper.getOtherPackageData
|
test
|
public static function getOtherPackageData($data, $key, $asArray = false)
{
$out = null;
if (false === empty($data[$key])) {
$out = $data[$key];
}
if (true === $asArray) {
|
php
|
{
"resource": ""
}
|
q264617
|
ExtensionDataHelper.humanizeReadme
|
test
|
public static function humanizeReadme($data)
{
$readme = '';
$data = Json::decode($data);
if (false === empty($data['content'])) {
|
php
|
{
"resource": ""
}
|
q264618
|
ExtensionDataHelper.prepareMigrationTask
|
test
|
public static function prepareMigrationTask(
array $ext,
ReportingChain $chain,
$way = ExtensionsManager::MIGRATE_TYPE_UP,
$group
) {
if ($ext['composer_type'] == Extension::TYPE_DOTPLANT) {
$extData = ComposerInstalledSet::get()->getInstalled($ext['composer_name']);
$packageMigrations = ExtensionDataHelper::getInstalledExtraData($extData, 'migrationPath', true);
$packagePath = '@vendor' . '/' . $ext['composer_name'] . '/';
foreach ($packageMigrations as $migrationPath) {
$migrateTask = self::buildTask(
[
realpath(Yii::getAlias('@app') . '/yii'),
'migrate/' . $way,
'--migrationPath=' . $packagePath . $migrationPath,
|
php
|
{
"resource": ""
}
|
q264619
|
ExtensionDataHelper.buildTask
|
test
|
public static function buildTask($command, $groupName)
{
$groupConfig = [
'email_notification' => 0,
'allow_parallel_run' => 0,
'group_notifications' => 0,
'run_last_command_only' => 0,
];
if (null === $group = DeferredGroup::findOne(['name' => $groupName])) {
$group = new DeferredGroup();
$group->loadDefaultValues();
$group->setAttributes($groupConfig);
$group->name = $groupName;
$group->save();
}
if ((int)$group->group_notifications !== 0) {
|
php
|
{
"resource": ""
}
|
q264620
|
Router.match
|
test
|
public function match(array $server = [], array $post)
{
$requestMethod = $server['REQUEST_METHOD'];
$requestUri = $server['REQUEST_URI'];
$restMethod = $this->getRestfullMethod($post);
// check if REST request is made
if (null === $restMethod && !in_array($requestMethod, array_keys($this->routes))) {
return false;
}
$method = $restMethod ?: $requestMethod;
foreach ($this->routes[$method] as $resource) {
$args = [];
$route = key($resource);
$handler = reset($resource);
if (preg_match(self::REGVAL, $route)) {
list($args, , $route) = $this->parseRegexRoute($requestUri, $route);
}
if (!preg_match("#^$route$#", $requestUri)) {
unset($this->routes[$method]);
continue;
|
php
|
{
"resource": ""
}
|
q264621
|
Router.parseRegexRoute
|
test
|
protected function parseRegexRoute($requestUri, $resource)
{
$route = preg_replace_callback(self::REGVAL, function ($matches) {
$patterns = $this->patterns;
$matches[0] = str_replace(['{', '}'], '', $matches[0]);
if (in_array($matches[0], array_keys($patterns))) {
|
php
|
{
"resource": ""
}
|
q264622
|
PropertiesValidator.checkStrictness
|
test
|
protected function checkStrictness(ContainerResult $container, $object): void
{
$properties = $this->getProperties();
foreach ($object as $property => $value) {
if (array_key_exists($property, $properties) === false) {
$container->addResult(
|
php
|
{
"resource": ""
}
|
q264623
|
AbstractAdapter.getProfiler
|
test
|
public function getProfiler()
{
return \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3
|
php
|
{
"resource": ""
}
|
q264624
|
AbstractAdapter.initTransport
|
test
|
protected function initTransport($options, $transport = '\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Transport\TCP')
{
if(!is_array($options))
{
|
php
|
{
"resource": ""
}
|
q264625
|
BaseActionsInfoTrait.getBlameableAttributes
|
test
|
protected function getBlameableAttributes()
{
return [
ActiveRecord::EVENT_BEFORE_INSERT =>
|
php
|
{
"resource": ""
}
|
q264626
|
BaseActionsInfoTrait.getTimestampAttributes
|
test
|
protected function getTimestampAttributes()
{
return [
ActiveRecord::EVENT_BEFORE_INSERT =>
|
php
|
{
"resource": ""
}
|
q264627
|
BaseActionsInfoTrait.evaluateAttributesInternal
|
test
|
public function evaluateAttributesInternal($event)
{
if (empty($event->data['attributes']) === false) {
$methodName = $event->data['methodName'];
$value = $this->$methodName($event);
foreach ((array) $event->data['attributes'] as $attribute) {
|
php
|
{
"resource": ""
}
|
q264628
|
BaseActionsInfoTrait.BaseActionsInfoTraitInit
|
test
|
public function BaseActionsInfoTraitInit()
{
/** @var ActiveRecord|self $this */
foreach ($this->blameableAttributes as $eventName => $attributes) {
$this->on(
$eventName,
[$this, 'evaluateAttributesInternal'],
[
'attributes' => $attributes,
'methodName' => 'getBlameableValue',
]
);
}
foreach
|
php
|
{
"resource": ""
}
|
q264629
|
CoreAuthHandler.before_request
|
test
|
public function before_request( &$url, &$headers, &$data )
{
// generate a date string
$date = new \DateTime('NOW', new \DateTimeZone("GMT"));
$headers['Date'] = $date->format("D, d M Y H:i:s \G\M\T");
// build up the data to be signed
$request_data = $headers['Date']."\n".$url."\n";
if( !empty($data) )
{
$request_data .= http_build_query($data);
}
// get a signature for our request
// private key is in hex form, needs to be converted into PrivateKey Object
$generator = EccFactory::getNistCurves()->generator256();
$private_key = new PrivateKey($this->math_adapter, $generator, $this->math_adapter->hexDec($this->private_key));
$hash = $this->math_adapter->hexDec(hash("sha256", $request_data));
$signer = EccFactory::getSigner();
$randomK
|
php
|
{
"resource": ""
}
|
q264630
|
CoreAuthHandler.after_request
|
test
|
public function after_request( \Requests_Response &$return )
{
$headers = $return->headers;
$url = $return->url;
$data = $return->body;
$signature = $headers['x-signature'];
if( $this->debug )
{
echo "\n\nResponse Data:\n";
var_dump($return);
}
// Check if signature header exists, if not the request failed
if( !isset($headers['x-signature']) or $headers['x-signature'] == '' )
{
throw new \Exception('Request Failed');
}
// build up the data to be signed
$request_data = $this->service_name."\n".$headers['date']."\n".$url."\n";
if( !empty($data) )
{
$request_data .= trim($data);
}
// try and validate the signature
// ------------------------------------
$generator = EccFactory::getNistCurves()->generator256();
$order_len = strlen($this->math_adapter->decHex($generator->getOrder()));
$x = $this->math_adapter->hexDec(substr($this->public_key, 0, $order_len));
$y = $this->math_adapter->hexDec(substr($this->public_key, $order_len));
$point = new Point($this->math_adapter, EccFactory::getNistCurves()->curve256(), $x, $y, $generator->getOrder());
$public_key = new PublicKey($this->math_adapter, $generator, $point);
$r
|
php
|
{
"resource": ""
}
|
q264631
|
UDP.read
|
test
|
public function read($length = 4096)
{
$this->connect();
$this->waitForReadyRead();
$data = @fread($this->stream, $length);
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit(strtolower($this->getAdapterType()) . "DataRead", $data);
if($data === FALSE)
{
|
php
|
{
"resource": ""
}
|
q264632
|
UDP.send
|
test
|
public function send($data)
{
$this->connect();
@stream_socket_sendto($this->stream, $data);
|
php
|
{
"resource": ""
}
|
q264633
|
MysqlController.actionRestore
|
test
|
public function actionRestore($fileName = null)
{
try {
$this->stdout(\Yii::t('skeeks/dbDumper', "The installation process is running the database")."\n");
\Yii::$app->dbDumper->restore($fileName);
$this->stdout(\Yii::t('skeeks/dbDumper', "Dump successfully installed")."\n", Console::FG_GREEN);
} catch (\Exception $e) {
|
php
|
{
"resource": ""
}
|
q264634
|
MysqlController.actionDump
|
test
|
public function actionDump()
{
try {
$result = \Yii::$app->dbDumper->dump();
$this->stdout(\Yii::t('skeeks/dbDumper', "Dump the database was created successfully").": {$result}\n",
Console::FG_GREEN);
$removed = \Yii::$app->dbDumper->clear();
if ($removed > 0) {
$this->stdout(\Yii::t('skeeks/dbDumper',
|
php
|
{
"resource": ""
}
|
q264635
|
Menubar.initMenu
|
test
|
function initMenu($icon, $pluginId = null)
{
$id = explode('\\', $pluginId);
$this->menu[$pluginId]
|
php
|
{
"resource": ""
}
|
q264636
|
Menubar.addButton
|
test
|
function addButton($name, $callback, $admin = false, $pluginId = null)
{
if(!isset($this->menu[$pluginId]))
$this->initMenu(Icons128x128_1::DefaultIcon, $pluginId);
$this->menu[$pluginId]['buttons'][] = array('name'
|
php
|
{
"resource": ""
}
|
q264637
|
Install.fire
|
test
|
public function fire()
{
$handle = popen(PHP_BINDIR.'/pecl install wxwidgets 2>&1', 'r');
while ( ! feof($handle)) {
|
php
|
{
"resource": ""
}
|
q264638
|
Table.populateColumnsWithLongestValue
|
test
|
public function populateColumnsWithLongestValue()
{
$query = DB::table($this->name);
foreach ($this->columns as $column) {
if ($column->isNumeric()) {
$query->addSelect(DB::raw('MAX(`' . $column->name . '`) as `' . $column->name . '`'));
}
if ($column->isTextual()) {
$query->addSelect(DB::raw('MAX(LENGTH(`' . $column->name . '`)) as `' . $column->name . '`'));
}
}
|
php
|
{
"resource": ""
}
|
q264639
|
Table.populateNumericColumnsWithLongestValue
|
test
|
public function populateNumericColumnsWithLongestValue()
{
$query = DB::table($this->name);
foreach ($this->columns as $column) {
if ($column->isNumeric()) {
$query->addSelect(DB::raw('MIN(`' . $column->name . '`) as `' . $column->name . '`'));
}
}
|
php
|
{
"resource": ""
}
|
q264640
|
JsonTransformer.transform
|
test
|
public function transform($json)
{
if (!is_string($json)) {
throw new \InvalidArgumentException('$json variable is not a string.');
}
|
php
|
{
"resource": ""
}
|
q264641
|
DoctrineORMServiceProvider.register
|
test
|
public function register(Application $app)
{
$app['doctrine_orm.configuration'] = $app->share(function ($app) {
$configuration = new Configuration();
$mCache = isset($app['doctrine_orm.metadata_cache']) ? $app['doctrine_orm.metadata_cache'] : new Cache();
$qCache = isset($app['doctrine_orm.query_cache']) ? $app['doctrine_orm.query_cache'] : new Cache();
$rCache = isset($app['doctrine_orm.result_cache']) ? $app['doctrine_orm.result_cache'] : new Cache();
$annotation = boolval($app['doctrine_orm.simple_annotation_reader']);
$driverImpl = $configuration->newDefaultAnnotationDriver($app['doctrine_orm.entities_path'], $annotation);
$configuration->setMetadataCacheImpl($mCache);
$configuration->setMetadataDriverImpl($driverImpl);
$configuration->setQueryCacheImpl($qCache);
$configuration->setResultCacheImpl($rCache);
$configuration->setProxyDir($app['doctrine_orm.proxies_path']);
$configuration->setProxyNamespace($app['doctrine_orm.proxies_namespace']);
$configuration->setAutogenerateProxyClasses(false);
if (isset($app['doctrine_orm.autogenerate_proxy_classes'])) {
$configuration->setAutogenerateProxyClasses($app['doctrine_orm.autogenerate_proxy_classes']);
} else {
$configuration->setAutogenerateProxyClasses(true);
}
|
php
|
{
"resource": ""
}
|
q264642
|
PageFetcherRequest.setFile
|
test
|
public function setFile(string $name, FilePathInterface $filePath): void
|
php
|
{
"resource": ""
}
|
q264643
|
PageFetcherRequest.setPostField
|
test
|
public function setPostField(string $name, string $value): void
{
$this->rawContent = '';
|
php
|
{
"resource": ""
}
|
q264644
|
PageFetcherRequest.setRawContent
|
test
|
public function setRawContent(string $rawContent): void
{
|
php
|
{
"resource": ""
}
|
q264645
|
ClassResolver.resolve
|
test
|
public function resolve($abstract, $parameters = array())
{
$concrete = $this->getConcrete($abstract);
// We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved.
if ($this->isBuildable($concrete, $abstract)) {
|
php
|
{
"resource": ""
}
|
q264646
|
ClassResolver.bind
|
test
|
public function bind($abstract, $concrete, $protect = false)
{
if ($protect) {
|
php
|
{
"resource": ""
}
|
q264647
|
ClassResolver.getConcrete
|
test
|
protected function getConcrete($abstract)
{
// If we don't have a registered resolver or concrete for the type, we'll just
// assume each type is a concrete name and will attempt to resolve it as is
// since the container should be able to resolve concretes automatically.
if (!is_scalar($abstract)) {
return $abstract;
}
|
php
|
{
"resource": ""
}
|
q264648
|
ClassResolver.dispatchEvent
|
test
|
protected function dispatchEvent($name, Event $event)
{
|
php
|
{
"resource": ""
}
|
q264649
|
Server.channelSpacerGetType
|
test
|
public function channelSpacerGetType($cid)
{
$channel = $this->channelGetById($cid);
if(!$this->channelIsSpacer($channel))
{
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid channel flags", 0x307);
}
switch($channel["channel_name"]->section("]", 1))
{
case "___":
return \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_SOLIDLINE;
case "---":
return \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_DASHLINE;
case "...":
|
php
|
{
"resource": ""
}
|
q264650
|
Server.channelSpacerGetAlign
|
test
|
public function channelSpacerGetAlign($cid)
{
$channel = $this->channelGetById($cid);
if(!$this->channelIsSpacer($channel) || !preg_match("/\[(.*)spacer.*\]/", $channel, $matches) || !isset($matches[1]))
{
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid channel flags", 0x307);
}
switch($matches[1])
{
case "*":
return \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_ALIGN_REPEAT;
|
php
|
{
"resource": ""
}
|
q264651
|
Server.channelPermAssign
|
test
|
public function channelPermAssign($cid, $permid, $permvalue)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264652
|
Server.channelPermRemove
|
test
|
public function channelPermRemove($cid, $permid)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264653
|
Server.channelClientPermAssign
|
test
|
public function channelClientPermAssign($cid, $cldbid, $permid, $permvalue)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264654
|
Server.channelClientPermRemove
|
test
|
public function channelClientPermRemove($cid, $cldbid, $permid)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264655
|
Server.channelFileList
|
test
|
public function channelFileList($cid, $cpw = "", $path = "/", $recursive = FALSE)
{
$files = $this->execute("ftgetfilelist", array("cid" => $cid, "cpw" => $cpw, "path" => $path))->toArray();
$count = count($files);
for($i = 0; $i < $count; $i++)
{
$files[$i]["cid"] = $files[0]["cid"];
$files[$i]["path"] = $files[0]["path"];
$files[$i]["src"] = new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String($cid ? $files[$i]["path"] : "/");
if(!$files[$i]["src"]->endsWith("/"))
{
$files[$i]["src"]->append("/");
}
|
php
|
{
"resource": ""
}
|
q264656
|
Server.clientGetById
|
test
|
public function clientGetById($clid)
{
if(!array_key_exists((string) $clid, $this->clientList()))
{
throw
|
php
|
{
"resource": ""
}
|
q264657
|
Server.clientGetByUid
|
test
|
public function clientGetByUid($uid)
{
foreach($this->clientList() as $client)
{
if($client["client_unique_identifier"] ==
|
php
|
{
"resource": ""
}
|
q264658
|
Server.clientMove
|
test
|
public function clientMove($clid, $cid, $cpw = null)
{
$this->clientListReset();
$this->execute("clientmove", array("clid" =>
|
php
|
{
"resource": ""
}
|
q264659
|
Server.clientKick
|
test
|
public function clientKick($clid, $reasonid = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::KICK_CHANNEL, $reasonmsg
|
php
|
{
"resource": ""
}
|
q264660
|
Server.clientPermRemove
|
test
|
public function clientPermRemove($cldbid, $permid)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264661
|
Server.serverGroupGetById
|
test
|
public function serverGroupGetById($sgid)
{
if(!array_key_exists((string) $sgid, $this->serverGroupList()))
{
|
php
|
{
"resource": ""
}
|
q264662
|
Server.serverGroupGetByName
|
test
|
public function serverGroupGetByName($name, $type = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR)
{
foreach($this->serverGroupList() as $group)
{
if($group["name"] == $name && $group["type"]
|
php
|
{
"resource": ""
}
|
q264663
|
Server.serverGroupPermAssign
|
test
|
public function serverGroupPermAssign($sgid, $permid, $permvalue, $permnegated = FALSE, $permskip = FALSE)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264664
|
Server.serverGroupGetProfiles
|
test
|
public function serverGroupGetProfiles()
{
$profiles = array();
foreach($this->serverGroupList() as $sgid => $sgroup)
{
if($sgroup["type"] != \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR) continue;
$profiles[$sgid] = array(
"b_permission_modify_power_ignore" => 0,
"i_group_needed_member_add_power" => 0,
"i_group_member_add_power" => 0,
"i_group_needed_member_remove_power" => 0,
"i_group_member_remove_power" => 0,
"i_needed_modify_power_count" => 0,
"i_needed_modify_power_total" => 0,
"i_permission_modify_power" => 0,
"i_group_needed_modify_power" => 0,
"i_group_modify_power" => 0,
"i_client_needed_modify_power" => 0,
"i_client_modify_power" => 0,
"b_virtualserver_servergroup_create" => 0,
"b_virtualserver_servergroup_delete" => 0,
"b_client_ignore_bans" => 0,
"b_client_ignore_antiflood" => 0,
"b_group_is_permanent" => 0,
"i_client_needed_ban_power" => 0,
"i_client_needed_kick_power" => 0,
"i_client_needed_move_power" => 0,
"i_client_talk_power" => 0,
"__sgid" => $sgid,
"__name" => $sgroup->toString(),
"__node" => $sgroup,
);
try
{
$perms = $this->serverGroupPermList($sgid, TRUE);
$grant = isset($perms["i_permission_modify_power"]) ? $perms["i_permission_modify_power"]["permvalue"] : null;
}
|
php
|
{
"resource": ""
}
|
q264665
|
Server.channelGroupGetById
|
test
|
public function channelGroupGetById($cgid)
{
if(!array_key_exists((string) $cgid, $this->channelGroupList()))
{
|
php
|
{
"resource": ""
}
|
q264666
|
Server.channelGroupGetByName
|
test
|
public function channelGroupGetByName($name, $type = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR)
{
foreach($this->channelGroupList() as $group)
{
if($group["name"] == $name && $group["type"]
|
php
|
{
"resource": ""
}
|
q264667
|
Server.channelGroupPermAssign
|
test
|
public function channelGroupPermAssign($cgid, $permid, $permvalue)
{
$permident = (is_numeric($permid)) ? "permid" : "permsid";
|
php
|
{
"resource": ""
}
|
q264668
|
Server.permReset
|
test
|
public function permReset()
{
$token = $this->request("permreset")->toList();
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit(
|
php
|
{
"resource": ""
}
|
q264669
|
Server.iconUpload
|
test
|
public function iconUpload($data)
{
$crc = crc32($data);
$size = strlen($data);
$upload = $this->transferInitUpload(rand(0x0000, 0xFFFF), 0, "/icon_" . $crc, $size);
$transfer = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::factory("filetransfer://"
|
php
|
{
"resource": ""
}
|
q264670
|
Server.snapshotCreate
|
test
|
public function snapshotCreate($mode = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SNAPSHOT_STRING)
{
$snapshot = $this->request("serversnapshotcreate")->toString(FALSE);
switch($mode)
{
case \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SNAPSHOT_BASE64:
return $snapshot->toBase64();
|
php
|
{
"resource": ""
}
|
q264671
|
Server.logView
|
test
|
public function logView($limitcount = 30, $comparator = null, $timestamp = null)
{
return $this->execute("logview", array("limitcount" => $limitcount,
|
php
|
{
"resource": ""
}
|
q264672
|
Server.logAdd
|
test
|
public function logAdd($logmsg, $loglevel = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::LOGLEVEL_INFO)
|
php
|
{
"resource": ""
}
|
q264673
|
Server.sortClientList
|
test
|
protected static function sortClientList(Client $a, Client $b)
{
if(get_class($a) != get_class($b))
{
return 0;
/* workaround for PHP bug #50688 */
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid parameter", 0x602);
}
if(!$a instanceof Client)
{
return 0;
/* workaround for PHP bug #50688 */
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("convert error", 0x604);
}
if($a->getProperty("client_talk_power", 0) != $b->getProperty("client_talk_power", 0))
{
return ($a->getProperty("client_talk_power", 0) > $b->getProperty("client_talk_power", 0)) ?
|
php
|
{
"resource": ""
}
|
q264674
|
Server.sortGroupList
|
test
|
protected static function sortGroupList(AbstractNode $a, AbstractNode $b)
{
if(get_class($a) != get_class($b))
{
return 0;
/* workaround for PHP bug #50688 */
throw new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Adapter\ServerQuery\Exception("invalid parameter", 0x602);
}
if(!$a instanceof Servergroup && !$a instanceof Channelgroup)
{
return 0;
/* workaround for PHP bug #50688 */
|
php
|
{
"resource": ""
}
|
q264675
|
Server.sortFileList
|
test
|
protected static function sortFileList(array $a, array $b)
{
if(!array_key_exists("src", $a) || !array_key_exists("src", $b))
{
return 0;
|
php
|
{
"resource": ""
}
|
q264676
|
Servergroup.copy
|
test
|
public function copy($name = null, $tsgid = 0, $type = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_DBTYPE_REGULAR)
|
php
|
{
"resource": ""
}
|
q264677
|
AbstractNode.iconGetName
|
test
|
public function iconGetName($key)
{
$iconid = ($this[$key] < 0) ? (pow(2, 32))-($this[$key]*-1) : $this[$key];
return new
|
php
|
{
"resource": ""
}
|
q264678
|
AbstractNode.getClass
|
test
|
public function getClass($prefix = "ts3_")
{
if($this instanceof Channel && $this->isSpacer())
{
return $prefix . "spacer";
}
elseif($this instanceof Client
|
php
|
{
"resource": ""
}
|
q264679
|
AbstractNode.getViewer
|
test
|
public function getViewer(ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Viewer\ViewerInterface $viewer)
{
$html = $viewer->fetchObject($this);
$iterator = new RecursiveIteratorIterator($this, RecursiveIteratorIterator::SELF_FIRST);
foreach($iterator as $node)
{
$siblings = array();
for($level = 0; $level < $iterator->getDepth(); $level++)
|
php
|
{
"resource": ""
}
|
q264680
|
AbstractNode.filterList
|
test
|
protected function filterList(array $nodes = array(), array $rules = array())
{
if(!empty($rules))
{
foreach($nodes as $node)
{
if(!$node instanceof AbstractNode) continue;
$props = $node->getInfo(FALSE);
$props = array_intersect_key($props, $rules);
$match = TRUE;
foreach($props as $key => $val)
{
if($val instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String)
{
$match = $val->contains($rules[$key], TRUE);
|
php
|
{
"resource": ""
}
|
q264681
|
HydratorFactory.writeFile
|
test
|
private function writeFile(string $filename, string $content)
{
$directory = \dirname($filename);
if (!\is_writable($directory)) {
throw new \RuntimeException(\sprintf('Cache directory "%s" is not writable.', $directory));
}
$tmpFile = \tempnam($directory, \basename($filename));
if (false === @\file_put_contents($tmpFile, $content)) {
throw new \RuntimeException(\sprintf('Could not write file
|
php
|
{
"resource": ""
}
|
q264682
|
HydratorFactory.getHydratorClass
|
test
|
public function getHydratorClass() : string
{
$originalClassName = $this->configuration->getHydratedClassName();
$realClassName = $this->generateClassName($originalClassName);
if (!class_exists($realClassName)) {
$directory = $directory = $this->configuration->getGeneratedClassesTargetDir();
$targetFile = $directory . '/' . \str_replace("\\", "_", $realClassName) . '.php';
if (@include_once $targetFile) {
return $realClassName;
}
$generator =
|
php
|
{
"resource": ""
}
|
q264683
|
TCP.connect
|
test
|
public function connect()
{
if($this->stream !== null) return;
$host = strval($this->config["host"]);
$port = strval($this->config["port"]);
$address = "tcp://" . $host . ":" . $port;
$timeout = intval($this->config["timeout"]);
|
php
|
{
"resource": ""
}
|
q264684
|
TCP.disconnect
|
test
|
public function disconnect()
{
if($this->stream === null) return;
fclose($this->stream);
$this->stream
|
php
|
{
"resource": ""
}
|
q264685
|
TCP.readLine
|
test
|
public function readLine($token = "\n", $useCR = false)
{
$this->connect();
$line = \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String::factory("");
while(!$line->endsWith($token) && !($useCR && $line->endsWith("\r"))) // FUUUUUUU carriage return
{
$this->waitForReadyRead();
$data = @fgets($this->stream, 4096);
|
php
|
{
"resource": ""
}
|
q264686
|
CrudOptionsFallbackAbstractFactory.canCreate
|
test
|
public function canCreate(ContainerInterface $container, $requestedName)
{
$fqcn = $this->getFQCN($requestedName);
if ($fqcn === false) {
|
php
|
{
"resource": ""
}
|
q264687
|
RoleController.store
|
test
|
public function store(CreateRoleRequest $request)
{
$input = $request->all();
$role = $this->roleRepository->create([
'name' => $input['name'],
]);
foreach ($input['permissions'] as $permission) {
$role->permissions()->attach($permission);
|
php
|
{
"resource": ""
}
|
q264688
|
RoleController.update
|
test
|
public function update($id, UpdateRoleRequest $request)
{
$role = $this->roleRepository->findWithoutFail($id);
if (empty($role)) {
\Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.roles.index'));
}
$input = $request->all();
$role = $this->roleRepository->update([
'name' => $input['name'],
], $id);
$permissions = [];
if (!empty($input['permissions'])) {
foreach ($input['permissions'] as $permission) {
|
php
|
{
"resource": ""
}
|
q264689
|
RoleController.destroy
|
test
|
public function destroy($id)
{
$role = $this->roleRepository->findWithoutFail($id);
if (empty($role)) {
\Flash::error(trans('l5starter::messages.404_not_found'));
|
php
|
{
"resource": ""
}
|
q264690
|
Client.get
|
test
|
public function get($resource, $headers = array())
{
return $this->getGuzzle()->request(
|
php
|
{
"resource": ""
}
|
q264691
|
Html.getCorpusClass
|
test
|
protected function getCorpusClass()
{
$extras = "";
if($this->currObj instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Channel && $this->currObj->isSpacer())
{
switch($this->currObj->spacerGetType())
{
case (string) \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_SOLIDLINE:
$extras .= " solidline";
break;
case (string) \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_DASHLINE:
$extras .= " dashline";
break;
case (string) \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_DASHDOTLINE:
|
php
|
{
"resource": ""
}
|
q264692
|
Html.getCorpusIcon
|
test
|
protected function getCorpusIcon()
{
if($this->currObj instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Channel && $this->currObj->isSpacer())
|
php
|
{
"resource": ""
}
|
q264693
|
Html.getCorpusName
|
test
|
protected function getCorpusName()
{
if($this->currObj instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Channel && $this->currObj->isSpacer())
{
if($this->currObj->spacerGetType() != \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_CUSTOM) return;
$string = $this->currObj["channel_name"]->section("]", 1);
if($this->currObj->spacerGetAlign() == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::SPACER_ALIGN_REPEAT)
{
$string->resize(30, $string);
}
return htmlspecialchars($string);
}
if($this->currObj instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Client)
{
$before = array();
$behind = array();
foreach($this->currObj->memberOf() as $group)
{
if($group->getProperty("namemode") == \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\TeamSpeak3::GROUP_NAMEMODE_BEFORE)
{
|
php
|
{
"resource": ""
}
|
q264694
|
Html.getSuffixFlag
|
test
|
protected function getSuffixFlag()
{
if(!$this->currObj instanceof \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Node\Client) return;
if($this->flagpath && $this->currObj["client_country"])
{
|
php
|
{
"resource": ""
}
|
q264695
|
FileTransfer.init
|
test
|
protected function init($ftkey)
{
if(strlen($ftkey) != 32)
{
throw new FileTransfer\Exception("invalid file transfer key format");
}
$this->getProfiler()->start();
$this->getTransport()->send($ftkey);
|
php
|
{
"resource": ""
}
|
q264696
|
FileTransfer.upload
|
test
|
public function upload($ftkey, $seek, $data)
{
$this->init($ftkey);
$size = strlen($data);
$seek = intval($seek);
$pack = 4096;
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("filetransferUploadStarted", $ftkey, $seek, $size);
for(;$seek < $size;)
{
$rest = $size-$seek;
$pack = $rest < $pack ? $rest : $pack;
$buff = substr($data, $seek, $pack);
$seek = $seek+$pack;
$this->getTransport()->send($buff);
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("filetransferUploadProgress",
|
php
|
{
"resource": ""
}
|
q264697
|
FileTransfer.download
|
test
|
public function download($ftkey, $size, $passthru = FALSE)
{
$this->init($ftkey);
if($passthru)
{
return $this->passthru($size);
}
$buff = new \ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\String("");
$size = intval($size);
$pack = 4096;
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("filetransferDownloadStarted", $ftkey, count($buff), $size);
for($seek = 0;$seek < $size;)
{
$rest = $size-$seek;
$pack = $rest < $pack ? $rest : $pack;
$data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
$seek = $seek+$pack;
$buff->append($data);
\ManiaLivePlugins\Standard\TeamSpeak\TeamSpeak3\Helper\Signal::getInstance()->emit("filetransferDownloadProgress", $ftkey, count($buff), $size);
}
|
php
|
{
"resource": ""
}
|
q264698
|
Application.getSessionContext
|
test
|
public function getSessionContext()
{
if (!$this->_sessionContext) {
$this->_sessionContext =
|
php
|
{
"resource": ""
}
|
q264699
|
Application.getTypeManager
|
test
|
public function getTypeManager()
{
if (!$this->_typeManager) {
$this->_typeManager = new TypeManager();
/* @var $localeInfoService localeInfoService */
$localeInfoService = Openbizx::getService(LOCALEINFO_SERVICE);
$localeInfo = $localeInfoService->getLocaleInfo();
|
php
|
{
"resource": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.