diff --git a/.gitignore b/.gitignore index b7c032e..b9fd70d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /csv +/translation-importer diff --git a/csv_check.php b/csv_check.php index fa28983..4f39499 100644 --- a/csv_check.php +++ b/csv_check.php @@ -1,45 +1,44 @@ ';print_r($allowed);echo ''; echo '1: Only allowed tags (column names) used?'; $fp = fopen ( $csv_datei, 'r' ); $y = 1; -$error=0; +$error = 0; $zeile = fgetcsv ( $fp, 100000, ';' ); -for ( $x = 0; $x < count ( $zeile ); $x++ ) +for ($x = 0; $x < count ( $zeile ); $x++) { - $zeile[$x] = str_replace("\xEF\xBB\xBF","",$zeile[$x]); - $inhalt[$y][$x] = $zeile[$x]; - if (!in_array($inhalt[1][$x], $allowed)) - { - echo '
ERROR in column '.$x.' created by value: '.$inhalt[1][$x].''; - $error=$error+1; - } - //echo '
';var_dump($inhalt[1][$x]); + $zeile[$x] = str_replace("\xEF\xBB\xBF", "", $zeile[$x]); + $inhalt[$y][$x] = $zeile[$x]; + if (!in_array($inhalt[1][$x], $allowed)) { + echo '
ERROR in column ' . $x . ' created by value: ' . $inhalt[1][$x] . ''; + $error = $error + 1; + } + //echo '
';var_dump($inhalt[1][$x]); } fclose($fp); $erstezeile = $zeile; @@ -47,508 +46,409 @@ if ($error != 0) echo '
Not allowed tags found !
2: Not allowed multiple use of tags (column names)?'; -$compare=array_unique($zeile); -function identical_values( $arrayA , $arrayB ) +$compare = array_unique($zeile); + +function identical_values($arrayA, $arrayB) { sort( $arrayA ); sort( $arrayB ); return $arrayA == $arrayB; + } -$result = identical_values($zeile,$compare); -if ($result==false) -{ - echo '
There are dublicate column names !'; - $error=$error+1; +$result = identical_values($zeile, $compare); +if ($result == false) { + echo '
There are dublicate column names !'; + $error = $error + 1; } else { - echo '
No dublicate column names !'; + echo '
No dublicate column names !'; } //// Get values into memory for following checks $fp = fopen ( $csv_datei, 'r' ); -$y=0; +$y = 0; while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) { - $y++; - //echo '
';print_r($zeile); - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x] = str_replace("'","\'",$zeile[$x]); - } + $y++; + //echo '
';print_r($zeile); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = str_replace("'", "\'", $zeile[$x]); + } } fclose($fp); ///// Check #3 echo '

