Smartsieve - wygodny panel do sieve

Sieve to język do sterowania CyrusImapd, np. ustawienie powiadomienia na czas wakacji, albo do filtrowania poczty. Niemniej sam skrypt jest bardzo słao rozwijany, zatem nie nadąża za zmianami w php5.4.x. Ponieważ jest pisany obiektowo, zatem trzeba go dostosować do wymogów języka.

Wymagania systemowe

Samo oprogramowanie smartsieve nie jest rozwijane od pewnego czasu. Ostatnie wydanie ma status rc2. Tak więc trzeba nieco je "podrasować" jeśli chodzi o obsługę przez nowsze wersje php (np. 5.5.x).

A z potrzebnych rzeczy pakietów (PHP) trzeba ręcznie doinstalować:

portupgrade -N pear-Log

W przypadku własnego repozytorium pakietów najelpiej zainstalować następujące paczki:

pkg install devel/pear databases/pear-DB sysutils/pear-Log mail/pear-Mail mail/pear-Mail_Mime mail/pear-Mail_mimeDecode net/pear-Net_SMTP net/pear-Net_Socket

Pozostałe wymagane pakiety będą zainstalowane poprzez wiewiórkę

Konfiguracja serwerów IMAP

Plik servers.php:

$servers['lokalny'] = array(
    'display' => 'Twój serwer pocztowy',
    'use_starttls' => false,
    'server' => '127.0.0.1',
    'sieveport' => '4190',
    'imapport' => '143/imap/notls',
    'maildomain' => ''
);

Poprawianie kodu smartsieve

Na podstawie logów serwera www udało się wykonać wiele poprawek kodu smartsieve. Oto one:

css.php

--- data/css.php.orig   2007-09-07 18:31:06.000000000 +0200
+++ data/css.php        2014-03-24 00:49:50.000000000 +0100
@@ -9,12 +9,12 @@
 
 
 include './lib/SmartSieve.lib';
-require SmartSieve::getConf('config_dir', 'conf') . '/style.php';
+require (new SmartSieve)->getConf('config_dir', 'conf') . '/style.php';
 
 
 header('Content-type: text/css');
