Skip to content
Permalink
Browse files

Update language.php

add event *.admin.language.*
  • Loading branch information...
halfhope committed Jun 17, 2015
1 parent bcfd7d9 commit 6bdc37dd654f109a239b6744a0012f371b2fd590
Showing with 13 additions and 1 deletion.
  1. +13 −1 upload/admin/model/localisation/language.php
@@ -1,6 +1,8 @@
<?php <?php
class ModelLocalisationLanguage extends Model { class ModelLocalisationLanguage extends Model {
public function addLanguage($data) { public function addLanguage($data) {
$this->event->trigger('pre.admin.language.add', $data);
$this->db->query("INSERT INTO " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', directory = '" . $this->db->escape($data['directory']) . "', image = '" . $this->db->escape($data['image']) . "', sort_order = '" . $this->db->escape($data['sort_order']) . "', status = '" . (int)$data['status'] . "'"); $this->db->query("INSERT INTO " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', directory = '" . $this->db->escape($data['directory']) . "', image = '" . $this->db->escape($data['image']) . "', sort_order = '" . $this->db->escape($data['sort_order']) . "', status = '" . (int)$data['status'] . "'");
$this->cache->delete('language'); $this->cache->delete('language');
@@ -194,17 +196,25 @@ public function addLanguage($data) {
foreach ($query->rows as $recurring) { foreach ($query->rows as $recurring) {
$this->db->query("INSERT INTO " . DB_PREFIX . "recurring_description SET recurring_id = '" . (int)$recurring['recurring_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($recurring['name'])); $this->db->query("INSERT INTO " . DB_PREFIX . "recurring_description SET recurring_id = '" . (int)$recurring['recurring_id'] . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($recurring['name']));
} }
$this->event->trigger('post.admin.language.add', $language_id);
return $language_id; return $language_id;
} }
public function editLanguage($language_id, $data) { public function editLanguage($language_id, $data) {
$this->event->trigger('pre.admin.language.edit', $data);
$this->db->query("UPDATE " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', directory = '" . $this->db->escape($data['directory']) . "', image = '" . $this->db->escape($data['image']) . "', sort_order = '" . $this->db->escape($data['sort_order']) . "', status = '" . (int)$data['status'] . "' WHERE language_id = '" . (int)$language_id . "'"); $this->db->query("UPDATE " . DB_PREFIX . "language SET name = '" . $this->db->escape($data['name']) . "', code = '" . $this->db->escape($data['code']) . "', locale = '" . $this->db->escape($data['locale']) . "', directory = '" . $this->db->escape($data['directory']) . "', image = '" . $this->db->escape($data['image']) . "', sort_order = '" . $this->db->escape($data['sort_order']) . "', status = '" . (int)$data['status'] . "' WHERE language_id = '" . (int)$language_id . "'");
$this->cache->delete('language'); $this->cache->delete('language');
$this->event->trigger('post.admin.language.edit', $language_id);
} }
public function deleteLanguage($language_id) { public function deleteLanguage($language_id) {
$this->event->trigger('pre.admin.language.delete', $language_id);
$this->db->query("DELETE FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'"); $this->db->query("DELETE FROM " . DB_PREFIX . "language WHERE language_id = '" . (int)$language_id . "'");
$this->cache->delete('language'); $this->cache->delete('language');
@@ -266,6 +276,8 @@ public function deleteLanguage($language_id) {
$this->cache->delete('weight_class'); $this->cache->delete('weight_class');
$this->db->query("DELETE FROM " . DB_PREFIX . "recurring_description WHERE language_id = '" . (int)$language_id . "'"); $this->db->query("DELETE FROM " . DB_PREFIX . "recurring_description WHERE language_id = '" . (int)$language_id . "'");
$this->event->trigger('post.admin.language.delete', $language_id);
} }
public function getLanguage($language_id) { public function getLanguage($language_id) {
@@ -344,4 +356,4 @@ public function getTotalLanguages() {
return $query->row['total']; return $query->row['total'];
} }
} }

0 comments on commit 6bdc37d

Please sign in to comment.
You can’t perform that action at this time.