function migrate_insert_meta($collectionid, $baseid, $fields, &$db, $db_prefix, &$db2) { $name = preg_replace("/([kK]\\.[[:space:]]*[aA])\\.?/", "", trim(stripslashes($fields['name']))); if (strlen($name) > 0 and strlen($fields['vorname']) > 0) { $artistname = $name . ", " . trim(stripslashes($fields['vorname'])); } else { $artistname = ''; } $sql = "REPLACE INTO `{$db_prefix}meta` (`collectionid`" . ", `imageid`" . ", `type`" . ", `status`" . ", `addition`" . ", `title`" . ", `dating`" . ", `material`" . ", `technique`" . ", `format`" . ", `institution`" . ", `literature`" . ", `page`" . ", `figure`" . ", `table`" . ", `isbn`" . ", `keyword`" . ", `insert_date`" . ", `modify_date`" . ", `name1id`" . ", `name2id`" . ", `locationid`" . ", `exp_prometheus`" . ", `exp_sid`" . ", `exp_unimedia`" . ", `metacreator`" . ", `name1`" . ", `location`" . ", `locationsounds`" . " ) VALUES (" . $db->qstr(trim(stripslashes($collectionid))) . ", " . $fields['bildid'] . ", 'image'" . ", 'new'" . ", " . $db->qstr(trim(stripslashes($fields['zusatz']))) . ", " . $db->qstr(trim(stripslashes($fields['titel']))) . ", " . $db->qstr(trim(stripslashes($fields['datierung']))) . ", " . $db->qstr(trim(stripslashes($fields['material']))) . ", " . $db->qstr(trim(stripslashes($fields['technik']))) . ", " . $db->qstr(trim(stripslashes($fields['format']))) . ", " . $db->qstr(trim(stripslashes($fields['institution']))) . ", " . $db->qstr(trim(stripslashes($fields['literatur']))) . ", " . $db->qstr(trim(stripslashes($fields['seite']))) . ", " . $db->qstr(trim(stripslashes($fields['abbildung']))) . ", " . $db->qstr(trim(stripslashes($fields['tafel']))) . ", " . $db->qstr(trim(stripslashes($fields['isbn']))) . ", " . $db->qstr(trim(stripslashes($fields['stichworte']))) . ", " . $db->qstr(trim(stripslashes($fields['insert_date']))) . ", " . $db->qstr(trim(stripslashes($fields['modify_date']))) . ", 1, 0, 1" . ", 0, 0, 0" . ", 'dilps-import'" . ", " . $db->qstr($artistname) . ", " . $db->qstr(trim(stripslashes($fields['stadt']))) . ", " . $db->qstr('.' . soundex2($db->qstr(trim(stripslashes($fields['stadt'])))) . '.') . ");"; echo "{$sql}\n<br>\n"; $db->Execute($sql); dating($db, stripslashes($fields['datierung']), $datelist); if (count($datelist)) { foreach ($datelist as $date) { $sql = "INSERT INTO {$db_prefix}dating(collectionid,imageid,`from`,`to`) VALUES(4,{$fields['bildid']},{$date['from']},{$date['to']})"; echo "{$sql}\n"; $db->Execute($sql); } } migrate_insert_img($collectionid, $baseid, $fields['bildid'], $db, $db_prefix, $db2); }
function smarty_function_save_image($params, &$smarty) { global $_REQUEST, $db_prefix, $db, $user; if (empty($params['error'])) { $smarty->trigger_error("save_image: missing 'error' parameter"); return; } $edit = $_REQUEST['edit']; if ($edit['loadtype'] != 'save') { return; } if (!$user['editor']) { $error = "Insufficient Rights"; $smarty->assign($params['error'], $error); return; } extractID($edit['id'], $collectionid, $imageid); $sql = "SELECT status FROM {$db_prefix}meta WHERE collectionid={$collectionid} AND imageid={$imageid}"; $status = $db->GetOne($sql); if ($user['admin']) { $status = $edit['status']; } else { if ($user['editor']) { $status = $edit['status'] == 'reviewed' ? 'edited' : $edit['status']; } } // If the name1id, name2id or locationid is "new", check to see whether it does actually already exist. // if not, insert the new name into the DB and set the id $name1 = get_or_set_values($db, $db_prefix, $edit['id'], 'name', $edit['name1text'], $edit['name1id']); if (isset($name1['is_error'])) { $smarty->assign($params['error'], $name1['error_msg']); return; } $name2 = get_or_set_values($db, $db_prefix, $edit['id'], 'name', $edit['name2text'], $edit['name2id']); if (isset($name2['is_error'])) { $smarty->assign($params['error'], $name2['error_msg']); return; } $location = get_or_set_values($db, $db_prefix, $edit['id'], 'location', $edit['city'], $edit['locationid']); if (isset($location['is_error'])) { $smarty->assign($params['error'], $location['error_msg']); return; } $export_systems = array('prometheus', 'sid', 'unimedia'); $exports = ''; foreach ($export_systems as $system) { $exports .= ", exp_{$system} = " . (int) (!empty($edit['export'][$system])); } $datestring = trim($edit['dating']); $sql = "UPDATE {$db_prefix}meta\r\n SET `type`=" . $db->qstr($edit['type']) . "\r\n ,`status`=" . $db->qstr($status) . "\r\n ,name1id='{$name1['id']}'\r\n ,name2id='{$name2['id']}'\r\n ,locationid='{$location['id']}'\r\n ,name1=" . $db->qstr($name1['name']) . "\r\n ,name2=" . $db->qstr($name2['name']) . "\r\n ,location=" . $db->qstr($location['location']) . "\r\n ,name1sounds=" . $db->qstr($name1['sounds']) . "\r\n ,name2sounds=" . $db->qstr($name2['sounds']) . "\r\n ,locationsounds=" . $db->qstr($location['sounds']) . "\r\n ,addition=" . $db->qstr(trim($edit['addition'])) . "\r\n ,title=" . $db->qstr(trim($edit['title'])) . "\r\n ,dating=" . $db->qstr($datestring) . "\r\n ,material=" . $db->qstr(trim($edit['material'])) . "\r\n ,technique=" . $db->qstr(trim($edit['technique'])) . "\r\n ,format=" . $db->qstr(trim($edit['format'])) . "\r\n ,institution=" . $db->qstr(trim($edit['institution'])) . "\r\n ,literature=" . $db->qstr(trim($edit['literature'])) . "\r\n ,page=" . $db->qstr(trim($edit['page'])) . "\r\n ,figure=" . $db->qstr(trim($edit['figure'])) . "\r\n ,`table`=" . $db->qstr(trim($edit['table'])) . "\r\n ,isbn=" . $db->qstr(trim($edit['isbn'])) . "\r\n ,keyword=" . $db->qstr(trim($edit['keyword'])) . "\r\n ,metacreator=" . $db->qstr(trim($edit['metacreator'])) . "\r\n ,metaeditor=" . $db->qstr(trim($edit['metaeditor'])) . "\r\n ,imagerights=" . $db->qstr(trim($edit['imagerights'])) . "\r\n ,commentary=" . $db->qstr(trim($edit['commentary'])) . "\r\n ,modify_date=NOW()" . $exports . "\r\nWHERE\r\n collectionid={$collectionid}\r\n AND imageid={$imageid};"; //die($sql); $sqls = $sql; if (!$db->Execute($sql)) { $error = $db->ErrorMsg() . "[{$sql}]"; } else { $sql = "DELETE FROM {$db_prefix}dating WHERE collectionid={$collectionid} AND imageid={$imageid};"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } else { dating($db, $datestring, $datelist); foreach ($datelist as $date) { $sql = "INSERT INTO {$db_prefix}dating(collectionid,imageid,`from`,`to`) VALUES('{$collectionid}', '{$imageid}', {$date['from']}, {$date['to']})"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } } $sql = "update {$db_prefix}dating d, {$db_prefix}meta m" . " set d.metaid=m.id" . " where m.collectionid = '{$collectionid}' and m.imageid = '{$imageid}'" . " and m.collectionid = d.collectionid and m.imageid = d.imageid"; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } } } $smarty->assign($params['error'], $error); if (isset($params['sql'])) { $smarty->assign($params['sql'], $sqls); } }
function get_dating_where_query($column, $value, $operator) { global $config; require_once $config['includepath'] . 'tools.inc.php'; dating($this->db, $value, $datelist); if (count($datelist)) { $date_to = $datelist[0]['to']; $date_from = $datelist[0]['from']; $sql = "select metaid from {$this->db_prefix}dating where {$this->db_prefix}dating.`from`<={$date_to} AND {$this->db_prefix}dating.`to`>={$date_from}"; $metaids = $this->db->GetCol($sql); if ($metaids === false) { $where = "'error trying to execute sql for dating: {$sql}'"; } else { if (empty($metaids)) { $where = "0"; } else { $where = "{$this->db_prefix}meta.id in (" . implode(',', $metaids) . ")"; } } } else { $where = "0"; } return $where; }
function migrate_insert_meta($collectionid, $baseid, $fields, &$db, $db_prefix, &$db2) { $name = preg_replace("/([kK]\\.[[:space:]]*[aA])\\.?/", "", trim(stripslashes($fields['name']))); // print_r($fields); if (strlen($name) > 0 and strlen($fields['vorname']) > 0) { $artistname = $name . ", " . trim(stripslashes($fields['vorname'])); } else { $artistname = ''; } $artistid = false; if ($artistname != '') { $artistid = migrate_get_or_set_artistid($artistname, $db, $db_prefix); } // echo ("Name: $artistname, ID: $artistid \n<br>\n"); $locationid = false; $locationname = trim(stripslashes($fields['stadt'])); if ($locationname != '') { $locationid = migrate_get_or_set_locationid($locationname, $collectionid . ':' . $fields['bildid'], $db, $db_prefix); } // echo ("Ort: $locationname, ID: $locationid \n<br>\n"); $sql = "INSERT INTO `{$db_prefix}meta` " . "(`collectionid`" . ", `imageid`" . ", `type`" . ", `status`" . ", `addition`" . ", `title`" . ", `dating`" . ", `material`" . ", `technique`" . ", `format`" . ", `institution`" . ", `literature`" . ", `page`" . ", `figure`" . ", `table`" . ", `isbn`" . ", `keyword`" . ", `insert_date`" . ", `modify_date`" . ($artistid !== false ? ", `name1id`" : '') . ($locationid !== false ? ", `locationid`" : '') . ", `exp_prometheus`" . ", `exp_sid`" . ", `exp_unimedia`" . ", `metacreator`" . ", `metaeditor`" . ", `name1`" . ", `location`" . ($locationname != '' && $locationid !== false ? ", `locationsounds`" : '') . ($artistname != '' && $artistid !== false ? ", `name1sounds`" : '') . " ) VALUES (" . intval($collectionid) . ", " . $fields['bildid'] . ", 'image'" . ", 'new'" . ", " . $db->qstr(trim(stripslashes($fields['zusatz']))) . ", " . $db->qstr(trim(stripslashes($fields['titel']))) . ", " . $db->qstr(trim(stripslashes($fields['datierung']))) . ", " . $db->qstr(trim(stripslashes($fields['material']))) . ", " . $db->qstr(trim(stripslashes($fields['technik']))) . ", " . $db->qstr(trim(stripslashes($fields['format']))) . ", " . $db->qstr(trim(stripslashes($fields['institution']))) . ", " . $db->qstr(trim(stripslashes($fields['literatur']))) . ", " . $db->qstr(trim(stripslashes($fields['seite']))) . ", " . $db->qstr(trim(stripslashes($fields['abbildung']))) . ", " . $db->qstr(trim(stripslashes($fields['tafel']))) . ", " . $db->qstr(trim(stripslashes($fields['isbn']))) . ", " . $db->qstr(trim(stripslashes($fields['stichworte']))) . ", " . $db->qstr(trim(stripslashes($fields['insert_date']))) . ", " . $db->qstr(trim(stripslashes($fields['modify_date']))) . ($artistid !== false ? ", " . intval($artistid) : '') . ($locationid !== false ? ", " . intval($locationid) : '') . ", 0, 0, 0" . ", 'dilps-import'" . ", 'dilps-import'" . ", " . $db->qstr($artistname) . ", " . $db->qstr($locationname) . ($locationname != '' && $locationid !== false ? ", " . $db->qstr(migrate_get_sounds_string($locationname)) : '') . ($artistname != '' && $artistid !== false ? ", " . $db->qstr(migrate_get_sounds_string($artistname)) : '') . ");"; // echo "$sql\n<br>\n"; $rs = $db->Execute($sql); echo "Inserting meta data: "; if ($rs) { echo "OK\n<br>\n"; } else { echo "<b>Failed</b>\n<br>\n"; echo "SQL: {$sql}\n<br>\n"; echo "\n<br>\n"; } // clear old dating information $sql = "DELETE FROM {$db_prefix}dating WHERE collectionid={$collectionid} AND imageid={$fields['bildid']}"; // echo "$sql\n"; $rs = $db->Execute($sql); echo "Clearing old dating information: "; if ($rs) { echo "OK\n<br>\n"; } else { echo "<b>Failed</b>\n<br>\n"; echo "SQL: {$sql}\n<br>\n"; echo "\n<br>\n"; } dating($db, stripslashes($fields['datierung']), $datelist); $rs2 = true; if (count($datelist)) { foreach ($datelist as $date) { $sql = "INSERT INTO {$db_prefix}dating(`collectionid`, `imageid`, `from`, `to`) " . "VALUES({$collectionid},{$fields['bildid']},{$date['from']},{$date['to']})"; $rs = $db->Execute($sql); } $rs2 = $rs2 && $rs; } echo "Inserting new dating information: "; if ($rs2) { echo "OK\n<br>\n"; } else { echo "<b>Failed</b>\n<br>\n"; echo "SQL: {$sql}\n<br>\n"; echo "\n<br>\n"; } migrate_insert_img($collectionid, $baseid, $fields['bildid'], $db, $db_prefix, $db2); }
function smarty_function_save_image($params, &$smarty) { global $_REQUEST, $db_prefix, $db, $user; if (empty($params['error'])) { $smarty->trigger_error("save_image: missing 'error' parameter"); return; } $edit = $_REQUEST['edit']; // echo('function.save_image.php: '.$edit['type'].' - Einsprungpunkt realisieren'."\n<br>\n"); if ($edit['loadtype'] != 'save') { return; } if (!$user['editor']) { $error = "Insufficient Rights"; $smarty->assign($params['error'], $error); return; } extractID($edit['id'], $collectionid, $imageid); $sql = "SELECT status FROM {$db_prefix}meta WHERE collectionid={$collectionid} AND imageid={$imageid}"; $status = $db->GetOne($sql); if ($user['admin']) { $status = $edit['status']; } else { if ($user['editor']) { $status = $edit['status'] == 'reviewed' ? 'edited' : $edit['status']; } } print_r($edit); $db->debug = true; // If the name1id, name2id or locationid is "new", check to see whether it does actually already exist. // if not, insert the new name into the DB and set the id $name1 = get_or_set_values($db, $db_prefix, $edit['id'], 'name', $edit['name1text'], $edit['name1id']); if (isset($name1['is_error'])) { $smarty->assign($params['error'], $name1['error_msg']); return; } $name2 = get_or_set_values($db, $db_prefix, $edit['id'], 'name', $edit['name2text'], $edit['name2id']); if (isset($name2['is_error'])) { $smarty->assign($params['error'], $name2['error_msg']); return; } $location = get_or_set_values($db, $db_prefix, $edit['id'], 'location', $edit['city'], $edit['locationid']); if (isset($location['is_error'])) { $smarty->assign($params['error'], $location['error_msg']); return; } $export_systems = array('prometheus', 'sid', 'unimedia'); $exports = ''; foreach ($export_systems as $system) { $exports .= ", exp_{$system} = " . (int) (!empty($edit['export'][$system])); } $datestring = trim($edit['dating']); $sql = "UPDATE {$db_prefix}meta\n SET `type`=" . $db->qstr($edit['type']) . "\n ,`status`=" . $db->qstr($status) . "\n ,name1id='{$name1['id']}'\n ,name2id='{$name2['id']}'\n ,locationid='{$location['id']}'\n ,name1=" . $db->qstr($name1['name']) . "\n ,name2=" . $db->qstr($name2['name']) . "\n ,location=" . $db->qstr($location['location']) . "\n ,name1sounds=" . $db->qstr($name1['sounds']) . "\n ,name2sounds=" . $db->qstr($name2['sounds']) . "\n ,locationsounds=" . $db->qstr($location['sounds']) . "\n ,addition=" . $db->qstr(trim($edit['addition'])) . "\n ,title=" . $db->qstr(trim($edit['title'])) . "\n ,dating=" . $db->qstr($datestring) . "\n ,material=" . $db->qstr(trim($edit['material'])) . "\n ,technique=" . $db->qstr(trim($edit['technique'])) . "\n ,format=" . $db->qstr(trim($edit['format'])) . "\n ,institution=" . $db->qstr(trim($edit['institution'])) . "\n ,literature=" . $db->qstr(trim($edit['literature'])) . "\n ,page=" . $db->qstr(trim($edit['page'])) . "\n ,figure=" . $db->qstr(trim($edit['figure'])) . "\n ,`table`=" . $db->qstr(trim($edit['table'])) . "\n ,isbn=" . $db->qstr(trim($edit['isbn'])) . "\n ,keyword=" . $db->qstr(trim($edit['keyword'])) . "\n ,metacreator=" . $db->qstr(trim($edit['metacreator'])) . "\n ,metaeditor=" . $db->qstr(trim($edit['metaeditor'])) . "\n ,imagerights=" . $db->qstr(trim($edit['imagerights'])) . "\n ,commentary=" . $db->qstr(trim($edit['commentary'])) . "\n ,modify_date=NOW()" . $exports . "\nWHERE\n collectionid={$collectionid}\n AND imageid={$imageid};"; //die($sql); $sqls = $sql; if (!$db->Execute($sql)) { $error = $db->ErrorMsg() . "[{$sql}]"; } else { $sql = "DELETE FROM {$db_prefix}dating WHERE collectionid={$collectionid} AND imageid={$imageid};"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } else { dating($db, $datestring, $datelist); foreach ($datelist as $date) { $sql = "INSERT INTO {$db_prefix}dating(collectionid,imageid,`from`,`to`) VALUES('{$collectionid}', '{$imageid}', {$date['from']}, {$date['to']})"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } } $sql = "update {$db_prefix}dating d, {$db_prefix}meta m" . " set d.metaid=m.id" . " where m.collectionid = '{$collectionid}' and m.imageid = '{$imageid}'" . " and m.collectionid = d.collectionid and m.imageid = d.imageid"; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } } } // clear temporary values in session if (isset($_SESSION['tempvals'])) { unset($_SESSION['tempvals']); } // save additional fields for archaeology if ($edit['type'] == 'archaeology') { // $db->debug = true; $sql = "DELETE FROM {$db_prefix}archaeology WHERE collectionid={$collectionid} AND imageid={$imageid};"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } else { $sql = "INSERT INTO {$db_prefix}archaeology (" . " `collectionid`, `imageid`" . " ,`category_fn`, `category`" . " ,`iconography_fn`, `iconography` " . " ,`dating_ext_fn`, `dating_ext` " . " ,`material_ext_fn`, `material_ext` " . " ,`location_ext_fn`, `location_ext` " . " ,`obj_culture_fn`, `obj_culture` " . " ,`obj_culthistory_fn`, `obj_culthistory` " . " ,`obj_topography_fn`, `obj_topography` " . " ,`obj_arch_structelems_fn`, `obj_arch_structelems` " . " ,`obj_arch_tenement_fn`, `obj_arch_tenement` " . " ,`obj_arch_funcbuild_fn`, `obj_arch_funcbuild` " . " ,`obj_arch_amusement_fn`, `obj_arch_amusement` " . " ,`obj_arch_economy_fn`, `obj_arch_economy` " . " ,`obj_arch_sacral_fn`, `obj_arch_sacral` " . " ,`obj_arch_sepulchre_fn`, `obj_arch_sepulchre` " . " ,`obj_arch_military_fn`, `obj_arch_military` " . " ,`obj_mosaic_fn`, `obj_mosaic` " . " ,`obj_painting_fn`, `obj_painting` " . " ,`obj_sculpture_fn`, `obj_sculpture` " . " ,`obj_portrait_fn`, `obj_portrait` " . " ,`obj_ceramic_vascularforms_fn`, `obj_ceramic_vascularforms` " . " ,`obj_ceramic_groups_fn`, `obj_ceramic_groups` " . " ,`obj_toreutics_fn`, `obj_toreutics` " . " ,`obj_jewellery_fn`, `obj_jewellery` " . " ,`obj_glass_fn`, `obj_glass` " . " ,`obj_glyptics_fn`, `obj_glyptics` " . " ,`obj_numismatics_fn`, `obj_numismatics` " . " ,`obj_textiles_fn`, `obj_textiles` " . " ,`obj_misc_fn`, `obj_misc` " . " ,`obj_epigraphy_fn`, `obj_epigraphy` " . " ,`obj_methods_fn`, `obj_methods` " . " ,`obj_reception_fn`, `obj_reception` " . " ) VALUES (" . $collectionid . "," . $imageid . "," . $db->qstr(trim($edit['category_fn'])) . "," . $db->qstr(trim($edit['category'])) . "," . $db->qstr(trim($edit['iconography_fn'])) . "," . $db->qstr(trim($edit['iconography'])) . "," . $db->qstr(trim($edit['dating_ext_fn'])) . "," . $db->qstr(trim($edit['dating_ext'])) . "," . $db->qstr(trim($edit['material_ext_fn'])) . "," . $db->qstr(trim($edit['material_ext'])) . "," . $db->qstr(trim($edit['location_ext_fn'])) . "," . $db->qstr(trim($edit['location_ext'])) . "," . $db->qstr(trim($edit['obj_culture_fn'])) . "," . $db->qstr(trim($edit['obj_culture'])) . "," . $db->qstr(trim($edit['obj_culthistory_fn'])) . "," . $db->qstr(trim($edit['obj_culthistory'])) . "," . $db->qstr(trim($edit['obj_topography_fn'])) . "," . $db->qstr(trim($edit['obj_topography'])) . "," . $db->qstr(trim($edit['obj_arch_structelems_fn'])) . "," . $db->qstr(trim($edit['obj_arch_structelems'])) . "," . $db->qstr(trim($edit['obj_arch_tenement_fn'])) . "," . $db->qstr(trim($edit['obj_arch_tenement'])) . "," . $db->qstr(trim($edit['obj_arch_funcbuild_fn'])) . "," . $db->qstr(trim($edit['obj_arch_funcbuild'])) . "," . $db->qstr(trim($edit['obj_arch_amusement_fn'])) . "," . $db->qstr(trim($edit['obj_arch_amusement'])) . "," . $db->qstr(trim($edit['obj_arch_economy_fn'])) . "," . $db->qstr(trim($edit['obj_arch_economy'])) . "," . $db->qstr(trim($edit['obj_arch_sacral_fn'])) . "," . $db->qstr(trim($edit['obj_arch_sacral'])) . "," . $db->qstr(trim($edit['obj_arch_sepulchre_fn'])) . "," . $db->qstr(trim($edit['obj_arch_sepulchre'])) . "," . $db->qstr(trim($edit['obj_arch_military_fn'])) . "," . $db->qstr(trim($edit['obj_arch_military'])) . "," . $db->qstr(trim($edit['obj_mosaic_fn'])) . "," . $db->qstr(trim($edit['obj_mosaic'])) . "," . $db->qstr(trim($edit['obj_painting_fn'])) . "," . $db->qstr(trim($edit['obj_painting'])) . "," . $db->qstr(trim($edit['obj_sculpture_fn'])) . "," . $db->qstr(trim($edit['obj_sculpture'])) . "," . $db->qstr(trim($edit['obj_portrait_fn'])) . "," . $db->qstr(trim($edit['obj_portrait'])) . "," . $db->qstr(trim($edit['obj_ceramic_vascularforms_fn'])) . "," . $db->qstr(trim($edit['obj_ceramic_vascularforms'])) . "," . $db->qstr(trim($edit['obj_ceramic_groups_fn'])) . "," . $db->qstr(trim($edit['obj_ceramic_groups'])) . "," . $db->qstr(trim($edit['obj_toreutics_fn'])) . "," . $db->qstr(trim($edit['obj_toreutics'])) . "," . $db->qstr(trim($edit['obj_jewellery_fn'])) . "," . $db->qstr(trim($edit['obj_jewellery'])) . "," . $db->qstr(trim($edit['obj_glass_fn'])) . "," . $db->qstr(trim($edit['obj_glass'])) . "," . $db->qstr(trim($edit['obj_glyptics_fn'])) . "," . $db->qstr(trim($edit['obj_glyptics'])) . "," . $db->qstr(trim($edit['obj_numismatics_fn'])) . "," . $db->qstr(trim($edit['obj_numismatics'])) . "," . $db->qstr(trim($edit['obj_textiles_fn'])) . "," . $db->qstr(trim($edit['obj_textiles'])) . "," . $db->qstr(trim($edit['obj_misc_fn'])) . "," . $db->qstr(trim($edit['obj_misc'])) . "," . $db->qstr(trim($edit['obj_epigraphy_fn'])) . "," . $db->qstr(trim($edit['obj_epigraphy'])) . "," . $db->qstr(trim($edit['obj_methods_fn'])) . "," . $db->qstr(trim($edit['obj_methods'])) . "," . $db->qstr(trim($edit['obj_reception_fn'])) . "," . $db->qstr(trim($edit['obj_reception'])) . ")"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error = $db->ErrorMsg() . "[{$sql}]"; } } } // save additional fields for architecture if ($edit['type'] == 'architecture') { // $db->debug = true; $sql = "DELETE FROM {$db_prefix}architecture WHERE collectionid={$collectionid} AND imageid={$imageid};"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error .= "\n" . $db->ErrorMsg() . "[{$sql}]"; } else { $sql = "INSERT INTO {$db_prefix}architecture (" . " `collectionid`, `imageid` " . ", `functiontype_fn`, `functiontype` " . ", `formtype_fn`, `formtype` " . ", `draught_fn`, `draught` " . ", `classification_fn`, `classification`" . " ) VALUES (" . $collectionid . "," . $imageid . "," . $db->qstr(trim($edit['functiontype_fn'])) . "," . $db->qstr(trim($edit['functiontype'])) . "," . $db->qstr(trim($edit['formtype_fn'])) . "," . $db->qstr(trim($edit['formtype'])) . "," . $db->qstr(trim($edit['draught_fn'])) . "," . $db->qstr(trim($edit['draught'])) . "," . $db->qstr(trim($edit['classification_fn'])) . "," . $db->qstr(trim($edit['classification'])) . ")"; $sqls .= "\n" . $sql; if (!$db->Execute($sql)) { $error = $db->ErrorMsg() . "[{$sql}]"; } } } $smarty->assign($params['error'], $error); if (isset($params['sql'])) { $smarty->assign($params['sql'], $sqls); } }