"Fossies" - the Fresh Open Source Software Archive

Member "openmailadmin-1.0.1/regexp.php" (31 May 2007, 2803 Bytes) of package /linux/privat/old/openmailadmin-1.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "regexp.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 include('./inc/_prepend.php');
    3 include('./inc/panel_filter.php');
    4 
    5 $oma->current_user->domain_set = $oma->get_domain_set($oma->current_user->mbox, $oma->current_user->domains);
    6 $oma->current_user->used_regexp = $oma->user_get_used_regexp($oma->current_user->mbox);
    7 
    8 // PERFORM ACTION
    9 if(isset($_POST['frm']) && $_POST['frm'] == 'virtual_regexp') {
   10     if(!isset($_POST['action'])) {
   11         error(txt('112'));
   12     } else {
   13         if($oma->current_user->max_regexp != 0 && $oma->authenticated_user->max_regexp != 0) {
   14             if($_POST['action'] == 'new' || $_POST['action'] == 'dest') {
   15                 // Set at least one valid destination.
   16                 if(isset($_POST['dest_is_mbox']) && $_POST['dest_is_mbox'] == '1') {
   17                     $destination = array($oma->current_user->mbox);
   18                 } else {
   19                     $destination = $oma->get_valid_destinations($_POST['dest']);
   20                     if(count($destination) < 1) {
   21                         $destination = array($oma->current_user->mbox);
   22                         error(txt('10'));
   23                     }
   24                 }
   25             }
   26             // On every action except 'new' and 'probe' at least one expression
   27             // must be selected for manipulation and thus $_POST['expr'] be an array.
   28             if($_POST['action'] != 'new' && $_POST['action'] != 'probe'
   29                && !(isset($_POST['expr']) && is_array($_POST['expr']))) {
   30                 error(txt('11'));
   31             } else {
   32                 switch($_POST['action']) {
   33                     case 'new':
   34                         $oma->regexp_create(trim($_POST['reg_exp']), $destination);
   35                         break;
   36                     case 'delete':
   37                         $oma->regexp_delete($_POST['expr']);
   38                         break;
   39                     case 'dest':
   40                         $oma->regexp_change_destination($_POST['expr'], $destination);
   41                         break;
   42                     case 'active':
   43                         $oma->regexp_toggle_active($_POST['expr']);
   44                         break;
   45                 }
   46 
   47                 if($ErrorHandler->errors_occured()) {
   48                     error($ErrorHandler->errors_get());
   49                 }
   50                 if($ErrorHandler->info_occured()) {
   51                     info($ErrorHandler->info_get());
   52                 }
   53             }
   54             if(isset($destination)) unset($destination);
   55         } else {
   56             error(txt('16'));
   57         }
   58     }
   59 }
   60 
   61 // DATA
   62 // We need to determine whether an string for matching shall be provided.
   63 if(isset($_POST['frm']) && isset($_POST['action'])
   64    && $_POST['frm'] == 'virtual_regexp' && $_POST['action'] == 'probe') {
   65     $regexp = $oma->get_regexp($_POST['probe']);
   66 } else {
   67     $regexp = $oma->get_regexp();
   68 }
   69 
   70 // DISPLAY
   71 include('./templates/'.$cfg['theme'].'/regexp/list.tpl');
   72 
   73 // ADMIN PANEL
   74 if($oma->current_user->max_regexp != 0 && $oma->authenticated_user->max_regexp != 0) {
   75     // This is the action handler for 'probing'.
   76     if(isset($_POST['frm']) && isset($_POST['action'])
   77        && $_POST['frm'] == 'virtual_regexp' && $_POST['action'] == 'probe'
   78        && trim($_POST['reg_exp']) != '' && trim($_POST['probe']) != ''
   79        && @preg_match($_POST['reg_exp'], $_POST['probe'])) {
   80         info(txt('36'));
   81     }
   82 
   83     include('./templates/'.$cfg['theme'].'/regexp/admin.tpl');
   84 }
   85 
   86 include('./inc/_append.php');
   87 ?>