1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 19:30:25 +02:00

Moving shortcodes to new folder

This commit is contained in:
mcfly
2010-04-26 13:15:32 +00:00
parent 597cc1b31c
commit c702d7d6db
2 changed files with 0 additions and 0 deletions

View File

@@ -1,187 +0,0 @@
<?php
if (!defined('e107_INIT')) { exit; }
class forum_post_shortcodes extends e_shortcode
{
protected $e107;
function __construct()
{
$this->e107 = e107::getInstance();
}
function sc_latestposts($parm)
{
$parm = ($parm ? $parm : 10);
global $LATESTPOSTS_START, $LATESTPOSTS_END, $LATESTPOSTS_POST;
$txt = $this->e107->tp->parseTemplate($LATESTPOSTS_START, true);
$start = max($this->threadInfo['thread_total_replies'] - $parm, 0);
$num = min($this->threadInfo['thread_total_replies'], $parm);
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], $start, $num);
for($i = count($tmp)-1; $i > 0; $i--)
{
setScVar('forum_shortcodes', 'postInfo', $tmp[$i]);
$txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_POST, true);
}
$txt .= $this->e107->tp->parseTemplate($LATESTPOSTS_END, true);
return $txt;
}
function sc_threadtopic()
{
global $THREADTOPIC_REPLY;
$tmp = $this->forum->postGet($this->threadInfo['thread_id'], 0, 1);
setScVar('forum_shortcodes', 'postInfo', $tmp[0]);
return $this->e107->tp->parseTemplate($THREADTOPIC_REPLY, true);
}
function sc_formstart()
{
return "<form enctype='multipart/form-data' method='post' action='".e_SELF.'?'.e_QUERY."' id='dataform'>";
}
function sc_formend()
{
return '</form>';
}
function sc_forumjump()
{
return forumjump();
}
function sc_userbox()
{
global $userbox;
return (USER == false ? $userbox : '');
}
function sc_subjectbox()
{
global $subjectbox, $action;
return ($action == 'nt' ? $subjectbox : '');
}
function sc_posttype()
{
global $action;
return ($action == 'nt' ? LAN_63 : LAN_73);
}
function sc_postbox()
{
global $post;
$rows = (e_WYSIWYG) ? 15 : 10;
$ret = "<textarea class='e-wysiwyg tbox' id='post' name='post' cols='70' rows='{$rows}' style='width:95%' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'>$post</textarea>\n<br />\n";
if(!e_WYSIWYG)
{
$ret .= display_help('helpb', 'forum');
}
return $ret;
}
function sc_buttons()
{
global $action, $eaction;
$ret = "<input class='button' type='submit' name='fpreview' value='".LAN_323."' /> ";
if ($action != 'nt')
{
$ret .= ($eaction ? "<input class='button' type='submit' name='update_reply' value='".LAN_78."' />" : "<input class='button' type='submit' name='reply' value='".LAN_74."' />");
}
else
{
$ret .= ($eaction ? "<input class='button' type='submit' name='update_thread' value='".LAN_77."' />" : "<input class='button' type='submit' name='newthread' value='".LAN_64."' />");
}
return $ret;
}
function sc_fileattach()
{
global $forum, $pref, $fileattach, $fileattach_alert;
if ($forum->prefs->get('attach') && (check_class($pref['upload_class']) || getperms('0')))
{
if (is_writable(e_PLUGIN.'forum/attachments'))
{
return $fileattach;
}
else
{
$FILEATTACH = '';
if(ADMIN)
{
if(!$fileattach_alert)
{
$fileattach_alert = "<tr><td colspan='2' class='nforumcaption2'>".($pref['image_post'] ? LAN_390 : LAN_416)."</td></tr><tr><td colspan='2' class='forumheader3'>".LAN_FORUM_1."</td></tr>\n";
}
return $fileattach_alert;
}
}
}
}
function sc_postthreadas()
{
global $action, $thread_info;
if (MODERATOR && $action == "nt")
{
$thread_sticky = (isset($_POST['threadtype']) ? $_POST['threadtype'] : $thread_info['head']['thread_sticky']);
return "<br /><span class='defaulttext'>".LAN_400."<input name='threadtype' type='radio' value='0' ".(!$thread_sticky ? "checked='checked' " : "")." />".LAN_1."&nbsp;<input name='threadtype' type='radio' value='1' ".($thread_sticky == 1 ? "checked='checked' " : "")." />".LAN_2."&nbsp;<input name='threadtype' type='radio' value='2' ".($thread_sticky == 2 ? "checked='checked' " : "")." />".LAN_3."</span>";
}
return '';
}
function sc_backlink()
{
global $forum, $thread_info, $eaction, $action;
$_tmp = '';
$forum->set_crumb(true, ($action == 'nt' ? ($eaction ? LAN_77 : LAN_60) : ($eaction ? LAN_78 : LAN_406.' '.$thread_info['head']['thread_name'])), $_tmp);
return $_tmp->BREADCRUMB;
}
function sc_noemotes()
{
if($eaction == true) { return ; }
return "<input type='checkbox' name='no_emote' value='1' />&nbsp;<span class='defaulttext'>".LAN_FORUMPOST_EMOTES.'</span>';
}
function sc_emailnotify()
{
global $pref, $thread_info, $action, $eaction;
if($eaction == true) { return ; }
if ($pref['email_notify'] && $action == 'nt' && USER)
{
if(isset($_POST['fpreview']))
{
$chk = ($_POST['email_notify'] ? "checked = 'checked'" : '');
}
else
{
if(isset($thread_info))
{
$chk = ($thread_info['head']['thread_active'] == 99 ? "checked='checked'" : '');
}
else
{
$chk = ($pref['email_notify_on'] ? "checked='checked'" : '');
}
}
return "<br /><input type='checkbox' name='email_notify' value='1' {$chk} />&nbsp;<span class='defaulttext'>".LAN_380."</span>";
}
return '';
}
function sc_poll()
{
global $forum, $poll_form, $action;
if ($action == 'nt' && check_class($forum->prefs->get('poll')) && strpos(e_QUERY, 'edit') === false)
{
return $poll_form;
}
return '';
}
}
?>

