the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. If you want to contact me by e-mail, this is my address: eugenio.tacchini@unicatt.it *********************************************************************************** */ // installed and allowed tables $tables_names_ar = build_tables_names_array(); if (count($tables_names_ar) == 0) { // no tables installed and allowed echo "<p><b>[04] Error:</b> it is impossible to run DaDaBIK, probably because you have decided to exclude all the tables from the DaDaBIK interface; go to the <a href='admin.php'>administration interface</a> and include some tables."; exit; } else { if (!isset($_GET["table_name"])) { $table_name = $tables_names_ar[0]; } else { $table_name = $_GET["table_name"]; if (!in_array($table_name, $tables_names_ar)) { // someone try to manage a not-allowed table by changing the url echo "<p><b>[05] Error:</b> you are attemping to manage a not allowed table."; exit; } }
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. If you want to contact me by e-mail, this is my address: eugenio.tacchini@unicatt.it *********************************************************************************** */ ob_start(); // tables present in the database $table_names_ar = build_tables_names_array(0, 0); if (count($table_names_ar) == 0) { // no table echo "<p><b>[02] Error:</b> your database " . DB_NAME . " is empty. No tables found. Please create some tables to manage before using DaDaBIK."; exit; } // end if ini_set('session.cookie_path', $site_path); // session_start(); if (!isset($_POST)) { $_POST = $HTTP_POST_VARS; } if (!isset($_GET)) { $_GET = $HTTP_GET_VARS; } if (!isset($_FILES)) {
function build_details_table($fields_labels_ar, $res_details) { global $db, $alias_prefix, $prefix_internal_table, $lang; // build the table $details_table = ""; $details_table .= "<table>"; while ($details_row = $db->db_fetch_assoc($res_details)) { // should be just one $count_temp = count($fields_labels_ar); for ($i = 0; $i < $count_temp; $i++) { if ($fields_labels_ar[$i]["present_details_form_field"] == "1") { $field_name_temp = $fields_labels_ar[$i]["name_field"]; $field_values_ar = array(); // reset the array containing values to display, otherwise for each loop if I don't call build_linked_field_values_ar I have the previous values $primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"]; if ($primary_key_field_field != "") { $primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"]; $primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"]; $primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"]; $linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"]; $linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field); $alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"]; // get the list of all the installed tables $tables_names_ar = build_tables_names_array(0); // if the linked table is installed I can get type content and separator of the linked field if (in_array($primary_key_table_field, $tables_names_ar)) { $linked_table_installed = 1; $fields_labels_linked_field_ar = build_fields_labels_array($prefix_internal_table . $primary_key_table_field, "1"); } else { $linked_table_installed = 0; } // end else for ($j = 0; $j < count($linked_fields_ar); $j++) { ////*$field_values_ar[$j] = $details_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field]; $field_values_ar[$j] = $details_row[$primary_key_table_field . $alias_prefix . $linked_fields_ar[$j] . $alias_prefix . $alias_suffix_field]; } // end for } else { $field_values_ar[0] = $details_row[$field_name_temp]; } $count_temp_2 = count($field_values_ar); $details_table .= "<tr><td class='td_label_details'><b>" . $fields_labels_ar[$i]["label_" . $lang . "_field"] . "</b></td><td class='td_value_details'>"; for ($j = 0; $j < $count_temp_2; $j++) { // if it's a linked field and the linked table is installed, get the correct $field_type $field_content $field_separator if ($primary_key_field_field != "" && $primary_key_field_field != NULL && $linked_table_installed === 1) { foreach ($fields_labels_linked_field_ar as $fields_labels_linked_field_ar_element) { if ($fields_labels_linked_field_ar_element['name_field'] === $linked_fields_ar[$j]) { $linked_field_type = $fields_labels_linked_field_ar_element['type_field']; $linked_field_content = $fields_labels_linked_field_ar_element['content_field']; $linked_field_separator = $fields_labels_linked_field_ar_element['separator_field']; } // end if } // end foreach reset($fields_labels_linked_field_ar); $field_to_display = get_field_correct_displaying($field_values_ar[$j], $linked_field_type, $linked_field_content, "details_table"); // get the correct display mode for the field } else { $field_to_display = get_field_correct_displaying($field_values_ar[$j], $fields_labels_ar[$i]["type_field"], $fields_labels_ar[$i]["content_field"], "details_table"); // get the correct display mode for the field } // end else $details_table .= $field_to_display . " "; // at the field value to the table } $details_table = substr($details_table, 0, -6); // delete the last $details_table .= "</td></tr>"; } // end if } // end for } // end while $details_table .= "</table>"; return $details_table; }