public function preview() { include_once 'lib/viewplugins/function.useravatar.php'; $dom = ZLanguage::getModuleDomain('MUBoard'); $id = $this->request->query->filter('id', 0); $parentid = $this->request->query->filter('muboardPosting_ParentItemList', 0, FILTER_SANITIZE_NUMBER_INT); $answer = $this->request->query->filter('answer', 0); $title = ''; $text = ''; $title = $this->request->query->filter('title'); $text = $this->request->query->filter('text'); $out = ""; if ($text != '' && ($id == 0 && $title == '' && $answer == 1 || $id == 0 && $answer == 0 && $title != '' || $id > 0 && ($parentid == 0 && $title != '' || $parentid > 0 && $title == ''))) { if (ModUtil::available('BBCode')) { $text = ModUtil::apiFunc('BBCode', 'user', 'transform', array('message' => $text)); } if (ModUtil::available('BBSmile')) { $text = ModUtil::apiFunc('BBSmile', 'user', 'transform', array('text' => $text)); } $text = nl2br($text); $uid = UserUtil::getVar('uid'); if ($uid > 1) { $uname = UserUtil::getVar('uname', $uid); } else { $uname = __('Guest', $dom); } $userRank = MUBoard_Util_View::getUserRank($uid, 1); $date = DateUtil::getDatetime(null, 'datetimelong'); if ($uid > 1) { $params['uid'] = $uid; if ($title != '') { $params["size"] = 80; } else { $params["size"] = 60; } $avatar = smarty_function_useravatar($params); } else { $avatar = ''; } $out .= "<div class='muboard-user-posting muboard-preview'>"; if ($title != '') { $out .= "<div class='muboard-user-posting-header'>"; $out .= "<div class='muboard-user-posting-header-title'>"; $out .= "<h2>" . __('Issue: ', $dom) . ' '; $out .= $title; $out .= "</h2></div></div>"; } $out .= "<div class='muboard-user-posting-user'>"; $out .= "<div class='muboard-user-posting-avatar'>"; $out .= $avatar . "<br />"; $out .= $uname; $out .= "</div>"; $out .= "<div class='muboard-user-posting-datas'>"; $out .= $userRank; $out .= "</div>"; $out .= "</div>"; $out .= "<div class='muboard-user-posting-content'>"; $out .= "<div class='muboard-user-posting-created'>"; $out .= $date; $out .= "</div>"; $out .= "<div class='muboard-user-posting-content-text'>"; $out .= $text; $out .= "</div>"; $out .= "</div>"; $out .= "</div>"; } else { $out .= "<div class='muboard-user-posting muboard-nopreview'>"; $out .= "<h3>"; if ($id == 0) { if ($answer == 0 && $title == '' && $text == '') { $out .= __('Sorry! If you want to create a new issue you have to enter a title and a text to get a preview!', $dom); } if ($answer == 0 && $title == '' && $text != '') { $out .= __('Sorry! If you want to create a new issue you have to enter a title to get a preview!', $dom); } if ($answer == 0 && $title != '' && $text == '') { $out .= __('Sorry! If you want to create a new issue you have to enter a text to get a preview!', $dom); } if ($answer == 1 && $text == '') { $out .= __('Sorry! If you want to answer to an issue you have to enter a text to get a preview', $dom); } } else { if ($answer == 0 && $parentid == 0 && $title == '') { $out .= __('Sorry! If you want to edit an existing issue you have to enter a title and a text to get a preview!', $dom); } if ($answer == 0 && $parentid > 0) { $out .= __('Sorry! If you want to edit an existing posting you have to enter a text to get a preview!', $dom); } } $out .= "</h3></div>"; } return $out; }
/** * The muboardGetUserRank return the state of abo. * * @param int $id posting id * * @return out html */ function smarty_modifier_muboardGetUserRank($id) { $out = MUBoard_Util_View::getUserRank($id); return $out; }