Зарегистрируем пользователя по идентификатору

@param array $checks Массив проверок

@return array

@version 29.10.2018
@author  Дмитрий Щербаков <atomcms@ya.ru>
490996
public function run($checks)
    {
        if (is_array($checks) && count($checks) > 0) {
            foreach ($checks as $check_type => $check_info) {
                switch ($check_type) {
                    case 'auth':
                        $check_result = (new Auth())->run($this->dic['session_id']);
                        break;

                    case 'role':
                        $check_result = (new Role())->run($check_info, $this->dic['user']['roles']);
                        break;

                    default:
                        $classname = 'Lemurro\\Api\\App\\Checker\\' . $check_info['class'];
                        $class = new $classname($this->dic);
                        $check_result = call_user_func([$class, 'run'], $check_info);
                        break;
                }

                if (isset($check_result['errors'])) {
                    return $check_result;
                }
            }
        }

        return [];
    }
588951
public static function check($emails): array
    {
        $result = [];

        if (empty($emails)) {
            return $result;
        }

        $emails = self::handleEmailsInput($emails);

        foreach ($emails as $email) {
            if (!self::isValid($email)) {
                continue;
            }
            if (!in_array($email, $result, true)) {
                $result[] = $email;
            }
        }

        return $result;
    }
1075039
public function setCheckboxes(array $checkboxes)
    {
        foreach ($checkboxes as $name => $label) {
            $this->checkboxes[$label] = new Checkbox($name);
        }

        return $this;
    }
1223850
public function getUser($check = true)
    {
        if ($check === true && $this->user === null) {
            $this->check();
        }

        return $this->user;
    }
238893
protected function getFormRules(array $fields)
    {
        $rules = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $rules[$field->getName()] = $field->getOption('rules');
        }

        return $rules;
    }
627906
public function select(array $statements): array
    {
        $hasDistincts = false;

        if (isset($statements['distincts']) === true && \count($statements['distincts']) > 0) {
            $hasDistincts = true;

            if (isset($statements['selects']) === true && \count($statements['selects']) > 0) {
                $statements['selects'] = array_merge($statements['distincts'], $statements['selects']);
            } else {
                $statements['selects'] = $statements['distincts'];
            }

        } else if (isset($statements['selects']) === false) {
            $statements['selects'] = ['*'];
        }

        // From
        $fromEnabled = false;
        $tables = '';

        if (isset($statements['tables']) === true) {
            $tablesFound = [];

            foreach ((array)$statements['tables'] as $table) {
                if ($table instanceof Raw) {
                    $t = $table;
                } else {
                    $prefix = $statements['aliases'][$table] ?? null;

                    if ($prefix !== null) {
                        $t = sprintf('`%s` AS `%s`', $table, strtolower($prefix));
                    } else {
                        $t = sprintf('`%s`', $table);
                    }
                }

                $tablesFound[] = $t;
            }

            $tables = implode(',', $tablesFound);
            $fromEnabled = true;
        }

        // WHERE
        [$whereCriteria, $whereBindings] = $this->buildCriteriaWithType($statements, 'wheres', 'WHERE');

        // HAVING
        [$havingCriteria, $havingBindings] = $this->buildCriteriaWithType($statements, 'havings', 'HAVING');

        $sql = $this->concatenateQuery([
            'SELECT' . ($hasDistincts === true ? ' DISTINCT' : ''),
            $this->arrayStr($statements['selects'], ', '),
            $fromEnabled ? 'FROM' : '',
            $tables,
            $this->buildQueryPart(static::QUERY_PART_JOIN, $statements),
            $whereCriteria,
            $this->buildQueryPart(static::QUERY_PART_GROUPBY, $statements),
            $havingCriteria,
            $this->buildQueryPart(static::QUERY_PART_ORDERBY, $statements),
            $this->buildQueryPart(static::QUERY_PART_LIMIT, $statements),
            $this->buildQueryPart(static::QUERY_PART_OFFSET, $statements),
        ]);

        $sql = $this->buildUnion($statements, $sql);

        $bindings = array_merge(
            $whereBindings,
            $havingBindings
        );

        return compact('sql', 'bindings');
    }
