diff --git a/admin/modules/sla_articles/models/articles.php b/admin/modules/sla_articles/models/articles.php index 8a3dce3..2867ae7 100644 --- a/admin/modules/sla_articles/models/articles.php +++ b/admin/modules/sla_articles/models/articles.php @@ -83,7 +83,7 @@ public function load_items() { if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } - $row_user = $this->slash->database->fetch("MYSQL_ASSOC"); + $row_user = $this->slash->database->fetch("ASSOC"); $row[4] = $row_user["name"]; /* CATEGORIE */ diff --git a/admin/modules/sla_categories/models/categories.php b/admin/modules/sla_categories/models/categories.php index 0a1fd7d..9911ffb 100644 --- a/admin/modules/sla_categories/models/categories.php +++ b/admin/modules/sla_categories/models/categories.php @@ -1 +1 @@ -. * @addtogroup sla_categories * @{ */ class categories extends slaModel implements iModel{ public function load_items() { $search = ""; if ($_SESSION[$this->controller->module_name."_search"] != "#") { $search = "WHERE title LIKE '%".$_SESSION[$this->controller->module_name."_search"]."%' OR description LIKE '%".$_SESSION[$this->controller->module_name."_search"]."%' "; } /*$result = mysql_query("SELECT id,title,description FROM ".$this->slash->database_prefix."categories ".$search."ORDER BY ".$_SESSION[$this->controller->module_name."_orderby"]." ".$_SESSION[$this->controller->module_name."_sort"], $this->slash->db_handle) or $this->slash->show_fatal_error("QUERY_ERROR",mysql_error()); */ $this->slash->database->setQuery("SELECT id,title,description FROM ".$this->slash->database_prefix."categories ".$search."ORDER BY ".$_SESSION[$this->controller->module_name."_orderby"]." ".$_SESSION[$this->controller->module_name."_sort"]); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } $objects = array(); $obj_ids = array("id","title","description"); $obj_titles = array("ID",$this->slash->trad_word("TITLE"),$this->slash->trad_word("DESCRIPTION")); $obj_sorts = array(false,true,true); $obj_sizes = array(5,40,40); $obj_actions = array(false,"single_edit","single_edit"); $obj_controls = array("single_edit","single_delete"); //while ($row = mysql_fetch_array($result, MYSQL_BOTH)) { foreach ($this->slash->database->fetchAll("BOTH") as $row) { /* CONTENT */ $sl_txt = new sl_text(); $h2t_content = new html2text($row[2]); $row[2] = $sl_txt->substring_word($h2t_content->get_text(),80,true); $row[2] = utf8_encode($row[2]); array_push($objects,$row); } sl_interface::create_listing($this->controller->module_name,$obj_ids,$obj_titles,$obj_sorts,$obj_sizes,$obj_actions,$objects,$obj_controls,true,true,true,true); } /** * Load categorie * @param $id Categorie ID */ public function load_item($id) { $this->slash->database->setQuery("SELECT * FROM ".$this->slash->database_prefix."categories WHERE id=".$id); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } $row = $this->slash->database->fetch("ASSOC"); return $row; } /** * Delete categorie * @param $id Categorie ID */ public function delete_items($id_array) { foreach ($id_array as $value) { $this->slash->database->setQuery("DELETE FROM ".$this->slash->database_prefix."categories WHERE id=".$value); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } } /** * Save categorie */ public function save_item($id,$values){ if ($id != 0) { $this->slash->database->setQuery("UPDATE ".$this->slash->database_prefix."categories set id_user='".$_SESSION["id_user"]."', title='".$values["title"]."', description='".$values["description"]."' WHERE id='".$values["id"]."' "); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } else { $this->slash->database->setQuery("INSERT INTO ".$this->slash->database_prefix."categories (id,id_user,title,description) value ('','".$_SESSION["id_user"]."','".$values["title"]."','".$values["description"]."')"); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } return $this->slash->trad_word("SAVE_SUCCESS"); } /** * Recovery fields value */ public function recovery_fields() { $obj = array(); $obj["id"] = $this->slash->sl_param($this->controller->module_name."_id_obj","POST"); $obj["title"] = $this->slash->sl_param($this->controller->module_name."_obj1","POST"); $obj["description"] = $this->slash->sl_param($this->controller->module_name."_obj2","POST"); return $obj; } /** * Check add/edit values * @param $values:Array Object Values */ public function check_fields($values) { $mess = array(); //Categorie verification $this->slash->database->setQuery("SELECT * FROM ".$this->slash->database_prefix."categories WHERE title='".$values["title"]."' AND id !='".$values["id"]."'"); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } if ($this->slash->database->rowCount()>0) { $mess[0]["message"] = $this->slash->trad_word("CATEGORIES_ERROR_EXIST"); } if (count($mess) > 0){ return $mess; } else { return null; } } } /** * @} */ ?> \ No newline at end of file +. * @addtogroup sla_categories * @{ */ class categories extends slaModel implements iModel{ public function load_items() { $search = ""; if ($_SESSION[$this->controller->module_name."_search"] != "#") { $search = "WHERE title LIKE '%".$_SESSION[$this->controller->module_name."_search"]."%' OR description LIKE '%".$_SESSION[$this->controller->module_name."_search"]."%' "; } /*$result = mysql_query("SELECT id,title,description FROM ".$this->slash->database_prefix."categories ".$search."ORDER BY ".$_SESSION[$this->controller->module_name."_orderby"]." ".$_SESSION[$this->controller->module_name."_sort"], $this->slash->db_handle) or $this->slash->show_fatal_error("QUERY_ERROR",mysql_error()); */ $this->slash->database->setQuery("SELECT id,title,description FROM ".$this->slash->database_prefix."categories ".$search."ORDER BY ".$_SESSION[$this->controller->module_name."_orderby"]." ".$_SESSION[$this->controller->module_name."_sort"]); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } $objects = array(); $obj_ids = array("id","title","description"); $obj_titles = array("ID",$this->slash->trad_word("TITLE"),$this->slash->trad_word("DESCRIPTION")); $obj_sorts = array(false,true,true); $obj_sizes = array(5,40,40); $obj_actions = array(false,"single_edit","single_edit"); $obj_controls = array("single_edit","single_delete"); foreach ($this->slash->database->fetchAll("BOTH") as $row) { /* CONTENT */ $sl_txt = new sl_text(); $h2t_content = new html2text($row[2]); $row[2] = $sl_txt->substring_word($h2t_content->get_text(),80,true); $row[2] = utf8_encode($row[2]); array_push($objects,$row); } sl_interface::create_listing($this->controller->module_name,$obj_ids,$obj_titles,$obj_sorts,$obj_sizes,$obj_actions,$objects,$obj_controls,true,true,true,true); } /** * Load categorie * @param $id Categorie ID */ public function load_item($id) { $this->slash->database->setQuery("SELECT * FROM ".$this->slash->database_prefix."categories WHERE id=".$id); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } $row = $this->slash->database->fetch("ASSOC"); return $row; } /** * Delete categorie * @param $id Categorie ID */ public function delete_items($id_array) { foreach ($id_array as $value) { $this->slash->database->setQuery("DELETE FROM ".$this->slash->database_prefix."categories WHERE id=".$value); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } } /** * Save categorie */ public function save_item($id,$values){ if ($id != 0) { $this->slash->database->setQuery("UPDATE ".$this->slash->database_prefix."categories set id_user='".$_SESSION["id_user"]."', title='".$values["title"]."', description='".$values["description"]."' WHERE id='".$values["id"]."' "); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } else { $this->slash->database->setQuery("INSERT INTO ".$this->slash->database_prefix."categories (id,id_user,title,description) value ('','".$_SESSION["id_user"]."','".$values["title"]."','".$values["description"]."')"); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } } return $this->slash->trad_word("SAVE_SUCCESS"); } /** * Recovery fields value */ public function recovery_fields() { $obj = array(); $obj["id"] = $this->slash->sl_param($this->controller->module_name."_id_obj","POST"); $obj["title"] = $this->slash->sl_param($this->controller->module_name."_obj1","POST"); $obj["description"] = $this->slash->sl_param($this->controller->module_name."_obj2","POST"); return $obj; } /** * Check add/edit values * @param $values:Array Object Values */ public function check_fields($values) { $mess = array(); //Categorie verification $this->slash->database->setQuery("SELECT * FROM ".$this->slash->database_prefix."categories WHERE title='".$values["title"]."' AND id !='".$values["id"]."'"); if (!$this->slash->database->execute()) { $this->slash->show_fatal_error("QUERY_ERROR",$this->slash->database->getError()); } if ($this->slash->database->rowCount()>0) { $mess[0]["message"] = $this->slash->trad_word("CATEGORIES_ERROR_EXIST"); } if (count($mess) > 0){ return $mess; } else { return null; } } } /** * @} */ ?> \ No newline at end of file diff --git a/admin/modules/sla_lang/models/lang.php b/admin/modules/sla_lang/models/lang.php index 3da5361..124f398 100644 --- a/admin/modules/sla_lang/models/lang.php +++ b/admin/modules/sla_lang/models/lang.php @@ -188,19 +188,7 @@ public function recovery_fields() { * @param $values:Array Object Values */ public function check_fields($values) { - /* - $mess = array(); - echo "test"; - //languages verification - $result = mysql_query("SELECT * FROM ".$this->slash->database_prefix."lang WHERE name='".$values["name"]."' AND id !='".$values["id"]."'",$this->slash->db_handle) or $this->slash->show_fatal_error("QUERY_ERROR",mysql_error()); - $row = mysql_fetch_array($result, MYSQL_ASSOC); - - if ($row["shortname"] == 1) { - $mess[0]["message"] = $this->slash->trad_word("LANG_ERROR_EXIST"); - } - - if (count($mess) > 0){ return $mess; } else { return null; } - */ + /* TODO */ } diff --git a/core/slash.php b/core/slash.php index 2da9b50..2a766c1 100644 --- a/core/slash.php +++ b/core/slash.php @@ -202,7 +202,7 @@ private function load_config() { $this->show_fatal_error("QUERY_ERROR",$this->database->getError()); } - foreach ($this->database->fetchAll("MYSQL_ASSOC") as $value) { + foreach ($this->database->fetchAll("ASSOC") as $value) { $this->config[$value["config_name"]] = $value["config_value"]; } @@ -481,7 +481,7 @@ public function get_admin_infos (){ $this->show_fatal_error("QUERY_ERROR",$this->database->getError()); } - return $this->database->fetch("MYSQL_ASSOC"); + return $this->database->fetch("ASSOC"); } else { return null; } } @@ -497,7 +497,7 @@ public function get_active_lang (){ $this->show_fatal_error("QUERY_ERROR",$this->database->getError()); } - return $this->database->fetchAll("MYSQL_ASSOC"); + return $this->database->fetchAll("ASSOC"); } @@ -565,7 +565,7 @@ public function sl_module_id($name,$type=0) { } if ($this->database->rowCount() > 0) { - $row_module = $this->database->fetch("MYSQL_ASSOC"); + $row_module = $this->database->fetch("ASSOC"); return $row_module["id"]; }else{ return false; @@ -583,7 +583,7 @@ public function initialize_modules() { $this->show_fatal_error("QUERY_ERROR",$this->database->getError()); } - foreach ($this->database->fetchAll("MYSQL_ASSOC") as $row) { + foreach ($this->database->fetchAll("ASSOC") as $row) { if ($row["initialize_order"] != "0") { //Global module $this->load_module_language($row["url"]); @@ -655,7 +655,7 @@ public function execute_modules() { $this->show_fatal_error("QUERY_ERROR",$this->database->getError()); } - foreach ($this->database->fetchAll("MYSQL_ASSOC") as $value) { + foreach ($this->database->fetchAll("ASSOC") as $value) { $this->modules[$value["name"]]->execute(); }