From d3ea720da70282d175eec0f149a021f8555eaf0e Mon Sep 17 00:00:00 2001 From: Neil Blakey-Milner Date: Fri, 23 Sep 2005 14:44:30 +0000 Subject: [PATCH] Add getTableName, The one true way to get the correct name for a table whilst respecting the administrator's choice of table naming. --- lib/util/ktutil.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index af7e854..1c67a47 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -158,7 +158,7 @@ class KTUtil { } // }}} - // {{{ + // {{{ copyDirectory function copyDirectory($sSrc, $sDst, $bMove = false) { if (file_exists($sDst)) { return PEAR::raiseError("Destination directory already exists."); @@ -260,6 +260,20 @@ class KTUtil { } } // }}} + + // {{{ getTableName + /** + * The one true way to get the correct name for a table whilst + * respecting the administrator's choice of table naming. + */ + function getTableName($sTable) { + $sTable = $sTable . "_table"; + if (isset($GLOBALS['default']->$sTable)) { + return $GLOBALS['default']->$sTable; + } + return PEAR::raiseError('Could not find table: ' . $sTable); + } + // }}} } ?> -- libgit2 0.21.4