Commit e569e98c authored by M.Nowocyn's avatar M.Nowocyn

Change Variable formation and changed some class directories and namespaces

parent 1a953660
......@@ -71,7 +71,7 @@ class Key extends Mixed implements iKey
if (!$name instanceof Key) {
$name = self::get($name);
}
if (User::getSession()->hasPermission("iko.Language.keys.delete")) {
if ( User::getSession()->hasPermission( "iko.language.keys.delete" ) ) {
$key = Core::PDO()->quote($name->getKey());
$sql = "DELETE FROM " . self::TABLE . " WHERE " . self::NAME . " = " . $key;
$statement = Core::PDO()->exec($sql);
......@@ -95,7 +95,7 @@ class Key extends Mixed implements iKey
public static function create (string $name)
{
if ($name != "" && !self::exist($name)) {
if (User::getSession()->hasPermission("iko.Language.keys.create")) {
if ( User::getSession()->hasPermission( "iko.language.keys.create" ) ) {
$name = Core::PDO()->quote($name);
$sql = "INSERT INTO " . self::TABLE . " (" . self::NAME . ") VALUE('" . $name . "')";
$statement = Core::PDO()->exec($sql);
......@@ -127,7 +127,7 @@ class Key extends Mixed implements iKey
public function getLang (string $lang = "")
{
if ($lang == "") {
$lang = language::getInstance()->getCurrent();
$lang = Language::getInstance()->getCurrent();
}
if ($lang != "") {
if (!isset($this->languages[ $lang ])) {
......@@ -144,7 +144,7 @@ class Key extends Mixed implements iKey
{
if (!$this->all) {
$this->all = TRUE;
$languages = language::getInstance()->getLanguages();
$languages = Language::getInstance()->getLanguages();
foreach ($languages as $item) {
if (!isset($this->languages[ $item ])) {
$this->all = FALSE;
......@@ -206,8 +206,14 @@ class Key extends Mixed implements iKey
{
if (Language::getInstance()->isSupportedLanguage($lang)) {
if ($value != "" && $value != $this->getLang($lang)) {
if (User::getSession()->hasPermission("iko.Language.keys.set.lang")) {
if (Handler::event("iko.Language.keys.set.lang", $this, NULL, TRUE)) {
if ( User::getSession()->hasPermission( "iko.language.keys.set.lang" ) ) {
if ( Handler::event(
"iko.language.keys.set.lang",
$this,
NULL,
TRUE
)
) {
$sql_value = Core::PDO()->quote($value);
$statement = Core::PDO()->exec("UPDATE " . self::TABLE . " Set " . $lang . " = " . $sql_value . " WHERE " . self::NAME . " = '" . self::getKey() . "' ");
if ($statement == 1) {
......@@ -226,8 +232,12 @@ class Key extends Mixed implements iKey
public function setKey ($name)
{
if ($name != "" && $name != $this->getKey()) {
if (User::getSession()->hasPermission("iko.Language.keys.set.name")) {
if (Handler::event("iko.Language.keys.set.name", $name)) {
if ( User::getSession()->hasPermission( "iko.language.keys.set.name" ) ) {
if ( Handler::event(
"iko.language.keys.set.name",
$name
)
) {
$sql_name = Core::PDO()->quote($name);
$statement = Core::PDO()->exec("UPDATE " . self::TABLE . " Set " . self::TABLE . " = " . $sql_name . " WHERE " . self::NAME . " = '" . self::getKey() . "' ");
if ($statement == 1) {
......
......@@ -44,7 +44,7 @@ class Language extends Instance implements iLanguage
{
$lang = NULL;
if (Session::isLoggedIn()) {
$lang = User::get_session()->get_language();
$lang = User::getSession()->getLanguage();
}
if ($lang == NULL || $lang == "") {
$config = Config::load("pdo", "Language");
......@@ -88,7 +88,7 @@ class Language extends Instance implements iLanguage
if (($func == "add" && !$this->isSupportedLanguage($name)) || ($func == "remove" && $this->isSupportedLanguage($name) && array_search($name,
self::FIXED, TRUE) === FALSE)
) {
if (User::get_session()->has_permission("iko.Language." . $func . ".lang")) {
if ( User::getSession()->hasPermission( "iko.language." . $func . ".lang" ) ) {
if ($func == "add") {
$sql = "ALTER TABLE " . self::TABLE . " ADD :lang TEXT";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment