Fixed naming (phpci -> php-censor)

This commit is contained in:
Dmitry Khomutov 2016-07-21 23:02:11 +06:00
commit 31f92327c1
76 changed files with 357 additions and 348 deletions

View file

@ -113,7 +113,7 @@ class ProjectController extends PHPCensor\Controller
throw new NotFoundException(Lang::get('project_x_not_found', $projectId));
}
$email = $_SESSION['phpci_user']->getEmail();
$email = $_SESSION['php-censor-user']->getEmail();
$build = $this->buildService->createBuild($project, null, urldecode($branch), $email);
if ($this->buildService->queueError) {

View file

@ -54,7 +54,7 @@ class SessionController extends Controller
if ($user && password_verify($this->getParam('password', ''), $user->getHash())) {
session_regenerate_id(true);
$_SESSION['phpci_user_id'] = $user->getId();
$_SESSION['php-censor-user-id'] = $user->getId();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', $this->getLoginRedirect());
return $response;
@ -104,8 +104,8 @@ class SessionController extends Controller
*/
public function logout()
{
unset($_SESSION['phpci_user']);
unset($_SESSION['phpci_user_id']);
unset($_SESSION['php-censor-user']);
unset($_SESSION['php-censor-user-id']);
session_destroy();
@ -166,8 +166,8 @@ class SessionController extends Controller
$hash = password_hash($this->getParam('password'), PASSWORD_DEFAULT);
$user->setHash($hash);
$_SESSION['phpci_user'] = $this->userStore->save($user);
$_SESSION['phpci_user_id'] = $user->getId();
$_SESSION['php-censor-user'] = $this->userStore->save($user);
$_SESSION['php-censor-user-id'] = $user->getId();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', APP_URL);
@ -188,9 +188,9 @@ class SessionController extends Controller
{
$rtn = APP_URL;
if (!empty($_SESSION['phpci_login_redirect'])) {
$rtn .= $_SESSION['phpci_login_redirect'];
$_SESSION['phpci_login_redirect'] = null;
if (!empty($_SESSION['php-censor-login-redirect'])) {
$rtn .= $_SESSION['php-censor-login-redirect'];
$_SESSION['php-censor-login-redirect'] = null;
}
return $rtn;

View file

@ -57,23 +57,23 @@ class SettingsController extends Controller
$this->view->settings = $this->settings;
$basicSettings = [];
if (isset($this->settings['phpci']['basic'])) {
$basicSettings = $this->settings['phpci']['basic'];
if (isset($this->settings['php-censor']['basic'])) {
$basicSettings = $this->settings['php-censor']['basic'];
}
$buildSettings = [];
if (isset($this->settings['phpci']['build'])) {
$buildSettings = $this->settings['phpci']['build'];
if (isset($this->settings['php-censor']['build'])) {
$buildSettings = $this->settings['php-censor']['build'];
}
$emailSettings = [];
if (isset($this->settings['phpci']['email_settings'])) {
$emailSettings = $this->settings['phpci']['email_settings'];
if (isset($this->settings['php-censor']['email_settings'])) {
$emailSettings = $this->settings['php-censor']['email_settings'];
}
$authSettings = [];
if (isset($this->settings['phpci']['authentication_settings'])) {
$authSettings = $this->settings['phpci']['authentication_settings'];
if (isset($this->settings['php-censor']['authentication_settings'])) {
$authSettings = $this->settings['php-censor']['authentication_settings'];
}
$this->view->configFile = APP_DIR . 'config.yml';
@ -84,8 +84,8 @@ class SettingsController extends Controller
$this->view->authenticationSettings = $this->getAuthenticationForm($authSettings);
$this->view->isWriteable = $this->canWriteConfig();
if (!empty($this->settings['phpci']['github']['token'])) {
$this->view->githubUser = $this->getGithubUser($this->settings['phpci']['github']['token']);
if (!empty($this->settings['php-censor']['github']['token'])) {
$this->view->githubUser = $this->getGithubUser($this->settings['php-censor']['github']['token']);
}
return $this->view->render();
@ -98,9 +98,9 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['github']['id'] = $this->getParam('githubid', '');
$this->settings['phpci']['github']['secret'] = $this->getParam('githubsecret', '');
$error = $this->storeSettings();
$this->settings['php-censor']['github']['id'] = $this->getParam('githubid', '');
$this->settings['php-censor']['github']['secret'] = $this->getParam('githubsecret', '');
$error = $this->storeSettings();
$response = new b8\Http\Response\RedirectResponse();
@ -120,8 +120,8 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['email_settings'] = $this->getParams();
$this->settings['phpci']['email_settings']['smtp_encryption'] = $this->getParam('smtp_encryption', 0);
$this->settings['php-censor']['email_settings'] = $this->getParams();
$this->settings['php-censor']['email_settings']['smtp_encryption'] = $this->getParam('smtp_encryption', 0);
$error = $this->storeSettings();
@ -143,7 +143,7 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['build'] = $this->getParams();
$this->settings['php-censor']['build'] = $this->getParams();
$error = $this->storeSettings();
@ -165,7 +165,7 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['basic'] = $this->getParams();
$this->settings['php-censor']['basic'] = $this->getParams();
$error = $this->storeSettings();
$response = new b8\Http\Response\RedirectResponse();
@ -186,8 +186,8 @@ class SettingsController extends Controller
{
$this->requireAdmin();
$this->settings['phpci']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0);
$this->settings['phpci']['authentication_settings']['user_id'] = $_SESSION['phpci_user_id'];
$this->settings['php-censor']['authentication_settings']['state'] = $this->getParam('disable_authentication', 0);
$this->settings['php-censor']['authentication_settings']['user_id'] = $_SESSION['php-censor-user-id'];
$error = $this->storeSettings();
@ -208,7 +208,7 @@ class SettingsController extends Controller
public function githubCallback()
{
$code = $this->getParam('code', null);
$github = $this->settings['phpci']['github'];
$github = $this->settings['php-censor']['github'];
if (!is_null($code)) {
$http = new HttpClient();
@ -219,7 +219,7 @@ class SettingsController extends Controller
if ($resp['success']) {
parse_str($resp['body'], $resp);
$this->settings['phpci']['github']['token'] = $resp['access_token'];
$this->settings['php-censor']['github']['token'] = $resp['access_token'];
$this->storeSettings();
$response = new b8\Http\Response\RedirectResponse();
@ -269,8 +269,8 @@ class SettingsController extends Controller
$field->setContainerClass('form-group');
$form->addField($field);
if (isset($this->settings['phpci']['github']['id'])) {
$field->setValue($this->settings['phpci']['github']['id']);
if (isset($this->settings['php-censor']['github']['id'])) {
$field->setValue($this->settings['php-censor']['github']['id']);
}
$field = new Form\Element\Text('githubsecret');
@ -281,8 +281,8 @@ class SettingsController extends Controller
$field->setContainerClass('form-group');
$form->addField($field);
if (isset($this->settings['phpci']['github']['secret'])) {
$field->setValue($this->settings['phpci']['github']['secret']);
if (isset($this->settings['php-censor']['github']['secret'])) {
$field->setValue($this->settings['php-censor']['github']['secret']);
}
$field = new Form\Element\Submit();

View file

@ -61,7 +61,7 @@ class UserController extends Controller
*/
public function profile()
{
$user = $_SESSION['phpci_user'];
$user = $_SESSION['php-censor-user'];
if ($this->request->getMethod() == 'POST') {
$name = $this->getParam('name', null);
@ -72,12 +72,12 @@ class UserController extends Controller
$chosenLang = $this->getParam('language', $currentLang);
if ($chosenLang !== $currentLang) {
setcookie('phpcilang', $chosenLang, time() + (10 * 365 * 24 * 60 * 60), '/');
setcookie('php-censor-language', $chosenLang, time() + (10 * 365 * 24 * 60 * 60), '/');
Lang::setLanguage($chosenLang);
}
$_SESSION['phpci_user'] = $this->userService->updateUser($user, $name, $email, $password);
$user = $_SESSION['phpci_user'];
$_SESSION['php-censor-user'] = $this->userService->updateUser($user, $name, $email, $password);
$user = $_SESSION['php-censor-user'];
$this->view->updated = 1;
}
@ -87,8 +87,8 @@ class UserController extends Controller
$values = $user->getDataArray();
if (array_key_exists('phpcilang', $_COOKIE)) {
$values['language'] = $_COOKIE['phpcilang'];
if (array_key_exists('php-censor-language', $_COOKIE)) {
$values['language'] = $_COOKIE['php-censor-language'];
}
$form = new Form();

View file

@ -292,7 +292,7 @@ class WebhookController extends Controller
}
$headers = [];
$token = Config::getInstance()->get('phpci.github.token');
$token = Config::getInstance()->get('php-censor.github.token');
if (!empty($token)) {
$headers[] = 'Authorization: token ' . $token;
@ -303,7 +303,7 @@ class WebhookController extends Controller
$http->setHeaders($headers);
//for large pull requests, allow grabbing more then the default number of commits
$custom_per_page = Config::getInstance()->get('phpci.github.per_page');
$custom_per_page = Config::getInstance()->get('php-censor.github.per_page');
$params = [];
if ($custom_per_page) {
$params["per_page"] = $custom_per_page;