2015-12-08 13:57:50 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Name: Fortunate
|
|
|
|
* Description: Add a random fortune cookie at the bottom of every pages. [Requires manual confguration.]
|
|
|
|
* Version: 1.0
|
|
|
|
* Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
|
2016-02-28 12:11:12 +01:00
|
|
|
* Maintainer: none
|
2015-12-08 13:57:50 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
function fortunate_load() {
|
|
|
|
register_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function fortunate_unload() {
|
|
|
|
unregister_hook('page_end', 'addon/fortunate/fortunate.php', 'fortunate_fetch');
|
|
|
|
}
|
|
|
|
|
|
|
|
function fortunate_module(){}
|
|
|
|
|
|
|
|
|
|
|
|
function fortunate_fetch(&$a,&$b) {
|
|
|
|
|
|
|
|
$fort_server = get_config('fortunate','server');
|
|
|
|
if(! $fort_server)
|
|
|
|
return;
|
|
|
|
|
2016-04-17 16:29:18 +02:00
|
|
|
App::$page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'
|
|
|
|
. z_root() . '/addon/fortunate/fortunate.css' . '" media="all" />' . "\r\n";
|
2015-12-08 13:57:50 +01:00
|
|
|
|
|
|
|
$s = z_fetch_url('http://' . $fort_server . '/cookie.php?numlines=4&equal=1&rand=' . mt_rand());
|
|
|
|
if($s['success'])
|
|
|
|
$b .= '<div class="fortunate">' . $s['body'] . '</div>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function fortunate_content(&$a) {
|
|
|
|
|
|
|
|
// $o = '';
|
|
|
|
// fortunate_fetch($a,$o);
|
|
|
|
// return $o;
|
|
|
|
|
|
|
|
}
|