コード例 #1
0
ファイル: Available.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * 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);
     }
 }
コード例 #2
0
ファイル: Installer.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Run through the installation process
  *
  */
 public function InstallSteps()
 {
     global $dataDir, $langmessage;
     $this->GetAddonData();
     // addonHistory
     $this->Init_PT();
     // $this->config
     //get from remote
     if ($this->remote_install && !$this->GetRemote()) {
         return false;
     }
     //check ini contents
     if (!$this->CheckIni()) {
         return false;
     }
     $this->SetDestination();
     $this->DataFolder();
     $this->IniContents();
     if (!$this->PrepConfig()) {
         return false;
     }
     if (!$this->CheckFile()) {
         return false;
     }
     //hooks
     if (!$this->Hooks()) {
         return false;
     }
     //layout
     if (!$this->Layout()) {
         return false;
     }
     //move new addon folder into place
     if (!$this->FinalizeFolder()) {
         return false;
     }
     if (!$this->FinalizeConfig()) {
         return false;
     }
     // Save
     if (!\gp\admin\Tools::SaveAllConfig()) {
         $this->message($langmessage['OOPS'] . ' (Configuration not saved)');
         return false;
     }
     if (!is_null($this->order)) {
         $img_path = \gp\tool::IdUrl('ci');
         \gp\tool::IdReq($img_path);
     }
     $this->UpdateHistory();
     return true;
 }
コード例 #3
0
ファイル: Tools.php プロジェクト: Bouhnosaure/Typesetter
 public static function CheckStatus()
 {
     switch (self::$update_status) {
         case 'embedcheck':
             $img_path = \gp\tool::GetUrl('Admin', 'cmd=embededcheck');
             \gp\tool::IdReq($img_path);
             break;
         case 'checkincompat':
             $img_path = \gp\tool::IdUrl('ci');
             //check in
             \gp\tool::IdReq($img_path);
             break;
     }
 }