diff options
author | rvelices <rv-github@modusoptimus.com> | 2012-02-09 21:11:34 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2012-02-09 21:11:34 +0000 |
commit | f6825cfb33d16796951ce29f28e2e99f61e3d903 (patch) | |
tree | a16d8fffbacb57ef35281e84410d9c7bff0cea6e /include/ws_functions.inc.php | |
parent | 40280db9d81c299044533c4331af2c2854e4f959 (diff) |
- remove square/thumb from choices on picture
- fix content margin on password register
- purge derivative cache by type of derivative
- session saved infos/messages are not given to the page on html redirections
- shorter/faster code in functions_xxx
git-svn-id: http://piwigo.org/svn/trunk@13074 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r-- | include/ws_functions.inc.php | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 908eb6118..fa4fd5fb0 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -522,6 +522,36 @@ LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['p /** + * create a tree from a flat list of categories, no recursivity for high speed + */ +function categories_flatlist_to_tree($categories) +{ + $tree = array(); + $key_of_cat = array(); + + foreach ($categories as $key => &$node) + { + $key_of_cat[$node['id']] = $key; + + if (!isset($node['id_uppercat'])) + { + $tree[$key] = &$node; + } + else + { + if (!isset($categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'])) + { + $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'] = array(); + } + + $categories[ $key_of_cat[ $node['id_uppercat'] ] ]['sub_categories'][$key] = &$node; + } + } + + return $tree; +} + +/** * returns a list of categories (web service method) */ function ws_categories_getList($params, &$service) @@ -1669,9 +1699,9 @@ SELECT if ('file' == $params['type']) { $do_update = false; - + $infos = pwg_image_infos($file_path); - + foreach (array('width', 'height', 'filesize') as $image_info) { if ($infos[$image_info] > $image[$image_info]) @@ -1744,7 +1774,7 @@ SELECT // pwg.images.addChunk. If "high" is available we use it as "original" // else we use "file". remove_chunks($params['original_sum'], 'thumb'); - + if (isset($params['high_sum'])) { $original_type = 'high'; |