Add load and local save of the cloud
This commit is contained in:
parent
98b3498de2
commit
fea36cb867
3 changed files with 118 additions and 37 deletions
38
save.php
38
save.php
|
@ -7,24 +7,28 @@ if (empty($_POST)) {
|
|||
}
|
||||
include 'templates/header.php';
|
||||
|
||||
$id = null;
|
||||
$cpt = 0;
|
||||
$already_used = array();
|
||||
foreach ($_POST as $name => $value) {
|
||||
$cpt;
|
||||
if ($name == 'fid') {
|
||||
$id = $value;
|
||||
continue;
|
||||
}
|
||||
if (isset($id) && !in_array($value, $already_used)) {
|
||||
$already_used[] = $value;
|
||||
$value = trim(strtolower($value));
|
||||
$db->addWord($id, $value);
|
||||
}
|
||||
if ($cpt > 9) {
|
||||
break;
|
||||
if (!isset($_POST['fid'])) {
|
||||
echo sprintf('<h3>%s</h3>', L::save_missingId);
|
||||
} elseif (!$db->loadCloud($_POST['fid'])) {
|
||||
echo sprintf('<h3>%s</h3>', L::save_cloudNotFound($_POST['fid']));
|
||||
} else {
|
||||
$cpt = 0;
|
||||
$already_used = array();
|
||||
foreach ($_POST as $name => $value) {
|
||||
if ($name == 'fid') {
|
||||
continue;
|
||||
}
|
||||
$cpt++;
|
||||
if (!in_array($value, $already_used)) {
|
||||
$already_used[] = $value;
|
||||
$value = trim(strtolower($value));
|
||||
$db->addWord($value);
|
||||
}
|
||||
if ($cpt > 9) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
echo sprintf('<h3>%s</h3>', L::save_success);
|
||||
}
|
||||
echo sprintf('<h3>%s</h3>', L::save_success);
|
||||
|
||||
include 'templates/footer.php';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue