add subcommand for submitting new translation

This commit is contained in:
Uwe Steinmann 2014-04-08 10:41:53 +02:00
parent 84f3942fba
commit 99ba945b75

View File

@ -55,7 +55,7 @@ if (isset($_COOKIE["mydms_session"])) {
$command = $_REQUEST["command"];
switch($command) {
case 'checkpwstrength':
case 'checkpwstrength': /* {{{ */
$ps = new Password_Strength();
$ps->set_password($_REQUEST["pwd"]);
if($settings->_passwordStrengthAlgorithm == 'simple')
@ -72,7 +72,7 @@ switch($command) {
} else {
echo json_encode(array('error'=>0, 'strength'=>$score));
}
break;
break; /* }}} */
case 'sessioninfo': /* {{{ */
if($user) {
@ -243,5 +243,19 @@ switch($command) {
}
break; /* }}} */
case 'submittranslation': /* {{{ */
if($user && !empty($_POST['phrase'])) {
if($fp = fopen('/tmp/newtranslations.txt', 'a+')) {
fputcsv($fp, array(date('Y-m-d H:i:s'), $user->getLogin(), $_POST['key'], $_POST['lang'], $_POST['phrase']));
fclose($fp);
}
header('Content-Type', 'application/json');
echo json_encode(array('success'=>true, 'message'=>'Thank you for your contribution', 'data'=>''));
} else {
header('Content-Type', 'application/json');
echo json_encode(array('success'=>false, 'message'=>'Missing translation', 'data'=>''));
}
break; /* }}} */
}
?>