diff options
author | Tatsuo Ishii | 2006-09-08 03:39:43 +0000 |
---|---|---|
committer | Tatsuo Ishii | 2006-09-08 03:39:43 +0000 |
commit | 5c1e79e5a7cc835ce9a9d5ebb82b680a5f48ce35 (patch) | |
tree | 6d4d9c306317fa2f1b63507cea1d24b434a48f8e |
pgpoolAdmin initial releaseV1_0_0
208 files changed, 22147 insertions, 0 deletions
@@ -0,0 +1 @@ +See doc/index_en.html diff --git a/README.euc_jp b/README.euc_jp new file mode 100644 index 0000000..1d3e753 --- /dev/null +++ b/README.euc_jp @@ -0,0 +1 @@ +doc/index_ja.html �Ƥ��������� diff --git a/changePassword.php b/changePassword.php new file mode 100644 index 0000000..5233870 --- /dev/null +++ b/changePassword.php @@ -0,0 +1,100 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Change in password for PgpoolAdmin written in pcp.conf + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +if(isset($_POST['action'])) { + $action = $_POST['action']; +} else { + $action = FALSE; +} + + +switch ( $action ) { + case 'update': + + if(!isset($_POST['password']) || !isset($_POST['password2'])) { + $tpl->display('changePassword.tpl'); + break; + } + + $password = $_POST['password']; + $password2 = $_POST['password2']; + + if($password == '' || $password2 == '') { + $tpl->assign('error', $message['errPasswordMismatch']); + $tpl->display('changePassword.tpl'); + break; + } + + if($password === $password2) { + + $passFile = @file(_PGPOOL2_PASSWORD_FILE); + if($passFile == false) { + $errorCode = 'e6001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + if( ! is_writable(_PGPOOL2_PASSWORD_FILE) ) { + $errorCode = 'e6003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + $fw = fopen(_PGPOOL2_PASSWORD_FILE, 'w'); + + for($i=0; $i<count($passFile); $i++) { + + $line = $passFile[$i]; + $spt = split(":", $line); + + if($spt[0] == $_SESSION[SESSION_LOGIN_USER]) { + $line = $_SESSION[SESSION_LOGIN_USER] . ":" . md5($password) . "\n"; + } + fputs($fw, $line); + } + fclose($fw); + + session_unset(); + $tpl->display('login.tpl'); + break; + } else { + $tpl->assign('error', $message['errPasswordMismatch']); + } + + default: + $tpl->display('changePassword.tpl'); + break; +} +?> + diff --git a/command.php b/command.php new file mode 100644 index 0000000..a59964a --- /dev/null +++ b/command.php @@ -0,0 +1,128 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Command of PCP + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); + +/** + * Execute pcp command + * + * @param string $command + * @param srgs $num + * @return array + */ +function execPcp($command, $num='') { + $pcpStatus = array ( + '0' => 'SUCCESS', + '1' => 'UNKNOWNERR', + '2' => 'EOFERR', + '3' => 'NOMEMERR', + '4' => 'READERR', + '5' => 'WRITEERR', + '6' => 'TIMEOUTERR', + '7' => 'INVALERR', + '8' => 'CONNERR', + '9' => 'NOCONNERR', + '10' => 'SOCKERR', + '11' => 'HOSTERR', + '12' => 'BACKENDERR', + '13' => 'AUTHERR', + '127' => 'COMMANDERROR' + ); + + $param = readPcpInfo(); + $param['hostname'] = _PGPOOL2_PCP_HOSTNAME; + + $args = " " . $param['pcp_timeout'] . " " . $param['hostname'] . " " . $param['pcp_port'] . " ". $_SESSION[SESSION_LOGIN_USER] . " " . $_SESSION[SESSION_LOGIN_USER_PASSWORD] . " " . $num; + + switch ($command) { + case 'PCP_NODE_COUNT': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_node_count' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + case 'PCP_NODE_INFO': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_node_info' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + case 'PCP_ATTACH_NODE': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_attach_node' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + case 'PCP_DETACH_NODE': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_detach_node' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + case 'PCP_PROC_COUNT': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_proc_count' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + case 'PCP_PROC_INFO': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_proc_info' . $args; + $ret = exec($cmd, $output, $return_var); + $ret = $output; + break; + + case 'PCP_START_PGPOOL': + $cmdOption = $num; + $cmdOption = $cmdOption . ' -f ' . _PGPOOL2_CONFIG_FILE + . ' -F ' . _PGPOOL2_PASSWORD_FILE; + if(DoesPgpoolPidExist()) { + return array('FAIL'=> ''); + } + $cmd = _PGPOOL2_COMMAND . $cmdOption . ' 2>&1 &'; + $ret = exec($cmd, $output, $return_var); + if($return_var == 0) { + return array($pcpStatus[$return_var] => $output); + } else { + return array('FAIL' => $output); + } + break; + + case 'PCP_STOP_PGPOOL': + $cmd = _PGPOOL2_PCP_DIR . '/pcp_stop_pgpool' . $args; + $ret = exec($cmd, $output, $return_var); + break; + + default: + return array($pspStatus[1] => $pspStatus[1]); + } + return array($pcpStatus[$return_var] => $ret); +} + +/** + * Read parameter of pcp_port and pcp_timeout from pgpool.conf + * + * @return array + */ +function readPcpInfo() { + + $params = readConfigParams(array('pcp_port', 'pcp_timeout')); + return $params; +} +?> diff --git a/common.php b/common.php new file mode 100644 index 0000000..fcb6390 --- /dev/null +++ b/common.php @@ -0,0 +1,390 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Common file of PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version SVN: $Id$ + */ + +require_once('version.php'); +require_once('libs/Smarty.class.php'); +error_reporting(E_ALL); + +define('SESSION_LOGIN_USER', 'loginUser'); +define('SESSION_LOGIN_USER_PASSWORD', 'md5pass'); +define('SESSION_LANG', 'lang'); +define('SESSION_MESSAGE', 'message'); + +session_start(); + +/** + * Smarty Parameter + */ +define('SMARTY_TEMPLATE_DIR', dirname(__FILE__) . '/templates' ); +define('SMARTY_COMPILE_DIR', dirname(__FILE__) . '/templates_c' ); + +/** + * Initialize Smartry + */ +$tpl = new Smarty(); +$tpl->assign('version', $version); + +if(!file_exists('conf/pgmgt.conf.php')) { + include('lang/en.lang.php'); + $tpl->assign('message', $message); + $tpl->display('pgmgtNotFound.tpl'); + exit(); +} + +require_once('conf/pgmgt.conf.php'); + +/** + * Check login + */ +$isLogin = FALSE; +if(isset($_SESSION[SESSION_LOGIN_USER])) { + $isLogin = TRUE; + $tpl->assign('isLogin', $isLogin); +} + +/** + * Check pgmgt.conf.php Parameter + */ +$errors = array(); +if( !defined('_PGPOOL2_LANG') + || !defined('_PGPOOL2_CONFIG_FILE') + || !defined('_PGPOOL2_PASSWORD_FILE') + || !defined('_PGPOOL2_COMMAND') + || !defined('_PGPOOL2_PCP_DIR') + || !defined('_PGPOOL2_PCP_HOSTNAME') + || !defined('_PGPOOL2_STATUS_REFRESH_TIME')) { + + include('lang/en.lang.php'); + $tpl->assign('message', $message); + $errorCode = 'e7'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + +/** + * Create message catalog list + */ +$messageList = array(); + +$res_dir = opendir('lang/'); +while($file_name = readdir( $res_dir )) { + if(ereg('.*\.lang\.php$', $file_name)) { + if(@is_file('lang/' . $file_name)) { + include('lang/' . $file_name); + $messageList[$message['lang']] = $message['strLang']; + } else { + $errorCode = 'e2'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + + } + } +} +$tpl->assign('messageList', $messageList); + +/** + * Load message catalog + */ + +$lang = selectLanguage(_PGPOOL2_LANG, $messageList); +include('lang/' . $lang . '.lang.php'); +$tpl->assign('message', $message); +$_SESSION[SESSION_MESSAGE] = $message; + +/** + * Open databse connection + * + * @param array $param + * @return resource + */ +function openDBConnection($param) +{ + $host= $param['hostname']; + $port = $param['port']; + $dbname = $param['dbname']; + $user = $param['user']; + $password = $param['password']; + + if($host != '') { + $conStr = "host=$host port=$port dbname=$dbname user=$user password=$password" ; + } else { + $conStr = "port=$port dbname=$dbname" ; + } + + $con = @pg_connect($conStr); + return $con; +} + +/** + * Close database connection + * + * @param bool + */ +function closeDBConnection($connection) +{ + return pg_close($connection); +} + +/** + * Execute query + * + * @param resource $conn + * @param string $sql + * @return resource + */ +function execQuery($conn, $sql) { + $rs = @pg_query($conn, $sql); + if(!pg_result_status($rs) == PGSQL_TUPLES_OK) { + return false; + } + + return $rs; +} + +/** + * Select language registred in conf directory + * + * @return string + */ +function selectLanguage($selectLang, $messageList) { + if( $selectLang == null || $selectLang == 'auto') { + if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { + $acceptLanguages = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + } else { + $acceptLanguages = FALSE; + } + + $lang = null; + + if($acceptLanguages == FALSE) { + $lang = 'en'; + } else { + $langList = split(',|;', $acceptLanguages); + foreach($langList as $acceptLanguage) { + foreach(array_keys($messageList) as $messageLanguage) { + if( $acceptLanguage == $messageLanguage ) { + $lang = $messageLanguage; + break; + } + } + if( $lang != null) break; + } + } + } else { + $lang = $selectLang; + } + $_SESSION[SESSION_LANG] = $lang; + return $lang; +} + +/** + * Whether pgpool is operating in the parallel mode or not? + * + * @return bool + */ +function isParallelMode() { + + $params = readConfigParams(array('parallel_mode')); + + if($params['parallel_mode'] == 'true') { + return true; + } else { + return false; + } +} + +/** + * Confirmation whether node is active or is not. + * + * @return bool + */ +function NodeActive($num) { + $healthCheckDb = 'template1'; + + $params = readHealthCheckParam(); + + $healthCheckUser = $params['health_check_user']; + $backendHostName = $params['backend_hostname'][$num]; + $backendPort = $params['backend_port'][$num]; + if($backendHostName != '') { + $conStr = "dbname=$healthCheckDb user=$healthCheckUser host=$backendHostName port=$backendPort" ; + } else { + $conStr = "dbname=$healthCheckDb port=$backendPort" ; + } + + $conn = @pg_connect($conStr); + + if($conn == FALSE) { + @pg_close($conn); + return FALSE; + } else { + @pg_close($conn); + return TRUE; + } +} + +/** + * Read parameter from pgpool.conf using health check + * + * @return array + */ +function readHealthCheckParam() { + + $params = readConfigParams(array('health_check_user', + 'backend_hostname', + 'backend_port', + 'backend_weight')); + + return $params; +} + +/** + * Existence confirmation of pgpool.pid + * + * @return bool + */ +function DoesPgpoolPidExist() { + $pidFile = readLogDir() . '/pgpool.pid'; + if( file_exists($pidFile) ) { + return true; + } + return false; +} + +/** + * Existence confirmation of pgpool.pid + * + * @return bool + */ +function readLogDir() { + + $params = readConfigParams(array('logdir')); + return $params['logdir']; +} + +/** + * Whether pgpool is operating in the replication mode or not? + * + * @return bool + */ +function isReplicationMode() { + + $params = readConfigParams(array('replication_mode')); + + if($params['replication_mode'] == 'true') { + return true; + } else { + return false; + } +} + +/** + * Whether pgpool is operating in the master slave mode or not? + * + * @return bool + */ +function isMasterSlaveMode() { + + $params = readConfigParams(array('master_slave_mode')); + + if($params['master_slave_mode'] == 'true') { + return true; + } else { + return false; + } +} + +/** + * Read parameters specified in $paramList from pgpool.conf. + * If $paramList is not specified, all item is read from pgpool.conf. + * + * @param array $paramList + * @return array + */ +function readConfigParams($paramList = FALSE) { + + $results = array(); + $configParam = array(); + + $configFile = @file(_PGPOOL2_CONFIG_FILE); + if($configFile == false) { + $errTpl = new Smarty(); + $errTpl->assign('message', $_SESSION[SESSION_MESSAGE]); + $errorCode = 'e4'; + $errTpl->assign('errorCode', $errorCode); + $errTpl->display('error.tpl'); + exit(); + } + + foreach ($configFile as $line_num => $line) { + $line = trim($line); + if(preg_match("/^\w/", $line)) { + list($key, $value) = split("=", $line); + + $key = trim($key); + $value = trim($value); + + if(preg_match("/^backend_hostname/", $key)) { + $num = str_replace('backend_hostname', '', $key); + $configParam['backend_hostname'][$num] = ereg_replace("'", "", $value); + } + else if(preg_match("/^backend_port/", $key)) { + $num = str_replace('backend_port', '', $key); + $configParam['backend_port'][$num] = $value; + } + else if(preg_match("/^backend_weight/", $key)) { + $num = str_replace('backend_weight', '', $key); + $configParam['backend_weight'][$num] = $value; + } + else { + $configParam[$key] = ereg_replace("'", "", $value); + } + } + } + + if(is_array($paramList)) { + foreach($paramList as $key) { + if(isset($configParam[$key])) { + $results[$key] = $configParam[$key]; + } else { + include('definePgpoolConfParam.php'); + if(!preg_match("/^backend_hostname/", $key) + && !preg_match("/^backend_port/", $key) + && !preg_match("/^backend_weight/", $key)) { + $results[$key] = $pgpoolConfigParam[$key]['default']; + } + } + } + } else { + $results = $configParam; + } + + return $results; + +} + +?> diff --git a/conf/pgmgt.conf.php b/conf/pgmgt.conf.php new file mode 100644 index 0000000..732e5cb --- /dev/null +++ b/conf/pgmgt.conf.php @@ -0,0 +1,15 @@ +<?php +define('_PGPOOL2_LANG', 'ja'); +define('_PGPOOL2_CONFIG_FILE', '/usr/local/etc/pgpool.conf'); +define('_PGPOOL2_PASSWORD_FILE', '/usr/local/etc/pcp.conf'); +define('_PGPOOL2_COMMAND', '/usr/local/bin/pgpool'); +define('_PGPOOL2_CMD_OPTION_C', '0'); +define('_PGPOOL2_CMD_OPTION_D', '0'); +define('_PGPOOL2_CMD_OPTION_M', 's'); +define('_PGPOOL2_CMD_OPTION_N', '0'); +define('_PGPOOL2_LOG_FILE', '/tmp/pgpool.log'); +define('_PGPOOL2_PCP_DIR', '/usr/local/bin'); +define('_PGPOOL2_PCP_HOSTNAME', 'localhost'); +define('_PGPOOL2_PCP_TIMEOUT', ''); +define('_PGPOOL2_STATUS_REFRESH_TIME', '0'); +?> diff --git a/config.php b/config.php new file mode 100644 index 0000000..6acd424 --- /dev/null +++ b/config.php @@ -0,0 +1,297 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Configuration of PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +if(isset($_POST['action'])) { + $action = $_POST['action']; +} else { + $action = FALSE; +} + +$errors = array(); +$params = array(); + +/** + * Read current parameter + */ +if( defined('_PGPOOL2_LANG')) + $params['lang'] = _PGPOOL2_LANG; +else + $errors['lang'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_CONFIG_FILE')) + $params['pgpool_config_file'] = _PGPOOL2_CONFIG_FILE; +else + $errors['pgpool_config_file'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_PASSWORD_FILE')) + $params['password_file'] = _PGPOOL2_PASSWORD_FILE; +else + $errors['password_file'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_COMMAND')) + $params['pgpool_command'] = _PGPOOL2_COMMAND; +else + $errors['pgpool_command'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_CMD_OPTION_C')) + $params['c'] = _PGPOOL2_CMD_OPTION_C; +else + $errors['c'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_CMD_OPTION_D')) + $params['d'] = _PGPOOL2_CMD_OPTION_D; +else + $errors['d'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_CMD_OPTION_M')) + $params['m'] = _PGPOOL2_CMD_OPTION_M; +else + $errors['m'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_CMD_OPTION_N')) + $params['n'] = _PGPOOL2_CMD_OPTION_N; +else + $errors['n'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_LOG_FILE')) + $params['pgpool_logfile'] = _PGPOOL2_LOG_FILE; +else + $errors['pgpool_logfile'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_PCP_DIR')) + $params['pcp_client_dir'] = _PGPOOL2_PCP_DIR; +else + $errors['pcp_client_dir'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_PCP_HOSTNAME')) + $params['pcp_hostname'] = _PGPOOL2_PCP_HOSTNAME; +else + $errors['pcp_hostname'] = $message['errNoDefined']; + +if( defined('_PGPOOL2_STATUS_REFRESH_TIME')) + $params['pcp_refresh_time'] = _PGPOOL2_STATUS_REFRESH_TIME; +else + $errors['pcp_refresh_time'] = $message['errNoDefined']; + +switch ( $action ) { + case 'update': + + $key = 'lang'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + + $key = 'pgpool_config_file'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if(!@is_file($params[$key])) { + $errors[$key] = $message['errFileNotFound']; + } + + $key = 'password_file'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if(!@is_file($params[$key])) { + $errors[$key] = $message['errFileNotFound']; + } + + $key = 'pgpool_command'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if(!is_executable($params[$key])) { + $errors[$key] = $message['errFileNotFound']; + } + + $key = 'c'; + if(isset($_POST[$key])) { + $params[$key] = 1; + } else { + $params[$key] = 0; + } + + $key = 'd'; + if(isset($_POST[$key])) { + $params[$key] = 1; + } else { + $params[$key] = 0; + } + + $key = 'm'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + + $key = 'n'; + if(isset($_POST[$key])) { + $params[$key] = 1; + } else { + $params[$key] = 0; + } + + $key = 'pgpool_logfile'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if($params[$key] != '' && !is_writable(dirname($params[$key]))) { + $errors[$key] = $message['errFileNotWritable']; + } + + $key = 'pcp_client_dir'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + + $key = 'pcp_hostname'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if(!ereg("^[0-9a-zA-Z\._\-]+$", $params[$key])) { + $errors[$key] = $message['errIllegalHostname']; + } + + $key = 'pcp_refresh_time'; + if(isset($_POST[$key])) { + $params[$key] = $_POST[$key]; + } else { + $errors[$key] = $message['errNoDefined']; + } + if( !is_numeric($params[$key] )) { + $errors[$key] = $message['errShouldBeInteger']; + } else { + if ( $params[$key] < 0) { + $errors[$key] = $message['errShouldBeZeroOrMore']; + } + } + + if( count($errors) == 0 ) { + + $pgmgtConfigFile = dirname(__FILE__) . '/conf/pgmgt.conf.php'; + + if( ! is_writable($pgmgtConfigFile)) { + $errorCode = 'e5003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + $fp = fopen( $pgmgtConfigFile, "w"); + if($fp == false) { + $errorCode = 'e5001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + $str = "<?php\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_LANG\', \'' . $params['lang'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CONFIG_FILE\', \'' . $params['pgpool_config_file'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PASSWORD_FILE\', \'' . $params['password_file'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_COMMAND\', \'' . $params['pgpool_command'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_C\', \'' . $params['c'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_D\', \'' . $params['d'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_M\', \'' . $params['m'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_N\', \'' . $params['n'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_LOG_FILE\', \'' . $params['pgpool_logfile'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PCP_DIR\', \'' . $params['pcp_client_dir'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PCP_HOSTNAME\', \'' . $params['pcp_hostname'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_STATUS_REFRESH_TIME\', \'' . $params['pcp_refresh_time'] . '\');' . "\n"; + fputs($fp, $str); + + $str = "?>\n"; + fputs($fp, $str); + fclose($fp); + + $tpl->assign('status', 'success'); + } + + /** + * reload message catalog + */ + $lang = selectLanguage($params['lang'], $messageList); + include('lang/' . $lang . '.lang.php'); + $tpl->assign('message', $message); + break; + + default: +} + +$tpl->assign('pgpoolConf', _PGPOOL2_CONFIG_FILE); +$tpl->assign('pcpConf', _PGPOOL2_PASSWORD_FILE); +$tpl->assign('params', $params); +$tpl->assign('errors', $errors); +$tpl->display('config.tpl'); + +?> diff --git a/definePgpoolConfParam.php b/definePgpoolConfParam.php new file mode 100644 index 0000000..400247c --- /dev/null +++ b/definePgpoolConfParam.php @@ -0,0 +1,235 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Definition of pgpool variable + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +$pgpoolConfigParam = array(); +$pgpoolConfigBackendParam = array(); + +$strreg = '^[0-9a-zA-Z_\-]+$'; +$dirreg = '^\/[0-9a-zA-Z\._\/\-]+$'; +$hostreg = "^[0-9a-zA-Z\._\-]*$"; + +$key = 'listen_addresses'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='localhost'; +$pgpoolConfigParam[$key]['regexp'] = '^([0-9a-zA-Z\._\-]+|[\*]{1})$'; + +$key = 'port'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='9999'; +$pgpoolConfigParam[$key]['max'] = 65355; +$pgpoolConfigParam[$key]['min'] = 1024; + +$key = 'socket_dir'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='/tmp'; +$pgpoolConfigParam[$key]['regexp'] = "$dirreg"; + +$key = 'backend_socket_dir'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='/tmp'; +$pgpoolConfigParam[$key]['regexp'] = "$dirreg"; + +$key = 'num_init_children'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='32'; +$pgpoolConfigParam[$key]['min'] = 1; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'max_pool'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='4'; +$pgpoolConfigParam[$key]['min'] = 1; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'child_life_time'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='300'; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'connection_life_time'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='0'; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'child_max_connections'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='0'; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'logdir'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='/tmp'; +$pgpoolConfigParam[$key]['regexp'] = "$dirreg"; + +$key = 'pcp_timeout'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] ='10'; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'replication_mode'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'replication_strict'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =true; + +$key = 'replication_timeout'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] =5000; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'load_balance_mode'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'replication_stop_on_mismatch'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'reset_query_list'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'; +$pgpoolConfigParam[$key]['regexp'] = "^[0-9a-zA-Z; ]+$"; + +$key = 'print_timestamp'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =true; + +$key = 'master_slave_mode'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'connection_cache'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =true; + +$key = 'health_check_timeout'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] =20; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'health_check_period'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] =0; +$pgpoolConfigParam[$key]['min'] = 0; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'health_check_user'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='nodoby'; +$pgpoolConfigParam[$key]['regexp'] = "^[0-9a-zA-Z_\.\-]+$"; + +$key = 'insert_lock'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'ignore_leading_white_space'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'parallel_mode'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'log_statement'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'enable_query_cache'; +$pgpoolConfigParam[$key]['type'] ='B'; +$pgpoolConfigParam[$key]['default'] =false; + +$key = 'system_db_hostname'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='system_db_hostname'; +$pgpoolConfigParam[$key]['regexp'] = $hostreg; + +$key = 'system_db_port'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] =5432; +$pgpoolConfigParam[$key]['min'] = 1024; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'system_db_dbname'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='pgpool'; +$pgpoolConfigParam[$key]['regexp'] = "$strreg"; + +$key = 'system_db_schema'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='pgpool_catalog'; +$pgpoolConfigParam[$key]['regexp'] = "$strreg"; + +$key = 'system_db_user'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='pgpool'; +$pgpoolConfigParam[$key]['regexp'] = "^[0-9a-zA-Z_\.\-]*$"; + +$key = 'system_db_password'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] =''; +$pgpoolConfigParam[$key]['regexp'] = ".*"; + +$key = 'pcp_port'; +$pgpoolConfigParam[$key]['type'] ='N'; +$pgpoolConfigParam[$key]['default'] =9898; +$pgpoolConfigParam[$key]['min'] = 1024; +$pgpoolConfigParam[$key]['max'] = 65355; + +$key = 'pcp_socket_dir'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] ='/tmp'; +$pgpoolConfigParam[$key]['regexp'] = "$dirreg"; + +$key = 'pgpool2_hostname'; +$pgpoolConfigParam[$key]['type'] ='C'; +$pgpoolConfigParam[$key]['default'] = 'localhost'; +$pgpoolConfigParam[$key]['regexp'] = $hostreg; + +$key = 'backend_hostname'; +$pgpoolConfigBackendParam[$key]['type'] ='C'; +$pgpoolConfigBackendParam[$key]['default'] =''; +$pgpoolConfigBackendParam[$key]['regexp'] = "^[0-9a-zA-Z\._\-]*$"; + +$key = 'backend_port'; +$pgpoolConfigBackendParam[$key]['type'] ='N'; +$pgpoolConfigBackendParam[$key]['default'] ='5432'; +$pgpoolConfigBackendParam[$key]['min'] = 1024; +$pgpoolConfigBackendParam[$key]['max'] = 65355; + +$key = 'backend_weight'; +$pgpoolConfigBackendParam[$key]['type'] ='F'; +$pgpoolConfigBackendParam[$key]['default'] ='1'; +$pgpoolConfigBackendParam[$key]['min'] = 0.0; +$pgpoolConfigBackendParam[$key]['max'] = 1.0; + +?>
\ No newline at end of file diff --git a/doc/en/changePassword.html b/doc/en/changePassword.html new file mode 100644 index 0000000..2d62670 --- /dev/null +++ b/doc/en/changePassword.html @@ -0,0 +1,62 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Change Password</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>Change Password</h2> + <h3>Summary</h3> + + The password of the user who is logging in the pgpool administration tool is changed. + <h3>Feature</h3> + Please input a new password to each input column twice and push the update button.<br /> + When it is successful, the login screen is displayed. Please login with the new password. + <table> + <tbody> + <tr> + + <th><label for="password">Password</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + <tr> + <th><label for="password2">Password Confirmation</label></th> + <td><input id="password2" name="password2" type="password" size="25" /></td> + </tr> + </tbody> + + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="ButtonName" value="Update" /> + </td></tr> + </table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/config.html b/doc/en/config.html new file mode 100644 index 0000000..4e396d4 --- /dev/null +++ b/doc/en/config.html @@ -0,0 +1,116 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpoolAdmin Setting</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>pgpoolAdmin Setting</h2> + <h3>Summary</h3> + + The setting of the pgpool administration tool can be displayed and be changed. + <p><img src="images/pgpooladmin.jpg" /></p> + <h3>Feature</h3> + <table> + <tbody> + <tr> + <th><label for="listen_addresses">Language</label> + (string)</th> + <td class="input">The language that wants to be displayed is selected. </td> + + </tr> + <tr> + <th><label for="pgconfigPath">pgpool.conf File</label> + (string)</th> + <td>Path to pgpool.conf is specified in the full path. </td></tr> + <tr> + <th><label for="PasswordFile">Password File</label> + + (string)</th> + <td>Path to pcp.conf is specified in the full path. </td></tr> + <tr> + <th colspan="2"><label>pgpool Command Option</label> + (string)</th></tr> + <tr><td>Clears query cache(-c)</td> + + <td>When starting pgpool, the query cache is cleared.</td> + </tr> + <tr><td>Don't run in daemon mode(-n)</td> + <td>Pgpool can be run in non-daemon mode. For display of pgpool log in this pool, it is necessary to turn on this item. </td> + </tr> + <tr><td>Debug mode(-d)</td> + + <td>Pgpool can be run in debug mode. When the debugging log is necessary, it turns it on.</td> + </tr> + <tr> + <tr><td>Stop mode(-d)</td> + <td>All the processes of pgpool are stopped. The pgpool stop option is displayed, when "Pgpool Stop" is pushed. There are stop mode for pgpool as follows. + <ul> + <li>smart</li> + <li>fast</li> + + <li>immediate</li> + </ul> + If pgpool is stopped, pgpool status in the status window become "pgpool stop" and start option for pgpool is displayed.</td> + </tr> + <tr><td>pgpool.conf(-f)</td> + <td>When pgpool starts, pgpool.conf must be specified. The path of pgpool.conf is specified in "pgpool.conf File".</td> + </tr> + + <tr><td>pcp.conf(-F)</td> + <td>When pgpool starts, pcp.conf must be specified. The path of pcp.conf is specified in "Password File".</td> + </tr> + <tr> + <th><label>pgpool Logfile</label> + (string)</th> + <td>The log file used when starting in non-daemon mode is specified by the full path form. If this is not specified, pgpool.log file is created in the directory specified in the logdir item of pgpool.conf.</td></tr> + + <tr> + <th><label for="PcpDir">PCP Directory</label> + (string)</th> + <td>The directory that has installed the PCP command is specified. </td></tr> + <tr> + <th><label for="PcpHostname">PCP Hostname</label> + (string)</th> + + <td>The host name that executes the PCP command is specified. It usually becomes "localhost".</td> + </tr> + <tr> + <th><label for="PcpRefreshTime">Refresh Time</label> + (integer) + </td> + <td>The update interval of status is specified every second. When 0 is specified, it doesn't update it automatically. </td></tr> + </tbody> + + </table> + <p>Finally, The update button is renewed pushing.</p> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/errorCode.html b/doc/en/errorCode.html new file mode 100644 index 0000000..4bfa249 --- /dev/null +++ b/doc/en/errorCode.html @@ -0,0 +1,180 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> +<h2>Error Code</h2> + +<h3>Common</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e1</label></th><td class="right_border">No found pgmgt.conf.php.</td><td>Please confirm whether the pgmgt.conf.php file is in the conf directory. Moreover, please confirm whether there is an appropriate right of access. </td></tr> + +<tr><th class="right_border"><label>e2</label></th><td class="right_border">No found message catalog.</td><td>Please confirm whether the message catalog file is in the lang directory. </td></tr> +<tr><th class="right_border"><label>e3</label></th><td class="right_border">PCP command error occurred.</td><td>Please confirm whether in the place that the Pcp command specified by a set </td></tr> +<tr><th class="right_border"><label>e4</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that the Pcp command specified by a set menu.</td></tr> +<tr><th class="right_border"><label>e5</label></th><td class="right_border">No found Smarty template file.</td><td>Please confirm whether the template file for the display is in the template directory. </td></tr> +<tr><th class="right_border"><label>e6</label></th><td class="right_border">No found help.</td><td>Please confirm whether the Help file is in template/help or less. </td></tr> + +<tr><th class="right_border"><label>e7</label></th><td class="right_border">No found Parameter in pgpmgt.conf.php</td><td>Please confirm whether the parameter to be specified to pgmgt.conf.php. </td></tr> +<tr><th class="right_border"><label>e8</label></th><td class="right_border">No found pcp_timeout in pgpool.conf</td><td>Please confirm whether pcp_timeout to be specified with pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e9</label></th><td class="right_border">No found pcp_port in pgpool.conf</td><td>Please confirm whether pcp_port to be specified with pgpool.conf. </td></tr> +</table> + +<h3>pgpool Status</h3> +<table> + + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e1001</label></th><td class="right_border">PCP command error occurred.</td><td>It is displayed when failing in the call of the pcp command. Please confirm whether in the place that the Pcp command specified by a set menu. </td></tr> + +<tr><th class="right_border"><label>e1002</label></th><td class="right_border">pcp_node_count command error occurred.</td><td>It is an execution of pcp_node_count error. Please confirm whether pcp_node_count can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1003</label></th><td class="right_border">pcp_node_info command error occurred.</td><td>It is an execution of pcp_node_info error. Please confirm whether pcp_node_infot can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1004</label></th><td class="right_border">pcp_proc_count command error occurred.</td><td>It is an execution of pcp_proc_count error. Please confirm whether pcp_proc_count can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1005</label></th><td class="right_border">pcp_proc_info command error occurred.</td><td>It is an execution of pcp_proc_info error. Please confirm whether pcp_proc_info can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1006</label></th><td class="right_border">pcp_stop_pgpool command error occurred.</td><td>It is an execution of pcp_stop_pgpool error. Please confirm whether pcp_stop_pgpool can be normally executed. </td></tr> + +<tr><th class="right_border"><label>e1007</label></th><td class="right_border">pcp_detach_node command error occurred.</td><td>It is an execution of pcp_detach_node error. Please confirm whether pcp_detach_node can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1008</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pgpool.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e1009</label></th><td class="right_border">No found pcp.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> +<tr><th class="right_border"><label>e1010</label></th><td class="right_border">pcp_attach_node command error occurred.</td><td>It is an execution of pcp_attach_node error. Please confirm whether pcp_detach_node can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1011</label></th><td class="right_border">No found log ifle.</td><td>Please confirm whether in the place that the pgpool log file specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to the specified log file. It is made for the directory specified with logdir of pgpool.conf by the file name of pgpool.log when not specifying it. </td></tr> + +</table> + +<h3>Node Status</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> + +<tr><th class="right_border"><label>e8001</label></th><td class="right_border">Detailed information cannot be acquired.</td><td>Please confirm whether to connect it with the node by the psql command. </td></tr> +</table> + +<h3>Query Cache</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e2001</label></th><td class="right_border">Database connection error occurred.</td><td>Please confirm whether to connect it with the data base specified with system DB of pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e2002</label></th><td class="right_border">The error occurred when SELECT was executed</td><td>Please confirm whether the record of Cericasshutabl can be normally acquired. </td></tr> +<tr><th class="right_border"><label>e2003</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> + +</table> + +<h3>Partitioning Rule</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> + +<tr><th class="right_border"><label>e3001</label></th><td class="right_border">Database connection error occurred.</td><td>Please confirm whether to connect it with the data base specified with system DB of pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e3002</label></th><td class="right_border">The SQL error occurred when SELECT was executed</td><td>Please confirm whether the record of system DB table can be normally acquired. </td></tr> +<tr><th class="right_border"><label>e3003</label></th><td class="right_border">The SQL error occurred when INSERT was executed</td><td>Please confirm whether the record can be normally inserted in system DB table. </td></tr> +<tr><th class="right_border"><label>e3004</label></th><td class="right_border">The SQL error occurred when UPDATE was executed</td><td>Please confirm whether the record of system DB table can be normally renewed. </td></tr> +<tr><th class="right_border"><label>e3005</label></th><td class="right_border">The SQL error occurred when DELETE was executed</td><td>Please confirm whether the record of system DB table can be normally deleted. </td></tr> + +<tr><th class="right_border"><label>e3006</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> + +</table> + +<h3>pgpool.conf Setting</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e4001</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> +<tr><th class="right_border"><label>e4002</label></th><td class="right_border">It is not possible to read to pgpool.conf. </td><td>Please confirm whether there is a reading right of access in pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e4003</label></th><td class="right_border">It is not possible to write to pgpool.conf. </td><td>Please confirm whether there is a writing right of access in pgpool.conf. </td></tr> + +<tr><th class="right_border"><label>e4004</label></th><td class="right_border">There is not required parameter in pgpool.conf</td><td>Please confirm whether there are all parameters in pgpool.conf. </td></tr> +</table> + +<h3>pgpoolAdmin Setting</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e5001</label></th><td class="right_border">No found pgmgt.conf.php.</td><td>Please confirm whether the pgmgt.conf.php file is in the conf directory. Moreover, please confirm whether there is an appropriate right of access. </td></tr> +<tr><th class="right_border"><label>e5002</label></th><td class="right_border">It is not possible to read to pgmgt.conf.php.</td><td>Please confirm whether there is a reading right of access in the pgmgt.conf.php file. </td></tr> +<tr><th class="right_border"><label>e5003</label></th><td class="right_border">It is not possible to write to pgmgt.conf.php.</td><td>Please confirm whether there is a writing right of access in the pgmgt.conf.php file. </td></tr> + +</table> + +<h3>Change Password</h3> +<table> + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> + +<tr><th class="right_border"><label>e6001</label></th><td class="right_border">No found pcp.conf</td><td>Please confirm whether in the place that pcp.conf specified by a set </td></tr> +<tr><th class="right_border"><label>e6002</label></th><td class="right_border">It is not possible to read to pcp.conf. </td><td>menu. </td></tr> +<tr><th class="right_border"><label>e6003</label></th><td class="right_border">It is not possible to write to pcp.conf. </td><td>Please confirm whether there is a reading right of access in the pcp.conf file. </td></tr> +</table> + +<h3>Logout</h3> +<table> + + <tr> + <th class="right_border"><label>Error Code</label></th> + <th class="right_border"><label>Error Message</label></th> + <th><label>Measures</label></th> + </tr> +<tr><th class="right_border"><label>e7001</label></th><td class="right_border">No found pcp.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. </td></tr> + +</table> + +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/images/1.jpg b/doc/en/images/1.jpg Binary files differnew file mode 100644 index 0000000..e691d02 --- /dev/null +++ b/doc/en/images/1.jpg diff --git a/doc/en/images/2.jpg b/doc/en/images/2.jpg Binary files differnew file mode 100644 index 0000000..601a88e --- /dev/null +++ b/doc/en/images/2.jpg diff --git a/doc/en/images/3.jpg b/doc/en/images/3.jpg Binary files differnew file mode 100644 index 0000000..d4f112d --- /dev/null +++ b/doc/en/images/3.jpg diff --git a/doc/en/images/4.jpg b/doc/en/images/4.jpg Binary files differnew file mode 100644 index 0000000..341770b --- /dev/null +++ b/doc/en/images/4.jpg diff --git a/doc/en/images/ng.gif b/doc/en/images/ng.gif Binary files differnew file mode 100644 index 0000000..b10aca7 --- /dev/null +++ b/doc/en/images/ng.gif diff --git a/doc/en/images/nodestatus.jpg b/doc/en/images/nodestatus.jpg Binary files differnew file mode 100644 index 0000000..ef57394 --- /dev/null +++ b/doc/en/images/nodestatus.jpg diff --git a/doc/en/images/ok.gif b/doc/en/images/ok.gif Binary files differnew file mode 100644 index 0000000..ee85496 --- /dev/null +++ b/doc/en/images/ok.gif diff --git a/doc/en/images/pgpooladmin.jpg b/doc/en/images/pgpooladmin.jpg Binary files differnew file mode 100644 index 0000000..88abe8e --- /dev/null +++ b/doc/en/images/pgpooladmin.jpg diff --git a/doc/en/images/restart.jpg b/doc/en/images/restart.jpg Binary files differnew file mode 100644 index 0000000..fd596db --- /dev/null +++ b/doc/en/images/restart.jpg diff --git a/doc/en/images/start.jpg b/doc/en/images/start.jpg Binary files differnew file mode 100644 index 0000000..5b1c477 --- /dev/null +++ b/doc/en/images/start.jpg diff --git a/doc/en/images/status.jpg b/doc/en/images/status.jpg Binary files differnew file mode 100644 index 0000000..601e009 --- /dev/null +++ b/doc/en/images/status.jpg diff --git a/doc/en/images/stop.jpg b/doc/en/images/stop.jpg Binary files differnew file mode 100644 index 0000000..b85aec1 --- /dev/null +++ b/doc/en/images/stop.jpg diff --git a/doc/en/install.html b/doc/en/install.html new file mode 100644 index 0000000..3251255 --- /dev/null +++ b/doc/en/install.html @@ -0,0 +1,424 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Installing Pgpool Management Tool</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + <h2>Installing Pgpool Administration Tool</h2> + <h3>Preface</h3> +Please confirm pgpool normally can be installed, and operates before starting the installation of the pgpool management tool. <p /> +The following software is at least installed in the server that operates pgpool when the pgpool management tool is installed, and it should be normally operating. + +<ul> + <li>HTTP Server(Apache)</li> + <li>PHP4.4.2 and higher</li> + <li>pgpool</li> +</ul> +Before starting the install, be sure to have: +<ul> + <li>Setup the HTTP, PHP and pgpool properly.</li> + <li>Turn cookie and JavaScript? support in your browser on.</li> +</ul> + <h3>Precondition</h3> +It explains on the assumption of being set it here as follows. +<p /> +<table> +<tr> +<th><label>Aapche document root directory</label></th> +<td>/var/www/html</td> +</tr> +<tr> +<th><label>Aapche process user</label></th> +<td>apache</td> +</tr> +<tr> +<th><label>pgpoolAdmin installation directory</label></th> +<td>/var/www/html/admin-tool</td> +</tr> +<tr> +<th><label>Pgpool command pass</label></th> +<td>/usr/local/bin/pgpool</td> +</tr> +<tr> +<th><label>pcp_attach_node command pass</label></th> +<td>/usr/local/bin/pcp_attach_node</td> +</tr> +<tr> +<th><label>pcp_detach_node command pass</label></th> +<td>/usr/local/bin/pcp_detach_node</td> +</tr> +<tr> +<th><label>pcp_node_count command pass</label></th> +<td>/usr/local/bin/pcp_node_count</td> +</tr> +<tr> +<th><label>pcp_node_info command pass</label></th> +<td>/usr/local/bin/pcp_node_info</td> +</tr> +<tr> +<th><label>pcp_proc_count command pass</label></th> +<td>/usr/local/bin/pcp_proc_count</td> +</tr> +<tr> +<th><label>pcp_proc_info command pass</label></th> +<td>/usr/local/bin/pcp_proc_info</td> +</tr> +<tr> +<th><label>pcp_stop_pgpool command pass</label></th> +<td>/usr/local/bin/pcp_stop_pgpool</td> +</tr> +<tr> +<th><label>pcp_systemdb_info command pass</label></th> +<td>/usr/local/bin/pcp_systemdb_info</td> +</tr> +<tr> +<th><label>pg_md5 command pass</label></th> +<td>/usr/local/bin/pg_md5</td> +</tr> +<tr> +<th><label>pgpool.conf file pass</label></th> +<td>/usr/local/etc/pgpool.conf</td> +</tr> +<tr> +<th><label>pcp.conf file pass</label></th> +<td>/usr/local/etc/pcp.conf</td> +</tr> +</table> + <h3>Install</h3> +It explains the installation of the management tool as follows. + <ol> + <li>To execute pgpool and the pcp tool set up from the Apach user, the right of access is set.</li> + <div id="cmd_window"><table> + <tr><td>cd /usr/local/bin</td></tr> + <tr><td>ls</td></tr> + </table> + </div> + It is confirmed that there is the following files. + <ul> + <li>pgpool</li> + <li>pcp_attach_node</li> + <li>pcp_detach_node</li> + <li>pcp_node_count</li> + <li>pcp_node_info</li> + <li>pcp_proc_count</li> + <li>pcp_proc_info</li> + <li>pcp_stop_pgpool</li> + <li>pcp_systemdb_info</li> + <li>pg_md5</li> + </ul> + <div id="cmd_window"><table> + <tr><td>chmod 755 /usr/local/bin/pgpool</td></tr> + <tr><td>chmod 755 /usr/local/bin/pcp_*</td></tr> + </table> + </div> + <li> +The login user is registered in the pcp.conf file.The turning md5 password is obtained. +<div id="cmd_window"><table> +<tr><td class="cmd_window">pg_md5 password_string</td></tr> +</table> +</div> +Next, the obtained character string write on pcp.conf as follows. +<p>username:md5 password</p> + </li> + <li> +Admin-tools.tar.gz that is the management tool program file is developed below the html directory of Apache. <br /> +<div id="cmd_window"><table> +<tr><td class="cmd_window">mv admin-tool.tar.gz /tmp</td></tr> +<tr><td class="cmd_window">cd /tmp</td></tr> +<tr><td class="cmd_window">tar xzf admin-tool.tar.gz</td></tr> +<tr><td class="cmd_window">mv admin-tool /var/www/html</td></tr> +<tr><td class="cmd_window">rm admin-tool.tar.gz</td></tr> +</table> +</div> + </li> + <li> +The file is confirmed. +<div id="cmd_window"><table> +<tr><td class="cmd_window">find /var/www/html/admin-tool -print</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/finish.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/defaultParameter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/setLang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/checkDirectory.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/Thumbs.db</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/ng.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/ok.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/index.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/checkParameter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang/ja.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang/en.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Smarty.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.counter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.escape.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.replace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_characters.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/block.textformat.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.spacify.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.date_format.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.regex_replace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.lower.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.debug_print_var.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.eval.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_image.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.nl2br.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.strip_tags.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/outputfilter.trimwhitespace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.assign_debug_info.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.strip.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/shared.make_timestamp.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_select_date.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.truncate.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/compiler.assign.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.capitalize.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.wordwrap.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.indent.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_checkboxes.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/shared.escape_special_chars.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.cycle.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.math.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.cat.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_select_time.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_options.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.fetch.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_paragraphs.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.config_load.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.popup_init.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.string_format.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_sentences.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_words.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.default.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.popup.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.upper.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_table.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.debug.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_radios.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.mailto.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_cache_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.display_debug_console.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.load_resource_plugin.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.is_trusted.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.is_secure.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.assemble_plugin_filepath.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_microtime.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.load_plugins.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.rmdir.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.smarty_include_php.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.process_compiled_include.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.run_insert_handler.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.process_cached_inserts.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_compiled_include.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.rm_auto.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_include_path.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_compiled_resource.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_php_resource.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.read_cache_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.create_dir_structure.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.assign_smarty_interface.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Smarty_Compiler.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/debug.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Config_File.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/nodeServerStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/login.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/innerSystemCatalog.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/definePgpoolConfParam.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/systemDb.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/setLang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/queryCache.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/pgconfig.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/common.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/status.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/config.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/command.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pgmgtNotFound.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pleaseInstall.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/nodeStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/procInfo.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerSystemCatalog.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/footer.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerError.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerNodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/menu.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/error.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/screen.css</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/conf</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/conf/pgmgt.conf.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/innerNodeServerStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/changePassword.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/question.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/background.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/descending.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/ascending.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/elephant.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/Thumbs.db</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/spacer.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/logo.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/back.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/marker.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/seaen.jpg</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/turtle.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/index.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates_c</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang/ja.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang/en.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/procInfo.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/nodeStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/help.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/logout.php</td></tr> +</table> +<li> +It accesses install/phpinfo.php from Web a browser. It is confirmed that the function of php_mstring and php_pgsql is effective. +<ul> +<li>"Multibyte Support" is "enabled". </li> +<li>"PostgreSQL Support" is "enabled".</li> +</ul> +<p>Please confirm the setting of PHP again when these items are not "enabled".</p> +</li> +</li> +<li> +The writing right of access is set to the "templates_c" directory in the progressing directory and the "conf/pgmgt.conf.php" file. + +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /var/www/html/admin-tool</td></tr> +<tr><td class="cmd_window">chmod 777 templates_c</td></tr> +</table> +</div> + </li> + <li> +The writing authority to pgmgt.conf.php is set to apache process user. +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /var/www/html/admin-tool/conf</td></tr> +<tr><td class="cmd_window">chown apache pgmgt.conf.php</td></tr> +<tr><td class="cmd_window">chmod 644 pgmgt.conf.php</td></tr> +</table> +</div> + </li> + <li> +The writing right is set to the pgpool.conf file and the pcp.conf file that is the configuration file of pgpool. +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /usr/local/etc</td></tr> +<tr><td class="cmd_window">chown apache pgpool.conf</td></tr> +<tr><td class="cmd_window">chmod 644 pgpool.conf</td></tr> +<tr><td class="cmd_window">chown apache pcp.conf</td></tr> +<tr><td class="cmd_window">chmod 644 pcp.conf</td></tr> +</table> +</div> + </li> + <li> + The Multi byte and the PostgreSQL library is confirmed. Following URL is accessed from a browser. + <p>http://ServerName/admin-tool/install/phpinfo.php</p> + It is confirmed that the set up information of PHP is displayed. + Whether Multibyte Support and PostgreSQL Support are enabled is confirmed to them. Please confirm the setting of PHP again when not becoming it. + </li> + <li> +It accesses the installer. URL is as follows. +<p>http://ServerName/admin-tool/install/index.php</p> + </li> + <li> +The display language is selected. +<p><img src="images/1.jpg"></p> + </li> + <li> +The right of access of the directory is confirmed. When <img src="images/ok.gif"> is displayed right, it is appropriately set. Please click "Next" button. +Please it is not appropriately set when <img src="images/ng.gif"> is displayed, and confirm the error message, correct, and push "Check" button. +<p><img src="images/2.jpg"></p> + </li> + <li> +The management tool is set. When <img src="images/ok.gif"> is displayed right, it is appropriately set. Please click "Next" button. +Please it is not appropriately set when <img src="images/ng.gif"> is displayed, and confirm the error message, correct, and push "Check" button. +<p> + <dl> + <dt>pgpool.conf</dt> + <dd>The full path of the pgpool.conf file is specified. </dd> + <dt>Password File</dt> + <dd>The full path of the pcp.conf file is specified. </dd> + <dt>pgpool Command</dt> + <dd>The full path of the pgpool command file is specified. </dd> + <dt>PCP Directory</dt> + <dd>The full path of the directory that the PCP command group has installed is specified. </dd> + <dt>PCP Hostname</dt> + <dd>The host name that has installed the PCP command is specified. </dd> + <dt>Refresh Time</dt> + <dd>The interval when the status of pgpool is updated automatically is set every second. It doesn't update it automatically in case of 0. </dd> + </dl> +</p> +<p><img src="images/3.jpg"></p> + </li> + <li> +The installation of the management tool finished. At last, The "install" directory is deleted. +<p><img src="images/4.jpg"></p> +<div id="cmd_window"><table> +<tr><td class="cmd_window">rm -Rf /var/www/html/admin-tool/install</td></tr> +</table> +</div> + </li> + </ol> +<h3>Display of login screen</h3> +When "top" is clicked on the installation completion screen, the login screen of the management tool is displayed. The username and the password set according to installation procedure 2 are input and it logs it in. +</div> +<div id="footer"> +<address> +Version 1.0 Alpha<br /> +Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. +</address> +</div> +</body> +</html>
\ No newline at end of file diff --git a/doc/en/login.html b/doc/en/login.html new file mode 100644 index 0000000..e277740 --- /dev/null +++ b/doc/en/login.html @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Login</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>Login</h2> + <h3>Summary</h3> + <p>It is a login screen. Please input the user-name and the password set to pcp.conf.<br /> + When the attestation succeeds, the status screen is displayed. The login screen is displayed again when failing. + + <h3>Feature</h3> + + <form action="login.php" method="post" name="Login"> + <table> + <tbody> + <tr> + <th><label>Login Name</label></th> + <td><input id="username" name="username" type="text" size="25" /> + Please input the user-name here. </td> + </tr> + + <tr> + <th><label>Password</label></th> + <td><input id="password" name="password" type="password" size="25" /> + Please input the password here. </td> + </tr> + </tbody> + <tfoot> + <tr> + + <td colspan="2"><input type="submit" name="Button2" value="Login" /> + Please push the button when you input the user-name and the password. </td> + </tr> + </tfoot> + </table> + </form> +</div> +</body><div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/logout.html b/doc/en/logout.html new file mode 100644 index 0000000..0f2a528 --- /dev/null +++ b/doc/en/logout.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Logout</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>Logout</h2> + <h3>Summary</h3> + <p> This menu is displayed, if login is succeed. + <h3>Feature</h3> + If logout is clicked, it logs out and the login screen is displayed. +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/en/nodeServerStatus.html b/doc/en/nodeServerStatus.html new file mode 100644 index 0000000..ea907a5 --- /dev/null +++ b/doc/en/nodeServerStatus.html @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Node Satsus</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + +<h2>Node Status</h2> +<h3>Summary</h3> +On the node status screen, +<ul><li>IP Address</li> + <li>Port</li> + <li>Status</li> + <li>Detail</li> + </ul> +<p>can be acquired for each nodes.</p> +<p><img src="images/nodestatus.jpg" /></p> +<h3>Feature</h3> +<table> + <tr> + <th class="right_border"><label>IP Address</label></th> + <td>The IP address of the node.</td> + </tr> + <tr> + <th class="right_border"><label>Port</label></th> + + <td>The port number that the postmaster runs on.</td> + </tr> + <tr> + <th class="right_border"><label>Status</label></th> + <td>It is displayed whether postmaster is operating.</td> + </tr> + <tr> + + <th class="right_border"><label>Detail</label></th> + <td>When the postmaster runs on, it will be displayed.<br /> +Pg_settings information is displayed for PostgreSQL, and pool_status is displayed for pgpool. + </td> + </tr> + +</table> + </td> + </tr> +</div> + +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/pgconfig.html b/doc/en/pgconfig.html new file mode 100644 index 0000000..6bb98ad --- /dev/null +++ b/doc/en/pgconfig.html @@ -0,0 +1,453 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool Setting</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + <h2>pgpool Setting</h2> + <h3>Summary</h3> + + The content of pgpool.conf that is the configuration file of pgpool set can be displayed and be changed. + <h3>Feature</h3> + Please input the value that wants to change and push the update button. + <h3>Addition of A backend host</h3> + Please push the add button when you want to add a new back end host. <br /> + It inputs in back end host's item and a new input column can be done, and input information on a new back end host there, please.<br /> + Please push the update button when input ends. + <h3>Deletion of backend host</h3> + + Please push the delete button at the right of the host setting when you want to delete the back end host who has registered. <br /> + <div id="submenu"> + <h3>Table of Contents</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#pcp">PCP</a></li> + + <li><a href="#logging">Logging</a></li> + <li><a href="#replication">Replication</a></li> + <li><a href="#health-check">Health Check</a></li> + <li><a href="#system-database">System Database</a></li> + <li><a href="#others">Others</a></li> + </ul> + + </div> + <h3><a name="connections">Connections</a></h3> + <table> + <thead> + <tr> + <th>Parameter</th> + <th>Detail</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>Specifies the addresses to listen on for TCP/IP connections</label> + <br>listen_addresses (string)</th> + <td> +Specifies the addresses to listen on for TCP/IP connections. Set to '*' for all configured IP interfaces, '' for no TCP/IP connections, or else to a specific IP address or host name. The default is 'localhost'. Note that connections via UNIX domain sockets are always allowed. + </td> + + </tr> + <tr> + <th><label>The port number where pgpool is running on</label> + <br>port (integer)</th> + <td>The port number where pgpool is running on. Default value is 9999.</td> + </tr> + <tr> + + <th><label>The socket directory pgpool could connect</label> + <br>socket_dir (string)</th> + <td>The directory of unix domain socket for PostgreSQL server. Default value is '/tmp'.</td> + </tr> + <tr> + <th><label>Number of pgpool process initially forked</label> + <br>num_init_children (integer)</th> + + <td>Number of pgpool process initially forked. Default value is 32.</td> + </tr> + <tr> + <th><label>Number of connection pools each pgpool server process are keeping</label> + <br>max_pool (integer)</th> + <td> +Number of connection pools each pgpool server process are keeping. pgpool will make a new connection if there's no user name and database name pair yet. Thus it is recommended that max_pool exceeds the number of such that possible pairs. If it exceeds, the oldest connection is discarded and the new connection uses the slot. The default value is 4. + </td> + + </tr> + <tr> + <th><label>Life of a idle child process in seconds</label> + <br>child_life_time (integer)</th> + <td>Life of a idle child process in seconds. This will prevent unwanted memory leaks or other problems. Default is 300. Set it to 0 disables this feature.</td> + </tr> + <tr> + + <th><label>Life time for each idle connection in seconds</label> + <br>connection_life_time (integer)</th> + <td>Life time for each idle connection in seconds. 0 means the life time is forever. The default value is 0.</td> + <tr> + <th><label>If child_max_connections connections were received, child exits</label> + <br>child_max_connections (integer)</th> + + <td> If child_max_connections connections were received, child exits. 0 means no exit. The default value is 0.</td> + </tr> + <tr> + <th><label>If true, cache connections to PostgreSQL</label> + <br>connection_cache</th> + <td>If true, cache connections to PostgreSQL. Default value is true.</td> + + </tr> + <tr> + <th><label>Pgpool2 server name where running on</label> + <br>pgpool2_hostname (string)</th> + <td>The host name that pgpool2 runs is specified.</td> + </tr> + </tbody> + <tfoot> + + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="backends">Backends</a></h3> + <table> + <thead> + + <tr> + <th>Parameter</th> + <th>Detail</th> + <td></td> + </tr> + </thead> + <tbody> + <tr> + + <th><label>The socket directory PostgreSQL could connect</label> + <br>backend_socket_dir (string)</th> + <td>The directory of unix domain socket for PostgreSQL server. Default value is '/tmp'.</td> + </tr> + <tr> + <th><label>The real PostgreSQL server name pgpool could connect</label><br />backend_hostname (string)</th> + + <td>The host name that PostgreSQL runs is specified.</td> + </tr> + <tr> + <th><label>The port number where real PostgreSQL server is running on</label><br />backend_port (integer)</th> + <td>It is a port number that postmaster is running.</td> + </tr> + <tr> + <th><label>Load balance weight when pgpool is running in the state of load balance mode</label><br />backend_weight (integer)</th> + + <td>The weight at the load balance mode is set by the value from 0 to 1. Relative weight is calculated and distributed from the value specified with all the back end servers. </td> + </tr> + </tbody> + </table> + <h3><a name="pcp">PCP (pgpool Control Port)</a></h3> + <table> + <thead> + <tr> + + <th>Parameter</th> + <th>Detail</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>The port number where pcp is running on</label> + + <br>pcp_port (integer)</th> + <td>It is a port number to connect it with PCP. Default is 9898.</td> + </tr> + <tr> + <th><label>The socket directory pcp could connect</label> + <br>pcp_socket_dir (string)</th> + <td>The directory of unix domain socket for PCP. Default value is '/tmp'.</td> + + </tr> + <tr> + <th><label>When there is no response in this time from client, it disconnect and stop</label> + <br>pcp_timeout (integer)</th> + <td>The time-out of the PCP command is set. The connection disconnect when there will not be response in this time. </td> + </tr> + </tbody> + <tfoot> + + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="logging">Logging</a></h3> + <table> + <thead> + + <tr> + <th>Parameter</th> + <th>Detail</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>The directory name to store pgpool's log files</label> + + <br>logdir (string)</th> + <td>The directory name to store pgpool's log files. Currently only a file named pgpool.pid(has pgpool's process id) is stored. The default value for logdir is '/tmp'.</td> + </tr> + <tr> + <th><label>If true timestamp is added to each log line</label> + <br>print_timestamp</th> + <td>If true timestamp is added to each log line. Default value is true.</td> + + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="replication">Replication</a></h3> + + <table> + <thead> + <tr> + <th>Parameter</th> + <th>Detail</th> + </tr> + </thead> + <tbody> + + <tr> + <th><label>Set this true if you are going to use replication functionality</label> + <br>replication_mode</th> + <td>Set this true if you are going to use replication functionality. Default is false.</td> + </tr> + <tr> + <th><label>If true, pgpool will wait for the completion of the master query before sending a query to the secondary server</label> + + <br>replication_strict</th> + <td>If true, pgpool will wait for the completion of the master query before sending a query to the secondary server. This is the safest and default operating mode for pgpool. Default is true. +</td> + </tr> + <tr> + <th><label>In non strict replication mode, there will be a chance of deadlock</label> + <br>replication_timeout (integer)</th> + <td>In non strict replication mode, there will be a chance of deadlock. pgpool will abort the session if master or secondary does not respond within this milli seconds. if set to 0, timeout is disabled.</td> + + </tr> + <tr> + <th><label>Stop replication mode on data mismatch between master and secondary</label> + <br>replication_stop_on_mismatch</th> + <td>Stop replication mode on data mismatch between master and secondary. Default is false.</td> + </tr> + <tr> + + <th><label>Semicolon separated SQL commands to be issued at the end of session</label> + <br>reset_query_list (string)</th> + <td>SQL command to initialize the connection when the session ends is delimited by ";".</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + + </tr> + </tfoot> + </table> + <h3><a name="health-check">Health Check</a></h3> + <table> + <thead> + <tr> + <th>Parameter</th> + + <th>Detail</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>Pgpool does "health check" periodically to detect PostgreSQL servers down, network communication problems or as such</label> + + <br>health_check_timeout (integer)</th> + <td>pgpool does "health check" periodically to detect PostgreSQL servers down, network communication problems or as such. If something is going wrong, pgpool will automatically run into fail over or degeneration mode.</td> + </tr> + <tr> + <th><label>Specifies the interval for next health checking. 0 means no health checking</label> + <br>health_check_period (integer)</th> + <td>Specifies the interval for next health checking. 0 means no health checking. The default is 0(i.e. no health checking).</td> + + </tr> + <tr> + <th><label>PostgreSQL user name for the health checking</label> + <br>health_check_user (string)</th> + <td>PostgreSQL user name for the health checking.</td> + </tr> + </tbody> + + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="system-database">System Database</a></h3> + <table> + + <thead> + <tr> + <th>Parameter</th> + <th>Detail</th> + </tr> + </thead> + <tbody> + <tr> + + <th><label>The server name system database running on</label> + <br>system_db_hostname (string)</th> + <td>The host name that system DB is operating is specified. It connects with Unix domain socket when not specifying it. </td> + </tr> + <tr> + <th><label>The port number system database could connect</label> + <br>system_db_port (integer)</th> + + <td>The port number to connect system DB is specified.</td> + </tr> + <tr> + <th><label>The database name of system database</label> + <br>system_db_dbname (string)</th> + <td>The data base name of system DB is specified. </td> + </tr> + <tr> + <th><label>The schema name of system database</label> + <br>system_db_schema (string)</th> + <td>The schema name of system DB is specified. </td> + </tr> + <tr> + <th><label>The username when connection system database</label> + <br>system_db_user (string)</th> + <td>The username connected with system DB is specified.</td> + </tr> + <tr> + <th><label>The password of system database who connects system database</label> + <br>system_db_password (string)</th> + <td>The password connected with system DB is specified.</td> + </tr> + </tbody> + + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="others">Others</a></h3> + <table> + + <thead> + <tr> + <th>Parameter</th> + <th>Detail</th> + </tr> + </thead> + <tbody> + <tr> + + <th><label>Perform load balancing for SELECT</label> + <br>load_balance_mode</th> + <td>Perform load balancing for SELECT. Default is false.</td> + </tr> + <tr> + <th><label>Run in master/slave mode</label> + <br>master_slave_mode</th> + + <td>Run in master/slave mode. See 14 for more details. Default value is false. This mode is not compatible with replication_mode.</td> + </tr> + <tr> + <th><label> If you replicate a table having SERIAL data type column, sometimes the serial value does not match between servers</label> + <br>insert_lock</th> + <td> +If you replicate a table having SERIAL data type column, sometimes the serial value does not match between servers. You can avoid the problem by using a table lock (with a performance penalty due to +less currency in transactions). For this you need to rewrite you query: + +<p> +INSERT INTO .... +</p> +<p> +to: +</p> +<p> +BEGIN;<br /> +LOCK TABLE ...<br /> +INSERT INTO ...<br /> +COMMIT; +</p> +<p> +This is painfull. If you turn on insert_lock, pgpool will +automatically do the rewriting for you. + +</p> + </td> + </tr> + <tr> + <th><label>If true, ignore leading white spaces of each query while pgpool judges if the query is a SELECT so that it can be load balanced</label> + <br>ignore_leading_white_space</th> + <td>If true, ignore leading white spaces of each query while pgpool judges if the query is a SELECT so that it can be load balanced. This is usefull for certain APIs such as DBI/DBD which is + know as adding an extra leading white space.</td> + </tr> + + <tr> + <th><label>Run in parallel mode</label> + <br>parallel_mode</th> + <td>When pgpool runs on parallel mode, true is specified. It is necessary to specify a partitioning rule in this case.</td> + </tr> + <tr> + <th><label>If true, print all statements to the log</label> + + <br>log_statement</th> + <td>If true, print all statements to the log. Like the log_statement option to PostgreSQL, this allows for observing queries without engaging in full debugging.</td> + </tr> + <tr> + <th><label>Perform query cache</label> + <br>enable_query_cache</th> + <td>When the result of SELECT is cached, it makes it to true.</td> + + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> +</div> + +<hr class="hidden" /> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/queryCache.html b/doc/en/queryCache.html new file mode 100644 index 0000000..4374cd7 --- /dev/null +++ b/doc/en/queryCache.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Query Cache</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>Query Cache</h2> + <form action="queryCache.php" method="post" name="queryCache" id="queryCache"> + <h3>Summary</h3> + + <p>It is possible to cache the SELECT query, if enable_query_cache of pgpool.conf is true.</p> + <h3>Feature</h3> + <p>It is possible to search for the data that exists in the query cache. It searches for the query string and the database name, and it processes it by the partial agreement retrieval. It becomes a search for the logical product with the query string and the database name. + <table> + <tbody> + <tr> <tr> + <td nowrap="nowrap" class="column">Query</td> + + <td><input name="qQueryStr" type="text" id="qQueryStr" size="50" value=""/> + </td> + </tr> + <tr> + <td nowrap="nowrap" class="column">Database</td> + <td><input name="qDb" type="text" id="qDb" size="50" value=""/></td> + </tr> + </tbody> + + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="search" value="Search" /> + <input type="submit" name="clear" value="Clear" /> + </td></tr> + </table> + <h3>Query cache list</h3> + <p> + +The query string, database name and create time which existing in cache is displayed. When "Query", "Database" and "Create Time" clicked, the records is sorted. Whenever clicking, it is sorted in the ascending order or the descending order. </p> + + <p>When the check is put in the check box in the left of the data that wants to be deleted, and the deletion button is pushed, it is deleted. +</p> + <table> + <tbody> + <tr> + <th><input type="checkbox" name="all" value="" /></th> + <th>Query</th> + + <th>Database</th> + <th>Create Time</th> + </tr> + </tbody> + <tfoot> + <tr><td colspan="4"> + <input type="submit" name="ButtonName" value="Delete" /> + </td></tr> + + </table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</html> diff --git a/doc/en/status.html b/doc/en/status.html new file mode 100644 index 0000000..61cfe8e --- /dev/null +++ b/doc/en/status.html @@ -0,0 +1,135 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool Status</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + +<h2>pgpool Status</h2> + <h3>Summary</h3> +On the status screen, it is possible to display it for pgpool as follows, +<ul><li>Summary</li> + <li>Process Information</li> + <li>Node Information</li> + <li>Log</li> +</ul> +and operate it. +<ul> + <li>Start</li> + <li>Stop</li> + <li>Restart</li> +</ul> + <h3>Feature</h3> + <p><img src="images/status.jpg" /></p> +<table> + <tr> + <th class="right_border"><label>Summary</label></th> + <td>The content of pgpool.conf is displayed.</td> + </tr> + <tr> + <th class="right_border"><label>Process Information</label></th> + <td><p>In each process for pgpool,</p> + <ul> + <li>Process ID</li> + <li>Database Name</li> + <li>Username</li> + <li>Process start time</li> + <li>Connection create time</li> + <li>Protocol major version</li> + <li>Protocol miner version</li> + <li>Use of connection</li> + </ul> + <p>will be shown.<br /> + In each process, it will be displayed only the number of max_pool in pgpool.conf in the maximum. + </p></td> + </tr> + <tr> + <th class="right_border"><label>Node Information</label></th> + <td><p>In each node,</p> + <ul> + <li>IP address</li> + <li>Port number</li> + <li>Status</li> + <li>Weight</li> + <li>Disconnect button</li> + </ul> + <p>will be shown. But, the button for disconnection will not be shown when pgpool is running on parallel mode.</p> + <p>In the status,</p> + <ul> + <li>Up. Disconnect</li> + <li>Up. Connected</li> + <li>Down</li> + </ul> + <p>the three states will be shown.</p></td> + </tr> + <tr> + <th class="right_border"><label>Log</label></th> + <td>It is possible to display about log of pgpool when pgpool doesn't run in daemon mode(-n).</td> + </tr> + <tr> + <th class="right_border"><label>Start</label></th> + <td>It is possible to start pgpool when it is stopped. The start option of pgpool + <ul> + <li>Clears query cache(-c)</li> + <li>don't run in daemon mode(-n)</li> + <li>stop mode(-m)</li> + <li>pgpool.conf(-f)</li> + <li>pcp.conf(-F)</li> + </ul> + can be specified. + <p><img src="images/start.jpg" /></p> + </td> + </tr> + <tr> + <tr> + <th class="right_border"><label>Stop</label></th> + <td>All the processes of pgpool are stopped. The pgpool stop option is displayed, when "pgpool Stop" is pushed. There are stop mode for pgpool as follows. + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + If pgpool is stopped, pgpool status in the status window becomes "pgpool stop" and the start option for pgpool is displayed. + <p><img src="images/stop.jpg" /></p> + </td> + </tr> + <tr> + <th class="right_border"><label>Restart</label></th> + <td>First, all the processes of pgpool are stopped and then pgpool start process is executed. Both the start and the stop of the abovementioned items can be specified. + <p><img src="images/restart.jpg" /></p> + </td> + </tr> +</table> + +<table> +</table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/en/systemDb.html b/doc/en/systemDb.html new file mode 100644 index 0000000..af0c03a --- /dev/null +++ b/doc/en/systemDb.html @@ -0,0 +1,101 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Partitioning Rule</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_en.html">Introduction</a></li> + <li><a href="install.html">Install</a></li> + <li><a href="login.html">Login</a></li> + <li><a href="status.html">pgpool Status</a></li> + <li><a href="nodeServerStatus.html">Node Status</a></li> + <li><a href="queryCache.html">Query Cache</a></li> + <li><a href="systemDb.html">Partitioning Rule</a></li> + <li><a href="pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="config.html">pgpoolAdmin Setting</a></li> + <li><a href="changePassword.html">Change Password</a></li> + <li><a href="logout.html">Logout</a></li> + <li><a href="errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + + <h2>Partitioning Rule</h2> + <h3>Summary</h3> + +The setting of a parallel query is defined for parallel_mode=true in pgpool.conf. + <h3>Feature</h3> +The data type of each column is as follows. <p /> +<table> + <tr> + <th class="right_border"><label>Column Name</label></th> + <th class="right_border"><label>Data Type</label></th> + <th><label>Description</label></th> + + </tr> + <tr> + <th class="right_border"><label>Database Name</label></th> + <td class="right_border">TEXT</td> + <td>Distributed database name</td> + </tr> + <tr> + + <th class="right_border"><label>Schema Name</label></th> + <td class="right_border">TEXT</td> + <td>Schema name of database</td> + </tr> + + <tr> + <th class="right_border"><label>Table</label></th> + <td class="right_border">TEXT</td> + <td>Distributed table name</td> + </tr> + + <tr> + <th class="right_border"><label>Column Name of Distributed key</label></th> + <td class="right_border">TEXT</td> + <td>Column Name of Distributed key</td> + </tr> + + <tr> + <th class="right_border"><label>Column List</label></th> + <td class="right_border">TEXT[]</td> + <td>List of row name of table that distributes data</td> + </tr> + <tr> + <th class="right_border"><label>Type List of Column</label></th> + + <td class="right_border">TEXT[]</td> + <td>List of type of row name</td> + </tr> + <tr> + <th class="right_border"><label>Distributed Function Name</label></th> + <td class="right_border">TEXT</td> + <td>Function name that defines partitioning rule</td> + + </tr> +</table> +<p /> +<h3>Add</h3> +The value is input to all columns and "Add" button is pushed. <br /> +Please enclose each element with a single quotation, and delimit each element by the comma about the column list and the type list of column. + +<h3>Update</h3> +Please click the data base name of the definition that wants to be updated. Please the value must be displayed in the input field and correct and push "Update" button. However, neither the data base name, the schema name nor the table name are revocable. +<h3>Delete</h3> +Please click the data base name of the definition that wants to be deleted. Please push "Delete" button. The confirmation dialog is displayed and push the "OK" button, please. +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address></div> +</body> +</html> diff --git a/doc/images/background.gif b/doc/images/background.gif Binary files differnew file mode 100644 index 0000000..ed77230 --- /dev/null +++ b/doc/images/background.gif diff --git a/doc/images/logo.gif b/doc/images/logo.gif Binary files differnew file mode 100644 index 0000000..4d63d04 --- /dev/null +++ b/doc/images/logo.gif diff --git a/doc/images/marker.gif b/doc/images/marker.gif Binary files differnew file mode 100644 index 0000000..3ffe323 --- /dev/null +++ b/doc/images/marker.gif diff --git a/doc/images/sea.jpg b/doc/images/sea.jpg Binary files differnew file mode 100644 index 0000000..b78332f --- /dev/null +++ b/doc/images/sea.jpg diff --git a/doc/images/spacer.gif b/doc/images/spacer.gif Binary files differnew file mode 100644 index 0000000..fc25609 --- /dev/null +++ b/doc/images/spacer.gif diff --git a/doc/index_en.html b/doc/index_en.html new file mode 100644 index 0000000..6198545 --- /dev/null +++ b/doc/index_en.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool Administration Tool</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="#">Introduction</a></li> + <li><a href="en/install.html">Install</a></li> + <li><a href="en/login.html">Login</a></li> + <li><a href="en/status.html">pgpool Status</a></li> + <li><a href="en/nodeServerStatus.html">Node Status</a></li> + <li><a href="en/queryCache.html">Query Cache</a></li> + <li><a href="en/systemDb.html">Partitioning Rule</a></li> + <li><a href="en/pgconfig.html">pgpool.conf Setting</a></li> + <li><a href="en/config.html">pgpoolAdmin Setting</a></li> + <li><a href="en/changePassword.html">Change Password</a></li> + <li><a href="en/logout.html">Logout</a></li> + <li><a href="en/errorCode.html">Error Code</a></li> + </ul> +</div> +<div id="content"> + <h2>Introduction</h2> + The pgpool Administration Tool is management tool of pgpool. It is possible to monitor, start, stop pgpool and change setting for pgpool. + <h3>Screen</h3> + The menu is displayed left and the function in each menu is displayed right on Screen of pgpoolAdmin. + <p><img src="en/images/status.jpg"/></p> + After login, the following menus are displayed. + <ul> + <li>pgpool Status</li> + <li>Node Status</li> + <li>Query Cache</li> + <li>Partitioning Rule</li> + <li>pgpool.conf Setting</li> + <li>pgpoolAdmin Setting</li> + <li>Change Password</li> + <li>Logout</li> + </ul> + <p> + There is a help button on the right of the screen. Help can be displayed by clicking it. +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/index_ja.html b/doc/index_ja.html new file mode 100644 index 0000000..1747709 --- /dev/null +++ b/doc/index_ja.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool Administration Tool</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="#">はじめに</a></li> + <li><a href="ja/install.html">インストール</a></li> + <li><a href="ja/login.html">ログイン</a></li> + <li><a href="ja/status.html">pgpoolステータス</a></li> + <li><a href="ja/nodeServerStatus.html">ノードステータス</a></li> + <li><a href="ja/queryCache.html">クエリキャッシュ</a></li> + <li><a href="ja/systemDb.html">分散ルール</a></li> + <li><a href="ja/pgconfig.html">pgpool.conf設定</a></li> + <li><a href="ja/config.html">管理ツール設定</a></li> + <li><a href="ja/changePassword.html">パスワード変更</a></li> + <li><a href="ja/logout.html">ログアウト</a></li> + <li><a href="ja/errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + <h2>はじめに</h2> + pgpool Administration Toolはpgpoolの管理をするためのツールです。GUIベースで、pgpoolの状態監視や起動・停止、pgpool.confの設定を行うことができます。 + <h3>画面構成</h3> + pgpoolAdminの画面は、左側にメニューが表示され、右側に各メニューでの機能が表示されます。 + <p><img src="ja/images/status.jpg"/></p> + ログイン後に表示されるメニューは + <ul> + <li>pgpoolステータス</li> + <li>ノードステータス</li> + <li>クエリキャッシュ</li> + <li>分散ルール</li> + <li>pgpool.conf設定</li> + <li>管理ツール設定</li> + <li>パスワード変更</li> + <li>ログアウト</li> + </ul> + になります。<p> + 画面右上にはヘルプボタンがあります。ヘルプボタンを押すと開いている機能でのヘルプを表示することができます。 +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/changePassword.html b/doc/ja/changePassword.html new file mode 100644 index 0000000..18cb4d4 --- /dev/null +++ b/doc/ja/changePassword.html @@ -0,0 +1,61 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>パスワード変更</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + + <h2>パスワード変更</h2> + <h3>概要</h3> + 管理ツールにログインしているユーザのパスワードを変更します。 + <h3>機能</h3> + それぞれの入力欄に新しいパスワードを2回入力して更新ボタンを押してください。<br /> + 更新ボタンを押すと、ログイン画面が表示されます。新しいパスワードでログインしてください。 + <p> + <table> + <tbody> + <tr> + <th><label for="password">パスワード</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + <tr> + <th><label for="password2">パスワード(確認)</label></th> + <td><input id="password2" name="password2" type="password" size="25" /></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="button" name="ButtonName" value="更新" /> + </td></tr> + </table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/config.html b/doc/ja/config.html new file mode 100644 index 0000000..3c32b07 --- /dev/null +++ b/doc/ja/config.html @@ -0,0 +1,123 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>管理ツール設定</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul></div> +<div id="content"> + + <h2>管理ツール設定</h2> + <h3>概要</h3> + + pgpool管理ツールの設定を表示・変更することができます。 + <p><img src="images/pgpooladmin.jpg" /></p> + <h3>機能</h3> + <table> + <tbody> + <tr> + <th><label>言語</label> + (string)</th> + <td class="input">表示したい言語を選択します。「auto」を選択した場合には、ブラウザで設定した言語が優先的に表示されます。</td> + + </tr> + <tr> + <th><label>pgpool.confファイル</label> + (string)</th> + <td>pgpool.confへのパスをフルパスで指定します。</td></tr> + <tr> + <th><label>パスワードファイル</label> + + (string)</th> + <td>pcp.confへのパスをフルパスで指定します。</td></tr> + <tr> + <th><label>pgpoolコマンド</label> + (string)</th> + <td>pgpoolへのパスをフルパスで指定します。</td></tr> + + <tr> + <th colspan="2"><label>pgpoolコマンドオプション</label> + (string)</th></tr> + <tr><td>クエリキャッシュクリア(-c)</td> + <td>起動時にクエリキャッシュをクリアします。</td> + </tr> + <tr><td>非デーモンモード(-n)</td> + + <td>非デーモンモードでpgpoolを起動します。pgpoolのログを管理ツールで表示するには、この項目をオンにする必要があります。</td> + </tr> + <tr><td>デバッグモード(-d)</td> + <td>デバッグモードで起動します。デバッグログが必要な場合にはオンにします。</td> + </tr> + <tr><td>停止モード(-m)</td> + <td>pgpoolのすべてのプロセスを終了します。pgpool停止ボタンを押すと、終了オプションが表示されます。停止モードとして + <ul> + + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + を選択することができます。終了すると、pgpoolステータスが「pgpool停止」となり、起動用画面が表示されます。</td> + </tr> + <tr><td>pgpool.conf(-f)</td> + + <td>pgpoolの起動時に指定するpgpool.confです。pgpool.confのパスは「pgpool.confファイル」で指定した値になります。</td> + </tr> + <tr><td>pcp.conf(-F)</td> + <td>pgpoolの起動時に指定するpcp.confです。pgpool.confのパスは「パスワードファイル」で指定した値になります。</td> + </tr> + <tr> + <th><label>pgpoolログファイル</label> + + (string)</th> + <td>非デーモンモードで起動した場合に使用するログファイルをフルパスで指定します。設定しない場合にはpgpool.confのlogdirで指定してあるパスにpgpool.logファイルを作成します。</td></tr> + <tr> + <th><label>PCPディレクトリ</label> + (string)</th> + <td>PCPコマンドがインストールしてあるディレクトリを指定します。</td></tr> + + <tr> + <th><label>PCPディレクトリ</label> + (string)</th> + <td>PCPコマンドがインストールしてあるディレクトリを指定します。</td></tr> + <tr> + <th><label>PCPホスト名</label> + (string)</th> + + <td>PCPコマンドを実行するホスト名を指定します。通常は「localhost」になります。</td> + </tr> + <tr> + <th><label>更新間隔(0で自動更新しない)</label> + (integer) + </td> + <td>ステータスの更新間隔を秒単位で指定します。0を指定した場合には自動更新しません。 + </td></tr> + </tbody> + </table> + <p>最後に更新ボタンを押して更新します。</p> +</div><div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/errorCode.html b/doc/ja/errorCode.html new file mode 100644 index 0000000..db234ff --- /dev/null +++ b/doc/ja/errorCode.html @@ -0,0 +1,163 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>エラーコード</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> +<h2>エラーコード</h2> +<h3>共通</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e1</label></th><td class="right_border">pgmgt.conf.phpが見つかりません</td><td>pgmgt.conf.phpファイルがconfディレクトリにあるか確認してください。また、適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2</label></th><td class="right_border">メッセージカタログが見つかりません</td><td>メッセージカタログファイルがlangディレクトリにあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3</label></th><td class="right_border">pcpコマンドエラーが発生しました</td><td>Pcpコマンドが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pgpool.confが設定メニューで指定した場所にあるか確認してください。また、pgpool.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5</label></th><td class="right_border">テンプレートファイルが見つかりません</td><td>表示用テンプレートファイルがtemplateディレクトリにあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6</label></th><td class="right_border">ヘルプが見つかりません</td><td>ヘルプファイルがtemplate/help以下にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e7</label></th><td class="right_border">pgmgt.conf.phpのパラメータが足りません</td><td>pgmgt.conf.phpにパラメータが指定してあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e8</label></th><td class="right_border">pcp_timeoutがpgpool.confで見つかりません</td><td>pcp_timeoutがpgpool.confで指定してあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e9</label></th><td class="right_border">pcp_portがpgpool.confで見つかりません</td><td>pcp_portがpgpool.confで指定してあるか確認してください。</td></tr> +</table> + +<h3>pgpoolステータス</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e1001</label></th><td class="right_border">pcpコマンドエラーが発生しました</td><td>pcpコマンドの呼び出しに失敗した場合に表示されます。Pcpコマンドが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1002</label></th><td class="right_border">pcp_node_countコマンドでエラーが発生しました</td><td>pcp_node_countの実行エラーです。pcp_node_countが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1003</label></th><td class="right_border">pcp_node_infoコマンドでエラーが発生しました</td><td>pcp_node_infoの実行エラーです。pcp_node_infotが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1004</label></th><td class="right_border">pcp_proc_countコマンドでエラーが発生しました</td><td>pcp_proc_countの実行エラーです。pcp_proc_countが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1005</label></th><td class="right_border">pcp_proc_infoコマンドでエラーが発生しました</td><td>pcp_proc_infoの実行エラーです。pcp_proc_infoが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1006</label></th><td class="right_border">pcp_stop_pgpoolコマンドでエラーが発生しました</td><td>pcp_stop_pgpoolの実行エラーです。pcp_stop_pgpoolが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1007</label></th><td class="right_border">pcp_detach_nodeコマンドでエラーが発生しました</td><td>pcp_detach_nodeの実行エラーです。pcp_detach_nodeが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1008</label></th><td class="right_border">指定したpgpool.confが見つかりません</td><td>pgpool.confが設定メニューで指定した場所にあるか確認してください。また、pgpool.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1009</label></th><td class="right_border">指定したpcp.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1010</label></th><td class="right_border">pcp_attach_nodeコマンドでエラーが発生しました</td><td>pcp_attach_nodeの実行エラーです。pcp_detach_nodeが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1011</label></th><td class="right_border">ログファイルが見つかりません</td><td>pgpoolログファイルが設定メニューで指定した場所にあるか確認してください。また指定したログファイルに適切なアクセス権があるか確認してください。指定しない場合には、pgpool.confのlogdirで指定したディレクトリにpgpool.logというファイル名で作成されます。</td></tr> +</table> + +<h3>ノードステータス</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e8001</label></th><td class="right_border">詳細情報が取得できません</td><td>ノードにpsqlコマンドで接続できるか確認してください。</td></tr> +</table> + +<h3>クエリキャッシュ</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e2001</label></th><td class="right_border">データベースに接続できません</td><td>pgpool.confのシステムDBで指定したデータベースに接続できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2002</label></th><td class="right_border">レコード取得時にエラーが発生しました</td><td>クエリキャッシュテーブルのレコードが正常に取得できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2003</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +</table> + +<h3>分散ルール</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e3001</label></th><td class="right_border">データベースに接続できません</td><td>pgpool.confのシステムDBで指定したデータベースに接続できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3002</label></th><td class="right_border">レコード取得時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に取得できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3003</label></th><td class="right_border">レコード登録時にエラーが発生しました</td><td>システムDBテーブルにレコードが正常に挿入できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3004</label></th><td class="right_border">レコード更新時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に更新できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3005</label></th><td class="right_border">レコード削除時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に削除できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3006</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +</table> + +<h3>pgpool.conf設定</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e4001</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4002</label></th><td class="right_border">pgpool.confから読み込みができません</td><td>pgpool.confに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4003</label></th><td class="right_border">pgpool.confに書き込みができません</td><td>pgpool.confに書き込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4004</label></th><td class="right_border">pgpool.confに必要なパラメータがありません</td><td>pgpool.confにパラメータがすべてあるか確認してください。</td></tr> +</table> + +<h3>管理ツール設定</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e5001</label></th><td class="right_border">pgmgt.conf.phpが見つかりません</td><td>pgmgt.conf.phpファイルがconfディレクトリにあるか確認してください。また、適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5002</label></th><td class="right_border">pgmgt.conf.phpから読み込みができません</td><td>pgmgt.conf.phpファイルに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5003</label></th><td class="right_border">pgmgt.conf.phpに書き込みができません</td><td>pgmgt.conf.phpファイルに書き込みアクセス権があるか確認してください。</td></tr> +</table> + +<h3>パスワード変更</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e6001</label></th><td class="right_border">pcp.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6002</label></th><td class="right_border">pcp.confに読み込みができません</td><td>pcp.confファイルに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6003</label></th><td class="right_border">pcp.confに書き込みができません</td><td>pcp.confファイルに書き込みアクセス権があるか確認してください。</td></tr> +</table> + +<h3>ログアウト</h3> +<table> + <tr> + <th class="right_border"><label>エラーコード</label></th> + <th class="right_border"><label>エラーメッセージ</label></th> + <th><label>対策</label></th> + </tr> +<tr><th class="right_border"><label>e7001</label></th><td class="right_border">pcp.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。</td></tr> +</table> + + +</div> +<div id="footer"> +<address> +Version 1.0 Alpha<br /> +Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. +</address> + +</div> +</body> +</html> diff --git a/doc/ja/images/1.jpg b/doc/ja/images/1.jpg Binary files differnew file mode 100644 index 0000000..474f072 --- /dev/null +++ b/doc/ja/images/1.jpg diff --git a/doc/ja/images/2.jpg b/doc/ja/images/2.jpg Binary files differnew file mode 100644 index 0000000..9b433b5 --- /dev/null +++ b/doc/ja/images/2.jpg diff --git a/doc/ja/images/3.jpg b/doc/ja/images/3.jpg Binary files differnew file mode 100644 index 0000000..2d81b72 --- /dev/null +++ b/doc/ja/images/3.jpg diff --git a/doc/ja/images/4.jpg b/doc/ja/images/4.jpg Binary files differnew file mode 100644 index 0000000..7553e9b --- /dev/null +++ b/doc/ja/images/4.jpg diff --git a/doc/ja/images/ng.gif b/doc/ja/images/ng.gif Binary files differnew file mode 100644 index 0000000..b10aca7 --- /dev/null +++ b/doc/ja/images/ng.gif diff --git a/doc/ja/images/nodestatus.jpg b/doc/ja/images/nodestatus.jpg Binary files differnew file mode 100644 index 0000000..f3064d2 --- /dev/null +++ b/doc/ja/images/nodestatus.jpg diff --git a/doc/ja/images/ok.gif b/doc/ja/images/ok.gif Binary files differnew file mode 100644 index 0000000..ee85496 --- /dev/null +++ b/doc/ja/images/ok.gif diff --git a/doc/ja/images/pgpooladmin.jpg b/doc/ja/images/pgpooladmin.jpg Binary files differnew file mode 100644 index 0000000..dbdf49c --- /dev/null +++ b/doc/ja/images/pgpooladmin.jpg diff --git a/doc/ja/images/restart.jpg b/doc/ja/images/restart.jpg Binary files differnew file mode 100644 index 0000000..f970680 --- /dev/null +++ b/doc/ja/images/restart.jpg diff --git a/doc/ja/images/start.jpg b/doc/ja/images/start.jpg Binary files differnew file mode 100644 index 0000000..dd9a81e --- /dev/null +++ b/doc/ja/images/start.jpg diff --git a/doc/ja/images/status.jpg b/doc/ja/images/status.jpg Binary files differnew file mode 100644 index 0000000..8a59a08 --- /dev/null +++ b/doc/ja/images/status.jpg diff --git a/doc/ja/images/stop.jpg b/doc/ja/images/stop.jpg Binary files differnew file mode 100644 index 0000000..992cded --- /dev/null +++ b/doc/ja/images/stop.jpg diff --git a/doc/ja/install.html b/doc/ja/install.html new file mode 100644 index 0000000..b97ea41 --- /dev/null +++ b/doc/ja/install.html @@ -0,0 +1,423 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool管理ツールインストール方法</title> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + <h2>pgpool管理ツールインストール方法</h2> + <h3>はじめに</h3> +pgpool管理ツールのインストールを始める前に、pgpoolが正常にインストールでき、稼動することを確認してください。<p /> +pgpool管理ツールをインストールする場合、少なくとも以下のソフトウェアがpgpoolが稼動するサーバにインストールされていて、正常に動く必要があります。 +<ul> + <li>HTTPサーバ(Apache)</li> + <li>PHP4.4.2以上</li> + <li>pgpool</li> +</ul> +インストールを始める前に次の準備をしてください。 + +<ul> + <li>HTTPサーバ、PHP、pgpoolを適切にセットアップする。</li> + <li>ブラウザのクッキーとJavaScriptを有効にする。</li> +</ul> + <h3>前提条件</h3> +ここでは以下のように設定してあることを前提として説明します。 +<p /> +<table> +<tr> +<th><label>Aapcheドキュメントルートディレクトリ</label></th> +<td>/var/www/html</td> +</tr> +<tr> +<th><label>Aapcheプロセスユーザ</label></th> +<td>apache</td> +</tr> +<tr> +<th><label>管理ツールインストールディレクトリ</label></th> +<td>/var/www/html/admin-tool</td> +</tr> +<tr> +<th><label>pgpoolコマンドパス</label></th> +<td>/usr/local/bin/pgpool</td> +</tr> +<tr> +<th><label>pcp_attach_nodeコマンドパス</label></th> +<td>/usr/local/bin/pcp_attach_node</td> +</tr> +<tr> +<th><label>pcp_detach_nodeコマンドパス</label></th> +<td>/usr/local/bin/pcp_detach_node</td> +</tr> +<tr> +<th><label>pcp_node_countコマンドパス</label></th> +<td>/usr/local/bin/pcp_node_count</td> +</tr> +<tr> +<th><label>pcp_node_infoコマンドパス</label></th> +<td>/usr/local/bin/pcp_node_info</td> +</tr> +<tr> +<th><label>pcp_proc_countコマンドパス</label></th> +<td>/usr/local/bin/pcp_proc_count</td> +</tr> +<tr> +<th><label>pcp_proc_infoコマンドパス</label></th> +<td>/usr/local/bin/pcp_proc_info</td> +</tr> +<tr> +<th><label>pcp_stop_pgpoolコマンドパス</label></th> +<td>/usr/local/bin/pcp_stop_pgpool</td> +</tr> +<tr> +<th><label>pcp_systemdb_infoコマンドパス</label></th> +<td>/usr/local/bin/pcp_systemdb_info</td> +</tr> +<tr> +<th><label>pg_md5コマンドパス</label></th> +<td>/usr/local/bin/pg_md5</td> +</tr> +<tr> +<th><label>pgpool.confファイルパス</label></th> +<td>/usr/local/etc/pgpool.conf</td> +</tr> +<tr> +<th><label>pcp.confファイルパス</label></th> +<td>/usr/local/etc/pcp.conf</td> +</tr> +</table> + <h3>インストール</h3> +以下に手順をおって、管理ツールのインストールを説明します。 + <ol> + <li>セットアップしたpgpoolおよびpcpツールをApachユーザから実行できるようにアクセス権を設定します。</li> + <div id="cmd_window"><table> + <tr><td>cd /usr/local/bin</td></tr> + <tr><td>ls</td></tr> + </table> + </div> + 以下のファイルがあることを確認します。 + <ul> + <li>pgpool</li> + <li>pcp_attach_node</li> + <li>pcp_detach_node</li> + <li>pcp_node_count</li> + <li>pcp_node_info</li> + <li>pcp_proc_count</li> + <li>pcp_proc_info</li> + <li>pcp_stop_pgpool</li> + <li>pcp_systemdb_info</li> + <li>pg_md5</li> + </ul> + <div id="cmd_window"><table> + <tr><td>chmod 755 /usr/local/bin/pgpool</td></tr> + <tr><td>chmod 755 /usr/local/bin/pcp_*</td></tr> + </table> + </div> + <li> +pcp.confファイルにログインユーザの登録を行います。最初にパスワードをmd5化した文字列を取得します。 +<div id="cmd_window"><table> +<tr><td class="cmd_window">pg_md5 パスワード文字列</td></tr> +</table> +</div> +次に、取得した文字列をpcp.confに +<p>ユーザ名:md5化したパスワード</p> +の行を追加します。 + </li> + <li> +管理ツールプログラムadmin-tool.tar.gzをApacheのhtmlディレクトリ以下に展開します。<br /> +<div id="cmd_window"><table> +<tr><td class="cmd_window">mv admin-tool.tar.gz /tmp</td></tr> +<tr><td class="cmd_window">cd /tmp</td></tr> +<tr><td class="cmd_window">tar xzf admin-tool.tar.gz</td></tr> +<tr><td class="cmd_window">mv admin-tool /var/www/html</td></tr> +<tr><td class="cmd_window">rm admin-tool.tar.gz</td></tr> +</table> +</div> + </li> + <li> +ファイルを確認します。 +<div id="cmd_window"><table> +<tr><td class="cmd_window">find /var/www/html/admin-tool -print</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/finish.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/defaultParameter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/setLang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/checkDirectory.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/Thumbs.db</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/ng.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/images/ok.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/index.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/checkParameter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang/ja.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/install/lang/en.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Smarty.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.counter.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.escape.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.replace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_characters.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/block.textformat.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.spacify.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.date_format.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.regex_replace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.lower.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.debug_print_var.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.eval.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_image.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.nl2br.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.strip_tags.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/outputfilter.trimwhitespace.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.assign_debug_info.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.strip.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/shared.make_timestamp.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_select_date.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.truncate.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/compiler.assign.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.capitalize.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.wordwrap.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.indent.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_checkboxes.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/shared.escape_special_chars.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.cycle.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.math.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.cat.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_select_time.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_options.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.fetch.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_paragraphs.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.config_load.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.popup_init.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.string_format.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_sentences.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.count_words.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.default.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.popup.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/modifier.upper.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_table.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.debug.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.html_radios.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/plugins/function.mailto.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_cache_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.display_debug_console.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.load_resource_plugin.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.is_trusted.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.is_secure.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.assemble_plugin_filepath.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_microtime.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.load_plugins.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.rmdir.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.smarty_include_php.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.process_compiled_include.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.run_insert_handler.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.process_cached_inserts.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_compiled_include.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.rm_auto.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_include_path.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.write_compiled_resource.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.get_php_resource.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.read_cache_file.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.create_dir_structure.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/internals/core.assign_smarty_interface.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Smarty_Compiler.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/debug.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/libs/Config_File.class.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/nodeServerStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/login.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/innerSystemCatalog.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/definePgpoolConfParam.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/systemDb.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/setLang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/queryCache.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/pgconfig.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/common.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/status.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/config.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/command.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pgmgtNotFound.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pleaseInstall.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/nodeStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/procInfo.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerSystemCatalog.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/ja/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/changePassword.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/systemDb.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/login.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/queryCache.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/status.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/pgconfig.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/help/en/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/footer.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerError.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/innerNodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/menu.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/config.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/nodeServerStatus.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates/error.tpl</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/screen.css</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/conf</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/conf/pgmgt.conf.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/innerNodeServerStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/changePassword.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/question.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/background.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/descending.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/ascending.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/elephant.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/Thumbs.db</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/spacer.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/logo.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/back.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/marker.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/sea.jpg</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/images/turtle.gif</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/index.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/templates_c</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang/ja.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/lang/en.lang.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/procInfo.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/nodeStatus.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/help.php</td></tr> +<tr><td class="cmd_window">/var/www/html/admin-tool/logout.php</td></tr> +</table> +</li> +<li> +Webブラウザからinstall/phpinfo.phpにアクセスします。php_mstringとphp_pgsqlの機能が有効であることを確認します。 +<ul> +<li>「Multibyte Support」が「enabled」になっている。</li> +<li>「PostgreSQL Support」が「enabled」になっている。</li> +</ul> +<p>これらの項目が「enabled」になっていない場合には、PHPの設定を再度確認してください。</p> +</li> +<li> +展開したディレクトリ内にある「templates_c」ディレクトリ、「conf/pgmgt.conf.php」ファイルに書き込みアクセス権を設定します。 +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /var/www/html/admin-tool</td></tr> +<tr><td class="cmd_window">chmod 777 templates_c</td></tr> +</table> +</div> + </li> + <li> +管理ツール設定ファイルにApacheプロセスのユーザに書き込み権限を与えます。 +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /var/www/html/admin-tool/conf</td></tr> +<tr><td class="cmd_window">chown apache pgmgt.conf.php</td></tr> +<tr><td class="cmd_window">chmod 644 pgmgt.conf.php</td></tr> +</table> +</div> + </li> + <li> +pgpoolの設定ファイルであるpgpool.confファイルとpcp.confファイルにapacheプロセスユーザからの書き込み権限を設定します。 +<div id="cmd_window"><table> +<tr><td class="cmd_window">cd /usr/local/etc</td></tr> +<tr><td class="cmd_window">chown apache pgpool.conf</td></tr> +<tr><td class="cmd_window">chmod 644 pgpool.conf</td></tr> +<tr><td class="cmd_window">chown apache pcp.conf</td></tr> +<tr><td class="cmd_window">chmod 644 pcp.conf</td></tr> +</table> +</div> + </li> + <li> + PHPのマルチバイトとPostgreSQLライブラリがインストールされているか確認します。ブラウザから + <p>http://インストールしたサーバ/admin-tool/install/phpinfo.php</p> + にアクセスします。PHPの設定情報が表示されるかどうか確認します。 + それらの中にMultibyte SupportとPostgreSQL Supportがenabledになっているか確認します。なっていない場合には、PHPの設定を再度確認してください。 + </li> + <li> +インストーラにアクセスします。URLは +<p>http://インストールしたサーバ/admin-tool/install/index.php</p> +になります。 + </li> + <li> +表示言語を選択します。 +<p><img src="images/1.jpg"></p> + </li> + <li> +ディレクトリのアクセス権の確認を行います。右側に<img src="images/ok.gif">が表示された場合には、適切に設定されています。「次へ」ボタンをクリックしてください。<img src="images/ng.gif">が表示された場合には適切に設定されてませんので、エラーメッセージを確認し修正して「チェック」ボタンを押してください。 +<p><img src="images/2.jpg"></p> + </li> + <li> +管理ツールの設定を行います。右側に<img src="images/ok.gif">が表示された場合には、適切に設定されています。「次へ」ボタンをクリックしてください。<img src="images/ng.gif">が表示された場合には適切に設定されてませんので、エラーメッセージを確認し修正して「チェック」ボタンを押してください。 +<p> + <dl> + <dt>pgpool.conf</dt> + <dd>pgpool.confファイルのパスをフルパスで指定します。</dd> + <dt>パスワードファイル</dt> + <dd>pcp.confファイルのパスをフルパスで指定します。</dd> + <dt>pgpoolコマンド</dt> + <dd>pgpoolファイルのパスをフルパスで指定します。</dd> + <dt>PCPディレクトリ</dt> + <dd>PCPコマンド群がインストールしてあるディレクトリをフルパスで指定します。</dd> + <dt>PCPホスト名</dt> + <dd>PCPコマンドがインストールしてあるホスト名を指定します。</dd> + <dt>更新間隔</dt> + <dd>pgpoolのステータスを自動更新する間隔を秒単位で設定します。0の場合には自動更新しません。</dd> + </dl> +</p> +<p><img src="images/3.jpg"></p> + </li> + <li> +これで管理ツールのインストールは終了しました。最後に「install」ディレクトリを削除して終了です。 +<p><img src="images/4.jpg"></p> +<div id="cmd_window"><table> +<tr><td class="cmd_window">rm -Rf /var/www/html/admin-tool/install</td></tr> +</table> +</div> + </li> + </ol> +<h3>ログイン画面の表示</h3> +インストール完了画面で「トップ画面へ移動」をクリックすると管理ツールのログイン画面が表示されます。インストール手順2で設定したユーザ名とパスワードを入力してログインします。 +</div> +<div id="footer"> +<address> +Version 1.0 Alpha<br /> +Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. +</address> +</div> +</body> +</html>
\ No newline at end of file diff --git a/doc/ja/login.html b/doc/ja/login.html new file mode 100644 index 0000000..7f2c1e8 --- /dev/null +++ b/doc/ja/login.html @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>ログイン</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + + <h2>ログイン</h2> + <h3>概要</h3> + <p>ログインページです。pcp.confに設定したユーザ名およびパスワードを入力してください。<br /> + 認証が成功すると、ステータス画面が表示されます。失敗した場合には、再度ログイン画面が表示されます。 + <h3>機能</h3> + <table> + <tbody> + <tr> + <th><label>ログイン名</label></th> + <td><input id="username" name="username" type="text" size="25" /> + ここにユーザ名を入力してください。</td> + </tr> + <tr> + <th><label>パスワード</label></th> + <td><input id="password" name="password" type="password" size="25" /> + ここにパスワードを入力してください。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"><input type="button" name="Button2" value="ログイン" /> + ユーザ名とパスワードを入力したらボタンを押してください。</td> + </tr> + </tfoot> + </table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/logout.html b/doc/ja/logout.html new file mode 100644 index 0000000..5ab6357 --- /dev/null +++ b/doc/ja/logout.html @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>ログアウト</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + + <h2>ログアウト</h2> + <h3>概要</h3> + <p>ログインに成功すると、メニューに表示されます。 + <h3>機能</h3> + クリックすると、ログアウトしてログイン画面が表示されます。 +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/nodeServerStatus.html b/doc/ja/nodeServerStatus.html new file mode 100644 index 0000000..aab8e6c --- /dev/null +++ b/doc/ja/nodeServerStatus.html @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>ノードステータス</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + +<h2>ノードステータス</h2> +<h3>概要</h3> +ノードステータスでは、各ノードについて +<ul><li>IPアドレス</li> + <li>ポート</li> + <li>ステータス</li> + <li>詳細情報</li> + </ul> +<p>を取得することができます。</p> +<p><img src="images/nodestatus.jpg" /></p> +<h3>機能</h3> +<table> + <tr> + <th class="right_border"><label>IPアドレス</label></th> + <td>ノードのIPアドレス</td> + </tr> + <tr> + <th class="right_border"><label>ポート</label></th> + <td>Postmasterが稼働しているポート番号</td> + </tr> + <tr> + <th class="right_border"><label>ステータス</label></th> + <td>Postmasterが稼働状態であるかどうかを表示します。</td> + </tr> + <tr> + <th class="right_border"><label>詳細</label></th> + <td>Postmasterが稼働状態の場合にのみ表示されます。<br /> +PostgreSQLの場合にはpg_settings情報、pgpoolの場合にはpool_statusを取得します。 + </td> + </tr> +</table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/pgconfig.html b/doc/ja/pgconfig.html new file mode 100644 index 0000000..613a77d --- /dev/null +++ b/doc/ja/pgconfig.html @@ -0,0 +1,457 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpool.conf設定</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + <h2>pgpool.conf設定</h2> + <h3>概要</h3> + + pgpoolの設定ファイルであるpgpool.confの設定内容を表示・変更することができます。 + <h3>機能</h3> + 変更したい値を入力して更新ボタンを押してください。 + <h3>バックエンドホストの追加</h3> + 新しいバックエンドホストを追加したい場合には、追加ボタンを押してください。<br /> + バックエンドホストの項目に新しい入力欄ができますので、そこに新しいバックエンドホストの情報を入力してください。<br /> + 入力が終わりましたら、更新ボタンを押してください。 + <h3>バックエンドホストの削除</h3> + + 登録してあるバックエンドホストを削除したい場合には、そのホスト設定の右側にある削除ボタンを押してください。<br /> + <div id="submenu"> + <h3>Table of Contents</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#pcp">PCP</a></li> + + <li><a href="#logging">Logging</a></li> + <li><a href="#replication">Replication</a></li> + <li><a href="#health-check">Health Check</a></li> + <li><a href="#system-database">System Database</a></li> + <li><a href="#others">Others</a></li> + </ul> + + </div> + <h3><a name="connections">Connections</a></h3> + <table> + <thead> + <tr> + <th>項目</th> + <th>詳細</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>TCP/IPコネクションを受け付けるアドレス</label> + <br>listen_addresses (string)</th> + <td> +TCP/IPコネクションを受け付けるアドレスをホスト名またはIPアドレスで指定します。「*」を指定するとすべてのIPインタフェースからのコネクションを受け付けます。「''」を指定するとTCP/IPコネクションを受け付けま +せん。デフォルト値は「localhost」です。<br />UNIXドメインソケット経由のコネクションは常に受け付けます。 + </td> + + </tr> + <tr> + <th><label>pgpoolがコネクションを受け付けるポート番号</label> + <br>port (integer)</th> + <td>pgpoolがコネクションを受け付けるポート番号です。デフォルト値は9999です</td> + </tr> + <tr> + + <th><label>pgpoolがコネクションを受け付けるUnix domain socketディレクトリ</label> + <br>socket_dir (string)</th> + <td>PostgreSQLサーバのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>preforkするpgpoolのサーバプロセス数</label> + <br>num_init_children (integer)</th> + + <td>preforkするpgpoolのサーバプロセスの数です。デフォルト値は32になっています。<br /> +なお、問い合わせのキャンセルを行うと通常のコネクションとは別に新たなコネクションが張られます。したがって、すべてのコネクションが使用中の場合は問い合わせのキャンセルができなくってしまうので、ご注意下 + さい。問い合わせのキャンセルを必ず保証したい場合は、想定されるコネクション数の倍の値を設定することをおすすめします。</td> + </tr> + <tr> + <th><label>pgpoolの各サーバプロセスがキープするPostgreSQLへの最大コネクション数</label> + <br>max_pool (integer)</th> + <td>pgpoolの各サーバプロセスがキープするPostgreSQLへの最大コネクション数です。pgpoolは、ユーザ名、データベースが同じならばコネクションを再利用しますが、そうでなければ新たにPostgreSQLへのコネクションを確立しようとします。したがって、ここでは想定される[ユーザ名:データベース名]のペアの種類の数だけをmax_poolに指定しておく必要があります。もしmax_poolを使いきってしまった場合は一番古いコネクションを切断し、そのスロットが再利用されます。<br />max_poolのデフォルト値は4です。<br />なお、pgpool全体としては、num_init_children*max_pool 分だけPostgreSQLへのコネクションが張られる点に注意してください</td> + + </tr> + <tr> + <th><label>pgpoolの子プロセスの寿命</label> + <br>child_life_time (integer)</th> + <td>pgpoolの子プロセスの寿命です。アイドル状態になってからchild_life_time秒経過すると、一旦終了して新しいプロセスを起動します。メモリーリークその他の障害に備えた予防措置です。child_life_timeのデフォルト値は300秒、すなわち5分です。0を指定するとこの機能は働きません(すなわち起動しっ放し)。なお、まだ一度もコネクションを受け付けていないプロセスにはchild_life_timeは適用されません。</td> + </tr> + <tr> + + <th><label>コネクションプール中のコネクションの有効期間(秒)</label> + <br>connection_life_time (integer)</th> + <td>コネクションプール中のコネクションの有効期間を秒単位で指定します。0を指定すると有効期間は無限になります。connection_life_timeのデフォルト値は0です。</td> + <tr> + <th><label>各pgpool子プロセスが終了するまでの接続回数</label> + <br>child_max_connections (integer)</th> + + <td>各pgpool子プロセスへの接続回数がこの設定値を超えると、その子プロセスを終了します。child_life_timeやconnection_life_timeが効かないくらい忙しいサーバで、PostgreSQLバックエンドが肥大化するのを防ぐのに有効です。</td> + </tr> + <tr> + <th><label>コネクションをキャッシュ</label> + <br>connection_cache</th> + <td>trueならコネクションをキャッシュします。デフォルトはtrueです。</td> + </tr> + + <tr> + <th><label>pgpool2 が動作しているホスト名</label> + <br>pgpool2_hostname (string)</th> + <td>pgpool2が稼働しているホスト名を指定します。</td> + </tr> + </tbody> + <tfoot> + <tr> + + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="backends">Backends</a></h3> + <table> + <thead> + <tr> + + <th>項目</th> + <th>詳細</th> + <td></td> + </tr> + </thead> + <tbody> + <tr> + <th><label>PostgreSQLサーバのUnix domain socketのディレクトリ</label> + + <br>backend_socket_dir (string)</th> + <td>PostgreSQLサーバのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>pgpoolが接続するPostgreSQLサーバ(postmaster)が動いているホスト名</label><br />backend_hostname (string)</th> + <td>postmasterが稼働しているホスト名を指定します。指定しない場合にはUnix domain socketで接続します。</td> + </tr> + + <tr> + <th><label>PostgreSQLサーバのポート番号</label><br />backend_port (integer)</th> + <td>postmasterが稼働しているポート番号です。</td> + </tr> + <tr> + <th><label>ロードバランスモード時のSELECTを振り分ける「重み」の定義</label><br />backend_weight (integer)</th> + <td>ロードバランスモード時に振り分ける重みを0から1の値で設定します。すべてのバックエンドサーバで指定した値から相対的な重みを計算して振り分けます。</td> + + </tr> + </tbody> + </table> + <h3><a name="pcp">PCP (pgpool Control Port)</a></h3> + <table> + <thead> + <tr> + <th>項目</th> + + <th>詳細</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>pgpool-IIが受け付けているポート番号</label> + <br>pcp_port (integer)</th> + + <td>PCPに接続するためのポート番号です。デフォルトは9898です。</td> + </tr> + <tr> + <th><label>pcpがコネクションを受け付けるUnix domain socketディレクトリ</label> + <br>pcp_socket_dir (string)</th> + <td>PCPのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + + <th><label>この時間内にクライアントから応答がない場合はコネクションを切断して終了</label> + <br>pcp_timeout (integer)</th> + <td>PCPコマンドのタイムアウトを設定します。この時間の間に応答がない場合にはコネクションを切断します。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + + </tr> + </tfoot> + </table> + <h3><a name="logging">Logging</a></h3> + <table> + <thead> + <tr> + <th>項目</th> + + <th>詳細</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>pgpoolの各種ログファイルを格納するディレクトリ</label> + <br>logdir (string)</th> + + <td>pgpoolの各種ログファイルを格納するディレクトリです。現在のところ、pgpool.pidというプロセスIDを格納するファイルだけが作られるようになっています。logdirのデフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>pgpoolのログにタイムスタンプを追加</label> + <br>print_timestamp</th> + <td>trueならばpgpoolのログにタイムスタンプを追加します。デフォルトはtrueです。</td> + </tr> + + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="replication">Replication</a></h3> + + <table> + <thead> + <tr> + <th>項目</th> + <th>詳細</th> + </tr> + </thead> + <tbody> + + <tr> + <th><label>レプリケーションモードの有効化</label> + <br>replication_mode</th> + <td>レプリケーションモードで動作させる場合はtrueを指定してください。デフォルト値はfalseです。</td> + </tr> + <tr> + <th><label>masterの問い合わせ処理の完了を待ってからsecondaryの処理</label> + + <br>replication_strict</th> + <td>このオプションをtrueにすると、masterの問い合わせ処理の完了を待ってからsecondaryの処理に移ります。デッドロックの危険性はなくなりますが、masterとsecondaryの間で問い合わせの並列処理を行わなくなるので性能が低下する場合もあります。<br />なお、すべての問い合わせではなくて、SQLのコメントを使って一部の問い合わせのみstrict動作させることもできます。<br />このオプションのデフォルト値はtrueです</td> + </tr> + <tr> + <th><label>replication_strictがfalseのときにデッドロックを監視するためのタイムアウト時間</label> + <br>replication_timeout (integer)</th> + + <td>replication_strictがfalseのときにデッドロックを監視するためのタイムアウト時間をミリ秒単位で指定します。デフォルト値は5000、すなわち5秒です。0を指定するとタイムアウトしなくなります。</td> + </tr> + <tr> + <th><label>trueを指定するとマスタとセカンダリの間でデータの不一致があった場合に強制的に縮退運転</label> + <br>replication_stop_on_mismatch</th> + <td>trueを指定するとマスタとセカンダリの間でデータの不一致があった場合に強制的に縮退運転に入ります。このオプションがfalseの場合は、該当の問い合わせを強制的に終了するだけに留めます。デフォルト値はfalseです。</td> + </tr> + + <tr> + <th><label>セッションが終了するときにコネクションを初期化するためのSQLコマンド</label> + <br>reset_query_list (string)</th> + <td>セッションが終了するときにコネクションを初期化するためのSQLコマンドを「;」で区切って列挙します。デフォルトは以下のようになっていますが、任意のSQL文を追加しても構いません。 + <p>reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'</p> +PostgreSQLのバージョンによって使用できるSQLコマンドが違うので、PostgreSQL 7.3以前では注意してください(「4. pgpoolの稼働環境」参照)。<br />なお、「ABORT」は、PostgreSQL 7.4以上ではトランザクションブロックの中にいない場合には発行されません。 + </td> + </tr> + + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="health-check">Health Check</a></h3> + + <table> + <thead> + <tr> + <th>項目</th> + <th>詳細</th> + </tr> + </thead> + <tbody> + + <tr> + <th><label>ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)</label> + <br>health_check_timeout (integer)</th> + <td> pgpoolはサーバ障害やネットワーク障害を検知するために、定期的にバックエンドに接続を試みます。これを「ヘルスチェック」と言います。障害が検知されると、フェイルオーバや縮退運転を試みます。<br />この パラメータは、ネットワークケーブルが抜けた際などにヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値を秒単位で指定します。デフォルトは20秒です。0を指定するとタイムアウト処理をしません。<br />なお、ヘルスチェックを有効にすると、ヘルスチェックのための余分の接続が1つ必要になりますので、PostgreSQLのpostgresql.confの設定項目のmax_connectionsを少くとも1増やすようにしてください</td> + </tr> + <tr> + + <th><label>ヘルスチェックを行う間隔(秒)</label> + <br>health_check_period (integer)</th> + <td>ヘルスチェックを行う間隔を秒単位で指定します。0を指定するとヘルスチェックを行いません。デフォルトは0です(つまりヘルスチェックを行いません)。 + </td> + </tr> + <tr> + <th><label>ヘルスチェックを行うためのPostgreSQLユーザ名</label> + <br>health_check_user (string)</th> + + <td>ヘルスチェックを行うためのPostgreSQLユーザ名です。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + + </table> + <h3><a name="system-database">System Database</a></h3> + <table> + <thead> + <tr> + <th>項目</th> + <th>詳細</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>System DBが動いているホスト名</label> + <br>system_db_hostname (string)</th> + <td>システムDBが稼働しているホスト名を指定します。指定しない場合にはUnix domain socketで接続します。</td> + </tr> + + <tr> + <th><label>System DBに接続するためのポート番号</label> + <br>system_db_port (integer)</th> + <td>システムDBがあるPostgreSQLに接続するためのポート番号を指定します。</td> + </tr> + <tr> + <th><label>System DBのデータベース名</label> + + <br>system_db_dbname (string)</th> + <td>システムDBのデータベース名を指定します。</td> + </tr> + <tr> + <th><label>System DBのスキーマ</label> + <br>system_db_schema (string)</th> + <td>システムDBのスキーマを指定します。</td> + + </tr> + <tr> + <th><label>System DBに接続するときのユーザ名</label> + <br>system_db_user (string)</th> + <td>システムDBに接続するユーザ名を指定します。</td> + </tr> + <tr> + <th><label>System DBに接続するユーザのパスワード</label> + + <br>system_db_password (string)</th> + <td>システムDBに接続するユーザのパスワードを指定します。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + + </tfoot> + </table> + <h3><a name="others">Others</a></h3> + <table> + <thead> + <tr> + <th>項目</th> + <th>詳細</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>レプリケーションモード時にSELECT文を各ノードにロードバランス</label> + <br>load_balance_mode</th> + <td>trueを指定するとレプリケーションモードの際に、SELECT文をマスタとセカンダリの間でロードバランスします。デフォルト値はfalseです</td> + + </tr> + <tr> + <th><label>マスタ/スレーブモードでpgpoolを運転</label> + <br>master_slave_mode</th> + <td> trueならばマスタ/スレーブモードでpgpoolを運転します。デフォルトはfalseです。このモードはreplication_modeとは両立しません。</td> + </tr> + <tr> + + <th><label>自動的にトランザクションの開始,テーブルロック,トランザクションの終了</label> + <br>insert_lock</th> + <td> +SERIAL型を使っているテーブルをレプリケーションすると、SERIAL型の列の値がマスタとセカンダリで一致しなくなることがあります。この問題は、該当テーブルを明示的にロックすることで回避できます(もちろんトランザ +クションの並列実行性は犠牲になりますが)。しかし、そのためには、 +<p> +INSERT INTO ... +</p> +<p> +を +</p> +<p> +BEGIN;<br /> + +LOCK TABLE ...<br /> +INSERT INTO ...<br /> +COMMIT; +</p> +<p> + に書き換えなければなりません。insert_lockをtrueにすると自動的にトランザクションの開始、テーブルロック、トランザクションの終了を行ってくれるので、こうした手間を省くことができます(すでにトランザクションが開始されている場合はLOCK TABLE...だけが実行されます)。 + + </td> + </tr> + <tr> + <th><label>trueならば、load balanceの際にSQL文行頭の空白を無視</label> + + <br>ignore_leading_white_space</th> + <td>trueならば、load balanceの際にSQL文行頭の空白を無視します(全角スペースは無視されません)。これは、DBI/DBD:Pgのように、勝手に行頭にホワイトスペースを追加するようなAPIを使い、ロードバランスしたいときに有効です</td> + </tr> + <tr> + <th><label>パラレルモードでpgpoolを運転</label> + <br>parallel_mode</th> + <td>pgpoolをパラレルモードで稼働させる場合にはtrueを指定します。この場合には分散ルールを指定する必要があります。</td> + + </tr> + <tr> + <th><label>trueならばSQL文をログ出力</label> + <br>log_statement</th> + <td>trueならばSQL文をログ出力します。この役目はPostgreSQLのlog_statementオプションと似ていて、デバッグオプションがないときでも問い合わせをログ出力して調べることができるので便利です。</td> + </tr> + <tr> + + <th><label>クエリキャッシュ機能の有効化</label> + <br>enable_query_cache</th> + <td>SELECTの結果をキャッシュする場合にはtrueにします。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + + </tr> + </tfoot> + </table> +</div><hr class="hidden" /> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/queryCache.html b/doc/ja/queryCache.html new file mode 100644 index 0000000..ec75e34 --- /dev/null +++ b/doc/ja/queryCache.html @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>クエリキャッシュ</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="#">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + + <h2>クエリキャッシュ</h2> + <h3>概要</h3> + <p>enable_query_cache = true の場合に、SELECT 文の結果をキャッシュさせます。</p> + <h3>機能</h3> + <p>クエリキャッシュのデータを検索することができます。検索対象は、クエリ文字列とデータベース名で、部分一致検索を行うことができます。クエリ文字列とデータベース名はAND検索になります。</p> + <table> + <tbody> + <tr> + <td nowrap="nowrap" class="column">クエリ文字列</td> + <td><input name="qQueryStr" type="text" id="qQueryStr" size="50" value=""/> + </td> + </tr> + <tr> + <td nowrap="nowrap" class="column">データベース名</td> + <td><input name="qDb" type="text" id="qDb" size="50" value=""/></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="search" value="検索" /> + <input type="submit" name="clear" value="クリア" /> + </td></tr> + </table> + <h3>クエリキャッシュリスト</h3> + <p>現在キャッシュされているクエリ文字列、データベース名、作成時刻が表示されます。「クエリ文字列」、「データベース名」および「作成時刻」をクリックすると、並べ替えが行われます。クリックするたびに、昇順または降順で並べ替えが行われます。</p> + <p>削除したいデータの左にあるチェックボックスにチェックを入れて、削除ボタンを押すと削除されます。一番上のチェックボックスにチェックするとすべてのレコードが選択されます。</p> + <table> + <tbody> + <tr> + <th><input type="checkbox" name="all" value="" /></th> + <th>クエリ文字列</th> + <th>データベース名</th> + <th>作成時刻</th> + </tr> + </tbody> + <tfoot> + <tr><td colspan="4"> + <input type="button" name="ButtonName" value="削除"/> + </td></tr> + </table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</html> diff --git a/doc/ja/status.html b/doc/ja/status.html new file mode 100644 index 0000000..ff45b41 --- /dev/null +++ b/doc/ja/status.html @@ -0,0 +1,134 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>pgpoolステータス</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + +<h2>pgpoolステータス</h2> +<h3>概要</h3> +ステータスでは、pgpoolについて +<ul> + <li>サマリー</li> + <li>プロセス情報</li> + <li>ノード情報</li> + <li>ログ</li> +</ul> +の表示とpgpoolの +<ul> + <li>起動</li> + <li>停止</li> + <li>再起動</li> +</ul> +を行うことができます。 +<h3>説明</h3> +<p><img src="images/status.jpg" /></p> +<table> + <tr> + <th class="right_border"><label>サマリー</label></th> + <td>pgpool.confの内容を表示します。</td> + </tr> + <tr> + <th class="right_border"><label>プロセス情報</label></th> + <td><p>pgppolの各プロセスについて</p> + <ul> + <li>プロセスID</li> + <li>データベース名</li> + <li>接続ユーザ名</li> + <li>プロセススタート時刻</li> + <li>コネクション作成時刻</li> + <li>プロトコルメジャーバージョン</li> + <li>プロトコルマイナーバージョン</li> + <li>コネクション使用回数</li> + </ul> + <p>が表示されます。<br /> + 各プロセスについて、最大でpgpool.confのmax_pool分だけ表示されます。 + </p></td> + </tr> + <tr> + <th class="right_border"><label>ノード情報</label></th> + <td><p>各ノードについて</p> + <ul> + <li>IPアドレス</li> + <li>ボート番号</li> + <li>ステータス</li> + <li>負荷分散ウェイト</li> + <li>切断ボタン</li> + </ul> + <p>が表示されます。ただし、pgpoolがパラレルモードで動いているときは、切断ボタンは表示されません。</p> + <p>ステータスには</p> + <ul> + <li>ノード稼働中。接続無し</li> + <li>ノード稼働中。接続中</li> + <li>ノードダウン</li> + </ul> + <p>の3つの状態が表示されます。</p></td> + </tr> + <tr> + <th class="right_border"><label>ログ</label></th> + <td>pgpool非デーモンモード(-n)で起動されているときに、pgpoolのログを表示することができます。</td> + </tr> + <tr> + <th class="right_border"><label>起動</label></th> + <td>pgpoolの停止時には、pgpoolを起動することができます。起動オプションとして + <ul> + <li>クエリキャッシュクリア</li> + <li>非デーモンモード</li> + <li>デバッグモード</li> + <li>pgpool.conf</li> + <li>pcp.conf</li> + </ul> + を指定することかできます。 + <p><img src="images/start.jpg" /></p> + </td> + </tr> + <tr> + <th class="right_border"><label>停止</label></th> + <td>pgpoolのすべてのプロセスを終了します。pgpool停止ボタンを押すと、終了オプションが表示されます。停止モードとして + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + を選択することができます。終了すると、pgpoolステータスが「pgpool停止」となり、起動用画面が表示されます。 +<p><img src="images/stop.jpg" /></p> + </td> + </tr> + <tr> + <th class="right_border"><label>再起動</label></th> + <td>pgpoolのすべてのプロセスを終了し続けて起動処理をします。上記の起動と停止の両方の項目を指定することができます。 +<p><img src="images/restart.jpg" /></p> +</td> + </tr> +</table> +</div> +<div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/ja/systemDb.html b/doc/ja/systemDb.html new file mode 100644 index 0000000..8eec464 --- /dev/null +++ b/doc/ja/systemDb.html @@ -0,0 +1,99 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>分散ルール</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> + <ul> + <li><a href="../index_ja.html">はじめに</a></li> + <li><a href="install.html">インストール</a></li> + <li><a href="login.html">ログイン</a></li> + <li><a href="status.html">pgpoolステータス</a></li> + <li><a href="nodeServerStatus.html">ノードステータス</a></li> + <li><a href="queryCache.html">クエリキャッシュ</a></li> + <li><a href="systemDb.html">分散ルール</a></li> + <li><a href="pgconfig.html">pgpool.conf設定</a></li> + <li><a href="config.html">管理ツール設定</a></li> + <li><a href="changePassword.html">パスワード変更</a></li> + <li><a href="logout.html">ログアウト</a></li> + <li><a href="errorCode.html">エラーコード</a></li> + </ul> +</div> +<div id="content"> + + <h2>分散ルール</h2> + <h3>概要</h3> + +pgpool.confのparallel_mode=trueの場合に並列問い合わせの設定を定義します。 + <h3>機能</h3> +各カラムのデータ型は以下のとおりです。<p /> +<table> + <tr> + <th class="right_border"><label>カラム名</label></th> + <th class="right_border"><label>データ型</label></th> + <th><label>説明</label></th> + + </tr> + <tr> + <th class="right_border"><label>データベース名</label></th> + <td class="right_border">TEXT</td> + <td>分散を行うデータベース名</td> + </tr> + <tr> + + <th class="right_border"><label>スキーマ名</label></th> + <td class="right_border">TEXT</td> + <td>データベースのスキーマ名</td> + </tr> + <tr> + <th class="right_border"><label>テーブル名</label></th> + <td class="right_border">TEXT</td> + <td>分散を行うテープル</td> + </tr> + + <tr> + <th class="right_border"><label>分散キー列名</label></th> + <td class="right_border">TEXT</td> + <td>分散キーとなる列名</td> + </tr> + + <tr> + <th class="right_border"><label>列名リスト</label></th> + <td class="right_border">TEXT[]</td> + <td>データを分散させるテーブルの列名リスト</td> + </tr> + <tr> + <th class="right_border"><label>列データ型リスト</label></th> + + <td class="right_border">TEXT[]</td> + <td>列名に対する型のリスト</td> + </tr> + <tr> + <th class="right_border"><label>分散関数名</label></th> + <td class="right_border">TEXT</td> + <td>分散ルールを定義した関数名</td> + + </tr> +</table> +<p /> +<h3>追加</h3> +すべてのカラムに値を入力して「追加」ボタンを押します。<br /> +列名リストと列データ型リストについては、各要素をシングルクォーテーションで囲み、各要素をカンマで区切ってください。 +<h3>更新</h3> +更新したい定義のデータベース名をクリックしてください。入力フィールドに値が表示されますので修正して「更新」ボタンを押してください。ただし、データベース名、スキーマ名、テーブル名は変更できません。 +<h3>削除</h3> +削除したい定義のデータベース名をクリックしてください。「削除」ボタンを押してください。確認ダイアログが表示されますので「OK」ボタンを押してください。 +</div><div id="footer"> + <address> + Version 1.0 Alpha<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address> +</div> +</body> +</html> diff --git a/doc/screen.css b/doc/screen.css new file mode 100644 index 0000000..1a13d7b --- /dev/null +++ b/doc/screen.css @@ -0,0 +1,170 @@ +body { + margin: 0; + font: x-small Verdana, Arial, Helvetica, sans-serif; +} +h1 { + margin: 0; +} +h2 { + padding-bottom: 4px; + border-bottom: 1px solid red; + color: red; + font-size: small; +} +h3 { + color: red; + font-size: x-small; +} +ul { + list-style: square; +} +table { + border-top: 1px solid lightsteelblue; + border-collapse: collapse; +} +th, td { + padding: 4px 8px; + border-bottom: 1px solid lightsteelblue; +} +thead th, thead td, tfoot th, tfoot td { + background: ghostwhite; +} +tbody th { + font-weight: normal; + text-align: left; +} +a:link { + color: red; + text-decoration: none; +} +a:visited { + color: maroon; + text-decoration: none; +} +a:link:hover, a:visited:hover { + color: orangered; + text-decoration: underline; +} +a img { + border: none; +} +input { + font: x-small Verdana, Arial, Helvetica, sans-serif; +} +label { + font-weight: bold; +} +#header { + padding: 8px; + border-bottom: 8px solid white; + background: steelblue url("images/sea.jpg") no-repeat bottom right; +} +#menu { + padding-bottom: 40px; + border-top: 1px solid lightsteelblue; + border-right: 1px solid lightsteelblue; + float: left; + width: 176px; + overflow: hidden; + background: ghostwhite; +} +#menu ul { + margin: 0; + padding: 0; + list-style: none; +} +#menu li { + border-bottom: 1px solid lightsteelblue; +} +#menu a:link, #menu a:visited { + padding: 8px 0; + display: block; + color: black; + background: url("images/marker.gif") no-repeat 8px; + text-indent: 16px; + text-decoration: none; +} +#menu a:hover { + background: antiquewhite url("images/marker.gif") no-repeat 8px; +} +#content { + padding: 8px 8px 40px 185px; + border-top: 1px solid lightsteelblue; + background: white url("images/background.gif") repeat-y left; +} +#submenu { + border: 1px solid lightsteelblue; + float: right; + background: ghostwhite; +} +#submenu h3 { + margin: 0; + padding: 4px 8px; + border-bottom: 4px solid white; + color: white; + background: steelblue; + text-align: center; +} +#submenu ul { + margin: 0; + padding: 8px; + border-top: 1px solid lightsteelblue; + list-style: square inside; +} +#footer { + padding: 8px 8px 20px; + clear: left; + color: white; + background: lightsteelblue; +} +#footer address { + font-style: normal; +} +#footer p { + margin: 0; + float: right; +} +#footer a:link, #footer a:visited { + color: white; + font-weight: bold; +} +.hidden { + display: none; +} +.odd { +} +.even { + background: azure; +} +.error { + font-weight: normal; + text-align: left; + background: red; +} +.right_border { + border-right: 1px solid lightsteelblue; + border-collapse: collapse; +} + +#help { + float: right; +} + +#cmd_window { + margin-top : 20px ; + margin-bottom : 20px ; +} +#cmd_window table { + border-top: 1px solid black; + border-collapse: collapse; + width: 70%; +} + +#cmd_window tr td { + border-bottom: 1px solid black; + background: black; + color: white; + font-size: x-small; + padding-left: 10px; + padding-right: 100px; +} diff --git a/help.php b/help.php new file mode 100644 index 0000000..76223f4 --- /dev/null +++ b/help.php @@ -0,0 +1,46 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Call of help of displayed screen + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +$lang = $_SESSION[SESSION_LANG]; + +$help = $_GET['help']; +$tpl->assign('help', $help); + +$tempFile = SMARTY_TEMPLATE_DIR . "/help/$lang/$help" . '.tpl'; + +if( ! file_exists($tempFile)) { + $errorCode = 'e6'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} + +$tpl->assign('isHelp', true); +$tpl->display($tempFile); + +?> diff --git a/images/ascending.gif b/images/ascending.gif Binary files differnew file mode 100644 index 0000000..6438089 --- /dev/null +++ b/images/ascending.gif diff --git a/images/back.gif b/images/back.gif Binary files differnew file mode 100644 index 0000000..c9a71a5 --- /dev/null +++ b/images/back.gif diff --git a/images/background.gif b/images/background.gif Binary files differnew file mode 100644 index 0000000..ed77230 --- /dev/null +++ b/images/background.gif diff --git a/images/descending.gif b/images/descending.gif Binary files differnew file mode 100644 index 0000000..64be7cc --- /dev/null +++ b/images/descending.gif diff --git a/images/logo.gif b/images/logo.gif Binary files differnew file mode 100644 index 0000000..4d63d04 --- /dev/null +++ b/images/logo.gif diff --git a/images/marker.gif b/images/marker.gif Binary files differnew file mode 100644 index 0000000..3ffe323 --- /dev/null +++ b/images/marker.gif diff --git a/images/question.gif b/images/question.gif Binary files differnew file mode 100644 index 0000000..82f564a --- /dev/null +++ b/images/question.gif diff --git a/images/sea.jpg b/images/sea.jpg Binary files differnew file mode 100644 index 0000000..b78332f --- /dev/null +++ b/images/sea.jpg diff --git a/images/spacer.gif b/images/spacer.gif Binary files differnew file mode 100644 index 0000000..fc25609 --- /dev/null +++ b/images/spacer.gif diff --git a/index.php b/index.php new file mode 100644 index 0000000..dc3bffb --- /dev/null +++ b/index.php @@ -0,0 +1,37 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Index page of PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} else { + header('Location: status.php'); + exit(); +} + +?>
\ No newline at end of file diff --git a/innerLog.php b/innerLog.php new file mode 100644 index 0000000..97013d5 --- /dev/null +++ b/innerLog.php @@ -0,0 +1,54 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Log view of Pgpool in status view + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$pgpoolLog = _PGPOOL2_LOG_FILE; +if($pgpoolLog == '') { + $logDir = readLogDir(); + $pgpoolLog = "$logDir/pgpool.log"; +} + +$logFile = @file($pgpoolLog); +if($logFile == false) { + $errorCode = 'e8001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); +} + +$logSplitFile = array(); +for($i=0; $i<count($logFile); $i++) { + $logFile[$i] = split(' +', $logFile[$i], 6); +} + +$tpl->assign('logFile', $logFile); +$tpl->display('innerLog.tpl'); + +?> diff --git a/innerNodeServerStatus.php b/innerNodeServerStatus.php new file mode 100644 index 0000000..7b61b15 --- /dev/null +++ b/innerNodeServerStatus.php @@ -0,0 +1,61 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * View of servers status registered in pgpool.conf + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$healthCheckDb = 'template1'; + +$params = readHealthCheckParam(); + +$healthCheckUser = $params['health_check_user']; + +if(isset($params['backend_hostname'])) { + $backendHostName = $params['backend_hostname']; + $backendPort = $params['backend_port']; +} else { + $backendHostName = array(); +} + +$result = array(); +foreach($backendHostName as $num => $hostname) { + $result[$num]['hostname'] = $backendHostName[$num]; + $result[$num]['port'] = $backendPort[$num]; + + if(NodeActive($num)) { + $result[$num]['status'] = TRUE; + } else { + $result[$num]['status'] = FALSE; + } +} + +$tpl->assign('nodeServerStatus', $result); +$tpl->assign('nodeCount', count($result)); +$tpl->display('innerNodeServerStatus.tpl'); + +?> diff --git a/innerSummary.php b/innerSummary.php new file mode 100644 index 0000000..74e47e2 --- /dev/null +++ b/innerSummary.php @@ -0,0 +1,41 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Infomation of the pgpool summary + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$params = readConfigParams(array('parallel_mode', + 'enable_query_cache', + 'replication_mode', + 'load_balance_mode', + 'health_check_period')); + +$tpl->assign('params', $params); +$tpl->display('innerSummary.tpl'); + +?> diff --git a/innerSystemCatalog.php b/innerSystemCatalog.php new file mode 100644 index 0000000..a3d66d6 --- /dev/null +++ b/innerSystemCatalog.php @@ -0,0 +1,78 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * View of the system catalog selected postgresql server + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$pgCatalog = pg_escape_string($_GET['catalog']); +$nodeNum = $_GET['num']; + +if($pgCatalog == '') { + return; +} + +$params =readHealthCheckParam(); + +$dbParams['hostname'] = $params['backend_hostname'][$nodeNum]; +$dbParams['port'] = $params['backend_port'][$nodeNum]; +$dbParams['dbname'] = 'template1'; +$dbParams['user'] = $params['health_check_user']; +$dbParams['password'] =''; + +$tpl->assign('hostname', $dbParams['hostname'] ); +$tpl->assign('port', $dbParams['port'] ); + +$conn = openDBConnection($dbParams); + +$sql = 'show pool_status'; + +$rs = execQuery($conn, $sql); + +if(!pg_result_status($rs) == PGSQL_TUPLES_OK) { + $sql = "SELECT * FROM $pgCatalog"; + $rs = execQuery($conn, $sql); + $tpl->assign('catalog', $pgCatalog); +} else { + $tpl->assign('catalog', 'pool_status'); +} + +if(!pg_result_status($rs) == PGSQL_TUPLES_OK) { + $errorCode = 'e8001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); +} + +$results = pg_fetch_all($rs); + +closeDBConnection($conn); + +$tpl->assign('results', $results); +$tpl->display('innerSystemCatalog.tpl'); + +?> diff --git a/install/checkDirectory.php b/install/checkDirectory.php new file mode 100644 index 0000000..cae86a9 --- /dev/null +++ b/install/checkDirectory.php @@ -0,0 +1,122 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Check directory used in PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('../version.php'); + +session_start(); + +require_once('setLang.php'); + +$error = false; + +$action = ''; +if(isset($_POST['action'])) { + $action = $_POST['action']; +} + +$templates_c = dirname(dirname(__FILE__) . '/') . '/templates_c'; +if(!is_writable($templates_c)) { + $templates_c = $templates_c . ' write denied'; + $error = true; +} else { + unset($templates_c); +} +$conf = dirname(dirname(__FILE__) . '/') . '/conf/pgmgt.conf.php'; +if(!is_writable($conf)) { + $conf = $conf . ' write denied'; + $error = true; +} else { + unset($conf); +} + +if(!$error && $action == 'next') { + header("Location: checkParameter.php"); +} + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title><? echo $message['strDirectoryCheck'] ?></title> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> + <body> + <div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> + </div> + <div id="content"> + <h2>Welcome to pgpool-II Administration Tool</h2> + <h3><? echo $message['strDirectoryCheck'] ?></h3> + <form action="checkDirectory.php" method="post" name="CheckPath" id="CheckPath"> + <?php + if($error) { + echo '<input type="hidden" name="action" value="check">'; + } else { + echo '<input type="hidden" name="action" value="next">'; + } + ?> +<table> + <tbody> + <tr> + <th><label><?php echo $message['strTempDir'] ?></label></th> + <td> + <?php + if(isset($templates_c)) + echo "<img src='images/ng.gif' alt='ng' /> " . $templates_c; + else + echo "<img src='images/ok.gif' alt='ok' />"; + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPgmgtFile'] ?></label></th> + <td> + <?php + if(isset($conf)) + echo "<img src='images/ng.gif' alt='ng' /> " . $conf; + else + echo "<img src='images/ok.gif' alt='ok' />"; + ?> + </td> + </tr> + </tbody> +</table> +<p> +<?php +if($error) + echo '<input type="submit" value="' . $message['strCheck'] . '" />'; +else + echo '<input type="submit" value="' . $message['strNext'] . '" />'; +?> +</p> +</form> +</div> + <div id="footer"> + <address>Version <?php echo $version;?><br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved.</address> + </div> + </body> +</html> diff --git a/install/checkParameter.php b/install/checkParameter.php new file mode 100644 index 0000000..feaaca2 --- /dev/null +++ b/install/checkParameter.php @@ -0,0 +1,423 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Check parameters used in PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('../version.php'); + +session_start(); + +require("defaultParameter.php"); +require_once('setLang.php'); + +$error = false; + +$action = ''; +if(isset($_POST['action'])) { + $action = $_POST['action']; +} + +$pgpool2_config_file = $_POST['pgpool2_config_file']; +if( !$pgpool2_config_file) { + $pgpool2_config_file = _PGPOOL2_CONFIG_FILE; +} +if(!@is_file($pgpool2_config_file)) { + $msgPgpoolConfigFile = 'No file found'; + $error = true; +} +else { + if(!is_readable($pgpool2_config_file)) { + $msgPgpoolConfigFile = 'Read access denied'; + $error = true; + } + if(!is_writable($pgpool2_config_file)) { + $msgPgpoolConfigFile = 'Write access denied'; + $error = true; + } +} + +$password_file = $_POST['password_file']; +if( !$password_file) { + $password_file = _PGPOOL2_PASSWORD_FILE; +} +if(!@is_file($password_file)) { + $msgPasswordFile = 'No file found'; + $error = true; +} +else { + if(!is_readable($password_file)) { + $msgPasswordFile = 'Read access denied'; + $error = true; + } + if(!is_writable($password_file)) { + $msgPasswordFile = 'Write access denied'; + $error = true; + } +} + +$pgpool_command = $_POST['pgpool_command']; +if( !$pgpool_command) { + $pgpool_command = _PGPOOL2_COMMAND; +} +if(!@is_file($pgpool_command)) { + $msgPgpoolCommand = 'Pgpool not found'; + $error = true; +} +if(!is_executable($pgpool_command)) { + $msgPgpoolCommand = 'Pgppol command can\'t excutable'; + $error = true; +} + +$pgpool_logfile = $_POST['pgpool_logfile']; +if( !$pgpool_logfile) { + $pgpool_logfile = _PGPOOL2_LOG_FILE; +} +if(!is_dir(dirname($pgpool_logfile))) { + $msgPgpoolLogFile = 'No Directory found'; + $error = true; +} +else { + if(!is_writable(dirname($pgpool_logfile))) { + $msgPgpoolLogFile = 'Write access denied'; + $error = true; + } +} + +$pcp_client_dir = $_POST['pcp_client_dir']; +if( !$pcp_client_dir) { + $pcp_client_dir = _PGPOOL2_PCP_DIR; +} +if(!is_dir($pcp_client_dir)) { + $msgPcpClientDir = 'Directory not found'; + $error = true; +} +else { + $command = array('pcp_attach_node', + 'pcp_detach_node', + 'pcp_node_count', + 'pcp_node_info', + 'pcp_proc_count', + 'pcp_proc_info', + 'pcp_stop_pgpool', + 'pcp_systemdb_info'); + + for($i=0; $i<count($command); $i++) { + if(!is_executable($pcp_client_dir . "/" . $command[$i] )) { + $msgPcpClientDir = $command[$i] . ' can\'t excutable'; + $error = true; + } + } +} + +$pcp_hostname = $_POST['pcp_hostname']; +if(!$pcp_hostname) { + $pcp_hostname = _PGPOOL2_PCP_HOSTNAME; + $msgPcpHostname = ''; +} + +$pcp_refreshTime = $_POST['pcp_refreshTime']; +if(!$pcp_refreshTime) { + $pcp_refreshTime = _PGPOOL2_STATUS_REFRESH_TIME; + $msgPcpRefreshTime = ''; +} + +if($error || $_POST['submitBack'] != null) { +} +else { + + $params['lang'] = $_SESSION['lang']; + $params['pgpool2_config_file'] = $pgpool2_config_file; + $params['password_file'] = $password_file; + $params['pcp_client_dir'] = $pcp_client_dir; + $params['pcp_hostname'] = $pcp_hostname; + $params['pcp_refreshTime'] = $pcp_refreshTime; + + $_SESSION['params'] = $params; +} + +if(!$error && $action == 'next') { + + $fp = fopen( "../conf/pgmgt.conf.php", "w"); + + fputs($fp, "<?php"."\n"); + + $str = 'define(\'_PGPOOL2_LANG\', \'' . $_SESSION['lang'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CONFIG_FILE\', \'' . $_POST['pgpool2_config_file'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PASSWORD_FILE\', \'' . $_POST['password_file'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_COMMAND\', \'' . $_POST['pgpool_command'] . '\');' . "\n"; + fputs($fp, $str); + + if(isset($_POST['c'])) { + $c = 1; + } else { + $c = 0; + } + + if(isset($_POST['d'])) { + $d = 1; + } else { + $d = 0; + } + + if(isset($_POST['n'])) { + $n = 1; + } else { + $n = 0; + } + + $str = 'define(\'_PGPOOL2_CMD_OPTION_C\', \'' . $c . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_D\', \'' . $d . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_M\', \'' . $_POST['m'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_CMD_OPTION_N\', \'' . $n . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_LOG_FILE\', \'' . $_POST['pgpool_logfile'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PCP_DIR\', \'' . $_POST['pcp_client_dir'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PCP_HOSTNAME\', \'' . $_POST['pcp_hostname'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_PCP_TIMEOUT\', \'' . $_POST['pcp_timeout'] . '\');' . "\n"; + fputs($fp, $str); + + $str = 'define(\'_PGPOOL2_STATUS_REFRESH_TIME\', \'' . $_POST['pcp_refreshTime'] . '\');' . "\n"; + fputs($fp, $str); + + fputs($fp, "?>"."\n"); + + fclose($fp); + + header("Location: finish.php"); +} +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title><?php echo $message['strParameterCheck']; ?></title> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> + <body> + <div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> + </div> + <div id="content"> + <h2>Welcome to pgpool-II Administration Tool</h2> + <h3><?php echo $message['strParameterCheck']; ?></h3> + <form action="checkParameter.php" method="post" name="CheckPath" id="CheckPath"> + <?php + if($error) { + echo '<input type="hidden" name="action" value="check">'; + } else { + echo '<input type="hidden" name="action" value="next">'; + } + ?> +<table> + <tbody> + <tr> + <th><label><?php echo $message['strPgConfFile'] ?></label></th> + <td><input name="pgpool2_config_file" type="text" value="<?php echo $pgpool2_config_file?>" size="50" /> + <?php + if($msgPgpoolConfigFile != '') { + echo '<br />' . $msgPgpoolConfigFile; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPasswordFile'] ?></label></th> + <td><input name="password_file" type="text" value="<?php echo $password_file ?>" size="50" /> + <?php + if($msgPasswordFile != '') { + echo '<br />' . $msgPasswordFile; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPgpoolCommand'] ?></label></th> + <td><input name="pgpool_command" type="text" value="<?php echo $pgpool_command ?>" size="50" /> + <?php + if($msgPgpoolCommand != '') { + echo '<br />' . $msgPgpoolCommand; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th colspan="3"><label><?php echo $message['strPgpoolCommandOption'] ?></label></th> + </tr> + <tr> + <th><label><?php echo $message['strCmdC'] ?></label></th> + <td><input type="checkbox" name="c" /></td> + <?php + if($msgCmdC != '') { + echo '<br />' . $msgCmdC; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strCmdN'] ?></label></th> + <td><input type="checkbox" name="n" /></td> + <?php + if($msgCmdN != '') { + echo '<br />' . $msgCmdN; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strCmdD'] ?></label></th> + <td><input type="checkbox" name="d" /></td> + <?php + if($msgCmdD != '') { + echo '<br />' . $msgCmdD; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strCmdM'] ?></label></th> + <td><select name="m" /> + <option value="s" selected="selected">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + </select> + </td> + <?php + if($msgCmdM != '') { + echo '<br />' . $msgCmdM; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPgpoolLogFile'] ?></label></th> + <td><input name="pgpool_logfile" type="text" value="<?php echo $pgpool_logfile ?>" size="50" /> + <?php + if($msgPgpoolLogFile != '') { + echo '<br />' . $msgPgpoolLogFile; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + + <tr> + <th><label><?php echo $message['strPcpDir'] ?></label></th> + <td><input name="pcp_client_dir" type="text" value="<?php echo $pcp_client_dir ?>" size="50" /> + <?php + if($msgPcpClientDir != '') { + echo '<br />' . $msgPcpClientDir; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPcpHostName'] ?></label></th> + <td><input name="pcp_hostname" type="text" value="<?php echo $pcp_hostname ?>" size="50" /> + <?php + if($msgPcpHostname != '') { + echo '<br />' . $msgPcpHostname; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + <tr> + <th><label><?php echo $message['strPcpRefreshTime'] ?></label></th> + <td><input name="pcp_refreshTime" type="text" value="<?php echo $pcp_refreshTime ?>" size="50" /> + <?php + if($msgPcpRefreshTime != '') { + echo '<br />' . $msgPcpRefreshTime; + echo '</td><td><img src="images/ng.gif" alt="ng" />'; + } else { + echo '</td><td><img src="images/ok.gif" alt="ok" />'; + } + ?> + </td> + </tr> + </tbody> +</table> +<p> +<?php +if($error) { +echo '<input type="submit" value="' . $message['strCheck'] . '" />'; +} +else { +echo '<input type="submit" value="' . $message['strNext'] . '" />'; +} +?> +</p> +</form> +</div> + <div id="footer"> + <address>Version <?php echo $version;?><br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved.</address> + </div> + </body> +</html> diff --git a/install/defaultParameter.php b/install/defaultParameter.php new file mode 100644 index 0000000..245c441 --- /dev/null +++ b/install/defaultParameter.php @@ -0,0 +1,39 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Default parameters of PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +define("_PGPOOL2_CONFIG_FILE", "/usr/local/etc/pgpool.conf"); +define("_PGPOOL2_PASSWORD_FILE", "/usr/local/etc/pcp.conf"); +define("_PGPOOL2_COMMAND", "/usr/local/bin/pgpool"); +define("_PGPOOL2_CMD_OPTION_C", "0"); +define("_PGPOOL2_CMD_OPTION_D", "0"); +define("_PGPOOL2_CMD_OPTION_M", "s"); +define("_PGPOOL2_CMD_OPTION_N", "0"); +define("_PGPOOL2_LOG_FILE", "/tmp/pgpool.log"); +define("_PGPOOL2_PCP_DIR", "/usr/local/bin"); +define("_PGPOOL2_PCP_HOSTNAME", "localhost"); +define("_PGPOOL2_PCP_TIMEOUT", "10"); +define("_PGPOOL2_STATUS_REFRESH_TIME", "0"); + +?>
\ No newline at end of file diff --git a/install/finish.php b/install/finish.php new file mode 100644 index 0000000..9c44709 --- /dev/null +++ b/install/finish.php @@ -0,0 +1,58 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Write pgmgt.conf.php, then finish + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('../version.php'); + +session_start(); + +require_once('setLang.php'); + +$installDir = dirname(__FILE__); + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title><?php echo $message['msgCongratulations']; ?></title> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> + <body> + <div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> + </div> + <div id="content"> + <h2>Welcome to pgpool-II Administration Tool</h2> + <h3><?php echo $message['msgCongratulations'] ?></h3> + <?php echo $installDir . $message['msgDeleteInstallDir'] ?> + <p><a href='../index.php'><?php echo $message['msgToTop'] ?></a></p> +</div> + <div id="footer"> + <address>Version <?php echo $version;?><br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved.</address> + </div> + </body> +</html> + diff --git a/install/images/ng.gif b/install/images/ng.gif Binary files differnew file mode 100644 index 0000000..b10aca7 --- /dev/null +++ b/install/images/ng.gif diff --git a/install/images/ok.gif b/install/images/ok.gif Binary files differnew file mode 100644 index 0000000..ee85496 --- /dev/null +++ b/install/images/ok.gif diff --git a/install/index.php b/install/index.php new file mode 100644 index 0000000..d9aae36 --- /dev/null +++ b/install/index.php @@ -0,0 +1,76 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * First access in install process + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('../version.php'); + +$messageList = array(); +$res_dir = opendir('lang/'); +while($file_name = readdir( $res_dir )) { + if(ereg('^[^\.]', $file_name)) { + include('lang/' . $file_name); + $messageList[$message['lang']] = $message['strLang']; + } +} + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<title>Welcome to pgpool-II Administration Tool</title> +<link href="../screen.css" rel="stylesheet" type="text/css" /> +</head> + <body> + <div id="header"> + <h1><img src="../images/logo.gif" alt="pgpoolAdmin" /></h1> + </div> + <div id="content"> + <h2>Welcome to pgpool-II Administration Tool</h2> +<form action="checkDirectory.php" method="post" name="CheckPath" id="CheckPath"> +<table> + <tbody> + <tr> + <th><label>Language</label></th> + <td> + <select name="lang"> + <?php + foreach ($messageList as $key => $str) { + echo "<option value='$key' >$str</option>\n"; + } + ?> + </select> + </td> + </tr> + </tbody> +</table> +<p><input type="submit" value="Next" /></p> +</form> +</div> + <div id="footer"> + <address>Version <?php echo $version;?><br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved.</address> + </div> + </body> +</html> diff --git a/install/lang/en.lang.php b/install/lang/en.lang.php new file mode 100644 index 0000000..640ea04 --- /dev/null +++ b/install/lang/en.lang.php @@ -0,0 +1,57 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Message catalog in English + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +$message = array( + 'lang' => 'en', + 'strLang' => 'English', + 'strNext' => 'Next', + 'strCheck' => 'Check', + 'strDirectoryCheck' => 'Directory Cehck', + 'strParameterCheck' => 'Parameter Setting', + 'strFinish' => 'Finish', + 'strPgConfFile' => 'pgpool.conf File', + 'strPasswordFile' => 'Password file', + 'strPgmgtFile' => 'pgpoolAdmin Setting File', + 'strTempDir' => 'Template Directory', + 'strPgpoolCommand' => 'Pgpool Command', + 'strPgpoolCommandOption' => 'Pgpool Command Option', + 'strCmdC' => 'Clears query cache', + 'strCmdD' => 'debug mode', + 'strCmdM' => 'stop mode', + 'strCmdN' => 'don\'t run in daemon mode', + 'strCmdPgpoolFile' => 'pgpool.conf', + 'strCmdPcpFile' => 'pcp.conf', + 'strCmdDesc' => 'If it is a blank, this option is ignored.', + 'strPgpoolLogFile' => 'Pgpool Logfile', + 'strPcpDir' => 'PCP directory', + 'strPcpTimeout' => 'PCP Timeout', + 'strPcpHostName' => 'PCP Hostname', + 'strPcpRefreshTime' => 'Refresh Time', + 'msgCongratulations' => 'Congratulations. Pgpool Administration Tool was installed!', + 'msgDeleteInstallDir' => ' : Please remove this directory', + 'msgToTop' => 'top' +); + +?> diff --git a/install/lang/ja.lang.php b/install/lang/ja.lang.php new file mode 100644 index 0000000..df76304 --- /dev/null +++ b/install/lang/ja.lang.php @@ -0,0 +1,57 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Message catalog in Japanese + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +$message = array( + 'lang' => 'ja', + 'strLang' => '日本語', + 'strNext' => '次へ', + 'strCheck' => 'チェック', + 'strDirectoryCheck' => 'ディレクトリ確認', + 'strParameterCheck' => '管理ツールパラメータ設定', + 'strFinish' => '完了', + 'strPgConfFile' => 'pgpool.confファイル', + 'strPasswordFile' => 'パスワードファイル', + 'strPgmgtFile' => '管理ツール設定ファイル', + 'strTempDir' => 'テンプレートディレクトリ', + 'strPgpoolCommand' => 'Pgpoolコマンド', + 'strPgpoolCommandOption' => 'pgpoolコマンドオプション', + 'strCmdC' => 'クエリキャッシュクリア', + 'strCmdD' => 'デバッグモード', + 'strCmdM' => '停止モード', + 'strCmdN' => '非デーモンモード', + 'strCmdPgpoolFile' => 'pgpool.conf', + 'strCmdPcpFile' => 'pcp.conf', + 'strCmdDesc' => '空白の場合には無視', + 'strPgpoolLogFile' => 'Pgpoolログファイル', + 'strPcpDir' => 'PCPディレクトリ', + 'strPcpTimeout' => 'PCPタイムアウト', + 'strPcpHostName' => 'PCPホスト名', + 'strPcpRefreshTime' => '更新間隔(0で自動更新しない)', + 'msgCongratulations' => 'おめでとうございます。インストールは終了しました。', + 'msgDeleteInstallDir' => 'を削除してください', + 'msgToTop' => 'トップ画面へ移動' +); + +?> diff --git a/install/setLang.php b/install/setLang.php new file mode 100644 index 0000000..4f8c9ce --- /dev/null +++ b/install/setLang.php @@ -0,0 +1,43 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Set to language + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('../version.php'); + +if(!isset($_POST['lang']) && !isset($_SESSION['lang'])) { + $lang = 'en'; +} +else { + if(isset($_POST['lang'])) { + $lang = $_POST['lang']; + $_SESSION['lang'] = $lang; + } + else { + $lang = $_SESSION['lang']; + } +} + +include('lang/'. $lang . '.lang.php'); + +?> diff --git a/lang/en.lang.php b/lang/en.lang.php new file mode 100644 index 0000000..5957aad --- /dev/null +++ b/lang/en.lang.php @@ -0,0 +1,250 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Message catalog in English + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +$message = array( + 'lang' => 'en', + 'strLang' => 'English', + 'descBackend_hostname' => 'The real PostgreSQL server name pgpool could connect', + 'descBackend_port' => 'The port number where real PostgreSQL server is running on', + 'descBackend_socket_dir' => 'The socket directory PostgreSQL could connect', + 'descBackend_weight' => 'Load balance weight when pgpool is running in the state of load balance mode', + 'descChild_life_time' => 'Life of a idle child process in seconds', + 'descChild_max_connections' => 'If child_max_connections connections were received, child exits', + 'descConnection_cache' => 'If true, cache connections to PostgreSQL', + 'descConnection_life_time' => 'Life time for each idle connection in seconds', + 'descEnable_query_cache' => 'Perform query cache', + 'descHealth_check_period' => 'Specifies the interval for next health checking. 0 means no health checking', + 'descHealth_check_timeout' => 'Pgpool does "health check" periodically to detect PostgreSQL servers down, network communication problems or as such', + 'descHealth_check_user' => 'PostgreSQL user name for the health checking', + 'descIgnore_leading_white_space' => 'If true, ignore leading white spaces of each query while pgpool judges if the query is a SELECT so that it can be load balanced', + 'descInsert_lock' => ' If you replicate a table having SERIAL data type column, sometimes the serial value does not match between servers', + 'descListen_addresses' => 'Specifies the addresses to listen on for TCP/IP connections', + 'descLoad_balance_mode' => 'Perform load balancing for SELECT', + 'descLog_statement' => 'If true, print all statements to the log', + 'descLogdir' => 'The directory name to store pgpool\'s log files', + 'descMaster_slave_mode' => 'Run in master/slave mode', + 'descMax_pool' => 'Number of connection pools each pgpool server process are keeping', + 'descNum_init_children' => 'Number of pgpool process initially forked', + 'descParallel_mode' => 'Run in parallel mode', + 'descPcp_port' => 'The port number where pcp is running on', + 'descPcp_socket_dir' => 'The socket directory pcp could connect', + 'descPcp_timeout' => 'When there is no response in this time from client, it disconnect and stop', + 'descPgpool2_hostname' => 'Pgpool2 server name where running on', + 'descPort' => 'The port number where pgpool is running on', + 'descPrint_timestamp' => 'If true timestamp is added to each log line', + 'descReplication_mode' => 'Set this true if you are going to use replication functionality', + 'descReplication_stop_on_mismatch' => 'Stop replication mode on data mismatch between master and secondary', + 'descReplication_strict' => 'If true, pgpool will wait for the completion of the master query before sending a query to the secondary server', + 'descReplication_timeout' => 'In non strict replication mode, there will be a chance of deadlock', + 'descReset_query_list' => 'Semicolon separated SQL commands to be issued at the end of session', + 'descSocket_dir' => 'The socket directory pgpool could connect', + 'descSystem_db_dbname' => 'The database name of system database', + 'descSystem_db_hostname' => 'The server name system database running on', + 'descSystem_db_password' => 'The password of system database who connects system database', + 'descSystem_db_port' => 'The port number system database could connect', + 'descSystem_db_schema' => 'The schema name of system database', + 'descSystem_db_user' => 'The username when connection system database', + 'errAlreadyExist' => 'It is already exist.', + 'errFileNotExecutable' => 'File can\'t executable', + 'errFileNotFound' => 'File not found', + 'errFileNotWritable' => 'File can\'t write', + 'errIllegalHostname' => 'Illegal Hostname', + 'errInputEverything' => 'Please input all items', + 'errNoDefined' => 'No defined Parameter', + 'errNotSameLength' => 'The array length of col_list is not corresponding to that of type_list. It should be the same number of elements.', + 'errPasswordMismatch' => 'The password is a mismatch', + 'errRequired' => 'This is reqired', + 'errShouldBeInteger' => 'This should be an integer', + 'errShouldBeZeroOrMore' => 'This should be 0 or more', + 'errSingleQuotation' => 'Please enclose the array element with a single quotation.', + 'msgDeleteConfirm' => 'May I really delete it?', + 'msgMasterDbConnectionError' => 'Mater DB connection failed', + 'msgPgpoolConfNotFound' => 'pgpool.conf not found', + 'msgPleaseSetup' => 'No found configuration file. Please execute the setup.', + 'msgRestart' => 'Please Restart to reflect the change', + 'msgRestartPgpool' => 'May I really restart pgpool?', + 'msgSameAsPasswordFile' => 'The value is the same as item Password File', + 'msgSameAsPgpoolFile' => 'The value is the same as item pgpool.conf File', + 'msgStopPgpool' => 'May I really stop pgpool?', + 'msgUpdateComplete' => 'Update complete', + 'msgUpdateFailed' => 'Update failed', + 'strAdd' => 'Add', + 'strAdminPassword' => 'Password', + 'strBack' => 'Back', + 'strCancel' => 'Cancel', + 'strChangePassword' => 'Change Password', + 'strClear' => 'Clear', + 'strClearQueryCache' => 'Clear Query Cache', + 'strCmdC' => 'Clears query cache', + 'strCmdD' => 'Debug mode', + 'strCmdDesc' => 'If it is a blank, this option is ignored.', + 'strCmdM' => 'Stop mode', + 'strCmdN' => 'Don\'t run in daemon mode', + 'strCmdPcpFile' => 'pcp.conf', + 'strCmdPgpoolFile' => 'pgpool.conf', + 'strColList' => 'Column List', + 'strColName' => 'Column Name of Distributed key', + 'strCommon' => 'Common', + 'strConnectionError' => 'Connection Error', + 'strConnTime' => 'Connection Create Time', + 'strConnUsed' => 'Use of Connection', + 'strConnUser' => 'Username', + 'strCreateTime' => 'Create Time', + 'strDataError' => 'Data Error', + 'strDateFormat' => 'M j G:i:s T Y', + 'strDb' => 'Database', + 'strDbName' => 'Database Name', + 'strDebug' => 'Debug Mode', + 'strDelete' => 'Delete', + 'strDeleted' => 'lines were deleted', + 'strDetail' => 'Detail', + 'strDetailInfo' => 'Detail Infomation', + 'strDisconnect' => 'Disconnect', + 'strDistDefFunc'=> 'Distributed Function Name', + 'strDown' => 'Down', + 'strError' => 'Error', + 'strErrorCode' => 'Error Code', + 'strErrorMessage' => 'Error Message', + 'strExecute' => 'Execute', + 'strFeature' => 'Feature', + 'strHealthCheck' => 'Health Check', + 'strHelp' => 'Help', + 'strInvalidation' => 'Invalidation', + 'strIPaddress' => 'IP Address', + 'strLanguage' => 'Language', + 'strLoadBalanceMode' => 'Load Balance Mode', + 'strLog' => 'Log', + 'strLogin' => 'Login', + 'strLoginName' => 'Login Name', + 'strLogout' => 'Logout', + 'strMasterServer' => 'Master Server', + 'strMeasures' => 'Measures', + 'strNodeInfo' => 'Node Info.', + 'strNodeStatus' => 'Node Status', + 'strNodeStatus1' => 'Up. Disconnect', + 'strNodeStatus2' => 'Up. Connected', + 'strNodeStatus3' => 'Down', + 'strNoNode' => 'There is no node', + 'strOff' => 'Off', + 'strOn' => 'On', + 'strParallelMode' => 'Parallel Mode', + 'strParameter' => 'Parameter', + 'strPassword' => 'Password', + 'strPasswordConfirmation' => 'Password Confirmation', + 'strPasswordFile' => 'Password File', + 'strPcpConfFile' => 'pcp.conf File', + 'strPcpDir' => 'PCP Directory', + 'strPcpHostName' => 'PCP Hostname', + 'strPcpRefreshTime' => 'Refresh Time', + 'strPcpTimeout' => 'PCP Timeout', + 'strPgConfFile' => 'pgpool.conf File', + 'strPgConfSetting' => 'pgpool.conf Setting', + 'strPgpool' => 'pgpool', + 'strPgpool1' => 'pgpool-I', + 'strPgpool2' => 'pgpool-II', + 'strPgpoolCommand' => 'pgpool Command', + 'strPgpoolCommandOption' => 'pgpool Command Option', + 'strPgpoolLogFile' => 'pgpool Logfile', + 'strPgpoolManagementSystem' => 'pgpool-II Management System', + 'strPgpoolServer' => 'pgpool-II Server', + 'strPgpoolStatus' => 'pgpool Status', + 'strPgpoolSummary' => 'Summary', + 'strPleaseWait' => 'Please wait...', + 'strPort' => 'Port', + 'strProcId' => 'Process ID', + 'strProcInfo' => 'Process Info.', + 'strProcTime' => 'Process Start Time', + 'strProtocolMajorVersion' => 'Protocol Major Version', + 'strProtocolNinorVersion' => 'Protocol Minor Version', + 'strQueryCache' => 'Query Cache', + 'strQueryStr' => 'Query', + 'strReplicationMode' => 'Replication Mode', + 'strReset' => 'Reset', + 'strRestart' => 'Restart', + 'strRestartOption' => 'pgpool Restart Option', + 'strRestartPgpool' => 'Restart pgpool', + 'strReturn' => 'Return', + 'strSchemaName' => 'Schema Name', + 'strSearch' => 'Search', + 'strSecondaryServer' => 'Secondary Server', + 'strSetting' => 'pgpoolAdmin Setting', + 'strSetup' => 'Setup', + 'strStartOption' => 'Start Option', + 'strStartPgpool' => 'Start pgpool', + 'strStatus' => 'Status', + 'strStopOption' => 'pgpool Stop Option', + 'strStopPgpool' => 'Stop pgpool', + 'strSummary' => 'Summary', + 'strSystemDb' => 'Partitioning Rule', + 'strTable' => 'Table', + 'strTypeList' => 'Type List of Column', + 'strUp' => 'Up', + 'strUpdate' => 'Update', + 'strValue' => 'Value', + 'strWeight' => 'Weight', + 'e1' => 'No found pgmgt.conf.php.', + 'e2' => 'No found message catalog.', + 'e3' => 'PCP command error occurred.', + 'e4' => 'No found pgpool.conf.', + 'e5' => 'No found Smarty template file.', + 'e6' => 'No found help.', + 'e8' => 'No found pcp_timeout in pgpool.conf', + 'e9' => 'No found pcp_timeout in pgpool.conf', + 'e7' => 'No found Parameter in pgpmgt.conf.php', + 'e1001' => 'PCP command error occurred.', + 'e1002' => 'pcp_node_count command error occurred.', + 'e1003' => 'pcp_node_info command error occurred.', + 'e1004' => 'pcp_proc_count command error occurred.', + 'e1005' => 'pcp_proc_info command error occurred.', + 'e1006' => 'pcp_stop_pgpool command error occurred.', + 'e1007' => 'pcp_detach_node command error occurred.', + 'e1008' => 'No found pgpool.conf.', + 'e1009' => 'No found pcp.conf.', + 'e1010' => 'pcp_attach_node command error occurred.', + 'e1011' => 'No found log ifle.', + 'e2001' => 'Database connection error occurred.', + 'e2002' => 'The error occurred when SELECT was executed', + 'e2003' => 'No found pgpool.conf.', + 'e3001' => 'Database connection error occurred.', + 'e3002' => 'The SQL error occurred when SELECT was executed', + 'e3003' => 'The SQL error occurred when INSERT was executed', + 'e3004' => 'The SQL error occurred when UPDATE was executed', + 'e3005' => 'The SQL error occurred when DELETE was executed', + 'e3006' => 'No found pgpool.conf.', + 'e4001' => 'No found pgpool.conf.', + 'e4002' => 'It is not possible to read to pgpool.conf. ', + 'e4003' => 'It is not possible to write to pgpool.conf. ', + 'e5001' => 'No found pgmgt.conf.php.', + 'e5002' => 'It is not possible to read to pgmgt.conf.php.', + 'e5003' => 'It is not possible to write to pgmgt.conf.php.', + 'e6001' => 'No found pcp.conf', + 'e6002' => 'It is not possible to read to pcp.conf. ', + 'e6003' => 'It is not possible to write to pcp.conf. ', + 'e7001' => 'No found pcp.conf.', + 'e8001' => 'Detailed information cannot be acquired.', + +); + +?> diff --git a/lang/ja.lang.php b/lang/ja.lang.php new file mode 100644 index 0000000..a006e28 --- /dev/null +++ b/lang/ja.lang.php @@ -0,0 +1,253 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Message catalog in Japanese + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +$message = array( + 'lang' => 'ja', + 'strLang' => '日本語', + 'descBackend_hostname' => 'pgpoolが接続するPostgreSQLサーバ(postmaster)が動いているホスト名', + 'descBackend_port' => 'PostgreSQLサーバのポート番号', + 'descBackend_socket_dir' => 'PostgreSQLサーバのUnix domain socketのディレクトリ', + 'descBackend_weight' => 'ロードバランスモード時のSELECTを振り分ける「重み」の定義', + 'descChild_life_time' => 'pgpoolの子プロセスの寿命', + 'descChild_max_connections' => '各pgpool子プロセスが終了するまでの接続回数', + 'descConnection_cache' => 'コネクションをキャッシュ', + 'descConnection_life_time' => 'コネクションプール中のコネクションの有効期間(秒)', + 'descEnable_query_cache' => 'クエリキャッシュ機能の有効化', + 'descHealth_check_period' => 'ヘルスチェックを行う間隔(秒)', + 'descHealth_check_timeout' => 'ヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値(秒)', + 'descHealth_check_user' => 'ヘルスチェックを行うためのPostgreSQLユーザ名', + 'descIgnore_leading_white_space' => 'trueならば、load balanceの際にSQL文行頭の空白を無視', + 'descInsert_lock' => '自動的にトランザクションの開始,テーブルロック,トランザクションの終了', + 'descListen_addresses' => 'TCP/IPコネクションを受け付けるアドレス', + 'descLoad_balance_mode' => 'レプリケーションモード時にSELECT文を各ノードにロードバランス', + 'descLog_statement' => 'trueならばSQL文をログ出力', + 'descLogdir' => 'pgpoolの各種ログファイルを格納するディレクトリ', + 'descMaster_slave_mode' => 'マスタ/スレーブモードでpgpoolを運転', + 'descMax_pool' => 'pgpoolの各サーバプロセスがキープするPostgreSQLへの最大コネクション数', + 'descNum_init_children' => 'preforkするpgpoolのサーバプロセス数', + 'descParallel_mode' => 'パラレルモードでpgpoolを運転', + 'descPcp_port' => 'pgpool-IIが受け付けているポート番号', + 'descPcp_socket_dir' => 'pcpがコネクションを受け付けるUnix domain socketディレクトリ', + 'descPcp_timeout' => 'この時間内にクライアントから応答がない場合はコネクションを切断して終了', + 'descPgpool2_hostname' => 'pgpool2 が動作しているホスト名', + 'descPort' => 'pgpoolがコネクションを受け付けるポート番号', + 'descPrint_timestamp' => 'pgpoolのログにタイムスタンプを追加', + 'descReplication_mode' => 'レプリケーションモードの有効化', + 'descReplication_stop_on_mismatch' => 'trueを指定するとマスタとセカンダリの間でデータの不一致があった場合に強制的に縮退運転', + 'descReplication_strict' => 'masterの問い合わせ処理の完了を待ってからsecondaryの処理', + 'descReplication_timeout' => 'replication_strictがfalseのときにデッドロックを監視するためのタイムアウト時間', + 'descReset_query_list' => 'セッションが終了するときにコネクションを初期化するためのSQLコマンド', + 'descSocket_dir' => 'pgpoolがコネクションを受け付けるUnix domain socketディレクトリ', + 'descSystem_db_dbname' => 'System DBのデータベース名', + 'descSystem_db_hostname' => 'System DBが動いているホスト名', + 'descSystem_db_password' => 'System DBに接続するユーザのパスワード', + 'descSystem_db_port' => 'System DBに接続するためのポート番号', + 'descSystem_db_schema' => 'System DBのスキーマ', + 'descSystem_db_user' => 'System DBに接続するときのユーザ名', + 'errAlreadyExist' => 'すでに登録されています', + 'errFileNotExecutable' => 'コマンドを実行できません', + 'errFileNotFound' => 'ファイルが見つかりません', + 'errFileNotWritable' => 'ファイルの書き込みができません', + 'errIllegalHostname' => '不正なホスト名です', + 'errInputEverything' => 'すべてを入力してください', + 'errNoDefined' => 'パラメータが設定されていません', + 'errNotSameLength' => '列名リストと列データ型リストの配列の長さが一致しません。同じ要素数である必要があります。', + 'errPasswordMismatch' => 'パスワードが一致しません', + 'errRequired' => 'これは必須項目です', + 'errShouldBeInteger' => '0以上の整数を入力してください', + 'errShouldBeZeroOrMore' => '0以上である必要があります', + 'errSingleQuotation' => '配列要素をシングルクォーテーションで囲んでください。', + 'msgDeleteConfirm' => '本当に削除してよいですか?', + 'msgMasterDbConnectionError' => 'マスターDBに接続できません', + 'msgPgpoolConfNotFound' => 'pgpool.confが見つかりません', + 'msgPleaseSetup' => '設定ファイルが見つかりません。セットアップを実行してください。', + 'msgRestart' => '変更を反映するには再起動してください', + 'msgRestartPgpool' => 'pgpoolを再起動してよいですか?', + 'msgSameAsPasswordFile' => '値はパスワードファイルの設定値となります', + 'msgSameAsPgpoolFile' => '値はpgpool.confファイルの設定値となります', + 'msgStopPgpool' => 'pgpoolを停止してよいですか?', + 'msgUpdateComplete' => '更新は正常に終了しました', + 'msgUpdateFailed' => '更新に失敗しました', + 'strAdd' => '追加', + 'strAdminPassword' => '管理者パスワード', + 'strBack' => '戻る', + 'strCancel' => 'キャンセル', + 'strChangePassword' => 'パスワード変更', + 'strClear' => 'クリア', + 'strClearQueryCache' => 'クエリキャッシュ削除', + 'strCmdC' => 'クエリキャッシュクリア', + 'strCmdD' => 'デバッグモード', + 'strCmdDesc' => '空白の場合には無視', + 'strCmdM' => '停止モード', + 'strCmdN' => '非デーモンモード', + 'strCmdPcpFile' => 'pcp.conf', + 'strCmdPgpoolFile' => 'pgpool.conf', + 'strColList' => '列名リスト', + 'strColName' => '分散キー列名', + 'strCommon' => '共通', + 'strConnectionError' => 'コネクションエラー', + 'strConnTime' => 'コネクション作成時刻', + 'strConnUsed' => 'コネクション使用回数', + 'strConnUser' => '接続ユーザ名', + 'strCreateTime' => '作成時刻', + 'strDataError' => 'データエラー', + 'strDateFormat' => 'Y年m月d日 H時i分s秒', + 'strDb' => 'データベース名', + 'strDbName' => 'データベース名', + 'strDebug' => 'デバッグモード', + 'strDelete' => '削除', + 'strDeleted' => 'レコードが削除されました', + 'strDetail' => '詳細', + 'strDetailInfo' => '詳細情報', + 'strDisconnect' => '切断', + 'strDistDefFunc'=> '分散関数名', + 'strDown' => 'ダウン', + 'strError' => 'エラー', + 'strErrorCode' => 'エラーコード', + 'strErrorMessage' => 'エラーメッセージ', + 'strExecute' => '実行', + 'strFeature' => '機能', + 'strHealthCheck' => 'ヘルスチェック', + 'strHelp' => 'ヘルプ', + 'strInvalidation' => '無効', + 'strIPaddress' => 'IPアドレス', + 'strLanguage' => '言語', + 'strLoadBalanceMode' => 'ロードバランスモード', + 'strLog' => 'ログ', + 'strLogin' => 'ログイン', + 'strLoginName' => 'ログイン名', + 'strLogout' => 'ログアウト', + 'strMasterServer' => 'マスターサーバ', + 'strMeasures' => '対策', + 'strNodeInfo' => 'ノード情報', + 'strNodeStatus' => 'ノードステータス', + 'strNodeStatus1' => 'ノード稼働中。接続無し', + 'strNodeStatus2' => 'ノード稼働中。接続有り', + 'strNodeStatus3' => 'ノードダウン', + 'strNoNode' => 'ノードがありません', + 'strOff' => 'オフ', + 'strOn' => 'オン', + 'strParallelMode' => 'パラレルモード', + 'strParameter' => '項目', + 'strPassword' => 'パスワード', + 'strPasswordConfirmation' => 'パスワード(確認)', + 'strPasswordFile' => 'パスワードファイル', + 'strPcpConfFile' => 'pcp.confファイル', + 'strPcpDir' => 'PCPディレクトリ', + 'strPcpHostName' => 'PCPホスト名', + 'strPcpRefreshTime' => '更新間隔(0で自動更新しない)', + 'strPcpTimeout' => 'PCPタイムアウト', + 'strPgConfFile' => 'pgpool.confファイル', + 'strPgConfSetting' => 'pgpool.conf設定', + 'strPgpool' => 'pgpool', + 'strPgpool1' => 'pgpool-I', + 'strPgpool2' => 'pgpool-II', + 'strPgpoolCommand' => 'pgpoolコマンド', + 'strPgpoolCommandOption' => 'pgpoolコマンドオプション', + 'strPgpoolLogFile' => 'pgpoolログファイル', + 'strPgpoolManagementSystem' => 'pgpool-II管理システム', + 'strPgpoolServer' => 'pgpool-IIサーバ', + 'strPgpoolStatus' => 'pgpoolステータス', + 'strPgpoolSummary' => 'サマリー', + 'strPleaseWait' => 'しばらくお待ちください・・・', + 'strPort' => 'ポート', + 'strProcId' => 'プロセスID', + 'strProcInfo' => 'プロセス情報', + 'strProcTime' => 'プロセススタート時刻', + 'strProtocolMajorVersion' => 'プロトコルメジャーバージョン', + 'strProtocolNinorVersion' => 'プロトコルマイナーバージョン', + 'strQueryCache' => 'クエリキャッシュ', + 'strQueryStr' => 'クエリ文字列', + 'strReplicationMode' => 'レプリケーションモード', + 'strReset' => 'リセット', + 'strRestart' => '再起動', + 'strRestartOption' => 'pgpool再起動オプション', + 'strRestartPgpool' => 'pgpool再起動', + 'strReturn' => '復帰', + 'strSchemaName' => 'スキーマ名', + 'strSearch' => '検索', + 'strSecondaryServer' => 'セカンダリサーバ', + 'strSetting' => '管理ツール設定', + 'strSetup' => 'セットアップ', + 'strStartOption' => '起動オプション', + 'strStartPgpool' => 'pgpool起動', + 'strStatus' => 'ステータス', + 'strStopOption' => 'pgpool停止オプション', + 'strStopPgpool' => 'pgpool停止', + 'strSummary' => '概要', + 'strSystemDb' => '分散ルール', + 'strTable' => 'テーブル名', + 'strTypeList' => '列データ型リスト', + 'strUp' => 'アップ', + 'strUpdate' => '更新', + 'strValue' => '値', + 'strWeight' => 'ウェイト', + 'e1' => 'pgmgt.conf.phpが見つかりません', + 'e2' => 'メッセージカタログが見つかりません', + 'e3' => 'pcpコマンドエラーが発生しました', + 'e1' => 'pgmgt.conf.phpが見つかりません', + 'e2' => 'メッセージカタログが見つかりません', + 'e3' => 'pcpコマンドエラーが発生しました', + 'e4' => 'pgpool.confが見つかりません', + 'e5' => 'テンプレートファイルが見つかりません', + 'e6' => 'ヘルプが見つかりません', + 'e7' => 'pgmgt.conf.phpのパラメータが足りません', + 'e8' => 'pcp_timeoutがpgpool.confで見つかりません', + 'e9' => 'pcp_portがpgpool.confで見つかりません', + 'e1001' => 'pcpコマンドエラーが発生しました', + 'e1002' => 'pcp_node_countコマンドでエラーが発生しました', + 'e1003' => 'pcp_node_infoコマンドでエラーが発生しました', + 'e1004' => 'pcp_proc_countコマンドでエラーが発生しました', + 'e1005' => 'pcp_proc_infoコマンドでエラーが発生しました', + 'e1006' => 'pcp_stop_pgpoolコマンドでエラーが発生しました', + 'e1007' => 'pcp_detach_nodeコマンドでエラーが発生しました', + 'e1008' => '指定したpgpool.confが見つかりません', + 'e1009' => '指定したpcp.confが見つかりません', + 'e1010' => 'pcp_attach_nodeコマンドでエラーが発生しました', + 'e1011' => 'ログファイルが見つかりません', + 'e2001' => 'データベースに接続できません', + 'e2002' => 'レコード取得時にエラーが発生しました', + 'e2003' => 'pgpool.confが見つかりません', + 'e3001' => 'データベースに接続できません', + 'e3002' => 'レコード取得時にエラーが発生しました', + 'e3003' => 'レコード登録時にエラーが発生しました', + 'e3004' => 'レコード更新時にエラーが発生しました', + 'e3005' => 'レコード削除時にエラーが発生しました', + 'e3006' => 'pgpool.confが見つかりません', + 'e4001' => 'pgpool.confが見つかりません', + 'e4002' => 'pgpool.confから読み込みができません', + 'e4003' => 'pgpool.confiに書き込みができません', + 'e5001' => 'pgmgt.conf.phpが見つかりません', + 'e5002' => 'pgmgt.conf.phpから読み込みができません', + 'e5003' => 'pgmgt.conf.phpに書き込みができません', + 'e6001' => 'pcp.confが見つかりません', + 'e6002' => 'pcp.confに読み込みができません', + 'e6003' => 'pcp.confに書き込みができません', + 'e7001' => 'pcp.confが見つかりません', + 'e8001' => '詳細情報が取得できません', + +); + +?> diff --git a/libs/Config_File.class.php b/libs/Config_File.class.php new file mode 100644 index 0000000..c0c8a0c --- /dev/null +++ b/libs/Config_File.class.php @@ -0,0 +1,389 @@ +<?php + +/** + * Config_File class. + * + * 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 + * + * @link http://smarty.php.net/ + * @version 2.6.13 + * @copyright Copyright: 2001-2005 New Digital Group, Inc. + * @author Andrei Zmievski <[email protected]> + * @access public + * @package Smarty + */ + +/* $Id$ */ + +/** + * Config file reading class + * @package Smarty + */ +class Config_File { + /**#@+ + * Options + * @var boolean + */ + /** + * Controls whether variables with the same name overwrite each other. + */ + var $overwrite = true; + + /** + * Controls whether config values of on/true/yes and off/false/no get + * converted to boolean values automatically. + */ + var $booleanize = true; + + /** + * Controls whether hidden config sections/vars are read from the file. + */ + var $read_hidden = true; + + /** + * Controls whether or not to fix mac or dos formatted newlines. + * If set to true, \r or \r\n will be changed to \n. + */ + var $fix_newlines = true; + /**#@-*/ + + /** @access private */ + var $_config_path = ""; + var $_config_data = array(); + /**#@-*/ + + /** + * Constructs a new config file class. + * + * @param string $config_path (optional) path to the config files + */ + function Config_File($config_path = NULL) + { + if (isset($config_path)) + $this->set_path($config_path); + } + + + /** + * Set the path where configuration files can be found. + * + * @param string $config_path path to the config files + */ + function set_path($config_path) + { + if (!empty($config_path)) { + if (!is_string($config_path) || !file_exists($config_path) || !is_dir($config_path)) { + $this->_trigger_error_msg("Bad config file path '$config_path'"); + return; + } + if(substr($config_path, -1) != DIRECTORY_SEPARATOR) { + $config_path .= DIRECTORY_SEPARATOR; + } + + $this->_config_path = $config_path; + } + } + + + /** + * Retrieves config info based on the file, section, and variable name. + * + * @param string $file_name config file to get info for + * @param string $section_name (optional) section to get info for + * @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) + { + if (empty($file_name)) { + $this->_trigger_error_msg('Empty config file name'); + return; + } else { + $file_name = $this->_config_path . $file_name; + if (!isset($this->_config_data[$file_name])) + $this->load_file($file_name, false); + } + + if (!empty($var_name)) { + if (empty($section_name)) { + return $this->_config_data[$file_name]["vars"][$var_name]; + } else { + if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name])) + return $this->_config_data[$file_name]["sections"][$section_name]["vars"][$var_name]; + else + return array(); + } + } else { + if (empty($section_name)) { + return (array)$this->_config_data[$file_name]["vars"]; + } else { + if(isset($this->_config_data[$file_name]["sections"][$section_name]["vars"])) + return (array)$this->_config_data[$file_name]["sections"][$section_name]["vars"]; + else + return array(); + } + } + } + + + /** + * Retrieves config info based on the key. + * + * @param $file_name string config key (filename/section/var) + * @return string|array same as get() + * @uses get() retrieves information from config file and returns it + */ + function &get_key($config_key) + { + list($file_name, $section_name, $var_name) = explode('/', $config_key, 3); + $result = &$this->get($file_name, $section_name, $var_name); + return $result; + } + + /** + * Get all loaded config file names. + * + * @return array an array of loaded config file names + */ + function get_file_names() + { + return array_keys($this->_config_data); + } + + + /** + * Get all section names from a loaded file. + * + * @param string $file_name config file to get section names from + * @return array an array of section names from the specified file + */ + function get_section_names($file_name) + { + $file_name = $this->_config_path . $file_name; + if (!isset($this->_config_data[$file_name])) { + $this->_trigger_error_msg("Unknown config file '$file_name'"); + return; + } + + return array_keys($this->_config_data[$file_name]["sections"]); + } + + + /** + * Get all global or section variable names. + * + * @param string $file_name config file to get info for + * @param string $section_name (optional) section to get info for + * @return array an array of variables names from the specified file/section + */ + function get_var_names($file_name, $section = NULL) + { + if (empty($file_name)) { + $this->_trigger_error_msg('Empty config file name'); + return; + } else if (!isset($this->_config_data[$file_name])) { + $this->_trigger_error_msg("Unknown config file '$file_name'"); + return; + } + + if (empty($section)) + return array_keys($this->_config_data[$file_name]["vars"]); + else + return array_keys($this->_config_data[$file_name]["sections"][$section]["vars"]); + } + + + /** + * Clear loaded config data for a certain file or all files. + * + * @param string $file_name file to clear config data for + */ + function clear($file_name = NULL) + { + if ($file_name === NULL) + $this->_config_data = array(); + else if (isset($this->_config_data[$file_name])) + $this->_config_data[$file_name] = array(); + } + + + /** + * Load a configuration file manually. + * + * @param string $file_name file name to load + * @param boolean $prepend_path whether current config path should be + * prepended to the filename + */ + function load_file($file_name, $prepend_path = true) + { + if ($prepend_path && $this->_config_path != "") + $config_file = $this->_config_path . $file_name; + else + $config_file = $file_name; + + ini_set('track_errors', true); + $fp = @fopen($config_file, "r"); + if (!is_resource($fp)) { + $this->_trigger_error_msg("Could not open config file '$config_file'"); + return false; + } + + $contents = ($size = filesize($config_file)) ? fread($fp, $size) : ''; + fclose($fp); + + $this->_config_data[$config_file] = $this->parse_contents($contents); + return true; + } + + /** + * Store the contents of a file manually. + * + * @param string $config_file file name of the related contents + * @param string $contents the file-contents to parse + */ + function set_file_contents($config_file, $contents) + { + $this->_config_data[$config_file] = $this->parse_contents($contents); + return true; + } + + /** + * parse the source of a configuration file manually. + * + * @param string $contents the file-contents to parse + */ + function parse_contents($contents) + { + if($this->fix_newlines) { + // fix mac/dos formatted newlines + $contents = preg_replace('!\r\n?!', "\n", $contents); + } + + $config_data = array(); + $config_data['sections'] = array(); + $config_data['vars'] = array(); + + /* reference to fill with data */ + $vars =& $config_data['vars']; + + /* parse file line by line */ + preg_match_all('!^.*\r?\n?!m', $contents, $match); + $lines = $match[0]; + for ($i=0, $count=count($lines); $i<$count; $i++) { + $line = $lines[$i]; + if (empty($line)) continue; + + if ( substr($line, 0, 1) == '[' && preg_match('!^\[(.*?)\]!', $line, $match) ) { + /* section found */ + if (substr($match[1], 0, 1) == '.') { + /* hidden section */ + if ($this->read_hidden) { + $section_name = substr($match[1], 1); + } else { + /* break reference to $vars to ignore hidden section */ + unset($vars); + $vars = array(); + continue; + } + } else { + $section_name = $match[1]; + } + if (!isset($config_data['sections'][$section_name])) + $config_data['sections'][$section_name] = array('vars' => array()); + $vars =& $config_data['sections'][$section_name]['vars']; + continue; + } + + if (preg_match('/^\s*(\.?\w+)\s*=\s*(.*)/s', $line, $match)) { + /* variable found */ + $var_name = rtrim($match[1]); + if (strpos($match[2], '"""') === 0) { + /* handle multiline-value */ + $lines[$i] = substr($match[2], 3); + $var_value = ''; + while ($i<$count) { + if (($pos = strpos($lines[$i], '"""')) === false) { + $var_value .= $lines[$i++]; + } else { + /* end of multiline-value */ + $var_value .= substr($lines[$i], 0, $pos); + break; + } + } + $booleanize = false; + + } else { + /* handle simple value */ + $var_value = preg_replace('/^([\'"])(.*)\1$/', '\2', rtrim($match[2])); + $booleanize = $this->booleanize; + + } + $this->_set_config_var($vars, $var_name, $var_value, $booleanize); + } + /* else unparsable line / means it is a comment / means ignore it */ + } + return $config_data; + } + + /**#@+ @access private */ + /** + * @param array &$container + * @param string $var_name + * @param mixed $var_value + * @param boolean $booleanize determines whether $var_value is converted to + * to true/false + */ + function _set_config_var(&$container, $var_name, $var_value, $booleanize) + { + if (substr($var_name, 0, 1) == '.') { + if (!$this->read_hidden) + return; + else + $var_name = substr($var_name, 1); + } + + if (!preg_match("/^[a-zA-Z_]\w*$/", $var_name)) { + $this->_trigger_error_msg("Bad variable name '$var_name'"); + return; + } + + if ($booleanize) { + if (preg_match("/^(on|true|yes)$/i", $var_value)) + $var_value = true; + else if (preg_match("/^(off|false|no)$/i", $var_value)) + $var_value = false; + } + + if (!isset($container[$var_name]) || $this->overwrite) + $container[$var_name] = $var_value; + else { + settype($container[$var_name], 'array'); + $container[$var_name][] = $var_value; + } + } + + /** + * @uses trigger_error() creates a PHP warning/error + * @param string $error_msg + * @param integer $error_type one of + */ + function _trigger_error_msg($error_msg, $error_type = E_USER_WARNING) + { + trigger_error("Config_File error: $error_msg", $error_type); + } + /**#@-*/ +} + +?> diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php new file mode 100644 index 0000000..8e6a459 --- /dev/null +++ b/libs/Smarty.class.php @@ -0,0 +1,1944 @@ +<?php + +/** + * Project: Smarty: the PHP compiling template engine + * File: Smarty.class.php + * + * 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 + * + * For questions, help, comments, discussion, etc., please join the + * Smarty mailing list. Send a blank e-mail to + * + * @link http://smarty.php.net/ + * @copyright 2001-2005 New Digital Group, Inc. + * @author Monte Ohrt <monte at ohrt dot com> + * @author Andrei Zmievski <[email protected]> + * @package Smarty + * @version 2.6.13 + */ + +/* $Id$ */ + +/** + * DIR_SEP isn't used anymore, but third party apps might + */ +if(!defined('DIR_SEP')) { + define('DIR_SEP', DIRECTORY_SEPARATOR); +} + +/** + * set SMARTY_DIR to absolute path to Smarty library files. + * if not defined, include_path will be used. Sets SMARTY_DIR only if user + * application has not already defined it. + */ + +if (!defined('SMARTY_DIR')) { + define('SMARTY_DIR', dirname(__FILE__) . DIRECTORY_SEPARATOR); +} + +if (!defined('SMARTY_CORE_DIR')) { + define('SMARTY_CORE_DIR', SMARTY_DIR . 'internals' . DIRECTORY_SEPARATOR); +} + +define('SMARTY_PHP_PASSTHRU', 0); +define('SMARTY_PHP_QUOTE', 1); +define('SMARTY_PHP_REMOVE', 2); +define('SMARTY_PHP_ALLOW', 3); + +/** + * @package Smarty + */ +class Smarty +{ + /**#@+ + * Smarty Configuration Section + */ + + /** + * The name of the directory where templates are located. + * + * @var string + */ + var $template_dir = 'templates'; + + /** + * The directory where compiled templates are located. + * + * @var string + */ + var $compile_dir = 'templates_c'; + + /** + * The directory where config files are located. + * + * @var string + */ + var $config_dir = 'configs'; + + /** + * An array of directories searched for plugins. + * + * @var array + */ + var $plugins_dir = array('plugins'); + + /** + * If debugging is enabled, a debug console window will display + * when the page loads (make sure your browser allows unrequested + * popup windows) + * + * @var boolean + */ + var $debugging = false; + + /** + * When set, smarty does uses this value as error_reporting-level. + * + * @var boolean + */ + var $error_reporting = null; + + /** + * This is the path to the debug console template. If not set, + * the default one will be used. + * + * @var string + */ + var $debug_tpl = ''; + + /** + * This determines if debugging is enable-able from the browser. + * <ul> + * <li>NONE => no debugging control allowed</li> + * <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li> + * </ul> + * @link http://www.foo.dom/index.php?SMARTY_DEBUG + * @var string + */ + var $debugging_ctrl = 'NONE'; + + /** + * This tells Smarty whether to check for recompiling or not. Recompiling + * does not need to happen unless a template or config file is changed. + * Typically you enable this during development, and disable for + * production. + * + * @var boolean + */ + var $compile_check = true; + + /** + * This forces templates to compile every time. Useful for development + * or debugging. + * + * @var boolean + */ + var $force_compile = false; + + /** + * This enables template caching. + * <ul> + * <li>0 = no caching</li> + * <li>1 = use class cache_lifetime value</li> + * <li>2 = use cache_lifetime in cache file</li> + * </ul> + * @var integer + */ + var $caching = 0; + + /** + * The name of the directory for cache files. + * + * @var string + */ + var $cache_dir = 'cache'; + + /** + * This is the number of seconds cached content will persist. + * <ul> + * <li>0 = always regenerate cache</li> + * <li>-1 = never expires</li> + * </ul> + * + * @var integer + */ + var $cache_lifetime = 3600; + + /** + * Only used when $caching is enabled. If true, then If-Modified-Since headers + * are respected with cached content, and appropriate HTTP headers are sent. + * This way repeated hits to a cached page do not send the entire page to the + * client every time. + * + * @var boolean + */ + var $cache_modified_check = false; + + /** + * This determines how Smarty handles "<?php ... ?>" tags in templates. + * possible values: + * <ul> + * <li>SMARTY_PHP_PASSTHRU -> print tags as plain text</li> + * <li>SMARTY_PHP_QUOTE -> escape tags as entities</li> + * <li>SMARTY_PHP_REMOVE -> remove php tags</li> + * <li>SMARTY_PHP_ALLOW -> execute php tags</li> + * </ul> + * + * @var integer + */ + var $php_handling = SMARTY_PHP_PASSTHRU; + + /** + * This enables template security. When enabled, many things are restricted + * in the templates that normally would go unchecked. This is useful when + * untrusted parties are editing templates and you want a reasonable level + * of security. (no direct execution of PHP in templates for example) + * + * @var boolean + */ + var $security = false; + + /** + * This is the list of template directories that are considered secure. This + * is used only if {@link $security} is enabled. One directory per array + * element. {@link $template_dir} is in this list implicitly. + * + * @var array + */ + var $secure_dir = array(); + + /** + * These are the security settings for Smarty. They are used only when + * {@link $security} is enabled. + * + * @var array + */ + var $security_settings = array( + 'PHP_HANDLING' => false, + 'IF_FUNCS' => array('array', 'list', + 'isset', 'empty', + 'count', 'sizeof', + 'in_array', 'is_array', + 'true', 'false', 'null'), + 'INCLUDE_ANY' => false, + 'PHP_TAGS' => false, + 'MODIFIER_FUNCS' => array('count'), + 'ALLOW_CONSTANTS' => false + ); + + /** + * This is an array of directories where trusted php scripts reside. + * {@link $security} is disabled during their inclusion/execution. + * + * @var array + */ + var $trusted_dir = array(); + + /** + * The left delimiter used for the template tags. + * + * @var string + */ + var $left_delimiter = '{'; + + /** + * The right delimiter used for the template tags. + * + * @var string + */ + var $right_delimiter = '}'; + + /** + * The order in which request variables are registered, similar to + * variables_order in php.ini E = Environment, G = GET, P = POST, + * C = Cookies, S = Server + * + * @var string + */ + var $request_vars_order = 'EGPCS'; + + /** + * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false) + * are uses as request-vars or $_*[]-vars. note: if + * request_use_auto_globals is true, then $request_vars_order has + * no effect, but the php-ini-value "gpc_order" + * + * @var boolean + */ + var $request_use_auto_globals = true; + + /** + * Set this if you want different sets of compiled files for the same + * templates. This is useful for things like different languages. + * Instead of creating separate sets of templates per language, you + * set different compile_ids like 'en' and 'de'. + * + * @var string + */ + var $compile_id = null; + + /** + * This tells Smarty whether or not to use sub dirs in the cache/ and + * templates_c/ directories. sub directories better organized, but + * may not work well with PHP safe mode enabled. + * + * @var boolean + * + */ + var $use_sub_dirs = false; + + /** + * This is a list of the modifiers to apply to all template variables. + * Put each modifier in a separate array element in the order you want + * them applied. example: <code>array('escape:"htmlall"');</code> + * + * @var array + */ + var $default_modifiers = array(); + + /** + * This is the resource type to be used when not specified + * at the beginning of the resource path. examples: + * $smarty->display('file:index.tpl'); + * $smarty->display('db:index.tpl'); + * $smarty->display('index.tpl'); // will use default resource type + * {include file="file:index.tpl"} + * {include file="db:index.tpl"} + * {include file="index.tpl"} {* will use default resource type *} + * + * @var array + */ + var $default_resource_type = 'file'; + + /** + * The function used for cache file handling. If not set, built-in caching is used. + * + * @var null|string function name + */ + var $cache_handler_func = null; + + /** + * This indicates which filters are automatically loaded into Smarty. + * + * @var array array of filter names + */ + var $autoload_filters = array(); + + /**#@+ + * @var boolean + */ + /** + * This tells if config file vars of the same name overwrite each other or not. + * if disabled, same name variables are accumulated in an array. + */ + var $config_overwrite = true; + + /** + * This tells whether or not to automatically booleanize config file variables. + * If enabled, then the strings "on", "true", and "yes" are treated as boolean + * true, and "off", "false" and "no" are treated as boolean false. + */ + var $config_booleanize = true; + + /** + * This tells whether hidden sections [.foobar] are readable from the + * tempalates or not. Normally you would never allow this since that is + * the point behind hidden sections: the application can access them, but + * the templates cannot. + */ + var $config_read_hidden = false; + + /** + * This tells whether or not automatically fix newlines in config files. + * It basically converts \r (mac) or \r\n (dos) to \n + */ + var $config_fix_newlines = true; + /**#@-*/ + + /** + * If a template cannot be found, this PHP function will be executed. + * Useful for creating templates on-the-fly or other special action. + * + * @var string function name + */ + var $default_template_handler_func = ''; + + /** + * The file that contains the compiler class. This can a full + * pathname, or relative to the php_include path. + * + * @var string + */ + var $compiler_file = 'Smarty_Compiler.class.php'; + + /** + * The class used for compiling templates. + * + * @var string + */ + var $compiler_class = 'Smarty_Compiler'; + + /** + * The class used to load config vars. + * + * @var string + */ + var $config_class = 'Config_File'; + +/**#@+ + * END Smarty Configuration Section + * There should be no need to touch anything below this line. + * @access private + */ + /** + * where assigned template vars are kept + * + * @var array + */ + var $_tpl_vars = array(); + + /** + * stores run-time $smarty.* vars + * + * @var null|array + */ + var $_smarty_vars = null; + + /** + * keeps track of sections + * + * @var array + */ + var $_sections = array(); + + /** + * keeps track of foreach blocks + * + * @var array + */ + var $_foreach = array(); + + /** + * keeps track of tag hierarchy + * + * @var array + */ + var $_tag_stack = array(); + + /** + * configuration object + * + * @var Config_file + */ + var $_conf_obj = null; + + /** + * loaded configuration settings + * + * @var array + */ + var $_config = array(array('vars' => array(), 'files' => array())); + + /** + * md5 checksum of the string 'Smarty' + * + * @var string + */ + var $_smarty_md5 = 'f8d698aea36fcbead2b9d5359ffca76f'; + + /** + * Smarty version number + * + * @var string + */ + var $_version = '2.6.13'; + + /** + * current template inclusion depth + * + * @var integer + */ + var $_inclusion_depth = 0; + + /** + * for different compiled templates + * + * @var string + */ + var $_compile_id = null; + + /** + * text in URL to enable debug mode + * + * @var string + */ + var $_smarty_debug_id = 'SMARTY_DEBUG'; + + /** + * debugging information for debug console + * + * @var array + */ + var $_smarty_debug_info = array(); + + /** + * info that makes up a cache file + * + * @var array + */ + var $_cache_info = array(); + + /** + * default file permissions + * + * @var integer + */ + var $_file_perms = 0644; + + /** + * default dir permissions + * + * @var integer + */ + var $_dir_perms = 0771; + + /** + * registered objects + * + * @var array + */ + var $_reg_objects = array(); + + /** + * table keeping track of plugins + * + * @var array + */ + var $_plugins = array( + 'modifier' => array(), + 'function' => array(), + 'block' => array(), + 'compiler' => array(), + 'prefilter' => array(), + 'postfilter' => array(), + 'outputfilter' => array(), + 'resource' => array(), + 'insert' => array()); + + + /** + * cache serials + * + * @var array + */ + var $_cache_serials = array(); + + /** + * name of optional cache include file + * + * @var string + */ + var $_cache_include = null; + + /** + * indicate if the current code is used in a compiled + * include + * + * @var string + */ + var $_cache_including = false; + + /**#@-*/ + /** + * The class constructor. + */ + function Smarty() + { + $this->assign('SCRIPT_NAME', isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] + : @$GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']); + } + + /** + * assigns values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to assign + */ + function assign($tpl_var, $value = null) + { + if (is_array($tpl_var)){ + foreach ($tpl_var as $key => $val) { + if ($key != '') { + $this->_tpl_vars[$key] = $val; + } + } + } else { + if ($tpl_var != '') + $this->_tpl_vars[$tpl_var] = $value; + } + } + + /** + * assigns values to template variables by reference + * + * @param string $tpl_var the template variable name + * @param mixed $value the referenced value to assign + */ + function assign_by_ref($tpl_var, &$value) + { + if ($tpl_var != '') + $this->_tpl_vars[$tpl_var] = &$value; + } + + /** + * appends values to template variables + * + * @param array|string $tpl_var the template variable name(s) + * @param mixed $value the value to append + */ + function append($tpl_var, $value=null, $merge=false) + { + if (is_array($tpl_var)) { + // $tpl_var is an array, ignore $value + foreach ($tpl_var as $_key => $_val) { + if ($_key != '') { + if(!@is_array($this->_tpl_vars[$_key])) { + settype($this->_tpl_vars[$_key],'array'); + } + if($merge && is_array($_val)) { + foreach($_val as $_mkey => $_mval) { + $this->_tpl_vars[$_key][$_mkey] = $_mval; + } + } else { + $this->_tpl_vars[$_key][] = $_val; + } + } + } + } else { + if ($tpl_var != '' && isset($value)) { + if(!@is_array($this->_tpl_vars[$tpl_var])) { + settype($this->_tpl_vars[$tpl_var],'array'); + } + if($merge && is_array($value)) { + foreach($value as $_mkey => $_mval) { + $this->_tpl_vars[$tpl_var][$_mkey] = $_mval; + } + } else { + $this->_tpl_vars[$tpl_var][] = $value; + } + } + } + } + + /** + * appends values to template variables by reference + * + * @param string $tpl_var the template variable name + * @param mixed $value the referenced value to append + */ + function append_by_ref($tpl_var, &$value, $merge=false) + { + if ($tpl_var != '' && isset($value)) { + if(!@is_array($this->_tpl_vars[$tpl_var])) { + settype($this->_tpl_vars[$tpl_var],'array'); + } + if ($merge && is_array($value)) { + foreach($value as $_key => $_val) { + $this->_tpl_vars[$tpl_var][$_key] = &$value[$_key]; + } + } else { + $this->_tpl_vars[$tpl_var][] = &$value; + } + } + } + + + /** + * clear the given assigned template variable. + * + * @param string $tpl_var the template variable to clear + */ + function clear_assign($tpl_var) + { + if (is_array($tpl_var)) + foreach ($tpl_var as $curr_var) + unset($this->_tpl_vars[$curr_var]); + else + unset($this->_tpl_vars[$tpl_var]); + } + + + /** + * Registers custom function to be used in templates + * + * @param string $function the name of the template function + * @param string $function_impl the name of the PHP function to register + */ + function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) + { + $this->_plugins['function'][$function] = + array($function_impl, null, null, false, $cacheable, $cache_attrs); + + } + + /** + * Unregisters custom function + * + * @param string $function name of template function + */ + function unregister_function($function) + { + unset($this->_plugins['function'][$function]); + } + + /** + * Registers object to be used in templates + * + * @param string $object name of template object + * @param object &$object_impl the referenced PHP object to register + * @param null|array $allowed list of allowed methods (empty = all) + * @param boolean $smarty_args smarty argument format, else traditional + * @param null|array $block_functs list of methods that are block format + */ + function register_object($object, &$object_impl, $allowed = array(), $smarty_args = true, $block_methods = array()) + { + settype($allowed, 'array'); + settype($smarty_args, 'boolean'); + $this->_reg_objects[$object] = + array(&$object_impl, $allowed, $smarty_args, $block_methods); + } + + /** + * Unregisters object + * + * @param string $object name of template object + */ + function unregister_object($object) + { + unset($this->_reg_objects[$object]); + } + + + /** + * Registers block function to be used in templates + * + * @param string $block name of template block + * @param string $block_impl PHP function to register + */ + function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null) + { + $this->_plugins['block'][$block] = + array($block_impl, null, null, false, $cacheable, $cache_attrs); + } + + /** + * Unregisters block function + * + * @param string $block name of template function + */ + function unregister_block($block) + { + unset($this->_plugins['block'][$block]); + } + + /** + * Registers compiler function + * + * @param string $function name of template function + * @param string $function_impl name of PHP function to register + */ + function register_compiler_function($function, $function_impl, $cacheable=true) + { + $this->_plugins['compiler'][$function] = + array($function_impl, null, null, false, $cacheable); + } + + /** + * Unregisters compiler function + * + * @param string $function name of template function + */ + function unregister_compiler_function($function) + { + unset($this->_plugins['compiler'][$function]); + } + + /** + * Registers modifier to be used in templates + * + * @param string $modifier name of template modifier + * @param string $modifier_impl name of PHP function to register + */ + function register_modifier($modifier, $modifier_impl) + { + $this->_plugins['modifier'][$modifier] = + array($modifier_impl, null, null, false); + } + + /** + * Unregisters modifier + * + * @param string $modifier name of template modifier + */ + function unregister_modifier($modifier) + { + unset($this->_plugins['modifier'][$modifier]); + } + + /** + * Registers a resource to fetch a template + * + * @param string $type name of resource + * @param array $functions array of functions to handle resource + */ + function register_resource($type, $functions) + { + if (count($functions)==4) { + $this->_plugins['resource'][$type] = + array($functions, false); + + } elseif (count($functions)==5) { + $this->_plugins['resource'][$type] = + array(array(array(&$functions[0], $functions[1]) + ,array(&$functions[0], $functions[2]) + ,array(&$functions[0], $functions[3]) + ,array(&$functions[0], $functions[4])) + ,false); + + } else { + $this->trigger_error("malformed function-list for '$type' in register_resource"); + + } + } + + /** + * Unregisters a resource + * + * @param string $type name of resource + */ + function unregister_resource($type) + { + unset($this->_plugins['resource'][$type]); + } + + /** + * Registers a prefilter function to apply + * to a template before compiling + * + * @param string $function name of PHP function to register + */ + function register_prefilter($function) + { + $_name = (is_array($function)) ? $function[1] : $function; + $this->_plugins['prefilter'][$_name] + = array($function, null, null, false); + } + + /** + * Unregisters a prefilter function + * + * @param string $function name of PHP function + */ + function unregister_prefilter($function) + { + unset($this->_plugins['prefilter'][$function]); + } + + /** + * Registers a postfilter function to apply + * to a compiled template after compilation + * + * @param string $function name of PHP function to register + */ + function register_postfilter($function) + { + $_name = (is_array($function)) ? $function[1] : $function; + $this->_plugins['postfilter'][$_name] + = array($function, null, null, false); + } + + /** + * Unregisters a postfilter function + * + * @param string $function name of PHP function + */ + function unregister_postfilter($function) + { + unset($this->_plugins['postfilter'][$function]); + } + + /** + * Registers an output filter function to apply + * to a template output + * + * @param string $function name of PHP function + */ + function register_outputfilter($function) + { + $_name = (is_array($function)) ? $function[1] : $function; + $this->_plugins['outputfilter'][$_name] + = array($function, null, null, false); + } + + /** + * Unregisters an outputfilter function + * + * @param string $function name of PHP function + */ + function unregister_outputfilter($function) + { + unset($this->_plugins['outputfilter'][$function]); + } + + /** + * load a filter of specified type and name + * + * @param string $type filter type + * @param string $name filter name + */ + function load_filter($type, $name) + { + switch ($type) { + case 'output': + $_params = array('plugins' => array(array($type . 'filter', $name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + break; + + case 'pre': + case 'post': + if (!isset($this->_plugins[$type . 'filter'][$name])) + $this->_plugins[$type . 'filter'][$name] = false; + break; + } + } + + /** + * clear cached content for the given template and cache id + * + * @param string $tpl_file name of template file + * @param string $cache_id name of cache_id + * @param string $compile_id name of compile_id + * @param string $exp_time expiration time + * @return boolean + */ + function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null) + { + + if (!isset($compile_id)) + $compile_id = $this->compile_id; + + if (!isset($tpl_file)) + $compile_id = null; + + $_auto_id = $this->_get_auto_id($cache_id, $compile_id); + + if (!empty($this->cache_handler_func)) { + return call_user_func_array($this->cache_handler_func, + array('clear', &$this, &$dummy, $tpl_file, $cache_id, $compile_id, $exp_time)); + } else { + $_params = array('auto_base' => $this->cache_dir, + 'auto_source' => $tpl_file, + 'auto_id' => $_auto_id, + 'exp_time' => $exp_time); + require_once(SMARTY_CORE_DIR . 'core.rm_auto.php'); + return smarty_core_rm_auto($_params, $this); + } + + } + + + /** + * clear the entire contents of cache (all templates) + * + * @param string $exp_time expire time + * @return boolean results of {@link smarty_core_rm_auto()} + */ + function clear_all_cache($exp_time = null) + { + return $this->clear_cache(null, null, null, $exp_time); + } + + + /** + * test to see if valid cache exists for this template + * + * @param string $tpl_file name of template file + * @param string $cache_id + * @param string $compile_id + * @return string|false results of {@link _read_cache_file()} + */ + function is_cached($tpl_file, $cache_id = null, $compile_id = null) + { + if (!$this->caching) + return false; + + if (!isset($compile_id)) + $compile_id = $this->compile_id; + + $_params = array( + 'tpl_file' => $tpl_file, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id + ); + require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php'); + return smarty_core_read_cache_file($_params, $this); + } + + + /** + * clear all the assigned template variables. + * + */ + function clear_all_assign() + { + $this->_tpl_vars = array(); + } + + /** + * clears compiled version of specified template resource, + * or all compiled template files if one is not specified. + * This function is for advanced use only, not normally needed. + * + * @param string $tpl_file + * @param string $compile_id + * @param string $exp_time + * @return boolean results of {@link smarty_core_rm_auto()} + */ + function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null) + { + if (!isset($compile_id)) { + $compile_id = $this->compile_id; + } + $_params = array('auto_base' => $this->compile_dir, + 'auto_source' => $tpl_file, + 'auto_id' => $compile_id, + 'exp_time' => $exp_time, + 'extensions' => array('.inc', '.php')); + require_once(SMARTY_CORE_DIR . 'core.rm_auto.php'); + return smarty_core_rm_auto($_params, $this); + } + + /** + * Checks whether requested template exists. + * + * @param string $tpl_file + * @return boolean + */ + function template_exists($tpl_file) + { + $_params = array('resource_name' => $tpl_file, 'quiet'=>true, 'get_source'=>false); + return $this->_fetch_resource_info($_params); + } + + /** + * Returns an array containing template variables + * + * @param string $name + * @param string $type + * @return array + */ + function &get_template_vars($name=null) + { + if(!isset($name)) { + return $this->_tpl_vars; + } elseif(isset($this->_tpl_vars[$name])) { + return $this->_tpl_vars[$name]; + } else { + // var non-existant, return valid reference + $_tmp = null; + return $_tmp; + } + } + + /** + * Returns an array containing config variables + * + * @param string $name + * @param string $type + * @return array + */ + function &get_config_vars($name=null) + { + if(!isset($name) && is_array($this->_config[0])) { + return $this->_config[0]['vars']; + } else if(isset($this->_config[0]['vars'][$name])) { + return $this->_config[0]['vars'][$name]; + } else { + // var non-existant, return valid reference + $_tmp = null; + return $_tmp; + } + } + + /** + * trigger Smarty error + * + * @param string $error_msg + * @param integer $error_type + */ + function trigger_error($error_msg, $error_type = E_USER_WARNING) + { + trigger_error("Smarty error: $error_msg", $error_type); + } + + + /** + * executes & displays the template results + * + * @param string $resource_name + * @param string $cache_id + * @param string $compile_id + */ + function display($resource_name, $cache_id = null, $compile_id = null) + { + $this->fetch($resource_name, $cache_id, $compile_id, true); + } + + /** + * executes & returns or displays the template results + * + * @param string $resource_name + * @param string $cache_id + * @param string $compile_id + * @param boolean $display + */ + function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false) + { + static $_cache_info = array(); + + $_smarty_old_error_level = $this->debugging ? error_reporting() : error_reporting(isset($this->error_reporting) + ? $this->error_reporting : error_reporting() & ~E_NOTICE); + + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + $_query_string = $this->request_use_auto_globals ? $_SERVER['QUERY_STRING'] : $GLOBALS['HTTP_SERVER_VARS']['QUERY_STRING']; + if (@strstr($_query_string, $this->_smarty_debug_id)) { + if (@strstr($_query_string, $this->_smarty_debug_id . '=on')) { + // enable debugging for this browser session + @setcookie('SMARTY_DEBUG', true); + $this->debugging = true; + } elseif (@strstr($_query_string, $this->_smarty_debug_id . '=off')) { + // disable debugging for this browser session + @setcookie('SMARTY_DEBUG', false); + $this->debugging = false; + } else { + // enable debugging for this page + $this->debugging = true; + } + } else { + $this->debugging = (bool)($this->request_use_auto_globals ? @$_COOKIE['SMARTY_DEBUG'] : @$GLOBALS['HTTP_COOKIE_VARS']['SMARTY_DEBUG']); + } + } + + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $_debug_start_time = smarty_core_get_microtime($_params, $this); + $this->_smarty_debug_info[] = array('type' => 'template', + 'filename' => $resource_name, + 'depth' => 0); + $_included_tpls_idx = count($this->_smarty_debug_info) - 1; + } + + if (!isset($compile_id)) { + $compile_id = $this->compile_id; + } + + $this->_compile_id = $compile_id; + $this->_inclusion_depth = 0; + + if ($this->caching) { + // save old cache_info, initialize cache_info + array_push($_cache_info, $this->_cache_info); + $this->_cache_info = array(); + $_params = array( + 'tpl_file' => $resource_name, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id, + 'results' => null + ); + require_once(SMARTY_CORE_DIR . 'core.read_cache_file.php'); + if (smarty_core_read_cache_file($_params, $this)) { + $_smarty_results = $_params['results']; + if (!empty($this->_cache_info['insert_tags'])) { + $_params = array('plugins' => $this->_cache_info['insert_tags']); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + $_params = array('results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php'); + $_smarty_results = smarty_core_process_cached_inserts($_params, $this); + } + if (!empty($this->_cache_info['cache_serials'])) { + $_params = array('results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.process_compiled_include.php'); + $_smarty_results = smarty_core_process_compiled_include($_params, $this); + } + + + if ($display) { + if ($this->debugging) + { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $_debug_start_time; + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + $_smarty_results .= smarty_core_display_debug_console($_params, $this); + } + if ($this->cache_modified_check) { + $_server_vars = ($this->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS']; + $_last_modified_date = @substr($_server_vars['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_server_vars['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3); + $_gmt_mtime = gmdate('D, d M Y H:i:s', $this->_cache_info['timestamp']).' GMT'; + if (@count($this->_cache_info['insert_tags']) == 0 + && !$this->_cache_serials + && $_gmt_mtime == $_last_modified_date) { + if (php_sapi_name()=='cgi') + header('Status: 304 Not Modified'); + else + header('HTTP/1.1 304 Not Modified'); + + } else { + header('Last-Modified: '.$_gmt_mtime); + echo $_smarty_results; + } + } else { + echo $_smarty_results; + } + error_reporting($_smarty_old_error_level); + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + return true; + } else { + error_reporting($_smarty_old_error_level); + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + return $_smarty_results; + } + } else { + $this->_cache_info['template'][$resource_name] = true; + if ($this->cache_modified_check && $display) { + header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT'); + } + } + } + + // load filters that are marked as autoload + if (count($this->autoload_filters)) { + foreach ($this->autoload_filters as $_filter_type => $_filters) { + foreach ($_filters as $_filter) { + $this->load_filter($_filter_type, $_filter); + } + } + } + + $_smarty_compile_path = $this->_get_compile_path($resource_name); + + // if we just need to display the results, don't perform output + // buffering - for speed + $_cache_including = $this->_cache_including; + $this->_cache_including = false; + if ($display && !$this->caching && count($this->_plugins['outputfilter']) == 0) { + if ($this->_is_compiled($resource_name, $_smarty_compile_path) + || $this->_compile_resource($resource_name, $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + } else { + ob_start(); + if ($this->_is_compiled($resource_name, $_smarty_compile_path) + || $this->_compile_resource($resource_name, $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + $_smarty_results = ob_get_contents(); + ob_end_clean(); + + foreach ((array)$this->_plugins['outputfilter'] as $_output_filter) { + $_smarty_results = call_user_func_array($_output_filter[0], array($_smarty_results, &$this)); + } + } + + if ($this->caching) { + $_params = array('tpl_file' => $resource_name, + 'cache_id' => $cache_id, + 'compile_id' => $compile_id, + 'results' => $_smarty_results); + require_once(SMARTY_CORE_DIR . 'core.write_cache_file.php'); + smarty_core_write_cache_file($_params, $this); + require_once(SMARTY_CORE_DIR . 'core.process_cached_inserts.php'); + $_smarty_results = smarty_core_process_cached_inserts($_params, $this); + + if ($this->_cache_serials) { + // strip nocache-tags from output + $_smarty_results = preg_replace('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!s' + ,'' + ,$_smarty_results); + } + // restore initial cache_info + $this->_cache_info = array_pop($_cache_info); + } + $this->_cache_including = $_cache_including; + + if ($display) { + if (isset($_smarty_results)) { echo $_smarty_results; } + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$_included_tpls_idx]['exec_time'] = (smarty_core_get_microtime($_params, $this) - $_debug_start_time); + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + echo smarty_core_display_debug_console($_params, $this); + } + error_reporting($_smarty_old_error_level); + return; + } else { + error_reporting($_smarty_old_error_level); + if (isset($_smarty_results)) { return $_smarty_results; } + } + } + + /** + * load configuration values + * + * @param string $file + * @param string $section + * @param string $scope + */ + function config_load($file, $section = null, $scope = 'global') + { + require_once($this->_get_plugin_filepath('function', 'config_load')); + smarty_function_config_load(array('file' => $file, 'section' => $section, 'scope' => $scope), $this); + } + + /** + * return a reference to a registered object + * + * @param string $name + * @return object + */ + function &get_registered_object($name) { + if (!isset($this->_reg_objects[$name])) + $this->_trigger_fatal_error("'$name' is not a registered object"); + + if (!is_object($this->_reg_objects[$name][0])) + $this->_trigger_fatal_error("registered '$name' is not an object"); + + return $this->_reg_objects[$name][0]; + } + + /** + * clear configuration values + * + * @param string $var + */ + function clear_config($var = null) + { + if(!isset($var)) { + // clear all values + $this->_config = array(array('vars' => array(), + 'files' => array())); + } else { + unset($this->_config[0]['vars'][$var]); + } + } + + /** + * get filepath of requested plugin + * + * @param string $type + * @param string $name + * @return string|false + */ + function _get_plugin_filepath($type, $name) + { + $_params = array('type' => $type, 'name' => $name); + require_once(SMARTY_CORE_DIR . 'core.assemble_plugin_filepath.php'); + return smarty_core_assemble_plugin_filepath($_params, $this); + } + + /** + * test if resource needs compiling + * + * @param string $resource_name + * @param string $compile_path + * @return boolean + */ + function _is_compiled($resource_name, $compile_path) + { + if (!$this->force_compile && file_exists($compile_path)) { + if (!$this->compile_check) { + // no need to check compiled file + return true; + } else { + // get file source and timestamp + $_params = array('resource_name' => $resource_name, 'get_source'=>false); + if (!$this->_fetch_resource_info($_params)) { + return false; + } + if ($_params['resource_timestamp'] <= filemtime($compile_path)) { + // template not expired, no recompile + return true; + } else { + // compile template + return false; + } + } + } else { + // compiled template does not exist, or forced compile + return false; + } + } + + /** + * compile the template + * + * @param string $resource_name + * @param string $compile_path + * @return boolean + */ + function _compile_resource($resource_name, $compile_path) + { + + $_params = array('resource_name' => $resource_name); + if (!$this->_fetch_resource_info($_params)) { + return false; + } + + $_source_content = $_params['source_content']; + $_cache_include = substr($compile_path, 0, -4).'.inc'; + + if ($this->_compile_source($resource_name, $_source_content, $_compiled_content, $_cache_include)) { + // if a _cache_serial was set, we also have to write an include-file: + if ($this->_cache_include_info) { + require_once(SMARTY_CORE_DIR . 'core.write_compiled_include.php'); + smarty_core_write_compiled_include(array_merge($this->_cache_include_info, array('compiled_content'=>$_compiled_content, 'resource_name'=>$resource_name)), $this); + } + + $_params = array('compile_path'=>$compile_path, 'compiled_content' => $_compiled_content); + require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); + smarty_core_write_compiled_resource($_params, $this); + + return true; + } else { + return false; + } + + } + + /** + * compile the given source + * + * @param string $resource_name + * @param string $source_content + * @param string $compiled_content + * @return boolean + */ + function _compile_source($resource_name, &$source_content, &$compiled_content, $cache_include_path=null) + { + if (file_exists(SMARTY_DIR . $this->compiler_file)) { + require_once(SMARTY_DIR . $this->compiler_file); + } else { + // use include_path + require_once($this->compiler_file); + } + + + $smarty_compiler = new $this->compiler_class; + + $smarty_compiler->template_dir = $this->template_dir; + $smarty_compiler->compile_dir = $this->compile_dir; + $smarty_compiler->plugins_dir = $this->plugins_dir; + $smarty_compiler->config_dir = $this->config_dir; + $smarty_compiler->force_compile = $this->force_compile; + $smarty_compiler->caching = $this->caching; + $smarty_compiler->php_handling = $this->php_handling; + $smarty_compiler->left_delimiter = $this->left_delimiter; + $smarty_compiler->right_delimiter = $this->right_delimiter; + $smarty_compiler->_version = $this->_version; + $smarty_compiler->security = $this->security; + $smarty_compiler->secure_dir = $this->secure_dir; + $smarty_compiler->security_settings = $this->security_settings; + $smarty_compiler->trusted_dir = $this->trusted_dir; + $smarty_compiler->use_sub_dirs = $this->use_sub_dirs; + $smarty_compiler->_reg_objects = &$this->_reg_objects; + $smarty_compiler->_plugins = &$this->_plugins; + $smarty_compiler->_tpl_vars = &$this->_tpl_vars; + $smarty_compiler->default_modifiers = $this->default_modifiers; + $smarty_compiler->compile_id = $this->_compile_id; + $smarty_compiler->_config = $this->_config; + $smarty_compiler->request_use_auto_globals = $this->request_use_auto_globals; + + if (isset($cache_include_path) && isset($this->_cache_serials[$cache_include_path])) { + $smarty_compiler->_cache_serial = $this->_cache_serials[$cache_include_path]; + } + $smarty_compiler->_cache_include = $cache_include_path; + + + $_results = $smarty_compiler->_compile_file($resource_name, $source_content, $compiled_content); + + if ($smarty_compiler->_cache_serial) { + $this->_cache_include_info = array( + 'cache_serial'=>$smarty_compiler->_cache_serial + ,'plugins_code'=>$smarty_compiler->_plugins_code + ,'include_file_path' => $cache_include_path); + + } else { + $this->_cache_include_info = null; + + } + + return $_results; + } + + /** + * Get the compile path for this resource + * + * @param string $resource_name + * @return string results of {@link _get_auto_filename()} + */ + function _get_compile_path($resource_name) + { + return $this->_get_auto_filename($this->compile_dir, $resource_name, + $this->_compile_id) . '.php'; + } + + /** + * fetch the template info. Gets timestamp, and source + * if get_source is true + * + * sets $source_content to the source of the template, and + * $resource_timestamp to its time stamp + * @param string $resource_name + * @param string $source_content + * @param integer $resource_timestamp + * @param boolean $get_source + * @param boolean $quiet + * @return boolean + */ + + function _fetch_resource_info(&$params) + { + if(!isset($params['get_source'])) { $params['get_source'] = true; } + if(!isset($params['quiet'])) { $params['quiet'] = false; } + + $_return = false; + $_params = array('resource_name' => $params['resource_name']) ; + if (isset($params['resource_base_path'])) + $_params['resource_base_path'] = $params['resource_base_path']; + else + $_params['resource_base_path'] = $this->template_dir; + + if ($this->_parse_resource_name($_params)) { + $_resource_type = $_params['resource_type']; + $_resource_name = $_params['resource_name']; + switch ($_resource_type) { + case 'file': + if ($params['get_source']) { + $params['source_content'] = $this->_read_file($_resource_name); + } + $params['resource_timestamp'] = filemtime($_resource_name); + $_return = is_file($_resource_name); + break; + + default: + // call resource functions to fetch the template source and timestamp + if ($params['get_source']) { + $_source_return = isset($this->_plugins['resource'][$_resource_type]) && + call_user_func_array($this->_plugins['resource'][$_resource_type][0][0], + array($_resource_name, &$params['source_content'], &$this)); + } else { + $_source_return = true; + } + + $_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) && + call_user_func_array($this->_plugins['resource'][$_resource_type][0][1], + array($_resource_name, &$params['resource_timestamp'], &$this)); + + $_return = $_source_return && $_timestamp_return; + break; + } + } + + if (!$_return) { + // see if we can get a template with the default template handler + if (!empty($this->default_template_handler_func)) { + if (!is_callable($this->default_template_handler_func)) { + $this->trigger_error("default template handler function \"$this->default_template_handler_func\" doesn't exist."); + } else { + $_return = call_user_func_array( + $this->default_template_handler_func, + array($_params['resource_type'], $_params['resource_name'], &$params['source_content'], &$params['resource_timestamp'], &$this)); + } + } + } + + if (!$_return) { + if (!$params['quiet']) { + $this->trigger_error('unable to read resource: "' . $params['resource_name'] . '"'); + } + } else if ($_return && $this->security) { + require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); + if (!smarty_core_is_secure($_params, $this)) { + if (!$params['quiet']) + $this->trigger_error('(secure mode) accessing "' . $params['resource_name'] . '" is not allowed'); + $params['source_content'] = null; + $params['resource_timestamp'] = null; + return false; + } + } + return $_return; + } + + + /** + * parse out the type and name from the resource + * + * @param string $resource_base_path + * @param string $resource_name + * @param string $resource_type + * @param string $resource_name + * @return boolean + */ + + function _parse_resource_name(&$params) + { + + // split tpl_path by the first colon + $_resource_name_parts = explode(':', $params['resource_name'], 2); + + if (count($_resource_name_parts) == 1) { + // no resource type given + $params['resource_type'] = $this->default_resource_type; + $params['resource_name'] = $_resource_name_parts[0]; + } else { + if(strlen($_resource_name_parts[0]) == 1) { + // 1 char is not resource type, but part of filepath + $params['resource_type'] = $this->default_resource_type; + $params['resource_name'] = $params['resource_name']; + } else { + $params['resource_type'] = $_resource_name_parts[0]; + $params['resource_name'] = $_resource_name_parts[1]; + } + } + + if ($params['resource_type'] == 'file') { + if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $params['resource_name'])) { + // relative pathname to $params['resource_base_path'] + // use the first directory where the file is found + foreach ((array)$params['resource_base_path'] as $_curr_path) { + $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name']; + if (file_exists($_fullpath) && is_file($_fullpath)) { + $params['resource_name'] = $_fullpath; + return true; + } + // didn't find the file, try include_path + $_params = array('file_path' => $_fullpath); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $this)) { + $params['resource_name'] = $_params['new_file_path']; + return true; + } + } + return false; + } else { + /* absolute path */ + return file_exists($params['resource_name']); + } + } elseif (empty($this->_plugins['resource'][$params['resource_type']])) { + $_params = array('type' => $params['resource_type']); + require_once(SMARTY_CORE_DIR . 'core.load_resource_plugin.php'); + smarty_core_load_resource_plugin($_params, $this); + } + + return true; + } + + + /** + * Handle modifiers + * + * @param string|null $modifier_name + * @param array|null $map_array + * @return string result of modifiers + */ + function _run_mod_handler() + { + $_args = func_get_args(); + list($_modifier_name, $_map_array) = array_splice($_args, 0, 2); + list($_func_name, $_tpl_file, $_tpl_line) = + $this->_plugins['modifier'][$_modifier_name]; + + $_var = $_args[0]; + foreach ($_var as $_key => $_val) { + $_args[0] = $_val; + $_var[$_key] = call_user_func_array($_func_name, $_args); + } + return $_var; + } + + /** + * Remove starting and ending quotes from the string + * + * @param string $string + * @return string + */ + function _dequote($string) + { + if ((substr($string, 0, 1) == "'" || substr($string, 0, 1) == '"') && + substr($string, -1) == substr($string, 0, 1)) + return substr($string, 1, -1); + else + return $string; + } + + + /** + * read in a file + * + * @param string $filename + * @return string + */ + function _read_file($filename) + { + if ( file_exists($filename) && ($fd = @fopen($filename, 'rb')) ) { + $contents = ''; + while (!feof($fd)) { + $contents .= fread($fd, 8192); + } + fclose($fd); + return $contents; + } else { + return false; + } + } + + /** + * get a concrete filename for automagically created content + * + * @param string $auto_base + * @param string $auto_source + * @param string $auto_id + * @return string + * @staticvar string|null + * @staticvar string|null + */ + function _get_auto_filename($auto_base, $auto_source = null, $auto_id = null) + { + $_compile_dir_sep = $this->use_sub_dirs ? DIRECTORY_SEPARATOR : '^'; + $_return = $auto_base . DIRECTORY_SEPARATOR; + + if(isset($auto_id)) { + // make auto_id safe for directory names + $auto_id = str_replace('%7C',$_compile_dir_sep,(urlencode($auto_id))); + // split into separate directories + $_return .= $auto_id . $_compile_dir_sep; + } + + if(isset($auto_source)) { + // make source name safe for filename + $_filename = urlencode(basename($auto_source)); + $_crc32 = sprintf('%08X', crc32($auto_source)); + // prepend %% to avoid name conflicts with + // with $params['auto_id'] names + $_crc32 = substr($_crc32, 0, 2) . $_compile_dir_sep . + substr($_crc32, 0, 3) . $_compile_dir_sep . $_crc32; + $_return .= '%%' . $_crc32 . '%%' . $_filename; + } + + return $_return; + } + + /** + * unlink a file, possibly using expiration time + * + * @param string $resource + * @param integer $exp_time + */ + function _unlink($resource, $exp_time = null) + { + if(isset($exp_time)) { + if(time() - @filemtime($resource) >= $exp_time) { + return @unlink($resource); + } + } else { + return @unlink($resource); + } + } + + /** + * returns an auto_id for auto-file-functions + * + * @param string $cache_id + * @param string $compile_id + * @return string|null + */ + function _get_auto_id($cache_id=null, $compile_id=null) { + if (isset($cache_id)) + return (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id; + elseif(isset($compile_id)) + return $compile_id; + else + return null; + } + + /** + * trigger Smarty plugin error + * + * @param string $error_msg + * @param string $tpl_file + * @param integer $tpl_line + * @param string $file + * @param integer $line + * @param integer $error_type + */ + function _trigger_fatal_error($error_msg, $tpl_file = null, $tpl_line = null, + $file = null, $line = null, $error_type = E_USER_ERROR) + { + if(isset($file) && isset($line)) { + $info = ' ('.basename($file).", line $line)"; + } else { + $info = ''; + } + if (isset($tpl_line) && isset($tpl_file)) { + $this->trigger_error('[in ' . $tpl_file . ' line ' . $tpl_line . "]: $error_msg$info", $error_type); + } else { + $this->trigger_error($error_msg . $info, $error_type); + } + } + + + /** + * callback function for preg_replace, to call a non-cacheable block + * @return string + */ + function _process_compiled_include_callback($match) { + $_func = '_smarty_tplfunc_'.$match[2].'_'.$match[3]; + ob_start(); + $_func($this); + $_ret = ob_get_contents(); + ob_end_clean(); + return $_ret; + } + + + /** + * called for included templates + * + * @param string $_smarty_include_tpl_file + * @param string $_smarty_include_vars + */ + + // $_smarty_include_tpl_file, $_smarty_include_vars + + function _smarty_include($params) + { + if ($this->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $debug_start_time = smarty_core_get_microtime($_params, $this); + $this->_smarty_debug_info[] = array('type' => 'template', + 'filename' => $params['smarty_include_tpl_file'], + 'depth' => ++$this->_inclusion_depth); + $included_tpls_idx = count($this->_smarty_debug_info) - 1; + } + + $this->_tpl_vars = array_merge($this->_tpl_vars, $params['smarty_include_vars']); + + // config vars are treated as local, so push a copy of the + // current ones onto the front of the stack + array_unshift($this->_config, $this->_config[0]); + + $_smarty_compile_path = $this->_get_compile_path($params['smarty_include_tpl_file']); + + + if ($this->_is_compiled($params['smarty_include_tpl_file'], $_smarty_compile_path) + || $this->_compile_resource($params['smarty_include_tpl_file'], $_smarty_compile_path)) + { + include($_smarty_compile_path); + } + + // pop the local vars off the front of the stack + array_shift($this->_config); + + $this->_inclusion_depth--; + + if ($this->debugging) { + // capture time for debugging info + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $this->_smarty_debug_info[$included_tpls_idx]['exec_time'] = smarty_core_get_microtime($_params, $this) - $debug_start_time; + } + + if ($this->caching) { + $this->_cache_info['template'][$params['smarty_include_tpl_file']] = true; + } + } + + + /** + * get or set an array of cached attributes for function that is + * not cacheable + * @return array + */ + function &_smarty_cache_attrs($cache_serial, $count) { + $_cache_attrs =& $this->_cache_info['cache_attrs'][$cache_serial][$count]; + + if ($this->_cache_including) { + /* return next set of cache_attrs */ + $_return = current($_cache_attrs); + next($_cache_attrs); + return $_return; + + } else { + /* add a reference to a new set of cache_attrs */ + $_cache_attrs[] = array(); + return $_cache_attrs[count($_cache_attrs)-1]; + + } + + } + + + /** + * wrapper for include() retaining $this + * @return mixed + */ + function _include($filename, $once=false, $params=null) + { + if ($once) { + return include_once($filename); + } else { + return include($filename); + } + } + + + /** + * wrapper for eval() retaining $this + * @return mixed + */ + function _eval($code, $params=null) + { + return eval($code); + } + /**#@-*/ + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php new file mode 100644 index 0000000..95bb1a2 --- /dev/null +++ b/libs/Smarty_Compiler.class.php @@ -0,0 +1,2313 @@ +<?php + +/** + * Project: Smarty: the PHP compiling template engine + * File: Smarty_Compiler.class.php + * + * 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 + * + * @link http://smarty.php.net/ + * @author Monte Ohrt <monte at ohrt dot com> + * @author Andrei Zmievski <[email protected]> + * @version 2.6.13 + * @copyright 2001-2005 New Digital Group, Inc. + * @package Smarty + */ + +/* $Id$ */ + +/** + * Template compiling class + * @package Smarty + */ +class Smarty_Compiler extends Smarty { + + // internal vars + /**#@+ + * @access private + */ + var $_folded_blocks = array(); // keeps folded template blocks + var $_current_file = null; // the current template being compiled + var $_current_line_no = 1; // line number for error messages + var $_capture_stack = array(); // keeps track of nested capture buffers + var $_plugin_info = array(); // keeps track of plugins to load + var $_init_smarty_vars = false; + var $_permitted_tokens = array('true','false','yes','no','on','off','null'); + var $_db_qstr_regexp = null; // regexps are setup in the constructor + var $_si_qstr_regexp = null; + var $_qstr_regexp = null; + var $_func_regexp = null; + var $_reg_obj_regexp = null; + var $_var_bracket_regexp = null; + var $_num_const_regexp = null; + var $_dvar_guts_regexp = null; + var $_dvar_regexp = null; + var $_cvar_regexp = null; + var $_svar_regexp = null; + var $_avar_regexp = null; + var $_mod_regexp = null; + var $_var_regexp = null; + var $_parenth_param_regexp = null; + var $_func_call_regexp = null; + var $_obj_ext_regexp = null; + var $_obj_start_regexp = null; + var $_obj_params_regexp = null; + var $_obj_call_regexp = null; + var $_cacheable_state = 0; + var $_cache_attrs_count = 0; + var $_nocache_count = 0; + var $_cache_serial = null; + var $_cache_include = null; + + var $_strip_depth = 0; + var $_additional_newline = "\n"; + + /**#@-*/ + /** + * The class constructor. + */ + function Smarty_Compiler() + { + // matches double quoted strings: + // "foobar" + // "foo\"bar" + $this->_db_qstr_regexp = '"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"'; + + // matches single quoted strings: + // 'foobar' + // 'foo\'bar' + $this->_si_qstr_regexp = '\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\''; + + // matches single or double quoted strings + $this->_qstr_regexp = '(?:' . $this->_db_qstr_regexp . '|' . $this->_si_qstr_regexp . ')'; + + // matches bracket portion of vars + // [0] + // [foo] + // [$bar] + $this->_var_bracket_regexp = '\[\$?[\w\.]+\]'; + + // matches numerical constants + // 30 + // -12 + // 13.22 + $this->_num_const_regexp = '(?:\-?\d+(?:\.\d+)?)'; + + // matches $ vars (not objects): + // $foo + // $foo.bar + // $foo.bar.foobar + // $foo[0] + // $foo[$bar] + // $foo[5][blah] + // $foo[5].bar[$foobar][4] + $this->_dvar_math_regexp = '(?:[\+\*\/\%]|(?:-(?!>)))'; + $this->_dvar_math_var_regexp = '[\$\w\.\+\-\*\/\%\d\>\[\]]'; + $this->_dvar_guts_regexp = '\w+(?:' . $this->_var_bracket_regexp + . ')*(?:\.\$?\w+(?:' . $this->_var_bracket_regexp . ')*)*(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?'; + $this->_dvar_regexp = '\$' . $this->_dvar_guts_regexp; + + // matches config vars: + // #foo# + // #foobar123_foo# + $this->_cvar_regexp = '\#\w+\#'; + + // matches section vars: + // %foo.bar% + $this->_svar_regexp = '\%\w+\.\w+\%'; + + // matches all valid variables (no quotes, no modifiers) + $this->_avar_regexp = '(?:' . $this->_dvar_regexp . '|' + . $this->_cvar_regexp . '|' . $this->_svar_regexp . ')'; + + // matches valid variable syntax: + // $foo + // $foo + // #foo# + // #foo# + // "text" + // "text" + $this->_var_regexp = '(?:' . $this->_avar_regexp . '|' . $this->_qstr_regexp . ')'; + + // matches valid object call (one level of object nesting allowed in parameters): + // $foo->bar + // $foo->bar() + // $foo->bar("text") + // $foo->bar($foo, $bar, "text") + // $foo->bar($foo, "foo") + // $foo->bar->foo() + // $foo->bar->foo->bar() + // $foo->bar($foo->bar) + // $foo->bar($foo->bar()) + // $foo->bar($foo->bar($blah,$foo,44,"foo",$foo[0].bar)) + $this->_obj_ext_regexp = '\->(?:\$?' . $this->_dvar_guts_regexp . ')'; + $this->_obj_restricted_param_regexp = '(?:' + . '(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')(?:' . $this->_obj_ext_regexp . '(?:\((?:(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . ')' + . '(?:\s*,\s*(?:' . $this->_var_regexp . '|' . $this->_num_const_regexp . '))*)?\))?)*)'; + $this->_obj_single_param_regexp = '(?:\w+|' . $this->_obj_restricted_param_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_var_regexp . $this->_obj_restricted_param_regexp . ')))*)'; + $this->_obj_params_regexp = '\((?:' . $this->_obj_single_param_regexp + . '(?:\s*,\s*' . $this->_obj_single_param_regexp . ')*)?\)'; + $this->_obj_start_regexp = '(?:' . $this->_dvar_regexp . '(?:' . $this->_obj_ext_regexp . ')+)'; + $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)'; + + // matches valid modifier syntax: + // |foo + // |@foo + // |foo:"bar" + // |foo:$bar + // |foo:"bar":$foobar + // |foo|bar + // |foo:$foo->bar + $this->_mod_regexp = '(?:\|@?\w+(?::(?:\w+|' . $this->_num_const_regexp . '|' + . $this->_obj_call_regexp . '|' . $this->_avar_regexp . '|' . $this->_qstr_regexp .'))*)'; + + // matches valid function name: + // foo123 + // _foo_bar + $this->_func_regexp = '[a-zA-Z_]\w*'; + + // matches valid registered object: + // foo->bar + $this->_reg_obj_regexp = '[a-zA-Z_]\w*->[a-zA-Z_]\w*'; + + // matches valid parameter values: + // true + // $foo + // $foo|bar + // #foo# + // #foo#|bar + // "text" + // "text"|bar + // $foo->bar + $this->_param_regexp = '(?:\s*(?:' . $this->_obj_call_regexp . '|' + . $this->_var_regexp . '|' . $this->_num_const_regexp . '|\w+)(?>' . $this->_mod_regexp . '*)\s*)'; + + // matches valid parenthesised function parameters: + // + // "text" + // $foo, $bar, "text" + // $foo|bar, "foo"|bar, $foo->bar($foo)|bar + $this->_parenth_param_regexp = '(?:\((?:\w+|' + . $this->_param_regexp . '(?:\s*,\s*(?:(?:\w+|' + . $this->_param_regexp . ')))*)?\))'; + + // matches valid function call: + // foo() + // foo_bar($foo) + // _foo_bar($foo,"bar") + // foo123($foo,$foo->bar(),"foo") + $this->_func_call_regexp = '(?:' . $this->_func_regexp . '\s*(?:' + . $this->_parenth_param_regexp . '))'; + } + + /** + * compile a resource + * + * sets $compiled_content to the compiled source + * @param string $resource_name + * @param string $source_content + * @param string $compiled_content + * @return true + */ + function _compile_file($resource_name, $source_content, &$compiled_content) + { + + if ($this->security) { + // do not allow php syntax to be executed unless specified + if ($this->php_handling == SMARTY_PHP_ALLOW && + !$this->security_settings['PHP_HANDLING']) { + $this->php_handling = SMARTY_PHP_PASSTHRU; + } + } + + $this->_load_filters(); + + $this->_current_file = $resource_name; + $this->_current_line_no = 1; + $ldq = preg_quote($this->left_delimiter, '~'); + $rdq = preg_quote($this->right_delimiter, '~'); + + // run template source through prefilter functions + if (count($this->_plugins['prefilter']) > 0) { + foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { + if ($prefilter === false) continue; + if ($prefilter[3] || is_callable($prefilter[0])) { + $source_content = call_user_func_array($prefilter[0], + array($source_content, &$this)); + $this->_plugins['prefilter'][$filter_name][3] = true; + } else { + $this->_trigger_fatal_error("[plugin] prefilter '$filter_name' is not implemented"); + } + } + } + + /* fetch all special blocks */ + $search = "~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s"; + + preg_match_all($search, $source_content, $match, PREG_SET_ORDER); + $this->_folded_blocks = $match; + reset($this->_folded_blocks); + + /* replace special blocks by "{php}" */ + $source_content = preg_replace($search.'e', "'" + . $this->_quote_replace($this->left_delimiter) . 'php' + . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'" + . $this->_quote_replace($this->right_delimiter) + . "'" + , $source_content); + + /* Gather all template tags. */ + preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match); + $template_tags = $_match[1]; + /* Split content by template tags to obtain non-template content. */ + $text_blocks = preg_split("~{$ldq}.*?{$rdq}~s", $source_content); + + /* loop through text blocks */ + for ($curr_tb = 0, $for_max = count($text_blocks); $curr_tb < $for_max; $curr_tb++) { + /* match anything resembling php tags */ + if (preg_match_all('~(<\?(?:\w+|=)?|\?>|language\s*=\s*[\"\']?php[\"\']?)~is', $text_blocks[$curr_tb], $sp_match)) { + /* replace tags with placeholders to prevent recursive replacements */ + $sp_match[1] = array_unique($sp_match[1]); + usort($sp_match[1], '_smarty_sort_length'); + for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { + $text_blocks[$curr_tb] = str_replace($sp_match[1][$curr_sp],'%%%SMARTYSP'.$curr_sp.'%%%',$text_blocks[$curr_tb]); + } + /* process each one */ + for ($curr_sp = 0, $for_max2 = count($sp_match[1]); $curr_sp < $for_max2; $curr_sp++) { + if ($this->php_handling == SMARTY_PHP_PASSTHRU) { + /* echo php contents */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '<?php echo \''.str_replace("'", "\'", $sp_match[1][$curr_sp]).'\'; ?>'."\n", $text_blocks[$curr_tb]); + } else if ($this->php_handling == SMARTY_PHP_QUOTE) { + /* quote php tags */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', htmlspecialchars($sp_match[1][$curr_sp]), $text_blocks[$curr_tb]); + } else if ($this->php_handling == SMARTY_PHP_REMOVE) { + /* remove php tags */ + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', '', $text_blocks[$curr_tb]); + } else { + /* SMARTY_PHP_ALLOW, but echo non php starting tags */ + $sp_match[1][$curr_sp] = preg_replace('~(<\?(?!php|=|$))~i', '<?php echo \'\\1\'?>'."\n", $sp_match[1][$curr_sp]); + $text_blocks[$curr_tb] = str_replace('%%%SMARTYSP'.$curr_sp.'%%%', $sp_match[1][$curr_sp], $text_blocks[$curr_tb]); + } + } + } + } + + /* Compile the template tags into PHP code. */ + $compiled_tags = array(); + for ($i = 0, $for_max = count($template_tags); $i < $for_max; $i++) { + $this->_current_line_no += substr_count($text_blocks[$i], "\n"); + $compiled_tags[] = $this->_compile_tag($template_tags[$i]); + $this->_current_line_no += substr_count($template_tags[$i], "\n"); + } + if (count($this->_tag_stack)>0) { + list($_open_tag, $_line_no) = end($this->_tag_stack); + $this->_syntax_error("unclosed tag \{$_open_tag} (opened line $_line_no).", E_USER_ERROR, __FILE__, __LINE__); + 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. */ + for ($i = 0, $for_max = count($compiled_tags); $i < $for_max; $i++) { + if ($compiled_tags[$i] == '') { + // tag result empty, remove first newline from following text block + $text_blocks[$i+1] = preg_replace('~^(\r\n|\r|\n)~', '', $text_blocks[$i+1]); + } + $compiled_content .= $text_blocks[$i].$compiled_tags[$i]; + } + $compiled_content .= $text_blocks[$i]; + + // remove \n from the end of the file, if any + if (strlen($compiled_content) && (substr($compiled_content, -1) == "\n") ) { + $compiled_content = substr($compiled_content, 0, -1); + } + + if (!empty($this->_cache_serial)) { + $compiled_content = "<?php \$this->_cache_serials['".$this->_cache_include."'] = '".$this->_cache_serial."'; ?>" . $compiled_content; + } + + // remove unnecessary close/open tags + $compiled_content = preg_replace('~\?>\n?<\?php~', '', $compiled_content); + + // run compiled template through postfilter functions + if (count($this->_plugins['postfilter']) > 0) { + foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { + if ($postfilter === false) continue; + if ($postfilter[3] || is_callable($postfilter[0])) { + $compiled_content = call_user_func_array($postfilter[0], + array($compiled_content, &$this)); + $this->_plugins['postfilter'][$filter_name][3] = true; + } else { + $this->_trigger_fatal_error("Smarty plugin error: postfilter '$filter_name' is not implemented"); + } + } + } + + // put header at the top of the compiled template + $template_header = "<?php /* Smarty version ".$this->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $template_header .= " compiled from ".strtr(urlencode($resource_name), array('%2F'=>'/', '%3A'=>':'))." */ ?>\n"; + + /* Emit code to load needed plugins. */ + $this->_plugins_code = ''; + if (count($this->_plugin_info)) { + $_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', '" . strtr($plugin_info[0], array("'" => "\\'", "\\" => "\\\\")) . "', $plugin_info[1], "; + $_plugins_params .= $plugin_info[2] ? 'true),' : 'false),'; + } + } + $_plugins_params .= '))'; + $plugins_code = "<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');\nsmarty_core_load_plugins($_plugins_params, \$this); ?>\n"; + $template_header .= $plugins_code; + $this->_plugin_info = array(); + $this->_plugins_code = $plugins_code; + } + + if ($this->_init_smarty_vars) { + $template_header .= "<?php require_once(SMARTY_CORE_DIR . 'core.assign_smarty_interface.php');\nsmarty_core_assign_smarty_interface(null, \$this); ?>\n"; + $this->_init_smarty_vars = false; + } + + $compiled_content = $template_header . $compiled_content; + return true; + } + + /** + * Compile a template tag + * + * @param string $template_tag + * @return string + */ + function _compile_tag($template_tag) + { + /* Matched comment. */ + if (substr($template_tag, 0, 1) == '*' && substr($template_tag, -1) == '*') + return ''; + + /* Split tag into two three parts: command, command modifiers and the arguments. */ + if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp + . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*)) + (?:\s+(.*))?$ + ~xs', $template_tag, $match)) { + $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__); + } + + $tag_command = $match[1]; + $tag_modifier = isset($match[2]) ? $match[2] : null; + $tag_args = isset($match[3]) ? $match[3] : null; + + 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); + return "<?php echo $_return; ?>" . $this->_additional_newline; + } + + /* If the tag name is a registered object, we process it. */ + if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) { + return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier); + } + + switch ($tag_command) { + case 'include': + return $this->_compile_include_tag($tag_args); + + case 'include_php': + return $this->_compile_include_php_tag($tag_args); + + case 'if': + $this->_push_tag('if'); + return $this->_compile_if_tag($tag_args); + + case 'else': + list($_open_tag) = end($this->_tag_stack); + if ($_open_tag != 'if' && $_open_tag != 'elseif') + $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__); + else + $this->_push_tag('else'); + return '<?php else: ?>'; + + case 'elseif': + list($_open_tag) = end($this->_tag_stack); + if ($_open_tag != 'if' && $_open_tag != 'elseif') + $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__); + if ($_open_tag == 'if') + $this->_push_tag('elseif'); + return $this->_compile_if_tag($tag_args, true); + + case '/if': + $this->_pop_tag('if'); + return '<?php endif; ?>'; + + case 'capture': + return $this->_compile_capture_tag(true, $tag_args); + + case '/capture': + return $this->_compile_capture_tag(false); + + case 'ldelim': + return $this->left_delimiter; + + case 'rdelim': + return $this->right_delimiter; + + case 'section': + $this->_push_tag('section'); + return $this->_compile_section_start($tag_args); + + case 'sectionelse': + $this->_push_tag('sectionelse'); + return "<?php endfor; else: ?>"; + break; + + case '/section': + $_open_tag = $this->_pop_tag('section'); + if ($_open_tag == 'sectionelse') + return "<?php endif; ?>"; + else + return "<?php endfor; endif; ?>"; + + case 'foreach': + $this->_push_tag('foreach'); + return $this->_compile_foreach_start($tag_args); + break; + + case 'foreachelse': + $this->_push_tag('foreachelse'); + return "<?php endforeach; else: ?>"; + + case '/foreach': + $_open_tag = $this->_pop_tag('foreach'); + if ($_open_tag == 'foreachelse') + return "<?php endif; unset(\$_from); ?>"; + else + return "<?php endforeach; endif; unset(\$_from); ?>"; + break; + + case 'strip': + case '/strip': + if (substr($tag_command, 0, 1)=='/') { + $this->_pop_tag('strip'); + if (--$this->_strip_depth==0) { /* outermost closing {/strip} */ + $this->_additional_newline = "\n"; + return '{' . $tag_command . '}'; + } + } else { + $this->_push_tag('strip'); + if ($this->_strip_depth++==0) { /* outermost opening {strip} */ + $this->_additional_newline = ""; + return '{' . $tag_command . '}'; + } + } + return ''; + + case 'php': + /* handle folded tags replaced by {php} */ + list(, $block) = each($this->_folded_blocks); + $this->_current_line_no += substr_count($block[0], "\n"); + /* the number of matched elements in the regexp in _compile_file() + determins the type of folded tag that was found */ + switch (count($block)) { + case 2: /* comment */ + return ''; + + case 3: /* literal */ + return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline; + + case 4: /* php */ + if ($this->security && !$this->security_settings['PHP_TAGS']) { + $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__); + return; + } + return '<?php ' . $block[3] .' ?>'; + } + break; + + case 'insert': + return $this->_compile_insert_tag($tag_args); + + default: + if ($this->_compile_compiler_tag($tag_command, $tag_args, $output)) { + return $output; + } else if ($this->_compile_block_tag($tag_command, $tag_args, $tag_modifier, $output)) { + return $output; + } else if ($this->_compile_custom_tag($tag_command, $tag_args, $tag_modifier, $output)) { + return $output; + } else { + $this->_syntax_error("unrecognized tag '$tag_command'", E_USER_ERROR, __FILE__, __LINE__); + } + + } + } + + + /** + * compile the custom compiler tag + * + * sets $output to the compiled custom compiler tag + * @param string $tag_command + * @param string $tag_args + * @param string $output + * @return boolean + */ + function _compile_compiler_tag($tag_command, $tag_args, &$output) + { + $found = false; + $have_function = true; + + /* + * First we check if the compiler function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['compiler'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['compiler'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "compiler function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('compiler', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_compiler_' . $tag_command; + if (!is_callable($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['compiler'][$tag_command] = array($plugin_func, null, null, null, true); + } + } + + /* + * True return value means that we either found a plugin or a + * dynamically registered function. False means that we didn't and the + * compiler should now emit code to load custom function plugin for this + * tag. + */ + if ($found) { + if ($have_function) { + $output = call_user_func_array($plugin_func, array($tag_args, &$this)); + if($output != '') { + $output = '<?php ' . $this->_push_cacheable_state('compiler', $tag_command) + . $output + . $this->_pop_cacheable_state('compiler', $tag_command) . ' ?>'; + } + } else { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + } + return true; + } else { + return false; + } + } + + + /** + * compile block function tag + * + * sets $output to compiled block function tag + * @param string $tag_command + * @param string $tag_args + * @param string $tag_modifier + * @param string $output + * @return boolean + */ + function _compile_block_tag($tag_command, $tag_args, $tag_modifier, &$output) + { + if (substr($tag_command, 0, 1) == '/') { + $start_tag = false; + $tag_command = substr($tag_command, 1); + } else + $start_tag = true; + + $found = false; + $have_function = true; + + /* + * First we check if the block function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['block'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['block'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "block function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('block', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_block_' . $tag_command; + if (!function_exists($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['block'][$tag_command] = array($plugin_func, null, null, null, true); + + } + } + + if (!$found) { + return false; + } else if (!$have_function) { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + return true; + } + + /* + * Even though we've located the plugin function, compilation + * happens only once, so the plugin will still need to be loaded + * at runtime for future requests. + */ + $this->_add_plugin('block', $tag_command); + + if ($start_tag) + $this->_push_tag($tag_command); + else + $this->_pop_tag($tag_command); + + if ($start_tag) { + $output = '<?php ' . $this->_push_cacheable_state('block', $tag_command); + $attrs = $this->_parse_attrs($tag_args); + $_cache_attrs=''; + $arg_list = $this->_compile_arg_list('block', $tag_command, $attrs, $_cache_attrs); + $output .= "$_cache_attrs\$this->_tag_stack[] = array('$tag_command', array(".implode(',', $arg_list).')); '; + $output .= '$_block_repeat=true;' . $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], null, $this, $_block_repeat);'; + $output .= 'while ($_block_repeat) { ob_start(); ?>'; + } else { + $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)'; + if ($tag_modifier != '') { + $this->_parse_modifiers($_out_tag_text, $tag_modifier); + } + $output .= '$_block_repeat=false;echo ' . $_out_tag_text . '; } '; + $output .= " array_pop(\$this->_tag_stack); " . $this->_pop_cacheable_state('block', $tag_command) . '?>'; + } + + return true; + } + + + /** + * compile custom function tag + * + * @param string $tag_command + * @param string $tag_args + * @param string $tag_modifier + * @return string + */ + function _compile_custom_tag($tag_command, $tag_args, $tag_modifier, &$output) + { + $found = false; + $have_function = true; + + /* + * First we check if the custom function has already been registered + * or loaded from a plugin file. + */ + if (isset($this->_plugins['function'][$tag_command])) { + $found = true; + $plugin_func = $this->_plugins['function'][$tag_command][0]; + if (!is_callable($plugin_func)) { + $message = "custom function '$tag_command' is not implemented"; + $have_function = false; + } + } + /* + * Otherwise we need to load plugin file and look for the function + * inside it. + */ + else if ($plugin_file = $this->_get_plugin_filepath('function', $tag_command)) { + $found = true; + + include_once $plugin_file; + + $plugin_func = 'smarty_function_' . $tag_command; + if (!function_exists($plugin_func)) { + $message = "plugin function $plugin_func() not found in $plugin_file\n"; + $have_function = false; + } else { + $this->_plugins['function'][$tag_command] = array($plugin_func, null, null, null, true); + + } + } + + if (!$found) { + return false; + } else if (!$have_function) { + $this->_syntax_error($message, E_USER_WARNING, __FILE__, __LINE__); + return true; + } + + /* declare plugin to be loaded on display of the template that + we compile right now */ + $this->_add_plugin('function', $tag_command); + + $_cacheable_state = $this->_push_cacheable_state('function', $tag_command); + $attrs = $this->_parse_attrs($tag_args); + $_cache_attrs = ''; + $arg_list = $this->_compile_arg_list('function', $tag_command, $attrs, $_cache_attrs); + + $output = $this->_compile_plugin_call('function', $tag_command).'(array('.implode(',', $arg_list)."), \$this)"; + if($tag_modifier != '') { + $this->_parse_modifiers($output, $tag_modifier); + } + + if($output != '') { + $output = '<?php ' . $_cacheable_state . $_cache_attrs . 'echo ' . $output . ';' + . $this->_pop_cacheable_state('function', $tag_command) . "?>" . $this->_additional_newline; + } + + return true; + } + + /** + * compile a registered object tag + * + * @param string $tag_command + * @param array $attrs + * @param string $tag_modifier + * @return string + */ + function _compile_registered_object_tag($tag_command, $attrs, $tag_modifier) + { + if (substr($tag_command, 0, 1) == '/') { + $start_tag = false; + $tag_command = substr($tag_command, 1); + } else { + $start_tag = true; + } + + list($object, $obj_comp) = explode('->', $tag_command); + + $arg_list = array(); + if(count($attrs)) { + $_assign_var = false; + foreach ($attrs as $arg_name => $arg_value) { + if($arg_name == 'assign') { + $_assign_var = $arg_value; + unset($attrs['assign']); + continue; + } + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + + if($this->_reg_objects[$object][2]) { + // smarty object argument format + $args = "array(".implode(',', (array)$arg_list)."), \$this"; + } else { + // traditional argument format + $args = implode(',', array_values($attrs)); + if (empty($args)) { + $args = 'null'; + } + } + + $prefix = ''; + $postfix = ''; + $newline = ''; + if(!is_object($this->_reg_objects[$object][0])) { + $this->_trigger_fatal_error("registered '$object' is not an object" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } elseif(!empty($this->_reg_objects[$object][1]) && !in_array($obj_comp, $this->_reg_objects[$object][1])) { + $this->_trigger_fatal_error("'$obj_comp' is not a registered component of object '$object'", $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } elseif(method_exists($this->_reg_objects[$object][0], $obj_comp)) { + // method + if(in_array($obj_comp, $this->_reg_objects[$object][3])) { + // block method + if ($start_tag) { + $prefix = "\$this->_tag_stack[] = array('$obj_comp', $args); "; + $prefix .= "\$_block_repeat=true; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], null, \$this, \$_block_repeat); "; + $prefix .= "while (\$_block_repeat) { ob_start();"; + $return = null; + $postfix = ''; + } else { + $prefix = "\$_obj_block_content = ob_get_contents(); ob_end_clean(); "; + $return = "\$_block_repeat=false; \$this->_reg_objects['$object'][0]->$obj_comp(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$_obj_block_content, \$this, \$_block_repeat)"; + $postfix = "} array_pop(\$this->_tag_stack);"; + } + } else { + // non-block method + $return = "\$this->_reg_objects['$object'][0]->$obj_comp($args)"; + } + } else { + // property + $return = "\$this->_reg_objects['$object'][0]->$obj_comp"; + } + + if($return != null) { + if($tag_modifier != '') { + $this->_parse_modifiers($return, $tag_modifier); + } + + if(!empty($_assign_var)) { + $output = "\$this->assign('" . $this->_dequote($_assign_var) ."', $return);"; + } else { + $output = 'echo ' . $return . ';'; + $newline = $this->_additional_newline; + } + } else { + $output = ''; + } + + return '<?php ' . $prefix . $output . $postfix . "?>" . $newline; + } + + /** + * Compile {insert ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_insert_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $name = $this->_dequote($attrs['name']); + + if (empty($name)) { + $this->_syntax_error("missing insert name", E_USER_ERROR, __FILE__, __LINE__); + } + + if (!empty($attrs['script'])) { + $delayed_loading = true; + } else { + $delayed_loading = false; + } + + foreach ($attrs as $arg_name => $arg_value) { + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + + $this->_add_plugin('insert', $name, $delayed_loading); + + $_params = "array('args' => array(".implode(', ', (array)$arg_list)."))"; + + return "<?php require_once(SMARTY_CORE_DIR . 'core.run_insert_handler.php');\necho smarty_core_run_insert_handler($_params, \$this); ?>" . $this->_additional_newline; + } + + /** + * Compile {include ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_include_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + if (empty($attrs['file'])) { + $this->_syntax_error("missing 'file' attribute in include tag", E_USER_ERROR, __FILE__, __LINE__); + } + + foreach ($attrs as $arg_name => $arg_value) { + if ($arg_name == 'file') { + $include_file = $arg_value; + continue; + } else if ($arg_name == 'assign') { + $assign_var = $arg_value; + continue; + } + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + + $output = '<?php '; + + if (isset($assign_var)) { + $output .= "ob_start();\n"; + } + + $output .= + "\$_smarty_tpl_vars = \$this->_tpl_vars;\n"; + + + $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(".implode(',', (array)$arg_list)."))"; + $output .= "\$this->_smarty_include($_params);\n" . + "\$this->_tpl_vars = \$_smarty_tpl_vars;\n" . + "unset(\$_smarty_tpl_vars);\n"; + + if (isset($assign_var)) { + $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n"; + } + + $output .= ' ?>'; + + return $output; + + } + + /** + * Compile {include ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_include_php_tag($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + + if (empty($attrs['file'])) { + $this->_syntax_error("missing 'file' attribute in include_php tag", E_USER_ERROR, __FILE__, __LINE__); + } + + $assign_var = (empty($attrs['assign'])) ? '' : $this->_dequote($attrs['assign']); + $once_var = (empty($attrs['once']) || $attrs['once']=='false') ? 'false' : 'true'; + + $arg_list = array(); + foreach($attrs as $arg_name => $arg_value) { + if($arg_name != 'file' AND $arg_name != 'once' AND $arg_name != 'assign') { + if(is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + + $_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '$assign_var', 'smarty_once' => $once_var, 'smarty_include_vars' => array(".implode(',', $arg_list)."))"; + + return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php($_params, \$this); ?>" . $this->_additional_newline; + } + + + /** + * Compile {section ...} tag + * + * @param string $tag_args + * @return string + */ + function _compile_section_start($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + $output = '<?php '; + $section_name = $attrs['name']; + if (empty($section_name)) { + $this->_syntax_error("missing section name", E_USER_ERROR, __FILE__, __LINE__); + } + + $output .= "unset(\$this->_sections[$section_name]);\n"; + $section_props = "\$this->_sections[$section_name]"; + + foreach ($attrs as $attr_name => $attr_value) { + switch ($attr_name) { + case 'loop': + $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n"; + break; + + case 'show': + if (is_bool($attr_value)) + $show_attr_value = $attr_value ? 'true' : 'false'; + else + $show_attr_value = "(bool)$attr_value"; + $output .= "{$section_props}['show'] = $show_attr_value;\n"; + break; + + case 'name': + $output .= "{$section_props}['$attr_name'] = $attr_value;\n"; + break; + + case 'max': + case 'start': + $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n"; + break; + + case 'step': + $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n"; + break; + + default: + $this->_syntax_error("unknown section attribute - '$attr_name'", E_USER_ERROR, __FILE__, __LINE__); + break; + } + } + + if (!isset($attrs['show'])) + $output .= "{$section_props}['show'] = true;\n"; + + if (!isset($attrs['loop'])) + $output .= "{$section_props}['loop'] = 1;\n"; + + if (!isset($attrs['max'])) + $output .= "{$section_props}['max'] = {$section_props}['loop'];\n"; + else + $output .= "if ({$section_props}['max'] < 0)\n" . + " {$section_props}['max'] = {$section_props}['loop'];\n"; + + if (!isset($attrs['step'])) + $output .= "{$section_props}['step'] = 1;\n"; + + if (!isset($attrs['start'])) + $output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n"; + else { + $output .= "if ({$section_props}['start'] < 0)\n" . + " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . + "else\n" . + " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n"; + } + + $output .= "if ({$section_props}['show']) {\n"; + if (!isset($attrs['start']) && !isset($attrs['step']) && !isset($attrs['max'])) { + $output .= " {$section_props}['total'] = {$section_props}['loop'];\n"; + } else { + $output .= " {$section_props}['total'] = min(ceil(({$section_props}['step'] > 0 ? {$section_props}['loop'] - {$section_props}['start'] : {$section_props}['start']+1)/abs({$section_props}['step'])), {$section_props}['max']);\n"; + } + $output .= " if ({$section_props}['total'] == 0)\n" . + " {$section_props}['show'] = false;\n" . + "} else\n" . + " {$section_props}['total'] = 0;\n"; + + $output .= "if ({$section_props}['show']):\n"; + $output .= " + for ({$section_props}['index'] = {$section_props}['start'], {$section_props}['iteration'] = 1; + {$section_props}['iteration'] <= {$section_props}['total']; + {$section_props}['index'] += {$section_props}['step'], {$section_props}['iteration']++):\n"; + $output .= "{$section_props}['rownum'] = {$section_props}['iteration'];\n"; + $output .= "{$section_props}['index_prev'] = {$section_props}['index'] - {$section_props}['step'];\n"; + $output .= "{$section_props}['index_next'] = {$section_props}['index'] + {$section_props}['step'];\n"; + $output .= "{$section_props}['first'] = ({$section_props}['iteration'] == 1);\n"; + $output .= "{$section_props}['last'] = ({$section_props}['iteration'] == {$section_props}['total']);\n"; + + $output .= "?>"; + + return $output; + } + + + /** + * Compile {foreach ...} tag. + * + * @param string $tag_args + * @return string + */ + function _compile_foreach_start($tag_args) + { + $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); + + if (empty($attrs['from'])) { + return $this->_syntax_error("foreach: missing 'from' attribute", E_USER_ERROR, __FILE__, __LINE__); + } + $from = $attrs['from']; + + if (empty($attrs['item'])) { + return $this->_syntax_error("foreach: missing 'item' attribute", E_USER_ERROR, __FILE__, __LINE__); + } + $item = $this->_dequote($attrs['item']); + if (!preg_match('~^\w+$~', $item)) { + return $this->_syntax_error("'foreach: item' must be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); + } + + if (isset($attrs['key'])) { + $key = $this->_dequote($attrs['key']); + if (!preg_match('~^\w+$~', $key)) { + return $this->_syntax_error("foreach: 'key' must to be a variable name (literal string)", E_USER_ERROR, __FILE__, __LINE__); + } + $key_part = "\$this->_tpl_vars['$key'] => "; + } else { + $key = null; + $key_part = ''; + } + + if (isset($attrs['name'])) { + $name = $attrs['name']; + } else { + $name = null; + } + + $output = '<?php '; + $output .= "\$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array'); }"; + if (isset($name)) { + $foreach_props = "\$this->_foreach[$name]"; + $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"; + } else { + $output .= "if (count(\$_from)):\n"; + $output .= " foreach (\$_from as $key_part\$this->_tpl_vars['$item']):\n"; + } + $output .= '?>'; + + return $output; + } + + + /** + * Compile {capture} .. {/capture} tags + * + * @param boolean $start true if this is the {capture} tag + * @param string $tag_args + * @return string + */ + + function _compile_capture_tag($start, $tag_args = '') + { + $attrs = $this->_parse_attrs($tag_args); + + if ($start) { + if (isset($attrs['name'])) + $buffer = $attrs['name']; + else + $buffer = "'default'"; + + if (isset($attrs['assign'])) + $assign = $attrs['assign']; + else + $assign = null; + $output = "<?php ob_start(); ?>"; + $this->_capture_stack[] = array($buffer, $assign); + } else { + list($buffer, $assign) = array_pop($this->_capture_stack); + $output = "<?php \$this->_smarty_vars['capture'][$buffer] = ob_get_contents(); "; + if (isset($assign)) { + $output .= " \$this->assign($assign, ob_get_contents());"; + } + $output .= "ob_end_clean(); ?>"; + } + + return $output; + } + + /** + * Compile {if ...} tag + * + * @param string $tag_args + * @param boolean $elseif if true, uses elseif instead of if + * @return string + */ + function _compile_if_tag($tag_args, $elseif = false) + { + + /* Tokenize args for 'if' tag. */ + preg_match_all('~(?> + ' . $this->_obj_call_regexp . '(?:' . $this->_mod_regexp . '*)? | # valid object call + ' . $this->_var_regexp . '(?:' . $this->_mod_regexp . '*)? | # var or quoted string + \-?0[xX][0-9a-fA-F]+|\-?\d+(?:\.\d+)?|\.\d+|!==|===|==|!=|<>|<<|>>|<=|>=|\&\&|\|\||\(|\)|,|\!|\^|=|\&|\~|<|>|\||\%|\+|\-|\/|\*|\@ | # valid non-word token + \b\w+\b | # valid word token + \S+ # anything else + )~x', $tag_args, $match); + + $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[')']) { + $this->_syntax_error("unbalanced parenthesis in if statement", E_USER_ERROR, __FILE__, __LINE__); + } + + $is_arg_stack = array(); + + for ($i = 0; $i < count($tokens); $i++) { + + $token = &$tokens[$i]; + + switch (strtolower($token)) { + case '!': + case '%': + case '!==': + case '==': + case '===': + case '>': + case '<': + case '!=': + case '<>': + case '<<': + case '>>': + case '<=': + case '>=': + case '&&': + case '||': + case '|': + case '^': + case '&': + case '~': + case ')': + case ',': + case '+': + case '-': + case '*': + case '/': + case '@': + break; + + case 'eq': + $token = '=='; + break; + + case 'ne': + case 'neq': + $token = '!='; + break; + + case 'lt': + $token = '<'; + break; + + case 'le': + case 'lte': + $token = '<='; + break; + + case 'gt': + $token = '>'; + break; + + case 'ge': + case 'gte': + $token = '>='; + break; + + case 'and': + $token = '&&'; + break; + + case 'or': + $token = '||'; + break; + + case 'not': + $token = '!'; + break; + + case 'mod': + $token = '%'; + break; + + case '(': + array_push($is_arg_stack, $i); + break; + + case 'is': + /* If last token was a ')', we operate on the parenthesized + expression. The start of the expression is on the stack. + Otherwise, we operate on the last encountered token. */ + if ($tokens[$i-1] == ')') + $is_arg_start = array_pop($is_arg_stack); + else + $is_arg_start = $i-1; + /* Construct the argument for 'is' expression, so it knows + what to operate on. */ + $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); + + /* Pass all tokens from next one until the end to the + 'is' expression parsing function. The function will + return modified tokens, where the first one is the result + of the 'is' expression and the rest are the tokens it + didn't touch. */ + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); + + /* Replace the old tokens with the new ones. */ + array_splice($tokens, $is_arg_start, count($tokens), $new_tokens); + + /* Adjust argument start so that it won't change from the + current position for the next iteration. */ + $i = $is_arg_start; + break; + + default: + if(preg_match('~^' . $this->_func_regexp . '$~', $token) ) { + // function call + if($this->security && + !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) && (strpos('+-*/^%&|', substr($token, -1)) === false) && 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(is_numeric($token)) { + // number, skip it + } else { + $this->_syntax_error("unidentified token '$token'", E_USER_ERROR, __FILE__, __LINE__); + } + break; + } + } + + if ($elseif) + return '<?php elseif ('.implode(' ', $tokens).'): ?>'; + else + return '<?php if ('.implode(' ', $tokens).'): ?>'; + } + + + function _compile_arg_list($type, $name, $attrs, &$cache_code) { + $arg_list = array(); + + if (isset($type) && isset($name) + && isset($this->_plugins[$type]) + && isset($this->_plugins[$type][$name]) + && empty($this->_plugins[$type][$name][4]) + && is_array($this->_plugins[$type][$name][5]) + ) { + /* we have a list of parameters that should be cached */ + $_cache_attrs = $this->_plugins[$type][$name][5]; + $_count = $this->_cache_attrs_count++; + $cache_code = "\$_cache_attrs =& \$this->_smarty_cache_attrs('$this->_cache_serial','$_count');"; + + } else { + /* no parameters are cached */ + $_cache_attrs = null; + } + + foreach ($attrs as $arg_name => $arg_value) { + if (is_bool($arg_value)) + $arg_value = $arg_value ? 'true' : 'false'; + if (is_null($arg_value)) + $arg_value = 'null'; + if ($_cache_attrs && in_array($arg_name, $_cache_attrs)) { + $arg_list[] = "'$arg_name' => (\$this->_cache_including) ? \$_cache_attrs['$arg_name'] : (\$_cache_attrs['$arg_name']=$arg_value)"; + } else { + $arg_list[] = "'$arg_name' => $arg_value"; + } + } + return $arg_list; + } + + /** + * Parse is expression + * + * @param string $is_arg + * @param array $tokens + * @return array + */ + function _parse_is_expr($is_arg, $tokens) + { + $expr_end = 0; + $negate_expr = false; + + if (($first_token = array_shift($tokens)) == 'not') { + $negate_expr = true; + $expr_type = array_shift($tokens); + } else + $expr_type = $first_token; + + switch ($expr_type) { + case 'even': + if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; + } else + $expr = "!(1 & $is_arg)"; + break; + + case 'odd': + if (isset($tokens[$expr_end]) && $tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; + } else + $expr = "(1 & $is_arg)"; + break; + + case 'div': + if (@$tokens[$expr_end] == 'by') { + $expr_end++; + $expr_arg = $tokens[$expr_end++]; + $expr = "!($is_arg % " . $this->_parse_var_props($expr_arg) . ")"; + } else { + $this->_syntax_error("expecting 'by' after 'div'", E_USER_ERROR, __FILE__, __LINE__); + } + break; + + default: + $this->_syntax_error("unknown 'is' expression - '$expr_type'", E_USER_ERROR, __FILE__, __LINE__); + break; + } + + if ($negate_expr) { + $expr = "!($expr)"; + } + + array_splice($tokens, 0, $expr_end, $expr); + + return $tokens; + } + + + /** + * Parse attribute string + * + * @param string $tag_args + * @return array + */ + function _parse_attrs($tag_args) + { + + /* Tokenize tag attributes. */ + preg_match_all('~(?:' . $this->_obj_call_regexp . '|' . $this->_qstr_regexp . ' | (?>[^"\'=\s]+) + )+ | + [=] + ~x', $tag_args, $match); + $tokens = $match[0]; + + $attrs = array(); + /* Parse state: + 0 - expecting attribute name + 1 - expecting '=' + 2 - expecting attribute value (not '=') */ + $state = 0; + + foreach ($tokens as $token) { + switch ($state) { + case 0: + /* If the token is a valid identifier, we set attribute name + and go to state 1. */ + if (preg_match('~^\w+$~', $token)) { + $attr_name = $token; + $state = 1; + } else + $this->_syntax_error("invalid attribute name: '$token'", E_USER_ERROR, __FILE__, __LINE__); + break; + + case 1: + /* If the token is '=', then we go to state 2. */ + if ($token == '=') { + $state = 2; + } else + $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); + break; + + case 2: + /* If token is not '=', we set the attribute value and go to + state 0. */ + if ($token != '=') { + /* We booleanize the token if it's a non-quoted possible + boolean value. */ + if (preg_match('~^(on|yes|true)$~', $token)) { + $token = 'true'; + } else if (preg_match('~^(off|no|false)$~', $token)) { + $token = 'false'; + } else if ($token == 'null') { + $token = 'null'; + } else if (preg_match('~^' . $this->_num_const_regexp . '|0[xX][0-9a-fA-F]+$~', $token)) { + /* treat integer literally */ + } else if (!preg_match('~^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')*$~', $token)) { + /* treat as a string, double-quote it escaping quotes */ + $token = '"'.addslashes($token).'"'; + } + + $attrs[$attr_name] = $token; + $state = 0; + } else + $this->_syntax_error("'=' cannot be an attribute value", E_USER_ERROR, __FILE__, __LINE__); + break; + } + $last_token = $token; + } + + if($state != 0) { + if($state == 1) { + $this->_syntax_error("expecting '=' after attribute name '$last_token'", E_USER_ERROR, __FILE__, __LINE__); + } else { + $this->_syntax_error("missing attribute value", E_USER_ERROR, __FILE__, __LINE__); + } + } + + $this->_parse_vars_props($attrs); + + return $attrs; + } + + /** + * compile multiple variables and section properties tokens into + * PHP code + * + * @param array $tokens + */ + function _parse_vars_props(&$tokens) + { + foreach($tokens as $key => $val) { + $tokens[$key] = $this->_parse_var_props($val); + } + } + + /** + * compile single variable and section properties token into + * PHP code + * + * @param string $val + * @param string $tag_attrs + * @return string + */ + function _parse_var_props($val) + { + $val = trim($val); + + if(preg_match('~^(' . $this->_obj_call_regexp . '|' . $this->_dvar_regexp . ')(' . $this->_mod_regexp . '*)$~', $val, $match)) { + // $ variable or object + $return = $this->_parse_var($match[1]); + $modifiers = $match[2]; + if (!empty($this->default_modifiers) && !preg_match('~(^|\|)smarty:nodefaults($|\|)~',$modifiers)) { + $_default_mod_string = implode('|',(array)$this->default_modifiers); + $modifiers = empty($modifiers) ? $_default_mod_string : $_default_mod_string . '|' . $modifiers; + } + $this->_parse_modifiers($return, $modifiers); + return $return; + } elseif (preg_match('~^' . $this->_db_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // double quoted text + preg_match('~^(' . $this->_db_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + $return = $this->_expand_quoted_text($match[1]); + if($match[2] != '') { + $this->_parse_modifiers($return, $match[2]); + } + return $return; + } + elseif(preg_match('~^' . $this->_num_const_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // numerical constant + preg_match('~^(' . $this->_num_const_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + if($match[2] != '') { + $this->_parse_modifiers($match[1], $match[2]); + return $match[1]; + } + } + elseif(preg_match('~^' . $this->_si_qstr_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // single quoted text + preg_match('~^(' . $this->_si_qstr_regexp . ')('. $this->_mod_regexp . '*)$~', $val, $match); + if($match[2] != '') { + $this->_parse_modifiers($match[1], $match[2]); + return $match[1]; + } + } + elseif(preg_match('~^' . $this->_cvar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // config var + return $this->_parse_conf_var($val); + } + elseif(preg_match('~^' . $this->_svar_regexp . '(?:' . $this->_mod_regexp . '*)$~', $val)) { + // section var + return $this->_parse_section_prop($val); + } + elseif(!in_array($val, $this->_permitted_tokens) && !is_numeric($val)) { + // literal string + return $this->_expand_quoted_text('"' . strtr($val, array('\\' => '\\\\', '"' => '\\"')) .'"'); + } + return $val; + } + + /** + * expand quoted text with embedded variables + * + * @param string $var_expr + * @return string + */ + function _expand_quoted_text($var_expr) + { + // if contains unescaped $, expand it + if(preg_match_all('~(?:\`(?<!\\\\)\$' . $this->_dvar_guts_regexp . '(?:' . $this->_obj_ext_regexp . ')*\`)|(?:(?<!\\\\)\$\w+(\[[a-zA-Z0-9]+\])*)~', $var_expr, $_match)) { + $_match = $_match[0]; + rsort($_match); + reset($_match); + foreach($_match as $_var) { + $var_expr = str_replace ($_var, '".(' . $this->_parse_var(str_replace('`','',$_var)) . ')."', $var_expr); + } + $_return = preg_replace('~\.""|(?<!\\\\)""\.~', '', $var_expr); + } else { + $_return = $var_expr; + } + // replace double quoted literal string with single quotes + $_return = preg_replace('~^"([\s\w]+)"$~',"'\\1'",$_return); + return $_return; + } + + /** + * parse variable expression into PHP code + * + * @param string $var_expr + * @param string $output + * @return string + */ + function _parse_var($var_expr) + { + $_has_math = false; + $_math_vars = preg_split('~('.$this->_dvar_math_regexp.'|'.$this->_qstr_regexp.')~', $var_expr, -1, PREG_SPLIT_DELIM_CAPTURE); + + if(count($_math_vars) > 1) { + $_first_var = ""; + $_complete_var = ""; + $_output = ""; + // simple check if there is any math, to stop recursion (due to modifiers with "xx % yy" as parameter) + foreach($_math_vars as $_k => $_math_var) { + $_math_var = $_math_vars[$_k]; + + if(!empty($_math_var) || is_numeric($_math_var)) { + // hit a math operator, so process the stuff which came before it + if(preg_match('~^' . $this->_dvar_math_regexp . '$~', $_math_var)) { + $_has_math = true; + if(!empty($_complete_var) || is_numeric($_complete_var)) { + $_output .= $this->_parse_var($_complete_var); + } + + // just output the math operator to php + $_output .= $_math_var; + + if(empty($_first_var)) + $_first_var = $_complete_var; + + $_complete_var = ""; + } else { + $_complete_var .= $_math_var; + } + } + } + if($_has_math) { + if(!empty($_complete_var) || is_numeric($_complete_var)) + $_output .= $this->_parse_var($_complete_var); + + // get the modifiers working (only the last var from math + modifier is left) + $var_expr = $_complete_var; + } + } + + // prevent cutting of first digit in the number (we _definitly_ got a number if the first char is a digit) + if(is_numeric(substr($var_expr, 0, 1))) + $_var_ref = $var_expr; + else + $_var_ref = substr($var_expr, 1); + + if(!$_has_math) { + + // get [foo] and .foo and ->foo and (...) pieces + preg_match_all('~(?:^\w+)|' . $this->_obj_params_regexp . '|(?:' . $this->_var_bracket_regexp . ')|->\$?\w+|\.\$?\w+|\S+~', $_var_ref, $match); + + $_indexes = $match[0]; + $_var_name = array_shift($_indexes); + + /* Handle $smarty.* variable references as a special case. */ + if ($_var_name == 'smarty') { + /* + * If the reference could be compiled, use the compiled output; + * otherwise, fall back on the $smarty variable generated at + * run-time. + */ + if (($smarty_ref = $this->_compile_smarty_ref($_indexes)) !== null) { + $_output = $smarty_ref; + } else { + $_var_name = substr(array_shift($_indexes), 1); + $_output = "\$this->_smarty_vars['$_var_name']"; + } + } elseif(is_numeric($_var_name) && is_numeric(substr($var_expr, 0, 1))) { + // because . is the operator for accessing arrays thru inidizes we need to put it together again for floating point numbers + if(count($_indexes) > 0) + { + $_var_name .= implode("", $_indexes); + $_indexes = array(); + } + $_output = $_var_name; + } else { + $_output = "\$this->_tpl_vars['$_var_name']"; + } + + foreach ($_indexes as $_index) { + if (substr($_index, 0, 1) == '[') { + $_index = substr($_index, 1, -1); + if (is_numeric($_index)) { + $_output .= "[$_index]"; + } elseif (substr($_index, 0, 1) == '$') { + if (strpos($_index, '.') !== false) { + $_output .= '[' . $this->_parse_var($_index) . ']'; + } else { + $_output .= "[\$this->_tpl_vars['" . substr($_index, 1) . "']]"; + } + } else { + $_var_parts = explode('.', $_index); + $_var_section = $_var_parts[0]; + $_var_section_prop = isset($_var_parts[1]) ? $_var_parts[1] : 'index'; + $_output .= "[\$this->_sections['$_var_section']['$_var_section_prop']]"; + } + } else if (substr($_index, 0, 1) == '.') { + if (substr($_index, 1, 1) == '$') + $_output .= "[\$this->_tpl_vars['" . substr($_index, 2) . "']]"; + else + $_output .= "['" . substr($_index, 1) . "']"; + } else if (substr($_index,0,2) == '->') { + if(substr($_index,2,2) == '__') { + $this->_syntax_error('call to internal object members is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } elseif($this->security && substr($_index, 2, 1) == '_') { + $this->_syntax_error('(secure) call to private object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } elseif (substr($_index, 2, 1) == '$') { + if ($this->security) { + $this->_syntax_error('(secure) call to dynamic object member is not allowed', E_USER_ERROR, __FILE__, __LINE__); + } else { + $_output .= '->{(($_var=$this->_tpl_vars[\''.substr($_index,3).'\']) && substr($_var,0,2)!=\'__\') ? $_var : $this->trigger_error("cannot access property \\"$_var\\"")}'; + } + } else { + $_output .= $_index; + } + } elseif (substr($_index, 0, 1) == '(') { + $_index = $this->_parse_parenth_args($_index); + $_output .= $_index; + } else { + $_output .= $_index; + } + } + } + + return $_output; + } + + /** + * parse arguments in function call parenthesis + * + * @param string $parenth_args + * @return string + */ + function _parse_parenth_args($parenth_args) + { + preg_match_all('~' . $this->_param_regexp . '~',$parenth_args, $match); + $orig_vals = $match = $match[0]; + $this->_parse_vars_props($match); + $replace = array(); + for ($i = 0, $count = count($match); $i < $count; $i++) { + $replace[$orig_vals[$i]] = $match[$i]; + } + return strtr($parenth_args, $replace); + } + + /** + * parse configuration variable expression into PHP code + * + * @param string $conf_var_expr + */ + function _parse_conf_var($conf_var_expr) + { + $parts = explode('|', $conf_var_expr, 2); + $var_ref = $parts[0]; + $modifiers = isset($parts[1]) ? $parts[1] : ''; + + $var_name = substr($var_ref, 1, -1); + + $output = "\$this->_config[0]['vars']['$var_name']"; + + $this->_parse_modifiers($output, $modifiers); + + return $output; + } + + /** + * parse section property expression into PHP code + * + * @param string $section_prop_expr + * @return string + */ + function _parse_section_prop($section_prop_expr) + { + $parts = explode('|', $section_prop_expr, 2); + $var_ref = $parts[0]; + $modifiers = isset($parts[1]) ? $parts[1] : ''; + + preg_match('!%(\w+)\.(\w+)%!', $var_ref, $match); + $section_name = $match[1]; + $prop_name = $match[2]; + + $output = "\$this->_sections['$section_name']['$prop_name']"; + + $this->_parse_modifiers($output, $modifiers); + + return $output; + } + + + /** + * parse modifier chain into PHP code + * + * sets $output to parsed modified chain + * @param string $output + * @param string $modifier_string + */ + function _parse_modifiers(&$output, $modifier_string) + { + preg_match_all('~\|(@?\w+)((?>:(?:'. $this->_qstr_regexp . '|[^|]+))*)~', '|' . $modifier_string, $_match); + list(, $_modifiers, $modifier_arg_strings) = $_match; + + for ($_i = 0, $_for_max = count($_modifiers); $_i < $_for_max; $_i++) { + $_modifier_name = $_modifiers[$_i]; + + if($_modifier_name == 'smarty') { + // skip smarty modifier + continue; + } + + preg_match_all('~:(' . $this->_qstr_regexp . '|[^:]+)~', $modifier_arg_strings[$_i], $_match); + $_modifier_args = $_match[1]; + + if (substr($_modifier_name, 0, 1) == '@') { + $_map_array = false; + $_modifier_name = substr($_modifier_name, 1); + } else { + $_map_array = true; + } + + if (empty($this->_plugins['modifier'][$_modifier_name]) + && !$this->_get_plugin_filepath('modifier', $_modifier_name) + && function_exists($_modifier_name)) { + if ($this->security && !in_array($_modifier_name, $this->security_settings['MODIFIER_FUNCS'])) { + $this->_trigger_fatal_error("[plugin] (secure mode) modifier '$_modifier_name' is not allowed" , $this->_current_file, $this->_current_line_no, __FILE__, __LINE__); + } else { + $this->_plugins['modifier'][$_modifier_name] = array($_modifier_name, null, null, false); + } + } + $this->_add_plugin('modifier', $_modifier_name); + + $this->_parse_vars_props($_modifier_args); + + if($_modifier_name == 'default') { + // supress notifications of default modifier vars and args + if(substr($output, 0, 1) == '$') { + $output = '@' . $output; + } + if(isset($_modifier_args[0]) && substr($_modifier_args[0], 0, 1) == '$') { + $_modifier_args[0] = '@' . $_modifier_args[0]; + } + } + if (count($_modifier_args) > 0) + $_modifier_args = ', '.implode(', ', $_modifier_args); + else + $_modifier_args = ''; + + if ($_map_array) { + $output = "((is_array(\$_tmp=$output)) ? \$this->_run_mod_handler('$_modifier_name', true, \$_tmp$_modifier_args) : " . $this->_compile_plugin_call('modifier', $_modifier_name) . "(\$_tmp$_modifier_args))"; + + } else { + + $output = $this->_compile_plugin_call('modifier', $_modifier_name)."($output$_modifier_args)"; + + } + } + } + + + /** + * add plugin + * + * @param string $type + * @param string $name + * @param boolean? $delayed_loading + */ + function _add_plugin($type, $name, $delayed_loading = null) + { + if (!isset($this->_plugin_info[$type])) { + $this->_plugin_info[$type] = array(); + } + if (!isset($this->_plugin_info[$type][$name])) { + $this->_plugin_info[$type][$name] = array($this->_current_file, + $this->_current_line_no, + $delayed_loading); + } + } + + + /** + * Compiles references of type $smarty.foo + * + * @param string $indexes + * @return string + */ + function _compile_smarty_ref(&$indexes) + { + /* Extract the reference name. */ + $_ref = substr($indexes[0], 1); + foreach($indexes as $_index_no=>$_index) { + if (substr($_index, 0, 1) != '.' && $_index_no<2 || !preg_match('~^(\.|\[|->)~', $_index)) { + $this->_syntax_error('$smarty' . implode('', array_slice($indexes, 0, 2)) . ' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); + } + } + + switch ($_ref) { + case 'now': + $compiled_ref = 'time()'; + $_max_index = 1; + 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)); + $compiled_ref = "\$this->_sections[$_var]"; + break; + + case 'get': + $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' : "\$GLOBALS['HTTP_GET_VARS']"; + break; + + case 'post': + $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' : "\$GLOBALS['HTTP_POST_VARS']"; + break; + + case 'cookies': + $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' : "\$GLOBALS['HTTP_COOKIE_VARS']"; + break; + + case 'env': + $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' : "\$GLOBALS['HTTP_ENV_VARS']"; + break; + + case 'server': + $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' : "\$GLOBALS['HTTP_SERVER_VARS']"; + break; + + case 'session': + $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' : "\$GLOBALS['HTTP_SESSION_VARS']"; + break; + + /* + * These cases are handled either at run-time or elsewhere in the + * compiler. + */ + case 'request': + if ($this->request_use_auto_globals) { + $compiled_ref = '$_REQUEST'; + break; + } else { + $this->_init_smarty_vars = true; + } + return null; + + case 'capture': + return null; + + case 'template': + $compiled_ref = "'$this->_current_file'"; + $_max_index = 1; + break; + + case 'version': + $compiled_ref = "'$this->_version'"; + $_max_index = 1; + break; + + case 'const': + if ($this->security && !$this->security_settings['ALLOW_CONSTANTS']) { + $this->_syntax_error("(secure mode) constants not permitted", + E_USER_WARNING, __FILE__, __LINE__); + return; + } + array_shift($indexes); + 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; + + case 'config': + $compiled_ref = "\$this->_config[0]['vars']"; + $_max_index = 3; + break; + + case 'ldelim': + $compiled_ref = "'$this->left_delimiter'"; + break; + + case 'rdelim': + $compiled_ref = "'$this->right_delimiter'"; + break; + + default: + $this->_syntax_error('$smarty.' . $_ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__); + break; + } + + if (isset($_max_index) && count($indexes) > $_max_index) { + $this->_syntax_error('$smarty' . implode('', $indexes) .' is an invalid reference', E_USER_ERROR, __FILE__, __LINE__); + } + + array_shift($indexes); + return $compiled_ref; + } + + /** + * compiles call to plugin of type $type with name $name + * returns a string containing the function-name or method call + * without the paramter-list that would have follow to make the + * call valid php-syntax + * + * @param string $type + * @param string $name + * @return string + */ + function _compile_plugin_call($type, $name) { + if (isset($this->_plugins[$type][$name])) { + /* plugin loaded */ + if (is_array($this->_plugins[$type][$name][0])) { + return ((is_object($this->_plugins[$type][$name][0][0])) ? + "\$this->_plugins['$type']['$name'][0][0]->" /* method callback */ + : (string)($this->_plugins[$type][$name][0][0]).'::' /* class callback */ + ). $this->_plugins[$type][$name][0][1]; + + } else { + /* function callback */ + return $this->_plugins[$type][$name][0]; + + } + } else { + /* plugin not loaded -> auto-loadable-plugin */ + return 'smarty_'.$type.'_'.$name; + + } + } + + /** + * load pre- and post-filters + */ + function _load_filters() + { + if (count($this->_plugins['prefilter']) > 0) { + foreach ($this->_plugins['prefilter'] as $filter_name => $prefilter) { + if ($prefilter === false) { + unset($this->_plugins['prefilter'][$filter_name]); + $_params = array('plugins' => array(array('prefilter', $filter_name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + } + } + } + if (count($this->_plugins['postfilter']) > 0) { + foreach ($this->_plugins['postfilter'] as $filter_name => $postfilter) { + if ($postfilter === false) { + unset($this->_plugins['postfilter'][$filter_name]); + $_params = array('plugins' => array(array('postfilter', $filter_name, null, null, false))); + require_once(SMARTY_CORE_DIR . 'core.load_plugins.php'); + smarty_core_load_plugins($_params, $this); + } + } + } + } + + + /** + * Quote subpattern references + * + * @param string $string + * @return string + */ + function _quote_replace($string) + { + return strtr($string, array('\\' => '\\\\', '$' => '\\$')); + } + + /** + * display Smarty syntax error + * + * @param string $error_msg + * @param integer $error_type + * @param string $file + * @param integer $line + */ + function _syntax_error($error_msg, $error_type = E_USER_ERROR, $file=null, $line=null) + { + $this->_trigger_fatal_error("syntax error: $error_msg", $this->_current_file, $this->_current_line_no, $file, $line, $error_type); + } + + + /** + * check if the compilation changes from cacheable to + * non-cacheable state with the beginning of the current + * plugin. return php-code to reflect the transition. + * @return string + */ + function _push_cacheable_state($type, $name) { + $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; + if ($_cacheable + || 0<$this->_cacheable_state++) return ''; + if (!isset($this->_cache_serial)) $this->_cache_serial = md5(uniqid('Smarty')); + $_ret = 'if ($this->caching && !$this->_cache_including) { echo \'{nocache:' + . $this->_cache_serial . '#' . $this->_nocache_count + . '}\'; };'; + return $_ret; + } + + + /** + * check if the compilation changes from non-cacheable to + * cacheable state with the end of the current plugin return + * php-code to reflect the transition. + * @return string + */ + function _pop_cacheable_state($type, $name) { + $_cacheable = !isset($this->_plugins[$type][$name]) || $this->_plugins[$type][$name][4]; + if ($_cacheable + || --$this->_cacheable_state>0) return ''; + return 'if ($this->caching && !$this->_cache_including) { echo \'{/nocache:' + . $this->_cache_serial . '#' . ($this->_nocache_count++) + . '}\'; };'; + } + + + /** + * push opening tag-name, file-name and line-number on the tag-stack + * @param string the opening tag's name + */ + function _push_tag($open_tag) + { + array_push($this->_tag_stack, array($open_tag, $this->_current_line_no)); + } + + /** + * pop closing tag-name + * raise an error if this stack-top doesn't match with the closing tag + * @param string the closing tag's name + * @return string the opening tag's name + */ + function _pop_tag($close_tag) + { + $message = ''; + if (count($this->_tag_stack)>0) { + list($_open_tag, $_line_no) = array_pop($this->_tag_stack); + if ($close_tag == $_open_tag) { + return $_open_tag; + } + if ($close_tag == 'if' && ($_open_tag == 'else' || $_open_tag == 'elseif' )) { + return $this->_pop_tag($close_tag); + } + if ($close_tag == 'section' && $_open_tag == 'sectionelse') { + $this->_pop_tag($close_tag); + return $_open_tag; + } + if ($close_tag == 'foreach' && $_open_tag == 'foreachelse') { + $this->_pop_tag($close_tag); + return $_open_tag; + } + if ($_open_tag == 'else' || $_open_tag == 'elseif') { + $_open_tag = 'if'; + } elseif ($_open_tag == 'sectionelse') { + $_open_tag = 'section'; + } elseif ($_open_tag == 'foreachelse') { + $_open_tag = 'foreach'; + } + $message = " expected {/$_open_tag} (opened line $_line_no)."; + } + $this->_syntax_error("mismatched tag {/$close_tag}.$message", + E_USER_ERROR, __FILE__, __LINE__); + } + +} + +/** + * compare to values by their string length + * + * @access private + * @param string $a + * @param string $b + * @return 0|-1|1 + */ +function _smarty_sort_length($a, $b) +{ + if($a == $b) + return 0; + + if(strlen($a) == strlen($b)) + return ($a > $b) ? -1 : 1; + + return (strlen($a) > strlen($b)) ? -1 : 1; +} + + +/* vim: set et: */ + +?> diff --git a/libs/debug.tpl b/libs/debug.tpl new file mode 100644 index 0000000..7f1c9d4 --- /dev/null +++ b/libs/debug.tpl @@ -0,0 +1,64 @@ +{* Smarty *} + +{* debug.tpl, last updated version 2.0.1 *} + +{assign_debug_info} + +{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"} + <table border=0 width=100%> + <tr bgcolor=#cccccc><th colspan=2>Smarty Debug Console</th></tr> + <tr bgcolor=#cccccc><td colspan=2><b>included templates & config files (load time in seconds):</b></td></tr> + {section name=templates loop=$_debug_tpls} + <tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth} {/section}<font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>{$_debug_tpls[templates].filename|escape:html}</font>{if isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}</i></font>{/if}</tt></td></tr> + {sectionelse} + <tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included</i></tt></td></tr> + {/section} + <tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr> + {section name=vars loop=$_debug_keys} + <tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var}</font></tt></td></tr> + {sectionelse} + <tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr> + {/section} + <tr bgcolor=#cccccc><td colspan=2><b>assigned config file variables (outer template scope):</b></td></tr> + {section name=config_vars loop=$_debug_config_keys} + <tr bgcolor={if %config_vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[config_vars]}#{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_config_vals[config_vars]|@debug_print_var}</font></tt></td></tr> + {sectionelse} + <tr bgcolor=#eeeeee><td colspan=2><tt><i>no config vars assigned</i></tt></td></tr> + {/section} + </table> +</BODY></HTML> +{else} +<SCRIPT language=javascript> + if( self.name == '' ) {ldelim} + var title = 'Console'; + {rdelim} + else {ldelim} + var title = 'Console_' + self.name; + {rdelim} + _smarty_console = window.open("",title.value,"width=680,height=600,resizable,scrollbars=yes"); + _smarty_console.document.write("<HTML><HEAD><TITLE>Smarty Debug Console_"+self.name+"</TITLE></HEAD><BODY bgcolor=#ffffff>"); + _smarty_console.document.write("<table border=0 width=100%>"); + _smarty_console.document.write("<tr bgcolor=#cccccc><th colspan=2>Smarty Debug Console</th></tr>"); + _smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>included templates & config files (load time in seconds):</b></td></tr>"); + {section name=templates loop=$_debug_tpls} + _smarty_console.document.write("<tr bgcolor={if %templates.index% is even}#eeeeee{else}#fafafa{/if}><td colspan=2><tt>{section name=indent loop=$_debug_tpls[templates].depth} {/section}<font color={if $_debug_tpls[templates].type eq "template"}brown{elseif $_debug_tpls[templates].type eq "insert"}black{else}green{/if}>{$_debug_tpls[templates].filename|escape:html|escape:javascript}</font>{if isset($_debug_tpls[templates].exec_time)} <font size=-1><i>({$_debug_tpls[templates].exec_time|string_format:"%.5f"}){if %templates.index% eq 0} (total){/if}</i></font>{/if}</tt></td></tr>"); + {sectionelse} + _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no templates included</i></tt></td></tr>"); + {/section} + _smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned template variables:</b></td></tr>"); + {section name=vars loop=$_debug_keys} + _smarty_console.document.write("<tr bgcolor={if %vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=blue>{ldelim}${$_debug_keys[vars]}{rdelim}</font></tt></td><td nowrap><tt><font color=green>{$_debug_vals[vars]|@debug_print_var|escape:javascript}</font></tt></td></tr>"); + {sectionelse} + _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no template variables assigned</i></tt></td></tr>"); + {/section} + _smarty_console.document.write("<tr bgcolor=#cccccc><td colspan=2><b>assigned config file variables (outer template scope):</b></td></tr>"); + {section name=config_vars loop=$_debug_config_keys} + _smarty_console.document.write("<tr bgcolor={if %config_vars.index% is even}#eeeeee{else}#fafafa{/if}><td valign=top><tt><font color=maroon>{ldelim}#{$_debug_config_keys[config_vars]}#{rdelim}</font></tt></td><td><tt><font color=green>{$_debug_config_vals[config_vars]|@debug_print_var|escape:javascript}</font></tt></td></tr>"); + {sectionelse} + _smarty_console.document.write("<tr bgcolor=#eeeeee><td colspan=2><tt><i>no config vars assigned</i></tt></td></tr>"); + {/section} + _smarty_console.document.write("</table>"); + _smarty_console.document.write("</BODY></HTML>"); + _smarty_console.document.close(); +</SCRIPT> +{/if} diff --git a/libs/internals/core.assemble_plugin_filepath.php b/libs/internals/core.assemble_plugin_filepath.php new file mode 100644 index 0000000..690d3dd --- /dev/null +++ b/libs/internals/core.assemble_plugin_filepath.php @@ -0,0 +1,67 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * assemble filepath of requested plugin + * + * @param string $type + * @param string $name + * @return string|false + */ +function smarty_core_assemble_plugin_filepath($params, &$smarty) +{ + static $_filepaths_cache = array(); + + $_plugin_filename = $params['type'] . '.' . $params['name'] . '.php'; + if (isset($_filepaths_cache[$_plugin_filename])) { + return $_filepaths_cache[$_plugin_filename]; + } + $_return = false; + + foreach ((array)$smarty->plugins_dir as $_plugin_dir) { + + $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; + + // see if path is relative + if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { + $_relative_paths[] = $_plugin_dir; + // relative path, see if it is in the SMARTY_DIR + if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { + $_return = SMARTY_DIR . $_plugin_filepath; + break; + } + } + // try relative to cwd (or absolute) + if (@is_readable($_plugin_filepath)) { + $_return = $_plugin_filepath; + break; + } + } + + if($_return === false) { + // still not found, try PHP include_path + if(isset($_relative_paths)) { + foreach ((array)$_relative_paths as $_plugin_dir) { + + $_plugin_filepath = $_plugin_dir . DIRECTORY_SEPARATOR . $_plugin_filename; + + $_params = array('file_path' => $_plugin_filepath); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $smarty)) { + $_return = $_params['new_file_path']; + break; + } + } + } + } + $_filepaths_cache[$_plugin_filename] = $_return; + return $_return; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.assign_smarty_interface.php b/libs/internals/core.assign_smarty_interface.php new file mode 100644 index 0000000..7e65a73 --- /dev/null +++ b/libs/internals/core.assign_smarty_interface.php @@ -0,0 +1,43 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty assign_smarty_interface core plugin + * + * Type: core<br> + * Name: assign_smarty_interface<br> + * Purpose: assign the $smarty interface variable + * @param array Format: null + * @param Smarty + */ +function smarty_core_assign_smarty_interface($params, &$smarty) +{ + if (isset($smarty->_smarty_vars) && isset($smarty->_smarty_vars['request'])) { + return; + } + + $_globals_map = array('g' => 'HTTP_GET_VARS', + 'p' => 'HTTP_POST_VARS', + 'c' => 'HTTP_COOKIE_VARS', + 's' => 'HTTP_SERVER_VARS', + 'e' => 'HTTP_ENV_VARS'); + + $_smarty_vars_request = array(); + + foreach (preg_split('!!', strtolower($smarty->request_vars_order)) as $_c) { + if (isset($_globals_map[$_c])) { + $_smarty_vars_request = array_merge($_smarty_vars_request, $GLOBALS[$_globals_map[$_c]]); + } + } + $_smarty_vars_request = @array_merge($_smarty_vars_request, $GLOBALS['HTTP_SESSION_VARS']); + + $smarty->_smarty_vars['request'] = $_smarty_vars_request; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.create_dir_structure.php b/libs/internals/core.create_dir_structure.php new file mode 100644 index 0000000..3eecc49 --- /dev/null +++ b/libs/internals/core.create_dir_structure.php @@ -0,0 +1,79 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * create full directory structure + * + * @param string $dir + */ + +// $dir + +function smarty_core_create_dir_structure($params, &$smarty) +{ + if (!file_exists($params['dir'])) { + $_open_basedir_ini = ini_get('open_basedir'); + + if (DIRECTORY_SEPARATOR=='/') { + /* unix-style paths */ + $_dir = $params['dir']; + $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY); + $_new_dir = (substr($_dir, 0, 1)=='/') ? '/' : getcwd().'/'; + if($_use_open_basedir = !empty($_open_basedir_ini)) { + $_open_basedirs = explode(':', $_open_basedir_ini); + } + + } else { + /* other-style paths */ + $_dir = str_replace('\\','/', $params['dir']); + $_dir_parts = preg_split('!/+!', $_dir, -1, PREG_SPLIT_NO_EMPTY); + if (preg_match('!^((//)|([a-zA-Z]:/))!', $_dir, $_root_dir)) { + /* leading "//" for network volume, or "[letter]:/" for full path */ + $_new_dir = $_root_dir[1]; + /* remove drive-letter from _dir_parts */ + if (isset($_root_dir[3])) array_shift($_dir_parts); + + } else { + $_new_dir = str_replace('\\', '/', getcwd()).'/'; + + } + + if($_use_open_basedir = !empty($_open_basedir_ini)) { + $_open_basedirs = explode(';', str_replace('\\', '/', $_open_basedir_ini)); + } + + } + + /* all paths use "/" only from here */ + foreach ($_dir_parts as $_dir_part) { + $_new_dir .= $_dir_part; + + if ($_use_open_basedir) { + // do not attempt to test or make directories outside of open_basedir + $_make_new_dir = false; + foreach ($_open_basedirs as $_open_basedir) { + if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) { + $_make_new_dir = true; + break; + } + } + } else { + $_make_new_dir = true; + } + + if ($_make_new_dir && !file_exists($_new_dir) && !@mkdir($_new_dir, $smarty->_dir_perms) && !is_dir($_new_dir)) { + $smarty->trigger_error("problem creating directory '" . $_new_dir . "'"); + return false; + } + $_new_dir .= '/'; + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.display_debug_console.php b/libs/internals/core.display_debug_console.php new file mode 100644 index 0000000..1a80f39 --- /dev/null +++ b/libs/internals/core.display_debug_console.php @@ -0,0 +1,61 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty debug_console function plugin + * + * Type: core<br> + * Name: display_debug_console<br> + * Purpose: display the javascript debug console window + * @param array Format: null + * @param Smarty + */ +function smarty_core_display_debug_console($params, &$smarty) +{ + // we must force compile the debug template in case the environment + // changed between separate applications. + + if(empty($smarty->debug_tpl)) { + // 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[] = realpath($smarty->debug_tpl); + } + $smarty->debug_tpl = 'file:' . SMARTY_DIR . 'debug.tpl'; + } + + $_ldelim_orig = $smarty->left_delimiter; + $_rdelim_orig = $smarty->right_delimiter; + + $smarty->left_delimiter = '{'; + $smarty->right_delimiter = '}'; + + $_compile_id_orig = $smarty->_compile_id; + $smarty->_compile_id = null; + + $_compile_path = $smarty->_get_compile_path($smarty->debug_tpl); + if ($smarty->_compile_resource($smarty->debug_tpl, $_compile_path)) + { + ob_start(); + $smarty->_include($_compile_path); + $_results = ob_get_contents(); + ob_end_clean(); + } else { + $_results = ''; + } + + $smarty->_compile_id = $_compile_id_orig; + + $smarty->left_delimiter = $_ldelim_orig; + $smarty->right_delimiter = $_rdelim_orig; + + return $_results; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.get_include_path.php b/libs/internals/core.get_include_path.php new file mode 100644 index 0000000..4343241 --- /dev/null +++ b/libs/internals/core.get_include_path.php @@ -0,0 +1,44 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Get path to file from include_path + * + * @param string $file_path + * @param string $new_file_path + * @return boolean + * @staticvar array|null + */ + +// $file_path, &$new_file_path + +function smarty_core_get_include_path(&$params, &$smarty) +{ + static $_path_array = null; + + if(!isset($_path_array)) { + $_ini_include_path = ini_get('include_path'); + + if(strstr($_ini_include_path,';')) { + // windows pathnames + $_path_array = explode(';',$_ini_include_path); + } else { + $_path_array = explode(':',$_ini_include_path); + } + } + foreach ($_path_array as $_include_path) { + if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) { + $params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path']; + return true; + } + } + return false; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.get_microtime.php b/libs/internals/core.get_microtime.php new file mode 100644 index 0000000..f1a28e0 --- /dev/null +++ b/libs/internals/core.get_microtime.php @@ -0,0 +1,23 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Get seconds and microseconds + * @return double + */ +function smarty_core_get_microtime($params, &$smarty) +{ + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $mtime = (double)($mtime[1]) + (double)($mtime[0]); + return ($mtime); +} + + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.get_php_resource.php b/libs/internals/core.get_php_resource.php new file mode 100644 index 0000000..786d4e7 --- /dev/null +++ b/libs/internals/core.get_php_resource.php @@ -0,0 +1,80 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Retrieves PHP script resource + * + * sets $php_resource to the returned resource + * @param string $resource + * @param string $resource_type + * @param $php_resource + * @return boolean + */ + +function smarty_core_get_php_resource(&$params, &$smarty) +{ + + $params['resource_base_path'] = $smarty->trusted_dir; + $smarty->_parse_resource_name($params, $smarty); + + /* + * Find out if the resource exists. + */ + + if ($params['resource_type'] == 'file') { + $_readable = false; + if(file_exists($params['resource_name']) && is_readable($params['resource_name'])) { + $_readable = true; + } else { + // test for file in include_path + $_params = array('file_path' => $params['resource_name']); + require_once(SMARTY_CORE_DIR . 'core.get_include_path.php'); + if(smarty_core_get_include_path($_params, $smarty)) { + $_include_path = $_params['new_file_path']; + $_readable = true; + } + } + } else if ($params['resource_type'] != 'file') { + $_template_source = null; + $_readable = is_callable($smarty->_plugins['resource'][$params['resource_type']][0][0]) + && call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0], + array($params['resource_name'], &$_template_source, &$smarty)); + } + + /* + * Set the error function, depending on which class calls us. + */ + if (method_exists($smarty, '_syntax_error')) { + $_error_funcc = '_syntax_error'; + } else { + $_error_funcc = 'trigger_error'; + } + + if ($_readable) { + if ($smarty->security) { + require_once(SMARTY_CORE_DIR . 'core.is_trusted.php'); + if (!smarty_core_is_trusted($params, $smarty)) { + $smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted'); + return false; + } + } + } else { + $smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable'); + return false; + } + + if ($params['resource_type'] == 'file') { + $params['php_resource'] = $params['resource_name']; + } else { + $params['php_resource'] = $_template_source; + } + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.is_secure.php b/libs/internals/core.is_secure.php new file mode 100644 index 0000000..d54abd4 --- /dev/null +++ b/libs/internals/core.is_secure.php @@ -0,0 +1,59 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * determines if a resource is secure or not. + * + * @param string $resource_type + * @param string $resource_name + * @return boolean + */ + +// $resource_type, $resource_name + +function smarty_core_is_secure($params, &$smarty) +{ + if (!$smarty->security || $smarty->security_settings['INCLUDE_ANY']) { + return true; + } + + if ($params['resource_type'] == 'file') { + $_rp = realpath($params['resource_name']); + if (isset($params['resource_base_path'])) { + foreach ((array)$params['resource_base_path'] as $curr_dir) { + if ( ($_cd = realpath($curr_dir)) !== false && + strncmp($_rp, $_cd, strlen($_cd)) == 0 && + substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { + return true; + } + } + } + if (!empty($smarty->secure_dir)) { + foreach ((array)$smarty->secure_dir as $curr_dir) { + if ( ($_cd = realpath($curr_dir)) !== false) { + if($_cd == $_rp) { + return true; + } elseif (strncmp($_rp, $_cd, strlen($_cd)) == 0 && + substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR) { + return true; + } + } + } + } + } else { + // resource is not on local file system + return call_user_func_array( + $smarty->_plugins['resource'][$params['resource_type']][0][2], + array($params['resource_name'], &$smarty)); + } + + return false; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.is_trusted.php b/libs/internals/core.is_trusted.php new file mode 100644 index 0000000..4299731 --- /dev/null +++ b/libs/internals/core.is_trusted.php @@ -0,0 +1,47 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * determines if a resource is trusted or not + * + * @param string $resource_type + * @param string $resource_name + * @return boolean + */ + + // $resource_type, $resource_name + +function smarty_core_is_trusted($params, &$smarty) +{ + $_smarty_trusted = false; + if ($params['resource_type'] == 'file') { + if (!empty($smarty->trusted_dir)) { + $_rp = realpath($params['resource_name']); + foreach ((array)$smarty->trusted_dir as $curr_dir) { + if (!empty($curr_dir) && is_readable ($curr_dir)) { + $_cd = realpath($curr_dir); + if (strncmp($_rp, $_cd, strlen($_cd)) == 0 + && substr($_rp, strlen($_cd), 1) == DIRECTORY_SEPARATOR ) { + $_smarty_trusted = true; + break; + } + } + } + } + + } else { + // resource is not on local file system + $_smarty_trusted = call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][3], + array($params['resource_name'], $smarty)); + } + + return $_smarty_trusted; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.load_plugins.php b/libs/internals/core.load_plugins.php new file mode 100644 index 0000000..6db1dc5 --- /dev/null +++ b/libs/internals/core.load_plugins.php @@ -0,0 +1,125 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Load requested plugins + * + * @param array $plugins + */ + +// $plugins + +function smarty_core_load_plugins($params, &$smarty) +{ + + foreach ($params['plugins'] as $_plugin_info) { + list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info; + $_plugin = &$smarty->_plugins[$_type][$_name]; + + /* + * We do not load plugin more than once for each instance of Smarty. + * The following code checks for that. The plugin can also be + * registered dynamically at runtime, in which case template file + * and line number will be unknown, so we fill them in. + * + * The final element of the info array is a flag that indicates + * whether the dynamically registered plugin function has been + * checked for existence yet or not. + */ + if (isset($_plugin)) { + if (empty($_plugin[3])) { + if (!is_callable($_plugin[0])) { + $smarty->_trigger_fatal_error("[plugin] $_type '$_name' is not implemented", $_tpl_file, $_tpl_line, __FILE__, __LINE__); + } else { + $_plugin[1] = $_tpl_file; + $_plugin[2] = $_tpl_line; + $_plugin[3] = true; + if (!isset($_plugin[4])) $_plugin[4] = true; /* cacheable */ + } + } + continue; + } else if ($_type == 'insert') { + /* + * For backwards compatibility, we check for insert functions in + * the symbol table before trying to load them as a plugin. + */ + $_plugin_func = 'insert_' . $_name; + if (function_exists($_plugin_func)) { + $_plugin = array($_plugin_func, $_tpl_file, $_tpl_line, true, false); + continue; + } + } + + $_plugin_file = $smarty->_get_plugin_filepath($_type, $_name); + + if (! $_found = ($_plugin_file != false)) { + $_message = "could not load plugin file '$_type.$_name.php'\n"; + } + + /* + * If plugin file is found, it -must- provide the properly named + * plugin function. In case it doesn't, simply output the error and + * do not fall back on any other method. + */ + if ($_found) { + include_once $_plugin_file; + + $_plugin_func = 'smarty_' . $_type . '_' . $_name; + if (!function_exists($_plugin_func)) { + $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", $_tpl_file, $_tpl_line, __FILE__, __LINE__); + continue; + } + } + /* + * In case of insert plugins, their code may be loaded later via + * 'script' attribute. + */ + else if ($_type == 'insert' && $_delayed_loading) { + $_plugin_func = 'smarty_' . $_type . '_' . $_name; + $_found = true; + } + + /* + * Plugin specific processing and error checking. + */ + if (!$_found) { + if ($_type == 'modifier') { + /* + * In case modifier falls back on using PHP functions + * directly, we only allow those specified in the security + * context. + */ + if ($smarty->security && !in_array($_name, $smarty->security_settings['MODIFIER_FUNCS'])) { + $_message = "(secure mode) modifier '$_name' is not allowed"; + } else { + if (!function_exists($_name)) { + $_message = "modifier '$_name' is not implemented"; + } else { + $_plugin_func = $_name; + $_found = true; + } + } + } else if ($_type == 'function') { + /* + * This is a catch-all situation. + */ + $_message = "unknown tag - '$_name'"; + } + } + + if ($_found) { + $smarty->_plugins[$_type][$_name] = array($_plugin_func, $_tpl_file, $_tpl_line, true, true); + } else { + // output error + $smarty->_trigger_fatal_error('[plugin] ' . $_message, $_tpl_file, $_tpl_line, __FILE__, __LINE__); + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.load_resource_plugin.php b/libs/internals/core.load_resource_plugin.php new file mode 100644 index 0000000..a7d37d1 --- /dev/null +++ b/libs/internals/core.load_resource_plugin.php @@ -0,0 +1,74 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * load a resource plugin + * + * @param string $type + */ + +// $type + +function smarty_core_load_resource_plugin($params, &$smarty) +{ + /* + * Resource plugins are not quite like the other ones, so they are + * handled differently. The first element of plugin info is the array of + * functions provided by the plugin, the second one indicates whether + * all of them exist or not. + */ + + $_plugin = &$smarty->_plugins['resource'][$params['type']]; + if (isset($_plugin)) { + if (!$_plugin[1] && count($_plugin[0])) { + $_plugin[1] = true; + foreach ($_plugin[0] as $_plugin_func) { + if (!is_callable($_plugin_func)) { + $_plugin[1] = false; + break; + } + } + } + + if (!$_plugin[1]) { + $smarty->_trigger_fatal_error("[plugin] resource '" . $params['type'] . "' is not implemented", null, null, __FILE__, __LINE__); + } + + return; + } + + $_plugin_file = $smarty->_get_plugin_filepath('resource', $params['type']); + $_found = ($_plugin_file != false); + + if ($_found) { /* + * If the plugin file is found, it -must- provide the properly named + * plugin functions. + */ + include_once($_plugin_file); + + /* + * Locate functions that we require the plugin to provide. + */ + $_resource_ops = array('source', 'timestamp', 'secure', 'trusted'); + $_resource_funcs = array(); + foreach ($_resource_ops as $_op) { + $_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op; + if (!function_exists($_plugin_func)) { + $smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__); + return; + } else { + $_resource_funcs[] = $_plugin_func; + } + } + + $smarty->_plugins['resource'][$params['type']] = array($_resource_funcs, true); + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.process_cached_inserts.php b/libs/internals/core.process_cached_inserts.php new file mode 100644 index 0000000..1d78edd --- /dev/null +++ b/libs/internals/core.process_cached_inserts.php @@ -0,0 +1,71 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Replace cached inserts with the actual results + * + * @param string $results + * @return string + */ +function smarty_core_process_cached_inserts($params, &$smarty) +{ + preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis', + $params['results'], $match); + list($cached_inserts, $insert_args) = $match; + + for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) { + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + $args = unserialize($insert_args[$i]); + $name = $args['name']; + + if (isset($args['script'])) { + $_params = array('resource_name' => $smarty->_dequote($args['script'])); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + if(!smarty_core_get_php_resource($_params, $smarty)) { + return false; + } + $resource_type = $_params['resource_type']; + $php_resource = $_params['php_resource']; + + + if ($resource_type == 'file') { + $smarty->_include($php_resource, true); + } else { + $smarty->_eval($php_resource); + } + } + + $function_name = $smarty->_plugins['insert'][$name][0]; + if (empty($args['assign'])) { + $replace = $function_name($args, $smarty); + } else { + $smarty->assign($args['assign'], $function_name($args, $smarty)); + $replace = ''; + } + + $params['results'] = substr_replace($params['results'], $replace, strpos($params['results'], $cached_inserts[$i]), strlen($cached_inserts[$i])); + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'insert', + 'filename' => 'insert_'.$name, + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time); + } + } + + return $params['results']; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.process_compiled_include.php b/libs/internals/core.process_compiled_include.php new file mode 100644 index 0000000..d539423 --- /dev/null +++ b/libs/internals/core.process_compiled_include.php @@ -0,0 +1,37 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Replace nocache-tags by results of the corresponding non-cacheable + * functions and return it + * + * @param string $compiled_tpl + * @param string $cached_source + * @return string + */ + +function smarty_core_process_compiled_include($params, &$smarty) +{ + $_cache_including = $smarty->_cache_including; + $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); + } + $smarty->_cache_including = $_cache_including; + return $_return; +} + +?> diff --git a/libs/internals/core.read_cache_file.php b/libs/internals/core.read_cache_file.php new file mode 100644 index 0000000..c60e113 --- /dev/null +++ b/libs/internals/core.read_cache_file.php @@ -0,0 +1,101 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * read a cache file, determine if it needs to be + * regenerated or not + * + * @param string $tpl_file + * @param string $cache_id + * @param string $compile_id + * @param string $results + * @return boolean + */ + +// $tpl_file, $cache_id, $compile_id, &$results + +function smarty_core_read_cache_file(&$params, &$smarty) +{ + static $content_cache = array(); + + if ($smarty->force_compile) { + // force compile enabled, always regenerate + return false; + } + + if (isset($content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']])) { + list($params['results'], $smarty->_cache_info) = $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']]; + return true; + } + + if (!empty($smarty->cache_handler_func)) { + // use cache_handler function + call_user_func_array($smarty->cache_handler_func, + array('read', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); + } else { + // use local cache file + $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); + $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); + $params['results'] = $smarty->_read_file($_cache_file); + } + + if (empty($params['results'])) { + // nothing to parse (error?), regenerate cache + return false; + } + + $_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 + if ($_cache_info['expires'] > -1 && (time() > $_cache_info['expires'])) { + // cache expired, regenerate + return false; + } + } else { + // caching by lifetime + if ($smarty->cache_lifetime > -1 && (time() - $_cache_info['timestamp'] > $smarty->cache_lifetime)) { + // cache expired, regenerate + return false; + } + } + + if ($smarty->compile_check) { + $_params = array('get_source' => false, 'quiet'=>true); + foreach (array_keys($_cache_info['template']) as $_template_dep) { + $_params['resource_name'] = $_template_dep; + if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { + // template file has changed, regenerate cache + return false; + } + } + + if (isset($_cache_info['config'])) { + $_params = array('resource_base_path' => $smarty->config_dir, 'get_source' => false, 'quiet'=>true); + foreach (array_keys($_cache_info['config']) as $_config_dep) { + $_params['resource_name'] = $_config_dep; + if (!$smarty->_fetch_resource_info($_params) || $_cache_info['timestamp'] < $_params['resource_timestamp']) { + // config file has changed, regenerate cache + return false; + } + } + } + } + + $content_cache[$params['tpl_file'].','.$params['cache_id'].','.$params['compile_id']] = array($params['results'], $_cache_info); + + $smarty->_cache_info = $_cache_info; + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.rm_auto.php b/libs/internals/core.rm_auto.php new file mode 100644 index 0000000..b251f64 --- /dev/null +++ b/libs/internals/core.rm_auto.php @@ -0,0 +1,71 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * delete an automagically created file by name and id + * + * @param string $auto_base + * @param string $auto_source + * @param string $auto_id + * @param integer $exp_time + * @return boolean + */ + +// $auto_base, $auto_source = null, $auto_id = null, $exp_time = null + +function smarty_core_rm_auto($params, &$smarty) +{ + if (!@is_dir($params['auto_base'])) + return false; + + if(!isset($params['auto_id']) && !isset($params['auto_source'])) { + $_params = array( + 'dirname' => $params['auto_base'], + 'level' => 0, + 'exp_time' => $params['exp_time'] + ); + require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); + $_res = smarty_core_rmdir($_params, $smarty); + } else { + $_tname = $smarty->_get_auto_filename($params['auto_base'], $params['auto_source'], $params['auto_id']); + + if(isset($params['auto_source'])) { + if (isset($params['extensions'])) { + $_res = false; + foreach ((array)$params['extensions'] as $_extension) + $_res |= $smarty->_unlink($_tname.$_extension, $params['exp_time']); + } else { + $_res = $smarty->_unlink($_tname, $params['exp_time']); + } + } elseif ($smarty->use_sub_dirs) { + $_params = array( + 'dirname' => $_tname, + 'level' => 1, + 'exp_time' => $params['exp_time'] + ); + require_once(SMARTY_CORE_DIR . 'core.rmdir.php'); + $_res = smarty_core_rmdir($_params, $smarty); + } else { + // remove matching file names + $_handle = opendir($params['auto_base']); + $_res = true; + while (false !== ($_filename = readdir($_handle))) { + if($_filename == '.' || $_filename == '..') { + continue; + } elseif (substr($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, 0, strlen($_tname)) == $_tname) { + $_res &= (bool)$smarty->_unlink($params['auto_base'] . DIRECTORY_SEPARATOR . $_filename, $params['exp_time']); + } + } + } + } + + return $_res; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.rmdir.php b/libs/internals/core.rmdir.php new file mode 100644 index 0000000..2166c44 --- /dev/null +++ b/libs/internals/core.rmdir.php @@ -0,0 +1,54 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * delete a dir recursively (level=0 -> keep root) + * WARNING: no tests, it will try to remove what you tell it! + * + * @param string $dirname + * @param integer $level + * @param integer $exp_time + * @return boolean + */ + +// $dirname, $level = 1, $exp_time = null + +function smarty_core_rmdir($params, &$smarty) +{ + if(!isset($params['level'])) { $params['level'] = 1; } + if(!isset($params['exp_time'])) { $params['exp_time'] = null; } + + if($_handle = @opendir($params['dirname'])) { + + while (false !== ($_entry = readdir($_handle))) { + if ($_entry != '.' && $_entry != '..') { + if (@is_dir($params['dirname'] . DIRECTORY_SEPARATOR . $_entry)) { + $_params = array( + 'dirname' => $params['dirname'] . DIRECTORY_SEPARATOR . $_entry, + 'level' => $params['level'] + 1, + 'exp_time' => $params['exp_time'] + ); + smarty_core_rmdir($_params, $smarty); + } + else { + $smarty->_unlink($params['dirname'] . DIRECTORY_SEPARATOR . $_entry, $params['exp_time']); + } + } + } + closedir($_handle); + } + + if ($params['level']) { + return @rmdir($params['dirname']); + } + return (bool)$_handle; + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.run_insert_handler.php b/libs/internals/core.run_insert_handler.php new file mode 100644 index 0000000..71c3845 --- /dev/null +++ b/libs/internals/core.run_insert_handler.php @@ -0,0 +1,71 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Handle insert tags + * + * @param array $args + * @return string + */ +function smarty_core_run_insert_handler($params, &$smarty) +{ + + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + if ($smarty->debugging) { + $_params = array(); + $_debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + if ($smarty->caching) { + $_arg_string = serialize($params['args']); + $_name = $params['args']['name']; + if (!isset($smarty->_cache_info['insert_tags'][$_name])) { + $smarty->_cache_info['insert_tags'][$_name] = array('insert', + $_name, + $smarty->_plugins['insert'][$_name][1], + $smarty->_plugins['insert'][$_name][2], + !empty($params['args']['script']) ? true : false); + } + return $smarty->_smarty_md5."{insert_cache $_arg_string}".$smarty->_smarty_md5; + } else { + if (isset($params['args']['script'])) { + $_params = array('resource_name' => $smarty->_dequote($params['args']['script'])); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + if(!smarty_core_get_php_resource($_params, $smarty)) { + return false; + } + + if ($_params['resource_type'] == 'file') { + $smarty->_include($_params['php_resource'], true); + } else { + $smarty->_eval($_params['php_resource']); + } + unset($params['args']['script']); + } + + $_funcname = $smarty->_plugins['insert'][$params['args']['name']][0]; + $_content = $_funcname($params['args'], $smarty); + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'insert', + 'filename' => 'insert_'.$params['args']['name'], + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); + } + + if (!empty($params['args']["assign"])) { + $smarty->assign($params['args']["assign"], $_content); + } else { + return $_content; + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.smarty_include_php.php b/libs/internals/core.smarty_include_php.php new file mode 100644 index 0000000..30c6e76 --- /dev/null +++ b/libs/internals/core.smarty_include_php.php @@ -0,0 +1,50 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * called for included php files within templates + * + * @param string $smarty_file + * @param string $smarty_assign variable to assign the included template's + * output into + * @param boolean $smarty_once uses include_once if this is true + * @param array $smarty_include_vars associative array of vars from + * {include file="blah" var=$var} + */ + +// $file, $assign, $once, $_smarty_include_vars + +function smarty_core_smarty_include_php($params, &$smarty) +{ + $_params = array('resource_name' => $params['smarty_file']); + require_once(SMARTY_CORE_DIR . 'core.get_php_resource.php'); + smarty_core_get_php_resource($_params, $smarty); + $_smarty_resource_type = $_params['resource_type']; + $_smarty_php_resource = $_params['php_resource']; + + if (!empty($params['smarty_assign'])) { + ob_start(); + if ($_smarty_resource_type == 'file') { + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); + } else { + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); + } + $smarty->assign($params['smarty_assign'], ob_get_contents()); + ob_end_clean(); + } else { + if ($_smarty_resource_type == 'file') { + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); + } else { + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); + } + } +} + + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.write_cache_file.php b/libs/internals/core.write_cache_file.php new file mode 100644 index 0000000..72f785b --- /dev/null +++ b/libs/internals/core.write_cache_file.php @@ -0,0 +1,96 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Prepend the cache information to the cache file + * and write it + * + * @param string $tpl_file + * @param string $cache_id + * @param string $compile_id + * @param string $results + * @return true|null + */ + + // $tpl_file, $cache_id, $compile_id, $results + +function smarty_core_write_cache_file($params, &$smarty) +{ + + // put timestamp in cache header + $smarty->_cache_info['timestamp'] = time(); + if ($smarty->cache_lifetime > -1){ + // expiration set + $smarty->_cache_info['expires'] = $smarty->_cache_info['timestamp'] + $smarty->cache_lifetime; + } else { + // cache will never expire + $smarty->_cache_info['expires'] = -1; + } + + // collapse nocache.../nocache-tags + if (preg_match_all('!\{(/?)nocache\:[0-9a-f]{32}#\d+\}!', $params['results'], $match, PREG_PATTERN_ORDER)) { + // remove everything between every pair of outermost noache.../nocache-tags + // and replace it by a single nocache-tag + // this new nocache-tag will be replaced by dynamic contents in + // smarty_core_process_compiled_includes() on a cache-read + + $match_count = count($match[0]); + $results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE); + + $level = 0; + $j = 0; + for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) { + if ($results[$i] == $match[0][$j]) { + // nocache tag + if ($match[1][$j]) { // closing tag + $level--; + unset($results[$i]); + } else { // opening tag + if ($level++ > 0) unset($results[$i]); + } + $j++; + } elseif ($level > 0) { + unset($results[$i]); + } + } + $params['results'] = implode('', $results); + } + $smarty->_cache_info['cache_serials'] = $smarty->_cache_serials; + + // prepend the cache header info into cache file + $_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 + call_user_func_array($smarty->cache_handler_func, + array('write', &$smarty, &$params['results'], $params['tpl_file'], $params['cache_id'], $params['compile_id'], null)); + } else { + // use local cache file + + if(!@is_writable($smarty->cache_dir)) { + // cache_dir not writable, see if it exists + if(!@is_dir($smarty->cache_dir)) { + $smarty->trigger_error('the $cache_dir \'' . $smarty->cache_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); + return false; + } + $smarty->trigger_error('unable to write to $cache_dir \'' . realpath($smarty->cache_dir) . '\'. Be sure $cache_dir is writable by the web server user.', E_USER_ERROR); + return false; + } + + $_auto_id = $smarty->_get_auto_id($params['cache_id'], $params['compile_id']); + $_cache_file = $smarty->_get_auto_filename($smarty->cache_dir, $params['tpl_file'], $_auto_id); + $_params = array('filename' => $_cache_file, 'contents' => $params['results'], 'create_dirs' => true); + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.write_compiled_include.php b/libs/internals/core.write_compiled_include.php new file mode 100644 index 0000000..3a78094 --- /dev/null +++ b/libs/internals/core.write_compiled_include.php @@ -0,0 +1,91 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Extract non-cacheable parts out of compiled template and write it + * + * @param string $compile_path + * @param string $template_compiled + * @return boolean + */ + +function smarty_core_write_compiled_include($params, &$smarty) +{ + $_tag_start = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{nocache\:('.$params['cache_serial'].')#(\d+)\}\'; \};'; + $_tag_end = 'if \(\$this->caching && \!\$this->_cache_including\) \{ echo \'\{/nocache\:(\\2)#(\\3)\}\'; \};'; + + preg_match_all('!('.$_tag_start.'(.*)'.$_tag_end.')!Us', + $params['compiled_content'], $_match_source, PREG_SET_ORDER); + + // no nocache-parts found: done + if (count($_match_source)==0) return; + + // convert the matched php-code to functions + $_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n"; + $_include_compiled .= " compiled from " . strtr(urlencode($params['resource_name']), array('%2F'=>'/', '%3A'=>':')) . " */\n\n"; + + $_compile_path = $params['include_file_path']; + + $smarty->_cache_serials[$_compile_path] = $params['cache_serial']; + $_include_compiled .= "\$this->_cache_serials['".$_compile_path."'] = '".$params['cache_serial']."';\n\n?>"; + + $_include_compiled .= $params['plugins_code']; + $_include_compiled .= "<?php"; + + $this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this'; + for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) { + $_match =& $_match_source[$_i]; + $source = $_match[4]; + if ($this_varname == '_smarty') { + /* rename $this to $_smarty in the sourcecode */ + $tokens = token_get_all('<?php ' . $_match[4]); + + /* 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') { + $tokens[$i] = '$' . $this_varname; + } else { + $tokens[$i] = $tokens[$i][1]; + } + } + } + $source = implode('', $tokens); + } + + /* add function to compiled include */ + $_include_compiled .= " +function _smarty_tplfunc_$_match[2]_$_match[3](&\$$this_varname) +{ +$source +} + +"; + } + $_include_compiled .= "\n\n?>\n"; + + $_params = array('filename' => $_compile_path, + 'contents' => $_include_compiled, 'create_dirs' => true); + + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; +} + + +?> diff --git a/libs/internals/core.write_compiled_resource.php b/libs/internals/core.write_compiled_resource.php new file mode 100644 index 0000000..b902eff --- /dev/null +++ b/libs/internals/core.write_compiled_resource.php @@ -0,0 +1,35 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * write the compiled resource + * + * @param string $compile_path + * @param string $compiled_content + * @return true + */ +function smarty_core_write_compiled_resource($params, &$smarty) +{ + if(!@is_writable($smarty->compile_dir)) { + // compile_dir not writable, see if it exists + if(!@is_dir($smarty->compile_dir)) { + $smarty->trigger_error('the $compile_dir \'' . $smarty->compile_dir . '\' does not exist, or is not a directory.', E_USER_ERROR); + return false; + } + $smarty->trigger_error('unable to write to $compile_dir \'' . realpath($smarty->compile_dir) . '\'. Be sure $compile_dir is writable by the web server user.', E_USER_ERROR); + return false; + } + + $_params = array('filename' => $params['compile_path'], 'contents' => $params['compiled_content'], 'create_dirs' => true); + require_once(SMARTY_CORE_DIR . 'core.write_file.php'); + smarty_core_write_file($_params, $smarty); + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/internals/core.write_file.php b/libs/internals/core.write_file.php new file mode 100644 index 0000000..09e1698 --- /dev/null +++ b/libs/internals/core.write_file.php @@ -0,0 +1,54 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * write out a file to disk + * + * @param string $filename + * @param string $contents + * @param boolean $create_dirs + * @return boolean + */ +function smarty_core_write_file($params, &$smarty) +{ + $_dirname = dirname($params['filename']); + + if ($params['create_dirs']) { + $_params = array('dir' => $_dirname); + require_once(SMARTY_CORE_DIR . 'core.create_dir_structure.php'); + smarty_core_create_dir_structure($_params, $smarty); + } + + // write to tmp file, then rename it to avoid + // file locking race condition + $_tmp_file = tempnam($_dirname, 'wrt'); + + if (!($fd = @fopen($_tmp_file, 'wb'))) { + $_tmp_file = $_dirname . DIRECTORY_SEPARATOR . uniqid('wrt'); + if (!($fd = @fopen($_tmp_file, 'wb'))) { + $smarty->trigger_error("problem writing temporary file '$_tmp_file'"); + return false; + } + } + + fwrite($fd, $params['contents']); + fclose($fd); + + // Delete the file if it allready exists (this is needed on Win, + // because it cannot overwrite files with rename() + if (file_exists($params['filename'])) { + @unlink($params['filename']); + } + @rename($_tmp_file, $params['filename']); + @chmod($params['filename'], $smarty->_file_perms); + + return true; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/block.textformat.php b/libs/plugins/block.textformat.php new file mode 100644 index 0000000..8cd010a --- /dev/null +++ b/libs/plugins/block.textformat.php @@ -0,0 +1,103 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {textformat}{/textformat} block plugin + * + * Type: block function<br> + * Name: textformat<br> + * Purpose: format text a certain way with preset styles + * or custom wrap/indent settings<br> + * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat} + * (Smarty online manual) + * @param array + * <pre> + * Params: style: string (email) + * indent: integer (0) + * wrap: integer (80) + * wrap_char string ("\n") + * indent_char: string (" ") + * wrap_boundary: boolean (true) + * </pre> + * @author Monte Ohrt <monte at ohrt dot com> + * @param string contents of the block + * @param Smarty clever simulation of a method + * @return string string $content re-formatted + */ +function smarty_block_textformat($params, $content, &$smarty) +{ + if (is_null($content)) { + return; + } + + $style = null; + $indent = 0; + $indent_first = 0; + $indent_char = ' '; + $wrap = 80; + $wrap_char = "\n"; + $wrap_cut = false; + $assign = null; + + foreach ($params as $_key => $_val) { + switch ($_key) { + case 'style': + case 'indent_char': + case 'wrap_char': + case 'assign': + $$_key = (string)$_val; + break; + + case 'indent': + case 'indent_first': + case 'wrap': + $$_key = (int)$_val; + break; + + case 'wrap_cut': + $$_key = (bool)$_val; + break; + + default: + $smarty->trigger_error("textformat: unknown attribute '$_key'"); + } + } + + if ($style == 'email') { + $wrap = 72; + } + + // split into paragraphs + $_paragraphs = preg_split('![\r\n][\r\n]!',$content); + $_output = ''; + + for($_x = 0, $_y = count($_paragraphs); $_x < $_y; $_x++) { + if ($_paragraphs[$_x] == '') { + continue; + } + // convert mult. spaces & special chars to single space + $_paragraphs[$_x] = preg_replace(array('!\s+!','!(^\s+)|(\s+$)!'), array(' ',''), $_paragraphs[$_x]); + // indent first line + if($indent_first > 0) { + $_paragraphs[$_x] = str_repeat($indent_char, $indent_first) . $_paragraphs[$_x]; + } + // wordwrap sentences + $_paragraphs[$_x] = wordwrap($_paragraphs[$_x], $wrap - $indent, $wrap_char, $wrap_cut); + // indent lines + if($indent > 0) { + $_paragraphs[$_x] = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraphs[$_x]); + } + } + $_output = implode($wrap_char . $wrap_char, $_paragraphs); + + return $assign ? $smarty->assign($assign, $_output) : $_output; + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/compiler.assign.php b/libs/plugins/compiler.assign.php new file mode 100644 index 0000000..be17298 --- /dev/null +++ b/libs/plugins/compiler.assign.php @@ -0,0 +1,40 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {assign} compiler function plugin + * + * Type: compiler function<br> + * Name: assign<br> + * Purpose: assign a value to a template variable + * @link http://smarty.php.net/manual/en/language.custom.functions.php#LANGUAGE.FUNCTION.ASSIGN {assign} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> (initial author) + * @auther messju mohr <messju at lammfellpuschen dot de> (conversion to compiler function) + * @param string containing var-attribute and value-attribute + * @param Smarty_Compiler + */ +function smarty_compiler_assign($tag_attrs, &$compiler) +{ + $_params = $compiler->_parse_attrs($tag_attrs); + + if (!isset($_params['var'])) { + $compiler->_syntax_error("assign: missing 'var' parameter", E_USER_WARNING); + return; + } + + if (!isset($_params['value'])) { + $compiler->_syntax_error("assign: missing 'value' parameter", E_USER_WARNING); + return; + } + + return "\$this->assign({$_params['var']}, {$_params['value']});"; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.assign_debug_info.php b/libs/plugins/function.assign_debug_info.php new file mode 100644 index 0000000..6540498 --- /dev/null +++ b/libs/plugins/function.assign_debug_info.php @@ -0,0 +1,40 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {assign_debug_info} function plugin + * + * Type: function<br> + * Name: assign_debug_info<br> + * Purpose: assign debug info to the template<br> + * @author Monte Ohrt <monte at ohrt dot com> + * @param array unused in this plugin, this plugin uses {@link Smarty::$_config}, + * {@link Smarty::$_tpl_vars} and {@link Smarty::$_smarty_debug_info} + * @param Smarty + */ +function smarty_function_assign_debug_info($params, &$smarty) +{ + $assigned_vars = $smarty->_tpl_vars; + ksort($assigned_vars); + if (@is_array($smarty->_config[0])) { + $config_vars = $smarty->_config[0]; + ksort($config_vars); + $smarty->assign("_debug_config_keys", array_keys($config_vars)); + $smarty->assign("_debug_config_vals", array_values($config_vars)); + } + + $included_templates = $smarty->_smarty_debug_info; + + $smarty->assign("_debug_keys", array_keys($assigned_vars)); + $smarty->assign("_debug_vals", array_values($assigned_vars)); + + $smarty->assign("_debug_tpls", $included_templates); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.config_load.php b/libs/plugins/function.config_load.php new file mode 100644 index 0000000..db89f63 --- /dev/null +++ b/libs/plugins/function.config_load.php @@ -0,0 +1,142 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {config_load} function plugin + * + * Type: function<br> + * Name: config_load<br> + * Purpose: load config file vars + * @link http://smarty.php.net/manual/en/language.function.config.load.php {config_load} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @author messju mohr <messju at lammfellpuschen dot de> (added use of resources) + * @param array Format: + * <pre> + * array('file' => required config file name, + * 'section' => optional config file section to load + * 'scope' => local/parent/global + * 'global' => overrides scope, setting to parent if true) + * </pre> + * @param Smarty + */ +function smarty_function_config_load($params, &$smarty) +{ + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $_debug_start_time = smarty_core_get_microtime($_params, $smarty); + } + + $_file = isset($params['file']) ? $smarty->_dequote($params['file']) : null; + $_section = isset($params['section']) ? $smarty->_dequote($params['section']) : null; + $_scope = isset($params['scope']) ? $smarty->_dequote($params['scope']) : 'global'; + $_global = isset($params['global']) ? $smarty->_dequote($params['global']) : false; + + if (!isset($_file) || strlen($_file) == 0) { + $smarty->trigger_error("missing 'file' attribute in config_load tag", E_USER_ERROR, __FILE__, __LINE__); + } + + if (isset($_scope)) { + if ($_scope != 'local' && + $_scope != 'parent' && + $_scope != 'global') { + $smarty->trigger_error("invalid 'scope' attribute value", E_USER_ERROR, __FILE__, __LINE__); + } + } else { + if ($_global) { + $_scope = 'parent'; + } else { + $_scope = 'local'; + } + } + + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + 'get_source' => false); + $smarty->_parse_resource_name($_params); + $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; + if (isset($_section)) + $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); + else + $_compile_file = $smarty->_get_compile_path($_file_path); + + if($smarty->force_compile || !file_exists($_compile_file)) { + $_compile = true; + } elseif ($smarty->compile_check) { + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + 'get_source' => false); + $_compile = $smarty->_fetch_resource_info($_params) && + $_params['resource_timestamp'] > filemtime($_compile_file); + } else { + $_compile = false; + } + + if($_compile) { + // compile config file + if(!is_object($smarty->_conf_obj)) { + require_once SMARTY_DIR . $smarty->config_class . '.class.php'; + $smarty->_conf_obj = new $smarty->config_class(); + $smarty->_conf_obj->overwrite = $smarty->config_overwrite; + $smarty->_conf_obj->booleanize = $smarty->config_booleanize; + $smarty->_conf_obj->read_hidden = $smarty->config_read_hidden; + $smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines; + } + + $_params = array('resource_name' => $_file, + 'resource_base_path' => $smarty->config_dir, + $_params['get_source'] = true); + if (!$smarty->_fetch_resource_info($_params)) { + return; + } + $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']); + $_config_vars = array_merge($smarty->_conf_obj->get($_file), + $smarty->_conf_obj->get($_file, $_section)); + if(function_exists('var_export')) { + $_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>'; + } else { + $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>'; + } + $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); + require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); + smarty_core_write_compiled_resource($_params, $smarty); + } else { + include($_compile_file); + } + + if ($smarty->caching) { + $smarty->_cache_info['config'][$_file] = true; + } + + $smarty->_config[0]['vars'] = @array_merge($smarty->_config[0]['vars'], $_config_vars); + $smarty->_config[0]['files'][$_file] = true; + + if ($_scope == 'parent') { + $smarty->_config[1]['vars'] = @array_merge($smarty->_config[1]['vars'], $_config_vars); + $smarty->_config[1]['files'][$_file] = true; + } else if ($_scope == 'global') { + for ($i = 1, $for_max = count($smarty->_config); $i < $for_max; $i++) { + $smarty->_config[$i]['vars'] = @array_merge($smarty->_config[$i]['vars'], $_config_vars); + $smarty->_config[$i]['files'][$_file] = true; + } + } + + if ($smarty->debugging) { + $_params = array(); + require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); + $smarty->_smarty_debug_info[] = array('type' => 'config', + 'filename' => $_file.' ['.$_section.'] '.$_scope, + 'depth' => $smarty->_inclusion_depth, + 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $_debug_start_time); + } + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.counter.php b/libs/plugins/function.counter.php new file mode 100644 index 0000000..1f26db5 --- /dev/null +++ b/libs/plugins/function.counter.php @@ -0,0 +1,80 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {counter} function plugin + * + * Type: function<br> + * Name: counter<br> + * Purpose: print out a counter value + * @author Monte Ohrt <monte at ohrt dot com> + * @link http://smarty.php.net/manual/en/language.function.counter.php {counter} + * (Smarty online manual) + * @param array parameters + * @param Smarty + * @return string|null + */ +function smarty_function_counter($params, &$smarty) +{ + static $counters = array(); + + $name = (isset($params['name'])) ? $params['name'] : 'default'; + if (!isset($counters[$name])) { + $counters[$name] = array( + 'start'=>1, + 'skip'=>1, + 'direction'=>'up', + 'count'=>1 + ); + } + $counter =& $counters[$name]; + + if (isset($params['start'])) { + $counter['start'] = $counter['count'] = (int)$params['start']; + } + + if (!empty($params['assign'])) { + $counter['assign'] = $params['assign']; + } + + if (isset($counter['assign'])) { + $smarty->assign($counter['assign'], $counter['count']); + } + + if (isset($params['print'])) { + $print = (bool)$params['print']; + } else { + $print = empty($counter['assign']); + } + + if ($print) { + $retval = $counter['count']; + } else { + $retval = null; + } + + if (isset($params['skip'])) { + $counter['skip'] = $params['skip']; + } + + if (isset($params['direction'])) { + $counter['direction'] = $params['direction']; + } + + if ($counter['direction'] == "down") + $counter['count'] -= $counter['skip']; + else + $counter['count'] += $counter['skip']; + + return $retval; + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.cycle.php b/libs/plugins/function.cycle.php new file mode 100644 index 0000000..fe78bb8 --- /dev/null +++ b/libs/plugins/function.cycle.php @@ -0,0 +1,102 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {cycle} function plugin + * + * Type: function<br> + * Name: cycle<br> + * Date: May 3, 2002<br> + * Purpose: cycle through given values<br> + * Input: + * - name = name of cycle (optional) + * - values = comma separated list of values to cycle, + * or an array of values to cycle + * (this can be left out for subsequent calls) + * - reset = boolean - resets given var to true + * - print = boolean - print var or not. default is true + * - advance = boolean - whether or not to advance the cycle + * - delimiter = the value delimiter, default is "," + * - assign = boolean, assigns to template var instead of + * printed. + * + * Examples:<br> + * <pre> + * {cycle values="#eeeeee,#d0d0d0d"} + * {cycle name=row values="one,two,three" reset=true} + * {cycle name=row} + * </pre> + * @link http://smarty.php.net/manual/en/language.function.cycle.php {cycle} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @author credit to Mark Priatel <[email protected]> + * @author credit to Gerard <[email protected]> + * @author credit to Jason Sweat <[email protected]> + * @version 1.3 + * @param array + * @param Smarty + * @return string|null + */ +function smarty_function_cycle($params, &$smarty) +{ + static $cycle_vars; + + $name = (empty($params['name'])) ? 'default' : $params['name']; + $print = (isset($params['print'])) ? (bool)$params['print'] : true; + $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true; + $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false; + + if (!in_array('values', array_keys($params))) { + if(!isset($cycle_vars[$name]['values'])) { + $smarty->trigger_error("cycle: missing 'values' parameter"); + return; + } + } else { + if(isset($cycle_vars[$name]['values']) + && $cycle_vars[$name]['values'] != $params['values'] ) { + $cycle_vars[$name]['index'] = 0; + } + $cycle_vars[$name]['values'] = $params['values']; + } + + $cycle_vars[$name]['delimiter'] = (isset($params['delimiter'])) ? $params['delimiter'] : ','; + + if(is_array($cycle_vars[$name]['values'])) { + $cycle_array = $cycle_vars[$name]['values']; + } else { + $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']); + } + + if(!isset($cycle_vars[$name]['index']) || $reset ) { + $cycle_vars[$name]['index'] = 0; + } + + if (isset($params['assign'])) { + $print = false; + $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]); + } + + if($print) { + $retval = $cycle_array[$cycle_vars[$name]['index']]; + } else { + $retval = null; + } + + if($advance) { + if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) { + $cycle_vars[$name]['index'] = 0; + } else { + $cycle_vars[$name]['index']++; + } + } + + return $retval; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.debug.php b/libs/plugins/function.debug.php new file mode 100644 index 0000000..4345230 --- /dev/null +++ b/libs/plugins/function.debug.php @@ -0,0 +1,35 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {debug} function plugin + * + * Type: function<br> + * Name: debug<br> + * Date: July 1, 2002<br> + * Purpose: popup debug window + * @link http://smarty.php.net/manual/en/language.function.debug.php {debug} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @version 1.0 + * @param array + * @param Smarty + * @return string output from {@link Smarty::_generate_debug_output()} + */ +function smarty_function_debug($params, &$smarty) +{ + if (isset($params['output'])) { + $smarty->assign('_smarty_debug_output', $params['output']); + } + require_once(SMARTY_CORE_DIR . 'core.display_debug_console.php'); + return smarty_core_display_debug_console(null, $smarty); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.eval.php b/libs/plugins/function.eval.php new file mode 100644 index 0000000..ff0472d --- /dev/null +++ b/libs/plugins/function.eval.php @@ -0,0 +1,49 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {eval} function plugin + * + * Type: function<br> + * Name: eval<br> + * Purpose: evaluate a template variable as a template<br> + * @link http://smarty.php.net/manual/en/language.function.eval.php {eval} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + */ +function smarty_function_eval($params, &$smarty) +{ + + if (!isset($params['var'])) { + $smarty->trigger_error("eval: missing 'var' parameter"); + return; + } + + if($params['var'] == '') { + return; + } + + $smarty->_compile_source('evaluated template', $params['var'], $_var_compiled); + + ob_start(); + $smarty->_eval('?>' . $_var_compiled); + $_contents = ob_get_contents(); + ob_end_clean(); + + if (!empty($params['assign'])) { + $smarty->assign($params['assign'], $_contents); + } else { + return $_contents; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.fetch.php b/libs/plugins/function.fetch.php new file mode 100644 index 0000000..81b1bfc --- /dev/null +++ b/libs/plugins/function.fetch.php @@ -0,0 +1,221 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {fetch} plugin + * + * Type: function<br> + * Name: fetch<br> + * Purpose: fetch file, web or ftp data and display results + * @link http://smarty.php.net/manual/en/language.function.fetch.php {fetch} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string|null if the assign parameter is passed, Smarty assigns the + * result to a template variable + */ +function smarty_function_fetch($params, &$smarty) +{ + if (empty($params['file'])) { + $smarty->_trigger_fatal_error("[plugin] parameter 'file' cannot be empty"); + return; + } + + $content = ''; + if ($smarty->security && !preg_match('!^(http|ftp)://!i', $params['file'])) { + $_params = array('resource_type' => 'file', 'resource_name' => $params['file']); + require_once(SMARTY_CORE_DIR . 'core.is_secure.php'); + if(!smarty_core_is_secure($_params, $smarty)) { + $smarty->_trigger_fatal_error('[plugin] (secure mode) fetch \'' . $params['file'] . '\' is not allowed'); + return; + } + + // fetch the file + if($fp = @fopen($params['file'],'r')) { + while(!feof($fp)) { + $content .= fgets ($fp,4096); + } + fclose($fp); + } else { + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] . '\''); + return; + } + } else { + // not a local file + if(preg_match('!^http://!i',$params['file'])) { + // http fetch + if($uri_parts = parse_url($params['file'])) { + // set defaults + $host = $server_name = $uri_parts['host']; + $timeout = 30; + $accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"; + $agent = "Smarty Template Engine ".$smarty->_version; + $referer = ""; + $uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/'; + $uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : ''; + $_is_proxy = false; + if(empty($uri_parts['port'])) { + $port = 80; + } else { + $port = $uri_parts['port']; + } + if(!empty($uri_parts['user'])) { + $user = $uri_parts['user']; + } + if(!empty($uri_parts['pass'])) { + $pass = $uri_parts['pass']; + } + // loop through parameters, setup headers + foreach($params as $param_key => $param_value) { + switch($param_key) { + case "file": + case "assign": + case "assign_headers": + break; + case "user": + if(!empty($param_value)) { + $user = $param_value; + } + break; + case "pass": + if(!empty($param_value)) { + $pass = $param_value; + } + break; + case "accept": + if(!empty($param_value)) { + $accept = $param_value; + } + break; + case "header": + if(!empty($param_value)) { + if(!preg_match('![\w\d-]+: .+!',$param_value)) { + $smarty->_trigger_fatal_error("[plugin] invalid header format '".$param_value."'"); + return; + } else { + $extra_headers[] = $param_value; + } + } + break; + case "proxy_host": + if(!empty($param_value)) { + $proxy_host = $param_value; + } + break; + case "proxy_port": + if(!preg_match('!\D!', $param_value)) { + $proxy_port = (int) $param_value; + } else { + $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); + return; + } + break; + case "agent": + if(!empty($param_value)) { + $agent = $param_value; + } + break; + case "referer": + if(!empty($param_value)) { + $referer = $param_value; + } + break; + case "timeout": + if(!preg_match('!\D!', $param_value)) { + $timeout = (int) $param_value; + } else { + $smarty->_trigger_fatal_error("[plugin] invalid value for attribute '".$param_key."'"); + return; + } + break; + default: + $smarty->_trigger_fatal_error("[plugin] unrecognized attribute '".$param_key."'"); + return; + } + } + if(!empty($proxy_host) && !empty($proxy_port)) { + $_is_proxy = true; + $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout); + } else { + $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout); + } + + if(!$fp) { + $smarty->_trigger_fatal_error("[plugin] unable to fetch: $errstr ($errno)"); + return; + } else { + if($_is_proxy) { + fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n"); + } else { + fputs($fp, "GET $uri HTTP/1.0\r\n"); + } + if(!empty($host)) { + fputs($fp, "Host: $host\r\n"); + } + if(!empty($accept)) { + fputs($fp, "Accept: $accept\r\n"); + } + if(!empty($agent)) { + fputs($fp, "User-Agent: $agent\r\n"); + } + if(!empty($referer)) { + fputs($fp, "Referer: $referer\r\n"); + } + if(isset($extra_headers) && is_array($extra_headers)) { + foreach($extra_headers as $curr_header) { + fputs($fp, $curr_header."\r\n"); + } + } + if(!empty($user) && !empty($pass)) { + fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n"); + } + + fputs($fp, "\r\n"); + while(!feof($fp)) { + $content .= fgets($fp,4096); + } + fclose($fp); + $csplit = split("\r\n\r\n",$content,2); + + $content = $csplit[1]; + + if(!empty($params['assign_headers'])) { + $smarty->assign($params['assign_headers'],split("\r\n",$csplit[0])); + } + } + } else { + $smarty->_trigger_fatal_error("[plugin] unable to parse URL, check syntax"); + return; + } + } else { + // ftp fetch + if($fp = @fopen($params['file'],'r')) { + while(!feof($fp)) { + $content .= fgets ($fp,4096); + } + fclose($fp); + } else { + $smarty->_trigger_fatal_error('[plugin] fetch cannot read file \'' . $params['file'] .'\''); + return; + } + } + + } + + + if (!empty($params['assign'])) { + $smarty->assign($params['assign'],$content); + } else { + return $content; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.html_checkboxes.php b/libs/plugins/function.html_checkboxes.php new file mode 100644 index 0000000..ed8ad7f --- /dev/null +++ b/libs/plugins/function.html_checkboxes.php @@ -0,0 +1,143 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_checkboxes} function plugin + * + * File: function.html_checkboxes.php<br> + * Type: function<br> + * Name: html_checkboxes<br> + * Date: 24.Feb.2003<br> + * Purpose: Prints out a list of checkbox input types<br> + * Input:<br> + * - name (optional) - string default "checkbox" + * - values (required) - array + * - options (optional) - associative array + * - checked (optional) - array default not set + * - separator (optional) - ie <br> or + * - output (optional) - the output next to each checkbox + * - assign (optional) - assign the output as an array to this variable + * Examples: + * <pre> + * {html_checkboxes values=$ids output=$names} + * {html_checkboxes values=$ids name='box' separator='<br>' output=$names} + * {html_checkboxes values=$ids checked=$checked separator='<br>' output=$names} + * </pre> + * @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} + * (Smarty online manual) + * @author Christopher Kvarme <[email protected]> + * @author credits to Monte Ohrt <monte at ohrt dot com> + * @version 1.0 + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_checkboxes($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $name = 'checkbox'; + $values = null; + $options = null; + $selected = null; + $separator = ''; + $labels = true; + $output = null; + + $extra = ''; + + foreach($params as $_key => $_val) { + switch($_key) { + case 'name': + case 'separator': + $$_key = $_val; + break; + + case 'labels': + $$_key = (bool)$_val; + break; + + case 'options': + $$_key = (array)$_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + + case 'checked': + case 'selected': + $selected = array_map('strval', array_values((array)$_val)); + break; + + case 'checkboxes': + $smarty->trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING); + $options = (array)$_val; + break; + + case 'assign': + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (!isset($options) && !isset($values)) + return ''; /* raise error here? */ + + settype($selected, 'array'); + $_html_result = array(); + + if (isset($options)) { + + foreach ($options as $_key=>$_val) + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + + + } else { + foreach ($values as $_i=>$_key) { + $_val = isset($output[$_i]) ? $output[$_i] : ''; + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); + } + + } + + if(!empty($params['assign'])) { + $smarty->assign($params['assign'], $_html_result); + } else { + return implode("\n",$_html_result); + } + +} + +function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) { + $_output = ''; + if ($labels) $_output .= '<label>'; + $_output .= '<input type="checkbox" name="' + . smarty_function_escape_special_chars($name) . '[]" value="' + . smarty_function_escape_special_chars($value) . '"'; + + if (in_array((string)$value, $selected)) { + $_output .= ' checked="checked"'; + } + $_output .= $extra . ' />' . $output; + if ($labels) $_output .= '</label>'; + $_output .= $separator; + + return $_output; +} + +?> diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php new file mode 100644 index 0000000..9abae72 --- /dev/null +++ b/libs/plugins/function.html_image.php @@ -0,0 +1,142 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_image} function plugin + * + * Type: function<br> + * Name: html_image<br> + * Date: Feb 24, 2003<br> + * Purpose: format HTML tags for the image<br> + * Input:<br> + * - file = file (and path) of image (required) + * - height = image height (optional, default actual height) + * - width = image width (optional, default actual width) + * - basedir = base directory for absolute paths, default + * is environment variable DOCUMENT_ROOT + * - path_prefix = prefix for path output (optional, default empty) + * + * Examples: {html_image file="/images/masthead.gif"} + * Output: <img src="/https/git.postgresql.org/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 at ohrt dot com> + * @author credits to Duda <[email protected]> - wrote first image function + * in repository, helped with lots of functionality + * @version 1.0 + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_image($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $alt = ''; + $file = ''; + $height = ''; + $width = ''; + $extra = ''; + $prefix = ''; + $suffix = ''; + $path_prefix = ''; + $server_vars = ($smarty->request_use_auto_globals) ? $_SERVER : $GLOBALS['HTTP_SERVER_VARS']; + $basedir = isset($server_vars['DOCUMENT_ROOT']) ? $server_vars['DOCUMENT_ROOT'] : ''; + foreach($params as $_key => $_val) { + switch($_key) { + case 'file': + case 'height': + case 'width': + case 'dpi': + case 'path_prefix': + case 'basedir': + $$_key = $_val; + break; + + case 'alt': + if(!is_array($_val)) { + $$_key = smarty_function_escape_special_chars($_val); + } else { + $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + + case 'link': + case 'href': + $prefix = '<a href="' . $_val . '">'; + $suffix = '</a>'; + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (empty($file)) { + $smarty->trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE); + return; + } + + if (substr($file,0,1) == '/') { + $_image_path = $basedir . $file; + } else { + $_image_path = $file; + } + + if(!isset($params['width']) || !isset($params['height'])) { + if(!$_image_data = @getimagesize($_image_path)) { + if(!file_exists($_image_path)) { + $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE); + return; + } else if(!is_readable($_image_path)) { + $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE); + return; + } else { + $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE); + return; + } + } + if ($smarty->security && + ($_params = array('resource_type' => 'file', 'resource_name' => $_image_path)) && + (require_once(SMARTY_CORE_DIR . 'core.is_secure.php')) && + (!smarty_core_is_secure($_params, $smarty)) ) { + $smarty->trigger_error("html_image: (secure) '$_image_path' not in secure directory", E_USER_NOTICE); + } + + if(!isset($params['width'])) { + $width = $_image_data[0]; + } + if(!isset($params['height'])) { + $height = $_image_data[1]; + } + + } + + if(isset($params['dpi'])) { + if(strstr($server_vars['HTTP_USER_AGENT'], 'Mac')) { + $dpi_default = 72; + } else { + $dpi_default = 96; + } + $_resize = $dpi_default/$params['dpi']; + $width = round($width * $_resize); + $height = round($height * $_resize); + } + + return $prefix . '<img src="'.$path_prefix.$file.'" alt="'.$alt.'" width="'.$width.'" height="'.$height.'"'.$extra.' />' . $suffix; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.html_options.php b/libs/plugins/function.html_options.php new file mode 100644 index 0000000..cebadde --- /dev/null +++ b/libs/plugins/function.html_options.php @@ -0,0 +1,122 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_options} function plugin + * + * Type: function<br> + * Name: html_options<br> + * Input:<br> + * - name (optional) - string default "select" + * - values (required if no options supplied) - array + * - options (required if no values supplied) - associative array + * - selected (optional) - string default not set + * - output (required if not options supplied) - array + * Purpose: Prints the list of <option> tags generated from + * the passed parameters + * @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_options($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $name = null; + $values = null; + $options = null; + $selected = array(); + $output = null; + + $extra = ''; + + foreach($params as $_key => $_val) { + switch($_key) { + case 'name': + $$_key = (string)$_val; + break; + + case 'options': + $$_key = (array)$_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + + case 'selected': + $$_key = array_map('strval', array_values((array)$_val)); + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (!isset($options) && !isset($values)) + return ''; /* raise error here? */ + + $_html_result = ''; + + if (isset($options)) { + + foreach ($options as $_key=>$_val) + $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); + + } else { + + foreach ($values as $_i=>$_key) { + $_val = isset($output[$_i]) ? $output[$_i] : ''; + $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); + } + + } + + if(!empty($name)) { + $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n"; + } + + return $_html_result; + +} + +function smarty_function_html_options_optoutput($key, $value, $selected) { + if(!is_array($value)) { + $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' . + smarty_function_escape_special_chars($key) . '"'; + if (in_array((string)$key, $selected)) + $_html_result .= ' selected="selected"'; + $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n"; + } else { + $_html_result = smarty_function_html_options_optgroup($key, $value, $selected); + } + return $_html_result; +} + +function smarty_function_html_options_optgroup($key, $values, $selected) { + $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n"; + foreach ($values as $key => $value) { + $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected); + } + $optgroup_html .= "</optgroup>\n"; + return $optgroup_html; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.html_radios.php b/libs/plugins/function.html_radios.php new file mode 100644 index 0000000..7503cfa --- /dev/null +++ b/libs/plugins/function.html_radios.php @@ -0,0 +1,156 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_radios} function plugin + * + * File: function.html_radios.php<br> + * Type: function<br> + * Name: html_radios<br> + * Date: 24.Feb.2003<br> + * Purpose: Prints out a list of radio input types<br> + * Input:<br> + * - name (optional) - string default "radio" + * - values (required) - array + * - options (optional) - associative array + * - checked (optional) - array default not set + * - separator (optional) - ie <br> or + * - output (optional) - the output next to each radio button + * - assign (optional) - assign the output as an array to this variable + * Examples: + * <pre> + * {html_radios values=$ids output=$names} + * {html_radios values=$ids name='box' separator='<br>' output=$names} + * {html_radios values=$ids checked=$checked separator='<br>' output=$names} + * </pre> + * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} + * (Smarty online manual) + * @author Christopher Kvarme <[email protected]> + * @author credits to Monte Ohrt <monte at ohrt dot com> + * @version 1.0 + * @param array + * @param Smarty + * @return string + * @uses smarty_function_escape_special_chars() + */ +function smarty_function_html_radios($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','escape_special_chars'); + + $name = 'radio'; + $values = null; + $options = null; + $selected = null; + $separator = ''; + $labels = true; + $label_ids = false; + $output = null; + $extra = ''; + + foreach($params as $_key => $_val) { + switch($_key) { + case 'name': + case 'separator': + $$_key = (string)$_val; + break; + + case 'checked': + case 'selected': + if(is_array($_val)) { + $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING); + } else { + $selected = (string)$_val; + } + break; + + case 'labels': + case 'label_ids': + $$_key = (bool)$_val; + break; + + case 'options': + $$_key = (array)$_val; + break; + + case 'values': + case 'output': + $$_key = array_values((array)$_val); + break; + + case 'radios': + $smarty->trigger_error('html_radios: the use of the "radios" attribute is deprecated, use "options" instead', E_USER_WARNING); + $options = (array)$_val; + break; + + case 'assign': + break; + + default: + if(!is_array($_val)) { + $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; + } else { + $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE); + } + break; + } + } + + if (!isset($options) && !isset($values)) + return ''; /* raise error here? */ + + $_html_result = array(); + + if (isset($options)) { + + foreach ($options as $_key=>$_val) + $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids); + + } else { + + 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, $label_ids); + } + + } + + if(!empty($params['assign'])) { + $smarty->assign($params['assign'], $_html_result); + } else { + return implode("\n",$_html_result); + } + +} + +function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) { + $_output = ''; + 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 ($labels && $label_ids) $_output .= ' id="' . $_id . '"'; + + if ((string)$value==$selected) { + $_output .= ' checked="checked"'; + } + $_output .= $extra . ' />' . $output; + if ($labels) $_output .= '</label>'; + $_output .= $separator; + + return $_output; +} + +?> diff --git a/libs/plugins/function.html_select_date.php b/libs/plugins/function.html_select_date.php new file mode 100644 index 0000000..9270cd6 --- /dev/null +++ b/libs/plugins/function.html_select_date.php @@ -0,0 +1,323 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty {html_select_date} plugin + * + * Type: function<br> + * Name: html_select_date<br> + * Purpose: Prints the dropdowns for date selection. + * + * ChangeLog:<br> + * - 1.0 initial release + * - 1.1 added support for +/- N syntax for begin + * and end year values. (Monte) + * - 1.2 added support for yyyy-mm-dd syntax for + * time value. (Jan Rosier) + * - 1.3 added support for choosing format for + * month values (Gary Loescher) + * - 1.3.1 added support for choosing format for + * day values (Marcus Bointon) + * - 1.3.2 suppport negative timestamps, force year + * dropdown to include given date unless explicitly set (Monte) + * @link http://smarty.php.net/manual/en/language.function.html.select.date.php {html_select_date} + * (Smarty online manual) + * @version 1.3.2 + * @author Andrei Zmievski + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string + */ +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. */ + $prefix = "Date_"; + $start_year = strftime("%Y"); + $end_year = $start_year; + $display_days = true; + $display_months = true; + $display_years = true; + $month_format = "%B"; + /* Write months as numbers by default GL */ + $month_value_format = "%m"; + $day_format = "%02d"; + /* Write day values using this format MB */ + $day_value_format = "%d"; + $year_as_text = false; + /* Display years in reverse order? Ie. 2000,1999,.... */ + $reverse_years = false; + /* Should the select boxes be part of an array when returned from PHP? + e.g. setting it to "birthday", would create "birthday[Day]", + "birthday[Month]" & "birthday[Year]". Can be combined with prefix */ + $field_array = null; + /* <select size>'s of the different <select> tags. + If not set, uses default dropdown. */ + $day_size = null; + $month_size = null; + $year_size = null; + /* Unparsed attributes common to *ALL* the <select>/<input> tags. + An example might be in the template: all_extra ='class ="foo"'. */ + $all_extra = null; + /* Separate attributes for the tags. */ + $day_extra = null; + $month_extra = null; + $year_extra = null; + /* Order in which to display the fields. + "D" -> day, "M" -> month, "Y" -> year. */ + $field_order = 'MDY'; + /* String printed between the different fields. */ + $field_separator = "\n"; + $time = time(); + $all_empty = null; + $day_empty = null; + $month_empty = null; + $year_empty = null; + $extra_attrs = ''; + + foreach ($params as $_key=>$_value) { + switch ($_key) { + case 'prefix': + case 'time': + case 'start_year': + case 'end_year': + case 'month_format': + case 'day_format': + case 'day_value_format': + case 'field_array': + case 'day_size': + case 'month_size': + case 'year_size': + case 'all_extra': + case 'day_extra': + case 'month_extra': + case 'year_extra': + case 'field_order': + case 'field_separator': + case 'month_value_format': + case 'month_empty': + case 'day_empty': + case 'year_empty': + $$_key = (string)$_value; + break; + + case 'all_empty': + $$_key = (string)$_value; + $day_empty = $month_empty = $year_empty = $all_empty; + break; + + case 'display_days': + case 'display_months': + case 'display_years': + case 'year_as_text': + case 'reverse_years': + $$_key = (bool)$_value; + break; + + default: + 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(preg_match('!^-\d+$!',$time)) { + // negative timestamp, use date() + $time = date('Y-m-d',$time); + } + // If $time is not in format yyyy-mm-dd + if (!preg_match('/^\d{0,4}-\d{0,2}-\d{0,2}$/', $time)) { + // use smarty_make_timestamp to get an unix timestamp and + // strftime to make yyyy-mm-dd + $time = strftime('%Y-%m-%d', smarty_make_timestamp($time)); + } + // Now split this in pieces, which later can be used to set the select + $time = explode("-", $time); + + // 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 = strftime('%Y') + $match[2]; + } else { + $end_year = strftime('%Y') - $match[2]; + } + } + if (preg_match('!^(\+|\-)\s*(\d+)$!', $start_year, $match)) { + if ($match[1] == '+') { + $start_year = strftime('%Y') + $match[2]; + } else { + $start_year = strftime('%Y') - $match[2]; + } + } + if (strlen($time[0]) > 0) { + if ($start_year > $time[0] && !isset($params['start_year'])) { + // force start year to include given date if not explicitly set + $start_year = $time[0]; + } + if($end_year < $time[0] && !isset($params['end_year'])) { + // force end year to include given date if not explicitly set + $end_year = $time[0]; + } + } + + $field_order = strtoupper($field_order); + + $html_result = $month_result = $day_result = $year_result = ""; + + if ($display_months) { + $month_names = array(); + $month_values = array(); + if(isset($month_empty)) { + $month_names[''] = $month_empty; + $month_values[''] = ''; + } + for ($i = 1; $i <= 12; $i++) { + $month_names[$i] = strftime($month_format, mktime(0, 0, 0, $i, 1, 2000)); + $month_values[$i] = strftime($month_value_format, mktime(0, 0, 0, $i, 1, 2000)); + } + + $month_result .= '<select name='; + if (null !== $field_array){ + $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"'; + } else { + $month_result .= '"' . $prefix . 'Month"'; + } + if (null !== $month_size){ + $month_result .= ' size="' . $month_size . '"'; + } + if (null !== $month_extra){ + $month_result .= ' ' . $month_extra; + } + if (null !== $all_extra){ + $month_result .= ' ' . $all_extra; + } + $month_result .= $extra_attrs . '>'."\n"; + + $month_result .= smarty_function_html_options(array('output' => $month_names, + 'values' => $month_values, + '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 ($display_days) { + $days = array(); + if (isset($day_empty)) { + $days[''] = $day_empty; + $day_values[''] = ''; + } + for ($i = 1; $i <= 31; $i++) { + $days[] = sprintf($day_format, $i); + $day_values[] = sprintf($day_value_format, $i); + } + + $day_result .= '<select name='; + if (null !== $field_array){ + $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"'; + } else { + $day_result .= '"' . $prefix . 'Day"'; + } + if (null !== $day_size){ + $day_result .= ' size="' . $day_size . '"'; + } + if (null !== $all_extra){ + $day_result .= ' ' . $all_extra; + } + if (null !== $day_extra){ + $day_result .= ' ' . $day_extra; + } + $day_result .= $extra_attrs . '>'."\n"; + $day_result .= smarty_function_html_options(array('output' => $days, + 'values' => $day_values, + 'selected' => $time[2], + 'print_result' => false), + $smarty); + $day_result .= '</select>'; + } + + if ($display_years) { + if (null !== $field_array){ + $year_name = $field_array . '[' . $prefix . 'Year]'; + } else { + $year_name = $prefix . 'Year'; + } + if ($year_as_text) { + $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"'; + if (null !== $all_extra){ + $year_result .= ' ' . $all_extra; + } + if (null !== $year_extra){ + $year_result .= ' ' . $year_extra; + } + $year_result .= ' />'; + } else { + $years = range((int)$start_year, (int)$end_year); + if ($reverse_years) { + rsort($years, SORT_NUMERIC); + } else { + sort($years, SORT_NUMERIC); + } + $yearvals = $years; + if(isset($year_empty)) { + array_unshift($years, $year_empty); + array_unshift($yearvals, ''); + } + $year_result .= '<select name="' . $year_name . '"'; + if (null !== $year_size){ + $year_result .= ' size="' . $year_size . '"'; + } + if (null !== $all_extra){ + $year_result .= ' ' . $all_extra; + } + if (null !== $year_extra){ + $year_result .= ' ' . $year_extra; + } + $year_result .= $extra_attrs . '>'."\n"; + $year_result .= smarty_function_html_options(array('output' => $years, + 'values' => $yearvals, + 'selected' => $time[0], + 'print_result' => false), + $smarty); + $year_result .= '</select>'; + } + } + + // Loop thru the field_order field + for ($i = 0; $i <= 2; $i++){ + $c = substr($field_order, $i, 1); + switch ($c){ + case 'D': + $html_result .= $day_result; + break; + + case 'M': + $html_result .= $month_result; + break; + + case 'Y': + $html_result .= $year_result; + break; + } + // Add the field seperator + if($i != 2) { + $html_result .= $field_separator; + } + } + + return $html_result; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php new file mode 100644 index 0000000..2e5be7e --- /dev/null +++ b/libs/plugins/function.html_select_time.php @@ -0,0 +1,194 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_select_time} function plugin + * + * Type: function<br> + * Name: html_select_time<br> + * Purpose: Prints the dropdowns for time selection + * @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time} + * (Smarty online manual) + * @author Roberto Berto <[email protected]> + * @credits Monte Ohrt <monte AT ohrt DOT com> + * @param array + * @param Smarty + * @return string + * @uses smarty_make_timestamp() + */ +function smarty_function_html_select_time($params, &$smarty) +{ + require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); + require_once $smarty->_get_plugin_filepath('function','html_options'); + /* Default values. */ + $prefix = "Time_"; + $time = time(); + $display_hours = true; + $display_minutes = true; + $display_seconds = true; + $display_meridian = true; + $use_24_hours = true; + $minute_interval = 1; + $second_interval = 1; + /* Should the select boxes be part of an array when returned from PHP? + e.g. setting it to "birthday", would create "birthday[Hour]", + "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". + Can be combined with prefix. */ + $field_array = null; + $all_extra = null; + $hour_extra = null; + $minute_extra = null; + $second_extra = null; + $meridian_extra = null; + + foreach ($params as $_key=>$_value) { + switch ($_key) { + case 'prefix': + case 'time': + case 'field_array': + case 'all_extra': + case 'hour_extra': + case 'minute_extra': + case 'second_extra': + case 'meridian_extra': + $$_key = (string)$_value; + break; + + case 'display_hours': + case 'display_minutes': + case 'display_seconds': + case 'display_meridian': + case 'use_24_hours': + $$_key = (bool)$_value; + break; + + case 'minute_interval': + case 'second_interval': + $$_key = (int)$_value; + break; + + default: + $smarty->trigger_error("[html_select_time] unknown parameter $_key", E_USER_WARNING); + } + } + + $time = smarty_make_timestamp($time); + + $html_result = ''; + + if ($display_hours) { + $hours = $use_24_hours ? range(0, 23) : range(1, 12); + $hour_fmt = $use_24_hours ? '%H' : '%I'; + for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) + $hours[$i] = sprintf('%02d', $hours[$i]); + $html_result .= '<select name='; + if (null !== $field_array) { + $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"'; + } else { + $html_result .= '"' . $prefix . 'Hour"'; + } + if (null !== $hour_extra){ + $html_result .= ' ' . $hour_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + $html_result .= smarty_function_html_options(array('output' => $hours, + 'values' => $hours, + 'selected' => strftime($hour_fmt, $time), + 'print_result' => false), + $smarty); + $html_result .= "</select>\n"; + } + + if ($display_minutes) { + $all_minutes = range(0, 59); + for ($i = 0, $for_max = count($all_minutes); $i < $for_max; $i+= $minute_interval) + $minutes[] = sprintf('%02d', $all_minutes[$i]); + $selected = intval(floor(strftime('%M', $time) / $minute_interval) * $minute_interval); + $html_result .= '<select name='; + if (null !== $field_array) { + $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"'; + } else { + $html_result .= '"' . $prefix . 'Minute"'; + } + if (null !== $minute_extra){ + $html_result .= ' ' . $minute_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + + $html_result .= smarty_function_html_options(array('output' => $minutes, + 'values' => $minutes, + 'selected' => $selected, + 'print_result' => false), + $smarty); + $html_result .= "</select>\n"; + } + + if ($display_seconds) { + $all_seconds = range(0, 59); + for ($i = 0, $for_max = count($all_seconds); $i < $for_max; $i+= $second_interval) + $seconds[] = sprintf('%02d', $all_seconds[$i]); + $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); + $html_result .= '<select name='; + if (null !== $field_array) { + $html_result .= '"' . $field_array . '[' . $prefix . 'Second]"'; + } else { + $html_result .= '"' . $prefix . 'Second"'; + } + + if (null !== $second_extra){ + $html_result .= ' ' . $second_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + + $html_result .= smarty_function_html_options(array('output' => $seconds, + 'values' => $seconds, + 'selected' => $selected, + 'print_result' => false), + $smarty); + $html_result .= "</select>\n"; + } + + if ($display_meridian && !$use_24_hours) { + $html_result .= '<select name='; + if (null !== $field_array) { + $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"'; + } else { + $html_result .= '"' . $prefix . 'Meridian"'; + } + + if (null !== $meridian_extra){ + $html_result .= ' ' . $meridian_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + + $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'), + 'values' => array('am', 'pm'), + 'selected' => strtolower(strftime('%p', $time)), + 'print_result' => false), + $smarty); + $html_result .= "</select>\n"; + } + + return $html_result; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.html_table.php b/libs/plugins/function.html_table.php new file mode 100644 index 0000000..62d7410 --- /dev/null +++ b/libs/plugins/function.html_table.php @@ -0,0 +1,137 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {html_table} function plugin + * + * Type: function<br> + * Name: html_table<br> + * Date: Feb 17, 2003<br> + * Purpose: make an html table from an array of data<br> + * Input:<br> + * - loop = array to loop through + * - cols = number of columns + * - rows = number of rows + * - table_attr = table attributes + * - tr_attr = table row attributes (arrays are cycled) + * - td_attr = table cell attributes (arrays are cycled) + * - trailpad = value to pad trailing cells with + * - vdir = vertical direction (default: "down", means top-to-bottom) + * - hdir = horizontal direction (default: "right", means left-to-right) + * - inner = inner loop (default "cols": print $loop line by line, + * $loop will be printed column by column otherwise) + * + * + * Examples: + * <pre> + * {table loop=$data} + * {table loop=$data cols=4 tr_attr='"bgcolor=red"'} + * {table loop=$data cols=4 tr_attr=$colors} + * </pre> + * @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) + * @param array + * @param Smarty + * @return string + */ +function smarty_function_html_table($params, &$smarty) +{ + $table_attr = 'border="1"'; + $tr_attr = ''; + $td_attr = ''; + $cols = 3; + $rows = 3; + $trailpad = ' '; + $vdir = 'down'; + $hdir = 'right'; + $inner = 'cols'; + + if (!isset($params['loop'])) { + $smarty->trigger_error("html_table: missing 'loop' parameter"); + return; + } + + foreach ($params as $_key=>$_value) { + switch ($_key) { + case 'loop': + $$_key = (array)$_value; + break; + + case 'cols': + case 'rows': + $$_key = (int)$_value; + break; + + case 'table_attr': + case 'trailpad': + case 'hdir': + case 'vdir': + case 'inner': + $$_key = (string)$_value; + break; + + case 'tr_attr': + case 'td_attr': + $$_key = $_value; + break; + } + } + + $loop_count = count($loop); + if (empty($params['rows'])) { + /* no rows specified */ + $rows = ceil($loop_count/$cols); + } elseif (empty($params['cols'])) { + if (!empty($params['rows'])) { + /* no cols specified, but rows */ + $cols = ceil($loop_count/$rows); + } + } + + $output = "<table $table_attr>\n"; + + for ($r=0; $r<$rows; $r++) { + $output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n"; + $rx = ($vdir == 'down') ? $r*$cols : ($rows-1-$r)*$cols; + + for ($c=0; $c<$cols; $c++) { + $x = ($hdir == 'right') ? $rx+$c : $rx+$cols-1-$c; + if ($inner!='cols') { + /* shuffle x to loop over rows*/ + $x = floor($x/$cols) + ($x%$cols)*$rows; + } + + if ($x<$loop_count) { + $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">" . $loop[$x] . "</td>\n"; + } else { + $output .= "<td" . smarty_function_html_table_cycle('td', $td_attr, $c) . ">$trailpad</td>\n"; + } + } + $output .= "</tr>\n"; + } + $output .= "</table>\n"; + + return $output; +} + +function smarty_function_html_table_cycle($name, $var, $no) { + if(!is_array($var)) { + $ret = $var; + } else { + $ret = $var[$no % count($var)]; + } + + return ($ret) ? ' '.$ret : ''; +} + + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.mailto.php b/libs/plugins/function.mailto.php new file mode 100644 index 0000000..64c122c --- /dev/null +++ b/libs/plugins/function.mailto.php @@ -0,0 +1,163 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {mailto} function plugin + * + * Type: function<br> + * Name: mailto<br> + * Date: May 21, 2002 + * Purpose: automate mailto address link creation, and optionally + * encode them.<br> + * Input:<br> + * - address = e-mail address + * - text = (optional) text to display, default is address + * - 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 + * - subject = (optional) e-mail subject + * - newsgroups = (optional) newsgroup(s) to post to + * - followupto = (optional) address(es) to follow up to + * - extra = (optional) extra tags for the href link + * + * Examples: + * <pre> + * {mailto address="[email protected]"} + * {mailto address="[email protected]" encode="javascript"} + * {mailto address="[email protected]" encode="hex"} + * {mailto address="[email protected]" subject="Hello to you!"} + * {mailto address="[email protected]" extra='class="mailto"'} + * </pre> + * @link http://smarty.php.net/manual/en/language.function.mailto.php {mailto} + * (Smarty online manual) + * @version 1.2 + * @author Monte Ohrt <monte at ohrt dot com> + * @author credits to Jason Sweat (added cc, bcc and subject functionality) + * @param array + * @param Smarty + * @return string + */ +function smarty_function_mailto($params, &$smarty) +{ + $extra = ''; + + if (empty($params['address'])) { + $smarty->trigger_error("mailto: missing 'address' parameter"); + return; + } else { + $address = $params['address']; + } + + $text = $address; + + // netscape and mozilla do not decode %40 (@) in BCC field (bug?) + // so, don't encode it. + $mail_parms = array(); + foreach ($params as $var=>$value) { + switch ($var) { + case 'cc': + case 'bcc': + case 'followupto': + if (!empty($value)) + $mail_parms[] = $var.'='.str_replace('%40','@',rawurlencode($value)); + break; + + case 'subject': + case 'newsgroups': + $mail_parms[] = $var.'='.rawurlencode($value); + break; + + case 'extra': + case 'text': + $$var = $value; + + default: + } + } + + $mail_parm_vals = ''; + for ($i=0; $i<count($mail_parms); $i++) { + $mail_parm_vals .= (0==$i) ? '?' : '&'; + $mail_parm_vals .= $mail_parms[$i]; + } + $address .= $mail_parm_vals; + + $encode = (empty($params['encode'])) ? 'none' : $params['encode']; + if (!in_array($encode,array('javascript','javascript_charcode','hex','none')) ) { + $smarty->trigger_error("mailto: 'encode' parameter must be none, javascript or hex"); + return; + } + + if ($encode == 'javascript' ) { + $string = 'document.write(\'<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>\');'; + + $js_encode = ''; + for ($x=0; $x < strlen($string); $x++) { + $js_encode .= '%' . bin2hex($string[$x]); + } + + 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); + if(!empty($match[2])) { + $smarty->trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript."); + return; + } + $address_encode = ''; + for ($x=0; $x < strlen($address); $x++) { + if(preg_match('!\w!',$address[$x])) { + $address_encode .= '%' . bin2hex($address[$x]); + } else { + $address_encode .= $address[$x]; + } + } + $text_encode = ''; + for ($x=0; $x < strlen($text); $x++) { + $text_encode .= '&#x' . bin2hex($text[$x]).';'; + } + + $mailto = "mailto:"; + return '<a href="'.$mailto.$address_encode.'" '.$extra.'>'.$text_encode.'</a>'; + + } else { + // no encoding + return '<a href="mailto:'.$address.'" '.$extra.'>'.$text.'</a>'; + + } + +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php new file mode 100644 index 0000000..71672fe --- /dev/null +++ b/libs/plugins/function.math.php @@ -0,0 +1,84 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {math} function plugin + * + * Type: function<br> + * Name: math<br> + * Purpose: handle math computations in template<br> + * @link http://smarty.php.net/manual/en/language.function.math.php {math} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string + */ +function smarty_function_math($params, &$smarty) +{ + // be sure equation parameter is present + if (empty($params['equation'])) { + $smarty->trigger_error("math: missing equation parameter"); + return; + } + + $equation = $params['equation']; + + // make sure parenthesis are balanced + if (substr_count($equation,"(") != substr_count($equation,")")) { + $smarty->trigger_error("math: unbalanced parenthesis"); + return; + } + + // match all vars in equation, make sure all are passed + 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[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; + } + } + + foreach($params as $key => $val) { + if ($key != "equation" && $key != "format" && $key != "assign") { + // make sure value is not empty + if (strlen($val)==0) { + $smarty->trigger_error("math: parameter $key is empty"); + return; + } + if (!is_numeric($val)) { + $smarty->trigger_error("math: parameter $key: is not numeric"); + return; + } + $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); + } + } + + eval("\$smarty_math_result = ".$equation.";"); + + if (empty($params['format'])) { + if (empty($params['assign'])) { + return $smarty_math_result; + } else { + $smarty->assign($params['assign'],$smarty_math_result); + } + } else { + if (empty($params['assign'])){ + printf($params['format'],$smarty_math_result); + } else { + $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result)); + } + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.popup.php b/libs/plugins/function.popup.php new file mode 100644 index 0000000..3a76b78 --- /dev/null +++ b/libs/plugins/function.popup.php @@ -0,0 +1,119 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {popup} function plugin + * + * Type: function<br> + * Name: popup<br> + * Purpose: make text pop up in windows via overlib + * @link http://smarty.php.net/manual/en/language.function.popup.php {popup} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string + */ +function smarty_function_popup($params, &$smarty) +{ + $append = ''; + foreach ($params as $_key=>$_value) { + 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 'closetext': + case 'status': + $append .= ',' . strtoupper($_key) . ",'" . str_replace("'","\'",$_value) . "'"; + break; + + case 'fgcolor': + case 'bgcolor': + case 'textcolor': + case 'capcolor': + case 'closecolor': + case 'textfont': + case 'captionfont': + case 'closefont': + case 'fgbackground': + case 'bgbackground': + case 'caparray': + case 'capicon': + case 'background': + case 'frame': + $append .= ',' . strtoupper($_key) . ",'$_value'"; + break; + + case 'textsize': + case 'captionsize': + case 'closesize': + case 'width': + case 'height': + case 'border': + case 'offsetx': + case 'offsety': + case 'snapx': + case 'snapy': + case 'fixx': + case 'fixy': + case 'padx': + case 'pady': + case 'timeout': + case 'delay': + $append .= ',' . strtoupper($_key) . ",$_value"; + break; + + case 'sticky': + case 'left': + case 'right': + case 'center': + case 'above': + case 'below': + case 'noclose': + case 'autostatus': + case 'autostatuscap': + case 'fullhtml': + case 'hauto': + case 'vauto': + case 'mouseoff': + case 'followmouse': + case 'closeclick': + if ($_value) $append .= ',' . strtoupper($_key); + break; + + default: + $smarty->trigger_error("[popup] unknown parameter $_key", E_USER_WARNING); + } + } + + if (empty($text) && !isset($inarray) && empty($function)) { + $smarty->trigger_error("overlib: attribute 'text' or 'inarray' or 'function' required"); + return false; + } + + if (empty($trigger)) { $trigger = "onmouseover"; } + + $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; + $retval .= $append . ');"'; + if ($trigger == 'onmouseover') + $retval .= ' onmouseout="nd();"'; + + + return $retval; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/function.popup_init.php b/libs/plugins/function.popup_init.php new file mode 100644 index 0000000..93cb454 --- /dev/null +++ b/libs/plugins/function.popup_init.php @@ -0,0 +1,40 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty {popup_init} function plugin + * + * Type: function<br> + * Name: popup_init<br> + * Purpose: initialize overlib + * @link http://smarty.php.net/manual/en/language.function.popup.init.php {popup_init} + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array + * @param Smarty + * @return string + */ +function smarty_function_popup_init($params, &$smarty) +{ + $zindex = 1000; + + if (!empty($params['zindex'])) { + $zindex = $params['zindex']; + } + + if (!empty($params['src'])) { + return '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:'.$zindex.';"></div>' . "\n" + . '<script type="text/javascript" language="JavaScript" src="'.$params['src'].'"></script>' . "\n"; + } else { + $smarty->trigger_error("popup_init: missing src parameter"); + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.capitalize.php b/libs/plugins/modifier.capitalize.php new file mode 100644 index 0000000..bca951a --- /dev/null +++ b/libs/plugins/modifier.capitalize.php @@ -0,0 +1,43 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty capitalize modifier plugin + * + * Type: modifier<br> + * Name: capitalize<br> + * Purpose: capitalize words in the string + * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE + * capitalize (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_modifier_capitalize($string, $uc_digits = false) +{ + smarty_modifier_capitalize_ucfirst(null, $uc_digits); + return preg_replace_callback('!\b\w+\b!', 'smarty_modifier_capitalize_ucfirst', $string); +} + +function smarty_modifier_capitalize_ucfirst($string, $uc_digits = null) +{ + static $_uc_digits = false; + + if(isset($uc_digits)) { + $_uc_digits = $uc_digits; + return; + } + + if(!preg_match('!\d!',$string[0]) || $_uc_digits) + return ucfirst($string[0]); + else + return $string[0]; +} + + +?> diff --git a/libs/plugins/modifier.cat.php b/libs/plugins/modifier.cat.php new file mode 100644 index 0000000..2e37940 --- /dev/null +++ b/libs/plugins/modifier.cat.php @@ -0,0 +1,33 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty cat modifier plugin + * + * Type: modifier<br> + * Name: cat<br> + * Date: Feb 24, 2003 + * Purpose: catenate a value to a variable + * Input: string to catenate + * Example: {$var|cat:"foo"} + * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat + * (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @version 1.0 + * @param string + * @param string + * @return string + */ +function smarty_modifier_cat($string, $cat) +{ + return $string . $cat; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.count_characters.php b/libs/plugins/modifier.count_characters.php new file mode 100644 index 0000000..5ed9a87 --- /dev/null +++ b/libs/plugins/modifier.count_characters.php @@ -0,0 +1,32 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty count_characters modifier plugin + * + * Type: modifier<br> + * Name: count_characteres<br> + * Purpose: count the number of characters in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.characters.php + * count_characters (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param boolean include whitespace in the character count + * @return integer + */ +function smarty_modifier_count_characters($string, $include_spaces = false) +{ + if ($include_spaces) + return(strlen($string)); + + return preg_match_all("/[^\s]/",$string, $match); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.count_paragraphs.php b/libs/plugins/modifier.count_paragraphs.php new file mode 100644 index 0000000..e0e274d --- /dev/null +++ b/libs/plugins/modifier.count_paragraphs.php @@ -0,0 +1,29 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty count_paragraphs modifier plugin + * + * Type: modifier<br> + * Name: count_paragraphs<br> + * Purpose: count the number of paragraphs in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php + * count_paragraphs (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return integer + */ +function smarty_modifier_count_paragraphs($string) +{ + // count \r or \n characters + return count(preg_split('/[\r\n]+/', $string)); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.count_sentences.php b/libs/plugins/modifier.count_sentences.php new file mode 100644 index 0000000..f66ea17 --- /dev/null +++ b/libs/plugins/modifier.count_sentences.php @@ -0,0 +1,29 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty count_sentences modifier plugin + * + * Type: modifier<br> + * Name: count_sentences + * Purpose: count the number of sentences in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.paragraphs.php + * count_sentences (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return integer + */ +function smarty_modifier_count_sentences($string) +{ + // find periods with a word before but not after. + return preg_match_all('/[^\s]\.(?!\w)/', $string, $match); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.count_words.php b/libs/plugins/modifier.count_words.php new file mode 100644 index 0000000..9d339f5 --- /dev/null +++ b/libs/plugins/modifier.count_words.php @@ -0,0 +1,33 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty count_words modifier plugin + * + * Type: modifier<br> + * Name: count_words<br> + * Purpose: count the number of words in a text + * @link http://smarty.php.net/manual/en/language.modifier.count.words.php + * count_words (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return integer + */ +function smarty_modifier_count_words($string) +{ + // split text by ' ',\r,\n,\f,\t + $split_array = preg_split('/\s+/',$string); + // count matches that contain alphanumerics + $word_count = preg_grep('/[a-zA-Z0-9\\x80-\\xff]/', $split_array); + + return count($word_count); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.date_format.php b/libs/plugins/modifier.date_format.php new file mode 100644 index 0000000..523c144 --- /dev/null +++ b/libs/plugins/modifier.date_format.php @@ -0,0 +1,49 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Include the {@link shared.make_timestamp.php} plugin + */ +require_once $smarty->_get_plugin_filepath('shared','make_timestamp'); +/** + * Smarty date_format modifier plugin + * + * Type: modifier<br> + * Name: date_format<br> + * Purpose: format datestamps via strftime<br> + * Input:<br> + * - string: input date string + * - format: strftime format for output + * - default_date: default date if $string is empty + * @link http://smarty.php.net/manual/en/language.modifier.date.format.php + * date_format (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string + * @param string + * @return string|void + * @uses smarty_make_timestamp() + */ +function smarty_modifier_date_format($string, $format="%b %e, %Y", $default_date=null) +{ + if (substr(PHP_OS,0,3) == 'WIN') { + $_win_from = array ('%e', '%T', '%D'); + $_win_to = array ('%#d', '%H:%M:%S', '%m/%d/%y'); + $format = str_replace($_win_from, $_win_to, $format); + } + if($string != '') { + return strftime($format, smarty_make_timestamp($string)); + } elseif (isset($default_date) && $default_date != '') { + return strftime($format, smarty_make_timestamp($default_date)); + } else { + return; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.debug_print_var.php b/libs/plugins/modifier.debug_print_var.php new file mode 100644 index 0000000..d28956a --- /dev/null +++ b/libs/plugins/modifier.debug_print_var.php @@ -0,0 +1,57 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty debug_print_var modifier plugin + * + * Type: modifier<br> + * Name: debug_print_var<br> + * Purpose: formats variable contents for display in the console + * @link http://smarty.php.net/manual/en/language.modifier.debug.print.var.php + * debug_print_var (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param array|object + * @param integer + * @param integer + * @return string + */ +function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40) +{ + $_replace = array("\n"=>'<i>\n</i>', "\r"=>'<i>\r</i>', "\t"=>'<i>\t</i>'); + if (is_array($var)) { + $results = "<b>Array (".count($var).")</b>"; + foreach ($var as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); + $results .= "<br>".str_repeat(' ', $depth*2)."<b>".strtr($curr_key, $_replace)."</b> => $return"; + } + } else if (is_object($var)) { + $object_vars = get_object_vars($var); + $results = "<b>".get_class($var)." Object (".count($object_vars).")</b>"; + foreach ($object_vars as $curr_key => $curr_val) { + $return = smarty_modifier_debug_print_var($curr_val, $depth+1, $length); + $results .= "<br>".str_repeat(' ', $depth*2)."<b>$curr_key</b> => $return"; + } + } else if (is_resource($var)) { + $results = '<i>'.(string)$var.'</i>'; + } else if (empty($var) && $var != "0") { + $results = '<i>empty</i>'; + } else { + if (strlen($var) > $length ) { + $results = substr($var, 0, $length-3).'...'; + } else { + $results = $var; + } + $results = htmlspecialchars($results); + $results = strtr($results, $_replace); + } + return $results; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.default.php b/libs/plugins/modifier.default.php new file mode 100644 index 0000000..70011fd --- /dev/null +++ b/libs/plugins/modifier.default.php @@ -0,0 +1,32 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty default modifier plugin + * + * Type: modifier<br> + * Name: default<br> + * Purpose: designate default value for empty variables + * @link http://smarty.php.net/manual/en/language.modifier.default.php + * default (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string + * @return string + */ +function smarty_modifier_default($string, $default = '') +{ + if (!isset($string) || $string === '') + return $default; + else + return $string; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.escape.php b/libs/plugins/modifier.escape.php new file mode 100644 index 0000000..a2f52b2 --- /dev/null +++ b/libs/plugins/modifier.escape.php @@ -0,0 +1,93 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty escape modifier plugin + * + * Type: modifier<br> + * Name: escape<br> + * Purpose: Escape the string according to escapement type + * @link http://smarty.php.net/manual/en/language.modifier.escape.php + * escape (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param html|htmlall|url|quotes|hex|hexentity|javascript + * @return string + */ +function smarty_modifier_escape($string, $esc_type = 'html', $char_set = 'ISO-8859-1') +{ + switch ($esc_type) { + case 'html': + return htmlspecialchars($string, ENT_QUOTES, $char_set); + + case 'htmlall': + return htmlentities($string, ENT_QUOTES, $char_set); + + case 'url': + return rawurlencode($string); + + case 'urlpathinfo': + return str_replace('%2F','/',rawurlencode($string)); + + case 'quotes': + // escape unescaped single quotes + return preg_replace("%(?<!\\\\)'%", "\\'", $string); + + case 'hex': + // escape every character into hex + $return = ''; + for ($x=0; $x < strlen($string); $x++) { + $return .= '%' . bin2hex($string[$x]); + } + return $return; + + case 'hexentity': + $return = ''; + for ($x=0; $x < strlen($string); $x++) { + $return .= '&#x' . bin2hex($string[$x]) . ';'; + } + return $return; + + case 'decentity': + $return = ''; + for ($x=0; $x < strlen($string); $x++) { + $return .= '&#' . ord($string[$x]) . ';'; + } + return $return; + + case 'javascript': + // escape quotes and backslashes, newlines, etc. + return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/')); + + case 'mail': + // safe way to display e-mail address on a web page + return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string); + + case 'nonstd': + // escape non-standard chars, such as ms document quotes + $_res = ''; + for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) { + $_ord = ord(substr($string, $_i, 1)); + // non-standard char, escape it + if($_ord >= 126){ + $_res .= '&#' . $_ord . ';'; + } + else { + $_res .= substr($string, $_i, 1); + } + } + return $_res; + + default: + return $string; + } +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.indent.php b/libs/plugins/modifier.indent.php new file mode 100644 index 0000000..394147a --- /dev/null +++ b/libs/plugins/modifier.indent.php @@ -0,0 +1,28 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty indent modifier plugin + * + * Type: modifier<br> + * Name: indent<br> + * Purpose: indent lines of text + * @link http://smarty.php.net/manual/en/language.modifier.indent.php + * indent (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param integer + * @param string + * @return string + */ +function smarty_modifier_indent($string,$chars=4,$char=" ") +{ + return preg_replace('!^!m',str_repeat($char,$chars),$string); +} + +?> diff --git a/libs/plugins/modifier.lower.php b/libs/plugins/modifier.lower.php new file mode 100644 index 0000000..20e7a8d --- /dev/null +++ b/libs/plugins/modifier.lower.php @@ -0,0 +1,26 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty lower modifier plugin + * + * Type: modifier<br> + * Name: lower<br> + * Purpose: convert string to lowercase + * @link http://smarty.php.net/manual/en/language.modifier.lower.php + * lower (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_modifier_lower($string) +{ + return strtolower($string); +} + +?> diff --git a/libs/plugins/modifier.nl2br.php b/libs/plugins/modifier.nl2br.php new file mode 100644 index 0000000..d6fabff --- /dev/null +++ b/libs/plugins/modifier.nl2br.php @@ -0,0 +1,35 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty plugin + * + * Type: modifier<br> + * Name: nl2br<br> + * Date: Feb 26, 2003 + * Purpose: convert \r\n, \r or \n to <<br>> + * Input:<br> + * - contents = contents to replace + * - preceed_test = if true, includes preceeding break tags + * in replacement + * Example: {$text|nl2br} + * @link http://smarty.php.net/manual/en/language.modifier.nl2br.php + * nl2br (Smarty online manual) + * @version 1.0 + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_modifier_nl2br($string) +{ + return nl2br($string); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.regex_replace.php b/libs/plugins/modifier.regex_replace.php new file mode 100644 index 0000000..d4d2030 --- /dev/null +++ b/libs/plugins/modifier.regex_replace.php @@ -0,0 +1,35 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty regex_replace modifier plugin + * + * Type: modifier<br> + * Name: regex_replace<br> + * Purpose: regular expression search/replace + * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php + * regex_replace (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string|array + * @param string|array + * @return string + */ +function smarty_modifier_regex_replace($string, $search, $replace) +{ + if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) { + /* remove eval-modifier from $search */ + $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]); + } + + return preg_replace($search, $replace, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.replace.php b/libs/plugins/modifier.replace.php new file mode 100644 index 0000000..df041c8 --- /dev/null +++ b/libs/plugins/modifier.replace.php @@ -0,0 +1,30 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty replace modifier plugin + * + * Type: modifier<br> + * Name: replace<br> + * Purpose: simple search/replace + * @link http://smarty.php.net/manual/en/language.modifier.replace.php + * replace (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string + * @param string + * @return string + */ +function smarty_modifier_replace($string, $search, $replace) +{ + return str_replace($search, $replace, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.spacify.php b/libs/plugins/modifier.spacify.php new file mode 100644 index 0000000..c2423f4 --- /dev/null +++ b/libs/plugins/modifier.spacify.php @@ -0,0 +1,30 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty spacify modifier plugin + * + * Type: modifier<br> + * Name: spacify<br> + * Purpose: add spaces between characters in a string + * @link http://smarty.php.net/manual/en/language.modifier.spacify.php + * spacify (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string + * @return string + */ +function smarty_modifier_spacify($string, $spacify_char = ' ') +{ + return implode($spacify_char, + preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY)); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.string_format.php b/libs/plugins/modifier.string_format.php new file mode 100644 index 0000000..9e051a5 --- /dev/null +++ b/libs/plugins/modifier.string_format.php @@ -0,0 +1,29 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty string_format modifier plugin + * + * Type: modifier<br> + * Name: string_format<br> + * Purpose: format strings via sprintf + * @link http://smarty.php.net/manual/en/language.modifier.string.format.php + * string_format (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param string + * @return string + */ +function smarty_modifier_string_format($string, $format) +{ + return sprintf($format, $string); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.strip.php b/libs/plugins/modifier.strip.php new file mode 100644 index 0000000..cc5c453 --- /dev/null +++ b/libs/plugins/modifier.strip.php @@ -0,0 +1,33 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty strip modifier plugin + * + * Type: modifier<br> + * Name: strip<br> + * Purpose: Replace all repeated spaces, newlines, tabs + * with a single space or supplied replacement string.<br> + * Example: {$var|strip} {$var|strip:" "} + * Date: September 25th, 2002 + * @link http://smarty.php.net/manual/en/language.modifier.strip.php + * strip (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @version 1.0 + * @param string + * @param string + * @return string + */ +function smarty_modifier_strip($text, $replace = ' ') +{ + return preg_replace('!\s+!', $replace, $text); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.strip_tags.php b/libs/plugins/modifier.strip_tags.php new file mode 100644 index 0000000..93011a8 --- /dev/null +++ b/libs/plugins/modifier.strip_tags.php @@ -0,0 +1,32 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty strip_tags modifier plugin + * + * Type: modifier<br> + * Name: strip_tags<br> + * Purpose: strip html tags from text + * @link http://smarty.php.net/manual/en/language.modifier.strip.tags.php + * strip_tags (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param boolean + * @return string + */ +function smarty_modifier_strip_tags($string, $replace_with_space = true) +{ + if ($replace_with_space) + return preg_replace('!<[^>]*?>!', ' ', $string); + else + return strip_tags($string); +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/modifier.truncate.php b/libs/plugins/modifier.truncate.php new file mode 100644 index 0000000..d96de5f --- /dev/null +++ b/libs/plugins/modifier.truncate.php @@ -0,0 +1,50 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty truncate modifier plugin + * + * Type: modifier<br> + * 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 or inserting $etc into the middle. + * @link http://smarty.php.net/manual/en/language.modifier.truncate.php + * truncate (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param integer + * @param string + * @param boolean + * @param boolean + * @return string + */ +function smarty_modifier_truncate($string, $length = 80, $etc = '...', + $break_words = false, $middle = false) +{ + if ($length == 0) + return ''; + + if (strlen($string) > $length) { + $length -= strlen($etc); + if (!$break_words && !$middle) { + $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1)); + } + 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: */ + +?> diff --git a/libs/plugins/modifier.upper.php b/libs/plugins/modifier.upper.php new file mode 100644 index 0000000..c12480f --- /dev/null +++ b/libs/plugins/modifier.upper.php @@ -0,0 +1,26 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty upper modifier plugin + * + * Type: modifier<br> + * Name: upper<br> + * Purpose: convert string to uppercase + * @link http://smarty.php.net/manual/en/language.modifier.upper.php + * upper (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_modifier_upper($string) +{ + return strtoupper($string); +} + +?> diff --git a/libs/plugins/modifier.wordwrap.php b/libs/plugins/modifier.wordwrap.php new file mode 100644 index 0000000..ce07181 --- /dev/null +++ b/libs/plugins/modifier.wordwrap.php @@ -0,0 +1,29 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Smarty wordwrap modifier plugin + * + * Type: modifier<br> + * Name: wordwrap<br> + * Purpose: wrap a string of text at a given length + * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php + * wordwrap (Smarty online manual) + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @param integer + * @param string + * @param boolean + * @return string + */ +function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false) +{ + return wordwrap($string,$length,$break,$cut); +} + +?> diff --git a/libs/plugins/outputfilter.trimwhitespace.php b/libs/plugins/outputfilter.trimwhitespace.php new file mode 100644 index 0000000..01e35e0 --- /dev/null +++ b/libs/plugins/outputfilter.trimwhitespace.php @@ -0,0 +1,75 @@ +<?php +/** + * Smarty plugin + * @package Smarty + * @subpackage plugins + */ + +/** + * Smarty trimwhitespace outputfilter plugin + * + * File: outputfilter.trimwhitespace.php<br> + * Type: outputfilter<br> + * Name: trimwhitespace<br> + * Date: Jan 25, 2003<br> + * Purpose: trim leading white space and blank lines from + * template source after it gets interpreted, cleaning + * up code and saving bandwidth. Does not affect + * <<PRE>></PRE> and <SCRIPT></SCRIPT> blocks.<br> + * Install: Drop into the plugin directory, call + * <code>$smarty->load_filter('output','trimwhitespace');</code> + * from application. + * @author Monte Ohrt <monte at ohrt dot com> + * @author Contributions from Lars Noschinski <[email protected]> + * @version 1.3 + * @param string + * @param Smarty + */ +function smarty_outputfilter_trimwhitespace($source, &$smarty) +{ + // Pull out the script blocks + preg_match_all("!<script[^>]+>.*?</script>!is", $source, $match); + $_script_blocks = $match[0]; + $source = preg_replace("!<script[^>]+>.*?</script>!is", + '@@@SMARTY:TRIM:SCRIPT@@@', $source); + + // Pull out the pre blocks + preg_match_all("!<pre>.*?</pre>!is", $source, $match); + $_pre_blocks = $match[0]; + $source = preg_replace("!<pre>.*?</pre>!is", + '@@@SMARTY:TRIM:PRE@@@', $source); + + // Pull out the textarea blocks + preg_match_all("!<textarea[^>]+>.*?</textarea>!is", $source, $match); + $_textarea_blocks = $match[0]; + $source = preg_replace("!<textarea[^>]+>.*?</textarea>!is", + '@@@SMARTY:TRIM:TEXTAREA@@@', $source); + + // remove all leading spaces, tabs and carriage returns NOT + // preceeded by a php close tag. + $source = trim(preg_replace('/((?<!\?>)\n)[\s]+/m', '\1', $source)); + + // replace script blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:SCRIPT@@@",$_script_blocks, $source); + + // replace pre blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:PRE@@@",$_pre_blocks, $source); + + // replace textarea blocks + smarty_outputfilter_trimwhitespace_replace("@@@SMARTY:TRIM:TEXTAREA@@@",$_textarea_blocks, $source); + + return $source; +} + +function smarty_outputfilter_trimwhitespace_replace($search_str, $replace, &$subject) { + $_len = strlen($search_str); + $_pos = 0; + for ($_i=0, $_count=count($replace); $_i<$_count; $_i++) + if (($_pos=strpos($subject, $search_str, $_pos))!==false) + $subject = substr_replace($subject, $replace[$_i], $_pos, $_len); + else + break; + +} + +?> diff --git a/libs/plugins/shared.escape_special_chars.php b/libs/plugins/shared.escape_special_chars.php new file mode 100644 index 0000000..c07ce31 --- /dev/null +++ b/libs/plugins/shared.escape_special_chars.php @@ -0,0 +1,31 @@ +<?php +/** + * Smarty shared plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * escape_special_chars common function + * + * Function: smarty_function_escape_special_chars<br> + * Purpose: used by other smarty functions to escape + * special chars except for already escaped ones + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_function_escape_special_chars($string) +{ + if(!is_array($string)) { + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string); + $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); + } + return $string; +} + +/* vim: set expandtab: */ + +?> diff --git a/libs/plugins/shared.make_timestamp.php b/libs/plugins/shared.make_timestamp.php new file mode 100644 index 0000000..b42eb11 --- /dev/null +++ b/libs/plugins/shared.make_timestamp.php @@ -0,0 +1,46 @@ +<?php +/** + * Smarty shared plugin + * @package Smarty + * @subpackage plugins + */ + + +/** + * Function: smarty_make_timestamp<br> + * Purpose: used by other smarty functions to make a timestamp + * from a string. + * @author Monte Ohrt <monte at ohrt dot com> + * @param string + * @return string + */ +function smarty_make_timestamp($string) +{ + if(empty($string)) { + // use "now": + $time = 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; + +} + +/* vim: set expandtab: */ + +?> diff --git a/login.php b/login.php new file mode 100644 index 0000000..6b94e54 --- /dev/null +++ b/login.php @@ -0,0 +1,102 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Login processing to PgpoolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +require_once('command.php'); + +$success = false; + +if(isset($_SESSION[SESSION_LOGIN_USER])) { + $success = true; +} + +if($success == false) { + if(isset($_POST['username'])) { + $username = $_POST['username']; + } else { + $tpl->display('login.tpl'); + exit(); + } + + if(isset($_POST['password'])) { + $password = $_POST['password']; + } + + $md5password = md5($password); + + if( !file_exists(_PGPOOL2_PASSWORD_FILE)) { + $errorCode = 'e7001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + $fp = fopen(_PGPOOL2_PASSWORD_FILE, 'r'); + $regexp = '^' . $username.":".$md5password; + + if($fp != null) { + while( !feof($fp) ) { + $line = fgets($fp); + if( ereg($regexp, $line) ) { + $_SESSION[SESSION_LOGIN_USER] = $username; + $_SESSION[SESSION_LOGIN_USER_PASSWORD] = $password; + $success = true; + } + } + } + fclose($fp); +} + +if(!$success) { + $tpl->display('login.tpl'); + exit(); +} + +$tpl->assign('isLogin', TRUE); +$tpl->assign('viewPHP', 'nodeStatus.php'); + +$refreshTime = 5000; +if( _PGPOOL2_STATUS_REFRESH_TIME >= 0 ) { + $refreshTime = _PGPOOL2_STATUS_REFRESH_TIME * 1000; +} +if(DoesPgpoolPidExist()) { + $tpl->assign('pgpoolIsActive', true); +} else { + $tpl->assign('pgpoolIsActive', false); +} + +$tpl->assign('c', _PGPOOL2_CMD_OPTION_C); +$tpl->assign('d', _PGPOOL2_CMD_OPTION_D); +$tpl->assign('m', _PGPOOL2_CMD_OPTION_M); +$tpl->assign('n', _PGPOOL2_CMD_OPTION_N); + +$tpl->assign('pgpoolConf', _PGPOOL2_CONFIG_FILE); +$tpl->assign('pcpConf', _PGPOOL2_PASSWORD_FILE); +$tpl->assign('refreshTime', $refreshTime); +$tpl->assign('msgStopPgpool', $message['msgStopPgpool']); +$tpl->assign('help', 'status'); +$tpl->display('status.tpl'); + +?> diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..e5c54d7 --- /dev/null +++ b/logout.php @@ -0,0 +1,33 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Logout processing from PgppolAdmin + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +session_unset(); + +header('Location: login.php'); + +?> diff --git a/nodeServerStatus.php b/nodeServerStatus.php new file mode 100644 index 0000000..bef2e77 --- /dev/null +++ b/nodeServerStatus.php @@ -0,0 +1,37 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Status information of the servers registered at backend host in pgpool.conf + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +readConfigParams(); + +$tpl->display('nodeServerStatus.tpl'); +?> diff --git a/nodeStatus.php b/nodeStatus.php new file mode 100644 index 0000000..1ae757e --- /dev/null +++ b/nodeStatus.php @@ -0,0 +1,101 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Node status of pgpool + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version SVN: $Id$ + */ + +require_once('common.php'); +require_once('command.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +$MAX_VALUE = 2147483647; + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$ret = execPcp('PCP_NODE_COUNT'); +if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1002'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); +} else { + $nodeCount = $ret['SUCCESS']; +} + +$tpl->assign('nodeCount', $nodeCount); + +$isParallelMode = isParallelMode(); +$isReplicationMode = isReplicationMode(); +$isMasterSlaveMode = isMasterSlaveMode(); + +$nodeInfo = array(); + +for($i=0; $i<$nodeCount; $i++) { + $ret = execPcp('PCP_NODE_INFO', $i); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); + } else { + $ret = $ret['SUCCESS']; + } + $nodeInfo[$i] = split(" ", $ret); + $nodeInfo[$i][3] = sprintf('%.3f', $nodeInfo[$i][3] / $MAX_VALUE); + if( $isParallelMode ) { + array_push($nodeInfo[$i], 'none'); + } else { + switch($nodeInfo[$i][2]) { + case 1: + case 2: + if($isReplicationMode || $isMasterSlaveMode) { + array_push($nodeInfo[$i], 'disconnect'); + } else { + array_push($nodeInfo[$i], 'none'); + } + break; + case 3: + if(NodeActive($i)) { + if($isReplicationMode || $isMasterSlaveMode) { + array_push($nodeInfo[$i], 'return'); + } else { + array_push($nodeInfo[$i], 'none'); + } + break; + } + else { + array_push($nodeInfo[$i], 'none'); + } + break; + } + } +} + +$tpl->assign('refreshTime', _PGPOOL2_STATUS_REFRESH_TIME*1000); +$tpl->assign('nodeInfo', $nodeInfo); +$tpl->assign('parallelMode', $isParallelMode); +$tpl->assign('msgStopPgpool', $message['msgStopPgpool']); +$tpl->display('nodeStatus.tpl'); + +?> diff --git a/pgconfig.php b/pgconfig.php new file mode 100644 index 0000000..b777240 --- /dev/null +++ b/pgconfig.php @@ -0,0 +1,452 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * View and edit of pgpool.conf + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +require('definePgpoolConfParam.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +$configParam = array(); +$error = array(); + +if(isset($_POST['action'])) { + $action = $_POST['action']; +} else { + $action = FALSE; +} + +if($action == 'add') { + foreach($pgpoolConfigParam as $key => $value) { + if($pgpoolConfigParam[$key]['type'] == 'B') { + if(isset($_POST[$key])) { + $configValue[$key] = 'true'; + } else { + $configValue[$key] = 'false'; + } + } else { + $configValue[$key] = trim($_POST[$key]); + } + } + if(isset($_POST['backend_hostname'])) { + $configValue['backend_hostname'] = $_POST['backend_hostname']; + } else { + $configValue['backend_hostname'] = array(); + } + if(isset($_POST['backend_port'])) { + $configValue['backend_port'] = $_POST['backend_port']; + } else { + $configValue['backend_port'] = array(); + } + if(isset($_POST['backend_weight'])) { + $configValue['backend_weight'] = $_POST['backend_weight']; + } else { + $configValue['backend_weight'] = array(); + } + + $tpl->assign('params', $configValue); + $tpl->assign('isAdd', true); + $tpl->display('pgconfig.tpl'); + return; +} else if( $action == 'cancel') { + foreach($pgpoolConfigParam as $key => $value) { + if($pgpoolConfigParam[$key]['type'] == 'B') { + if(isset($_POST[$key])) { + $configValue[$key] = 'true'; + } else { + $configValue[$key] = 'false'; + } + } else { + $configValue[$key] = trim($_POST[$key]); + } + } + + if(isset($_POST['backend_hostname'])) { + $configValue['backend_hostname'] = $_POST['backend_hostname']; + } + if(isset($_POST['backend_port'])) { + $configValue['backend_port'] = $_POST['backend_port']; + } + if(isset($_POST['backend_weight'])) { + $configValue['backend_weight'] = $_POST['backend_weight']; + } + + array_pop($configValue['backend_hostname']); + array_pop($configValue['backend_port']); + array_pop($configValue['backend_weight']); + $tpl->assign('params', $configValue); + $tpl->assign('isAdd', false); + $tpl->display('pgconfig.tpl'); + return; +} + +$configValue = readConfigParams(); + +/** + * check $configFile + */ + +foreach($pgpoolConfigParam as $key => $value) { + if( ! isset($configValue[$key]) ) { + $configValue[$key] = $value['default']; + } +} + +switch( $action ) { + case 'update': + + /** + * copy from POST data to $configValue except backend value + */ + foreach($pgpoolConfigParam as $key => $value) { + if($pgpoolConfigParam[$key]['type'] == 'B') { + if(isset($_POST[$key])) { + $configValue[$key] = 'true'; + } else { + $configValue[$key] = 'false'; + } + } else { + $configValue[$key] = trim($_POST[$key]); + } + } + + /** + * Confirmations of value except backend host + */ + foreach($pgpoolConfigParam as $key => $value) { + check($key, $value, $configValue, $error); + } + + /** + * copy backend value from POST data to $configValue + */ + foreach($pgpoolConfigBackendParam as $key => $value) { + if(isset($_POST[$key])) { + $configValue[$key] = $_POST[$key]; + } + } + /** + * check backend value + */ + if(isset($configValue['backend_hostname'])) { + for( $i = 0; $i < count($configValue['backend_hostname']); $i++) { + $hostname = $configValue['backend_hostname'][$i]; + $port = $configValue['backend_port'][$i]; + $weight = $configValue['backend_weight'][$i]; + + $result = FALSE; + $result = checkString ($hostname, + $pgpoolConfigBackendParam['backend_hostname']['regexp']); + if(!$result) { + $error['backend_hostname'][$i] = TRUE; + } else { + $error['backend_hostname'][$i] = FALSE; + } + $result = checkInteger($port, + $pgpoolConfigBackendParam['backend_port']['min'], + $pgpoolConfigBackendParam['backend_port']['max']); + if(!$result) { + $error['backend_port'][$i] = TRUE; + } else { + $error['backend_port'][$i] = FALSE; + } + $result = checkFloat ($weight, + $pgpoolConfigBackendParam['backend_weight']['min'], + $pgpoolConfigBackendParam['backend_weight']['max']); + if($weight == 0) { + $result = FALSE; + } + if(!$result) { + $error['backend_weight'][$i] = TRUE; + } else { + $error['backend_weight'][$i] = FALSE; + } + + } + } + + $isError = FALSE; + foreach($error as $key => $value) { + if(preg_match("/^backend_hostname/", $key) + || preg_match("/^backend_port/", $key) + || preg_match("/^backend_weight/", $key)) { + for($i=0; $i < count($value); $i++) { + if($value[$i] == TRUE) { + $isError = TRUE; + } + } + } else { + if ($value == TRUE) { + $isError = TRUE; + } + } + if($isError) { + break; + } + } + + if( !$isError) { + if(is_writable(_PGPOOL2_CONFIG_FILE)) { + writeConfigFile($configValue, $pgpoolConfigParam); + $configValue = readConfigParams(); + $tpl->assign('status', 'success'); + } else { + $errorCode = 'e4003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + } else { + $tpl->assign('status', 'fail'); + } + + break; + + case 'delete': + $num = $_POST['num']; + deleteBackendHost($num, $configValue); + if(is_writable(_PGPOOL2_CONFIG_FILE)) { + writeConfigFile($configValue, $pgpoolConfigParam); + $configValue = readConfigParams(); + } else { + $errorCode = 'e4003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + break; + + case 'reset': + default: +} + +$tpl->assign('params', $configValue); +$tpl->assign('error', $error); + +$tpl->display('pgconfig.tpl'); + +/** + * check POST value + * + * @param string $key + * @param string $value + * @param array $configParam + * @param string $error + */ +function check($key, $value, &$configParam ,&$error) { + $type = $value['type']; + $result = false; + switch($type) { + case 'B': + $result = checkBoolean($configParam[$key]); + break; + case 'C': + $result = checkString($configParam[$key], $value['regexp']); + break; + case 'F': + $result = checkFloat($configParam[$key], $value['min'], $value['max']); + break; + case 'N': + $result = checkInteger($configParam[$key], $value['min'], $value['max']); + break; + } + if(!$result) { + $error[$key] = true; + } +} + +/** + * check string value + * + * @param string $str + * @param string $pattern + * @return bool + */ +function checkString($str, $pattern) +{ + if(ereg($pattern, $str)) { + return true; + } else { + return false; + } +} + +/** + * check integer value + * + * @param int $str + * @param int $min + * @param int $max + * @return bool + */ +function checkInteger($str, $min, $max) +{ + if(is_numeric($str)) { + $minLen = strlen($min); + $maxLen = strlen($max); + if(ereg("^[0-9]{".$minLen.",".$maxLen."}$", $str)) { + if($str < $min || $str > $max) { + return false; + } else { + return true; + } + } + } + return false; +} + +/** + * check float value + * + * @param float $str + * @param float $min + * @param float $max + * @return bool + */ +function checkFloat($str, $min, $max) +{ + if(is_numeric($str)) { + if($str < $min || $str > $max) { + return false; + } + return true; + } + return false; +} + +/** + * Check Boolean value + * + * @param bool $str + * @return bool + */ +function checkBoolean($str) +{ + if($str == 'true' || $str == 'false') { + return true; + } else { + return false; + } +} + +/** + * Write pgpool.conf + * + * @param array $configValue + * @param array $pgpoolConfigParam + */ +function writeConfigFile($configValue, $pgpoolConfigParam) +{ + + $configFile = @file(_PGPOOL2_CONFIG_FILE); + + $removeBackendConfigFile = array(); + + for($i=0; $i < count($configFile); $i++) { + $line = $configFile[$i]; + if(preg_match("/^\w/", $line)) { + list($key, $value) = split("=", $line); + $key = trim($key); + if(!preg_match("/^backend_hostname/", $key) + && !preg_match("/^backend_port/", $key) + && !preg_match("/^backend_weight/", $key) ) { + $removeBackendConfigFile[] = $line; + } + } else { + $removeBackendConfigFile[] = $line; + } + } + + $configFile = $removeBackendConfigFile; + + foreach($pgpoolConfigParam as $key => $value) { + $isWrite = FALSE; + for($j=0; $j<count($configFile); $j++) { + $line = $configFile[$j]; + $line = trim($line); + + if(preg_match("/^$key/", $line)) { + if( strcmp($pgpoolConfigParam[$key]['type'], "C") == 0) { + $configFile[$j] = $key . " = '" . $configValue[$key] . "'\n"; + } else { + $configFile[$j] = $key . " = " . $configValue[$key]."\n"; + } + $isWrite = TRUE; + break; + } + } + if(!$isWrite) { + if( strcmp($pgpoolConfigParam[$key]['type'], "C") == 0) { + $configFile[] = $key . " = '" . $configValue[$key] . "'\n"; + } else { + $configFile[] = $key . " = " . $configValue[$key]."\n"; + } + } + } + if(isset($configValue['backend_hostname'])) { + for($i=0; $i<count($configValue['backend_hostname']); $i++) { + $line = "backend_hostname$i = '" . $configValue['backend_hostname'][$i] . "'\n"; + $configFile[] = $line; + + $line = "backend_port$i = " . $configValue['backend_port'][$i] . "\n"; + $configFile[] = $line; + + $line = "backend_weight$i = " . $configValue['backend_weight'][$i] . "\n"; + $configFile[] = $line; + } + } + + $outfp = fopen(_PGPOOL2_CONFIG_FILE, 'w'); + foreach($configFile as $line) { + fputs($outfp, $line); + } + fclose($outfp); +} + +/** + * Delete backend host + * + * @param int $num + * @param array $configValue + */ +function deleteBackendHost($num, &$configValue) +{ + unset($configValue['backend_hostname'][$num]); + $configValue['backend_hostname'] = array_values($configValue['backend_hostname']); + + unset($configValue['backend_port'][$num]); + $configValue['backend_port'] = array_values($configValue['backend_port']); + + unset($configValue['backend_weight'][$num]); + $configValue['backend_weight'] = array_values($configValue['backend_weight']); + +} + +?> diff --git a/procInfo.php b/procInfo.php new file mode 100644 index 0000000..6e8f142 --- /dev/null +++ b/procInfo.php @@ -0,0 +1,72 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Infomation view of Pgpool process info in status view + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('command.php'); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + exit(); +} + +$ret = execPcp('PCP_PROC_COUNT'); +if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1004'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); +} else { + $procPids = split(" ", $ret['SUCCESS']); +} + +for($i=0; $i<count($procPids); $i++) { + $procPid = $procPids[$i]; + $ret = execPcp('PCP_PROC_INFO', $procPid); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1005'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('innerError.tpl'); + exit(); + } else { + + $ret = $ret['SUCCESS']; + + if(count($ret) > 0) { + foreach($ret as $line) { + $data = split(" ", $line); + + $dateFormat = $message['strDateFormat']; + $data[2] = date($dateFormat, $data[2]); + $data[3] = date($dateFormat, $data[3]); + $procInfo[$procPid][] = $data; + } + } else { + $procInfo[$procPid] = array(''); + } + } +} +$tpl->assign('procInfo', $procInfo); +$tpl->display('procInfo.tpl'); + +?> + diff --git a/queryCache.php b/queryCache.php new file mode 100644 index 0000000..a5ff480 --- /dev/null +++ b/queryCache.php @@ -0,0 +1,187 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * List of query cache + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version CVS: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +readConfigParams(); + +if(isset($_GET['action'])) { + $action=$_GET['action']; +} else { + $action = ''; +} + +if(isset($_GET['col'])) { + $col = $_GET{'col'}; +} else { + $col = ''; +} + +if(isset($_GET['sort'])) { + $sort = $_GET{'sort'}; +} else { + $sort = ''; +} + +$tpl->assign('col', $col); +$tpl->assign('sort', $sort); + +$sysDbParam = readConfigParams(array('system_db_hostname', + 'system_db_port', + 'system_db_dbname', + 'system_db_schema', + 'system_db_user', + 'system_db_password')); + +$sysDbParam['hostname'] = $sysDbParam['system_db_hostname']; +$sysDbParam['port'] = $sysDbParam['system_db_port']; +$sysDbParam['dbname'] = $sysDbParam['system_db_dbname']; +$sysDbParam['user'] = $sysDbParam['system_db_user']; +$sysDbParam['password'] = $sysDbParam['system_db_password']; + +$sysDbSchema = $sysDbParam['system_db_schema']; + +$conn = openDBConnection($sysDbParam); +if($conn == false) { + $errorCode = 'e2001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} + +if($action == 'delete') { + if(isset($_POST['hash'])) { + $hashArray = $_POST['hash']; + } else { + $hashArray = FALSE; + } + if($hashArray != FALSE) { + $sql = "DELETE FROM $sysDbSchema.query_cache WHERE "; + for($i=0; $i<count($hashArray)-1; $i++) { + $escaped = pg_escape_string($hashArray[$i]); + $sql .= "hash = '$escaped' OR "; + } + $sql .= "hash = '$hashArray[$i]'"; + $rs = execQuery($conn, $sql); + $deleteRow = pg_affected_rows($rs); + $tpl->assign("deleteRow", $deleteRow); + } +} + +if($action == 'search') { + $query = $_POST['qQueryStr']; + $dbname = $_POST['qDb']; + $_SESSION['qQueryStr'] = $query; + $_SESSION['qDb'] = $dbname; +} + +if(isset($_SESSION['qQueryStr'])) { + $query = $_SESSION['qQueryStr']; +} else { + $query = ''; +} + +if(isset($_SESSION['qDb'])) { + $dbname = $_SESSION['qDb']; +} else { + $dbname = ''; +} + +if($action == 'clear') { + session_unregister('qQueryStr'); + session_unregister('qDb'); + + $query = ''; + $dbname = ''; +} + +$sql = "SELECT hash, query, dbname, create_time FROM $sysDbSchema.query_cache "; + +$first = true; +if($query != null) { + if($first) { + $sql = $sql . " WHERE "; + $first = false; + } + else { + $sql = $sql . " AND "; + } + + $sql = $sql . "query like '%" . pg_escape_string($query) . "%' "; +} +if($dbname != null) { + if($first) { + $sql = $sql . " WHERE "; + $first = false; + } + else { + $sql = $sql . " AND "; + } + + $sql = $sql . "dbname like '%" . pg_escape_string($dbname). "%' "; +} + +if($col == null) { + $col = 'query'; +} + +$sql = $sql . " ORDER BY " . pg_escape_string($col); + +if($sort == "descending") + $sql = $sql . " DESC"; + +$rs = execQuery($conn, $sql); +if($rs == false) { + $errorCode = 'e2002'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} + + +$result = pg_fetch_all($rs); + +closeDBConnection($conn); + +if($result) { + $dateFormat = $message['strDateFormat']; + for($i=0; $i<count($result); $i++) { + $result[$i]['create_time'] = date($dateFormat, strtotime($result[$i]['create_time'])); + } + $tpl->assign('queryCache', $result); +} + +$tpl->assign('qQueryStr', $query); +$tpl->assign("qDb", $dbname); + +$tpl->display('queryCache.tpl'); + +?> diff --git a/screen.css b/screen.css new file mode 100644 index 0000000..193919b --- /dev/null +++ b/screen.css @@ -0,0 +1,151 @@ +body { + margin: 0; + font: x-small Verdana, Arial, Helvetica, sans-serif; +} +h1 { + margin: 0; +} +h2 { + padding-bottom: 4px; + border-bottom: 1px solid red; + color: red; + font-size: small; +} +h3 { + color: red; + font-size: x-small; +} +ul { + list-style: square; +} +table { + border-top: 1px solid lightsteelblue; + border-collapse: collapse; +} +th, td { + padding: 4px 8px; + border-bottom: 1px solid lightsteelblue; +} +thead th, thead td, tfoot th, tfoot td { + background: ghostwhite; +} +tbody th { + font-weight: normal; + text-align: left; +} +a:link { + color: red; + text-decoration: none; +} +a:visited { + color: maroon; + text-decoration: none; +} +a:link:hover, a:visited:hover { + color: orangered; + text-decoration: underline; +} +a img { + border: none; +} +input { + font: x-small Verdana, Arial, Helvetica, sans-serif; +} +label { + font-weight: bold; +} +#header { + padding: 8px; + border-bottom: 8px solid white; + background: steelblue url("images/sea.jpg") no-repeat bottom right; +} +#menu { + padding-bottom: 40px; + border-top: 1px solid lightsteelblue; + border-right: 1px solid lightsteelblue; + float: left; + width: 176px; + overflow: hidden; + background: ghostwhite; +} +#menu ul { + margin: 0; + padding: 0; + list-style: none; +} +#menu li { + border-bottom: 1px solid lightsteelblue; +} +#menu a:link, #menu a:visited { + padding: 8px 0; + display: block; + color: black; + background: url("images/marker.gif") no-repeat 8px; + text-indent: 16px; + text-decoration: none; +} +#menu a:hover { + background: antiquewhite url("images/marker.gif") no-repeat 8px; +} +#content { + padding: 8px 8px 40px 185px; + border-top: 1px solid lightsteelblue; + background: white url("images/background.gif") repeat-y left; +} +#submenu { + border: 1px solid lightsteelblue; + float: right; + background: ghostwhite; +} +#submenu h3 { + margin: 0; + padding: 4px 8px; + border-bottom: 4px solid white; + color: white; + background: steelblue; + text-align: center; +} +#submenu ul { + margin: 0; + padding: 8px; + border-top: 1px solid lightsteelblue; + list-style: square inside; +} +#footer { + padding: 8px 8px 20px; + clear: left; + color: white; + background: lightsteelblue; +} +#footer address { + font-style: normal; +} +#footer p { + margin: 0; + float: right; +} +#footer a:link, #footer a:visited { + color: white; + font-weight: bold; +} +.hidden { + display: none; +} +.odd { +} +.even { + background: azure; +} +.error { + font-weight: normal; + text-align: left; + background: red; +} +.right_border { + border-right: 1px solid lightsteelblue; + border-collapse: collapse; +} + +#help { + float: right; +}
\ No newline at end of file diff --git a/status.php b/status.php new file mode 100644 index 0000000..196f860 --- /dev/null +++ b/status.php @@ -0,0 +1,246 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Display of status information on pgpool + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version SVN: $Id$ + */ + +require_once('common.php'); +require_once('command.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +$viewPHP = 'nodeStatus.php'; +$refreshTime = 5000; +if(isset($_POST['nodeNumber'])) { + $nodeNumber = $_POST['nodeNumber']; +} else { + $nodeNumber = -1; +} + + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +if(isset($_POST['action'])) { + $action = $_POST['action']; +} else { + $action = FALSE; +} + +/** + * Set pgpool command option + */ + +$tpl->assign('c', _PGPOOL2_CMD_OPTION_C); +$tpl->assign('d', _PGPOOL2_CMD_OPTION_D); +$tpl->assign('m', _PGPOOL2_CMD_OPTION_M); +$tpl->assign('n', _PGPOOL2_CMD_OPTION_N); + +switch ($action) { + case 'start': + $args = ' '; + + if(isset($_POST['c'])) { + $args = $args . "-c "; + } + if(isset($_POST['d'])) { + $args = $args . "-d "; + } + if(isset($_POST['n'])) { + $pgpoolLog = _PGPOOL2_LOG_FILE; + if($pgpoolLog == '') { + $logDir = readLogDir(); + $pgpoolLog = "$logDir/pgpool.log"; + } + + $args = "$args -n > $pgpoolLog "; + } + $ret = execPcp('PCP_START_PGPOOL', $args); + if(!array_key_exists('SUCCESS', $ret)) { + $tpl->assign('pgpoolStatus', 'Pgpool start failed.'); + $tpl->assign('pgpoolMessage', $ret); + } else { + for($i=0; $i<10; $i++) { + if(DoesPgpoolPidExist()) { + break; + } else { + sleep(1); + } + } + if(DoesPgpoolPidExist()) { + $tpl->assign('pgpoolStatus', 'Pgpool start succeed'); + } else { + $tpl->assign('pgpoolStatus', 'Pgpool start failed. Pgpool.pid not found'); + } + $tpl->assign('pgpoolMessage', $ret['SUCCESS']); + } + + break; + + case 'stop': + $m = $_POST['m']; + + $ret = execPcp('PCP_STOP_PGPOOL', $m); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1006'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } else { + for($i=0; $i<10; $i++) { + if(DoesPgpoolPidExist()) { + sleep(1); + } else { + break; + } + } + if(DoesPgpoolPidExist()) { + $tpl->assign('pgpoolStatus', 'Pgpool stop failed. pgpool.pid exists.'); + } else { + $tpl->assign('pgpoolStatus', 'Pgpool stop succeed'); + } + } + + break; + + case 'restart': + /** + * Stop Pgpool + */ + $m = $_POST['m']; + + $ret = execPcp('PCP_STOP_PGPOOL', $m); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1006'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } else { + for($i=0; $i<10; $i++) { + if(DoesPgpoolPidExist()) { + sleep(1); + } else { + break; + } + } + } + + if(DoesPgpoolPidExist() ) { + $tpl->assign('pgpoolStatus', 'pgpool restart failed. Pgpool.pid exists.'); + break; + } + + /** + * Start Pgpool + */ + $args = ' '; + + if(isset($_POST['c'])) { + $args = $args . "-c "; + } + if(isset($_POST['d'])) { + $args = $args . "-d "; + } + if(isset($_POST['n'])) { + $pgpoolLog = _PGPOOL2_LOG_FILE; + if($pgpoolLog == '') { + $logDir = readLogDir(); + $pgpoolLog = "$logDir/pgpool.log"; + } + + $args = "$args -n > $pgpoolLog "; + } + + $ret = execPcp('PCP_START_PGPOOL', $args); + if(!array_key_exists('SUCCESS', $ret)) { + $tpl->assign('pgpoolStatus', 'Pgpool restart failed.'); + $tpl->assign('pgpoolMessage', $ret); + } else { + for($i=0; $i<10; $i++) { + if(DoesPgpoolPidExist()) { + $tpl->assign('pgpoolStatus', 'Pgpool restart succeed'); + break; + } else { + sleep(1); + } + } + if(!DoesPgpoolPidExist()) { + $tpl->assign('pgpoolStatus', 'Pgpool restart failed. Pgpool.pid not found'); + } + $tpl->assign('pgpoolMessage', $ret['SUCCESS']); + } + break; + + case 'return': + $ret = execPcp('PCP_ATTACH_NODE', $nodeNumber); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1010'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + break; + + case 'detach': + $ret = execPcp('PCP_DETACH_NODE', $nodeNumber); + if(!array_key_exists('SUCCESS', $ret)) { + $errorCode = 'e1007'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + break; + + case 'summary': + $viewPHP = 'innerSummary.php'; + break; + case 'proc': + $viewPHP = 'procInfo.php'; + break; + case 'node': + $viewPHP = 'nodeStatus.php'; + break; + case 'log': + $viewPHP = 'innerLog.php'; + break; +} + +if(DoesPgpoolPidExist()) { + $tpl->assign('pgpoolIsActive', true); +} else { + $tpl->assign('pgpoolIsActive', false); +} + +$tpl->assign('viewPHP', $viewPHP); + +if( _PGPOOL2_STATUS_REFRESH_TIME >= 0 ) { + $refreshTime = _PGPOOL2_STATUS_REFRESH_TIME * 1000; +} + +$tpl->assign('pgpoolConf', _PGPOOL2_CONFIG_FILE); +$tpl->assign('pcpConf', _PGPOOL2_PASSWORD_FILE); +$tpl->assign('refreshTime', $refreshTime); +$tpl->assign('msgStopPgpool', $message['msgStopPgpool']); +$tpl->display('status.tpl'); + +?> diff --git a/systemDb.php b/systemDb.php new file mode 100644 index 0000000..d59fd08 --- /dev/null +++ b/systemDb.php @@ -0,0 +1,445 @@ +<?php + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Display and edit of pgpool system database + * + * PHP versions 4 and 5 + * + * LICENSE: Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby + * granted, provided that the above copyright notice appear in all + * copies and that both that copyright notice and this permission + * notice appear in supporting documentation, and that the name of the + * author not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. The author makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * @author Ryuma Ando <[email protected]> + * @copyright 2003-2006 PgPool Global Development Group + * @version SVN: $Id$ + */ + +require_once('common.php'); +$tpl->assign('help', basename( __FILE__, '.php')); + +if(!isset($_SESSION[SESSION_LOGIN_USER])) { + header('Location: login.php'); + exit(); +} + +if( ! file_exists(_PGPOOL2_CONFIG_FILE)) { + $errorCode = 'e3006'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} +$sysDbParam = readConfigParams(array('system_db_hostname', + 'system_db_port', + 'system_db_dbname', + 'system_db_schema', + 'system_db_user', + 'system_db_password')); + +$sysDbParam['hostname'] = $sysDbParam['system_db_hostname']; +$sysDbParam['port'] = $sysDbParam['system_db_port']; +$sysDbParam['dbname'] = $sysDbParam['system_db_dbname']; +$sysDbParam['user'] = $sysDbParam['system_db_user']; +$sysDbParam['password'] = $sysDbParam['system_db_password']; + +$conn = openDBConnection($sysDbParam); +if($conn == false) { + $errorCode = 'e3001'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} + +$sysDbSchema = $sysDbParam['system_db_schema']; + +if(isset($_GET['dbname'])) { + $dbname = pg_escape_string($_GET['dbname']); +} else { + $dbname = ''; +} +if(isset($_GET['schema_name'])) { + $schema_name = pg_escape_string($_GET['schema_name']); +} else { + $schema_name = ''; +} +if(isset($_GET['table_name'])) { + $table_name = pg_escape_string($_GET['table_name']); +} else { + $table_name = ''; +} + +$result = null; + +if($dbname && $schema_name && $table_name) { + $sql = "SELECT * FROM $sysDbSchema.dist_def WHERE dbname='$dbname' AND schema_name='$schema_name' AND table_name = '$table_name'"; + $rs = execQuery($conn, $sql); + if($rs == false) { + $errorCode = 'e3002'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + if(pg_num_rows($rs) > 0) { + $result = pg_fetch_array($rs, 0); + + $col_lists = var_sql2php($result['col_list']); + $type_lists = var_sql2php($result['type_list']); + + $col_list = "'" . $col_lists[0] . "'"; + $type_list = "'" . $type_lists[0] . "'"; + + for($i=1; $i<count($col_lists); $i++) { + $col_list = $col_list . ", '" . $col_lists[$i] . "'"; + $type_list = $type_list . ", '" . $type_lists[$i] . "'"; + } + + $result['col_list'] = $col_list; + $result['type_list'] = $type_list; + + $tpl->assign('isUpdate', true); + } +} + +$tpl->assign('result', $result); + +if(isset($_POST['action'])) { + $action = $_POST['action']; +} else { + $action = FALSE; +} + +$error = FALSE; + +switch( $action ) { + + case 'add': + $dbname = $_POST['dbname']; + $schema_name = $_POST['schema_name']; + $table_name = $_POST['table_name']; + $col_name = $_POST['col_name']; + $col_list = $_POST['col_list']; + $type_list = $_POST['type_list']; + $dist_def_func = $_POST['dist_def_func']; + + $col_list = str_replace('\\', '', $col_list); + $type_list = str_replace('\\', '', $type_list); + + $col_lists = explode_csv($col_list, FALSE, ',', '\'', array()); + $type_lists = explode_csv($type_list, FALSE, ',', '\'', array()); + + if($dbname == '' + || $schema_name == '' + || $table_name == '' + || $col_name == '' + || $col_list == '' + || $type_list == '' + || $dist_def_func == '') { + $tpl->assign('error', $message['errInputEverything']); + $error = TRUE; + break; + } + + if(count($col_lists) != count($type_lists)) { + $tpl->assign('error', $message['errNotSameLength']); + $error = TRUE; + break; + } + + for($i=0; $i<count($col_lists); $i++) { + if(trim($col_lists[$i]) == '' || trim($type_lists[$i]) == '') { + $tpl->assign('error', $message['errNotSameLength']); + $error = TRUE; + break 2; + } + } + + for($i=0; $i<count($col_lists); $i++) { + $col_lists[$i] = pg_escape_string(trim($col_lists[$i])); + $type_lists[$i] = pg_escape_string(trim($type_lists[$i])); + } + + $col_list = array2sql($col_lists); + $type_list = array2sql($type_lists); + + $dbname = pg_escape_string($dbname); + $schema_name = pg_escape_string($schema_name); + $table_name = pg_escape_string($table_name); + $col_name = pg_escape_string($col_name); + $dist_def_func = pg_escape_string($dist_def_func); + + $sql = "SELECT count(*) FROM $sysDbSchema.dist_def WHERE dbname='$dbname' AND schema_name='$schema_name' AND table_name = '$table_name'"; + + $rs = execQuery($conn, $sql); + if($rs == false) { + $errorCode = 'e3003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + + $count = pg_fetch_row($rs, 0); + + if($count[0] > 0) { + $tpl->assign('error', $message['errAlreadyExist']); + $error = TRUE; + break; + } + + $sql = "INSERT INTO $sysDbSchema.dist_def VALUES('$dbname', '$schema_name', '$table_name', '$col_name', ARRAY[$col_list], ARRAY[$type_list], '$dist_def_func')"; + + $rs = execQuery($conn, $sql); + if($rs == false) { + $errorCode = 'e3003'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + break; + + case 'update': + $tpl->assign('isUpdate', true); + + $dbname = $_POST['dbname']; + $schema_name = $_POST['schema_name']; + $table_name = $_POST['table_name']; + $col_name = $_POST['col_name']; + $col_list = $_POST['col_list']; + $type_list = $_POST['type_list']; + $dist_def_func = $_POST['dist_def_func']; + + $col_list = str_replace('\\', '', $col_list); + $type_list = str_replace('\\', '', $type_list); + + $col_lists = explode_csv($col_list, FALSE, ',', '\'', array()); + $type_lists = explode_csv($type_list, FALSE, ',', '\'', array()); + + if($dbname == '' + || $schema_name == '' + || $table_name == '' + || $col_name == '' + || $col_list == '' + || $type_list == '' + || $dist_def_func == '') { + $tpl->assign('error', $message['errInputEverything']); + $error = TRUE; + break; + } + + if(count($col_lists) != count($type_lists)) { + $tpl->assign('error', $message['errNotSameLength']); + $error = TRUE; + break; + } + + $err = false; + + for($i=0; $i<count($col_lists); $i++) { + if(trim($col_lists[$i]) == '' || trim($type_lists[$i]) == '') { + $tpl->assign('error', $message['errNotSameLength']); + $error = TRUE; + break 2; + } + } + + for($i=0; $i<count($col_lists); $i++) { + $col_lists[$i] = pg_escape_string(trim($col_lists[$i])); + $type_lists[$i] = pg_escape_string(trim($type_lists[$i])); + } + + $col_list = array2sql($col_lists); + $type_list = array2sql($type_lists); + + $dbname = pg_escape_string($dbname); + $schema_name = pg_escape_string($schema_name); + $table_name = pg_escape_string($table_name); + $col_name = pg_escape_string($col_name); + $dist_def_func = pg_escape_string($dist_def_func); + + if($dbname && $schema_name && $table_name) { + $sql = "UPDATE $sysDbSchema.dist_def set " + . "dbname = '$dbname', " + . "schema_name = '$schema_name', " + . "table_name = '$table_name', " + . "col_name = '$col_name', " + . "col_list = ARRAY[$col_list], " + . "type_list = ARRAY[$type_list], " + . "dist_def_func = '$dist_def_func' " + . "WHERE dbname='$dbname' AND schema_name='$schema_name' AND table_name = '$table_name'"; + + $rs = execQuery($conn, $sql); + if($rs == false) { + $errorCode = 'e3004'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + $tpl->assign('isUpdate', false); + + break; + } + case 'delete': + $dbname = pg_escape_string($_POST['dbname']); + $schema_name = pg_escape_string($_POST['schema_name']); + $table_name = pg_escape_string($_POST['table_name']); + + if($dbname && $schema_name && $table_name) { + $sql = "DELETE FROM $sysDbSchema.dist_def WHERE " + . "dbname = '$dbname' AND " + . "schema_name = '$schema_name' AND " + . "table_name = '$table_name'"; + + $rs = execQuery($conn, $sql); + if($rs == false) { + $errorCode = 'e3005'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); + } + break; + + } + case 'cancel': + default: +} + +if($error == TRUE) { + $result['dbname'] = $dbname; + $result['schema_name'] = $schema_name; + $result['table_name'] = $table_name; + $result['col_name'] = $col_name; + $result['col_list'] = $col_list; + $result['type_list'] = $type_list; + $result['dist_def_func'] = $dist_def_func; + $tpl->assign('result', $result); +} + +$sql = "SELECT * FROM $sysDbSchema.dist_def ORDER BY dbname"; +$rs = execQuery($conn, $sql); +if($rs == false) { + $errorCode = 'e3002'; + $tpl->assign('errorCode', $errorCode); + $tpl->display('error.tpl'); + exit(); +} + +$result = pg_fetch_all($rs); + +closeDBConnection($conn); + +if($result) { + $arrayResult = array(); + foreach($result as $rc) { + $rc['col_list'] = var_sql2php($rc['col_list']); + $rc['type_list'] = var_sql2php($rc['type_list']); + $rc['listLength'] = count($rc['col_list']); + array_push($arrayResult, $rc); + } + + $tpl->assign('systemDb', $arrayResult); +} + +$tpl->display('systemDb.tpl'); + +function explode_csv($STR,$SQL = FALSE,$DELIMITER = ',',$ENCLOSURE = '"',$BRACKETS = array('{','}')) { + $column = 0; + $enclose = FALSE; + $escape = FALSE; + $braket = 0; + settype($ROW[$column],'string'); + for($i = 0; $i < mb_strlen($STR); $i++) { + $C = mb_substr($STR,$i,1); + if(isset($BRACKETS[0])) { + $brakets0 = $BRACKETS[0]; + } else { + $brakets0 = null; + } + if(isset($BRACKETS[1])) { + $brakets1 = $BRACKETS[1]; + } else { + $brakets1 = null; + } + + switch($C) { + case $DELIMITER: + if($enclose || $braket > 0) { + $ROW[$column] .= $C; + } else { + $column++; + settype($ROW[$column],'string'); + } + $escape = FALSE; + break; + + case $ENCLOSURE: + if($escape || $braket) { + $ROW[$column] .= $C; + } else { + if($enclose) { + $enclose = FALSE; + } else { + $enclose = TRUE; + } + } + $escape = FALSE; + break; + + case '\\': + $ROW[$column] .= $C; + $escape = TRUE; + break; + + case $brakets0: + $ROW[$column] .= $C; + if($SQL && !$escape) { + $braket++; + } + $escape = FALSE; + break; + + case $brakets1: + $ROW[$column] .= $C; + if($SQL && !$escape) { + $braket--; + } + $escape = FALSE; + break; + + default: + $ROW[$column] .= $C; + $escape = FALSE; + } + } + return($ROW); +} + +function var_sql2php($VAL) { + if(mb_ereg('^\{(.*)\}$',$VAL,$match) !== FALSE) { + $VAL = array_map('var_sql2php',explode_csv($match[1],TRUE)); + } + return($VAL); +} + +function array2sql($var) { + if(!is_array($var)) { + return ''; + } + + $str = ''; + $str = "'" . $var[0] . "'"; + + for($i=1; $i<count($var); $i++) { + $str = $str . ", '" . $var[$i] . "'"; + } + return $str; +} + +?> diff --git a/templates/changePassword.tpl b/templates/changePassword.tpl new file mode 100644 index 0000000..201d972 --- /dev/null +++ b/templates/changePassword.tpl @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strChangePassword|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help" />{$message.strHelp|escape}</a></div> + <h2>{$message.strChangePassword|escape}</h2> + <form action="changePassword.php" method="post"> + <input type="hidden" name="action" value="update"/> + <table> + {if $error != ''} + <thead><tr><td colspan="2">{$error|escape}</td></tr></thead> + {/if} + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="ButtonName" value="{$message.strUpdate|escape}" /> + </td></tr> + </tfoot> + <tbody> + <tr> + <th><label>{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + <tr> + <th><label>{$message.strPasswordConfirmation|escape}</label></th> + <td><input id="password2" name="password2" type="password" size="25" /></td> + </tr> + </tbody> +</table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/config.tpl b/templates/config.tpl new file mode 100644 index 0000000..e4bc946 --- /dev/null +++ b/templates/config.tpl @@ -0,0 +1,162 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + {if $status == 'success'} + <table> + <tr> + <td>{$message.msgUpdateComplete|escape}</td> + </tr> + </table> + {elseif $status == 'fail'} + <table> + <tr> + <td>{$message.msgUpdateFailed|escape}</td> + </tr> + </table> + {/if} + <h2>{$message.strSetting|escape}</h2> + <form action="config.php" method="post" id="Config"> + <input type="hidden" name="action" value="update" /> + <table> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="ButtonName" value="{$message.strUpdate|escape}" /> + </td></tr> + </tfoot> + <tbody> + <tr> + <th><label>{$message.strLanguage|escape}</label> + (string)</th> + <td class="input"><select name="lang"> + <option value="auto">auto</option> + {foreach key=key item=str from=$messageList} + {if $params.lang == $key} + <option value="{$key|escape}" selected="selected">{$str|escape}</option> + {else} + <option value="{$key|escape}">{$str|escape}</option> + {/if} + {/foreach} + </select> + </td> + </tr> + <tr> + <th><label>{$message.strPgConfFile|escape}</label> + (string)</th> + <td><input type="text" name="pgpool_config_file" size="50" value="{$params.pgpool_config_file|escape}" /> + {if $errors.pgpool_config_file != ''} + <br />{$errors.pgpool_config_file|escape} + {/if} + </td></tr> + <tr> + <th><label>{$message.strPasswordFile|escape}</label> + (string)</th> + <td><input type="text" name="password_file" size="50" value="{$params.password_file|escape}" /> + {if $errors.password_file != ''} + <br />{$errors.password_file|escape} + {/if} + </td></tr> + <tr> + <th><label>{$message.strPgpoolCommand|escape}</label> + (string)</th> + <td><input type="text" name="pgpool_command" size="50" value="{$params.pgpool_command|escape}" /> + {if $errors.pgpool_command != ''} + <br />{$errors.pgpool_command|escape} + {/if} + </td></tr> + <tr> + <th colspan="2"><label>{$message.strPgpoolCommandOption|escape}</label> + (string)</th></tr> + <tr><td>{$message.strCmdC|escape}(-c)</td> + {if $params.c == 1} + <td><input type="checkbox" name="c" checked="checked" /></td> + {else} + <td><input type="checkbox" name="c" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdN|escape}(-n)</td> + {if $params.n == 1} + <td><input type="checkbox" name="n" checked="checked" /></td> + {else} + <td><input type="checkbox" name="n" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdD|escape}(-d)</td> + {if $params.d == 1} + <td><input type="checkbox" name="d" checked="checked" /></td> + {else} + <td><input type="checkbox" name="d" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdM|escape}(-m)</td><td><select name="m"> + {if $params.m == 's'} + <option value="s" selected="selected">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $params.m == 'f'} + <option value="s">smart</optgroup> + <option value="f" selected="selected">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $params.m == 'i'} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i" selected="selected">immediate</optgroup> + {else} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {/if} + </td></tr> + <tr> + <th><label>{$message.strPgpoolLogFile|escape}</label> + (string)</th> + <td><input type="text" name="pgpool_logfile" size="50" value="{$params.pgpool_logfile|escape}" /> + {if $errors.pgpool_logfile != ''} + <br />{$errors.pgpool_logfile|escape} + {/if} + </td></tr> + <tr> + <th><label>{$message.strPcpDir|escape}</label> + (string)</th> + <td><input type="text" name="pcp_client_dir" size="50" value="{$params.pcp_client_dir|escape}" /> + {if $errors.pcp_client_dir != ''} + <br />{$errors.pcp_client_dir|escape} + {/if} + </td></tr> + <tr> + <th><label>{$message.strPcpHostName|escape}</label> + (string)</th> + <td><input type="text" name="pcp_hostname" size="50" value="{$params.pcp_hostname|escape}" /> + {if $errors.pcp_hostname != ''} + <br />{$errors.pcp_hostname|escape} + {/if} + </td></tr> + <tr> + <th><label>{$message.strPcpRefreshTime|escape}</label> + (integer) + </th><td><input type="text" name="pcp_refresh_time" size="50" value="{$params.pcp_refresh_time|escape}" /> + {if $errors.pcp_refresh_time != ''} + <br />{$errors.pcp_refresh_time|escape} + {/if} + </td></tr> + </tbody> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/error.tpl b/templates/error.tpl new file mode 100644 index 0000000..bedb0d5 --- /dev/null +++ b/templates/error.tpl @@ -0,0 +1,37 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strError|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file='menu.tpl'} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + <h2>{$message.strError|escape}</h2> + <table> + <tr> + <th><label>{$message.strErrorCode|escape}</label></th> + <td>{$errorCode|escape}</td> + </tr> + <tr> + <th><label>{$message.strErrorMessage|escape}</label></th> + <td>{$message.$errorCode|escape}</td> + </tr> + </td> + + </tr> + + </table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/footer.tpl b/templates/footer.tpl new file mode 100644 index 0000000..a0f454c --- /dev/null +++ b/templates/footer.tpl @@ -0,0 +1,4 @@ + <address> + Version {$version|escape}<br /> + Copyright © 2006 <a href="http://pgpool.projects.postgresql.org/">pgpool Global Development Group</a>. All rights reserved. + </address>
\ No newline at end of file diff --git a/templates/help/en/changePassword.tpl b/templates/help/en/changePassword.tpl new file mode 100644 index 0000000..04480c3 --- /dev/null +++ b/templates/help/en/changePassword.tpl @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strHelp|escape}({$message.strChangePassword|escape})</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strChangePassword|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + The password of the user who is logging in the pgpool administration tool is changed. + <h3>{$message.strFeature|escape}</h3> + Please input a new password to each input column twice and push the update button.<br /> + When it is successful, the login screen is displayed. Please login with the new password. + <form aciton="changePassword.php?action=update" method="post"> + <input type="hidden" name="action" value="update"/> + <table> + <tbody> + <tr> + <th><label for="password">{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + <tr> + <th><label for="password2">{$message.strPasswordConfirmation|escape}</label></th> + <td><input id="password2" name="password2" type="password" size="25" /></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="ButtonName" value="{$message.strUpdate|escape}" /> + </td></tr> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/config.tpl b/templates/help/en/config.tpl new file mode 100644 index 0000000..4a92dcc --- /dev/null +++ b/templates/help/en/config.tpl @@ -0,0 +1,90 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strSetting|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + The setting of the pgpool administration tool can be displayed and be changed. + <h3>{$message.strFeature|escape}</h3> + <table> + <tbody> + <tr> + <th><label for="listen_addresses">{$message.strLanguage|escape}</label> + (string)</th> + <td class="input">The language that wants to be displayed is selected. </td> + </tr> + <tr> + <th><label for="pgconfigPath">{$message.strPgConfFile|escape}</label> + (string)</th> + <td>Path to pgpool.conf is specified in the full path. </td></tr> + <tr> + <th><label for="PasswordFile">{$message.strPasswordFile|escape}</label> + (string)</th> + <td>Path to pcp.conf is specified in the full path. </td></tr> + <tr> + <th colspan="2"><label>{$message.strPgpoolCommandOption|escape}</label> + (string)</th></tr> + <tr><td>{$message.strCmdC|escape}(-c)</td> + <td>When starting pgpool, the query cache is cleared.</td> + </tr> + <tr><td>{$message.strCmdN|escape}(-n)</td> + <td>Pgpool can be run in non-daemon mode. For display of pgpool log in this pool, it is necessary to turn on this item. </td> + </tr> + <tr><td>{$message.strCmdD|escape}(-d)</td> + <td>Pgpool can be run in debug mode. When the debugging log is necessary, it turns it on.</td> + </tr> + <tr> + <tr><td>{$message.strCmdM|escape}(-d)</td> + <td>All the processes of pgpool are stopped. The pgpool stop option is displayed, when "Pgpool Stop" is pushed. There are stop mode for pgpool as follows. + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + If pgpool is stopped, pgpool status in the status window become "pgpool stop" and start option for pgpool is displayed.</td> + </tr> + <tr><td>{$message.strCmdPgpoolFile|escape}(-f)</td> + <td>When pgpool starts, pgpool.conf must be specified. The path of pgpool.conf is specified in "{$message.strPgConfFile|escape}".</td> + </tr> + <tr><td>{$message.strCmdPcpFile|escape}(-F)</td> + <td>When pgpool starts, pcp.conf must be specified. The path of pcp.conf is specified in "{$message.strPasswordFile|escape}".</td> + </tr> + <tr> + <th><label>{$message.strPgpoolLogFile|escape}</label> + (string)</th> + <td>The log file used when starting in non-daemon mode is specified by the full path form. If this is not specified, pgpool.log file is created in the directory specified in the logdir item of pgpool.conf.</td></tr> + <tr> + <th><label for="PcpDir">{$message.strPcpDir|escape}</label> + (string)</th> + <td>The directory that has installed the PCP command is specified. </td></tr> + <tr> + <th><label for="PcpHostname">{$message.strPcpHostName|escape}</label> + (string)</th> + <td>The host name that executes the PCP command is specified. It usually becomes "localhost".</td> + </tr> + <tr> + <th><label for="PcpRefreshTime">{$message.strPcpRefreshTime|escape}</label> + (integer) + </td> + <td>The update interval of status is specified every second. When 0 is specified, it doesn't update it automatically. </td></tr> + </tbody> + </table> + <p>Finally, The update button is renewed pushing.</p> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/errorCode.tpl b/templates/help/en/errorCode.tpl new file mode 100644 index 0000000..ab9181c --- /dev/null +++ b/templates/help/en/errorCode.tpl @@ -0,0 +1,148 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="#" onclick="history.back()"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>{$message.strHelp|escape}({$message.strErrorCode|escape})</h2> +<h3>{$message.strCommon|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e1</label></th><td class="right_border">No found pgmgt.conf.php.</td><td>Please confirm whether the pgmgt.conf.php file is in the conf directory. Moreover, please confirm whether there is an appropriate right of access. </td></tr> +<tr><th class="right_border"><label>e2</label></th><td class="right_border">No found message catalog.</td><td>Please confirm whether the message catalog file is in the lang directory. </td></tr> +<tr><th class="right_border"><label>e3</label></th><td class="right_border">PCP command error occurred.</td><td>Please confirm whether in the place that the Pcp command specified by a set </td></tr> +<tr><th class="right_border"><label>e4</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that the Pcp command specified by a set menu.</td></tr> +<tr><th class="right_border"><label>e5</label></th><td class="right_border">No found Smarty template file.</td><td>Please confirm whether the template file for the display is in the template directory. </td></tr> +<tr><th class="right_border"><label>e6</label></th><td class="right_border">No found help.</td><td>Please confirm whether the Help file is in template/help or less. </td></tr> +<tr><th class="right_border"><label>e7</label></th><td class="right_border">No found Parameter in pgpmgt.conf.php</td><td>Please confirm whether the parameter to be specified to pgmgt.conf.php. </td></tr> +<tr><th class="right_border"><label>e8</label></th><td class="right_border">No found pcp_timeout in pgpool.conf</td><td>Please confirm whether pcp_timeout to be specified with pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e9</label></th><td class="right_border">No found pcp_port in pgpool.conf</td><td>Please confirm whether pcp_port to be specified with pgpool.conf. </td></tr> +</table> + +<h3>{$message.strPgpoolStatus|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e1001</label></th><td class="right_border">PCP command error occurred.</td><td>It is displayed when failing in the call of the pcp command. Please confirm whether in the place that the Pcp command specified by a set menu. </td></tr> +<tr><th class="right_border"><label>e1002</label></th><td class="right_border">pcp_node_count command error occurred.</td><td>It is an execution of pcp_node_count error. Please confirm whether pcp_node_count can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1003</label></th><td class="right_border">pcp_node_info command error occurred.</td><td>It is an execution of pcp_node_info error. Please confirm whether pcp_node_infot can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1004</label></th><td class="right_border">pcp_proc_count command error occurred.</td><td>It is an execution of pcp_proc_count error. Please confirm whether pcp_proc_count can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1005</label></th><td class="right_border">pcp_proc_info command error occurred.</td><td>It is an execution of pcp_proc_info error. Please confirm whether pcp_proc_info can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1006</label></th><td class="right_border">pcp_stop_pgpool command error occurred.</td><td>It is an execution of pcp_stop_pgpool error. Please confirm whether pcp_stop_pgpool can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1007</label></th><td class="right_border">pcp_detach_node command error occurred.</td><td>It is an execution of pcp_detach_node error. Please confirm whether pcp_detach_node can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1008</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pgpool.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e1009</label></th><td class="right_border">No found pcp.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> +<tr><th class="right_border"><label>e1010</label></th><td class="right_border">pcp_attach_node command error occurred.</td><td>It is an execution of pcp_attach_node error. Please confirm whether pcp_detach_node can be normally executed. </td></tr> +<tr><th class="right_border"><label>e1011</label></th><td class="right_border">No found log ifle.</td><td>Please confirm whether in the place that the pgpool log file specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to the specified log file. It is made for the directory specified with logdir of pgpool.conf by the file name of pgpool.log when not specifying it. </td></tr> +</table> + +<h3>{$message.strNodeStatus|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e8001</label></th><td class="right_border">Detailed information cannot be acquired.</td><td>Please confirm whether to connect it with the node by the psql command. </td></tr> +</table> + +<h3>{$message.strQueryCache|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e2001</label></th><td class="right_border">Database connection error occurred.</td><td>Please confirm whether to connect it with the data base specified with system DB of pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e2002</label></th><td class="right_border">The error occurred when SELECT was executed</td><td>Please confirm whether the record of Cericasshutabl can be normally acquired. </td></tr> +<tr><th class="right_border"><label>e2003</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> +</table> + +<h3>{$message.strSystemDb|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e3001</label></th><td class="right_border">Database connection error occurred.</td><td>Please confirm whether to connect it with the data base specified with system DB of pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e3002</label></th><td class="right_border">The SQL error occurred when SELECT was executed</td><td>Please confirm whether the record of system DB table can be normally acquired. </td></tr> +<tr><th class="right_border"><label>e3003</label></th><td class="right_border">The SQL error occurred when INSERT was executed</td><td>Please confirm whether the record can be normally inserted in system DB table. </td></tr> +<tr><th class="right_border"><label>e3004</label></th><td class="right_border">The SQL error occurred when UPDATE was executed</td><td>Please confirm whether the record of system DB table can be normally renewed. </td></tr> +<tr><th class="right_border"><label>e3005</label></th><td class="right_border">The SQL error occurred when DELETE was executed</td><td>Please confirm whether the record of system DB table can be normally deleted. </td></tr> +<tr><th class="right_border"><label>e3006</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> + +</table> + +<h3>{$message.strPgConfSetting|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e4001</label></th><td class="right_border">No found pgpool.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. Moreover, please confirm whether there is an appropriate right of access to pcp.conf. </td></tr> +<tr><th class="right_border"><label>e4002</label></th><td class="right_border">It is not possible to read to pgpool.conf. </td><td>Please confirm whether there is a reading right of access in pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e4003</label></th><td class="right_border">It is not possible to write to pgpool.conf. </td><td>Please confirm whether there is a writing right of access in pgpool.conf. </td></tr> +<tr><th class="right_border"><label>e4004</label></th><td class="right_border">There is not required parameter in pgpool.conf</td><td>Please confirm whether there are all parameters in pgpool.conf. </td></tr> +</table> + +<h3>{$message.strSetting|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e5001</label></th><td class="right_border">No found pgmgt.conf.php.</td><td>Please confirm whether the pgmgt.conf.php file is in the conf directory. Moreover, please confirm whether there is an appropriate right of access. </td></tr> +<tr><th class="right_border"><label>e5002</label></th><td class="right_border">It is not possible to read to pgmgt.conf.php.</td><td>Please confirm whether there is a reading right of access in the pgmgt.conf.php file. </td></tr> +<tr><th class="right_border"><label>e5003</label></th><td class="right_border">It is not possible to write to pgmgt.conf.php.</td><td>Please confirm whether there is a writing right of access in the pgmgt.conf.php file. </td></tr> +</table> + +<h3>{$message.strChangePassword|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e6001</label></th><td class="right_border">No found pcp.conf</td><td>Please confirm whether in the place that pcp.conf specified by a set </td></tr> +<tr><th class="right_border"><label>e6002</label></th><td class="right_border">It is not possible to read to pcp.conf. </td><td>menu. </td></tr> +<tr><th class="right_border"><label>e6003</label></th><td class="right_border">It is not possible to write to pcp.conf. </td><td>Please confirm whether there is a reading right of access in the pcp.conf file. </td></tr> +</table> + +<h3>{$message.strLogout|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e7001</label></th><td class="right_border">No found pcp.conf.</td><td>Please confirm whether in the place that pcp.conf specified by a set menu. </td></tr> +</table> + + +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/login.tpl b/templates/help/en/login.tpl new file mode 100644 index 0000000..0c1a210 --- /dev/null +++ b/templates/help/en/login.tpl @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strLogin|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strLogin|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + <p>It is a login screen. Please input the user-name and the password set to pcp.conf.<br /> + When the attestation succeeds, the status screen is displayed. The login screen is displayed again when failing. + + <h3>{$message.strFeature|escape}</h3> + <form action="login.php" method="post" name="Login"> + <table> + <tbody> + <tr> + <th><label>{$message.strLoginName|escape}</label></th> + <td><input id="username" name="username" type="text" size="25" /> + Please input the user-name here. </td> + </tr> + <tr> + <th><label>{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /> + Please input the password here. </td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"><input type="submit" name="Button2" value="{$message.strLogin|escape}" /> + Please push the button when you input the user-name and the password. </td> + </tr> + </tfoot> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/nodeServerStatus.tpl b/templates/help/en/nodeServerStatus.tpl new file mode 100644 index 0000000..0e46688 --- /dev/null +++ b/templates/help/en/nodeServerStatus.tpl @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>{$message.strHelp|escape}({$message.strNodeStatus|escape})</h2> +<h3>{$message.strSummary|escape}</h3> +On the node status screen, +<ul><li>IP Address</li> + <li>Port</li> + <li>Status</li> + <li>Detail</li> + </ul> +<p>can be acquired for each nodes.</p> +<h3>{$message.strFeature|escape}</h3> +<table> + <tr> + <th class="right_border"><label>IP Address</label></th> + <td>The IP address of the node.</td> + </tr> + <tr> + <th class="right_border"><label>Port</label></th> + <td>The port number that the postmaster runs on.</td> + </tr> + <tr> + <th class="right_border"><label>Status</label></th> + <td>It is displayed whether postmaster is operating.</td> + </tr> + <tr> + <th class="right_border"><label>Detail</label></th> + <td>When the postmaster runs on, it will be displayed.<br /> +Pg_settings information is displayed for PostgreSQL, and pool_status is displayed for pgpool. + </td> + </tr> + +</table> + </td> + </tr> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/pgconfig.tpl b/templates/help/en/pgconfig.tpl new file mode 100644 index 0000000..3899abf --- /dev/null +++ b/templates/help/en/pgconfig.tpl @@ -0,0 +1,393 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgConfSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help}.php"><img src="images/back.gif" />{$message.strBack}</a></div> + <h2>{$message.strHelp|escape}({$message.strPgConfSetting|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + The content of pgpool.conf that is the configuration file of pgpool set can be displayed and be changed. + <h3>{$message.strFeature|escape}</h3> + Please input the value that wants to change and push the update button. + <h3>Addition of A backend host</h3> + Please push the add button when you want to add a new back end host. <br /> + It inputs in back end host's item and a new input column can be done, and input information on a new back end host there, please.<br /> + Please push the update button when input ends. + <h3>Deletion of backend host</h3> + Please push the delete button at the right of the host setting when you want to delete the back end host who has registered. <br /> + <div id="submenu"> + <h3>Table of Contents</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#pcp">PCP</a></li> + <li><a href="#logging">Logging</a></li> + <li><a href="#replication">Replication</a></li> + <li><a href="#health-check">Health Check</a></li> + <li><a href="#system-database">System Database</a></li> + <li><a href="#others">Others</a></li> + </ul> + </div> + <h3><a name="connections">Connections</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descListen_addresses|escape}</label> + <br>listen_addresses (string)</th> + <td> +Specifies the addresses to listen on for TCP/IP connections. Set to '*' for all configured IP interfaces, '' for no TCP/IP connections, or else to a specific IP address or host name. The default is 'localhost'. Note that connections via UNIX domain sockets are always allowed. + </td> + </tr> + <tr> + <th><label>{$message.descPort|escape}</label> + <br>port (integer)</th> + <td>The port number where pgpool is running on. Default value is 9999.</td> + </tr> + <tr> + <th><label>{$message.descSocket_dir|escape}</label> + <br>socket_dir (string)</th> + <td>The directory of unix domain socket for PostgreSQL server. Default value is '/tmp'.</td> + </tr> + <tr> + <th><label>{$message.descNum_init_children|escape}</label> + <br>num_init_children (integer)</th> + <td>number of pgpool process initially forked. Default value is 32.</td> + </tr> + <tr> + <th><label>{$message.descMax_pool|escape}</label> + <br>max_pool (integer)</th> + <td> +number of connection pools each pgpool server process are keeping. pgpool will make a new connection if there's no user name and database name pair yet. Thus it is recommended that max_pool exceeds the number of such that possible pairs. If it exceeds, the oldest connection is discarded and the new connection uses the slot. The default value is 4. + </td> + </tr> + <tr> + <th><label>{$message.descChild_life_time|escape}</label> + <br>child_life_time (integer)</th> + <td>Life of a idle child process in seconds. This will prevent unwanted memory leaks or other problems. Default is 300. Set it to 0 disables this feature.</td> + </tr> + <tr> + <th><label>{$message.descConnection_life_time|escape}</label> + <br>connection_life_time (integer)</th> + <td>Life time for each idle connection in seconds. 0 means the life time is forever. The default value is 0.</td> + <tr> + <th><label>{$message.descChild_max_connections|escape}</label> + <br>child_max_connections (integer)</th> + <td> If child_max_connections connections were received, child exits. 0 means no exit. The default value is 0.</td> + </tr> + <tr> + <th><label>{$message.descConnection_cache|escape}</label> + <br>connection_cache</th> + <td>If true, cache connections to PostgreSQL. Default value is true.</td> + </tr> + <tr> + <th><label>{$message.descPgpool2_hostname|escape}</label> + <br>pgpool2_hostname (string)</th> + <td>The host name that pgpool2 runs is specified.</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="backends">Backends</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + <td></td> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descBackend_socket_dir|escape}</label> + <br>backend_socket_dir (string)</th> + <td>The directory of unix domain socket for PostgreSQL server. Default value is '/tmp'.</td> + </tr> + <tr> + <th><label>{$message.descBackend_hostname|escape}</label><br />backend_hostname (string)</th> + <td>The host name that PostgreSQL runs is specified.</td> + </tr> + <tr> + <th><label>{$message.descBackend_port|escape}</label> + <br />backend_port (integer)</th> + <td>It is a port number that postmaster is running.</td> + </tr> + <tr> + <th><label>{$message.descBackend_weight|escape}</label><br />backend_weight (integer)</th> + <td>The weight at the load balance mode is set by the value from 0 to 1. Relative weight is calculated and distributed from the value specified with all the back end servers. </td> + </tr> + </tbody> + </table> + <h3><a name="pcp">PCP (pgpool Control Port)</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descPcp_port|escape}</label> + <br>pcp_port (integer)</th> + <td>It is a port number to connect it with PCP. Default is 9898.</td> + </tr> + <tr> + <th><label>{$message.descPcp_socket_dir|escape}</label> + <br>pcp_socket_dir (string)</th> + <td>The directory of unix domain socket for PCP. Default value is '/tmp'.</td> + </tr> + <tr> + <th><label>{$message.descPcp_timeout|escape}</label> + <br>pcp_timeout (integer)</th> + <td>The time-out of the PCP command is set. The connection disconnect when there will not be response in this time. </td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="logging">Logging</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descLogdir|escape}</label> + <br>logdir (string)</th> + <td>The directory name to store pgpool's log files. Currently only a file named pgpool.pid(has pgpool's process id) is stored. The default value for logdir is '/tmp'.</td> + </tr> + <tr> + <th><label>{$message.descPrint_timestamp|escape}</label> + <br>print_timestamp</th> + <td>If true timestamp is added to each log line. Default value is true.</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="replication">Replication</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descReplication_mode|escape}</label> + <br>replication_mode</th> + <td>Set this true if you are going to use replication functionality. Default is false.</td> + </tr> + <tr> + <th><label>{$message.descReplication_strict|escape}</label> + <br>replication_strict</th> + <td>If true, pgpool will wait for the completion of the master query before sending a query to the secondary server. This is the safest and default operating mode for pgpool. Default is true. +</td> + </tr> + <tr> + <th><label>{$message.descReplication_timeout|escape}</label> + <br>replication_timeout (integer)</th> + <td>In non strict replication mode, there will be a chance of deadlock. pgpool will abort the session if master or secondary does not respond within this milli seconds. if set to 0, timeout is disabled.</td> + </tr> + <tr> + <th><label>{$message.descReplication_stop_on_mismatch|escape}</label> + <br>replication_stop_on_mismatch</th> + <td>Stop replication mode on data mismatch between master and secondary. Default is false.</td> + </tr> + <tr> + <th><label>{$message.descReset_query_list|escape}</label> + <br>reset_query_list (string)</th> + <td>SQL command to initialize the connection when the session ends is delimited by ";".</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="health-check">Health Check</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descHealth_check_timeout|escape}</label> + <br>health_check_timeout (integer)</th> + <td>pgpool does "health check" periodically to detect PostgreSQL servers down, network communication problems or as such. If something is going wrong, pgpool will automatically run into fail over or degeneration mode.</td> + </tr> + <tr> + <th><label>{$message.descHealth_check_period|escape}</label> + <br>health_check_period (integer)</th> + <td>Specifies the interval for next health checking. 0 means no health checking. The default is 0(i.e. no health checking).</td> + </tr> + <tr> + <th><label>{$message.descHealth_check_user|escape}</label> + <br>health_check_user (string)</th> + <td>PostgreSQL user name for the health checking.</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="system-database">System Database</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descSystem_db_hostname|escape}</label> + <br>system_db_hostname (string)</th> + <td>The host name that system DB is operating is specified. It connects with Unix domain socket when not specifying it. </td> + </tr> + <tr> + <th><label>{$message.descSystem_db_port|escape}</label> + <br>system_db_port (integer)</th> + <td>The port number to connect system DB is specified.</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_dbname|escape}</label> + <br>system_db_dbname (string)</th> + <td>The data base name of system DB is specified.</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_schema|escape}</label> + <br>system_db_schema (string)</th> + <td>The schema name of system DB is specified.</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_user|escape}</label> + <br>system_db_user (string)</th> + <td>The username connected with system DB is specified.</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_password|escape}</label> + <br>system_db_password (string)</th> + <td>The password connected with system DB is specified. </td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="others">Others</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descLoad_balance_mode|escape}</label> + <br>load_balance_mode</th> + <td>Perform load balancing for SELECT. Default is false.</td> + </tr> + <tr> + <th><label>{$message.descMaster_slave_mode|escape}</label> + <br>master_slave_mode</th> + <td>Run in master/slave mode. See 14 for more details. Default value is false. This mode is not compatible with replication_mode.</td> + </tr> + <tr> + <th><label>{$message.descInsert_lock|escape}</label> + <br>insert_lock</th> + <td> +If you replicate a table having SERIAL data type column, sometimes the serial value does not match between servers. You can avoid the problem by using a table lock (with a performance penalty due to +less currency in transactions). For this you need to rewrite you query: +<p> +INSERT INTO .... +</p> +<p> +to: +</p> +<p> +BEGIN;<br /> +LOCK TABLE ...<br /> +INSERT INTO ...<br /> +COMMIT; +</p> +<p> +This is painfull. If you turn on insert_lock, pgpool will +automatically do the rewriting for you. +</p> + </td> + </tr> + <tr> + <th><label>{$message.descIgnore_leading_white_space|escape}</label> + <br>ignore_leading_white_space</th> + <td>If true, ignore leading white spaces of each query while pgpool judges if the query is a SELECT so that it can be load balanced. This is usefull for certain APIs such as DBI/DBD which is + know as adding an extra leading white space.</td> + </tr> + <tr> + <th><label>{$message.descParallel_mode|escape}</label> + <br>parallel_mode</th> + <td>When pgpool runs on parallel mode, true is specified. It is necessary to specify a partitioning rule in this case. </td> + </tr> + <tr> + <th><label>{$message.descLog_statement|escape}</label> + <br>log_statement</th> + <td>If true, print all statements to the log. Like the log_statement option to PostgreSQL, this allows for observing queries without engaging in full debugging.</td> + </tr> + <tr> + <th><label>{$message.descEnable_query_cache|escape}</label> + <br>enable_query_cache</th> + <td>When the result of SELECT is cached, it makes it to true.</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> +</div> +<hr class="hidden" /> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/queryCache.tpl b/templates/help/en/queryCache.tpl new file mode 100644 index 0000000..f5848d6 --- /dev/null +++ b/templates/help/en/queryCache.tpl @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strQueryCache|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strQueryCache})</h2> + <h3>{$message.strSummary|escape}</h3> + <p>It is possible to cache the query executed on pgpool, if enable_query_cache of pgpool.conf is true.</p> + <h3>{$message.strFeature|escape}</h3> + <p>It is possible to search for the data that exists in the query cache. It searches for the query string and the database name, and it processes it by the partial agreement retrieval. It becomes a search for the logical product with the query string and the database name. + <table> + <tbody> + <tr> {if $deleteRow > 0} + <tr> + <td colspan="5">{$deleteRow|escape}{$message.strDeleted|escape}</td> + </tr> + {/if} + <tr> + <td nowrap="nowrap" class="column">{$message.strQueryStr|escape}</td> + <td><input name="qQueryStr" type="text" id="qQueryStr" size="50" value="{$qQueryStr|escape}"/> + </td> + </tr> + <tr> + <td nowrap="nowrap" class="column">{$message.strDb|escape}</td> + <td><input name="qDb" type="text" id="qDb" size="50" value="{$qDb|escape}"/></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="search" value="{$message.strSearch|escape}" /> + <input type="submit" name="clear" value="{$message.strClear|escape}" /> + </td></tr> + </table> + <h3>Query cache list</h3> + <p> +The query string, database name and create time which existing in cache is displayed. When "Query", "Database" and "Create Time" clicked, the records is sorted. Whenever clicking, it is sorted in the ascending order or the descending order. </p> + + <p>When the check is put in the check box in the left of the data that wants to be deleted, and the deletion button is pushed, it is deleted. +</p> + <table> + <tbody> + <tr> + <th><input type="checkbox" name="all" value="" /></th> + <th>{$message.strQueryStr|escape}</th> + <th>{$message.strDb|escape}</th> + <th>{$message.strCreateTime|escape}</th> + </tr> + {foreach name=querycache from=$queryCache item=cache} + {if $smarty.foreach.querycache.iteration % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td><input type="checkbox" name="hash[]" value="{$cache.hash|escape}" /></td> + <td>{$cache.query|escape}</td> + <td>{$cache.dbname|escape}</td> + <td>{$cache.create_time|escape}</td> + </tr> + {/foreach} + </tbody> + <tfoot> + <tr><td colspan="4"> + <input type="submit" name="ButtonName" value="{$message.strDelete|escape}" /> + </td></tr> + </table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</html> diff --git a/templates/help/en/status.tpl b/templates/help/en/status.tpl new file mode 100644 index 0000000..ca73a3a --- /dev/null +++ b/templates/help/en/status.tpl @@ -0,0 +1,115 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgpoolStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>{$message.strHelp|escape}({$message.strStatus|escape})</h2> + <h3>{$message.strSummary|escape}</h3> +On the status screen, it is possible to display it for pgpool as follows, +<ul><li>Summary</li> + <li>Process Information</li> + <li>Node Information</li> + <li>Log</li> +</ul> +and operate it. +<ul> + <li>Start</li> + <li>Stop</li> + <li>Restart</li> +</ul> +<h3> <h3>{$message.strFeature|escape}</h3></h3> + +<table> + <tr> + <th class="right_border"><label>Summary</label></th> + <td>The content of pgpool.conf is displayed.</td> + </tr> + <tr> + <th class="right_border"><label>Process Information</label></th> + <td><p>In each process for pgpool,</p> + <ul> + <li>Process ID</li> + <li>Database Name</li> + <li>Username</li> + <li>Process start time</li> + <li>Connection create time</li> + <li>Protocol major version</li> + <li>Protocol miner version</li> + <li>Use of connection</li> + </ul> + <p>will be shown.<br /> + In each process, it will be displayed only the number of max_pool in pgpool.conf in the maximum. + </p></td> + </tr> + <tr> + <th class="right_border"><label>Node Information</label></th> + <td><p>In each node,</p> + <ul> + <li>IP address</li> + <li>Port number</li> + <li>Status</li> + <li>Weight</li> + <li>Disconnect button</li> + </ul> + <p>will be shown. But, the button for disconnection will not be shown when pgpool is running on parallel mode.</p> + <p>In the status,</p> + <ul> + <li>Up. Disconnect</li> + <li>Up. Connected</li> + <li>Down</li> + </ul> + <p>the three states will be shown.</p></td> + </tr> + <tr> + <th class="right_border"><label>Log</label></th> + <td>It is possible to display about log of pgpool when pgpool doesn't run in daemon mode(-n).</td> + </tr> + <tr> + <th class="right_border"><label>Start</label></th> + <td>It is possible to start pgpool when it is stopped. The start option of pgpool + <ul> + <li>Clears query cache(-c)</li> + <li>don't run in daemon mode(-n)</li> + <li>stop mode(-m)</li> + <li>pgpool.conf(-f)</li> + <li>pcp.conf(-F)</li> + </ul> + can be specified. + </td> + </tr> + <tr> + <tr> + <th class="right_border"><label>Stop</label></th> + <td>All the processes of pgpool are stopped. The pgpool stop option is displayed, when "pgpool Stop" is pushed. There are stop mode for pgpool as follows. + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + If pgpool is stopped, pgpool status in the status window becomes "pgpool stop" and the start option for pgpool is displayed.</td> + </tr> + <tr> + <th class="right_border"><label>Restart</label></th> + <td>First, all the processes of pgpool are stopped and then pgpool start process is executed. Both the start and the stop of the abovementioned items can be specified. </td> + </tr> +</table> + +<table> +</table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/en/systemDb.tpl b/templates/help/en/systemDb.tpl new file mode 100644 index 0000000..b1c73e2 --- /dev/null +++ b/templates/help/en/systemDb.tpl @@ -0,0 +1,85 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSystemDb|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strSystemDb|escape})</h2> + <h3>{$message.strSummary|escape}</h3> +The setting of a parallel query is defined for parallel_mode=true in pgpool.conf. + <h3>{$message.strFeature|escape}</h3> +The data type of each column is as follows. <p /> +<table> + <tr> + <th class="right_border"><label>Column Name</label></th> + <th class="right_border"><label>Data Type</label></th> + <th><label>Description</label></th> + + </tr> + <tr> + <th class="right_border"><label>Database Name</label></th> + <td class="right_border">TEXT</td> + <td>Distributed database name</td> + </tr> + <tr> + + <th class="right_border"><label>Schema Name</label></th> + <td class="right_border">TEXT</td> + <td>Schema name of database</td> + </tr> + + <tr> + <th class="right_border"><label>Table</label></th> + <td class="right_border">TEXT</td> + <td>Distributed table name</td> + </tr> + + <tr> + <th class="right_border"><label>Column Name of Distributed key</label></th> + <td class="right_border">TEXT</td> + <td>Column Name of Distributed key</td> + </tr> + + <tr> + <th class="right_border"><label>Column List</label></th> + <td class="right_border">TEXT[]</td> + <td>List of row name of table that distributes data</td> + </tr> + <tr> + <th class="right_border"><label>Type List of Column</label></th> + + <td class="right_border">TEXT[]</td> + <td>List of type of row name</td> + </tr> + <tr> + <th class="right_border"><label>Distributed Function Name</label></th> + <td class="right_border">TEXT</td> + <td>Function name that defines partitioning rule</td> + + </tr> +</table> +<p /> +<h3>Add</h3> +The value is input to all columns and "Add" button is pushed. <br /> +Please enclose each element with a single quotation, and delimit each element by the comma about the column list and the type list of column. + +<h3>Update</h3> +Please click the data base name of the definition that wants to be updated. Please the value must be displayed in the input field and correct and push "Update" button. However, neither the data base name, the schema name nor the table name are revocable. +<h3>Delete</h3> +Please click the data base name of the definition that wants to be deleted. Please push "Delete" button. The confirmation dialog is displayed and push the "OK" button, please. +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/changePassword.tpl b/templates/help/ja/changePassword.tpl new file mode 100644 index 0000000..564e0e8 --- /dev/null +++ b/templates/help/ja/changePassword.tpl @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strHelp|escape}({$message.strChangePassword|escape})</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strChangePassword|escape})</h2> + <h3>概要</h3> + 管理ツールにログインしているユーザのパスワードを変更します。 + <h3>機能</h3> + それぞれの入力欄に新しいパスワードを2回入力して更新ボタンを押してください。<br /> + 更新ボタンを押すと、ログイン画面が表示されます。新しいパスワードでログインしてください。 + <p> + <form aciton="changePassword.php?action=update" method="post"> + <input type="hidden" name="action" value="update"/> + <table> + <tbody> + <tr> + <th><label for="password">{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + <tr> + <th><label for="password2">{$message.strPasswordConfirmation|escape}</label></th> + <td><input id="password2" name="password2" type="password" size="25" /></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="ButtonName" value="{$message.strUpdate|escape}" /> + </td></tr> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/config.tpl b/templates/help/ja/config.tpl new file mode 100644 index 0000000..061c68c --- /dev/null +++ b/templates/help/ja/config.tpl @@ -0,0 +1,98 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strSetting|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + pgpool管理ツールの設定を表示・変更することができます。 + <h3>{$message.strFeature|escape}</h3> + <table> + <tbody> + <tr> + <th><label>{$message.strLanguage|escape}</label> + (string)</th> + <td class="input">表示したい言語を選択します。「auto」を選択した場合には、ブラウザで設定した言語が優先的に表示されます。</td> + </tr> + <tr> + <th><label>{$message.strPgConfFile|escape}</label> + (string)</th> + <td>pgpool.confへのパスをフルパスで指定します。</td></tr> + <tr> + <th><label>{$message.strPasswordFile|escape}</label> + (string)</th> + <td>pcp.confへのパスをフルパスで指定します。</td></tr> + <tr> + <th><label>{$message.strPgpoolCommand|escape}</label> + (string)</th> + <td>pgpoolへのパスをフルパスで指定します。</td></tr> + <tr> + <th colspan="2"><label>{$message.strPgpoolCommandOption|escape}</label> + (string)</th></tr> + <tr><td>{$message.strCmdC|escape}(-c)</td> + <td>起動時にクエリキャッシュをクリアします。</td> + </tr> + <tr><td>{$message.strCmdN|escape}(-n)</td> + <td>非デーモンモードでpgpoolを起動します。pgpoolのログを管理ツールで表示するには、この項目をオンにする必要があります。</td> + </tr> + <tr><td>{$message.strCmdD|escape}(-d)</td> + <td>デバッグモードで起動します。デバッグログが必要な場合にはオンにします。</td> + </tr> + <tr><td>{$message.strCmdM|escape}(-m)</td> + <td>pgpoolのすべてのプロセスを終了します。pgpool停止ボタンを押すと、終了オプションが表示されます。停止モードとして + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + を選択することができます。終了すると、pgpoolステータスが「pgpool停止」となり、起動用画面が表示されます。</td> + </tr> + <tr><td>{$message.strCmdPgpoolFile|escape}(-f)</td> + <td>pgpoolの起動時に指定するpgpool.confです。pgpool.confのパスは「{$message.strPgConfFile|escape}」で指定した値になります。</td> + </tr> + <tr><td>{$message.strCmdPcpFile|escape}(-F)</td> + <td>pgpoolの起動時に指定するpcp.confです。pgpool.confのパスは「{$message.strPasswordFile|escape}」で指定した値になります。</td> + </tr> + <tr> + <th><label>{$message.strPgpoolLogFile|escape}</label> + (string)</th> + <td>非デーモンモードで起動した場合に使用するログファイルをフルパスで指定します。設定しない場合にはpgpool.confのlogdirで指定してあるパスにpgpool.logファイルを作成します。</td></tr> + <tr> + <th><label>{$message.strPcpDir|escape}</label> + (string)</th> + <td>PCPコマンドがインストールしてあるディレクトリを指定します。</td></tr> + <tr> + <th><label>{$message.strPcpDir|escape}</label> + (string)</th> + <td>PCPコマンドがインストールしてあるディレクトリを指定します。</td></tr> + <tr> + <th><label>{$message.strPcpHostName|escape}</label> + (string)</th> + <td>PCPコマンドを実行するホスト名を指定します。通常は「localhost」になります。</td> + </tr> + <tr> + <th><label>{$message.strPcpRefreshTime|escape}</label> + (integer) + </td> + <td>ステータスの更新間隔を秒単位で指定します。0を指定した場合には自動更新しません。 + </td></tr> + </tbody> + </table> + <p>最後に更新ボタンを押して更新します。</p> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/errorCode.tpl b/templates/help/ja/errorCode.tpl new file mode 100644 index 0000000..415f00d --- /dev/null +++ b/templates/help/ja/errorCode.tpl @@ -0,0 +1,147 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="#" onclick="history.back()"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>{$message.strHelp|escape}({$message.strErrorCode|escape})</h2> +<h3>{$message.strCommon|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e1</label></th><td class="right_border">pgmgt.conf.phpが見つかりません</td><td>pgmgt.conf.phpファイルがconfディレクトリにあるか確認してください。また、適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2</label></th><td class="right_border">メッセージカタログが見つかりません</td><td>メッセージカタログファイルがlangディレクトリにあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3</label></th><td class="right_border">pcpコマンドエラーが発生しました</td><td>Pcpコマンドが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pgpool.confが設定メニューで指定した場所にあるか確認してください。また、pgpool.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5</label></th><td class="right_border">テンプレートファイルが見つかりません</td><td>表示用テンプレートファイルがtemplateディレクトリにあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6</label></th><td class="right_border">ヘルプが見つかりません</td><td>ヘルプファイルがtemplate/help以下にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e7</label></th><td class="right_border">pgmgt.conf.phpのパラメータが足りません</td><td>pgmgt.conf.phpにパラメータが指定してあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e8</label></th><td class="right_border">pcp_timeoutがpgpool.confで見つかりません</td><td>pcp_timeoutがpgpool.confで指定してあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e9</label></th><td class="right_border">pcp_portがpgpool.confで見つかりません</td><td>pcp_portがpgpool.confで指定してあるか確認してください。</td></tr> +</table> + +<h3>{$message.strPgpoolStatus|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e1001</label></th><td class="right_border">pcpコマンドエラーが発生しました</td><td>pcpコマンドの呼び出しに失敗した場合に表示されます。Pcpコマンドが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1002</label></th><td class="right_border">pcp_node_countコマンドでエラーが発生しました</td><td>pcp_node_countの実行エラーです。pcp_node_countが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1003</label></th><td class="right_border">pcp_node_infoコマンドでエラーが発生しました</td><td>pcp_node_infoの実行エラーです。pcp_node_infotが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1004</label></th><td class="right_border">pcp_proc_countコマンドでエラーが発生しました</td><td>pcp_proc_countの実行エラーです。pcp_proc_countが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1005</label></th><td class="right_border">pcp_proc_infoコマンドでエラーが発生しました</td><td>pcp_proc_infoの実行エラーです。pcp_proc_infoが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1006</label></th><td class="right_border">pcp_stop_pgpoolコマンドでエラーが発生しました</td><td>pcp_stop_pgpoolの実行エラーです。pcp_stop_pgpoolが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1007</label></th><td class="right_border">pcp_detach_nodeコマンドでエラーが発生しました</td><td>pcp_detach_nodeの実行エラーです。pcp_detach_nodeが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1008</label></th><td class="right_border">指定したpgpool.confが見つかりません</td><td>pgpool.confが設定メニューで指定した場所にあるか確認してください。また、pgpool.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1009</label></th><td class="right_border">指定したpcp.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1010</label></th><td class="right_border">pcp_attach_nodeコマンドでエラーが発生しました</td><td>pcp_attach_nodeの実行エラーです。pcp_detach_nodeが正常に実行できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e1011</label></th><td class="right_border">ログファイルが見つかりません</td><td>pgpoolログファイルが設定メニューで指定した場所にあるか確認してください。また指定したログファイルに適切なアクセス権があるか確認してください。指定しない場合には、pgpool.confのlogdirで指定したディレクトリにpgpool.logというファイル名で作成されます。</td></tr> +</table> + +<h3>{$message.strNodeStatus|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e8001</label></th><td class="right_border">詳細情報が取得できません</td><td>ノードにpsqlコマンドで接続できるか確認してください。</td></tr> +</table> + +<h3>{$message.strQueryCache|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e2001</label></th><td class="right_border">データベースに接続できません</td><td>pgpool.confのシステムDBで指定したデータベースに接続できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2002</label></th><td class="right_border">レコード取得時にエラーが発生しました</td><td>クエリキャッシュテーブルのレコードが正常に取得できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e2003</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +</table> + +<h3>{$message.strSystemDb|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e3001</label></th><td class="right_border">データベースに接続できません</td><td>pgpool.confのシステムDBで指定したデータベースに接続できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3002</label></th><td class="right_border">レコード取得時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に取得できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3003</label></th><td class="right_border">レコード登録時にエラーが発生しました</td><td>システムDBテーブルにレコードが正常に挿入できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3004</label></th><td class="right_border">レコード更新時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に更新できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3005</label></th><td class="right_border">レコード削除時にエラーが発生しました</td><td>システムDBテーブルのレコードが正常に削除できるか確認してください。</td></tr> +<tr><th class="right_border"><label>e3006</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +</table> + +<h3>{$message.strPgConfSetting|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e4001</label></th><td class="right_border">pgpool.confが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。またpcp.confに適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4002</label></th><td class="right_border">pgpool.confから読み込みができません</td><td>pgpool.confに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4003</label></th><td class="right_border">pgpool.confに書き込みができません</td><td>pgpool.confに書き込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e4004</label></th><td class="right_border">pgpool.confに必要なパラメータがありません</td><td>pgpool.confにパラメータがすべてあるか確認してください。</td></tr> +</table> + +<h3>{$message.strSetting|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e5001</label></th><td class="right_border">pgmgt.conf.phpが見つかりません</td><td>pgmgt.conf.phpファイルがconfディレクトリにあるか確認してください。また、適切なアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5002</label></th><td class="right_border">pgmgt.conf.phpから読み込みができません</td><td>pgmgt.conf.phpファイルに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e5003</label></th><td class="right_border">pgmgt.conf.phpに書き込みができません</td><td>pgmgt.conf.phpファイルに書き込みアクセス権があるか確認してください。</td></tr> +</table> + +<h3>{$message.strChangePassword|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e6001</label></th><td class="right_border">pcp.confがファイルが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6002</label></th><td class="right_border">pcp.confに読み込みができません</td><td>pcp.confファイルに読み込みアクセス権があるか確認してください。</td></tr> +<tr><th class="right_border"><label>e6003</label></th><td class="right_border">pcp.confに書き込みができません</td><td>pcp.confファイルに書き込みアクセス権があるか確認してください。</td></tr> +</table> + +<h3>{$message.strLogout|escape}</h3> +<table> + <tr> + <th class="right_border"><label>{$message.strErrorCode|escape}</label></th> + <th class="right_border"><label>{$message.strErrorMessage|escape}</label></th> + <th><label>{$message.strMeasures|escape}</label></th> + </tr> +<tr><th class="right_border"><label>e7001</label></th><td class="right_border">pcp.confがファイルが見つかりません</td><td>pcp.confが設定メニューで指定した場所にあるか確認してください。</td></tr> +</table> + + +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/login.tpl b/templates/help/ja/login.tpl new file mode 100644 index 0000000..bfcfac9 --- /dev/null +++ b/templates/help/ja/login.tpl @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strLogin|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strLogin|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + <p>ログインページです。pcp.confに設定したユーザ名およびパスワードを入力してください。<br /> + 認証が成功すると、ステータス画面が表示されます。失敗した場合には、再度ログイン画面が表示されます。 + <h3>{$message.strFeature|escape}</h3> + <form action="login.php" method="post" name="Login"> + <table> + <tbody> + <tr> + <th><label>{$message.strLoginName|escape}</label></th> + <td><input id="username" name="username" type="text" size="25" /> + ここにユーザ名を入力してください。</td> + </tr> + <tr> + <th><label>{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /> + ここにパスワードを入力してください。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"><input type="submit" name="Button2" value="{$message.strLogin|escape}" /> + ユーザ名とパスワードを入力したらボタンを押してください。</td> + </tr> + </tfoot> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/nodeServerStatus.tpl b/templates/help/ja/nodeServerStatus.tpl new file mode 100644 index 0000000..1d2ecc6 --- /dev/null +++ b/templates/help/ja/nodeServerStatus.tpl @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> + +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>{$message.strHelp|escape}({$message.strNodeStatus|escape})</h2> +<h3>{$message.strSummary|escape}</h3> +ノードステータスでは、各ノードについて +<ul><li>IPアドレス</li> + <li>ポート</li> + <li>ステータス</li> + <li>詳細情報</li> + </ul> +<p>を取得することができます。</p> +<h3>{$message.strFeature|escape}</h3> +<table> + <tr> + <th class="right_border"><label>IPアドレス</label></th> + <td>ノードのIPアドレス</td> + </tr> + <tr> + <th class="right_border"><label>ポート</label></th> + <td>Postmasterが稼働しているポート番号</td> + </tr> + <tr> + <th class="right_border"><label>ステータス</label></th> + <td>Postmasterが稼働状態であるかどうかを表示します。</td> + </tr> + <tr> + <th class="right_border"><label>詳細</label></th> + <td>Postmasterが稼働状態の場合にのみ表示されます。<br /> +PostgreSQLの場合にはpg_settings情報、pgpoolの場合にはpool_statusを取得します。 + </td> + </tr> +</table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/pgconfig.tpl b/templates/help/ja/pgconfig.tpl new file mode 100644 index 0000000..27d1f9d --- /dev/null +++ b/templates/help/ja/pgconfig.tpl @@ -0,0 +1,437 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgConfSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help}.php"><img src="images/back.gif" />{$message.strBack}</a></div> + <h2>{$message.strHelp|escape}({$message.strPgConfSetting|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + pgpoolの設定ファイルであるpgpool.confの設定内容を表示・変更することができます。 + <h3>{$message.strFeature|escape}</h3> + 変更したい値を入力して更新ボタンを押してください。 + <h3>バックエンドホストの追加</h3> + 新しいバックエンドホストを追加したい場合には、追加ボタンを押してください。<br /> + バックエンドホストの項目に新しい入力欄ができますので、そこに新しいバックエンドホストの情報を入力してください。<br /> + 入力が終わりましたら、更新ボタンを押してください。 + <h3>バックエンドホストの削除</h3> + + 登録してあるバックエンドホストを削除したい場合には、そのホスト設定の右側にある削除ボタンを押してください。<br /> + <div id="submenu"> + <h3>Table of Contents</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#pcp">PCP</a></li> + <li><a href="#logging">Logging</a></li> + <li><a href="#replication">Replication</a></li> + <li><a href="#health-check">Health Check</a></li> + <li><a href="#system-database">System Database</a></li> + <li><a href="#others">Others</a></li> + </ul> + </div> + <h3><a name="connections">Connections</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descListen_addresses|escape}</label> + <br>listen_addresses (string)</th> + <td> +TCP/IPコネクションを受け付けるアドレスをホスト名またはIPアドレスで指定します。「*」を指定するとすべてのIPインタフェースからのコネクションを受け付けます。「''」を指定するとTCP/IPコネクションを受け付けま +せん。デフォルト値は「localhost」です。<br />UNIXドメインソケット経由のコネクションは常に受け付けます。 + </td> + + </tr> + <tr> + <th><label>{$message.descPort|escape}</label> + <br>port (integer)</th> + <td>pgpoolがコネクションを受け付けるポート番号です。デフォルト値は9999です</td> + </tr> + <tr> + + <th><label>{$message.descSocket_dir|escape}</label> + <br>socket_dir (string)</th> + <td>PostgreSQLサーバのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>{$message.descNum_init_children|escape}</label> + <br>num_init_children (integer)</th> + + <td>preforkするpgpoolのサーバプロセスの数です。デフォルト値は32になっています。<br /> +なお、問い合わせのキャンセルを行うと通常のコネクションとは別に新たなコネクションが張られます。したがって、すべてのコネクションが使用中の場合は問い合わせのキャンセルができなくってしまうので、ご注意下 + さい。問い合わせのキャンセルを必ず保証したい場合は、想定されるコネクション数の倍の値を設定することをおすすめします。</td> + </tr> + <tr> + <th><label>{$message.descMax_pool|escape}</label> + <br>max_pool (integer)</th> + <td>pgpoolの各サーバプロセスがキープするPostgreSQLへの最大コネクション数です。pgpoolは、ユーザ名、データベースが同じならばコネクションを再利用しますが、そうでなければ新たにPostgreSQLへのコネクションを確立しようとします。したがって、ここでは想定される[ユーザ名:データベース名]のペアの種類の数だけをmax_poolに指定しておく必要があります。もしmax_poolを使いきってしまった場合は一番古いコネクションを切断し、そのスロットが再利用されます。<br />max_poolのデフォルト値は4です。<br />なお、pgpool全体としては、num_init_children*max_pool 分だけPostgreSQLへのコネクションが張られる点に注意してください</td> + + </tr> + <tr> + <th><label>{$message.descChild_life_time|escape}</label> + <br>child_life_time (integer)</th> + <td>pgpoolの子プロセスの寿命です。アイドル状態になってからchild_life_time秒経過すると、一旦終了して新しいプロセスを起動します。メモリーリークその他の障害に備えた予防措置です。child_life_timeのデフォルト値は300秒、すなわち5分です。0を指定するとこの機能は働きません(すなわち起動しっ放し)。なお、まだ一度もコネクションを受け付けていないプロセスにはchild_life_timeは適用されません。</td> + </tr> + <tr> + + <th><label>{$message.descConnection_life_time|escape}</label> + <br>connection_life_time (integer)</th> + <td>コネクションプール中のコネクションの有効期間を秒単位で指定します。0を指定すると有効期間は無限になります。connection_life_timeのデフォルト値は0です。</td> + <tr> + <th><label>{$message.descChild_max_connections|escape}</label> + <br>child_max_connections (integer)</th> + + <td>各pgpool子プロセスへの接続回数がこの設定値を超えると、その子プロセスを終了します。child_life_timeやconnection_life_timeが効かないくらい忙しいサーバで、PostgreSQLバックエンドが肥大化するのを防ぐのに有効です。</td> + </tr> + <tr> + <th><label>{$message.descConnection_cache|escape}</label> + <br>connection_cache</th> + <td>trueならコネクションをキャッシュします。デフォルトはtrueです。</td> + </tr> + + <tr> + <th><label>{$message.descPgpool2_hostname|escape}</label> + <br>pgpool2_hostname (string)</th> + <td>pgpool2が稼働しているホスト名を指定します。</td> + </tr> + </tbody> + <tfoot> + <tr> + + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="backends">Backends</a></h3> + <table> + <thead> + <tr> + + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + <td></td> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descBackend_socket_dir|escape}</label> + <br>backend_socket_dir (string)</th> + <td>PostgreSQLサーバのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>{$message.descBackend_hostname|escape}</label> + <br />backend_hostname (string)</th> + <td>postmasterが稼働しているホスト名を指定します。指定しない場合にはUnix domain socketで接続します。</td> + </tr> + + <tr> + <th><label>{$message.descBackend_port|escape}</label> + <br />backend_port (integer)</th> + <td>postmasterが稼働しているポート番号です。</td> + </tr> + <tr> + <th><label>{$message.descBackend_weight|escape}</label><br />backend_weight (integer)</th> + <td>ロードバランスモード時に振り分ける重みを0から1の値で設定します。すべてのバックエンドサーバで指定した値から相対的な重みを計算して振り分けます。</td> + + </tr> + </tbody> + </table> + <h3><a name="pcp">PCP (pgpool Control Port)</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descPcp_port|escape}</label> + <br>pcp_port (integer)</th> + + <td>PCPに接続するためのポート番号です。デフォルトは9898です。</td> + </tr> + <tr> + <th><label>{$message.descPcp_socket_dir|escape}</label> + <br>pcp_socket_dir (string)</th> + <td>PCPのUnix domain socketのディレクトリです。デフォルト値は'/tmp'です。</td> + </tr> + <tr> + + <th><label>{$message.descPcp_timeout|escape}</label> + <br>pcp_timeout (integer)</th> + <td>PCPコマンドのタイムアウトを設定します。この時間の間に応答がない場合にはコネクションを切断します。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + + </tr> + </tfoot> + </table> + <h3><a name="logging">Logging</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descLogdir|escape}</label> + <br>logdir (string)</th> + + <td>pgpoolの各種ログファイルを格納するディレクトリです。現在のところ、pgpool.pidというプロセスIDを格納するファイルだけが作られるようになっています。logdirのデフォルト値は'/tmp'です。</td> + </tr> + <tr> + <th><label>{$message.descPrint_timestamp|escape}</label> + <br>print_timestamp</th> + <td>trueならばpgpoolのログにタイムスタンプを追加します。デフォルトはtrueです。</td> + </tr> + + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="replication">Replication</a></h3> + + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + + <tr> + <th><label>{$message.descReplication_mode|escape}</label> + <br>replication_mode</th> + <td>レプリケーションモードで動作させる場合はtrueを指定してください。デフォルト値はfalseです。</td> + </tr> + <tr> + <th><label>{$message.descReplication_strict|escape}</label> + + <br>replication_strict</th> + <td>このオプションをtrueにすると、masterの問い合わせ処理の完了を待ってからsecondaryの処理に移ります。デッドロックの危険性はなくなりますが、masterとsecondaryの間で問い合わせの並列処理を行わなくなるので性能が低下する場合もあります。<br />なお、すべての問い合わせではなくて、SQLのコメントを使って一部の問い合わせのみstrict動作させることもできます。<br />このオプションのデフォルト値はtrueです</td> + </tr> + <tr> + <th><label>{$message.descReplication_timeout|escape}</label> + <br>replication_timeout (integer)</th> + + <td>replication_strictがfalseのときにデッドロックを監視するためのタイムアウト時間をミリ秒単位で指定します。デフォルト値は5000、すなわち5秒です。0を指定するとタイムアウトしなくなります。</td> + </tr> + <tr> + <th><label>{$message.descReplication_stop_on_mismatch|escape}</label> + <br>replication_stop_on_mismatch</th> + <td>trueを指定するとマスタとセカンダリの間でデータの不一致があった場合に強制的に縮退運転に入ります。このオプションがfalseの場合は、該当の問い合わせを強制的に終了するだけに留めます。デフォルト値はfalseです。</td> + </tr> + + <tr> + <th><label>{$message.descReset_query_list|escape}</label> + <br>reset_query_list (string)</th> + <td>セッションが終了するときにコネクションを初期化するためのSQLコマンドを「;」で区切って列挙します。デフォルトは以下のようになっていますが、任意のSQL文を追加しても構いません。 + <p>reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'</p> +PostgreSQLのバージョンによって使用できるSQLコマンドが違うので、PostgreSQL 7.3以前では注意してください(「4. pgpoolの稼働環境」参照)。<br />なお、「ABORT」は、PostgreSQL 7.4以上ではトランザクションブロックの中にいない場合には発行されません。 + </td> + </tr> + + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + </table> + <h3><a name="health-check">Health Check</a></h3> + + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + </tr> + </thead> + <tbody> + + <tr> + <th><label>{$message.descHealth_check_timeout|escape}</label> + <br>health_check_timeout (integer)</th> + <td> pgpoolはサーバ障害やネットワーク障害を検知するために、定期的にバックエンドに接続を試みます。これを「ヘルスチェック」と言います。障害が検知されると、フェイルオーバや縮退運転を試みます。<br />この パラメータは、ネットワークケーブルが抜けた際などにヘルスチェックが長時間待たされるのを防ぐためのタイムアウト値を秒単位で指定します。デフォルトは20秒です。0を指定するとタイムアウト処理をしません。<br />なお、ヘルスチェックを有効にすると、ヘルスチェックのための余分の接続が1つ必要になりますので、PostgreSQLのpostgresql.confの設定項目のmax_connectionsを少くとも1増やすようにしてください</td> + </tr> + <tr> + + <th><label>{$message.descHealth_check_period|escape}</label> + <br>health_check_period (integer)</th> + <td>ヘルスチェックを行う間隔を秒単位で指定します。0を指定するとヘルスチェックを行いません。デフォルトは0です(つまりヘルスチェックを行いません)。 + </td> + </tr> + <tr> + <th><label>{$message.descHealth_check_user|escape}</label> + <br>health_check_user (string)</th> + + <td>ヘルスチェックを行うためのPostgreSQLユーザ名です。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + + </table> + <h3><a name="system-database">System Database</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descSystem_db_hostname|escape}</label> + <br>system_db_hostname (string)</th> + <td>システムDBが稼働しているホスト名を指定します。指定しない場合にはUnix domain socketで接続します。</td> + </tr> + + <tr> + <th><label>{$message.descSystem_db_port|escape}</label> + <br>system_db_port (integer)</th> + <td>システムDBがあるPostgreSQLに接続するためのポート番号を指定します。</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_dbname|escape}</label> + <br>system_db_dbname (string)</th> + <td>システムDBのデータベース名を指定します。</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_schema|escape}</label> + <br>system_db_schema (string)</th> + <td>システムDBのスキーマを指定します。</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_user|escape}</label> + <br>system_db_user (string)</th> + <td>システムDBに接続するユーザ名を指定します。</td> + </tr> + <tr> + <th><label>{$message.descSystem_db_password|escape}</label> + <br>system_db_password (string)</th> + <td>システムDBに接続するユーザのパスワードを指定します。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + + </tfoot> + </table> + <h3><a name="others">Others</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strDetail|escape}</th> + + </tr> + </thead> + <tbody> + <tr> + <th><label>{$message.descLoad_balance_mode|escape}</label> + <br>load_balance_mode</th> + <td>trueを指定するとレプリケーションモードの際に、SELECT文をマスタとセカンダリの間でロードバランスします。デフォルト値はfalseです</td> + + </tr> + <tr> + <th><label>{$message.descMaster_slave_mode|escape}</label> + <br>master_slave_mode</th> + <td> trueならばマスタ/スレーブモードでpgpoolを運転します。デフォルトはfalseです。このモードはreplication_modeとは両立しません。</td> + </tr> + <tr> + + <th><label>{$message.descInsert_lock|escape}</label> + <br>insert_lock</th> + <td> +SERIAL型を使っているテーブルをレプリケーションすると、SERIAL型の列の値がマスタとセカンダリで一致しなくなることがあります。この問題は、該当テーブルを明示的にロックすることで回避できます(もちろんトランザ +クションの並列実行性は犠牲になりますが)。しかし、そのためには、 +<p> +INSERT INTO ... +</p> +<p> +を +</p> +<p> +BEGIN;<br /> + +LOCK TABLE ...<br /> +INSERT INTO ...<br /> +COMMIT; +</p> +<p> + に書き換えなければなりません。insert_lockをtrueにすると自動的にトランザクションの開始、テーブルロック、トランザクションの終了を行ってくれるので、こうした手間を省くことができます(すでにトランザクションが開始されている場合はLOCK TABLE...だけが実行されます)。 + + </td> + </tr> + <tr> + <th><label>{$message.descIgnore_leading_white_space|escape}</label> + <br>ignore_leading_white_space</th> + <td>trueならば、load balanceの際にSQL文行頭の空白を無視します(全角スペースは無視されません)。これは、DBI/DBD:Pgのように、勝手に行頭にホワイトスペースを追加するようなAPIを使い、ロードバランスしたいときに有効です</td> + </tr> + <tr> + <th><label>{$message.descParallel_mode|escape}</label> + <br>parallel_mode</th> + <td>pgpoolをパラレルモードで稼働させる場合にはtrueを指定します。この場合には分散ルールを指定する必要があります。</td> + + </tr> + <tr> + <th><label>{$message.descLog_statement|escape}</label> + <br>log_statement</th> + <td>trueならばSQL文をログ出力します。この役目はPostgreSQLのlog_statementオプションと似ていて、デバッグオプションがないときでも問い合わせをログ出力して調べることができるので便利です。</td> + </tr> + <tr> + + <th><label>{$message.descEnable_query_cache|escape}</label> + <br>enable_query_cache</th> + <td>SELECTの結果をキャッシュする場合にはtrueにします。</td> + </tr> + </tbody> + <tfoot> + <tr> + <td colspan="2"></td> + + </tr> + </tfoot> + </table> +</div> +<hr class="hidden" /> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/queryCache.tpl b/templates/help/ja/queryCache.tpl new file mode 100644 index 0000000..d589a19 --- /dev/null +++ b/templates/help/ja/queryCache.tpl @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strQueryCache|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>ヘルプ({$message.strQueryCache|escape})</h2> + <h3>{$message.strSummary|escape}</h3> + <p>enable_query_cache = true の場合に、SELECT 文の結果をキャッシュさせます。</p> + <h3>{$message.strFeature|escape}</h3> + <p>クエリキャッシュのデータを検索することができます。検索対象は、クエリ文字列とデータベース名で、部分一致検索を行うことができます。クエリ文字列とデータベース名はAND検索になります。</p> + <table> + <tbody> + <tr> {if $deleteRow > 0} + <tr> + <td colspan="5">{$deleteRow|escape}{$message.strDeleted|escape}</td> + </tr> + {/if} + <tr> + <td nowrap="nowrap" class="column">{$message.strQueryStr|escape}</td> + <td><input name="qQueryStr" type="text" id="qQueryStr" size="50" value="{$qQueryStr|escape}"/> + </td> + </tr> + <tr> + <td nowrap="nowrap" class="column">{$message.strDb|escape}</td> + <td><input name="qDb" type="text" id="qDb" size="50" value="{$qDb|escape}"/></td> + </tr> + </tbody> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="search" value="{$message.strSearch|escape}" /> + <input type="submit" name="clear" value="{$message.strClear|escape}" /> + </td></tr> + </table> + <h3>クエリキャッシュリスト</h3> + <p>現在キャッシュされているクエリ文字列、データベース名、作成時刻が表示されます。「クエリ文字列」、「データベース名」および「作成時刻」をクリックすると、並べ替えが行われます。クリックするたびに、昇順または降順で並べ替えが行われます。</p> + <p>削除したいデータの左にあるチェックボックスにチェックを入れて、削除ボタンを押すと削除されます。一番上のチェックボックスにチェックするとすべてのレコードが選択されます。</p> + <table> + <tbody> + <tr> + <th><input type="checkbox" name="all" value="" /></th> + <th>{$message.strQueryStr|escape}</th> + <th>{$message.strDb|escape}</th> + <th>{$message.strCreateTime|escape}</th> + </tr> + </tbody> + <tfoot> + <tr><td colspan="4"> + <input type="submit" name="ButtonName" value="{$message.strDelete|escape}" /> + </td></tr> + </table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</html> diff --git a/templates/help/ja/status.tpl b/templates/help/ja/status.tpl new file mode 100644 index 0000000..cd8cb1e --- /dev/null +++ b/templates/help/ja/status.tpl @@ -0,0 +1,113 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgpoolStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> +<h2>ヘルプ({$message.strStatus|escape})</h2> +<h3>概要</h3> +ステータスでは、pgpoolについて +<ul> + <li>サマリー</li> + <li>プロセス情報</li> + <li>ノード情報</li> + <li>ログ</li> +</ul> +の表示とpgpoolの +<ul> + <li>起動</li> + <li>停止</li> + <li>再起動</li> +</ul> +を行うことができます。 +<h3>説明</h3> + +<table> + <tr> + <th class="right_border"><label>サマリー</label></th> + <td>pgpool.confの内容を表示します。</td> + </tr> + <tr> + <th class="right_border"><label>プロセス情報</label></th> + <td><p>pgppolの各プロセスについて</p> + <ul> + <li>プロセスID</li> + <li>データベース名</li> + <li>接続ユーザ名</li> + <li>プロセススタート時刻</li> + <li>コネクション作成時刻</li> + <li>プロトコルメジャーバージョン</li> + <li>プロトコルマイナーバージョン</li> + <li>コネクション使用回数</li> + </ul> + <p>が表示されます。<br /> + 各プロセスについて、最大でpgpool.confのmax_pool分だけ表示されます。 + </p></td> + </tr> + <tr> + <th class="right_border"><label>ノード情報</label></th> + <td><p>各ノードについて</p> + <ul> + <li>IPアドレス</li> + <li>ボート番号</li> + <li>ステータス</li> + <li>負荷分散ウェイト</li> + <li>切断ボタン</li> + </ul> + <p>が表示されます。ただし、pgpoolがパラレルモードで動いているときは、切断ボタンは表示されません。</p> + <p>ステータスには</p> + <ul> + <li>ノード稼働中。接続無し</li> + <li>ノード稼働中。接続中</li> + <li>ノードダウン</li> + </ul> + <p>の3つの状態が表示されます。</p></td> + </tr> + <tr> + <th class="right_border"><label>ログ</label></th> + <td>pgpool非デーモンモード(-n)で起動されているときに、pgpoolのログを表示することができます。</td> + </tr> + <tr> + <th class="right_border"><label>起動</label></th> + <td>pgpoolの停止時には、pgpoolを起動することができます。起動オプションとして + <ul> + <li>クエリキャッシュクリア</li> + <li>非デーモンモード</li> + <li>デバッグモード</li> + <li>pgpool.conf</li> + <li>pcp.conf</li> + </ul> + を指定することかできます。 + </td> + </tr> + <tr> + <th class="right_border"><label>停止</label></th> + <td>pgpoolのすべてのプロセスを終了します。pgpool停止ボタンを押すと、終了オプションが表示されます。停止モードとして + <ul> + <li>smart</li> + <li>fast</li> + <li>immediate</li> + </ul> + を選択することができます。終了すると、pgpoolステータスが「pgpool停止」となり、起動用画面が表示されます。</td> + </tr> + <tr> + <th class="right_border"><label>再起動</label></th> + <td>pgpoolのすべてのプロセスを終了し続けて起動処理をします。上記の起動と停止の両方の項目を指定することができます。</td> + </tr> +</table> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/help/ja/systemDb.tpl b/templates/help/ja/systemDb.tpl new file mode 100644 index 0000000..cb10cb1 --- /dev/null +++ b/templates/help/ja/systemDb.tpl @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSystemDb|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="{$help|escape}.php"><img src="images/back.gif" />{$message.strBack|escape}</a></div> + <h2>{$message.strHelp|escape}({$message.strSystemDb|escape})</h2> + <h3>{$message.strSummary|escape}</h3> +pgpool.confのparallel_mode=trueの場合に並列問い合わせの設定を定義します。 + <h3>{$message.strFeature|escape}</h3> +各カラムのデータ型は以下のとおりです。<p /> +<table> + <tr> + <th class="right_border"><label>カラム名</label></th> + <th class="right_border"><label>データ型</label></th> + <th><label>説明</label></th> + </tr> + <tr> + <th class="right_border"><label>{$message.strDbName|escape}</label></th> + <td class="right_border">TEXT</td> + <td>分散を行うデータベース名</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strSchemaName|escape}</label></th> + <td class="right_border">TEXT</td> + <td>データベースのスキーマ名</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strTable|escape}</label></th> + <td class="right_border">TEXT</td> + <td>分散を行うテープル</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strColName|escape}</label></th> + <td class="right_border">TEXT</td> + <td>分散キーとなる列名</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strColList|escape}</label></th> + <td class="right_border">TEXT[]</td> + <td>データを分散させるテーブルの列名リスト</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strTypeList|escape}</label></th> + <td class="right_border">TEXT[]</td> + <td>列名に対する型のリスト</td> + </tr> + <tr> + <th class="right_border"><label>{$message.strDistDefFunc|escape}</label></th> + <td class="right_border">TEXT</td> + <td>分散ルールを定義した関数名</td> + </tr> +</table> +<p /> +<h3>追加</h3> +すべてのカラムに値を入力して「追加」ボタンを押します。<br /> +列名リストと列データ型リストについては、各要素をシングルクォーテーションで囲み、各要素をカンマで区切ってください。 +<h3>更新</h3> +更新したい定義のデータベース名をクリックしてください。入力フィールドに値が表示されますので修正して「更新」ボタンを押してください。ただし、データベース名、スキーマ名、テーブル名は変更できません。 +<h3>削除</h3> +削除したい定義のデータベース名をクリックしてください。「削除」ボタンを押してください。確認ダイアログが表示されますので「OK」ボタンを押してください。 +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/innerError.tpl b/templates/innerError.tpl new file mode 100644 index 0000000..829717e --- /dev/null +++ b/templates/innerError.tpl @@ -0,0 +1,22 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeInfo|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> + <table> + <tr> + <th><label>{$message.strErrorCode|escape}</label></th> + <td>{$errorCode|escape}</td> + </tr> + <tr> + <th><label>{$message.strErrorMessage|escape}</label></th> + <td>{$message.$errorCode|escape}</td> + </tr> + </td> + </tr> + </table> +</body> +</html> diff --git a/templates/innerLog.tpl b/templates/innerLog.tpl new file mode 100644 index 0000000..8735268 --- /dev/null +++ b/templates/innerLog.tpl @@ -0,0 +1,32 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<table> + <thead> + </thead> + <tbody> + {section name=num loop=$logFile} + {if $logFile[num][2] == 'ERROR:' } + <tr class="error"> + {elseif ($smarty.section.num.index+1) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td>{$logFile[num][0]|escape}</td> + <td>{$logFile[num][1]|escape}</td> + <td>{$logFile[num][2]|escape}</td> + <td>{$logFile[num][3]|escape}</td> + <td>{$logFile[num][4]|escape}</td> + <td>{$logFile[num][5]|escape}</td> + <td></td> + {/section} + </tbody> +</table> +</body> +</html> diff --git a/templates/innerNodeServerStatus.tpl b/templates/innerNodeServerStatus.tpl new file mode 100644 index 0000000..4f4284f --- /dev/null +++ b/templates/innerNodeServerStatus.tpl @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +{if $nodeCount > 0} +<table> + <thead> + <tr> + <th><label>{$message.strIPaddress|escape}</label></th> + <th><label>{$message.strPort|escape}</label></th> + <th><label>{$message.strStatus|escape}</label></th> + <th></th> + </thead> + <tbody> + {section name=num loop=$nodeServerStatus} + {if ($smarty.section.num.index+1) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td class="input">{$nodeServerStatus[num].hostname|escape}</td> + <td class="input">{$nodeServerStatus[num].port|escape}</td> + <td class="input"> + {if $nodeServerStatus[num].status == true} + {$message.strUp|escape} + </td> + <td><input type="button" name="detail" value="{$message.strDetail}" onclick="showDetail({$smarty.section.num.index})" /></td> + {else} + {$message.strDown|escape} + </td> + <td></td> + {/if} + {/section} + </tbody> +</table> +{else} +{$message.strNoNode|escape} +{/if} +</body> +</html> diff --git a/templates/innerSummary.tpl b/templates/innerSummary.tpl new file mode 100644 index 0000000..1237bc5 --- /dev/null +++ b/templates/innerSummary.tpl @@ -0,0 +1,59 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<h3>{$message.strPgpoolSummary|escape}</h3> +<table> + <tbody> + <tr><td>{$message.strParallelMode|escape}</td> + <td> + {if $params.parallel_mode == 'true'} + {$message.strPgpool2|escape} + {else} + {$message.strPgpool1|escape} + {/if} + </td></tr> + <tr><td>{$message.strQueryCache|escape}</td> + <td> + {if $params.enable_query_cache == 'true'} + {$message.strOn|escape} + {else} + {$message.strOff|escape} + {/if} + </td></tr> + <tr><td>{$message.strReplicationMode|escape}</td> + <td> + {if $params.parallel_mode == 'true'} + {$message.strInvalidation|escape} + {elseif $params.replication_mode == 'true'} + {$message.strOn|escape} + {else} + {$message.strOff|escape} + {/if} + </td></tr> + <tr><td>{$message.strLoadBalanceMode|escape}</td> + <td> + {if $params.parallel_mode == 'true'} + {$message.strInvalidation|escape} + {elseif $params.load_balance_mode == 'true'} + {$message.strOn|escape} + {else} + {$message.strOff|escape} + {/if} + </td></tr> + <tr><td>{$message.strHealthCheck|escape}</td> + <td> + {if $params.health_check_period == 0} + {$message.strInvalidation|escape} + {else} + {$message.strOn|escape} + {/if} + </td></tr> + </tbody> +</table> +</body> +</html> diff --git a/templates/innerSystemCatalog.tpl b/templates/innerSystemCatalog.tpl new file mode 100644 index 0000000..be491fd --- /dev/null +++ b/templates/innerSystemCatalog.tpl @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<h2>{$message.strDetailInfo|escape}</h2> +<table> + <thead> + <tr> + <th><label>{$message.strIPaddress|escape}</label></th> + <th><label>{$message.strPort|escape}</label></th> + <th><label>{$message.strTable|escape}</label></th> + </tr> + </thead> + <tbody> + <tr><td>{$hostname|escape}</td><td>{$port|escape}</td><td>{$catalog|escape}</td></tr> + </tbody> +</table> +<p> +<table> + <thead> + <tr> + {foreach from=$results[0] key=column item=value} + <th><label>{$column|escape}</label></th> + {/foreach} + </tr> + </thead> + <tbody> + {section name=num loop=$results} + {if ($smarty.section.num.index+1) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + {foreach from=$results[num] item=value} + <td class="input">{$value|escape}</td> + {/foreach} + </tr> + {/section} + </tbody> +</table> +</body> +</html> diff --git a/templates/login.tpl b/templates/login.tpl new file mode 100644 index 0000000..576133c --- /dev/null +++ b/templates/login.tpl @@ -0,0 +1,43 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strLogin|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +</div> +<div id="content"> +<div id="help"> +<a href="help.php?help=login"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a> +</div> + <h2>{$message.strLogin|escape}</h2> + <form action="login.php" method="post" name="Login"> + <table> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="Button" value="{$message.strLogin|escape}" /> + </td></tr> + </tfoot> + <tbody> + <tr> + <th><label>{$message.strLoginName|escape}</label></th> + <td><input id="username" name="username" type="text" size="25" /></td> + </tr> + <tr> + <th><label>{$message.strPassword|escape}</label></th> + <td><input id="password" name="password" type="password" size="25" /></td> + </tr> + </tbody> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/menu.tpl b/templates/menu.tpl new file mode 100644 index 0000000..63b1b4a --- /dev/null +++ b/templates/menu.tpl @@ -0,0 +1,16 @@ + <ul> + {if $isLogin == 'true'} + <li><strong><a href="status.php">{$message.strPgpoolStatus|escape}</a></strong></li> + <li><a href="nodeServerStatus.php">{$message.strNodeStatus|escape}</a></li> + <li><a href="queryCache.php">{$message.strQueryCache|escape}</a></li> + <li><a href="systemDb.php">{$message.strSystemDb|escape}</a></li> + <li><a href="pgconfig.php">{$message.strPgConfSetting|escape}</a></li> + <li><a href="config.php">{$message.strSetting|escape}</a></li> + <li><a href="changePassword.php">{$message.strChangePassword|escape}</a></li> + <li><a href="logout.php">{$message.strLogout|escape}</a></li> + {/if} + {if $isHelp == 'true'} + <li><a href="help.php?help=errorCode">{$message.strErrorCode|escape}</a></li> + {/if} + </ul> +
\ No newline at end of file diff --git a/templates/nodeServerStatus.tpl b/templates/nodeServerStatus.tpl new file mode 100644 index 0000000..eb94ddd --- /dev/null +++ b/templates/nodeServerStatus.tpl @@ -0,0 +1,88 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript"> +<!-- +{literal} +function load() { + var xmlhttp = false; + + if (typeof XMLHttpRequest!='undefined') + xmlhttp = new XMLHttpRequest(); + else + xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); + + if (!xmlhttp) { + alert('Sorry, cannot use XMLHttpRequest'); + return; + } + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var content = document.getElementById('status'); + var ret = xmlhttp.responseText; + + content.innerHTML = ret; + } + } + xmlhttp.open('GET', 'innerNodeServerStatus.php', true); + xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT"); + xmlhttp.send(""); +} + +function showDetail(num) { + var catalog = "pg_settings"; + var xmlhttp = false; + var url = ""; + + if (typeof XMLHttpRequest!='undefined') + xmlhttp = new XMLHttpRequest(); + else + xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); + + if (!xmlhttp) { + alert('Sorry, cannot use XMLHttpRequest'); + return; + } + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var content = document.getElementById('detailInfo'); + var ret = xmlhttp.responseText; + + content.innerHTML = ret; + } + } + url = "innerSystemCatalog.php?num=" + num + "&catalog=" + catalog; + xmlhttp.open('GET', url, true); + xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT"); + xmlhttp.send(""); +} + +// --> +</script> +{/literal} +</head> +<body onload="load()"> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> +<h2>{$message.strNodeStatus|escape}</h2> + <div id="status">{$message.strPleaseWait|escape}</div> +<p> + <div id="detailInfo"></div> +</p> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/nodeStatus.tpl b/templates/nodeStatus.tpl new file mode 100644 index 0000000..2390dc8 --- /dev/null +++ b/templates/nodeStatus.tpl @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strNodeInfo|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<h3>{$message.strNodeInfo|escape}</h3> +{if $nodeCount > 0} +<table> + <tr> + <th><label>{$message.strIPaddress|escape}</label></th> + <th><label>{$message.strPort|escape}</label></th> + <th><label>{$message.strStatus|escape}</label></th> + {if $parallelMode == false} + <th><label>{$message.strWeight|escape}</label></th> + {/if} + <th></th> + </tr> + {section name=num loop=$nodeInfo} + {if ($smarty.section.num.index+1) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td>{$nodeInfo[num][0]|escape}</td> + <td>{$nodeInfo[num][1]|escape}</td> + <td> + {if $nodeInfo[num][2] == 1} + {$message.strNodeStatus1|escape} + {elseif $nodeInfo[num][2] == 2} + {$message.strNodeStatus2|escape} + {elseif $nodeInfo[num][2] == 3} + {$message.strNodeStatus3|escape} + {/if} + </td> + {if $parallelMode == false} + <td>{$nodeInfo[num][3]|escape}</td> + {/if} + <td> + {if $nodeInfo[num][4] == 'disconnect'} + <input type="button" name="command" onclick="sendCommand('detach', {$smarty.section.num.index|escape})" value="{$message.strDisconnect|escape}" /> + {elseif $nodeInfo[num][4] == 'return'} + <input type="button" name="command" onclick="sendCommand('return', {$smarty.section.num.index|escape})" value="{$message.strReturn|escape}" /> + {/if} + </td> + </tr> + {/section} +</table> +{else} +{$message.strNoNode|escape} +{/if} +</body> +</html> diff --git a/templates/pgconfig.tpl b/templates/pgconfig.tpl new file mode 100644 index 0000000..04a0c3a --- /dev/null +++ b/templates/pgconfig.tpl @@ -0,0 +1,647 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgConfSetting|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript"> +<!-- +var msgDeleteConfirm = "{$message.msgDeleteConfirm|escape}"; +{literal} +function update(){ + document.pgconfig.action.value= "update"; + document.pgconfig.submit(); +} + +function resetData(){ + document.pgconfig.action.value= "reset"; + document.pgconfig.submit(); +} + +function del(num){ + if(window.confirm(msgDeleteConfirm)){ + document.pgconfig.action.value= "delete"; + document.pgconfig.num.value = num; + document.pgconfig.submit(); + } +} + +function addNode() { + document.pgconfig.action.value= "add"; + document.pgconfig.submit(); +} + +function cancelNode() { + document.pgconfig.action.value= "cancel"; + document.pgconfig.submit(); +} + +// --> +</script> +{/literal} +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + {if $status == 'success'} + <table> + <tr> + <td>{$message.msgUpdateComplete|escape}</td> + </tr> + </table> + {elseif $status == 'fail'} + <table> + <tr> + <td>{$message.msgUpdateFailed|escape}</td> + </tr> + </table> + {/if} + <h2>{$message.strPgConfSetting|escape}</h2> + <div id="submenu"> + <h3>Table of Contents</h3> + <ul> + <li><a href="#connections">Connections</a></li> + <li><a href="#backends">Backends</a></li> + <li><a href="#pcp">PCP</a></li> + <li><a href="#logging">Logging</a></li> + <li><a href="#replication">Replication</a></li> + <li><a href="#health-check">Health Check</a></li> + <li><a href="#system-database">System Database</a></li> + <li><a href="#others">Others</a></li> + </ul> + </div> + <form name="pgconfig" method="post" action="pgconfig.php"> + <input type="hidden" name="action" value="" /> + <input type="hidden" name="num" value="" /> + <h3><a name="connections" id="connections">Connections</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.listen_addresses != null} + <th class="error"><label>{$message.descListen_addresses|escape}</label> + <br />listen_addresses (string)</th> + {else} + <th><label>{$message.descListen_addresses|escape}</label> + <br />listen_addresses (string)</th> + {/if} + <td><input type="text" name="listen_addresses" value="{$params.listen_addresses|escape}"/></td> + </tr> + <tr> {if $error.port != null} + <th class="error"><label>{$message.descPort|escape}</label> + <br />port (integer)</th> + {else} + <th><label>{$message.descPort|escape}</label> + <br />port (integer)</th> + {/if} + <td><input type="text" name="port" value="{$params.port|escape}"/></td> + </tr> + <tr> {if $error.socket_dir != null} + <th class="error"><label>{$message.descSocket_dir|escape}</label> + <br />socket_dir (string)</th> + {else} + <th><label>{$message.descSocket_dir|escape}</label> + <br />socket_dir (string)</th> + {/if} + <td><input type="text" name="socket_dir" value="{$params.socket_dir|escape}"/></td> + </tr> + <tr> {if $error.num_init_children != null} + <th class="error"><label>{$message.descNum_init_children|escape}</label> + <br />num_init_children (integer)</th> + {else} + <th><label>{$message.descNum_init_children|escape}</label> + <br />num_init_children (integer)</th> + {/if} + <td><input type="text" name="num_init_children" value="{$params.num_init_children|escape}"/></td> + </tr> + <tr> {if $error.max_pool != null} + <th class="error"><label>{$message.descMax_pool|escape}</label> + <br />max_pool (integer)</th> + {else} + <th><label>{$message.descMax_pool|escape}</label> + <br />max_pool (integer)</th> + {/if} + <td><input type="text" name="max_pool" value="{$params.max_pool|escape}"/></td> + </tr> + <tr> {if $error.child_life_time != null} + <th class="error"><label>{$message.descChild_life_time|escape}</label> + <br />child_life_time (integer)</th> + {else} + <th><label>{$message.descChild_life_time|escape}</label> + <br />child_life_time (integer)</th> + {/if} + <td><input type="text" name="child_life_time" value="{$params.child_life_time|escape}"/></td> + </tr> + <tr> {if $error.connection_life_time != null} + <th class="error"><label>{$message.descConnection_life_time|escape}</label> + <br />connection_life_time (integer)</th> + {else} + <th><label>{$message.descConnection_life_time|escape}</label> + <br />connection_life_time (integer)</th> + {/if} + <td><input type="text" name="connection_life_time" value="{$params.connection_life_time|escape}"/></td> + </tr><tr> {if $error.child_max_connections != null} + <th class="error"><label>{$message.descChild_max_connections|escape}</label> + <br />child_max_connections (integer)</th> + {else} + <th><label>{$message.descChild_max_connections|escape}</label> + <br />child_max_connections (integer)</th> + {/if} + <td><input type="text" name="child_max_connections" value="{$params.child_max_connections|escape}"/></td> + </tr> + <tr> {if $error.connection_cache != null} + <th class="error"><label>{$message.descConnection_cache|escape}</label> + <br />connection_cache</th> + {else} + <th><label>{$message.descConnection_cache|escape}</label> + <br />connection_cache</th> + {/if} + {if $params.connection_cache == 'true'} + <td><input type="checkbox" name="connection_cache" id="connection_cache" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="connection_cache" id="connection_cache" value="false" /></td> + {/if} </tr> + <tr> {if $error.pgpool2_hostname != null} + <th><label>{$message.descPgpool2_hostname|escape}</label> + <br />pgpool2_hostname (string)</th> + {else} + <th><label>{$message.descPgpool2_hostname|escape}</label> + <br />pgpool2_hostname (string)</th> + {/if} + <td><input type="text" name="pgpool2_hostname" value="{$params.pgpool2_hostname|escape}"/></td> + </tr> + </tbody> + </table> + <h3><a name="backends" id="backends">Backends</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + <td></td> + </tr> + </thead> + {if $isAdd == true} + <tfoot> + <tr> + <td colspan="2"><input type="button" name="cancel" value="{$message.strCancel|escape}" onclick="cancelNode()" /></td> + </tr> + </tfoot> + {else} + <tfoot> + <tr> + <td colspan="2"><input type="button" name="add" value="{$message.strAdd|escape}" onclick="addNode()" /></td> + </tr> + </tfoot> + {/if} + <tbody> + <tr> {if $error.backend_socket_dir != null} + <th class="error"><label>{$message.descBackend_socket_dir|escape}</label> + <br />backend_socket_dir (string)</th> + {else} + <th><label>{$message.descBackend_socket_dir|escape}</label> + <br />backend_socket_dir (string)</th> + {/if} + <td><input type="text" name="backend_socket_dir" value="{$params.backend_socket_dir|escape}"/></td> + <td></td> + </tr> + {section name=num loop=$params.backend_hostname} + <tr> {if $error.backend_hostname[num] != null} + <th class="error"><label>{$message.descBackend_hostname|escape}</label> + <br />backend_hostname{$smarty.section.num.index} (string)</th> + {else} + <th><label>{$message.descBackend_hostname|escape}</label> + <br />backend_hostname{$smarty.section.num.index} (string)</th> + {/if} + <td><input type="text" name="backend_hostname[]" value="{$params.backend_hostname[num]|escape}" /></td> + <td rowspan="3"><input type="button" name="delete" value="{$message.strDelete|escape}" onclick="del({$smarty.section.num.index})" /></td> + </tr> + <tr> {if $error.backend_port[num] != null} + <tr><th class="error"><label>{$message.descBackend_port|escape}</label> + <br />backend_port{$smarty.section.num.index|escape} (integer)</th> + {else} + <th><label>{$message.descBackend_port|escape}</label> + <br />backend_port{$smarty.section.num.index|escape} (integer)</th> + {/if} + <td><input type="text" name="backend_port[]" value="{$params.backend_port[num]|escape}" /></td> + </tr> + <tr> {if $error.backend_weight[num] != null} + <th class="error"><label>{$message.descBackend_weight|escape}</label> + <br />backend_weight{$smarty.section.num.index|escape} (float)</th> + {else} + <th><label>{$message.descBackend_weight|escape}</label> + <br />backend_weight{$smarty.section.num.index|escape} (float)</th> + {/if} + <td><input type="text" name="backend_weight[]" value="{$params.backend_weight[num]|escape}" /></td> + </tr> + {/section} + {if $isAdd == true} + <tr> + <th><label>new backend_hostname</label> + (string)</th> + <td><input type="text" name="backend_hostname[]" value="" /></td> + <td rowspan="3"></td> + </tr> + <tr><th><label>new backend_port</label> + (integer)</th> + <td><input type="text" name="backend_port[]" value="" /></td> + </tr> + <tr> + <th><label>new backend_weight</label> + (float)</th> + <td><input type="text" name="backend_weight[]" value="" /></td> + </tr> + {/if} + </tbody> + </table> + <h3><a name="pcp" id="pcp">PCP (pgpool Control Port)</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.pcp_port != null} + <th class="error"><label>{$message.descPcp_port|escape}</label> + <br />pcp_port (integer)</th> + {else} + <th><label>{$message.descPcp_port|escape}</label> + <br />pcp_port (integer)</th> + {/if} + <td><input type="text" name="pcp_port" value="{$params.pcp_port|escape}"/></td> + </tr> + <tr> {if $error.pcp_socket_dir != null} + <th class="error"><label>{$message.descPcp_socket_dir|escape}</label> + <br />pcp_socket_dir (string)</th> + {else} + <th><label>{$message.descPcp_socket_dir|escape}</label> + <br />pcp_socket_dir (string)</th> + {/if} + <td><input type="text" name="pcp_socket_dir" value="{$params.pcp_socket_dir|escape}"/></td> + </tr> + <tr> {if $error.pcp_timeout != null} + <th class="error"><label>{$message.descPcp_timeout|escape}</label> + <br />pcp_timeout (integer)</th> + {else} + <th><label>{$message.descPcp_timeout|escape}</label> + <br />pcp_timeout (integer)</th> + {/if} + <td><input type="text" name="pcp_timeout" value="{$params.pcp_timeout|escape}"/></td> + </tr> + </tbody> + </table> + <h3><a name="logging" id="logging">Logging</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.logdir != null} + <th class="error"><label>{$message.descLogdir|escape}</label> + <br />logdir (string)</th> + {else} + <th><label>{$message.descLogdir|escape}</label> + <br />logdir (string)</th> + {/if} + <td><input type="text" name="logdir" value="{$params.logdir|escape}"/></td> + </tr> + <tr> {if $error.print_timestamp != null} + <th><label>{$message.descPrint_timestamp|escape}</label> + <br />print_timestamp</th> + {else} + <th><label>{$message.descPrint_timestamp|escape}</label> + <br />print_timestamp</th> + {/if} + {if $params.print_timestamp == 'true'} + <td><input type="checkbox" name="print_timestamp" id="print_timestamp" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="print_timestamp" id="print_timestamp" value="false" /></td> + {/if} </tr> + </tbody> + </table> + <h3><a name="replication" id="replication">Replication</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.replication_mode != null} + <th class="error"><label>{$message.descReplication_mode|escape}</label> + <br />replication_mode</th> + {else} + <th><label>{$message.descReplication_mode|escape}</label> + <br />replication_mode</th> + {/if} + {if $params.replication_mode == 'true'} + <td><input type="checkbox" name="replication_mode" id="replication_mode" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="replication_mode" id="replication_mode" value="false" /></td> + {/if} </tr> + <tr> {if $error.replication_strict != null} + <th class="error"><label>{$message.descReplication_strict|escape}</label> + <br />replication_strict</th> + {else} + <th><label>{$message.descReplication_strict|escape}</label> + <br />replication_strict</th> + {/if} + {if $params.replication_strict == 'true'} + <td><input type="checkbox" name="replication_strict" id="replication_strict" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="replication_strict" id="replication_strict" value="false" /></td> + {/if} + </tr> + <tr> {if $error.replication_timeout != null} + <th class="error"><label>{$message.descReplication_timeout|escape}</label> + <br />replication_timeout (integer)</th> + {else} + <th><label>{$message.descReplication_timeout|escape}</label> + <br />replication_timeout (integer)</th> + {/if} + <td><input type="text" name="replication_timeout" value="{$params.replication_timeout|escape}"/></td> + </tr> + <tr> {if $error.replication_stop_on_mismatch != null} + <th class="error"><label>{$message.descReplication_stop_on_mismatch|escape}</label> + <br />replication_stop_on_mismatch</th> + {else} + <th><label>{$message.descReplication_stop_on_mismatch|escape}</label> + <br />replication_stop_on_mismatch</th> + {/if} + {if $params.replication_stop_on_mismatch == 'true'} + <td><input type="checkbox" name="replication_stop_on_mismatch" id="replication_stop_on_mismatch" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="replication_stop_on_mismatch" id="replication_stop_on_mismatch" value="false" /></td> + {/if} </tr> + <tr> {if $error.reset_query_list != null} + <th class="error"><label>{$message.descReset_query_list|escape}</label> + <br />reset_query_list (string)</th> + {else} + <th><label>{$message.descReset_query_list|escape}</label> + <br />reset_query_list (string)</th> + {/if} + <td><input type="text" name="reset_query_list" value="{$params.reset_query_list|escape}"/></td> + </tr> + </tbody> + </table> + <h3><a name="health-check" id="health-check">Health Check</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.health_check_timeout != null} + <th class="error"><label>{$message.descHealth_check_timeout|escape}</label> + <br />health_check_timeout (integer)</th> + {else} + <th><label>{$message.descHealth_check_timeout|escape}</label> + <br />health_check_timeout (integer)</th> + {/if} + <td><input type="text" name="health_check_timeout" value="{$params.health_check_timeout|escape}"/></td> + </tr> + <tr> {if $error.health_check_period != null} + <th class="error"><label>{$message.descHealth_check_period|escape}</label> + <br />health_check_period (integer)</th> + {else} + <th><label>{$message.descHealth_check_period|escape}</label> + <br />health_check_period (integer)</th> + {/if} + <td><input type="text" name="health_check_period" value="{$params.health_check_period|escape}"/></td> + </tr> + <tr> {if $error.health_check_user != null} + <th class="error"><label>{$message.descHealth_check_user|escape}</label> + <br />health_check_user (string)</th> + {else} + <th><label>{$message.descHealth_check_user|escape}</label> + <br />health_check_user (string)</th> + {/if} + <td><input type="text" name="health_check_user" value="{$params.health_check_user|escape}"/></td> + </tr> + </tbody> + </table> + <h3><a name="system-database" id="system-database">System Database</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.system_db_hostname != null} + <th class="error"><label>{$message.descSystem_db_hostname|escape}</label> + <br />system_db_hostname (string)</th> + {else} + <th><label>{$message.descSystem_db_hostname|escape}</label> + <br />system_db_hostname (string)</th> + {/if} + <td><input type="text" name="system_db_hostname" value="{$params.system_db_hostname|escape}"/></td> + </tr> + <tr> {if $error.system_db_port != null} + <th class="error"><label>{$message.descSystem_db_port|escape}</label> + <br />system_db_port (integer)</th> + {else} + <th><label>{$message.descSystem_db_port|escape}</label> + <br />system_db_port (integer)</th> + {/if} + <td><input type="text" name="system_db_port" value="{$params.system_db_port|escape}"/></td> + </tr> + <tr> {if $error.system_db_dbname != null} + <th class="error"><label>{$message.descSystem_db_dbname|escape}</label> + <br />system_db_dbname (string)</th> + {else} + <th><label>{$message.descSystem_db_dbname|escape}</label> + <br />system_db_dbname (string)</th> + {/if} + <td><input type="text" name="system_db_dbname" value="{$params.system_db_dbname|escape}"/></td> + </tr> + <tr> {if $error.system_db_schema != null} + <th class="error"><label>{$message.descSystem_db_schema|escape}</label> + <br />system_db_schema (string)</th> + {else} + <th><label>{$message.descSystem_db_schema|escape}</label> + <br />system_db_schema (string)</th> + {/if} + <td><input type="text" name="system_db_schema" value="{$params.system_db_schema|escape}"/></td> + </tr> + <tr> {if $error.system_db_user != null} + <th class="error"><label>{$message.descSystem_db_user|escape}</label> + <br />system_db_user (string)</th> + {else} + <th><label>{$message.descSystem_db_user|escape}</label> + <br />system_db_user (string)</th> + {/if} + <td><input type="text" name="system_db_user" value="{$params.system_db_user|escape}"/></td> + </tr> + <tr> {if $error.system_db_password != null} + <th class="error"><label>{$message.descSystem_db_password|escape}</label> + <br />system_db_password (string)</th> + {else} + <th><label>{$message.descSystem_db_password|escape}</label> + <br />system_db_password (string)</th> + {/if} + <td><input type="password" name="system_db_password" value="{$params.system_db_password|escape}"/></td> + </tr> + </tbody> + </table> + <h3><a name="others" id="others">Others</a></h3> + <table> + <thead> + <tr> + <th>{$message.strParameter|escape}</th> + <th>{$message.strValue|escape}</th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="2"></td> + </tr> + </tfoot> + <tbody> + <tr> {if $error.load_balance_mode != null} + <th class="error"><label>{$message.descLoad_balance_mode|escape}</label> + <br />load_balance_mode</th> + {else} + <th><label>{$message.descLoad_balance_mode|escape}</label> + <br />load_balance_mode</th> + {/if} + {if $params.load_balance_mode == 'true'} + <td><input type="checkbox" name="load_balance_mode" id="load_balance_mode" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="load_balance_mode" id="load_balance_mode" value="false" /></td> + {/if} </tr> + <tr> {if $error.master_slave_mode != null} + <th class="error"><label>{$message.descMaster_slave_mode|escape}</label> + <br />master_slave_mode</th> + {else} + <th><label>{$message.descMaster_slave_mode|escape}</label> + <br />master_slave_mode</th> + {/if} + {if $params.master_slave_mode == 'true'} + <td><input type="checkbox" name="master_slave_mode" id="master_slave_mode" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="master_slave_mode" id="master_slave_mode" value="false" /></td> + {/if} </tr> + <tr> {if $error.portinsert_lock!= null} + <th class="error"><label>{$message.descInsert_lock|escape}</label> + <br />insert_lock</th> + {else} + <th><label>{$message.descInsert_lock|escape}</label> + <br />insert_lock</th> + {/if} + {if $params.insert_lock == 'true'} + <td><input type="checkbox" name="insert_lock" id="insert_lock" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="insert_lock" id="insert_lock" value="false" /></td> + {/if} </tr> + <tr> {if $error.ignore_leading_white_space != null} + <th class="error"><label>{$message.descIgnore_leading_white_space|escape}</label> + <br />ignore_leading_white_space</th> + {else} + <th><label>{$message.descIgnore_leading_white_space|escape}</label> + <br />ignore_leading_white_space</th> + {/if} + {if $params.ignore_leading_white_space == 'true'} + <td><input type="checkbox" name="ignore_leading_white_space" id="ignore_leading_white_space" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="ignore_leading_white_space" id="ignore_leading_white_space" value="false" /></td> + {/if} </tr> + <tr> {if $error.log_statement != null} + <th class="error"><label>{$message.descLog_statement|escape}</label> + <br />log_statement</th> + {else} + <th><label>{$message.descLog_statement|escape}</label> + <br />log_statement</th> + {/if} + {if $params.log_statement == 'true'} + <td><input type="checkbox" name="log_statement" id="log_statement" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="log_statement" id="log_statement" value="false" /></td> + {/if} </tr> + <tr> {if $error.parallel_mode != null} + <th class="error"><label>{$message.descParallel_mode|escape}</label> + <br />parallel_mode</th> + {else} + <th><label>{$message.descParallel_mode|escape}</label> + <br />parallel_mode</th> + {/if} + {if $params.parallel_mode == 'true'} + <td><input type="checkbox" name="parallel_mode" id="parallel_mode" value="true" checked="checked" /></td> + {else} + <td><input type="checkbox" name="parallel_mode" id="parallel_mode" value="false" /></td> + {/if} </tr> + <tr> {if $error.enable_query_cache != null} + <th class="error"><label>{$message.descEnable_query_cache|escape}</label> + <br />enable_query_cache</th> + {else} + <th><label>{$message.descEnable_query_cache|escape}</label> + <br />enable_query_cache</th> + {/if} + {if $params.enable_query_cache == 'true'} + <td><input type="checkbox" name="enable_query_cache" id="enable_query_cache" checked="checked" /></td> + {else} + <td><input type="checkbox" name="enable_query_cache" id="enable_query_cache" /></td> + {/if} </tr> + </tbody> + </table> + <p> + <input type="button" name="btnSubmit" value="{$message.strUpdate|escape}" onclick="update()"/> + <input type="button" name="btnReset" value="{$message.strReset|escape}" onclick="resetData()"/> + </p> + </form> +</div> +<hr class="hidden" /> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/pgmgtNotFound.tpl b/templates/pgmgtNotFound.tpl new file mode 100644 index 0000000..3e6364e --- /dev/null +++ b/templates/pgmgtNotFound.tpl @@ -0,0 +1,22 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>Error</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + <h2>pgmgt.conf.php not found</h2> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/procInfo.tpl b/templates/procInfo.tpl new file mode 100644 index 0000000..46a0dcf --- /dev/null +++ b/templates/procInfo.tpl @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +</head> +<body> +<h3>{$message.strProcInfo|escape}</h3> +<table> + <tr> + <td><label>{$message.strProcId|escape}</label></td> + <td><label>{$message.strDbName|escape}</label><br /><label>{$message.strConnUser|escape}</label></td> + <td><label>{$message.strProcTime|escape}</label><br /><label>{$message.strConnTime|escape}</label></td> + <td><label>{$message.strProtocolMajorVersion|escape}</label><br /><label>{$message.strProtocolNinorVersion|escape}</label></td> + <td><label>{$message.strConnUsed|escape}</label></td> + </tr> + {foreach name=proc key=num item=value from=$procInfo} + {foreach name=data item=data from=$value} + {if $smarty.foreach.data.first == true} + {if $smarty.foreach.proc.iteration % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td rowspan="{$smarty.foreach.data.total}">{$num|escape}</td> + <td>{$data.0|escape}<br />{$data.1|escape}</td> + <td>{$data.2|escape}<br />{$data.3|escape}</td> + <td>{$data.4|escape}<br />{$data.5|escape}</td> + <td>{$data.6|escape}</td> + </tr> + {else} + {if $smarty.foreach.proc.iteration % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td>{$data.0|escape}<br />{$data.1|escape}</td> + <td>{$data.2|escape}<br />{$data.3|escape}</td> + <td>{$data.4|escape}<br />{$data.5|escape}</td> + <td>{$data.6|escape}</td> + </tr> + {/if} + {/foreach} +{/foreach} +</table> +</body> +</html> diff --git a/templates/queryCache.tpl b/templates/queryCache.tpl new file mode 100644 index 0000000..38eae92 --- /dev/null +++ b/templates/queryCache.tpl @@ -0,0 +1,97 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strQueryCache|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript"> +{literal} +<!-- +var count; +function checkboxChange(chkBox){ + for(count = 0; count < document.queryCache.elements.length; count++){ + document.queryCache.elements[count].checked = chkBox.checked; + } +} + +function sendAction(action) { + document.queryCache.action = 'queryCache.php?action=' + action; + document.queryCache.submit(); +} +// --> +{/literal} +</script> +<!-- InstanceEndEditable --> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + <h2>{$message.strQueryCache|escape}</h2> + <form action="queryCache.php" method="post" name="queryCache" id="queryCache"> + <h3>{$message.strSearch|escape}</h3> + <table> + <tfoot> + <tr><td colspan="2"> + <input type="submit" name="search" value="{$message.strSearch|escape}" onclick="sendAction('search')"/> + <input type="submit" name="clear" value="{$message.strClear|escape}" onclick="sendAction('clear')"/> + </td></tr> + </tfoot> + <tbody> + {if $deleteRow > 0} + <tr> + <td colspan="5">{$deleteRow|escape}{$message.strDeleted|escape}</td> + </tr> + {/if} + <tr> + <td nowrap="nowrap" class="column">{$message.strQueryStr|escape}</td> + <td><input name="qQueryStr" type="text" id="qQueryStr" size="50" value="{$qQueryStr|escape}"/> + </td> + </tr> + <tr> + <td nowrap="nowrap" class="column">{$message.strDb|escape}</td> + <td><input name="qDb" type="text" id="qDb" size="50" value="{$qDb|escape}"/></td> + </tr> + </tbody> + </table> + <p> + <table> + <tfoot> + <tr><td colspan="4"> + <input type="submit" name="ButtonName" value="{$message.strDelete|escape}" onclick="sendAction('delete')"/> + </td></tr> + </tfoot> + <tbody> + <tr> + <th><input type="checkbox" name="all" onclick="checkboxChange(this)" value="" /></th> + <th> {if $col == "query" && $sort == "ascending"} <a href="queryCache.php?col=query&sort=descending"><img src="images/ascending.gif" alt="ascending" />{$message.strQueryStr|escape}</a> {elseif $col == "query" && $sort == "descending"} <a href="queryCache.php?col=query&sort=ascending"><img src="images/descending.gif" alt="descending" />{$message.strQueryStr|escape}</a> {else} <img src="images/spacer.gif" width="8" height="8" alt="spacer" /><a href="queryCache.php?col=query&sort=ascending">{$message.strQueryStr|escape}</a> {/if} </th> + <th> {if $col == "dbname" && $sort == "ascending"} <a href="queryCache.php?col=dbname&sort=descending"><img src="images/ascending.gif" alt="ascending" />{$message.strDb|escape}</a> {elseif $col == "dbname" && $sort == "descending"} <a href="queryCache.php?col=dbname&sort=ascending"><img src="images/descending.gif" alt="descending" />{$message.strDb|escape}</a> {else} <img src="images/spacer.gif" width="8" height="8" alt="spacer" /><a href="queryCache.php?col=dbname&sort=ascending">{$message.strDb|escape}</a> {/if} </th> + <th> {if $col == "create_time" && $sort == "ascending"} <a href="queryCache.php?col=create_time&sort=descending"><img src="images/ascending.gif" alt="ascending" />{$message.strCreateTime|escape}</a> {elseif $col == "create_time" && $sort == "descending"} <a href="queryCache.php?col=create_time&sort=ascending"><img src="images/descending.gif" alt="descending" />{$message.strCreateTime|escape}</a> {else} <img src="images/spacer.gif" width="8" height="8" alt="spacer" /><a href="queryCache.php?col=create_time&sort=ascending">{$message.strCreateTime|escape}</a> {/if} </th> + </tr> + {foreach name=querycache from=$queryCache item=cache} + {if $smarty.foreach.querycache.iteration % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td><input type="checkbox" name="hash[]" value="{$cache.hash|escape}" /></td> + <td>{$cache.query|escape}</td> + <td>{$cache.dbname|escape}</td> + <td>{$cache.create_time|escape}</td> + </tr> + {/foreach} + </tbody> + </table> + </p> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/status.tpl b/templates/status.tpl new file mode 100644 index 0000000..d089a6e --- /dev/null +++ b/templates/status.tpl @@ -0,0 +1,333 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strPgpoolStatus|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript"> +<!-- + +var strConnError = "{$message.strConnectionError|escape}"; +var strUp = "{$message.strUp|escape}"; +var strDown = "{$message.strDown|escape}"; +var strDataError = "{$message.strDataError|escape}"; +var refreshTime = "{$refreshTime|escape}"; +var view = "{$viewPHP|escape}"; +var msgStopPgpool = "{$message.msgStopPgpool|escape}"; +var msgRestartPgpool = "{$message.msgRestartPgpool|escape}"; + +{literal} +function load() { + var xmlhttp = false; + + if (typeof XMLHttpRequest!='undefined') + xmlhttp = new XMLHttpRequest(); + else + xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); + + if (!xmlhttp) { + alert('Sorry, cannot use XMLHttpRequest'); + return; + } + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var content = document.getElementById('status'); + var ret = xmlhttp.responseText; + + content.innerHTML = ret; + if(view != "innerLog.php") + timer(2000); + } + } + xmlhttp.open('GET', view, true); + xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT"); + xmlhttp.send(""); +} + +function reload() { + var xmlhttp = false; + if (typeof XMLHttpRequest!='undefined') + xmlhttp = new XMLHttpRequest(); + else + xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); + + if (!xmlhttp) { + alert('Sorry, cannot use XMLHttpRequest'); + return; + } + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var content = document.getElementById('status'); + var ret = xmlhttp.responseText; + + content.innerHTML = ret; + if(refreshTime > 0) + timer(refreshTime); + } + } + xmlhttp.open('GET', view, true); + xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT"); + xmlhttp.send(""); +} + +function timer(interval) { + setTimeout("reload()",interval); +} + +function sendCommand(command, nodeNumber){ + document.Command.action.value= command; + document.Command.nodeNumber.value= nodeNumber; + document.Command.submit(); +} + +function startPgpool() { + document.Command.action.value= "start"; + document.Command.submit(); +} + +function stopPgpool() { + var stopOption = document.getElementById('stopOption'); + stopOption.style.visibility = "visible"; + stopOption.style.position = ""; + stopOption.style.height = ""; + var cmdBtn = document.getElementById('cmdBtn'); + cmdBtn.style.visibility = "hidden"; + cmdBtn.style.position = "absolute"; + cmdBtn.style.height = "0"; +} + +function restartPgpool() { + var stopOption = document.getElementById('stopOption'); + stopOption.style.visibility = "hidden"; + stopOption.style.position = "absolute"; + stopOption.style.height = "0"; + var restartOption = document.getElementById('restartOption'); + restartOption.style.visibility = "visible"; + restartOption.style.position = ""; + restartOption.style.height = ""; + var cmdBtn = document.getElementById('cmdBtn'); + cmdBtn.style.visibility = "hidden"; + cmdBtn.style.position = "absolute"; + cmdBtn.style.height = "0"; +} + +function cancelCmd() { + var stopOption = document.getElementById('stopOption'); + stopOption.style.visibility = "hidden"; + stopOption.style.position = "absolute"; + stopOption.style.height = "0"; + var restartOption = document.getElementById('restartOption'); + restartOption.style.visibility = "hidden"; + restartOption.style.position = "absolute"; + restartOption.style.height = "0"; + var cmdBtn = document.getElementById('cmdBtn'); + cmdBtn.style.visibility = "visible"; + cmdBtn.style.position = ""; + cmdBtn.style.height = ""; +} + +function execRestartPgpool() { + if(window.confirm(msgRestartPgpool)){ + document.Command.action.value= "restart"; + document.Command.submit(); + } +} + +function execStopPgpool() { + if(window.confirm(msgStopPgpool)){ + document.Command.action.value= "stop"; + document.Command.submit(); + } +} + +function changeView(chView){ + document.Command.action.value= chView; + document.Command.submit(); +} + +// --> +</script> +{/literal} +</head> +<body onload="load()"> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> +<form action="status.php" name="Command" method="post"> + <input type="hidden" name="action" value="" /> + <input type="hidden" name="nodeNumber" value="" /> +<h2>{$message.strPgpoolStatus|escape}</h2> +{if $pgpoolIsActive == true} +<p> + <input type="button" name="command" onclick="changeView('summary')" value="{$message.strPgpoolSummary|escape}" /> + <input type="button" name="command" onclick="changeView('proc')" value="{$message.strProcInfo|escape}" /> + <input type="button" name="command" onclick="changeView('node')" value="{$message.strNodeInfo|escape}" /> + {if $n == 1} + <input type="button" name="command" onclick="changeView('log')" value="{$message.strLog|escape}" /> + {/if} +</p> + <div id="status"></div> +<p> + <input type="button" name="command" onclick="changeView('summary')" value="{$message.strPgpoolSummary|escape}" /> + <input type="button" name="command" onclick="changeView('proc')" value="{$message.strProcInfo|escape}" /> + <input type="button" name="command" onclick="changeView('node')" value="{$message.strNodeInfo|escape}" /> + {if $n == 1} + <input type="button" name="command" onclick="changeView('log')" value="{$message.strLog|escape}" /> + {/if} +</p> +{else} +{$message.strStopPgpool|escape} +{/if} +<h2>{$message.strPgpool|escape}</h2> + {if $pgpoolIsActive == false} + <table> + <thead><tr><th colspan="2">{$message.strStartOption|escape}</th></tr></thead> + <tfoot> + <tr><td colspan="2"><input type="button" name="command" onclick="startPgpool()" value="{$message.strStartPgpool|escape}" /></td></tr></tfoot> + <tbody> + <tr> + <tr><td>{$message.strCmdC|escape}(-c)</td> + {if $c == 1} + <td><input type="checkbox" name="c" checked="checked" /></td> + {else} + <td><input type="checkbox" name="c" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdN|escape}(-n)</td> + {if $n == 1} + <td><input type="checkbox" name="n" checked="checked" /></td> + {else} + <td><input type="checkbox" name="n" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdD|escape}(-d)</td> + {if $d == 1} + <td><input type="checkbox" name="d" checked="checked" /></td> + {else} + <td><input type="checkbox" name="d" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdPgpoolFile|escape}(-f)</td> + <td>{$pgpoolConf|escape}</td> + </tr> + <tr><td>{$message.strCmdPcpFile|escape}(-F)</td> + <td>{$pcpConf|escape}</td> + </tr> + </tbody> + </table> + {else} + <div id="cmdBtn" style="visibility: visible"> + <input type="button" name="command" onclick="stopPgpool()" value="{$message.strStopPgpool|escape}" /> + <input type="button" name="command" onclick="restartPgpool()" value="{$message.strRestartPgpool|escape}" /> + </div> + <div id="stopOption" style="visibility: hidden; position: absolute"> + <table> + <thead><tr><th colspan="2">{$message.strStopOption|escape}</th></tr></thead> + <tfoot> + <tr><td colspan="2"> + <input type="button" name="command" onclick="execStopPgpool()" value="{$message.strExecute|escape}" /> + <input type="button" name="command" onclick="cancelCmd()" value="{$message.strCancel|escape}" /> + </td></tr></tfoot> + <tbody> + <tr><td>{$message.strCmdM|escape}(-m)</td><td><select name="m"> + {if $m == 's'} + <option value="s" selected="selected">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $m == 'f'} + <option value="s">smart</optgroup> + <option value="f" selected="selected">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $m == 'i'} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i" selected="selected">immediate</optgroup> + {else} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {/if} + </td></tr> + </tbody> + </table> + </div> + <div id="restartOption" style="visibility: hidden; position: absolute"> + <table> + <thead><tr><th colspan="2">{$message.strRestartOption|escape}</th></tr></thead> + <tfoot> + <tr><td colspan="2"> + <input type="button" name="command" onclick="execRestartPgpool()" value="{$message.strExecute|escape}" /> + <input type="button" name="command" onclick="cancelCmd()" value="{$message.strCancel|escape}" /> + </td></tr></tfoot> + <tbody> + <tr> + <tr><td>{$message.strCmdC|escape}(-c)</td> + {if $c == 1} + <td><input type="checkbox" name="c" checked="checked" /></td> + {else} + <td><input type="checkbox" name="c" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdN|escape}(-n)</td> + {if $n == 1} + <td><input type="checkbox" name="n" checked="checked" /></td> + {else} + <td><input type="checkbox" name="n" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdD|escape}(-d)</td> + {if $d == 1} + <td><input type="checkbox" name="d" checked="checked" /></td> + {else} + <td><input type="checkbox" name="d" /></td> + {/if} + </tr> + <tr><td>{$message.strCmdM|escape}(-m)</td><td><select name="m"> + {if $m == 's'} + <option value="s" selected="selected">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $m == 'f'} + <option value="s">smart</optgroup> + <option value="f" selected="selected">fast</optgroup> + <option value="i">immediate</optgroup> + {elseif $m == 'i'} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i" selected="selected">immediate</optgroup> + {else} + <option value="s">smart</optgroup> + <option value="f">fast</optgroup> + <option value="i">immediate</optgroup> + {/if} + </td></tr> + <tr><td>{$message.strCmdPgpoolFile|escape}(-f)</td> + <td>{$pgpoolConf|escape}</td> + </tr> + <tr><td>{$message.strCmdPcpFile|escape}(-F)</td> + <td>{$pcpConf|escape}</td> + </tr> + </tbody> + </table> + </div> + {/if} + <p>{$pgpoolStatus|escape}</p> + <p> + {foreach from=$pgpoolMessage item=lines} + {$lines|escape}<br /> + {/foreach} + </p> +</form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/templates/systemDb.tpl b/templates/systemDb.tpl new file mode 100644 index 0000000..95d7258 --- /dev/null +++ b/templates/systemDb.tpl @@ -0,0 +1,198 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>{$message.strSystemDb|escape}</title> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<link href="screen.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript"> +var msgDeleteConfirm = "{$message.msgDeleteConfirm|escape}"; +{literal} +<!-- +var count; +function CheckboxChange(chkBox){ + for(count = 0; count < document.queryCache.elements.length; count++){ + document.queryCache.elements[count].checked = chkBox.checked; + } +} + +function sendAction(action) { + document.systemDb.action.value=action; + document.systemDb.submit(); +} + +function deleteAction() { + if(window.confirm(msgDeleteConfirm)){ + document.systemDb.action.value="delete"; + document.systemDb.submit(); + } +} + +// --> +{/literal} +</script> +</head> +<body> +<div id="header"> + <h1><img src="images/logo.gif" alt="pgpoolAdmin" /></h1> +</div> +<div id="menu"> +{include file="menu.tpl"} +</div> +<div id="content"> +<div id="help"><a href="help.php?help={$help|escape}"><img src="images/question.gif" alt="help"/>{$message.strHelp|escape}</a></div> + <h2>{$message.strSystemDb|escape}</h2> + <form name="systemDb" action="systemDb.php" method="post"> + <input type="hidden" name="action" value="update" /> + <table> + <tfoot> + <tr><td colspan="7"> {if $isUpdate == true} + <input type="button" name="submitUpdate" value="{$message.strUpdate|escape}" onclick="sendAction('update')"/> + <input type="button" name="submitDelete" value="{$message.strDelete|escape}" onclick="deleteAction()"/> + <input type="button" name="submitCancel" value="{$message.strCancel|escape}" onclick="sendAction('cancel')"/> + {else} + <input type="button" name="submitAdd" value="{$message.strAdd|escape}" onclick="sendAction('add')"/> + {/if} </td> + </tr> + </tfoot> + <tbody> + + {if $error} + <tr> + <td colspan="4"> {$error|escape} </td> + </tr> + {/if} + {if $isUpdate == true} + <tr> + <th><label>{$message.strDbName|escape}</label></th> + <td></td> + <td><input type="text" name="dbname" value="{$result.dbname|escape}" readonly="readonly" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strSchemaName|escape}</label></th> + <td></td> + <td><input type="text" name="schema_name" value="{$result.schema_name|escape}" readonly="readonly" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strTable|escape}</label></th> + <td></td> + <td><input type="text" name="table_name" value="{$result.table_name|escape}" readonly="readonly" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strColName|escape}</label></th> + <td></td> + <td><input type="text" name="col_name" value="{$result.col_name|escape}" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strColList|escape}</label></th> + <td>{ldelim}</td> + <td> + <input type="text" name="col_list" size="50" value="{$result.col_list|escape}" /> + </td> + <td>{rdelim}</td> + </tr><tr> + <th><label>{$message.strTypeList|escape}</label></th> + <td>{ldelim}</td> + <td> + <input type="text" name="type_list" size="50" value="{$result.type_list|escape}" /> + </td> + <td>{rdelim}</td> + </tr><tr> + <th><label>{$message.strDistDefFunc|escape}</label></th> + <td></td> + <td><input type="text" name="dist_def_func" value="{$result.dist_def_func|escape}" /></td> + <td></td> + </tr> + {else} + <tr> + <th><label>{$message.strDbName|escape}</label></th> + <td></td> + <td><input type="text" name="dbname" value="{$result.dbname|escape}" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strSchemaName|escape}</label></th> + <td></td> + <td><input type="text" name="schema_name" value="{$result.schema_name|escape}" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strTable|escape}</label></th> + <td></td> + <td><input type="text" name="table_name" value="{$result.table_name|escape}" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strColName|escape}</label></th> + <td></td> + <td><input type="text" name="col_name" value="{$result.col_name|escape}" /></td> + <td></td> + </tr><tr> + <th><label>{$message.strColList|escape}</label></th> + <td>{ldelim}</td> + <td> + <input type="text" name="col_list" size="50" value="{$result.col_list|escape}" /> + </td> + <td>{rdelim}</td> + </tr><tr> + <th><label>{$message.strTypeList|escape}</label></th> + <td>{ldelim}</td> + <td> + <input type="text" name="type_list" size="50" value="{$result.type_list|escape}" /> + </td> + <td>{rdelim}</td> + </tr><tr> + <th><label>{$message.strDistDefFunc|escape}</label></th> + <td></td> + <td><input type="text" name="dist_def_func" value="{$result.dist_def_func|escape}" /></td> + <td></td> + </tr> + {/if} + </tbody> + </table> + <p /> + <table> + <thead> + <tr> + <th><label>{$message.strDbName|escape}</label></th> + <th><label>{$message.strSchemaName|escape}</label></th> + <th><label>{$message.strTable|escape}</label></th> + <th><label>{$message.strColName|escape}</label></th> + <th><label>{$message.strColList|escape}</label></th> + <th><label>{$message.strTypeList|escape}</label></th> + <th><label>{$message.strDistDefFunc|escape}</label></th> + </tr> + </thead> + <tbody> + {foreach name=systemdb from=$systemDb item=list} + {if ($smarty.foreach.systemdb.iteration) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td rowspan="{$list.listLength|escape}"><a href="systemDb.php?dbname={$list.dbname|escape}&schema_name={$list.schema_name|escape}&table_name={$list.table_name|escape}">{$list.dbname|escape}</a></td> + <td rowspan="{$list.listLength|escape}">{$list.schema_name|escape}</td> + <td rowspan="{$list.listLength|escape}">{$list.table_name|escape}</td> + <td rowspan="{$list.listLength|escape}">{$list.col_name|escape}</td> + <td>{$list.col_list[0]|escape}</td> + <td>{$list.type_list[0]|escape}</td> + <td rowspan="{$list.listLength|escape}">{$list.dist_def_func|escape}</td> + </tr> + {section name=num loop=$list.col_list start=1} + {if ($smarty.foreach.systemdb.iteration) % 2 == 0} + <tr class="even"> + {else} + <tr class="odd"> + {/if} + <td> + {$list.col_list[num]|escape} + </td><td> + {$list.type_list[num]|escape} + </td></tr> + {/section} + {/foreach} + </tbody> + </table> + </form> +</div> +<div id="footer"> +{include file='footer.tpl'} +</div> +</body> +</html> diff --git a/version.php b/version.php new file mode 100644 index 0000000..853cc68 --- /dev/null +++ b/version.php @@ -0,0 +1,28 @@ +<?php
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Common file of PgpoolAdmin
+ *
+ * PHP versions 4 and 5
+ *
+ * LICENSE: Permission to use, copy, modify, and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice appear in all
+ * copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of the
+ * author not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. The author makes no representations about the
+ * suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * @author Ryuma Ando <[email protected]>
+ * @copyright 2003-2006 PgPool Global Development Group
+ * @version SVN: $Id$
+ */
+
+$version = '1.0'; + +?>
\ No newline at end of file |