1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

chatbox sc namespace collisions fix; legacy JS issue fix (user

settings)
This commit is contained in:
SecretR
2013-04-29 15:04:01 +03:00
parent 3847aca845
commit fedd644b69
3 changed files with 16 additions and 16 deletions

View File

@@ -1058,7 +1058,6 @@ class e107
*/ */
public static function getScBatch($className, $pluginName = null, $overrideClass = null) public static function getScBatch($className, $pluginName = null, $overrideClass = null)
{ {
//FIXME URGENT - Check for WRAPPER in template, and place into class.
if(is_string($overrideClass)) $overrideClass .= '_shortcodes'; if(is_string($overrideClass)) $overrideClass .= '_shortcodes';
return self::getScParser()->getScObject($className.'_shortcodes', $pluginName, $overrideClass); return self::getScParser()->getScObject($className.'_shortcodes', $pluginName, $overrideClass);
} }

View File

@@ -19,10 +19,9 @@ error_reporting(E_ALL);
if(isset($_POST['chatbox_ajax'])) if(isset($_POST['chatbox_ajax']))
{ {
define('e_MINIMAL',true); define('e_MINIMAL',true);
if(!defined('e107_INIT')) require_once('../../class2.php');
} }
include_once('../../class2.php');
global $e107cache, $e_event, $e107; global $e107cache, $e_event, $e107;
@@ -64,10 +63,10 @@ $emessage='';
// FIX - using generic sc names is affecting old installs/templates and global wrappers (e.g. sc_style[USERNAME])
class chatbox_shortcodes extends e_shortcode class chatbox_shortcodes extends e_shortcode
{ {
function sc_username($parm='') function sc_cb_username($parm='')
{ {
list($cb_uid, $cb_nick) = explode(".", $this->var['cb_nick'], 2); list($cb_uid, $cb_nick) = explode(".", $this->var['cb_nick'], 2);
if($this->var['user_name']) if($this->var['user_name'])
@@ -83,13 +82,13 @@ class chatbox_shortcodes extends e_shortcode
return $cb_nick; return $cb_nick;
} }
function sc_timedate($parm='') function sc_cb_timedate($parm='')
{ {
return e107::getDate()->convert_date($this->var['cb_datestamp'], "relative"); return e107::getDate()->convert_date($this->var['cb_datestamp'], "relative");
} }
function sc_message($parm = '') function sc_cb_message($parm = '')
{ {
if($this->var['cb_blocked']) if($this->var['cb_blocked'])
{ {
@@ -110,12 +109,12 @@ class chatbox_shortcodes extends e_shortcode
$cb_message = str_replace($search, $replace, $cb_message); $cb_message = str_replace($search, $replace, $cb_message);
} }
function sc_avatar($parm='') function sc_cb_avatar($parm='')
{ {
return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}"); return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}");
} }
function sc_bullet($parm = '') function sc_cb_bullet($parm = '')
{ {
$bullet = ""; $bullet = "";
@@ -301,18 +300,22 @@ if(!$text = $e107cache->retrieve("nq_chatbox"))
else // default chatbox style else // default chatbox style
{ {
$tp->parseTemplate("{SETIMAGE: w=40}",true); // set thumbnail size. $tp->parseTemplate("{SETIMAGE: w=40}",true); // set thumbnail size.
// FIXME - move to template
$CHATBOX_TEMPLATE['start'] = "<ul class='unstyled'>"; $CHATBOX_TEMPLATE['start'] = "<ul class='unstyled'>";
$CHATBOX_TEMPLATE['item'] = "<li> $CHATBOX_TEMPLATE['item'] = "<li>
{AVATAR} <b>{USERNAME}</b>&nbsp; {CB_AVATAR} <b>{CB_USERNAME}</b>&nbsp;
<small class='muted smalltext'>{TIMEDATE}</small><br /> <small class='muted smalltext'>{CB_TIMEDATE}</small><br />
<p style='margin-left:50px'>{MESSAGE}</p> <p style='margin-left:50px'>{CB_MESSAGE}</p>
</li>\n"; </li>\n";
$CHATBOX_TEMPLATE['end'] = "</ul>"; $CHATBOX_TEMPLATE['end'] = "</ul>";
} }
$sc = e107::getScBatch('chatbox'); // FIX - don't call getScBatch() if don't need to globally register the methods
// $sc = e107::getScBatch('chatbox');
// the good way in this case - it works with any object having sc_*, models too
$sc = new chatbox_shortcodes();
if($sql->gen($qry)) if($sql->gen($qry))
{ {

View File

@@ -838,12 +838,10 @@ function headerjs()
{ {
$script = " $script = "
<script type='text/javascript'>
function addtext_us(sc) function addtext_us(sc)
{ {
document.getElementById('dataform').image.value = sc; document.getElementById('dataform').image.value = sc;
} }
</script>
"; ";