Les couleurs fonctionnent
This commit is contained in:
parent
3b1bd49621
commit
11bab4d60b
11
ajax.php
11
ajax.php
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once 'config/config.php';
|
||||
require_once 'lib/Net/SSH2.php';
|
||||
require_once 'config/color.php';
|
||||
require_once 'Net/SSH2.php';
|
||||
global $servers;
|
||||
|
||||
if (!empty($_POST['section'])) {
|
||||
@ -15,14 +16,14 @@ if (!empty($_POST['section'])) {
|
||||
|
||||
if (!empty($_POST['action'])) {
|
||||
$session = new Net_SSH2($config['host'], $config['port']);
|
||||
if ($ssh->login($config['user'], $config['pass'])) {
|
||||
if ($session->login($config['user'], $config['pass'])) {
|
||||
if ($_POST['action'] == 'status') {
|
||||
echo $ssh->exec('cd ' . $config['path'] . ' && git fetch && git status');
|
||||
echo ansi2html($session->exec('cd ' . $config['path'] . ' && git fetch && git status'));
|
||||
} else if ($_POST['action'] == 'push') {
|
||||
$message = empty($_POST['message']) ? 'FTP' : $_POST['message'];
|
||||
//echo $ssh->exec('cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push');
|
||||
//echo $session->exec('cd ' . $config['path'] . ' && git add -A && git commit -m "' . $message . '" && git push');
|
||||
} else if ($_POST['action'] == 'pull') {
|
||||
//echo $ssh->exec('cd ' . $config['path'] . ' && git pull');
|
||||
//echo $session->exec('cd ' . $config['path'] . ' && git pull');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
17
config/color.php
Normal file
17
config/color.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
function ansi2html($string) {
|
||||
$dictionary = array(
|
||||
'[30m' => '<span style="color:blue">',
|
||||
'[31m' => '<span style="color:blue">',
|
||||
'[32m' => '<span style="color:blue">',
|
||||
'[33m' => '<span style="color:blue">',
|
||||
'[34m' => '<span style="color:blue">',
|
||||
'[35m' => '<span style="color:blue">',
|
||||
'[36m' => '<span style="color:blue">',
|
||||
'[37m' => '<span style="color:blue">',
|
||||
'[m' => '</span>',
|
||||
);
|
||||
|
||||
return str_replace(array_keys($dictionary), $dictionary, $string);
|
||||
}
|
@ -20,7 +20,7 @@ pre {
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.nav {
|
||||
|
Loading…
Reference in New Issue
Block a user