From c823ffc3a6385a20320e8fc16be988b17956eea8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 23 Nov 2003 13:33:21 +0000 Subject: [PATCH] fix to generate link-title from description for an empty subject --- infolog/inc/class.boinfolog.inc.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index dbe56fd6e8..700e165656 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -172,12 +172,17 @@ return False; } + function subject_from_des($des) + { + return substr($des,0,60).' ...'; + } + function read($info_id) { $err = $this->so->read($info_id) === False; $data = &$this->so->data; - if ($data['info_subject'] == (substr($data['info_des'],0,60).' ...')) + if ($data['info_subject'] == $this->subject_from_des($data['info_des'])) { $data['info_subject'] = ''; } @@ -218,9 +223,9 @@ { $values['info_owner'] = $this->so->user; } - if (!$values['info_subject']) + if (empty($values['info_subject'])) { - $values['info_subject'] = substr($values['info_des'],0,60).' ...'; + $values['info_subject'] = $this->subject_from_des($values['info_des']); } } if ($values['info_link_id'] && isset($values['info_from']) && empty($values['info_from'])) @@ -260,7 +265,12 @@ { $info = $this->read( $info ); } - return $info ? $info['info_subject'] : False; + if (!$info) + { + return False; + } + return !empty($info['info_subject']) ? $info['info_subject'] : + $this->subject_from_des($info['info_descr']); } /*!