Chat font color hold ???

Post Reply
User avatar
clight77
Donor
Donor
Posts: 25
Joined: Mon Mar 11, 2013 10:09 pm
Flag: Canada

Chat font color hold ???

Post by clight77 » Sat Mar 30, 2013 6:00 pm

Hi space don't know if you have any info on doing this or not.

But i added a few things to chat.php and MySql, but seem to have an issue with URL links and Smilies in the chat,they will not post properly unless i add a text character in the message first.

The font color holds just fine and all bbcodes work fine also.

Maybe you can have a look,as usual i suck at coding :)

I will just post the changes i made.

Thanks
Mark

I will PM you the FTP info that may make it easier.

DB:
Code: Select all
ALTER TABLE `phpbb_users` ADD `chat_font_color` INT( 11 ) NOT NULL DEFAULT '0' AFTER `user_colour`;
chat.php find:
Code: Select all
generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
add before:
Code: Select all
// Font Color
      $color_code = $user->data['chat_font_color'];
      $color_hex = dechex ("$color_code");
      while (strlen("$color_hex") < 6)
      {
         $color_hex = '0' . $color_hex;
      }
      $new_message = $message;
      $font = strrpos($new_message, "color=#");
      if(!$font)
      {
         $message = '[color=#' . $color_hex . ']' . $new_message . '[/color]';
      }
      else
      {
         $message_long = strlen($message);
         $message_start = strpos($message,"#")+1;
         $message_end = strpos($message,"]");
         $message_erased = ($message_long - $message_end);
         $color_code = substr ($message,$message_start,-$message_erased);
         $color_dec = hexdec ("$color_code");
         $sql = 'UPDATE ' . USERS_TABLE . " SET chat_font_color = " . $color_dec . " WHERE user_id = {$user->data['user_id']}";
         $db->sql_query($sql);
      } // End Font Color
Last edited by clight77 on Sat Mar 30, 2013 6:12 pm, edited 4 times in total.


User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Sun Mar 31, 2013 9:07 am

when you make changes to the chat.php, do you also make those changes to the shout.php? also, if you have added that code and things start having problems, then there is an issue with the code itself or the placement of the code. if i get time, i will log into the ftp and have a look today.
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Sun Mar 31, 2013 5:09 pm

trying to make some sense of all this and the chat.php and shout.php that you are using on your site are older than the ones i currently use here. that being said, some of the fixes implemented on mine combined with what you are trying to do in yours might fix it but not sure.

also, whatever editor you use or someone has used has inserted a blank line between every line of code in the files.

edit #2... i founf where you got this code from and from the poster of this code, it's broken
If you use my Font Color edit, you won't be able to post urls or smilies on their own, you MUST write something before them (i.e ":D" will be seen like that while "hey :D" will replace the smilie).
Last edited by spaceace on Sun Mar 31, 2013 5:26 pm, edited 2 times in total.
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Sun Mar 31, 2013 5:49 pm

guess what i found :D :D
Font Color Hold 4 Ajax Chat 0.0.3.zip
You do not have the required permissions to view the files attached to this post.
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
clight77
Donor
Donor
Posts: 25
Joined: Mon Mar 11, 2013 10:09 pm
Flag: Canada

Re: Chat font color hold ???

Post by clight77 » Sun Mar 31, 2013 7:59 pm

And where did you find that at ????

I looked for hours to locate that :) without luck......

Yeah forgot to set DW to eliminate white spaces,fixed that :)

Thanks
Mark
Last edited by clight77 on Mon Apr 01, 2013 12:07 am, edited 1 time in total.

User avatar
clight77
Donor
Donor
Posts: 25
Joined: Mon Mar 11, 2013 10:09 pm
Flag: Canada

Re: Chat font color hold ???

Post by clight77 » Sun Mar 31, 2013 10:58 pm

Thanks but i cannot get chat font color hold to work properly either :(
OH well i can live with the way it is.
Not as if anyone ever posts anyhow :) LOL

User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Mon Apr 01, 2013 6:13 am

clight77 wrote:And where did you find that at ????

I looked for hours to locate that :) without luck......

