- Added German translation
- Fix mysql database size (reported by Roland Arendes)
- Added JobID column in report template. (thanks to Stephan Ebeit)
+ - Upgraded Smarty to 2.6.10 version.
+ - Added multicatalog support
25-10-2004 Bacula web 1.1
- Add array_fill function (as Mikael suggested)
- Fix url encode of links. (reported by Phil Stracchino)
- - Upgrade Smarty to 2.6.6 version.
+ - Upgraded Smarty to 2.6.6 version.
- Add French translation
04-08-2004 Bacula web 1.0
- TrueType (optional)
- Pear DB (http://pear.php.net/package/DB)
- MySQL or PostgreSQL
+ - Sessions
- Bacula (Oh!, yes, you need this ;-) ) http://www.bacula.org
-- Multi catalog
- Improve check errors routines.
- Improve security. (stats.php mainly)
- Optimize database querys (Very poor now) (TO_DAYS,etc.).
- WebConsole!!!
- Add support to PDF creation.
- Build documentation of classes.
-- Best icons ;-)
\ No newline at end of file
+- Best icons and design ;-)
\ No newline at end of file
var $StartDate;
var $EndDate;
var $driver;
+ var $dbs;
function Bweb() {
$conf = new Config_File (CONFIG_DIR);
-
-
- $this->dsn['hostspec'] = $conf->get(CONFIG_FILE,"DATABASE","host");
- $this->dsn['username'] = $conf->get(CONFIG_FILE,"DATABASE","login");
- $this->dsn['password'] = $conf->get(CONFIG_FILE,"DATABASE","pass");
- $this->dsn['database'] = $conf->get(CONFIG_FILE,"DATABASE","db_name");
- $this->dsn['phptype'] = $conf->get(CONFIG_FILE,"DATABASE","db_type"); // mysql, (sqlite, pgsql) -->> Yet not checked
- if ( $conf->get(CONFIG_FILE,"DATABASE","db_port") )
- $this->dsn[port] = $conf->get(CONFIG_FILE,"DATABASE","db_port");
+ $this->dbs = array();
+ $i = 2;
+ $sections = $conf->get(CONFIG_FILE,"DATABASE","host");
+ array_push($this->dbs, "DATABASE");
+ while ( !empty($sections) ) {
+ $sections = $conf->get(CONFIG_FILE,"DATABASE".$i,"host");
+ if ( !empty($sections) )
+ array_push($this->dbs,"DATABASE".$i);
+ $i++;
+ }
+
+ if ( $i < 4)
+ $sec = "DATABASE";
+ else {
+ if ( !empty($_POST['sel_database']) ) {
+ $_SESSION['DATABASE'] = $_POST['sel_database'];
+ $sec = $_POST['sel_database'];
+ } else {
+ if (isset($_SESSION['DATABASE']) )
+ $sec = $_SESSION['DATABASE'];
+ else
+ $sec = "DATABASE";
+ }
+ }
+
+ $this->dsn['hostspec'] = $conf->get(CONFIG_FILE,$sec,"host");
+ $this->dsn['username'] = $conf->get(CONFIG_FILE,$sec,"login");
+ $this->dsn['password'] = $conf->get(CONFIG_FILE,$sec,"pass");
+ $this->dsn['database'] = $conf->get(CONFIG_FILE,$sec,"db_name");
+ $this->dsn['phptype'] = $conf->get(CONFIG_FILE,$sec,"db_type"); // mysql, (sqlite, pgsql) -->> Yet not checked
+ if ( $conf->get(CONFIG_FILE,$sec,"db_port") )
+ $this->dsn[port] = $conf->get(CONFIG_FILE,$sec,"db_port");
$this->link =& $this->connect($this->dsn);
die($this->link->getMessage());
$this->driver = $this->dsn[phptype];
register_shutdown_function(array(&$this,'close'));
- }
-
-
+ }
function close() {
$this->link->disconnect();
- }
+ }
or die("classes.inc: Error query: 1");
$return =& $result->fetchRow();
return $return[0];
- }//end function
+ }//end function
or die("classes.inc: Error query: 2");
$return =& $result->fetchRow();
return $return[0];
- }//end function
+ }//end function
-# DATABASE INFORMATION
-# --------------------
+# DATABASE INFORMATION AND MULTICATALOG SUPPORT
+# ---------------------------------------------
# This section contains the database configuration.
# You must create a user or to give it permissions to access
# from web machine.
# Uncomment this and modify it if your database runs on a non standard port.
# db_port = 3306
+# MULTICATALOG SUPPORT
+# ---------------------
+# If you have only one catalog don't remove the comments.
+# If you have 2 or more catalogs, please remove the coments of this section
+# and configure with your preferences.
+# You can add so many as you want.
+
+#[.DATABASE2]
+#host = 192.168.2.55
+#login = bacula
+#pass =
+#db_name = bacula
+#db_type = mysql
+
+#[.DATABASE3]
+#host = 192.168.20.40
+#login = bacula
+#pass =
+#dbname = bacula
+#db_type= pgsql
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://smarty.php.net/
- * @version 2.6.6
- * @copyright Copyright: 2001-2004 ispi of Lincoln, Inc.
+ * @version 2.6.10
+ * @copyright Copyright: 2001-2005 New Digital Group, Inc.
* @author Andrei Zmievski <andrei@php.net>
* @access public
* @package Smarty
* @param string $var_name (optional) variable to get info for
* @return string|array a value or array of values
*/
- function &get($file_name, $section_name = NULL, $var_name = NULL)
+ function get($file_name, $section_name = NULL, $var_name = NULL)
{
if (empty($file_name)) {
$this->_trigger_error_msg('Empty config file name');
* smarty-general-subscribe@lists.php.net
*
* @link http://smarty.php.net/
- * @copyright 2001-2004 ispi of Lincoln, Inc.
- * @author Monte Ohrt <monte@ispi.net>
+ * @copyright 2001-2005 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
* @package Smarty
- * @version 2.6.6
+ * @version 2.6.10
*/
/* $Id$ */
'isset', 'empty',
'count', 'sizeof',
'in_array', 'is_array',
- 'true','false'),
+ 'true', 'false', 'null'),
'INCLUDE_ANY' => false,
'PHP_TAGS' => false,
'MODIFIER_FUNCS' => array('count'),
*
* @var string
*/
- var $_version = '2.6.6';
+ var $_version = '2.6.10';
/**
* current template inclusion depth
$this->debugging = true;
}
} else {
- $_cookie_var = $this->request_use_auto_globals ? $_COOKIE['SMARTY_DEBUG'] : $GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG'];
- $this->debugging = $_cookie_var ? true : false;
+ $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']);
}
}
/**
- * read in a file from line $start for $lines.
- * read the entire file if $start and $lines are null.
+ * read in a file
*
* @param string $filename
- * @param integer $start
- * @param integer $lines
* @return string
*/
function _read_file($filename)
if ($this->_cache_including) {
/* return next set of cache_attrs */
- $_return =& current($_cache_attrs);
+ $_return = current($_cache_attrs);
next($_cache_attrs);
return $_return;
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @link http://smarty.php.net/
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author Andrei Zmievski <andrei@php.net>
- * @version 2.6.6
- * @copyright 2001-2004 ispi of Lincoln, Inc.
+ * @version 2.6.10
+ * @copyright 2001-2005 New Digital Group, Inc.
* @package Smarty
*/
return;
}
+ /* Reformat $text_blocks between 'strip' and '/strip' tags,
+ removing spaces, tabs and newlines. */
+ $strip = false;
+ for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) {
+ if ($compiled_tags[$i] == '{strip}') {
+ $compiled_tags[$i] = '';
+ $strip = true;
+ /* remove leading whitespaces */
+ $text_blocks[$i + 1] = ltrim($text_blocks[$i + 1]);
+ }
+ if ($strip) {
+ /* strip all $text_blocks before the next '/strip' */
+ for ($j = $i + 1; $j < $for_max; $j++) {
+ /* remove leading and trailing whitespaces of each line */
+ $text_blocks[$j] = preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $text_blocks[$j]);
+ if ($compiled_tags[$j] == '{/strip}') {
+ /* remove trailing whitespaces from the last text_block */
+ $text_blocks[$j] = rtrim($text_blocks[$j]);
+ }
+ $text_blocks[$j] = "<?php echo '" . strtr($text_blocks[$j], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>";
+ if ($compiled_tags[$j] == '{/strip}') {
+ $compiled_tags[$j] = "\n"; /* slurped by php, but necessary
+ if a newline is following the closing strip-tag */
+ $strip = false;
+ $i = $j;
+ break;
+ }
+ }
+ }
+ }
$compiled_content = '';
/* Interleave the compiled contents and text blocks to get the final result. */
}
$compiled_content .= $text_blocks[$i];
- /* Reformat data between 'strip' and '/strip' tags, removing spaces, tabs and newlines. */
- if (preg_match_all("~{$ldq}strip{$rdq}.*?{$ldq}/strip{$rdq}~s", $compiled_content, $_match)) {
- $strip_tags = $_match[0];
- $strip_tags_modified = preg_replace("~{$ldq}/?strip{$rdq}|[\t ]+$|^[\t ]+~m", '', $strip_tags);
- $strip_tags_modified = preg_replace('~[\r\n]+~m', '', $strip_tags_modified);
- for ($i = 0, $for_max = count($strip_tags); $i < $for_max; $i++)
- $compiled_content = preg_replace("~{$ldq}strip{$rdq}.*?{$ldq}/strip{$rdq}~s",
- $this->_quote_replace($strip_tags_modified[$i]),
- $compiled_content, 1);
- }
-
// remove \n from the end of the file, if any
if (($_len=strlen($compiled_content)) && ($compiled_content{$_len - 1} == "\n" )) {
$compiled_content = substr($compiled_content, 0, -1);
$_plugins_params = "array('plugins' => array(";
foreach ($this->_plugin_info as $plugin_type => $plugins) {
foreach ($plugins as $plugin_name => $plugin_info) {
- $_plugins_params .= "array('$plugin_type', '$plugin_name', '$plugin_info[0]', $plugin_info[1], ";
+ $_plugins_params .= "array('$plugin_type', '$plugin_name', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], ";
$_plugins_params .= $plugin_info[2] ? 'true),' : 'false),';
}
}
if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) {
/* tag name is a variable or object */
- $_return = $this->_parse_var_props($tag_command . $tag_modifier, $this->_parse_attrs($tag_args));
- if(isset($_tag_attrs['assign'])) {
- return "<?php \$this->assign('" . $this->_dequote($_tag_attrs['assign']) . "', $_return ); ?>\n";
- } else {
- return "<?php echo $_return; ?>" . $this->_additional_newline;
- }
+ $_return = $this->_parse_var_props($tag_command . $tag_modifier);
+ return "<?php echo $_return; ?>" . $this->_additional_newline;
}
/* If the tag name is a registered object, we process it. */
case 'foreachelse':
$this->_push_tag('foreachelse');
- return "<?php endforeach; unset(\$_from); else: ?>";
+ return "<?php endforeach; else: ?>";
case '/foreach':
$_open_tag = $this->_pop_tag('foreach');
if ($_open_tag == 'foreachelse')
- return "<?php endif; ?>";
+ return "<?php endif; unset(\$_from); ?>";
else
- return "<?php endforeach; unset(\$_from); endif; ?>";
+ return "<?php endforeach; endif; unset(\$_from); ?>";
break;
case 'strip':
$this->_pop_tag('strip');
if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
$this->_additional_newline = "\n";
- return $this->left_delimiter.$tag_command.$this->right_delimiter;
+ return '{' . $tag_command . '}';
}
} else {
$this->_push_tag('strip');
if ($this->_strip_depth++==0) { /* outermost opening {strip} */
$this->_additional_newline = "";
- return $this->left_delimiter.$tag_command.$this->right_delimiter;
+ return '{' . $tag_command . '}';
}
}
return '';
$output .= $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat=true);';
$output .= 'while ($_block_repeat) { ob_start(); ?>';
} else {
- $output = '<?php $this->_block_content = ob_get_contents(); ob_end_clean(); ';
- $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $this->_block_content, $this, $_block_repeat=false)';
+ $output = '<?php $_block_content = ob_get_contents(); ob_end_clean(); ';
+ $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $_block_content, $this, $_block_repeat=false)';
if ($tag_modifier != '') {
$this->_parse_modifiers($_out_tag_text, $tag_modifier);
}
$return = null;
$postfix = '';
} else {
- $prefix = "\$this->_obj_block_content = ob_get_contents(); ob_end_clean(); ";
- $return = "\$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$this->_obj_block_content, \$this, \$_block_repeat=false)";
+ $prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); ";
+ $return = "\$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat=false)";
$postfix = "} array_pop(\$this->_tag_stack);";
}
} else {
}
$output = '<?php ';
+ $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }";
if (isset($name)) {
$foreach_props = "\$this->_foreach[$name]";
- $output .= "if (isset(\$this->_foreach[$name])) unset(\$this->_foreach[$name]);\n";
- $output .= "{$foreach_props}['total'] = count(\$_from = (array)$from);\n";
- $output .= "{$foreach_props}['show'] = {$foreach_props}['total'] > 0;\n";
- $output .= "if ({$foreach_props}['show']):\n";
- $output .= "{$foreach_props}['iteration'] = 0;\n";
+ $output .= "{$foreach_props} = array('total' => count(\$_from), 'iteration' => 0);\n";
+ $output .= "if ({$foreach_props}['total'] > 0):\n";
$output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
$output .= " {$foreach_props}['iteration']++;\n";
- $output .= " {$foreach_props}['first'] = ({$foreach_props}['iteration'] == 1);\n";
- $output .= " {$foreach_props}['last'] = ({$foreach_props}['iteration'] == {$foreach_props}['total']);\n";
} else {
- $output .= "if (count(\$_from = (array)$from)):\n";
+ $output .= "if (count(\$_from)):\n";
$output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n";
}
$output .= '?>';
$tokens = $match[0];
+ if(empty($tokens)) {
+ $_error_msg .= $elseif ? "'elseif'" : "'if'";
+ $_error_msg .= ' statement requires arguments';
+ $this->_syntax_error($_error_msg, E_USER_ERROR, __FILE__, __LINE__);
+ }
+
+
// make sure we have balanced parenthesis
$token_count = array_count_values($tokens);
if(isset($token_count['(']) && $token_count['('] != $token_count[')']) {
!in_array($token, $this->security_settings['IF_FUNCS'])) {
$this->_syntax_error("(secure mode) '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);
}
+ } elseif(preg_match('~^' . $this->_var_regexp . '$~', $token) && isset($tokens[$i+1]) && $tokens[$i+1] == '(') {
+ // variable function call
+ $this->_syntax_error("variable function call '$token' not allowed in if statement", E_USER_ERROR, __FILE__, __LINE__);
} elseif(preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)$~', $token)) {
// object or variable
$token = $this->_parse_var_props($token);
}
elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) {
// literal string
- return $this->_expand_quoted_text('"' . $val .'"');
+ return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"');
}
return $val;
}
break;
case 'foreach':
+ array_shift($indexes);
+ $_var = $this->_parse_var_props(substr($indexes[0], 1));
+ $_propname = substr($indexes[1], 1);
+ $_max_index = 1;
+ switch ($_propname) {
+ case 'index':
+ array_shift($indexes);
+ $compiled_ref = "(\$this->_foreach[$_var]['iteration']-1)";
+ break;
+
+ case 'first':
+ array_shift($indexes);
+ $compiled_ref = "(\$this->_foreach[$_var]['iteration'] <= 1)";
+ break;
+
+ case 'last':
+ array_shift($indexes);
+ $compiled_ref = "(\$this->_foreach[$_var]['iteration'] == \$this->_foreach[$_var]['total'])";
+ break;
+
+ case 'show':
+ array_shift($indexes);
+ $compiled_ref = "(\$this->_foreach[$_var]['total'] > 0)";
+ break;
+
+ default:
+ unset($_max_index);
+ $compiled_ref = "\$this->_foreach[$_var]";
+ }
+ break;
+
case 'section':
array_shift($indexes);
$_var = $this->_parse_var_props(substr($indexes[0], 1));
- if ($_ref == 'foreach')
- $compiled_ref = "\$this->_foreach[$_var]";
- else
- $compiled_ref = "\$this->_sections[$_var]";
+ $compiled_ref = "\$this->_sections[$_var]";
break;
case 'get':
return;
}
array_shift($indexes);
- $_val = $this->_parse_var_props(substr($indexes[0],1));
- $compiled_ref = '@constant(' . $_val . ')';
+ if (preg_match('!^\.\w+$!', $indexes[0])) {
+ $compiled_ref = '@' . substr($indexes[0], 1);
+ } else {
+ $_val = $this->_parse_var_props(substr($indexes[0], 1));
+ $compiled_ref = '@constant(' . $_val . ')';
+ }
$_max_index = 1;
break;
// set path to debug template from SMARTY_DIR
$smarty->debug_tpl = SMARTY_DIR . 'debug.tpl';
if($smarty->security && is_file($smarty->debug_tpl)) {
- $smarty->secure_dir[] = dirname(realpath($smarty->debug_tpl));
+ $smarty->secure_dir[] = realpath($smarty->debug_tpl);
}
$smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl';
}
}
if (!empty($smarty->secure_dir)) {
foreach ((array)$smarty->secure_dir as $curr_dir) {
- if ( ($_cd = realpath($curr_dir)) !== false &&
- strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
+ if ( ($_cd = realpath($curr_dir)) !== false) {
+ if( strncmp($_rp, $_cd, strlen($_cd)) == 0 &&
$_rp{strlen($_cd)} == DIRECTORY_SEPARATOR ) {
- return true;
- }
+ return true;
+ } elseif ($_cd == $_rp) {
+ return true;
+ }
+ }
}
}
} else {
$smarty->_cache_including = true;
$_return = $params['results'];
+
+ foreach ($smarty->_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
+ $smarty->_include($_include_file_path, true);
+ }
+
foreach ($smarty->_cache_serials as $_include_file_path=>$_cache_serial) {
$_return = preg_replace_callback('!(\{nocache\:('.$_cache_serial.')#(\d+)\})!s',
array(&$smarty, '_process_compiled_include_callback'),
return false;
}
- $cache_split = explode("\n", $params['results'], 2);
- $cache_header = $cache_split[0];
-
- $_cache_info = unserialize($cache_header);
+ $_contents = $params['results'];
+ $_info_start = strpos($_contents, "\n") + 1;
+ $_info_len = (int)substr($_contents, 0, $_info_start - 1);
+ $_cache_info = unserialize(substr($_contents, $_info_start, $_info_len));
+ $params['results'] = substr($_contents, $_info_start + $_info_len);
if ($smarty->caching == 2 && isset ($_cache_info['expires'])){
// caching by expiration time
}
}
- foreach ($_cache_info['cache_serials'] as $_include_file_path=>$_cache_serial) {
- if (empty($smarty->_cache_serials[$_include_file_path])) {
- $smarty->_include($_include_file_path, true);
- }
-
- if ($smarty->_cache_serials[$_include_file_path] != $_cache_serial) {
- /* regenerate */
- return false;
- }
- }
- $params['results'] = $cache_split[1];
$content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info);
$smarty->_cache_info = $_cache_info;
'level' => $params['level'] + 1,
'exp_time' => $params['exp_time']
);
- require_once(SMARTY_CORE_DIR . 'core.rmdir.php');
smarty_core_rmdir($_params, $smarty);
}
else {
$smarty->_cache_info['cache_serials'] = $smarty->_cache_serials;
// prepend the cache header info into cache file
- $params['results'] = serialize($smarty->_cache_info)."\n".$params['results'];
+ $_cache_info = serialize($smarty->_cache_info);
+ $params['results'] = strlen($_cache_info) . "\n" . $_cache_info . $params['results'];
if (!empty($smarty->cache_handler_func)) {
// use cache_handler function
if ($this_varname == '_smarty') {
/* rename $this to $_smarty in the sourcecode */
$tokens = token_get_all('<?php ' . $_match[4]);
- array_shift($tokens); /* remove the opening <.?.php */
+
+ /* remove trailing <?php */
+ $open_tag = '';
+ while ($tokens) {
+ $token = array_shift($tokens);
+ if (is_array($token)) {
+ $open_tag .= $token[1];
+ } else {
+ $open_tag .= $token;
+ }
+ if ($open_tag == '<?php ') break;
+ }
+
for ($i=0, $count = count($tokens); $i < $count; $i++) {
if (is_array($tokens[$i])) {
if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
* </pre>
* @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle}
* (Smarty online manual)
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Mark Priatel <mpriatel@rogers.com>
* @author credit to Gerard <gerard@interfold.com>
* @author credit to Jason Sweat <jsweat_php@yahoo.com>
* Purpose: popup debug window
* @link http://smarty.php.net/manual/en/language.function.debug.php {debug}
* (Smarty online manual)
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
* @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
- * @author credits to Monte Ohrt <monte@ispi.net>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
settype($selected, 'array');
$_html_result = array();
- if (is_array($options)) {
+ if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
* Purpose: format HTML tags for the image<br>
* Input:<br>
* - file = file (and path) of image (required)
- * - border = border width (optional, default 0)
* - height = image height (optional, default actual height)
- * - image =image width (optional, default actual width)
+ * - width = image width (optional, default actual width)
* - basedir = base directory for absolute paths, default
* is environment variable DOCUMENT_ROOT
*
* Examples: {html_image file="images/masthead.gif"}
- * Output: <img src="images/masthead.gif" border=0 width=400 height=23>
+ * Output: <img src="images/masthead.gif" width=400 height=23>
* @link http://smarty.php.net/manual/en/language.function.html.image.php {html_image}
* (Smarty online manual)
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Duda <duda@big.hu> - wrote first image function
* in repository, helped with lots of functionality
* @version 1.0
$alt = '';
$file = '';
- $border = 0;
$height = '';
$width = '';
$extra = '';
foreach($params as $_key => $_val) {
switch($_key) {
case 'file':
- case 'border':
case 'height':
case 'width':
case 'dpi':
$height = round($height * $_resize);
}
- return $prefix . '<img src="'.$file.'" alt="'.$alt.'" border="'.$border.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
+ return $prefix . '<img src="'.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix;
}
/* vim: set expandtab: */
$_html_result = '';
- if (is_array($options)) {
+ if (isset($options)) {
foreach ($options as $_key=>$_val)
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
} else {
- foreach ((array)$values as $_i=>$_key) {
+ foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
}
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
* (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
- * @author credits to Monte Ohrt <monte@ispi.net>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param array
* @param Smarty
$selected = null;
$separator = '';
$labels = true;
+ $label_ids = false;
$output = null;
$extra = '';
break;
case 'labels':
+ case 'label_ids':
$$_key = (bool)$_val;
break;
$_html_result = array();
- if (isset($options) && is_array($options)) {
+ if (isset($options)) {
- foreach ((array)$options as $_key=>$_val)
- $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+ foreach ($options as $_key=>$_val)
+ $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
} else {
- foreach ((array)$values as $_i=>$_key) {
+ foreach ($values as $_i=>$_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
- $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
+ $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
}
}
}
-function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) {
+function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
$_output = '';
- if ($labels) $_output .= '<label>';
- $_output .= '<input type="radio" name="'
+ if ($labels) {
+ if($label_ids) {
+ $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
+ $_output .= '<label for="' . $_id . '">';
+ } else {
+ $_output .= '<label>';
+ }
+ }
+ $_output .= '<input type="radio" name="'
. smarty_function_escape_special_chars($name) . '" value="'
. smarty_function_escape_special_chars($value) . '"';
- if ($value==$selected) {
+ if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
+
+ if ((string)$value==$selected) {
$_output .= ' checked="checked"';
}
$_output .= $extra . ' />' . $output;
*/
function smarty_function_html_select_date($params, &$smarty)
{
+ require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
require_once $smarty->_get_plugin_filepath('function','html_options');
/* Default values. */
$day_empty = null;
$month_empty = null;
$year_empty = null;
+ $extra_attrs = '';
foreach ($params as $_key=>$_value) {
switch ($_key) {
break;
default:
- $smarty->trigger_error("[html_select_date] unknown parameter $_key", E_USER_WARNING);
-
+ if(!is_array($_value)) {
+ $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
+ } else {
+ $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
+ }
+ break;
}
}
if (null !== $all_extra){
$month_result .= ' ' . $all_extra;
}
- $month_result .= '>'."\n";
+ $month_result .= $extra_attrs . '>'."\n";
$month_result .= smarty_function_html_options(array('output' => $month_names,
'values' => $month_values,
- 'selected' => $a=$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
+ 'selected' => (int)$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
'print_result' => false),
$smarty);
$month_result .= '</select>';
if (null !== $day_extra){
$day_result .= ' ' . $day_extra;
}
- $day_result .= '>'."\n";
+ $day_result .= $extra_attrs . '>'."\n";
$day_result .= smarty_function_html_options(array('output' => $days,
'values' => $day_values,
'selected' => $time[2],
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
- $year_result .= '>';
+ $year_result .= ' />';
} else {
$years = range((int)$start_year, (int)$end_year);
if ($reverse_years) {
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
- $year_result .= '>'."\n";
+ $year_result .= $extra_attrs . '>'."\n";
$year_result .= smarty_function_html_options(array('output' => $years,
'values' => $yearvals,
'selected' => $time[0],
* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
* {table loop=$data cols=4 tr_attr=$colors}
* </pre>
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
* (Smarty online manual)
* - encode = (optional) can be one of:
* * none : no encoding (default)
* * javascript : encode with javascript
+ * * javascript_charcode : encode with javascript charcode
* * hex : encode with hexidecimal (no javascript)
* - cc = (optional) address(es) to carbon copy
* - bcc = (optional) address(es) to blind carbon copy
* @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto}
* (Smarty online manual)
* @version 1.2
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Jason Sweat (added cc, bcc and subject functionality)
* @param array
* @param Smarty
$address .= $mail_parm_vals;
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
- if (!in_array($encode,array('javascript','hex','none')) ) {
+ if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) {
$smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex");
return;
}
return '<script type="text/javascript">eval(unescape(\''.$js_encode.'\'))</script>';
+ } elseif ($encode == 'javascript_charcode' ) {
+ $string = '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>';
+
+ for($x = 0, $y = strlen($string); $x < $y; $x++ ) {
+ $ord[] = ord($string[$x]);
+ }
+
+ $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n";
+ $_ret .= "<!--\n";
+ $_ret .= "{document.write(String.fromCharCode(";
+ $_ret .= implode(',',$ord);
+ $_ret .= "))";
+ $_ret .= "}\n";
+ $_ret .= "//-->\n";
+ $_ret .= "</script>\n";
+
+ return $_ret;
+
+
} elseif ($encode == 'hex') {
preg_match('!^(.*)(\?.*)$!',$address,$match);
}
// match all vars in equation, make sure all are passed
- preg_match_all("!\!(0x)([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
+ preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]+)!",$equation, $match);
$allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
- foreach($match[2] as $curr_var) {
- if (!in_array($curr_var,array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
- $smarty->trigger_error("math: parameter $curr_var not passed as argument");
+
+ foreach($match[1] as $curr_var) {
+ if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
+ $smarty->trigger_error("math: function call $curr_var not allowed");
return;
}
}
switch ($_key) {
case 'text':
case 'trigger':
+ case 'function':
+ case 'inarray':
$$_key = (string)$_value;
+ if ($_key == 'function' || $_key == 'inarray')
+ $append .= ',' . strtoupper($_key) . ",'$_value'";
break;
case 'caption':
case 'closefont':
case 'fgbackground':
case 'bgbackground':
- case 'inarray':
case 'caparray':
case 'capicon':
case 'background':
case 'frame':
- case 'function':
$append .= ',' . strtoupper($_key) . ",'$_value'";
break;
case 'fullhtml':
case 'hauto':
case 'vauto':
+ case 'mouseoff':
+ case 'followmouse':
if ($_value) $append .= ',' . strtoupper($_key);
break;
if (empty($trigger)) { $trigger = "onmouseover"; }
$retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\'';
- $retval .= $append . ');" onmouseout="nd();"';
+ $retval .= $append . ');"';
+ if ($trigger == 'onmouseover')
+ $retval .= ' onmouseout="nd();"';
+
return $retval;
}
* Example: {$var|cat:"foo"}
* @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
* (Smarty online manual)
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param string
* @param string
return htmlentities($string, ENT_QUOTES);
case 'url':
- return urlencode($string);
+ return rawurlencode($string);
case 'quotes':
// escape unescaped single quotes
* @link http://smarty.php.net/manual/en/language.modifier.nl2br.php
* nl2br (Smarty online manual)
* @version 1.0
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @param string
* @return string
*/
*/
function smarty_modifier_regex_replace($string, $search, $replace)
{
+ if (preg_match('!\W(\w+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
+ /* remove eval-modifier from $search */
+ $search = substr($search, 0, -strlen($match[1])) . str_replace('e', '', $match[1]);
+ }
return preg_replace($search, $replace, $string);
}
* Date: September 25th, 2002
* @link http://smarty.php.net/manual/en/language.modifier.strip.php
* strip (Smarty online manual)
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @version 1.0
* @param string
* @param string
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
- * appending the $etc string.
+ * appending the $etc string or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @param string
* @param integer
* @param string
* @param boolean
+ * @param boolean
* @return string
*/
function smarty_modifier_truncate($string, $length = 80, $etc = '...',
- $break_words = false)
+ $break_words = false, $middle = false)
{
if ($length == 0)
return '';
if (strlen($string) > $length) {
$length -= strlen($etc);
- if (!$break_words)
+ if (!$break_words && !$middle) {
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
-
- return substr($string, 0, $length).$etc;
- } else
+ }
+ if(!$middle) {
+ return substr($string, 0, $length).$etc;
+ } else {
+ return substr($string, 0, $length/2) . $etc . substr($string, -$length/2);
+ }
+ } else {
return $string;
+ }
}
/* vim: set expandtab: */
* Install: Drop into the plugin directory, call
* <code>$smarty->load_filter('output','trimwhitespace');</code>
* from application.
- * @author Monte Ohrt <monte@ispi.net>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author Contributions from Lars Noschinski <lars@usenet.noschinski.de>
* @version 1.3
* @param string
function smarty_make_timestamp($string)
{
if(empty($string)) {
- $string = "now";
- }
- $time = strtotime($string);
- if (is_numeric($time) && $time != -1)
- return $time;
-
- // is mysql timestamp format of YYYYMMDDHHMMSS?
- if (preg_match('/^\d{14}$/', $string)) {
- $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
- substr($string,4,2),substr($string,6,2),substr($string,0,4));
+ // use "now":
+ $time = time();
- return $time;
+ } elseif (preg_match('/^\d{14}$/', $string)) {
+ // it is mysql timestamp format of YYYYMMDDHHMMSS?
+ $time = mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
+ substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
+
+ } elseif (is_numeric($string)) {
+ // it is a numeric string, we handle it as timestamp
+ $time = (int)$string;
+
+ } else {
+ // strtotime should handle it
+ $time = strtotime($string);
+ if ($time == -1 || $time === false) {
+ // strtotime() was not able to parse $string, use "now":
+ $time = time();
+ }
}
+ return $time;
- // couldn't recognize it, try to return a time
- $time = (int) $string;
- if ($time > 0)
- return $time;
- else
- return time();
}
/* vim: set expandtab: */
+-------------------------------------------------------------------------+
*/
// Last Err:
+session_start();
require ("paths.php");
require($smarty_path."Smarty.class.php");
include "classes.inc";
require("lang.php");
+//Assign dbs
+if ( count($dbSql->dbs) >1 ) {
+ $smarty->assign("dbs", $dbSql->dbs);
+ $smarty->assign("dbs_now", $_SESSION['DATABASE']);
+}
// generaldata.tpl & last_run_report.tpl (last24bytes)
$client = $dbSql->link->query("select count(*) from Client")
# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR Free Software Foundation, Inc.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2004-06-11 13:02+0200\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2005-10-06 16:30+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: ENCODING\n"
+"Content-Transfer-Encoding: 8bit\n"
#: lang.c:1 lang.c:2
msgid "Bytes transferred last 30 days from ALL clients"
msgstr ""
#: lang.c:7
-msgid "Last month, bytes transferred"
+msgid "Database size"
msgstr ""
#: lang.c:8
-msgid "Last month, bytes transferred (pie)"
+msgid "Last month, bytes transferred"
msgstr ""
#: lang.c:9
-msgid "General%20report"
+msgid "Last month, bytes transferred (pie)"
msgstr ""
#: lang.c:10
-msgid "Status from last 24h"
+msgid "Select"
msgstr ""
#: lang.c:11
-msgid "Errors:"
+msgid "General%20report"
msgstr ""
#: lang.c:12
-msgid "Terminated Jobs:"
+msgid "Status from last 24h"
msgstr ""
#: lang.c:13
-msgid "Total time spent to do backup:"
+msgid "Errors:"
msgstr ""
#: lang.c:14
-msgid "Bytes transferred last 24h"
+msgid "Terminated Jobs:"
msgstr ""
#: lang.c:15
-msgid "Show details"
+msgid "Total time spent to do backup:"
msgstr ""
#: lang.c:16
-msgid "Jobs with errors"
+msgid "Bytes transferred last 24h"
msgstr ""
#: lang.c:17
-msgid "Name"
+msgid "Show details"
msgstr ""
#: lang.c:18
-msgid "EndTime"
+msgid "Jobs with errors"
msgstr ""
#: lang.c:19
-msgid "JobStatus"
+msgid "Name"
msgstr ""
#: lang.c:20
+msgid "EndTime"
+msgstr ""
+
+#: lang.c:21
+msgid "JobStatus"
+msgstr ""
+
+#: lang.c:22
msgid "Detailed report"
msgstr ""
-#: lang.c:21 lang.c:42
+#: lang.c:23 lang.c:45
msgid "Select a job:"
msgstr ""
-#: lang.c:22
+#: lang.c:24
msgid "go"
msgstr ""
-#: lang.c:23
+#: lang.c:25
msgid "Elapsed time"
msgstr ""
-#: lang.c:24
-msgid "Job"
+#: lang.c:26
+msgid "Client"
msgstr ""
-#: lang.c:25
+#: lang.c:27
msgid "Start Time"
msgstr ""
-#: lang.c:26
+#: lang.c:28
msgid "End Time"
msgstr ""
-#: lang.c:27
+#: lang.c:29
msgid "Type"
msgstr ""
-#: lang.c:28
+#: lang.c:30
msgid "Pool"
msgstr ""
-#: lang.c:29 lang.c:40
+#: lang.c:31 lang.c:43
msgid "Status"
msgstr ""
-#: lang.c:30
+#: lang.c:32
msgid "Stats Bacula: Job"
msgstr ""
-#: lang.c:31
-msgid "Client:"
+#: lang.c:33
+msgid "Job:"
msgstr ""
-#: lang.c:32
+#: lang.c:34
msgid "Period: From"
msgstr ""
-#: lang.c:33
+#: lang.c:35
msgid "to"
msgstr ""
-#: lang.c:34
+#: lang.c:36
msgid "Bytes transferred in the period:"
msgstr ""
-#: lang.c:35
+#: lang.c:37
msgid "Files transferred in the period:"
msgstr ""
-#: lang.c:36
+#: lang.c:38
+msgid "JobID"
+msgstr ""
+
+#: lang.c:39
msgid "Date"
msgstr ""
-#: lang.c:37
+#: lang.c:40
msgid "Elapsed"
msgstr ""
-#: lang.c:38
+#: lang.c:41
msgid "Level"
msgstr ""
-#: lang.c:39
+#: lang.c:42
msgid "Bytes"
msgstr ""
-#: lang.c:41
+#: lang.c:44
msgid "SELECT NEW REPORT"
msgstr ""
-#: lang.c:43
+#: lang.c:46
msgid "Graph mode:"
msgstr ""
-#: lang.c:44
+#: lang.c:47
msgid "lines"
msgstr ""
-#: lang.c:45
+#: lang.c:48
msgid "linepoints"
msgstr ""
-#: lang.c:46
+#: lang.c:49
msgid "points"
msgstr ""
-#: lang.c:47
+#: lang.c:50
msgid "bars"
msgstr ""
-#: lang.c:48
+#: lang.c:51
msgid "area"
msgstr ""
-#: lang.c:49
+#: lang.c:52
msgid "Data to show:"
msgstr ""
-#: lang.c:50
+#: lang.c:53
msgid "Transferred bytes"
msgstr ""
-#: lang.c:51
+#: lang.c:54
msgid "Start period:"
msgstr ""
-#: lang.c:52
+#: lang.c:55
msgid "End period:"
msgstr ""
-#: lang.c:53
+#: lang.c:56
msgid "Create report"
msgstr ""
-#: lang.c:54
+#: lang.c:57
msgid "Volume Name"
msgstr ""
-#: lang.c:55
+#: lang.c:58
msgid "Volume Bytes"
msgstr ""
-#: lang.c:56
+#: lang.c:59
msgid "Media Type"
msgstr ""
-#: lang.c:57
+#: lang.c:60
msgid "When expire?"
msgstr ""
-#: lang.c:58
+#: lang.c:61
msgid "Last Written"
msgstr ""
-#: lang.c:59
+#: lang.c:62
msgid "Volume Status"
msgstr ""
// PhPlot package. version 5.0RC1. http://www.phplot.com
$phplot_path = "external_packages/phplot/";
-//Smarty package. version 2.6.6. http://smarty.php.net
+//Smarty package. version 2.6.10. http://smarty.php.net
$smarty_path = "external_packages/smarty/";
//Smarty_gettext. version 0.9. http://www.boom.org.il/smarty/gettext/
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
*/
-
+session_start();
require ("paths.php");
require($smarty_path."Smarty.class.php");
include "classes.inc";
// $MBottom = Margin of the bottom of the graph
// $modo_graph= Type of graph (bars, lines, linepoints, area, points, and pie).
// $elapsed = Period in seconds to show complex graph (tipo_dato <3) 1 month = 18144000
-
+session_start();
require ("classes.inc");
$graph = new BCreateGraph();
<BODY bgcolor="#ffffff">
<table width=1000px cellpadding=0 cellspacing=0 border=0 bgcolor="#2F92AF">
<tr>
- <td class=titulo2 background="images/bg2.png">
+ <td class=titulo2 background="images/bg2.png" valign="bottom">
{#title#}
</td>
- <td background="images/bg2.png" align=right>
+ {if $dbs ne ""}
+ <form method=post action=index.php>
+ <td background="{#root#}/images/bg2.png" align="right" valign="top">
+ {t}Select{/t}:
+ <select name=sel_database style="font-family:verdana;font-size: 6px;color: white; background-color:#666;" onchange=submit()>
+ {html_options values=$dbs output=$dbs selected=$dbs_now}
+ </select>
+ </td>
+ </form>
+ {/if}
+ <td background="{#root#}/images/bg2.png" align=right width=7%>
+ <a href="{php $_SERVER['PHP_SELF'];}"><img src="{#root#}/images/refresh.gif" alt='Refresh'></a>
<a href="http://indpnday.com/bacula_stuff/bacula-web/mantisbt/login_page.php" target="_blank" {popup text="They grow thanks to Juan Luis Francés...Please, click here to report them"}>
Bugs?
</a>
-#!/usr/local/bin/php -qn
+#!/usr/bin/php -qn
<?php
/**
* tsmarty2c.php - rips gettext strings from smarty template