963210
protected function checkRoles(array $roles)
    {
        $checkedRoles = array();
        foreach ($roles as $role) {
            if (true === is_string($role) && false === in_array($role, $checkedRoles)) {
                $checkedRoles[] = (string)$role;
            }
        }
        return $checkedRoles;
    }
466173
public function checkCss($check = null): bool
    {
        // Css (could be array) and objects css property set?
        if (isset($check) && $this->css) {

            // convert non array css to array
            if (!is_array($check)) {
                $check = (array) $check;
            }

            // Is css to check already in objects css array?
            $check = array_intersect($check, $this->css) ? true : false;
        }
        else {
            // Without set css param we only check if css is used
            $check = $this->css ? true : false;
        }

        return $check;
    }
481466
public function removeCheck($check)
    {
        if (in_array($check, $this->checks)) {
            $this->checks = array_diff($this->checks, [$check]);
        }
    }
1270965
protected function _createcronjobs($check = false) {
		$this->out(__d('cake_installer', 'Creating cron jobs'));
		$this->hr();

		$result = true;
		if ($this->InstallerCheck->isOsWindows()) {
			$this->out(__d('cake_installer', 'Server OS is Windows. Creating cron jobs skipped.'));

			return $result;
		}

		$resultCheck = $this->InstallerCheck->checkCronJobsExists();
		if ($resultCheck) {
			if ($check) {
				$this->out('<success>' . __d('cake_installer', 'This action has already been successfully completed. Skipped.') . '</success>');

				return true;
			} elseif ($this->useActionNotify) {
				if (!$this->_checkSure(__d('cake_installer', 'All cron jobs exists. Rewrite?'), 'n')) {
					return true;
				}
			}
		}

		$cronjobsList = $this->ConfigInstaller->getListCronJobsCreation();
		if (empty($cronjobsList)) {
			$this->out('<info>' . __d('cake_installer', 'List of cron jobs is empty') . '</info>');

			return true;
		}

		$apacheUser = $this->InstallerCheck->getWebSrvUser();
		if (empty($apacheUser)) {
			$this->out('<error>' . __d('cake_installer', 'Error on getting the username of the web server process') . '</error>');

			return false;
		}

		$tmpFile = TMP . 'installer' . DS . uniqid('cron_');
		$tmpCrurrFile = TMP . 'installer' . DS . uniqid('cron_');
		$bkpFile = TMP . 'installer' . DS . 'crontab.bkp';
		$output = [];
		$exitCode = -1;
		$cmd = 'crontab -u ' . $apacheUser . ' -l >' . $tmpFile . ' 2>/dev/null';
		exec($cmd, $output, $exitCode);
		if (($exitCode !== 0) && !$this->_createCrontabFile($tmpFile)) {
			$this->out('<error>' . __d('cake_installer', 'Error on getting crontab for user \'%s\'', $apacheUser) . '</error>');

			return false;
		}

		$tailOpt = [
			'ellipsis' => '...',
			'exact' => true,
			'html' => false
		];
		$messages = [];
		$oFileCurr = new File($tmpFile, true);
		if (!$oFileCurr->copy($tmpCrurrFile)) {
			$this->out('<error>' . __d('cake_installer', 'Error on creation copy of current crontab.') . '</error>');
			$oFileCurr->delete();

			return false;
		}
		$oFileBkp = new File($tmpCrurrFile, false);

		$needUpdate = false;
		$cronFile = $oFileCurr->read();
		foreach ($cronjobsList as $cmd => $time) {
			if (empty($cmd) || empty($time)) {
				continue;
			}

			$jobState = false;
			if (!empty($cronFile)) {
				if (preg_match('/^[^#]+' . preg_quote($cmd, '/') . '$/m', $cronFile)) {
					$jobState = true;
				} else {
					$jobState = $oFileCurr->append($time . ' ' . $cmd . "\n");
					$needUpdate = true;
				}
			} else {
				$jobState = $oFileCurr->append($time . ' ' . $cmd . "\n");
				$needUpdate = true;
			}
			if ($jobState) {
				$state = '<success>' . __d('cake_installer', 'Ok') . '</success>';
			} else {
				$state = '<error>' . __d('cake_installer', 'Bad') . '</error>';
				$result = false;
			}

			$state = '[' . $state . ']';
			$message = ' * ' . CakeText::tail($cmd, $this->maxWidth - 12, $tailOpt);
			$messages[] = $this->state->getState($message, $state, $this->maxWidth - 1);
		}
		if (!$oFileCurr->close()) {
			$result = false;
			$messages[] = '<error>' . __d('cake_installer', 'Error on closing cron file.') . '</error>';
		} elseif ($needUpdate) {
			$output = [];
			$exitCode = -1;
			$cmd = 'crontab -u ' . $apacheUser . ' ' . $tmpFile . ' 2>/dev/null';
			exec($cmd, $output, $exitCode);
			if ($exitCode !== 0) {
				$result = false;
				$messages[] = '<error>' . __d('cake_installer', 'Error on updating crontab.') . '</error>';
			} else {
				if (!$oFileBkp->copy($bkpFile, true)) {
					$this->out('<error>' . __d('cake_installer', 'Error on creation copy of previous crontab.') . '</error>');
					$result = false;
				}
			}
		}
		$oFileCurr->delete();
		$oFileBkp->delete();

		if (empty($messages)) {
			$messages[] = '<info>' . __d('cake_installer', 'List of cron jobs is empty') . '</info>';
		} elseif (!$needUpdate) {
			$messages[] = '<info>' . __d('cake_installer', 'Crontab update is not required.') . '</info>';
		}

		$this->out($messages, 1);
		$this->hr();
		if ($result) {
			$this->out('<success>' . __d('cake_installer', 'Creating cron jobs completed successfully.') . '</success>');
		} else {
			$this->out('<error>' . __d('cake_installer', 'Creating cron jobs unsuccessfully.') . '</error>');
		}

		return $result;
	}