-if (SmartSieve::getConf('cache_css') !== false) {
-    $mtime = filemtime(SmartSieve::getConf('config_dir', 'conf') . '/style.php');
+if ((new SmartSieve)->getConf('cache_css') !== false) {
+    $mtime = filemtime((new SmartSieve)->getConf('config_dir', 'conf') . '/style.php');
     $last_mod = sprintf('%s GMT', gmdate('D, d M Y H:i:s', $mtime));
     header('Last-Modified: ' . $last_mod);
     header('Cache-Control: max-age=86400, public, must-revalidate');

include/common-head.inc

--- data/include/common-head.inc.orig   2007-09-07 18:31:07.000000000 +0200
+++ data/include/common-head.inc        2014-03-24 00:49:50.000000000 +0100
@@ -1,9 +1,9 @@
-<?php header('Content-type: text/html; charset=' . SmartSieve::getCharset());?>
+<?php header('Content-type: text/html; charset=' . (new SmartSieve)->getCharset());?>
 <HTML>
-<HEAD><TITLE><?php echo SmartSieve::getConf('page_title', 'SmartSieve'); ?></TITLE>
-<LINK HREF="<?php echo SmartSieve::setUrl('css.php'); ?>" REL="stylesheet" TYPE="text/css">
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=<?php echo SmartSieve::getCharset();?>">
-<?php if (!empty($jsfile)) include SmartSieve::getConf('include_dir', 'include') . '/' . $jsfile;?>
+<HEAD><TITLE><?php echo (new SmartSieve)->getConf('page_title', 'SmartSieve'); ?></TITLE>
+<LINK HREF="<?php echo (new SmartSieve)->setUrl('css.php'); ?>" REL="stylesheet" TYPE="text/css">
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=<?php echo (new SmartSieve)->getCharset();?>">
+<?php if (!empty($jsfile)) include (new SmartSieve)->getConf('include_dir', 'include') . '/' . $jsfile;?>
 
 </HEAD>

include/common_status.inc

--- data/include/common_status.inc.orig 2007-08-03 18:11:21.000000000 +0200
+++ data/include/common_status.inc      2014-03-24 00:49:50.000000000 +0100
@@ -3,18 +3,18 @@
 <?php if (!empty($_SESSION['errors']) || !empty($_SESSION['notices'])): ?>
 
 <TABLE WIDTH="100%" CELLPADDING="5" BORDER="0" CELLSPACING="0">
-<?php foreach (SmartSieve::setError() as $err): ?>
+<?php foreach ((new SmartSieve)->setError() as $err): ?>
   <TR CLASS="errors">
     <TD>
-      <IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/error.gif" BORDER="0">
+      <IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/error.gif" BORDER="0">
       <?php echo $err; ?> 
     </TD>
   </TR>
 <?php endforeach; ?>
-<?php foreach (SmartSieve::setNotice() as $notice): ?>
+<?php foreach ((new SmartSieve)->setNotice() as $notice): ?>
   <TR CLASS="messages">
     <TD>
-      <IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/tick.gif" BORDER="0">
+      <IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/tick.gif" BORDER="0">
       <?php echo $notice; ?> 
     </TD>
   </TR>

include/custom.inc

--- data/include/custom.inc.orig        2007-08-31 20:07:55.000000000 +0200
+++ data/include/custom.inc     2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,21 +7,21 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        &nbsp;<?php echo SmartSieve::text('Edit filter rule');?>
+        &nbsp;<?php echo (new SmartSieve)->text('Edit filter rule');?>
 <?php else: ?>
-        &nbsp;<?php echo SmartSieve::text('New filter rule');?>
+        &nbsp;<?php echo (new SmartSieve)->text('New filter rule');?>
 <?php endif;?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?>
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?>
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?>
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -40,13 +40,13 @@
     <TR CLASS="heading">
       <TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        <?php echo SmartSieve::text('Edit filter rule');?>
+        <?php echo (new SmartSieve)->text('Edit filter rule');?>
       </TD>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?>
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?>
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
 <?php else: ?>
-        <?php echo SmartSieve::text('New filter rule');?>
+        <?php echo (new SmartSieve)->text('New filter rule');?>
       </TD>
       <TD>
         &nbsp;
@@ -65,7 +65,7 @@
         <TD>
           <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text("Custom sieve rule");?></TH>
+              <TH><?php echo (new SmartSieve)->text("Custom sieve rule");?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -77,8 +77,8 @@
             <TR CLASS="active">
               <TD>
                 <select name="control">
-                  <option value="<?php echo CONTROL_IF;?>"<?php echo ($rule['control'] == CONTROL_IF) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('If');?></option>
-                  <option value="<?php echo CONTROL_ELSEIF;?>"<?php echo ($rule['control'] == CONTROL_ELSEIF) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('Else If');?></option>
+                  <option value="<?php echo CONTROL_IF;?>"<?php echo ($rule['control'] == CONTROL_IF) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('If');?></option>
+                  <option value="<?php echo CONTROL_ELSEIF;?>"<?php echo ($rule['control'] == CONTROL_ELSEIF) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('Else If');?></option>
                 </select>
               </TD>
             </TR>
@@ -90,7 +90,7 @@
 <?php if (!isset($ruleID) || $ruleID == 'new') :?>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Save at position');?>
+                <?php echo (new SmartSieve)->text('Save at position');?>
                 <select name="position">
 <?php for ($i=0; $i<count($script->rules); $i++):?>
                   <option value="<?php echo $i;?>"<?php echo ($ruleID === $i) ? ' selected="selected"' : '';?>><?php echo $i+1;?></option>
@@ -118,13 +118,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>
@@ -139,15 +139,15 @@
 <?php if ($condition['type'] == 'new'):?>
 <?php elseif ($condition['type'] == TEST_HEADER && $condition['header'] !== 'subject'):?>
 <INPUT TYPE="hidden" NAME="condition<?php echo $i;?>" VALUE="header">
-<INPUT TYPE="hidden" NAME="header<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['header']);?>">
-<INPUT TYPE="hidden" NAME="headerMatchStr<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['matchStr']);?>">
+<INPUT TYPE="hidden" NAME="header<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['header']);?>">
+<INPUT TYPE="hidden" NAME="headerMatchStr<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['matchStr']);?>">
 <?php elseif ($condition['type'] == TEST_SIZE):?>
 <INPUT TYPE="hidden" NAME="condition<?php echo $i;?>" VALUE="size">
 <INPUT TYPE="hidden" NAME="gthan<?php echo $i;?>" VALUE="<?php echo (!empty($condition['gthan'])) ? SIZE_BIT : 0;?>">
 <INPUT TYPE="hidden" NAME="size<?php echo $i;?>" VALUE="<?php echo $condition['kbytes'];?>">
 <?php else:?>
 <INPUT TYPE="hidden" NAME="condition<?php echo $i;?>" VALUE="<?php echo (is_array($condition['header'])) ? implode('', $condition['header']) : $condition['header'];?>">
-<INPUT TYPE="hidden" NAME="matchStr<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['matchStr']);?>">
+<INPUT TYPE="hidden" NAME="matchStr<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['matchStr']);?>">
 <?php endif;?>
 <?php if ($condition['type'] != TEST_SIZE && $condition['type'] != 'new'):?>
 <?php if ($condition['matchType'] == MATCH_IS):?>

include/forward.inc

--- data/include/forward.inc.orig       2007-08-30 16:52:48.000000000 +0200
+++ data/include/forward.inc    2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,21 +7,21 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        &nbsp;<?php echo SmartSieve::text('Edit mail forwarding');?>
+        &nbsp;<?php echo (new SmartSieve)->text('Edit mail forwarding');?>
 <?php else: ?>
-        &nbsp;<?php echo SmartSieve::text('Set mail forwarding');?>
+        &nbsp;<?php echo (new SmartSieve)->text('Set mail forwarding');?>
 <?php endif;?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?>
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?>
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?>
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -40,13 +40,13 @@
     <TR CLASS="heading">
       <TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        <?php echo SmartSieve::text('Edit mail forwarding');?> 
+        <?php echo (new SmartSieve)->text('Edit mail forwarding');?> 
       </TD>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?>
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?>
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
 <?php else: ?>
-        <?php echo SmartSieve::text('Set mail forwarding');?> 
+        <?php echo (new SmartSieve)->text('Set mail forwarding');?> 
       </TD>
       <TD>
         &nbsp;
@@ -65,7 +65,7 @@
         <TD>
           <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Mail forwarding');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Mail forwarding');?></TH>
             </TR>
           </TABLE>
         </TD>
@@ -75,7 +75,7 @@
           <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Forward to address');?>:
+                <?php echo (new SmartSieve)->text('Forward to address');?>:
               </TD>
               <TD>
                 <INPUT TYPE="text" NAME="<?php echo ACTION_REDIRECT;?>0" VALUE="<?php echo $rule['actions'][0]['address'];?>" SIZE="40">
@@ -83,7 +83,7 @@
             </TR>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Keep a copy in your Inbox');?>:
+                <?php echo (new SmartSieve)->text('Keep a copy in your Inbox');?>:
               </TD>
               <TD>
                 <INPUT TYPE="checkbox" NAME="action1" VALUE="<?php echo ACTION_KEEP;?>"<?php echo (!empty($rule['actions'][1]) && $rule['actions'][1]['type'] == ACTION_KEEP) ? ' CHECKED="checked"' : '';?>>
@@ -107,13 +107,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>

include/login.inc

--- data/include/login.inc.orig 2007-08-28 18:54:03.000000000 +0200
+++ data/include/login.inc      2014-03-24 00:49:50.000000000 +0100
@@ -1,26 +1,26 @@
 <CENTER>
 
-<FORM ACTION="<?php echo SmartSieve::setUrl('login.php'); ?>" METHOD="post" NAME="login">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('login.php'); ?>" METHOD="post" NAME="login">
 
 <TABLE WIDTH="300" CELLPADDING="5" BORDER="0" CELLSPACING="0">
   <TR>
     <TD CLASS="welcome" ALIGN="center" COLSPAN="2">
-      &nbsp;<?php echo SmartSieve::getConf('login_page_heading', SmartSieve::text('Welcome to SmartSieve'));?> 
+      &nbsp;<?php echo (new SmartSieve)->getConf('login_page_heading', (new SmartSieve)->text('Welcome to SmartSieve'));?> 
     </TD>
   </TR>
 
   <TR>
     <TD ALIGN="center" COLSPAN="2">&nbsp;
 <?php if ($reason == 'failure'): ?>
-      <?php echo SmartSieve::text("Login failed! Please try again");?>.
+      <?php echo (new SmartSieve)->text("Login failed! Please try again");?>.
 <?php elseif ($reason == 'logout'): ?>
-      <?php echo SmartSieve::text("You have been logged out");?>.
+      <?php echo (new SmartSieve)->text("You have been logged out");?>.
 <?php endif; ?>
     </TD>
   </TR>
 
   <TR CLASS="menu">
-    <TD ALIGN="right"> <?php echo SmartSieve::text("Sieve Username");?>:
+    <TD ALIGN="right"> <?php echo (new SmartSieve)->text("Sieve Username");?>:
     </TD>
     <TD ALIGN="left">
       <INPUT TYPE="text" TABINDEX="<?php echo $tabindex++;?>" NAME="auth"<?php if (!empty($proxyusers)) echo " onBlur='checkUser();'";?>>
@@ -28,7 +28,7 @@
   </TR>
 <?php if (!empty($proxyusers) || $proxyall): ?>
   <TR CLASS="menu" ID="authztr"<?php if (!$proxyall) echo ' STYLE="display: none;"';?>>
-    <TD ALIGN="right"> <?php echo SmartSieve::text("Proxy user");?>:
+    <TD ALIGN="right"> <?php echo (new SmartSieve)->text("Proxy user");?>:
     </TD>
     <TD ALIGN="left">
       <INPUT TYPE="text" TABINDEX="<?php echo $tabindex++;?>" NAME="authz">
@@ -38,32 +38,32 @@
     <INPUT TYPE="hidden" NAME="authz" VALUE="">
 <?php endif; ?>
   <TR CLASS="menu">
-    <TD ALIGN="right"> <?php echo SmartSieve::text("Password");?>:
+    <TD ALIGN="right"> <?php echo (new SmartSieve)->text("Password");?>:
     </TD>
     <TD ALIGN="left">
       <INPUT TYPE="password" TABINDEX="<?php echo $tabindex++;?>" NAME="passwd">
     </TD>
   </TR>
 
-<?php if (SmartSieve::getConf('user_select_lang') !== false):?>
+<?php if ((new SmartSieve)->getConf('user_select_lang') !== false):?>
   <TR CLASS="menu">
-    <TD ALIGN="right"> <?php echo SmartSieve::text("Language");?>:
+    <TD ALIGN="right"> <?php echo (new SmartSieve)->text("Language");?>:
     </TD>
     <TD ALIGN="left">
       <SELECT TABINDEX="<?php echo $tabindex++;?>" NAME="lang" onchange="changeLang();">
 <?php foreach ($locales as $value => $locale): ?>
-        <OPTION VALUE="<?php echo $value;?>"<?php echo ($value == SmartSieve::getLang()) ? ' SELECTED' : '';?>><?php echo $locale['display'];?></OPTION>
+        <OPTION VALUE="<?php echo $value;?>"<?php echo ($value == (new SmartSieve)->getLang()) ? ' SELECTED' : '';?>><?php echo $locale['display'];?></OPTION>
 <?php endforeach; ?>
       </SELECT>
     </TD>
   </TR>
 
 <?php else: ?>
-    <INPUT TYPE="hidden" NAME="lang" VALUE="<?php echo SmartSieve::getConf('language', 'en_GB');?>">
+    <INPUT TYPE="hidden" NAME="lang" VALUE="<?php echo (new SmartSieve)->getConf('language', 'en_GB');?>">
 <?php endif; ?>
-<?php if (SmartSieve::getConf('user_select_server') !== false):?>
+<?php if ((new SmartSieve)->getConf('user_select_server') !== false):?>
   <TR CLASS="menu">
-    <TD ALIGN="right"><?php echo SmartSieve::text("Server");?>:
+    <TD ALIGN="right"><?php echo (new SmartSieve)->text("Server");?>:
     </TD>
     <TD ALIGN="left">
       <SELECT NAME="server" TABINDEX="<?php echo $tabindex++;?>">
@@ -76,12 +76,12 @@
 <?php else: ?>
     <INPUT TYPE="hidden" NAME="server" VALUE="<?php echo $fsrv;?>">
 <?php endif; ?>
-<?php if (SmartSieve::getConf('user_supply_scriptfile') && SmartSieve::getConf('allow_multi_scripts') !== false):?>
+<?php if ((new SmartSieve)->getConf('user_supply_scriptfile') && (new SmartSieve)->getConf('allow_multi_scripts') !== false):?>
   <TR CLASS="menu">
-    <TD ALIGN="right"><?php echo SmartSieve::text("Script name");?>:
+    <TD ALIGN="right"><?php echo (new SmartSieve)->text("Script name");?>:
     </TD>
     <TD ALIGN="left">
-      <INPUT TYPE="text" TABINDEX="<?php echo $tabindex++;?>" NAME="scriptfile" VALUE="<?php echo SmartSieve::getConf('scriptfile', '');?>">
+      <INPUT TYPE="text" TABINDEX="<?php echo $tabindex++;?>" NAME="scriptfile" VALUE="<?php echo (new SmartSieve)->getConf('scriptfile', '');?>">
     </TD>
   </TR>
 <?php else: ?>
@@ -90,7 +90,7 @@
 
   <TR CLASS="menu">
     <TD ALIGN="center" COLSPAN="2">
-      <INPUT TYPE="submit" NAME="submit" TABINDEX="<?php echo $tabindex++;?>" VALUE="<?php echo SmartSieve::text("Log In");?>">
+      <INPUT TYPE="submit" NAME="submit" TABINDEX="<?php echo $tabindex++;?>" VALUE="<?php echo (new SmartSieve)->text("Log In");?>">
     </TD>
   <TR>
 </TABLE>
@@ -98,5 +98,5 @@
 
 </FORM>
 
-<?php if (is_readable(SmartSieve::getConf('config_dir', 'conf') . '/motd.php')) include SmartSieve::getConf('config_dir', 'conf') . '/motd.php';?>
+<?php if (is_readable((new SmartSieve)->getConf('config_dir', 'conf') . '/motd.php')) include (new SmartSieve)->getConf('config_dir', 'conf') . '/motd.php';?>

include/main.js

--- data/include/main.js.orig   2007-08-15 13:32:49.000000000 +0200
+++ data/include/main.js        2014-03-24 00:49:50.000000000 +0100
@@ -25,14 +25,14 @@
 {
     if (AnySelected()) {
        if (a == 'delete'){
-           if (!confirm("<?php echo SmartSieve::text('Are you sure you want to delete this rule?');?>")){
+           if (!confirm("<?php echo (new SmartSieve)->text('Are you sure you want to delete this rule?');?>")){
                return true;
            }
        }
        document.rules.action.value = a;
         document.rules.submit();
     } else {
-        window.alert('<?php echo SmartSieve::text('You must select at least one rule to do this.');?>');
+        window.alert('<?php echo (new SmartSieve)->text('You must select at least one rule to do this.');?>');
     }
 }
 
@@ -46,7 +46,7 @@
 
 function ChangeMode()
 {
-    if (!confirm("<?php echo SmartSieve::text('If you edit this script directly, any changes you make will be lost if you revert to GUI later.\nDo you still want to continue?');?>")) {
+    if (!confirm("<?php echo (new SmartSieve)->text('If you edit this script directly, any changes you make will be lost if you revert to GUI later.\nDo you still want to continue?');?>")) {
         return true;
     }
     document.rules.action.value = 'direct';
@@ -55,7 +55,7 @@
 
 function deleteRule(r)
 {
-    if (!confirm("<?php echo SmartSieve::text('Are you sure you want to delete this rule?');?>")){
+    if (!confirm("<?php echo (new SmartSieve)->text('Are you sure you want to delete this rule?');?>")){
         return true;
     }
     var ruleIDs = document.getElementsByName('ruleID[]');

include/menu.inc

--- data/include/menu.inc.orig  2007-08-28 17:51:04.000000000 +0200
+++ data/include/menu.inc       2014-03-24 00:49:50.000000000 +0100
@@ -1,5 +1,5 @@
 
-<FORM ACTION="<?php echo SmartSieve::setUrl('main.php');?>" METHOD="post" NAME="menu">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('main.php');?>" METHOD="post" NAME="menu">
 
 <TABLE WIDTH="100%" CELLPADDING="1" BORDER="0" CELLSPACING="0">
 <TR CLASS="menuouter">
@@ -10,46 +10,46 @@
           <TABLE CELLPADDING="2" BORDER="0" CELLSPACING="2">
             <tr>
               <td>
-                <a href="<?php echo SmartSieve::setUrl('main.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/filter.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Filter Rules');?></a>
+                <a href="<?php echo (new SmartSieve)->setUrl('main.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/filter.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Filter Rules');?></a>
               </td>
 <?php if ($_SESSION['scripts'][$_SESSION['smartsieve']['workingScript']]->mode != 'advanced'): ?>
-<?php if (SmartSieve::getConf('use_whitelist', true)):?>
+<?php if ((new SmartSieve)->getConf('use_whitelist', true)):?>
               <td>
-                <A HREF="<?php echo SmartSieve::setUrl('rule.php?mode=whitelist');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/whitelist.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Whitelist');?></A>
+                <A HREF="<?php echo (new SmartSieve)->setUrl('rule.php?mode=whitelist');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/whitelist.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Whitelist');?></A>
               </td>
 <?php endif;?>
-<?php if (SmartSieve::getConf('use_forward_mail_interface', true)):?>
+<?php if ((new SmartSieve)->getConf('use_forward_mail_interface', true)):?>
               <td>
-                <A HREF="<?php echo SmartSieve::setUrl('rule.php?mode=forward');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/forward.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Forward Mail');?></A>
+                <A HREF="<?php echo (new SmartSieve)->setUrl('rule.php?mode=forward');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/forward.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Forward Mail');?></A>
               </td>
 <?php endif;?>
-<?php if (SmartSieve::getConf('use_vacation_interface', true)):?>
+<?php if ((new SmartSieve)->getConf('use_vacation_interface', true)):?>
               <td>
-                <a href="<?php echo SmartSieve::setUrl('rule.php?mode=vacation');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/vacation.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Vacation Settings');?></a>
+                <a href="<?php echo (new SmartSieve)->setUrl('rule.php?mode=vacation');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/vacation.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Vacation Settings');?></a>
               </td>
 <?php endif;?>
               <td>
-                <a href="<?php echo SmartSieve::setUrl('rule.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/new.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('New Rule');?></a>
+                <a href="<?")){
+           if (!confirm("php echo (new SmartSieve)->setUrl('rule.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/new.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('New Rule');?></a>
               </td>
-<?php if (SmartSieve::getConf('spam_filter')):?>
+<?php if ((new SmartSieve)->getConf('spam_filter')):?>
               <td>
-                <a href="<?php echo SmartSieve::setUrl('rule.php?mode=spam');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/spam.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Filter Spam');?></a>
+                <a href="<?php echo (new SmartSieve)->setUrl('rule.php?mode=spam');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/spam.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Filter Spam');?></a>
               </td>
 <?php endif;?>
 <?php endif;?>
-<?php if (SmartSieve::getConf('allow_multi_scripts') !== false): ?>
+<?php if ((new SmartSieve)->getConf('allow_multi_scripts') !== false): ?>
               <td>
-                <A HREF="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/scripts.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Manage Scripts');?></A>
+                <A HREF="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/scripts.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Manage Scripts');?></A>
               </td>
 <?php endif; //$default->allow_multi_scripts ?>
-<?php foreach (SmartSieve::getConf('menu_items', array()) as $item):?>
+<?php foreach ((new SmartSieve)->getConf('menu_items', array()) as $item):?>
               <td>
-                <a href="<?php echo $item['uri'];?>"<?php echo (isset($item['target'])) ? sprintf(' target="%s"', $item['target']) : '';?>><img src="<?php echo (isset($item['img'])) ? $item['img'] : SmartSieve::getConf('image_dir', 'images').'/new.gif';?>" alt="" title="" border="0"><br><?php echo $item['label'];?></a>
+                <a href="<?php echo $item['uri'];?>"<?php echo (isset($item['target'])) ? sprintf(' target="%s"', $item['target']) : '';?>><img src="<?php echo (isset($item['img'])) ? $item['img'] : (new SmartSieve)->getConf('image_dir', 'images').'/new.gif';?>" alt="" title="" border="0"><br><?php echo $item['label'];?></a>
               </td>
 <?php endforeach;?>
 <?php if (!empty($help_url)): ?>
               <td>
-                <a href="<?php echo $help_url; ?>" target="_blank"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/help.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Help');?></a>
+                <a href="<?php echo $help_url; ?>" target="_blank"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/help.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Help');?></a>
               </td>
 <?php endif; //$help_url ?>
             </tr>
@@ -59,10 +59,10 @@
           <TABLE CELLPADDING="2" BORDER="0" CELLSPACING="2">
             <tr>
               <td>
-                <?php echo SmartSieve::text('Logged in as "%s"', array($_SESSION['smartsieve']['authz']));?>
+                <?php echo (new SmartSieve)->text('Logged in as "%s"', array($_SESSION['smartsieve']['authz']));?>
               </td>
               <td>
-                <a href="<?php echo SmartSieve::setUrl('login.php?reason=logout');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images');?>/logout.gif" alt="" title="" border="0"><br><?php echo SmartSieve::text('Logout');?></a>
+                <a href="<?php echo (new SmartSieve)->setUrl('login.php?reason=logout');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/logout.gif" alt="" title="" border="0"><br><?php echo (new SmartSieve)->text('Logout');?></a>
               </td>
             </tr>
           </table>

include/rule.inc

--- data/include/rule.inc.orig  2007-08-31 19:43:07.000000000 +0200
+++ data/include/rule.inc       2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,21 +7,21 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        &nbsp;<?php echo SmartSieve::text('Edit filter rule');?> 
+        &nbsp;<?php echo (new SmartSieve)->text('Edit filter rule');?> 
 <?php else: ?>
-        &nbsp;<?php echo SmartSieve::text('New filter rule');?> 
+        &nbsp;<?php echo (new SmartSieve)->text('New filter rule');?> 
 <?php endif;?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?> 
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?> 
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?> 
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?> 
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -40,13 +40,13 @@
     <TR CLASS="heading">
       <TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        <?php echo SmartSieve::text('Edit filter rule');?> 
+        <?php echo (new SmartSieve)->text('Edit filter rule');?> 
       </TD>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?> 
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?> 
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
 <?php else: ?>
-        <?php echo SmartSieve::text('New filter rule');?> 
+        <?php echo (new SmartSieve)->text('New filter rule');?> 
       </TD>
       <TD>
         &nbsp;
@@ -65,7 +65,7 @@
         <TD>
           <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Conditions');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Conditions');?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -77,15 +77,15 @@
             <TR CLASS="active">
               <TD>
                 <select name="control">
-                  <option value="<?php echo CONTROL_IF;?>"<?php echo ($rule['control'] == CONTROL_IF) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('If');?></option>
-                  <option value="<?php echo CONTROL_ELSEIF;?>"<?php echo ($rule['control'] == CONTROL_ELSEIF) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('Else If');?></option>
+                  <option value="<?php echo CONTROL_IF;?>"<?php echo ($rule['control'] == CONTROL_IF) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('If');?></option>
+                  <option value="<?php echo CONTROL_ELSEIF;?>"<?php echo ($rule['control'] == CONTROL_ELSEIF) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('Else If');?></option>
                 </select>
                 &nbsp;
                 <SELECT NAME="anyof">
-                  <OPTION VALUE="0"<?php echo (empty($rule['matchAny'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('all of');?></OPTION>
-                  <OPTION VALUE="<?php echo ANYOF_BIT;?>"<?php echo (!empty($rule['matchAny'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('any of');?></OPTION>
+                  <OPTION VALUE="0"<?php echo (empty($rule['matchAny'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('all of');?></OPTION>
+                  <OPTION VALUE="<?php echo ANYOF_BIT;?>"<?php echo (!empty($rule['matchAny'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('any of');?></OPTION>
                 </SELECT>
-                &nbsp;<?php echo SmartSieve::text('the following matches');?> 
+                &nbsp;<?php echo (new SmartSieve)->text('the following matches');?> 
               </TD>
               <TD>
                 &nbsp;
@@ -97,16 +97,16 @@
                 &nbsp;
                 <SELECT NAME="condition<?php echo $i;?>" onchange="document.thisRule.submit();return true;">
 <?php if ($condition['type'] == 'new'):?>
-                  <OPTION VALUE="new" SELECTED="selected"><?php echo SmartSieve::text('Add condition');?></OPTION>
+                  <OPTION VALUE="new" SELECTED="selected"><?php echo (new SmartSieve)->text('Add condition');?></OPTION>
 <?php endif;?>
-                  <OPTION VALUE="from"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == 'from') ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message 'From:'");?></OPTION>
-                  <OPTION VALUE="to"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == 'to') ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message 'To:'");?></OPTION>
-                  <OPTION VALUE="tocc"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == array('to', 'cc')) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message 'To:' or 'Cc:'");?></OPTION>
-                  <OPTION VALUE="subject"<?php echo ($condition['type'] == TEST_HEADER && $condition['header'] == 'subject') ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message 'Subject:'");?></OPTION>
-                  <OPTION VALUE="size"<?php echo ($condition['type'] == TEST_SIZE) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message size is");?></OPTION>
-                  <OPTION VALUE="header"<?php echo ($condition['type'] == TEST_HEADER && $condition['header'] !== 'subject') ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message header");?></OPTION>
+                  <OPTION VALUE="from"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == 'from') ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message 'From:'");?></OPTION>
+                  <OPTION VALUE="to"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == 'to') ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message 'To:'");?></OPTION>
+                  <OPTION VALUE="tocc"<?php echo ($condition['type'] == TEST_ADDRESS && $condition['header'] == array('to', 'cc')) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message 'To:' or 'Cc:'");?></OPTION>
+                  <OPTION VALUE="subject"<?php echo ($condition['type'] == TEST_HEADER && $condition['header'] == 'subject') ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message 'Subject:'");?></OPTION>
+                  <OPTION VALUE="size"<?php echo ($condition['type'] == TEST_SIZE) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message size is");?></OPTION>
+                  <OPTION VALUE="header"<?php echo ($condition['type'] == TEST_HEADER && $condition['header'] !== 'subject') ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message header");?></OPTION>
 <?php if ($managesieve->hasExtension('body')):?>
-                  <OPTION VALUE="body"<?php echo ($condition['type'] == TEST_BODY) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("If message body");?></OPTION>
+                  <OPTION VALUE="body"<?php echo ($condition['type'] == TEST_BODY) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("If message body");?></OPTION>
 <?php endif;?>
                 </SELECT>
               </TD>
@@ -114,56 +114,56 @@
 <?php if ($condition['type'] == 'new'):?>
                 &nbsp;
 <?php elseif ($condition['type'] == TEST_HEADER && $condition['header'] !== 'subject'):?>
-                <INPUT TYPE="text" NAME="header<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['header']);?>" SIZE="20">
+                <INPUT TYPE="text" NAME="header<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['header']);?>" SIZE="20">
                 <select name="matchType<?php echo $i;?>">
-                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is');?></option>
-                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is not');?></option>
-                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('contains');?></option>
-                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not contain');?></option>
-                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches');?></option>
-                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match');?></option>
-                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches regular expression');?></option>
-                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match regular expression');?></option>
+                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is');?></option>
+                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is not');?></option>
+                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('contains');?></option>
+                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not contain');?></option>
+                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches');?></option>
+                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match');?></option>
+                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches regular expression');?></option>
+                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match regular expression');?></option>
                 </select>
-                <INPUT TYPE="text" NAME="headerMatchStr<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['matchStr']);?>" SIZE="30">
+                <INPUT TYPE="text" NAME="headerMatchStr<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['matchStr']);?>" SIZE="30">
                 <INPUT TYPE="hidden" NAME="delete<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete condition');?>" TITLE="<?php echo SmartSieve::text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete condition');?>" TITLE="<?php echo (new SmartSieve)->text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
 <?php elseif ($condition['type'] == TEST_SIZE):?>
                 <SELECT NAME="gthan<?php echo $i;?>">
-                  <OPTION VALUE="0"<?php echo (empty($condition['gthan'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("less than");?></OPTION>
-                  <OPTION VALUE="<?php echo SIZE_BIT;?>"<?php echo (!empty($condition['gthan'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("greater than");?></OPTION>
+                  <OPTION VALUE="0"<?php echo (empty($condition['gthan'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("less than");?></OPTION>
+                  <OPTION VALUE="<?php echo SIZE_BIT;?>"<?php echo (!empty($condition['gthan'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("greater than");?></OPTION>
                 </SELECT>
-                <INPUT TYPE="text" NAME="size<?php echo $i;?>" VALUE="<?php echo $condition['kbytes'];?>" SIZE="5"> <?php echo SmartSieve::text("KiloBytes");?> 
+                <INPUT TYPE="text" NAME="size<?php echo $i;?>" VALUE="<?php echo $condition['kbytes'];?>" SIZE="5"> <?php echo (new SmartSieve)->text("KiloBytes");?> 
                 <INPUT TYPE="hidden" NAME="delete<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete condition');?>" TITLE="<?php echo SmartSieve::text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete condition');?>" TITLE="<?php echo (new SmartSieve)->text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
 <?php elseif ($condition['type'] == TEST_BODY):?>
                 <select name="matchType<?php echo $i;?>">
-                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is');?></option>
-                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is not');?></option>
-                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('contains');?></option>
-                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not contain');?></option>
-                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches');?></option>
-                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match');?></option>
-                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches regular expression');?></option>
-                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match regular expression');?></option>
+                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is');?></option>
+                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is not');?></option>
+                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('contains');?></option>
+                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not contain');?></option>
+                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches');?></option>
+                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match');?></option>
+                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches regular expression');?></option>
+                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match regular expression');?></option>
                 </select>
-                <INPUT TYPE="text" NAME="bodyMatchStr<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['matchStr']);?>" SIZE="50">
+                <INPUT TYPE="text" NAME="bodyMatchStr<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['matchStr']);?>" SIZE="50">
                 <INPUT TYPE="hidden" NAME="delete<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete condition');?>" TITLE="<?php echo SmartSieve::text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete condition');?>" TITLE="<?php echo (new SmartSieve)->text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
 <?php else:?>
                 <select name="matchType<?php echo $i;?>">
-                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is');?></option>
-                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('is not');?></option>
-                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('contains');?></option>
-                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not contain');?></option>
-                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches');?></option>
-                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match');?></option>
-                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('matches regular expression');?></option>
-                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo SmartSieve::text('does not match regular expression');?></option>
+                  <option value="is"<?php echo ($condition['matchType'] == MATCH_IS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is');?></option>
+                  <option value="notis"<?php echo ($condition['matchType'] == MATCH_IS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('is not');?></option>
+                  <option value="contains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('contains');?></option>
+                  <option value="notcontains"<?php echo ($condition['matchType'] == MATCH_CONTAINS && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not contain');?></option>
+                  <option value="matches"<?php echo ($condition['matchType'] == MATCH_MATCHES && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches');?></option>
+                  <option value="notmatches"<?php echo ($condition['matchType'] == MATCH_MATCHES && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match');?></option>
+                  <option value="regex"<?php echo ($condition['matchType'] == MATCH_REGEX && empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('matches regular expression');?></option>
+                  <option value="notregex"<?php echo ($condition['matchType'] == MATCH_REGEX && !empty($condition['not'])) ? ' selected="selected"' : '';?>><?php echo (new SmartSieve)->text('does not match regular expression');?></option>
                 </select>
-                <INPUT TYPE="text" NAME="matchStr<?php echo $i;?>" VALUE="<?php echo SmartSieve::utf8Decode($condition['matchStr']);?>" SIZE="50">
+                <INPUT TYPE="text" NAME="matchStr<?php echo $i;?>" VALUE="<?php echo (new SmartSieve)->utf8Decode($condition['matchStr']);?>" SIZE="50">
                 <INPUT TYPE="hidden" NAME="delete<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete condition');?>" TITLE="<?php echo SmartSieve::text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete condition');?>" TITLE="<?php echo (new SmartSieve)->text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
 <?php endif;?>
               </TD>
             </TR>
@@ -188,7 +188,7 @@
         <TD>
           <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Actions');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Actions');?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -202,21 +202,21 @@
               <TD>
                 <SELECT NAME="action<?php echo $i;?>" onchange="document.thisRule.submit(); return true;">
 <?php if ($action['type'] == 'new'):?>
-                  <OPTION VALUE="new" SELECTED="selected"><?php echo SmartSieve::text('Add action');?></OPTION>
+                  <OPTION VALUE="new" SELECTED="selected"><?php echo (new SmartSieve)->text('Add action');?></OPTION>
 <?php endif;?>
-                  <OPTION VALUE="<?php echo ACTION_FILEINTO;?>"<?php echo ($action['type'] == ACTION_FILEINTO) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("File Into");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_REDIRECT;?>"<?php echo ($action['type'] == ACTION_REDIRECT) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Forward to address");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_REJECT;?>"<?php echo ($action['type'] == ACTION_REJECT) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Send a reject message");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_DISCARD;?>"<?php echo ($action['type'] == ACTION_DISCARD) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Discard the message");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_VACATION;?>"<?php echo ($action['type'] == ACTION_VACATION) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Send vacation message');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_FILEINTO;?>"<?php echo ($action['type'] == ACTION_FILEINTO) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("File Into");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_REDIRECT;?>"<?php echo ($action['type'] == ACTION_REDIRECT) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Forward to address");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_REJECT;?>"<?php echo ($action['type'] == ACTION_REJECT) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Send a reject message");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_DISCARD;?>"<?php echo ($action['type'] == ACTION_DISCARD) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Discard the message");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_VACATION;?>"<?php echo ($action['type'] == ACTION_VACATION) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Send vacation message');?></OPTION>
 <?php if ($GLOBALS['managesieve']->hasExtension('imapflags') && !empty($imapFlags)):?>
-                  <OPTION VALUE="<?php echo ACTION_ADDFLAG;?>"<?php echo ($action['type'] == ACTION_ADDFLAG) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Set message flag');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_ADDFLAG;?>"<?php echo ($action['type'] == ACTION_ADDFLAG) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Set message flag');?></OPTION>
 <?php endif;?>
 <?php if ($GLOBALS['managesieve']->hasExtension('notify') && !empty($notifyMethods)):?>
-                  <OPTION VALUE="<?php echo ACTION_NOTIFY;?>"<?php echo ($action['type'] == ACTION_NOTIFY) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Send notification message');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_NOTIFY;?>"<?php echo ($action['type'] == ACTION_NOTIFY) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Send notification message');?></OPTION>
 <?php endif;?>
-                  <OPTION VALUE="<?php echo ACTION_KEEP;?>"<?php echo ($action['type'] == ACTION_KEEP) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Keep a copy in your Inbox');?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_STOP;?>"<?php echo ($action['type'] == ACTION_STOP) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Stop processing filter rules');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_KEEP;?>"<?php echo ($action['type'] == ACTION_KEEP) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Keep a copy in your Inbox');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_STOP;?>"<?php echo ($action['type'] == ACTION_STOP) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Stop processing filter rules');?></OPTION>
                 </SELECT>
               </TD>
               <TD>
@@ -224,19 +224,19 @@
 <?php if ($_SESSION['smartsieve']['auth'] == $_SESSION['smartsieve']['authz']):?>
                 <SELECT NAME="<?php echo ACTION_FILEINTO . $i;?>">
 <?php foreach ($mailboxes as $mbox): ?>
-                  <OPTION VALUE="<?php echo $mbox;?>"<?php echo ($action['folder'] == $mbox) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::mutf7Decode($mbox);?></OPTION>
+                  <OPTION VALUE="<?php echo $mbox;?>"<?php echo ($action['folder'] == $mbox) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->mutf7Decode($mbox);?></OPTION>
 <?php endforeach; ?>
 <?php if (!empty($action['folder']) && !in_array($action['folder'], $mailboxes)):?>
-                  <OPTION VALUE="<?php echo $action['folder'];?>" SELECTED="selected"><?php echo SmartSieve::mutf7Decode($action['folder']);?></OPTION>
+                  <OPTION VALUE="<?php echo $action['folder'];?>" SELECTED="selected"><?php echo (new SmartSieve)->mutf7Decode($action['folder']);?></OPTION>
 <?php endif;?>
                 </SELECT>
 <?php else:?>
                 <INPUT TYPE="text" NAME="<?php echo ACTION_FILEINTO . $i;?>" VALUE="<?php echo $action['folder'];?>">
 <?php endif;?>
 <?php elseif ($action['type'] == ACTION_REDIRECT):?>
-                <INPUT TYPE="text" NAME="<?php echo ACTION_REDIRECT . $i;?>" VALUE="<?php echo (!empty($action['address'])) ? SmartSieve::utf8Decode($action['address']) : '';?>" SIZE="40">
+                <INPUT TYPE="text" NAME="<?php echo ACTION_REDIRECT . $i;?>" VALUE="<?php echo (!empty($action['address'])) ? (new SmartSieve)->utf8Decode($action['address']) : '';?>" SIZE="40">
 <?php elseif ($action['type'] == ACTION_REJECT):?>
-                <TEXTAREA NAME="<?php echo ACTION_REJECT . $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo SmartSieve::utf8Decode($action['message']);?></TEXTAREA>
+                <TEXTAREA NAME="<?php echo ACTION_REJECT . $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (new SmartSieve)->utf8Decode($action['message']);?></TEXTAREA>
 <?php elseif ($action['type'] == ACTION_VACATION):?>
                 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
                   <TR>
@@ -244,24 +244,24 @@
                       &nbsp;
                     </TD>
                     <TD>
-                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? SmartSieve::utf8Decode($action['message']) : '';?></TEXTAREA>
+                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? (new SmartSieve)->utf8Decode($action['message']) : '';?></TEXTAREA>
                     </TD>
                   </TR>
                     <TR>
                     <TD>
-                      <?php echo SmartSieve::text('Days between responses');?> 
+                      <?php echo (new SmartSieve)->text('Days between responses');?> 
                     </TD>
                     <TD>
                       <SELECT NAME="days<?php echo $i;?>">
-<?php for ($j=1; $j <= SmartSieve::getConf('max_vacation_days', 30); $j++):?>
-                        <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($action['days']) && SmartSieve::getConf('vacation_days', 7) == $j) || $action['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
+<?php for ($j=1; $j <= (new SmartSieve)->getConf('max_vacation_days', 30); $j++):?>
+                        <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($action['days']) && (new SmartSieve)->getConf('vacation_days', 7) == $j) || $action['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
 <?php endfor;?>
                       </SELECT>
                     </TD>
                   </TR>
                   <TR>
                     <TD>
-                      <?php echo SmartSieve::text('Your e-mail addresses');?> 
+                      <?php echo (new SmartSieve)->text('Your e-mail addresses');?> 
                     </TD>
                     <TD>
                       <TABLE WIDTH="100%" CELLPADDING="5" BORDER="0" CELLSPACING="0">
@@ -284,7 +284,7 @@
 <?php elseif ($action['type'] == ACTION_ADDFLAG):?>
                 <SELECT NAME="<?php echo ACTION_ADDFLAG . $i;?>">
 <?php foreach ($imapFlags as $flag): ?>
-                  <OPTION VALUE="<?php echo $flag;?>"<?php echo ($action['flag'] == $flag) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::utf8Decode($flag);?></OPTION>
+                  <OPTION VALUE="<?php echo $flag;?>"<?php echo ($action['flag'] == $flag) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->utf8Decode($flag);?></OPTION>
 <?php endforeach; ?>
                 </SELECT>
 <?php elseif ($action['type'] == ACTION_NOTIFY):?>
@@ -293,18 +293,18 @@
                     <TD>
                       <SELECT NAME="notify_method<?php echo $i;?>" onchange="document.thisRule.submit(); return true;">
 <?php if (in_array('mailto', $notifyMethods)):?>
-                        <OPTION VALUE="<?php echo 'mailto';?>"<?php echo ($action['method'] == 'mailto' || empty($action['method'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('by email');?></OPTION>
+                        <OPTION VALUE="<?php echo 'mailto';?>"<?php echo ($action['method'] == 'mailto' || empty($action['method'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('by email');?></OPTION>
 <?php endif;?>
 <?php if (in_array('sms', $notifyMethods)):?>
-                        <OPTION VALUE="<?php echo 'sms';?>"<?php echo ($action['method'] == 'sms') ? ' SELECTED' : '';?>><?php echo SmartSieve::text('by SMS');?></OPTION>
+                        <OPTION VALUE="<?php echo 'sms';?>"<?php echo ($action['method'] == 'sms') ? ' SELECTED' : '';?>><?php echo (new SmartSieve)->text('by SMS');?></OPTION>
 <?php endif;?>
                       </SELECT>
 <?php if ($action['method'] == 'mailto' || empty($action['method'])):?>
-                      &nbsp;<?php echo SmartSieve::text('to email address');?> 
-                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo SmartSieve::utf8Decode($action['options']);?>" size="50">
+                      &nbsp;<?php echo (new SmartSieve)->text('to email address');?> 
+                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo (new SmartSieve)->utf8Decode($action['options']);?>" size="50">
 <?php elseif ($action['method'] == 'sms'):?>
-                      &nbsp;<?php echo SmartSieve::text('to number');?> 
-                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo SmartSieve::utf8Decode($action['options']);?>" size="50">
+                      &nbsp;<?php echo (new SmartSieve)->text('to number');?> 
+                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo (new SmartSieve)->utf8Decode($action['options']);?>" size="50">
 <?php else:?>
                       &nbsp;
 <?php endif;?>
@@ -312,7 +312,7 @@
                   </TR>
                   <TR>
                     <TD>
-                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? SmartSieve::utf8Decode($action['message']) : '';?></TEXTAREA>
+                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? (new SmartSieve)->utf8Decode($action['message']) : '';?></TEXTAREA>
                     </TD>
                   </TR>
                 </TABLE>
@@ -321,7 +321,7 @@
 <?php endif;?>
 <?php if ($action['type'] != 'new'):?>
                 <INPUT TYPE="hidden" NAME="deleteAction<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.deleteAction<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete action');?>" TITLE="<?php echo SmartSieve::text('Delete action');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete action');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.deleteAction<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete action');?>" TITLE="<?php echo (new SmartSieve)->text('Delete action');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete action');?>'; return true;" onmouseout="window.status='';"></a>
 <?php endif;?>
               </TD>
             </TR>
@@ -329,7 +329,7 @@
 <?php if (!isset($ruleID) || $ruleID == 'new') :?>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Save at position');?> 
+                <?php echo (new SmartSieve)->text('Save at position');?> 
                 <select name="position">
 <?php for ($i=0; $i<count($script->rules); $i++):?>
                   <option value="<?php echo $i;?>"<?php echo ($ruleID === $i) ? ' selected="selected"' : '';?>><?php echo $i+1;?></option>
@@ -360,13 +360,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>

include/rule.js

--- data/include/rule.js.orig   2007-08-20 17:24:45.000000000 +0200
+++ data/include/rule.js        2014-03-24 00:49:50.000000000 +0100
@@ -12,7 +12,7 @@
 
 function Delete()
 {
-    if (!confirm("<?php echo SmartSieve::text('Are you sure you want to delete this rule?');?>")){
+    if (!confirm("<?php echo (new SmartSieve)->text('Are you sure you want to delete this rule?');?>")){
         return true;
     }
     document.thisRule.thisAction.value = '<?php echo FORM_ACTION_DELETE;?>';

include/script-direct.inc

--- data/include/script-direct.inc.orig 2007-08-29 19:37:51.000000000 +0200
+++ data/include/script-direct.inc      2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('main.php');?>" METHOD="post" NAME="rules">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('main.php');?>" METHOD="post" NAME="rules">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,16 +7,16 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?>
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?>
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?>
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -33,7 +33,7 @@
 
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR class="heading">
-      <TD><?php echo SmartSieve::text('Filter Rules');?></TD>
+      <TD><?php echo (new SmartSieve)->text('Filter Rules');?></TD>
     </TR>
     </TABLE>
 
@@ -52,11 +52,11 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.rules.action.value='<?php echo FORM_ACTION_SAVE;?>'; document.rules.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.rules.action.value='<?php echo FORM_ACTION_SAVE;?>'; document.rules.submit(); return false;">
         </TD>
-<?php if (SmartSieve::getConf('allow_change_mode')): ?>
+<?php if ((new SmartSieve)->getConf('allow_change_mode')): ?>
         <TD ALIGN="right" CLASS="options">
-          <input type="button" name="changeMode" value="<?php echo SmartSieve::text('GUI mode');?>" onClick="ChangeMode(); return false;">
+          <input type="button" name="changeMode" value="<?php echo (new SmartSieve)->text('GUI mode');?>" onClick="ChangeMode(); return false;">
         </TD>
 <?php endif; ?>
       </TR>

include/script-direct.js

--- data/include/script-direct.js.orig  2007-02-22 16:36:55.000000000 +0100
+++ data/include/script-direct.js       2014-03-24 00:49:50.000000000 +0100
@@ -18,7 +18,7 @@
 
 function ChangeMode()
 {
-    if (!confirm("<?php echo SmartSieve::text('If you switch to GUI mode you will lose any changes you have made in direct edit mode.\nAre you sure you want to continue?');?>")) {
+    if (!confirm("<?php echo (new SmartSieve)->text('If you switch to GUI mode you will lose any changes you have made in direct edit mode.\nAre you sure you want to continue?');?>")) {
         return true;
     }
     document.rules.action.value = 'gui';

include/script-gui.inc

--- data/include/script-gui.inc.orig    2007-09-07 18:31:07.000000000 +0200
+++ data/include/script-gui.inc 2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('main.php');?>" METHOD="post" NAME="rules">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('main.php');?>" METHOD="post" NAME="rules">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,16 +7,16 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?> 
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?> 
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?> 
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?> 
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?> 
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?> 
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -33,7 +33,7 @@
 
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR class="heading">
-      <TD><?php echo SmartSieve::text('Filter Rules');?></TD>
+      <TD><?php echo (new SmartSieve)->text('Filter Rules');?></TD>
     </TR>
     </TABLE>
 
@@ -47,9 +47,9 @@
       <TR>
         <TH WIDTH="3%">&nbsp;</TH>
         <TH WIDTH="3%">&nbsp;</TH>
-        <TH WIDTH="5%"><?php echo SmartSieve::text('Status');?></TH>
-        <TH WIDTH="82%"><?php echo SmartSieve::text('Rule');?></TH>
-        <TH WIDTH="7%"><?php echo SmartSieve::text('Order');?></TH>
+        <TH WIDTH="5%"><?php echo (new SmartSieve)->text('Status');?></TH>
+        <TH WIDTH="82%"><?php echo (new SmartSieve)->text('Rule');?></TH>
+        <TH WIDTH="7%"><?php echo (new SmartSieve)->text('Order');?></TH>
       </TR>
 <?php foreach ($rows as $tr):?>
     <TR CLASS="<?php echo $tr['class'];?>" onmouseover="this.className='<?php echo $tr['class'];?>-mover';" onmouseout="this.className='<?php echo $tr['class'];?>';">
@@ -61,21 +61,21 @@
       </TD>
       <TD>
         <A HREF="" onclick="var ruleIDs=document.getElementsByName('ruleID[]'); ruleIDs[<?php echo $tr['id'];?>].checked=true; document.rules.action.value='<?php echo $tr['statusChangeAction'];?>'; document.rules.submit(); return false;"><IMG SRC="<?php echo $tr['statusImage'];?>" ALT="<?php echo $tr['statusChangeText'];?>" TITLE="<?php echo $tr['statusChangeText'];?>" BORDER="0"></a>
-        <A HREF="" onclick="deleteRule(<?php echo $tr['id'];?>); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete');?>" TITLE="<?php echo SmartSieve::text('Delete this rule');?>" BORDER="0"></a>
+        <A HREF="" onclick="deleteRule(<?php echo $tr['id'];?>); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete');?>" TITLE="<?php echo (new SmartSieve)->text('Delete this rule');?>" BORDER="0"></a>
       </TD>
       <TD>
         <A CLASS="summary" HREF="<?php echo $tr['link'];?>" TITLE="<?php echo $tr['tooltip'];?>" onmouseover="window.status='<?php echo $tr['tooltip'];?>'; return true;" onmouseout="window.status='';"><?php if (isset($tr['img'])):?><img src="<?php echo $tr['img'];?>" alt="" title="<?php echo $tr['tooltip'];?>" border="0">&nbsp;<?php endif;?><?php echo $tr['summary'];?></A>
       </TD>
       <TD NOWRAP="nowrap">
-        <A HREF="" onclick="ChangeOrder(<?php echo $tr['id'];?>, <?php echo $tr['id'];?>); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/up.gif" ALT="Move rule up" TITLE="<?php echo SmartSieve::text('Move rule up');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Move rule up');?>'; return true;" onmouseout="window.status='';"></A>
-        <A HREF="" onclick="ChangeOrder(<?php echo $tr['id'];?>, <?php echo $tr['id']+2;?>); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/down.gif" ALT="Move rule down" TITLE="<?php echo SmartSieve::text('Move rule down');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Move rule down');?>'; return true;" onmouseout="window.status='';"></A>
-        <?php echo SmartSieve::text('To');?>:<INPUT TYPE="text" NAME="toPosition<?php echo $tr['id'];?>" VALUE="" SIZE="2" CLASS="position" TITLE="<?php echo SmartSieve::text('Move rule position');?>" onChange="ChangeOrder(<?php echo $tr['id'];?>, document.forms.rules.toPosition<?php echo $tr['id'];?>.value); return false;">
+        <A HREF="" onclick="ChangeOrder(<?php echo $tr['id'];?>, <?php echo $tr['id'];?>); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/up.gif" ALT="Move rule up" TITLE="<?php echo (new SmartSieve)->text('Move rule up');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Move rule up');?>'; return true;" onmouseout="window.status='';"></A>
+        <A HREF="" onclick="ChangeOrder(<?php echo $tr['id'];?>, <?php echo $tr['id']+2;?>); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/down.gif" ALT="Move rule down" TITLE="<?php echo (new SmartSieve)->text('Move rule down');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Move rule down');?>'; return true;" onmouseout="window.status='';"></A>
+        <?php echo (new SmartSieve)->text('To');?>:<INPUT TYPE="text" NAME="toPosition<?php echo $tr['id'];?>" VALUE="" SIZE="2" CLASS="position" TITLE="<?php echo (new SmartSieve)->text('Move rule position');?>" onChange="ChangeOrder(<?php echo $tr['id'];?>, document.forms.rules.toPosition<?php echo $tr['id'];?>.value); return false;">
       </TD>
     </TR>
 <?php endforeach;?>
 <?php else:?>
     <TR CLASS="active">
-      <TD COLSPAN="4">[<?php echo SmartSieve::text('No rules found');?>]</TD>
+      <TD COLSPAN="4">[<?php echo (new SmartSieve)->text('No rules found');?>]</TD>
     </TR>
 <?php endif;?>
     </TABLE>
@@ -93,22 +93,22 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="Submit('enable'); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="Submit('disable'); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Submit('delete'); return false;">
-          <input type="button" name="new" value="<?php echo SmartSieve::text('New Rule');?>" onClick="window.location='<?php echo SmartSieve::setUrl('rule.php');?>';">
-<?php if (SmartSieve::getConf('allow_custom', true) !== false):?>
-          <input type="button" name="custom" value="<?php echo SmartSieve::text('Custom Rule');?>" onClick="window.location='<?php echo SmartSieve::setUrl('rule.php?mode=custom');?>';">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="Submit('enable'); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="Submit('disable'); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Submit('delete'); return false;">
+          <input type="button" name="new" value="<?php echo (new SmartSieve)->text('New Rule');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('rule.php');?>';">
+<?php if ((new SmartSieve)->getConf('allow_custom', true) !== false):?>
+          <input type="button" name="custom" value="<?php echo (new SmartSieve)->text('Custom Rule');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('rule.php?mode=custom');?>';">
 <?php endif;?>
         </TD>
-<?php if (SmartSieve::getConf('allow_change_mode')): ?>
+<?php if ((new SmartSieve)->getConf('allow_change_mode')): ?>
         <TD ALIGN="right" CLASS="options">
-          <input type="button" name="changeMode" value="<?php echo SmartSieve::text('Direct edit mode');?>" onClick="ChangeMode(); return false;">
+          <input type="button" name="changeMode" value="<?php echo (new SmartSieve)->text('Direct edit mode');?>" onClick="ChangeMode(); return false;">
         </TD>
 <?php endif; ?>
-<?php if (SmartSieve::getConf('allow_view_source', true) !== false): ?>
+<?php if ((new SmartSieve)->getConf('allow_view_source', true) !== false): ?>
         <TD ALIGN="right" CLASS="options">
-          <input type="button" name="viewSource" value="<?php echo SmartSieve::text('View Source');?>" onClick="window.open('<?php echo SmartSieve::setUrl('main.php?action=viewSource');?>','','menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes'); return false;">
+          <input type="button" name="viewSource" value="<?php echo (new SmartSieve)->text('View Source');?>" onClick="window.open('<?php echo (new SmartSieve)->setUrl('main.php?action=viewSource');?>','','menubar=yes,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes'); return false;">
         </TD>
 <?php endif; ?>
       </TR>

include/scripts.inc

--- data/include/scripts.inc.orig       2007-08-22 15:49:24.000000000 +0200
+++ data/include/scripts.inc    2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('scripts.php');?>" METHOD="post" NAME="slist">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('scripts.php');?>" METHOD="post" NAME="slist">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,7 +7,7 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;
+        &nbsp;<?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;
       </TD>
     </TR>
     <TR CLASS="heading">
@@ -24,7 +24,7 @@
 
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
-      <TD CLASS="heading"><?php echo SmgetName()));?artSieve::text('Sieve Scripts');?></TD>
+      <TD CLASS="heading"><?php echo (new SmartSieve)->text('Sieve Scripts');?></TD>
     </TR>
     </TABLE>
 
@@ -37,9 +37,9 @@
 <?php if (!empty($slist)):?>
       <TR>
         <TH WIDTH="10%">&nbsp;</TH>
-        <TH WIDTH="70%"><?php echo SmartSieve::text("Script");?></TH>
-        <TH WIDTH="10%"><?php echo SmartSieve::text("Status");?></TH>
-        <TH WIDTH="10%"><?php echo SmartSieve::text("Size");?></TH>
+        <TH WIDTH="70%"><?php echo (new SmartSieve)->text("Script");?></TH>
+        <TH WIDTH="10%"><?php echo (new SmartSieve)->text("Status");?></TH>
+        <TH WIDTH="10%"><?php echo (new SmartSieve)->text("Size");?></TH>
       </TR>
 <?php foreach ($slist as $s => $active): ?>
     <TR CLASS="<?php echo ($active===true) ? 'active' : 'inactive';?>" onmouseover="this.className='<?php echo ($active===true) ? 'active' : 'inactive';?>-mover';" onmouseout="this.className='<?php echo ($active===true) ? 'active' : 'inactive';?>';">
@@ -47,20 +47,20 @@
         <INPUT TYPE="checkbox" NAME="scriptID[]" VALUE="<?php echo $i++;?>">
       </TD>
       <TD>
-        <A CLASS="summary" HREF="" TITLE="<?php echo SmartSieve::text('Edit this script');?>" onclick="edit('<?php echo $s;?>'); return false;" onmouseover="window.status='<?php echo SmartSieve::text('Edit this script');?>'; return true;" onmouseout="window.status='';"><?php echo $s;?></A>
+        <A CLASS="summary" HREF="" TITLE="<?php echo (new SmartSieve)->text('Edit this script');?>" onclick="edit('<?php echo $s;?>'); return false;" onmouseover="window.status='<?php echo (new SmartSieve)->text('Edit this script');?>'; return true;" onmouseout="window.status='';"><?php echo $s;?></A>
       </TD>
       <TD>
-        <IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/<?php echo ($active===true) ? 'tick.gif' : 'disable.gif';?>" BORDER="0">
-        <?php echo ($active===true) ? SmartSieve::text('active') : SmartSieve::text('not active');?> 
+        <IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/<?php echo ($active===true) ? 'tick.gif' : 'disable.gif';?>" BORDER="0">
+        <?php echo ($active===true) ? (new SmartSieve)->text('active') : (new SmartSieve)->text('not active');?> 
       </TD>
       <TD>
-        &nbsp;<?php echo (isset($scripts[$s])) ? $scripts[$s]->size . SmartSieve::text('bytes') : '';?> 
+        &nbsp;<?php echo (isset($scripts[$s])) ? $scripts[$s]->size . (new SmartSieve)->text('bytes') : '';?> 
       </TD>
     </TR>
 <?php endforeach; ?>
 <?php else: ?>
     <TR CLASS="active">
-      <TD COLSPAN="4">[<?php echo SmartSieve::text("No existing scripts");?>]</TD>
+      <TD COLSPAN="4">[<?php echo (new SmartSieve)->text("No existing scripts");?>]</TD>
     </TR>
 <?php endif; ?>
     </TABLE>
@@ -78,11 +78,11 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="activate" value="<?php echo SmartSieve::text('Activate');?>" onClick="setScriptActive(); return false;">
-          <input type="button" name="deactivate" value="<?php echo SmartSieve::text('Deactivate');?>" onClick="Deactivate(); return false;">
-          <input type="button" name="create" value="<?php echo SmartSieve::text('Create new script');?>" onClick="createScript(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="deleteScript(); return false;">
-          <input type="button" name="rename" value="<?php echo SmartSieve::text('Rename script');?>" onClick="renameScript(); return false;">
+          <input type="button" name="activate" value="<?php echo (new SmartSieve)->text('Activate');?>" onClick="setScriptActive(); return false;">
+          <input type="button" name="deactivate" value="<?php echo (new SmartSieve)->text('Deactivate');?>" onClick="Deactivate(); return false;">
+          <input type="button" name="create" value="<?php echo (new SmartSieve)->text('Create new script');?>" onClick="createScript(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="deleteScript(); return false;">
+          <input type="button" name="rename" value="<?php echo (new SmartSieve)->text('Rename script');?>" onClick="renameScript(); return false;">
         </TD>
       </TR>
     </TABLE>

include/scripts.js

--- data/include/scripts.js.orig        2007-08-20 17:24:45.000000000 +0200
+++ data/include/scripts.js     2014-03-24 00:49:50.000000000 +0100
@@ -26,7 +26,7 @@
 function setScriptActive()
 {
     if (numSelected() == 0){
-        alert('<?php echo SmartSieve::text('Please select a script to activate');?>');
+        alert('<?php echo (new SmartSieve)->text('Please select a script to activate');?>');
         return false;
     }
     document.slist.action.value = '<?php echo FORM_ACTION_ACTIVATE;?>';
@@ -35,7 +35,7 @@
 
 function createScript()
 {
-    var newscript = prompt('<?php echo SmartSieve::text('Please supply a name for your new script');?>','');
+    var newscript = prompt('<?php echo (new SmartSieve)->text('Please supply a name for your new script');?>','');
     if (newscript){
         document.slist.action.value = '<?php echo FORM_ACTION_CREATE;?>';
         document.slist.newscript.value = newscript;
@@ -46,10 +46,10 @@
 function deleteScript()
 {
     if (numSelected() == 0){
-        alert('<?php echo SmartSieve::text('Please select a script to delete');?>');
+        alert('<?php echo (new SmartSieve)->text('Please select a script to delete');?>');
         return false;
     }
-    if (!confirm("<?php echo SmartSieve::text('You are about to permanently remove the selected scripts.\nAre you sure you want to do this?');?>")){
+    if (!confirm("<?php echo (new SmartSieve)->text('You are about to permanently remove the selected scripts.\nAre you sure you want to do this?');?>")){
         return true;
     }
     document.slist.action.value = '<?php echo FORM_ACTION_DELETE;?>';
@@ -59,10 +59,10 @@
 function renameScript()
 {
     if (numSelected() == 0){
-        alert('<?php echo SmartSieve::text('Please select the script to rename');?>');
+        alert('<?php echo (new SmartSieve)->text('Please select the script to rename');?>');
         return false;
     }
-    var newscript = prompt('<?php echo SmartSieve::text('Please supply the new name for this script');?>','');
+    var newscript = prompt('<?php echo (new SmartSieve)->text('Please supply the new name for this script');?>','');
     if (newscript){
         document.slist.action.value = '<?php echo FORM_ACTION_RENAME;?>';
         document.slist.newscript.value = newscript;

include/spam.inc

--- data/include/spam.inc.orig  2007-08-30 17:22:56.000000000 +0200
+++ data/include/spam.inc       2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,17 +7,17 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
-        &nbsp;<?php echo SmartSieve::text('Filter spam');?>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<?php echo (new SmartSieve)->text('Filter spam');?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?>
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?>
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?>
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -35,12 +35,12 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
     <TR CLASS="heading">
       <TD>
-        <?php echo SmartSieve::text('What do you want to do with spam?');?> 
+        <?php echo (new SmartSieve)->text('What do you want to do with spam?');?> 
       </TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?>
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?>
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
       </TD>
 <?php else: ?>
       <TD>
@@ -60,7 +60,7 @@
         <TD>
           <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Actions');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Actions');?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -74,21 +74,21 @@
               <TD>
                 <SELECT NAME="action<?php echo $i;?>" onchange="document.thisRule.submit(); return true;">
 <?php if ($action['type'] == 'new'):?>
-                  <OPTION VALUE="new" SELECTED="selected"><?php echo SmartSieve::text('Add action');?></OPTION>
+                  <OPTION VALUE="new" SELECTED="selected"><?php echo (new SmartSieve)->text('Add action');?></OPTION>
 <?php endif;?>
-                  <OPTION VALUE="<?php echo ACTION_FILEINTO;?>"<?php echo ($action['type'] == ACTION_FILEINTO) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("File Into");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_REDIRECT;?>"<?php echo ($action['type'] == ACTION_REDIRECT) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Forward to address");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_REJECT;?>"<?php echo ($action['type'] == ACTION_REJECT) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Send a reject message");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_DISCARD;?>"<?php echo ($action['type'] == ACTION_DISCARD) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text("Discard the message");?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_VACATION;?>"<?php echo ($action['type'] == ACTION_VACATION) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Send vacation message');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_FILEINTO;?>"<?php echo ($action['type'] == ACTION_FILEINTO) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("File Into");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_REDIRECT;?>"<?php echo ($action['type'] == ACTION_REDIRECT) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Forward to address");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_REJECT;?>"<?php echo ($action['type'] == ACTION_REJECT) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Send a reject message");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_DISCARD;?>"<?php echo ($action['type'] == ACTION_DISCARD) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text("Discard the message");?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_VACATION;?>"<?php echo ($action['type'] == ACTION_VACATION) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Send vacation message');?></OPTION>
 <?php if ($GLOBALS['managesieve']->hasExtension('imapflags') && !empty($imapFlags)):?>
-                  <OPTION VALUE="<?php echo ACTION_ADDFLAG;?>"<?php echo ($action['type'] == ACTION_ADDFLAG) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Set message flag');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_ADDFLAG;?>"<?php echo ($action['type'] == ACTION_ADDFLAG) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Set message flag');?></OPTION>
 <?php endif;?>
 <?php if ($GLOBALS['managesieve']->hasExtension('notify') && !empty($notifyMethods)):?>
-                  <OPTION VALUE="<?php echo ACTION_NOTIFY;?>"<?php echo ($action['type'] == ACTION_NOTIFY) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Send notification message');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_NOTIFY;?>"<?php echo ($action['type'] == ACTION_NOTIFY) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Send notification message');?></OPTION>
 <?php endif;?>
-                  <OPTION VALUE="<?php echo ACTION_KEEP;?>"<?php echo ($action['type'] == ACTION_KEEP) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Keep a copy in your Inbox');?></OPTION>
-                  <OPTION VALUE="<?php echo ACTION_STOP;?>"<?php echo ($action['type'] == ACTION_STOP) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('Stop processing filter rules');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_KEEP;?>"<?php echo ($action['type'] == ACTION_KEEP) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Keep a copy in your Inbox');?></OPTION>
+                  <OPTION VALUE="<?php echo ACTION_STOP;?>"<?php echo ($action['type'] == ACTION_STOP) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('Stop processing filter rules');?></OPTION>
                 </SELECT>
               </TD>
               <TD>
@@ -96,19 +96,19 @@
 <?php if ($_SESSION['smartsieve']['auth'] == $_SESSION['smartsieve']['authz']):?>
                 <SELECT NAME="<?php echo ACTION_FILEINTO . $i;?>">
 <?php foreach ($mailboxes as $mbox): ?>
-                  <OPTION VALUE="<?php echo $mbox;?>"<?php echo ($action['folder'] == $mbox) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::mutf7Decode($mbox);?></OPTION>
+                  <OPTION VALUE="<?php echo $mbox;?>"<?php echo ($action['folder'] == $mbox) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->mutf7Decode($mbox);?></OPTION>
 <?php endforeach; ?>
 <?php if (!empty($action['folder']) && !in_array($action['folder'], $mailboxes)):?>
-                  <OPTION VALUE="<?php echo $action['folder'];?>" SELECTED="selected"><?php echo SmartSieve::mutf7Decode($action['folder']);?></OPTION>
+                  <OPTION VALUE="<?php echo $action['folder'];?>" SELECTED="selected"><?php echo (new SmartSieve)->mutf7Decode($action['folder']);?></OPTION>
 <?php endif;?>
                 </SELECT>
 <?php else:?>
                 <INPUT TYPE="text" NAME="<?php echo ACTION_FILEINTO . $i;?>" VALUE="<?php echo $action['folder'];?>">
 <?php endif;?>
 <?php elseif ($action['type'] == ACTION_REDIRECT):?>
-                <INPUT TYPE="text" NAME="<?php echo ACTION_REDIRECT . $i;?>" VALUE="<?php echo (!empty($action['address'])) ? SmartSieve::utf8Decode($action['address']) : '';?>" SIZE="40">
+                <INPUT TYPE="text" NAME="<?php echo ACTION_REDIRECT . $i;?>" VALUE="<?php echo (!empty($action['address'])) ? (new SmartSieve)->utf8Decode($action['address']) : '';?>" SIZE="40">
 <?php elseif ($action['type'] == ACTION_REJECT):?>
-                <TEXTAREA NAME="<?php echo ACTION_REJECT . $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo SmartSieve::utf8Decode($action['message']);?></TEXTAREA>
+                <TEXTAREA NAME="<?php echo ACTION_REJECT . $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (new SmartSieve)->utf8Decode($action['message']);?></TEXTAREA>
 <?php elseif ($action['type'] == ACTION_VACATION):?>
                 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
                   <TR>
@@ -116,24 +116,24 @@
                       &nbsp;
                     </TD>
                     <TD>
-                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? SmartSieve::utf8Decode($action['message']) : '';?></TEXTAREA>
+                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? (new SmartSieve)->utf8Decode($action['message']) : '';?></TEXTAREA>
                     </TD>
                   </TR>
                     <TR>
                     <TD>
-                      <?php echo SmartSieve::text('Days between responses');?> 
+                      <?php echo (new SmartSieve)->text('Days between responses');?> 
                     </TD>
                     <TD>
                       <SELECT NAME="days<?php echo $i;?>">
-<?php for ($j=1; $j <= SmartSieve::getConf('max_vacation_days', 30); $j++):?>
-                        <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($action['days']) && SmartSieve::getConf('vacation_days', 7) == $j) || $action['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
+<?php for ($j=1; $j <= (new SmartSieve)->getConf('max_vacation_days', 30); $j++):?>
+                        <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($action['days']) && (new SmartSieve)->getConf('vacation_days', 7) == $j) || $action['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
 <?php endfor;?>
                       </SELECT>
                     </TD>
                   </TR>
                   <TR>
                     <TD>
-                      <?php echo SmartSieve::text('Your e-mail addresses');?> 
+                      <?php echo (new SmartSieve)->text('Your e-mail addresses');?> 
                     </TD>
                     <TD>
                       <TABLE WIDTH="100%" CELLPADDING="5" BORDER="0" CELLSPACING="0">
@@ -156,7 +156,7 @@
 <?php elseif ($action['type'] == ACTION_ADDFLAG):?>
                 <SELECT NAME="<?php echo ACTION_ADDFLAG . $i;?>">
 <?php foreach ($imapFlags as $flag): ?>
-                  <OPTION VALUE="<?php echo $flag;?>"<?php echo ($action['flag'] == $flag) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::utf8Decode($flag);?></OPTION>
+                  <OPTION VALUE="<?php echo $flag;?>"<?php echo ($action['flag'] == $flag) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->utf8Decode($flag);?></OPTION>
 <?php endforeach; ?>
                 </SELECT>
 <?php elseif ($action['type'] == ACTION_NOTIFY):?>
@@ -165,18 +165,18 @@
                     <TD>
                       <SELECT NAME="notify_method<?php echo $i;?>" onchange="document.thisRule.submit(); return true;">
 <?php if (in_array('mailto', $notifyMethods)):?>
-                        <OPTION VALUE="<?php echo 'mailto';?>"<?php echo ($action['method'] == 'mailto' || empty($action['method'])) ? ' SELECTED="selected"' : '';?>><?php echo SmartSieve::text('by email');?></OPTION>
+                        <OPTION VALUE="<?php echo 'mailto';?>"<?php echo ($action['method'] == 'mailto' || empty($action['method'])) ? ' SELECTED="selected"' : '';?>><?php echo (new SmartSieve)->text('by email');?></OPTION>
 <?php endif;?>
 <?php if (in_array('sms', $notifyMethods)):?>
-                        <OPTION VALUE="<?php echo 'sms';?>"<?php echo ($action['method'] == 'sms') ? ' SELECTED' : '';?>><?php echo SmartSieve::text('by SMS');?></OPTION>
+                        <OPTION VALUE="<?php echo 'sms';?>"<?php echo ($action['method'] == 'sms') ? ' SELECTED' : '';?>><?php echo (new SmartSieve)->text('by SMS');?></OPTION>
 <?php endif;?>
                       </SELECT>
 <?php if ($action['method'] == 'mailto' || empty($action['method'])):?>
-                      &nbsp;<?php echo SmartSieve::text('to email address');?> 
-                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo SmartSieve::utf8Decode($action['options']);?>" size="50">
+                      &nbsp;<?php echo (new SmartSieve)->text('to email address');?> 
+                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo (new SmartSieve)->utf8Decode($action['options']);?>" size="50">
 <?php elseif ($action['method'] == 'sms'):?>
-                      &nbsp;<?php echo SmartSieve::text('to number');?> 
-                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo SmartSieve::utf8Decode($action['options']);?>" size="50">
+                      &nbsp;<?php echo (new SmartSieve)->text('to number');?> 
+                      &nbsp;<input type="text" name="notify_options<?php echo $i;?>" value="<?php echo (new SmartSieve)->utf8Decode($action['options']);?>" size="50">
 <?php else:?>
                       &nbsp;
 <?php endif;?>
@@ -184,7 +184,7 @@
                   </TR>
                   <TR>
                     <TD>
-                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? SmartSieve::utf8Decode($action['message']) : '';?></TEXTAREA>
+                      <TEXTAREA NAME="message<?php echo $i;?>" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php echo (!empty($action['message'])) ? (new SmartSieve)->utf8Decode($action['message']) : '';?></TEXTAREA>
                     </TD>
                   </TR>
                 </TABLE>
@@ -193,7 +193,7 @@
 <?php endif;?>
 <?php if ($action['type'] != 'new'):?>
                 <INPUT TYPE="hidden" NAME="deleteAction<?php echo $i;?>" VALUE="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.deleteAction<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete action');?>" TITLE="<?php echo SmartSieve::text('Delete action');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete action');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.deleteAction<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete action');?>" TITLE="<?php echo (new SmartSieve)->text('Delete action');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete action');?>'; return true;" onmouseout="window.status='';"></a>
 <?php endif;?>
               </TD>
             </TR>
@@ -201,7 +201,7 @@
 <?php if (!isset($ruleID) || $ruleID == 'new') :?>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Save at position');?> 
+                <?php echo (new SmartSieve)->text('Save at position');?> 
                 <select name="position">
 <?php for ($i=0; $i<count($script->rules); $i++):?>
                   <option value="<?php echo $i;?>"<?php echo ($i === 0) ? ' selected="selected"' : '';?>><?php echo $i+1;?></option>
@@ -232,13 +232,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>

include/vacation.inc

--- data/include/vacation.inc.orig      2007-08-30 16:52:48.000000000 +0200
+++ data/include/vacation.inc   2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,21 +7,21 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        &nbsp;<?php echo SmartSieve::text('Edit vacation settings');?>
+        &nbsp;<?php echo (new SmartSieve)->text('Edit vacation settings');?>
 <?php else: ?>
-        &nbsp;<?php echo SmartSieve::text('Set vacation message');?>
+        &nbsp;<?php echo (new SmartSieve)->text('Set vacation message');?>
 <?php endif;?>
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?>
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?>
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?>
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -40,13 +40,13 @@
     <TR CLASS="heading">
       <TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-        <?php echo SmartSieve::text('Edit filter rule');?>
+        <?php echo (new SmartSieve)->text('Edit filter rule');?>
       </TD>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?>
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?>
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
 <?php else: ?>
-        <?php echo SmartSieve::text('New filter rule');?>
+        <?php echo (new SmartSieve)->text('New filter rule');?>
       </TD>
       <TD>
         &nbsp;
@@ -65,7 +65,7 @@
         <TD>
           <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Vacation settings');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Vacation settings');?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -76,28 +76,28 @@
           <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Message');?>:
+                <?php echo (new SmartSieve)->text('Message');?>:
               </TD>
               <TD>
                 <INPUT TYPE="hidden" NAME="action0" VALUE="<?php echo ACTION_VACATION;?>">
-                <TEXTAREA NAME="message0" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php if (!empty($rule['actions'][0]['message'])) echo SmartSieve::utf8Decode($rule['actions'][0]['message']); ?></TEXTAREA>
+                <TEXTAREA NAME="message0" ROWS="10" COLS="<?php echo $wrap_width;?>" WRAP="hard"><?php if (!empty($rule['actions'][0]['message'])) echo (new SmartSieve)->utf8Decode($rule['actions'][0]['message']); ?></TEXTAREA>
               </TD>
             </TR>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Days between responses');?>:
+                <?php echo (new SmartSieve)->text('Days between responses');?>:
               </TD>
               <TD>
                 <SELECT NAME="days0">
-<?php for ($j=1; $j <= SmartSieve::getConf('max_vacation_days', 30); $j++):?>
-                  <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($rule['actions'][0]['days']) && SmartSieve::getConf('vacation_days', 7) == $j) || $rule['actions'][0]['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
+<?php for ($j=1; $j <= (new SmartSieve)->getConf('max_vacation_days', 30); $j++):?>
+                  <OPTION VALUE="<?php echo $j;?>"<?php echo ((empty($rule['actions'][0]['days']) && (new SmartSieve)->getConf('vacation_days', 7) == $j) || $rule['actions'][0]['days']==$j) ? ' SELECTED' : '';?>><?php echo $j;?></OPTION>
 <?php endfor;?>
                 </SELECT>
               </TD>
             </TR>
             <TR CLASS="active">
               <TD>
-                <?php echo SmartSieve::text('Your e-mail addresses');?>:
+                <?php echo (new SmartSieve)->text('Your e-mail addresses');?>:
               </TD>
               <TD>
                 <TABLE WIDTH="100%" CELLPADDING="5" BORDER="0" CELLSPACING="0">
@@ -134,13 +134,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>

include/whitelist.inc

--- data/include/whitelist.inc.orig     2007-09-25 17:37:19.000000000 +0200
+++ data/include/whitelist.inc  2014-03-24 00:49:50.000000000 +0100
@@ -1,4 +1,4 @@
-<FORM ACTION="<?php echo SmartSieve::setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
+<FORM ACTION="<?php echo (new SmartSieve)->setUrl('rule.php');?>" METHOD="post" NAME="thisRule">
 
 <TABLE WIDTH="100%" CELLPADDING="0" BORDER="0" CELLSPACING="0">
 <TR>
@@ -7,17 +7,17 @@
     <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
     <TR>
       <TD CLASS="breadcrumb">
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><?php echo SmartSieve::text('Scripts');?>&nbsp;&gt;</a>
-        &nbsp;<A HREF="<?php echo SmartSieve::setUrl('main.php');?>"><?php echo SmartSieve::text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
-        &nbsp;<?php echo SmartSieve::text('Edit whitelist');?> 
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><?php echo (new SmartSieve)->text('Scripts');?>&nbsp;&gt;</a>
+        &nbsp;<A HREF="<?php echo (new SmartSieve)->setUrl('main.php');?>"><?php echo (new SmartSieve)->text('Filter rules for "%s"', array($script->getName()));?>&nbsp;&gt;</A>
+        &nbsp;<?php echo (new SmartSieve)->text('Edit whitelist');?> 
       </TD>
       <TD ALIGN="right" class="heading">
-<?php if ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()): ?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is active', array($script->getName()));?> 
+<?php if ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()): ?>
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is active', array($script->getName()));?> 
 <?php else:?>
-        &nbsp;<?php echo SmartSieve::text('Script "%s" is not active', array($script->getName()));?> 
+        &nbsp;<?php echo (new SmartSieve)->text('Script "%s" is not active', array($script->getName()));?> 
 <?php endif;?>
-        &nbsp;<a href="<?php echo SmartSieve::setUrl('scripts.php');?>"><img src="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === SmartSieve::getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo SmartSieve::text('Manage Scripts');?>" border="0"></a>
+        &nbsp;<a href="<?php echo (new SmartSieve)->setUrl('scripts.php');?>"><img src="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($_SESSION['smartsieve']['workingScript'] === (new SmartSieve)->getActiveScript()) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo (new SmartSieve)->text('Manage Scripts');?>" border="0"></a>
       </TD>
     </TR>
     </TABLE>
@@ -35,12 +35,12 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
     <TR CLASS="heading">
       <TD>
-        <?php echo SmartSieve::text('Whitelist mail from the following addresses');?> 
+        <?php echo (new SmartSieve)->text('Whitelist mail from the following addresses');?> 
       </TD>
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
       <TD ALIGN="right">
-        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('This rule is enabled') : SmartSieve::text('This rule is disabled');?> 
-        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? SmartSieve::text('Disable this rule') : SmartSieve::text('Enable this rule');?>" BORDER="0"></a>
+        &nbsp;<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('This rule is enabled') : (new SmartSieve)->text('This rule is disabled');?> 
+        &nbsp;<a href="" onclick="document.thisRule.thisAction.value='<?php echo ($script->isRuleEnabled($ruleID)) ? FORM_ACTION_DISABLE : FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images'); echo ($script->isRuleEnabled($ruleID)) ? '/tick.gif' : '/disable.gif';?>" title="<?php echo ($script->isRuleEnabled($ruleID)) ? (new SmartSieve)->text('Disable this rule') : (new SmartSieve)->text('Enable this rule');?>" BORDER="0"></a>
 <?php else: ?>
       <TD>
         &nbsp;
@@ -59,7 +59,7 @@
         <TD>
           <TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">
             <TR>
-              <TH><?php echo SmartSieve::text('Addresses');?></TH>
+              <TH><?php echo (new SmartSieve)->text('Addresses');?></TH>
               <TH>&nbsp;</TH>
             </TR>
           </TABLE>
@@ -75,9 +75,9 @@
                 &nbsp;
                 <input type="hidden" name="condition<?php echo $i;?>" value="from">
                 <input type="hidden" name="matchType<?php echo $i;?>" value="is">
-                <input type="text" name="matchStr<?php echo $i;?>" value="<?php echo (!empty($condition['matchStr'])) ? SmartSieve::utf8Decode($condition['matchStr']) : '';?>" SIZE="30">
+                <input type="text" name="matchStr<?php echo $i;?>" value="<?php echo (!empty($condition['matchStr'])) ? (new SmartSieve)->utf8Decode($condition['matchStr']) : '';?>" SIZE="30">
                 <input type="hidden" name="delete<?php echo $i;?>" value="">
-                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo SmartSieve::getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo SmartSieve::text('Delete condition');?>" TITLE="<?php echo SmartSieve::text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo SmartSieve::text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
+                &nbsp;<A HREF="" onclick="document.forms.thisRule.delete<?php echo $i;?>.value='1'; document.forms.thisRule.submit(); return false;"><IMG SRC="<?php echo (new SmartSieve)->getConf('image_dir', 'images');?>/delete.gif" ALT="<?php echo (new SmartSieve)->text('Delete condition');?>" TITLE="<?php echo (new SmartSieve)->text('Delete condition');?>" BORDER="0" onmouseover="window.status='<?php echo (new SmartSieve)->text('Delete condition');?>'; return true;" onmouseout="window.status='';"></a>
               </TD>
             </TR>
 <?php else:?>
@@ -88,7 +88,7 @@
                 <input type="hidden" name="matchType<?php echo $i;?>" value="is">
                 <input type="hidden" name="matchStr<?php echo $i;?>" value="">
                 <input type="hidden" name="delete<?php echo $i;?>" value="">
-                <input type="button" name="new" value="<?php echo SmartSieve::text('New Address');?>" onclick="document.thisRule.condition<?php echo $i;?>.value='from'; document.thisRule.submit(); return false;">
+                <input type="button" name="new" value="<?php echo (new SmartSieve)->text('New Address');?>" onclick="document.thisRule.condition<?php echo $i;?>.value='from'; document.thisRule.submit(); return false;">
               </TD>
             </TR>
 <?php endif;?>
@@ -111,13 +111,13 @@
     <TABLE WIDTH="100%" CELLPADDING="2" BORDER="0" CELLSPACING="0">
       <TR>
         <TD CLASS="options">
-          <input type="button" name="save" value="<?php echo SmartSieve::text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="save" value="<?php echo (new SmartSieve)->text('Save Changes');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_SAVE;?>'; document.thisRule.submit(); return false;">
 <?php if (isset($ruleID) && $ruleID !== 'new'): ?>
-          <input type="button" name="enable" value="<?php echo SmartSieve::text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="disable" value="<?php echo SmartSieve::text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
-          <input type="button" name="delete" value="<?php echo SmartSieve::text('Delete');?>" onClick="Delete(); return false;">
+          <input type="button" name="enable" value="<?php echo (new SmartSieve)->text('Enable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_ENABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="disable" value="<?php echo (new SmartSieve)->text('Disable');?>" onClick="document.thisRule.thisAction.value='<?php echo FORM_ACTION_DISABLE;?>'; document.thisRule.submit(); return false;">
+          <input type="button" name="delete" value="<?php echo (new SmartSieve)->text('Delete');?>" onClick="Delete(); return false;">
 <?php endif; ?>
-          <input type="button" name="return" value="<?php echo SmartSieve::text('Return to Filters');?>" onClick="window.location='<?php echo SmartSieve::setUrl('main.php');?>';">
+          <input type="button" name="return" value="<?php echo (new SmartSieve)->text('Return to Filters');?>" onClick="window.location='<?php echo (new SmartSieve)->setUrl('main.php');?>';">
         </TD>
       </TR>
     </TABLE>

index.php

--- data/index.php.orig 2007-09-07 18:31:06.000000000 +0200
+++ data/index.php      2014-03-24 00:49:50.000000000 +0100
@@ -11,11 +11,11 @@
 
 require './lib/base.php';
 
-SmartSieve::checkAuthentication();
+(new SmartSieve)->checkAuthentication();
 
 // If we get here, we must have a valid session. Redirect to initial page.
 header(sprintf('Location: %s',
-    SmartSieve::setUrl(SmartSieve::getConf('initial_page', 'main.php'))));
+    (new SmartSieve)->setUrl((new SmartSieve)->getConf('initial_page', 'main.php'))));
 exit;
 
 ?>

lib/Crypt.php

--- data/lib/Crypt.php.orig     2007-03-13 00:35:15.000000000 +0100
+++ data/lib/Crypt.php  2015-07-13 11:02:17.000000000 +0200
@@ -23,8 +23,8 @@
    /**
     * Constructor
     *
-    * Note, this will only be called if Crypto::getCryptLib() cannot find a 
-    * crypto library to use and Crypto::factory() can therefore not instantiate 
+    * Note, this will only be called if (new Crypto)->getCryptLib() cannot find a 
+    * crypto library to use and (new Crypto)->factory() can therefore not instantiate 
     * a subclass. This parent class does not do any encryption.
     *
     * @param array $args Additional parameters.
@@ -32,8 +32,9 @@
     */
     function Crypto($args=array())
     {
-        SmartSieve::log('Crypto: Crypto parent class does not provide encryption', LOG_WARNING);
-        SmartSieve::setError(SmartSieve::text('The cryptographic library used is not providing adequate encryption'));
+        /* (new SmartSieve)->log('Crypto: Crypto parent class does not provide encryption', LOG_WARNING);
+        (new SmartSieve)->setError((new SmartSieve)->text('The cryptographic library used is not providing adequate encryption'));
+       */
     }
 
    /**
@@ -43,10 +44,10 @@
     * @param array $args Parameters to pass to crypto library.
     * @return object Reference to a Crypto object instance
     */
-    function &factory($driver=null, $args=array())
+    public static function &factory($driver=null, $args=array())
     {
         if ($driver !== null) {
-            @require_once sprintf('%s/Crypt/%s.php', SmartSieve::getConf('lib_dir', 'lib'), strtolower($driver));
+            @require_once sprintf('%s/Crypt/%s.php', (new SmartSieve)->getConf('lib_dir', 'lib'), strtolower($driver));
             $subclass = sprintf('Crypto_%s', strtoupper($driver));
             if (class_exists($subclass)){
                 $crypto = new $subclass($args);
@@ -70,9 +71,9 @@
         }
         static $crypto;
         if (!isset($crypto) || !is_object($crypto)) {
-            $args = SmartSieve::getConf('crypt_args', array());
-            $args['key'] = Crypto::generateKey();
-            $crypto = Crypto::factory(Crypto::getCryptLib(), $args);
+            $args = (new SmartSieve)->getConf('crypt_args', array());
+            $args['key'] = (new Crypto)->generateKey();
+            $crypto = (new Crypto)->factory((new Crypto)->getCryptLib(), $args);
         }
         return $crypto->encrypt($string);
     }
@@ -90,9 +91,9 @@
         }
         static $crypto;
         if (!isset($crypto) || !is_object($crypto)) {
-            $args = SmartSieve::getConf('crypt_args', array());
-            $args['key'] = Crypto::getKey();
-            $crypto = Crypto::factory(Crypto::getCryptLib(), $args);
+            $args = (new SmartSieve)->getConf('crypt_args', array());
+            $args['key'] = (new Crypto)->getKey();
+            $crypto = (new Crypto)->factory((new Crypto)->getCryptLib(), $args);
         }
         return $crypto->decrypt($string);
     }
@@ -122,14 +123,14 @@
                 }
                 $key = md5(uniqid(mt_rand(), 1));
                 $_COOKIE['smartsieve_key'] = $key;
-                setcookie('smartsieve_key', $key, 0, SmartSieve::getConf('cookie_path', ''),
-                    SmartSieve::getConf('cookie_domain', ''), 0);
+                setcookie('smartsieve_key', $key, 0, (new SmartSieve)->getConf('cookie_path', ''),
+                    (new SmartSieve)->getConf('cookie_domain', ''), 0);
             }
         } else {
             // Looks like browser doesn't have cookies enabled. Use a standard value.
             $key = md5(session_id());
-            setcookie('smartsieve_key', $key, 0, SmartSieve::getConf('cookie_path', ''),
-                SmartSieve::getConf('cookie_domain', ''), 0);
+            setcookie('smartsieve_key', $key, 0, (new SmartSieve)->getConf('cookie_path', ''),
+                (new SmartSieve)->getConf('cookie_domain', ''), 0);
         }
         return $key;
     }
@@ -140,7 +141,7 @@
     *
     * @return string The 32 bit secret key
     */
-    function getKey()
+    public static function getKey()
     {
         if (isset($_COOKIE['smartsieve_key'])) {
             return $_COOKIE['smartsieve_key'];
@@ -156,7 +157,7 @@
     *
     * @return mixed The crypto library to use, or null
     */
-    function getCryptLib()
+    public static function getCryptLib()
     {
         $libs = array();
         if (extension_loaded('mcrypt') && function_exists('mcrypt_module_open')) {
@@ -170,14 +171,14 @@
         }
         if (!empty($libs)) {
             $lib = $libs[0];
-            if (($cLib = SmartSieve::getConf('crypt_lib')) !== null &&
+            if (($cLib = (new SmartSieve)->getConf('crypt_lib')) !== null &&
                 in_array($cLib, $libs)) {
                 $lib = $cLib;
             }
-            SmartSieve::log(sprintf('getCryptLib: using %s', $lib), LOG_DEBUG);
+            (new SmartSieve)->log(sprintf('getCryptLib: using %s', $lib), LOG_DEBUG);
             return $lib;
         }
-        SmartSieve::log('getCryptLib: no usable cryptographic library', LOG_WARNING);
+        (new SmartSieve)->log('getCryptLib: no usable cryptographic library', LOG_WARNING);
         return null;
     }

lib/Log.php

--- data/lib/Log.php.orig       2015-07-16 00:02:51.526166373 +0200
+++ data/lib/Log.php    2014-03-24 00:49:50.000000000 +0100
@@ -0,0 +1,93 @@
+<?php
+/*
+ * $Id: Log.php,v 1.4 2006/02/13 13:11:37 stephengrier Exp $
+ *
+ * Copyright 2002-2006 Stephen Grier <stephengrier@users.sourceforge.net>
+ *
+ * See the inclosed NOTICE file for conditions of use and distribution.
+ */
+
+
+class Log {
+
+    var $method;   /* logging method: file or syslog. */
+    var $facility; /* syslog facility or file name, depending on $method. */
+    var $ident;    /* string to identify SmartSieve log messages in log. */
+    var $stream;   /* file pointer to log facility. */
+    var $open;     /* boolean: is fp to log open? */
+    var $errstr;   /* error messages. */
+
+    // class constructor
+    function Log($method,$facility,$ident) {
+
+       $this->method = $method;
+       $this->facility = $facility;
+       $this->ident = $ident;
+        $this->stream = 0;
+       $this->open = false;
+        $this->errstr = '';
+
+       if ($method == 'file'){
+           if (!$this->open_file()) return false;
+       }
+       elseif ($method == 'syslog'){
+           if (!$this->open_syslog()) return false;
+       }
+       else {
+           $this->errstr = "Log: invalid log method: $method";
+           return false;
+       }
+
+       return true;
+    }
+
+    function open_file () {
+
+       if (!$this->open){
+           if (!$this->stream = fopen($this->facility,'a')){
+               $this->errstr = "open_file: can't open logfile $facility";
+               return false;
+           }
+           $this->open = true;
+       }
+       return true;
+    }
+
+    function open_syslog () {
+
+       if (!$this->open){
+           if (!$this->stream = openlog($this->ident, LOG_PID, 
+                                               $this->facility)){
+               $this->errstr = "open_syslog: can't open syslog $facility";
+               return false;
+           }
+            $this->open = true;
+        }
+       return true;
+    }
+
+    function writeToLog($msg,$level) {
+       if (!$this->stream){
+           $this->errstr = "writeToLog: no log open";
+           return false;
+       }
+       if ($this->method == 'file'){
+           $s = strftime("%b %d %T") . ' [' . $this->ident . "] $msg\n";
+           if (!fwrite($this->stream, $s)){
+               $this->errstr = "writeToLog: error writing to log";
+               return false;
+           }
+       }
+       elseif ($this->method == 'syslog'){
+           if (!syslog($level, $msg)){
+               $this->errstr = "writeToLog: error writing to log";
+               return false;
+           }
+       }
+       return true;
+    }
+
+}
+
+
+?>

lib/Managesieve.php

--- data/lib/Managesieve.php.orig       2007-08-21 16:23:36.000000000 +0200
+++ data/lib/Managesieve.php    2014-03-24 01:09:40.000000000 +0100
@@ -232,7 +232,7 @@
                     $this->_capabilities['starttls'] = true;
                     break;
                 default:
-                    $this->_capabilities['unknown_banners'][] = $line;
+                    $this->_capabilities['unknown_banners'][] = $this->resp['data'];
                     break;
             }
         }
@@ -292,6 +292,8 @@
         $this->_errstr = '';
         $line = $this->read();
 
+       // (new SmartSieve)->log( sprintf("managesieve->getresponse: {%s}", $line ), LOG_DEBUG);
+       
         // Check for socket timeout
         if ($this->_sock_timed_out === true){
             $this->resp['data'] = $line;
@@ -568,6 +570,9 @@
         if (!$sasl_mech = $this->_selectSaslMech($this->sasl_mech)){
             return false;
         }
+       (new SmartSieve)->log( sprintf("managesieve->authenticate: login: %s, pass: %s, authz: %s, mech: %s",$auth, $passwd,
+                       $authz, $sasl_mech), LOG_DEBUG);
+
         switch ($sasl_mech){
 
             case "plain":
@@ -577,6 +582,8 @@
                 fputs($this->_socket, sprintf("AUTHENTICATE \"PLAIN\" {%s+}\r\n", $len));
                 fputs($this->_socket,"$authstr\r\n");
 
+               (new SmartSieve)->log( sprintf("managesieve->authenticate->plain: {%s+}, authsr: %s", $len, $authstr ), LOG_DEBUG);
+
                 if ($this->getResponse() == F_OK) {
                     $this->_state = S_AUTHENTICATED;
                     return true;

lib/Script.php

--- data/lib/Script.php.orig    2007-09-06 17:06:20.000000000 +0200
+++ data/lib/Script.php 2014-03-24 00:49:50.000000000 +0100
@@ -57,7 +57,7 @@
 
 
 /**
- * Class Script:: implements a sieve script.
+ * Class (new Script)-> implements a sieve script.
  *
  * @author Stephen Grier <stephengrier@users.sourceforge.net>
  * @version $Revision: 1.35 $
@@ -176,7 +176,7 @@
  
         // If script doesn't yet exist, nothing to retrieve. 
         // This will be a SmartSieve script.
-        if (!SmartSieve::scriptExists($this->name)) {
+        if (!(new SmartSieve)->scriptExists($this->name)) {
             $this->so = true;
             return true;
         }
@@ -246,7 +246,7 @@
                     if (($bits[8] & REGEX_BIT)) {
                         $condition['matchType'] = MATCH_REGEX;
                     } elseif (preg_match("/\*|\?/", $condition['matchStr']) &&
-                        SmartSieve::getConf('websieve_auto_matches') === true) {
+                        (new SmartSieve)->getConf('websieve_auto_matches') === true) {
                         $condition['matchType'] = MATCH_MATCHES;
                     } else {
                         $condition['matchType'] = MATCH_CONTAINS;
@@ -266,7 +266,7 @@
                     if (($bits[8] & REGEX_BIT)) {
                         $condition['matchType'] = MATCH_REGEX;
                     } elseif (preg_match("/\*|\?/", $condition['matchStr']) &&
-                        SmartSieve::getConf('websieve_auto_matches') === true) {
+                        (new SmartSieve)->getConf('websieve_auto_matches') === true) {
                         $condition['matchType'] = MATCH_MATCHES;
                     } else {
                         $condition['matchType'] = MATCH_CONTAINS;
@@ -286,7 +286,7 @@
                     if (($bits[8] & REGEX_BIT)) {
                         $condition['matchType'] = MATCH_REGEX;
                     } elseif (preg_match("/\*|\?/", $condition['matchStr']) &&
-                        SmartSieve::getConf('websieve_auto_matches') === true) {
+                        (new SmartSieve)->getConf('websieve_auto_matches') === true) {
                         $condition['matchType'] = MATCH_MATCHES;
                     } else {
                         $condition['matchType'] = MATCH_CONTAINS;
@@ -307,7 +307,7 @@
                     if (($bits[8] & REGEX_BIT)) {
                         $condition['matchType'] = MATCH_REGEX;
                     } elseif (preg_match("/\*|\?/", $condition['matchStr']) &&
-                        SmartSieve::getConf('websieve_auto_matches') === true) {
+                        (new SmartSieve)->getConf('websieve_auto_matches') === true) {
                         $condition['matchType'] = MATCH_MATCHES;
                     } else {
                         $condition['matchType'] = MATCH_CONTAINS;
@@ -419,7 +419,7 @@
     {
         global $managesieve;
 
-        include_once SmartSieve::getConf('lib_dir', 'lib') . '/version.php';
+        include_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/version.php';
 
         if (!is_object($managesieve)) {
             $this->errstr = "updateScript: no sieve session open";
@@ -427,7 +427,7 @@
         }
 
         // Don't overwrite a non-SmartSieve script if configured not to.
-        if (!$this->so && SmartSieve::getConf('allow_write_unrecognised_scripts') === false) {
+        if (!$this->so && (new SmartSieve)->getConf('allow_write_unrecognised_scripts') === false) {
             $this->errstr = 'updateScript: encoding not recognised: not safe to overwrite ' . $this->name;
             return false;
         }
@@ -444,7 +444,7 @@
  
         $newscripthead = sprintf("#Mail filter rules for %s\n", $_SESSION['smartsieve']['authz']);
         $newscripthead .= sprintf("#Generated by %s using SmartSieve %s %s\n", $_SESSION['smartsieve']['auth'],
-                                  VERSION, date(SmartSieve::getConf('script_date_format', 'Y/m/d H:i:s')));
+                                  VERSION, date((new SmartSieve)->getConf('script_date_format', 'Y/m/d H:i:s')));
  
         $newrequire = '';
         $started = false;
@@ -477,7 +477,7 @@
         }
 
         // Upload the updated script.
-        $slist = SmartSieve::getScriptList();
+        $slist = (new SmartSieve)->getScriptList();
         if (!$managesieve->putScript($this->name, $newscript)) {
             $this->errstr = 'updateScript: putscript failed: ' . $managesieve->getError();
             return false;
@@ -488,9 +488,9 @@
         // active script if 1) configured to activate when saving changes; 2) if 
         // only allowing user to edit this script, or 3) there are no existing 
         // scripts on the server.
-        if ($this->name !== SmartSieve::getActiveScript() &&
-            (SmartSieve::getConf('update_activate_script') === true ||
-             SmartSieve::getConf('allow_multi_scripts') === false ||
+        if ($this->name !== (new SmartSieve)->getActiveScript() &&
+            ((new SmartSieve)->getConf('update_activate_script') === true ||
+             (new SmartSieve)->getConf('allow_multi_scripts') === false ||
              count($slist) === 0)) {
             if (!$managesieve->setActive($this->name)) {
                 $this->errstr = 'updateScript: activatescript failed: ' . $managesieve->getError();
@@ -731,7 +731,7 @@
     {
         // If called without parameters use current version.
         if (is_null($major)) {
-            include_once SmartSieve::getConf('lib_dir', 'lib') . '/version.php';
+            include_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/version.php';
             list($major, $minor, $bugfix) = explode('.', VERSION);
             if (strpos($bugfix, '-') !== false) {
                 list($bugfix, $tag) = explode('-', $bugfix);

lib/SmartSieve.lib

--- data/lib/SmartSieve.lib.orig        2007-10-02 12:04:58.000000000 +0200
+++ data/lib/SmartSieve.lib     2015-07-13 11:02:22.000000000 +0200
@@ -25,23 +25,23 @@
     *
     * @return void Sends a 302 redirect on failure
     */
-    function checkAuthentication()
+    public static function checkAuthentication()
     {
         if (isset($_SESSION['smartsieve']) && is_array($_SESSION['smartsieve'])) {
-            if (SmartSieve::authenticate() !== true) {
-                SmartSieve::destroy();
-                header('Location: ' . SmartSieve::setUrl('login.php'));
+            if ((new SmartSieve)->authenticate() !== true) {
+                (new SmartSieve)->destroy();
+                header('Location: ' . (new SmartSieve)->setUrl('login.php'));
                 exit;
             }
-        } elseif (($details = SmartSieve::getLoginDetails()) !== false) {
-            $ret = SmartSieve::login($details);
+        } elseif (($details = (new SmartSieve)->getLoginDetails()) !== false) {
+            $ret = (new SmartSieve)->login($details);
             if ($ret !== true) {
-                header('Location: ' . SmartSieve::setUrl('login.php?reason=failure'));
+                header('Location: ' . (new SmartSieve)->setUrl('login.php?reason=failure'));
                 exit;
             }
         } else {
             // No existing session or login attempt. Redirect to login page.
-            header('Location: ' . SmartSieve::setUrl('login.php'));
+            header('Location: ' . (new SmartSieve)->setUrl('login.php'));
             exit;
         }
     }
@@ -51,18 +51,18 @@
     *
     * @return mixed array of login details on success, boolean false if not
     */
-    function getLoginDetails()
+    public static function getLoginDetails()
     {
         $details = array();
         /* If user has submitted login page, get details from POST request. */
         if (isset($_POST['auth']) && isset($_POST['passwd'])) {
-            $details['auth'] = SmartSieve::getFormValue('auth');
-            $details['passwd'] = SmartSieve::getFormValue('passwd');
-            $details['authz'] = SmartSieve::getFormValue('authz');
-            $details['server'] = SmartSieve::getFormValue('server');
+            $details['auth'] = (new SmartSieve)->getFormValue('auth');
+            $details['passwd'] = (new SmartSieve)->getFormValue('passwd');
+            $details['authz'] = (new SmartSieve)->getFormValue('authz');
+            $details['server'] = (new SmartSieve)->getFormValue('server');
         }
         /* Try an alternative source. */
-        elseif (($func = SmartSieve::getConf('get_login_details_hook')) !== null &&
+        elseif (($func = (new SmartSieve)->getConf('get_login_details_hook')) !== null &&
              function_exists($func)) {
             $details = call_user_func($func);
         }
@@ -75,40 +75,40 @@
     * @param array $credentials Login credentials as returned by ::getLoginDetails()
     * @return boolean true on success, false if not
     */
-    function login($credentials)
+    public static function login($credentials)
     {
         if (empty($credentials) || !is_array($credentials)) {
             return false;
         }
         // Make sure we have a clean session.
-        SmartSieve::destroy();
+        (new SmartSieve)->destroy();
         session_start();
 
-        if (($ret = SmartSieve::setSession($credentials)) === true &&
-            ($ret = SmartSieve::authenticate()) === true) {
+        if (($ret = (new SmartSieve)->setSession($credentials)) === true &&
+            ($ret = (new SmartSieve)->authenticate()) === true) {
 
             $smartsieve = &$_SESSION['smartsieve'];
 
-            SmartSieve::log(sprintf('login: %s%s [%s] {%s:%s}',
+            (new SmartSieve)->log(sprintf('login: %s%s [%s] {%s:%s}',
                 ($smartsieve['auth'] != $smartsieve['authz']) ? sprintf('%s as ', $smartsieve['auth']) : '',
                 $smartsieve['authz'], $_SERVER['REMOTE_ADDR'], $smartsieve['server']['host'],
                 $smartsieve['server']['sieveport']), LOG_INFO);
             // Set the array of script objects in the PHP session.
             $_SESSION['scripts'] = array();
             // Set which script to edit first.
-            SmartSieve::setWorkingScript(SmartSieve::getFormValue('scriptfile'));
+            (new SmartSieve)->setWorkingScript((new SmartSieve)->getFormValue('scriptfile'));
             if (isset($_POST['lang'])) {
-                $_SESSION['smartsieve_lang'] = SmartSieve::getFormValue('lang');
+                $_SESSION['smartsieve_lang'] = (new SmartSieve)->getFormValue('lang');
             }
             return true;
         }
-        SmartSieve::log(sprintf('FAILED LOGIN: %s%s [%s] {%s}: %s',
+        (new SmartSieve)->log(sprintf('FAILED LOGIN: %s%s [%s] {%s}: <%s>',
             $credentials['auth'],
             (!empty($credentials['authz']) && $credentials['authz'] != $credentials['auth']) ?
                 sprintf(' as %s', $credentials['authz']) : '',
             $_SERVER['REMOTE_ADDR'], $credentials['server'], $ret), LOG_ERR);
 
-        SmartSieve::destroy();
+        (new SmartSieve)->destroy();
         session_start();
         return false;
     }
@@ -118,7 +118,7 @@
     *
     * @return void
     */
-    function destroy()
+    public static function destroy()
     {
         if (isset($_SESSION['smartsieve'])) {
             $_SESSION['smartsieve'] = null;
@@ -136,14 +136,14 @@
     *
     * @return void Possibly a 302 redirect
     */
-    function logout()
+    public static function logout()
     {
         if (isset($_SESSION['smartsieve']) && is_array($_SESSION['smartsieve'])) {
-            SmartSieve::log(sprintf('logout: %s',
+            (new SmartSieve)->log(sprintf('logout: %s',
                 $_SESSION['smartsieve']['authz']), LOG_INFO);
-            SmartSieve::close();
-            SmartSieve::destroy();
-            if (($uri = SmartSieve::getConf('logout_redirect')) !== null) {
+            (new SmartSieve)->close();
+            (new SmartSieve)->destroy();
+            if (($uri = (new SmartSieve)->getConf('logout_redirect')) !== null) {
                 header(sprintf('Location: %s', $uri));
                 exit;
             }
@@ -161,7 +161,7 @@
     *                                 string $server)
     * @return mixed boolean true on success, string error if not
     */
-    function setSession($credentials)
+    public static function setSession($credentials)
     {
         global $servers;
         if (empty($credentials['auth'])) {
@@ -172,7 +172,7 @@
 
         $smartsieve = array();
 
-        include_once SmartSieve::getConf('config_dir', 'conf') . '/servers.php';
+        include_once (new SmartSieve)->getConf('config_dir', 'conf') . '/servers.php';
 
         // Server value must exist in servers.php.
         if (!array_key_exists($credentials['server'], $servers) ||
@@ -181,16 +181,16 @@
             $credentials['server'] = (!empty($srvkeys)) ? $srvkeys[0] : '';
         }
         $server = array();
-        $server['host'] = SmartSieve::getServerValue($credentials['server'], 'server');
-        $server['sieveport'] = SmartSieve::getServerValue($credentials['server'], 'sieveport', '2000');
-        $server['display'] = SmartSieve::getServerValue($credentials['server'], 'display', $server['host']);
-        $server['imapport'] = SmartSieve::getServerValue($credentials['server'], 'imapport', '143');
-        $server['maildomain'] = SmartSieve::getServerValue($credentials['server'], 'maildomain');
-        $server['use_starttls'] = SmartSieve::getServerValue($credentials['server'], 'use_starttls', true);
+        $server['host'] = (new SmartSieve)->getServerValue($credentials['server'], 'server');
+        $server['sieveport'] = (new SmartSieve)->getServerValue($credentials['server'], 'sieveport', '2000');
+        $server['display'] = (new SmartSieve)->getServerValue($credentials['server'], 'display', $server['host']);
+        $server['imapport'] = (new SmartSieve)->getServerValue($credentials['server'], 'imapport', '143');
+        $server['maildomain'] = (new SmartSieve)->getServerValue($credentials['server'], 'maildomain');
+        $server['use_starttls'] = (new SmartSieve)->getServerValue($credentials['server'], 'use_starttls', true);
         $smartsieve['server'] = $server;
 
         $smartsieve['auth'] = $credentials['auth'];
-        $auth_domain = SmartSieve::getServerValue($credentials['server'], 'auth_domain');
+        $auth_domain = (new SmartSieve)->getServerValue($credentials['server'], 'auth_domain');
         if (!empty($auth_domain) && strpos($credentials['auth'], '@') === false) {
             $smartsieve['auth'] .= '@' . $auth_domain;
         }
@@ -201,8 +201,8 @@
         if (!empty($auth_domain) && strpos($credentials['authz'], '@') === false) {
             $smartsieve['authz'] .= '@' . $auth_domain;
         }
-        require_once SmartSieve::getConf('lib_dir', 'lib') . '/Crypt.php';
-        $smartsieve['passwd'] = Crypto::encrypt($credentials['passwd']);
+        require_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/Crypt.php';
+        $smartsieve['passwd'] = (new Crypto)->encrypt($credentials['passwd']);
         $_SESSION['smartsieve'] = $smartsieve;
         return true;
     }
@@ -212,18 +212,18 @@
     *
     * @return mixed true on success, string error if not
     */
-    function authenticate()
+    public static function authenticate()
     {
         if (!isset($_SESSION['smartsieve']) || !is_array($_SESSION['smartsieve'])) {
             return 'authenticate: no session started';
         }
         $smartsieve = $_SESSION['smartsieve'];
 
-        require_once SmartSieve::getConf('lib_dir', 'lib') . '/Crypt.php';
-        $passwd = Crypto::decrypt($smartsieve['passwd']);
+        require_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/Crypt.php';
+        $passwd = (new Crypto)->decrypt($smartsieve['passwd']);
 
         $managesieve = new Managesieve();
-        $ret = $managesieve->open($smartsieve['server']['host'], $smartsieve['server']['sieveport'], SmartSieve::getConf('socket_timeout', 2));
+        $ret = $managesieve->open($smartsieve['server']['host'], $smartsieve['server']['sieveport'], (new SmartSieve)->getConf('socket_timeout', 2));
         if ($ret !== true) {
             $err = $managesieve->getError();
             $managesieve->close();
@@ -239,12 +239,15 @@
                 return $err;
             }
         }
-        $ret = $managesieve->authenticate($smartsieve['auth'], $passwd, $smartsieve['authz'], SmartSieve::getConf('sasl_mech'));
+       (new SmartSieve)->log( sprintf("login: %s, pass: %s, authz: %s, mech: %s",$smartsieve['auth'], $passwd,
+                       $smartsieve['authz'], (new SmartSieve)->getConf('sasl_mech')), LOG_DEBUG);
+        $ret = $managesieve->authenticate($smartsieve['auth'], $passwd, $smartsieve['authz'], (new SmartSieve)->getConf('sasl_mech'));
         if ($ret !== true) {
             $err = $managesieve->getError();
             $managesieve->close();
             return $err;
         }
+
         $GLOBALS['managesieve'] = $managesieve;
         register_shutdown_function(array('SmartSieve', 'close'));
         return true;
@@ -255,7 +258,7 @@
     *
     * @return boolean true
     */
-    function close()
+    public static function close()
     {
         if (isset($GLOBALS['managesieve']) && is_object($GLOBALS['managesieve'])) {
             $GLOBALS['managesieve']->close();
@@ -276,16 +279,16 @@
     * @var array $args vsprintf style arguments
     * @return string The (possibly translated) text
     */
-    function text($string = '', $args = array())
+    public static function text($string = '', $args = array())
     {
         static $lang, $phrase;
 
         if (!isset($lang)) {
-            $lang = SmartSieve::getLang();
+            $lang = (new SmartSieve)->getLang();
         }
 
         if (!isset($phrase)) {
-            @include SmartSieve::getConf('lang_dir', 'conf/locale') . "/$lang/strings.php";
+            @include (new SmartSieve)->getConf('lang_dir', 'conf/locale') . "/$lang/strings.php";
         }
 
         if (!empty($phrase[$string])) {
@@ -300,17 +303,17 @@
     *
     * @return string The charset to use
     */
-    function getCharset()
+    public static function getCharset()
     {
         static $charset;
 
         if (!isset($charset)) {
-            $lang = SmartSieve::getLang();
-            include SmartSieve::getConf('config_dir', 'conf') . '/locales.php';
+            $lang = (new SmartSieve)->getLang();
+            include (new SmartSieve)->getConf('config_dir', 'conf') . '/locales.php';
             if (isset($locales[$lang]['charset'])) {
                 $charset = $locales[$lang]['charset'];
             } else {
-                $charset = SmartSieve::getConf('charset', 'ISO-8859-1');
+                $charset = (new SmartSieve)->getConf('charset', 'ISO-8859-1');
             }
         }
         return $charset;
@@ -321,22 +324,22 @@
     *
     * @return string The language to use
     */
-    function getLang()
+    public static function getLang()
     {
         // Get lang if login form submitted.
         if (isset($_POST['lang'])) {
-            return SmartSieve::getPOST('lang');
+            return (new SmartSieve)->getPOST('lang');
         }
         // Check if user has changed language on login page.
         if (isset($_GET['login_lang'])) {
-            return SmartSieve::getGET('login_lang');
+            return (new SmartSieve)->getGET('login_lang');
         }
         // Check if language is set in the session.
         if (isset($_SESSION['smartsieve_lang'])) {
             return $_SESSION['smartsieve_lang'];
         }
         // If none of the above, use the default.
-        return SmartSieve::getConf('language', 'en_GB');
+        return (new SmartSieve)->getConf('language', 'en_GB');
     }
 
    /**
@@ -346,9 +349,9 @@
     * @param string $string The mUTF-7 string to decode
     * @return string The string decoded into the current charset
     */
-    function mutf7Decode($string)
+    public static function mutf7Decode($string)
     {
-        $charset = SmartSieve::getCharset();
+        $charset = (new SmartSieve)->getCharset();
 
         /* if we're using the ISO-8859-1 charset, we can just use imap_utf7_decode(). */
         if (strtolower($charset) == 'iso-8859-1' || strtolower($charset) == 'us-ascii') {
@@ -369,7 +372,7 @@
          * incompatible characters. also, add extra ascii char to avoid iconv bug. */
         if (extension_loaded('iconv')) {
             /* convert the modified UTF-7 string to UTF-7. */
-            $utf7 = SmartSieve::modifiedToPlainUTF7($string);
+            $utf7 = (new SmartSieve)->modifiedToPlainUTF7($string);
             $decoded = @iconv('UTF-7', $charset . '//TRANSLIT', $utf7 . "\0");
             if ($decoded) {
                 return $decoded;
@@ -392,7 +395,7 @@
     * @param string $string The mUTF-7 string to convert
     * @return string The converted UTF-7 string
     */
-    function modifiedToPlainUTF7($string)
+    public static function modifiedToPlainUTF7($string)
     {
         $utf7 = '';
         $base64 = false;
@@ -436,10 +439,11 @@
     * @param string $def Default value
     * @return mixed Config value, possibly null
     */
-    function getConf($option, $def=null)
+    public static function getConf($option, $def=null)
     {
         static $default;
         if (!isset($default)) {
+            $default = new stdClass();
             require_once 'conf/config.php';
         }
         if (isset($default->$option)) {
@@ -456,7 +460,7 @@
     * @param string $def Default value
     * @return mixed Server value, possibly null
     */
-    function getServerValue($skey, $val, $def=null)
+    public static function getServerValue($skey, $val, $def=null)
     {
         require_once "conf/servers.php";
         global $servers;
@@ -473,20 +477,20 @@
     * @param integer $level One of the LOG_* contants
     * @return boolean True on success, false if not
     */
-    function log($msg, $level=LOG_INFO)
+    public static function log($msg, $level=LOG_INFO)
     {
-        if (SmartSieve::getConf('logging') !== true) {
+        if ((new SmartSieve)->getConf('logging') !== true) {
             return true;
-        } if ($level > SmartSieve::getConf('logging_level', LOG_INFO)) {
+        } if ($level > (new SmartSieve)->getConf('logging_level', LOG_INFO)) {
             return true;
         }
         include_once 'Log.php';
-        $log = &Log::singleton(SmartSieve::getConf('logging_method', 'syslog'),
-                               SmartSieve::getConf('logging_facility', 'LOG_LOCAL4'),
-                               SmartSieve::getConf('logging_ident', 'smartsieve'),
-                               SmartSieve::getConf('logging_args'));
+        $log = Log::singleton((new SmartSieve)->getConf('logging_method', 'syslog'),
+                               (new SmartSieve)->getConf('logging_facility', 'LOG_LOCAL4'),
+                               (new SmartSieve)->getConf('logging_ident', 'smartsieve'),
+                               (new SmartSieve)->getConf('logging_args'));
         if ($log === null) {
-            SmartSieve::setError(SmartSieve::text('Failed writing to log'));
+            (new SmartSieve)->setError((new SmartSieve)->text('Failed writing to log'));
             return false;
         }
         return $log->log($msg, $level);
@@ -499,7 +503,7 @@
     * @param string $msg The error message to set
     * @return mixed boolean true or array of string messages
     */
-    function setError($msg=null)
+    public static function setError($msg=null)
     {
         if (!isset($_SESSION['errors']) || !is_array($_SESSION['errors'])) {
             $_SESSION['errors'] = array();
@@ -520,7 +524,7 @@
     * @param string $msg The message to set
     * @return mixed boolean true or array of string messages
     */
-    function setNotice($msg=null)
+    public static function setNotice($msg=null)
     {
         if (!isset($_SESSION['notices']) || !is_array($_SESSION['notices'])) {
             $_SESSION['notices'] = array();
@@ -539,10 +543,10 @@
     *
     * @return mixed array of scripts if success, or string error if not
     */
-    function getScriptList()
+    public static function getScriptList()
     {
         if (!isset($GLOBALS['managesieve']) || !is_object($GLOBALS['managesieve'])) {
-            $ret = SmartSieve::authenticate();
+            $ret = (new SmartSieve)->authenticate();
             if ($ret !== true) {
                 return $ret;
             }
@@ -552,7 +556,7 @@
         if ($slist === false) {
             $resp = $managesieve->getLastResponse();
             if ($resp['state'] === F_BYE) {
-                SmartSieve::handleReferral();
+                (new SmartSieve)->handleReferral();
                 return Smartsieve::getScriptList();
             }
             return $managesieve->getError();
@@ -565,9 +569,9 @@
     *
     * @return mixed string name of active script, or null if none active
     */
-    function getActiveScript()
+    public static function getActiveScript()
     {
-        $slist = SmartSieve::getScriptList();
+        $slist = (new SmartSieve)->getScriptList();
         if (!is_array($slist)) {
             return "getActiveScript: $slist";
         }
@@ -580,9 +584,9 @@
     * @param string $name Name of script
     * @return boolean true if script exists on server, false if not
     */
-    function scriptExists($name)
+    public static function scriptExists($name)
     {
-        $slist = array_keys(SmartSieve::getScriptList());
+        $slist = array_keys((new SmartSieve)->getScriptList());
         return in_array($name, $slist, true);
     }
 
@@ -591,7 +595,7 @@
     *
     * @return boolean true on success, or void redirect if not
     */
-    function handleReferral()
+    public static function handleReferral()
     {
         global $managesieve;
         $resp = $managesieve->getLastResponse();
@@ -602,21 +606,21 @@
                 $rserver = substr($rserver, 8);
             }
             $managesieve->close();
-            $ret = $managesieve->open($rserver, $_SESSION['smartsieve']['server']['sieveport'], SmartSieve::getConf('socket_timeout', 2));
+            $ret = $managesieve->open($rserver, $_SESSION['smartsieve']['server']['sieveport'], (new SmartSieve)->getConf('socket_timeout', 2));
             if ($ret === true) {
-                require_once SmartSieve::getConf('lib_dir', 'lib') . '/Crypt.php';
-                $passwd = Crypto::decrypt($_SESSION['smartsieve']['passwd']);
+                require_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/Crypt.php';
+                $passwd = (new Crypto)->decrypt($_SESSION['smartsieve']['passwd']);
                 $ret = $managesieve->authenticate($_SESSION['smartsieve']['auth'], $passwd, 
-                    $_SESSION['smartsieve']['authz'], SmartSieve::getConf('sasl_mech'));
+                    $_SESSION['smartsieve']['authz'], (new SmartSieve)->getConf('sasl_mech'));
                 if ($ret === true) {
-                    SmartSieve::setNotice(SmartSieve::text('Referred to server "%s"', $rserver));
+                    (new SmartSieve)->setNotice((new SmartSieve)->text('Referred to server "%s"', $rserver));
                     $_SESSION['smartsieve']['server']['host'] = $rserver;
                     return true;
                 }
             }
-            SmartSieve::log(sprintf('handleReferral: %s', $managesieve->getError()), LOG_ERR);
-            SmartSieve::close();
-            header('Location: ' . SmartSieve::setUrl('login.php?reason=failure'),true);
+            (new SmartSieve)->log(sprintf('handleReferral: %s', $managesieve->getError()), LOG_ERR);
+            (new SmartSieve)->close();
+            header('Location: ' . (new SmartSieve)->setUrl('login.php?reason=failure'),true);
             exit;
         }
         return true;
@@ -632,15 +636,15 @@
     * @param string $script The script to edit
     * @return void
     */
-    function setWorkingScript($script=null)
+    public static function setWorkingScript($script=null)
     {
         // If not allowing multiple scripts select the default.
-        if (SmartSieve::getConf('allow_multi_scripts') === false) {
-            $script = SmartSieve::getConf('scriptfile', 'smartsieve');
+        if ((new SmartSieve)->getConf('allow_multi_scripts') === false) {
+            $script = (new SmartSieve)->getConf('scriptfile', 'smartsieve');
         }
 
         if (empty($script)) {
-            $slist = SmartSieve::getScriptList();
+            $slist = (new SmartSieve)->getScriptList();
             if (is_array($slist)) {
                 $active = array_search(true, $slist, true);
                 $slist = array_keys($slist);
@@ -652,13 +656,13 @@
                     $script = $slist[0];
                 }
             } else {
-                SmartSieve::setError(SmartSieve::text('Failed reading script list: %s', $slist));
-                SmartSieve::log("setWorkingScript: failed reading script list: $slist", LOG_ERR);
+                (new SmartSieve)->setError((new SmartSieve)->text('Failed reading script list: %s', $slist));
+                (new SmartSieve)->log("setWorkingScript: failed reading script list: $slist", LOG_ERR);
             }
         }
         // If all else fails, select the default.
         if (empty($script)) {
-            $script = SmartSieve::getConf('scriptfile', 'smartsieve');
+            $script = (new SmartSieve)->getConf('scriptfile', 'smartsieve');
         }
         $_SESSION['smartsieve']['workingScript'] = $script;
 
@@ -669,10 +673,10 @@
         $s = &$_SESSION['scripts'][$script];
         $ret = $s->getContent();
         if ($ret === false) {
-            SmartSieve::setError(SmartSieve::text('ERROR: ') . $s->errstr);
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $s->errstr);
             $logmsg = sprintf('failed reading rules from script "%s" for %s: %s',
                 $s->name, $_SESSION['smartsieve']['authz'], $s->errstr);
-            SmartSieve::log($logmsg, LOG_ERR);
+            (new SmartSieve)->log($logmsg, LOG_ERR);
         }
     }
 
@@ -681,15 +685,15 @@
     *
     * @return array An array of mUTF7 encoded mailbox names, possibly empty
     */
-    function getMailboxList()
+    public static function getMailboxList()
     {
         $mboxlist = array();
-        require_once SmartSieve::getConf('lib_dir', 'lib') . '/Crypt.php';
+        require_once (new SmartSieve)->getConf('lib_dir', 'lib') . '/Crypt.php';
 
         $connstr = sprintf('{%s:%s}INBOX', $_SESSION['smartsieve']['server']['host'],
                            $_SESSION['smartsieve']['server']['imapport']);
-        $passwd = Crypto::decrypt($_SESSION['smartsieve']['passwd']);
-        $conn = imap_open($connstr, $_SESSION['smartsieve']['auth'], $passwd, OP_HALFOPEN);
+        $passwd = (new Crypto)->decrypt($_SESSION['smartsieve']['passwd']);
+        $conn = imap_open($connstr, $_SESSION['smartsieve']['auth'], $passwd, OP_HALFOPEN, 1, array('DISABLE_AUTHENTICATOR' => 'CRAM-MD5'));
         if ($conn) {
             $connstr = sprintf('{%s:%s}', $_SESSION['smartsieve']['server']['host'],
                                $_SESSION['smartsieve']['server']['imapport']);
@@ -702,8 +706,8 @@
                 return $mboxlist;
             }
         }
-        SmartSieve::setError(sprintf('ERROR: failed getting mailbox list: %s', imap_last_error()));
-        SmartSieve::log(sprintf('failed getting mailbox list for %s from %s: %s',
+        (new SmartSieve)->setError(sprintf('ERROR: failed getting mailbox list: %s', imap_last_error()));
+        (new SmartSieve)->log(sprintf('failed getting mailbox list for %s from %s: %s',
                                 $_SESSION['smartsieve']['auth'],
                                 $_SESSION['smartsieve']['server']['host'],
                                 imap_last_error()), LOG_ERR);
@@ -722,11 +726,11 @@
     * @param boolean $prependRoot Prepend the webroot
     * @return string The formatted url
     */
-    function setUrl($uri, $prependRoot=true)
+    public static function setUrl($uri, $prependRoot=true)
     {
         $url = '';
         if ($prependRoot) {
-            $baseurl = SmartSieve::getConf('baseurl', '/smartsieve/');
+            $baseurl = (new SmartSieve)->getConf('baseurl', '/smartsieve/');
             if (substr($baseurl, -1) != '/') {
                 $baseurl .= '/';
             }
@@ -750,7 +754,7 @@
     * @param string $var Value to remove magic quotes from
     * @return string Value stripped of any magic quotes
     */
-    function removeMagicQuotes($var)
+    public static function removeMagicQuotes($var)
     {
         static $magicQuotes;
         if (!isset($magicQuotes)) {
@@ -760,7 +764,7 @@
             if (is_array($var)) {
                 $new = array();
                 foreach ($var as $key=>$val) {
-                    $new[$key] = SmartSieve::removeMagicQuotes($val);
+                    $new[$key] = (new SmartSieve)->removeMagicQuotes($val);
                 }
                 return $new;
             }
@@ -776,9 +780,9 @@
     * @param mixed $def Default to return if value not found
     * @return mixed Value if set, or default if not (possibly null)
     */
-    function getGET($var, $def=null)
+    public static function getGET($var, $def=null)
     {
-        return (isset($_GET[$var])) ? SmartSieve::removeMagicQuotes($_GET[$var]) : $def;
+        return (isset($_GET[$var])) ? (new SmartSieve)->removeMagicQuotes($_GET[$var]) : $def;
     }
 
    /**
@@ -788,9 +792,9 @@
     * @param mixed $def Default to return if value not found
     * @return mixed Value if set, or default if not (possibly null)
     */
-    function getPOST($var, $def=null)
+    public static function getPOST($var, $def=null)
     {
-        return (isset($_POST[$var])) ? SmartSieve::removeMagicQuotes($_POST[$var]) : $def;
+        return (isset($_POST[$var])) ? (new SmartSieve)->removeMagicQuotes($_POST[$var]) : $def;
     }
 
    /**
@@ -800,10 +804,10 @@
     * @param mixed $def Default to return if value not found
     * @return mixed Value if set, or default if not
     */
-    function getFormValue($var, $def=null)
+    public static function getFormValue($var, $def=null)
     {
-        return (($val = SmartSieve::getPOST($var)) !== null) ? $val : 
-            SmartSieve::getGET($var, $def);
+        return (($val = (new SmartSieve)->getPOST($var)) !== null) ? $val : 
+            (new SmartSieve)->getGET($var, $def);
     }
 
    /**
@@ -813,9 +817,9 @@
     * @param string $string  The string to convert
     * @return string  UTF-8 encoded string
     */
-    function utf8Encode($string)
+    public static function utf8Encode($string)
     {
-        $charset = SmartSieve::getCharset();
+        $charset = (new SmartSieve)->getCharset();
 
         if (strtolower($charset) == 'utf-8') {
             return $string;
@@ -848,9 +852,9 @@
     * @param string $string  The UTF-8 string to convert
     * @return string  The decoded string
     */
-    function utf8Decode($string)
+    public static function utf8Decode($string)
     {
-        $charset = SmartSieve::getCharset();
+        $charset = (new SmartSieve)->getCharset();
 
         if (strtolower($charset) == 'utf-8') {
             return $string;

lib/base.php

--- data/lib/base.php.orig      2007-09-07 18:32:16.000000000 +0200
+++ data/lib/base.php   2014-03-24 00:49:50.000000000 +0100
@@ -8,12 +8,12 @@
  */
 
 require './lib/SmartSieve.lib';
-require SmartSieve::getConf('lib_dir', 'lib') . '/Managesieve.php';
-require SmartSieve::getConf('lib_dir', 'lib') . "/Script.php";
+require (new SmartSieve)->getConf('lib_dir', 'lib') . '/Managesieve.php';
+require (new SmartSieve)->getConf('lib_dir', 'lib') . "/Script.php";
 
 ini_set('session.use_trans_sid', 0);
-session_set_cookie_params(0, SmartSieve::getConf('cookie_path', '/smartsieve'), SmartSieve::getConf('cookie_domain', $_SERVER['SERVER_NAME']));
-session_name(SmartSieve::getConf('session_name', 'SmartSieve'));
+session_set_cookie_params(0, (new SmartSieve)->getConf('cookie_path', '/smartsieve'), (new SmartSieve)->getConf('cookie_domain', $_SERVER['SERVER_NAME']));
+session_name((new SmartSieve)->getConf('session_name', 'SmartSieve'));
 @session_start();
 
 ?>

login.php

--- data/login.php.orig 2007-09-07 18:31:06.000000000 +0200
+++ data/login.php      2014-03-24 00:49:50.000000000 +0100
@@ -9,14 +9,14 @@
 
 
 require './lib/base.php';
-require SmartSieve::getConf('config_dir', 'conf') . "/servers.php";
-require SmartSieve::getConf('config_dir', 'conf') . "/locales.php";
+require (new SmartSieve)->getConf('config_dir', 'conf') . "/servers.php";
+require (new SmartSieve)->getConf('config_dir', 'conf') . "/locales.php";
 
-$reason = SmartSieve::getFormValue('reason');
+$reason = (new SmartSieve)->getFormValue('reason');
 
 switch ($reason) {
     case ('logout'):
-        SmartSieve::logout();
+        (new SmartSieve)->logout();
         break;
 
     case ('failure'):
@@ -33,20 +33,20 @@
 if (isset($_SESSION['smartsieve']) && is_array($_SESSION['smartsieve'])) {
     // If we can authenticate redirect into the application.
     // If not, destroy current session.
-    if (SmartSieve::authenticate() === true) {
+    if ((new SmartSieve)->authenticate() === true) {
         header(sprintf('Location: %s',
-            SmartSieve::setUrl(SmartSieve::getConf('initial_page', 'main.php'))));
+            (new SmartSieve)->setUrl((new SmartSieve)->getConf('initial_page', 'main.php'))));
         exit;
     }
-    SmartSieve::destroy();
+    (new SmartSieve)->destroy();
     session_start();
 }
 
 // If login details have been submitted, create new session and redirect.
-if (($details = SmartSieve::getLoginDetails()) !== false) {
-    if (SmartSieve::login($details) === true) {
+if (($details = (new SmartSieve)->getLoginDetails()) !== false) {
+    if ((new SmartSieve)->login($details) === true) {
         header(sprintf('Location: %s',
-            SmartSieve::setUrl(SmartSieve::getConf('initial_page', 'main.php'))));
+            (new SmartSieve)->setUrl((new SmartSieve)->getConf('initial_page', 'main.php'))));
         exit;
     }
     $reason = 'failure';
@@ -65,15 +65,15 @@
 $srvkeys = array_keys($servers);
 $fsrv = (!empty($srvkeys)) ? $srvkeys[0] : '';
 
-$proxyusers = SmartSieve::getConf('proxy_authz_users', array());
+$proxyusers = (new SmartSieve)->getConf('proxy_authz_users', array());
 $proxyall = false;
 if (isset($proxyusers[0]) && $proxyusers[0] == 'all') {
     $proxyusers = array();
     $proxyall = true;
 }
 
-include SmartSieve::getConf('include_dir', 'include') . '/common-head.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/login.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/common-footer.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-head.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/login.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-footer.inc';
 
 ?>

main.php

--- data/main.php.orig  2007-09-07 18:31:06.000000000 +0200
+++ data/main.php       2015-07-13 12:15:13.000000000 +0200
@@ -18,13 +18,13 @@
 define("FORM_ACTION_CHANGEORDER", 'changeOrder');
 define("FORM_ACTION_VIEWSOURCE", 'viewSource');
 
-SmartSieve::checkAuthentication();
+(new SmartSieve)->checkAuthentication();
 
 $smartsieve = &$_SESSION['smartsieve'];
 
 // Change working script if requested.
 if (isset($_POST['script'])) {
-    SmartSieve::setWorkingScript(SmartSieve::getFormValue('script'));
+    (new SmartSieve)->setWorkingScript((new SmartSieve)->getFormValue('script'));
 }
 
 $script = &$_SESSION['scripts'][$_SESSION['smartsieve']['workingScript']];
@@ -32,13 +32,13 @@
 
 /* do rule status change if requested. */
 
-$action = SmartSieve::getFormValue('action');
+$action = (new SmartSieve)->getFormValue('action');
 
 switch ($action) {
 
     case (FORM_ACTION_ENABLE):
         $changes = false;
-        $ruleIDs = SmartSieve::getPOST('ruleID');
+        $ruleIDs = (new SmartSieve)->getPOST('ruleID');
         if (is_array($ruleIDs)) {
             foreach ($ruleIDs as $ruleID) {
                 if (($rule = $script->getRule($ruleID)) !== null) {
@@ -50,19 +50,19 @@
         }
         if ($changes === true) {
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
                 $logmsg = sprintf('failed writing script "%s" for %s: %s',
                   $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-                SmartSieve::log($logmsg, LOG_ERR);
+                (new SmartSieve)->log($logmsg, LOG_ERR);
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully enabled'));
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully enabled'));
             }
         }
         break;
 
     case (FORM_ACTION_DISABLE):
         $changes = false;
-        $ruleIDs = SmartSieve::getPOST('ruleID');
+        $ruleIDs = (new SmartSieve)->getPOST('ruleID');
         if (is_array($ruleIDs)) {
             foreach ($ruleIDs as $ruleID) {
                 if (($rule = $script->getRule($ruleID)) !== null) {
@@ -74,19 +74,19 @@
         }
         if ($changes === true) {
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
                 $logmsg = sprintf('failed writing script "%s" for %s: %s',
                   $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-                SmartSieve::log($logmsg, LOG_ERR);
+                (new SmartSieve)->log($logmsg, LOG_ERR);
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully disabled'));
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully disabled'));
             }
         }
         break;
 
     case (FORM_ACTION_DELETE):
         $changes = false;
-        $ruleIDs = SmartSieve::getPOST('ruleID');
+        $ruleIDs = (new SmartSieve)->getPOST('ruleID');
         if (is_array($ruleIDs)) {
             foreach ($ruleIDs as $ruleID) {
                 $changes = $script->deleteRule($ruleID);
@@ -94,61 +94,61 @@
         }
         if ($changes === true) {
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
                 $logmsg = sprintf('failed writing script "%s" for %s: %s',
                   $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-                SmartSieve::log($logmsg, LOG_ERR);
+                (new SmartSieve)->log($logmsg, LOG_ERR);
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully deleted'));
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully deleted'));
             }
         }
         break;
 
     case (FORM_ACTION_SAVE):
-        $script->content = SmartSieve::utf8Encode(SmartSieve::getFormValue('content'));
+        $script->content = (new SmartSieve)->utf8Encode((new SmartSieve)->getFormValue('content'));
         if (!$script->updateScript()) {
-            SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
             $logmsg = sprintf('failed writing script "%s" for %s: %s',
               $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-            SmartSieve::log($logmsg, LOG_ERR);
+            (new SmartSieve)->log($logmsg, LOG_ERR);
         } else {
-            SmartSieve::setNotice(SmartSieve::text('Your changes have been successfully saved'));
+            (new SmartSieve)->setNotice((new SmartSieve)->text('Your changes have been successfully saved'));
         }
         break;
 
     case (FORM_ACTION_CHANGEORDER):
-        $ridx = SmartSieve::getPOST('rindex');
-        $newidx = SmartSieve::getPOST('toPosition')-1;
+        $ridx = (new SmartSieve)->getPOST('rindex');
+        $newidx = (new SmartSieve)->getPOST('toPosition')-1;
         $script->changeRuleOrder($ridx, $newidx);
         if (!$script->updateScript()) {
-            SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
             $logmsg = sprintf('failed writing script "%s" for %s: %s',
                 $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-            SmartSieve::log($logmsg, LOG_ERR);
+            (new SmartSieve)->log($logmsg, LOG_ERR);
         }
         break;
 
     case ('direct'):
         $script->mode = 'advanced';
         if (!$script->updateScript()) {
-            SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
             $logmsg = sprintf('failed writing script "%s" for %s: %s',
               $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-            SmartSieve::log($logmsg, LOG_ERR);
+            (new SmartSieve)->log($logmsg, LOG_ERR);
         } else {
-            SmartSieve::setNotice(SmartSieve::text('You are now in direct edit mode'));
+            (new SmartSieve)->setNotice((new SmartSieve)->text('You are now in direct edit mode'));
         }
         break;
 
     case ('gui'):
         $script->mode = 'basic';
         if (!$script->updateScript()) {
-            SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
             $logmsg = sprintf('failed writing script "%s" for %s: %s',
               $script->name, $_SESSION['smartsieve']['authz'], $script->errstr);
-            SmartSieve::log($logmsg, LOG_ERR);
+            (new SmartSieve)->log($logmsg, LOG_ERR);
         } else {
-            SmartSieve::setNotice(SmartSieve::text('You are now in GUI mode'));
+            (new SmartSieve)->setNotice((new SmartSieve)->text('You are now in GUI mode'));
         }
         break;
 
@@ -160,70 +160,70 @@
 }
 
 
-$ret = $script->getContent();
+$ret = (new Script( $script ))->getContent();
 if ($ret === false) {
-    SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
-    SmartSieve::log(sprintf('failed reading rules from script "%s" for %s: %s',
+    (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
+    (new SmartSieve)->log(sprintf('failed reading rules from script "%s" for %s: %s',
         $script->name, $_SESSION['smartsieve']['authz'], $script->errstr), LOG_ERR);
 }
 
 $jsonload = '';
 $jsfile = ($script->mode == 'advanced' || $script->so == false) ? 'script-direct.js' : 'main.js';
-$help_url = SmartSieve::getConf('main_help_url', '');
+$help_url = (new SmartSieve)->getConf('main_help_url', '');
 
-include SmartSieve::getConf('include_dir', 'include') . '/common-head.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/menu.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/common_status.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-head.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/menu.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common_status.inc';
 
 if ($script->mode == 'advanced' || $script->so == false){
     if (isset($_POST['content'])) {
-        $content = SmartSieve::getPOST('content');
+        $content = (new SmartSieve)->getPOST('content');
     } else {
-        $content = SmartSieve::utf8Decode(Script::removeEncoding());
+        $content = (new SmartSieve)->utf8Decode((new Script($script))->removeEncoding());
     }
-    include SmartSieve::getConf('include_dir', 'include') . '/script-direct.inc';
+    include (new SmartSieve)->getConf('include_dir', 'include') . '/script-direct.inc';
 } else {
     $rows = array();
     for ($i=0; $i<count($script->rules); $i++) {
         $tr = array();
         $tr['summary'] = getSummary($script->rules[$i]);
         $tr['class'] = 'inactive';
-        $tr['statusImage'] = SmartSieve::getConf('image_dir', 'images') . '/disable.gif';
+        $tr['statusImage'] = (new SmartSieve)->getConf('image_dir', 'images') . '/disable.gif';
         $tr['statusChangeAction'] = FORM_ACTION_ENABLE;
-        $tr['statusChangeText'] = SmartSieve::text('Enable this rule');
+        $tr['statusChangeText'] = (new SmartSieve)->text('Enable this rule');
         if ($script->isRuleEnabled($i)) {
             $tr['class'] = 'active';
-            $tr['statusImage'] = SmartSieve::getConf('image_dir', 'images') . '/tick.gif';
+            $tr['statusImage'] = (new SmartSieve)->getConf('image_dir', 'images') . '/tick.gif';
             $tr['statusChangeAction'] = FORM_ACTION_DISABLE;
-            $tr['statusChangeText'] = SmartSieve::text('Disable this rule');
+            $tr['statusChangeText'] = (new SmartSieve)->text('Disable this rule');
         }
         $tr['id'] = $i;
         $tr['position'] = $i+1;
-        $tr['link'] = SmartSieve::setUrl(sprintf("rule.php?ruleID=%s", $i));
-        $tr['tooltip'] = SmartSieve::text('Edit this rule');
+        $tr['link'] = (new SmartSieve)->setUrl(sprintf("rule.php?ruleID=%s", $i));
+        $tr['tooltip'] = (new SmartSieve)->text('Edit this rule');
         if (!empty($script->rules[$i]['special'])) {
-            $tr['link'] = SmartSieve::setUrl(sprintf("rule.php?mode=%s", $script->rules[$i]['special']));
+            $tr['link'] = (new SmartSieve)->setUrl(sprintf("rule.php?mode=%s", $script->rules[$i]['special']));
             if ($script->rules[$i]['special'] == RULE_TAG_VACATION) {
-                $tr['tooltip'] = SmartSieve::text('Edit vacation settings');
-                $tr['img'] = SmartSieve::getConf('image_dir', 'images').'/vacation.gif';
+                $tr['tooltip'] = (new SmartSieve)->text('Edit vacation settings');
+                $tr['img'] = (new SmartSieve)->getConf('image_dir', 'images').'/vacation.gif';
             } elseif ($script->rules[$i]['special'] == RULE_TAG_FORWARD) {
-                $tr['tooltip'] = SmartSieve::text('Edit mail forwarding');
-                $tr['img'] = SmartSieve::getConf('image_dir', 'images').'/forward.gif';
+                $tr['tooltip'] = (new SmartSieve)->text('Edit mail forwarding');
+                $tr['img'] = (new SmartSieve)->getConf('image_dir', 'images').'/forward.gif';
             } elseif ($script->rules[$i]['special'] == RULE_TAG_SPAM) {
-                $tr['tooltip'] = SmartSieve::text('Edit spam filtering');
-                $tr['img'] = SmartSieve::getConf('image_dir', 'images').'/spam.gif';
+                $tr['tooltip'] = (new SmartSieve)->text('Edit spam filtering');
+                $tr['img'] = (new SmartSieve)->getConf('image_dir', 'images').'/spam.gif';
             } elseif ($script->rules[$i]['special'] == RULE_TAG_WHITELIST) {
-                $tr['tooltip'] = SmartSieve::text('Edit whitelist');
-                $tr['img'] = SmartSieve::getConf('image_dir', 'images').'/whitelist.gif';
+                $tr['tooltip'] = (new SmartSieve)->text('Edit whitelist');
+                $tr['img'] = (new SmartSieve)->getConf('image_dir', 'images').'/whitelist.gif';
             }
         }
         $rows[] = $tr;
     }
-    include SmartSieve::getConf('include_dir', 'include') . '/script-gui.inc';
+    include (new SmartSieve)->getConf('include_dir', 'include') . '/script-gui.inc';
 }
-include SmartSieve::getConf('include_dir', 'include') . '/common-footer.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-footer.inc';
 
-SmartSieve::close();
+(new SmartSieve)->close();
 
 
 /**
@@ -237,14 +237,14 @@
     global $script;
     static $useif = true;
     $started = 0;
-    $andor = sprintf(" %s ", ($rule['matchAny']) ? SmartSieve::text('OR') : SmartSieve::text('AND'));
+    $andor = sprintf(" %s ", ($rule['matchAny']) ? (new SmartSieve)->text('OR') : (new SmartSieve)->text('AND'));
 
-    if (Script::hasCondition($rule) == false) {
-        $complete = sprintf("[%s] ", SmartSieve::text('Unconditional'));
+    if ((new Script($script))->hasCondition($rule) == false) {
+        $complete = sprintf("[%s] ", (new SmartSieve)->text('Unconditional'));
     } elseif ($useif || $rule['control'] == CONTROL_IF) {
-        $complete = sprintf("%s ", SmartSieve::text('IF'));
+        $complete = sprintf("%s ", (new SmartSieve)->text('IF'));
     } else {
-        $complete = sprintf("%s ", SmartSieve::text('ELSE IF'));
+        $complete = sprintf("%s ", (new SmartSieve)->text('ELSE IF'));
     }
 
     foreach ($rule['conditions'] as $condition) {
@@ -253,19 +253,19 @@
             $match = getMatchType($condition['matchType'], isset($condition['not']) ? $condition['not'] : false);
             if ($condition['header'] == 'from') {
                 $complete .= sprintf("'From:' %s '%s'",
-                    $match, SmartSieve::utf8Decode($condition['matchStr']));
+                    $match, (new SmartSieve)->utf8Decode($condition['matchStr']));
                 $started = 1;
             } elseif ($condition['header'] == 'to') {
                 $complete .= sprintf("'To:' %s '%s'",
-                    $match, SmartSieve::utf8Decode($condition['matchStr']));
+                    $match, (new SmartSieve)->utf8Decode($condition['matchStr']));
                 $started = 1;
             } elseif ($condition['header'] == array('to', 'cc')) {
                 $complete .= sprintf("'To:' or 'Cc:' %s '%s'",
-                    $match, SmartSieve::utf8Decode($condition['matchStr']));
+                    $match, (new SmartSieve)->utf8Decode($condition['matchStr']));
                 $started = 1;
             } else {
                 $complete .= sprintf("'%s' %s '%s'", $condition['header'],
-                    $match, SmartSieve::utf8Decode($condition['matchStr']));
+                    $match, (new SmartSieve)->utf8Decode($condition['matchStr']));
                 $started = 1;
             }
         }
@@ -273,92 +273,92 @@
             $match = getMatchType($condition['matchType'], isset($condition['not']) ? $condition['not'] : false);
             if ($condition['header'] == 'subject') {
                 $complete .= sprintf("'Subject:' %s '%s'",
-                    $match, SmartSieve::utf8Decode($condition['matchStr']));
+                    $match, (new SmartSieve)->utf8Decode($condition['matchStr']));
             } else {
                 $complete .= sprintf("'%s' %s '%s'",
-                    SmartSieve::utf8Decode($condition['header']), $match,
-                    SmartSieve::utf8Decode($condition['matchStr']));
+                    (new SmartSieve)->utf8Decode($condition['header']), $match,
+                    (new SmartSieve)->utf8Decode($condition['matchStr']));
             }
             $started = 1;
         }
         if ($condition['type'] == TEST_SIZE) {
-            $complete .= SmartSieve::text("message %s '%sKB'", array(
-                ($condition['gthan']) ? SmartSieve::text('greater than') : SmartSieve::text('less than'),
+            $complete .= (new SmartSieve)->text("message %s '%sKB'", array(
+                ($condition['gthan']) ? (new SmartSieve)->text('greater than') : (new SmartSieve)->text('less than'),
                 $condition['kbytes']));
             $started = 1;
         }
         if ($condition['type'] == TEST_BODY) {
             $match = getMatchType($condition['matchType'], isset($condition['not']) ? $condition['not'] : false);
-            $complete .= SmartSieve::text("message body %s '%s'", array(
-                $match, SmartSieve::utf8Decode($condition['matchStr'])));
+            $complete .= (new SmartSieve)->text("message body %s '%s'", array(
+                $match, (new SmartSieve)->utf8Decode($condition['matchStr'])));
             $started = 1;
         }
     }
-    if (Script::hasCondition($rule)) {
-        $complete .= sprintf(" %s ", SmartSieve::text('THEN'));
+    if ((new Script($script))->hasCondition($rule)) {
+        $complete .= sprintf(" %s ", (new SmartSieve)->text('THEN'));
     }
     $started = false;
     foreach ($rule['actions'] as $action) {
         if ($started) {
-            $complete .= sprintf(" %s ", SmartSieve::text('AND'));
+            $complete .= sprintf(" %s ", (new SmartSieve)->text('AND'));
         }
         switch ($action['type']) {
             case (ACTION_FILEINTO):
-                $complete .= sprintf("%s '%s'", SmartSieve::text('file into'),
-                                     SmartSieve::mutf7Decode($action['folder']));
+                $complete .= sprintf("%s '%s'", (new SmartSieve)->text('file into'),
+                                     (new SmartSieve)->mutf7Decode($action['folder']));
                 break;
             case (ACTION_REDIRECT):
-                $complete .= sprintf("%s '%s'", SmartSieve::text('forward to'),
-                                     SmartSieve::utf8Decode($action['address']));
+                $complete .= sprintf("%s '%s'", (new SmartSieve)->text('forward to'),
+                                     (new SmartSieve)->utf8Decode($action['address']));
                 break;
             case (ACTION_REJECT):
-                $complete .= sprintf("%s '%s'", SmartSieve::text('reject'),
-                                     SmartSieve::utf8Decode($action['message']));
+                $complete .= sprintf("%s '%s'", (new SmartSieve)->text('reject'),
+                                     (new SmartSieve)->utf8Decode($action['message']));
                 break;
             case (ACTION_DISCARD):
-                $complete .= SmartSieve::text('discard');
+                $complete .= (new SmartSieve)->text('discard');
                 break;
             case (ACTION_KEEP):
-                $complete .= SmartSieve::text('Keep a copy');
+                $complete .= (new SmartSieve)->text('Keep a copy');
                 break;
             case (ACTION_STOP):
-                $complete .= SmartSieve::text('Stop processing');
+                $complete .= (new SmartSieve)->text('Stop processing');
                 break;
             case (ACTION_VACATION):
-                $complete .= SmartSieve::text('Respond');
+                $complete .= (new SmartSieve)->text('Respond');
                 if (!empty($action['addresses']) && is_array($action['addresses'])) {
-                    $complete .= sprintf(" %s ", SmartSieve::text('to mail sent to'));
+                    $complete .= sprintf(" %s ", (new SmartSieve)->text('to mail sent to'));
                     $first = true;
                     foreach ($action['addresses'] as $addr) {
                         $complete .= ($first) ? '' : ', ';
-                        $complete .= SmartSieve::utf8Decode($addr);
+                        $complete .= (new SmartSieve)->utf8Decode($addr);
                         $first = false;
                     }
                 }
                 $complete .= (!empty($action['days'])) ? sprintf(" %s ",
-                    SmartSieve::text("every %s days",array($action['days']))) : '';
+                    (new SmartSieve)->text("every %s days",array($action['days']))) : '';
                 $complete .= sprintf(" %s",
-                    SmartSieve::text('with message "%s"',array(SmartSieve::utf8Decode($action['message']))));
+                    (new SmartSieve)->text('with message "%s"',array((new SmartSieve)->utf8Decode($action['message']))));
                 break;
             case (ACTION_ADDFLAG):
-                $complete .= SmartSieve::text('set the "%s" flag', array($action['flag']));
+                $complete .= (new SmartSieve)->text('set the "%s" flag', array($action['flag']));
                 break;
             case (ACTION_NOTIFY):
                 if ($action['method'] == 'mailto') {
-                    $complete .= SmartSieve::text('send email notification to %s "%s"',
+                    $complete .= (new SmartSieve)->text('send email notification to %s "%s"',
                         array($action['options'], $action['message']));
                 } elseif ($action['method'] == 'sms') {
-                    $complete .= SmartSieve::text('send SMS notification to %s "%s"',
+                    $complete .= (new SmartSieve)->text('send SMS notification to %s "%s"',
                         array($action['options'], $action['message']));
                 } else {
-                    $complete .= SmartSieve::text('send notification to %s "%s"',
+                    $complete .= (new SmartSieve)->text('send notification to %s "%s"',
                         array($action['options'], $action['message']));
                 }
                 break;
             case (ACTION_CUSTOM):
                 // Scrap the above and just display the custom text.
-                $complete = sprintf("[%s] %s", SmartSieve::text('Custom Rule'),
-                                    SmartSieve::utf8Decode($action['sieve']));
+                $complete = sprintf("[%s] %s", (new SmartSieve)->text('Custom Rule'),
+                                    (new SmartSieve)->utf8Decode($action['sieve']));
                 continue 2;
                 break;
         }
@@ -366,7 +366,7 @@
     }
     if ($rule['status'] == 'ENABLED') {
         $useif = false;
-        if (Script::hasCondition($rule) == false) {
+        if ((new Script($script))->hasCondition($rule) == false) {
             $useif = true;
         }
     }
@@ -383,20 +383,20 @@
  */
 function getMatchType($matchType, $not=false)
 {
-    $translated = SmartSieve::text('contains');
+    $translated = (new SmartSieve)->text('contains');
     switch ($matchType) {
         case (MATCH_IS):
-            $translated = ($not) ? SmartSieve::text('is not') : SmartSieve::text('is');
+            $translated = ($not) ? (new SmartSieve)->text('is not') : (new SmartSieve)->text('is');
             break;
         case (MATCH_MATCHES):
-            $translated = ($not) ? SmartSieve::text('does not match') : SmartSieve::text('matches');
+            $translated = ($not) ? (new SmartSieve)->text('does not match') : (new SmartSieve)->text('matches');
             break;
         case (MATCH_REGEX):
-            $translated = ($not) ? SmartSieve::text('does not match regexp') : SmartSieve::text('matches regexp');
+            $translated = ($not) ? (new SmartSieve)->text('does not match regexp') : (new SmartSieve)->text('matches regexp');
             break;
         case (MATCH_CONTAINS):
         default:
-            $translated = ($not) ? SmartSieve::text('does not contain') : SmartSieve::text('contains');
+            $translated = ($not) ? (new SmartSieve)->text('does not contain') : (new SmartSieve)->text('contains');
             break;
     }
     return $translated;

rule.php

--- data/rule.php.orig  2007-09-07 18:31:06.000000000 +0200
+++ data/rule.php       2014-03-24 00:49:50.000000000 +0100
@@ -24,20 +24,20 @@
 define("FORM_ACTION_DELETE", 'delete');
 define("FORM_ACTION_SAVE", 'save');
 
-SmartSieve::checkAuthentication();
+(new SmartSieve)->checkAuthentication();
 
 $smartsieve = &$_SESSION['smartsieve'];
 $script = &$_SESSION['scripts'][$_SESSION['smartsieve']['workingScript']];
 
 // If not in GUI mode, redirect.
 if ($script->mode == 'advanced' || $script->so == false) {
-    header('Location: ' . SmartSieve::setUrl('main.php'));
+    header('Location: ' . (new SmartSieve)->setUrl('main.php'));
     exit;
 }
 
 // What kind of rule are we creating?
 $mode = SMARTSIEVE_RULE_MODE_GENERAL;
-if (($m = SmartSieve::getFormValue('mode')) !== null &&
+if (($m = (new SmartSieve)->getFormValue('mode')) !== null &&
     ($m == SMARTSIEVE_RULE_MODE_SPAM ||
      $m == SMARTSIEVE_RULE_MODE_FORWARD ||
      $m == SMARTSIEVE_RULE_MODE_CUSTOM ||
@@ -55,13 +55,13 @@
               'actions' => array(),
               );
 // Get form values from POST data.
-if (SmartSieve::getPOST('ruleID') !== null) {
-    $ruleID = SmartSieve::getPOST('ruleID');
+if ((new SmartSieve)->getPOST('ruleID') !== null) {
+    $ruleID = (new SmartSieve)->getPOST('ruleID');
     $rule = getPOSTValues();
 }
 // Use values from an existing rule.
-elseif (SmartSieve::getGET('ruleID') !== null) {
-    $ruleID = SmartSieve::getGET('ruleID');
+elseif ((new SmartSieve)->getGET('ruleID') !== null) {
+    $ruleID = (new SmartSieve)->getGET('ruleID');
     $rule = $script->getRule($ruleID);
 }
 // If using spam mode, look for an existing spam rule.
@@ -69,7 +69,7 @@
     $ruleID = $script->getSpecialRuleId(RULE_TAG_SPAM);
     if ($ruleID !== null) {
         $rule = $script->getRule($ruleID);
-    } elseif (($spam = SmartSieve::getConf('spam_filter')) !== null &&
+    } elseif (($spam = (new SmartSieve)->getConf('spam_filter')) !== null &&
                isset($spam['header']) &&
                isset($spam['matchStr']) &&
                isset($spam['matchType'])) {
@@ -87,7 +87,7 @@
     $ruleID = $script->getSpecialRuleId(RULE_TAG_FORWARD);
     if ($ruleID !== null) {
         $rule = $script->getRule($ruleID);
-    } elseif (SmartSieve::getConf('use_forward_mail_interface', true) == true) {
+    } elseif ((new SmartSieve)->getConf('use_forward_mail_interface', true) == true) {
         $rule['actions'][] = array('type'=>ACTION_REDIRECT, 'address'=>'');
     } else {
         $mode = SMARTSIEVE_RULE_MODE_GENERAL;
@@ -96,10 +96,10 @@
     $ruleID = $script->getSpecialRuleId(RULE_TAG_VACATION);
     if ($ruleID !== null) {
         $rule = $script->getRule($ruleID);
-    } elseif (SmartSieve::getConf('use_vacation_interface', true) == true) {
+    } elseif ((new SmartSieve)->getConf('use_vacation_interface', true) == true) {
         $rule['actions'][] = array('type'=>ACTION_VACATION,
                                    'message'=>'',
-                                   'days'=>SmartSieve::getConf('vacation_days', 7),
+                                   'days'=>(new SmartSieve)->getConf('vacation_days', 7),
                                    'addresses'=>array());
     } else {
         $mode = SMARTSIEVE_RULE_MODE_GENERAL;
@@ -108,7 +108,7 @@
     $ruleID = $script->getSpecialRuleId(RULE_TAG_WHITELIST);
     if ($ruleID !== null) {
         $rule = $script->getRule($ruleID);
-    } elseif (SmartSieve::getConf('use_whitelist', true) == true) {
+    } elseif ((new SmartSieve)->getConf('use_whitelist', true) == true) {
         $rule['conditions'][] = array('type'=>TEST_ADDRESS,
                                     'header'=>'from',
                                     'matchStr'=>'',
@@ -126,7 +126,7 @@
 }
 // If this is a new custom rule, display custom rule interface only if permitted to do so.
 if ($mode == SMARTSIEVE_RULE_MODE_CUSTOM && empty($ruleID)) {
-    if (SmartSieve::getConf('allow_custom', true) !== false) {
+    if ((new SmartSieve)->getConf('allow_custom', true) !== false) {
         $rule['actions'][] = array('type'=>ACTION_CUSTOM, 'sieve'=>'');
     } else {
         $mode = SMARTSIEVE_RULE_MODE_GENERAL;
@@ -139,13 +139,13 @@
 foreach ($rule['actions'] as $action) {
     if ($action['type'] == ACTION_FILEINTO &&
         $_SESSION['smartsieve']['auth'] == $_SESSION['smartsieve']['authz']) {
-        $mailboxes = SmartSieve::getMailboxList();
+        $mailboxes = (new SmartSieve)->getMailboxList();
     }
 }
 
 // Perform actions.
 
-$action = SmartSieve::getFormValue('thisAction');
+$action = (new SmartSieve)->getFormValue('thisAction');
 
 switch ($action) {
 
@@ -156,11 +156,11 @@
             if (isset($script->rules[$ruleID])) {
                 $ruleID = $script->saveRule($rule, $ruleID);
             } else {
-                $ruleID = $script->addRule($rule, (int)SmartSieve::getPOST('position'));
+                $ruleID = $script->addRule($rule, (int)(new SmartSieve)->getPOST('position'));
             }
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
-                SmartSieve::log(sprintf('failed writing script "%s" for %s: %s',
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->log(sprintf('failed writing script "%s" for %s: %s',
                     $script->name, $_SESSION['smartsieve']['authz'], $script->errstr), LOG_ERR);
                 if ($oldrule) {
                     $ruleID = $script->saveRule($oldrule, $ruleID);
@@ -168,9 +168,9 @@
                     $script->deleteRule($ruleID);
                 }
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully enabled'));
-                if (SmartSieve::getConf('return_after_update') === true) {
-                    header('Location: ' . SmartSieve::setUrl('main.php'),true);
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully enabled'));
+                if ((new SmartSieve)->getConf('return_after_update') === true) {
+                    header('Location: ' . (new SmartSieve)->setUrl('main.php'),true);
                     exit;
                 }
             }
@@ -184,11 +184,11 @@
             if (isset($script->rules[$ruleID])) {
                 $ruleID = $script->saveRule($rule, $ruleID);
             } else {
-                $ruleID = $script->addRule($rule, (int)SmartSieve::getPOST('position'));
+                $ruleID = $script->addRule($rule, (int)(new SmartSieve)->getPOST('position'));
             }
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
-                SmartSieve::log(sprintf('failed writing script "%s" for %s: %s',
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->log(sprintf('failed writing script "%s" for %s: %s',
                     $script->name, $_SESSION['smartsieve']['authz'], $script->errstr), LOG_ERR);
                 if ($oldrule) {
                     $ruleID = $script->saveRule($oldrule, $ruleID);
@@ -196,9 +196,9 @@
                     $script->deleteRule($ruleID);
                 }
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully disabled'));
-                if (SmartSieve::getConf('return_after_update') === true) {
-                    header('Location: ' . SmartSieve::setUrl('main.php'),true);
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully disabled'));
+                if ((new SmartSieve)->getConf('return_after_update') === true) {
+                    header('Location: ' . (new SmartSieve)->setUrl('main.php'),true);
                     exit;
                 }
             }
@@ -209,19 +209,19 @@
         $oldrule = $script->getRule($ruleID);
         if ($script->deleteRule($ruleID)) {
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
-                SmartSieve::log(sprintf('failed writing script "%s" for %s: %s',
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->log(sprintf('failed writing script "%s" for %s: %s',
                     $script->name, $_SESSION['smartsieve']['authz'], $script->errstr), LOG_ERR);
                 if ($oldrule) {
                     $ruleID = $script->saveRule($oldrule, $ruleID);
                 }
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Rule successfully deleted'));
-                header('Location: ' . SmartSieve::setUrl('main.php'),true);
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Rule successfully deleted'));
+                header('Location: ' . (new SmartSieve)->setUrl('main.php'),true);
                 exit;
             }
         } else {
-            SmartSieve::setError(SmartSieve::text('ERROR: rule does not exist.'));
+            (new SmartSieve)->setError((new SmartSieve)->text('ERROR: rule does not exist.'));
         }
         break;
 
@@ -231,11 +231,11 @@
             if (isset($script->rules[$ruleID])) {
                 $ruleID = $script->saveRule($rule, $ruleID);
             } else {
-                $ruleID = $script->addRule($rule, (int)SmartSieve::getPOST('position'));
+                $ruleID = $script->addRule($rule, (int)(new SmartSieve)->getPOST('position'));
             }
             if (!$script->updateScript()) {
-                SmartSieve::setError(SmartSieve::text('ERROR: ') . $script->errstr);
-                SmartSieve::log(sprintf('failed writing script "%s" for %s: %s',
+                (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $script->errstr);
+                (new SmartSieve)->log(sprintf('failed writing script "%s" for %s: %s',
                     $script->name, $_SESSION['smartsieve']['authz'], $script->errstr), LOG_ERR);
                 if ($oldrule) {
                     $ruleID = $script->saveRule($oldrule, $ruleID);
@@ -243,9 +243,9 @@
                     $script->deleteRule($ruleID);
                 }
             } else {
-                SmartSieve::setNotice(SmartSieve::text('Your changes have been successfully saved'));
-                if (SmartSieve::getConf('return_after_update') === true) {
-                    header('Location: ' . SmartSieve::setUrl('main.php'),true);
+                (new SmartSieve)->setNotice((new SmartSieve)->text('Your changes have been successfully saved'));
+                if ((new SmartSieve)->getConf('return_after_update') === true) {
+                    header('Location: ' . (new SmartSieve)->setUrl('main.php'),true);
                     exit;
                 }
             }
@@ -256,10 +256,10 @@
 
 $jsfile = 'rule.js';
 $jsonload = '';
-$wrap_width = (SmartSieve::getConf('wrap_width')) ? SmartSieve::getConf('wrap_width') : 80;
+$wrap_width = ((new SmartSieve)->getConf('wrap_width')) ? (new SmartSieve)->getConf('wrap_width') : 80;
 // Define a list of imap flags to make available to the addflag action.
-$imapFlags = SmartSieve::getConf('imap_flags', array('\\\\Seen', '\\\\Deleted', '\\\\Answered', '\\\\Flagged', 'Junk', 'NotJunk', '$Label1', '$Label2', '$Label3', '$Label4', '$Label5'));
-$notifyMethods = SmartSieve::getConf('notify_methods', array());
+$imapFlags = (new SmartSieve)->getConf('imap_flags', array('\\\\Seen', '\\\\Deleted', '\\\\Answered', '\\\\Flagged', 'Junk', 'NotJunk', '$Label1', '$Label2', '$Label3', '$Label4', '$Label5'));
+$notifyMethods = (new SmartSieve)->getConf('notify_methods', array());
 
 // Add dummy condition and action for "Add action" widgits.
 $rule['conditions'][] = array('type' => 'new');
@@ -267,38 +267,38 @@
 
 switch ($mode) {
     case (SMARTSIEVE_RULE_MODE_SPAM):
-        $help_url = SmartSieve::getConf('spam_help_url', '');
+        $help_url = (new SmartSieve)->getConf('spam_help_url', '');
         $template = '/spam.inc';
         break;
     case (SMARTSIEVE_RULE_MODE_FORWARD):
-        $help_url = SmartSieve::getConf('forward_help_url', '');
+        $help_url = (new SmartSieve)->getConf('forward_help_url', '');
         $template = '/forward.inc';
         break;
     case (SMARTSIEVE_RULE_MODE_CUSTOM):
-        $help_url = SmartSieve::getConf('custom_help_url', '');
+        $help_url = (new SmartSieve)->getConf('custom_help_url', '');
         $template = '/custom.inc';
         break;
     case (SMARTSIEVE_RULE_MODE_VACATION):
-        $help_url = SmartSieve::getConf('vacation_help_url', '');
+        $help_url = (new SmartSieve)->getConf('vacation_help_url', '');
         $template = '/vacation.inc';
         break;
     case (SMARTSIEVE_RULE_MODE_WHITELIST):
-        $help_url = SmartSieve::getConf('whitelist_help_url', '');
+        $help_url = (new SmartSieve)->getConf('whitelist_help_url', '');
         $template = '/whitelist.inc';
         break;
     default:
-        $help_url = SmartSieve::getConf('rule_help_url', '');
+        $help_url = (new SmartSieve)->getConf('rule_help_url', '');
         $template = '/rule.inc';
         break;
 }
 
-include SmartSieve::getConf('include_dir', 'include') . '/common-head.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/menu.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/common_status.inc';
-include SmartSieve::getConf('include_dir', 'include') . $template;
-include SmartSieve::getConf('include_dir', 'include') . '/common-footer.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-head.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/menu.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common_status.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . $template;
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-footer.inc';
 
-SmartSieve::close();
+(new SmartSieve)->close();
 
 
 /**
@@ -309,16 +309,16 @@
 function getPOSTValues()
 {
     $rule = array();
-    $rule['status'] = SmartSieve::getPOST('status', 'ENABLED');
-    $rule['control'] = SmartSieve::getPOST('control');
-    $rule['matchAny'] = SmartSieve::getPOST('anyof');
+    $rule['status'] = (new SmartSieve)->getPOST('status', 'ENABLED');
+    $rule['control'] = (new SmartSieve)->getPOST('control');
+    $rule['matchAny'] = (new SmartSieve)->getPOST('anyof');
     $rule['conditions'] = array();
-    $special = SmartSieve::getPOST('special');
+    $special = (new SmartSieve)->getPOST('special');
     if (!empty($special)) {
         $rule['special'] = $special;
     }
     $i = 0;
-    while (($type = SmartSieve::getPOST('condition' . $i)) !== null) {
+    while (($type = (new SmartSieve)->getPOST('condition' . $i)) !== null) {
         $condition = array();
         switch ($type) {
             case ('new'):
@@ -326,40 +326,40 @@
             case ('from'):
                 $condition['type'] = TEST_ADDRESS;
                 $condition['header'] = 'from';
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('matchStr'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('matchStr'.$i));
                 break;
             case ('to'):
                 $condition['type'] = TEST_ADDRESS;
                 $condition['header'] = 'to';
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('matchStr'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('matchStr'.$i));
                 break;
             case ('tocc'):
                 $condition['type'] = TEST_ADDRESS;
                 $condition['header'] = array('to', 'cc');
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('matchStr'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('matchStr'.$i));
                 break;
             case ('subject'):
                 $condition['type'] = TEST_HEADER;
                 $condition['header'] = 'subject';
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('matchStr'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('matchStr'.$i));
                 break;
             case ('size'):
                 $condition['type'] = TEST_SIZE;
-                $condition['gthan'] = SmartSieve::getPOST('gthan'.$i);
-                $condition['kbytes'] = SmartSieve::getPOST('size'.$i);
+                $condition['gthan'] = (new SmartSieve)->getPOST('gthan'.$i);
+                $condition['kbytes'] = (new SmartSieve)->getPOST('size'.$i);
                 break;
             case ('header'):
                 $condition['type'] = TEST_HEADER;
-                $condition['header'] = SmartSieve::utf8Encode(SmartSieve::getPOST('header'.$i));
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('headerMatchStr'.$i));
+                $condition['header'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('header'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('headerMatchStr'.$i));
                 break;
             case ('body'):
                 $condition['type'] = TEST_BODY;
-                $condition['matchStr'] = SmartSieve::utf8Encode(SmartSieve::getPOST('bodyMatchStr'.$i));
+                $condition['matchStr'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('bodyMatchStr'.$i));
                 break;
         }
         if ($type != 'new' && ($condition['type'] == TEST_ADDRESS || $condition['type'] == TEST_HEADER || $condition['type'] == TEST_BODY)) {
-            $matchType = SmartSieve::getPOST('matchType'.$i);
+            $matchType = (new SmartSieve)->getPOST('matchType'.$i);
             switch ($matchType) {
                 case ('is'):
                     $condition['matchType'] = MATCH_IS;
@@ -393,29 +393,29 @@
             }
         }
         // If delete value set, ignore this condition.
-        if (SmartSieve::getPOST('delete' . $i++) == '1' || $type == 'new') {
+        if ((new SmartSieve)->getPOST('delete' . $i++) == '1' || $type == 'new') {
             continue;
         }
         $rule['conditions'][] = $condition;
     }
     $rule['actions'] = array();
     $i = 0;
-    while (($type = SmartSieve::getPOST('action' . $i)) !== null) {
+    while (($type = (new SmartSieve)->getPOST('action' . $i)) !== null) {
         $action = array();
         switch ($type) {
             case ('new'):
                 break;
             case (ACTION_FILEINTO):
                 $action['type'] = ACTION_FILEINTO;
-                $action['folder'] = SmartSieve::getPOST(ACTION_FILEINTO . $i);
+                $action['folder'] = (new SmartSieve)->getPOST(ACTION_FILEINTO . $i);
                 break;
             case (ACTION_REDIRECT):
                 $action['type'] = ACTION_REDIRECT;
-                $action['address'] = SmartSieve::utf8Encode(SmartSieve::getPOST(ACTION_REDIRECT . $i));
+                $action['address'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST(ACTION_REDIRECT . $i));
                 break;
             case (ACTION_REJECT):
                 $action['type'] = ACTION_REJECT;
-                $action['message'] = SmartSieve::utf8Encode(SmartSieve::getPOST(ACTION_REJECT . $i));
+                $action['message'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST(ACTION_REJECT . $i));
                 break;
             case (ACTION_DISCARD):
                 $action['type'] = ACTION_DISCARD;
@@ -428,20 +428,20 @@
                 break;
             case (ACTION_CUSTOM):
                 $action['type'] = ACTION_CUSTOM;
-                $action['sieve'] = SmartSieve::utf8Encode(SmartSieve::getPOST('sieve'));
+                $action['sieve'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('sieve'));
                 break;
             case (ACTION_VACATION):
                 $action['type'] = ACTION_VACATION;
-                $action['message'] = SmartSieve::utf8Encode(SmartSieve::getPOST('message'.$i));
-                $action['days'] = SmartSieve::getPOST('days'.$i);
-                $addrs = SmartSieve::getFormValue('address'.$i);
+                $action['message'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('message'.$i));
+                $action['days'] = (new SmartSieve)->getPOST('days'.$i);
+                $addrs = (new SmartSieve)->getFormValue('address'.$i);
                 $addresses = array();
                 if (is_array($addrs)) {
                     foreach ($addrs as $addr) {
-                        $addresses[] = SmartSieve::utf8Encode($addr);
+                        $addresses[] = (new SmartSieve)->utf8Encode($addr);
                     }
                 }
-                $newAddrs = SmartSieve::utf8Encode(SmartSieve::getFormValue('newaddresses'.$i));
+                $newAddrs = (new SmartSieve)->utf8Encode((new SmartSieve)->getFormValue('newaddresses'.$i));
                 $newAddrs = preg_replace("/\"|\\\/", "", $newAddrs);
                 $addrs = preg_split("/\s*,\s*|\s+/", $newAddrs);
                 foreach ($addrs as $addr) {
@@ -453,17 +453,17 @@
                 break;
             case (ACTION_ADDFLAG):
                 $action['type'] = ACTION_ADDFLAG;
-                $action['flag'] = SmartSieve::getPOST(ACTION_ADDFLAG.$i);
+                $action['flag'] = (new SmartSieve)->getPOST(ACTION_ADDFLAG.$i);
                 break;
             case (ACTION_NOTIFY):
                 $action['type'] = ACTION_NOTIFY;
-                $action['method'] = SmartSieve::getPOST('notify_method'.$i);
-                $action['options'] = SmartSieve::utf8Encode(SmartSieve::getPOST('notify_options'.$i));
-                $action['message'] = SmartSieve::utf8Encode(SmartSieve::getPOST('message'.$i));
+                $action['method'] = (new SmartSieve)->getPOST('notify_method'.$i);
+                $action['options'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('notify_options'.$i));
+                $action['message'] = (new SmartSieve)->utf8Encode((new SmartSieve)->getPOST('message'.$i));
                 break;
         }
         // If delete value set, ignore this condition.
-        if (SmartSieve::getPOST('deleteAction' . $i++) == '1' || $type == 'new') {
+        if ((new SmartSieve)->getPOST('deleteAction' . $i++) == '1' || $type == 'new') {
             continue;
         }
         $rule['actions'][] = $action;
@@ -482,8 +482,8 @@
  */
 function isSane($rule)
 {
-    $max_field_chars = SmartSieve::getConf('max_field_chars', 500);
-    $max_textbox_chars = SmartSieve::getConf('max_textbox_chars', 50000);
+    $max_field_chars = (new SmartSieve)->getConf('max_field_chars', 500);
+    $max_textbox_chars = (new SmartSieve)->getConf('max_textbox_chars', 50000);
 
     // Condition checks.
 
@@ -492,31 +492,31 @@
         if ($condition['type'] == TEST_ADDRESS || $condition['type'] == TEST_HEADER) {
             if (($condition['type'] == TEST_HEADER && strlen($condition['header']) > $max_field_chars) ||
                 strlen($condition['matchStr']) > $max_field_chars) {
-                SmartSieve::setError(SmartSieve::text('The condition value you supplied is too long. It should not exceed %d characters.', array($max_field_chars)));
+                (new SmartSieve)->setError((new SmartSieve)->text('The condition value you supplied is too long. It should not exceed %d characters.', array($max_field_chars)));
                 return false;
             }
         }
         if ($condition['type'] == TEST_SIZE) {
             // Message size must not contain non-digits.
             if (preg_match("/\D/", $condition['kbytes'])) {
-                SmartSieve::setError(SmartSieve::text('Message size value must be a positive integer'));
+                (new SmartSieve)->setError((new SmartSieve)->text('Message size value must be a positive integer'));
                 return false;
             }
         }
         if ($condition['type'] == TEST_HEADER) {
             if (empty($condition['header'])) {
-                SmartSieve::setError(SmartSieve::text('Please supply a message header to match on'));
+                (new SmartSieve)->setError((new SmartSieve)->text('Please supply a message header to match on'));
                 return false;
             }
             if (empty($condition['matchStr'])) {
-                SmartSieve::setError(SmartSieve::text('You must supply a value for the header "%s"',
+                (new SmartSieve)->setError((new SmartSieve)->text('You must supply a value for the header "%s"',
                     array($condition['header'])));
                 return false;
             }
         }
         if ($condition['type'] == TEST_BODY) {
             if (empty($condition['matchStr'])) {
-                SmartSieve::setError(SmartSieve::text('You must supply a value to match in the message body'));
+                (new SmartSieve)->setError((new SmartSieve)->text('You must supply a value to match in the message body'));
                 return false;
             }
         }
@@ -526,7 +526,7 @@
 
     // Rule must have an action.
     if (empty($rule['actions'])) {
-        SmartSieve::setError(SmartSieve::text('Please supply an action'));
+        (new SmartSieve)->setError((new SmartSieve)->text('Please supply an action'));
         return false;
     }
     foreach ($rule['actions'] as $action) {
@@ -538,68 +538,68 @@
             ($action['type'] == ACTION_ADDFLAG && empty($action['flag'])) ||
             ($action['type'] == ACTION_NOTIFY && empty($action['message'])) ||
             ($action['type'] == ACTION_CUSTOM && empty($action['sieve']))) {
-            SmartSieve::setError(SmartSieve::text('You must supply an argument for this action'));
+            (new SmartSieve)->setError((new SmartSieve)->text('You must supply an argument for this action'));
             return false;
         }
         if ($action['type'] == ACTION_FILEINTO) {
             if (!empty($GLOBALS['mailboxes']) && !in_array($action['folder'], $GLOBALS['mailboxes'])) {
-                SmartSieve::setError(SmartSieve::text('The folder "%s" does not exist', array($action['folder'])));
+                (new SmartSieve)->setError((new SmartSieve)->text('The folder "%s" does not exist', array($action['folder'])));
                 return false;
             }
         }
         if ($action['type'] == ACTION_REDIRECT) {
             if (strlen($action['address']) > $max_field_chars) {
-                SmartSieve::setError(SmartSieve::text('The email address you supplied is too long. It should not exceed %d characters', array($max_field_chars)));
+                (new SmartSieve)->setError((new SmartSieve)->text('The email address you supplied is too long. It should not exceed %d characters', array($max_field_chars)));
                 return false;
             }
             if (!preg_match("/^[\x21-\x7E]+@([0-9a-zA-Z-]+\.)+[0-9a-zA-Z]{2,}$/i", $action['address'])) {
-            SmartSieve::setError(SmartSieve::text('"%s" is not a valid email address',
+            (new SmartSieve)->setError((new SmartSieve)->text('"%s" is not a valid email address',
                 array(htmlspecialchars($action['address']))));
                 return false;
             }
         }
         if ($action['type'] == ACTION_REJECT) {
             if (strlen($action['message']) > $max_textbox_chars) {
-                SmartSieve::setError(SmartSieve::text('Your reject message is too long. It should not exceed %d characters', array($max_textbox_chars)));
+                (new SmartSieve)->setError((new SmartSieve)->text('Your reject message is too long. It should not exceed %d characters', array($max_textbox_chars)));
                 return false;
             }
         }
         if ($action['type'] == ACTION_VACATION) {
             if (strlen($action['message']) > $max_textbox_chars) {
-                SmartSieve::setError(SmartSieve::text('Your vacation message must not exceed %d characters',
+                (new SmartSieve)->setError((new SmartSieve)->text('Your vacation message must not exceed %d characters',
                     array($max_textbox_chars)));
                 return false;
             }
             foreach ($action['addresses'] as $addr) {
                 if (!preg_match("/^[\x21-\x7E]+@([0-9a-zA-Z-]+\.)+[0-9a-zA-Z]{2,}$/i", $addr)) {
-                    SmartSieve::setError(SmartSieve::text('"%s" is not a valid email address',
+                    (new SmartSieve)->setError((new SmartSieve)->text('"%s" is not a valid email address',
                         array(htmlspecialchars($addr))));
                     return false;
                 }
             }
             if (!is_numeric($action['days'])) {
-                SmartSieve::setError(SmartSieve::text('Vacation days must be a positive integer'));
+                (new SmartSieve)->setError((new SmartSieve)->text('Vacation days must be a positive integer'));
                 return false;
             }
         }
         if ($action['type'] == ACTION_ADDFLAG) {
-            $allowed = SmartSieve::getConf('imap_flags', array('\\\\Seen', '\\\\Deleted', '\\\\Answered', '\\\\Flagged', 'Junk', 'NotJunk', '$Label1', '$Label2', '$Label3', '$Label4', '$Label5'));
+            $allowed = (new SmartSieve)->getConf('imap_flags', array('\\\\Seen', '\\\\Deleted', '\\\\Answered', '\\\\Flagged', 'Junk', 'NotJunk', '$Label1', '$Label2', '$Label3', '$Label4', '$Label5'));
             if (!in_array($action['flag'], $allowed)) {
-                SmartSieve::setError(SmartSieve::text('This flag is not permitted'));
+                (new SmartSieve)->setError((new SmartSieve)->text('This flag is not permitted'));
                 return false;
             }
         }
         if ($action['type'] == ACTION_NOTIFY) {
-            $allowed = SmartSieve::getConf('notify_methods', array());
+            $allowed = (new SmartSieve)->getConf('notify_methods', array());
             if (!in_array($action['method'], $allowed)) {
-                SmartSieve::setError(SmartSieve::text('This notify method is not permitted'));
+                (new SmartSieve)->setError((new SmartSieve)->text('This notify method is not permitted'));
                 return false;
             }
         }
     }
 
     // Call is_sane_hook callback function, if defined.
-    if (($func = SmartSieve::getConf('is_sane_hook')) !== null &&
+    if (($func = (new SmartSieve)->getConf('is_sane_hook')) !== null &&
             function_exists($func)) {
             return call_user_func($func, $rule);
     }
@@ -622,20 +622,20 @@
     $all = array();
     if (is_array($addresses)) {
         foreach ($addresses as $address) {
-            $all[SmartSieve::utf8Decode($address)] = true;
+            $all[(new SmartSieve)->utf8Decode($address)] = true;
         }
     }
     static $extra_addresses;
     if (!isset($extra_addresses)) {
         $extra_addresses = array();
-        if (($func = SmartSieve::getConf('get_email_addresses_hook')) !== null &&
+        if (($func = (new SmartSieve)->getConf('get_email_addresses_hook')) !== null &&
             function_exists($func)) {
             $extra_addresses = call_user_func($func);
         }
     }
     foreach ($extra_addresses as $addr) {
         if (!in_array($addr, $addresses)) {
-            $all[SmartSieve::utf8Decode($addr)] = false;
+            $all[(new SmartSieve)->utf8Decode($addr)] = false;
         }
     }
     // Try some other options if have no addresses.

scripts.php

--- data/scripts.php.orig       2007-09-07 18:31:06.000000000 +0200
+++ data/scripts.php    2014-03-24 00:49:50.000000000 +0100
@@ -18,7 +18,7 @@
 define("FORM_ACTION_RENAME", 'rename');
 define("FORM_ACTION_EDIT", 'edit');
 
-SmartSieve::checkAuthentication();
+(new SmartSieve)->checkAuthentication();
 
 $smartsieve = &$_SESSION['smartsieve'];
 $scripts = &$_SESSION['scripts'];
@@ -27,23 +27,23 @@
 
 /* do script actions if necessary. */
 
-$action = SmartSieve::getFormValue('action');
+$action = (new SmartSieve)->getFormValue('action');
 
 switch ($action) {
 
     case (FORM_ACTION_ACTIVATE):
-        $sids = SmartSieve::getFormValue('scriptID');
+        $sids = (new SmartSieve)->getFormValue('scriptID');
         if (is_array($sids)){
             // might have been more than one checkbox selected.
             // set only the first one active.
-            $slist = array_keys(SmartSieve::getScriptList());
+            $slist = array_keys((new SmartSieve)->getScriptList());
             if (isset($slist[$sids[0]])) {
                 $s = $slist[$sids[0]];
                 $ret = $managesieve->setActive($s);
                 if ($ret === false) {
-                    SmartSieve::setError(SmartSieve::text('activatescript failed').': ' . $managesieve->getError());
+                    (new SmartSieve)->setError((new SmartSieve)->text('activatescript failed').': ' . $managesieve->getError());
                 } else {
-                    SmartSieve::setNotice(SmartSieve::text('Script "%s" successfully activated', array($s)));
+                    (new SmartSieve)->setNotice((new SmartSieve)->text('Script "%s" successfully activated', array($s)));
                 }
             }
         }
@@ -54,54 +54,54 @@
         // as the active script, so we don't care about the scriptID array.
         $ret = $managesieve->setActive('');
         if ($ret === false) {
-            SmartSieve::setError(SmartSieve::text('activatescript failed').': ' . $managesieve->getError());
+            (new SmartSieve)->setError((new SmartSieve)->text('activatescript failed').': ' . $managesieve->getError());
         } else {
-            SmartSieve::setNotice(SmartSieve::text('Successfully deactivated all scripts'));
+            (new SmartSieve)->setNotice((new SmartSieve)->text('Successfully deactivated all scripts'));
         }
         break;
 
     case (FORM_ACTION_CREATE):
-        $newscript = SmartSieve::getFormValue('newscript');
+        $newscript = (new SmartSieve)->getFormValue('newscript');
         if ($newscript){
-            if (SmartSieve::scriptExists($newscript)) {
-                SmartSieve::setError(SmartSieve::text('Script "%s" already exists', array($newscript)));
+            if ((new SmartSieve)->scriptExists($newscript)) {
+                (new SmartSieve)->setError((new SmartSieve)->text('Script "%s" already exists', array($newscript)));
             } else {
                 if (!isset($scripts[$newscript]) || !is_object($scripts[$newscript])) {
                     $scripts[$newscript] = new Script($newscript);
                 }
                 if (!$scripts[$newscript]->updateScript()) {
-                    SmartSieve::setError(SmartSieve::text('ERROR: ') . $scripts[$newscript]->errstr);
-                    SmartSieve::log(sprintf('failed writing script "%s" for %s: %s',
+                    (new SmartSieve)->setError((new SmartSieve)->text('ERROR: ') . $scripts[$newscript]->errstr);
+                    (new SmartSieve)->log(sprintf('failed writing script "%s" for %s: %s',
                         $scripts[$newscript]->name, $_SESSION['smartsieve']['authz'], $scripts[$newscript]->errstr), LOG_ERR);
                 }
-                if (SmartSieve::scriptExists($newscript)) {
-                    SmartSieve::setNotice(SmartSieve::text('Successfully created script "%s"', array($newscript)));
+                if ((new SmartSieve)->scriptExists($newscript)) {
+                    (new SmartSieve)->setNotice((new SmartSieve)->text('Successfully created script "%s"', array($newscript)));
                 } else {
-                    SmartSieve::setError(SmartSieve::text('Could not create script "%s"', array($newscript)));
+                    (new SmartSieve)->setError((new SmartSieve)->text('Could not create script "%s"', array($newscript)));
                 }
             }
         }
         break;
 
     case (FORM_ACTION_DELETE):
-        $sids = SmartSieve::getFormValue('scriptID');
+        $sids = (new SmartSieve)->getFormValue('scriptID');
         if (is_array($sids)){
             // might have been more than one checkbox selected.
             // try to delete each one in turn.
             foreach ($sids as $sid){
-                $slist = array_keys(SmartSieve::getScriptList());
+                $slist = array_keys((new SmartSieve)->getScriptList());
                 if (isset($slist[$sid])) {
                     $sname = $slist[$sid];
                     $ret = $managesieve->deleteScript($sname);
                     if ($ret === false) {
-                        SmartSieve::setError('deletescript '.SmartSieve::text('failed: ') . $managesieve->getError());
+                        (new SmartSieve)->setError('deletescript '.(new SmartSieve)->text('failed: ') . $managesieve->getError());
                     } else {
-                        SmartSieve::setNotice(SmartSieve::text('Script "%s" successfully deleted', array($sname)));
+                        (new SmartSieve)->setNotice((new SmartSieve)->text('Script "%s" successfully deleted', array($sname)));
                         if (isset($scripts[$sname])) {
                             unset($scripts[$sname]);
                         }
                         if ($_SESSION['smartsieve']['workingScript'] == $sname) {
-                            SmartSieve::setWorkingScript();
+                            (new SmartSieve)->setWorkingScript();
                         }
                     }
                 }
@@ -111,51 +111,51 @@
 
     case (FORM_ACTION_RENAME):
         $oldscript = '';
-        $newscript = SmartSieve::getFormValue('newscript');
-        $sids = SmartSieve::getFormValue('scriptID');
+        $newscript = (new SmartSieve)->getFormValue('newscript');
+        $sids = (new SmartSieve)->getFormValue('scriptID');
         if (is_array($sids)){
             // might have been more than one checkbox selected.
             // rename the first one only.
-            $slist = array_keys(SmartSieve::getScriptList());
+            $slist = array_keys((new SmartSieve)->getScriptList());
             if (isset($slist[$sids[0]])) {
                 $oldscript = $slist[$sids[0]];
             }
         }
         if ($newscript && $oldscript){
-            if (SmartSieve::scriptExists($newscript)) {
-                SmartSieve::setError(SmartSieve::text('Script "%s" already exists', array($newscript)));
-            } elseif (!SmartSieve::scriptExists($oldscript)) {
-                SmartSieve::setError(SmartSieve::text('Script "%s" does not exist', array($oldscript)));
+            if ((new SmartSieve)->scriptExists($newscript)) {
+                (new SmartSieve)->setError((new SmartSieve)->text('Script "%s" already exists', array($newscript)));
+            } elseif (!(new SmartSieve)->scriptExists($oldscript)) {
+                (new SmartSieve)->setError((new SmartSieve)->text('Script "%s" does not exist', array($oldscript)));
             } else {
                 $resp = $managesieve->getScript($oldscript);
                 if ($resp === false || !is_array($resp)) {
-                    SmartSieve::setError('getscript '.SmartSieve::text('failed: ') . $managesieve->getError());
+                    (new SmartSieve)->setError('getscript '.(new SmartSieve)->text('failed: ') . $managesieve->getError());
                 } else {
                     $old = $resp['raw'];
                     $ret = $managesieve->putScript($newscript, $old);
                     if ($ret === false) {
-                        SmartSieve::setError('putscript '.SmartSieve::text('failed: ') . $managesieve->getError());
+                        (new SmartSieve)->setError('putscript '.(new SmartSieve)->text('failed: ') . $managesieve->getError());
                     } else {
                         // Check old and new are the same.
                         $resp = $managesieve->getScript($newscript);
                         if ($resp === false) {
-                            SmartSieve::setError('getscript '.SmartSieve::text('failed: ') . $managesieve->getError());
+                            (new SmartSieve)->setError('getscript '.(new SmartSieve)->text('failed: ') . $managesieve->getError());
                         } elseif ($resp['raw'] != $old) {
-                            SmartSieve::setError(SmartSieve::text('Failed to rename "%s" as "%s"', array($oldscript,$newscript)));
+                            (new SmartSieve)->setError((new SmartSieve)->text('Failed to rename "%s" as "%s"', array($oldscript,$newscript)));
                             $managesieve->deleteScript($newscript);
                         } else {
                             // Successfully copied old to new. Delete old.
                             $ret = $managesieve->deleteScript($oldscript);
                             if ($ret === false) {
-                                SmartSieve::setError('deletescript '.SmartSieve::text('failed: ') . $managesieve->getError());
+                                (new SmartSieve)->setError('deletescript '.(new SmartSieve)->text('failed: ') . $managesieve->getError());
                             } else {
-                                SmartSieve::setNotice(SmartSieve::text('Successfully renamed "%s" as "%s"', array($oldscript,$newscript)));
+                                (new SmartSieve)->setNotice((new SmartSieve)->text('Successfully renamed "%s" as "%s"', array($oldscript,$newscript)));
                                 if (isset($scripts[$oldscript])) {
                                     $scripts[$newscript] = $scripts[$oldscript];
                                     unset($scripts[$oldscript]);
                                 }
                                 if ($_SESSION['smartsieve']['workingScript'] == $oldscript) {
-                                    SmartSieve::setWorkingScript();
+                                    (new SmartSieve)->setWorkingScript();
                                 }
                             }
                         }
@@ -166,10 +166,10 @@
         break;
 
     case (FORM_ACTION_EDIT):
-        $s = SmartSieve::getFormValue('viewscript');
+        $s = (new SmartSieve)->getFormValue('viewscript');
         if ($s){
-            SmartSieve::setWorkingScript($s);
-            header('Location: ' . SmartSieve::setUrl('main.php'),true);
+            (new SmartSieve)->setWorkingScript($s);
+            header('Location: ' . (new SmartSieve)->setUrl('main.php'),true);
             getConf('include_dir', 'include') . '/menu.inc';
+include (new SmartSieve)-exit;
         }
         break;
@@ -178,16 +178,16 @@
 
 $jsfile = 'scripts.js';
 $jsonload = '';
-$help_url = SmartSieve::getConf('scripts_help_url', '');
-$slist = SmartSieve::getScriptList();
+$help_url = (new SmartSieve)->getConf('scripts_help_url', '');
+$slist = (new SmartSieve)->getScriptList();
 $i = 0;
 
-include SmartSieve::getConf('include_dir', 'include') . '/common-head.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/menu.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/common_status.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/scripts.inc';
-include SmartSieve::getConf('include_dir', 'include') . '/common-footer.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-head.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/menu.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common_status.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/scripts.inc';
+include (new SmartSieve)->getConf('include_dir', 'include') . '/common-footer.inc';
 
-SmartSieve::close();
+(new SmartSieve)->close();
 
 ?>

Skrypty pomocnicze do wygenerowania łatek

W celu wygenerowania patchy dla Smartsievie, skorzystałem z prostych jednolinijkowych skryptów, które wygenerowały łatki dla smartsieve

Pobranie źródeł z SF

wget http://downloads.sourceforge.net/project/smartsieve/smartsieve/smartsieve-1.0-RC2/smartsieve-1.0-RC2.tar.gz
mkdir -p orig.data/
tar -xzf smartsieve-1.0-RC2.tar.gz
mv smartsieve-1.0-rc2/ orig.data

Generowanie dokumentacji wiki

Ze względu na parsery wiki w poniśzym jednolinijkowcu znaki { zostały poprzedzone znakiem backslash.

diff -ruN orig.data/ data/ | grep '^diff' | egrep -v '(conf/|/wtp|127.0.0.1|4203|plain)' | egrep -v '\.orig$'| awk '{ print "echo ==", $3, "==\necho"; print "echo \{\{\{#\!diff numbers=off\n" "diff -uN", $4 ".orig", $4; print "echo \}\}\}\necho"; }' | sh > /tmp/ss.patch

perl -p -e 'next unless /^==/; s|orig.data/||;' /tmp/ss.patch > ../fw.gdbd.pl/data/smartsieve.wiki.txt

Wygenrowanie skryptów shell

diff -ruN orig.data/ data/ | grep '^diff' | egrep -v '(conf/|/wtp|127.0.0.1|4203|plain)' | egrep -v '\.orig$'| awk '{ printf( "diff -uN %s.orig %s > pfiles/patch-", $4, $4); gsub(/\//, "__", $4); print $4;}' | sh


{i}  (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.

SmartSieve (ostatnio edytowane 2015-07-15 23:28:54 przez wtps0n)