Esempio n. 1
0
	foreach($msgData['translations'] as $trnData) {
		$msg=new LPC_I18n_message();
		$msgs=$msg->search(
			array(
				'language',
				'message_key',
			),
			array(
				$langMapping[$trnData['language']],
				$ref->id
			)
		);
		if ($msgs) {
			$msg=$msgs[0];
			$msg->load();
		} else {
			$msg=new LPC_I18n_message();
			$msg->setAttrs(array(
				'language'=>$langMapping[$trnData['language']],
				'message_key'=>$ref->id,
			));
		}
		$msg->setAttr('translation',$trnData['translation']);
		$msg->save();
	}
}

echo "Clean exit, all messages from $filename imported into the local database.\n";
if (defined('LPC_CACHE_TYPE') && in_array(LPC_CACHE_TYPE,array('session','apc')))
	echo "WARNING! You're using ".LPC_CACHE_TYPE." caching, which means that messages updated by this import (if any) might still be cached in the old form!\n";
Esempio n. 2
0
	exit;
}

$p->title="Message translator";
$p->st();

$msg=new LPC_I18n_message();
$msg=$msg->search(
	array('language','message_key'),
	array($_SESSION['LPC_target_lang'],$msgKey)
);
if ($msg)
	$msg=$msg[0];
else {
	$msg=new LPC_I18n_message();
	$msg->setAttr('language',$_SESSION['LPC_target_lang']);
	$msg->setAttr('message_key',$msgKey);
}

$ref=new LPC_I18n_reference($msgKey);
if (!$ref->probe()) {
	$p->a("<div class='container'>&larr; <a href='message_select.php'>Back to the message list</a></div>");
	$p->a(new LPC_HTML_error("This reference message was not found in the database: [".htmlspecialchars($msgKey)."]"));
	$p->show();
	return;
	$p->show();
}
if (isset($_POST['delete'])) {
	$ref->delete();
	header("Location: message_select.php");
	exit;