public static function admin() { if (!Current_User::allow('layout')) { Current_User::disallow(); } PHPWS_Core::initModClass('controlpanel', 'Panel.php'); $title = $content = null; $panel = Layout_Admin::adminPanel(); if (isset($_REQUEST['command'])) { $command = $_REQUEST['command']; } else { $command = $panel->getCurrentTab(); } switch ($command) { case 'arrange': $title = dgettext('layout', 'Arrange Layout'); $content[] = Layout_Admin::arrangeForm(); break; case 'turn_off_box_move': Layout::moveBoxes(false); PHPWS_Core::goBack(); break; case 'post_style_change': $result = Layout_Admin::postStyleChange(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); } javascript('close_refresh'); break; case 'reset_boxes': if (!Current_User::authorized('layout')) { Current_User::disallow(); } Layout::resetDefaultBoxes(); unset($_SESSION['Layout_Settings']); PHPWS_Core::reroute('index.php?module=layout&action=admin&authkey=' . Current_User::getAuthKey()); break; case 'move_boxes_on': if (!Current_User::authorized('layout')) { Current_User::disallow(); } Layout::moveBoxes(true); PHPWS_Core::goBack(); break; case 'move_boxes_off': if (!Current_User::authorized('layout')) { Current_User::disallow(); } Layout::moveBoxes(false); PHPWS_Core::goBack(); break; case 'confirmThemeChange': $title = dgettext('layout', 'Themes'); if (isset($_POST['confirm'])) { Layout_Admin::changeTheme(); PHPWS_Core::reroute('index.php?module=layout&action=admin&tab=theme'); exit; } else { Layout::reset(); } $content[] = Layout_Admin::adminThemes(); break; case 'meta': $title = dgettext('layout', 'Edit Meta Tags'); $content[] = Layout_Admin::metaForm(); break; case 'clear_templates': if (!Current_User::authorized('layout')) { Current_User::disallow(); } $files = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'templates/cache', false, true); if (!empty($files) && is_array($files)) { foreach ($files as $fn) { $delete_cache_path = "templates/cache/{$fn}"; if (is_file($delete_cache_path)) { unlink('templates/cache/' . $fn); } } } PHPWS_Core::goBack(); break; case 'clear_cache': if (!Current_User::authorized('layout')) { Current_User::disallow(); } PHPWS_Cache::clearCache(); PHPWS_Core::goBack(); break; case 'moveBox': $result = Layout_Admin::moveBox(); PHPWS_Error::logIfError($result); javascript('close_refresh'); Layout::nakedDisplay(); break; case 'postMeta': if (!Current_User::authorized('layout')) { Current_User::disallow(); } Layout_Admin::postMeta(); if (isset($_POST['key_id'])) { javascript('close_refresh'); Layout::nakedDisplay(); exit; } Layout::reset(); $title = dgettext('layout', 'Edit Meta Tags'); $template['MESSAGE'] = dgettext('layout', 'Meta Tags updated.'); $content[] = Layout_Admin::metaForm(); break; case 'demo_fail': unset($_SESSION['Layout_Settings']); Layout::checkSettings(); PHPWS_Core::reroute('index.php?module=layout&action=admin&command=confirmThemeChange'); break; case 'demo_theme': $title = dgettext('layout', 'Confirm Theme Change'); $content[] = dgettext('layout', 'If you are happy with the change, click the appropiate button.'); $content[] = dgettext('layout', 'Failure to respond in ten seconds, reverts phpWebSite to the default theme.'); $content[] = Layout_Admin::confirmThemeChange(); break; case 'postTheme': if (!Current_User::authorized('layout')) { Current_User::disallow(); } if ($_POST['default_theme'] != $_SESSION['Layout_Settings']->current_theme) { Layout::reset($_POST['default_theme']); PHPWS_Core::reroute('index.php?module=layout&action=admin&command=demo_theme&authkey=' . Current_User::getAuthKey()); } else { PHPWS_Settings::set('layout', 'include_css_order', (int) $_POST['include_css_order']); PHPWS_Settings::save('layout'); $title = dgettext('layout', 'Themes'); $content[] = Layout_Admin::adminThemes(); } break; case 'theme': $title = dgettext('layout', 'Themes'); $content[] = Layout_Admin::adminThemes(); break; case 'js_style_change': $content = Layout_Admin::jsStyleChange(); if (empty($content)) { javascript('close_refresh'); } Layout::nakedDisplay($content, dgettext('layout', 'Change CSS')); break; case 'page_meta_tags': $content = Layout_Admin::pageMetaTags((int) $_REQUEST['key_id']); if (empty($content)) { javascript('close_refresh'); } Layout::nakedDisplay($content, dgettext('layout', 'Set meta tags')); break; case 'move_popup': if (!Current_User::authorized('layout')) { Current_User::disallow(); } Layout_Admin::moveBoxMenu(); break; } $template['TITLE'] = $title; if (isset($content)) { $template['CONTENT'] = implode('<br />', $content); } if (isset($message)) { $template['MESSAGE'] = $message; } $final = PHPWS_Template::process($template, 'layout', 'main.tpl'); $panel->setContent($final); Layout::add(PHPWS_ControlPanel::display($panel->display())); }
public function postSettings() { PHPWS_Settings::set('calendar', 'personal_schedules', (int) isset($_POST['personal_schedules'])); PHPWS_Settings::set('calendar', 'allow_submissions', (int) isset($_POST['allow_submissions'])); PHPWS_Settings::set('calendar', 'mini_event_link', (int) isset($_POST['mini_event_link'])); PHPWS_Settings::set('calendar', 'cache_month_views', (int) isset($_POST['cache_month_views'])); PHPWS_Settings::set('calendar', 'mini_grid', (int) isset($_POST['mini_grid'])); PHPWS_Settings::set('calendar', 'anon_ical', (int) isset($_POST['anon_ical'])); PHPWS_Settings::set('calendar', 'no_follow', (int) isset($_POST['no_follow'])); PHPWS_Settings::set('calendar', 'display_mini', (int) $_POST['display_mini']); PHPWS_Settings::set('calendar', 'starting_day', (int) $_POST['starting_day']); PHPWS_Settings::set('calendar', 'default_view', $_POST['default_view']); PHPWS_Settings::set('calendar', 'brief_grid', $_POST['brief_grid']); PHPWS_Settings::save('calendar'); PHPWS_Cache::clearCache(); }
public function postSettings() { PHPWS_Settings::set('pagesmith', 'auto_link', isset($_POST['auto_link'])); PHPWS_Settings::set('pagesmith', 'create_shortcuts', isset($_POST['create_shortcuts'])); PHPWS_Settings::set('pagesmith', 'back_to_top', isset($_POST['back_to_top'])); PHPWS_Settings::save('pagesmith'); PHPWS_Cache::clearCache(); }
public function uninstall() { PHPWS_Cache::clearCache(); $content = array(); if (!$this->isModules()) { return PHPWS_Error::get(BOOST_NO_MODULES_SET, 'boost', 'install'); } foreach ($this->modules as $title => $mod) { unset($GLOBALS['Modules'][$title]); $title = trim($title); if ($this->getStatus($title) == BOOST_DONE) { continue; } if ($this->getCurrent() != $title && $this->getStatus($title) == BOOST_NEW) { $this->setCurrent($title); $this->setStatus($title, BOOST_START); } // H 0120 $content[] = dgettext('boost', 'Uninstalling') . ' - ' . $mod->getProperName(); // $content[] = '<b>' . dgettext('boost', 'Uninstalling') . ' - ' . $mod->getProperName() .'</b>'; if ($this->getStatus($title) == BOOST_START && $mod->isImportSQL()) { $uninstall_file = $mod->getDirectory() . 'boost/uninstall.sql'; if (!is_file($uninstall_file)) { $content[] = dgettext('boost', 'Uninstall SQL not found.'); } else { $content[] = dgettext('boost', 'Importing SQL uninstall file.'); $result = PHPWS_Boost::importSQL($uninstall_file); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); $content[] = dgettext('boost', 'An import error occurred.'); $content[] = dgettext('boost', 'Check your logs for more information.'); return implode('<br />', $content); } else { $content[] = dgettext('boost', 'Import successful.'); } } } $result = (bool) $this->onUninstall($mod, $content); // ensure translate path if ($result === true) { $this->setStatus($title, BOOST_DONE); $this->removeDirectories($mod, $content); $this->unregisterModule($mod, $content); $this->removeDependencies($mod); $this->removeKeys($mod); // H 0120 // $content[] = '<hr />'; $content[] = dgettext('boost', 'Finished uninstalling module!'); break; } elseif ($result == -1) { $this->setStatus($title, BOOST_DONE); $this->removeDirectories($mod, $content); $this->unregisterModule($mod, $content); $this->removeDependencies($mod); $this->removeKeys($mod); } elseif ($result === false) { $this->setStatus($title, BOOST_PENDING); break; } elseif (PHPWS_Error::isError($result)) { $content[] = dgettext('boost', 'There was a problem in the installation file:'); $content[] = '<b>' . $result->getMessage() . '</b>'; $content[] = '<br />'; PHPWS_Error::log($result); } } // H 0120 + place into boost log also $this->addLog($title, implode("\n", str_replace('<br />', "\n", $content))); return implode('<br />', $content); }
public function delete() { $table = $this->_schedule->getEventTable(); Key::drop($this->key_id); $db = new PHPWS_DB($table); $db->addWhere('id', $this->id); // Remove any possible children $db->addWhere('pid', $this->id, null, 'or'); PHPWS_Cache::clearCache(); return $db->delete(); }