original_string: public function insert($imess){
      $cfg =& $this->class_cfg;
      // Get default page if it isn't set
      if ( empty($imess['id_option']) ){
        $perm = new \bbn\user\permissions();
        $imess['id_option'] = $perm->is(self::BBN_DEFAULT_PERM);
      }
      if (
        !empty($imess['id_option']) &&
        !empty($imess['title']) &&
        !empty($imess['content']) &&
        !empty($this->_id_type()) &&
        // Insert the new note
        ($id_note = $this->notes->insert($imess['title'], $imess['content'], $this->_id_type())) &&
        // Insert the new internal message
        $this->db->insert($cfg['table'], [
          $cfg['arch']['imessages']['id_note'] => $id_note,
          $cfg['arch']['imessages']['id_option'] => $imess['id_option'],
          $cfg['arch']['imessages']['id_user'] => $imess['id_user'] ?: NULL,
          $cfg['arch']['imessages']['id_group'] => $imess['id_group'] ?: NULL,
          $cfg['arch']['imessages']['start'] => $imess['start'] ?: NULL,
          $cfg['arch']['imessages']['end'] => $imess['end'] ?: NULL
        ])
      ){
        return $this->db->last_id();
      }
      return false;
    }
code: public function insert($imess){
      $cfg =& $this->class_cfg;
      // Get default page if it isn't set
      if ( empty($imess['id_option']) ){
        $perm = new \bbn\user\permissions();
        $imess['id_option'] = $perm->is(self::BBN_DEFAULT_PERM);
      }
      if (
        !empty($imess['id_option']) &&
        !empty($imess['title']) &&
        !empty($imess['content']) &&
        !empty($this->_id_type()) &&
        // Insert the new note
        ($id_note = $this->notes->insert($imess['title'], $imess['content'], $this->_id_type())) &&
        // Insert the new internal message
        $this->db->insert($cfg['table'], [
          $cfg['arch']['imessages']['id_note'] => $id_note,
          $cfg['arch']['imessages']['id_option'] => $imess['id_option'],
          $cfg['arch']['imessages']['id_user'] => $imess['id_user'] ?: NULL,
          $cfg['arch']['imessages']['id_group'] => $imess['id_group'] ?: NULL,
          $cfg['arch']['imessages']['start'] => $imess['start'] ?: NULL,
          $cfg['arch']['imessages']['end'] => $imess['end'] ?: NULL
        ])
      ){
        return $this->db->last_id();
      }
      return false;
    }
code_tokens: public function insert ( $ imess ) { $ cfg = & $ this -> class_cfg ; // Get default page if it isn't set if ( empty ( $ imess [ 'id_option' ] ) ) { $ perm = new \ bbn \ user \ permissions ( ) ; $ imess [ 'id_option' ] = $ perm -> is ( self :: BBN_DEFAULT_PERM ) ; } if ( ! empty ( $ imess [ 'id_option' ] ) && ! empty ( $ imess [ 'title' ] ) && ! empty ( $ imess [ 'content' ] ) && ! empty ( $ this -> _id_type ( ) ) && // Insert the new note ( $ id_note = $ this -> notes -> insert ( $ imess [ 'title' ] , $ imess [ 'content' ] , $ this -> _id_type ( ) ) ) && // Insert the new internal message $ this -> db -> insert ( $ cfg [ 'table' ] , [ $ cfg [ 'arch' ] [ 'imessages' ] [ 'id_note' ] => $ id_note , $ cfg [ 'arch' ] [ 'imessages' ] [ 'id_option' ] => $ imess [ 'id_option' ] , $ cfg [ 'arch' ] [ 'imessages' ] [ 'id_user' ] => $ imess [ 'id_user' ] ? : NULL , $ cfg [ 'arch' ] [ 'imessages' ] [ 'id_group' ] => $ imess [ 'id_group' ] ? : NULL , $ cfg [ 'arch' ] [ 'imessages' ] [ 'start' ] => $ imess [ 'start' ] ? : NULL , $ cfg [ 'arch' ] [ 'imessages' ] [ 'end' ] => $ imess [ 'end' ] ? : NULL ] ) ) { return $ this -> db -> last_id ( ) ; } return false ; }
docstring: Inserts a new page's internal message
  
  @param $imess
  @return bool|int
docstring_tokens: Inserts a new page s internal message