Commit b05113ba authored by Alexandre Bourget's avatar Alexandre Bourget

Move config.inc.php to a distribution file. First page showing correclty.

Corrected behavior to show the file. Remove header and footer. Needs to be
added to a local .css file.

Git_Access: add information about how to autoreconf --install.
parent 27aa36b2
......@@ -31,5 +31,7 @@ authentication. Then:
--------------------------------------------------------------
git clone git+ssh://sflphone_org@sflphone.org/git/sflphone.git
cd sflphone
autoreconf --install
--------------------------------------------------------------
......@@ -2,8 +2,7 @@
include('sflphone.funcs.php');
show_page('Git_Access');
......
......@@ -18,11 +18,12 @@ require_once('config.inc.php');
/**
* Show page, compile it if new, cache it.
* Retrieve page, compile it if new, cache it.
*
* @param string File name (without the .txt) in the $PREFIX dir.
* @return HTML content
*/
function show_page($page) {
function get_page($page) {
// Compile it
// Get the latest HASH for that page.
......@@ -43,6 +44,18 @@ function show_page($page) {
}
/**
* Show page
*
* @param string File name (without the .txt) in the $PREFIX dir.
*/
function show_page($page) {
print get_page($page);
}
/**
* Create the Cache dir if it doesn't exist.
*/
......@@ -77,7 +90,7 @@ function get_cache_hash($hash) {
* Write content to cache (identified by $hash)
*/
function put_cache_hash($hash, $content) {
global $CACHE_PÂTH;
global $CACHE_PATH;
$fn = $CACHE_PATH.'/'.$hash.'.cache';
......@@ -97,14 +110,14 @@ function compile_page($hash, $page) {
$output = '';
$p = popen("GIT_DIR=".$GIT_REPOS." git-show $hash | asciidoc -", 'r');
$p = popen("GIT_DIR=".$GIT_REPOS." git-show $hash | asciidoc --no-header-footer -", 'r');
if (!$p) {
return "Unable to compile file: $page ($hash)\n";
}
while (!feof($p)) {
$output .= fread($p);
$output .= fread($p, 1024);
}
pclose($p);
......@@ -134,7 +147,8 @@ function get_git_file_content($file) {
function get_git_hash_content($hash) {
global $GIT_REPOS;
$content = exec("GIT_DIR=".$GIT_REPOS." git-show $hash");
$output = array();
$content = exec("GIT_DIR=".$GIT_REPOS." git-show $hash", $output);
return $content;
}
......@@ -151,14 +165,17 @@ function get_git_hash($file) {
$output = array();
$string = exec("GIT_DIR=".$GIT_REPOS." git-ls-tree $USE_BRANCH \"".git_filename($file)."\"", $output);
$cmd = "cd $GIT_REPOS; git-ls-tree $USE_BRANCH \"".git_filename($file).".txt\"";
$string = exec($cmd, $output);
if (count($output)) {
$fields = explode(' ', $output[0]);
if ($fields[1] == 'blob') {
// Return the HASH
return $fields[2];
$subfields = explode("\t", $fields[2]);
return $subfields[0];
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment