/**
  * Activates a theme.
  */
 public function get_activate_theme()
 {
     $theme_name = $this->handler_vars['theme_name'];
     $theme_dir = $this->handler_vars['theme_dir'];
     if (isset($theme_name) && isset($theme_dir)) {
         Themes::activate_theme($theme_name, $theme_dir);
     }
     Session::notice(sprintf(_t("Activated theme '%s'"), $theme_name));
     Utils::redirect(URL::get('admin', 'page=themes'));
 }
 /**
  * Activates a theme.
  */
 public function get_activate_theme()
 {
     $theme_name = $this->handler_vars['theme_name'];
     $theme_dir = $this->handler_vars['theme_dir'];
     $activated = false;
     if (isset($theme_name) && isset($theme_dir)) {
         $activated = Themes::activate_theme($theme_name, $theme_dir);
     }
     if ($activated) {
         Session::notice(_t("Activated theme '%s'", array($theme_name)));
     }
     Utils::redirect(URL::get('admin', 'page=themes'));
 }
Exemple #3
0
 /**
  * Activates a theme.
  */
 public function get_activate_theme()
 {
     $theme_name = $_GET['theme_name'];
     $theme_dir = $_GET['theme_dir'];
     $activated = false;
     if (isset($theme_name) && isset($theme_dir)) {
         $activated = Themes::activate_theme($theme_name, $theme_dir);
     }
     if ($activated) {
         Session::notice(_t("Activated theme '%s'", array($theme_name)));
     }
     Utils::redirect(URL::get('display_themes'));
 }
Exemple #4
0
 public function activate_theme()
 {
     $theme_dir = $this->handler_vars['theme_dir'];
     if (!isset($theme_dir) || empty($theme_dir)) {
         return;
     }
     // set the user_id in the session in case theme activation methods need it
     if (!($u = User::get_by_name($this->handler_vars['admin_username']))) {
         // @todo die gracefully
         die(_t('No admin user found'));
     }
     $u->remember();
     $themes = Themes::get_all_data();
     $theme = $themes[$theme_dir];
     Themes::activate_theme((string) $theme['info']->name, $theme_dir);
     // unset the user_id session variable
     Session::clear_userid($_SESSION['user_id']);
     unset($_SESSION['user_id']);
 }
Exemple #5
0
	/**
	 * Write the default options
	 */
	private function create_default_options()
	{
		// Create the default options

		Options::set( 'installed', true );

		Options::set( 'title', $this->handler_vars['blog_title'] );
		Options::set( 'pagination', '5' );
		Options::set( 'atom_entries', '5' );
		Options::set( 'theme_name', 'k2' );
		Options::set( 'theme_dir', 'k2' );
		Themes::activate_theme( 'k2', 'k2' );
		Options::set( 'comments_require_id', 1 );
		Options::set( 'locale', $this->handler_vars['locale'] );
		Options::set( 'timezone', 'UTC' );
		Options::set( 'dateformat', 'Y-m-d' );
		Options::set( 'timeformat', 'g:i a' );
		Options::set( 'log_min_severity', 3 );		// the default logging level - 3 should be 'info'
		Options::set( 'spam_percentage', 100 );

		// generate a random-ish number to use as the salt for
		// a SHA1 hash that will serve as the unique identifier for
		// this installation.  Also for use in cookies
		Options::set( 'GUID', sha1( Utils::nonce() ) );

		// Let's prepare the EventLog here, as well
		EventLog::register_type( 'default', 'habari' );
		EventLog::register_type( 'user', 'habari' );
		EventLog::register_type( 'authentication', 'habari' );
		EventLog::register_type( 'content', 'habari' );
		EventLog::register_type( 'comment', 'habari' );

		// Add the cronjob to trim the log so that it doesn't get too big
		CronTab::add_daily_cron( 'trim_log', array( 'EventLog', 'trim' ), _t( 'Trim the log table' ) );
		
		// Add the cronjob to check for plugin updates
		CronTab::add_daily_cron( 'update_check', array( 'Update', 'cron' ), _t( 'Perform a check for plugin updates.' ) );

		return true;
	}