Fixed constants

This commit is contained in:
Dmitry Khomutov 2016-07-21 21:20:34 +06:00
parent 60a2b7282a
commit 4fee89fb80
46 changed files with 204 additions and 212 deletions

View file

@ -23,7 +23,7 @@ use PHPCensor\Service\BuildService;
use Symfony\Component\Console\Application;
use b8\Store\Factory;
define('PHPCI_IS_CONSOLE', true);
define('IS_CONSOLE', true);
require_once(dirname(__DIR__) . '/bootstrap.php');

View file

@ -12,7 +12,7 @@
use PHPCensor\Command\DaemoniseCommand;
use Symfony\Component\Console\Application;
define('PHPCI_IS_CONSOLE', true);
define('IS_CONSOLE', true);
require_once(dirname(__DIR__) . '/bootstrap.php');

View file

@ -13,28 +13,24 @@ if (!defined('ROOT_DIR')) {
define('ROOT_DIR', __DIR__ . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_DIR')) {
define('PHPCI_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
if (!defined('SRC_DIR')) {
define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_PUBLIC_DIR')) {
define('PHPCI_PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_APP_DIR')) {
define('PHPCI_APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
if (!defined('APP_DIR')) {
define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_BIN_DIR')) {
define('PHPCI_BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
if (!defined('BIN_DIR')) {
define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_RUNTIME_DIR')) {
define('PHPCI_RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_BUILDS_DIR')) {
define('PHPCI_BUILDS_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR . 'builds' . DIRECTORY_SEPARATOR);
if (!defined('RUNTIME_DIR')) {
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
if (!defined('IS_WIN')) {
@ -45,29 +41,29 @@ require_once(ROOT_DIR . 'vendor/autoload.php');
\PHPCensor\ErrorHandler::register();
if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) {
$loggerConfig = LoggerConfig::newFromFile(PHPCI_APP_DIR . "loggerconfig.php");
if (defined('IS_CONSOLE') && IS_CONSOLE) {
$loggerConfig = LoggerConfig::newFromFile(APP_DIR . "loggerconfig.php");
}
// Load configuration if present:
$conf = [];
$conf['b8']['app']['namespace'] = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = PHPCI_DIR . 'View' . DIRECTORY_SEPARATOR;
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
$config = new b8\Config($conf);
$configFile = PHPCI_APP_DIR . 'config.yml';
$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
$config->loadYaml($configFile);
}
if (!defined('PHPCI_URL') && !empty($config)) {
define('PHPCI_URL', $config->get('phpci.url', '') . '/');
if (!defined('APP_URL') && !empty($config)) {
define('APP_URL', $config->get('phpci.url', '') . '/');
}
if (!defined('PHPCI_IS_CONSOLE')) {
define('PHPCI_IS_CONSOLE', false);
if (!defined('IS_CONSOLE')) {
define('IS_CONSOLE', false);
}
\PHPCensor\Helper\Lang::init($config);

View file

@ -16,7 +16,7 @@ Installation
#!/bin/sh
PROJECT_ID=1
PHPCI_URL="http://my.server.com/PHPCI/"
APP_URL="http://my.server.com/PHPCI/"
trigger_hook() {
NEWREV="$2"
@ -44,7 +44,7 @@ trigger_hook() {
--data-urlencode commit="$NEWREV" \
--data-urlencode committer="$COMMITTER" \
--data-urlencode message="$MESSAGE" \
"$PHPCI_URL/webhook/git/$PROJECT_ID"
"$APP_URL/webhook/git/$PROJECT_ID"
}
if [ -n "$1" -a -n "$2" -a -n "$3" ]; then

View file

@ -76,10 +76,10 @@ var Build = Class.extend({
var query = query || {};
var cb = function() {
var fullUri = window.PHPCI_URL + uri;
var fullUri = window.APP_URL + uri;
if (name == 'build-updated') {
fullUri = window.PHPCI_URL + 'build/data/' + self.buildId;
fullUri = window.APP_URL + 'build/data/' + self.buildId;
}
$.ajax({

View file

@ -4,7 +4,7 @@ var PHPCensor = {
init: function () {
// Setup the date locale
moment.locale(PHPCI_LANGUAGE);
moment.locale(LANGUAGE);
$(document).ready(function () {
// Format datetimes
@ -19,7 +19,7 @@ var PHPCensor = {
PHPCensor.intervals.getBuilds = setInterval(PHPCensor.getBuilds, 5000);
// Update latest project builds every 10 seconds:
if (typeof PHPCI_PROJECT_ID != 'undefined') {
if (typeof PROJECT_ID != 'undefined') {
PHPCensor.intervals.getProjectBuilds = setInterval(PHPCensor.getProjectBuilds, 10000);
}
@ -33,7 +33,7 @@ var PHPCensor = {
getBuilds: function () {
$.ajax({
url: PHPCI_URL + 'build/latest',
url: APP_URL + 'build/latest',
success: function (data) {
$(window).trigger('builds-updated', [data]);
@ -45,7 +45,7 @@ var PHPCensor = {
getProjectBuilds: function () {
$.ajax({
url: PHPCI_URL + 'project/builds/' + PHPCI_PROJECT_ID + '?branch=' + PHPCI_PROJECT_BRANCH,
url: APP_URL + 'project/builds/' + PROJECT_ID + '?branch=' + PROJECT_BRANCH,
success: function (data) {
$('#latest-builds').html(data);
@ -86,7 +86,7 @@ var PHPCensor = {
get: function (uri, success) {
$.ajax({
url: window.PHPCI_URL + uri,
url: window.APP_URL + uri,
success: function (data) {
success();
@ -99,7 +99,7 @@ var PHPCensor = {
handleFailedAjax: function (xhr) {
if (xhr.status == 401) {
window.location.href = window.PHPCI_URL + 'session/login';
window.location.href = window.APP_URL + 'session/login';
}
},
@ -409,7 +409,7 @@ function setupProjectForm()
$.ajax({
dataType: "json",
url: window.PHPCI_URL + 'project/github-repositories',
url: window.APP_URL + 'project/github-repositories',
success: function (data) {
$('#loading').hide();
@ -463,8 +463,8 @@ var Lang = {
var args = Array.prototype.slice.call(arguments);;
var string = args.shift();
if (PHPCI_STRINGS[string]) {
args.unshift(PHPCI_STRINGS[string]);
if (STRINGS[string]) {
args.unshift(STRINGS[string]);
return sprintf.apply(sprintf[0], args);
}
@ -472,4 +472,4 @@ var Lang = {
}
};
moment.locale(PHPCI_LANGUAGE);
moment.locale(LANGUAGE);

View file

@ -64,7 +64,7 @@ class Application extends b8\Application
} else {
$_SESSION['phpci_login_redirect'] = substr($request->getPath(), 1);
$response = new RedirectResponse($response);
$response->setHeader('Location', PHPCI_URL . 'session/login');
$response->setHeader('Location', APP_URL . 'session/login');
}
return false;

View file

@ -110,7 +110,7 @@ class Builder implements LoggerAwareInterface
$this->buildLogger = new BuildLogger($logger, $build);
$pluginFactory = $this->buildPluginFactory($build);
$pluginFactory->addConfigFromFile(PHPCI_APP_DIR . "pluginconfig.php");
$pluginFactory->addConfigFromFile(APP_DIR . "pluginconfig.php");
$this->pluginExecutor = new Plugin\Util\Executor($pluginFactory, $this->buildLogger);
$executorClass = 'PHPCensor\Helper\UnixCommandExecutor';
@ -314,7 +314,7 @@ class Builder implements LoggerAwareInterface
$this->interpolator->setupInterpolationVars(
$this->build,
$this->buildPath,
PHPCI_URL
APP_URL
);
$this->commandExecutor->setBuildPath($this->buildPath);

View file

@ -114,7 +114,7 @@ class DaemonCommand extends Command
$this->logger->info("Trying to start the daemon");
$cmd = "nohup %sdaemonise phpci:daemonise > %s 2>&1 &";
$command = sprintf($cmd, PHPCI_BIN_DIR, $this->logFilePath);
$command = sprintf($cmd, BIN_DIR, $this->logFilePath);
$output = $exitCode = null;
exec($command, $output, $exitCode);

View file

@ -66,7 +66,7 @@ class DaemoniseCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$cmd = "echo %s > '%sdaemon/daemon.pid'";
$command = sprintf($cmd, getmypid(), PHPCI_RUNTIME_DIR);
$command = sprintf($cmd, getmypid(), RUNTIME_DIR);
exec($command);
$this->output = $output;

View file

@ -37,7 +37,7 @@ class InstallCommand extends Command
protected function configure()
{
$defaultPath = PHPCI_APP_DIR . 'config.yml';
$defaultPath = APP_DIR . 'config.yml';
$this
->setName('phpci:install')
@ -383,7 +383,7 @@ class InstallCommand extends Command
$output->write(Lang::get('setting_up_db'));
$phinxBinary = escapeshellarg(ROOT_DIR . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'phinx');
$phinxScript = escapeshellarg(PHPCI_APP_DIR . 'phinx.php');
$phinxScript = escapeshellarg(APP_DIR . 'phinx.php');
shell_exec($phinxBinary . ' migrate -c ' . $phinxScript);
$output->writeln('<info>'.Lang::get('ok').'</info>');

View file

@ -51,7 +51,7 @@ class PollCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output)
{
$parser = new Parser();
$yaml = file_get_contents(PHPCI_APP_DIR . 'config.yml');
$yaml = file_get_contents(APP_DIR . 'config.yml');
$this->settings = $parser->parse($yaml);
$token = $this->settings['phpci']['github']['token'];

View file

@ -87,7 +87,7 @@ class RunCommand extends Command
// Allow PHPCI to run in "debug mode"
if ($input->hasOption('debug') && $input->getOption('debug')) {
$output->writeln('<comment>Debug mode enabled.</comment>');
define('PHPCI_DEBUG_MODE', true);
define('DEBUG_MODE', true);
}
$running = $this->validateRunningBuilds();

View file

@ -53,7 +53,7 @@ class UpdateCommand extends Command
$output->write(Lang::get('updating_phpci'));
shell_exec(ROOT_DIR . 'vendor/bin/phinx migrate -c "' . PHPCI_APP_DIR . 'phinx.php"');
shell_exec(ROOT_DIR . 'vendor/bin/phinx migrate -c "' . APP_DIR . 'phinx.php"');
$output->writeln('<info>'.Lang::get('ok').'</info>');
}

View file

@ -69,7 +69,7 @@ class WorkerCommand extends Command
// Allow PHPCI to run in "debug mode"
if ($input->hasOption('debug') && $input->getOption('debug')) {
$output->writeln('<comment>Debug mode enabled.</comment>');
define('PHPCI_DEBUG_MODE', true);
define('DEBUG_MODE', true);
}
$config = Config::getInstance()->get('phpci.worker', []);

View file

@ -88,10 +88,10 @@ class BuildController extends Controller
}
$rebuild = Lang::get('rebuild_now');
$rebuildLink = PHPCI_URL . 'build/rebuild/' . $build->getId();
$rebuildLink = APP_URL . 'build/rebuild/' . $build->getId();
$delete = Lang::get('delete_build');
$deleteLink = PHPCI_URL . 'build/delete/' . $build->getId();
$deleteLink = APP_URL . 'build/delete/' . $build->getId();
$actions = "<a class=\"btn btn-default\" href=\"{$rebuildLink}\">{$rebuild}</a> ";
@ -109,7 +109,7 @@ class BuildController extends Controller
protected function getUiPlugins()
{
$rtn = [];
$path = PHPCI_PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR;
$path = PUBLIC_DIR . 'assets' . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'build-plugins' . DIRECTORY_SEPARATOR;
$dir = opendir($path);
while ($item = readdir($dir)) {
@ -206,7 +206,7 @@ class BuildController extends Controller
}
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
return $response;
}
@ -226,7 +226,7 @@ class BuildController extends Controller
$this->buildService->deleteBuild($build);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'project/view/' . $build->getProjectId());
$response->setHeader('Location', APP_URL.'project/view/' . $build->getProjectId());
return $response;
}

View file

@ -80,13 +80,13 @@ class GroupController extends Controller
$this->groupStore->save($group);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'group');
$response->setHeader('Location', APP_URL.'group');
return $response;
}
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : ''));
$form->setAction(APP_URL . 'group/edit' . (!is_null($groupId) ? '/' . $groupId : ''));
$title = new Form\Element\Text('title');
$title->setContainerClass('form-group');
@ -115,7 +115,7 @@ class GroupController extends Controller
$this->groupStore->delete($group);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'group');
$response->setHeader('Location', APP_URL.'group');
return $response;
}
}

View file

@ -36,7 +36,7 @@ class PluginController extends Controller
$this->view->installedPackages = $json['require'];
$pluginInfo = new PluginInformationCollection();
$pluginInfo->add(FilesPluginInformation::newFromDir(PHPCI_DIR . "Plugin" . DIRECTORY_SEPARATOR));
$pluginInfo->add(FilesPluginInformation::newFromDir(SRC_DIR . "Plugin" . DIRECTORY_SEPARATOR));
$pluginInfo->add(ComposerPluginInformation::buildFromYaml(
ROOT_DIR . "vendor" . DIRECTORY_SEPARATOR . "composer" . DIRECTORY_SEPARATOR . "installed.json"
));

View file

@ -79,7 +79,7 @@ class ProjectController extends PHPCensor\Controller
if ($page > $pages) {
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'project/view/'.$projectId);
$response->setHeader('Location', APP_URL.'project/view/'.$projectId);
return $response;
}
@ -121,7 +121,7 @@ class ProjectController extends PHPCensor\Controller
}
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'build/view/' . $build->getId());
$response->setHeader('Location', APP_URL.'build/view/' . $build->getId());
return $response;
}
@ -136,7 +136,7 @@ class ProjectController extends PHPCensor\Controller
$this->projectService->deleteProject($project);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL);
$response->setHeader('Location', APP_URL);
return $response;
}
@ -230,7 +230,7 @@ class ProjectController extends PHPCensor\Controller
$project = $this->projectService->createProject($title, $type, $reference, $options);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId());
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
return $response;
}
}
@ -295,7 +295,7 @@ class ProjectController extends PHPCensor\Controller
$project = $this->projectService->updateProject($project, $title, $type, $reference, $options);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL.'project/view/' . $project->getId());
$response->setHeader('Location', APP_URL.'project/view/' . $project->getId());
return $response;
}
@ -306,7 +306,7 @@ class ProjectController extends PHPCensor\Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL.'project/' . $type);
$form->setAction(APP_URL.'project/' . $type);
$form->addField(new Form\Element\Csrf('csrf'));
$form->addField(new Form\Element\Hidden('pubkey'));

View file

@ -66,7 +66,7 @@ class SessionController extends Controller
$form = new b8\Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL.'session/login');
$form->setAction(APP_URL.'session/login');
$email = new b8\Form\Element\Email('email');
$email->setLabel(Lang::get('email_address'));
@ -110,7 +110,7 @@ class SessionController extends Controller
session_destroy();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL);
$response->setHeader('Location', APP_URL);
return $response;
}
@ -130,7 +130,7 @@ class SessionController extends Controller
}
$key = md5(date('Y-m-d') . $user->getHash());
$url = PHPCI_URL;
$url = APP_URL;
$message = Lang::get('reset_email_body', $user->getName(), $url, $user->getId(), $key);
@ -170,7 +170,7 @@ class SessionController extends Controller
$_SESSION['phpci_user_id'] = $user->getId();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL);
$response->setHeader('Location', APP_URL);
return $response;
}
@ -186,7 +186,7 @@ class SessionController extends Controller
*/
protected function getLoginRedirect()
{
$rtn = PHPCI_URL;
$rtn = APP_URL;
if (!empty($_SESSION['phpci_login_redirect'])) {
$rtn .= $_SESSION['phpci_login_redirect'];

View file

@ -40,7 +40,7 @@ class SettingsController extends Controller
parent::init();
$parser = new Parser();
$yaml = file_get_contents(PHPCI_APP_DIR . 'config.yml');
$yaml = file_get_contents(APP_DIR . 'config.yml');
$this->settings = $parser->parse($yaml);
}
@ -76,7 +76,7 @@ class SettingsController extends Controller
$authSettings = $this->settings['phpci']['authentication_settings'];
}
$this->view->configFile = PHPCI_APP_DIR . 'config.yml';
$this->view->configFile = APP_DIR . 'config.yml';
$this->view->basicSettings = $this->getBasicForm($basicSettings);
$this->view->buildSettings = $this->getBuildForm($buildSettings);
$this->view->github = $this->getGithubForm();
@ -105,9 +105,9 @@ class SettingsController extends Controller
$response = new b8\Http\Response\RedirectResponse();
if ($error) {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=2');
$response->setHeader('Location', APP_URL . 'settings?saved=2');
} else {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=1');
$response->setHeader('Location', APP_URL . 'settings?saved=1');
}
return $response;
@ -128,9 +128,9 @@ class SettingsController extends Controller
$response = new b8\Http\Response\RedirectResponse();
if ($error) {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=2');
$response->setHeader('Location', APP_URL . 'settings?saved=2');
} else {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=1');
$response->setHeader('Location', APP_URL . 'settings?saved=1');
}
return $response;
@ -150,9 +150,9 @@ class SettingsController extends Controller
$response = new b8\Http\Response\RedirectResponse();
if ($error) {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=2');
$response->setHeader('Location', APP_URL . 'settings?saved=2');
} else {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=1');
$response->setHeader('Location', APP_URL . 'settings?saved=1');
}
return $response;
@ -171,9 +171,9 @@ class SettingsController extends Controller
$response = new b8\Http\Response\RedirectResponse();
if ($error) {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=2');
$response->setHeader('Location', APP_URL . 'settings?saved=2');
} else {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=1');
$response->setHeader('Location', APP_URL . 'settings?saved=1');
}
return $response;
@ -194,9 +194,9 @@ class SettingsController extends Controller
$response = new b8\Http\Response\RedirectResponse();
if ($error) {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=2');
$response->setHeader('Location', APP_URL . 'settings?saved=2');
} else {
$response->setHeader('Location', PHPCI_URL . 'settings?saved=1');
$response->setHeader('Location', APP_URL . 'settings?saved=1');
}
return $response;
@ -223,13 +223,13 @@ class SettingsController extends Controller
$this->storeSettings();
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL . 'settings?linked=1');
$response->setHeader('Location', APP_URL . 'settings?linked=1');
return $response;
}
}
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL . 'settings?linked=2');
$response->setHeader('Location', APP_URL . 'settings?linked=2');
return $response;
}
@ -242,7 +242,7 @@ class SettingsController extends Controller
{
$dumper = new Dumper();
$yaml = $dumper->dump($this->settings, 4);
file_put_contents(PHPCI_APP_DIR . 'config.yml', $yaml);
file_put_contents(APP_DIR . 'config.yml', $yaml);
if (error_get_last()) {
$error_get_last = error_get_last();
@ -258,7 +258,7 @@ class SettingsController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/github');
$form->setAction(APP_URL . 'settings/github');
$form->addField(new Form\Element\Csrf('csrf'));
$field = new Form\Element\Text('githubid');
@ -302,7 +302,7 @@ class SettingsController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/email');
$form->setAction(APP_URL . 'settings/email');
$form->addField(new Form\Element\Csrf('csrf'));
$field = new Form\Element\Text('smtp_address');
@ -387,7 +387,7 @@ class SettingsController extends Controller
*/
protected function canWriteConfig()
{
return is_writeable(PHPCI_APP_DIR . 'config.yml');
return is_writeable(APP_DIR . 'config.yml');
}
/**
@ -399,7 +399,7 @@ class SettingsController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/build');
$form->setAction(APP_URL . 'settings/build');
$field = new Form\Element\Select('failed_after');
$field->setRequired(false);
@ -436,7 +436,7 @@ class SettingsController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/basic');
$form->setAction(APP_URL . 'settings/basic');
$field = new Form\Element\Select('language');
$field->setRequired(true);
@ -468,7 +468,7 @@ class SettingsController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL . 'settings/authentication');
$form->setAction(APP_URL . 'settings/authentication');
$form->addField(new Form\Element\Csrf('csrf'));
$field = new Form\Element\Checkbox('disable_authentication');

View file

@ -92,7 +92,7 @@ class UserController extends Controller
}
$form = new Form();
$form->setAction(PHPCI_URL.'user/profile');
$form->setAction(APP_URL.'user/profile');
$form->setMethod('POST');
$name = new Form\Element\Text('name');
@ -174,7 +174,7 @@ class UserController extends Controller
$this->userService->createUser($name, $email, $password, $isAdmin);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL . 'user');
$response->setHeader('Location', APP_URL . 'user');
return $response;
}
@ -215,7 +215,7 @@ class UserController extends Controller
$this->userService->updateUser($user, $name, $email, $password, $isAdmin);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL . 'user');
$response->setHeader('Location', APP_URL . 'user');
return $response;
}
@ -226,7 +226,7 @@ class UserController extends Controller
{
$form = new Form();
$form->setMethod('POST');
$form->setAction(PHPCI_URL.'user/' . $type);
$form->setAction(APP_URL.'user/' . $type);
$form->addField(new Form\Element\Csrf('csrf'));
$field = new Form\Element\Email('email');
@ -289,7 +289,7 @@ class UserController extends Controller
$this->userService->deleteUser($user);
$response = new b8\Http\Response\RedirectResponse();
$response->setHeader('Location', PHPCI_URL . 'user');
$response->setHeader('Location', APP_URL . 'user');
return $response;
}
}

View file

@ -104,7 +104,7 @@ class Lang
{
$languages = [];
foreach (self::$languages as $language) {
$strings = include_once(PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php');
$strings = include_once(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php');
$languages[$language] = !empty($strings['language_name']) ? $strings['language_name'] : $language;
}
@ -171,7 +171,7 @@ class Lang
protected static function loadLanguage($language = null)
{
$language = $language ? $language : self::$language;
$langFile = PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php';
$langFile = SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.' . $language . '.php';
if (!file_exists($langFile)) {
return null;
@ -191,7 +191,7 @@ class Lang
protected static function loadAvailableLanguages()
{
$matches = [];
foreach (glob(PHPCI_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.*.php') as $file) {
foreach (glob(SRC_DIR . 'Languages' . DIRECTORY_SEPARATOR . 'lang.*.php') as $file) {
if (preg_match('/lang\.([a-z]{2}\-?[a-z]*)\.php/', $file, $matches)) {
self::$languages[] = $matches[1];
}

View file

@ -100,7 +100,7 @@ class BuildLogger implements LoggerAwareInterface
*/
public function logDebug($message)
{
if (defined('PHPCI_DEBUG_MODE') && PHPCI_DEBUG_MODE) {
if (defined('DEBUG_MODE') && DEBUG_MODE) {
$this->log("\033[0;36m" . $message . "\033[0m");
}
}

View file

@ -135,7 +135,7 @@ class Build extends BuildBase
*/
protected function getZeroConfigPlugins(Builder $builder)
{
$pluginDir = PHPCI_DIR . 'Plugin' . DIRECTORY_SEPARATOR;
$pluginDir = SRC_DIR . 'Plugin' . DIRECTORY_SEPARATOR;
$dir = new \DirectoryIterator($pluginDir);
$config = [
@ -258,7 +258,7 @@ class Build extends BuildBase
if (empty($this->currentBuildPath)) {
$buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5);
$this->currentBuildPath = PHPCI_BUILDS_DIR . $buildDirectory . DIRECTORY_SEPARATOR;
$this->currentBuildPath = RUNTIME_DIR . 'builds' . DIRECTORY_SEPARATOR . $buildDirectory . DIRECTORY_SEPARATOR;
}
return $this->currentBuildPath;

View file

@ -63,7 +63,7 @@ class Campfire implements Plugin
*/
public function execute()
{
$url = PHPCI_URL . "build/view/" . $this->build->getId();
$url = APP_URL . "build/view/" . $this->build->getId();
$message = str_replace("%buildurl%", $url, $this->message);
$this->joinRoom($this->roomId);
$status = $this->speak($message, $this->roomId);

View file

@ -69,7 +69,7 @@ class Mysql implements Plugin
$config = Database::getConnection('write')->getDetails();
$this->host =(defined('PHPCI_DB_HOST')) ? PHPCI_DB_HOST : null;
$this->host =(defined('DB_HOST')) ? DB_HOST : null;
$this->user = $config['user'];
$this->pass = $config['pass'];

View file

@ -10,9 +10,9 @@ use Pimple\Container;
*/
class Factory
{
const TYPE_ARRAY = "array";
const TYPE_CALLABLE = "callable";
const INTERFACE_PHPCI_PLUGIN = '\PHPCensor\Plugin';
const TYPE_ARRAY = "array";
const TYPE_CALLABLE = "callable";
const INTERFACE_PLUGIN = '\PHPCensor\Plugin';
private $currentPluginOptions;
@ -79,9 +79,9 @@ class Factory
$reflectedPlugin = new \ReflectionClass($className);
if (!$reflectedPlugin->implementsInterface(self::INTERFACE_PHPCI_PLUGIN)) {
if (!$reflectedPlugin->implementsInterface(self::INTERFACE_PLUGIN)) {
throw new \InvalidArgumentException(
"Requested class must implement " . self:: INTERFACE_PHPCI_PLUGIN
"Requested class must implement " . self:: INTERFACE_PLUGIN
);
}

View file

@ -57,8 +57,8 @@ class BuildStatusService
if ($this->build) {
$this->loadParentBuild($isParent);
}
if (defined('PHPCI_URL')) {
$this->setUrl(PHPCI_URL);
if (defined('APP_URL')) {
$this->setUrl(APP_URL);
}
}

View file

@ -1,6 +1,6 @@
<?php use PHPCensor\Helper\Lang; ?>
<li>
<a href="<?php print PHPCI_URL; ?>build/view/<?php print $build->getId(); ?>">
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
<?php if ($build->getCommitterEmail()): ?>
<div class="pull-left">
<img src="https://www.gravatar.com/avatar/<?php print md5($build->getCommitterEmail()); ?>?d=mm&s=40" class="img-circle" alt="">

View file

@ -14,7 +14,7 @@
<tr>
<th><?php Lang::out('project'); ?></th>
<td style="text-align: right">
<a href="<?php print PHPCI_URL . 'project/view/' . $build->getProjectId(); ?>">
<a href="<?php print APP_URL . 'project/view/' . $build->getProjectId(); ?>">
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
<?php print $build->getProject()->getTitle(); ?>
</a>
@ -160,7 +160,7 @@
</div>
</div>
<script src="<?php print PHPCI_URL; ?>assets/js/build.js"></script>
<script src="<?php print APP_URL; ?>assets/js/build.js"></script>
<script>
var ActiveBuild = new Build(<?php print $build->getId() ?>);
@ -170,7 +170,7 @@
<?php
foreach ($plugins as $plugin) {
print '<script src="'.PHPCI_URL.'assets/js/build-plugins/' . $plugin . '"></script>' . PHP_EOL;
print '<script src="'.APP_URL.'assets/js/build-plugins/' . $plugin . '"></script>' . PHP_EOL;
}
?>
@ -181,7 +181,7 @@ foreach ($plugins as $plugin) {
$('#delete-build').on('click', function (e) {
e.preventDefault();
confirmDelete(
"<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>", "Build"
"<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>", "Build"
).onCloseConfirmed = function () {window.location = '/'};
});
});

View file

@ -7,26 +7,26 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href='//fonts.googleapis.com/css?family=Roboto:300,500&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="<?php echo PHPCI_URL ?>assets/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo APP_URL ?>assets/css/bootstrap.min.css">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo PHPCI_URL ?>favicon.ico">
<link rel="shortcut icon" type="image/png" href="<?php echo PHPCI_URL ?>assets/img/favicon.png">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo APP_URL ?>favicon.ico">
<link rel="shortcut icon" type="image/png" href="<?php echo APP_URL ?>assets/img/favicon.png">
<script>window.PHPCI_URL = <?php print json_encode(PHPCI_URL) ?></script>
<script>window.APP_URL = <?php print json_encode(APP_URL) ?></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/bootstrap.min.js"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/jqueryui.js"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/class.js"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/phpci.js"></script>
<script src="<?php echo PHPCI_URL ?>assets/js/init.js"></script>
<script src="<?php echo APP_URL ?>assets/js/bootstrap.min.js"></script>
<script src="<?php echo APP_URL ?>assets/js/jqueryui.js"></script>
<script src="<?php echo APP_URL ?>assets/js/class.js"></script>
<script src="<?php echo APP_URL ?>assets/js/phpci.js"></script>
<script src="<?php echo APP_URL ?>assets/js/init.js"></script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<a class="navbar-brand" href="<?php echo PHPCI_URL ?>"><img src="<?php echo PHPCI_URL ?>assets/img/php-censor-logo.png"></a>
<a class="navbar-brand" href="<?php echo APP_URL ?>"><img src="<?php echo APP_URL ?>assets/img/php-censor-logo.png"></a>
</div>
</div>

View file

@ -38,9 +38,9 @@ switch($build->getStatus())
}
?>
<tr class="<?php print $cls; ?>">
<td><a href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><a href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>">#<?php print str_pad($build->getId(), 6, '0', STR_PAD_LEFT); ?></a></td>
<td><?php print $build->getCreated()->format('Y-m-d H:i:s'); ?></td>
<td><a href="<?php echo PHPCI_URL ?>project/view/<?php print $build->getProjectId(); ?>">
<td><a href="<?php echo APP_URL ?>project/view/<?php print $build->getProjectId(); ?>">
<i class="fa fa-<?php print $build->getProject()->getIcon(); ?>"></i>
<?php
@ -72,13 +72,13 @@ switch($build->getStatus())
</td>
<td>
<div class="btn-group">
<a class="btn btn-default btn-sm" href="<?php echo PHPCI_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
<a class="btn btn-default btn-sm" href="<?php echo APP_URL ?>build/view/<?php print $build->getId(); ?>"><?php Lang::out('view'); ?></a>
<?php if($this->User()->getIsAdmin()): ?>
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo PHPCI_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build"><?php Lang::out('delete_build'); ?></a></li>
<li><a href="<?php echo APP_URL ?>build/delete/<?php print $build->getId(); ?>" class="phpci-app-delete-build"><?php Lang::out('delete_build'); ?></a></li>
</ul>
<?php endif; ?>
</div>

View file

@ -20,7 +20,7 @@
</div>
<footer>
You can review <a href="<?php print $build->getCommitLink(); ?>">your commit</a>
and the <a href="<?php print PHPCI_URL . 'build/view/' . $build->getId(); ?>">build log</a>.
and the <a href="<?php print APP_URL . 'build/view/' . $build->getId(); ?>">build log</a>.
</footer>
</div>
</div>

View file

@ -1,6 +1,6 @@
<?php use PHPCensor\Helper\Lang; ?>
<div class="clearfix" style="margin-bottom: 20px;">
<a class="btn btn-success pull-right" href="<?php print PHPCI_URL . 'group/edit'; ?>">
<a class="btn btn-success pull-right" href="<?php print APP_URL . 'group/edit'; ?>">
<?php Lang::out('group_add'); ?>
</a>
</div>
@ -24,12 +24,12 @@
<td><?php print $group['title']; ?></td>
<td><?php print count($group['projects']); ?></td>
<td>
<a class="btn btn-sm btn-default" href="<?php print PHPCI_URL . 'group/edit/' . $group['id']; ?>">
<a class="btn btn-sm btn-default" href="<?php print APP_URL . 'group/edit/' . $group['id']; ?>">
<?php Lang::out('group_edit'); ?>
</a>
<?php if (!count($group['projects'])): ?>
<a class="btn btn-sm btn-danger delete-group" href="<?php print PHPCI_URL . 'group/delete/' . $group['id']; ?>">
<a class="btn btn-sm btn-danger delete-group" href="<?php print APP_URL . 'group/delete/' . $group['id']; ?>">
<?php Lang::out('group_delete'); ?>
</a>
<?php endif; ?>

View file

@ -73,11 +73,11 @@
<div class="timeline-item">
<span class="time"><i class="fa fa-clock-o"></i> <?php print Lang::formatDateTime($updated, 'LT'); ?></span>
<h3 class="timeline-header">
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
<a href="<?php print APP_URL; ?>project/view/<?php print $build->getProjectId(); ?>">
<?php print $build->getProject()->getTitle(); ?>
</a>
-
<a href="<?php print PHPCI_URL; ?>build/view/<?php print $build->getId(); ?>">
<a href="<?php print APP_URL; ?>build/view/<?php print $build->getId(); ?>">
Build #<?php print $build->getId(); ?>
</a>
-

View file

@ -1,20 +1,20 @@
<?php use PHPCensor\Helper\Lang; ?>
<script>
var PHPCI_PROJECT_ID = <?php print $project->getId(); ?>;
var PHPCI_PROJECT_BRANCH = '<?php print $branch; ?>';
var PROJECT_ID = <?php print $project->getId(); ?>;
var PROJECT_BRANCH = '<?php print $branch; ?>';
</script>
<div class="clearfix" style="margin-bottom: 20px;">
<a class="btn btn-default" href="<?php print PHPCI_URL . 'project/edit/' . $project->getId(); ?>">
<a class="btn btn-default" href="<?php print APP_URL . 'project/edit/' . $project->getId(); ?>">
<?php Lang::out('edit_project'); ?>
</a>
<a class="btn btn-danger" href="javascript:confirmDelete('<?php print PHPCI_URL . 'project/delete/' . $project->getId(); ?>', '<?php print Lang::out('project'); ?>', true)">
<a class="btn btn-danger" href="javascript:confirmDelete('<?php print APP_URL . 'project/delete/' . $project->getId(); ?>', '<?php print Lang::out('project'); ?>', true)">
<?php Lang::out('delete_project'); ?>
</a>
<div class="pull-right btn-group">
<a class="btn btn-success" href="<?php print PHPCI_URL . 'project/build/' . $project->getId(); ?><?php echo !empty($branch) ? '/' . urlencode($branch) : '' ?>">
<a class="btn btn-success" href="<?php print APP_URL . 'project/build/' . $project->getId(); ?><?php echo !empty($branch) ? '/' . urlencode($branch) : '' ?>">
<?php Lang::out('build_now'); ?>
</a>
@ -26,14 +26,14 @@
<ul class="dropdown-menu" role="menu">
<?php foreach ($branches as $curbranch) : ?>
<li <?php echo ($curbranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($curbranch) ?>">
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($curbranch) ?>">
<?php echo $curbranch ?>
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<li><a href="<?php echo PHPCI_URL ?>project/view/<?php print $project->getId(); ?>"><?php Lang::out('all_branches'); ?></a></li>
<li><a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>"><?php Lang::out('all_branches'); ?></a></li>
</ul>
</div>
</div>
@ -78,17 +78,17 @@
switch($project->getType())
{
case 'github':
$url = PHPCI_URL . 'webhook/github/' . $project->getId();
$url = APP_URL . 'webhook/github/' . $project->getId();
Lang::out('webhooks_help_github', $project->getReference());
break;
case 'gitlab':
$url = PHPCI_URL. 'webhook/gitlab/' . $project->getId();
$url = APP_URL. 'webhook/gitlab/' . $project->getId();
Lang::out('webhooks_help_gitlab');
break;
case 'bitbucket':
$url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId();
$url = APP_URL . 'webhook/bitbucket/' . $project->getId();
Lang::out('webhooks_help_bitbucket', $project->getReference());
break;
}
@ -111,7 +111,7 @@
print '<div><ul class="pagination">';
$project_url = PHPCI_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';

View file

@ -48,7 +48,7 @@
<div class="container">
<div class="row" style="margin-top: 10%; text-align: center">
<a id="phpci-logo" href="/">
<img src="<?php print PHPCI_URL; ?>assets/img/php-censor-logo.png">
<img src="<?php print APP_URL; ?>assets/img/php-censor-logo.png">
</a>
<div class="" id="login-box">
<?php print $content; ?>

View file

@ -15,7 +15,7 @@
<?php endif; ?>
<div class="">
<form class="form" action="<?php print PHPCI_URL; ?>session/forgot-password" method="POST">
<form class="form" action="<?php print APP_URL; ?>session/forgot-password" method="POST">
<div class="form-group">
<label for="email"><?php Lang::out('reset_email_address'); ?></label>
<input id="email" name="email" class="form-control" required>

View file

@ -4,6 +4,6 @@
<?php endif; ?>
<?php print $form; ?>
<a style="margin-top: -22px; font-size: 0.85em; color: #246" class="pull-right" href="<?php print PHPCI_URL; ?>session/forgot-password">
<a style="margin-top: -22px; font-size: 0.85em; color: #246" class="pull-right" href="<?php print APP_URL; ?>session/forgot-password">
<?php Lang::out('forgotten_password_link'); ?>
</a>

View file

@ -6,7 +6,7 @@
</div>
<div class="box-body">
<form class="form" action="<?php print PHPCI_URL; ?>session/reset-password/<?php print $id; ?>/<?php print $key; ?>" method="POST">
<form class="form" action="<?php print APP_URL; ?>session/reset-password/<?php print $id; ?>/<?php print $key; ?>" method="POST">
<div class="form-group">
<label for="password"><?php Lang::out('reset_new_password'); ?></label>
<input type="password" id="password" name="password" class="form-control" required>

View file

@ -56,7 +56,7 @@
$id = $settings['phpci']['github']['id'];
}
$returnTo = PHPCI_URL . 'settings/github-callback';
$returnTo = APP_URL . 'settings/github-callback';
$githubUri = 'https://github.com/login/oauth/authorize?client_id='.$id.'&scope=repo&redirect_uri=' . $returnTo;
?>
<?php if (!empty($id)): ?>

View file

@ -85,7 +85,7 @@ foreach($projects as $project):
<div class="inner">
<h3>
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>">
<?php print $project->getTitle(); ?>
</a>
</h3>
@ -98,7 +98,7 @@ foreach($projects as $project):
<div class="icon">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
</div>
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>" class="small-box-footer small-box-footer-project">
<?php Lang::out('view_project'); ?> (<?php print $counts[$project->getId()]; ?>) <i class="fa fa-arrow-circle-right"></i>
</a>
@ -107,7 +107,7 @@ foreach($projects as $project):
echo '<span class="small-box-footer-build small-box-footer bg-blue"><i class="fa fa-minus"></i></span>';
} else {
$build = $builds[$project->getId()][$idx];
$link = PHPCI_URL . 'build/view/' . $build->id;
$link = APP_URL . 'build/view/' . $build->id;
switch ($build->getStatus()) {
case 0:
$class = 'bg-blue';

View file

@ -1,7 +1,7 @@
<?php use PHPCensor\Helper\Lang; ?>
<div class="clearfix" style="margin-bottom: 20px;">
<div class="pull-right btn-group">
<a class="btn btn-primary" href="<?php print PHPCI_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
<a class="btn btn-primary" href="<?php print APP_URL; ?>user/add"><?php Lang::out('add_user'); ?></a>
</div>
</div>
@ -35,18 +35,18 @@
}
?>
<tr class="<?php print $cls; ?>">
<td><a href="<?php echo PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>"><?php print $user->getEmail(); ?></a></td>
<td><a href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php print $user->getEmail(); ?></a></td>
<td><?php print htmlspecialchars($user->getName()); ?></td>
<td><?php print $status; ?></td>
<td>
<?php if($this->User()->getIsAdmin()): ?>
<div class="btn-group pull-right">
<a class="btn btn-default btn-small" href="<?php echo PHPCI_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
<a class="btn btn-default btn-small" href="<?php echo APP_URL ?>user/edit/<?php print $user->getId(); ?>"><?php Lang::out('edit'); ?></a>
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="<?php echo PHPCI_URL ?>user/delete/<?php print $user->getId(); ?>" class="phpci-app-delete-user"><?php Lang::out('delete_user'); ?></a></li>
<li><a href="<?php echo APP_URL ?>user/delete/<?php print $user->getId(); ?>" class="phpci-app-delete-user"><?php Lang::out('delete_user'); ?></a></li>
</ul>
</div>
<?php endif; ?>

View file

@ -10,31 +10,31 @@
<link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/ansi-colors.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE-skins.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print PHPCI_URL; ?>assets/css/AdminLTE-custom.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/AdminLTE-skins.min.css" rel="stylesheet" type="text/css" />
<link href="<?php print APP_URL; ?>assets/css/AdminLTE-custom.css" rel="stylesheet" type="text/css" />
<script>
var PHPCI_URL = '<?php print PHPCI_URL; ?>';
var PHPCI_LANGUAGE = <?php print json_encode(Lang::getLanguage()); ?>;
var APP_URL = '<?php print APP_URL; ?>';
var LANGUAGE = <?php print json_encode(Lang::getLanguage()); ?>;
<?php if (defined('JSON_UNESCAPED_UNICODE')): ?>
var PHPCI_STRINGS = <?php print json_encode(Lang::getStrings(), JSON_UNESCAPED_UNICODE); ?>;
var STRINGS = <?php print json_encode(Lang::getStrings(), JSON_UNESCAPED_UNICODE); ?>;
<?php else: ?>
var PHPCI_STRINGS = <?php print json_encode(Lang::getStrings()); ?>;
var STRINGS = <?php print json_encode(Lang::getStrings()); ?>;
<?php endif; ?>
</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/class.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/sprintf.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/moment.min.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/js/phpci.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/js/class.js"></script>
<script src="<?php print APP_URL; ?>assets/js/sprintf.js"></script>
<script src="<?php print APP_URL; ?>assets/js/moment.min.js"></script>
<script src="<?php print APP_URL; ?>assets/js/phpci.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
@ -46,7 +46,7 @@
<!-- header logo: style can be found in header.less -->
<header class="main-header">
<a href="<?php print PHPCI_URL; ?>" class="logo">PHPCI</a>
<a href="<?php print APP_URL; ?>" class="logo">PHPCI</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
@ -106,10 +106,10 @@
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="<?php print PHPCI_URL ?>user/profile" class="btn btn-default btn-flat"><?php Lang::out('edit_profile'); ?></a>
<a href="<?php print APP_URL ?>user/profile" class="btn btn-default btn-flat"><?php Lang::out('edit_profile'); ?></a>
</div>
<div class="pull-right">
<a href="<?php print PHPCI_URL ?>session/logout" class="btn btn-default btn-flat"><?php Lang::out('sign_out'); ?></a>
<a href="<?php print APP_URL ?>session/logout" class="btn btn-default btn-flat"><?php Lang::out('sign_out'); ?></a>
</div>
</li>
</ul>
@ -139,7 +139,7 @@
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu">
<li<?php print (array_key_exists('archived', $_GET) ? '' : ' class="active"'); ?>>
<a href="<?php print PHPCI_URL; ?>">
<a href="<?php print APP_URL; ?>">
<i class="fa fa-dashboard"></i> <span><?php Lang::out('dashboard'); ?></span>
</a>
</li>
@ -154,31 +154,31 @@
<ul class="treeview-menu">
<li>
<a href="<?php print PHPCI_URL; ?>project/add">
<a href="<?php print APP_URL; ?>project/add">
<i class="fa fa-angle-double-right"></i> <?php Lang::out('add_project'); ?>
</a>
</li>
<li>
<a href="<?php print PHPCI_URL; ?>group">
<a href="<?php print APP_URL; ?>group">
<i class="fa fa-angle-double-right"></i> <?php Lang::out('project_groups'); ?>
</a>
</li>
<li>
<a href="<?php print PHPCI_URL; ?>settings">
<a href="<?php print APP_URL; ?>settings">
<i class="fa fa-angle-double-right"></i> <?php Lang::out('settings'); ?>
</a>
</li>
<li>
<a href="<?php print PHPCI_URL; ?>user">
<a href="<?php print APP_URL; ?>user">
<i class="fa fa-angle-double-right"></i> <?php Lang::out('manage_users'); ?>
</a>
</li>
<li>
<a href="<?php print PHPCI_URL; ?>plugin">
<a href="<?php print APP_URL; ?>plugin">
<i class="fa fa-angle-double-right"></i> <?php Lang::out('plugins'); ?>
</a>
</li>
@ -198,7 +198,7 @@
<ul class="treeview-menu">
<?php foreach($group['projects'] as $project): ?>
<li>
<a href="<?php print PHPCI_URL; ?>project/view/<?php print $project->getId(); ?>">
<a href="<?php print APP_URL; ?>project/view/<?php print $project->getId(); ?>">
<i class="fa fa-<?php print $project->getIcon(); ?>"></i>
<span><?php print $project->getTitle(); ?></span>
</a>
@ -221,7 +221,7 @@
<ul class="treeview-menu">
<?php foreach ($nav['links'] as $link => $linkTitle): ?>
<li>
<a href="<?php print PHPCI_URL . $link; ?>">
<a href="<?php print APP_URL . $link; ?>">
<i class="fa fa-angle-double-right"></i> <?php print $linkTitle; ?>
</a>
</li>
@ -231,7 +231,7 @@
<?php endif; ?>
<li class="archive<?php print (array_key_exists('archived', $_GET) ? ' active' : ''); ?>">
<a href="<?php print PHPCI_URL . (array_key_exists('archived', $_GET) ? '' : '?archived'); ?>">
<a href="<?php print APP_URL . (array_key_exists('archived', $_GET) ? '' : '?archived'); ?>">
<i class="fa fa-archive"></i> <span><?php Lang::out('archived_menu'); ?></span>
</a>
</li>
@ -280,13 +280,13 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php print PHPCI_URL; ?>assets/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<?php if (file_exists(PHPCI_PUBLIC_DIR . 'assets/plugins/datepicker/locales/bootstrap-datepicker.' . Lang::getLanguage() . '.js')) :?>
<script src="<?php print PHPCI_URL; ?>assets/plugins/datepicker/locales/bootstrap-datepicker.<?php print Lang::getLanguage(); ?>.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/plugins/chartjs/Chart.min.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
<?php if (file_exists(PUBLIC_DIR . 'assets/plugins/datepicker/locales/bootstrap-datepicker.' . Lang::getLanguage() . '.js')) :?>
<script src="<?php print APP_URL; ?>assets/plugins/datepicker/locales/bootstrap-datepicker.<?php print Lang::getLanguage(); ?>.js" type="text/javascript"></script>
<?php endif; ?>
<script src="<?php print PHPCI_URL; ?>assets/js/AdminLTE/app.min.js" type="text/javascript"></script>
<script src="<?php print APP_URL; ?>assets/js/AdminLTE/app.min.js" type="text/javascript"></script>
</body>
</html>

View file

@ -13,28 +13,24 @@ if (!defined('ROOT_DIR')) {
define('ROOT_DIR', dirname(__DIR__) . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_DIR')) {
define('PHPCI_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
if (!defined('SRC_DIR')) {
define('SRC_DIR', ROOT_DIR . 'src' . DIRECTORY_SEPARATOR . 'PHPCensor' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_PUBLIC_DIR')) {
define('PHPCI_PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
if (!defined('PUBLIC_DIR')) {
define('PUBLIC_DIR', ROOT_DIR . 'public' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_APP_DIR')) {
define('PHPCI_APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
if (!defined('APP_DIR')) {
define('APP_DIR', ROOT_DIR . 'app' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_BIN_DIR')) {
define('PHPCI_BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
if (!defined('BIN_DIR')) {
define('BIN_DIR', ROOT_DIR . 'bin' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_RUNTIME_DIR')) {
define('PHPCI_RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
if (!defined('PHPCI_BUILDS_DIR')) {
define('PHPCI_BUILDS_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR . 'builds' . DIRECTORY_SEPARATOR);
if (!defined('RUNTIME_DIR')) {
define('RUNTIME_DIR', ROOT_DIR . 'runtime' . DIRECTORY_SEPARATOR);
}
if (!defined('IS_WIN')) {
@ -45,29 +41,29 @@ require_once(ROOT_DIR . 'vendor/autoload.php');
\PHPCensor\ErrorHandler::register();
if (defined('PHPCI_IS_CONSOLE') && PHPCI_IS_CONSOLE) {
$loggerConfig = LoggerConfig::newFromFile(PHPCI_APP_DIR . "loggerconfig.php");
if (defined('IS_CONSOLE') && IS_CONSOLE) {
$loggerConfig = LoggerConfig::newFromFile(APP_DIR . "loggerconfig.php");
}
// Load configuration if present:
$conf = [];
$conf['b8']['app']['namespace'] = 'PHPCensor';
$conf['b8']['app']['default_controller'] = 'Home';
$conf['b8']['view']['path'] = PHPCI_DIR . 'View' . DIRECTORY_SEPARATOR;
$conf['b8']['view']['path'] = SRC_DIR . 'View' . DIRECTORY_SEPARATOR;
$config = new b8\Config($conf);
$configFile = PHPCI_APP_DIR . 'config.yml';
$configFile = APP_DIR . 'config.yml';
if (file_exists($configFile)) {
$config->loadYaml($configFile);
}
if (!defined('PHPCI_URL') && !empty($config)) {
define('PHPCI_URL', $config->get('phpci.url', '') . '/');
if (!defined('APP_URL') && !empty($config)) {
define('APP_URL', $config->get('phpci.url', '') . '/');
}
if (!defined('PHPCI_IS_CONSOLE')) {
define('PHPCI_IS_CONSOLE', false);
if (!defined('IS_CONSOLE')) {
define('IS_CONSOLE', false);
}
\PHPCensor\Helper\Lang::init($config);