diff --git a/e107_plugins/forum/e_menu.php b/e107_plugins/forum/e_menu.php index 015392d0a..1e3effd37 100644 --- a/e107_plugins/forum/e_menu.php +++ b/e107_plugins/forum/e_menu.php @@ -27,14 +27,17 @@ class forum_menu public function config($menu='') { + $layouts = e107::getLayouts('forum','newforumposts_menu'); + $fields = array(); $fields['caption'] = array('title'=> LAN_FORUM_MENU_004, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge')); $fields['display'] = array('title'=> LAN_FORUM_MENU_005, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*')); $fields['maxage'] = array('title'=> LAN_FORUM_MENU_0012, 'type'=>'text', 'help'=>LAN_FORUM_MENU_0013, 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*')); $fields['characters'] = array('title'=> LAN_FORUM_MENU_006, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*')); $fields['postfix'] = array('title'=> LAN_FORUM_MENU_007, 'type'=>'text', 'writeParms'=>array('size'=>'mini')); - $fields['title'] = array('title'=> LAN_FORUM_MENU_008, 'type'=>'boolean'); - + // $fields['title'] = array('title'=> LAN_FORUM_MENU_008, 'type'=>'boolean'); + $fields['layout'] = array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$layouts[0])); + return $fields; } diff --git a/e107_plugins/forum/newforumposts_menu.php b/e107_plugins/forum/newforumposts_menu.php index 8e9c27a46..5b05385f4 100755 --- a/e107_plugins/forum/newforumposts_menu.php +++ b/e107_plugins/forum/newforumposts_menu.php @@ -45,7 +45,9 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php) $qry = " SELECT p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry, - t.thread_id, t.thread_datestamp, t.thread_name, u.user_id, u.user_name, u.user_image, u.user_currentvisit, f.forum_sef + t.*, + u.user_id, u.user_name, u.user_image, u.user_currentvisit, + f.forum_name, f.forum_sef FROM `#forum_post` as p LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread @@ -73,19 +75,54 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php) $list = null; $text = null; + $layout = 'minimal'; + + if (!empty($this->menuPref['title']) && intval($this->menuPref['title']) === 1) // legacy pref value + { + $layout = 'default'; + } + + if(!empty($this->menuPref['layout']))//@todo e_menu add 'layout' dropdown. + { + $layout = $this->menuPref['layout']; + } + + $template = e107::getTemplate('forum','newforumposts_menu',$layout); + + + + + $param = array(); + + foreach($this->menuPref as $k=>$v) + { + $param['nfp_'.$k] = $v; + } + + + if($results = $sql->gen($qry)) { - if($tp->thumbWidth() > 250) // Fix for unset image size. + /* if($tp->thumbWidth() > 250) // Fix for unset image size. { $tp->setThumbSize(40,40,true); - } + }*/ - $list = "
"; + + + $list .= $tp->parseTemplate($template['end'],true); + $text = $list; } @@ -164,7 +204,9 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php) { $caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption']; } - else + + + if(empty($caption)) { $caption = LAN_PLUGIN_FORUM_LATESTPOSTS; } diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index a91e5881e..bd23b9284 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -1,948 +1,1107 @@ e107 = e107::getInstance(); - $this->forum = new e107forum(); - $this->pref = e107::pref('forum'); - - $this->defaultImgAttachSize = e107::pref('forum','maxwidth',false); // don't resize here if set to 0. + exit; } - function sc_breadcrumb() - { - return $this->var['breadcrumb']; - } - function sc_backlink() - { - return $this->var['breadcrumb']; - } - - function sc_top($parm='') - { - $text = ($parm == 'caret') ? "" : LAN_FORUM_2030; - - return "".$text.''; - } - - function sc_joined() + class plugin_forum_view_shortcodes extends e_shortcode { - $gen = e107::getDate(); - if ($this->postInfo['post_user']) + protected $e107; + protected $defaultImgAttachSize = false; + protected $pref; + // $param is sent from nfp menu. + + function __construct() { - return LAN_FORUM_2031.': '.$gen->convert_date($this->postInfo['user_join'], 'forum').''.print_r($info, true).''; + return $this->sc_threaddatestamp('relative'); } - } - - - - function sc_attachments($parm=array()) - { - $tp = e107::getParser(); - - if($this->postInfo['post_attachments']) + function sc_post_topic($parm=null) { - $baseDir = $this->forum->getAttachmentPath($this->postInfo['post_user']); + return $this->sc_threadname($parm); + } - $images = array(); - $txt = ''; - - $attachArray = e107::unserialize($this->postInfo['post_attachments']); + function sc_post_content($parm=null) + { + $tp = e107::getParser(); + $pref = e107::getPref(); + $post = strip_tags($tp->toHTML($this->var['post_entry'], true, 'emotes_off, no_make_clickable', '', $pref['menu_wordwrap'])); + $post = $tp->text_truncate($post, varset($this->param['nfp_characters'],120), varset($this->param['nfp_postfix'],'...')); - $thumbAtt = (!empty($this->defaultImgAttachSize)) ? array('w'=>$this->defaultImgAttachSize, 'x'=>1) : null; + return $post; + } - //print_a($attachArray); + function sc_post_author_name($parm=null) + { + return $this->sc_poster(); + } - foreach($attachArray as $type=>$vals) + function sc_post_author_avatar($parm=null) + { + return $this->sc_avatar($parm); + } + + // thread/topic + + function sc_topic_name($parm=null) + { + return $this->sc_threadname($parm); + } + + function sc_topic_url($parm=null) + { + return e107::url('forum', 'topic', $this->var); + } + + function sc_topic_views($parm=null) + { + $val = ($this->var['thread_views']) ? $this->var['thread_views'] : '0' ; + return e107::getParser()->toBadge($val); + } + + + function sc_topic_replies($parm=null) + { + $val = ($this->var['thread_total_replies']) ? $this->var['thread_total_replies'] : '0'; + return e107::getParser()->toBadge($val); + } + + + function sc_topic_lastpost_date($parm=null) + { + + + } + + // forum + + function sc_forum_name($parm=null) + { + if(substr($this->var['forum_name'], 0, 1) === '*') { - foreach($vals as $key=>$file) + $this->var['forum_name'] = substr($this->var['forum_name'], 1); + } + + $this->var['forum_name'] = e107::getParser()->toHTML($this->var['forum_name'], true, 'no_hook'); + + return $this->var['forum_name']; + } + + function sc_forum_url($parm=null) + { + return e107::url('forum', 'forum', $this->var); + } + + + // More sc_topic_xxxxx and sc_forum_xxxx in the same format. + + // --------------------------------------- + + + + + + + + + + + + + + + + + + function sc_breadcrumb() + { + return $this->var['breadcrumb']; + } + + function sc_backlink() + { + return $this->var['breadcrumb']; + } + + function sc_top($parm = '') + { + $text = ($parm == 'caret') ? "" : LAN_FORUM_2030; + + return "" . $text . ''; + } + + function sc_joined() + { + + $gen = e107::getDate(); + if($this->postInfo['post_user']) + { + return LAN_FORUM_2031 . ': ' . $gen->convert_date($this->postInfo['user_join'], 'forum') . '
'.print_r($info, true).''; + } + } + + + function sc_attachments($parm = array()) + { + $tp = e107::getParser(); + + if($this->postInfo['post_attachments']) + { + $baseDir = $this->forum->getAttachmentPath($this->postInfo['post_user']); + + $images = array(); + $txt = ''; + + $attachArray = e107::unserialize($this->postInfo['post_attachments']); + + $thumbAtt = (!empty($this->defaultImgAttachSize)) ? array('w' => $this->defaultImgAttachSize, 'x' => 1) : null; + + //print_a($attachArray); + + foreach($attachArray as $type => $vals) { - if(is_array($file)) + foreach($vals as $key => $file) + { + if(is_array($file)) + { + + $name = !empty($file['name']) ? $file['name'] : $file['file']; + + $file = $file['file']; + } + else + { + list($date, $user, $name) = explode("_", $file, 3); + } + + switch($type) + { + case "file": + + $url = e_REQUEST_SELF . "?id=" . $this->postInfo['post_id'] . "&dl=" . $key; + + if(defset("BOOTSTRAP") == 3) + { + $txt .= "" . $tp->toGlyph('glyphicon-save') . " {$name}