Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
0
 /**
  * Remove a layout from $gp_titles and $gpLayouts
  *
  */
 public function RmLayout($layout)
 {
     global $gp_titles, $gpLayouts, $langmessage;
     $this->RmLayoutPrep($layout);
     //determine if code in /data/_theme should be removed
     $rm_addon = $this->RemoveAddonCode($layout);
     unset($gpLayouts[$layout]);
     //delete and save
     if ($rm_addon) {
         $installer = new \gp\admin\Addon\Installer();
         $installer->rm_folders = false;
         if (!$installer->Uninstall($rm_addon)) {
             $gpLayouts = $this->gpLayouts_before;
         }
         $installer->OutputMessages();
     }
     if (!$this->SaveLayouts()) {
         return false;
     }
     //remove custom css
     $this->RemoveCSS($layout);
 }
Ejemplo n.º 3
0
 /**
  * Delete a remote theme
  *
  */
 public function DeleteTheme()
 {
     global $langmessage, $dataDir, $gpLayouts, $config;
     $config_before = $config;
     $gpLayoutsBefore = $gpLayouts;
     $theme_folder_name =& $_POST['folder'];
     $theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name)) {
         message($langmessage['OOPS'] . ' (Invalid Request)');
         return false;
     }
     $order = false;
     if (isset($config['themes'][$theme_folder_name]['order'])) {
         $order = $config['themes'][$theme_folder_name]['order'];
     }
     if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
         message($message);
         return false;
     }
     //remove layouts
     $rm_addon = false;
     foreach ($gpLayouts as $layout_id => $layout_info) {
         if (!isset($layout_info['is_addon']) || !$layout_info['is_addon']) {
             continue;
         }
         $layout_folder = dirname($layout_info['theme']);
         if ($layout_folder != $theme_folder_name) {
             continue;
         }
         if (array_key_exists('addon_key', $layout_info)) {
             $rm_addon = $layout_info['addon_key'];
         }
         $this->RmLayoutPrep($layout_id);
         unset($gpLayouts[$layout_id]);
     }
     //remove from settings
     unset($config['themes'][$theme_folder_name]);
     if ($rm_addon) {
         $installer = new \gp\admin\Addon\Installer();
         if (!$installer->Uninstall($rm_addon)) {
             $gpLayouts = $gpLayoutsBefore;
         }
         $installer->OutputMessages();
     } else {
         if (!\gp\admin\Tools::SaveAllConfig()) {
             $config = $config_before;
             $gpLayouts = $gpLayoutsBefore;
             message($langmessage['OOPS'] . ' (s1)');
             return false;
         }
         message($langmessage['SAVED']);
         if ($order) {
             $img_path = \gp\tool::IdUrl('ci');
             \gp\tool::IdReq($img_path);
         }
     }
     //delete the folder if it hasn't already been deleted by addon installer
     $dir = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (file_exists($dir)) {
         \gp\tool\Files::RmAll($dir);
     }
 }
Ejemplo n.º 4
0
 public function RemoteInstallConfirmed($type = 'plugin')
 {
     $_POST += array('order' => '');
     $installer = new \gp\admin\Addon\Installer();
     $installer->code_folder_name = $this->code_folder_name;
     $installer->config_index = $this->config_index;
     $installer->InstallRemote($type, $_POST['id'], $_POST['order']);
     $installer->OutputMessages();
     return $installer;
 }