Changeset 1817 for trunk/admin/include
- Timestamp:
- Feb 14, 2007, 11:53:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r1794 r1817 607 607 SET '; 608 608 $is_first = true; 609 foreach ($dbfields['update'] as $ num => $key)609 foreach ($dbfields['update'] as $key) 610 610 { 611 611 if (!$is_first) … … 626 626 $query.= ' 627 627 WHERE '; 628 foreach ($dbfields['primary'] as $num => $key) 628 629 $is_first = true; 630 foreach ($dbfields['primary'] as $key) 629 631 { 630 if ( $num > 1)632 if (!$is_first) 631 633 { 632 634 $query.= ' AND '; 633 635 } 634 636 $query.= $key.' = \''.$data[$key].'\''; 637 $is_first = false; 635 638 } 636 639 $query.= ' … … 1903 1906 1904 1907 /** 1908 * Create an XML file with PhpWebGallery informations about a list of 1909 * pictures. 1910 * 1911 * The goal of the export feature is to make easier the reading of 1912 * informations related to pictures outside of PhpWebGallery. 1913 * 1914 * @param array image_ids 1915 */ 1916 function export_pwg_data($image_ids) 1917 { 1918 global $conf; 1919 1920 if (count($image_ids) == 0) 1921 { 1922 return; 1923 } 1924 1925 $fp = fopen($conf['export_file'], 'w'); 1926 $xml_string = '<export>'."\n"; 1927 1928 $query = ' 1929 SELECT tag_id, 1930 image_id 1931 FROM '.IMAGE_TAG_TABLE.' 1932 WHERE image_id IN ('.implode(',', $image_ids).') 1933 ;'; 1934 $result = pwg_query($query); 1935 $tags_of = array(); 1936 $all_tag_ids = array(); 1937 $tag_name_of = array(); 1938 1939 if (mysql_num_rows($result)) 1940 { 1941 while ($row = mysql_fetch_array($result)) 1942 { 1943 array_push($all_tag_ids, $row['tag_id']); 1944 1945 if (!isset($tags_of[ $row['image_id'] ])) { 1946 $tags_of[ $row['image_id'] ] = array(); 1947 } 1948 1949 array_push( 1950 $tags_of[ $row['image_id'] ], 1951 $row['tag_id'] 1952 ); 1953 } 1954 1955 $all_tag_ids = array_unique($all_tag_ids); 1956 1957 $query = ' 1958 SELECT id, 1959 name 1960 FROM '.TAGS_TABLE.' 1961 WHERE id IN ('.implode(',', $all_tag_ids).') 1962 ;'; 1963 $result = pwg_query($query); 1964 1965 while ($row = mysql_fetch_array($result)) 1966 { 1967 $tag_name_of[ $row['id'] ] = $row['name']; 1968 } 1969 } 1970 1971 $query = ' 1972 SELECT id, 1973 path 1974 FROM '.IMAGES_TABLE.' 1975 WHERE id IN ('.implode(',', $image_ids).') 1976 ;'; 1977 $result = pwg_query($query); 1978 1979 while ($row = mysql_fetch_array($result)) 1980 { 1981 $xml_string.= " <photo>\n"; 1982 $xml_string.= " <id>".$row['id']."</id>\n"; 1983 $xml_string.= " <path>".$row['path']."</path>\n"; 1984 1985 foreach ($tags_of[ $row['id'] ] as $tag_id) 1986 { 1987 $xml_string.= " <tag>".$tag_name_of[$tag_id]."</tag>\n"; 1988 } 1989 1990 $xml_string.= " </photo>\n"; 1991 } 1992 1993 $xml_string.= '</export>'; 1994 fwrite($fp, $xml_string); 1995 fclose($fp); 1996 } 1997 1998 /** 1905 1999 * Check configuration and add notes on problem 1906 2000 * … … 1938 2032 } 1939 2033 } 1940 1941 2034 /** 1942 2035 * Refer main PhpWebGallery URLs (currently PHPWG_DOMAIN domain)
Note: See TracChangeset
for help on using the changeset viewer.