";
}
/**
* @return int The number of rows returned from the most recent query.
*/
function getNumRows( $cur=null ) {
return mysql_num_rows( $cur ? $cur : $this->_cursor );
}
/**
* This method loads the first field of the first row returned by the query.
*
* @return The value returned in the query or null if the query failed.
*/
function loadResult() {
if (!($cur = $this->query())) {
return null;
}
$ret = null;
if ($row = mysql_fetch_row( $cur )) {
$ret = $row[0];
}
mysql_free_result( $cur );
return $ret;
}
/**
* Load an array of single field results into an array
*/
function loadResultArray($numinarray = 0) {
if (!($cur = $this->query())) {
return null;
}
$array = array();
while ($row = mysql_fetch_row( $cur )) {
$array[] = $row[$numinarray];
}
mysql_free_result( $cur );
return $array;
}
/**
* Load a assoc list of database rows
* @param string The field name of a primary key
* @return array If key is empty as sequential list of returned records.
*/
function loadAssocList( $key='' ) {
if (!($cur = $this->query())) {
return null;
}
$array = array();
while ($row = mysql_fetch_assoc( $cur )) {
if ($key) {
$array[$row[$key]] = $row;
} else {
$array[] = $row;
}
}
mysql_free_result( $cur );
return $array;
}
/**
* This global function loads the first row of a query into an object
*
* If an object is passed to this function, the returned row is bound to the existing elements of object.
* If object has a value of null, then all of the returned query fields returned in the object.
* @param string The SQL query
* @param object The address of variable
*/
function loadObject( &$object ) {
if ($object != null) {
if (!($cur = $this->query())) {
return false;
}
if ($array = mysql_fetch_assoc( $cur )) {
mysql_free_result( $cur );
mosBindArrayToObject( $array, $object, null, null, false );
return true;
} else {
return false;
}
} else {
if ($cur = $this->query()) {
if ($object = mysql_fetch_object( $cur )) {
mysql_free_result( $cur );
return true;
} else {
$object = null;
return false;
}
} else {
return false;
}
}
}
/**
* Load a list of database objects
* @param string The field name of a primary key
* @return array If key is empty as sequential list of returned records.
* If key is not empty then the returned array is indexed by the value
* the database key. Returns null if the query fails.
*/
function loadObjectList( $key='' ) {
if (!($cur = $this->query())) {
return null;
}
$array = array();
while ($row = mysql_fetch_object( $cur )) {
if ($key) {
$array[$row->$key] = $row;
} else {
$array[] = $row;
}
}
mysql_free_result( $cur );
return $array;
}
/**
* @return The first row of the query.
*/
function loadRow() {
if (!($cur = $this->query())) {
return null;
}
$ret = null;
if ($row = mysql_fetch_row( $cur )) {
$ret = $row;
}
mysql_free_result( $cur );
return $ret;
}
/**
* Load a list of database rows (numeric column indexing)
* @param int Value of the primary key
* @return array If key is empty as sequential list of returned records.
* If key is not empty then the returned array is indexed by the value
* the database key. Returns null if the query fails.
*/
function loadRowList( $key=null ) {
if (!($cur = $this->query())) {
return null;
}
$array = array();
while ($row = mysql_fetch_row( $cur )) {
if ( !is_null( $key ) ) {
$array[$row[$key]] = $row;
} else {
$array[] = $row;
}
}
mysql_free_result( $cur );
return $array;
}
/**
* Document::db_insertObject()
*
* { Description }
*
* @param string $table This is expected to be a valid (and safe!) table name
* @param [type] $keyName
* @param [type] $verbose
*/
function insertObject( $table, &$object, $keyName = NULL, $verbose=false ) {
$fmtsql = "INSERT INTO $table ( %s ) VALUES ( %s ) ";
$fields = array();
foreach (get_object_vars( $object ) as $k => $v) {
if (is_array($v) or is_object($v) or $v === NULL) {
continue;
}
if ($k[0] == '_') { // internal field
continue;
}
$fields[] = $this->NameQuote( $k );
$values[] = $this->Quote( $v );
}
$this->setQuery( sprintf( $fmtsql, implode( ",", $fields ) , implode( ",", $values ) ) );
($verbose) && print "$sql \n";
if (!$this->query()) {
return false;
}
$id = mysql_insert_id( $this->_resource );
($verbose) && print "id=[$id] \n";
if ($keyName && $id) {
$object->$keyName = $id;
}
return true;
}
/**
* Document::db_updateObject()
*
* { Description }
*
* @param string $table This is expected to be a valid (and safe!) table name
* @param [type] $updateNulls
*/
function updateObject( $table, &$object, $keyName, $updateNulls=true ) {
$fmtsql = "UPDATE $table SET %s WHERE %s";
$tmp = array();
foreach (get_object_vars( $object ) as $k => $v) {
if( is_array($v) or is_object($v) or $k[0] == '_' ) { // internal or NA field
continue;
}
if( $k == $keyName ) { // PK not to be updated
$where = $keyName . '=' . $this->Quote( $v );
continue;
}
if ($v === NULL && !$updateNulls) {
continue;
}
if( $v == '' ) {
$val = "''";
} else {
$val = $this->Quote( $v );
}
$tmp[] = $this->NameQuote( $k ) . '=' . $val;
}
$this->setQuery( sprintf( $fmtsql, implode( ",", $tmp ) , $where ) );
return $this->query();
}
/**
* @param boolean If TRUE, displays the last SQL statement sent to the database
* @return string A standised error message
*/
function stderr( $showSQL = false ) {
return "DB function failed with error number $this->_errorNum"
." $this->_errorMsg"
.($showSQL ? " SQL =
$this->_sql
" : '');
}
function insertid() {
return mysql_insert_id( $this->_resource );
}
function getVersion() {
return mysql_get_server_info( $this->_resource );
}
/**
* @return array A list of all the tables in the database
*/
function getTableList() {
$this->setQuery( 'SHOW TABLES' );
return $this->loadResultArray();
}
/**
* @param array A list of valid (and safe!) table names
* @return array A list the create SQL for the tables
*/
function getTableCreate( $tables ) {
$result = array();
foreach ($tables as $tblval) {
$this->setQuery( 'SHOW CREATE table ' . $this->getEscaped( $tblval ) );
$rows = $this->loadRowList();
foreach ($rows as $row) {
$result[$tblval] = $row[1];
}
}
return $result;
}
/**
* @param array A list of valid (and safe!) table names
* @return array An array of fields by table
*/
function getTableFields( $tables ) {
$result = array();
foreach ($tables as $tblval) {
$this->setQuery( 'SHOW FIELDS FROM ' . $tblval );
$fields = $this->loadObjectList();
foreach ($fields as $field) {
$result[$tblval][$field->Field] = preg_replace("/[(0-9)]/",'', $field->Type );
}
}
return $result;
}
/**
* Fudge method for ADOdb compatibility
*/
function GenID( $foo1=null, $foo2=null ) {
return '0';
}
}
/**
* mosDBTable Abstract Class.
* @abstract
* @package Joomla
* @subpackage Database
*
* Parent classes to all database derived objects. Customisation will generally
* not involve tampering with this object.
* @author Andrew Eddie _tbl = $table;
$this->_tbl_key = $key;
$this->_db =& $db;
}
/**
* Returns an array of public properties
* @return array
*/
function getPublicProperties() {
static $cache = null;
if (is_null( $cache )) {
$cache = array();
foreach (get_class_vars( get_class( $this ) ) as $key=>$val) {
if (substr( $key, 0, 1 ) != '_') {
$cache[] = $key;
}
}
}
return $cache;
}
/**
* Filters public properties
* @access protected
* @param array List of fields to ignore
*/
function filter( $ignoreList=null ) {
$ignore = is_array( $ignoreList );
$iFilter = new InputFilter();
foreach ($this->getPublicProperties() as $k) {
if ($ignore && in_array( $k, $ignoreList ) ) {
continue;
}
$this->$k = $iFilter->process( $this->$k );
}
}
/**
* @return string Returns the error message
*/
function getError() {
return $this->_error;
}
/**
* Gets the value of the class variable
* @param string The name of the class variable
* @return mixed The value of the class var (or null if no var of that name exists)
*/
function get( $_property ) {
if(isset( $this->$_property )) {
return $this->$_property;
} else {
return null;
}
}
/**
* Set the value of the class variable
* @param string The name of the class variable
* @param mixed The value to assign to the variable
*/
function set( $_property, $_value ) {
$this->$_property = $_value;
}
/**
* Resets public properties
* @param mixed The value to set all properties to, default is null
*/
function reset( $value=null ) {
$keys = $this->getPublicProperties();
foreach ($keys as $k) {
$this->$k = $value;
}
}
/**
* binds a named array/hash to this object
*
* can be overloaded/supplemented by the child class
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
*/
function bind( $array, $ignore='' ) {
if (!is_array( $array )) {
$this->_error = strtolower(get_class( $this ))."::bind failed.";
return false;
} else {
return mosBindArrayToObject( $array, $this, $ignore );
}
}
/**
* binds an array/hash to this object
* @param int $oid optional argument, if not specifed then the value of current key is used
* @return any result from the database operation
*/
function load( $oid=null ) {
$k = $this->_tbl_key;
if ($oid !== null) {
$this->$k = $oid;
}
$oid = $this->$k;
if ($oid === null) {
return false;
}
//Note: Prior to PHP 4.2.0, Uninitialized class variables will not be reported by get_class_vars().
/*
$class_vars = $this->getPublicProperties();
foreach ($class_vars as $name => $value) {
if ($name != $k) {
$this->$name = $value;
}
}
*/
$class_vars = get_class_vars(get_class($this));
foreach ($class_vars as $name => $value) {
if (($name != $k) and ($name != "_db") and ($name != "_tbl") and ($name != "_tbl_key")) {
$this->$name = $value;
}
}
$this->reset();
$query = "SELECT *"
. "\n FROM $this->_tbl"
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $oid )
;
$this->_db->setQuery( $query );
return $this->_db->loadObject( $this );
}
/**
* generic check method
*
* can be overloaded/supplemented by the child class
* @return boolean True if the object is ok
*/
function check() {
return true;
}
/**
* Inserts a new row if id is zero or updates an existing row in the database table
*
* Can be overloaded/supplemented by the child class
* @param boolean If false, null object variables are not updated
* @return null|string null if successful otherwise returns and error message
*/
function store( $updateNulls=false ) {
$k = $this->_tbl_key;
if ($this->$k != 0) {
$ret = $this->_db->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls);
} else {
$ret = $this->_db->insertObject($this->_tbl, $this, $this->_tbl_key);
}
if (!$ret) {
$this->_error = strtolower(get_class($this))."::store failed " . $this->_db->getErrorMsg();
return false;
} else {
return true;
}
}
/**
* @param string $where This is expected to be a valid (and safe!) SQL expression
*/
function move( $dirn, $where='' ) {
$k = $this->_tbl_key;
$sql = "SELECT $this->_tbl_key, ordering FROM $this->_tbl";
if ($dirn < 0) {
$sql .= "\n WHERE ordering < " . (int) $this->ordering;
$sql .= ($where ? "\n AND $where" : '');
$sql .= "\n ORDER BY ordering DESC";
$sql .= "\n LIMIT 1";
} else if ($dirn > 0) {
$sql .= "\n WHERE ordering > " . (int) $this->ordering;
$sql .= ($where ? "\n AND $where" : '');
$sql .= "\n ORDER BY ordering";
$sql .= "\n LIMIT 1";
} else {
$sql .= "\nWHERE ordering = " . (int) $this->ordering;
$sql .= ($where ? "\n AND $where" : '');
$sql .= "\n ORDER BY ordering";
$sql .= "\n LIMIT 1";
}
$this->_db->setQuery( $sql );
//echo 'A: ' . $this->_db->getQuery();
$row = null;
if ($this->_db->loadObject( $row )) {
$query = "UPDATE $this->_tbl"
. "\n SET ordering = " . (int) $row->ordering
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
$err = $this->_db->getErrorMsg();
die( $err );
}
//echo 'B: ' . $this->_db->getQuery();
$query = "UPDATE $this->_tbl"
. "\n SET ordering = " . (int) $this->ordering
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $row->$k )
;
$this->_db->setQuery( $query );
//echo 'C: ' . $this->_db->getQuery();
if (!$this->_db->query()) {
$err = $this->_db->getErrorMsg();
die( $err );
}
$this->ordering = $row->ordering;
} else {
$query = "UPDATE $this->_tbl"
. "\n SET ordering = " . (int) $this->ordering
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
//echo 'D: ' . $this->_db->getQuery();
if (!$this->_db->query()) {
$err = $this->_db->getErrorMsg();
die( $err );
}
}
}
/**
* Compacts the ordering sequence of the selected records
* @param string Additional where query to limit ordering to a particular subset of records. This is expected to be a valid (and safe!) SQL expression
*/
function updateOrder( $where='' ) {
$k = $this->_tbl_key;
if (!array_key_exists( 'ordering', get_class_vars( strtolower(get_class( $this )) ) )) {
$this->_error = "WARNING: ".strtolower(get_class( $this ))." does not support ordering.";
return false;
}
if ($this->_tbl == "#__content_frontpage") {
$order2 = ", content_id DESC";
} else {
$order2 = '';
}
$query = "SELECT $this->_tbl_key, ordering"
. "\n FROM $this->_tbl"
. ( $where ? "\n WHERE $where" : '' )
. "\n ORDER BY ordering$order2 "
;
$this->_db->setQuery( $query );
if (!($orders = $this->_db->loadObjectList())) {
$this->_error = $this->_db->getErrorMsg();
return false;
}
// first pass, compact the ordering numbers
for ($i=0, $n=count( $orders ); $i < $n; $i++) {
if ($orders[$i]->ordering >= 0) {
$orders[$i]->ordering = $i+1;
}
}
$shift = 0;
$n=count( $orders );
for ($i=0; $i < $n; $i++) {
//echo "i=$i id=".$orders[$i]->$k." order=".$orders[$i]->ordering;
if ($orders[$i]->$k == $this->$k) {
// place 'this' record in the desired location
$orders[$i]->ordering = min( $this->ordering, $n );
$shift = 1;
} else if ($orders[$i]->ordering >= $this->ordering && $this->ordering > 0) {
$orders[$i]->ordering++;
}
}
//echo '
';print_r($orders);echo '
';
// compact once more until I can find a better algorithm
for ($i=0, $n=count( $orders ); $i < $n; $i++) {
if ($orders[$i]->ordering >= 0) {
$orders[$i]->ordering = $i+1;
$query = "UPDATE $this->_tbl"
. "\n SET ordering = " . (int) $orders[$i]->ordering
. "\n WHERE $k = " . $this->_db->Quote( $orders[$i]->$k )
;
$this->_db->setQuery( $query);
$this->_db->query();
//echo ' '.$this->_db->getQuery();
}
}
// if we didn't reorder the current record, make it last
if ($shift == 0) {
$order = $n+1;
$query = "UPDATE $this->_tbl"
. "\n SET ordering = " . (int) $order
. "\n WHERE $k = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$this->_db->query();
//echo ' '.$this->_db->getQuery();
}
return true;
}
/**
* Generic check for whether dependancies exist for this object in the db schema
*
* can be overloaded/supplemented by the child class
* @param string $msg Error message returned
* @param int Optional key index
* @param array Optional array to compiles standard joins: format [label=>'Label',name=>'table name',idfield=>'field',joinfield=>'field']. This is expected to hold only valid (and safe!) SQL expressions
* @return true|false
*/
function canDelete( $oid=null, $joins=null ) {
$k = $this->_tbl_key;
if ($oid) {
$this->$k = $oid;
}
if (is_array( $joins )) {
$select = $k;
$join = '';
foreach( $joins as $table ) {
$tblName = $this->getEscaped( $table['name'] );
$idField = $this->getEscaped( $table['idfield'] );
$jnField = $this->getEscaped( $table['joinfield'] );
$select .= ",\n COUNT(DISTINCT `$tblName`.`$idField`) AS `count_".substr($tblName, 3)."_$idField`";
$join .= "\n LEFT JOIN `$tblName` ON `$tblName`.`$jnField` = `$this->_tbl`.`$k`";
}
$query = "SELECT $select"
. "\n FROM `$this->_tbl`"
. $join
. "\n WHERE `$this->_tbl`.`$k` = ". (int) $this->$k
. "\n GROUP BY `$this->_tbl`.`$k`"
;
$this->_db->setQuery( $query );
$obj = null;
if (!$this->_db->loadObject($obj)) {
$this->_error = $this->_db->getErrorMsg();
return false;
}
$msg = array();
foreach( $joins as $table ) {
$tblName = $this->getEscaped( $table['name'] );
$idField = $this->getEscaped( $table['idfield'] );
$k = 'count_'.substr($tblName, 3).'_'.$idField;
if ($obj->$k) {
$msg[] = $table['label'];
}
}
if (count( $msg )) {
$this->_error = "noDeleteRecord" . ": " . implode( ', ', $msg );
return false;
} else {
return true;
}
}
return true;
}
/**
* Default delete method
*
* can be overloaded/supplemented by the child class
* @return true if successful otherwise returns and error message
*/
function delete( $oid=null ) {
//if (!$this->canDelete( $msg )) {
// return $msg;
//}
$k = $this->_tbl_key;
if ($oid) {
$this->$k = intval( $oid );
}
$query = "DELETE FROM $this->_tbl"
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
if ($this->_db->query()) {
return true;
} else {
$this->_error = $this->_db->getErrorMsg();
return false;
}
}
/**
* Checks out an object
* @param int User id
* @param int Object id
*/
function checkout( $user_id, $oid=null ) {
if (!array_key_exists( 'checked_out', get_class_vars( strtolower(get_class( $this )) ) )) {
$this->_error = "WARNING: ".strtolower(get_class( $this ))." does not support checkouts.";
return false;
}
$k = $this->_tbl_key;
if ($oid !== null) {
$this->$k = $oid;
}
$time = date( 'Y-m-d H:i:s' );
if (intval( $user_id )) {
$user_id = intval( $user_id );
// new way of storing editor, by id
$query = "UPDATE $this->_tbl"
. "\n SET checked_out = $user_id, checked_out_time = " . $this->_db->Quote( $time )
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$this->checked_out = $user_id;
$this->checked_out_time = $time;
} else {
$user_id = $this->_db->Quote( $user_id );
// old way of storing editor, by name
$query = "UPDATE $this->_tbl"
. "\n SET checked_out = 1, checked_out_time = " . $this->_db->Quote( $time ) . ", editor = $user_id"
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$this->checked_out = 1;
$this->checked_out_time = $time;
$this->checked_out_editor = $user_id;
}
return $this->_db->query();
}
/**
* Checks in an object
* @param int Object id
*/
function checkin( $oid=null ) {
if (!array_key_exists( 'checked_out', get_class_vars( strtolower(get_class( $this )) ) )) {
$this->_error = "WARNING: ".strtolower(get_class( $this ))." does not support checkin.";
return false;
}
$k = $this->_tbl_key;
$nullDate = $this->_db->getNullDate();
if ($oid !== null) {
$this->$k = intval( $oid );
}
if ($this->$k == NULL) {
return false;
}
$query = "UPDATE $this->_tbl"
. "\n SET checked_out = 0, checked_out_time = " . $this->_db->Quote( $nullDate )
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$this->checked_out = 0;
$this->checked_out_time = '';
return $this->_db->query();
}
/**
* Increments the hit counter for an object
* @param int Object id
*/
function hit( $oid=null ) {
global $mosConfig_enable_log_items;
$k = $this->_tbl_key;
if ($oid !== null) {
$this->$k = intval( $oid );
}
$query = "UPDATE $this->_tbl"
. "\n SET hits = ( hits + 1 )"
. "\n WHERE $this->_tbl_key = " . $this->_db->Quote( $this->id )
;
$this->_db->setQuery( $query );
$this->_db->query();
if (@$mosConfig_enable_log_items) {
$now = date( 'Y-m-d' );
$query = "SELECT hits"
. "\n FROM #__core_log_items"
. "\n WHERE time_stamp = " . $this->_db->Quote( $now )
. "\n AND item_table = " . $this->_db->Quote( $this->_tbl )
. "\n AND item_id = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$hits = intval( $this->_db->loadResult() );
if ($hits) {
$query = "UPDATE #__core_log_items"
. "\n SET hits = ( hits + 1 )"
. "\n WHERE time_stamp = " . $this->_db->Quote( $now )
. "\n AND item_table = " . $this->_db->Quote( $this->_tbl )
. "\n AND item_id = " . $this->_db->Quote( $this->$k )
;
$this->_db->setQuery( $query );
$this->_db->query();
} else {
$query = "INSERT INTO #__core_log_items"
. "\n VALUES ( " . $this->_db->Quote( $now ) . ", " . $this->_db->Quote( $this->_tbl ) . ", " . $this->_db->Quote( $this->$k ) . ", 1 )"
;
$this->_db->setQuery( $query );
$this->_db->query();
}
}
}
/**
* Tests if item is checked out
* @param int A user id
* @return boolean
*/
function isCheckedOut( $user_id=0 ) {
if ($user_id) {
return ($this->checked_out && $this->checked_out != $user_id);
} else {
return $this->checked_out;
}
}
/**
* Generic save function
* @param array Source array for binding to class vars
* @param string Filter for the order updating. This is expected to be a valid (and safe!) SQL expression
* @returns TRUE if completely successful, FALSE if partially or not succesful
* NOTE: Filter will be deprecated in verion 1.1
*/
function save( $source, $order_filter='' ) {
if (!$this->bind( $source )) {
return false;
}
if (!$this->check()) {
return false;
}
if (!$this->store()) {
return false;
}
if (!$this->checkin()) {
return false;
}
if ($order_filter) {
$filter_value = $this->$order_filter;
$this->updateOrder( $order_filter ? "`$order_filter` = " . $this->_db->Quote( $filter_value ) : '' );
}
$this->_error = '';
return true;
}
/**
* @deprecated As of 1.0.3, replaced by publish
*/
function publish_array( $cid=null, $publish=1, $user_id=0 ) {
$this->publish( $cid, $publish, $user_id );
}
/**
* Generic Publish/Unpublish function
* @param array An array of id numbers
* @param integer 0 if unpublishing, 1 if publishing
* @param integer The id of the user performnig the operation
* @since 1.0.4
*/
function publish( $cid=null, $publish=1, $user_id=0 ) {
mosArrayToInts( $cid, array() );
$user_id = (int) $user_id;
$publish = (int) $publish;
$k = $this->_tbl_key;
if (count( $cid ) < 1) {
$this->_error = "No items selected.";
return false;
}
$cids = $this->_tbl_key . '=' . implode( ' OR ' . $this->_tbl_key . '=', $cid );
$query = "UPDATE $this->_tbl"
. "\n SET published = " . (int) $publish
. "\n WHERE ($cids)"
. "\n AND (checked_out = 0 OR checked_out = " . (int) $user_id . ")"
;
$this->_db->setQuery( $query );
if (!$this->_db->query()) {
$this->_error = $this->_db->getErrorMsg();
return false;
}
if (count( $cid ) == 1) {
$this->checkin( $cid[0] );
}
$this->_error = '';
return true;
}
/**
* Export item list to xml
* @param boolean Map foreign keys to text values
*/
function toXML( $mapKeysToText=false ) {
$xml = ' $v) {
if (is_array($v) or is_object($v) or $v === NULL) {
continue;
}
if ($k[0] == '_') { // internal field
continue;
}
$xml .= '<' . $k . '>' . $k . '>';
}
$xml .= '';
return $xml;
}
}
?>
Centre Islamique de la Réunion - Recommandations prophètiques à l'occasion du Hadjadatoul Wada' (introduction)
Celui qui parle sans savoir ni connaissances sur (un point en rapport avec) le dîn (c’est-à-dire la pratique religieuse) est un menteur, et ce, même s’il n’avait pas envie de mentir.
”
Ibnou Taymiyah (rahimahoullâh)
http://www.muslimblog.fr/
déc
18
2007
Recommandations prophètiques à l'occasion du Hadjadatoul Wada' (introduction)
" Hadjadatoul Wada'" est un chapitre important de la vie du Prophète (sallallâhou alayhi wa sallam). Ce fut son premier et dernier grand pèlerinage (après la Hijrah, émigration). Dès que les compagnons (radhi yallâhou 'anhoum) furent informés du prochain voyage du Prophète (sallallâhou alayhi wa sallam) vers la maison d’ALLAH, ils accoururent de toutes parts pour se joindre a lui. Beaucoup d’entre eux l’accompagnèrent dès le départ de Madina et une masse innombrable le rejoignit en cours de route à tel point qu’il est difficile de les chiffrer précisément. On pourrait avoir une idée si l'on se base sur leur nombre à la guerre de Tabouk qui était d’environ 100 000. Considérant le Hadj une obligation de l'islam, il est certain que le nombre de fidèles présent lors de cet événement devait être plus important : Moulla Ali Qâri (rahimahoullah) parle de 114 000 ou un nombre légèrement supérieur à 124 000. Une troisième révision faisait état de 130 000 compagnons présents ! Devant ou derrière, à droite ou à gauche, à pied ou à dos de chameau, jusqu’à l’horizon, la terre de Makkah était remplie d’êtres humains.
Le voyage de Hadj est la preuve vivante de l’amour et l’attachement du croyant à Son Créateur ! Il le fut encore encore plus par la présence du bien Bien Aimé Prophète (sallallâhou alayhi wa sallam) et de ses compagnons amoureux de ses enseignements ! Imaginez l'attention particulière dont ont fait preuve ces même personnes lorsqu’il entendirent le Prophète (sallallâhou alayhi wa sallam) dire a cette occasion : « Apprenez de moi les "Manaasik" du Hadj ; peut être ne pourrais-je plus accomplir le Hadj (cité par Mouslim dans son Sahih vol.1 p.419). C’est aussi lors de cet événement grandiose que la Sourah "an-Nasr" fut révélée dans laquelle Allah l’informa de son prochain départ vers l’autre monde (Hayâtous Sahaabah,vol.3-p.403)
On comprend aisément que toutes les conditions étaient réunies pour que le Prophète (sallallâhou alayhi wa sallam) délivre de précieux conseils qui soient profitables et utiles à l’humanité jusqu'à la fin du monde!Ainsi, en sus de l’enseignement des actions relatives au Hadj,le Prophète (sallallâhou alayhi wa sallam) a prononcé des sermons historiques. Sheikh Habiboul Rahman A’zami (Rahimahoullah) écrit : "Les sermons du Prophète (sallallâhou alayhi wa sallam) sont tellement précieux qu’il est du devoir de chaque musulman de les prendre en considération ; il incombe aussi à chaque pèlerin de se souvenir de ses paroles lorsqu’il se trouve dans ses endroits sacrés ou furent délivrés ses sermons".
Le voyage du pèlerinage d'adieu du Prophète (sallallâhou alayhi wa sallam) débuta de Madina le dimanche 25 Dhoul Qa’dah de l’année 10 Hijri, après la Salah de Dho’hr. La lune de Dhoul Hijjah ayant été vue le 29 Dhoul Qa’dah au soir, le mois débute donc un jeudi. Le Prophète (sallallâhou alayhi wa sallam) arriva à Makkah le dimanche 4 du mois (soit un voyage de 8 jours). Le jeudi 8 il quitte Makkah pour Mina. Le Hadj eut lieu le lendemain, vendredi 9. Ensuite, il reste à Mina jusqu’au 13 afin d’accomplir les « Rami ». Et le 14 au matin, il repartit pour Madina. Il resta donc 10 jours au total à Makkah et aux différents lieux historiques du Hadj (Jouzou Khoutoubâtin Nabiyy).
Parmi tous les sermons que le Prophète (sallallâhou alayhi wa sallam) a délivrés lors du Hadj , les plus connus sont ceux de Mina et de Arafat car ils contiennent de nombreux conseils d’ordre général, ils seront donc cités dans des chapitres respectifs. Concernant les autres sermons à propos desquels il n’a pas été possible de connaître le lieu ou ils furent délivrés ils seront eux, cités dans le chapitre intitulé « Sermons du pèlerinage d’Adieu ». Qu’Allah fasse de ces Conseils un moyen de protection de la foi de chaque musulman, que ces précieuses paroles puissent être mises en pratique et transmises aux autres.
N'oublions pas que le Prophète (sallallâhou alayhi wa sallam) ne resta en vie que 80 à 90 jours après ce voyage de Hadj. Il n’eut donc plus la chance de voir autant de personnes réunies. De plus, il avait été mis au courant de son prochain départ vers l'Au-delà. Il est donc clair que ces conseils doivent être considérés au même titre q’un testament. D’ailleurs, certains compagnons (radhi yallâhou 'anhoum) ont même cité comme tels !