clipbucket/upload/plugins/global_announcement/global_announcement.php

71 lines
1.6 KiB
PHP
Raw Normal View History

2013-10-07 12:17:06 +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'))
{
2014-06-02 07:07:29 +00:00
function announcement_2014(){
global $db;
$results = $db->select(tbl('global_announcement'),'*');
$ann = htmlspecialchars_decode($results[0]['announcement']);
2014-08-05 11:12:59 +00:00
if (!$ann ==''){
2014-06-05 10:53:59 +00:00
echo '<div class="alert alert-info margin-bottom-10 ">'.$ann.'</div>';
2014-08-05 11:12:59 +00:00
}
2014-06-02 07:07:29 +00:00
}
/*
2013-10-07 12:17:06 +00:00
function global_announcement()
{
echo '<div>'.htmlspecialchars_decode(get_announcement()).'</div>';
}
2014-06-02 07:07:29 +00:00
*/
2013-10-07 12:17:06 +00:00
function get_announcement()
{
global $db;
$exec = $db->Execute('SELECT * FROM '.tbl("global_announcement"));
$ann = $exec->getrows();
return $ann[0][0];
2014-06-02 07:07:29 +00:00
}
2013-10-07 12:17:06 +00:00
//Function used to update announcement
function update_announcement($text)
{
global $db;
$textCheck = str_replace(array('<p>','</p>','<br>'), '', $text);
if (strlen($textCheck) < 1) {
$text = '';
}
2013-10-07 12:17:06 +00:00
$db->Execute("UPDATE ".tbl("global_announcement")." SET announcement='$text'");
}
}
2014-06-02 07:07:29 +00:00
2013-10-07 12:17:06 +00:00
//Function used to get annoucment for smarty
$Smarty->register_function('get_announcement','get_announcement');
2014-06-02 07:07:29 +00:00
//getting announcement for display in smarty//
register_anchor_function('announcement_2014','global');
2013-10-07 12:17:06 +00:00
add_admin_menu('Global Announcement','Edit Announcement','edit_announcement.php');
2014-06-02 07:07:29 +00:00
//register_anchor_function(array('global_announcement'=>'global'));
2013-10-07 12:17:06 +00:00
?>