aboutsummaryrefslogtreecommitdiff
path: root/classes/contact.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/contact.php')
-rw-r--r--classes/contact.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/classes/contact.php b/classes/contact.php
index 989a14f..7741c17 100644
--- a/classes/contact.php
+++ b/classes/contact.php
@@ -317,13 +317,19 @@ class contact {
/**
* Set the language of the contact
*
+ * @see correspondence::LANGUAGES The available languages
+ *
* @param string $language The new language for the contact
*
* @throws PDOException If something went wrong with the database
+ * @throws Exception If the language is unknown
*
* @return bool True on succes, false on failure
*/
public function setLanguage($language) {
+ if (!in_array($language, correspondence::LANGUAGES)) {
+ throw new Exception("Language $language not available.");
+ }
$stmt = $this->pdo->prepare("UPDATE `".constants::db_prefix."contact` SET `language`=? WHERE `id`=?");
$stmt->execute(array($language, $this->id));
if ($stmt->rowCount() == 1) {