update file generation, replace crc32() '-' with 'N'

This commit is contained in:
mohrt
2002-03-20 16:44:17 +00:00
parent 4b0e85ea94
commit de9503ac16
8 changed files with 77 additions and 28 deletions

View File

@@ -13,7 +13,7 @@ function smarty_function_fetch($params, &$smarty)
$file = $params['file'];
if (empty($file)) {
$smarty->trigger_error("parameter 'file' cannot be empty");
$smarty->_trigger_plugin_error("parameter 'file' cannot be empty");
return;
}
@@ -26,11 +26,11 @@ function smarty_function_fetch($params, &$smarty)
}
}
if (!$resource_is_secure) {
$smarty->trigger_error("(secure mode) fetch '$file' is not allowed");
$smarty->_trigger_plugin_error("(secure mode) fetch '$file' is not allowed");
return;
}
if (!@is_readable($file)) {
$smarty->trigger_error("fetch cannot read file '$file'");
$smarty->_trigger_plugin_error("fetch cannot read file '$file'");
return;
}
// fetch the file
@@ -89,7 +89,7 @@ function smarty_function_fetch($params, &$smarty)
case "header":
if(!empty($param_value)) {
if(!preg_match('![\w\d-]+: .+!',$param_value)) {
$smarty->trigger_error("invalid header format '".$param_value."'");
$smarty->_trigger_plugin_error("invalid header format '".$param_value."'");
return;
} else {
$extra_headers[] = $param_value;
@@ -105,7 +105,7 @@ function smarty_function_fetch($params, &$smarty)
if(!preg_match('!\D!', $param_value)) {
$proxy_port = (int) $param_value;
} else {
$smarty->trigger_error("invalid value for attribute '".$param_key."'");
$smarty->_trigger_plugin_error("invalid value for attribute '".$param_key."'");
return;
}
break;
@@ -123,7 +123,7 @@ function smarty_function_fetch($params, &$smarty)
if(!preg_match('!\D!', $param_value)) {
$timeout = (int) $param_value;
} else {
$smarty->trigger_error("invalid value for attribute '".$param_key."'");
$smarty->_trigger_plugin_error("invalid value for attribute '".$param_key."'");
return;
}
break;
@@ -134,7 +134,7 @@ function smarty_function_fetch($params, &$smarty)
}
break;
default:
$smarty->trigger_error("unrecognized attribute '".$param_key."'");
$smarty->_trigger_plugin_error("unrecognized attribute '".$param_key."'");
return;
}
}
@@ -146,7 +146,7 @@ function smarty_function_fetch($params, &$smarty)
}
if(!$fp) {
$smarty->trigger_error("unable to fetch: $errstr ($errno)");
$smarty->_trigger_plugin_error("unable to fetch: $errstr ($errno)");
return;
} else {
if($_is_proxy) {
@@ -189,7 +189,7 @@ function smarty_function_fetch($params, &$smarty)
}
}
} else {
$smarty->trigger_error("unable to parse URL, check syntax");
$smarty->_trigger_plugin_error("unable to parse URL, check syntax");
return;
}
} else {

View File

@@ -5,7 +5,13 @@
* -------------------------------------------------------------
* Type: function
* Name: html_select_date
* Version: 1.1
* Purpose: Prints the dropdowns for date selection.
* Author: Andrei Zmievski
*
* ChangeLog: 1.0 initial release
* 1.1 added support for +/- N syntax for begin
* and end year values. (Monte)
* -------------------------------------------------------------
*/
require_once SMARTY_DIR . 'plugins/.make_timestamp.php';
@@ -49,6 +55,22 @@ function smarty_function_html_select_date($params, &$smarty)
extract($params);
// make syntax "+N" or "-N" work with start_year and end_year
if(preg_match('!(\+|\-)\s*(\d+)!',$end_year,$match)) {
if($match[1] == '+') {
$end_year = $match[2] + strftime("%Y");
} else {
$end_year = $match[2] - strftime("%Y");
}
}
if(preg_match('!(\+|\-)\s*(\d+)!',$start_year,$match)) {
if($match[1] == '+') {
$start_year = $match[2] + strftime("%Y");
} else {
$start_year = $match[2] - strftime("%Y");
}
}
$time = smarty_make_timestamp($time);
$field_order = strtoupper($field_order);