Text Formatted Code
......................
..........
$user_templates->parse('output', 'memberdetail');
$retval .= $user_templates->finish($user_templates->get_var('output'));
return $retval;
}
function phpblock_plugin_menu()
{
$retval = '';
$plugin_menu = PLG_getMenuItems();
for( $i = 1; $i <= count($plugin_menu); $i++ )
{
$url = current($plugin_menu);
$plg = key($plugin_menu);
$retval .= '<a href="' . $url . '">' . $plg . '</a><br>';
next( $plugin_menu );
}
return $retval;
}
function phpblock_galleryRandomPhoto() {
global $_CONF, $GALLERY_BASEDIR, $GALLERY_NO_SESSIONS, $gallery;
$GALLERY_NO_SESSIONS=true;
$GALLERY_BASEDIR = "/webroot/gallery/";
define(CACHE_FILE, "/webroot/gallery/RandPhoto/block-random.cache");
define(CACHE_EXPIRED, 30);
require_once($GALLERY_BASEDIR ."init.php");
include_once($_CONF['path_html'] . "/block-random.php");
if ($profile) {
$timer = time();
}
/* Initializing the seed */
srand ((double) microtime() * 1000);
// Check the cache file to see if it's up to date
$rebuild = 1;
if (fs_file_exists(CACHE_FILE)) {
$stat = fs_stat(CACHE_FILE);
$mtime = $stat[9];
if (time() - $mtime < CACHE_EXPIRED) {
$rebuild = 0;
}
}
if ($rebuild) {
scanAlbums();
saveCache();
} else {
readCache();
}
$album = chooseAlbum();
if ($album) {
$index = choosePhoto($album);
}
if (isset($index)) {
$id = $album->getPhotoId($index);
$retval = ""
."<a href=" .makeAlbumUrl($album->fields["name"], $id) .">"
.$album->getThumbnailTag($index)
."</a>";
$caption = $album->getCaption($index);
// Add any exclusions that you want for captions. I don't always add an caption and Gallery use the default image name
// which I don't want to display. My Cannon digicam uses IMG_XXXX and my Kodak uses DCP_XXXX
if (($caption) AND(!strstr($caption,"IMG_")) AND (!strstr($caption,"DCP_"))) {
$retval .= "<br><center>$caption</center>";
} else {
$retval .= "<br>";
} $retval .= "<br><center>From: "
."<a href=" .makeAlbumUrl($album->fields["name"]) .">"
.$album->fields["title"]
."</a></center>";
} else {
$retval = "No photo chosen.";
}
if ($profile) {
$elapsed = time() - $timer;
$retval .= "<br>Elapsed: $elapsed secs";
}
return $retval;
}
/**
* This is an example of a custom email function. When this function is NOT
* commented out, Geeklog would send all emails through this function
* instead of sending them through COM_mail in lib-common.php.
*
* This is basically a re-implementation of the way emails were sent
* prior to Geeklog 1.3.9 (Geeklog uses PEAR::Mail as of version 1.3.9).
*
*/
/*
function CUSTOM_mail($to, $subject, $message, $from = '', $html = false, $priority = 0)
{
global $_CONF, $LANG_CHARSET;
if (empty ($LANG_CHARSET)) {
$charset = $_CONF['default_charset'];
if (empty ($charset)) {
$charset = 'iso-8859-1';
}
} else {
$charset = $LANG_CHARSET;
}
if (empty ($from)) {
$from = $_CONF['site_name'] . ' <' . $_CONF['site_mail'] . '>';
}
$headers = 'From: ' . $from . "rn"
. 'X-Mailer: Geeklog ' . VERSION . "rn";
if ($priority > 0) {
$headers .= 'X-Priority: ' . $priority . "rn";
}
if ($html) {
$headers .= "Content-Type: text/html; charset={$charset}rn"
. 'Content-Transfer-Encoding: 8bit';
} else {
$headers .= "Content-Type: text/plain; charset={$charset}";
}
return mail ($to, $subject, $message, $headers);
}
*/
?>