src/bbn/appui/imessages.php
public function get_by_user(string $id_user){
    $cfg =& $this->class_cfg;
    // Current datetime
    $now = date('Y-m-d H:i:s');
    // Get the user's group
    $id_group = $this->db->select_one('bbn_users', 'id_group', ['id' => $id_user]);
    // Get all user's internal messages
    $messages = $this->db->get_rows("
      SELECT {$cfg['table']}.*
      FROM {$cfg['tables']['users']}
        RIGHT JOIN {$cfg['table']}
	        ON {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_user']}
	        AND {$cfg['table']}.{$cfg['arch']['imessages']['id']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_imessage']}
      WHERE (
        {$cfg['table']}.{$cfg['arch']['imessages']['start']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['start']} <= ?
      )
      AND (
        {$cfg['table']}.{$cfg['arch']['imessages']['end']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['end']} > ?
      )
      AND (
        (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = ?
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} = ?
        )
        OR (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} IS NULL
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} IS NULL
        )
      )
      AND (
        {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} IS NULL
        OR {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} = 0
      )",
      $now,
      $now,
      hex2bin($id_user),
      hex2bin($id_group)
    );
    // Get and return the imessage's info from notes archive
    return $this->from_notes($messages);
  }
public function get_by_user(string $id_user){
    $cfg =& $this->class_cfg;
    // Current datetime
    $now = date('Y-m-d H:i:s');
    // Get the user's group
    $id_group = $this->db->select_one('bbn_users', 'id_group', ['id' => $id_user]);
    // Get all user's internal messages
    $messages = $this->db->get_rows("
      SELECT {$cfg['table']}.*
      FROM {$cfg['tables']['users']}
        RIGHT JOIN {$cfg['table']}
	        ON {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_user']}
	        AND {$cfg['table']}.{$cfg['arch']['imessages']['id']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_imessage']}
      WHERE (
        {$cfg['table']}.{$cfg['arch']['imessages']['start']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['start']} <= ?
      )
      AND (
        {$cfg['table']}.{$cfg['arch']['imessages']['end']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['end']} > ?
      )
      AND (
        (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = ?
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} = ?
        )
        OR (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} IS NULL
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} IS NULL
        )
      )
      AND (
        {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} IS NULL
        OR {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} = 0
      )",
      $now,
      $now,
      hex2bin($id_user),
      hex2bin($id_group)
    );
    // Get and return the imessage's info from notes archive
    return $this->from_notes($messages);
  }
public function get_by_user ( string $ id_user ) { $ cfg = & $ this -> class_cfg ; // Current datetime $ now = date ( 'Y-m-d H:i:s' ) ; // Get the user's group $ id_group = $ this -> db -> select_one ( 'bbn_users' , 'id_group' , [ 'id' => $ id_user ] ) ; // Get all user's internal messages $ messages = $ this -> db -> get_rows ( "
      SELECT {$cfg['table']}.*
      FROM {$cfg['tables']['users']}
        RIGHT JOIN {$cfg['table']}
	        ON {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_user']}
	        AND {$cfg['table']}.{$cfg['arch']['imessages']['id']} = {$cfg['tables']['users']}.{$cfg['arch']['users']['id_imessage']}
      WHERE (
        {$cfg['table']}.{$cfg['arch']['imessages']['start']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['start']} <= ?
      )
      AND (
        {$cfg['table']}.{$cfg['arch']['imessages']['end']} IS NULL
        OR {$cfg['table']}.{$cfg['arch']['imessages']['end']} > ?
      )
      AND (
        (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} = ?
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} = ?
        )
        OR (
          {$cfg['table']}.{$cfg['arch']['imessages']['id_user']} IS NULL
          OR {$cfg['table']}.{$cfg['arch']['imessages']['id_group']} IS NULL
        )
      )
      AND (
        {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} IS NULL
        OR {$cfg['tables']['users']}.{$cfg['arch']['users']['hidden']} = 0
      )" , $ now , $ now , hex2bin ( $ id_user ) , hex2bin ( $ id_group ) ) ; // Get and return the imessage's info from notes archive return $ this -> from_notes ( $ messages ) ; }
Gets all user's internal messages

@param string $id_user
@return array
Gets all user s internal messages