示例#1
0
 /**
  * Add a new layout to the installation
  *
  */
 public function AddLayout($theme_info)
 {
     global $gpLayouts, $langmessage, $config;
     $new_layout = array();
     $new_layout['theme'] = $theme_info['folder'] . '/' . $theme_info['color'];
     $new_layout['color'] = self::GetRandColor();
     $new_layout['label'] = htmlspecialchars($_POST['label']);
     if ($theme_info['is_addon']) {
         $new_layout['is_addon'] = true;
     }
     $installer = new \gp\admin\Addon\Installer();
     $installer->addon_folder_rel = dirname($theme_info['rel']);
     $installer->code_folder_name = '_themes';
     $installer->source = $theme_info['full_dir'];
     $installer->new_layout = $new_layout;
     if (!empty($_POST['default']) && $_POST['default'] != 'false') {
         $installer->default_layout = true;
     }
     $success = $installer->Install();
     $installer->OutputMessages();
     if ($success && $installer->default_layout) {
         $this->page->SetTheme();
         $this->SetLayoutArray();
     }
 }
示例#2
0
 /**
  * Install Local Packages
  *
  */
 function LocalInstall()
 {
     global $dataDir;
     $_REQUEST += array('source' => '');
     if (strpos($_REQUEST['source'], '/') !== false || strpos($_REQUEST['source'], '\\') !== false) {
         message($langmessage['OOPS'] . ' (Invalid Request)');
         return false;
     }
     $installer = new \gp\admin\Addon\Installer();
     $installer->source = $dataDir . '/addons/' . $_REQUEST['source'];
     $installer->Install();
     $installer->OutputMessages();
 }
示例#3
0
 /**
  * Update theme hooks and references in any related layouts
  *
  *
  */
 public function UpgradeTheme()
 {
     global $langmessage, $gpLayouts;
     $theme =& $_REQUEST['source'];
     $theme_info = $this->ThemeInfo($theme);
     if (!$theme_info) {
         message($langmessage['OOPS'] . ' (Invalid Source)');
         return false;
     }
     //install addon
     $installer = new \gp\admin\Addon\Installer();
     $installer->addon_folder_rel = dirname($theme_info['rel']);
     $installer->code_folder_name = '_themes';
     $installer->source = $theme_info['full_dir'];
     $success = $installer->Install();
     $installer->OutputMessages();
     if (!$success) {
         return;
     }
     $this->UpdateLayouts($installer);
 }