Yeah forgot to set DW to eliminate white spaces,fixed that :)

Thanks
Mark
told you i thought i had it on a hard drive somewhere. i keep everything like that ;)
clight77 wrote:Thanks but i cannot get chat font color hold to work properly either :(
OH well i can live with the way it is.
Not as if anyone ever posts anyhow :) LOL
i will install it on a test board to see what i can find.
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Mon Apr 01, 2013 11:49 am

installed on a test site and it works just fine :D
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
spaceace
Site Owner
Site Owner
Posts: 910
Joined: Wed Dec 16, 2009 8:30 pm
Location: Ontario, Canada
Flag: Canada
Contact:

Re: Chat font color hold ???

Post by spaceace » Mon Apr 01, 2013 12:37 pm

played a bit with the layout and text of the button and came up with this...

notice that the button for the font colour is in line with the rest of the bbcodes
chat font colour.jpg
when you want to set your colour...
chat font colour2.jpg
just remember that if someone has their browser to not accept cookies from your site, the colour setting will not stay set.
You do not have the required permissions to view the files attached to this post.
if you like my work and would like to contribute to my development of styles, please donate by using the donate button in the header.

Image

Image

User avatar
clight77
Donor
Donor
Posts: 25
Joined: Mon Mar 11, 2013 10:09 pm
Flag: Canada

Re: Chat font color hold ???

Post by clight77 » Mon Apr 01, 2013 1:10 pm

