<?php
// Build the compare.html from compare.csv
// compare.csv is easy edited with LibreOffice
// compare.html gets included in the website
$INC = dirname(__FILE__) . '/../inc';
require_once($INC . '/util.inc.php');
$h = fopen($_SERVER['argv'][1], 'r');
if (!$h)
die('Cannot open incput file!' . "\n");
$out = fopen($_SERVER['argv'][2], 'w');
if (!$out)
die('Cannot open out file!' . "\n");
fwrite($out, '<div class="main_title">Git hosting solutions comparison</div>' . "\n");
fwrite($out, '<table class="compare">' . "\n");
$lineno = 1;
while (($line = fgetcsv($h, 4000, ',')) !== FALSE) {
if ($lineno == 1) {
// First line
$td = 'th';
$rows = count($line);
} else {
$td = 'td';
}
// Insert an empty line
if (empty($line[0])) {
fwrite($out, '<tr><' . $td . ' colspan="'
. $rows . '"> </' . $td . '></tr>' . "\n");
continue;
}
if (empty($line[1])) {
// We have a chapter
$title = str_replace('[', '', $line[0]);
$title = str_replace(']', '', $title);
fwrite($out,
'<tr><' . $td . ' colspan="' . $rows . '">'
. '<b>' . rg_xss_safe($title) . '</b>'
. '</' . $td . '></tr>' . "\n");
$lineno++;
continue;
}
// Notes
if (strcmp($line[0], '*') == 0) {
fwrite($out,
'<tr><' . $td . ' colspan="' . $rows . '">'
. rg_xss_safe($line[1])
. '</' . $td . '></tr>' . "\n");
continue;
}
fwrite($out, '<tr>');
foreach ($line as $i => $f) {
if ($i == 0) {
$color = '';
} else if (strstr($f, '/#')) {
$t = explode('/#', $f);
$color = ' bgcolor="#' . $t[1] . '"';
$f = $t[0];
} else if (stristr($f, 'no')) {
$color = ' bgcolor="#f00"';
} else if (stristr($f, 'yes')) {
$color = ' bgcolor="#0f0"';
} else {
$color = '';
}
fwrite($out,
'<' . $td . $color . '>'
. rg_xss_safe($f)
. '</' . $td . '>');
}
fwrite($out, '</tr>' . "\n");
$lineno++;
}
fwrite($out, '</table>' . "\n");
fclose($out);
fclose($h);
?>
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"
Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit
Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit
You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a
pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master