Create a new authentication file

@return boolean true if ok or false if error or if already exists
978269
public static function create()
	{
		if ( file_exists( self::$authFile ) ) return false;
		if ( @touch( self::$authFile ) === false ) return false;

		self::$auth = array(
			'generated' => date('U'),
			'security'  => self::generateSecurityToken(),
			'anonymous' => array(),
			'users'     => array(),
		);

		self::save();

		return true;
	}
817292
public function createFileSet()
    {
        $this->fileset = new ZendGuardFileSet();
        $this->filesets[] = $this->fileset;

        return $this->fileset;
    }
12584
private function _createDBFFile()
    {
        if (! self::supportsDbase() || ! is_array($this->DBFHeader) || count($this->DBFHeader) == 0) {
            $this->DBFFile = null;

            return true;
        }
        $dbf_name = $this->_getFilename('.dbf');

        /* Unlink existing file */
        if (file_exists($dbf_name)) {
            unlink($dbf_name);
        }

        /* Create new file */
        $this->DBFFile = @dbase_create($dbf_name, $this->DBFHeader);
        if ($this->DBFFile === false) {
            $this->setError(sprintf('It wasn\'t possible to create the DBase file "%s"', $dbf_name));

            return false;
        }

        return true;
    }
1039197
public function create() {

		if(false === $this -> file -> getExists()) {
			
			fopen($this -> file -> getBasepath(), 'w+');

			$this -> refresh();
		}

		return $this;
	}
1316498
public function createNewFile($mode = null)
    {
        if ($this->isAbsolute()) {
            if (is_null($mode)) {
                $mode = $this->defaul_permission;
            }

            if ($resource = fopen($this->getPathname(), 'x')) {
                fclose($resource);
                $this->chmod($mode);
                return true;
            }
            return false;
        } else {
            throw new FileException('Given file path is not a absolute path.');
        }
    }
1324447
protected function createMigration()
    {
        $migration_file = database_path('migrations').'/'.date('Y_m_d_His').'_create_ratings_table.php';

        if (! file_exists($migration_file) && $fs = fopen($migration_file, 'x')) {
            fwrite($fs, file_get_contents(__DIR__.'/../migrations/create_ratings_table.php'));
            fclose($fs);
            return true;
        }

        return false;
    }
115556
public function canCreateCacheFile()
    {
        // Skip if we're running in devMode and not in force mode
        if (\Craft::$app->config->general->devMode === true && $this->settings->forceOn == false) {
            return false;
        }

        // skip if not enabled
        if ($this->settings->enableGeneral == false) {
            return false;
        }

        // Skip if system is not on and not in force mode
        if (!\Craft::$app->getIsSystemOn() && $this->settings->forceOn == false) {
            return false;
        }

        // Skip if it's a CP Request
        if (\Craft::$app->request->getIsCpRequest()) {
            return false;
        }

        // Skip if it's an action Request
        if (\Craft::$app->request->getIsActionRequest()) {
            return false;
        }

        // Skip if it's a preview request
        if (\Craft::$app->request->getIsLivePreview()) {
            return false;
        }
        // Skip if it's a post request
        if (!\Craft::$app->request->getIsGet()) {
            return false;
        }
        // Skip if it's an ajax request
        if (\Craft::$app->request->getIsAjax()) {
            return false;
        }
        // Skip if route from element api
        if ($this->isElementApiRoute()) {
            return false;
        }
        // Skip if currently requested URL path is excluded
        if ($this->isPathExcluded()) {
            return false;
        }

        return true;
    }
120000
protected function _createFile()
        {
            do {
                $this->_filename = $this->getPath() .  mt_rand() . '.html';
            } while(File::exists($this->_filename));

            /**
             * create an empty file
             */
            File::put($this->_filename, $this->getHtml());
            chmod($this->_filename, 0777);

            return $this->_filename;
        }
1066961
private function generatePasswordAndUpdateMigration()
    {
        $this->password = str_random(10);

        $files = File::allFiles(database_path('migrations'));
        foreach ($files as $file) {
            if (strpos($file->getFilename(), 'fill_default_admin_user_and_permissions.php') !== false) {
                //change database/migrations/*fill_default_user_and_permissions.php to use new password
                $this->strReplaceInFile(database_path('migrations/' . $file->getFilename()),
                    "best package ever",
                    "" . $this->password . "");
                break;
            }
        }
    }
1171087
public function actionCreate()
    {
        $user = new User();
        $this->readValue($user, 'username');
        $this->readValue($user, 'email');
        $user->setPassword($this->prompt('Password:', [
            'required' => true,
            'pattern'  => '#^.{6,255}$#i',
            'error'    => 'More than 6 symbols',
        ]));
        $user->generateAuthKey();
        $user->status = User::STATUS_ACTIVE;
        $this->log($this->repository->save($user));
    }
