Git-Center/utils.php

27 lines
634 B
PHP
Raw Normal View History

2013-10-02 13:22:31 +00:00
<?php
2013-10-16 19:16:17 +00:00
session_start();
if (defined('ONGITLAB') && ONGITLAB) {
2013-10-16 21:10:51 +00:00
if (!isset($_COOKIE['remember_user_token'])) {
header('Location: /');
2013-10-16 19:16:17 +00:00
exit;
}
}
2013-10-02 13:22:31 +00:00
function ansi2html($string) {
$dictionary = array(
2013-10-17 07:57:29 +00:00
'[30m' => '<span style="color:black">',
'[31m' => '<span style="color:red">',
'[32m' => '<span style="color:green">',
'[33m' => '<span style="color:yellow">',
2013-10-02 13:22:31 +00:00
'[34m' => '<span style="color:blue">',
2013-10-17 07:57:29 +00:00
'[35m' => '<span style="color:fuchsia">',
'[36m' => '<span style="color:aqua">',
'[37m' => '<span style="color:white">',
2013-10-02 13:22:31 +00:00
'[m' => '</span>',
);
return str_replace(array_keys($dictionary), $dictionary, $string);
}