From 55695163291ad4abdcc571d4259e8971bc6f49ab Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 5 Mar 2017 12:03:41 -0800 Subject: [PATCH] Issue #1436, Issue #2294 - New Forum Posts Menu template added. Beginnings of "New Forum Posts Main" replacement. --- e107_plugins/forum/e_menu.php | 7 +- e107_plugins/forum/newforumposts_menu.php | 56 +- .../shortcodes/batch/view_shortcodes.php | 1761 +++++++++-------- .../templates/newforumposts_menu_template.php | 63 + 4 files changed, 1077 insertions(+), 810 deletions(-) create mode 100644 e107_plugins/forum/templates/newforumposts_menu_template.php 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').'
'; + parent::__construct(); + $this->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. } - } - /** - * What does this do? - */ - function sc_threaddatestamp($parm='') - { - $gen = e107::getDateConvert(); // XXX _URL_ check if all required info is there - - if($parm == 'relative') + + /** + * v2.1.5 - Start of Shortcode rewrite rewrite for use throughout all of the forum plugin.. + * return 1 piece of data. (ie. no combining of titles and urls unless absolutely required) + * @param $this->var - table data. + * @param $this->param - dynamic control of shortcode via menu configuration. + * Only by nfp menu at this time. + */ + + function sc_post_url($parm=null) { - return $gen->computeLapse($this->postInfo['post_datestamp'], time(), false, false, 'short'); + $url = e107::url('forum', 'topic', $this->var, array( + 'query' => array( + 'f' => 'post', + 'id' => intval($this->var['post_id']) // proper page number + ), + )); + + return $url; } - - // XXX what is this line meant to do? - // $text = " $this->postInfo['thread_name'], 'thread' => $this->postInfo['post_thread'], 'id' => $this->postInfo['post_id']))."'>".IMAGE_post." "; - return $gen->convert_date($this->postInfo['post_datestamp'], 'forum'); - } - function sc_postid() - { - return $this->postInfo['post_id']; - } - - /* Preferred - as {POST} may conflict with other shortcodes */ - function sc_thread_text() - { - return $this->sc_post(); - } - - /** - * @DEPRECATED - use {THREAD_TEXT} - */ - function sc_post() - { - // return print_a($this->postInfo['post_entry'],true); - $emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : ''); - - $uclass = (!empty($this->postInfo['user_class'])) ? $this->postInfo['user_class'] : 0; - - return e107::getParser()->toHTML($this->postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$uclass); - } - - function sc_postdeleted() - { - if($this->postInfo['post_status']) + function sc_post_datestamp($parm=null) { - $info = unserialize($this->postInfo['post_options']); - return " - ".LAN_FORUM_2037.": {$info['deldate']}
- ".LAN_FORUM_2038.": {$info['delreason']} - "; - // $ret = '
'.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') . '
'; + } + } + + /** + * What does this do? + */ + function sc_threaddatestamp($parm = '') + { + $gen = e107::getDateConvert(); // XXX _URL_ check if all required info is there + + if($parm == 'relative') + { + return $gen->computeLapse($this->postInfo['post_datestamp'], time(), false, false, 'short'); + } + + // XXX what is this line meant to do? + // $text = " $this->postInfo['thread_name'], 'thread' => $this->postInfo['post_thread'], 'id' => $this->postInfo['post_id']))."'>".IMAGE_post." "; + return $gen->convert_date($this->postInfo['post_datestamp'], 'forum'); + } + + function sc_postid() + { + return $this->postInfo['post_id']; + } + + /* Preferred - as {POST} may conflict with other shortcodes */ + function sc_thread_text($parm=null) + { + return $this->sc_post($parm=null); + } + + /** + * @DEPRECATED - use {THREAD_TEXT} + */ + function sc_post($parm) + { + // return print_a($this->postInfo['post_entry'],true); + $emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : ''); + + $uclass = (!empty($this->postInfo['user_class'])) ? $this->postInfo['user_class'] : 0; + + return e107::getParser()->toHTML($this->postInfo['post_entry'], true, 'USER_BODY' . $emote, 'class:' . $uclass); + } + + function sc_postdeleted() + { + if($this->postInfo['post_status']) + { + $info = unserialize($this->postInfo['post_options']); + + return " + " . LAN_FORUM_2037 . ": {$info['deldate']}
+ " . LAN_FORUM_2038 . ": {$info['delreason']} + "; + // $ret = '
'.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}
"; + } + else + { + $txt .= IMAGE_attachment . " {$name}
"; + } + + break; + + case 'img': //Always use thumb to hide the hash. + + + // return $baseDir.$file; + if(file_exists($baseDir . $file)) + { + $thumb = $tp->thumbUrl($baseDir . $file, $thumbAtt, true); + $full = $tp->thumbUrl($baseDir . $file, 'w=1000&x=1', true); + + //TODO Use jQuery zoom instead. + + $caption = $name; + + $inc = (vartrue($parm['modal'])) ? "data-modal-caption=\"" . $caption . "\" data-target='#uiModal' " : ""; + $images[] = ""; + } + elseif(ADMIN) + { + $images[] = "Missing File: " . $baseDir . $file; + } + + + break; + } + + } + + } + + if(count($images)) + { + if(deftrue('BOOTSTRAP')) { - $name = !empty($file['name']) ? $file['name'] : $file['file']; - - $file = $file['file']; + return "" . vartrue($txt); } else { - list($date,$user, $name) = explode("_", $file, 3); + return implode("
", $images) . "
" . vartrue($txt); + } + } + + return $txt; + } + + } + + function sc_privmessage() + { + if(e107::isInstalled('pm') && ($this->postInfo['post_user'] > 0)) + { + return e107::getParser()->parseTemplate("{SENDPM={$this->postInfo['post_user']}}"); + } + } + + function sc_avatar($opts) + { + return e107::getParser()->toAvatar($this->postInfo, $opts); + // return $tp->parseTemplate("{USER_AVATAR=".$this->postInfo['user_image']."}", true); + } + + function sc_anon_ip() + { + if($this->postInfo['post_user_anon'] && (ADMIN || MODERATOR)) + { + return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); + } + } + + function sc_ip() + { + if((ADMIN || MODERATOR) && !$this->postInfo['user_admin']) + { + return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); + } + + } + + function sc_poster() + { + if($this->postInfo['user_name']) + { + return " $this->postInfo['user_name'], 'id' => $this->postInfo['post_user'])) . "'>{$this->postInfo['user_name']}"; + } + else + { + return '' . e107::getParser()->toHTML($this->postInfo['post_user_anon']) . ''; + } + + } + + function sc_emailimg() + { + if($this->postInfo['user_name']) + { + return (!$this->postInfo['user_hideemail'] ? e107::getParser()->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : ''); + } + + return ''; + + } + + function sc_emailitem() + { + if($this->postInfo['thread_start']) + { + return e107::getParser()->parseTemplate("{EMAIL_ITEM=" . LAN_FORUM_2044 . "^plugin:forum.{$this->postInfo['post_thread']}}"); + } + } + + function sc_printitem() + { + if($this->postInfo['thread_start']) + { + return e107::getParser()->parseTemplate("{PRINT_ITEM=" . LAN_FORUM_2045 . "^plugin:forum.{$this->postInfo['post_thread']}}"); + } + } + + function sc_signature($parm = '') + { + if(!USER) + { + return ''; + } + global $forum; + $tp = e107::getParser(); + static $forum_sig_shown; + if($forum->prefs->get('sig_once')) + { + $_tmp = 'forum_sig_shown_' . $this->postInfo['post_user']; + if(getcachedvars($_tmp)) + { + return ''; + } + cachevars($_tmp, 1); + } + + if($parm == 'clean') + { + return ($this->postInfo['user_signature'] ? trim($tp->toHTML($this->postInfo['user_signature'], true)) : ""); + } + + + return ($this->postInfo['user_signature'] ? "

" . trim($tp->toHTML($this->postInfo['user_signature'], true)) . '' : ''); + } + + function sc_profileimg() + { + if(USER && $this->postInfo['user_name']) + { + return e107::getParser()->parseTemplate("{PROFILE={$this->postInfo['post_user']}}"); + } + } + + function sc_posts() + { + if($this->postInfo['post_user']) + { + return LAN_FORUM_2032 . ': ' . (int) $this->postInfo['user_plugin_forum_posts'] . '
'; + } + } + + function sc_visits() + { + if($this->postInfo['user_name']) + { + return LAN_FORUM_2033 . ': ' . $this->postInfo['user_visits'] . '
'; + } + } + + function sc_customtitle() + { + if($this->postInfo['user_customtitle']) + { + return e107::getParser()->toHTML($this->postInfo['user_customtitle']) . '
'; + } + } + + function sc_website() + { + if(!empty($this->postInfo['user_homepage'])) + { + return LAN_FORUM_2034 . ': ' . $this->postInfo['user_homepage'] . '
'; + } + } + + function sc_websiteimg() + { + if($this->postInfo['user_homepage'] && $this->postInfo['user_homepage'] != 'http://') + { + return "" . IMAGE_website . ''; + } + } + + function sc_editimg() + { + if(USER && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active']) + { + $qry = array('f' => 'edit', 'id' => $this->postInfo['post_thread'], 'post' => $this->postInfo['post_id']); + $editURL = e107::url('forum', 'post', null, array('query' => $qry)); + + return "" . IMAGE_edit . ' '; + } + } + + function sc_quoteimg() + { + if($this->forum->checkperm($this->postInfo['post_forum'], 'post')) + { + $qry = array('f' => 'quote', 'id' => $this->postInfo['post_thread'], 'post' => $this->postInfo['post_id']); + $quoteURL = e107::url('forum', 'post', null, array('query' => $qry)); + + return "" . IMAGE_quote . ' '; + } + } + + function sc_reportimg() + { + if(USER) + { + $qry = array('f' => 'report', 'id' => $this->postInfo['post_thread'], 'post' => $this->postInfo['post_id']); + $reportURL = e107::url('forum', 'post', null, array('query' => $qry)); + + return "" . IMAGE_report . ' '; + } + } + + function sc_rpg() + { + return rpg($this->postInfo['user_join'], $this->postInfo['user_plugin_forum_posts']); + } + + function sc_memberid() + { + if(!$this->postInfo['post_user']) + { + return false; + } + + return "" . LAN_FORUM_2035 . ' #' . $this->postInfo['post_user'] . ''; + } + + function sc_level($parm) + { + + if(isset($this->pref['ranks']) && empty($this->pref['ranks'])) + { + return false; + } + + + if(!$this->postInfo['post_user']) + { + return ''; + } + + $rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']); + // FIXME - level handler!!! + + + // print_a($rankInfo); + + if($parm == 'badge') + { + return "" . $rankInfo['name'] . ""; + } + + if(!$parm) + { + $parm = 'name'; + } + + + switch($parm) + { + + case 'userid' : + return $this->sc_memberid(); + break; + + case 'special': + if(isset($rankInfo['special'])) + { + return $rankInfo['special']; + } + if($this->forum->isModerator($this->postInfo['post_user'])) + { + return "
" . IMAGE_rank_moderator_image . '
'; } - switch($type) + return ''; + break; + + case 'glyph': + $text = ""; + $tp = e107::getParser(); + for($i = 0; $i < $rankInfo['value']; $i++) { - case "file": - - $url = e_REQUEST_SELF."?id=".$this->postInfo['post_id']."&dl=".$key; + $text .= $tp->toGlyph('fa-star'); + } - if(defset("BOOTSTRAP") == 3) - { - $txt .= "".$tp->toGlyph('glyphicon-save')." {$name}
"; - } - else - { - $txt .= IMAGE_attachment." {$name}
"; - } + return $text; + break; - break; - - case 'img': //Always use thumb to hide the hash. - - - - - // return $baseDir.$file; - if(file_exists($baseDir.$file)) - { - $thumb = $tp->thumbUrl($baseDir.$file,$thumbAtt,true); - $full = $tp->thumbUrl($baseDir.$file,'w=1000&x=1', true); - - //TODO Use jQuery zoom instead. - - $caption = $name; - - $inc = (vartrue($parm['modal'])) ? "data-modal-caption=\"".$caption."\" data-target='#uiModal' " : ""; - $images[] = ""; - } - elseif(ADMIN) - { - $images[] = "Missing File: ".$baseDir.$file; - } - - - - break; - } - - } - + default: + return varset($rankInfo[$parm], ''); + break; } - - if(count($images)) + } + + function sc_modoptions() + { + if(MODERATOR) { - if(deftrue('BOOTSTRAP')) - { - - return "".vartrue($txt); - } - else - { - return implode("
",$images)."
".vartrue($txt); - } + return showmodoptions(); } - - return $txt; } - } - - function sc_privmessage() - { - if(e107::isInstalled('pm') && ($this->postInfo['post_user'] > 0)) + function sc_lastedit() { - return e107::getParser()->parseTemplate("{SENDPM={$this->postInfo['post_user']}}"); - } - } - - function sc_avatar($opts) - { - return e107::getParser()->toAvatar($this->postInfo,$opts); - // return $tp->parseTemplate("{USER_AVATAR=".$this->postInfo['user_image']."}", true); - } - - function sc_anon_ip() - { - if($this->postInfo['post_user_anon'] && (ADMIN || MODERATOR)) - { - return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); - } - } - - function sc_ip() - { - if((ADMIN || MODERATOR) && !$this->postInfo['user_admin']) - { - return e107::getIPHandler()->ipDecode($this->postInfo['post_ip']); - } - - } - - function sc_poster() - { - if($this->postInfo['user_name']) - { - return " $this->postInfo['user_name'], 'id' => $this->postInfo['post_user']))."'>{$this->postInfo['user_name']}"; - } - else - { - return ''.e107::getParser()->toHTML($this->postInfo['post_user_anon']).''; - } - - } - - function sc_emailimg() - { - if($this->postInfo['user_name']) - { - return (!$this->postInfo['user_hideemail'] ? e107::getParser()->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : ''); - } - return ''; - - } - - function sc_emailitem() - { - if($this->postInfo['thread_start']) - { - return e107::getParser()->parseTemplate("{EMAIL_ITEM=".LAN_FORUM_2044."^plugin:forum.{$this->postInfo['post_thread']}}"); - } - } - - function sc_printitem() - { - if($this->postInfo['thread_start']) - { - return e107::getParser()->parseTemplate("{PRINT_ITEM=".LAN_FORUM_2045."^plugin:forum.{$this->postInfo['post_thread']}}"); - } - } - - function sc_signature($parm='') - { - if(!USER) { return ''; } - global $forum; - $tp = e107::getParser(); - static $forum_sig_shown; - if($forum->prefs->get('sig_once')) - { - $_tmp = 'forum_sig_shown_'.$this->postInfo['post_user']; - if(getcachedvars($_tmp)) { return ''; } - cachevars($_tmp, 1); - } - - if($parm == 'clean') - { - return ($this->postInfo['user_signature'] ? trim($tp->toHTML($this->postInfo['user_signature'], true)) : ""); - } - - - return ($this->postInfo['user_signature'] ? "

".trim($tp->toHTML($this->postInfo['user_signature'], true)).'' : ''); - } - - function sc_profileimg() - { - if (USER && $this->postInfo['user_name']) - { - return e107::getParser()->parseTemplate("{PROFILE={$this->postInfo['post_user']}}"); - } - } - - function sc_posts() - { - if ($this->postInfo['post_user']) - { - return LAN_FORUM_2032.': '.(int)$this->postInfo['user_plugin_forum_posts'].'
'; - } - } - - function sc_visits() - { - if ($this->postInfo['user_name']) - { - return LAN_FORUM_2033.': '.$this->postInfo['user_visits'].'
'; - } - } - - function sc_customtitle() - { - if ($this->postInfo['user_customtitle']) - { - return e107::getParser()->toHTML($this->postInfo['user_customtitle']).'
'; - } - } - - function sc_website() - { - if (!empty($this->postInfo['user_homepage'])) { - return LAN_FORUM_2034.': '.$this->postInfo['user_homepage'].'
'; - } - } - - function sc_websiteimg() - { - if ($this->postInfo['user_homepage'] && $this->postInfo['user_homepage'] != 'http://') - { - return "".IMAGE_website.''; - } - } - - function sc_editimg() - { - if (USER && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active']) - { - $qry = array('f'=>'edit', 'id'=>$this->postInfo['post_thread'], 'post'=>$this->postInfo['post_id']); - $editURL = e107::url('forum','post', null, array('query'=> $qry)); - - return "".IMAGE_edit.' '; - } - } - - function sc_quoteimg() - { - if($this->forum->checkperm($this->postInfo['post_forum'], 'post')) - { - $qry = array('f'=>'quote', 'id'=>$this->postInfo['post_thread'], 'post'=>$this->postInfo['post_id']); - $quoteURL = e107::url('forum','post', null, array('query'=> $qry)); - - return "".IMAGE_quote.' '; - } - } - - function sc_reportimg() - { - if (USER) - { - $qry = array('f'=>'report', 'id'=>$this->postInfo['post_thread'], 'post'=>$this->postInfo['post_id']); - $reportURL = e107::url('forum','post', null, array('query'=> $qry)); - - return "".IMAGE_report.' '; - } - } - - function sc_rpg() - { - return rpg($this->postInfo['user_join'], $this->postInfo['user_plugin_forum_posts']); - } - - function sc_memberid() - { - if (!$this->postInfo['post_user']) { return FALSE; } - return "".LAN_FORUM_2035.' #'.$this->postInfo['post_user'].''; - } - - function sc_level($parm) - { - - if(isset($this->pref['ranks']) && empty($this->pref['ranks'])) - { - return false; - } - - - if (!$this->postInfo['post_user']) { return ''; } - - $rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']); - // FIXME - level handler!!! - - - // print_a($rankInfo); - - if($parm == 'badge') - { - return "".$rankInfo['name'].""; - } - - if(!$parm) { $parm = 'name'; } - - - switch($parm) - { - - case 'userid' : - return $this->sc_memberid(); - break; - - case 'special': - if(isset($rankInfo['special'])) { return $rankInfo['special']; } - if($this->forum->isModerator($this->postInfo['post_user'])) - { - return "
".IMAGE_rank_moderator_image.'
'; - } - return ''; - break; - - case 'glyph': - $text = ""; - $tp = e107::getParser(); - for($i=0; $i< $rankInfo['value']; $i++) - { - $text .= $tp->toGlyph('fa-star'); - } - return $text; - break; - - default: - return varset($rankInfo[$parm], ''); - break; - } - } - - function sc_modoptions() - { - if (MODERATOR) - { - return showmodoptions(); - } - } - - function sc_lastedit() - { - $gen = e107::getDate(); - if ($this->postInfo['post_edit_datestamp']) - { - return $gen->convert_date($this->postInfo['post_edit_datestamp'],'forum'); - } - } - - function sc_lasteditby($parm='') - { - if(isset($this->postInfo['edit_name'])) - { - if($parm == 'link') + $gen = e107::getDate(); + if($this->postInfo['post_edit_datestamp']) { - $url = e107::getUrl()->create('user/profile/view', array('name' => $this->postInfo['edit_name'], 'id' => $this->postInfo['post_edit_user'])); - return "{$this->postInfo['edit_name']}"; + return $gen->convert_date($this->postInfo['post_edit_datestamp'], 'forum'); } - return $this->postInfo['edit_name']; } - } - function sc_poll() - { - if($this->postInfo['thread_start'] == 1) + function sc_lasteditby($parm = '') { - global $pollstr; - return $pollstr; + if(isset($this->postInfo['edit_name'])) + { + if($parm == 'link') + { + $url = e107::getUrl()->create('user/profile/view', array('name' => $this->postInfo['edit_name'], 'id' => $this->postInfo['post_edit_user'])); + + return "{$this->postInfo['edit_name']}"; + } + + return $this->postInfo['edit_name']; + } } - } - function sc_newflag() - { - // Defined in case an indicator is required - return ''; - } - - function sc_usercombo() - { - - $tp = e107::getParser(); - - // $text2 = $this->sc_level('special'); - // $text .= $this->sc_level('pic'); - - $ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value}",true); - $username = (empty($this->postInfo['user_name'])) ? LAN_ANONYMOUS : $this->postInfo['user_name']; + function sc_poll() + { + if($this->postInfo['thread_start'] == 1) + { + global $pollstr; - $userUrl = empty($this->postInfo['post_user']) ? '#' : e107::getUrl()->create('user/profile/view', array('user_id'=>$this->postInfo['post_user'], 'user_name'=>$username)); - // e_HTTP.'user.php?id.'.$this->postInfo['post_user'] - $text = '
+ return $pollstr; + } + } - '.$username.' + function sc_newflag() + { + // Defined in case an indicator is required + return ''; + } + + function sc_usercombo() + { + + $tp = e107::getParser(); + + // $text2 = $this->sc_level('special'); + // $text .= $this->sc_level('pic'); + + $ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value}", true); + $username = (empty($this->postInfo['user_name'])) ? LAN_ANONYMOUS : $this->postInfo['user_name']; + + $userUrl = empty($this->postInfo['post_user']) ? '#' : e107::getUrl()->create('user/profile/view', array('user_id' => $this->postInfo['post_user'], 'user_name' => $username)); + // e_HTTP.'user.php?id.'.$this->postInfo['post_user'] + $text = '
+ + ' . $username . ' -
"; - - - return $text; - } - - - function sc_postoptions() - { - $tp = e107::getParser(); - // {EMAILITEM} {PRINTITEM} {REPORTIMG}{EDITIMG}{QUOTEIMG} - - $text = '
+ + $text .= " +
"; + + + return $text; + } + + + function sc_postoptions() + { + $tp = e107::getParser(); + // {EMAILITEM} {PRINTITEM} {REPORTIMG}{EDITIMG}{QUOTEIMG} + + $text = '
'; - - return $text; - - - } - + + return $text; + + + } + //---- SHORTCODES CONVERTED FROM $tVars.... - function sc_threadname() - { - return e107::getParser()->toHTML($this->var['thread_name'], true, 'no_hook, emotes_off'); - } + function sc_threadname($parm=null) + { + return e107::getParser()->toHTML($this->var['thread_name'], true, 'no_hook, emotes_off'); + } - function sc_nextprev() - { - global $forum, $thread; - $prev = $forum->threadGetNextPrev('prev', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']); - $next = $forum->threadGetNextPrev('next', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']); + function sc_nextprev() + { + global $forum, $thread; + $prev = $forum->threadGetNextPrev('prev', $thread->threadId, $this->var['forum_id'], $this->var['thread_lastpost']); + $next = $forum->threadGetNextPrev('next', $thread->threadId, $this->var['forum_id'], $this->var['thread_lastpost']); - $options = array(); + $options = array(); - if($prev !== false) - { - $options[] = "« " . LAN_FORUM_2001 . ""; - } - if($next !== false) - { - $options[] = "" . LAN_FORUM_2002 . " »"; - } + if($prev !== false) + { + $options[] = "« " . LAN_FORUM_2001 . ""; + } + if($next !== false) + { + $options[] = "" . LAN_FORUM_2002 . " »"; + } //---- $tVars->NEXTPREV = implode(" | ", $options); - return implode(" | ", $options); -} + return implode(" | ", $options); + } - function sc_track() - { - global $forum; -if ($forum->prefs->get('track') && USER) -{ - // BC Fix for old template. - if(!defined('IMAGE_track')) - { - define('IMAGE_track', ''.LAN_FORUM_4009.''); - } + function sc_track() + { + global $forum; + if($forum->prefs->get('track') && USER) + { + // BC Fix for old template. + if(!defined('IMAGE_track')) + { + define('IMAGE_track', '' . LAN_FORUM_4009 . ''); + } - if(!defined('IMAGE_untrack')) - { - define('IMAGE_untrack', ''.LAN_FORUM_4010.''); - } + if(!defined('IMAGE_untrack')) + { + define('IMAGE_untrack', '' . LAN_FORUM_4010 . ''); + } - $img = ($this->var['track_userid'] ? IMAGE_track : IMAGE_untrack); + $img = ($this->var['track_userid'] ? IMAGE_track : IMAGE_untrack); -/* - $url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call + /* + $url = $e107->url->create('forum/thread/view', array('id' => $thread->threadId), 'encode=0'); // encoding could break AJAX call - $url = e107::url('forum','index'); + $url = e107::url('forum','index'); - $tVars->TRACK .= " - - {$img} - - - ";*/ + $tVars->TRACK .= " + + {$img} + + + ";*/ - $trackDiz = ($forum->prefs->get('trackemail',true)) ? LAN_FORUM_3040 : LAN_FORUM_3041; + $trackDiz = ($forum->prefs->get('trackemail', true)) ? LAN_FORUM_3040 : LAN_FORUM_3041; // $tVars->TRACK = "".$img.""; - return "".$img.""; + return "" . $img . ""; -} - return ''; -} + } - function sc_moderators() - { - global $forum; + return ''; + } -$modUser = array(); -foreach ( $forum->modArray as $user) -{ - $modUser[] = "".$user['user_name'].""; -} + function sc_moderators() + { + global $forum; + + $modUser = array(); + foreach($forum->modArray as $user) + { + $modUser[] = "" . $user['user_name'] . ""; + } //$tVars->MODERATORS = LAN_FORUM_2003.": ". implode(', ', $modUser); -return LAN_FORUM_2003.": ". implode(', ', $modUser); + return LAN_FORUM_2003 . ": " . implode(', ', $modUser); //unset($modUser); -} + } - function sc_threadstatus() - { + function sc_threadstatus() + { //$tVars->THREADSTATUS = (!$thread->threadInfo['thread_active'] ? LAN_FORUM_2004 : ''); -return (!$this->var['thread_active'] ? LAN_FORUM_2004 : ''); -} + return (!$this->var['thread_active'] ? LAN_FORUM_2004 : ''); + } - function sc_gotopages() - { - global $thread; -if ($thread->pages > 1) -{ - if(!$thread->page) $thread->page = 1; + function sc_gotopages() + { + global $thread; + if($thread->pages > 1) + { + if(!$thread->page) + { + $thread->page = 1; + } // $url = rawurlencode(e107::getUrl()->create('forum/thread/view', array('name' => $thread->threadInfo['thread_name'], 'id' => $thread->threadId, 'page' => '[FROM]'))); // $url = e_REQUEST_SELF."?p=[FROM]"; // SEF URL Friendly. - $url = e107::url('forum','topic', $this->var)."&p=[FROM]"; + $url = e107::url('forum', 'topic', $this->var) . "&p=[FROM]"; - $parms = "total={$thread->pages}&type=page¤t={$thread->page}&url=".urlencode($url)."&caption=off&tmpl=default&navcount=4&glyphs=1"; - - //XXX FIXME - pull-down template not practical here. Can we force another? + $parms = "total={$thread->pages}&type=page¤t={$thread->page}&url=" . urlencode($url) . "&caption=off&tmpl=default&navcount=4&glyphs=1"; + + //XXX FIXME - pull-down template not practical here. Can we force another? // $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}"); - return e107::getParser()->parseTemplate("{NEXTPREV={$parms}}"); -/* - $parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; - $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/ -} -} + return e107::getParser()->parseTemplate("{NEXTPREV={$parms}}"); + /* + $parms = ($thread->pages).",1,{$thread->page},url::forum::thread::func=view&id={$thread->threadId}&page=[FROM],off"; + $tVars->GOTOPAGES = $tp->parseTemplate("{NEXTPREV={$parms}}");*/ + } + } - function sc_buttons() - { - global $forum, $thread; + function sc_buttons() + { + global $forum, $thread; //----$tVars->BUTTONS = ''; -if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active']) -{ - // print_a($thread->threadInfo); - $url = e107::url('forum','post')."?f=rp&id=".$this->var['thread_id']."&post=".$thread->threadId; + if($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active']) + { + // print_a($thread->threadInfo); + $url = e107::url('forum', 'post') . "?f=rp&id=" . $this->var['thread_id'] . "&post=" . $thread->threadId; + // $url = $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)); - return "" . IMAGE_reply . ""; -} -if ($forum->checkPerm($this->var['thread_forum_id'], 'thread')) -{ - $ntUrl = e107::url('forum','post')."?f=nt&id=". $this->var['thread_forum_id']; + return "" . IMAGE_reply . ""; + } + if($forum->checkPerm($this->var['thread_forum_id'], 'thread')) + { + $ntUrl = e107::url('forum', 'post') . "?f=nt&id=" . $this->var['thread_forum_id']; + // $ntUrl = $e107->url->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])); - return "" . IMAGE_newthread . ""; -} -return ''; -} + return "" . IMAGE_newthread . ""; + } + + return ''; + } //$tVars->BUTTONSX = forumbuttons($thread); -function sc_buttonsx() -{ - global $forum, $thread; + function sc_buttonsx() + { + global $forum, $thread; - if ($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active']) - { - $url = e107::url('forum','post')."?f=rp&id=".$this->var['thread_id']."&post=".$thread->threadId; - // $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId)); - } - $replyUrl = "".LAN_FORUM_2006."".($url?"":" "); + if($forum->checkPerm($this->var['thread_forum_id'], 'post') && $this->var['thread_active']) + { + $url = e107::url('forum', 'post') . "?f=rp&id=" . $this->var['thread_id'] . "&post=" . $thread->threadId; + // $url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId)); + } + $replyUrl = "" . LAN_FORUM_2006 . "" . ($url ? "" : " "); + + if($forum->checkPerm($this->var['thread_forum_id'], 'post')) + { + $ntUrl = e107::url('forum', 'post') . "?f=nt&id=" . $this->var['thread_forum_id']; + // $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])); + $options[] = " " . LAN_FORUM_2005 . ""; + } - if ($forum->checkPerm($this->var['thread_forum_id'], 'post')) - { - $ntUrl = e107::url('forum','post')."?f=nt&id=". $this->var['thread_forum_id']; - // $ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id'])); - $options[] = " ".LAN_FORUM_2005.""; - } - // $options[] = " $thread->threadId)) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2001.""; // $options[] = " $thread->threadId)) . "'>".LAN_FORUM_1017." ".LAN_FORUM_2002.""; //---- SIMILAR CODE AS SC_NEXTPREV!!!!!!! - $prev = $forum->threadGetNextPrev('prev', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']); - $next = $forum->threadGetNextPrev('next', $thread->threadId,$this->var['forum_id'], $this->var['thread_lastpost']); + $prev = $forum->threadGetNextPrev('prev', $thread->threadId, $this->var['forum_id'], $this->var['thread_lastpost']); + $next = $forum->threadGetNextPrev('next', $thread->threadId, $this->var['forum_id'], $this->var['thread_lastpost']); - if($prev !== false) - { - $options[] = "".LAN_FORUM_1017." ".LAN_FORUM_2001.""; - } - if($next !== false) - { - $options[] = "".LAN_FORUM_1017." ".LAN_FORUM_2002.""; - } + if($prev !== false) + { + $options[] = "" . LAN_FORUM_1017 . " " . LAN_FORUM_2001 . ""; + } + if($next !== false) + { + $options[] = "" . LAN_FORUM_1017 . " " . LAN_FORUM_2002 . ""; + } -/* -$text = '
- '.($replyUrl?:"").' - -