/**
  * Displays an announcement at the top of the screen
  *
  * @param string $announcement - optional 
  * @return array
  */
 public function checkAnnouncements($h, $announcement = '')
 {
     $announcements = array();
     if (SITE_OPEN == "false") {
         array_push($announcements, $h->lang['main_announcement_site_closed']);
     }
     // "All plugins are currently disabled."
     if (!$h->numActivePlugins()) {
         array_push($announcements, $h->lang['main_announcement_plugins_disabled']);
     }
     // if using the announcement parameter, then add to non-admin pages only:
     if ($announcement && !$h->isAdmin) {
         array_push($announcements, $announcement);
     }
     // get the announcement set in the Admin Maintenance page:
     require_once LIBS . 'Maintenance.php';
     $maintenance = new Maintenance();
     $maintenance->getSiteAnnouncement($h);
     if ($h->vars['admin_announcement_enabled']) {
         array_push($announcements, urldecode($h->vars['admin_announcement']));
     }
     // Plugins can add announcements with this:
     $h->vars['hotaru_announcements'] = $announcements;
     $h->pluginHook('hotaru_announcements');
     $announcements = $h->vars['hotaru_announcements'];
     if (!is_array($announcements)) {
         return false;
     } else {
         return $announcements;
     }
 }
Beispiel #2
0
 /**
  * Check action called in Maintenance template
  */
 public function maintenanceAction($h)
 {
     $maintenance = new Maintenance();
     $maintenance->getSiteAnnouncement($h);
     // check if we're viewing a debug file
     $debug_file = $h->cage->get->noPath('debug');
     if ($debug_file) {
         // skip the opening die() statement and echo debug file
         $debug_contents = file_get_contents(CACHE . 'debug_logs/' . $debug_file, NULL, NULL, 16);
         echo nl2br($debug_contents);
         exit;
     }
     // check if we're performing an action
     $action = $h->cage->get->testAlnumLines('action');
     if ($action == 'announcement') {
         $maintenance->addSiteAnnouncement($h);
     }
     if ($action == 'open') {
         $h->openCloseSite('open');
     }
     if ($action == 'close') {
         $h->openCloseSite('close');
     }
     if ($action == 'clear_all_cache') {
         $h->clearCache('db_cache', false);
         $h->clearCache('css_js_cache', false);
         $h->clearCache('rss_cache', false);
         $h->clearCache('html_cache', false);
         $h->clearCache('lang_cache', false);
         @unlink(BASE . 'cache/smartloader_cache.php');
         $h->pluginHook('maintenance_clear_all_cache');
         $h->messages[$h->lang('admin_maintenance_clear_all_cache_success')] = 'green';
     }
     if ($action == 'clear_db_cache') {
         $h->clearCache('db_cache');
     }
     if ($action == 'clear_css_js_cache') {
         $h->clearCache('css_js_cache');
     }
     if ($action == 'clear_rss_cache') {
         $h->clearCache('rss_cache');
     }
     if ($action == 'clear_html_cache') {
         $h->clearCache('html_cache');
     }
     if ($action == 'clear_lang_cache') {
         $h->clearCache('lang_cache');
     }
     if ($action == 'optimize') {
         $h->optimizeTables();
     }
     if ($action == 'export') {
         $h->exportDatabase();
     }
     if ($action == 'empty') {
         $h->emptyTable($h->cage->get->testAlnumLines('table'));
     }
     if ($action == 'drop') {
         $h->dropTable($h->cage->get->testAlnumLines('table'));
     }
     if ($action == 'remove_settings') {
         $h->removeSettings($h->cage->get->testAlnumLines('settings'));
     }
     if ($action == 'system_report') {
         $h->generateReport();
     }
     if ($action == 'delete_debugs') {
         $h->clearCache('debug_logs');
         $h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs');
     }
     // get list of debug logs
     $h->vars['debug_files'] = $h->getFiles(CACHE . 'debug_logs');
 }