diff --git a/e107_handlers/date_handler.php b/e107_handlers/date_handler.php index 917975648..e28980d38 100644 --- a/e107_handlers/date_handler.php +++ b/e107_handlers/date_handler.php @@ -29,7 +29,7 @@ class convert * System time offset is considered. * * @param integer $datestamp unix stamp - * @param string $mask [optional] long|short|forum or any strftime() valid string + * @param string $mask [optional] long|short|forum|relative or any strftime() valid string * * @return string parsed date */ @@ -76,6 +76,10 @@ class convert // $datestamp += TIMEOFFSET; break; + case 'relative': + return $this->computeLapse($datestamp, time(), false, false, 'short') ; + break; + default: if(strpos($mask, '%') === FALSE) { @@ -84,7 +88,6 @@ class convert break; } - // return strftime($mask, $datestamp); } diff --git a/e107_plugins/chatbox_menu/chatbox_menu.php b/e107_plugins/chatbox_menu/chatbox_menu.php index 84a14b2a0..18abac25b 100644 --- a/e107_plugins/chatbox_menu/chatbox_menu.php +++ b/e107_plugins/chatbox_menu/chatbox_menu.php @@ -14,12 +14,23 @@ * @package e107_plugins * @subpackage chatbox */ -error_reporting(0); + +error_reporting(E_ALL); +if(isset($_POST['chatbox_ajax'])) +{ + define('e_MINIMAL',true); +} + +include_once('../../class2.php'); global $e107cache, $e_event, $e107; + + $tp = e107::getParser(); $pref = e107::getPref(); + + if (!plugInstalled('chatbox_menu')) { return ''; @@ -28,11 +39,12 @@ if (!plugInstalled('chatbox_menu')) include_lan(e_PLUGIN.'chatbox_menu/languages/'.e_LANGUAGE.'/'.e_LANGUAGE.'.php'); // FIXME - start - LAN is not loaded +/* if(($pref['cb_layer']==2) || isset($_POST['chatbox_ajax'])) { if(isset($_POST['chat_submit'])) { - include_once('../../class2.php'); + //Normally the menu.sc file will auto-load the language file, this is needed in case //ajax is turned on and the menu is not loaded from the menu.sc @@ -40,13 +52,103 @@ if(($pref['cb_layer']==2) || isset($_POST['chatbox_ajax'])) } } // FIXME - end +*/ - -if(!defined('e_HANDLER')){ exit; } +// if(!defined('e_HANDLER')){ exit; } require_once(e_HANDLER.'emote.php'); $emessage=''; -if(isset($_POST['chat_submit']) && $_POST['cmessage'] != '') + + + + + + + +class chatbox_shortcodes extends e_shortcode +{ + function sc_username($parm='') + { + list($cb_uid, $cb_nick) = explode(".", $this->var['cb_nick'], 2); + if($this->var['user_name']) + { + $cb_nick = "".$this->var['user_name'].""; + } + else + { + $cb_nick = $tp -> toHTML($cb_nick,FALSE,'USER_TITLE, emotes_off, no_make_clickable'); + $cb_nick = str_replace("Anonymous", LAN_ANONYMOUS, $cb_nick); + } + + return $cb_nick; + } + + function sc_timedate($parm='') + { + return e107::getDate()->convert_date($this->var['cb_datestamp'], "relative"); + } + + + function sc_message($parm = '') + { + if($this->var['cb_blocked']) + { + return CHATBOX_L6; + } + + $pref = e107::getPref(); + $emotes_active = $pref['cb_emote'] ? 'USER_BODY, emotes_on' : 'USER_BODY, emotes_off'; + + list($cb_uid, $cb_nick) = explode(".", $this->var['cb_nick'], 2); + + $cb_message = e107::getParser()->toHTML($this->var['cb_message'], false, $emotes_active, $cb_uid, $pref['menu_wordwrap']); + + return $cb_message; + + $replace[0] = "["; $replace[1] = "]"; + $search[0] = "["; $search[1] = "]"; + $cb_message = str_replace($search, $replace, $cb_message); + } + + function sc_avatar($parm='') + { + return e107::getParser()->parseTemplate("{USER_AVATAR=".$this->var['user_image']."}"); + } + + function sc_bullet($parm = '') + { + $bullet = ""; + + if(defined('BULLET')) + { + $bullet = ''; + } + elseif(file_exists(THEME.'images/bullet2.gif')) + { + $bullet = ''; + } + + return $bullet; + } + +} + + + + + + + + + + + + + + + + +if((isset($_POST['chat_submit']) || e_AJAX_REQUEST) && $_POST['cmessage'] != '') { if(!USER && !$pref['anon_post']) { @@ -65,7 +167,7 @@ if(isset($_POST['chat_submit']) && $_POST['cmessage'] != '') if((strlen(trim($cmessage)) < 1000) && trim($cmessage) != "") { $cmessage = $tp -> toDB($cmessage); - if($sql -> db_Select("chatbox", "*", "cb_message='$cmessage' AND cb_datestamp+84600>".time())) + if($sql->select("chatbox", "*", "cb_message='$cmessage' AND cb_datestamp+84600>".time())) { $emessage = CHATBOX_L17; } @@ -84,7 +186,7 @@ if(isset($_POST['chat_submit']) && $_POST['cmessage'] != '') } else { - if($sql -> db_Select("user", "*", "user_name='$nick' ")){ + if($sql->select("user", "*", "user_name='$nick' ")){ $emessage = CHATBOX_L1; } else @@ -94,7 +196,7 @@ if(isset($_POST['chat_submit']) && $_POST['cmessage'] != '') } if(!$emessage) { - $sql -> db_Insert("chatbox", "0, '$nick', '$cmessage', '".time()."', '0' , '$ip' "); + $sql->insert("chatbox", "0, '$nick', '$cmessage', '".time()."', '0' , '$ip' "); $edata_cb = array("cmessage" => $cmessage, "ip" => $ip); $e_event -> trigger("cboxpost", $edata_cb); $e107cache->clear("nq_chatbox"); @@ -150,12 +252,15 @@ else $oc = ""; } $texta .= " - +
- "; + "; + + // $texta .= ""; // How often do we see these lately? ;-) - if($pref['cb_emote'] && $pref['smiley_activate']){ + if($pref['cb_emote'] && $pref['smiley_activate']) + { $texta .= "