Skip to content

Commit

Permalink
Remplacement des MYSQL_* par ASSOC, BOTH, NUM.
Browse files Browse the repository at this point in the history
Remplacement des MYSQL_ASSOC, MYSQL_BOTH, MYSQL_NUM, dans les modules
par : ASSOC, BOTH, NUM.
  • Loading branch information
wakdev committed Mar 30, 2013
1 parent 4725944 commit 001c6fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 21 deletions.
2 changes: 1 addition & 1 deletion admin/modules/sla_articles/models/articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion admin/modules/sla_categories/models/categories.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php/*** @package SLASH-CMS* @subpackage sla_categories* @internal sla_categories* @version categories.php - Version 12.3.25* @author Julien Veuillet [http://www.wakdev.com]* @copyright Copyright(C) 2009 - Today. All rights reserved.* @license GNU/GPLThis program is free software : you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.* @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; } } }/** * @} */?>
<?php/*** @package SLASH-CMS* @subpackage sla_categories* @internal sla_categories* @version categories.php - Version 12.3.25* @author Julien Veuillet [http://www.wakdev.com]* @copyright Copyright(C) 2009 - Today. All rights reserved.* @license GNU/GPLThis program is free software : you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 3 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.* @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; } } }/** * @} */?>
Expand Down
14 changes: 1 addition & 13 deletions admin/modules/sla_lang/models/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}


Expand Down
12 changes: 6 additions & 6 deletions core/slash.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
}

Expand Down Expand Up @@ -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; }
}
Expand All @@ -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");

}

Expand Down Expand Up @@ -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;
Expand All @@ -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"]);

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 001c6fb

Please sign in to comment.