Commit d3ea720da70282d175eec0f149a021f8555eaf0e
1 parent
eb962002
Add getTableName, The one true way to get the correct name for a table
whilst respecting the administrator's choice of table naming. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3667 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
15 additions
and
1 deletions
lib/util/ktutil.inc
| @@ -158,7 +158,7 @@ class KTUtil { | @@ -158,7 +158,7 @@ class KTUtil { | ||
| 158 | } | 158 | } |
| 159 | // }}} | 159 | // }}} |
| 160 | 160 | ||
| 161 | - // {{{ | 161 | + // {{{ copyDirectory |
| 162 | function copyDirectory($sSrc, $sDst, $bMove = false) { | 162 | function copyDirectory($sSrc, $sDst, $bMove = false) { |
| 163 | if (file_exists($sDst)) { | 163 | if (file_exists($sDst)) { |
| 164 | return PEAR::raiseError("Destination directory already exists."); | 164 | return PEAR::raiseError("Destination directory already exists."); |
| @@ -260,6 +260,20 @@ class KTUtil { | @@ -260,6 +260,20 @@ class KTUtil { | ||
| 260 | } | 260 | } |
| 261 | } | 261 | } |
| 262 | // }}} | 262 | // }}} |
| 263 | + | ||
| 264 | + // {{{ getTableName | ||
| 265 | + /** | ||
| 266 | + * The one true way to get the correct name for a table whilst | ||
| 267 | + * respecting the administrator's choice of table naming. | ||
| 268 | + */ | ||
| 269 | + function getTableName($sTable) { | ||
| 270 | + $sTable = $sTable . "_table"; | ||
| 271 | + if (isset($GLOBALS['default']->$sTable)) { | ||
| 272 | + return $GLOBALS['default']->$sTable; | ||
| 273 | + } | ||
| 274 | + return PEAR::raiseError('Could not find table: ' . $sTable); | ||
| 275 | + } | ||
| 276 | + // }}} | ||
| 263 | } | 277 | } |
| 264 | 278 | ||
| 265 | ?> | 279 | ?> |