Changeset 1817
- Timestamp:
- Feb 14, 2007, 11:53:02 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/action.php
r1678 r1817 62 62 63 63 64 if ( !isset($_GET['id']) or !is_numeric($_GET['id']) 64 if (!isset($_GET['id']) 65 or !is_numeric($_GET['id']) 65 66 or !isset($_GET['part']) 66 67 or !in_array($_GET['part'], array('t','e','i','h') ) ) … … 69 70 } 70 71 71 $id = $_GET['id'];72 72 $query = ' 73 73 SELECT * FROM '. IMAGES_TABLE.' 74 WHERE id='.$ id.'74 WHERE id='.$_GET['id'].' 75 75 ;'; 76 76 … … 85 85 // are not used because it's not necessary (filter <> restriction) 86 86 $query=' 87 SELECT id FROM '.CATEGORIES_TABLE.' 88 INNER JOIN '.IMAGE_CATEGORY_TABLE.' 89 ON category_id=id 90 WHERE image_id='.$id.' 91 '.get_sql_condition_FandF(array('forbidden_categories' => 'category_id'), 'AND').' 87 SELECT id 88 FROM '.CATEGORIES_TABLE.' 89 INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON category_id = id 90 WHERE image_id = '.$_GET['id'].' 91 '.get_sql_condition_FandF( 92 array('forbidden_categories' => 'category_id'), 93 ' AND' 94 ).' 92 95 LIMIT 1 93 96 ;'; … … 124 127 } 125 128 129 if ($_GET['part'] == 'h') { 130 $is_high = true; 131 pwg_log($_GET['id'], $is_high); 132 } 133 126 134 $http_headers = array(); 127 135 -
trunk/admin/history.php
r1782 r1817 95 95 } 96 96 97 $search['fields']['pictures'] = $_POST['pictures']; 98 $search['fields']['high'] = $_POST['high']; 99 97 100 // echo '<pre>'; print_r($search); echo '</pre>'; 98 101 … … 182 185 } 183 186 187 if (isset($page['search']['fields']['pictures'])) 188 { 189 $clause = null; 190 191 if ($page['search']['fields']['pictures'] == 'no') 192 { 193 $clause = 'image_id IS NULL'; 194 } 195 196 if ($page['search']['fields']['pictures'] == 'only') 197 { 198 $clause = 'image_id IS NOT NULL'; 199 } 200 201 if (isset($clause)) 202 { 203 array_push($clauses, $clause); 204 } 205 } 206 207 if (isset($page['search']['fields']['high'])) 208 { 209 $clause = null; 210 211 if ($page['search']['fields']['high'] == 'no') 212 { 213 $clause = "is_high IS NULL or is_high = 'false'"; 214 } 215 216 if ($page['search']['fields']['high'] == 'only') 217 { 218 $clause = "is_high = 'true'"; 219 } 220 221 if (isset($clause)) 222 { 223 array_push($clauses, $clause); 224 } 225 } 226 184 227 $clauses = prepend_append_array_items($clauses, '(', ')'); 185 228 … … 199 242 200 243 $query = ' 201 SELECT date, time, user_id, IP, section, category_id, tag_ids, image_id 244 SELECT 245 date, 246 time, 247 user_id, 248 IP, 249 section, 250 category_id, 251 tag_ids, 252 image_id, 253 is_high 202 254 FROM '.HISTORY_TABLE.' 203 255 WHERE '.$where_separator.' … … 299 351 ) 300 352 ); 353 354 if (isset($line['image_id'])) 355 { 356 if ($line['is_high'] == 'true') 357 { 358 $template->assign_block_vars('detail.high', array()); 359 } 360 else 361 { 362 $template->assign_block_vars('detail.no_high', array()); 363 } 364 } 301 365 } 302 366 } … … 352 416 { 353 417 $tokens = explode('-', $page['search']['fields']['date-before']); 354 355 (int)$tokens[0]; 356 (int)$tokens[1]; 357 (int)$tokens[2]; 358 } 418 419 $form['end_year'] = (int)$tokens[0]; 420 $form['end_month'] = (int)$tokens[1]; 421 $form['end_day'] = (int)$tokens[2]; 422 } 423 424 $form['pictures'] = $page['search']['fields']['pictures']; 425 $form['high'] = $page['search']['fields']['high']; 359 426 } 360 427 else … … 365 432 $form['start_month'] = $form['end_month'] = date('n'); 366 433 $form['start_day'] = $form['end_day'] = date('j'); 434 $form['pictures'] = 'yes'; 435 $form['high'] = 'yes'; 367 436 } 368 437 … … 380 449 ) 381 450 ); 451 452 foreach (array('pictures', 'high') as $block) 453 { 454 foreach (array('yes', 'no', 'only') as $item) 455 { 456 $selected = ''; 457 458 if ($item == $form[$block]) 459 { 460 $selected = 'selected="selected"'; 461 } 462 463 $template->assign_block_vars( 464 $block.'_option', 465 array( 466 'VALUE' => $item, 467 'CONTENT' => l10n($item), 468 'SELECTED' => $selected, 469 ) 470 ); 471 } 472 } 382 473 383 474 // +-----------------------------------------------------------------------+ -
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) -
trunk/include/functions.inc.php
r1766 r1817 411 411 } 412 412 413 function pwg_log($image_id = null )413 function pwg_log($image_id = null, $is_high = false) 414 414 { 415 415 global $conf, $user, $page; … … 469 469 category_id, 470 470 image_id, 471 is_high, 471 472 tag_ids 472 473 ) … … 484 485 '.(isset($page['category']) ? $page['category'] : 'NULL').', 485 486 '.(isset($image_id) ? $image_id : 'NULL').', 487 '.(isset($image_id) ? "'".boolean_to_string($is_high)."'" : 'NULL').', 486 488 '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').' 487 489 ) -
trunk/include/functions_user.inc.php
r1763 r1817 1090 1090 1091 1091 /* 1092 * Compute sql where condition with restrict and filter data 1093 * 1094 * FandF: Forbidden and Filters 1095 * 1096 * @param $condition_fields array: 1097 * keys are condition to aply and 1098 * values are sql field to use 1099 * array('forbidden_categories' => 'ic.category_id') 1100 * $prefix_condition string: 1101 * this value are concatenated if sql is not empty 1102 * $force_one_condition: 1103 * if there are not condition , use this condition "1 = 1" 1092 * Compute sql where condition with restrict and filter data. "FandF" means 1093 * Forbidden and Filters. 1094 * 1095 * @param array condition_fields: read function body 1096 * @param string prefix_condition: prefixes sql if condition is not empty 1097 * @param boolean force_one_condition: use at least "1 = 1" 1104 1098 * 1105 1099 * @return string sql where/conditions 1106 1100 */ 1107 function get_sql_condition_FandF($condition_fields, $prefix_condition = null, $force_one_condition = false) 1101 function get_sql_condition_FandF( 1102 $condition_fields, 1103 $prefix_condition = null, 1104 $force_one_condition = false 1105 ) 1108 1106 { 1109 1107 global $user, $filter; … … 1116 1114 { 1117 1115 case 'forbidden_categories': 1116 { 1118 1117 if (!empty($user['forbidden_categories'])) 1119 1118 { 1120 $sql_list[] = $field_name.' NOT IN ('.$user['forbidden_categories'].')'; 1119 $sql_list[] = 1120 $field_name.' NOT IN ('.$user['forbidden_categories'].')'; 1121 1121 } 1122 1122 break; 1123 1123 } 1124 1124 case 'visible_categories': 1125 { 1125 1126 if (!empty($filter['visible_categories'])) 1126 1127 { 1127 $sql_list[] = $field_name.' IN ('.$filter['visible_categories'].')'; 1128 $sql_list[] = 1129 $field_name.' IN ('.$filter['visible_categories'].')'; 1128 1130 } 1129 1131 break; 1130 1132 } 1131 1133 case 'visible_images': 1134 { 1132 1135 if (!empty($filter['visible_images'])) 1133 1136 { 1134 $sql_list[] = $field_name.' IN ('.$filter['visible_images'].')'; 1137 $sql_list[] = 1138 $field_name.' IN ('.$filter['visible_images'].')'; 1135 1139 } 1136 1140 break; 1137 1141 } 1138 1142 default: 1143 { 1139 1144 die('Unknow condition'); 1140 1145 break; 1141 1146 } 1142 1147 } 1143 1148 } -
trunk/install/phpwebgallery_structure.sql
r1791 r1817 127 127 `image_id` mediumint(8) default NULL, 128 128 `summarized` enum('true','false') default 'false', 129 `is_high` enum('true','false') default NULL, 129 130 PRIMARY KEY (`id`), 130 131 KEY `history_i1` (`summarized`) -
trunk/template/yoga/admin/history.tpl
r1780 r1817 50 50 </ul> 51 51 52 <ul> 53 <li><label></label></li> 54 <li></li> 55 </ul> 56 57 <label> 58 {lang:Pictures} 59 <select name="pictures"> 60 <!-- BEGIN pictures_option --> 61 <option 62 value="{pictures_option.VALUE}" 63 {pictures_option.SELECTED} 64 > 65 {pictures_option.CONTENT} 66 </option> 67 <!-- END pictures_option --> 68 </select> 69 </label> 70 71 <label> 72 {lang:High quality} 73 <select name="high"> 74 <!-- BEGIN high_option --> 75 <option 76 value="{high_option.VALUE}" 77 {high_option.SELECTED} 78 > 79 {high_option.CONTENT} 80 </option> 81 <!-- END high_option --> 82 </select> 83 </label> 84 52 85 <input class="submit" type="submit" name="submit" value="{lang:submit}" {TAG_INPUT_ENABLED}/> 53 86 </fieldset> … … 69 102 <th>{lang:IP}</th> 70 103 <th>{lang:image}</th> 104 <th>{lang:high quality}</th> 71 105 <th>{lang:section}</th> 72 106 <th>{lang:category}</th> … … 80 114 <td>{detail.IP}</td> 81 115 <td>{detail.IMAGE}</td> 116 <td> 117 <!-- BEGIN high --> 118 <img src="{themeconf:icon_dir}/check.png" alt="{lang:yes}"> 119 <!-- END high --> 120 <!-- BEGIN no_high --> 121 <img src="{themeconf:icon_dir}/uncheck.png" alt="{lang:no}"> 122 <!-- END no_high --> 123 </td> 82 124 <td>{detail.SECTION}</td> 83 125 <td>{detail.CATEGORY}</td>
Note: See TracChangeset
for help on using the changeset viewer.