ó
‚•oTc           @   s`  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d  d l j Z d Z d Z d Z	 d Z
 d Z d Z d Z d	 Z d
 Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d d „ Z$ e% d  „ Z& d! „  Z' d" „  Z( d S(#   iÿÿÿÿNi    i   i   i   i   i   i   i   i   c           C   s   d t  d ƒ d S(   Ns"   
    <html>
    <head>
    <title>s   Problem withsï    %s %s</title>
    </head>
    <body>
    <h1><font color="#0000FF"> %s %s</font></h1>
    <p align="center">&nbsp;</p>
    <p align="center"><font size="5">
    <blockquote>
        %s
    </blockquote>
    <br>%s<br>
    </body>
</html>
(   t   Ta(    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_NEWS(   s    c           C   s
   t  d ƒ S(   NsÓ   
    SABnzbd is not compatible with some software firewalls.<br>
    %s<br>
    Sorry, but we cannot solve this incompatibility right now.<br>
    Please file a complaint at your firewall supplier.<br>
    <br>
(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_FWALL:   s    c           C   s   t  d ƒ d t  d ƒ S(   Ns  
    SABnzbd needs a free tcp/ip port for its internal web server.<br>
    Port %s on %s was tried , but it is not available.<br>
    Some other software uses the port or SABnzbd is already running.<br>
    <br>
    Please restart SABnzbd with a different port number.sU   <br>
    <br>
    %s<br>
      &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
    <br>sG   If you get this error message again, please try a different number.<br>(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_PORTC   s    c           C   s   t  d ƒ d t  d ƒ S(   Ns2  
    SABnzbd needs a free tcp/ip port for its internal web server.<br>
    Port %s on %s was tried , but the account used for SABnzbd has no permission to use it.<br>
    On OSX and Linux systems, normal users must use ports above 1023.<br>
    <br>
    Please restart SABnzbd with a different port number.sU   <br>
    <br>
    %s<br>
      &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
    <br>sG   If you get this error message again, please try a different number.<br>(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_ILL_PORTQ   s    c           C   s   t  d ƒ d S(   Nsó   
    SABnzbd needs a valid host address for its internal web server.<br>
    You have specified an invalid address.<br>
    Safe values are <b>localhost</b> and <b>0.0.0.0</b><br>
    <br>
    Please restart SABnzbd with a proper host address.sV   <br>
    <br>
    %s<br>
      &nbsp;&nbsp;&nbsp;&nbsp;%s --server %s:%s<br>
    <br>
(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_HOST_   s    c           C   s   t  d ƒ d S(   Nsd  
    SABnzbd detected saved data from an other SABnzbd version<br>
    but cannot re-use the data of the other program.<br><br>
    You may want to finish your queue first with the other program.<br><br>
    After that, start this program with the "--clean" option.<br>
    This will erase the current queue and history!<br>
    SABnzbd read the file "%s".sO   <br>
    <br>
    %s<br>
      &nbsp;&nbsp;&nbsp;&nbsp;%s --clean<br>
    <br>
(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_QUEUEm   s    c           C   s
   t  d ƒ S(   Nso   
    SABnzbd cannot find its web interface files in %s.<br>
    Please install the program again.<br>
    <br>
(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_BAD_TEMPL|   s    c           C   s   t  d ƒ d S(   Ns   SABnzbd detected a fatal error:s   <br>%s<br><br>%s<br>(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt	   MSG_OTHERƒ   s    c           C   s   t  d ƒ d t  d ƒ S(   Ns  
    SABnzbd detected a Queue and History from an older (0.4.x) release.<br><br>
    Both queue and history will be ignored and may get lost!<br><br>
    You may choose to stop SABnzbd and finish the queue with the older program.<br><br>
    Click OK to proceed to SABnzbdsy   <br><br><FORM><input type="button" onclick="this.form.action='/.'; this.form.submit(); return false;" value="%s"/></FORM>t   OK(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   MSG_OLD_QUEUE†   s    c           C   s
   t  d ƒ S(   Nsù   
    SABnzbd detected that the file sqlite3.dll is missing.<br><br>
    Some poorly designed virus-scanners remove this file.<br>
    Please check your virus-scanner, try to re-install SABnzbd and complain to your virus-scanner vendor.<br>
    <br>
(   R    (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt
   MSG_SQLITEŽ   s    c   	      C   sT  t  j r% t d ƒ } d t  j } n t d ƒ } t  j } |  t k r‚ t | ƒ d } d | } t ƒ  | | | | | | f } n/|  t k rå t | ƒ d k  r© d } n t | ƒ d } d | } t ƒ  | | | | | | f } nÌ |  t	 k rt
 ƒ  | } n° |  t k r&t ƒ  | | | f } n‹ |  t k r^| rNt ƒ  t d ƒ } q±t ƒ  d	 } nS |  t k rvt ƒ  } n; |  t k ržt ƒ  | | d
 | f } n t ƒ  | | f } t ƒ  t  j t  j t  j t  j | t d ƒ f } t  j rt  j j d | ƒ n  t j ƒ  st  j rd  St j d d ƒ \ } } t j | | ƒ t j  | ƒ | S(   Ns-   Press Startkey+R and type the line (example):s   "%s"s3   Open a Terminal window and type the line (example):i   s   %siÿ  i   s7   It is likely that you are using ZoneAlarm on Vista.<br>s   <br>t	   localhosts   Program did not start!s
   Panic exitt   suffixs   .html(!   t   sabnzbdt   WIN32R    t   MY_FULLNAMEt
   PANIC_PORTt   intR   t   PANIC_XPORTR   t   PANIC_TEMPLR   t   PANIC_QUEUER   t   PANIC_FWALLR   t   PANIC_SQLITER   t
   PANIC_HOSTR   R   R   t   MY_NAMEt   __version__t   WIN_SERVICEt	   ErrLoggert   cfgt   autobrowsert   DAEMONt   tempfilet   mkstempt   ost   writet   close(	   t   panict   at   bt   os_strt	   prog_patht   newportt   msgt   msgfilet   url(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_message–   sL    		
"	
"	c         C   s   t  t t |  ƒ ƒ d  S(   N(   t   launch_a_browserR.   R   (   t   vista(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_fwallÊ   s    c         C   s   t  t t |  | ƒ ƒ d  S(   N(   R/   R.   R   (   t   hostt   port(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt
   panic_portÍ   s    c         C   s   t  t t |  | ƒ ƒ d  S(   N(   R/   R.   R   (   R2   R3   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt
   panic_hostÐ   s    c         C   s0   t  t t |  | ƒ ƒ t j t d ƒ | ƒ d  S(   Ns$   You have no permisson to use port %s(   R/   R.   R   t   loggingt   errorR    (   R2   R3   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_xportÓ   s    c         C   s   t  t t |  d ƒ ƒ d  S(   Ni    (   R/   R.   R   (   t   name(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_queue×   s    c         C   s   t  t t |  d ƒ ƒ d  S(   Ni    (   R/   R.   R   (   R9   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt
   panic_tmplÚ   s    c         C   s   t  t t |  d ƒ ƒ d  S(   Ni    (   R/   R.   R   (   R9   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_sqliteÝ   s    c          C   s2   t  ƒ  }  t ƒ  t j t j t j t j |  d f S(   Nt    (   R
   R   R   R   R   (   R+   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   panic_old_queueà   s    	R=   c         C   s2   d t  d ƒ |  | f GHt t t |  | ƒ ƒ d  S(   Ns   
%s:
  %s
%ss   Fatal error(   R    R/   R.   t   PANIC_OTHER(   t   reasont   remedy(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyR%   ä   s    c         C   sý   | r t  j ƒ  s t j r! d  Sd |  k rN d |  k rN |  j d d ƒ }  n  t  j ƒ  r t  j j ƒ  r |  j d d ƒ }  n  t j	 d |  ƒ y: |  rµ |  j
 d ƒ rµ d |  }  n  t j |  d d	 ƒ Wn- t j t d
 ƒ ƒ t j	 d d t ƒn Xd  S(   Ns   ::1s   [::1]s   http:s   https:s   Lauching browser with %st   https
   file:///%si   i   s-   Cannot launch the browser, probably not founds   Traceback: t   exc_info(   R   R   R   R   t   replacet   enable_httpst
   https_portt   get_intR6   t   infot
   startswitht
   webbrowsert   opent   warningR    t   True(   R-   t   force(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyR/   é   s    c         C   s*   t  d ƒ } t  d ƒ |  } d | | f S(   Ns   Access denieds<   Error %s: You need to provide a valid username and password.s‡   
<html>
    <head>
    <title>%s</title>
    </head>
    <body>
    <br/><br/>
    <font color="#0000FF">%s</font>
    </body>
</html>
(   t   T(   t   statust   messaget	   tracebackt   versiont   titlet   body(    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   error_page_401  s    c         C   s   d d  l  } d | j j S(   Niÿÿÿÿs¦   
<html>
    <head>
      <script type="text/javascript">
      <!--
      location.href = "%s"
      //-->
      </script>
    </head>
    <body><br/></body>
</html>
(   t   cherrypyt
   wsgiservert   REDIRECT_URL(   RP   RQ   RR   RS   RW   (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   error_page_404  s    ()   R"   R6   RJ   R    R   t   sabnzbd.cfgR   t
   PANIC_NONER   R   R   R   R?   R   R   R   R   R   R   R   R   R   R   R   R
   R   t   NoneR.   R1   R4   R5   R8   R:   R;   R<   R>   R%   t   FalseR/   RV   RZ   (    (    (    s!   /var/www/SABnzbd/sabnzbd/panic.pyt   <module>   sJ   											4									