Пример #1
0
 public function run($formData, $step, &$state)
 {
     $response = parent::run($formData, $step, $state);
     if (!$response->isSuccessful()) {
         return $response;
     }
     $stepsData = [];
     foreach ($state['steps'] as $aStep) {
         if ($stepData = $aStep->getData()) {
             $stepsData = array_merge($stepsData, $stepData);
         }
     }
     unset($stepsData['languages']);
     unset($_SESSION['install_locale']);
     InstallerUtils::createConfig($stepsData, BASE_PATH . '/api');
     InstallerUtils::createTables(BASE_PATH);
     InstallerUtils::addDefaultSettings($stepsData, BASE_PATH);
     $stepsData = InstallerUtils::addDefaultUser($stepsData);
     InstallerUtils::installSchema($stepsData['db_schema'], BASE_PATH);
     $data = ['user' => ['email' => $stepsData['directus_email'], 'token' => $stepsData['user_token'], 'password' => $stepsData['directus_password']], 'project' => ['name' => $stepsData['directus_name'], 'version' => DIRECTUS_VERSION, 'url' => get_url()], 'database' => ['host' => $stepsData['db_host'], 'name' => $stepsData['db_name'], 'user' => $stepsData['db_user'], 'password' => $stepsData['db_password']]];
     if ($response->getData('send_config_email')) {
         Mail::send('mail/new-install.twig.html', $data, function ($message) use($data) {
             $message->setSubject(__t('your_new_directus_instance_x', ['name' => $data['project']['name']]));
             $message->setTo($data['user']['email']);
         });
     }
     return $response;
 }
Пример #2
0
                } else {
                    $recipientString .= $newresult;
                }
            } else {
                $recipientString .= $newresult . ', ';
            }
            $i++;
        }
        foreach ($userRecipients as $recipient) {
            $usersTableGateway = new DirectusUsersTableGateway($acl, $ZendDb);
            $user = $usersTableGateway->findOneBy('id', $recipient);
            if (isset($user) && $user['email_messages'] == 1) {
                $data = ['message' => $requestPayload['message']];
                $view = 'mail/notification.twig.html';
                Mail::send($view, $data, function ($message) use($user, $requestPayload) {
                    $message->setSubject($requestPayload['subject']);
                    $message->setTo($user['email']);
                });
            }
        }
    }
    $requestPayload['datetime'] = DateUtils::now();
    $newRecord = $TableGateway->manageRecordUpdate('directus_messages', $requestPayload, TableGateway::ACTIVITY_ENTRY_MODE_DISABLED);
    $params['id'] = $newRecord['id'];
    // GET all table entries
    $entries = $TableGateway->getEntries($params);
    JsonView::render($entries);
});
/**
 * EXCEPTION LOG
 */
//$app->post("/$v/exception/?", function () use ($params, $requestPayload, $app, $acl, $ZendDb) {