From b05113ba0ad3e904ddaf936b950f94ebe133f4b2 Mon Sep 17 00:00:00 2001 From: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> Date: Mon, 27 Aug 2007 15:01:00 -0400 Subject: [PATCH] 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. --- www/Git_Access.txt | 2 ++ www/{config.inc.php => config.inc.php.dist} | 0 www/index.php | 3 +- www/sflphone.funcs.php | 33 ++++++++++++++++----- 4 files changed, 28 insertions(+), 10 deletions(-) rename www/{config.inc.php => config.inc.php.dist} (100%) diff --git a/www/Git_Access.txt b/www/Git_Access.txt index 9596c5a62b..7d80ce7bbe 100644 --- a/www/Git_Access.txt +++ b/www/Git_Access.txt @@ -31,5 +31,7 @@ authentication. Then: -------------------------------------------------------------- git clone git+ssh://sflphone_org@sflphone.org/git/sflphone.git +cd sflphone +autoreconf --install -------------------------------------------------------------- diff --git a/www/config.inc.php b/www/config.inc.php.dist similarity index 100% rename from www/config.inc.php rename to www/config.inc.php.dist diff --git a/www/index.php b/www/index.php index 6cb9af5e60..58598b4813 100644 --- a/www/index.php +++ b/www/index.php @@ -2,8 +2,7 @@ include('sflphone.funcs.php'); - - +show_page('Git_Access'); diff --git a/www/sflphone.funcs.php b/www/sflphone.funcs.php index cf270356aa..b0d6174b52 100644 --- a/www/sflphone.funcs.php +++ b/www/sflphone.funcs.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 */ -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]; } } -- GitLab