Permalink
Browse files

Remove Home Message plugin in favor of existing Message of the Day

  • Loading branch information...
1 parent dab1d82 commit 85d84d1441af98554972117e24af68bc759e4493 @Afterster Afterster committed Dec 7, 2015
View
@@ -17,3 +17,5 @@ log/
*.log
/lib/vendor/
/lib/components/
+web.config
+config/motd.php
@@ -63,13 +63,13 @@ public static function add($name,$message,$clobber=0)
if (!isset(AmpError::$errors[$name])) {
AmpError::$errors[$name] = $message;
AmpError::$state = true;
- $_SESSION['errors'][$name] = $message;
+ $_SESSION['errors'][$name] = $message;
}
// They want us to clobber it
elseif ($clobber) {
AmpError::$state = true;
AmpError::$errors[$name] = $message;
- $_SESSION['errors'][$name] = $message;
+ $_SESSION['errors'][$name] = $message;
}
// They want us to append the error, add a BR\n and then the message
else {
@@ -20,20 +20,16 @@
*
*/
-class AmpacheHomeMessage
+class AmpacheMOTDHome
{
- public $name = 'Home Message';
+ public $name = 'Message of the Day';
public $categories = 'home';
- public $description = 'Message on homepage';
+ public $description = 'Message of the Day on homepage';
public $url = '';
public $version = '000001';
public $min_ampache = '370040';
public $max_ampache = '999999';
- // These are internal settings used by this class, run this->load to
- // fill them out
- private $message;
-
/**
* Constructor
* This function does nothing...
@@ -50,14 +46,6 @@ public function __construct()
*/
public function install()
{
- // Check and see if it's already installed
- if (Preference::exists('hm_message')) {
- return false;
- }
-
- Preference::insert('hm_message','Home Message text','','75','string','plugins');
- Preference::insert('hm_level','Home Message level','3','75','integer','plugins');
-
return true;
}
@@ -68,9 +56,6 @@ public function install()
*/
public function uninstall()
{
- Preference::delete('hm_message');
- Preference::delete('hm_level');
-
return true;
}
@@ -89,24 +74,12 @@ public function upgrade()
*/
public function display_home()
{
- if (!empty($this->message)) {
- UI::show_box_top(T_('Global Message'));
- $dstyle = '';
- switch ($this->level) {
- case 1:
- $dstyle .= 'color: #C33; font-weight: bold;';
- break;
- case 2:
- $dstyle .= 'color: #FF0; font-weight: bold;';
- break;
- default:
- $dstyle .= '';
- break;
- }
- echo '<div style="' . $dstyle . '">';
- echo $this->message;
- echo '</div>';
+ if (@is_readable(AmpConfig::get('prefix') . '/config/motd.php')) {
+ echo '<div id="motd">';
+ UI::show_box_top(T_('Message of the Day'));
+ require_once AmpConfig::get('prefix') . '/config/motd.php';
UI::show_box_bottom();
+ echo '</div>';
}
}
@@ -117,13 +90,6 @@ public function display_home()
*/
public function load($user)
{
- $user->set_preferences();
- $data = $user->prefs;
-
- $this->message = $data['hm_message'];
- $this->level = $data['hm_level'];
-
-
return true;
}
}

0 comments on commit 85d84d1

Please sign in to comment.