Commit fb081475 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Merge commit 'origin/master' into dbus

Conflicts:

	.gitignore
	src/Makefile.am
	src/managerimpl.cpp
parents 96868436 4be69b42
<?php
/**
* Copyright (C) 2007 - Savoir-faire Linux Inc.
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
*
* LICENSE: GPLv3
*/
include('sflphone.funcs.php');
require_once('sflphone.funcs.php');
// We've requested an image, fetch it, and send it.
if (defined($_REQUEST['i'])) {
$img = $_REQUEST['i'];
switch(strtolower(substr($img, -3))) {
case 'jpg':
header("Content-Type: image/jpeg");
break;
case 'png':
header("Content-Type: image/png");
break;
case 'gif':
header("Content-Type: image/gif");
break;
default:
break;
}
show_page($img);
}
$module = '';
// Default module: home
if (!$_REQUEST['mod']) {
$module = 'home';
} else {
$module = $_REQUEST['mod'];
}
// Send output.
include('header.php');
$mod = "templates/page_$module.php";
if (!file_exists($mod)) {
print "<h1>Module '$module' not found</h1>";
} else {
include($mod);
}
include('footer.php');
?>
\ No newline at end of file
/* Based on the output of asciidoc */
/* COLOR THEME:
* #86B1B5
* #B58A86
* #8A86B5
* #B1B586
*/
body {
margin: 0 auto 0 auto;
width: 750px;
background: #EBEBDF url(images/bg-grad.png) repeat-x top;
}
a {
color: #423130;
text-decoration: underline;
}
a:visited {
color: #826260;
}
em {
font-style: italic;
}
strong {
font-weight: bold;
}
tt {
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #4D4F3A;
font-family: sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1 {
border-bottom: 2px solid silver;
}
h2 {
border-bottom: 2px solid silver;
padding-top: 0.5em;
}
div.sectionbody {
font-family: serif;
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
pre {
padding: 0;
margin: 0;
}
span#author {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
font-size: 1.2em;
}
span#email {
}
span#revision {
font-family: sans-serif;
}
div#footer {
font-family: sans-serif;
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble,
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-right: 10%;
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.5em;
margin-bottom: 2.5em;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock > div.content {
padding-left: 2.0em;
}
div.attribution {
text-align: right;
}
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 2px solid silver;
}
div.exampleblock > div.content {
border-left: 2px solid silver;
padding: 0.5em;
}
div.verseblock div.content {
white-space: pre;
}
div.imageblock div.content { padding-left: 0; }
div.imageblock img { border: 1px solid silver; }
span.image img { border-style: none; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: italic;
}
dd > *:first-child {
margin-top: 0;
}
ul, ol {
list-style-position: outside;
}
ol.olist2 {
list-style-type: lower-alpha;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead {
font-family: sans-serif;
font-weight: bold;
}
tfoot {
font-weight: bold;
}
div.hlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
td.hlist1 {
vertical-align: top;
font-style: italic;
padding-right: 0.8em;
}
td.hlist2 {
vertical-align: top;
}
@media print {
div#footer-badges { display: none; }
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.sidebar-title, div.image-title {
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
margin-bottom: 0.5em;
}
div.listingblock div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock-content {
padding-left: 2.0em;
}
div.exampleblock-content {
border-left: 2px solid silver;
padding-left: 0.5em;
}
/** SFLphone specific */
#header {
text-align: center;
}
#header img {
border: 0px;
}
#page_wrapper {
width: 750px;
background-color: white;
padding: 1em 2em 2em 2em;
border-left: 1px #aaaaaa solid;
border-right: 1px #aaaaaa solid;
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
* Copyright (C) 2007 - Savoir-Faire Linux Inc.
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
*
* LICENCE: GPL
* LICENCE: GPLv3
*/
......@@ -18,24 +18,38 @@ 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 (including the extension) in the $PREFIX dir.
* @return HTML content
*/
function show_page($page) {
// Compile it
function get_page($page, $compile = TRUE) {
// Get the latest HASH for that page.
$hash = get_git_hash($page);
if (!$hash) {
return "Page '$page' not found.<br />\n";
}
$cnt = get_cache_hash($hash);
if (!$cnt) {
$cnt = compile_page($hash, $page /* for ref only */);
if ($compile) {
// Compile it
$cnt = compile_page($hash, $page /* for ref only */);
put_cache_hash($hash, $cnt);
put_cache_hash($hash, $cnt);
return $cnt;
}
else {
// Grab it as is.
$cnt = get_git_hash_content($hash);
put_cache_hash($hash, $cnt);
return $cnt;
return $cnt;
}
}
return $cnt;
......@@ -43,6 +57,18 @@ function show_page($page) {
}
/**
* Show page
*
* @param string File name (including the ext.) in the $PREFIX dir.
*/
function show_page($page, $compile = TRUE) {
print get_page($page, $compile);
}
/**
* Create the Cache dir if it doesn't exist.
*/
......@@ -61,23 +87,37 @@ function check_cache_path() {
* @return mixed NULL or the content of the cache
*/
function get_cache_hash($hash) {
$fn = get_cache_hash_filename($hash);
if ($fn) {
return file_get_contents($fn);
}
return NULL;
}
/**
* Return the local filename (.cache) in the cache path if it exists
*
* @return string/null Filename of the locally cached file.
*/
function get_cache_hash_filename($hash) {
global $CACHE_PATH;
$fn = $CACHE_PATH.'/'.$hash.'.cache';
if (file_exists($fn)) {
return file_get_contents($fn);
return $fn;
}
return NULL;
}
/**
* 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';
......@@ -93,18 +133,23 @@ function put_cache_hash($hash, $content) {
* @return string Content of the compiled page.
*/
function compile_page($hash, $page) {
global $GIT_REPOS;
global $GIT_REPOS, $CACHE_PATH;
$output = '';
$p = popen("GIT_DIR=".$GIT_REPOS." git-show $hash | asciidoc -", 'r');
// Grab the asciidoc.conf file, and put it into cache.
// keep return the hash
$fnconf = bring_local_file('asciidoc.conf');
// -d book so we can render H1s
$p = popen("GIT_DIR=".$GIT_REPOS." git-show $hash | asciidoc -f \"".$fnconf."\"-d book --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);
......@@ -113,9 +158,35 @@ function compile_page($hash, $page) {
/**
* Retrieve file from git's object-ocean
* Bring a file in the .git repository into a local .cache file
* and return the filename (as $CACHE_PATH/hash.cache)
*
* This function will prepend the PREFIX to the given git filename ($gitfile)
*
* UNUSED
* @param string Gitfile is a filename in the repository (without the PREFIX)
* @return string Filename of the local copy of that file (cache/lsakdjflakdj.cache)
*/
function bring_local_file($gitfile) {
$hash = get_git_hash($gitfile);
$fn = get_cache_hash_filename($hash);
if (!$fn) {
$cnt = get_git_hash_content($hash);
put_cache_hash($hash, $cnt);
// Might return an error, but that's all we can do.
return get_cache_hash_filename($hash);
}
return $fn;
}
/**
* Retrieve file from git's object-ocean
*/
function get_git_file_content($file) {
$hash = get_git_hash($file);
......@@ -128,13 +199,12 @@ function get_git_file_content($file) {
/**
* Retrieve hash's content from git's object-ocean
*
* UNUSED
*/
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;
}
......@@ -144,6 +214,7 @@ function get_git_hash_content($hash) {
*
* Used for comparison of cached/to cache/cache filename.
*
* @param string Filename without the $PREFIX (ex: Features.txt, images/pouet.png)
* @return string SHA-1 hash
*/
function get_git_hash($file) {
......@@ -151,14 +222,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)."\"";
$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];
}
}
......@@ -168,7 +242,8 @@ function get_git_hash($file) {
/**
* Get file name (parsed and clear for git-ls-tree)
*
* @return string Parsed file name
* @param string Filename without the $PREFIX (ex: Features.txt, images/pouet.png)
* @return string Parsed file name, with $PREFIX prepended, and slashes cleaned up.
*/
function git_filename($file) {
global $PREFIX;
......
<h1>Build instructions</h1>
<?php show_page('Build.txt'); ?>
<h1>Source code</h1>
<?php show_page('Git_Access.txt'); ?>
<h1>Download</h1>
<?php show_page('Download.txt'); ?>
<?php show_page('Features.txt'); ?>
<h1>Goals</h1>
<?php show_page('Goals.txt'); ?>
<?php show_page('News.txt'); ?>
<?php show_page('About.txt'); ?>
<h1>Get started</h1>
<p>
The project is ongoing well, but your help and contribution is needed to make this software even better!
</p>
<p>&nbsp;</p>
<p>
<img align="left" style="margin-right: 10px; margin-left: 5em;" src="images/info.png"/>
<a href="index.php?mod=goals">Goals</a> - where do we want to be <br/>
<a href="index.php?mod=features">Features</a> - where we are <br/>
<a href="index.php?mod=screenshots">Screenshots</a> - we love them
</p>
<br style="clear: both;"/>
<p>
<img align="left" style="margin-right: 10px; margin-left: 5em;" src="images/fetch.png"/>
<a href="index.php?mod=download">Download</a> - grab the latest source code<br/>
<a href="index.php?mod=build">Build</a> - build and installation instructions <br/>
</p>
<br style="clear: both;"/>
<p>
<img align="left" style="margin-right: 10px; margin-left: 5em;" src="images/devel.png"/>
<a href="/mantis">File a bug</a> - report errors<br/>
<a href="index.php?mod=discuss">Discuss</a> - Subscribe to a mailing list or contact us <br/>
<a href="index.php?mod=devel">Develop</a> - Submit patches, work on the code, contribute
</p>
\ No newline at end of file
<h1>Screenshots</h1>
<?php show_page('Screenshots.txt'); ?>