/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.91 2004/09/03 08:24:35 jollytoad Exp $
+ * $Id: Misc.php,v 1.92 2004/09/07 14:00:26 jollytoad Exp $
*/
class Misc {
'databases' => array (
'title' => $lang['strdatabases'],
'url' => "all_db.php",
- 'help' => 'managing_databases',
+ 'help' => 'pg.database',
),
'users' => array (
'title' => $lang['strusers'],
'url' => "users.php",
'hide' => $hide_users,
- 'help' => 'users',
+ 'help' => 'pg.user',
),
'groups' => array (
'title' => $lang['strgroups'],
'url' => "groups.php",
'hide' => $hide_users,
- 'help' => 'groups',
+ 'help' => 'pg.group',
),
'tablespaces' => array (
'title' => $lang['strtablespaces'],
'url' => "tablespaces.php",
'hide' => (!$data->hasTablespaces()),
+ 'help' => 'pg.tablespace',
),
'export' => array (
'title' => $lang['strexport'],
'title' => $lang['strschemas'],
'url' => "database.php?{$vars}",
'hide' => (!$data->hasSchemas()),
- 'help' => 'schemas',
+ 'help' => 'pg.schema',
),
'sql' => array (
'title' => $lang['strsql'],
'url' => "database.php?{$vars}&action=sql",
- 'help' => 'sql',
+ 'help' => 'pg.sql',
),
'find' => array (
'title' => $lang['strfind'],
'title' => $lang['strvariables'],
'url' => "database.php?{$vars}&action=variables",
'hide' => (!$data->hasVariables()),
- 'help' => 'runtime_config',
+ 'help' => 'pg.variable',
),
'processes' => array (
'title' => $lang['strprocesses'],
'url' => "database.php?{$vars}&action=processes",
'hide' => (!$data->hasProcesses()),
- 'help' => 'processes',
+ 'help' => 'pg.process',
),
'admin' => array (
'title' => $lang['stradmin'],
'title' => $lang['strprivileges'],
'url' => "privileges.php?{$vars}",
'hide' => (!isset($data->privlist['database'])),
+ 'help' => 'pg.privilege',
),
'languages' => array (
'title' => $lang['strlanguages'],
'url' => "languages.php?{$vars}",
'hide' => $hide_advanced,
+ 'help' => 'pg.language',
),
'casts' => array (
'title' => $lang['strcasts'],
'url' => "casts.php?{$vars}",
'hide' => ($hide_advanced || !$data->hasCasts()),
+ 'help' => 'pg.cast',
),
'export' => array (
'title' => $lang['strexport'],
'tables' => array (
'title' => $lang['strtables'],
'url' => "tables.php?{$vars}",
- 'help' => 'tables',
+ 'help' => 'pg.table',
),
'views' => array (
'title' => $lang['strviews'],
'url' => "views.php?{$vars}",
- 'help' => 'views',
+ 'help' => 'pg.view',
),
'sequences' => array (
'title' => $lang['strsequences'],
'url' => "sequences.php?{$vars}",
- 'help' => 'sequences',
+ 'help' => 'pg.sequence',
),
'functions' => array (
'title' => $lang['strfunctions'],
'url' => "functions.php?{$vars}",
+ 'help' => 'pg.function',
),
'domains' => array (
'title' => $lang['strdomains'],
'url' => "domains.php?{$vars}",
'hide' => (!$data->hasDomains()),
- 'help' => 'domains',
+ 'help' => 'pg.domain',
),
'aggregates' => array (
'title' => $lang['straggregates'],
'url' => "aggregates.php?{$vars}",
'hide' => $hide_advanced,
- 'help' => 'aggregates',
+ 'help' => 'pg.aggregate',
),
'types' => array (
'title' => $lang['strtypes'],
'url' => "types.php?{$vars}",
'hide' => $hide_advanced,
+ 'help' => 'pg.type',
),
'operators' => array (
'title' => $lang['stroperators'],
'url' => "operators.php?{$vars}",
'hide' => $hide_advanced,
- 'help' => 'operators',
+ 'help' => 'pg.operator',
),
'opclasses' => array (
'title' => $lang['stropclasses'],
'url' => "opclasses.php?{$vars}",
'hide' => $hide_advanced,
- 'help' => 'opclasses',
+ 'help' => 'pg.opclass',
),
'conversions' => array (
'title' => $lang['strconversions'],
'url' => "conversions.php?{$vars}",
'hide' => ($hide_advanced || !$data->hasConversions()),
- 'help' => 'conversions',
+ 'help' => 'pg.conversion',
),
'privileges' => array (
'title' => $lang['strprivileges'],
'url' => "privileges.php?{$vars}",
'hide' => (!$data->hasSchemas()),
+ 'help' => 'pg.privilege',
),
);
'indexes' => array (
'title' => $lang['strindexes'],
'url' => "indexes.php?{$vars}",
+ 'help' => 'pg.index',
),
'constraints' => array (
'title' => $lang['strconstraints'],
'url' => "constraints.php?{$vars}",
- 'help' => 'constraints',
+ 'help' => 'pg.constraint',
),
'triggers' => array (
'title' => $lang['strtriggers'],
'url' => "triggers.php?{$vars}",
+ 'help' => 'pg.trigger',
),
'rules' => array (
'title' => $lang['strrules'],
'url' => "rules.php?{$vars}",
+ 'help' => 'pg.rule',
),
'info' => array (
'title' => $lang['strinfo'],
'privileges' => array (
'title' => $lang['strprivileges'],
'url' => "privileges.php?{$vars}",
+ 'help' => 'pg.privilege',
),
'import' => array (
'title' => $lang['strimport'],
'rules' => array (
'title' => $lang['strrules'],
'url' => "rules.php?{$vars}",
+ 'help' => 'pg.rule',
),
'privileges' => array (
'title' => $lang['strprivileges'],
'url' => "privileges.php?{$vars}",
+ 'help' => 'pg.privilege',
),
'export' => array (
'title' => $lang['strexport'],
'sql' => array (
'title' => $lang['strsql'],
'url' => "sqledit.php?{$vars}&action=sql",
+ 'help' => 'pg.sql',
),
'find' => array (
'title' => $lang['strfind'],
'title' => $lang['strserver'],
'text' => $conf['servers'][$_SESSION['webdbServerID']]['desc'],
'url' => 'redirect.php?section=server',
+ 'help' => 'pg.server',
);
if ($subject == 'server') $done = true;
'title' => $lang['strdatabase'],
'text' => $_REQUEST['database'],
'url' => "redirect.php?section=database&{$vars}",
+ 'help' => 'pg.database',
);
}
if ($subject == 'database') $done = true;
'title' => $lang['strschema'],
'text' => $_REQUEST['schema'],
'url' => "redirect.php?section=schema&{$vars}",
- 'help' => 'schemas',
+ 'help' => 'pg.schema',
);
}
if ($subject == 'schema') $done = true;
'title' => $lang['strtable'],
'text' => $_REQUEST['table'],
'url' => "redirect.php?{$vars}",
- 'help' => 'tables',
+ 'help' => 'pg.table',
);
} elseif (isset($_REQUEST['view']) && !$done) {
$vars .= "section=view&view=".urlencode($_REQUEST['view']);
'title' => $lang['strview'],
'text' => $_REQUEST['view'],
'url' => "redirect.php?{$vars}",
- 'help' => 'views',
+ 'help' => 'pg.view',
);
}
if ($subject == 'table' || $subject == 'view') $done = true;
'title' => $lang['str'.$subject],
'text' => $_REQUEST[$subject],
'url' => "redirect.php?{$vars}",
- 'help' => $subject.'s',
+ 'help' => 'pg.'.$subject,
);
break;
default:
/**
* Displays link to the context help.
- * @param $str - a string to place a context help by (already escaped)
- * @param $help - help section name
+ * @param $str - the string that the context help is related to (already escaped)
+ * @param $help - help section identifier
*/
function printHelp($str, $help) {
global $lang, $data;
echo $str;
- if (!is_null($help) && isset($data->help_page[$help])) {
+ if ($help) {
echo "<a class=\"help\" href=\"";
- echo htmlspecialchars($data->help_base . $data->help_page[$help]);
+ echo htmlspecialchars("help.php?help=".urlencode($help));
echo "\" title=\"{$lang['strhelp']}\" target=\"phppgadminhelp\">{$lang['strhelpicon']}</a>";
}
}
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres.php,v 1.244 2004/08/25 07:47:34 chriskl Exp $
+ * $Id: Postgres.php,v 1.245 2004/09/07 14:04:21 jollytoad Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
var $joinOps = array('INNER JOIN' => 'INNER JOIN');
// Default help URL
- var $help_base = 'http://www.postgresql.org/docs/7/interactive/';
+ var $help_base;
// Help sub pages
- var $help_page = array(
- 'create_table' => 'sql-createtable.htm',
- 'drop_table' => 'sql-droptable.htm',
- 'insert' => 'sql-insert.htm',
- 'select' => 'sql-select.htm',
- 'tables' => 'ddl.htm#DDL-BASICS',
- 'schemas' => 'ddl-schemas.htm',
- 'create_schema' => 'sql-createschema.htm',
- 'alter_schema' => 'sql-alterschema.htm',
- 'drop_schema' => 'sql-dropschema.htm',
- 'runtime_config' => 'runtime-config.htm',
- 'processes' => 'monitoring-stats.htm#MONITORING-STATS-VIEWS-TABLE',
- 'sql' => 'sql-syntax.htm',
- 'views' => 'tutorial-views.htm',
- 'create_view' => 'sql-createview.htm',
- 'drop_view' => 'sql-dropview.htm',
- 'aggregates' => 'xaggr.htm',
- 'types' => 'xtypes.htm',
- 'create_type' => 'sql-createtype.htm',
- 'drop_type' => 'sql-droptype.htm',
- 'operators' => 'xoper.htm',
- 'managing_databases' => 'managing-databases.htm',
- 'users' => 'security17760.htm',
- 'groups' => 'security17760.htm',
- 'create_database' => 'sql-createdatabase.htm',
- 'drop_database' => 'sql-dropdatabase.htm',
- 'constraints' => 'ddl-constraints.htm'
- );
+ var $help_page;
/**
* Constructor
$this->ADODB_base($conn);
}
+ // Help functions
+
+ /**
+ * Fetch a URL (or array of URLs) for a given help page.
+ */
+ function getHelp($help) {
+ $this->getHelpPages();
+
+ if (isset($this->help_page[$help])) {
+ if (is_array($this->help_page[$help])) {
+ $urls = array();
+ foreach ($this->help_page[$help] as $link) {
+ $urls[] = $this->help_base . $link;
+ }
+ return $urls;
+ } else
+ return $this->help_base . $this->help_page[$help];
+ } else
+ return null;
+ }
+
+ /**
+ * Initialize help pages and return the full list
+ */
+ function &getHelpPages() {
+ include_once('./help/PostgresDoc70.php');
+ return $this->help_page;
+ }
+
// Formatting functions
/**
*/
function clean(&$str) {
if ($str === null) return null;
+ $str = str_replace("\r\n","\n",$str);
if (function_exists('pg_escape_string'))
$str = pg_escape_string($str);
else
}
return $arr;
}
-
+
/**
* Outputs the HTML code for a particular field
* @param $name The name to give the field
* A class that implements the DB interface for Postgres
* Note: This class uses ADODB and returns RecordSets.
*
- * $Id: Postgres71.php,v 1.66 2004/08/03 16:16:02 soranzo Exp $
+ * $Id: Postgres71.php,v 1.67 2004/09/07 14:04:20 jollytoad Exp $
*/
// @@@ THOUGHT: What about inherits? ie. use of ONLY???
// Supported join operations for use with view wizard
var $joinOps = array('INNER JOIN' => 'INNER JOIN', 'LEFT JOIN' => 'LEFT JOIN', 'RIGHT JOIN' => 'RIGHT JOIN', 'FULL JOIN' => 'FULL JOIN');
- // Default help URL
- var $help_base = 'http://www.postgresql.org/docs/7.1/interactive/';
-
- // Help sub pages (alphabetical order)
- var $help_page = array(
- 'add_column' => 'sql-altertable.html',
- 'alter_column' => 'sql-altertable.html',
- 'alter_table' => 'sql-altertable.html',
- 'create_table' => 'sql-createtable.html',
- 'drop_column' => 'sql-altertable.html',
- 'drop_table' => 'sql-droptable.html',
- 'insert' => 'sql-insert.html',
- 'select' => 'sql-select.html',
- 'tables' => 'ddl.html#DDL-BASICS',
- 'schemas' => 'ddl-schemas.html',
- 'create_schema' => 'sql-createschema.html',
- 'alter_schema' => 'sql-alterschema.html',
- 'drop_schema' => 'sql-dropschema.html',
- 'runtime_config' => 'runtime-config.html',
- 'processes' => 'monitoring-stats.html#MONITORING-STATS-VIEWS-TABLE',
- 'sql' => 'sql-syntax.html',
- 'views' => 'tutorial-views.html',
- 'create_view' => 'sql-createview.html',
- 'drop_view' => 'sql-dropview.html',
- 'aggregates' => 'xaggr.html',
- 'types' => 'xtypes.html',
- 'create_type' => 'sql-createtype.html',
- 'drop_type' => 'sql-droptype.html',
- 'operators' => 'xoper.html',
- 'managing_databases' => 'managing-databases.html',
- 'users' => 'user-manag.html#DATABASE-USERS',
- 'groups' => 'groups.html',
- 'create_database' => 'sql-createdatabase.html',
- 'drop_database' => 'sql-dropdatabase.html',
- 'constraints' => 'ddl-constraints.html'
- );
-
/**
* Constructor
* @param $conn The database connection
$this->Postgres($conn);
}
+ // Help functions
+
+ function &getHelpPages() {
+ include_once('./help/PostgresDoc71.php');
+ return $this->help_page;
+ }
+
/**
* Sets the client encoding
* @param $encoding The encoding to for the client