Thread: SF.net SVN: postfixadmin:[1824] trunk (Page 13)
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2016-02-04 22:30:08
|
Revision: 1824 http://sourceforge.net/p/postfixadmin/code/1824 Author: christian_boltz Date: 2016-02-04 22:30:06 +0000 (Thu, 04 Feb 2016) Log Message: ----------- Merge pull request #9 from phyrog/master Add sqlite backend option (thank you @phyrog for doing this) (imported from github) Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php trunk/model/FetchmailHandler.php trunk/model/PFAHandler.php trunk/setup.php trunk/upgrade.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/config.inc.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -80,6 +80,7 @@ // mysql = MySQL 3.23 and 4.0, 4.1 or 5 // mysqli = MySQL 4.1+ or MariaDB // pgsql = PostgreSQL +// sqlite = SQLite 3 $CONF['database_type'] = 'mysqli'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'postfix'; @@ -90,6 +91,8 @@ // If you need to specify a different port for POSTGRESQL database connection // uncomment and change the following // $CONF['database_port'] = '5432'; +// If sqlite is used, specify the database file path: +// $CONF['database_name'] = '/etc/postfix/sqlite/postfixadmin.db' // Here, if you need, you can customize table names. $CONF['database_prefix'] = ''; Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/functions.inc.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -302,6 +302,9 @@ if ($CONF['database_type'] == "mysqli") { $escaped_string = mysqli_real_escape_string($link, $string); } + if (db_sqlite()) { + $escaped_string = SQLite3::escapeString($string); + } if (db_pgsql()) { // php 5.2+ allows for $link to be specified. if (version_compare(phpversion(), "5.2.0", ">=")) { @@ -490,7 +493,9 @@ if (db_pgsql()) { $initcount = "CREATE TEMPORARY SEQUENCE rowcount MINVALUE 0"; } - $result = db_query($initcount); + if (!db_sqlite()) { + $result = db_query($initcount); + } # get labels for relevant rows (first and last of each page) $page_size_zerobase = $page_size - 1; @@ -507,6 +512,15 @@ ) idx WHERE MOD(idx.row, $page_size) IN (0,$page_size_zerobase) OR idx.row = $count_results "; } + + if (db_sqlite()) { + $query = " + WITH idx AS (SELECT * $querypart) + SELECT $idxfield AS label, (SELECT (COUNT(*) - 1) FROM idx t1 WHERE t1.$idxfield <= t2.$idxfield) AS row + FROM idx t2 + WHERE (row % $page_size) IN (0,$page_size_zerobase) OR row = $count_results"; + } + # echo "<p>$query"; # TODO: $query is MySQL-specific @@ -1249,6 +1263,17 @@ } else { $error_text .= "<p />DEBUG INFORMATION:<br />MySQL 4.1 functions not available! (php5-mysqli installed?)<br />database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT"; } + } elseif (db_sqlite()) { + if (class_exists ("SQLite3")) { + if ($CONF['database_name'] == '' || !is_dir(dirname($CONF['database_name'])) || !is_writable(dirname($CONF['database_name']))) { + $error_text .= ("<p />DEBUG INFORMATION<br />Connect: given database path does not exist, is not writable, or \$CONF['database_name'] is empty."); + } else { + $link = new SQLite3($CONF['database_name']) or $error_text .= ("<p />DEBUG INFORMATION<br />Connect: failed to connect to database. $DEBUG_TEXT"); + $link->createFunction('base64_decode', 'base64_decode'); + } + } else { + $error_text .= "<p />DEBUG INFORMATION:<br />SQLite functions not available! (php5-sqlite installed?)<br />database_type = 'sqlite' in config.inc.php, are you using a different database? $DEBUG_TEXT"; + } } elseif (db_pgsql()) { if (function_exists ("pg_pconnect")) { if(!isset($CONF['database_port'])) { @@ -1299,7 +1324,7 @@ return 't'; } return 'f'; - } elseif(Config::Read('database_type') == 'mysql' || Config::Read('database_type') == 'mysqli') { + } elseif(Config::Read('database_type') == 'mysql' || Config::Read('database_type') == 'mysqli' || db_sqlite()) { if($bool) { return 1; } @@ -1317,11 +1342,21 @@ * @return string */ function db_quota_text($count, $quota, $fieldname) { - return " CASE $quota - WHEN '-1' THEN CONCAT(coalesce($count,0), ' / -') - WHEN '0' THEN CONCAT(coalesce($count,0), ' / ', '" . escape_string(html_entity_decode('∞')) . "') - ELSE CONCAT(coalesce($count,0), ' / ', $quota) - END AS $fieldname"; + if (db_sqlite()) { + // SQLite uses || to concatenate strings + return " CASE $quota + WHEN '-1' THEN (coalesce($count,0) || ' / -') + WHEN '0' THEN (coalesce($count,0) || ' / " . escape_string(html_entity_decode('∞')) . "') + ELSE (coalesce($count,0) || ' / ' || $quota) + END AS $fieldname"; + } + else { + return " CASE $quota + WHEN '-1' THEN CONCAT(coalesce($count,0), ' / -') + WHEN '0' THEN CONCAT(coalesce($count,0), ' / ', '" . escape_string(html_entity_decode('∞')) . "') + ELSE CONCAT(coalesce($count,0), ' / ', $quota) + END AS $fieldname"; + } } /** @@ -1350,6 +1385,17 @@ } } +/** + * returns true if SQLite is used, false otherwise + */ +function db_sqlite() { + if(Config::Read('database_type')=='sqlite') { + return true; + } else { + return false; + } +} + // // db_query // Action: Sends a query to the database and returns query result and number of rows @@ -1372,6 +1418,8 @@ or $error_text = "Invalid query: " . mysql_error($link); if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query) or $error_text = "Invalid query: " . mysqli_error($link); + if (db_sqlite()) $result = @$link->query($query) + or $error_text = "Invalid query: " . $link->lastErrorMsg(); if (db_pgsql()) { $result = @pg_query ($link, $query) or $error_text = "Invalid query: " . pg_last_error(); @@ -1383,7 +1431,18 @@ } if ($error_text == "") { - if (preg_match("/^SELECT/i", trim($query))) { + if (db_sqlite()) { + if($result->numColumns()) { + // Query returned something + $num_rows = 0; + while(@$result->fetchArray(SQLITE3_ASSOC)) $num_rows++; + $result->reset(); + $number_rows = $num_rows; + } else { + // Query was UPDATE, DELETE or INSERT + $number_rows = $link->changes(); + } + } elseif (preg_match("/^SELECT/i", trim($query))) { // if $query was a SELECT statement check the number of rows with [database_type]_num_rows (). if ($CONF['database_type'] == "mysql") $number_rows = mysql_num_rows ($result); if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_num_rows ($result); @@ -1416,6 +1475,7 @@ $row = ""; if ($CONF['database_type'] == "mysql") $row = mysql_fetch_row ($result); if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_row ($result); + if (db_sqlite() ) $row = $result->fetchArray(SQLITE3_NUM); if (db_pgsql() ) $row = pg_fetch_row ($result); return $row; } @@ -1431,6 +1491,7 @@ $row = ""; if ($CONF['database_type'] == "mysql") $row = mysql_fetch_array ($result); if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_array ($result); + if (db_sqlite() ) $row = $result->fetchArray(); if (db_pgsql() ) $row = pg_fetch_array ($result); return $row; } @@ -1446,6 +1507,7 @@ $row = ""; if ($CONF['database_type'] == "mysql") $row = mysql_fetch_assoc ($result); if ($CONF['database_type'] == "mysqli") $row = mysqli_fetch_assoc ($result); + if (db_sqlite() ) $row = $result->fetchArray(SQLITE3_ASSOC); if (db_pgsql() ) $row = pg_fetch_assoc ($result); return $row; } @@ -1487,7 +1549,11 @@ } foreach($timestamp as $key) { - $values[$key] = "now()"; + if (db_sqlite()) { + $values[$key] = "datetime('now')"; + } else { + $values[$key] = "now()"; + } } $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES (".implode(",",$values).")"; @@ -1531,7 +1597,11 @@ } foreach($timestamp as $key) { - $sql_values[$key] = escape_string($key) . "=now()"; + if (db_sqlite()) { + $sql_values[$key] = escape_string($key) . "=datetime('now')"; + } else { + $sql_values[$key] = escape_string($key) . "=now()"; + } } $sql="UPDATE $table SET ".implode(",",$sql_values)." WHERE $where"; Modified: trunk/model/FetchmailHandler.php =================================================================== --- trunk/model/FetchmailHandler.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/model/FetchmailHandler.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -21,7 +21,7 @@ $this->struct=array( # field name allow display in... type $PALANG label $PALANG description default / options / ... # editing? form list - 'id' => pacol( 0, 0, 1, 'num' , '' , '' ), + 'id' => pacol( 0, 0, 1, 'num' , '' , '' , '', array(), 0, 1), 'domain' => pacol( 0, 0, 1, 'text', '' , '' ), 'mailbox' => pacol( 1, 1, 1, 'enum', 'pFetchmail_field_mailbox' , 'pFetchmail_desc_mailbox' ), # mailbox list 'src_server' => pacol( 1, 1, 1, 'text', 'pFetchmail_field_src_server' , 'pFetchmail_desc_src_server' ), Modified: trunk/model/PFAHandler.php =================================================================== --- trunk/model/PFAHandler.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/model/PFAHandler.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -567,6 +567,10 @@ if (db_pgsql()) { $formatted_date = "TO_DATE(text(###KEY###), '" . escape_string(Config::Lang('dateformat_pgsql')) . "')"; $base64_decode = "DECODE(###KEY###, 'base64')"; + } elseif (db_sqlite()) { + $formatted_date = "strftime(###KEY###, '" . escape_string(Config::Lang('dateformat_mysql')) . "')"; + $base64_decode = "base64_decode(###KEY###)"; + } else { $formatted_date = "DATE_FORMAT(###KEY###, '" . escape_string(Config::Lang('dateformat_mysql')) . "')"; $base64_decode = "FROM_BASE64(###KEY###)"; Modified: trunk/setup.php =================================================================== --- trunk/setup.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/setup.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -47,6 +47,7 @@ $f_mysql_connect = function_exists ("mysql_connect"); $f_mysqli_connect = function_exists ("mysqli_connect"); $f_pg_connect = function_exists ("pg_connect"); +$f_sqlite_open = class_exists("SQLite3"); $f_session_start = function_exists ("session_start"); $f_preg_match = function_exists ("preg_match"); $f_mb_encode_mimeheader = function_exists ("mb_encode_mimeheader"); @@ -162,7 +163,7 @@ // // Check if there is support for at least 1 database // -if (($f_mysql_connect == 0) and ($f_mysqli_connect == 0) and ($f_pg_connect == 0)) +if (($f_mysql_connect == 0) and ($f_mysqli_connect == 0) and ($f_pg_connect == 0) and ($f_sqlite_open == 0)) { print "<li><b>Error: There is no database support in your PHP setup</b><br />\n"; print "To install MySQL 3.23 or 4.0 support on FreeBSD:<br />\n"; @@ -220,6 +221,15 @@ print "</li>"; } +if ($f_sqlite_open == 1) +{ + print "<li>Depends on: SQLite - OK \n"; + if ( !($config_loaded && db_sqlite()) ) { + print "<br>(change the database_type to 'sqlite' in config.inc.php if you want to use SQLite)\n"; + } + print "</li>"; +} + // // Database connection // Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2016-01-12 12:07:25 UTC (rev 1823) +++ trunk/upgrade.php 2016-02-04 22:30:06 UTC (rev 1824) @@ -72,7 +72,7 @@ } } function _upgrade_filter_function($name) { - return preg_match('/upgrade_[\d]+(_mysql|_pgsql)?$/', $name) == 1; + return preg_match('/upgrade_[\d]+(_mysql|_pgsql|_sqlite|_mysql_pgsql)?$/', $name) == 1; } function _db_add_field($table, $field, $fieldtype, $after) { @@ -108,8 +108,18 @@ )"; db_query_parsed($pgsql); } -} -else { +} elseif(db_sqlite()) { + $enc = 'PRAGMA encoding = "UTF-8"'; + db_query_parsed($enc); + $sql = " + CREATE TABLE {IF_NOT_EXISTS} $table ( + `id` {AUTOINCREMENT}, + `name` TEXT NOT NULL UNIQUE DEFAULT '', + `value` TEXT NOT NULL DEFAULT '' + ) + "; + db_query_parsed($sql); +} else { $mysql = " CREATE TABLE {IF_NOT_EXISTS} $table ( `id` {AUTOINCREMENT} {PRIMARY}, @@ -163,21 +173,42 @@ echo "<p>Updating database:</p><p>- old version: $current_version; target version: $target_version</p>\n"; echo "<div style='color:#999'> (If the update doesn't work, run setup.php?debug=1 to see the detailed error messages and SQL queries.)</div>"; + if (db_sqlite() && $current_version < 1824) { + // Fast forward to the first revision supporting SQLite + $current_version = 1823; + } + for ($i = $current_version +1; $i <= $target_version; $i++) { $function = "upgrade_$i"; + $function_mysql_pgsql = $function . "_mysql_pgsql"; $function_mysql = $function . "_mysql"; $function_pgsql = $function . "_pgsql"; + $function_sqlite = $function . "_sqlite"; + if (function_exists($function)) { echo "<p>updating to version $i (all databases)..."; $function(); echo " done"; } + if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' || $CONF['database_type'] == 'pgsql') { + if (function_exists($function_mysql_pgsql)) { + echo "<p>updating to version $i (MySQL and PgSQL)..."; + $function_mysql_pgsql(); + echo " done"; + } + } if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { if (function_exists($function_mysql)) { echo "<p>updating to version $i (MySQL)..."; $function_mysql(); echo " done"; } + } elseif(db_sqlite()) { + if (function_exists($function_sqlite)) { + echo "<p>updating to version $i (SQLite)..."; + $function_sqlite(); + echo " done"; + } } elseif($CONF['database_type'] == 'pgsql') { if (function_exists($function_pgsql)) { echo "<p>updating to version $i (PgSQL)..."; @@ -225,6 +256,25 @@ ); $sql = "$sql $attach_mysql"; + } elseif(db_sqlite()) { + $replace = array( + '{AUTOINCREMENT}' => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', + '{PRIMARY}' => 'PRIMARY KEY', + '{UNSIGNED}' => 'unsigned', + '{FULLTEXT}' => 'text', + '{BOOLEAN}' => "tinyint(1) NOT NULL DEFAULT '" . db_get_boolean(False) . "'", + '{BOOLEAN_TRUE}' => "tinyint(1) NOT NULL DEFAULT '" . db_get_boolean(True) . "'", + '{UTF-8}' => '', + '{LATIN1}' => '', + '{IF_NOT_EXISTS}' => 'IF NOT EXISTS', + '{RENAME_COLUMN}' => 'CHANGE COLUMN', + '{MYISAM}' => '', + '{INNODB}' => '', + '{INT}' => 'int(11) NOT NULL DEFAULT 0', + '{BIGINT}' => 'bigint(20) NOT NULL DEFAULT 0', + '{DATE}' => "datetime NOT NULL default '2000-01-01'", + '{DATECURRENT}' => 'datetime NOT NULL default CURRENT_TIMESTAMP', + ); } elseif($CONF['database_type'] == 'pgsql') { $replace = array( '{AUTOINCREMENT}' => 'SERIAL', @@ -274,7 +324,7 @@ if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { return "ALTER TABLE $table DROP INDEX $index"; - } elseif($CONF['database_type'] == 'pgsql') { + } elseif($CONF['database_type'] == 'pgsql' || db_sqlite()) { return "DROP INDEX $index"; # Index names are unique with a DB for PostgreSQL } else { echo "Sorry, unsupported database type " . $conf['database_type']; @@ -837,7 +887,7 @@ /** * Make logging translatable - i.e. create alias => create_alias */ -function upgrade_90() { +function upgrade_90_mysql_pgsql() { $result = db_query_parsed("UPDATE " . table_by_key ('log') . " SET action = REPLACE(action,' ','_')", TRUE); # change edit_alias_state to edit_alias_active $result = db_query_parsed("UPDATE " . table_by_key ('log') . " SET action = 'edit_alias_state' WHERE action = 'edit_alias_active'", TRUE); @@ -1139,7 +1189,7 @@ db_query_parsed("ALTER TABLE `$table_mailbox` CHANGE `local_part` `local_part` VARCHAR( 255 ) {LATIN1} NOT NULL"); } -function upgrade_655() { +function upgrade_655_mysql_pgsql() { db_query_parsed(_add_index('mailbox', 'domain', 'domain')); db_query_parsed(_add_index('alias', 'domain', 'domain')); } @@ -1206,7 +1256,7 @@ } */ -function upgrade_729() { +function upgrade_729_mysql_pgsql() { $table_quota = table_by_key('quota'); $table_quota2 = table_by_key('quota2'); @@ -1302,11 +1352,11 @@ "); } -function upgrade_945() { +function upgrade_945_mysql_pgsql() { _db_add_field('vacation', 'modified', '{DATECURRENT}', 'created'); } -function upgrade_946() { +function upgrade_946_mysql_pgsql() { # taken from upgrade_727_mysql, needs to be done for all databases _db_add_field('vacation', 'activefrom', '{DATE}', 'body'); _db_add_field('vacation', 'activeuntil', '{DATE}', 'activefrom'); @@ -1320,15 +1370,15 @@ db_query_parsed("ALTER TABLE $table_mailbox ALTER COLUMN quota type bigint"); } -function upgrade_1050() { +function upgrade_1050_mysql_pgsql() { db_query_parsed(_add_index('log', 'domain_timestamp', 'domain,timestamp')); } -function upgrade_1283() { +function upgrade_1283_mysql_pgsql() { _db_add_field('admin', 'superadmin', '{BOOLEAN}', 'password'); } -function upgrade_1284() { +function upgrade_1284_mysql_pgsql() { # migrate the ALL domain to the superadmin column # Note: The ALL domain is not (yet) deleted to stay backwards-compatible for now (will be done in a later upgrade function) @@ -1350,13 +1400,13 @@ # db_query_parsed("ALTER TABLE `$table_vacation` ADD `interval_time` INT NOT NULL DEFAULT '0' AFTER `reply_type` "); } -function upgrade_1519() { +function upgrade_1519_mysql_pgsql() { _db_add_field('fetchmail', 'sslcertck', '{BOOLEAN}', 'usessl' ); _db_add_field('fetchmail', 'sslcertpath', "VARCHAR(255) {UTF-8} DEFAULT ''", 'sslcertck' ); _db_add_field('fetchmail', 'sslfingerprint', "VARCHAR(255) {LATIN1} DEFAULT ''", 'sslcertpath'); } -function upgrade_1610() { +function upgrade_1610_mysql_pgsql() { # obsoletes upgrade_1345_mysql() - which means debug mode could print "field already exists" _db_add_field('vacation', 'interval_time', '{INT}', 'domain'); } @@ -1380,7 +1430,7 @@ db_query_parsed("ALTER TABLE `$table_fetchmail` CHANGE `date` `date` {DATE}"); } -function upgrade_1762() { +function upgrade_1762_mysql_pgsql() { _db_add_field('fetchmail', 'domain', "VARCHAR(255) {LATIN1} DEFAULT ''", 'id'); _db_add_field('fetchmail', 'active', '{BOOLEAN}', 'date'); _db_add_field('fetchmail', 'created', '{DATE}', 'date'); @@ -1400,7 +1450,7 @@ db_query_parsed("UPDATE $table SET domain=SPLIT_PART(mailbox, '@', 2) WHERE domain='';"); } -function upgrade_1767() { +function upgrade_1767_mysql_pgsql() { # 'active' was just added, so make sure all existing jobs stay active $table = table_by_key('fetchmail'); db_query_parsed("UPDATE $table SET active='{BOOL_TRUE}'"); @@ -1412,6 +1462,170 @@ upgrade_1761_mysql(); } +function upgrade_1824_sqlite() { + $admin_table = table_by_key('admin'); + $alias_table = table_by_key('alias'); + $alias_domain_table = table_by_key('alias_domain'); + $domain_table = table_by_key('domain'); + $domain_admins_table = table_by_key('domain_admins'); + $fetchmail_table = table_by_key('fetchmail'); + $log_table = table_by_key('log'); + $mailbox_table = table_by_key('mailbox'); + $quota_table = table_by_key('quota'); + $quota2_table = table_by_key('quota2'); + $vacation_table = table_by_key('vacation'); + $vacation_notification_table = table_by_key('vacation_notification'); + + db_query_parsed(" + CREATE TABLE $admin_table ( + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `superadmin` {BOOLEAN}, + `created` {DATE}, + `modified` {DATE}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`username`)); + "); + + db_query_parsed(" + CREATE TABLE $alias_table ( + `address` varchar(255) NOT NULL, + `goto` {FULLTEXT} NOT NULL, + `domain` varchar(255) NOT NULL, + `created` {DATE}, + `modified` {DATE}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`address`)); + "); + + db_query_parsed(" + CREATE TABLE $alias_domain_table ( + `alias_domain` varchar(255) NOT NULL, + `target_domain` varchar(255) NOT NULL, + `created` {DATE}, + `modified` {DATE}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`alias_domain`)); + "); + + db_query_parsed(" + CREATE TABLE $domain_table ( + `domain` varchar(255) NOT NULL, + `description` varchar(255) NOT NULL, + `aliases` {INT}, + `mailboxes` {INT}, + `maxquota` {BIGINT}, + `quota` {BIGINT}, + `transport` varchar(255) NOT NULL, + `backupmx` {BOOLEAN}, + `created` {DATE}, + `modified` {DATE}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`domain`)); + "); + + db_query_parsed(" + CREATE TABLE $domain_admins_table ( + `username` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `created` {DATE}, + `active` {BOOLEAN_TRUE}); + "); + + db_query_parsed(" + CREATE TABLE $fetchmail_table ( + `id` {AUTOINCREMENT}, + `domain` varchar(255) DEFAULT '', + `mailbox` varchar(255) NOT NULL, + `src_server` varchar(255) NOT NULL, + `src_auth` varchar(255) DEFAULT NULL, + `src_user` varchar(255) NOT NULL, + `src_password` varchar(255) NOT NULL, + `src_folder` varchar(255) NOT NULL, + `poll_time` int(11) NOT NULL DEFAULT '10', + `fetchall` {BOOLEAN}, + `keep` {BOOLEAN}, + `protocol` {FULLTEXT} DEFAULT NULL, + `usessl` {BOOLEAN}, + `sslcertck` {BOOLEAN}, + `sslcertpath` varchar(255) DEFAULT '', + `sslfingerprint` varchar(255) DEFAULT '', + `extra_options` {FULLTEXT}, + `returned_text` {FULLTEXT}, + `mda` varchar(255) NOT NULL, + `date` {DATE}, + `created` {DATE}, + `modified` {DATECURRENT}, + `active` {BOOLEAN}); + "); + + db_query_parsed(" + CREATE TABLE $log_table ( + `timestamp` {DATE}, + `username` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `action` varchar(255) NOT NULL, + `data` {FULLTEXT} NOT NULL); + "); + + db_query_parsed(" + CREATE TABLE $mailbox_table ( + `username` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `name` varchar(255) NOT NULL, + `maildir` varchar(255) NOT NULL, + `quota` {BIGINT}, + `local_part` varchar(255) NOT NULL, + `domain` varchar(255) NOT NULL, + `created` {DATE}, + `modified` {DATE}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`username`)); + "); + + db_query_parsed(" + CREATE TABLE $quota_table ( + `username` varchar(255) NOT NULL, + `path` varchar(100) NOT NULL, + `current` {BIGINT}, + {PRIMARY} (`username`,`path`)); + "); + + db_query_parsed(" + CREATE TABLE $quota2_table ( + `username` varchar(255) NOT NULL, + `bytes` {BIGINT}, + `messages` {INT}, + {PRIMARY} (`username`)); + "); + + db_query_parsed(" + CREATE TABLE $vacation_table ( + `email` varchar(255) NOT NULL, + `subject` varchar(255) NOT NULL, + `body` {FULLTEXT} NOT NULL, + `activefrom` {DATE}, + `activeuntil` {DATE}, + `cache` {FULLTEXT} NOT NULL DEFAULT '', + `domain` varchar(255) NOT NULL, + `interval_time` {INT}, + `created` {DATE}, + `modified` {DATECURRENT}, + `active` {BOOLEAN_TRUE}, + {PRIMARY} (`email`)); + "); + + db_query_parsed(" + CREATE TABLE $vacation_notification_table ( + `on_vacation` varchar(255) NOT NULL, + `notified` varchar(255) NOT NULL, + `notified_at` {DATECURRENT}, + {PRIMARY} (`on_vacation`,`notified`), + CONSTRAINT `vacation_notification_pkey` FOREIGN KEY (`on_vacation`) REFERENCES `vacation` (`email`) ON DELETE CASCADE); + "); + +} + # TODO MySQL: # - various varchar fields do not have a default value # https://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/3419725 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gin...@us...> - 2016-03-28 18:28:42
|
Revision: 1832 http://sourceforge.net/p/postfixadmin/code/1832 Author: gingerdog Date: 2016-03-28 18:28:40 +0000 (Mon, 28 Mar 2016) Log Message: ----------- merge github pull request into svn manually - https://github.com/postfixadmin/postfixadmin/commit/3e62d3975ab78eee565b484b1f0fa3c29e0909fb - adding configurable smtp helo (CONF["smtp_client"]) Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2016-03-27 20:12:49 UTC (rev 1831) +++ trunk/config.inc.php 2016-03-28 18:28:40 UTC (rev 1832) @@ -125,6 +125,11 @@ $CONF['smtp_server'] = 'localhost'; $CONF['smtp_port'] = '25'; +// SMTP Client +// Hostname (FQDN) of the server hosting Postfix Admin +// Used in the HELO when sending emails from Postfix Admin +$CONF['smtp_client'] = ''; + // Encrypt // In what way do you want the passwords to be crypted? // md5crypt = internal postfix admin md5 Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2016-03-27 20:12:49 UTC (rev 1831) +++ trunk/functions.inc.php 2016-03-28 18:28:40 UTC (rev 1832) @@ -1136,7 +1136,10 @@ $smtpd_server = $CONF['smtp_server']; $smtpd_port = $CONF['smtp_port']; //$smtp_server = $_SERVER["SERVER_NAME"]; - $smtp_server = php_uname("n"); + $smtp_server = php_uname('n'); + if(!empty($CONF['smtp_client'])) { + $smtp_server = $CONF['smtp_client']; + } $errno = "0"; $errstr = "0"; $timeout = "30"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gin...@us...> - 2016-05-20 20:27:32
|
Revision: 1841 http://sourceforge.net/p/postfixadmin/code/1841 Author: gingerdog Date: 2016-05-20 20:27:29 +0000 (Fri, 20 May 2016) Log Message: ----------- update Smarty to 3.1.29 Modified Paths: -------------- trunk/smarty/libs/Smarty.class.php trunk/smarty/libs/SmartyBC.class.php trunk/smarty/libs/debug.tpl trunk/smarty/libs/plugins/modifier.date_format.php trunk/smarty/libs/plugins/modifier.debug_print_var.php trunk/smarty/libs/plugins/modifier.regex_replace.php trunk/smarty/libs/plugins/modifiercompiler.escape.php trunk/smarty/libs/plugins/modifiercompiler.strip_tags.php trunk/smarty/libs/plugins/modifiercompiler.wordwrap.php trunk/smarty/libs/plugins/outputfilter.trimwhitespace.php trunk/smarty/libs/plugins/shared.make_timestamp.php trunk/smarty/libs/sysplugins/smarty_cacheresource.php trunk/smarty/libs/sysplugins/smarty_cacheresource_custom.php trunk/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php trunk/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php trunk/smarty/libs/sysplugins/smarty_internal_compile_append.php trunk/smarty/libs/sysplugins/smarty_internal_compile_assign.php trunk/smarty/libs/sysplugins/smarty_internal_compile_block.php trunk/smarty/libs/sysplugins/smarty_internal_compile_break.php trunk/smarty/libs/sysplugins/smarty_internal_compile_call.php trunk/smarty/libs/sysplugins/smarty_internal_compile_capture.php trunk/smarty/libs/sysplugins/smarty_internal_compile_config_load.php trunk/smarty/libs/sysplugins/smarty_internal_compile_continue.php trunk/smarty/libs/sysplugins/smarty_internal_compile_debug.php trunk/smarty/libs/sysplugins/smarty_internal_compile_extends.php trunk/smarty/libs/sysplugins/smarty_internal_compile_for.php trunk/smarty/libs/sysplugins/smarty_internal_compile_foreach.php trunk/smarty/libs/sysplugins/smarty_internal_compile_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_if.php trunk/smarty/libs/sysplugins/smarty_internal_compile_include.php trunk/smarty/libs/sysplugins/smarty_internal_compile_include_php.php trunk/smarty/libs/sysplugins/smarty_internal_compile_insert.php trunk/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php trunk/smarty/libs/sysplugins/smarty_internal_compile_nocache.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php trunk/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php trunk/smarty/libs/sysplugins/smarty_internal_compile_section.php trunk/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php trunk/smarty/libs/sysplugins/smarty_internal_compile_while.php trunk/smarty/libs/sysplugins/smarty_internal_compilebase.php trunk/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php trunk/smarty/libs/sysplugins/smarty_internal_configfilelexer.php trunk/smarty/libs/sysplugins/smarty_internal_configfileparser.php trunk/smarty/libs/sysplugins/smarty_internal_data.php trunk/smarty/libs/sysplugins/smarty_internal_debug.php trunk/smarty/libs/sysplugins/smarty_internal_nocache_insert.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree.php trunk/smarty/libs/sysplugins/smarty_internal_resource_eval.php trunk/smarty/libs/sysplugins/smarty_internal_resource_extends.php trunk/smarty/libs/sysplugins/smarty_internal_resource_file.php trunk/smarty/libs/sysplugins/smarty_internal_resource_php.php trunk/smarty/libs/sysplugins/smarty_internal_resource_registered.php trunk/smarty/libs/sysplugins/smarty_internal_resource_stream.php trunk/smarty/libs/sysplugins/smarty_internal_resource_string.php trunk/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php trunk/smarty/libs/sysplugins/smarty_internal_template.php trunk/smarty/libs/sysplugins/smarty_internal_templatebase.php trunk/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php trunk/smarty/libs/sysplugins/smarty_internal_templatelexer.php trunk/smarty/libs/sysplugins/smarty_internal_templateparser.php trunk/smarty/libs/sysplugins/smarty_resource.php trunk/smarty/libs/sysplugins/smarty_resource_custom.php trunk/smarty/libs/sysplugins/smarty_resource_recompiled.php trunk/smarty/libs/sysplugins/smarty_resource_uncompiled.php trunk/smarty/libs/sysplugins/smarty_security.php trunk/smarty/smarty_version trunk/smarty.inc.php Added Paths: ----------- trunk/smarty/libs/Autoloader.php trunk/smarty/libs/plugins/modifier.needle.php trunk/smarty/libs/sysplugins/smarty_data.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_php.php trunk/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php trunk/smarty/libs/sysplugins/smarty_internal_extension_clear.php trunk/smarty/libs/sysplugins/smarty_internal_extension_handler.php trunk/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_append.php trunk/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php trunk/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php trunk/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearassign.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearcache.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php trunk/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php trunk/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php trunk/smarty/libs/sysplugins/smarty_internal_method_configload.php trunk/smarty/libs/sysplugins/smarty_internal_method_createdata.php trunk/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php trunk/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php trunk/smarty/libs/sysplugins/smarty_internal_method_gettags.php trunk/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php trunk/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php trunk/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerclass.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_code.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_template.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_text.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_var.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php trunk/smarty/libs/sysplugins/smarty_internal_testinstall.php trunk/smarty/libs/sysplugins/smarty_internal_undefined.php trunk/smarty/libs/sysplugins/smarty_template_cached.php trunk/smarty/libs/sysplugins/smarty_template_compiled.php trunk/smarty/libs/sysplugins/smarty_template_config.php trunk/smarty/libs/sysplugins/smarty_template_resource_base.php trunk/smarty/libs/sysplugins/smarty_template_source.php trunk/smarty/libs/sysplugins/smarty_undefined_variable.php trunk/smarty/libs/sysplugins/smarty_variable.php trunk/smarty/libs/sysplugins/smartycompilerexception.php trunk/smarty/libs/sysplugins/smartyexception.php Removed Paths: ------------- trunk/smarty/libs/plugins/modifier.needle.php trunk/smarty/libs/sysplugins/smarty_config_source.php trunk/smarty/libs/sysplugins/smarty_internal_config.php trunk/smarty/libs/sysplugins/smarty_internal_filter_handler.php trunk/smarty/libs/sysplugins/smarty_internal_function_call_handler.php trunk/smarty/libs/sysplugins/smarty_internal_get_include_path.php trunk/smarty/libs/sysplugins/smarty_internal_utility.php trunk/smarty/libs/sysplugins/smarty_internal_write_file.php Added: trunk/smarty/libs/Autoloader.php =================================================================== --- trunk/smarty/libs/Autoloader.php (rev 0) +++ trunk/smarty/libs/Autoloader.php 2016-05-20 20:27:29 UTC (rev 1841) @@ -0,0 +1,124 @@ +<?php +/** + * Smarty Autoloader + * + * @package Smarty + */ + +/** + * Smarty Autoloader + * + * @package Smarty + * @author Uwe Tews + * Usage: + * require_once '...path/Autoloader.php'; + * Smarty_Autoloader::register(); + * $smarty = new Smarty(); + * Note: This autoloader is not needed if you use Composer. + * Composer will automatically add the classes of the Smarty package to it common autoloader. + */ +class Smarty_Autoloader +{ + /** + * Filepath to Smarty root + * + * @var string + */ + public static $SMARTY_DIR = ''; + + /** + * Filepath to Smarty internal plugins + * + * @var string + */ + public static $SMARTY_SYSPLUGINS_DIR = ''; + + /** + * Array with Smarty core classes and their filename + * + * @var array + */ + public static $rootClasses = array('smarty' => 'Smarty.class.php', 'smartybc' => 'SmartyBC.class.php',); + + /** + * Registers Smarty_Autoloader backward compatible to older installations. + * + * @param bool $prepend Whether to prepend the autoloader or not. + */ + public static function registerBC($prepend = false) + { + /** + * register the class autoloader + */ + if (!defined('SMARTY_SPL_AUTOLOAD')) { + define('SMARTY_SPL_AUTOLOAD', 0); + } + if (SMARTY_SPL_AUTOLOAD && + set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false + ) { + $registeredAutoLoadFunctions = spl_autoload_functions(); + if (!isset($registeredAutoLoadFunctions['spl_autoload'])) { + spl_autoload_register(); + } + } else { + self::register($prepend); + } + } + + /** + * Registers Smarty_Autoloader as an SPL autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not. + */ + public static function register($prepend = false) + { + self::$SMARTY_DIR = defined('SMARTY_DIR') ? SMARTY_DIR : dirname(__FILE__) . DIRECTORY_SEPARATOR; + self::$SMARTY_SYSPLUGINS_DIR = defined('SMARTY_SYSPLUGINS_DIR') ? SMARTY_SYSPLUGINS_DIR : + self::$SMARTY_DIR . 'sysplugins' . DIRECTORY_SEPARATOR; + if (version_compare(phpversion(), '5.3.0', '>=')) { + spl_autoload_register(array(__CLASS__, 'autoload'), true, $prepend); + } else { + spl_autoload_register(array(__CLASS__, 'autoload')); + } + } + + /** + * Handles auto loading of classes. + * + * @param string $class A class name. + */ + public static function autoload($class) + { + $_class = strtolower($class); + $file = self::$SMARTY_SYSPLUGINS_DIR . $_class . '.php'; + if (strpos($_class, 'smarty_internal_') === 0) { + if (strpos($_class, 'smarty_internal_compile_') === 0) { + if (is_file($file)) { + require $file; + } + return; + } + @include $file; + return; + } + if (preg_match('/^(smarty_(((template_(source|config|cache|compiled|resource_base))|((cached|compiled)?resource)|(variable|security)))|(smarty(bc)?)$)/', + $_class, $match)) { + if (!empty($match[3])) { + @include $file; + return; + } elseif (!empty($match[9]) && isset(self::$rootClasses[$_class])) { + $file = self::$rootClasses[$_class]; + require $file; + return; + } + } + if (0 !== strpos($_class, 'smarty')) { + return; + } + if (is_file($file)) { + require $file; + return; + } + return; + } +} Modified: trunk/smarty/libs/Smarty.class.php =================================================================== --- trunk/smarty/libs/Smarty.class.php 2016-05-20 19:55:55 UTC (rev 1840) +++ trunk/smarty/libs/Smarty.class.php 2016-05-20 20:27:29 UTC (rev 1841) @@ -2,15 +2,17 @@ /** * Project: Smarty: the PHP compiling template engine * File: Smarty.class.php - * SVN: $Id: Smarty.class.php 4897 2014-10-14 22:29:58Z Uwe...@go... $ + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -19,12 +21,13 @@ * sma...@go... * * @link http://www.smarty.net/ - * @copyright 2008 New Digital Group, Inc. + * @copyright 2015 New Digital Group, Inc. + * @copyright 2015 Uwe Tews * @author Monte Ohrt <monte at ohrt dot com> * @author Uwe Tews * @author Rodney Rehm * @package Smarty - * @version 3.1.21 + * @version 3.1.29 */ /** @@ -53,7 +56,7 @@ define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS); } if (!defined('SMARTY_MBSTRING')) { - define('SMARTY_MBSTRING', function_exists('mb_split')); + define('SMARTY_MBSTRING', function_exists('mb_get_info')); } if (!defined('SMARTY_RESOURCE_CHAR_SET')) { // UTF-8 can only be done properly when mbstring is available! @@ -70,36 +73,41 @@ } /** - * register the class autoloader + * Try loading the Smarty_Internal_Data class + * If we fail we must load Smarty's autoloader. + * Otherwise we may have a global autoloader like Composer */ -if (!defined('SMARTY_SPL_AUTOLOAD')) { - define('SMARTY_SPL_AUTOLOAD', 0); -} - -if (SMARTY_SPL_AUTOLOAD && set_include_path(get_include_path() . PATH_SEPARATOR . SMARTY_SYSPLUGINS_DIR) !== false) { - $registeredAutoLoadFunctions = spl_autoload_functions(); - if (!isset($registeredAutoLoadFunctions['spl_autoload'])) { - spl_autoload_register(); +if (!class_exists('Smarty_Autoloader', false)) { + if (!class_exists('Smarty_Internal_Data', true)) { + require_once dirname(__FILE__) . '/Autoloader.php'; + Smarty_Autoloader::registerBC(); } -} else { - spl_autoload_register('smartyAutoload'); } /** * Load always needed external class files */ -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php'; -include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_cacheresource_file.php'; +if (!class_exists('Smarty_Internal_Data', false)) { + require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php'; +} +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_extension_handler.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_variable.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_source.php'; +require_once SMARTY_SYSPLUGINS_DIR . 'smarty_template_resource_base.php'; /** * This is the main Smarty class * * @package Smarty + * + * @method int clearAllCache(int $exp_time = null, string $type = null) + * @method int clearCache(string $template_name, string $cache_id = null, string $compile_id = null, int $exp_time = null, string $type = null) + * @method int compileAllTemplates(Smarty $smarty, string $extension = '.tpl', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * @method int compileAllConfig(Smarty $smarty, string $extension = '.conf', bool $force_compile = false, int $time_limit = 0, int $max_errors = null) + * */ class Smarty extends Smarty_Internal_TemplateBase { @@ -110,23 +118,36 @@ /** * smarty version */ - const SMARTY_VERSION = 'Smarty-3.1.21-dev'; + const SMARTY_VERSION = '3.1.29'; /** * define variable scopes */ const SCOPE_LOCAL = 0; - const SCOPE_PARENT = 1; - const SCOPE_ROOT = 2; - const SCOPE_GLOBAL = 3; + + const SCOPE_PARENT = 2; + + const SCOPE_TPL_ROOT = 4; + + const SCOPE_ROOT = 8; + + const SCOPE_SMARTY = 16; + + const SCOPE_GLOBAL = 32; + + const SCOPE_BUBBLE_UP = 64; + /** * define caching modes */ const CACHING_OFF = 0; + const CACHING_LIFETIME_CURRENT = 1; + const CACHING_LIFETIME_SAVED = 2; + /** - * define constant for clearing cache files be saved expiration datees + * define constant for clearing cache files be saved expiration dates */ const CLEAR_EXPIRED = - 1; @@ -134,31 +155,66 @@ * define compile check modes */ const COMPILECHECK_OFF = 0; + const COMPILECHECK_ON = 1; + const COMPILECHECK_CACHEMISS = 2; + /** + * define debug modes + */ + const DEBUG_OFF = 0; + + const DEBUG_ON = 1; + + const DEBUG_INDIVIDUAL = 2; + + /** * modes for handling of "<?php ... ?>" tags in templates. */ const PHP_PASSTHRU = 0; //-> print tags as plain text + const PHP_QUOTE = 1; //-> escape tags as entities + const PHP_REMOVE = 2; //-> escape tags as entities + const PHP_ALLOW = 3; //-> escape tags as entities + /** * filter types */ const FILTER_POST = 'post'; + const FILTER_PRE = 'pre'; + const FILTER_OUTPUT = 'output'; + const FILTER_VARIABLE = 'variable'; + /** * plugin types */ const PLUGIN_FUNCTION = 'function'; + const PLUGIN_BLOCK = 'block'; + const PLUGIN_COMPILER = 'compiler'; + const PLUGIN_MODIFIER = 'modifier'; + const PLUGIN_MODIFIERCOMPILER = 'modifiercompiler'; + /** + * Resource caching modes + */ + const RESOURCE_CACHE_OFF = 0; + + const RESOURCE_CACHE_AUTOMATIC = 1; // cache template objects by rules + + const RESOURCE_CACHE_TEMPLATE = 2; // cache all template objects + + const RESOURCE_CACHE_ON = 4; // cache source and compiled resources + /**#@-*/ /** @@ -167,26 +223,31 @@ public static $global_tpl_vars = array(); /** - * error handler returned by set_error_hanlder() in Smarty::muteExpectedErrors() + * error handler returned by set_error_handler() in Smarty::muteExpectedErrors() */ public static $_previous_error_handler = null; + /** * contains directories outside of SMARTY_DIR that are to be muted by muteExpectedErrors() */ public static $_muted_directories = array(); + /** * Flag denoting if Multibyte String functions are available */ public static $_MBSTRING = SMARTY_MBSTRING; + /** * The character set to adhere to (e.g. "UTF-8") */ public static $_CHARSET = SMARTY_RESOURCE_CHAR_SET; + /** * The date format to be used internally * (accepts date() and strftime()) */ public static $_DATE_FORMAT = SMARTY_RESOURCE_DATE_FORMAT; + /** * Flag denoting if PCRE should run in UTF-8 mode */ @@ -202,163 +263,152 @@ */ /** - * auto literal on delimiters with whitspace + * auto literal on delimiters with whitespace * * @var boolean */ public $auto_literal = true; + /** * display error on not assigned variables * * @var boolean */ public $error_unassigned = false; + /** - * look up relative filepaths in include_path + * look up relative file path in include_path * * @var boolean */ public $use_include_path = false; + /** * template directory * * @var array */ - private $template_dir = array(); + private $template_dir = array('./templates/'); + /** * joined template directory string used in cache keys * * @var string */ - public $joined_template_dir = null; + public $_joined_template_dir = null; + /** * joined config directory string used in cache keys * * @var string */ - public $joined_config_dir = null; + public $_joined_config_dir = null; + /** * default template handler * * @var callable */ public $default_template_handler_func = null; + /** * default config handler * * @var callable */ public $default_config_handler_func = null; + /** * default plugin handler * * @var callable */ public $default_plugin_handler_func = null; + /** * compile directory * * @var string */ - private $compile_dir = null; + private $compile_dir = './templates_c/'; + /** * plugins directory * * @var array */ - private $plugins_dir = array(); + private $plugins_dir = null; + /** * cache directory * * @var string */ - private $cache_dir = null; + private $cache_dir = './cache/'; + /** * config directory * * @var array */ - private $config_dir = array(); + private $config_dir = array('./configs/'); + /** * force template compiling? * * @var boolean */ public $force_compile = false; + /** * check template for modifications? * * @var boolean */ public $compile_check = true; + /** * use sub dirs for compiled/cached files? * * @var boolean */ public $use_sub_dirs = false; + /** * allow ambiguous resources (that are made unique by the resource handler) * * @var boolean */ public $allow_ambiguous_resources = false; + /** - * caching enabled - * - * @var boolean - */ - public $caching = false; - /** * merge compiled includes * * @var boolean */ public $merge_compiled_includes = false; + /** - * template inheritance merge compiled includes - * - * @var boolean - */ - public $inheritance_merge_compiled_includes = true; - /** - * cache lifetime in seconds - * - * @var integer - */ - public $cache_lifetime = 3600; - /** * force cache file creation * * @var boolean */ public $force_cache = false; + /** - * Set this if you want different sets of cache files for the same - * templates. - * - * @var string - */ - public $cache_id = null; - /** - * Set this if you want different sets of compiled files for the same - * templates. - * - * @var string - */ - public $compile_id = null; - /** * template left-delimiter * * @var string */ public $left_delimiter = "{"; + /** * template right-delimiter * * @var string */ public $right_delimiter = "}"; + /**#@+ * security */ @@ -370,33 +420,28 @@ * @see Smarty_Security */ public $security_class = 'Smarty_Security'; + /** * implementation of security class * * @var Smarty_Security */ public $security_policy = null; + /** * controls handling of PHP-blocks * * @var integer */ public $php_handling = self::PHP_PASSTHRU; + /** * controls if the php template file resource is allowed * * @var bool */ public $allow_php_templates = false; - /** - * Should compiled-templates be prevented from being called directly? - * {@internal - * Currently used by Smarty_Internal_Template only. - * }} - * - * @var boolean - */ - public $direct_access_security = true; + /**#@-*/ /** * debug mode @@ -405,6 +450,7 @@ * @var boolean */ public $debugging = false; + /** * This determines if debugging is enable-able from the browser. * <ul> @@ -415,32 +461,29 @@ * @var string */ public $debugging_ctrl = 'NONE'; + /** * Name of debugging URL-param. * Only used when $debugging_ctrl is set to 'URL'. * The name of the URL-parameter that activates debugging. * - * @var type + * @var string */ public $smarty_debug_id = 'SMARTY_DEBUG'; + /** * Path of debug template. * * @var string */ public $debug_tpl = null; + /** * When set, smarty uses this value as error_reporting-level. * * @var int */ public $error_reporting = null; - /** - * Internal flag for getTags() - * - * @var boolean - */ - public $get_used_tags = false; /**#@+ * config var settings @@ -452,12 +495,14 @@ * @var boolean */ public $config_overwrite = true; + /** * Controls whether config values of on/true/yes and off/false/no get converted to boolean. * * @var boolean */ public $config_booleanize = true; + /** * Controls whether hidden config sections/vars are read from the file. * @@ -477,12 +522,14 @@ * @var boolean */ public $compile_locking = true; + /** - * Controls whether cache resources should emply locking mechanism + * Controls whether cache resources should use locking mechanism * * @var boolean */ public $cache_locking = false; + /** * seconds to wait for acquiring a lock before ignoring the write lock * @@ -493,18 +540,13 @@ /**#@-*/ /** - * global template functions - * - * @var array - */ - public $template_functions = array(); - /** * resource type used if none given * Must be an valid key of $registered_resources. * * @var string */ public $default_resource_type = 'file'; + /** * caching type * Must be an element of $cache_resource_types. @@ -512,259 +554,171 @@ * @var string */ public $caching_type = 'file'; + /** - * internal config properties - * - * @var array - */ - public $properties = array(); - /** * config type * * @var string */ public $default_config_type = 'file'; + /** - * cached template objects + * enable resource caching * - * @var array + * @var bool */ - public $template_objects = array(); + public $resource_cache_mode = 1; + /** * check If-Modified-Since headers * * @var boolean */ public $cache_modified_check = false; + /** * registered plugins * * @var array */ public $registered_plugins = array(); + /** - * plugin search order - * - * @var array - */ - public $plugin_search_order = array('function', 'block', 'compiler', 'class'); - /** * registered objects * * @var array */ public $registered_objects = array(); + /** * registered classes * * @var array */ public $registered_classes = array(); + /** * registered filters * * @var array */ public $registered_filters = array(); + /** * registered resources * * @var array */ public $registered_resources = array(); + /** - * resource handler cache - * - * @var array - */ - public $_resource_handlers = array(); - /** * registered cache resources * * @var array */ public $registered_cache_resources = array(); + /** - * cache resource handler cache - * - * @var array - */ - public $_cacheresource_handlers = array(); - /** * autoload filter * * @var array */ public $autoload_filters = array(); + /** * default modifier * * @var array */ public $default_modifiers = array(); + /** * autoescape variable output * * @var boolean */ public $escape_html = false; + /** - * global internal smarty vars - * - * @var array - */ - public static $_smarty_vars = array(); - /** * start time for execution time calculation * * @var int */ public $start_time = 0; + /** - * default file permissions + * required by the compiler for BC * - * @var int + * @var string */ - public $_file_perms = 0644; + public $_current_file = null; + /** - * default dir permissions + * internal flag to enable parser debugging * - * @var int + * @var bool */ - public $_dir_perms = 0771; + public $_parserdebug = false; + /** - * block tag hierarchy + * This object type (Smarty = 1, template = 2, data = 4) * - * @var array + * @var int */ - public $_tag_stack = array(); + public $_objType = 1; + /** - * self pointer to Smarty object + * Debug object * - * @var Smarty + * @var Smarty_Internal_Debug */ - public $smarty; + public $_debug = null; + /** - * required by the compiler for BC + * removed properties * - * @var string + * @var string[] */ - public $_current_file = null; + private static $obsoleteProperties = array('resource_caching', 'template_resource_caching', + 'direct_access_security', '_dir_perms', '_file_perms', + 'plugin_search_order', 'inheritance_merge_compiled_includes'); + /** - * internal flag to enable parser debugging + * List of private properties which will call getter/setter ona direct access * - * @var bool - */ - public $_parserdebug = false; - /** - * Saved parameter of merged templates during compilation - * * @var array */ - public $merged_templates_func = array(); + private static $accessMap = array('template_dir' => 'TemplateDir', 'config_dir' => 'ConfigDir', + 'plugins_dir' => 'PluginsDir', 'compile_dir' => 'CompileDir', + 'cache_dir' => 'CacheDir',); - /** - * Cache of is_file results of loadPlugin() - * - * @var array - */ - public static $_is_file_cache= array(); - /**#@-*/ /** * Initialize new Smarty object - */ public function __construct() { - // selfpointer needed by some other class methods - $this->smarty = $this; + parent::__construct(); if (is_callable('mb_internal_encoding')) { mb_internal_encoding(Smarty::$_CHARSET); } $this->start_time = microtime(true); - // set default dirs - $this->setTemplateDir('.' . DS . 'templates' . DS) - ->setCompileDir('.' . DS . 'templates_c' . DS) - ->setPluginsDir(SMARTY_PLUGINS_DIR) - ->setCacheDir('.' . DS . 'cache' . DS) - ->setConfigDir('.' . DS . 'configs' . DS); - $this->debug_tpl = 'file:' . dirname(__FILE__) . '/debug.tpl'; if (isset($_SERVER['SCRIPT_NAME'])) { - $this->assignGlobal('SCRIPT_NAME', $_SERVER['SCRIPT_NAME']); + Smarty::$global_tpl_vars['SCRIPT_NAME'] = new Smarty_Variable($_SERVER['SCRIPT_NAME']); } - } - /** - * Class destructor - */ - public function __destruct() - { - // intentionally left blank - } + // Check if we're running on windows + Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; - /** - * <<magic>> set selfpointer on cloned object - */ - public function __clone() - { - $this->smarty = $this; - } - - /** - * <<magic>> Generic getter. - * Calls the appropriate getter function. - * Issues an E_USER_NOTICE if no valid getter is found. - * - * @param string $name property name - * - * @return mixed - */ - public function __get($name) - { - $allowed = array( - 'template_dir' => 'getTemplateDir', - 'config_dir' => 'getConfigDir', - 'plugins_dir' => 'getPluginsDir', - 'compile_dir' => 'getCompileDir', - 'cache_dir' => 'getCacheDir', - ); - - if (isset($allowed[$name])) { - return $this->{$allowed[$name]}(); - } else { - trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); + // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8 + if (Smarty::$_CHARSET !== 'UTF-8') { + Smarty::$_UTF8_MODIFIER = ''; } } /** - * <<magic>> Generic setter. - * Calls the appropriate setter function. - * Issues an E_USER_NOTICE if no valid setter is found. - * - * @param string $name property name - * @param mixed $value parameter passed to setter - */ - public function __set($name, $value) - { - $allowed = array( - 'template_dir' => 'setTemplateDir', - 'config_dir' => 'setConfigDir', - 'plugins_dir' => 'setPluginsDir', - 'compile_dir' => 'setCompileDir', - 'cache_dir' => 'setCacheDir', - ); - - if (isset($allowed[$name])) { - $this->{$allowed[$name]}($value); - } else { - trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE); - } - } - - /** * Check if a template resource exists * * @param string $resource_name template name @@ -773,14 +727,9 @@ */ public function templateExists($resource_name) { - // create template object - $save = $this->template_objects; - $tpl = new $this->template_class($resource_name, $this); - // check if it does exists - $result = $tpl->source->exists; - $this->template_objects = $save; - - return $result; + // create source object + $source = Smarty_Template_Source::load(null, $this, $resource_name); + return $source->exists; } /** @@ -809,43 +758,6 @@ } /** - * Empty cache folder - * - * @param integer $exp_time expiration time - * @param string $type resource type - * - * @return integer number of cache files deleted - */ - public function clearAllCache($exp_time = null, $type = null) - { - // load cache resource and call clearAll - $_cache_resource = Smarty_CacheResource::load($this, $type); - Smarty_CacheResource::invalidLoadedCache($this); - - return $_cache_resource->clearAll($this, $exp_time); - } - - /** - * Empty cache for a specific template - * - * @param string $template_name template name - * @param string $cache_id cache id - * @param string $compile_id compile id - * @param integer $exp_time expiration time - * @param string $type resource type - * - * @return integer number of cache files deleted - */ - public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null) - { - // load cache resource and call clear - $_cache_resource = Smarty_CacheResource::load($this, $type); - Smarty_CacheResource::invalidLoadedCache($this); - - return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time); - } - - /** * Loads security class and enables security * * @param string|Smarty_Security $security_class if a string is used, it must be class-name @@ -855,24 +767,7 @@ */ public function enableSecurity($security_class = null) { - if ($security_class instanceof Smarty_Security) { - $this->security_policy = $security_class; - - return $this; - } elseif (is_object($security_class)) { - throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security."); - } - if ($security_class == null) { - $security_class = $this->security_class; - } - if (!class_exists($security_class)) { - throw new SmartyException("Security class '$security_class' is not defined"); - } elseif ($security_class !== 'Smarty_Security' && !is_subclass_of($security_class, 'Smarty_Security')) { - throw new SmartyException("Class '$security_class' must extend Smarty_Security."); - } else { - $this->security_policy = new $security_class($this); - } - + Smarty_Security::enableSecurity($this, $security_class); return $this; } @@ -892,18 +787,18 @@ * Set template directory * * @param string|array $template_dir directory(s) of template sources + * @param bool $isConfig true for config_dir * - * @return Smarty current Smarty instance for chaining + * @return \Smarty current Smarty instance for chaining */ - public function setTemplateDir($template_dir) + public function setTemplateDir($template_dir, $isConfig = false) { - $this->template_dir = array(); - foreach ((array) $template_dir as $k => $v) { - $this->template_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; - } - - $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir); - + $type = $isConfig ? 'config_dir' : 'template_dir'; + $joined = '_joined_' . $type; + $this->{$type} = (array) $template_dir; + $this->{$joined} = join(' # ', $this->{$type}); + $this->_cache[$type . '_new'] = true; + $this->_cache[$type] = false; return $this; } @@ -912,55 +807,53 @@ * * @param string|array $template_dir directory(s) of template sources * @param string $key of the array element to assign the template dir to + * @param bool $isConfig true for config_dir * * @return Smarty current Smarty instance for chaining - * @throws SmartyException when the given template directory is not valid */ - public function addTemplateDir($template_dir, $key = null) + public function addTemplateDir($template_dir, $key = null, $isConfig = false) { - // make sure we're dealing with an array - $this->template_dir = (array) $this->template_dir; - - if (is_array($template_dir)) { - foreach ($template_dir as $k => $v) { - $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; - if (is_int($k)) { - // indexes are not merged but appended - $this->template_dir[] = $v; - } else { - // string indexes are overridden - $this->template_dir[$k] = $v; - } - } - } else { - $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS; - if ($key !== null) { - // override directory at specified index - $this->template_dir[$key] = $v; - } else { - // append new directory - $this->template_dir[] = $v; - } + $type = $isConfig ? 'config_dir' : 'template_dir'; + $joined = '_joined_' . $type; + if (!isset($this->_cache[$type])) { + $this->{$type} = (array) $this->{$type}; + $this->{$joined} = join(' # ', $this->{$type}); + $this->_cache[$type . '_new'] = true; + $this->_cache[$type] = false; } - $this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir); - + $this->{$joined} .= ' # ' . join(' # ', (array) $template_dir); + $this->_addDir($type, $template_dir, $key); return $this; } /** * Get template directories * - * @param mixed $index index of directory to get, null to get all + * @param mixed $index index of directory to get, null to get all + * @param bool $isConfig true for config_dir * - * @return array|string list of template directories, or directory of $index + * @return array list of template directories, or directory of $index */ - public function getTemplateDir($index = null) + public function getTemplateDir($index = null, $isConfig = false) { + $type = $isConfig ? 'config_dir' : 'template_dir'; + if (!isset($this->_cache[$type])) { + $joined = '_joined_' . $type; + $this->{$type} = (array) $this->{$type}; + $this->{$joined} = join(' # ', $this->{$type}); + $this->_cache[$type] = false; + } + if ($this->_cache[$type] == false) { + foreach ($this->{$type} as $k => $v) { + $this->{$type}[$k] = $this->_realpath($v . DS, true); + } + $this->_cache[$type . '_new'] = true; + $this->_cache[$type] = true; + } if ($index !== null) { - return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null; + return isset($this->{$type}[$index]) ? $this->{$type}[$index] : null; } - - return (array) $this->template_dir; + return $this->{$type}; } /** @@ -972,54 +865,20 @@ */ public function setConfigDir($config_dir) { - $this->config_dir = array(); - foreach ((array) $config_dir as $k => $v) { - $this->config_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; - } - - $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir); - - return $this; + return $this->setTemplateDir($config_dir, true); } /** * Add config directory(s) * - * @param string|array $config_dir directory(s) of config sources - * @param mixed $key key of the array element to assign the config dir to + * @param string|array $config_dir directory(s) of config sources + * @param mixed $key key of the array element to assign the config dir to * * @return Smarty current Smarty instance for chaining */ public function addConfigDir($config_dir, $key = null) { - // make sure we're dealing with an array - $this->config_dir = (array) $this->config_dir; - - if (is_array($config_dir)) { - foreach ($config_dir as $k => $v) { - $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS; - if (is_int($k)) { - // indexes are not merged but appended - $this->config_dir[] = $v; - } else { - // string indexes are overridden - $this->config_dir[$k] = $v; - } - } - } else { - $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS; - if ($key !== null) { - // override directory at specified index - $this->config_dir[$key] = rtrim($v, '/\\') . DS; - } else { - // append new directory - $this->config_dir[] = rtrim($v, '/\\') . DS; - } - } - - $this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir); - - return $this; + return $this->addTemplateDir($config_dir, $key, true); } /** @@ -1027,15 +886,11 @@ * * @param mixed $index index of directory to get, null to get all * - * @return array|string configuration directory + * @return array configuration directory */ public function getConfigDir($index = null) { - if ($index !== null) { - return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null; - } - - return (array) $this->config_dir; + return $this->getTemplateDir($index, true); } /** @@ -1047,11 +902,10 @@ */ public function setPluginsDir($plugins_dir) { - $this->plugins_dir = array(); - foreach ((array) $plugins_dir as $k => $v) { - $this->plugins_dir[$k] = rtrim($v, '/\\') . DS; + $this->plugins_dir = (array) $plugins_dir; + if (isset($this->_cache['plugins_dir'])) { + unset($this->_cache['plugins_dir']); } - return $this; } @@ -1064,26 +918,13 @@ */ public function addPluginsDir($plugins_dir) { - // make sure we're dealing with an array - $this->plugins_dir = (array) $this->plugins_dir; - - if (is_array($plugins_dir)) { - foreach ($plugins_dir as $k => $v) { - if (is_int($k)) { - // indexes are not merged but appended - $this->plugins_dir[] = rtrim($v, '/\\') . DS; - } else { - // string indexes are overridden - $this->plugins_dir[$k] = rtrim($v, '/\\') . DS; - } - } - } else { - // append new directory - $this->plugins_dir[] = rtrim($plugins_dir, '/\\') . DS; + if (!isset($this->plugins_dir)) { + $this->plugins_dir = array(SMARTY_PLUGINS_DIR); } - - $this->plugins_dir = array_unique($this->plugins_dir); - + $this->plugins_dir = array_merge((array) $this->plugins_dir, (array) $plugins_dir); + if (isset($this->_cache['plugins_dir'])) { + unset($this->_cache['plugins_dir']); + } return $this; } @@ -1094,7 +935,21 @@ */ public function getPluginsDir() { - return (array) $this->plugins_dir; + if (!isset($this->_cache['plugins_dir'])) { + if (!isset($this->plugins_dir)) { + $this->plugins_dir = array(SMARTY_PLUGINS_DIR); + } else { + $plugins_dir = (array) $this->plugins_dir; + $this->plugins_dir = array(); + foreach ($plugins_dir as $v) { + $this->plugins_dir[] = $this->_realpath($v . DS, true); + } + $this->plugins_dir = array_unique($this->plugins_dir); + } + $this->_cache['plugin_files'] = array(); + $this->_cache['plugins_dir'] = true; + } + return $this->plugins_dir; } /** @@ -1106,11 +961,11 @@ */ public function setCompileDir($compile_dir) { - $this->compile_dir = rtrim($compile_dir, '/\\') . DS; + $this->compile_dir = $this->_realpath($compile_dir . DS, true); if (!isset(Smarty::$_muted_directories[$this->compile_dir])) { Smarty::$_muted_directories[$this->compile_dir] = null; } - + $this->_cache['compile_dir'] = true; return $this; } @@ -1121,6 +976,13 @@ */ public function getCompileDir() { + if (!isset($this->_cache['compile_dir'])) { + $this->compile_dir = $this->_realpath($this->compile_dir . DS, true); + if (!isset(Smarty::$_muted_directories[$this->compile_dir])) { + Smarty::$_muted_directories[$this->compile_dir] = null; + } + $this->_cache['compile_dir'] = true; + } return $this->compile_dir; } @@ -1133,11 +995,11 @@ */ public function setCacheDir($cache_dir) { - $this->cache_dir = rtrim($cache_dir, '/\\') . DS; + $this->cache_dir = $this->_realpath($cache_dir . DS, true); if (!isset(Smarty::$_muted_directories[$this->cache_dir])) { Smarty::$_muted_directories[$this->cache_dir] = null; } - + $this->_cache['cache_dir'] = true; return $this; } @@ -1148,347 +1010,376 @@ */ public function getCacheDir() { + if (!isset($this->_cache['cache_dir'])) { + $this->cache_dir = $this->_realpath($this->cache_dir . DS, true); + if (!isset(Smarty::$_muted_directories[$this->cache_dir])) { + Smarty::$_muted_directories[$this->cache_dir] = null; + } + $this->_cache['cache_dir'] = true; + } return $this->cache_dir; } /** - * Set default modifiers + * add directories to given property name * - * @param array|string $modifiers modifier or list of modifiers to set - * - * @return Smarty current Smarty instance for chaining + * @param string $dirName directory property name + * @param string|array $dir directory string or array of strings + * @param mixed $key optional key */ - public function setDefaultModifiers($modifiers) + private function _addDir($dirName, $dir, $key = null) { - $this->default_modifiers = (array) $modifiers; - - return $this; + $rp = $this->_cache[$dirName]; + if (is_array($dir)) { + foreach ($dir as $k => $v) { + $path = $rp ? $this->_realpath($v . DS, true) : $v; + if (is_int($k)) { + // indexes are not merged but appended + $this->{$dirName}[] = $path; + } else { + // string indexes are overridden + $this->{$dirName}[$k] = $path; + } + } + } else { + $path = $rp ? $this->_realpath($dir . DS, true) : $dir; + if ($key !== null) { + // override directory at specified index + $this->{$dirName}[$key] = $path; + } else { + // append new directory + $this->{$dirName}[] = $path; + } + } } /** - * Add default modifiers + * creates a template object * - * @param array|string $modifiers modifier or list of modifiers to add + * @param string $template the resource handle of the template file + * @param mixed $cache_id cache id to be used with this template + * @param mixed $compile_id compile id to be used with this template + * @param object $parent next higher level of Smarty variables + * @param boolean $do_clone flag is Smarty object shall be cloned * - * @return Smarty current Smarty instance for chaining + * @return object template object */ - public function addDefaultModifiers($modifiers) + public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true) { - if (is_array($modifiers)) { - $this->default_modifiers = array_merge($this->default_modifiers, $modifiers); + if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) { + $parent = $cache_id; + $cache_id = null; + } + if ($parent !== null && is_array($parent)) { + $data = $parent; + $parent = null; } else { - $this->default_modifiers[] = $modifiers; + $data = null; } - - return $this; + if ($this->caching && + isset($this->_cache['isCached'][$_templateId = $this->_getTemplateId($template, $cache_id, $compile_id)]) + ) { + $tpl = $do_clone ? clone $this->_cache['isCached'][$_templateId] : $this->_cache['isCached'][$_templateId]; + $tpl->parent = $parent; + $tpl->tpl_vars = array(); + $tpl->config_vars = array(); + } else { + /* @var Smarty_Internal_Template $tpl */ + $tpl = new $this->template_class($template, $this, $parent, $cache_id, $compile_id, null, null); + } + if ($do_clone) { + $tpl->smarty = clone $tpl->smarty; + } elseif ($parent === null) { + $tpl->parent = $this; + } + // fill data if present + if (!empty($data) && is_array($data)) { + // set up variable values + foreach ($data as $_key => $_val) { + $tpl->tpl_vars[$_key] = new Smarty_Variable($_val); + } + } + if ($this->debugging || $this->debugging_ctrl == 'URL') { + $tpl->smarty->_debug = new Smarty_Internal_Debug(); + // check URL debugging control + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + $tpl->smarty->_debug->debugUrl($tpl->smarty); + } + } + return $tpl; } /** - * Get default modifiers + * Takes unknown classes and loads plugin files for them + * class name format: Smarty_PluginType_PluginName + * plugin filename format: plugintype.pluginname.php * - * @return array list of default modifiers + * @param string $plugin_name class plugin name to load + * @param bool $check check if already loaded + * + * @throws SmartyException + * @return string |boolean filepath of loaded file or false */ - public function getDefaultModifiers() + public function loadPlugin($plugin_name, $check = true) { - return $this->default_modifiers; + return $this->ext->loadPlugin->loadPlugin($this, $plugin_name, $check); } /** - * Set autoload filters + * Get unique template id * - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types + * @param string $template_name + * @param null|mixed $cache_id + * @param null|mixed $compile_id + * @param null $caching * - * @return Smarty current Smarty instance for chaining + * @return string */ - public function setAutoloadFilters($filters, $type = null) + public function _getTemplateId($template_name, $cache_id = null, $compile_id = null, $caching = null) { - if ($type !== null) { - $this->autoload_filters[$type] = (array) $filters; + $cache_id = $cache_id === null ? $this->cache_id : $cache_id; + $compile_id = $compile_id === null ? $this->compile_id : $compile_id; + $caching = (int) ($caching === null ? $this->caching : $caching); + + if ($this->allow_ambiguous_resources) { + $_templateId = + Smarty_Resource::getUniqueTemplateName($this, $template_name) . "#{$cache_id}#{$compile_id}#{$caching}"; } else { - $this->autoload_filters = (array) $filters; + $_templateId = $this->_joined_template_dir . "#{$template_name}#{$cache_id}#{$compile_id}#{$caching}"; } - - return $this; + if (isset($_templateId[150])) { + $_templateId = sha1($_templateId); + } + return $_templateId; } /** - * Add autoload filters + * Normalize path + * - remove /./ and /../ + * - make it absolute if required * - * @param array $filters filters to load automatically - * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types + * @param string $path file path + * @param bool $realpath leave $path relative * - * @return Smarty current Smarty instance for chaining + * @return string */ - public function addAutoloadFilters($filters, $type = null) + public function _realpath($path, $realpath = null) { ... [truncated message content] |
From: <chr...@us...> - 2016-05-20 20:42:07
|
Revision: 1842 http://sourceforge.net/p/postfixadmin/code/1842 Author: christian_boltz Date: 2016-05-20 20:42:04 +0000 (Fri, 20 May 2016) Log Message: ----------- Add CSRF protection for POST requests Add the CSRF token to all forms, and validate it when those forms are submitted. https://sourceforge.net/p/postfixadmin/bugs/372/ Modified Paths: -------------- trunk/broadcast-message.php trunk/edit.php trunk/sendmail.php trunk/templates/broadcast-message.tpl trunk/templates/editform.tpl trunk/templates/password.tpl trunk/templates/sendmail.tpl trunk/templates/users_edit-alias.tpl trunk/templates/vacation.tpl trunk/users/edit-alias.php trunk/users/password.php trunk/vacation.php Modified: trunk/broadcast-message.php =================================================================== --- trunk/broadcast-message.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/broadcast-message.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -38,6 +38,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); + if (empty($_POST['subject']) || empty($_POST['message']) || empty($_POST['name'])) { $error = 1; Modified: trunk/edit.php =================================================================== --- trunk/edit.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/edit.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -93,6 +93,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); $inp_values = safepost('value', array() ); foreach($form_fields as $key => $field) { Modified: trunk/sendmail.php =================================================================== --- trunk/sendmail.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/sendmail.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -39,6 +39,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); + $fTo = safepost('fTo'); $fFrom = $smtp_from_email; $fSubject = safepost('fSubject'); Modified: trunk/templates/broadcast-message.tpl =================================================================== --- trunk/templates/broadcast-message.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/broadcast-message.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -1,5 +1,6 @@ <div id="edit_form"> <form name="broadcast-message" method="post" action=""> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> <th colspan="2">{$PALANG.pBroadcast_title}</th> Modified: trunk/templates/editform.tpl =================================================================== --- trunk/templates/editform.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/editform.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -1,6 +1,7 @@ <div id="edit_form"> <form name="edit_{$table}" method="post" action=""> <input class="flat" type="hidden" name="table" value="{$table}" /> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> Modified: trunk/templates/password.tpl =================================================================== --- trunk/templates/password.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/password.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -1,5 +1,6 @@ <div id="edit_form"> <form name="password" method="post" action=""> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> <th colspan="3">{$PALANG.pPassword_welcome}</th> Modified: trunk/templates/sendmail.tpl =================================================================== --- trunk/templates/sendmail.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/sendmail.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -1,5 +1,6 @@ <div id="edit_form"> <form name="mailbox" method="post" action=""> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> <th colspan="3">{$PALANG.pSendmail_welcome}</th> Modified: trunk/templates/users_edit-alias.tpl =================================================================== --- trunk/templates/users_edit-alias.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/users_edit-alias.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -1,5 +1,6 @@ <div id="edit_form"> <form name="alias" method="post" action=""> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> <th colspan="3">{$PALANG.pEdit_alias_welcome}<br /><em>{$PALANG.pEdit_alias_help}</em></th> Modified: trunk/templates/vacation.tpl =================================================================== --- trunk/templates/vacation.tpl 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/templates/vacation.tpl 2016-05-20 20:42:04 UTC (rev 1842) @@ -3,6 +3,7 @@ {/literal} <div id="edit_form"> <form name="edit-vacation" method="post" action=''> +<input class="flat" type="hidden" name="token" value="{$smarty.session.PFA_token|escape:"url"}" /> <table> <tr> <th colspan="3">{$PALANG.pUsersVacation_welcome}</th> Modified: trunk/users/edit-alias.php =================================================================== --- trunk/users/edit-alias.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/users/edit-alias.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -52,6 +52,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); + // user clicked on cancel button if(isset($_POST['fCancel'])) { header("Location: main.php"); Modified: trunk/users/password.php =================================================================== --- trunk/users/password.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/users/password.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -37,6 +37,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); + if(isset($_POST['fCancel'])) { header("Location: main.php"); exit(0); Modified: trunk/vacation.php =================================================================== --- trunk/vacation.php 2016-05-20 20:27:29 UTC (rev 1841) +++ trunk/vacation.php 2016-05-20 20:42:04 UTC (rev 1842) @@ -103,6 +103,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") { + if (safepost('token') != $_SESSION['PFA_token']) die('Invalid token!'); + if(isset($_POST['fCancel'])) { header ("Location: $Return_url"); exit(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-05-22 19:58:56
|
Revision: 1853 http://sourceforge.net/p/postfixadmin/code/1853 Author: christian_boltz Date: 2016-05-22 19:58:54 +0000 (Sun, 22 May 2016) Log Message: ----------- Add checks to login.php and cli to ensure database layout is up to date - add check_db_version() to functions.inc.php - add $min_db_version (needs to be updated at least before the release) - call check_db_version in login.php, users/login.php and CLI - they'll error out if the database layout is outdated - change setup.php to use check_db_version() Modified Paths: -------------- trunk/functions.inc.php trunk/login.php trunk/scripts/postfixadmin-cli.php trunk/upgrade.php trunk/users/login.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2016-05-22 19:26:52 UTC (rev 1852) +++ trunk/functions.inc.php 2016-05-22 19:58:54 UTC (rev 1853) @@ -16,6 +16,7 @@ */ $version = '2.93'; +$min_db_version = 1835; # update (at least) before a release with the latest function numbrer in upgrade.php /** * check_session @@ -1754,8 +1755,35 @@ return $CONF['database_prefix'].$table; } +/* + * check if the database layout is up to date + * returns the current 'version' value from the config table + * if $error_out is True (default), die() with a message that recommends to run setup.php. + */ +function check_db_version($error_out = True) { + global $min_db_version; + $table = table_by_key('config'); + $sql = "SELECT value FROM $table WHERE name = 'version'"; + $r = db_query($sql); + + if($r['rows'] == 1) { + $row = db_assoc($r['result']); + $dbversion = $row['value']; + } else { + $dbversion = 0; + db_query("INSERT INTO $table (name, value) VALUES ('version', '0')", 0, ''); + } + + if ( ($dbversion < $min_db_version) && $error_out == True) { + echo "ERROR: The PostfixAdmin database layout is outdated (you have r$dbversion, but r$min_db_version is expected).\nPlease run setup.php to upgrade the database.\n"; + exit(1); + } + + return $dbversion; +} + /* Called after an alias_domain has been deleted in the DBMS. Returns: boolean. Modified: trunk/login.php =================================================================== --- trunk/login.php 2016-05-22 19:26:52 UTC (rev 1852) +++ trunk/login.php 2016-05-22 19:58:54 UTC (rev 1853) @@ -34,6 +34,7 @@ exit; } +check_db_version(); # check if the database layout is up to date (and error out if not) if ($_SERVER['REQUEST_METHOD'] == "POST") { Modified: trunk/scripts/postfixadmin-cli.php =================================================================== --- trunk/scripts/postfixadmin-cli.php 2016-05-22 19:26:52 UTC (rev 1852) +++ trunk/scripts/postfixadmin-cli.php 2016-05-22 19:58:54 UTC (rev 1853) @@ -177,6 +177,9 @@ return false; } + # make sure global variables fron functions.inc.php end up in the global namespace, instead of being local to this function + global $version, $min_db_version; + if (!require_once(PATH . '/common.php')) { $this->stderr("Failed to load " . PATH . '/common.php'); return false; @@ -190,6 +193,8 @@ public function dispatch() { $CONF = Config::read('all'); + check_db_version(); # ensure the database layout is up to date + if (!isset($this->args[0])) { $this->help(); return; Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2016-05-22 19:26:52 UTC (rev 1852) +++ trunk/upgrade.php 2016-05-22 19:58:54 UTC (rev 1853) @@ -131,21 +131,7 @@ db_query_parsed($mysql, 0, " ENGINE = MYISAM COMMENT = 'PostfixAdmin settings'"); } -$sql = "SELECT * FROM $table WHERE name = 'version'"; - -// insert into config('version', '01'); - -$r = db_query($sql); - -if($r['rows'] == 1) { - $rs = $r['result']; - $row = db_array($rs); - $version = $row['value']; -} else { - db_query_parsed("INSERT INTO $table (name, value) VALUES ('version', '0')", 0, ''); - $version = 0; -} - +$version = check_db_version(False); _do_upgrade($version); function _do_upgrade($current_version) { Modified: trunk/users/login.php =================================================================== --- trunk/users/login.php 2016-05-22 19:26:52 UTC (rev 1852) +++ trunk/users/login.php 2016-05-22 19:58:54 UTC (rev 1853) @@ -30,6 +30,7 @@ define('POSTFIXADMIN_LOGOUT', 1); require_once("../common.php"); +check_db_version(); # check if the database layout is up to date (and error out if not) if ($_SERVER['REQUEST_METHOD'] == "POST") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-10-20 20:15:18
|
Revision: 1875 http://sourceforge.net/p/postfixadmin/code/1875 Author: christian_boltz Date: 2016-10-20 20:15:15 +0000 (Thu, 20 Oct 2016) Log Message: ----------- pacrypt(): allow switching between dovecot:* password schemes Dovecot password hashes include a {SCHEME} prefix, so it's possible to switch the scheme while still accepting passwords hashed using the previous dovecot:* scheme. This patch adds the code needed to find out the used hashing scheme from the hash and ensures it gets used to validate the password. Patch by Aaron Lindsay <aaron AT aclindsay com> (sent to the ML) Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2016-10-18 19:49:13 UTC (rev 1874) +++ trunk/CHANGELOG.TXT 2016-10-20 20:15:15 UTC (rev 1875) @@ -9,6 +9,13 @@ # Last update: # $Id$ +Changes since the 3.0.1 release +------------------------------------------------- + + - allow switching between dovecot:* password schemes while still accepting + passwords hashed using the previous dovecot:* scheme + - FetchmailHandler: use a valid date as default for 'date' + Version 3.0.1 - 2016/09/19 - SVN r1870 ------------------------------------------------- Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2016-10-18 19:49:13 UTC (rev 1874) +++ trunk/functions.inc.php 2016-10-20 20:15:15 UTC (rev 1875) @@ -933,7 +933,9 @@ elseif (preg_match("/^dovecot:/", $CONF['encrypt'])) { $split_method = preg_split ('/:/', $CONF['encrypt']); - $method = strtoupper($split_method[1]); # TODO: if $pw_db starts with {method}, change $method accordingly + $method = strtoupper($split_method[1]); + # If $pw_db starts with {method}, change $method accordingly + if (!empty($pw_db) && preg_match('/^\{([A-Z0-9.-]+)\}.+/', $pw_db, $method_matches)) { $method = $method_matches[1]; } if (! preg_match("/^[A-Z0-9.-]+$/", $method)) { die("invalid dovecot encryption method"); } # TODO: check against a fixed list? # if (strtolower($method) == 'md5-crypt') die("\$CONF['encrypt'] = 'dovecot:md5-crypt' will not work because dovecotpw generates a random salt each time. Please use \$CONF['encrypt'] = 'md5crypt' instead."); # $crypt_method = preg_match ("/.*-CRYPT$/", $method); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-10-20 21:26:15
|
Revision: 1876 http://sourceforge.net/p/postfixadmin/code/1876 Author: christian_boltz Date: 2016-10-20 21:26:13 +0000 (Thu, 20 Oct 2016) Log Message: ----------- upate wiki links mediawiki -> SF wiki Modified Paths: -------------- trunk/INSTALL.TXT trunk/config.inc.php Modified: trunk/INSTALL.TXT =================================================================== --- trunk/INSTALL.TXT 2016-10-20 20:15:15 UTC (rev 1875) +++ trunk/INSTALL.TXT 2016-10-20 21:26:13 UTC (rev 1876) @@ -22,7 +22,7 @@ Users check out: - the PostfixAdmin documentation in the DOCUMENTS/ directory - - our wiki at http://sourceforge.net/apps/mediawiki/postfixadmin/ + - our wiki at https://sourceforge.net/p/postfixadmin/wiki/ There are also lots of HOWTOs around the web. Be warned that many of them (even those listed below) may be outdated or incomplete. Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2016-10-20 20:15:15 UTC (rev 1875) +++ trunk/config.inc.php 2016-10-20 21:26:13 UTC (rev 1876) @@ -262,7 +262,7 @@ PostfixAdmin, but it does not create it in the database. You have to do that yourself. Please follow the naming policy for custom database fields and tables on - http://sourceforge.net/apps/mediawiki/postfixadmin/index.php?title=Custom_fields + https://sourceforge.net/p/postfixadmin/wiki/Custom_fields/ to avoid clashes with future versions of PostfixAdmin. See initStruct() in the *Handler class for the default $struct. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-10-31 20:15:33
|
Revision: 1877 http://sourceforge.net/p/postfixadmin/code/1877 Author: christian_boltz Date: 2016-10-31 20:15:31 +0000 (Mon, 31 Oct 2016) Log Message: ----------- AliasHandler: restrict __is_mailbox subquery to allowed domains This improves performance on setups with lots of mailboxes. Well, except for superadmins because restricting to "all domains" doesn't really help ;-) Thanks to gygy for reporting this on IRC, and for testing the patch. Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/model/AliasHandler.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2016-10-20 21:26:13 UTC (rev 1876) +++ trunk/CHANGELOG.TXT 2016-10-31 20:15:31 UTC (rev 1877) @@ -12,6 +12,8 @@ Changes since the 3.0.1 release ------------------------------------------------- + - AliasHandler: restrict mailbox subquery to allowed domains to improve + performance (except for superadmins ;-) on setups with lots of mailboxes - allow switching between dovecot:* password schemes while still accepting passwords hashed using the previous dovecot:* scheme - FetchmailHandler: use a valid date as default for 'date' Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2016-10-20 21:26:13 UTC (rev 1876) +++ trunk/model/AliasHandler.php 2016-10-31 20:15:31 UTC (rev 1877) @@ -48,6 +48,7 @@ ' SELECT 1 as __is_mailbox, username as __mailbox_username ' . ' FROM ' . table_by_key('mailbox') . ' WHERE username IS NOT NULL ' . + ' AND ' . db_in_clause($this->domain_field, $this->allowed_domains) . ' ) AS __mailbox ON __mailbox_username = address' ), 'goto_mailbox' => pacol( $mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0, /*options*/ '', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-11-01 17:43:35
|
Revision: 1879 http://sourceforge.net/p/postfixadmin/code/1879 Author: christian_boltz Date: 2016-11-01 17:43:32 +0000 (Tue, 01 Nov 2016) Log Message: ----------- beautify alias list search parameters AliasHandler: - initStruct(): handle __mailbox_username as separate field (needed to make it searchable) - split off a condition_ignore_mailboxes() function (used in getList() and getPagebrowser()) to add '__mailbox_username IS NULL' to the search condition array. Also, make sure $condition can be an array (preferred) or a string with a raw query list-virtual.php: - hand over a search array instead of a raw query Modified Paths: -------------- trunk/list-virtual.php trunk/model/AliasHandler.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2016-11-01 15:45:45 UTC (rev 1878) +++ trunk/list-virtual.php 2016-11-01 17:43:32 UTC (rev 1879) @@ -136,10 +136,9 @@ $table_mailbox = table_by_key('mailbox'); if (count($search) == 0 || !isset($search['_'])) { - $list_param = "domain='$fDomain'"; + $search_alias = array('domain' => $fDomain); } else { - $searchterm = escape_string($search['_']); - $list_param = "(address LIKE '%$searchterm%' OR goto LIKE '%$searchterm%')"; + $search_alias = array('_' => $search['_']); } $handler = new AliasHandler(0, $admin_username); @@ -153,8 +152,8 @@ $alias_data['struct']['on_vacation']['display_in_list'] = 0; $alias_data['msg']['show_simple_search'] = False; # hide search box -$handler->getList($list_param, array(), $page_size, $fDisplay); -$pagebrowser_alias = $handler->getPagebrowser($list_param, array()); +$handler->getList($search_alias, array(), $page_size, $fDisplay); +$pagebrowser_alias = $handler->getPagebrowser($search_alias, array()); $tAlias = $handler->result(); Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2016-11-01 15:45:45 UTC (rev 1878) +++ trunk/model/AliasHandler.php 2016-11-01 17:43:32 UTC (rev 1879) @@ -42,7 +42,7 @@ /*options*/ '', /*not_in_db*/ 0, /*dont_write_to_db*/ 1, - /*select*/ 'coalesce(__is_mailbox,0) as is_mailbox, __mailbox_username', + /*select*/ 'coalesce(__is_mailbox,0) as is_mailbox', # __mailbox_username is unused, but needed as workaround for a MariaDB bug /*extrafrom*/ 'LEFT JOIN ( ' . ' SELECT 1 as __is_mailbox, username as __mailbox_username ' . @@ -50,6 +50,7 @@ ' WHERE username IS NOT NULL ' . ' AND ' . db_in_clause($this->domain_field, $this->allowed_domains) . ' ) AS __mailbox ON __mailbox_username = address' ), + '__mailbox_username' => pacol( 0, 0, 1, 'vtxt', '' , '' , 0), # filled via is_mailbox 'goto_mailbox' => pacol( $mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0, /*options*/ '', /*not_in_db*/ 1 ), # read_from_db_postprocess() sets the value @@ -304,22 +305,28 @@ return $db_result; } - public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) { + private function condition_ignore_mailboxes($condition, $searchmode) { # only list aliases that do not belong to mailboxes - # TODO: breaks if $condition is an array - if ($condition != '') { - $condition = " AND ( $condition ) "; + if (is_array($condition)) { + $condition['__mailbox_username'] = 1; + $searchmode['__mailbox_username'] = 'NULL'; + } else { + if ($condition != '') { + $condition = " ( $condition ) AND "; + } + $condition = " $condition __mailbox_username IS NULL "; } - return parent::getList( "__mailbox_username IS NULL $condition", $searchmode, $limit, $offset); + return array($condition, $searchmode); } + public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) { + list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode); + return parent::getList($condition, $searchmode, $limit, $offset); + } + public function getPagebrowser($condition, $searchmode = array()) { - # only list aliases that do not belong to mailboxes - # TODO: breaks if $condition is an array - if ($condition != '') { - $condition = " AND ( $condition ) "; - } - return parent::getPagebrowser( "__mailbox_username IS NULL $condition", $searchmode); + list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode); + return parent::getPagebrowser($condition, $searchmode); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2016-11-09 20:41:26
|
Revision: 1882 http://sourceforge.net/p/postfixadmin/code/1882 Author: christian_boltz Date: 2016-11-09 20:41:24 +0000 (Wed, 09 Nov 2016) Log Message: ----------- AliasHandler: restrict mailbox subquery to requested domains set_is_mailbox_extrafrom() restricts the domain list to the domain that needs to be checked (in normal list-virtual listing one domain), and is then used to restore the default extrafrom. This improves the performance for most usecases even for superadmins. Note: Search mode might still be slow because by default it searches in all domains available to the admin. Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/model/AliasHandler.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2016-11-01 20:31:52 UTC (rev 1881) +++ trunk/CHANGELOG.TXT 2016-11-09 20:41:24 UTC (rev 1882) @@ -12,8 +12,8 @@ Changes since the 3.0.1 release ------------------------------------------------- - - AliasHandler: restrict mailbox subquery to allowed domains to improve - performance (except for superadmins ;-) on setups with lots of mailboxes + - AliasHandler: restrict mailbox subquery to allowed and specified domains + to improve performance on setups with lots of mailboxes - allow switching between dovecot:* password schemes while still accepting passwords hashed using the previous dovecot:* scheme - FetchmailHandler: use a valid date as default for 'date' Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2016-11-01 20:31:52 UTC (rev 1881) +++ trunk/model/AliasHandler.php 2016-11-09 20:41:24 UTC (rev 1882) @@ -42,14 +42,8 @@ /*options*/ '', /*not_in_db*/ 0, /*dont_write_to_db*/ 1, - /*select*/ 'coalesce(__is_mailbox,0) as is_mailbox', - # __mailbox_username is unused, but needed as workaround for a MariaDB bug - /*extrafrom*/ 'LEFT JOIN ( ' . - ' SELECT 1 as __is_mailbox, username as __mailbox_username ' . - ' FROM ' . table_by_key('mailbox') . - ' WHERE username IS NOT NULL ' . - ' AND ' . db_in_clause($this->domain_field, $this->allowed_domains) . - ' ) AS __mailbox ON __mailbox_username = address' ), + /*select*/ 'coalesce(__is_mailbox,0) as is_mailbox' ), + /*extrafrom set via set_is_mailbox_extrafrom() */ '__mailbox_username' => pacol( 0, 0, 1, 'vtxt', '' , '' , 0), # filled via is_mailbox 'goto_mailbox' => pacol( $mbgoto, $mbgoto,$mbgoto,'bool', 'pEdit_alias_forward_and_store' , '' , 0, /*options*/ '', @@ -66,8 +60,37 @@ array('select' => '1 as _can_delete') ), # read_from_db_postprocess() updates the value # aliases listed in $CONF[default_aliases] are read-only for domain admins if $CONF[special_alias_control] is NO. ); + + $this->set_is_mailbox_extrafrom(); } + /* + * set $this->struct['is_mailbox']['extrafrom'] based on the search conditions. + * If a listing for a specific domain is requested, optimize the subquery to only return mailboxes from that domain. + * This doesn't change the result of the main query, but improves the performance a lot on setups with lots of mailboxes. + * When using this function to optimize the is_mailbox extrafrom, don't forget to reset it to the default value + * (all domains for this admin) afterwards. + */ + private function set_is_mailbox_extrafrom($condition=array(), $searchmode=array()) { + $extrafrom = 'LEFT JOIN ( ' . + ' SELECT 1 as __is_mailbox, username as __mailbox_username ' . + ' FROM ' . table_by_key('mailbox') . + ' WHERE username IS NOT NULL '; + + if(isset($condition['domain']) && !isset($searchmode['domain']) && in_array($condition['domain'], $this->allowed_domains)) { + # listing for a specific domain, so restrict subquery to that domain + $extrafrom .= ' AND ' . db_in_clause($this->domain_field, array($condition['domain'])); + } else { + # restrict subquery to all domains accessible to this admin + $extrafrom .= ' AND ' . db_in_clause($this->domain_field, $this->allowed_domains); + } + + $extrafrom .= ' ) AS __mailbox ON __mailbox_username = address'; + + $this->struct['is_mailbox']['extrafrom'] = $extrafrom; + } + + protected function initMsg() { $this->msg['error_already_exists'] = 'email_address_already_exists'; $this->msg['error_does_not_exist'] = 'alias_does_not_exist'; @@ -321,12 +344,18 @@ public function getList($condition, $searchmode = array(), $limit=-1, $offset=-1) { list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode); - return parent::getList($condition, $searchmode, $limit, $offset); + $this->set_is_mailbox_extrafrom($condition, $searchmode); + $result = parent::getList($condition, $searchmode, $limit, $offset); + $this->set_is_mailbox_extrafrom(); # reset to default + return $result; } public function getPagebrowser($condition, $searchmode = array()) { list($condition, $searchmode) = $this->condition_ignore_mailboxes($condition, $searchmode); - return parent::getPagebrowser($condition, $searchmode); + $this->set_is_mailbox_extrafrom($condition, $searchmode); + $result = parent::getPagebrowser($condition, $searchmode); + $this->set_is_mailbox_extrafrom(); # reset to default + return $result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2017-02-08 17:53:16
|
Revision: 1889 http://sourceforge.net/p/postfixadmin/code/1889 Author: christian_boltz Date: 2017-02-08 17:53:13 +0000 (Wed, 08 Feb 2017) Log Message: ----------- Security fix: don't allow to delete protected aliases (CVE-2017-5930) Thanks to Janfred, https://github.com/postfixadmin/postfixadmin/pull/23 Modified Paths: -------------- trunk/languages/bg.lang trunk/languages/ca.lang trunk/languages/cn.lang trunk/languages/cs.lang trunk/languages/da.lang trunk/languages/de.lang trunk/languages/en.lang trunk/languages/es.lang trunk/languages/et.lang trunk/languages/eu.lang trunk/languages/fi.lang trunk/languages/fo.lang trunk/languages/fr.lang trunk/languages/hr.lang trunk/languages/hu.lang trunk/languages/is.lang trunk/languages/it.lang trunk/languages/ja.lang trunk/languages/lt.lang trunk/languages/mk.lang trunk/languages/nb.lang trunk/languages/nl.lang trunk/languages/nn.lang trunk/languages/pl.lang trunk/languages/pt-br.lang trunk/languages/ro.lang trunk/languages/ru.lang trunk/languages/sk.lang trunk/languages/sl.lang trunk/languages/sv.lang trunk/languages/tr.lang trunk/languages/tw.lang trunk/model/AliasHandler.php Modified: trunk/languages/bg.lang =================================================================== --- trunk/languages/bg.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/bg.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'За да създадете catch-all използвайте "*" за alias. За пренасочване на домейн към домейн използвайте "*@domain.tld" в полето Към.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Редактиране на alias за вашия домейн.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Един запис на ред.'; # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/ca.lang =================================================================== --- trunk/languages/ca.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/ca.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -124,6 +124,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Per crear un àlies general usi "*" com a àlies. Per una redirecció de domini a domini, usi "*@domain.tld" com a Destí.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Editi un àlies pel seu domini.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Una entrada per línia.'; # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/cn.lang =================================================================== --- trunk/languages/cn.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/cn.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = '要将所有的邮件全部转发请使用"*"作为别名. 域到域的转发请使用"*@domain.tld".'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = '编辑你域名中的别名.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = '每行一条记录.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/cs.lang =================================================================== --- trunk/languages/cs.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/cs.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -131,6 +131,7 @@ $PALANG['alias_updated'] = 'Přesměrování %s bylo upraveno!'; $PALANG['pCreate_alias_catchall_text'] = 'Pro vytvoření doménového koše použijte * jako alias. Pro přesměrování doména -> doména použijte *@domain.tld jako cíl.'; $PALANG['mailbox_alias_cant_be_deleted'] = 'Toto přesměrování je svázáno s emailem a nemůže být proto vymazáno!'; +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Upravit nastavení přesměrování.'; $PALANG['pEdit_alias_help'] = 'Je možné zadat více cílových adres, jeden záznam na řádek.'; Modified: trunk/languages/da.lang =================================================================== --- trunk/languages/da.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/da.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -130,6 +130,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'For at tilføje et stjerne-alias, brug en "*" som alias. For domæne til domæne-videresending brug "*@domæne.tld" som modtager.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Rediger alias.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'En modtager pr. linje.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/de.lang =================================================================== --- trunk/languages/de.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/de.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -127,6 +127,7 @@ $PALANG['alias_updated'] = 'Der Alias %s wurde geändert.'; $PALANG['pCreate_alias_catchall_text'] = 'Um alle Adressen abzudecken benutzen Sie einen "*" als Alias. Um ganze Domains an andere Domains weiterzuleiten benutzen Sie "*@domain.tld" im "An"-Feld.'; $PALANG['mailbox_alias_cant_be_deleted'] = 'Dieser Alias gehört zu einer Mailbox und kann nicht gelöscht werden!'; +$PALANG['protected_alias_cant_be_deleted'] = 'Der Alias %s ist geschützt und kann nur von einem Superadmin gelöscht werden.'; $PALANG['pEdit_alias_welcome'] = 'Weiterleitungs-Einstellungen ändern'; $PALANG['pEdit_alias_help'] = 'Angabe mehrerer Ziele möglich, ein Eintrag pro Zeile.'; Modified: trunk/languages/en.lang =================================================================== --- trunk/languages/en.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/en.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -128,6 +128,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; $PALANG['pCreate_alias_catchall_text'] = 'To create a catch-all use an "*" as alias.'; # XXX don't propagate usage of *@target-domain.com for domain-aliasing any longer $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; $PALANG['pEdit_alias_welcome'] = 'Edit forwarding settings'; $PALANG['pEdit_alias_help'] = 'Accepts multiple targets, one entry per line.'; Modified: trunk/languages/es.lang =================================================================== --- trunk/languages/es.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/es.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Para crear un alias general use "*" como alias. Para una redirección de dominio a dominio, use "*@domain.tld" como Destino.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Edite un alias para su dominio.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Una entrada por línea.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/et.lang =================================================================== --- trunk/languages/et.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/et.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Loomaks püüa-kõik aadressi kasuta aliasena "*". Domeenilt domeenile edasisaatmiseks kasuta kellele väljal "*@domeen.xx".'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Muuda aliast.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Üks kirje rea kohta.'; # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/eu.lang =================================================================== --- trunk/languages/eu.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/eu.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -123,6 +123,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Alias orokor bat sortzeko "*" erabil ezazu alias gisa. Domeinuz domeinurako birbideraketa baterako Norako gisa "*@domain.tld" erabil ezazu.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Domeinuarentzat aliasa aldatu.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Lerroko sarrera bat.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/fi.lang =================================================================== --- trunk/languages/fi.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/fi.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Jos haluat luoda catch-all osoitteen käytä "*" merkkiä aliaksena. Ohjaus domainista domainiin tapahtuu käyttämällä "*@domain.tld" Kenelle: -osoitteena.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Muokkaa aliasta.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Yksi kohta per rivi.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' $PALANG['alias'] = 'Alias'; Modified: trunk/languages/fo.lang =================================================================== --- trunk/languages/fo.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/fo.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Fyri at stovna eitt ið fangar alt, brúka eina "*" sum dulnevni. Fyri navnaøki til navnaøki víðarisending brúka "*@navnaøki.fo" til hetta.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Broyt eitt dulnevni á tínum navnaøki.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Eina adressu pr. linju.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/fr.lang =================================================================== --- trunk/languages/fr.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/fr.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'L\'alias %s a été mis à jour!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Pour ajouter un alias global, utilisez "*". Pour un transfert de domaine à domaine, utilisez "*@domain.tld" dans le champs A.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'Cet alias appartient à un compte courriel et ne peut être supprimé!'; +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Modifier les paramètres de transfert.'; $PALANG['pEdit_alias_help'] = 'Cibles multiples acceptées, une entrée par ligne.'; Modified: trunk/languages/hr.lang =================================================================== --- trunk/languages/hr.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/hr.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -124,6 +124,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Ukoliko elite stvoriti "sveprimajući" alias, upotrijebite "*" umjesto aliasa. Za preusmjeravanje iz domene na domenu, upotrijebite "*@domena.tld" u "Za" polju.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Uredi alias za domenu.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Jedan unos po liniji.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/hu.lang =================================================================== --- trunk/languages/hu.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/hu.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -127,6 +127,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'A catch-all (*@valami.hu) beállításához használj "*" -ot az alias mezõnél. A domain-domain közötti átirányításhoz használd a "*@akarmi.hu" címet.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Alias szerkesztése a domainhez.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Soronként egy.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/is.lang =================================================================== --- trunk/languages/is.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/is.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Til að útbúa alias fyrir öll netföng í léninu, þá geturðu útbúið "*" alias. Til að áframsenda með alias á annað lén eða pósthólf, notaðu "*@domain.tld í til.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Breyta alias í léninu.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Ein færsla í einu.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/it.lang =================================================================== --- trunk/languages/it.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/it.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Per creare un account universale, usare "*" come alias. Per inoltri da dominio a dominio, usare "*@domain.tld" come campo "a".'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Modifica un alias per il tuo dominio.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Un indirizzo per linea.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/ja.lang =================================================================== --- trunk/languages/ja.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/ja.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -127,6 +127,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'すべてのメールを受け取るには、転送元に "*" を使います。 別のドメインにすべて転送するには、転送先に "*.domain.tld" を使います。'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = '転送先アドレスの編集'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = '1行に1エントリです。'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/lt.lang =================================================================== --- trunk/languages/lt.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/lt.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Jei norite sukurti sinonimą, kuris gautų visas žinutes neegzistuojantiems adresatams, naudokite "*".'; $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Keisti persiuntimo nustatymus'; Modified: trunk/languages/mk.lang =================================================================== --- trunk/languages/mk.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/mk.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'За да креираш catch-all користи "*" како алијас. За препраќање од домен на домен користи "*@domain.tld" како ДО.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Едитирање на алијас за вашиот домен.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Еден запис по линија.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/nb.lang =================================================================== --- trunk/languages/nb.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/nb.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -127,6 +127,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'For å opprette et "catch-all"-alias, bruk "*" som alias. For domene-til-domene-videresending, bruk "*@domene.tld" i Til-feltet.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Endre et alias.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Én e-postadresse per linje.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' $PALANG['alias'] = 'Alias'; Modified: trunk/languages/nl.lang =================================================================== --- trunk/languages/nl.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/nl.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'De alias %s is bijgewerkt!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Om een catch-all te gebruiken, dient u een "*" (asteric) in te vullen als alias. Voor domein naar domein forwarding gebruik "*@domein.tld" als naar.'; $PALANG['mailbox_alias_cant_be_deleted'] = 'De alias maakt onderdeel uit van mailbox en kan niet worden verwijderd!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Bewerk een alias voor uw domein.'; $PALANG['pEdit_alias_help'] = 'Meerdere e-mailadressen toegestaan. Slechts één alias per regel.'; Modified: trunk/languages/nn.lang =================================================================== --- trunk/languages/nn.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/nn.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'For å opprette et alias som "mottar alt" bruk "*" som alias. For domene-til-domene videresending bruk "*@domene.tld" som mottaker.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Endre et alias.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'En mottaker per linje.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' $PALANG['alias'] = 'Alias'; Modified: trunk/languages/pl.lang =================================================================== --- trunk/languages/pl.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/pl.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -128,6 +128,7 @@ $PALANG['alias_updated'] = 'Alias %s został zaktualizowany!'; $PALANG['pCreate_alias_catchall_text'] = 'Aby utworzyć domyślne konto dla domeny (catch-all) podaj "*" (gwiazdkę) jako alias. Jeśli chcesz przekazywać całość poczty do innej domeny, wpisz jako alias "*@domena.tld".'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Edytuj alias dla Twojej domeny.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Jeden wpis na linię.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' $PALANG['alias'] = 'Alias'; Modified: trunk/languages/pt-br.lang =================================================================== --- trunk/languages/pt-br.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/pt-br.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -129,6 +129,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Para criar um alias global, use "*" no campo Alias. Para encaminhar de um domínio para outro, use "*@dominio.tld" no campo Para.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Edição de alias do domínio.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Uma entrada por linha.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/ro.lang =================================================================== --- trunk/languages/ro.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/ro.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -127,6 +127,7 @@ $PALANG['alias_updated'] = 'Aliasul %s a fost modificat!'; $PALANG['pCreate_alias_catchall_text'] = 'Puteti crea un alias pentru adrese multiple prin folosirea "*".'; # XXX don't propagate usage of *@target-domain.com for domain-aliasing any longer $PALANG['mailbox_alias_cant_be_deleted'] = 'Acest alias apartine unei casute si nu poate fi sters!'; +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Editeaza setarile de redirectionare'; $PALANG['pEdit_alias_help'] = 'Se accepta inregistrari multiple, cate una pe linie.'; Modified: trunk/languages/ru.lang =================================================================== --- trunk/languages/ru.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/ru.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -129,6 +129,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Для создания catch-all почтового ящика используйте "*" в качестве имени алиаса.'; # XXX don't propagate usage of *@target-domain.com for domain-aliasing any longer $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Редактирование настроек пересылки'; $PALANG['pEdit_alias_help'] = 'Можно указать несколько целей, одна запись на строку.'; Modified: trunk/languages/sk.lang =================================================================== --- trunk/languages/sk.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/sk.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Pre vytvorenie doménového koša použite * ako alias. Pre alias doména-doména použite *@domain.tld ako cieľ.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Upraviť aliasy'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Jeden záznam na riadku'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/sl.lang =================================================================== --- trunk/languages/sl.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/sl.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Če želite ustvariti "vseobsegajoči" alias, uporabite "*" namesto aliasa. Za posredovanje iz domene na domeno, uporabite "*@domena.si" v "Za" polju.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Uredi alias za določeno domeno.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'V posamezni vrstici je lahko samo en naslov.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/sv.lang =================================================================== --- trunk/languages/sv.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/sv.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -128,6 +128,7 @@ $PALANG['alias_updated'] = 'Aliaset %s är uppdaterat!'; $PALANG['pCreate_alias_catchall_text'] = 'För att skapa en catch-all anges ett "*" som alias.'; $PALANG['mailbox_alias_cant_be_deleted'] = 'Detta alias tillhör en brevlåda och kan inte tas bort!'; +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'Inställningar för vidarebefordring.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Ett alias per rad.'; # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/tr.lang =================================================================== --- trunk/languages/tr.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/tr.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -125,6 +125,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = 'Hepsini-yakala yaratmak için alias olarak "*" kullanýn. Domain yönlendirme domaini için kime kýsmýnda "*@domain.tld" kullanýn.'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = 'domaniniz için bir domain\'i düzenleyin. '; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = 'Satýr baþýna bir giriþ.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/languages/tw.lang =================================================================== --- trunk/languages/tw.lang 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/languages/tw.lang 2017-02-08 17:53:13 UTC (rev 1889) @@ -126,6 +126,7 @@ $PALANG['alias_updated'] = 'The alias %s has been updated!'; # XXX $PALANG['pCreate_alias_catchall_text'] = '要將所有的郵件全部轉發請使用"*"作為別名. 網域到網域的轉發請使用"*@domain.tld".'; # XXX check/beautify - was split in two lines before $PALANG['mailbox_alias_cant_be_deleted'] = 'This alias belongs to a mailbox and can\'t be deleted!'; # XXX +$PALANG['protected_alias_cant_be_deleted'] = 'The alias %s is protected and can only be deleted by a superadmin'; # XXX $PALANG['pEdit_alias_welcome'] = '編輯你網域中的別名.'; # XXX Text change to: 'Edit forwarding settings' $PALANG['pEdit_alias_help'] = '每行一條記錄.'; # XXX # XXX Text change to: 'Accepts multiple targets, one entry per line.' Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2017-01-26 18:22:55 UTC (rev 1888) +++ trunk/model/AliasHandler.php 2017-02-08 17:53:13 UTC (rev 1889) @@ -441,6 +441,11 @@ return false; } + if (!$this->can_delete) { + $this->errormsg[] = Config::Lang_f('protected_alias_cant_be_deleted', $this->id); + return false; + } + db_delete('alias', 'address', $this->id); list(/*NULL*/,$domain) = explode('@', $this->id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2017-02-08 20:45:28
|
Revision: 1894 http://sourceforge.net/p/postfixadmin/code/1894 Author: christian_boltz Date: 2017-02-08 20:45:26 +0000 (Wed, 08 Feb 2017) Log Message: ----------- 3.0.2 release Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2017-02-08 20:24:31 UTC (rev 1893) +++ trunk/CHANGELOG.TXT 2017-02-08 20:45:26 UTC (rev 1894) @@ -9,7 +9,7 @@ # Last update: # $Id$ -Changes since the 3.0.1 release +Version 3.0.2 - 2017/02/08 - SVN r1893 ------------------------------------------------- - SECURITY: don't allow to delete protected aliases (CVE-2017-5930, PR#23) Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2017-02-08 20:24:31 UTC (rev 1893) +++ trunk/functions.inc.php 2017-02-08 20:45:26 UTC (rev 1894) @@ -15,7 +15,7 @@ * Contains re-usable code. */ -$version = '3.0'; +$version = '3.0.2'; $min_db_version = 1835; # update (at least) before a release with the latest function numbrer in upgrade.php /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2018-01-12 20:20:50
|
Revision: 1906 http://sourceforge.net/p/postfixadmin/code/1906 Author: christian_boltz Date: 2018-01-12 20:20:46 +0000 (Fri, 12 Jan 2018) Log Message: ----------- Delete all files and replace them with a README pointing to github Added Paths: ----------- trunk/README Removed Paths: ------------- trunk/ADDITIONS/README.TXT trunk/ADDITIONS/change_password.tgz trunk/ADDITIONS/cleanupdirs.pl trunk/ADDITIONS/convert-passwd-to-postfixadmin.pl trunk/ADDITIONS/cyrus/Changelog trunk/ADDITIONS/cyrus/README-ES.txt trunk/ADDITIONS/cyrus/README.txt trunk/ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl trunk/ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl trunk/ADDITIONS/cyrus/cyrus-mailbox-postedit.pl trunk/ADDITIONS/cyrus/cyrus.conf trunk/ADDITIONS/delete-mailq-by-domain.pl trunk/ADDITIONS/fetchmail.pl trunk/ADDITIONS/import_users_from_csv.py trunk/ADDITIONS/mailbox_remover.pl trunk/ADDITIONS/mkeveryone.pl trunk/ADDITIONS/pfa_maildir_cleanup.pl trunk/ADDITIONS/postfixadmin-domain-postdeletion.sh trunk/ADDITIONS/postfixadmin-mailbox-postcreation.sh trunk/ADDITIONS/postfixadmin-mailbox-postdeletion.sh trunk/ADDITIONS/quota_usage.pl trunk/ADDITIONS/squirrelmail-plugin/INSTALL trunk/ADDITIONS/squirrelmail-plugin/LICENSE.txt trunk/ADDITIONS/squirrelmail-plugin/README trunk/ADDITIONS/squirrelmail-plugin/common.php trunk/ADDITIONS/squirrelmail-plugin/config.php.sample trunk/ADDITIONS/squirrelmail-plugin/debian/README.Debian trunk/ADDITIONS/squirrelmail-plugin/debian/changelog trunk/ADDITIONS/squirrelmail-plugin/debian/conffiles trunk/ADDITIONS/squirrelmail-plugin/debian/control trunk/ADDITIONS/squirrelmail-plugin/debian/copyright trunk/ADDITIONS/squirrelmail-plugin/debian/docs trunk/ADDITIONS/squirrelmail-plugin/debian/files trunk/ADDITIONS/squirrelmail-plugin/debian/postfixadmin-squirrelmail.dirs trunk/ADDITIONS/squirrelmail-plugin/debian/postinst trunk/ADDITIONS/squirrelmail-plugin/debian/rules trunk/ADDITIONS/squirrelmail-plugin/functions.inc.php trunk/ADDITIONS/squirrelmail-plugin/index.php trunk/ADDITIONS/squirrelmail-plugin/locale/build.sh trunk/ADDITIONS/squirrelmail-plugin/locale/cs_CZ/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/cs_CZ/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/da_DK/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/da_DK/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/de_DE/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/de_DE/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/hu_HU/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/hu_HU/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/it_IT/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/nl_NL/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/nl_NL/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/pl_PL/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/pl_PL/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/locale/pt_BR/LC_MESSAGES/postfixadmin.mo trunk/ADDITIONS/squirrelmail-plugin/locale/pt_BR/LC_MESSAGES/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/po/postfixadmin.po trunk/ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php trunk/ADDITIONS/squirrelmail-plugin/postfixadmin_forward.php trunk/ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php trunk/ADDITIONS/squirrelmail-plugin/setup.php trunk/ADDITIONS/squirrelmail-plugin/version trunk/ADDITIONS/virtualmaildel.php trunk/CHANGELOG.TXT trunk/DOCUMENTS/BACKUP_MX.txt trunk/DOCUMENTS/DOVECOT.txt trunk/DOCUMENTS/FAQ.txt trunk/DOCUMENTS/HORDE.txt trunk/DOCUMENTS/LANGUAGE.txt trunk/DOCUMENTS/POSTFIXADMIN.txt trunk/DOCUMENTS/POSTFIX_CONF.txt trunk/DOCUMENTS/SECURITY.txt trunk/DOCUMENTS/SUPERADMIN.txt trunk/DOCUMENTS/UPGRADE.txt trunk/DOCUMENTS/screenshots/README.txt trunk/DOCUMENTS/screenshots/postfixadmin-admin-create-alias.jpg trunk/DOCUMENTS/screenshots/postfixadmin-admin-create-domain.jpg trunk/DOCUMENTS/screenshots/postfixadmin-admin-create-mailbox.jpg trunk/DOCUMENTS/screenshots/postfixadmin-admin-domain-list.jpg trunk/DOCUMENTS/screenshots/postfixadmin-admin-virtual-list.jpg trunk/DOCUMENTS/screenshots/postfixadmin-inital-welcome.jpg trunk/DOCUMENTS/screenshots/postfixadmin-mail-admin-login.jpg trunk/DOCUMENTS/screenshots/postfixadmin-user-change-forward.jpg trunk/DOCUMENTS/screenshots/postfixadmin-user-overview.jpg trunk/DOCUMENTS/screenshots/postfixadmin-user-vacation.jpg trunk/GPL-LICENSE.TXT trunk/INSTALL.TXT trunk/LICENSE.TXT trunk/README.moved_to_github trunk/VIRTUAL_VACATION/FILTER_README trunk/VIRTUAL_VACATION/INSTALL.TXT trunk/VIRTUAL_VACATION/index.php trunk/VIRTUAL_VACATION/tests/asterisk-email.txt trunk/VIRTUAL_VACATION/tests/facebook.txt trunk/VIRTUAL_VACATION/tests/mail-myself.txt trunk/VIRTUAL_VACATION/tests/mailing-list.txt trunk/VIRTUAL_VACATION/tests/spam.txt trunk/VIRTUAL_VACATION/tests/teodor-smtp-envelope-headers.txt trunk/VIRTUAL_VACATION/tests/test-email.txt trunk/VIRTUAL_VACATION/tests/test.sh trunk/VIRTUAL_VACATION/vacation.pl trunk/backup.php trunk/broadcast-message.php trunk/calendar.js trunk/common.php trunk/config.inc.php trunk/configs/menu.conf trunk/css/calendar.css trunk/css/default.css trunk/debian/README.Debian trunk/debian/README.source trunk/debian/README.txt trunk/debian/TODO trunk/debian/apache/postfixadmin.conf trunk/debian/changelog trunk/debian/compat trunk/debian/control trunk/debian/copyright trunk/debian/lighttpd/90-postfixadmin.conf trunk/debian/patches/0001-db_credentials.patch trunk/debian/patches/series trunk/debian/postfixadmin.apache2 trunk/debian/postfixadmin.config trunk/debian/postfixadmin.dirs trunk/debian/postfixadmin.docs trunk/debian/postfixadmin.examples trunk/debian/postfixadmin.install trunk/debian/postfixadmin.links trunk/debian/postfixadmin.maintscript trunk/debian/postfixadmin.postinst trunk/debian/postfixadmin.postrm trunk/debian/postfixadmin.prerm trunk/debian/rules trunk/debian/source/format trunk/debian/stamp-patched trunk/debian/watch trunk/delete.php trunk/edit.php trunk/editactive.php trunk/functions.inc.php trunk/images/arrow-l.png trunk/images/arrow-r.png trunk/images/arrow-u.png trunk/images/calendar/cal.gif trunk/images/calendar/next_mon.gif trunk/images/calendar/next_year.gif trunk/images/calendar/no_cal.gif trunk/images/calendar/pixel.gif trunk/images/calendar/prev_mon.gif trunk/images/calendar/prev_year.gif trunk/images/calendar/shade_bl.png trunk/images/calendar/shade_bm.png trunk/images/calendar/shade_br.png trunk/images/calendar/shade_mr.png trunk/images/calendar/shade_tr.png trunk/images/index.php trunk/images/logo-default.png trunk/images/mail_bg.gif trunk/images/postbox.png trunk/images/postfixadmin.png trunk/images/postfixadmin2.png trunk/images/postfixadmin2.xcf trunk/images/quota-colors.png trunk/index.php trunk/languages/bg.lang trunk/languages/ca.lang trunk/languages/cn.lang trunk/languages/cs.lang trunk/languages/da.lang trunk/languages/de.lang trunk/languages/en.lang trunk/languages/es.lang trunk/languages/et.lang trunk/languages/eu.lang trunk/languages/fi.lang trunk/languages/fo.lang trunk/languages/fr.lang trunk/languages/hr.lang trunk/languages/hu.lang trunk/languages/index.php trunk/languages/is.lang trunk/languages/it.lang trunk/languages/ja.lang trunk/languages/language-update.sh trunk/languages/language.php trunk/languages/lt.lang trunk/languages/mk.lang trunk/languages/nb.lang trunk/languages/nl.lang trunk/languages/nn.lang trunk/languages/pl.lang trunk/languages/pt-br.lang trunk/languages/ro.lang trunk/languages/ru.lang trunk/languages/sk.lang trunk/languages/sl.lang trunk/languages/sv.lang trunk/languages/tr.lang trunk/languages/tw.lang trunk/list-virtual.php trunk/list.php trunk/login.php trunk/main.php trunk/model/AdminHandler.php trunk/model/AdminpasswordHandler.php trunk/model/AliasHandler.php trunk/model/AliasdomainHandler.php trunk/model/CliDelete.php trunk/model/CliEdit.php trunk/model/CliHelp.php trunk/model/CliScheme.php trunk/model/CliView.php trunk/model/Config.php trunk/model/DomainHandler.php trunk/model/FetchmailHandler.php trunk/model/MailboxHandler.php trunk/model/PFAHandler.php trunk/model/VacationHandler.php trunk/scripts/postfixadmin-cli trunk/scripts/postfixadmin-cli.php trunk/scripts/shells/mailbox.php trunk/scripts/shells/shell.php trunk/scripts/snippets/crypt.php trunk/scripts/snippets/crypt_test.php trunk/scripts/snippets/dovecot_crypt.php trunk/sendmail.php trunk/setup.php trunk/smarty/COPYING.lib trunk/smarty/libs/Autoloader.php trunk/smarty/libs/Smarty.class.php trunk/smarty/libs/SmartyBC.class.php trunk/smarty/libs/debug.tpl trunk/smarty/libs/plugins/block.textformat.php trunk/smarty/libs/plugins/function.counter.php trunk/smarty/libs/plugins/function.cycle.php trunk/smarty/libs/plugins/function.fetch.php trunk/smarty/libs/plugins/function.html_checkboxes.php trunk/smarty/libs/plugins/function.html_image.php trunk/smarty/libs/plugins/function.html_options.php trunk/smarty/libs/plugins/function.html_radios.php trunk/smarty/libs/plugins/function.html_select_date.php trunk/smarty/libs/plugins/function.html_select_time.php trunk/smarty/libs/plugins/function.html_table.php trunk/smarty/libs/plugins/function.mailto.php trunk/smarty/libs/plugins/function.math.php trunk/smarty/libs/plugins/modifier.capitalize.php trunk/smarty/libs/plugins/modifier.date_format.php trunk/smarty/libs/plugins/modifier.debug_print_var.php trunk/smarty/libs/plugins/modifier.escape.php trunk/smarty/libs/plugins/modifier.needle.php trunk/smarty/libs/plugins/modifier.regex_replace.php trunk/smarty/libs/plugins/modifier.replace.php trunk/smarty/libs/plugins/modifier.spacify.php trunk/smarty/libs/plugins/modifier.truncate.php trunk/smarty/libs/plugins/modifiercompiler.cat.php trunk/smarty/libs/plugins/modifiercompiler.count_characters.php trunk/smarty/libs/plugins/modifiercompiler.count_paragraphs.php trunk/smarty/libs/plugins/modifiercompiler.count_sentences.php trunk/smarty/libs/plugins/modifiercompiler.count_words.php trunk/smarty/libs/plugins/modifiercompiler.default.php trunk/smarty/libs/plugins/modifiercompiler.escape.php trunk/smarty/libs/plugins/modifiercompiler.from_charset.php trunk/smarty/libs/plugins/modifiercompiler.indent.php trunk/smarty/libs/plugins/modifiercompiler.lower.php trunk/smarty/libs/plugins/modifiercompiler.noprint.php trunk/smarty/libs/plugins/modifiercompiler.string_format.php trunk/smarty/libs/plugins/modifiercompiler.strip.php trunk/smarty/libs/plugins/modifiercompiler.strip_tags.php trunk/smarty/libs/plugins/modifiercompiler.to_charset.php trunk/smarty/libs/plugins/modifiercompiler.unescape.php trunk/smarty/libs/plugins/modifiercompiler.upper.php trunk/smarty/libs/plugins/modifiercompiler.wordwrap.php trunk/smarty/libs/plugins/outputfilter.trimwhitespace.php trunk/smarty/libs/plugins/shared.escape_special_chars.php trunk/smarty/libs/plugins/shared.literal_compiler_param.php trunk/smarty/libs/plugins/shared.make_timestamp.php trunk/smarty/libs/plugins/shared.mb_str_replace.php trunk/smarty/libs/plugins/shared.mb_unicode.php trunk/smarty/libs/plugins/shared.mb_wordwrap.php trunk/smarty/libs/plugins/variablefilter.htmlspecialchars.php trunk/smarty/libs/sysplugins/smarty_cacheresource.php trunk/smarty/libs/sysplugins/smarty_cacheresource_custom.php trunk/smarty/libs/sysplugins/smarty_cacheresource_keyvaluestore.php trunk/smarty/libs/sysplugins/smarty_data.php trunk/smarty/libs/sysplugins/smarty_internal_cacheresource_file.php trunk/smarty/libs/sysplugins/smarty_internal_compile_append.php trunk/smarty/libs/sysplugins/smarty_internal_compile_assign.php trunk/smarty/libs/sysplugins/smarty_internal_compile_block.php trunk/smarty/libs/sysplugins/smarty_internal_compile_break.php trunk/smarty/libs/sysplugins/smarty_internal_compile_call.php trunk/smarty/libs/sysplugins/smarty_internal_compile_capture.php trunk/smarty/libs/sysplugins/smarty_internal_compile_config_load.php trunk/smarty/libs/sysplugins/smarty_internal_compile_continue.php trunk/smarty/libs/sysplugins/smarty_internal_compile_debug.php trunk/smarty/libs/sysplugins/smarty_internal_compile_eval.php trunk/smarty/libs/sysplugins/smarty_internal_compile_extends.php trunk/smarty/libs/sysplugins/smarty_internal_compile_for.php trunk/smarty/libs/sysplugins/smarty_internal_compile_foreach.php trunk/smarty/libs/sysplugins/smarty_internal_compile_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_if.php trunk/smarty/libs/sysplugins/smarty_internal_compile_include.php trunk/smarty/libs/sysplugins/smarty_internal_compile_include_php.php trunk/smarty/libs/sysplugins/smarty_internal_compile_insert.php trunk/smarty/libs/sysplugins/smarty_internal_compile_ldelim.php trunk/smarty/libs/sysplugins/smarty_internal_compile_nocache.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_block_plugin.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_foreachsection.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_function_plugin.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_object_block_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_object_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_php.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_print_expression.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_registered_function.php trunk/smarty/libs/sysplugins/smarty_internal_compile_private_special_variable.php trunk/smarty/libs/sysplugins/smarty_internal_compile_rdelim.php trunk/smarty/libs/sysplugins/smarty_internal_compile_section.php trunk/smarty/libs/sysplugins/smarty_internal_compile_setfilter.php trunk/smarty/libs/sysplugins/smarty_internal_compile_shared_inheritance.php trunk/smarty/libs/sysplugins/smarty_internal_compile_while.php trunk/smarty/libs/sysplugins/smarty_internal_compilebase.php trunk/smarty/libs/sysplugins/smarty_internal_config_file_compiler.php trunk/smarty/libs/sysplugins/smarty_internal_configfilelexer.php trunk/smarty/libs/sysplugins/smarty_internal_configfileparser.php trunk/smarty/libs/sysplugins/smarty_internal_data.php trunk/smarty/libs/sysplugins/smarty_internal_debug.php trunk/smarty/libs/sysplugins/smarty_internal_extension_clear.php trunk/smarty/libs/sysplugins/smarty_internal_extension_handler.php trunk/smarty/libs/sysplugins/smarty_internal_method_addautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_adddefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_append.php trunk/smarty/libs/sysplugins/smarty_internal_method_appendbyref.php trunk/smarty/libs/sysplugins/smarty_internal_method_assignbyref.php trunk/smarty/libs/sysplugins/smarty_internal_method_assignglobal.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearallassign.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearallcache.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearassign.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearcache.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearcompiledtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_clearconfig.php trunk/smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php trunk/smarty/libs/sysplugins/smarty_internal_method_compilealltemplates.php trunk/smarty/libs/sysplugins/smarty_internal_method_configload.php trunk/smarty/libs/sysplugins/smarty_internal_method_createdata.php trunk/smarty/libs/sysplugins/smarty_internal_method_getautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_getconfigvars.php trunk/smarty/libs/sysplugins/smarty_internal_method_getdebugtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_getdefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_getregisteredobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_getstreamvariable.php trunk/smarty/libs/sysplugins/smarty_internal_method_gettags.php trunk/smarty/libs/sysplugins/smarty_internal_method_gettemplatevars.php trunk/smarty/libs/sysplugins/smarty_internal_method_loadfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_mustcompile.php trunk/smarty/libs/sysplugins/smarty_internal_method_registercacheresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerclass.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaultconfighandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaultpluginhandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerdefaulttemplatehandler.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_registerresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_setautoloadfilters.php trunk/smarty/libs/sysplugins/smarty_internal_method_setdebugtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_method_setdefaultmodifiers.php trunk/smarty/libs/sysplugins/smarty_internal_method_unloadfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregistercacheresource.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterfilter.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterobject.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php trunk/smarty/libs/sysplugins/smarty_internal_method_unregisterresource.php trunk/smarty/libs/sysplugins/smarty_internal_nocache_insert.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_code.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_dq.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_dqcontent.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_tag.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_template.php trunk/smarty/libs/sysplugins/smarty_internal_parsetree_text.php trunk/smarty/libs/sysplugins/smarty_internal_resource_eval.php trunk/smarty/libs/sysplugins/smarty_internal_resource_extends.php trunk/smarty/libs/sysplugins/smarty_internal_resource_file.php trunk/smarty/libs/sysplugins/smarty_internal_resource_php.php trunk/smarty/libs/sysplugins/smarty_internal_resource_registered.php trunk/smarty/libs/sysplugins/smarty_internal_resource_stream.php trunk/smarty/libs/sysplugins/smarty_internal_resource_string.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_cachemodify.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_codeframe.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_foreach.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_getincludepath.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_hhvm.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_inheritance.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_subtemplate.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_tplfunction.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_updatecache.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_validatecompiled.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_var.php trunk/smarty/libs/sysplugins/smarty_internal_runtime_writefile.php trunk/smarty/libs/sysplugins/smarty_internal_smartytemplatecompiler.php trunk/smarty/libs/sysplugins/smarty_internal_template.php trunk/smarty/libs/sysplugins/smarty_internal_templatebase.php trunk/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php trunk/smarty/libs/sysplugins/smarty_internal_templatelexer.php trunk/smarty/libs/sysplugins/smarty_internal_templateparser.php trunk/smarty/libs/sysplugins/smarty_internal_testinstall.php trunk/smarty/libs/sysplugins/smarty_internal_undefined.php trunk/smarty/libs/sysplugins/smarty_resource.php trunk/smarty/libs/sysplugins/smarty_resource_custom.php trunk/smarty/libs/sysplugins/smarty_resource_recompiled.php trunk/smarty/libs/sysplugins/smarty_resource_uncompiled.php trunk/smarty/libs/sysplugins/smarty_security.php trunk/smarty/libs/sysplugins/smarty_template_cached.php trunk/smarty/libs/sysplugins/smarty_template_compiled.php trunk/smarty/libs/sysplugins/smarty_template_config.php trunk/smarty/libs/sysplugins/smarty_template_resource_base.php trunk/smarty/libs/sysplugins/smarty_template_source.php trunk/smarty/libs/sysplugins/smarty_undefined_variable.php trunk/smarty/libs/sysplugins/smarty_variable.php trunk/smarty/libs/sysplugins/smartycompilerexception.php trunk/smarty/libs/sysplugins/smartyexception.php trunk/smarty/smarty_version trunk/smarty.inc.php trunk/templates/backupwarning.tpl trunk/templates/broadcast-message.tpl trunk/templates/editform.tpl trunk/templates/flash_error.tpl trunk/templates/footer.tpl trunk/templates/header.php trunk/templates/header.tpl trunk/templates/index.tpl trunk/templates/list-virtual.tpl trunk/templates/list-virtual_alias.tpl trunk/templates/list-virtual_alias_domain.tpl trunk/templates/list-virtual_mailbox.tpl trunk/templates/list.tpl trunk/templates/login.tpl trunk/templates/main.tpl trunk/templates/menu.tpl trunk/templates/message.tpl trunk/templates/password.tpl trunk/templates/sendmail.tpl trunk/templates/users_edit-alias.tpl trunk/templates/users_main.tpl trunk/templates/users_menu.tpl trunk/templates/vacation.tpl trunk/templates/viewlog.tpl trunk/tests/RemoteAliasTest.php trunk/tests/RemoteTest.php trunk/tests/RemoteUserTest.php trunk/tests/RemoteVacationTest.php trunk/tests/common.php trunk/upgrade.php trunk/users/calendar.js trunk/users/css/calendar.css trunk/users/css/default.css trunk/users/edit-alias.php trunk/users/images/calendar/cal.gif trunk/users/images/calendar/next_mon.gif trunk/users/images/calendar/next_year.gif trunk/users/images/calendar/no_cal.gif trunk/users/images/calendar/pixel.gif trunk/users/images/calendar/prev_mon.gif trunk/users/images/calendar/prev_year.gif trunk/users/images/calendar/shade_bl.png trunk/users/images/calendar/shade_bm.png trunk/users/images/calendar/shade_br.png trunk/users/images/calendar/shade_mr.png trunk/users/images/calendar/shade_tr.png trunk/users/index.php trunk/users/login.php trunk/users/main.php trunk/users/password.php trunk/users/vacation.php trunk/vacation.php trunk/variables.inc.php trunk/viewlog.php trunk/xmlrpc.php Deleted: trunk/ADDITIONS/README.TXT =================================================================== --- trunk/ADDITIONS/README.TXT 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/README.TXT 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,52 +0,0 @@ -# -# Postfix Admin ADDITIONS -# - -BEFORE YOU START ----------------- - -**** ALL THESE SCRIPTS ARE CREATED BY THIRD PARTIES **** - **** THEY ARE AS IS, USE AT YOUR OWN RISK! **** - -ADDITIONS ---------- - -In this directory you will find additional scripts that are build by others. - -- change_password.tgz -by George Vieira <george at citadelcomputer dot com dot au> -SquirrelMail plugin to change your passwor - -- cleanupdirs.pl -by jared bell <jared at beol dot net> -Displays a list of mailboxes that need to be deleted - -- mailbox_remover.pl -by Petr Znojemsky -Deletes all unused mailboxes - -- mkeveryone.pl -by Joshua Preston -Generate an 'everybody' alias for a domain. - -- pfa_maildir_cleanup.pl -by Stephen Fulton <sfulton at esoteric dot ca> -Deletes all unused mailboxes - -- postfixadmin-0.3-1.4.tar.gz -by Florian Kimmerl <info at spacekoeln dot de> -The Postfixadmin SquirrelMail plugin let users change their virtual alias, -vacation status/message and password. - -- virtualmaildel.php -by George Vieira <george at citadelcomputer dot com dot au> -Deletes all unused mailboxes - -- postfixadmin-mailbox-postcreation.sh -- postfixadmin-mailbox-postdeletion.sh -- postfixadmin-domain-postdeletion.sh -by Troels Arvin <tr...@ar...> -Examples of scripts relevant to the optional -$CONF['mailbox_postcreation_script'], -$CONF['mailbox_postdeletion_script'] and -$CONF['domain_postdeletion_script'] configuration options. Deleted: trunk/ADDITIONS/change_password.tgz =================================================================== (Binary files differ) Deleted: trunk/ADDITIONS/cleanupdirs.pl =================================================================== --- trunk/ADDITIONS/cleanupdirs.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cleanupdirs.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,112 +0,0 @@ -#!/usr/bin/perl -w - -################################################################################ -# -# cleanupdirs 1.2 by jared bell <ja...@be...> -# -# display/remove maildir & domains directory tree's not listed in the postfix -# mysql database. currently setup for use with postfixadmin, but can be -# adapted. edit settings where it says 'change settings as needed.' by default -# this program will display a list of directories which need deleted, nothing -# is actually deleted. to change this behavior, look into the command line -# arguments. -# -# command line arguments: -# --delete -# force automatic deletion of directories. instead of displaying a list -# of deleted directories, they will be logged in the specified logfile. -# --print -# display deleted directories as well as log them. only valid when -# '--delete' has been specified. -# -# settings: -# $root_path = "/home/vmail"; -# if maildir is '/home/vmail/domain.tld/user' then '/home/vmail' is the -# $root_path. if your maildirs are '/home/vmail/us...@do...d' then -# this program will need to be modified in order to work right. -# $logfile = "/var/log/removed_maildirs.log"; -# the logfile to use when $delete_old_dirs is set to 1 -# $db_* = "*"; -# sets the host, port, database, user and pass to your mysql server -# -# version history: -# 1.2 - removed uneeded settings. added '--print' command line argument -# 1.1 - added '--delete' command line argument -# 1.0 - initial release -# -################################################################################ - -use strict; -use DBI; -use File::Path; -use Getopt::Long; - -### change settings as needed, see notes above ################################# -our $root_path = "/home/vmail"; -our $logfile = "/var/log/removed_maildirs.log"; -our $db_hostname = "localhost"; -our $db_port = "3306"; # this script currently supports MySQL only -our $db_database = "postfix"; -our $db_username = "someuser"; -our $db_password = "somepass"; - -# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/cleanupdirs.conf -# just use perl syntax there to fill the variables listed above (without the "our" keyword). Example: -# $db_username = 'mail'; -if (-f "/etc/mail/postfixadmin/cleanupdirs.conf") { - require "/etc/mail/postfixadmin/cleanupdirs.conf"; -} - -################################################################################ - -### begin program ############################################################## -my(@dirs_to_delete, $logfile_open); -my $delete_old_dirs = 0; # do not delete by default, use cmdline to change this -my $print_also = 0; # also print items when deleting, use cmdline to change this -GetOptions ('delete' => \$delete_old_dirs, 'print' => \$print_also); -my $conn_info = "DBI:mysql:database=$db_database;hostname=$db_hostname;port=$db_port"; -my $dbh = DBI->connect($conn_info, $db_username, $db_password) - or die $DBI::errstr; -opendir DOMAINDIR, $root_path - or die "Unable to access directory '$root_path' ($!)"; -foreach my $domain_dir (sort readdir DOMAINDIR) { - next if $domain_dir =~ /^\./; # skip dotted dirs - next if (! -d "$root_path/$domain_dir"); # skip everything that is not a directory - my $full_domain_dir = "$root_path/$domain_dir"; - opendir USERDIR, $full_domain_dir - or die "Unable to access directory '$full_domain_dir' ($!)"; - foreach my $user_dir (sort readdir USERDIR) { - next if $user_dir =~ /^\./; # skip dotted dirs - push @dirs_to_delete, "$full_domain_dir/$user_dir" - if &check_dir("SELECT maildir FROM mailbox WHERE maildir = ?", - "$domain_dir/$user_dir/"); # end slash needed for checkdir - } - push @dirs_to_delete, $full_domain_dir - if &check_dir("SELECT domain FROM domain WHERE domain = ?", $domain_dir); -} -closedir USERDIR; -closedir DOMAINDIR; -$dbh->disconnect; -if (@dirs_to_delete) { - foreach my $to_delete (@dirs_to_delete) { - if ($delete_old_dirs == 1) { - $logfile_open = open LOGFILE, ">> $logfile" - or die "Unable to append logfile '$logfile' ($!)" - unless $logfile_open; - rmtree $to_delete; - print LOGFILE localtime() . " Deleting directory '$to_delete'\n"; - print localtime() . " Deleting directory '$to_delete'\n" - if $print_also; - } else { - print localtime() . " Need to delete directory '$to_delete'\n"; - } - } -} -close LOGFILE if $logfile_open; -sub check_dir { - my($query, $dir) = @_; - my $sth = $dbh->prepare($query); - my $num_rows = $sth->execute($dir); - $sth->finish; - ($num_rows eq "0E0") ? 1 : 0; -} Deleted: trunk/ADDITIONS/convert-passwd-to-postfixadmin.pl =================================================================== --- trunk/ADDITIONS/convert-passwd-to-postfixadmin.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/convert-passwd-to-postfixadmin.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,40 +0,0 @@ -#!/usr/bin/perl -w -# -# Postfix Admin -# -# LICENSE -# This source file is subject to the GPL license that is bundled with -# this package in the file LICENSE.TXT. -# -# Further details on the project are available at http://postfixadmin.sf.net -# -# @version $Id$ -# @license GNU GPL v2 or later. -# -# -# Really crude attempt at taking all users from a local -# passwd file (/etc/shadow) and creating postfixadmin mailboxes for them. -# -# The script outputs some SQL, which you need to then insert into your database -# as appropriate. -# -# Notes: -# 1) Change $mydomain and $true as required. -# 2) Ideally it should parse /etc/passwd, or call the getpw()? function and -# populate someone's name if known. -# 3) There's plenty of room for improvement. -# -# Original author: David Goodwin <david at palepurple-co-uk> - 2007/10/05. -# -use strict; - -open(FH, '</etc/shadow') or die ('Cannot open shadow file; you need to be root - ' . $!); -my $mydomain = "test.com"; -my $true = "t"; # t for pgsql; 1 for mysql -foreach(<FH>) { - my ($username, $password) = split(':', $_); - next if $password eq '!'; - next if $password eq '*'; - my $maildir = "$username\@$mydomain/"; - print "insert into mailbox (username, password, domain, active, maildir) values ('$username', '$password', '$mydomain', $true, '$maildir');\n"; -} Deleted: trunk/ADDITIONS/cyrus/Changelog =================================================================== --- trunk/ADDITIONS/cyrus/Changelog 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/Changelog 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,8 +0,0 @@ - -Version 0.1 -- 26/10/2009 ---------------------------- - - * Public Release. - * Postcreation, Postdeletion and Postedit hooks. - - Deleted: trunk/ADDITIONS/cyrus/README-ES.txt =================================================================== --- trunk/ADDITIONS/cyrus/README-ES.txt 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/README-ES.txt 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,7 +0,0 @@ - -Configuración -------------- - - - Edita el fichero cyrus.conf y modifica las variables $cyrus_*. El usuario debe tener permisos sobre todas las cuentas. - - Edita los ficheros cyrus-*.pl y cambia la ruta de cyrus.conf (linea require '/path/to/cyrus.conf';) - Deleted: trunk/ADDITIONS/cyrus/README.txt =================================================================== --- trunk/ADDITIONS/cyrus/README.txt 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/README.txt 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,7 +0,0 @@ - -Configuration -------------- - - - Edit cyrus.conf and set $cyrus_* variables correctly. User must have permission over all accounts. - - Edit cyrus-*.pl and change path to cyrus.conf (require '/path/to/cyrus.conf'; line) - Deleted: trunk/ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl =================================================================== --- trunk/ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -# Cyrus Mailbox creation -# -# Iñaki Rodriguez (iro...@vi... / iro...@ac...) -# -# LICENSE -# This source file is subject to the GPL license that is bundled with -# this package in the file LICENSE.TXT. -# -# (26/10/2009) - -use Cyrus::IMAP::Admin; -require '/etc/mail/postfixadmin/cyrus.conf'; -use strict; -use vars qw($cyrus_user $cyrus_password $cyrus_host); - -my %opts; - -my $mailbox = mailbox_name($ARGV[0]); - -my $client = Cyrus::IMAP::Admin->new($cyrus_host); -die_on_error($client); - -$opts{-user} = $cyrus_user; -$opts{-password} = $cyrus_password; - -$client->authenticate(%opts); -die_on_error($client); - -$client->create($mailbox); -die_on_error($client); - -$client->setquota($mailbox,'STORAGE',scalar $ARGV[3]) if ($ARGV[3] > 0); -die_on_error($client); - Deleted: trunk/ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl =================================================================== --- trunk/ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,36 +0,0 @@ -#!/usr/bin/perl - -# Cyrus Mailbox deletion -# -# Iñaki Rodriguez (iro...@vi... / iro...@ac...) -# -# LICENSE -# This source file is subject to the GPL license that is bundled with -# this package in the file LICENSE.TXT. -# -# (26/10/2009) - -use Cyrus::IMAP::Admin; -require '/etc/mail/postfixadmin/cyrus.conf'; -use strict; -use vars qw($cyrus_user $cyrus_password $cyrus_host); - -my %opts; - -my $mailbox = mailbox_name($ARGV[0]); - -my $client = Cyrus::IMAP::Admin->new($cyrus_host); -die_on_error($client); - -$opts{-user} = $cyrus_user; -$opts{-password} = $cyrus_password; - -$client->authenticate(%opts); -die_on_error($client); - -$client->setacl($mailbox,$cyrus_user => 'all'); -die_on_error($client); - -$client->deletemailbox($mailbox); -die_on_error($client); - Deleted: trunk/ADDITIONS/cyrus/cyrus-mailbox-postedit.pl =================================================================== --- trunk/ADDITIONS/cyrus/cyrus-mailbox-postedit.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/cyrus-mailbox-postedit.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,33 +0,0 @@ -#!/usr/bin/perl - -# Cyrus Mailbox edition -# -# Iñaki Rodriguez (iro...@vi... / iro...@ac...) -# -# LICENSE -# This source file is subject to the GPL license that is bundled with -# this package in the file LICENSE.TXT. -# -# (26/10/2009) - -use Cyrus::IMAP::Admin; -require '/etc/mail/postfixadmin/cyrus.conf'; -use strict; -use vars qw($cyrus_user $cyrus_password $cyrus_host); - -my %opts; - -my $mailbox = mailbox_name($ARGV[0]); - -my $client = Cyrus::IMAP::Admin->new($cyrus_host); -die_on_error($client); - -$opts{-user} = $cyrus_user; -$opts{-password} = $cyrus_password; - -$client->authenticate(%opts); -die_on_error($client); - -$client->setquota($mailbox,'STORAGE',scalar $ARGV[3]) if ($ARGV[3] > 0); -die_on_error($client); - Deleted: trunk/ADDITIONS/cyrus/cyrus.conf =================================================================== --- trunk/ADDITIONS/cyrus/cyrus.conf 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/cyrus/cyrus.conf 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,31 +0,0 @@ -#!/usr/bin/perl - -# Config - -$cyrus_user = 'cyrus'; -$cyrus_password = 'cyruspass'; -$cyrus_host = 'localhost'; - -# unixhierarchysep => 1 (yes) / 0 (no) -$unixhierarchysep = 1; - -# Common routines - -sub mailbox_name { - my $mailbox = shift; - - if($unixhierarchysep) { - $mailbox = 'user/'.$ARGV[0]; - } else { - $mailbox = 'user.'.$ARGV[0]; - } - - return $mailbox; -} - -sub die_on_error { - my $cyradm = shift; - if($cyradm->error) { die $cyradm->error; } -} -1; - Deleted: trunk/ADDITIONS/delete-mailq-by-domain.pl =================================================================== --- trunk/ADDITIONS/delete-mailq-by-domain.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/delete-mailq-by-domain.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,77 +0,0 @@ -#!/usr/bin/perl - - -use strict; -use warnings; -use Getopt::Long; - - -$ENV{'PATH'} = "/sbin:/bin:/usr/sbin:/usr/bin"; - -my ($domain); -my $list = 0; - -(help()) if (!$ARGV[0]); -GetOptions ('l' => \$list, 'd=s' => \$domain) or (help()); - - -(list_queue()) if ($list == 1); - -(delete_queue()) if ($domain); - - -sub delete_queue { -my $ids = `postqueue -p`; -my @ids = split /\n/, $ids; - -for my $id (@ids) { - next if $id =~ /^[\s\(-]/; - chomp $id; - next unless $id; - $id =~ s/(.*?)\**\s.*/$1/; - #print "$id\n"; - my $match = `postcat -q $id | grep '$domain'`; - next unless $match; - #print "Deleting ID: $id\n"; - my $saida = `postsuper -d $id`; - print $saida; -} - -} - - - - -sub list_queue { -my %hash_mail = (); -my @queue = `postqueue -p`; -my($queue,$key,$total); - - -foreach $queue(@queue) { - chomp $queue; - if ( $queue =~ /^\s+.*\@(.*)/ ) { - $hash_mail{$1}++; - } -} -print"\nTOTAL\tTO\n"; -print"----- -----------------------------------------------------------------\n"; -foreach $key (reverse sort { $hash_mail{$a} <=> $hash_mail{$b}} keys -%hash_mail) { - $total += $hash_mail{$key}; - print"$hash_mail{$key} - $key\n"; -} -print"\n$total -> TOTAL QUEUE\n"; - -} - - -sub help { -print "Usage $0 -l To list a row of E-mail -Usage $0 -d domain.com To delete the mensgens the Domain\n"; -} - - - - Deleted: trunk/ADDITIONS/fetchmail.pl =================================================================== --- trunk/ADDITIONS/fetchmail.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/fetchmail.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,141 +0,0 @@ -#!/usr/bin/perl - -use DBI; -use MIME::Base64; -# use Data::Dumper; -use File::Temp qw/ mkstemp /; -use Sys::Syslog; -# require liblockfile-simple-perl -use LockFile::Simple qw(lock trylock unlock); - -###################################################################### -########## Change the following variables to fit your needs ########## - -# database settings - -# database backend - uncomment one of these -our $db_type = 'Pg'; -#my $db_type = 'mysql'; - -# host name -our $db_host="127.0.0.1"; -# database name -our $db_name="postfix"; -# database username -our $db_username="mail"; -# database password -our $db_password="CHANGE_ME!"; - -# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/fetchmail.conf -# just use perl syntax there to fill the variables listed above (without the "our" keyword). Example: -# $db_username = 'mail'; -if (-f "/etc/mail/postfixadmin/fetchmail.conf") { - require "/etc/mail/postfixadmin/fetchmail.conf"; -} - - -#################### Don't change anything below! #################### -###################################################################### - -openlog("fetchmail-all", "pid", "mail"); - -sub log_and_die { - my($message) = @_; - syslog("err", $message); - die $message; -} - -# read options and arguments - -$configfile = "/etc/fetchmail-all/config"; - -@ARGS1 = @ARGV; - -while ($_ = shift @ARGS1) { - if (/^-/) { - if (/^--config$/) { - $configfile = shift @ARGS1 - } - } -} - -$run_dir="/var/run/fetchmail"; - -# use specified config file -if (-e $configfile) { - do $configfile; -} - -if($db_type eq "Pg" || $db_type eq "mysql") { - $dsn = "DBI:$db_type:database=$db_name;host=$db_host"; -} else { - log_and_die "unsupported db_type $db_type"; -} - -$lock_file=$run_dir . "/fetchmail-all.lock"; - -$lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1); -$lockmgr->lock($lock_file) || log_and_die "can't lock ${lock_file}"; - -# database connect -$dbh = DBI->connect($dsn, $db_username, $db_password) || log_and_die "cannot connect the database"; - -if($db_type eq "Pg") { - $sql_cond = "active = 't' AND date_part('epoch',now())-date_part('epoch',date)"; -} elsif($db_type eq "mysql") { - $sql_cond = "active = 1 AND unix_timestamp(now())-unix_timestamp(date)"; -} - -$sql = " - SELECT id,mailbox,src_server,src_auth,src_user,src_password,src_folder,fetchall,keep,protocol,mda,extra_options,usessl, sslcertck, sslcertpath, sslfingerprint - FROM fetchmail - WHERE $sql_cond > poll_time*60 - "; - -my (%config); -map{ - my ($id,$mailbox,$src_server,$src_auth,$src_user,$src_password,$src_folder,$fetchall,$keep,$protocol,$mda,$extra_options,$usessl,$sslcertck,$sslcertpath,$sslfingerprint)=@$_; - - syslog("info","fetch ${src_user}@${src_server} for ${mailbox}"); - - $cmd="user '${src_user}' there with password '".decode_base64($src_password)."'"; - $cmd.=" folder '${src_folder}'" if ($src_folder); - $cmd.=" mda ".$mda if ($mda); - -# $cmd.=" mda \"/usr/local/libexec/dovecot/deliver -m ${mailbox}\""; - $cmd.=" is '${mailbox}' here"; - - $cmd.=" keep" if ($keep); - $cmd.=" fetchall" if ($fetchall); - $cmd.=" ssl" if ($usessl); - $cmd.=" sslcertck" if($sslcertck); - $cmd.=" sslcertpath $sslcertpath" if ($sslcertck && $sslcertpath); - $cmd.=" sslfingerprint \"$sslfingerprint\"" if ($sslfingerprint); - $cmd.=" ".$extra_options if ($extra_options); - - $text=<<TXT; -set postmaster "postmaster" -set nobouncemail -set no spambounce -set properties "" -set syslog - -poll ${src_server} with proto ${protocol} - $cmd - -TXT - - ($file_handler, $filename) = mkstemp( "/tmp/fetchmail-all-XXXXX" ) or log_and_die "cannot open/create fetchmail temp file"; - print $file_handler $text; - close $file_handler; - - $ret=`/usr/bin/fetchmail -f $filename -i $run_dir/fetchmail.pid`; - - unlink $filename; - - $sql="UPDATE fetchmail SET returned_text=".$dbh->quote($ret).", date=now() WHERE id=".$id; - $dbh->do($sql); -}@{$dbh->selectall_arrayref($sql)}; - -$lockmgr->unlock($lock_file); -closelog(); Deleted: trunk/ADDITIONS/import_users_from_csv.py =================================================================== --- trunk/ADDITIONS/import_users_from_csv.py 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/import_users_from_csv.py 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,231 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Script takes a CSV list of users and does a 'bulk' insertion into mysql. -# -# Copyright (C) 2009 Simone Piccardi -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -import csv -import getopt -import sys -import re -import time -import random, string -from datetime import datetime -from crypt import crypt -try: - import MySQLdb -except ImportError ,e: - print 'Cannot import the needed MySQLdb module, you must install it' - print 'on Debian systems just use the command' - print ' apt-get install python-mysqldb' - -def usage(): - print "Usage: inspostadmusers.py [options] users.csv" - print " -h print this help" - print " -t test run, do not insert, just print" - print " -u DB user" - print " -p DB password" - print " -D DB name" - print " -H DB host" - print " -q Quota in Mb (0 => no limit)" - print " -n char in seed" - print " -d debug info on" - print " -A create default alias for each domain" - print - print "the users.csv file must contains the user list with a line" - print "for each user, first line should be a title line with at least" - print "the following column names: " - print " * user - user part of the email (like user in us...@do...)" - print " * password - cleartext password" - print " * domain - domain name (like 'domain.com')" - print " * name - full user name ('Name Surname')" - print - print "the 'name' column is optional, other columns will be ignored" - print - print "Known restrictions:" - print "* this script only works with MySQL" - print "* mailbox paths are hardcoded to domain/username/" - - -# option parsing -try: - opts, args = getopt.getopt(sys.argv[1:], 'u:p:d:D:H:htdA') - optval={} - for opt, val in opts: - if opt == "-h": - usage() - sys.exit(0) - else: - optval[opt]=val -except getopt.GetoptError: - usage() - sys.exit(2) - -# -# Setup DB connection -# -MYSQLDB="postfixadmin" -MYSQLUSER="postfixadmin" -MYSQLPASSWORD="" -MYSQLHOST="localhost" - -# settings by command line options -if optval.has_key('-u'): - MYSQLUSER = optval['-u'] -if optval.has_key('-p'): - MYSQLPASSWORD = optval['-p'] -if optval.has_key('-D'): - MYSQLDB = optval['-D'] -if optval.has_key('-H'): - MYSQLHOST = optval['-H'] - -if optval.has_key('-q'): - quota = optval['-q'] -else: - quota = 0 - -if optval.has_key('-n'): - seed_len = optval['-n'] -else: - seed_len = 8 - -# check arguments, only the user list file must be present -if len(args) !=1: - print 'Need just one argument' - usage() - sys.exit(1) - -# MySQL connection (skipped in test run) -if optval.has_key('-t'): - print "Test Run" -else: - try: - connection = MySQLdb.connect(host=MYSQLHOST, user=MYSQLUSER, - db=MYSQLDB, passwd=MYSQLPASSWORD) - except MySQLdb.MySQLError, e: - print "Database connection error" - print e - sys.exit(1) - - cursor = connection.cursor() - -# -# Main body -# -NOW = datetime.now().strftime("%Y-%m-%d %H:%M:%S") - -# read and convert CSV data -lista = csv.DictReader(open(args[0])) - -def gen_seed(seed_len, chars): - return '$1$'+''.join([random.choice(chars) for _ in xrange(seed_len)])+'$' - -def insert_record(cursor,table,record): - columns = record.keys() - query = "INSERT INTO " + table + "(" + ','.join(columns) + ") VALUES (" + ','.join(len(columns)*['%s']) + ")" - try: - cursor.execute(query, record.values()) - return 0 - except MySQLdb.MySQLError, e: - print "Database insertion error" - print e - print "Record was:" - print record.values() - print "Query was:" - print query - -# defining default values for tables (mailbox, alias and domain) -mailbox = { - 'created': NOW, - 'modified': NOW, - 'active': 1, - 'quota': quota - } -aliases = { - 'created': NOW, - 'modified': NOW, - 'active': 1 - } -domain = { - 'description': "", - 'aliases': 0, - 'mailboxes': 0, - 'quota': 0, - 'transport': 'virtual', - 'backupmx': 0, - 'created': NOW, - 'modified': NOW, - 'active': 1 -} - -# list of default alias -def_alias = ['abuse','hostmaster','postmaster','webmaster'] - -domain_list = {} -chars = string.letters + string.digits - -# loop over the CSV -for row in lista: - # create domain if it does not exists - if domain_list.has_key(row["domain"]): - if optval.has_key('-d'): - print "Domain " + row["domain"] + "already exixts" - else: - domain_list[row["domain"]] = 1 - domain['domain'] = row["domain"] - if optval.has_key('-t'): - print "Inserting domain" - print domain - else: - insert_record(cursor,'domain',domain) - if optval.has_key('-A'): - for i in def_alias: - aliases['address']= i+'@'+row["domain"] - aliases['goto']= aliases['address'] - aliases['domain'] = row["domain"] - if optval.has_key('-t'): - print "Inserting alias" - print aliases - else: - insert_record(cursor,'alias',aliases) - - # build query data for mailbox table - mailbox['username']=row["user"]+'@'+row["domain"] - encpass=crypt(row["password"], gen_seed(seed_len,chars)) - mailbox['password'] = encpass - mailbox['name'] = row["name"] - mailbox['maildir'] = row["domain"]+'/'+row["user"]+'/' - mailbox['local_part'] =row["user"] - mailbox['domain'] = row["domain"] - - # build query data for alias table - aliases['address']= mailbox['username'] - aliases['goto']= mailbox['username'] - aliases['domain'] = row["domain"] - - # inserting data for mailbox (and relate alias) - if optval.has_key('-t'): - print "Inserting mailbox" - print mailbox - print aliases - else: - insert_record(cursor,'mailbox',mailbox) - insert_record(cursor,'alias',aliases) - - -sys.exit(0) Deleted: trunk/ADDITIONS/mailbox_remover.pl =================================================================== --- trunk/ADDITIONS/mailbox_remover.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/mailbox_remover.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,124 +0,0 @@ -#!/usr/bin/perl -# -# by Petr Znojemsky (c) 2004 -# Mailbox remover 0.1a 23/10/2004 - the very first version for MySQL -# removes maildirs from disk when they are not found in a database -# -# Added subdir support and pause --- Alan Batie 2007 -# Lists directories to be deleted then pauses for 5 seconds for chance to abort -# $Id$ -# -# All your maildirs or other directories could be accidentally removed. -# Use it at own risk. No warranties! - -use strict; -use DBI; -use File::Path; - -########## -# Set these variables according to your configuration - -# when mailboxes are removed, save their tarballs here -my $archdir="/var/archive/mailboxes"; - -# expected to support z option, tweak invocation if you want different -my $archcmd="/usr/bin/tar"; - -# trailing slash not needed -my $maildir_path="/var/mail"; -# find out if we need to check subdirs for mailboxes or just maildir_path -# $CONF['domain_path'] = 'YES'; -my $pfadmin_config="/usr/local/www/postfixadmin/config.inc.php"; - -# database information -my $host="localhost"; -my $port="3306"; -my $userid="dbuser"; -my $passwd="dbpw"; -my $db="dbname"; -############ - -my $connectionInfo="DBI:mysql:database=$db;$host:$port"; -# make connection to database -my $dbh = DBI->connect($connectionInfo,$userid,$passwd); -# prepare and execute query -my $query = "SELECT maildir FROM mailbox"; -my $sth = $dbh->prepare($query); -$sth->execute(); - -# assign fields to variables -my ($db_maildir, %db_maildirs); -$sth->bind_columns(\$db_maildir); - -# load up directory list -while($sth->fetch()) { - $db_maildirs{$db_maildir} = 1; -} - -$sth->finish(); -# disconnect from database -$dbh->disconnect; - -# -# find out if we need to check subdirs for mailboxes or just maildir_path -# $CONF['domain_path'] = 'YES'; -# -my $use_subdirs = 0; -open(CONFIG, "<$pfadmin_config") || die "Can't open '$pfadmin_config': $!\n"; -while(<CONFIG>) { - if (/\$CONF\['domain_path'\] *= *'([^']*)'/) { - $use_subdirs = ($1 =~ /yes/i); - } -} -close(CONFIG); - -# store maildir list to %directories -# key is path, value is username to use in archive file -my %directories; -opendir(DIR, $maildir_path) || die "Cannot open dir $maildir_path: $!\n"; -foreach my $name (readdir(DIR)) { - next if ($name eq '.' || $name eq '..' || ! -d "$maildir_path/$name"); - - if ($use_subdirs) { - opendir(SUBDIR, "$maildir_path/$name") || die "Cannot open dir $maildir_path/$name: $!\n"; - foreach my $subname (readdir(SUBDIR)) { - next if ($subname eq '.' || $subname eq '..' || ! -d "$maildir_path/$name/$subname"); - # db entry has trailing slash... - if (!defined($db_maildirs{"$name/$subname/"})) { - print "marking $maildir_path/$name/$subname for deletion.\n"; - $directories{"$name/$subname"} = "$name-$subname"; - } - } - closedir(SUBDIR); - } else { - # db entry has trailing slash... - if (!defined($db_maildirs{"$name/"})) { - print "marking $maildir_path/$name for deletion.\n"; - $directories{"$name"} = $name; - } - } -} -closedir(DIR); - -print "Ctrl-C in 5 seconds to abort before removal starts...\n"; -sleep 5; - -my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); -# yyyymmddhhmm -my $tstamp = sprintf("%04d%02d%02d%02d%02d", $year+1900, $mon+1, $mday, $hour, $min); - -# compare two arrays and erase maildirs not found in database -chdir $maildir_path || die "Can't change to maildir '$maildir_path': $!\n";; -my @args; -foreach my $maildir (keys(%directories)) { - my $archive = "$archdir/$directories{$maildir}-$tstamp.tgz"; - # quick permissions check - open(TOUCH, ">$archive") || die "Can't create archive file $archive: $!\n"; - close(TOUCH); - print "Archiving $maildir\n"; - @args = ($archcmd, "cvzf", $archive, $maildir); - system(@args) == 0 or die "Creating archive for $maildir failed: $?" - - rmtree($maildir); - print localtime() . " $maildir has been deleted.\n"; -} Deleted: trunk/ADDITIONS/mkeveryone.pl =================================================================== --- trunk/ADDITIONS/mkeveryone.pl 2017-07-02 12:47:04 UTC (rev 1905) +++ trunk/ADDITIONS/mkeveryone.pl 2018-01-12 20:20:46 UTC (rev 1906) @@ -1,167 +0,0 @@ -#!/usr/bin/perl -# -# Generate an 'everybody' alias for a domain. -# -# Create the file /etc/mkeveryone.conf -# chmod 640 /etc/mkeveryone.conf -# Example of mkeveryone.conf -# -# userid=postfix -# passwd=postfix -# db=postfix -# host=localhost -# port=3306 -# domain=domain.tld -# target=eve...@do...d -# ignore=vac...@do...d -# ignore=sp...@do...d -# ignore=new...@do...d -# ignore=ro...@do...d -# -# Save this file in, for example, /usr/local/sbin/mkeveryone.pl -# chmod 750 /usr/local/sbin/mkeveryone.pl -# -# Run the script! -# -use DBI; -use Time::Local; -use POSIX qw(EAGAIN); -use Fcntl; -use IO; -use IO::File; - -my $timeNow=time(); - -my $DATFILE = "/etc/mkeveryone.conf"; -my $FILEHANDLE = ""; - -# database information -my $db="postfix"; -my $host="localhost"; -my $port="3306"; -my $userid="postfix"; -my $passwd="postfix"; -my $domain="domain.tld"; -my $target="everyone@$domain"; -my @ignore; -my @dest; - -open (FILEHANDLE, $DATFILE); - -while ( $LINE = <FILEHANDLE> ) { - - if ( length $LINE > 0 ) { - chomp $LINE; - - $RETURNCODE = 0; - - SWITCH: { - - $LINE =~ /^ignore/i and do { - $LINE =~ s/^ignore// && $LINE =~ s/=// && $LINE =~ s/^ //g; - @ignore = (@ignore,$LINE); - }; - - $LINE =~ /^userid/i and do { - # Userid found."; - $LINE =~ s/^userid// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $userid = $LINE; - }; - - $LINE =~ /^passwd/i and do { - # Passwd found."; - $LINE =~ s/^passwd// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $passwd = $LINE; - }; - - $LINE =~ /^db/i and do { - # Database found."; - $LINE =~ s/^db// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $db = $LINE; - }; - - $LINE =~ /^host/i and do { - # Database host found."; - $LINE =~ s/^host// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $host = $LINE; - }; - - $LINE =~ /^port/i and do { - # Database host found."; - $LINE =~ s/^port// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $port = $LINE; - }; - - $LINE =~ /^target/i and do { - # Database host found."; - $LINE =~ s/^target// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $target = $LINE; - }; - - $LINE =~ /^domain/i and do { - # Database host found."; - $LINE =~ s/^domain// && $LINE =~ s/=// && $LINE =~ s/^ //g; - $domain = $LINE; - }; - } - } -} - -print "Connecting to database $db on $host:$port...\n\r"; - -print "Target email address is $target...\n\r"; - -my $connectionInfo="DBI:mysql:database=$db;$host:$port"; - -# make connection to database -$dbh = DBI->connect($connectionInfo,$userid,$passwd); - -# Delete the old message...prepare and execute query -$query = "SELECT username FROM mailbox WHERE domain='$domain';"; -$sth = $dbh->prepare($query); -$sth->execute(); - -# assign fields to variables -$sth->bind_columns(\$username); - -my $ign="false"; -while($sth->fetch()) { - $ign = "false"; - - foreach $ignored ( @ignore ) { - if ( $username eq $ignored ){ - $ign = "true"; - } - } - - if ( $ign eq "false" ) { - @dest = (@dest,$username); - } -} - -# Delete the old aliases...prepare and execute query -$query = "DELETE FROM alias WHERE address='$target';"; -$sth = $dbh->prepare($query); -$sth->execute(); - -print "Record deleted from the database.\r\n"; - -$sth->finish(); - -$goto = join(",",@dest); -print "$goto\n\r\n\r"; - - -# Insert the new message...prepare and execute query -$query = "INSERT INTO alias (address,goto,domain,created,modified) VALUES ('$target','$goto','$domain... [truncated message content] |