Ejemplo n.º 1
0
 public static function install($theme_id, $authorizations = array(), $enable_theme = true)
 {
     if (!file_exists(PATH_TO_ROOT . '/templates/' . $theme_id . '/config.ini')) {
         self::$error = LangLoader::get_message('misfit.phpboost', 'status-messages-common');
         $folder = new Folder(PATH_TO_ROOT . '/templates/' . $theme_id);
         $folder->delete();
     } else {
         if (!empty($theme_id) && !self::get_theme_existed($theme_id)) {
             $theme = new Theme($theme_id, $authorizations, $enable_theme);
             $configuration = $theme->get_configuration();
             $theme->set_columns_disabled($configuration->get_columns_disabled());
             $phpboost_version = GeneralConfig::load()->get_phpboost_major_version();
             if (version_compare($phpboost_version, $configuration->get_compatibility(), '>')) {
                 self::$error = LangLoader::get_message('misfit.phpboost', 'status-messages-common');
             } else {
                 ThemesConfig::load()->add_theme($theme);
                 ThemesConfig::save();
             }
         } else {
             self::$error = LangLoader::get_message('element.already_exists', 'status-messages-common');
         }
     }
 }