This commit is contained in:
Momchil Bozhinov
2021-02-23 12:06:18 +02:00
parent ac0c401938
commit 781d53d1cd
5 changed files with 10 additions and 11 deletions

View File

@@ -130,7 +130,6 @@ class Db {
} }
# TODO once tested $values can have a default value of an empty array # TODO once tested $values can have a default value of an empty array
# TODO both selects were assoc
function select($sql, $values, $single = false){ function select($sql, $values, $single = false){
try { try {
$query = $this->_pdo->prepare($sql); $query = $this->_pdo->prepare($sql);
@@ -173,7 +172,7 @@ class Db {
$i++; $i++;
} }
$query->execute(); $query->execute();
$query->commit(); $this->_pdo->commit();
} catch(PDOException $e) { } catch(PDOException $e) {
return array('error'=>true,'info'=>$e->getMessage()); return array('error'=>true,'info'=>$e->getMessage());
} }
@@ -194,7 +193,7 @@ class Db {
} }
$query->execute(); $query->execute();
$rowCount=$query->rowCount(); $rowCount=$query->rowCount();
$query->commit(); $this->_pdo->commit();
} catch(PDOException $e) { } catch(PDOException $e) {
return false;//$e->getMessage(); return false;//$e->getMessage();
} }

View File

@@ -1,14 +1,14 @@
<?php <?php
class Locale() class Locale
{ {
public $language='en'; public $language='en';
public $translate_arr=array(); public $translate_arr=array();
function __construct($realpath_public) function __construct($realpath_public)
{ {
(isset($_COOKIE['lang'])) $this->language=$_COOKIE['lang']; (isset($_COOKIE['lang'])) AND $this->language=$_COOKIE['lang'];
(!array_key_exists($this->language, Config::languages)) $this->language='en'; (!array_key_exists($this->language, Config::$languages)) AND $this->language='en';
include($realpath_public.'/lang/'.$this->language.'.php'); include($realpath_public.'/lang/'.$this->language.'.php');
$this->translate_arr=$lang; $this->translate_arr=$lang;
} }
@@ -20,7 +20,7 @@ class Locale()
public function get_available_languages() public function get_available_languages()
{ {
return Config::languages; return Config::$languages;
} }
public function translate($phrase) public function translate($phrase)

View File

@@ -36,7 +36,7 @@ class Menu
{ {
$realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/ $realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/
$lang = new Locale($realpath_public); $lang = new Locale($realpath_public);
$menu_config = Config::menu; $menu_config = Config::$menu;
if(!empty($menu_config)){ if(!empty($menu_config)){
reset($menu_config); reset($menu_config);
$this->first_key=key($menu_config); $this->first_key=key($menu_config);
@@ -95,7 +95,7 @@ class Menu
$this->html.='</ul>'; $this->html.='</ul>';
if($this->title=='Error'){ if($this->title=='Error'){
$other_titles = Config::other_titles; $other_titles = Config::$other_titles;
if(isset($other_titles[$qstr])) if(isset($other_titles[$qstr]))
$this->title=$lang->translate($other_titles[$qstr]); $this->title=$lang->translate($other_titles[$qstr]);
} }

View File

@@ -2,7 +2,7 @@
class Utils class Utils
{ {
public static gen_uri_chunks($uri) public static function gen_uri_chunks($uri)
{ {
$uri_chunks = []; $uri_chunks = [];
if(!empty($uri)){ if(!empty($uri)){

View File

@@ -10,7 +10,7 @@ $uri=trim($_SERVER['REQUEST_URI'],'/');
include($_REALPATH.'/php/clonos.php'); include($_REALPATH.'/php/clonos.php');
include($_REALPATH.'/php/menu.php'); include($_REALPATH.'/php/menu.php');
$clonos=new ClonOS($_REALPATH,$uri); $clonos=new ClonOS($_REALPATH,$uri);
$menu=new Menu($this, $uri); $menu=new Menu($_REALPATH, $uri);
$realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/ $realpath_public=$_REALPATH.'/public/'; # /usr/home/web/cp/clonos/public/
$locale = new Locale($realpath_public); $locale = new Locale($realpath_public);
//echo json_encode($clonos->config->os_types);exit; //echo json_encode($clonos->config->os_types);exit;