# Path: RapacheCore/PluginBase.py
# class PluginBaseObject():
# 
#     def __init__(self, path):
#             
#         # The path to the plugin
#         self.path = path
#     
#         # module this plugin works with
#         self.module = ""
#         
#         # Define what additional config should be read from vhost file
#         self.vhosts_config = {  } # 0 value | 1 options
#         
#         # Number set when plugin UI is added to notebook
#         self._tab_number = -1
#     
#     def is_module_enabled(self):
#         if self.module:
#             module = ModuleModel(self.module)
#             module.load()
#             #print "STATUS : " + self.module + " - " + str( module.is_enabled())
#             return module.is_enabled()
#         return True
#         
#     def is_enabled(self):
#         enabled = self.is_module_enabled()
#         
#         #TODO: Method of activating / deactivating plugins
#         
#         return enabled
#         
#     # Add item to tools menu
#     def init_main_window(self, MainWindow):
#         return None
#         
#         
#     # Customise the module properties window
#     def load_module_properties(self, notebook, module):
#         return True
# 
#     # Perform action on module properties save
#     def save_module_properties(self, module):
#         return True
# 
# 
# 
# 
# 
# 
#     # Init the vhost propertis window
#     def init_vhost_properties(self, notebook):
#         return None, None, None
# 
#     # Tab recives focus load properties from vhost object
#     def load_vhost_properties(self,  vhost):
#         return True
#         
#     # Tab blurs update vhost object with changes
#     def update_vhost_properties(self, vhost):
#         return True, ""
#         
#     # Perform action on vhost properties save, return false if validation fails
#     def save_vhost_properties(self, vhost):
#         return True, ""
# 
# Path: RapacheCore/Shell.py
# class CommandLogEntry:
# class CommandHandler:
#     def __init__(self, command):
#     def __init__(self, ssh_server="localhost", ssh_port=None, ssh_username=None, ssh_password=None):
#     def __get_backup_path(self, path):
#     def get_backup_files(self, path):
#     def read_file_version(self, path, date_stamp):
#     def create_backup(self, path, new_content):
#     def read_file(self, path):
#     def write_file(self, path, content, backup=True):
#     def listdir(self, path):
#     def create_complete_path ( self, complete_path ):
#     def exists(self, path):
#     def readlink(self, path):
#     def move(self, source, destination):
#     def __get_password(self, description, prompt="Password: "):
#     def __sudo_popen (self, command, password ): 
#     def is_auth_needed (self):        
#     def execute(self, command, description = None ):
#     def __output (self, command, returncode, output, error ):
#     def sudo_reset (self):
#     def ask_password(self, description = "Super user priviledges are required to perform this operation"):
#     def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
#     def sudo_read_file(self, path):
#     def sudo_exists(self, path):
#     def sudo_listdir(self, path):
# 
# Path: RapacheCore/VirtualHost.py
# VHOST_TEMPLATE = """#created for you by Rapache
# <VirtualHost *:80>
#     
# </VirtualHost>"""
# def valid_domain_name ( name ):
# def is_denormalized_vhost ( fname ):
# def is_not_normalizable( fname):
# def normalize_vhost( fname ):
#     def __init__(self, name = None, plugin_manager = None):        
#     def load(self, name = False):  
#     def load_from_string(self, content):
#     def save(self, content=None):
#     def get_source ( self ):
#     def get_source_generated( self ):
#     def get_name(self):
#     def get_source_filename(self):
#     def get_backup_files(self):
#     def get_source_version ( self, timestamp ):
#     def delete( self ):
#     def is_default( self ):
#     def is_editable( self ):
#     def is_enabled ( self ):
#     def toggle( self, status ):
#     def get_server_name(self):
#     def get_document_root(self):
#     def get_server_alias(self):
#     def get_icon(self):
#     def has_port(self):
#     def get_port(self):
#     def set_port(self, portnumber):
# class VirtualHostModel():
# 
# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30


import os
import subprocess
import time
     import pygtk
    import gtk
    import gtk.glade
from RapacheCore.PluginBase import PluginBaseObject
from certificate_request import CertificateRequestWindow
from RapacheCore import Shell
from text_display import TextDisplayWindow
from OpenSSL import crypto
from RapacheCore import VirtualHost
from RapacheCore import Configuration
# Rapache - Apache Configuration Tool
# Copyright (C) 2008 Stefano Forenza,  Jason Taylor, Emanuele Gentili
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

try:
     pygtk.require("2.0")
except:

# Path: RapacheCore/PluginBase.py
# class PluginBaseObject():
# 
#     def __init__(self, path):
#             
#         # The path to the plugin
#         self.path = path
#     
#         # module this plugin works with
#         self.module = ""
#         
#         # Define what additional config should be read from vhost file
#         self.vhosts_config = {  } # 0 value | 1 options
#         
#         # Number set when plugin UI is added to notebook
#         self._tab_number = -1
#     
#     def is_module_enabled(self):
#         if self.module:
#             module = ModuleModel(self.module)
#             module.load()
#             #print "STATUS : " + self.module + " - " + str( module.is_enabled())
#             return module.is_enabled()
#         return True
#         
#     def is_enabled(self):
#         enabled = self.is_module_enabled()
#         
#         #TODO: Method of activating / deactivating plugins
#         
#         return enabled
#         
#     # Add item to tools menu
#     def init_main_window(self, MainWindow):
#         return None
#         
#         
#     # Customise the module properties window
#     def load_module_properties(self, notebook, module):
#         return True
# 
#     # Perform action on module properties save
#     def save_module_properties(self, module):
#         return True
# 
# 
# 
# 
# 
# 
#     # Init the vhost propertis window
#     def init_vhost_properties(self, notebook):
#         return None, None, None
# 
#     # Tab recives focus load properties from vhost object
#     def load_vhost_properties(self,  vhost):
#         return True
#         
#     # Tab blurs update vhost object with changes
#     def update_vhost_properties(self, vhost):
#         return True, ""
#         
#     # Perform action on vhost properties save, return false if validation fails
#     def save_vhost_properties(self, vhost):
#         return True, ""
# 
# Path: RapacheCore/Shell.py
# class CommandLogEntry:
# class CommandHandler:
#     def __init__(self, command):
#     def __init__(self, ssh_server="localhost", ssh_port=None, ssh_username=None, ssh_password=None):
#     def __get_backup_path(self, path):
#     def get_backup_files(self, path):
#     def read_file_version(self, path, date_stamp):
#     def create_backup(self, path, new_content):
#     def read_file(self, path):
#     def write_file(self, path, content, backup=True):
#     def listdir(self, path):
#     def create_complete_path ( self, complete_path ):
#     def exists(self, path):
#     def readlink(self, path):
#     def move(self, source, destination):
#     def __get_password(self, description, prompt="Password: "):
#     def __sudo_popen (self, command, password ): 
#     def is_auth_needed (self):        
#     def execute(self, command, description = None ):
#     def __output (self, command, returncode, output, error ):
#     def sudo_reset (self):
#     def ask_password(self, description = "Super user priviledges are required to perform this operation"):
#     def sudo_execute(self, command, description = "Super user priviledges are required to perform this operation"):
#     def sudo_read_file(self, path):
#     def sudo_exists(self, path):
#     def sudo_listdir(self, path):
# 
# Path: RapacheCore/VirtualHost.py
# VHOST_TEMPLATE = """#created for you by Rapache
# <VirtualHost *:80>
#     
# </VirtualHost>"""
# def valid_domain_name ( name ):
# def is_denormalized_vhost ( fname ):
# def is_not_normalizable( fname):
# def normalize_vhost( fname ):
#     def __init__(self, name = None, plugin_manager = None):        
#     def load(self, name = False):  
#     def load_from_string(self, content):
#     def save(self, content=None):
#     def get_source ( self ):
#     def get_source_generated( self ):
#     def get_name(self):
#     def get_source_filename(self):
#     def get_backup_files(self):
#     def get_source_version ( self, timestamp ):
#     def delete( self ):
#     def is_default( self ):
#     def is_editable( self ):
#     def is_enabled ( self ):
#     def toggle( self, status ):
#     def get_server_name(self):
#     def get_document_root(self):
#     def get_server_alias(self):
#     def get_icon(self):
#     def has_port(self):
#     def get_port(self):
#     def set_port(self, portnumber):
# class VirtualHostModel():
# 
# Path: RapacheCore/Configuration.py
# SYSCONFDIR = '/etc/apache2'
# SITES_ENABLED_DIR = SYSCONFDIR + '/sites-enabled'
# SITES_AVAILABLE_DIR = SYSCONFDIR + '/sites-available'
# MODS_ENABLED_DIR = SYSCONFDIR + '/mods-enabled'
# MODS_AVAILABLE_DIR = SYSCONFDIR + '/mods-available'
# APPPATH = '/usr/bin' #please fill at run-time
# GLADEPATH = '/usr/share/rapache/Glade' #please fill at run-time
# NUMBER_OF_BACKUPS = 10
# TEST_CONNECTION_INTERVAL = 30


# Path: plugins/ssl/plugin.py
import os
import subprocess
import time
     import pygtk
    import gtk
    import gtk.glade
from RapacheCore.PluginBase import PluginBaseObject
from certificate_request import CertificateRequestWindow
from RapacheCore import Shell
from text_display import TextDisplayWindow
from OpenSSL import crypto
from RapacheCore import VirtualHost
from RapacheCore import Configuration

# Rapache - Apache Configuration Tool
# Copyright (C) 2008 Stefano Forenza,  Jason Taylor, Emanuele Gentili
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

try:
     pygtk.require("2.0")
except:

      pass