Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Can't find exactly what you've been wanting? Try searching for what you are looking for in the search box to the right. ----------->


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: [All versions] Mailbox clickable bbcode and smilies  (Read 1827 times)

03laceys

  • Basic Member
  • *
  • Reputation Power: 0
  • 03laceys has no influence.
  • Offline Offline
  • Posts: 34
    • View Profile
    • Email
[All versions] Mailbox clickable bbcode and smilies
« on: March 03, 2009, 06:58:03 PM »
Ok this will allow bbcode and smilies to be used in the mailbox, they are also clickable, and the bbcode has onmouseoverhover tested on cross browers.

With thanks to silver for the bbcode.php, and killah for the css.
And Peter Nederlof for the cross browser script.

First create new file and call it bbcodestyle.css
Insert the following code and upload
Code: [Select]
   <style>
body { behavior:url("csshover3.htc"); }

    .bbcode_hover
    {
     background-image: url('icons/bold.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover:hover
    {
     background-image: url('icons/bold_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover1
    {
     background-image: url('icons/italics.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover1:hover
    {
     background-image: url('icons/italics_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover2
    {
     background-image: url('icons/underline.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover2:hover
    {
     background-image: url('icons/underline_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover3
    {
     background-image: url('icons/insert_hyperlink.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover3:hover
    {
     background-image: url('icons/insert_hyperlink_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover4
    {
     background-image: url('icons/strikethrough.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover4:hover
    {
     background-image: url('icons/strikethrough_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover5
    {
     background-image: url('icons/insert_picture.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover5:hover
    {
     background-image: url('icons/insert_picture_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover6
    {
     background-image: url('icons/justify_center.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover6:hover
    {
     background-image: url('icons/justify_center_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }

    .bbcode_hover7
    {
     background-image: url('icons/forecolor.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
    .bbcode_hover7:hover
    {
     background-image: url('icons/forecolor_on.gif');
     background-color: transparent;
     height: 20px;
     width: 20px;
     border: 0px;
    }
  </style>


Next create a new file and call it csshover3.htc
Insert the following to the file.
Code: [Select]
<public:attach event="ondocumentready" onevent="CSSHover()" />
<script>
// <![CDATA[
/**
 *   Whatever:hover - V3.00.081222
 *   ------------------------------------------------------------
 *   Author  - Peter Nederlof, http://www.xs4all.nl/~peterned
 *   License - http://creativecommons.org/licenses/LGPL/2.1
 *
 *   Whatever:hover is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU Lesser General Public
 *   License as published by the Free Software Foundation; either
 *   version 2.1 of the License, or (at your option) any later version.
 *
 *   Whatever:hover is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 *   Lesser General Public License for more details.
 *
 *   howto: body { behavior:url("csshover3.htc"); }
 *   ------------------------------------------------------------
 */

window.CSSHover = (function(){

   // regular expressions, used and explained later on.
   var REG_INTERACTIVE = /(^|\s)((([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active|focus))/i,
      REG_AFFECTED = /(.*?)\:(hover|active|focus)/i,
      REG_PSEUDO = /[^:]+:([a-z-]+).*/i,
      REG_SELECT = /(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi,
      REG_CLASS = /\.([a-z0-9_-]*on(hover|active|focus))/i,
      REG_MSIE = /msie (5|6|7)/i,
      REG_COMPAT = /backcompat/i;

   // css prefix, a leading dash would be nice (spec), but IE6 doesn't like that.
   var CSSHOVER_PREFIX = 'csh-';
   
   /**
    *   Local CSSHover object
    *   --------------------------
    */
   
   var CSSHover = {
     
      // array of CSSHoverElements, used to unload created events
      elements: [],
     
      // buffer used for checking on duplicate expressions
      callbacks: {},
     
      // init, called once ondomcontentready via the exposed window.CSSHover function
      init:function() {
         // don't run in IE8 standards; expressions don't work in standards mode anyway,
         // and the stuff we're trying to fix should already work properly
         if(!REG_MSIE.test(navigator.userAgent) && !REG_COMPAT.test(window.document.compatMode)) return;

         // start parsing the existing stylesheets
         var sheets = window.document.styleSheets, l = sheets.length;
         for(var i=0; i<l; i++) {
            this.parseStylesheet(sheets[i]);
         }
      },

      // called from init, parses individual stylesheets
      parseStylesheet:function(sheet) {
         // check sheet imports and parse those recursively
         if(sheet.imports) {
            try {
               var imports = sheet.imports, l = imports.length;
               for(var i=0; i<l; i++) {
                  this.parseStylesheet(sheet.imports[i]);
               }
            } catch(securityException){
               // trycatch for various possible errors,
               // todo; might need to be placed inside the for loop, since an error
               // on an import stops following imports from being processed.
            }
         }
         
         // interate the sheet's rules and send them to the parser
         try {
            var rules = sheet.rules, l = rules.length;
            for(var j=0; j<l; j++) {
               this.parseCSSRule(rules[j], sheet);
            }
         } catch(securityException){
            // trycatch for various errors, most likely accessing the sheet's rules,
            // don't see how individual rules would throw errors, but you never know.
         }
      },

      // magic starts here ...
      parseCSSRule:function(rule, sheet) {
         
         // The sheet is used to insert new rules into, this must be the same sheet the rule
         // came from, to ensure that relative paths keep pointing to the right location.

         // only parse a rule if it contains an interactive pseudo.
         var select = rule.selectorText;
         if(REG_INTERACTIVE.test(select)) {
            var style = rule.style.cssText,
               
               // affected elements are found by truncating the selector after the interactive pseudo,
               // eg: "div li:hover" >>  "div li"
               affected = REG_AFFECTED.exec(select)[1],
               
               // that pseudo is needed for a classname, and defines the type of interaction (focus, hover, active)
               // eg: "li:hover" >> "onhover"
               pseudo = select.replace(REG_PSEUDO, 'on$1'),
               
               // the new selector is going to use that classname in a new css rule,
               // since IE6 doesn't support multiple classnames, this is merged into one classname
               // eg: "li:hover" >> "li.onhover",  "li.folder:hover" >> "li.folderonhover"
               newSelect = select.replace(REG_SELECT, '.$2' + pseudo),
               
               // the classname is needed for the events that are going to be set on affected nodes
               // eg: "li.folder:hover" >> "folderonhover"
               className = REG_CLASS.exec(newSelect)[1];

            // no need to set the same callback more than once when the same selector uses the same classname
            var hash = affected + className;
            if(!this.callbacks[hash]) {

               // affected elements are given an expression under a fake css property, the classname is used
               // because a unique name (eg "behavior:") would be overruled (in IE6, not 7) by a following rule
               // selecting the same element. The expression does a callback to CSSHover.patch, rerouted via the
               // exposed window.CSSHover function.

               // because the expression is added to the stylesheet, and styles are always applied to html that is
               // dynamically added to the dom, the expression will also trigger for those new elements (provided
               // they are selected by the affected selector).

               sheet.addRule(affected, CSSHOVER_PREFIX + className + ':expression(CSSHover(this, "'+pseudo+'", "'+className+'"))');
               
               // hash it, so an identical selector/class combo does not duplicate the expression
               this.callbacks[hash] = true;
            }
           
            // duplicate expressions need not be set, but the style could differ
            sheet.addRule(newSelect, style);
         }
      },

      // called via the expression, patches individual nodes
      patch:function(node, type, className) {
         
         // the patch's type is returned to the expression. That way the expression property
         // can be found and removed, to stop it from calling patch over and over.
         // The if will fail the first time, since the expression has not yet received a value.
         var property = CSSHOVER_PREFIX + className;
         if(node.style[property]) {
            node.style[property] = null;
         }

         // just to make sure, also keep track of patched classnames locally on the node
         if(!node.csshover) node.csshover = [];

         // and check for it to prevent duplicate events with the same classname from being set
         if(!node.csshover[className]) {
            node.csshover[className] = true;

            // create an instance for the given type and class
            var element = new CSSHoverElement(node, type, className);
           
            // and store that instance for unloading later on
            this.elements.push(element);
         }

         // returns a dummy value to the expression
         return type;
      },

      // unload stuff onbeforeunload
      unload:function() {
         try {
           
            // remove events
            var l = this.elements.length;
            for(var i=0; i<l; i++) {
               this.elements[i].unload();
            }

            // and set properties to null
            this.elements = [];
            this.callbacks = {};

         } catch (e) {
         }
      }
   };

   // add the unload to the onbeforeunload event
   window.attachEvent('onbeforeunload', function(){
      CSSHover.unload();
   });

   /**
    *   CSSHoverElement
    *   --------------------------
    */

   // the event types associated with the interactive pseudos
   var CSSEvents = {
      onhover:  { activator: 'onmouseenter', deactivator: 'onmouseleave' },
      onactive: { activator: 'onmousedown',  deactivator: 'onmouseup' },
      onfocus:  { activator: 'onfocus',      deactivator: 'onblur' }
   };
   
   // CSSHoverElement constructor, called via CSSHover.patch
   function CSSHoverElement(node, type, className) {

      // the CSSHoverElement patches individual nodes by manually applying the events that should
      // have fired by the css pseudoclasses, eg mouseenter and mouseleave for :hover.

      this.node = node;
      this.type = type;
      var replacer = new RegExp('(^|\\s)'+className+'(\\s|$)', 'g');

      // store event handlers for removal onunload
      this.activator =   function(){ node.className += ' ' + className; };
      this.deactivator = function(){ node.className = node.className.replace(replacer, ' '); };
     
      // add the events
      node.attachEvent(CSSEvents[type].activator, this.activator);
      node.attachEvent(CSSEvents[type].deactivator, this.deactivator);
   }
   
   CSSHoverElement.prototype = {
      // onbeforeunload, called via CSSHover.unload
      unload:function() {

         // remove events
         this.node.detachEvent(CSSEvents[this.type].activator, this.activator);
         this.node.detachEvent(CSSEvents[this.type].deactivator, this.deactivator);

         // and set properties to null
         this.activator = null;
         this.deactivator = null;
         this.node = null;
         this.type = null;
      }
   };

   /**
    *   Public hook
    *   --------------------------
    */
   
   return function(node, type, className) {
      if(node) {
         // called via the css expression; patches individual nodes
         return CSSHover.patch(node, type, className);
      } else {
         // called ondomcontentready via the public:attach node
         CSSHover.init();
      }
   };

})();

// ]]>
</script>


Next create a new file and call it bbcode.php
Insert the following code and upload it.
Code: [Select]
<?php
function bb2html($text)
{
   
$pattern[] = "/\[url=([^<> \n]+?)\](.+?)\[\/url\]/i";
   
$replacement[] = '<a href="\\1" target="_blank">\\2</a>';
   
$pattern[] = "/\[url\](.+?)\[\/url\]/i";
   
$replacement[] = '<a href="\\1" target="_blank">\\1</a>';
   
$pattern[] = "/\[email=([^<> \n]+?)\](.+?)\[\/email\]/i";
   
$replacement[] = '<a href="mailto:\\1">\\2</a>';
   
$pattern[] = "/\[img[=]?(left|right)?\](([^<> \n]+?)\.(gif|jpg|jpeg|png|bmp))\[\/img\]/i";
   
$replacement[] = '<img src="\\2" border="0" align="\\1" alt="">';
   
$pattern[] = "/\[[bB]\](.+?)\[\/[bB]\]/s";
   
$replacement[] = '<b>\\1</b>';
   
$pattern[] = "/\[[iI]\](.+?)\[\/[iI]\]/s";
   
$replacement[] = '<i>\\1</i>';
   
$pattern[] = "/\[[uU]\](.+?)\[\/[uU]\]/s";
   
$replacement[] = '<u>\\1</u>';
   
$pattern[] = "/\[[pP]\](.+?)\[\/[pP]\]/s";
   
$replacement[] = '<p>\\1</p>';
   
$pattern[] = "/\[[sS]\](.+?)\[\/[sS]\]/s";
   
$replacement[] = '<s>\\1</s>';
   
$pattern[] = "/\[hr]/s";
   
$replacement[] = '<hr />';
   
$pattern[] = "/\[center](.+?)\[\/center\]/is";
   
$replacement[] = '<center>\\1</center>';
   
$pattern[] = "/\[align(=left|=right|=center|=justify)?\](.+?)\[\/align\]/is";
   
$replacement[] = '<div align\\1>\\2</div>';
   
$pattern[] = "/\[color=(#[A-F0-9]{6})\](.+?)\[\/color\]/is";
   
$replacement[] = '<font color="\\1">\\2</font>';
   
$pattern[] = "/\[link=([^<> \n]+?)\](.+?)\[\/link\]/i";
   
$replacement[] = '<a href="\\1">\\2</a>';
   
$pattern[] = "/\[nbsp]/s";
   
$replacement[] = '&nbsp;';
   
$pattern[] = "/\[div]/s";
   
$replacement[] = '<div class="hr">&nbsp;</div>';
   
$pattern[] = "/\[bp]/s";
   
$replacement[] = '<img src="icons/bullet.png" title="Bullet Point" align="middle" border="0"> ';
   
$pattern[] = "/\[arrow]/s";
   
$replacement[] = '<img src="icons/arrow.png" title="Arrow" align="middle" border="0"> ';
   
$pattern[] = "/\[ab=([^<> \n].+?)\](.+?)\[\/ab\]/i";
   
$replacement[] = '<abbr title="\\1">\\2</abbr>';   
   
$text preg_replace($pattern$replacement$text);
   return 
$text;
}
function 
strip_bbcode($text)
{
   
$pattern[] = "/\[url=([^<> \n]+?)\](.+?)\[\/url\]/i";
   
$pattern[] = "/\[email=([^<> \n]+?)\](.+?)\[\/email\]/i";
   
$pattern[] = "/\[img(=left|=right)?\](([^<> \n]+?)\.(gif|jpg|jpeg|png))\[\/img\]/i";
   
$pattern[] = "/\[[bB]\](.+?)\[\/[bB]\]/s";
   
$pattern[] = "/\[[iI]\](.+?)\[\/[iI]\]/s";
   
$pattern[] = "/\[[uU]\](.+?)\[\/[uU]\]/s";
   
$pattern[] = "/\[hr]/s";
   
$pattern[] = "/\[center](.+?)\[\/center\]/is";
   
$pattern[] = "/\[align(=left|=right|=center|=justify)?\](.+?)\[\/align\]/is";
   
$pattern[] = "/\[font(#[A-F0-9]{6})\](.+?)\[\/font\]/is";
   
$pattern[] = "/\[link=([^<> \n]+?)\](.+?)\[\/link\]/i";
   
$pattern[] = "/\[nbsp]/s";
   
$pattern[] = "/\[div]/s";
   
$pattern[] = "/\[bp]/s";
   
$text preg_replace($pattern''$text);
   return 
$text;
}
?>

Where your page includes or requires the globals add this.
Quote
require "bbcodestyle.css";
include "bbcode.php";

Now find
Quote
function mail_send()

And replace the whole function with
Code: [Select]
function mail_send()
{
global $ir,$c,$userid,$h;
$subj=str_replace(array("\n"),array("<br />"),strip_tags($_POST['subject']));

$msg=bb2html($_POST['message']);

$codes = array(":)", ";)", ":o", ":D", ":s", ":(", ":red", ":clown", ":bashful", ":x", ":green", ":|", ";(", ":]", ":horny",

":cool", ":heart");
$images  = array("<img src=smilies/smiley1.gif>", "<img src=smilies/smiley2.gif>", "<img src=smilies/smiley3.gif>", "<img

src=smilies/smiley4.gif>", "<img src=smilies/smiley5.gif>", "<img src=smilies/smiley6.gif>", "<img

src=smilies/smiley7.gif>", "<img src=smilies/smiley8.gif>", "<img src=smilies/smiley9.gif>", "<img

src=smilies/smiley10.gif>", "<img src=smilies/smiley11.gif>", "<img src=smilies/smiley12.gif>", "<img

src=smilies/smiley13.gif>", "<img src=smilies/smiley14.gif>", "<img src=smilies/smiley15.gif>", "<img

src=smilies/smiley16.gif>", "<img src=smilies/heart.gif>");
$newmsg = str_replace($codes, $images, $msg);
$to= (int) $_POST['userid'];
mysql_query("INSERT INTO mail VALUES ('',0,$userid,$to,unix_timestamp(),'$subj','$newmsg')",$c) or die(mysql_error());
print "Message sent.<br />
<a href='mailbox.php'>&gt; Back</a>";
}
Logged

03laceys

  • Basic Member
  • *
  • Reputation Power: 0
  • 03laceys has no influence.
  • Offline Offline
  • Posts: 34
    • View Profile
    • Email
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #1 on: March 03, 2009, 06:58:24 PM »
Now find.
Code: [Select]
function mail_compose()
And replace whole function with
Code: [Select]
function mail_compose()
{
global $ir,$c,$userid,$h;
echo <<< EOF
<script type="text/javascript">
function insert(el,ins) {
if (el.setSelectionRange){
el.value = el.value.substring(0,el.selectionStart) + ins + el.value.substring(el.selectionStart,el.selectionEnd) +

el.value.substring(el.selectionEnd,el.value.length);
}
else if (document.selection && document.selection.createRange) {
el.focus();
var range = document.selection.createRange();
range.text = ins + range.text;
}
}
</script>
<form action='mailbox.php?action=send' method='post'>
<table width=75% border=2> <tr>
<td>ID to send to:</td> <td><input type='text' name='userid' value='{$_GET['ID']}'/></td></tr><tr>
<td>Subject:</td> <td><input type='text' name='subject'/></td></tr><tr>
<td>Message:</td>
<td>
<center>
<input type="button" class="bbcode_hover" onClick="insert(this.form.message,'[b][/b]'); return false;" value="" />
<input type="button" class="bbcode_hover1" onClick="insert(this.form.message,'[i][/i]'); return false;" value="" />
<input type="button" class="bbcode_hover2" onClick="insert(this.form.message,'[u][/u]'); return false;" value="" />
<input type="button" class="bbcode_hover3" onClick="insert(this.form.message,'[url][/url]'); return false;" value="" />
<input type="button" class="bbcode_hover4" onClick="insert(this.form.message,'[s][/s]'); return false;" value="" />
<input type="button" class="bbcode_hover5" onClick="insert(this.form.message,'[img][/img]'); return false;" value="" />
<input type="button" class="bbcode_hover6" onClick="insert(this.form.message,'[center][/center]'); return false;" value="" />
<input type="button" class="bbcode_hover7" onClick="insert(this.form.message,'[color=#xxxxxx][/color]'); return false;"

value="" />
<textarea name='message' rows='10' cols='70' style='color: black; background-color: white'></textarea><br />
<input type="image" src="smilies/smiley1.gif" alt="Smile" title="smile" onclick="insert(this.form.message,':)'); return false;" />
<input type="image" src="smilies/smiley2.gif" alt="Wink" title="Wink" onclick="insert(this.form.message,';)'); return false;" />
<input type="image" src="smilies/smiley3.gif" alt="Suprised" title="Suprised" onclick="insert(this.form.message,':o'); return false;" />
<input type="image" src="smilies/smiley4.gif" alt="Cheesy Grin" title="Cheesy Grin" onclick="insert(this.form.message,':D'); return false;" />
<input type="image" src="smilies/smiley5.gif" alt="Confused" title="Confused" onclick="insert(this.form.message,':s'); return false;" />
<input type="image" src="smilies/smiley6.gif" alt="Sad" title="Sad" onclick="insert(this.form.message,':('); return false;" />
<input type="image" src="smilies/smiley7.gif" alt="Angry" title="Angry" onclick="insert(this.form.message,':red'); return false;" />
<input type="image" src="smilies/smiley8.gif" alt="Clown" title="Clown" onclick="insert(this.form.message,':clown'); return false;" />
<input type="image" src="smilies/smiley9.gif" alt="Embarrassed" title="Embarrassed" onclick="insert(this.form.message,':bashful'); return false;" />
<input type="image" src="smilies/smiley10.gif" alt="Star" title="Star" onclick="insert(this.form.message,':x'); return false;" />
<input type="image" src="smilies/smiley11.gif" alt="Sick" title="Sick" onclick="insert(this.form.message,':green'); return false;" />
<input type="image" src="smilies/smiley12.gif" alt="Bored" title="Bored" onclick="insert(this.form.message,':|'); return false;" />
<input type="image" src="smilies/smiley13.gif" alt="Begging" title="Begging" onclick="insert(this.form.message,';('); return false;" />
<input type="image" src="smilies/smiley14.gif" alt="Smug" title="Smug" onclick="insert(this.form.message,':]'); return false;" />
<input type="image" src="smilies/smiley15.gif" alt="Horny" title="Horny" onclick="insert(this.form.message,':horny'); return false;" />
<input type="image" src="smilies/smiley16.gif" alt="Cool" title="Cool" onclick="insert(this.form.message,':cool'); return false;" />
<input type="image" src="smilies/heart.gif" alt="Heart" title="Heart" onclick="insert(this.form.message,':heart'); return false;" /></center>
</td></tr><tr>
</td></tr><td colspan=2><input type='submit' value='Send' class='btn'></td></tr></table></form>
EOF;
if($_GET['ID'])
{
print "<br /><table width=75% border=2><tr><td colspan=2><b>Your last 5 mails to/from this person:</b></td></tr>";
$q=mysql_query("SELECT m.*,u1.username as sender from mail m left join users u1 on m.mail_from=u1.userid WHERE

(m.mail_from=$userid AND m.mail_to={$_GET['ID']}) OR (m.mail_to=$userid AND m.mail_from={$_GET['ID']}) ORDER BY m.mail_time

DESC LIMIT 5",$c);
while($r=mysql_fetch_array($q))
{
$sent=date('F j, Y, g:i:s a',$r['mail_time']);
print "<tr><td>$sent</td> <td><b>{$r['sender']} wrote:</b> {$r['mail_text']}</td></tr>";
}
}
OUT;
$h->endpage();
}

Images

Screenshots



Preview

Username: test
Password: test
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #2 on: March 03, 2009, 07:06:02 PM »
Very nice laceys, has it all been secured as well?
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

03laceys

  • Basic Member
  • *
  • Reputation Power: 0
  • 03laceys has no influence.
  • Offline Offline
  • Posts: 34
    • View Profile
    • Email
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #3 on: March 03, 2009, 07:22:19 PM »
Very nice laceys, has it all been secured as well?

Unfortunatly not for my game it is but this is only due to i calling a function to secure in mailbox which i am unable to post for free as it was a paid mod.
Logged

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #4 on: March 03, 2009, 08:37:29 PM »
Well then perhaps someone can come up with a secured version. =)
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

Twist3d Fat3

  • Basic Member
  • *
  • Reputation Power: 52
  • Twist3d Fat3 has no influence.
  • Offline Offline
  • Posts: 42
    • View Profile
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #5 on: June 08, 2009, 07:09:21 AM »
It didn't work. Can you see If you can see where I messed up, The mailbox Is still working normal Just no smiley's







Code: [Select]
<?php
require "globals.php";
require 
"bbcodestyle.css";
include 
"bbcode.php";
print 
"
<h1>Mailbox</h1><hr width='90%' align='left' />"
;
if(
$ir['mailban']) {
die(
"<h1><prb>! ERROR</prb></h1>
<prb>You have been mail banned for {$ir['mailban']} days.<br /><br />
<b>Reason: {$ir['mb_reason']}</prb></b><hr width='90%' align='left' />"
);
}
$_GET['ID'] = abs((int) $_GET['ID']);
print 
"
<table width=90% class='table' cellspacing='1'><tr>
<td width='33%'><a href='mailbox.php?action=inbox'><ph3><pgb>[</pgb>Inbox<pgb>]</pgb></ph3></a></td>
<td width='33%'><a href='mailbox.php?action=outbox'><ph3><pgb>[</pgb>Sent Messages<pgb>]</pgb></ph3></a></td>
<td width='33%'><a href='mailbox.php?action=compose'><ph3><pgb>[</pgb>Compose Message<pgb>]</pgb></ph3></a></td>
</tr><tr>
<td width='33%'><a href='mailbox.php?action=delall'><ph3><pgb>[</pgb>Delete All Messages<pgb>]</pgb></ph3></a></td>
<td width='33%'><a href='mailbox.php?action=archive'><ph3><pgb>[</pgb>Archive Messages<pgb>]</pgb></ph3></a></td>
<td width='33%'><a href='contactlist.php'><ph3><pgb>[</pgb>Contacts<pgb>]</pgb></ph3></a></td>
</tr></table>"
;
switch(
$_GET['action']) {
case 'inbox':
mail_inbox();
break;
case 'outbox':
mail_outbox();
break;
case 'compose':
mail_compose();
break;
case 'delete':
mail_delete();
break;
case 'send':
mail_send();
break;
case 'delall':
mail_delall();
break;
case 'delall2':
mail_delall2();
break;
case 'archive':
mail_archive();
break;
default:
mail_inbox();
break;
}






function 
mail_inboxoriginal() {
global 
$db,$ir,$c,$userid,$h;
print 
"
<table width='90%' class='table'>
<tr><th width=25%><ph2>From</ph2></th>
<th width='60%'><ph2>Subject/Message</ph2></th>
<th wiidth='15%'><ph2>Links</ph2></th></tr>
"
;
$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 25");
while(
$r=$db->fetch_row($q)) {
$sent=date('F j, Y, g:i:s a',$r['mail_time']);
print "<tr><td><hr />";
if($r['userid']) {
print "<a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]";
}
else {
print "SYSTEM";
}
$fm=urlencode($r['mail_text']);
print "</td>
<td><hr />Subject: {$r['mail_subject']}</td>
<td valign='top'><hr /></td>
</tr><tr>
<td>Sent at: {$sent}<br /></td>
<td class='tdleft'>{$r['mail_text']}</td>
<td><a href='mailbox.php?action=compose&ID={$r['userid']}'><pgb>[</pgb>Reply<pgb>]</pgb></a><br />
<a href='mailbox.php?action=delete&ID={$r['mail_id']}'><pgb>[</pgb>Delete<pgb>]</pgb></a><br />
<a href='preport.php?ID={$r['userid']}&amp;report=Fradulent mail: {$fm}'><pgb>[</pgb>Report<pgb>]</pgb></a>
</td></tr><tr></tr>
"
;
}
if(
$ir['new_mail'] > 0)
{
$db->query("UPDATE mail SET mail_read=1 WHERE mail_to=$userid");
$db->query("UPDATE users SET new_mail=0 WHERE userid=$userid");
}
print 
"</table><hr width='90%' align='left' /><br /><br />";
}
















function 
mail_inbox() {
global $db,$ir,$c,$userid,$h;
$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_from=u.userid WHERE m.mail_to=$userid ORDER BY mail_time DESC LIMIT 25");
while($r=$db->fetch_row($q)) {
print "<hr width='90%' align='left' /><div class='mailbox'>";
$sent=date('F j, Y, g:i:s a',$r['mail_time']);
$subj=$r['mail_subject'];
if($r['userid']) {
print "<pgb>From: </pgb><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]";
}
else {
print "<pgb>From: </pgb>SYSTEM";
}
$fm=urlencode($r['mail_text']);
print "<br /><pgb>Subject: </pgb>";
if($subj) { 
print "$subj<br />";
}
else {
print "None<br />";
}
print "Sent at: {$sent}<br />
{$r['mail_text']}<br />
<a href='mailbox.php?action=compose&ID={$r['userid']}'><pgb>[</pgb>Reply<pgb>]</pgb></a>&nbsp;&nbsp;
<a href='mailbox.php?action=delete&ID={$r['mail_id']}'><pgb>[</pgb>Delete<pgb>]</pgb></a>&nbsp;&nbsp;
<a href='preport.php?ID={$r['userid']}&amp;report=Fradulent mail: {$fm}'><pgb>[</pgb>Report<pgb>]</pgb></a>
</div>"
;
}
if($ir['new_mail'] > 0) {
$db->query("UPDATE mail SET mail_read=1 WHERE mail_to=$userid");
$db->query("UPDATE users SET new_mail=0 WHERE userid=$userid");
}
}



















function 
mail_outbox()
{
global 
$db,$ir,$c,$userid,$h;
print 
"
<p>Only the last 25 messages you have sent are visible.</p><br />
<table width=85% cellspacing=1 class='table2'><tr><th width=25%>To</th><th>Subject/Message</th></tr>"
;
$q=$db->query("SELECT m.*,u.* FROM mail m LEFT JOIN users u ON m.mail_to=u.userid WHERE m.mail_from=$userid ORDER BY mail_time DESC LIMIT 25");
while(
$r=$db->fetch_row($q))
{
$sent=date('F j, Y, g:i:s a',$r['mail_time']);
print 
"<tr><td><a href='viewuser.php?u={$r['userid']}'>{$r['username']}</a> [{$r['userid']}]</td><td>Subject: {$r['mail_subject']}</td></tr><tr><td>Sent at: $sent<br /></td><td>{$r['mail_text']}</td></tr>";
}

}
function 
mail_compose()
{
global 
$ir,$c,$userid,$h;
echo <<< EOF
<script type="text/javascript">
function insert(el,ins) {
if (el.setSelectionRange){
el.value = el.value.substring(0,el.selectionStart) + ins + el.value.substring(el.selectionStart,el.selectionEnd) +

el.value.substring(el.selectionEnd,el.value.length);
}
else if (document.selection && document.selection.createRange) {
el.focus();
var range = document.selection.createRange();
range.text = ins + range.text;
}
}
</script>
<form action='mailbox.php?action=send' method='post'>
<table width=75% border=2> <tr>
<td>ID to send to:</td> <td><input type='text' name='userid' value='
{$_GET['ID']}'/></td></tr><tr>
<td>Subject:</td> <td><input type='text' name='subject'/></td></tr><tr>
<td>Message:</td>
<td>
<center>
<input type="button" class="bbcode_hover" onClick="insert(this.form.message,'[b][/b]'); return false;" value="" />
<input type="button" class="bbcode_hover1" onClick="insert(this.form.message,'[i][/i]'); return false;" value="" />
<input type="button" class="bbcode_hover2" onClick="insert(this.form.message,'[u][/u]'); return false;" value="" />
<input type="button" class="bbcode_hover3" onClick="insert(this.form.message,'[url][/url]'); return false;" value="" />
<input type="button" class="bbcode_hover4" onClick="insert(this.form.message,'[s][/s]'); return false;" value="" />
<input type="button" class="bbcode_hover5" onClick="insert(this.form.message,'[img][/img]'); return false;" value="" />
<input type="button" class="bbcode_hover6" onClick="insert(this.form.message,'[center][/center]'); return false;" value="" />
<input type="button" class="bbcode_hover7" onClick="insert(this.form.message,'[color=#xxxxxx][/color]'); return false;"

value="" />
<textarea name='message' rows='10' cols='70' style='color: black; background-color: white'></textarea><br />
<input type="image" src="smilies/smiley1.gif" alt="Smile" title="smile" onclick="insert(this.form.message,':)'); return false;" />
<input type="image" src="smilies/smiley2.gif" alt="Wink" title="Wink" onclick="insert(this.form.message,';)'); return false;" />
<input type="image" src="smilies/smiley3.gif" alt="Suprised" title="Suprised" onclick="insert(this.form.message,':o'); return false;" />
<input type="image" src="smilies/smiley4.gif" alt="Cheesy Grin" title="Cheesy Grin" onclick="insert(this.form.message,':D'); return false;" />
<input type="image" src="smilies/smiley5.gif" alt="Confused" title="Confused" onclick="insert(this.form.message,':s'); return false;" />
<input type="image" src="smilies/smiley6.gif" alt="Sad" title="Sad" onclick="insert(this.form.message,':('); return false;" />
<input type="image" src="smilies/smiley7.gif" alt="Angry" title="Angry" onclick="insert(this.form.message,':red'); return false;" />
<input type="image" src="smilies/smiley8.gif" alt="Clown" title="Clown" onclick="insert(this.form.message,':clown'); return false;" />
<input type="image" src="smilies/smiley9.gif" alt="Embarrassed" title="Embarrassed" onclick="insert(this.form.message,':bashful'); return false;" />
<input type="image" src="smilies/smiley10.gif" alt="Star" title="Star" onclick="insert(this.form.message,':x'); return false;" />
<input type="image" src="smilies/smiley11.gif" alt="Sick" title="Sick" onclick="insert(this.form.message,':green'); return false;" />
<input type="image" src="smilies/smiley12.gif" alt="Bored" title="Bored" onclick="insert(this.form.message,':|'); return false;" />
<input type="image" src="smilies/smiley13.gif" alt="Begging" title="Begging" onclick="insert(this.form.message,';('); return false;" />
<input type="image" src="smilies/smiley14.gif" alt="Smug" title="Smug" onclick="insert(this.form.message,':]'); return false;" />
<input type="image" src="smilies/smiley15.gif" alt="Horny" title="Horny" onclick="insert(this.form.message,':horny'); return false;" />
<input type="image" src="smilies/smiley16.gif" alt="Cool" title="Cool" onclick="insert(this.form.message,':cool'); return false;" />
<input type="image" src="smilies/heart.gif" alt="Heart" title="Heart" onclick="insert(this.form.message,':heart'); return false;" /></center>
</td></tr><tr>
</td></tr><td colspan=2><input type='submit' value='Send' class='btn'></td></tr></table></form>
EOF;
if(
$_GET['ID'])
{
print 
"<br /><table width=75% border=2><tr><td colspan=2><b>Your last 5 mails to/from this person:</b></td></tr>";
$q=mysql_query("SELECT m.*,u1.username as sender from mail m left join users u1 on m.mail_from=u1.userid WHERE

(m.mail_from=$userid AND m.mail_to={$_GET['ID']}) OR (m.mail_to=$userid AND m.mail_from={$_GET['ID']}) ORDER BY m.mail_time

DESC LIMIT 5"
,$c);
while(
$r=mysql_fetch_array($q))
{
$sent=date('F j, Y, g:i:s a',$r['mail_time']);
print 
"<tr><td>$sent</td> <td><b>{$r['sender']} wrote:</b> {$r['mail_text']}</td></tr>";
}
}
OUT;
$h->endpage();
}
function 
mail_send()
{
global 
$ir,$c,$userid,$h;
$subj=str_replace(array("\n"),array("<br />"),strip_tags($_POST['subject']));

$msg=bb2html($_POST['message']);

$codes = array(":)"";)"":o"":D"":s"":("":red"":clown"":bashful"":x"":green"":|"";("":]"":horny",

":cool"":heart");
$images  = array("<img src=smilies/smiley1.gif>""<img src=smilies/smiley2.gif>""<img src=smilies/smiley3.gif>""<img

src=smilies/smiley4.gif>"
"<img src=smilies/smiley5.gif>""<img src=smilies/smiley6.gif>""<img

src=smilies/smiley7.gif>"
"<img src=smilies/smiley8.gif>""<img src=smilies/smiley9.gif>""<img

src=smilies/smiley10.gif>"
"<img src=smilies/smiley11.gif>""<img src=smilies/smiley12.gif>""<img

src=smilies/smiley13.gif>"
"<img src=smilies/smiley14.gif>""<img src=smilies/smiley15.gif>""<img

src=smilies/smiley16.gif>"
"<img src=smilies/heart.gif>");
$newmsg str_replace($codes$images$msg);
$to= (int) $_POST['userid'];
mysql_query("INSERT INTO mail VALUES ('',0,$userid,$to,unix_timestamp(),'$subj','$newmsg')",$c) or die(mysql_error());
print 
"Message sent.<br />
<a href='mailbox.php'>&gt; Back</a>"
;
}
function 
mail_delete()
{
global 
$db,$ir,$c,$userid,$h;
$db->query("DELETE FROM mail WHERE mail_id={$_GET['ID']} AND mail_to=$userid");
print 
"Message deleted.<br />
<a href='mailbox.php'>&gt; Back</a>"
;
}
function 
mail_delall()
{
global 
$ir,$c,$userid,$h;
print 
"This will delete all the messages in your inbox.<br />
There is <b>NO</b> undo, so be sure.<br />
<a href='mailbox.php?action=delall2'>&gt; Yes, delete all messages</a><br />
<a href='mailbox.php'>&gt; No, go back</a>"
;
}
function 
mail_delall2()
{
global 
$db,$ir,$c,$userid,$h;
$db->query("DELETE FROM mail WHERE mail_to=$userid");
print 
"All ".$db->affected_rows()." mails in your inbox were deleted.<br />
<a href='mailbox.php'>&gt; Back</a>"
;
}
function 
mail_archive()
{
global 
$ir,$c,$userid,$h;
print 
"This tool will download an archive of all your messages.<br />
<a href='dlarchive.php?a=inbox'>&gt; Download Inbox</a><br />
<a href='dlarchive.php?a=outbox'>&gt; Download Outbox</a>"
;
}
$h->endpage();
?>
Logged

Markwickk

  • Basic Member
  • *
  • Reputation Power: 15
  • Markwickk has no influence.
  • Offline Offline
  • Posts: 1
    • View Profile
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #6 on: September 29, 2010, 09:56:24 AM »
Does anyone have the images for this ? Id be very greatful if you could post them up or add me on msn to send them to me, thanks
thedeadmafia@hotmail.co.uk <--- MSN
Logged

Grips

  • Basic Member
  • *
  • Reputation Power: 30
  • Grips has no influence.
  • Offline Offline
  • Posts: 7
    • View Profile
    • Email
Re: [All versions] Mailbox clickable bbcode and smilies
« Reply #7 on: October 02, 2010, 10:16:03 AM »
I tried to track this down myself but was unable could you let me know if you get these?  I would love to get my hands on them too!!

ddugas@comcast.net is my MSN.
Logged
 


This forum is now closed and has moved to a new location! Click here to find out why.