Changeset 169
- Timestamp:
- 09/01/07 18:21:29 (16 months ago)
- Location:
- trunk
- Files:
-
- 16 modified
-
ChangeLog (modified) (1 diff)
-
includes/check_access.php (modified) (1 diff)
-
includes/func.inc.php (modified) (1 diff)
-
includes/sites/domain_view.php (modified) (1 diff)
-
includes/sites/email_view.php (modified) (7 diffs)
-
includes/sites/login.php (modified) (2 diffs)
-
includes/sites/user_autores.php (modified) (2 diffs)
-
sql_upgrades (modified) (1 diff)
-
system_scripts/autoresponder.pl (modified) (3 diffs)
-
templates/domain_add.tpl (modified) (1 diff)
-
templates/domain_view.tpl (modified) (1 diff)
-
templates/email_view.tpl (modified) (2 diffs)
-
templates/error_messages.tpl (modified) (1 diff)
-
templates/user_autores.tpl (modified) (2 diffs)
-
templates/user_spam.tpl (modified) (1 diff)
-
web/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r166 r169 1 CpVES 0.06 YYYY-MM-DD - Jonas Genannt - <jonas.genannt@brachium-system.net> 2 o Added: autoresponder.pl: special X-Header vacation disable 3 o Added: special X-Header vacation to email user/admin frontend 1 4 CpVES 0.05 2007-08-31 - Jonas Genannt - <jonas.genannt@brachium-system.net> 2 5 o Fixed: repaired listmailer.pl for access tinyint(1) column (T. Genannt) -
trunk/includes/check_access.php
r145 r169 29 29 if (isset($_SESSION['p_sa_learn'])) $smarty->assign('p_sa_learn', $_SESSION['p_sa_learn']); 30 30 if (isset($_SESSION['p_fetchmail'])) $smarty->assign('p_fetchmail',$_SESSION['p_fetchmail']); 31 if (isset($_SESSION['p_autores_xheader'])) $smarty->assign('p_autores_xheader',$_SESSION['p_autores_xheader']); 32 31 33 32 34 $no_login=0; -
trunk/includes/func.inc.php
r151 r169 180 180 $do="p_fetchmail"; 181 181 break; 182 case 'autores_xheader': 183 $do="p_autores_xheader"; 184 break; 182 185 default: 183 186 return false; -
trunk/includes/sites/domain_view.php
r149 r169 207 207 $smarty->assign('p_fetchmail', $data['p_fetchmail']); 208 208 $smarty->assign('p_webinterface', $data['p_webinterface']); 209 $smarty->assign('p_autores_xheader', $data['p_autores_xheader']); 209 210 210 211 $smarty->assign('max_emails', $data['max_email']); -
trunk/includes/sites/email_view.php
r149 r169 46 46 $smarty->assign('if_fetchmail', $data['p_fetchmail']); 47 47 $smarty->assign('if_webinterface', $data['p_webinterface']); 48 $smarty->assign('if_autores_xheader', $data['p_autores_xheader']); 48 49 $sql=sprintf("SELECT passwd,cpasswd,email FROM users WHERE id='%s'", 49 50 $db->escapeSimple($_GET['id'])); … … 134 135 } 135 136 /* save spamassassin end */ 136 137 138 //xheader disable feature 139 if (isset($_GET['xheader']) && is_numeric($_GET['xheader']) && isset($_GET['do']) && $_GET['do']=='del') { 140 $sql=sprintf("DELETE FROM autoresponder_xheader WHERE email='%d' AND id='%d'", 141 $db->escapeSimple($_GET['id']), 142 $db->escapeSimple($_GET['xheader'])); 143 $db->query($sql); 144 } 145 if (isset($_POST['xheader_submit'])) { 146 if (!empty($_POST['xheader_name']) && !empty($_POST['xheader_value'])) { 147 $sql=sprintf("INSERT INTO autoresponder_xheader SET email='%d',xheader='%s',value='%s'", 148 $db->escapeSimple($_GET['id']), 149 $db->escapeSimple($_POST['xheader_name']), 150 $db->escapeSimple($_POST['xheader_value'])); 151 $db->query($sql); 152 } 153 else { 154 $smarty->assign('error_msg','y'); 155 $smarty->assign('if_xheader_empty', 'y'); 156 } 157 } 158 137 159 /* Save autoresponder begin */ 138 160 if (isset($_POST['autores_submit'])) { … … 462 484 else { 463 485 $webinterface=0; 486 } 487 if (isset($_POST['autores_xheader']) && $_POST['autores_xheader'] == "enable" && check_domain_feature($_GET['did'], 'p_autores_xheader')) { 488 $autores_xheader=1; 489 } 490 else { 491 $autores_xheader=0; 464 492 } 465 493 if (isset($_POST['forwarding']) && $_POST['forwarding'] == "enable" ) { … … 500 528 if (!$error) 501 529 { 502 $sql=sprintf("UPDATE users SET passwd='%s', full_name='%s',p_imap='%d', p_pop3='%d',p_webmail='%d', cpasswd='%s', p_forwarding='%s',p_spamassassin='%s',p_mailarchive='%d',p_bogofilter='%d',p_spam_del='%d',p_sa_learn='%d',p_fetchmail='%d',p_webinterface='%d' WHERE id='%d' ",530 $sql=sprintf("UPDATE users SET passwd='%s', full_name='%s',p_imap='%d', p_pop3='%d',p_webmail='%d', cpasswd='%s', p_forwarding='%s',p_spamassassin='%s',p_mailarchive='%d',p_bogofilter='%d',p_spam_del='%d',p_sa_learn='%d',p_fetchmail='%d',p_webinterface='%d',p_autores_xheader='%d' WHERE id='%d' ", 503 531 $db->escapeSimple($cleartext), 504 532 $db->escapeSimple($_POST['full_name']), … … 515 543 $db->escapeSimple($fetchmail), 516 544 $db->escapeSimple($webinterface), 545 $db->escapeSimple($autores_xheader), 517 546 $db->escapeSimple($_GET['id'])) ; 518 547 $result=&$db->query($sql); … … 543 572 $smarty->assign('if_sa_learn_value', $edata['p_sa_learn']); 544 573 $smarty->assign('if_fetchmail_value',$edata['p_fetchmail']); 574 $smarty->assign('if_autores_xheader_value',$edata['p_autores_xheader']); 545 575 if ( !empty($edata['move_spam']) && $edata['move_spam']!=NULL) { 546 576 $smarty->assign('sa_move_spam',$edata['move_spam'] ); … … 589 619 $smarty->assign('threshold', $sa_threshold); 590 620 621 //output xheader feature 622 if ($edata['p_autores_xheader'] == 1) { 623 $sql=sprintf("SELECT * FROM autoresponder_xheader WHERE email='%d' ORDER BY xheader", 624 $db->escapeSimple($_GET['id'])); 625 $result=&$db->query($sql); 626 $table_xheader=array(); 627 while($data=$result->fetchrow(DB_FETCHMODE_ASSOC)) { 628 array_push($table_xheader,array( 629 'id' => $data['id'], 630 'xheader' => $data['xheader'], 631 'value' => $data['value'])); 632 } 633 $smarty->assign('table_xheader',$table_xheader); 634 } 591 635 592 636 -
trunk/includes/sites/login.php
r149 r169 30 30 $_SESSION['p_sa_learn']='0'; 31 31 $_SESSION['p_fetchmail']='0'; 32 $_SESSION['p_autores_xheader']='0'; 32 33 33 34 if (isset($_POST['email']) && isset($_POST['password']) && isset($_POST['login']) ) … … 77 78 $_SESSION['p_sa_learn']=check_du_fetaure($_SESSION['uid'],$daten['domainid'],'p_sa_learn'); 78 79 $_SESSION['p_fetchmail']=check_du_fetaure($_SESSION['uid'],$daten['domainid'],'p_fetchmail'); 80 $_SESSION['p_autores_xheader']=check_du_fetaure($_SESSION['uid'],$daten['domainid'],'p_autores_xheader'); 79 81 $_SESSION['forwarding']=$daten['p_forwarding']; 80 82 $_SESSION['p_mailfilter']=$data_domain['p_mailfilter']; -
trunk/includes/sites/user_autores.php
r118 r169 74 74 } 75 75 76 //xheader disable feature 77 if ($_SESSION['p_autores_xheader'] == 1) { 78 if (isset($_GET['xheader']) && is_numeric($_GET['xheader']) && isset($_GET['do']) && $_GET['do']=='del') { 79 $sql=sprintf("DELETE FROM autoresponder_xheader WHERE email='%d' AND id='%d'", 80 $db->escapeSimple($_SESSION['uid']), 81 $db->escapeSimple($_GET['xheader'])); 82 $db->query($sql); 83 } 84 if (isset($_POST['xheader_submit'])) { 85 if (!empty($_POST['xheader_name']) && !empty($_POST['xheader_value'])) { 86 $sql=sprintf("INSERT INTO autoresponder_xheader SET email='%d',xheader='%s',value='%s'", 87 $db->escapeSimple($_SESSION['uid']), 88 $db->escapeSimple($_POST['xheader_name']), 89 $db->escapeSimple($_POST['xheader_value'])); 90 $db->query($sql); 91 } 92 else { 93 $smarty->assign('error_msg','y'); 94 $smarty->assign('if_xheader_empty', 'y'); 95 } 96 } 97 } 98 76 99 //save automatic autoresponder disable feaure 77 100 if (isset($_POST['autores_datedisable_submit'])) { … … 157 180 $autores_disable=get_autores_disable($_SESSION['uid']); 158 181 182 //output xheader feature 183 if ($_SESSION['p_autores_xheader'] == 1) { 184 $sql=sprintf("SELECT * FROM autoresponder_xheader WHERE email='%d' ORDER BY xheader", 185 $db->escapeSimple($_SESSION['uid'])); 186 $result=&$db->query($sql); 187 $table_xheader=array(); 188 while($data=$result->fetchrow(DB_FETCHMODE_ASSOC)) { 189 array_push($table_xheader,array( 190 'id' => $data['id'], 191 'xheader' => $data['xheader'], 192 'value' => $data['value'])); 193 } 194 $smarty->assign('table_xheader',$table_xheader); 195 } 196 197 159 198 $smarty->assign('autores_disable', $autores_disable); 160 199 $smarty->assign('table_val_tos', $table_val_tos); -
trunk/sql_upgrades
r163 r169 123 123 Version 0.04 to 0.05 124 124 ALTER TABLE `lists` modify column `access` TINYINT( 1 ) DEFAULT '1' NOT NULL; 125 126 Version 0.05 to 0.06 127 CREATE TABLE `autoresponder_xheader` ( 128 `id` int(11) NOT NULL auto_increment, 129 `email` int(11) NOT NULL, 130 `xheader` varchar(255) NOT NULL, 131 `value` varchar(255) NOT NULL, 132 PRIMARY KEY (`id`), 133 KEY `email` (`email`) 134 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 135 ALTER TABLE `domains` ADD `p_autores_xheader` TINYINT( 1 ) NOT NULL DEFAULT '0'; 136 ALTER TABLE `users` ADD `p_autores_xheader` TINYINT( 1 ) NOT NULL DEFAULT '0'; 137 -
trunk/system_scripts/autoresponder.pl
r146 r169 100 100 #Now check if autoresponder is enabled 101 101 my $dbh = DBI->connect($dsn, $config{'db_username'}, $config{'db_password'}); 102 103 sub check_du_feature($$) { 104 my $uid = $_[0]; 105 my $type = $_[1]; 106 my $sql = sprintf("SELECT 1 FROM users AS a LEFT JOIN domains AS b ON b.id=a.domainid WHERE a.id=%s AND a.%s=1 AND a.%s=1", 107 $dbh->quote($uid), 108 $type, 109 $type); 110 my $access = $dbh->prepare($sql); 111 undef $sql; 112 $access->execute(); 113 if ($access->rows == 1) { 114 $access->finish; 115 return 1; 116 } 117 $access->finish; 118 undef $access; 119 return 0; 120 121 } 122 102 123 my $sql=sprintf("SELECT email,times FROM autoresponder WHERE email=%s AND active='y'", 103 124 $dbh->quote($ARGV[0])); … … 115 136 my $autores_times = $row_autores->{'times'}; 116 137 $sth->finish(); 138 139 #xheader check: 140 if (check_du_feature($ARGV[0], 'p_autores_xheader')== 1) { 141 $sth = $dbh->prepare("SELECT id,xheader,value FROM autoresponder_xheader WHERE email=?"); 142 $sth->execute($ARGV[0]); 143 my $xheader_row; 144 while ($xheader_row=$sth->fetchrow_hashref) { 145 if ( $mail->header($xheader_row->{'xheader'}) eq $xheader_row->{'value'}) { 146 #exits because of user defined xheader 147 $sth->finish(); 148 $dbh->disconnect(); 149 exit(0); 150 } 151 } 152 $sth->finish(); 153 } 117 154 118 155 #Now check if allready send an autoresponder to the email address: … … 123 160 undef($sql); 124 161 $sth->execute; 125 print "->> $autores_times - ROws: ",$sth->rows, "\n";162 #print "->> $autores_times - ROws: ",$sth->rows, "\n"; 126 163 if ($sth->rows < $autores_times || $autores_times eq "n") 127 164 { -
trunk/templates/domain_add.tpl
r156 r169 33 33 <br /> 34 34 {/if} {if $points eq 'n' } 35 <div style="color:red;">{t }no MX entry points to our server.<br>You will not receive mail for this domain!{/t}35 <div style="color:red;">{t escape='off'}no MX entry points to our server.<br>You will not receive mail for this domain!{/t} 36 36 </div> 37 37 <br /> -
trunk/templates/domain_view.tpl
r154 r169 180 180 </tr> 181 181 <tr> 182 <td>{t}vacation X-Header disable feature:{/t}</td> 183 <td></td> 184 <td style="text-align:right;"> 185 {if $p_autores_xheader == 0 } 186 <a href="?module=domain_view&did={$did}&fstate=1&f=autores_xheader"> 187 <img src="img/icons/button_cancel.png" style="border:0px;" title="{t}activate vacation X-Header feature.{/t}" /></a> 188 {else} 189 <a href="?module=domain_view&did={$did}&fstate=0&f=autores_xheader"> 190 <img src="img/icons/button_ok.png" style="border:0px;" title="{t}deactivate vacation X-Header feature.{/t}" /></a> 191 {/if}</td> 192 </tr> 193 <tr> 182 194 <td>{t}fetchmail:{/t}</td> 183 195 <td></td> -
trunk/templates/email_view.tpl
r156 r169 59 59 <option value="enable">{t}yes{/t}</option> 60 60 {if $if_webinterface_value == 0 } 61 <option value="disable" selected="selected" >{t}no{/t}</option> 62 {else} 63 <option value="disable" >{t}no{/t}</option> 64 {/if} 65 </select></td> 66 </tr> 67 {/if} 68 {if $if_autores_xheader == 1 } 69 <tr> 70 <td>{t}vacation X-Header disable feature:{/t}</td> 71 <td><select name="autores_xheader"> 72 <option value="enable">{t}yes{/t}</option> 73 {if $if_autores_xheader_value == 0 } 61 74 <option value="disable" selected="selected" >{t}no{/t}</option> 62 75 {else} … … 284 297 <td><input type="text" id="autores_valtos_add_data" name="val_tos_da" /><input type="submit" id="autores_valtos_add_submit" name="val_tos_add" value="{t}add{/t}" /></td> 285 298 </tr> 299 {if $if_autores_xheader_value == 1} 300 <tr style="height:25px;"> 301 <td></td> 302 </tr> 303 <tr> 304 <td valign="top">{t}vacation X-Header disable feature:{/t}</td> 305 </tr> 306 <tr> 307 <td></td> 308 <td> 309 <table border="0"> 310 <tr> 311 <td style="font-weight:bold;padding-right:30px;">{t}X-Header{/t}</td> 312 <td style="font-weight:bold;padding-right:20px;">{t}Value{/t}</td> 313 <td></td> 314 </tr> 315 {foreach item=row from=$table_xheader} 316 <td>{$row.xheader}</td> 317 <td>{$row.value}</td> 318 <td><a href="?module=email_view&id={$id}&did={$did}&xheader={$row.id}&do=del"><img src="img/icons/delete.png" style="border:0px;"/></a></td> 319 {/foreach} 320 </table> 321 </td> 322 323 </tr> 324 <tr style="height:25px;"> 325 <td></td> 326 </tr> 327 <tr> 328 <td valign="top">{t}add new X-Header:{/t}</td> 329 <td></td> 330 </tr> 331 <tr> 332 <td></td> 333 <td> 334 <form action="?module=email_view&id={$id}&did={$did}" method="post"> 335 <table border="0"> 336 <tr> 337 <td style="padding-right:10px;">{t}X-Header:{/t}</td> 338 <td><input type="text" name="xheader_name" /></td> 339 </tr> 340 <tr> 341 <td style="padding-right:10px;">{t}Value:{/t}</td> 342 <td><input type="text" name="xheader_value" /></td> 343 </tr> 344 </table> 345 <input name="xheader_submit" type="submit" value="{t}save{/t}"/> 346 </form> 347 </td> 348 </tr> 349 {/if} 286 350 </form> 287 351 {if $autores_active eq 'n' } -
trunk/templates/error_messages.tpl
r156 r169 83 83 {t}Please check all input fields!{/t} 84 84 Bitte alle Felder ausfüllen! 85 {elseif $if_xheader_empty == 'y' } 86 {t}Both X-Header fields are required!{/t} 85 87 {/if} -
trunk/templates/user_autores.tpl
r155 r169 16 16 <td>{t}send vacation back to sender:{/t}</td> 17 17 <td> 18 {html_options name="autores_sendback_times" options="$autores_sendback_times_selects" selected=$autores_sendback_times_value style="width:200px;"}18 {html_options name="autores_sendback_times" id="autores_sendback_times" options="$autores_sendback_times_selects" selected=$autores_sendback_times_value style="width:200px;"} 19 19 </td> 20 20 </tr> … … 98 98 <td><input type="text" id="autores_valtos_add_data" name="val_tos_da" /><input type="submit" id="autores_valtos_add_submit" name="val_tos_add" value="{t}add{/t}" /></td> 99 99 </tr></form> 100 {if $p_autores_xheader == 1} 101 <tr style="height:25px;"> 102 <td></td> 103 </tr> 104 <tr> 105 <td valign="top">{t}vacation X-Header disable feature:{/t}</td> 106 </tr> 107 <tr> 108 <td></td> 109 <td> 110 <table border="0"> 111 <tr> 112 <td style="font-weight:bold;padding-right:30px;">{t}X-Header{/t}</td> 113 <td style="font-weight:bold;padding-right:20px;">{t}Value{/t}</td> 114 <td></td> 115 </tr> 116 {foreach item=row from=$table_xheader} 117 <td>{$row.xheader}</td> 118 <td>{$row.value}</td> 119 <td><a href="?module=user_autores&xheader={$row.id}&do=del"><img src="img/icons/delete.png" style="border:0px;"/></a></td> 120 {/foreach} 121 </table> 122 </td> 123 124 </tr> 125 <tr style="height:25px;"> 126 <td></td> 127 </tr> 128 <tr> 129 <td valign="top">{t}add new X-Header:{/t}</td> 130 <td></td> 131 </tr> 132 <tr> 133 <td></td> 134 <td> 135 <form action="?module=user_autores" method="post"> 136 <table border="0"> 137 <tr> 138 <td style="padding-right:10px;">{t}X-Header:{/t}</td> 139 <td><input type="text" name="xheader_name" /></td> 140 </tr> 141 <tr> 142 <td style="padding-right:10px;">{t}Value:{/t}</td> 143 <td><input type="text" name="xheader_value" /></td> 144 </tr> 145 </table> 146 <input name="xheader_submit" type="submit" value="{t}save{/t}"/> 147 </form> 148 </td> 149 </tr> 150 {/if} 100 151 </table> 101 152 {if $autores_active eq 'n' } -
trunk/templates/user_spam.tpl
r156 r169 70 70 {/foreach}</select> 71 71 72 {else}<p>{t }no IMAP folder exists.<br/>please create an folder first, to use this option.{/t}</p>72 {else}<p>{t escape='off'}no IMAP folder exists.<br/>please create an folder first, to use this option.{/t}</p> 73 73 {/if} 74 74 </td> -
trunk/web/index.php
r156 r169 19 19 session_start(); 20 20 require_once("../root.php"); 21 if (!is_file(ROOT . "/includes/config.inc.php")) { 22 die("<h3>missing ". ROOT . "/includes/config.inc.php!</h3>"); 23 } 21 24 require_once( ROOT . "/includes/config.inc.php"); 22 25 if (!isset($_POST['login']) && $_GET['module'] != "login" ) {