Well i cant get it to work :(
All goes fine but color codes are showing around messages. EG: [ color=#00BF00]Testing color code[ /color]


I gave you admin rights on my site also.

My original chat_body.html

Code: Select all
<!-- IF S_USER_LOGGED_IN -->
<!-- IF S_GET_CHAT -->
	<!-- IF S_READ or S_ADD -->
		<!-- BEGIN chatrow -->
     <!--<div id="p{chatrow.MESSAGE_ID}" class="post bg{chatrow.CLASS}">-->
				<div id="p{chatrow.MESSAGE_ID}" class="post <!-- IF chatrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
					<div class="inner">
						<div class="corners-top"><div></div></div>
                        <div class="postbody">
                        
                           <div {chatrow.USERNAME_FULL}<dl class="postprofile"style="width: 85%" id="profile{postrow.POST_ID}">  								
                                
								<span style="color: #0000FF;">{chatrow.MESSAGE}</span>
							</div></div>
							<span style="color: #0000FF;">{chatrow.TIME}</span>
                             <!-- IF U_ACP or U_MCP -->
                            <a href="javascript:delete_post('{chatrow.MESSAGE_ID}')" title="{L_DELETE_POST}">&nbsp;&nbsp;&nbsp;<input type="image" src="http://101warez.com/forum/images/redxsmall2.png">&nbsp;&nbsp;&nbsp;</a><!-- ENDIF -->
							</dl>
						<span class="corners-bottom"><span></span></span>
					</div>
				</div>
			<!-- END chatrow -->--!--{LAST_ID}--!--
			<!-- BEGIN soundrow -->{soundrow.SOUND}<!-- END soundrow -->
				<!-- IF S_WHOISONLINE -->
					<!-- BEGIN whoisrow -->
						<div>
							<div class="inner">
								<div class="user"><img style="vertical-align: middle" src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" alt="" />&nbsp;{whoisrow.USERNAME_FULL}</div>
							</div>
						</div>
					<!-- END whoisrow -->--!--{LAST_TIME}--!--{DELAY}--!--{LAST_POST}
				<!-- ENDIF -->
	<!-- ENDIF -->
<!-- ELSE -->
	<!-- IF S_CHAT -->
		<!-- INCLUDE overall_header.html -->
<!-- ENDIF -->
<script type="text/javascript">
// <![CDATA[
	var form_name = 'postform';
	var text_name = 'message';
	var fieldname = 'chat';
	var last_time = 0;
	var xmlHttp = http_object();
	var last_id = {LAST_ID};
	var type = 'receive';
	var post_time = {TIME};
	var read_interval = 15000;
	var interval = setInterval('handle_send("read", last_id);', read_interval);
	function handle_send(mode, f)
	{
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
			indicator_switch('on');
			type = 'receive';
			param = 'mode=' + mode;
			param += '&last_id=' + last_id;
			param += '&last_time=' + last_time;
			param += '&last_post=' + post_time;
			param += '&read_interval=' + read_interval;
			if (mode == 'add' && document.postform.message.value != '')
			{
				type = 'send';
				for(var i = 0; i < f.elements.length; i++)
				{
					elem = f.elements[i];
					param += '&' + elem.name + '=' + encodeURIComponent(elem.value);
				}
				document.postform.message.value = '';
			}
			else if (mode == 'delete')
			{
				type = 'delete';
				param += '&chat_id=' + f;
			}
			xmlHttp.open("POST", '{FILENAME}', true);
			xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			xmlHttp.onreadystatechange = handle_return;
			xmlHttp.send(param);
		}
	}
	function handle_return()
	{
		if (xmlHttp.readyState == 4)
		{
			if (type != 'delete')
			{
				results = xmlHttp.responseText.split('--!--');
				if (results[1])
				{
					if (last_id == 0)
					{
						document.getElementById(fieldname).innerHTML = results[0];
					}
					else
					{
						document.getElementById(fieldname).innerHTML = results[0] + document.getElementById(fieldname).innerHTML;
					}
					last_id = results[1];
					if (results[2])
					{
						document.getElementById('whois_online').innerHTML = results[2];
						last_time = results[3];
						if (results[4] != read_interval * 1000)
						{
							window.clearInterval(interval);
							read_interval = results[4] * 1000;
							interval = setInterval('handle_send("read", last_id);', read_interval);
							document.getElementById('update_seconds').innerHTML = results[4];
						}
						post_time = results[5];
					}
				}
			}
			indicator_switch('off');
		}
	}
	function delete_post(chatid)
	{
		document.getElementById('p' + chatid).style.display = 'none';
		handle_send('delete', chatid);
	}
	function indicator_switch(mode)
	{
		if(document.getElementById("act_indicator"))
		{
			var img = document.getElementById("act_indicator");
			if(img.style.visibility == "hidden" && mode == 'on')
			{
				img.style.visibility = "visible";
			}
			else if (mode == 'off')
			{
				img.style.visibility = "hidden"
			}
		}
	}
	function http_object()
	{
		if (window.XMLHttpRequest)
		{
			return new XMLHttpRequest();
		}
		else if(window.ActiveXObject)
		{
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
		}
	}
	function addText(instext)
	{
		var mess = document.getElementById('message');
	//IE support
		if (document.selection)
		{
			mess.focus();
			sel = document.selection.createRange();
			sel.text = instext;
			document.message.focus();
		}
	//MOZILLA/NETSCAPE support
		else if (mess.selectionStart || mess.selectionStart == "0")
		{
			var startPos = mess.selectionStart;
			var endPos = mess.selectionEnd;
			var chaine = mess.value;
			mess.value = chaine.substring(0, startPos) + instext + chaine.substring(endPos, chaine.length);
			mess.selectionStart = startPos + instext.length;
			mess.selectionEnd = endPos + instext.length;
			mess.focus();
		}
		else
		{
			mess.value += instext;
			mess.focus();
		}
	}
// ]]>
-->
</script>
<style type="text/css">
<!--
#wrap {
   padding: 8px;
   margin: 6px auto;
   width: 97%;
   text-align:left;
   background-color:#FFFFFF;
}
		#act_indicator {
			visibility:hidden;
		}
		.shouts {
			width: 70%;
			height:200px;
			overflow-x: hidden;
			overflow:auto;
			float:left;
		}
		.onlinelist {
			width: 30%;
			overflow:auto;
			height:200px;
		}
		#chat {
			width: 100%;
			text-align:left;
		}	
		#chat * {
			margin:0px;
			padding:0px;
			min-height:0px;
		}
		.postprofile {
			min-height: 5px !important;
		}
		.chatform {
			width: 95%;
			text-align:center;
		}
		.users {
			width: 90%;
			text-align: left;
			margin-left:auto;
			margin-right:auto;
		}
		.user {
			width: 95%;
			font-size: 1.0em;
			font-family:Verdana, Arial, Helvetica, sans-serif;
			line-height: 1.2em;
		
		}
		.chatinput {width: 21% !important;}
			.online_img {
		}
		.postbody {
	padding: 0;
	line-height: 1.0em;
	float: left;
	clear: both;
}
.postbody .content {
	font-size: 1.0em;
}
	-->