258164
public function create($data)
    {
        $uae = new AddUser($data);
        $uae = \Events::dispatch('on_before_user_add', $uae);
        if (!$uae->proceed()) {
            return false;
        }

        $config = $this->application->make('config');
        $hasher = new PasswordHash($config->get('concrete.user.password.hash_cost_log2'), $config->get('concrete.user.password.hash_portable'));

        if (isset($data['uIsValidated']) && $data['uIsValidated'] == 1) {
            $uIsValidated = 1;
        } elseif (isset($data['uIsValidated']) && $data['uIsValidated'] == 0) {
            $uIsValidated = 0;
        } else {
            $uIsValidated = -1;
        }

        if (isset($data['uIsFullRecord']) && $data['uIsFullRecord'] == 0) {
            $uIsFullRecord = 0;
        } else {
            $uIsFullRecord = 1;
        }

        $password_to_insert = isset($data['uPassword']) ? $data['uPassword'] : null;
        $hash = $hasher->HashPassword($password_to_insert);

        $uDefaultLanguage = null;
        if (isset($data['uDefaultLanguage']) && $data['uDefaultLanguage'] != '') {
            $uDefaultLanguage = $data['uDefaultLanguage'];
        }

        $entity = new UserEntity();
        $entity->setUserName($data['uName']);
        $entity->setUserEmail($data['uEmail']);
        $entity->setUserPassword($hash);
        $entity->setUserIsValidated($uIsValidated);
        $entity->setUserIsFullRecord($uIsFullRecord);
        $entity->setUserDefaultLanguage($uDefaultLanguage);
        $entity->setUserIsActive(true);

        $this->entityManager->persist($entity);
        $this->entityManager->flush();

        $newUID = $entity->getUserID();
        $ui = $this->userInfoRepository->getByID($newUID);

        if (is_object($ui)) {
            $uo = $ui->getUserObject();
            $groupControllers = \Group::getAutomatedOnRegisterGroupControllers($uo);
            foreach ($groupControllers as $ga) {
                if ($ga->check($uo)) {
                    $uo->enterGroup($ga->getGroupObject());
                }
            }

            // run any internal event we have for user add
            $ue = new UserInfoWithPassword($ui);
            $ue->setUserPassword($password_to_insert);
            \Events::dispatch('on_user_add', $ue);

            // Now we notify any relevant users.
            $type = $this->application->make('manager/notification/types')->driver('user_signup');
            /* @var UserSignupType $type */
            $u = new User();
            $createdBy = null;
            if (is_object($u)) {
                $creator = $u->getUserInfoObject();
                if (is_object($creator)) {
                    $createdBy = $creator->getEntityObject();
                }
            }
            $signup = new UserSignup($ui->getEntityObject(), $createdBy);
            $notifier = $type->getNotifier();
            $subscription = $type->getSubscription($signup);
            $notified = $notifier->getUsersToNotify($subscription, $signup);
            $notification = $type->createNotification($signup);
            $notifier->notify($notified, $notification);
        }

        return $ui;
    }
1068729
public function authenticate()
    {
        if (empty($this->authResult)) {
            if ($this->hasIdentity()) {
                $this->clearIdentity();
            }

            return new Result(
                Result::FAILURE_UNCATEGORIZED,
                null,
                ['no result set']
            );
        }

        if ($this->hasIdentity()) {
            $this->clearIdentity();
        }

        if ($this->authResult->isValid()) {
            $this->getStorage()->write($this->authResult->getIdentity());
        }

        $result = $this->authResult;
        $this->authResult = null;

        return $result;
    }
595848
public function actionCreate()
    {
        if ((Authentication::findOne(['user_id' => Yii::$app->user->id])) != null || Authentication::isAuthentication(Yii::$app->user->id)) {
            return $this->redirect(['index']);
        }
        $model = new Authentication();
        $model->scenario = Authentication::SCENARIO_CREATE;
        if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index']);
        }
        return $this->render('create', [
            'model' => $model,
        ]);
    }
721381
public function createStandaloneConfiguration() : bool
    {
        $retval = false;

        if ($this->apache_config_path) {
            $file = new CApacheStandaloneFile($this, $this->nb_server, $this->nb_site);
            $file->create();
            $file->exportToFile($this->apache_config_path . DIRECTORY_SEPARATOR . self::APACHE_CONFIG_FILENAME);
            $retval = true;
        }

        return $retval;
    }
1073764
protected function createDirectories()
    {
        if (! $this->files->isDirectory($directory = app_path('Forms/Auth/Passwords'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = app_path('Http/Controllers/Auth'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = resource_path('views/auth/passwords'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }

        if (! $this->files->isDirectory($directory = resource_path('views/settings'))) {
            $this->files->makeDirectory($directory, 0755, true);
        }
    }
530484
function createCa()
    {
        $caPemPath = $this->caPath().'/LaravelValetCASelfSigned.pem';
        $caKeyPath = $this->caPath().'/LaravelValetCASelfSigned.key';

        if ($this->files->exists($caKeyPath) && $this->files->exists($caPemPath)) {
            return;
        }

        $oName = 'Laravel Valet CA Self Signed Organization';
        $cName = 'Laravel Valet CA Self Signed CN';

        if ($this->files->exists($caKeyPath)) {
            $this->files->unlink($caKeyPath);
        }
        if ($this->files->exists($caPemPath)) {
            $this->files->unlink($caPemPath);
        }

        $this->cli->run(sprintf(
            'sudo security delete-certificate -c "%s" /Library/Keychains/System.keychain',
            $cName
        ));

        $this->cli->runAsUser(sprintf(
            'openssl req -new -newkey rsa:2048 -days 730 -nodes -x509 -subj "/C=/ST=/O=%s/localityName=/commonName=%s/organizationalUnitName=Developers/emailAddress=%s/" -keyout "%s" -out "%s"',
            $oName, $cName, 'rootcertificate@laravel.valet', $caKeyPath, $caPemPath
        ));
        $this->trustCa($caPemPath);
    }
1365853
public function create()
    {
        if ($this->scenario != self::SCENARIO_CREATE) {
            return false;
        }

        if (!$this->validate()) {
            return false;
        }

        $rule = \Yii::createObject([
            'class' => $this->class,
            'name'  => $this->name,
        ]);
        
        $this->authManager->add($rule);
        $this->authManager->invalidateCache();
        
        return true;
    }