1?" style='margin-top: 10px'":"").">{$sentence['snt_text']}"; if ($sentence['snt_new']==1) { $html .= " new"; } elseif ($sentence['snt_new']==2) { $html .= " postponed"; } if (!empty($sentence['snt_transcr'])) { $html .= "

{$sentence['snt_transcr']}"; } if (!empty($sentence['snt_translation'])) { $html .= "

{$sentence['snt_translation']}"; } $contributor = $sentence['u_name']; if ($sentence['snt_byadmin']==1) { $contributor = "webmaster for $contributor"; } if (!empty($sentence['u_email'])) { $contributor = "$contributor"; } $html .= " (Submitted by $contributor"; if ($sentence['snt_date']!=='0000-00-00') { $html .= " on ".date("M j, Y", strtotime($sentence['snt_date'])); } $html .= ")"; $html .= "

"; if ($sentence['snt_style']==1) { $html .= "This example is in Spoken style. "; } $html .= $sentence['snt_note']; $source = array(); if (!empty($sentence['snt_source'])) { $source[] = $sentence['snt_source']; } if (!empty($sentence['snt_author'])) { $source[] = "$sentence[snt_author]"; } if ($sentence['snt_year']!=0) { $source[] = "$sentence[snt_year]"; } $source = implode(", ", $source); if (!empty($sentence['snt_url'])) { if (empty($source)) $source = 'source'; $source = "$source"; } if (!empty($source)) $html .= " (".$source.")"; $html .= " [ edit ] [ delete ]"; $html .= "

"; } break; case 'delsnt': if ($snt_id==-1) die(); if (mysql_query("DELETE FROM pvc_sentence WHERE snt_id=$snt_id")) { mysql_query("DELETE FROM pvc_verb_sentence WHERE vs_sid=$snt_id"); mysql_query("DELETE FROM pvc_sentence_tag WHERE sentence_id=$snt_id;"); $html = 'ok'; } break; case 'addsynset': $synset = mysql_real_escape_string($_POST['synset']); $spoken = intval($_POST['ss_spoken']); $both = intval($_POST['ss_both']); $ok = 0; $rows = ''; $error = ''; if (mysql_query("INSERT INTO pvc_synsets (ss_name, ss_spoken) VALUES (\"$synset\", $spoken)")) { $id = mysql_insert_id(); $ok++; $sp = ''; if ($spoken) { $sp = ' class=\'spoken\''; } $rows .= "$id".htmlspecialchars(stripslashes($synset), ENT_QUOTES); if (isset($_POST['popup'])) { $rows .= "select"; } else { $rows .= "

has: [ add a relation ]"; $rows .= "

"; } $rows .= ""; } elseif (mysql_errno()==1062) { $error = "Such synset already exists"; } else { $html = '{"msg": "'.mysql_errno().' - '.addslashes(mysql_error()).'"}'; break; } if ($both) { if (mysql_query("INSERT INTO pvc_synsets (ss_name, ss_spoken) VALUES (\"$synset\", 1)")) { $id = mysql_insert_id(); $ok++; $rows .= "$id".htmlspecialchars(stripslashes($synset), ENT_QUOTES); if (isset($_POST['popup'])) { $rows .= "select"; } else { $rows .= "

has: [ add a relation ]"; $rows .= "

"; } $rows .= ""; $error = ''; } elseif (mysql_errno()==1062) { if (empty($rows)) $error = "Such synset already exists"; } else { $html = '{"msg": "'.mysql_errno().' - '.addslashes(mysql_error()).'"}'; break; } } if ($ok) { $html = '{"msg": "ok", "rows": "'.addslashes($rows).'"}'; } else { $html = '{"msg": "'.$error.'"}'; } break; case 'getsynset': $synset = intval($_POST['synset']); $title = $syn = ''; if ($r = mysql_query("SELECT * FROM pvc_synsets WHERE ss_id=$synset")) { if ($row = mysql_fetch_assoc($r)) { $title = htmlspecialchars($row['ss_name']); if ($row['ss_spoken']==1) $title .= ' (spoken)'; } } if ($r = mysql_query(" SELECT * FROM pvc_synonyms sn INNER JOIN pvc_meanings m ON sn_meaning=m_id INNER JOIN pvc_verbs e ON m_vid=id WHERE sn_synset=$synset ORDER BY sn_order")) { while ($row = mysql_fetch_assoc($r)) { $syn .= '
  • '.htmlspecialchars($row['pers_inf']).' '.htmlspecialchars($row['m_text']).'
  • '; } } $html = '{"title": "'.$title.'", "synonyms": "'.$syn.'"}'; break; case 'addrelation': $ss = intval($_POST['ss']); $sspar = intval($_POST['sspar']); $relation = mysql_real_escape_string($_POST['rel']); $r = mysql_query("INSERT INTO pvc_synset_relations (sr_synset, sr_parent, sr_type) VALUES ($ss, $sspar, '$relation');"); if (!$r) { if (mysql_errno() == 1062) { $html = '{"msg": "This relation is already added"}'; } else { $html = '{"msg": "' . mysql_error() . '"}'; } } else { $html = '{"msg": "ok", "relations": "' . GetRelations($ss) . '"}'; } break; case 'getrelations': $ss = intval($_POST['ss']); $html = GetRelations($ss); break; default: break; } print $html; ?>