</style>
<!-- IF S_USER_LOGGED_IN -->
	<div class="forabg">
		<div class="inner">
			<span class="corners-top"><span></span></span>
				<div class="chatform" align="center">
                               
  
							
<div align="left">                
<form>                        
<!-- INCLUDE posting_buttons2.html --> 
<!-- IF S_SMILIES_ALLOWED and .smiley -->
<!-- BEGIN smiley -->
<a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" /></a>
<!-- END smiley -->	</div>				
<!-- ENDIF -->
</form>
 <form name="postform" id="postform" method="post" action="javascript:void(0);" onsubmit="handle_send('add', this)" autocomplete="off">
 <div align="left">
<strong style="color: black;">{L_MESSAGE}:</strong> <input type="text" tabindex="1" name="message" id="message" class="inputbox chatinput" />
<input type="submit" class="button1" value="{L_SUBMIT}" name="submit" tabindex="6" accesskey="s"/> </div>               
				</div>
			<span class="corners-bottom"><span></span></span>
		</div>
	</div>
<!-- ENDIF -->
<div class="forabg" align="left">
	<div class="inner">
		<span class="corners-top"><span></span></span>
		<div class="shouts">
			<div id="chat">
				<!-- BEGIN chatrow -->
     <!--<div id="p{chatrow.MESSAGE_ID}" class="post bg{chatrow.CLASS}">-->
				<div id="p{chatrow.MESSAGE_ID}" class="post <!-- IF chatrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
					<div class="inner">
						<div class="corners-top"><div></div></div>
                        <div class="postbody">
                        
                           <div {chatrow.USERNAME_FULL}<dl class="postprofile"style="width: 85%" id="profile{postrow.POST_ID}">  								
                                
								<span style="color: #0000FF;">{chatrow.MESSAGE}</span>
							</div></div>
							<span style="color: #0000FF;">{chatrow.TIME}</span>
                             <!-- IF U_ACP or U_MCP -->
                            <a href="javascript:delete_post('{chatrow.MESSAGE_ID}')" title="{L_DELETE_POST}">&nbsp;&nbsp;&nbsp;<input type="image" src="http://101warez.com/forum/images/redxsmall2.png">&nbsp;&nbsp;&nbsp;</a><!-- ENDIF -->
							</dl>
						<span class="corners-bottom"><span></span></span>
					</div>
				</div>
			<!-- END chatrow -->
			</div>
          </div>
          <div class="onlinelist bg1">
             <h4>&nbsp; &nbsp; &nbsp; &nbsp;Online List:<div style="float: right;">Welcome to 101warez chat.<div style="float: right;"> <img src="http://101warez.com/forum/images/chatimage1.png"></h4>
<div class="users" id="whois_online">
                <!-- BEGIN whoisrow -->
                   <div>
                      <div class="inner">
                         <div class="user"><img style="vertical-align: middle" src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" />&nbsp;{whoisrow.USERNAME_FULL}</div>
                      </div>
                   </div>
                <!-- END whoisrow -->
             </div>
          </div>
          <span class="corners-bottom"><span></span></span>
       </div>
    </div>
    
    <!-- IF S_CHAT -->
       <!-- INCLUDE overall_footer.html -->
    <!-- ENDIF -->
    <!-- ENDIF -->
<!-- ELSE -->
    <div class="navbar" style="text-align: center">
       <div class="inner">
          <span class="corners-top"><span></span></span>
             <div id="author">{L_DETAILS}
                <strong>To use chat, you must be registered and logged in.</strong>
             </div>
          <span class="corners-bottom"><span></span></span>
       </div>
    </div>
    <br />
    <!-- ENDIF -->
Last edited by clight77 on Mon Apr 01, 2013 2:59 pm, edited 4 times in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest