';print_r($allowed);echo ''; echo '1: Only allowed tags (column names) used?'; $fp = fopen ( $csv_datei, 'r' ); $y = 1; $error = 0; $zeile = fgetcsv ( $fp, 100000, ';' ); 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]); } fclose($fp); $erstezeile = $zeile; if ($error != 0) echo '
Not allowed tags found !'; else echo '
Only allowed tags used !'; //// Check #2 echo '

2: Not allowed multiple use of tags (column names)?'; $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; } else { echo '
No dublicate column names !'; } //// Get values into memory for following checks $fp = fopen ( $csv_datei, 'r' ); $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]); } } fclose($fp); ///// Check #3 echo '

3: Mandatory tags available and always filled in?'; unset($inv_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; $i < count ($mandatory); $i++) { 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 !'; ///// 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; $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 '
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_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_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_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'; } } // 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_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'; } } // 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++) { 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_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++) { 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; $i < count($eventpart); $i++) { 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 !'; } ///// Check #6 echo '

6: Dependency of content observed?'; $depcon_error = 0; for ($l = 0; $l < count($crosscheck1); $l++) { 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; $l < count($eventpart); $l++) { 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)] == '') { 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)] == '') { 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++) { if (in_array('image_name'.$im,$erstezeile)) { for ($j=1;$j<($y+1);$j++) { if ($inhalt[$j][array_search('image_rights'.$im,$erstezeile)]!=='') { echo '
TAG image_name'.$im.' given but no value available for image_rights'.$im.' (row '.$j.')'; $depcon_error=$depcon_error+1; } if ($inhalt[$j][array_search('image_visible'.$im,$erstezeile)]!=='') { 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 !'; ///// Check #7 echo '

7: Not allowed values in controlled lists?
'; for ($i = 1; $i <= $y; $i++) { for ($j = 0; $j < count ($inhalt[$i]); $j++) { 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 (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 !'; } ///// Check #8 unset($errormessage); echo '

8: Main image or main resource given?
'; $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 ($hasanyimage > 0) { $imagemain = array_values($imagemain); for ($i = 1; $i <= $y; $i++) { if ($i > 1) { $maimg[$i] = 0; //check if in a row any image_name is given $hatimg[$i] = 0; for ($im = 0; $im < count($imagemain); $im++) { if ($inhalt[$i][$imagemain[$im]['name']] != '') $hatimg[$i]++; } if ($hatimg[$i] > 0) { // first check: how many main-images? for ($im = 0; $im < count($imagemain); $im++) { if ($inhalt[$i][$imagemain[$im]['main']] == 'y') {$maimg[$i]++;$merk = $im; } } // if there is exacly one main-image, is it visible? 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 (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 !'; } } else { echo 'No images to be imported !'; } echo '
'; 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)
'; }