- Timestamp:
- 12/13/10 22:58:40 (17 months ago)
- Files:
-
- 1 modified
-
branches/1.5/libs/Announcements.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.5/libs/Announcements.php
r2239 r2299 5 5 * PHP version 5 6 6 * 7 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 7 * LICENSE: Hotaru CMS is free software: you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License as 9 * published by the Free Software Foundation, either version 3 of 10 * the License, or (at your option) any later version. 11 11 * 12 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. 12 * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. 15 15 * 16 * You should have received a copy of the GNU General Public License along 16 * You should have received a copy of the GNU General Public License along 17 17 * with Hotaru CMS. If not, see http://www.gnu.org/licenses/. 18 * 18 * 19 19 * @category Content Management System 20 20 * @package HotaruCMS … … 26 26 class Announcements 27 27 { 28 28 29 /** 29 30 * Displays an announcement at the top of the screen 30 31 * 31 * @param string $announcement - optional 32 * @param string $announcement - optional 32 33 * @return array 33 34 */ 34 public function checkAnnouncements($h, $announcement = '') 35 public function checkAnnouncements($h, $announcement = '') 35 36 { 36 37 $announcements = array(); 37 38 38 39 if (SITE_OPEN == "false") { 39 array_push( 40 $announcements, 41 $h->lang['main_announcement_site_closed'] 42 ); 40 $announcements[] = $h->lang['main_announcement_site_closed']; 43 41 } 44 42 45 43 // "All plugins are currently disabled." 46 44 if (!$h->numActivePlugins()) { 47 array_push( 48 $announcements, 49 $h->lang['main_announcement_plugins_disabled'] 50 ); 45 $announcements[] = $h->lang['main_announcement_plugins_disabled']; 51 46 } 52 47 53 48 // if using the announcement parameter, then add to non-admin pages only: 54 49 if ($announcement && !$h->isAdmin) { 55 array_push($announcements, $announcement);50 $announcements[] = $announcement; 56 51 } 57 52 58 53 // get the announcement set in the Admin Maintenance page: 59 require_once(LIBS .'Maintenance.php');54 require_once(LIBS.'Maintenance.php'); 60 55 $maintenance = new Maintenance(); 61 56 $maintenance->getSiteAnnouncement($h); 62 57 if ($h->vars['admin_announcement_enabled']) { 63 array_push($announcements, urldecode($h->vars['admin_announcement']));58 $announcements[] = urldecode($h->vars['admin_announcement']); 64 59 } 65 60 66 61 // Plugins can add announcements with this: 67 62 $h->vars['hotaru_announcements'] = $announcements; 68 63 $h->pluginHook('hotaru_announcements'); 69 64 $announcements = $h->vars['hotaru_announcements']; 70 71 if (!is_array($announcements)) { 72 return false; 73 } else { 74 return $announcements; 65 66 if (count($announcements)) { 67 return $announcemens; 75 68 } 69 return FALSE; 76 70 } 77 78 71 79 72 /** 80 73 * Returns an announcement for display at the top of Admin … … 85 78 { 86 79 // Check if the install file has been deleted: 87 80 88 81 $announcements = array(); 89 82 90 // Check if install file has been deleted91 $filename = INSTALL .'install.php';92 if (file_exists($filename)) {93 array_push($announcements, $h->lang['admin_announcement_delete_install']);94 }83 // Check if install file has been deleted 84 $filename = INSTALL.'install.php'; 85 if (file_exists($filename)) { 86 $announcements[] = $h->lang['admin_announcement_delete_install']; 87 } 95 88 96 // Check if install file has not been run97 $sql = "SELECT miscdata_value FROM " . TABLE_MISCDATA ." WHERE miscdata_key = %s";98 $hotaru_version = $h->db->get_var($h->db->prepare($sql, 'hotaru_version'));99 if (version_compare($h->version, $hotaru_version, '>')) {100 array_push($announcements, $h->lang['admin_announcement_run_install']);101 }102 89 // Check if install file has not been run 90 $sql = "SELECT miscdata_value FROM ".TABLE_MISCDATA." WHERE miscdata_key = %s"; 91 $hotaru_version = $h->db->get_var($h->db->prepare($sql, 'hotaru_version')); 92 if (version_compare($h->version, $hotaru_version, '>')) { 93 $announcements[] = $h->lang['admin_announcement_run_install']; 94 } 95 103 96 // Site is currently undergoing maintenance 104 97 if (SITE_OPEN == "false") { 105 array_push($announcements, $h->lang['admin_announcement_site_closed']);98 $announcements[] = $h->lang['admin_announcement_site_closed']; 106 99 } 107 100 108 101 // Please enter a site email address 109 102 if (SITE_EMAIL == "email@example.com") { 110 array_push($announcements, $h->lang['admin_announcement_change_site_email']);111 } 112 103 $announcements[] = $h->lang['admin_announcement_change_site_email']; 104 } 105 113 106 // "Go to Plugin Management to enable some plugins" 114 107 if (!$h->numActivePlugins()) { 115 array_push($announcements, $h->lang['admin_announcement_plugins_disabled']);108 $announcements[] = $h->lang['admin_announcement_plugins_disabled']; 116 109 } 117 110 118 111 // Plugins can add announcements with this: 119 112 $h->vars['admin_announcements'] = $announcements; 120 113 $h->pluginHook('admin_announcements'); 121 114 $announcements = $h->vars['admin_announcements']; 122 115 123 116 if (!is_array($announcements)) { 124 117 return false; … … 127 120 } 128 121 } 122 129 123 } 130 ?>