aboutsummaryrefslogtreecommitdiffstats
path: root/include/dblayer
diff options
context:
space:
mode:
authornikrou <nikrou@piwigo.org>2010-05-09 20:52:38 +0000
committernikrou <nikrou@piwigo.org>2010-05-09 20:52:38 +0000
commitd8d8ca5ed389f8c3e22a928d3be9e87bd1f05f39 (patch)
treed269ee8f649907fdf303a91a4196fb4993a258eb /include/dblayer
parent84691404710b8553eaae0937454ef684293d2684 (diff)
Fix get_enums function for SQLite
hard coded enums values for all tables because enum feature doesn't exists for SQLite. git-svn-id: http://piwigo.org/svn/trunk@6153 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/dblayer')
-rw-r--r--include/dblayer/functions_pdo-sqlite.inc.php14
-rw-r--r--include/dblayer/functions_sqlite.inc.php14
2 files changed, 26 insertions, 2 deletions
diff --git a/include/dblayer/functions_pdo-sqlite.inc.php b/include/dblayer/functions_pdo-sqlite.inc.php
index d59e3b510..a4c3881f0 100644
--- a/include/dblayer/functions_pdo-sqlite.inc.php
+++ b/include/dblayer/functions_pdo-sqlite.inc.php
@@ -431,7 +431,19 @@ function pwg_db_cast_to_text($string)
*/
function get_enums($table, $field)
{
- return array();
+ $Enums['categories']['status'] = array('public', 'private');
+ $Enums['history']['section'] = array('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats');
+ $Enums['user_infos']['status'] = array('webmaster','admin','normal','generic','guest');
+ $Enums['image']['type'] = array('picture','high','other');
+ $Enums['plugins']['state'] = array('active', 'inactive');
+ $Enums['user_cache_image']['access_type'] = array('NOT IN','IN');
+
+ $table = str_replace($GLOBALS['prefixeTable'], '', $table);
+ if (isset($Enums[$table][$field])) {
+ return $Enums[$table][$field];
+ } else {
+ return array();
+ }
}
// get_boolean transforms a string to a boolean value. If the string is
diff --git a/include/dblayer/functions_sqlite.inc.php b/include/dblayer/functions_sqlite.inc.php
index 5c8f76a9c..1b34d3fcb 100644
--- a/include/dblayer/functions_sqlite.inc.php
+++ b/include/dblayer/functions_sqlite.inc.php
@@ -443,7 +443,19 @@ function pwg_db_cast_to_text($string)
*/
function get_enums($table, $field)
{
- return array();
+ $Enums['categories']['status'] = array('public', 'private');
+ $Enums['history']['section'] = array('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats');
+ $Enums['user_infos']['status'] = array('webmaster','admin','normal','generic','guest');
+ $Enums['image']['type'] = array('picture','high','other');
+ $Enums['plugins']['state'] = array('active', 'inactive');
+ $Enums['user_cache_image']['access_type'] = array('NOT IN','IN');
+
+ $table = str_replace($GLOBALS['prefixeTable'], '', $table);
+ if (isset($Enums[$table][$field])) {
+ return $Enums[$table][$field];
+ } else {
+ return array();
+ }
}
// get_boolean transforms a string to a boolean value. If the string is