From cb58bff46e411871362f1c42f4d9b51f2ff999bb Mon Sep 17 00:00:00 2001 From: vdigital Date: Sat, 3 Feb 2007 15:50:07 +0000 Subject: Web Service: - Delete functions_webserv.inc.php - Activate $colling_partner_id in ws.php git-svn-id: http://piwigo.org/svn/trunk@1777 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_webserv.inc.php | 143 -------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 include/functions_webserv.inc.php (limited to 'include/functions_webserv.inc.php') diff --git a/include/functions_webserv.inc.php b/include/functions_webserv.inc.php deleted file mode 100644 index 7961c63c8..000000000 --- a/include/functions_webserv.inc.php +++ /dev/null @@ -1,143 +0,0 @@ - 0 and hit desc order */ - , 'recent' /* recent = Date_available desc order */ - , 'highrated' /* avg_rate > 0 and desc order */ - , 'oldest' /* Date_available asc order */ - , 'lessviewed' /* hit asc order */ - , 'lowrated' /* avg_rate asc order */ - , 'undescribed' /* description missing */ - , 'unnamed' /* new name missing */ - , 'portraits' /* width < height (portrait oriented) */ - , 'landscapes' /* width > height (landscape oriented) */ - , 'squares' /* width ~ height (square form) */ -); -} - - -// expand_id_list($ids) convert a human list expression to a full ordered list -// example : expand_id_list( array(5,2-3,2) ) returns array( 2, 3, 5) -function expand_id_list($ids) -{ - $tid = array(); - foreach ( $ids as $id ) - { - if ( is_numeric($id) ) - { - $tid[] = (int) $id; - } - else - { - $range = explode( '-', $id ); - if ( is_numeric($range[0]) and is_numeric($range[1]) ) - { - $from = min($range[0],$range[1]); - $to = max($range[0],$range[1]); - for ($i = $from; $i <= $to; $i++) - { - $tid[] = (int) $i; - } - } - } - } - $result = array_unique ($tid); // remove duplicates... - sort ($result); - return $result; -} - -// check_target($string) verifies and corrects syntax of target parameter -// example : check_target(cat/23,24,24,24,25,27) returns cat/23-25,27 -function check_target($list) -{ - if ( $list !== '' ) - { - $type = explode('/',$list); // Find type list - if ( !in_array($type[0],array('list','cat','tag') ) ) - { - $type[0] = 'list'; // Assume an id list - } - $ids = explode( ',',$type[1] ); - $list = $type[0] . '/'; - - // 1,2,21,3,22,4,5,9-12,6,11,12,13,2,4,6, - - $result = expand_id_list( $ids ); - - // 1,2,3,4,5,6,9,10,11,12,13,21,22, - // I would like - // 1-6,9-13,21-22 - $serial[] = $result[0]; // To be shifted - foreach ($result as $k => $id) - { - $next_less_1 = (isset($result[$k + 1]))? $result[$k + 1] - 1:-1; - if ( $id == $next_less_1 and end($serial)=='-' ) - { // nothing to do - } - elseif ( $id == $next_less_1 ) - { - $serial[]=$id; - $serial[]='-'; - } - else - { - $serial[]=$id; // end serie or non serie - } - } - $null = array_shift($serial); // remove first value - $list .= array_shift($serial); // add the real first one - $separ = ','; - foreach ($serial as $id) - { - $list .= ($id=='-') ? '' : $separ . $id; - $separ = ($id=='-') ? '-':','; // add comma except if hyphen - } - } - return $list; -} - - -// FIXME Function which could already exist somewhere else -function get_image_ids_for_cats($cat_ids) -{ - $cat_list = implode(',', $cat_ids); - $ret_ids = array(); - $query = ' - SELECT DISTINCT image_id - FROM '.IMAGE_CATEGORY_TABLE.' - WHERE category_id in ('.$cat_list.') - ;'; - return $array_from_query($query, 'image_id'); -} -?> -- cgit v1.2.3