2009-08-25 12:16:42 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
Plugin Name: Global announcement
|
|
|
|
Description: This will let you post a global announcement on your website
|
|
|
|
Author: Arslan Hassan
|
|
|
|
ClipBucket Version: 1.8
|
|
|
|
Plugin Version: 1.0
|
|
|
|
Website: http://labguru.com/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!function_exists('global_announcement'))
|
|
|
|
{
|
|
|
|
|
|
|
|
function global_announcement()
|
|
|
|
{
|
2010-03-25 12:14:58 +00:00
|
|
|
echo '<div>'.htmlspecialchars_decode(get_announcement()).'</div>';
|
2009-08-25 12:16:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function get_announcement()
|
|
|
|
{
|
|
|
|
global $db;
|
2010-03-23 18:17:53 +00:00
|
|
|
$exec = $db->Execute('SELECT * FROM '.tbl("global_announcement"));
|
2009-08-25 12:16:42 +00:00
|
|
|
$ann = $exec->getrows();
|
|
|
|
return $ann[0][0];
|
|
|
|
}
|
|
|
|
|
|
|
|
//Function used to update announcement
|
|
|
|
function update_announcement($text)
|
|
|
|
{
|
|
|
|
global $db;
|
2010-03-25 12:14:58 +00:00
|
|
|
$text = $text;
|
2010-03-23 08:33:20 +00:00
|
|
|
$db->Execute("UPDATE ".tbl("global_announcement")." SET announcement='$text'");
|
2009-08-25 12:16:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//Function used to get annoucment for smarty
|
|
|
|
$Smarty->register_function('get_announcement','get_announcement');
|
|
|
|
register_anchor_function(array('global_announcement'=>'global'));
|
|
|
|
add_admin_menu('Global Announcement','Edit Announcement','edit_announcement.php');
|
|
|
|
?>
|