450480
public function pauseChecks($check_ids) {
    $this->ensureParameters(array('check_ids' => $check_ids), __METHOD__);
    $parameters = array(
      'paused' => TRUE,
    );
    return $this->modifyChecks($check_ids, $parameters);
  }
700699
public function check($directories = null)
    {
        null == $directories && $directories = $this->directories;
        $return = array();
        $valid  = true;

        foreach ($directories as $path => $validationSpec) {
            $result                       = $this->checkDirectory($path, $validationSpec);
            $return['directories'][$path] = $result;
            $valid                        = $valid && $result['valid'];
        }
        $return['valid'] = $valid;

        return $return;
    }
635212
protected function getMetaboxRules(array $fields)
    {
        $rules = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $rules[$field->getName()] = $field->getOption('rules');
        }

        return $rules;
    }
1143239
public function beforeCreate(SpecificationFactory $subject, array $checks): array
    {
        $checks = array_merge(
            $checks,
            $this->additionalChecks
        );
        return [ $checks ];
    }
858246
public function checked($checked = [])
    {
        if ($checked instanceof Arrayable) {
            $checked = $checked->toArray();
        }

        $this->checked = array_merge($this->checked, $checked);

        return $this;
    }
972773
public function checkIntegrity($check)
  {
    $db=$this->getDbConnection();
    foreach($this->schemas as $schema){
      $db->createCommand()->checkIntegrity($check,$schema)->execute();
    }
  }
331994
protected function params($check = null) {
        $params = $this->view->getParams();
        if ($check) {
            if (is_array($check)) {
                $inter = array_intersect($check, $params);
                return (count($inter) === count($check));
            }
            else {
                return in_array($check, $params);
            }
        }
        return $params;
    }