3: Mandatory tags available and always filled in?'; unset($inv_array); -$inv_error=0; -function get_duplicates( $array ) +$inv_error = 0; + +function get_duplicates($array) { return array_unique( array_diff_assoc( $array, array_unique( $array ) ) ); + } -$mandatory=array('inventory_number','object_type','object_title','object_description'); -for ($i=0;$iMandatory: Column '.$mandatory[$i].' missing'; - $error=$error+1; - $inv_error=$inv_error+1; - } - else - { - $spaltenr=array_search($mandatory[$i],$erstezeile); - for ($j=0;$j<$y;$j++) - { - if ($inhalt[$j+1][$spaltenr]=='') - { - echo '
Missing value for '.$mandatory[$i].' in row '.($j+1).''; - $error=$error+1; - $inv_error=$inv_error+1; - } - if ($mandatory[$i]=='inventory_number') - { - $inv_array[]=$inhalt[$j+1][$spaltenr]; - } + if (!in_array($mandatory[$i], $erstezeile)) { + echo '
Mandatory: Column ' . $mandatory[$i] . ' missing'; + $error = $error + 1; + $inv_error = $inv_error + 1; + } + else + { + $spaltenr = array_search($mandatory[$i], $erstezeile); + for ($j = 0; $j < $y; $j++) + { + if ($inhalt[$j + 1][$spaltenr] == '') { + echo '
Missing value for ' . $mandatory[$i] . ' in row ' . ($j + 1) . ''; + $error = $error + 1; + $inv_error = $inv_error + 1; + } + if ($mandatory[$i] == 'inventory_number') { + $inv_array[] = $inhalt[$j + 1][$spaltenr]; + } + } } - } } -if ($inv_error==0) echo '
All mandatory tags available and with values !'; +if ($inv_error == 0) echo '
All mandatory tags available and with values !'; ///// Check #4 echo '

4: Inventory_number unique ?'; -if (in_array('inventory_number',$erstezeile)) -{ - $doppelte_inv=get_duplicates($inv_array); - $doppelte_inv = array_values($doppelte_inv); - if (count($doppelte_inv)>0) - { - for ($i=0;$iMultiple use of inventory_number '.$doppelte_inv[$i].''; - $error=$error+1; +if (in_array('inventory_number', $erstezeile)) { + $doppelte_inv = get_duplicates($inv_array); + $doppelte_inv = array_values($doppelte_inv); + if (count($doppelte_inv) > 0) { + for ($i = 0; $i < count($doppelte_inv); $i++) + { + echo '
Multiple use of inventory_number ' . $doppelte_inv[$i] . ''; + $error = $error + 1; + } } - } - else echo '
All inventory_numbers are unique !'; + else echo '
All inventory_numbers are unique !'; } else { - echo '
Aborted, column inventory_number is missing'; - $error=$error+1; + echo '
Aborted, column inventory_number is missing'; + $error = $error + 1; } ///// Check #5 echo '

5: Dependent colums observed ?
'; -if (array_search('object_other_title',$erstezeile)!==false) -{ - if (array_search('object_other_title_kind_of',$erstezeile)===false) - { - $depencymessage[]='One column of object_other_title, object_other_title_kind_of is missing'; - } +if (array_search('object_other_title', $erstezeile) !== false) { + if (array_search('object_other_title_kind_of', $erstezeile) === false) { + $depencymessage[] = 'One column of object_other_title, object_other_title_kind_of is missing'; + } } -if (array_search('object_other_title_kind_of',$erstezeile)!==false) -{ - if (array_search('object_other_title',$erstezeile)===false) - { - $depencymessage[]='One column of object_other_title, object_other_title_kind_of is missing'; - } +if (array_search('object_other_title_kind_of', $erstezeile) !== false) { + if (array_search('object_other_title', $erstezeile) === false) { + $depencymessage[] = 'One column of object_other_title, object_other_title_kind_of is missing'; + } } -if (array_search('other_object_title',$erstezeile)!==false) -{ - if (array_search('other_object_title_in',$erstezeile)===false) - { - $depencymessage[]='One column of other_object_title, other_object_title_in is missing'; - } +if (array_search('other_object_title', $erstezeile) !== false) { + if (array_search('other_object_title_in', $erstezeile) === false) { + $depencymessage[] = 'One column of other_object_title, other_object_title_in is missing'; + } } -if (array_search('other_object_title_in',$erstezeile)!==false) -{ - if (array_search('other_object_title',$erstezeile)===false) - { - $depencymessage[]='One column of other_object_title, other_object_title_in is missing'; - } +if (array_search('other_object_title_in', $erstezeile) !== false) { + if (array_search('other_object_title', $erstezeile) === false) { + $depencymessage[] = 'One column of other_object_title, other_object_title_in is missing'; + } } -if (array_search('detailed_description',$erstezeile)!==false) -{ - if (array_search('detailed_description_md',$erstezeile)===false or array_search('detailed_description_extern',$erstezeile)===false) - { - $depencymessage[]='One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; - } +if (array_search('detailed_description', $erstezeile) !== false) { + if (array_search('detailed_description_md', $erstezeile) === false or array_search('detailed_description_extern', $erstezeile) === false) { + $depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; + } } -if (array_search('detailed_description_md',$erstezeile)!==false) -{ - if (array_search('detailed_description',$erstezeile)===false or array_search('detailed_description_extern',$erstezeile)===false) - { - $depencymessage[]='One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; - } +if (array_search('detailed_description_md', $erstezeile) !== false) { + if (array_search('detailed_description', $erstezeile) === false or array_search('detailed_description_extern', $erstezeile) === false) { + $depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; + } } -if (array_search('detailed_description_extern',$erstezeile)!==false) -{ - if (array_search('detailed_description',$erstezeile)===false or array_search('detailed_description_md',$erstezeile)===false) - { - $depencymessage[]='One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; - } +if (array_search('detailed_description_extern', $erstezeile) !== false) { + if (array_search('detailed_description', $erstezeile) === false or array_search('detailed_description_md', $erstezeile) === false) { + $depencymessage[] = 'One column of detailed_description, detailed_description_md, detailed_description_extern is missing'; + } } // dependency of colums: inscription. If one of inscription or inscription_md or inscription_extern is given - all three are necessary -if (array_search('inscription',$erstezeile)!==false) -{ - if (array_search('inscription_md',$erstezeile)===false or array_search('inscription_extern',$erstezeile)===false) - { - $depencymessage[]='One column of inscription, inscription_md, inscription_extern is missing'; - } +if (array_search('inscription', $erstezeile) !== false) { + if (array_search('inscription_md', $erstezeile) === false or array_search('inscription_extern', $erstezeile) === false) { + $depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing'; + } } -if (array_search('inscription_md',$erstezeile)!==false) -{ - if (array_search('inscription',$erstezeile)===false or array_search('inscription_extern',$erstezeile)===false) - { - $depencymessage[]='One column of inscription, inscription_md, inscription_extern is missing'; - } +if (array_search('inscription_md', $erstezeile) !== false) { + if (array_search('inscription', $erstezeile) === false or array_search('inscription_extern', $erstezeile) === false) { + $depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing'; + } } -if (array_search('inscription_extern',$erstezeile)!==false) -{ - if (array_search('inscription',$erstezeile)===false or array_search('inscription_md',$erstezeile)===false) - { - $depencymessage[]='One column of inscription, inscription_md, inscription_extern is missing'; - } +if (array_search('inscription_extern', $erstezeile) !== false) { + if (array_search('inscription', $erstezeile) === false or array_search('inscription_md', $erstezeile) === false) { + $depencymessage[] = 'One column of inscription, inscription_md, inscription_extern is missing'; + } } // dependency of colums: object_group1 to 5. If one of object_group_name1 or object_group_description1 or object_group_show1 is given - all three are necessary -for ($og=1;$og<6;$og++) +for ($og = 1; $og < 6; $og++) { - if (array_search('object_group_name'.$og,$erstezeile)!==false) - { - if (array_search('object_group_description'.$og,$erstezeile)===false or array_search('object_group_show'.$og,$erstezeile)===false) - { - $depencymessage[]='One column of object_group_name'.$og.', object_group_description'.$og.', object_group_show'.$og.' is missing'; + if (array_search('object_group_name' . $og, $erstezeile) !== false) { + if (array_search('object_group_description' . $og, $erstezeile) === false or array_search('object_group_show' . $og, $erstezeile) === false) { + $depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing'; + } } - } - if (array_search('object_group_description'.$og,$erstezeile)!==false) - { - if (array_search('object_group_name'.$og,$erstezeile)===false or array_search('object_group_show'.$og,$erstezeile)===false) - { - $depencymessage[]='One column of object_group_name'.$og.', object_group_description'.$og.', object_group_show'.$og.' is missing'; + if (array_search('object_group_description' . $og, $erstezeile) !== false) { + if (array_search('object_group_name' . $og, $erstezeile) === false or array_search('object_group_show' . $og, $erstezeile) === false) { + $depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing'; + } } - } - if (array_search('object_group_show'.$og,$erstezeile)!==false) - { - if (array_search('object_group_name'.$og,$erstezeile)===false or array_search('object_group_description'.$og,$erstezeile)===false) - { - $depencymessage[]='One column of object_group_name'.$og.', object_group_description'.$og.', object_group_show'.$og.' is missing'; + if (array_search('object_group_show' . $og, $erstezeile) !== false) { + if (array_search('object_group_name' . $og, $erstezeile) === false or array_search('object_group_description' . $og, $erstezeile) === false) { + $depencymessage[] = 'One column of object_group_name' . $og . ', object_group_description' . $og . ', object_group_show' . $og . ' is missing'; + } } - } } // dependency of colums: images. If one of image_name1 or image_rights1 or image_visible1 is given - all three are necessary -for ($im=1;$im<29;$im++) +for ($im = 1; $im < 29; $im++) { - if (array_search('image_name'.$im,$erstezeile)!==false) - { - if (array_search('image_rights'.$im,$erstezeile)===false or array_search('image_visible'.$im,$erstezeile)===false or array_search('image_main'.$im,$erstezeile)===false) - { - $depencymessage[]='One column of image_name'.$im.', image_rights'.$im.', image_visible'.$im.', image_main'.$im.' is missing'; } - } - if (array_search('image_rights'.$im,$erstezeile)!==false) - { - if (array_search('image_name'.$im,$erstezeile)===false or array_search('image_visible'.$im,$erstezeile)===false or array_search('image_main'.$im,$erstezeile)===false) - { - $depencymessage[]='One column of image_name'.$im.', image_rights'.$im.', image_visible'.$im.', image_main'.$im.' is missing'; } - } - if (array_search('image_visible'.$im,$erstezeile)!==false) - { - if (array_search('image_name'.$im,$erstezeile)===false or array_search('image_rights'.$im,$erstezeile)===false or array_search('image_main'.$im,$erstezeile)===false) - { - $depencymessage[]='One column of image_name'.$im.', image_rights'.$im.', image_visible'.$im.', image_main'.$im.' is missing'; } - } - if (array_search('image_main'.$im,$erstezeile)!==false) - { - if (array_search('image_name'.$im,$erstezeile)===false or array_search('image_rights'.$im,$erstezeile)===false or array_search('image_visible'.$im,$erstezeile)===false) - { - $depencymessage[]='One column of image_name'.$im.', image_rights'.$im.', image_visible'.$im.', image_main'.$im.' is missing'; + if (array_search('image_name' . $im, $erstezeile) !== false) { + if (array_search('image_rights' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) { + $depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing'; + } + } + if (array_search('image_rights' . $im, $erstezeile) !== false) { + if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) { + $depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing'; + } + } + if (array_search('image_visible' . $im, $erstezeile) !== false) { + if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_rights' . $im, $erstezeile) === false or array_search('image_main' . $im, $erstezeile) === false) { + $depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing'; + } + } + if (array_search('image_main' . $im, $erstezeile) !== false) { + if (array_search('image_name' . $im, $erstezeile) === false or array_search('image_rights' . $im, $erstezeile) === false or array_search('image_visible' . $im, $erstezeile) === false) { + $depencymessage[] = 'One column of image_name' . $im . ', image_rights' . $im . ', image_visible' . $im . ', image_main' . $im . ' is missing'; + } } - } } // dependency of colums: comparable_objects_other_museums. If one of comparable_objects_other_museums or comparable_objects_other_museums_show_md or comparable_objects_other_museums_show_extern is given - all three are necessary -if (array_search('comparable_objects_other_museums',$erstezeile)!==false) -{ - if (array_search('comparable_objects_other_museums_show_md',$erstezeile)===false or array_search('comparable_objects_other_museums_show_extern',$erstezeile)===false) - { - $depencymessage[]='One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing'; - } -} -if (array_search('comparable_objects_other_museums_show_md',$erstezeile)!==false) -{ - if (array_search('comparable_objects_other_museums',$erstezeile)===false or array_search('comparable_objects_other_museums_show_extern',$erstezeile)===false) - { - $depencymessage[]='One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing'; - } -} -if (array_search('comparable_objects_other_museums_show_extern',$erstezeile)!==false) -{ - if (array_search('comparable_objects_other_museums',$erstezeile)===false or array_search('comparable_objects_other_museums_show_md',$erstezeile)===false) - { - $depencymessage[]='One column of comparable_objects_other_museums, comparable_objects_other_museums_show_md, comparable_objects_other_museums_show_extern is missing'; - } -} - -if (array_search('dimensions_separate_length_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_length_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_length_value, dimensions_separate_length_unit is missing'; - } -} -if (array_search('dimensions_separate_length_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_length_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_length_value, dimensions_separate_length_unit is missing'; - } -} -if (array_search('dimensions_separate_width_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_width_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_width_value, dimensions_separate_width_unit is missing'; - } -} -if (array_search('dimensions_separate_width_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_width_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_width_value, dimensions_separate_width_unit is missing'; - } -} -if (array_search('dimensions_separate_height_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_height_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_height_value, dimensions_separate_height_unit is missing'; - } -} -if (array_search('dimensions_separate_height_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_height_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_height_value, dimensions_separate_height_unit is missing'; - } -} -if (array_search('dimensions_separate_diameter_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_diameter_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_diameter_value, dimensions_separate_diameter_unit is missing'; - } -} -if (array_search('dimensions_separate_diameter_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_diameter_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_diameter_value, dimensions_separate_diameter_unit is missing'; - } -} -if (array_search('dimensions_separate_wall_thickness_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_wall_thickness_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_wall_thickness_value, dimensions_separate_wall_thickness_unit is missing'; - } -} -if (array_search('dimensions_separate_wall_thickness_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_wall_thickness_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_wall_thickness_value, dimensions_separate_wall_thickness_unit is missing'; - } -} -if (array_search('dimensions_separate_weight_value',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_weight_unit',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_weight_value, dimensions_separate_weight_unit is missing'; - } -} -if (array_search('dimensions_separate_weight_unit',$erstezeile)!==false) -{ - if (array_search('dimensions_separate_weight_value',$erstezeile)===false) - { - $depencymessage[]='One column of dimensions_separate_weight_value, dimensions_separate_weight_unit is missing'; - } -} -if (array_search('closer_location',$erstezeile)!==false) -{ - if (array_search('closer_location_as',$erstezeile)===false) - { - $depencymessage[]='One column of closer_location, closer_location_as is missing'; - } -} -if (array_search('closer_location_as',$erstezeile)!==false) -{ - if (array_search('closer_location',$erstezeile)===false) - { - $depencymessage[]='One column of closer_location, closer_location_as is missing'; - } -} -if (array_search('bought_for',$erstezeile)!==false) -{ - if (array_search('bought_for_currency',$erstezeile)===false) - { - $depencymessage[]='One column of bought_for, bought_for_currency is missing'; - } -} -if (array_search('bought_for_currency',$erstezeile)!==false) -{ - if (array_search('bought_for',$erstezeile)===false) - { - $depencymessage[]='One column of bought_for, bought_for_currency is missing'; - } -} -if (array_search('worth_value',$erstezeile)!==false) -{ - if (array_search('worth_unit',$erstezeile)===false) - { - $depencymessage[]='One column of worth_value, worth_unit is missing'; - } -} -if (array_search('worth_unit',$erstezeile)!==false) -{ - if (array_search('worth_value',$erstezeile)===false) - { - $depencymessage[]='One column of worth_value, worth_unit is missing'; - } -} -if (array_search('worth_insurance_value',$erstezeile)!==false) -{ - if (array_search('worth_insurance_unit',$erstezeile)===false) - { - $depencymessage[]='One column of worth_insurance_value, worth_insurance_unit is missing'; - } -} -if (array_search('worth_insurance_unit',$erstezeile)!==false) -{ - if (array_search('worth_insurance_value',$erstezeile)===false) - { - $depencymessage[]='One column of worth_insurance_value, worth_insurance_unit is missing'; - } -} -if (array_search('link_url1',$erstezeile)!==false) -{ - if (array_search('link_show1',$erstezeile)===false) - { - $depencymessage[]='One column of link_url1, link_show1 is missing'; - } -} -if (array_search('link_show1',$erstezeile)!==false) -{ - if (array_search('link_url1',$erstezeile)===false) - { - $depencymessage[]='One column of link_url1, link_show1 is missing'; - } -} -if (array_search('link_url2',$erstezeile)!==false) -{ - if (array_search('link_show2',$erstezeile)===false) - { - $depencymessage[]='One column of link_url2, link_show2 is missing'; - } -} -if (array_search('link_show2',$erstezeile)!==false) -{ - if (array_search('link_url2',$erstezeile)===false) - { - $depencymessage[]='One column of link_url2, link_show2 is missing'; - } -} - -for ($i=0;$iDependent columns were not observed !'; - for ($i=0;$i'.$depencymessage[$i]; - $error=$error+1; - } + if (array_search($eventpart[$i], $erstezeile) !== false) { + if (array_search($eventpartsure[$i], $erstezeile) === false) { + echo $eventpart[$i]; + $depencymessage[] = 'One column of ' . $eventpart[$i] . ', ' . $eventpartsure[$i] . ' is missing'; + } + } + if (array_search($eventpartsure[$i], $erstezeile) !== false) { + if (array_search($eventpart[$i], $erstezeile) === false) { + $depencymessage[] = 'One column of ' . $eventpart[$i] . ', ' . $eventpartsure[$i] . ' is missing'; + } + } +} + +if (isset($depencymessage) and $depencymessage != '') { + echo 'Dependent columns were not observed !'; + for ($i = 0; $i < count ($depencymessage); $i++) + { + echo '
' . $depencymessage[$i]; + $error = $error + 1; + } } else { - echo 'Dependent columns were observed !'; + echo 'Dependent columns were observed !'; } ///// Check #6 echo '

6: Dependency of content observed?'; -$depcon_error=0; -for ($l=0;$lTag '.$crosscheck2[$l].' given but no entry for '.$crosscheck1[$l].' (row '.$j.')'; - $depcon_error=$depcon_error+1; - } + if (in_array($crosscheck1[$l], $erstezeile)) { + for ($j = 1; $j < ($y + 1); $j++) + { + if ($inhalt[$j][array_search($crosscheck2[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($crosscheck1[$l], $erstezeile)] == '') { + echo '
Tag ' . $crosscheck2[$l] . ' given but no entry for ' . $crosscheck1[$l] . ' (row ' . $j . ')'; + $depcon_error = $depcon_error + 1; + } + } } - } } -for ($l=0;$lTag '.$eventpartsure[$l].' given but no entry for '.$eventpart[$l].' (row '.$j.')'; - $depcon_error=$depcon_error+1; - } + if (in_array($eventpart[$l], $erstezeile)) { + for ($j = 1; $j < ($y + 1); $j++) + { + if ($inhalt[$j][array_search($eventpartsure[$l], $erstezeile)] !== '' and $inhalt[$j][array_search($eventpart[$l], $erstezeile)] == '') { + echo '
Tag ' . $eventpartsure[$l] . ' given but no entry for ' . $eventpart[$l] . ' (row ' . $j . ')'; + $depcon_error = $depcon_error + 1; + } + } } - } } -if (in_array('dimensions_separate_show_md',$erstezeile)) -{ - for ($j=1;$j<($y+1);$j++) - { - if ($inhalt[$j][array_search('dimensions_separate_show_md',$erstezeile)]!=='' and ($inhalt[$j][array_search('dimensions_separate_length_value',$erstezeile)]=='') and $inhalt[$j][array_search('dimensions_separate_width_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_heigt_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_weight_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_diameter_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value',$erstezeile)]=='') +if (in_array('dimensions_separate_show_md', $erstezeile)) { + for ($j = 1; $j < ($y + 1); $j++) { - echo '
Tag dimensions_separate_show_md given but no separate values available (row '.$j.')'; - $depcon_error=$depcon_error+1; + if ($inhalt[$j][array_search('dimensions_separate_show_md', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') { + echo '
Tag dimensions_separate_show_md given but no separate values available (row ' . $j . ')'; + $depcon_error = $depcon_error + 1; + } } - } } -if (in_array('dimensions_separate_show_extern',$erstezeile)) -{ - for ($j=1;$j<($y+1);$j++) - { - if ($inhalt[$j][array_search('dimensions_separate_show_extern',$erstezeile)]!=='' and ($inhalt[$j][array_search('dimensions_separate_length_value',$erstezeile)]=='') and $inhalt[$j][array_search('dimensions_separate_width_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_heigt_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_weight_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_diameter_value',$erstezeile)]=='' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value',$erstezeile)]=='') +if (in_array('dimensions_separate_show_extern', $erstezeile)) { + for ($j = 1; $j < ($y + 1); $j++) { - echo '
Tag dimensions_separate_show_extern given but no separate values available (row '.$j.')'; - $depcon_error=$depcon_error+1; + if ($inhalt[$j][array_search('dimensions_separate_show_extern', $erstezeile)] !== '' and ($inhalt[$j][array_search('dimensions_separate_length_value', $erstezeile)] == '') and $inhalt[$j][array_search('dimensions_separate_width_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_heigt_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_weight_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_diameter_value', $erstezeile)] == '' and $inhalt[$j][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') { + echo '
Tag dimensions_separate_show_extern given but no separate values available (row ' . $j . ')'; + $depcon_error = $depcon_error + 1; + } } - } } /* for ($im=1;$im<11;$im++) @@ -567,222 +467,193 @@ for ($im=1;$im<11;$im++) echo '
TAG image_name'.$im.' given but no value available for image_visible'.$im.' (row '.$j.')'; $depcon_error=$depcon_error+1; } - } + } } } */ -if ($depcon_error==0) echo '
Dependency of content was observed !'; +if ($depcon_error == 0) echo '
Dependency of content was observed !'; ///// Check #7 echo '

7: Not allowed values in controlled lists?
'; -for ($i=1;$i<=$y;$i++) +for ($i = 1; $i <= $y; $i++) { - for ($j=0;$j'; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_object_other_title_kind_of)) $errormessage[]='Not allowed value in column object_other_title_kind_of: '.$showvalue.' (row '.$i.')'; + if ($inhalt[1][$j] == 'object_other_title_kind_of' and !$inhalt[$i][array_search('object_other_title', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_object_other_title_kind_of)) $errormessage[] = 'Not allowed value in column object_other_title_kind_of: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'other_object_title_in' and !$inhalt[$i][array_search('other_object_title', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_other_object_title_in)) $errormessage[] = 'Not allowed value in column other_object_title_in: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'closer_location_as' and !$inhalt[$i][array_search('closer_location', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_closer_location_as)) $errormessage[] = 'Not allowed value in column closer_location_as: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'inclusion_kind_of') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_inclusion_kind_of)) $errormessage[] = 'Not allowed value in column inclusion_kind_of: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'bought_for_currency' and !$inhalt[$i][array_search('bought_for', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column bought_for_currency: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'worth_unit' and !$inhalt[$i][array_search('worth_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column worth_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'worth_insurance_unit' and !$inhalt[$i][array_search('worth_insurance_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_currency)) $errormessage[] = 'Not allowed value in column worth_insurance_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'detailed_description_md' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column detailed_description_md: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'detailed_description_extern' and !$inhalt[$i][array_search('detailed_description', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column detailed_description_extern: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'inscription_md' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column inscription_md: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'inscription_extern' and !$inhalt[$i][array_search('inscription', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column inscription_extern: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_length_unit' and !$inhalt[$i][array_search('dimensions_separate_length_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_length_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_width_unit' and !$inhalt[$i][array_search('dimensions_separate_width_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_width_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_height_unit' and !$inhalt[$i][array_search('dimensions_separate_height_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_height_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_diameter_unit' and !$inhalt[$i][array_search('dimensions_separate_diameter_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_diameter_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_wall_thickness_unit' and !$inhalt[$i][array_search('dimensions_separate_wall_thickness_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_measurements)) $errormessage[] = 'Not allowed value in column dimensions_separate_wall_thickness_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_weight_unit' and !$inhalt[$i][array_search('dimensions_separate_weight_value', $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_weight)) $errormessage[] = 'Not allowed value in column dimensions_separate_weight_unit: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_show_md') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column dimensions_separate_show_md: ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'dimensions_separate_show_extern') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if (!in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column dimensions_separate_show_extern: ' . $showvalue . ' (row ' . $i . ')'; + } + for ($og = 1; $og < 6; $og++) + { + if ($inhalt[1][$j] == 'object_group_show' . $og and !$inhalt[$i][array_search('object_group_name' . $og, $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column object_group_show' . $og . ': ' . $showvalue . ' (row ' . $i . ')'; + } + } + for ($im = 1; $im < 29; $im++) + { + if ($inhalt[1][$j] == 'image_visible' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column image_visible' . $im . ': ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'image_main' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column image_main' . $im . ': ' . $showvalue . ' (row ' . $i . ')'; + } + if ($inhalt[1][$j] == 'image_rights' . $im and !$inhalt[$i][array_search('image_name' . $im, $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_image_rights)) $errormessage[] = 'Not allowed value in column image_rights' . $im . ': ' . $showvalue . ' (row ' . $i . ')'; + } + } + for ($k = 0; $k < count($eventpartsure); $k++) + { + if ($inhalt[1][$j] == $eventpartsure[$k] and !$inhalt[$i][array_search($eventpart[$k], $erstezeile)] == '') { + if ($inhalt[$i][$j] != '') $showvalue = '' . $inhalt[$i][$j] . ''; else $showvalue = '[empty]'; + if ($i > 1 and !in_array($inhalt[$i][$j], $allowed_yesno)) $errormessage[] = 'Not allowed value in column ' . $eventpartsure[$k] . ': ' . $showvalue . ' (row ' . $i . ')'; + } + } } - if ($inhalt[1][$j]=='other_object_title_in' and !$inhalt[$i][array_search('other_object_title',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_other_object_title_in)) $errormessage[]='Not allowed value in column other_object_title_in: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='closer_location_as' and !$inhalt[$i][array_search('closer_location',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_closer_location_as)) $errormessage[]='Not allowed value in column closer_location_as: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='inclusion_kind_of') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_inclusion_kind_of)) $errormessage[]='Not allowed value in column inclusion_kind_of: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='bought_for_currency' and !$inhalt[$i][array_search('bought_for',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_currency)) $errormessage[]='Not allowed value in column bought_for_currency: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='worth_unit' and !$inhalt[$i][array_search('worth_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_currency)) $errormessage[]='Not allowed value in column worth_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='worth_insurance_unit' and !$inhalt[$i][array_search('worth_insurance_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_currency)) $errormessage[]='Not allowed value in column worth_insurance_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='detailed_description_md' and !$inhalt[$i][array_search('detailed_description',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column detailed_description_md: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='detailed_description_extern' and !$inhalt[$i][array_search('detailed_description',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column detailed_description_extern: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='inscription_md' and !$inhalt[$i][array_search('inscription',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column inscription_md: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='inscription_extern' and !$inhalt[$i][array_search('inscription',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column inscription_extern: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_length_unit' and !$inhalt[$i][array_search('dimensions_separate_length_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_measurements)) $errormessage[]='Not allowed value in column dimensions_separate_length_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_width_unit' and !$inhalt[$i][array_search('dimensions_separate_width_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_measurements)) $errormessage[]='Not allowed value in column dimensions_separate_width_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_height_unit' and !$inhalt[$i][array_search('dimensions_separate_height_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_measurements)) $errormessage[]='Not allowed value in column dimensions_separate_height_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_diameter_unit' and !$inhalt[$i][array_search('dimensions_separate_diameter_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_measurements)) $errormessage[]='Not allowed value in column dimensions_separate_diameter_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_wall_thickness_unit' and !$inhalt[$i][array_search('dimensions_separate_wall_thickness_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_measurements)) $errormessage[]='Not allowed value in column dimensions_separate_wall_thickness_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_weight_unit' and !$inhalt[$i][array_search('dimensions_separate_weight_value',$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_weight)) $errormessage[]='Not allowed value in column dimensions_separate_weight_unit: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_show_md') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column dimensions_separate_show_md: '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='dimensions_separate_show_extern') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if (!in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column dimensions_separate_show_extern: '.$showvalue.' (row '.$i.')'; - } - for ($og=1;$og<6;$og++) - { - if ($inhalt[1][$j]=='object_group_show'.$og and !$inhalt[$i][array_search('object_group_name'.$og,$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if ($i>1 and !in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column object_group_show'.$og.': '.$showvalue.' (row '.$i.')'; - } - } - for ($im=1;$im<29;$im++) - { - if ($inhalt[1][$j]=='image_visible'.$im and !$inhalt[$i][array_search('image_name'.$im,$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if ($i>1 and !in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column image_visible'.$im.': '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='image_main'.$im and !$inhalt[$i][array_search('image_name'.$im,$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if ($i>1 and !in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column image_main'.$im.': '.$showvalue.' (row '.$i.')'; - } - if ($inhalt[1][$j]=='image_rights'.$im and !$inhalt[$i][array_search('image_name'.$im,$erstezeile)]=='') - { - if ($inhalt[$i][$j]!='') $showvalue=''.$inhalt[$i][$j].''; else $showvalue='[empty]'; - if ($i>1 and !in_array($inhalt[$i][$j],$allowed_image_rights)) $errormessage[]='Not allowed value in column image_rights'.$im.': '.$showvalue.' (row '.$i.')'; - } - } - for ($k=0;$k'; else $showvalue='[empty]'; - if ($i>1 and !in_array($inhalt[$i][$j],$allowed_yesno)) $errormessage[]='Not allowed value in column '.$eventpartsure[$k].': '.$showvalue.' (row '.$i.')'; - } - } - } } -if (isset($errormessage) and $errormessage!='') -{ - echo 'Columns with controlled values contain invalid values !'; - for ($i=0;$i'.$errormessage[$i]; - $error=$error+1; - } +if (isset($errormessage) and $errormessage != '') { + echo 'Columns with controlled values contain invalid values !'; + for ($i = 0; $i < count ($errormessage); $i++) + { + echo '
' . $errormessage[$i]; + $error = $error + 1; + } } else { - echo 'Values in controlled fields are all valid !'; + echo 'Values in controlled fields are all valid !'; } ///// Check #8 unset($errormessage); echo '

8: Main image or main resource given?
'; -$hasanyimage=0; -for ($im=1;$im<29;$im++) +$hasanyimage = 0; +for ($im = 1; $im < 29; $im++) { - if (array_search('image_name'.$im,$erstezeile)!='') {$imagemain[$im]['name']=array_search('image_name'.$im,$erstezeile);$hasanyimage++;} - if (array_search('image_visible'.$im,$erstezeile)!='') $imagemain[$im]['visible']=array_search('image_visible'.$im,$erstezeile); - if (array_search('image_main'.$im,$erstezeile)!='') $imagemain[$im]['main']=array_search('image_main'.$im,$erstezeile); + if (array_search('image_name' . $im, $erstezeile) != '') {$imagemain[$im]['name'] = array_search('image_name' . $im, $erstezeile);$hasanyimage++; + } + if (array_search('image_visible' . $im, $erstezeile) != '') $imagemain[$im]['visible'] = array_search('image_visible' . $im, $erstezeile); + if (array_search('image_main' . $im, $erstezeile) != '') $imagemain[$im]['main'] = array_search('image_main' . $im, $erstezeile); } -if ($hasanyimage > 0) -{ - $imagemain=array_values($imagemain); - for ($i=1;$i<=$y;$i++) +if ($hasanyimage > 0) { + $imagemain = array_values($imagemain); + for ($i = 1; $i <= $y; $i++) { - if ($i>1) - { - $maimg[$i]=0; + if ($i > 1) { + $maimg[$i] = 0; //check if in a row any image_name is given - $hatimg[$i]=0; - for ($im=0;$im0) - { + if ($hatimg[$i] > 0) { // first check: how many main-images? - for ($im=0;$im'; + if ($maimg[$i] == 1) { + if ($inhalt[$i][$imagemain[$merk]['visible']] == 'n') { + $errormessage[] = 'Main image in row ' . $i . ' is not visible'; } } } } - if ($i>1 and $maimg[$i]==0 and $hatimg[$i]>0) $errormessage[]='There is no visible main image given in row '.$i.''; - if ($i>1 and $maimg[$i]>1 and $hatimg[$i]>0) $errormessage[]='There are '.$maimg[$i].' main images given in row '.$i.''; + if ($i > 1 and $maimg[$i] == 0 and $hatimg[$i] > 0) $errormessage[] = 'There is no visible main image given in row ' . $i . ''; + if ($i > 1 and $maimg[$i] > 1 and $hatimg[$i] > 0) $errormessage[] = 'There are ' . $maimg[$i] . ' main images given in row ' . $i . ''; } - if (isset($errormessage) and $errormessage!='') - { - echo 'There is not one main image for each object !'; - for ($i=0;$i'.$errormessage[$i]; - $error=$error+1; - } + if (isset($errormessage) and $errormessage != '') { + echo 'There is not one main image for each object !'; + for ($i = 0; $i < count ($errormessage); $i++) + { + echo '
' . $errormessage[$i]; + $error = $error + 1; + } } else { - echo 'For each object that has images attached exactly one main image is given !'; + echo 'For each object that has images attached exactly one main image is given !'; } } else @@ -791,13 +662,11 @@ else } echo '
'; -if ($error+$depcon_error>0) -{ - echo 'Error(s) found: '.($error+$depcon_error); +if ($error + $depcon_error > 0) { + echo 'Error(s) found: ' . ($error + $depcon_error); } else { - echo ' Create XML for md:import (iso 8859-1)
'; - echo ' Create XML for md:import (utf8)
'; + echo ' Create XML for md:import (iso 8859-1)
'; + echo ' Create XML for md:import (utf8)
'; } -?> \ No newline at end of file diff --git a/csv_laden.php b/csv_laden.php index 38585ee..fe04b6b 100644 --- a/csv_laden.php +++ b/csv_laden.php @@ -1,46 +1,43 @@ Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; - $zieldatei = 'xml/'.$y.'.xml'; - if (!$handle = fopen($zieldatei, 'w')) - { - echo "Cannot open file ($zieldatei)";exit; - } - $somecontent=''."\n"; // normal - $somecontent=$somecontent.''."\n"; + $y++; + //echo 'Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; + $zieldatei = 'xml/' . $y . '.xml'; + if (!$handle = fopen($zieldatei, 'w')) { + echo "Cannot open file ($zieldatei)";exit; + } + $somecontent = '' . "\n"; // normal + $somecontent = $somecontent . '' . "\n"; - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x]=$zeile[$x]; - //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; - if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).''."\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// - - $somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung - } - $somecontent=$somecontent.'
'; -//if ($y>1) -//{ - if (fwrite($handle, $somecontent) === FALSE) - { - echo "Cannot write to file ($filename)";exit; - } -// echo "Success, wrote to file ($filename)

"; -//} - fclose($handle); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = $zeile[$x]; + //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; + if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ'; + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).''."\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// + + $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '' . "\n"; //normaleinstellung + } + $somecontent = $somecontent . '
'; + //if ($y>1) + //{ + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)";exit; + } + // echo "Success, wrote to file ($filename)

"; + //} + fclose($handle); } fclose($fp); -echo ($y-1).' files created'; +echo ($y - 1) . ' files created'; echo '
Download as zip'; -?> diff --git a/csv_laden_hu.php b/csv_laden_hu.php index 856fa6f..22c4989 100644 --- a/csv_laden_hu.php +++ b/csv_laden_hu.php @@ -1,12 +1,12 @@ '; // für ungarn sonst weg ////////////////////// -include ('inc/zeichen.php'); -$filename=$_GET['fnam']; -$csv_datei = 'csv/'.$filename; +require 'inc/zeichen.php'; +$filename = $_GET['fnam']; +$csv_datei = 'csv/' . $filename; if (!file_exists("xml")) { mkdir("xml", 0700); @@ -16,39 +16,36 @@ $fp = fopen ( $csv_datei, 'r' ); $y = 0; while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) { - $y++; - //echo 'Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; - $zieldatei = 'xml/'.$y.'.xml'; - if (!$handle = fopen($zieldatei, 'w')) - { - echo "Cannot open file ($zieldatei)";exit; - } - $somecontent=''."\n"; // für Ungarn /////////////////////////////////// - /*$somecontent=''."\n"; // normal */ - $somecontent=$somecontent.''."\n"; + $y++; + //echo 'Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; + $zieldatei = 'xml/' . $y . '.xml'; + if (!$handle = fopen($zieldatei, 'w')) { + echo "Cannot open file ($zieldatei)";exit; + } + $somecontent = '' . "\n"; // für Ungarn /////////////////////////////////// + /*$somecontent=''."\n"; // normal */ + $somecontent = $somecontent . '' . "\n"; - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x]=$zeile[$x]; - //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; - if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 - $somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).''."\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// - - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung - } - $somecontent=$somecontent.'
'; -//if ($y>1) -//{ - if (fwrite($handle, $somecontent) === FALSE) - { - echo "Cannot write to file ($filename)";exit; - } -// echo "Success, wrote to file ($filename)

"; -//} - fclose($handle); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = $zeile[$x]; + //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; + if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ'; + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 + $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . (($inhalt[$y][$x])) . '' . "\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// + + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung + } + $somecontent = $somecontent . '
'; + //if ($y>1) + //{ + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)";exit; + } + // echo "Success, wrote to file ($filename)

"; + //} + fclose($handle); } fclose($fp); -echo ($y-1).' files created'; +echo ($y - 1) . ' files created'; echo '
Download as zip'; -?> diff --git a/csv_laden_hu_alt.php b/csv_laden_hu_alt.php index 6875d56..13ab271 100644 --- a/csv_laden_hu_alt.php +++ b/csv_laden_hu_alt.php @@ -1,49 +1,46 @@ '; // für ungarn sonst weg ////////////////////// -include ('inc/zeichen.php'); -$filename=$_GET['fnam']; -$csv_datei = 'csv/'.$filename; +require 'inc/zeichen.php'; +$filename = $_GET['fnam']; +$csv_datei = 'csv/' . $filename; -mkdir("xml",0777); +mkdir("xml", 0777); $fp = fopen ( $csv_datei, 'r' ); $y = 0; while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) //while ( $zeile = fgetcsv ( $fp, 100000, ',' ) ) { - $y++; - //echo 'Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; - $zieldatei = 'xml/'.$y.'.xml'; - if (!$handle = fopen($zieldatei, 'w')) - { - echo "Cannot open file ($zieldatei)";exit; - } - $somecontent=''."\n"; // für Ungarn /////////////////////////////////// - /*$somecontent=''."\n"; // normal */ - $somecontent=$somecontent.''."\n"; + $y++; + //echo 'Zeile='.$y.' Anzahl in Zeile: '.count ( $zeile ).'
'; + $zieldatei = 'xml/' . $y . '.xml'; + if (!$handle = fopen($zieldatei, 'w')) { + echo "Cannot open file ($zieldatei)";exit; + } + $somecontent = '' . "\n"; // für Ungarn /////////////////////////////////// + /*$somecontent=''."\n"; // normal */ + $somecontent = $somecontent . '' . "\n"; - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x]=$zeile[$x]; - //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; - if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 - $somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).''."\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// - - //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung - } - echo $y.'
'; - $somecontent=$somecontent.'
'; -//if ($y>1) -//{ - if (fwrite($handle, $somecontent) === FALSE) - { - echo "Cannot write to file ($filename)";exit; - } -// echo "Success, wrote to file ($filename)

"; -//} - fclose($handle); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = $zeile[$x]; + //echo ''.$inhalt[1][$x].' --> '.$zeile[$x].'
'; + if ($inhalt[$y][$x] == '') $inhalt[$y][$x] = 'ERSATZ'; + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.utf8_decode(transform($inhalt[$y][$x])).''."\n"; // für utf8 + $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . (($inhalt[$y][$x])) . '' . "\n"; //für ungarn sonst weg ////////////////////////////////////////////////////////////// + + //$somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung + } + echo $y . '
'; + $somecontent = $somecontent . '
'; + //if ($y>1) + //{ + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)";exit; + } + // echo "Success, wrote to file ($filename)

"; + //} + fclose($handle); } fclose($fp); echo 'download as zip'; -?> diff --git a/csv_laden_iso.php b/csv_laden_iso.php index 48520b5..a326760 100644 --- a/csv_laden_iso.php +++ b/csv_laden_iso.php @@ -1,37 +1,34 @@ '."\n"; // normal - $somecontent=$somecontent.''."\n"; + $y++; + $zieldatei = 'xml/' . $y . '.xml'; + if (!$handle = fopen($zieldatei, 'w')) { + echo "Cannot open file ($zieldatei)";exit; + } + $somecontent = '' . "\n"; // normal + $somecontent = $somecontent . '' . "\n"; - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x]=$zeile[$x]; - //if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; - $somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.transform($inhalt[$y][$x]).''."\n"; //normaleinstellung - } - $somecontent=$somecontent.''; - if (fwrite($handle, $somecontent) === FALSE) - { - echo "Cannot write to file ($filename)";exit; - } - fclose($handle); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = $zeile[$x]; + //if ($inhalt[$y][$x]=='') $inhalt[$y][$x]='ERSATZ'; + $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . transform($inhalt[$y][$x]) . '' . "\n"; //normaleinstellung + } + $somecontent = $somecontent . ''; + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)";exit; + } + fclose($handle); } fclose($fp); -echo ($y-1).' files created'; +echo ($y - 1) . ' files created'; echo '
Download as zip'; -?> diff --git a/csv_laden_utf.php b/csv_laden_utf.php index 9048b46..a791c73 100644 --- a/csv_laden_utf.php +++ b/csv_laden_utf.php @@ -3,40 +3,37 @@ //ini_set('display_errors',1); ob_start(); echo ''; // für ungarn sonst weg ////////////////////// -include ('inc/zeichen.php'); -$filename=$_GET['fnam']; -$csv_datei = 'csv/'.$filename; +require 'inc/zeichen.php'; +$filename = $_GET['fnam']; +$csv_datei = 'csv/' . $filename; -mkdir("xml",0777); +mkdir("xml", 0777); $fp = fopen ( $csv_datei, 'r' ); $y = 0; while ( $zeile = fgetcsv ( $fp, 100000, ';' ) ) { - $y++; - $zieldatei = 'xml/'.$y.'.xml'; - if (!$handle = fopen($zieldatei, 'w')) - { - echo "Cannot open file ($zieldatei)";exit; - } - $somecontent=''."\n"; // für Ungarn /////////////////////////////////// - $somecontent=$somecontent.''."\n"; + $y++; + $zieldatei = 'xml/' . $y . '.xml'; + if (!$handle = fopen($zieldatei, 'w')) { + echo "Cannot open file ($zieldatei)";exit; + } + $somecontent = '' . "\n"; // für Ungarn /////////////////////////////////// + $somecontent = $somecontent . '' . "\n"; - for ( $x = 0; $x < count ( $zeile ); $x++ ) - { - $inhalt[$y][$x]=$zeile[$x]; - $inhalt[$y][$x] = preg_replace('/[\x00-\x1F\x7F]/u', '', $inhalt[$y][$x]); - $inhalt[$y][$x] = str_replace('>',']',str_replace('<','[',$inhalt[$y][$x])); - //if ($y!=1) $inhalt[$y][$x] = ''; - $somecontent=$somecontent.'<'.tagify(transform($inhalt[1][$x])).'>'.(($inhalt[$y][$x])).''."\n"; //für ungarn sonst weg } - } - $somecontent=$somecontent.''; - if (fwrite($handle, $somecontent) === FALSE) - { - echo "Cannot write to file ($filename)";exit; - } - fclose($handle); + for ($x = 0; $x < count ( $zeile ); $x++) + { + $inhalt[$y][$x] = $zeile[$x]; + $inhalt[$y][$x] = preg_replace('/[\x00-\x1F\x7F]/u', '', $inhalt[$y][$x]); + $inhalt[$y][$x] = str_replace('>', ']', str_replace('<', '[', $inhalt[$y][$x])); + //if ($y!=1) $inhalt[$y][$x] = ''; + $somecontent = $somecontent . '<' . tagify(transform($inhalt[1][$x])) . '>' . (($inhalt[$y][$x])) . '' . "\n"; //für ungarn sonst weg } + } + $somecontent = $somecontent . ''; + if (fwrite($handle, $somecontent) === FALSE) { + echo "Cannot write to file ($filename)";exit; + } + fclose($handle); } fclose($fp); -echo ($y-1).' files created'; +echo ($y - 1) . ' files created'; echo '
Download as zip'; -?> diff --git a/index.php b/index.php index f8ab7d4..f0372a1 100644 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@