View File

@@ -1,341 +0,0 @@
<?php
if (!defined('e107_INIT')) { exit; }
class forum_shortcodes extends e_shortcode
{
protected $e107;
function __construct()
{
$this->e107 = e107::getInstance();
}
function sc_top()
{
return "<a href='".e_SELF.'?'.e_QUERY."#top' onclick=\"window.scrollTo(0,0);\">".LAN_10.'</a>';
}
function sc_joined()
{
global $gen;
if ($this->postInfo['post_user'])
{
return LAN_06.': '.$gen->convert_date($this->postInfo['user_join'], 'forum').'<br />';
}
}
function sc_threaddatestamp()
{
global $gen;
return "<a id='post_{$this->post_info['post_id']}' href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'post', 'id' => $this->postInfo['post_id']))."'>".IMAGE_post."</a> ".$gen->convert_date($this->postInfo['post_datestamp'], 'forum');
}
function sc_post()
{
$emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : '');
return $this->e107->tp->toHTML($this->postInfo['post_entry'], true, 'USER_BODY'.$emote, 'class:'.$this->postInfo['user_class']);
}
function sc_postdeleted()
{
if($this->postInfo['post_status'])
{
$info = unserialize($this->postInfo['post_options']);
return "
Post delete on: {$info['deldate']}<br />
reason: {$info['delreason']}
";
$ret = '<pre>'.print_r($info, true).'</pre>';
}
}
function sc_attachments()
{
if($this->postInfo['post_attachments'])
{
$baseDir = e_MEDIA_ABS.'files/plugins/forum/attachments/';
$attachments = explode(',', $this->postInfo['post_attachments']);
$txt = '';
foreach($attachments as $a)
{
$info = explode('*', $a);
switch($info[0])
{
case 'file':
$txt .= IMAGE_attachment." <a href='{$baseDir}{$info[1]}'>{$info[2]}</a><br />";
break;
case 'img':
//if image has a thumb, show it and link to main
if(isset($info[2]))
{
$txt .= "<a href='{$baseDir}{$info[1]}'><img src='{$baseDir}thumb/{$info[2]}' alt='' /></a><br />";
}
else
{
$txt .= "<img src='{$baseDir}{$info[1]}' alt='' /><br />";
}
}
}
return $txt;
}
}
function sc_privmessage()
{
if(plugInstalled('pm') && ($this->postInfo['post_user'] > 0))
{
return $this->e107->tp->parseTemplate("{SENDPM={$this->postInfo['post_user']}}");
}
}
function sc_avatar()
{
if ($this->postInfo['post_user'])
{
if(!$avatar = getcachedvars('forum_avatar_'.$this->postInfo['post_user']))
{
if ($this->postInfo['user_image'])
{
require_once(e_HANDLER.'avatar_handler.php');
$avatar = "<div class='spacer'><img src='".avatar($this->postInfo['user_image'])."' alt='' /></div><br />";
}
else
{
$avatar = '';
}
cachevars('forum_avatar_'.$this->postInfo['post_user'], $avatar);
}
return $avatar;
}
return '';
}
function sc_anon_ip()
{
if($this->postInfo['post_user_anon'] && (ADMIN || MODERATOR))
{
return $this->e107->ipDecode($this->postInfo['post_ip']);
}
}
function sc_ip()
{
if((ADMIN || MODERATOR) && !$this->postInfo['user_admin'])
{
return $this->e107->ipDecode($this->postInfo['post_ip']);
}
}
function sc_poster()
{
if($this->postInfo['user_name'])
{
return "<a href='".$this->e107->url->getUrl('core:user', 'main', array('func' => 'profile', 'id' => $this->postInfo['post_user']))."'>{$this->postInfo['user_name']}</a>";
}
else
{
return '<b>'.$this->e107->tp->toHTML($this->postInfo['post_user_anon']).'</b>';
}
}
function sc_emailimg()
{
if($this->postInfo['user_name'])
{
return (!$this->postInfo['user_hideemail'] ? $this->e107->tp->parseTemplate("{EMAILTO={$this->postInfo['user_email']}}") : '');
}
return '';
}
function sc_emailitem()
{
if($this->postInfo['thread_start'])
{
return $this->e107->tp->parseTemplate("{EMAIL_ITEM=".FORLAN_101."^plugin:forum.{$this->postInfo['post_thread']}}");
}
}
function sc_printitem()
{
if($this->postInfo['thread_start'])
{
return $this->e107->tp->parseTemplate("{PRINT_ITEM=".FORLAN_102."^plugin:forum.{$this->postInfo['post_thread']}}");
}
}
function sc_signature()
{
if(!USER) { return ''; }
global $forum;
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);
}
return ($this->postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".$this->e107->tp->toHTML($this->postInfo['user_signature'], true).'</span>' : '');
}
function sc_profileimg()
{
if (USER && $this->postInfo['user_name'])
{
return $this->e107->tp->parseTemplate("{PROFILE={$this->postInfo['post_user']}}");
}
}
function sc_posts()
{
if ($this->postInfo['post_user'])
{
return LAN_67.': '.(int)$this->postInfo['user_plugin_forum_posts'].'<br />';
}
}
function sc_visits()
{
if ($this->postInfo['user_name'])
{
return LAN_09.': '.$this->postInfo['user_visits'].'<br />';
}
}
function sc_customtitle()
{
if ($this->postInfo['user_customtitle'])
{
return $this->e107->tp->toHTML($this->postInfo['user_customtitle']).'<br />';
}
}
function sc_website()
{
if ($this->postInfo['user_homepage']) {
return LAN_08.': '.$this->postInfo['user_homepage'].'<br />';
}
}
function sc_websiteimg()
{
if ($this->postInfo['user_homepage'] && $this->postInfo['user_homepage'] != 'http://')
{
return "<a href='{$this->postInfo['user_homepage']}'>".IMAGE_website.'</a>';
}
}
function sc_editimg()
{
if (USER && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active'])
{
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'edit', 'id' => $this->postInfo['post_id']))."'>".IMAGE_edit.'</a> ';
}
}
function sc_quoteimg()
{
if($this->forum->checkperm($this->postInfo['post_forum'], 'post'))
{
return "<a href='".$this->e107->url->getUrl('forum', 'thread', array('func' => 'quote', 'id' => $this->postInfo['post_id']))."'>".IMAGE_quote.'</a> ';
}
}
function sc_reportimg()
{
global $page;
if (USER) {
return "<a href='".$this->e107->url->getUrl('forum', 'thread', "func=report&id={$this->postInfo['post_thread']}&post={$this->postInfo['post_id']}")."'>".IMAGE_report.'</a> ';
}
}
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 "<span class='smalltext'>".LAN_195.' #'.$this->postInfo['post_user'].'</span>';
}
function sc_level($parm)
{
if (!$this->postInfo['post_user']) { return ''; }
$rankInfo = e107::getRank()->getRanks($this->postInfo['post_user']);
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 "<div class='spacer'>".IMAGE_rank_moderator_image.'</div>';
}
return '';
break;
default:
return varset($rankInfo[$parm], '');
break;
}
}
function sc_modoptions()
{
if (MODERATOR)
{
return showmodoptions();
}
}
function sc_lastedit()
{
global $gen;
if ($this->postInfo['post_edit_datestamp'])
{
return $gen->convert_date($this->postInfo['post_edit_datestamp'],'forum');
}
}
function sc_lasteditby()
{
if(isset($this->postInfo['edit_name']))
{
if($parm == 'link')
{
$e107 = e107::getInstance();
$url = $e107->url->getUrl('core:user', 'main', 'func=profile&id='.$this->postInfo['post_edit_user']);
return "<a href='{$url}'>{$this->postInfo['edit_name']}</a>";
}
return $this->postInfo['edit_name'];
}
}
function sc_poll()
{
global $pollstr;
return $pollstr;
}
function sc_newflag()
{
// Defined in case an indicator is required
return '';
}
}
?>