Skip to content
Snippets Groups Projects
Commit b05113ba authored by Alexandre Bourget's avatar Alexandre Bourget
Browse files

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
No related branches found
No related tags found
No related merge requests found
...@@ -31,5 +31,7 @@ authentication. Then: ...@@ -31,5 +31,7 @@ authentication. Then:
-------------------------------------------------------------- --------------------------------------------------------------
git clone git+ssh://sflphone_org@sflphone.org/git/sflphone.git git clone git+ssh://sflphone_org@sflphone.org/git/sflphone.git
cd sflphone
autoreconf --install
-------------------------------------------------------------- --------------------------------------------------------------
File moved
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
include('sflphone.funcs.php'); include('sflphone.funcs.php');
show_page('Git_Access');
......
...@@ -18,11 +18,12 @@ require_once('config.inc.php'); ...@@ -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 * @return HTML content
*/ */
function show_page($page) { function get_page($page) {
// Compile it // Compile it
// Get the latest HASH for that page. // Get the latest HASH for that page.
...@@ -43,6 +44,18 @@ function show_page($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. * Create the Cache dir if it doesn't exist.
*/ */
...@@ -77,7 +90,7 @@ function get_cache_hash($hash) { ...@@ -77,7 +90,7 @@ function get_cache_hash($hash) {
* Write content to cache (identified by $hash) * Write content to cache (identified by $hash)
*/ */
function put_cache_hash($hash, $content) { function put_cache_hash($hash, $content) {
global $CACHE_PÂTH; global $CACHE_PATH;
$fn = $CACHE_PATH.'/'.$hash.'.cache'; $fn = $CACHE_PATH.'/'.$hash.'.cache';
...@@ -97,14 +110,14 @@ function compile_page($hash, $page) { ...@@ -97,14 +110,14 @@ function compile_page($hash, $page) {
$output = ''; $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) { if (!$p) {
return "Unable to compile file: $page ($hash)\n"; return "Unable to compile file: $page ($hash)\n";
} }
while (!feof($p)) { while (!feof($p)) {
$output .= fread($p); $output .= fread($p, 1024);
} }
pclose($p); pclose($p);
...@@ -134,7 +147,8 @@ function get_git_file_content($file) { ...@@ -134,7 +147,8 @@ function get_git_file_content($file) {
function get_git_hash_content($hash) { function get_git_hash_content($hash) {
global $GIT_REPOS; 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; return $content;
} }
...@@ -151,14 +165,17 @@ function get_git_hash($file) { ...@@ -151,14 +165,17 @@ function get_git_hash($file) {
$output = array(); $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)) { if (count($output)) {
$fields = explode(' ', $output[0]); $fields = explode(' ', $output[0]);
if ($fields[1] == 'blob') { if ($fields[1] == 'blob') {
// Return the HASH // Return the HASH
return $fields[2]; $subfields = explode("\t", $fields[2]);
return $subfields[0];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment