Merge pull request #316 from HungryFeline/patch-5

Fixing csv upload form
This commit is contained in:
Shish 2013-07-06 01:53:29 -07:00
commit 589bda1b00
2 changed files with 7 additions and 2 deletions

View File

@ -138,7 +138,12 @@ class AliasEditor extends Extension {
foreach(explode("\n", $csv) as $line) { foreach(explode("\n", $csv) as $line) {
$parts = explode(",", $line); $parts = explode(",", $line);
if(count($parts) == 2) { if(count($parts) == 2) {
$database->execute("INSERT INTO aliases(oldtag, newtag) VALUES(:oldtag, :newtag)", array("oldtag" => $parts[0], "newtag" => $parts[1])); $pair = array("oldtag" => $parts[0], "newtag" => $parts[1]);
if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:oldtag AND lower(newtag)=lower(:newtag)", $pair)){
if(!$database->get_row("SELECT * FROM aliases WHERE oldtag=:newtag", array("newtag" => $pair['newtag']))){
$database->execute("INSERT INTO aliases(oldtag, newtag) VALUES(:oldtag, :newtag)", $pair);
}
}
} }
} }
} }

View File

@ -57,7 +57,7 @@ class AliasEditorTheme extends Themelet {
"; ";
$bulk_html = " $bulk_html = "
".make_form(make_link("alias/import"), $multipart=True)." ".make_form(make_link("alias/import"), 'post', true)."
<input type='file' name='alias_file'> <input type='file' name='alias_file'>
<input type='submit' value='Upload List'> <input type='submit' value='Upload List'>
</form> </form>