| 1 |
<?php
|
| 2 |
// vim:filetype=php expandtab tabstop=2 softtabstop=2 shiftwidth=2 autoindent smartindent
|
| 3 |
// $Id: tribune.page.inc,v 1.12 2008/11/28 10:22:53 seeschloss Exp $
|
| 4 |
|
| 5 |
/**
|
| 6 |
* Show cookie information for Coincoin users
|
| 7 |
*/
|
| 8 |
function tribune_show_info($node) {
|
| 9 |
global $user;
|
| 10 |
|
| 11 |
$cookie = "";
|
| 12 |
$content = "";
|
| 13 |
|
| 14 |
if ($user->uid) {
|
| 15 |
|
| 16 |
if (isset($_SERVER['HTTP_COOKIE'])) {
|
| 17 |
//$cookie = explode(';', $_SERVER['HTTP_COOKIE']);
|
| 18 |
//$cookie = $cookie[0];
|
| 19 |
|
| 20 |
$cookie = $_SERVER['HTTP_COOKIE'];
|
| 21 |
}
|
| 22 |
|
| 23 |
$content = t("<p><strong>Your cookie</strong>: @cookie</p>", array('@cookie' => $cookie));
|
| 24 |
}
|
| 25 |
|
| 26 |
$site_root = url(NULL, array('absolute' => TRUE));
|
| 27 |
|
| 28 |
$url_backend = url('node/'. $node->nid .'/tribune.xml', array('absolute' => TRUE));
|
| 29 |
$url_post = url('node/'. $node->nid .'/post', array('absolute' => TRUE));
|
| 30 |
$url_b2b = url('node/'. $node->nid .'/info/b2b.xml', array('absolute' => TRUE));
|
| 31 |
|
| 32 |
$content .= "<p><strong>Backend</strong>: ". $url_backend ."</p>";
|
| 33 |
$content .= "<p><strong>Post URL</strong>: ". $url_post ."</p>";
|
| 34 |
$content .= "<p><strong>B2B discover URL</strong> (for ". l("JCoinCoin", "http://fredm00.free.fr/jcoincoin/") ."): ". $url_b2b ."</p>";
|
| 35 |
|
| 36 |
$login = $user->uid ? $user->name : t("YOUR_LOGIN");
|
| 37 |
|
| 38 |
$wmcc_conf .= "board_site: \"". $node->title ."\"\n";
|
| 39 |
$wmcc_conf .= ".backend_flavour: 2\n";
|
| 40 |
$wmcc_conf .= ".palmipede.userlogin: ". $login ."\n";
|
| 41 |
$wmcc_conf .= ".backend.url: ". $url_backend ."\n";
|
| 42 |
$wmcc_conf .= ".post.url: ". $url_post ."\n";
|
| 43 |
$wmcc_conf .= ".tribune.delay: ". $node->tribune_settings['reload_delay'] ."\n";
|
| 44 |
$wmcc_conf .= ".palmipede.msg_max_length: ". $node->tribune_settings['max_message_size'] ."\n";
|
| 45 |
if ($user->uid) {
|
| 46 |
$wmcc_conf .= "\n";
|
| 47 |
$wmcc_conf .= "\"". $node->title ."\" cookie: \"". $cookie ."\"\n";
|
| 48 |
}
|
| 49 |
|
| 50 |
$content .= t("<div>For <strong><a href='http://hules.free.fr/wmcoincoin'>wmcoincoin</a> users, wmc² configuration</strong> (place it in <code>~/.wmcoincoin/options</code>):");
|
| 51 |
$content .= "<pre>". $wmcc_conf ."</pre>";
|
| 52 |
$content .= "</div>";
|
| 53 |
|
| 54 |
return $content;
|
| 55 |
}
|
| 56 |
|
| 57 |
function tribune_b2b_xml($node) {
|
| 58 |
$site_root = url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=');
|
| 59 |
|
| 60 |
$url_backend = url('node/'. $node->nid .'/tribune.xml');
|
| 61 |
$url_post = url('node/'. $node->nid .'/tribune/post');
|
| 62 |
|
| 63 |
$name = check_plain($node->title);
|
| 64 |
$maxlength = $node->tribune_settings['max_message_size'];
|
| 65 |
|
| 66 |
header("Content-Type: application/x-coincoin");
|
| 67 |
print <<<EOT
|
| 68 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 69 |
<!DOCTYPE bouchot SYSTEM "http://www.nraynaud.org/kilombo/b2b-config.dtd">
|
| 70 |
|
| 71 |
<bouchot name="$name" title="$name">
|
| 72 |
<site>$site_root</site>
|
| 73 |
|
| 74 |
<module name="tribune" type="tribune">
|
| 75 |
|
| 76 |
<backend url="$url_backend">
|
| 77 |
<slip type="tags_not_encoded" />
|
| 78 |
</backend>
|
| 79 |
|
| 80 |
<post url="$url_post">
|
| 81 |
<data>message=%m</data>
|
| 82 |
<maxlength>$maxlength</maxlength>
|
| 83 |
<anonym>true</anonym>
|
| 84 |
</post>
|
| 85 |
</module>
|
| 86 |
|
| 87 |
</bouchot>
|
| 88 |
EOT;
|
| 89 |
exit();
|
| 90 |
}
|