Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#552 Re: User Discussion & Help » How to use a form inside Xinha? » 2005-12-18 09:00:37

As per the HTML specification, the contents of a textarea (and thus, xinha area) are Parsed Character Data.  All HTML tags are  forbidden to occur in a textarea.  You must ENTIZE (ie convert special characters to thier relevant entities (ampersand codes)) all data you place into a textarea, including HTML which will be edited with Xinha.

#553 Re: User Discussion & Help » Howto to enable and disable xinha editor object via javascript? » 2005-12-14 22:10:56

you need a

xinha_editors.yourEditor.activateEditor()

I'm guessing ?

#554 Re: User Discussion & Help » Xinha as a Firefox Plugin » 2005-12-13 08:03:50

Good job hyper!  Looks like it would be a really useful extention.  I think the posters over at fark would really like that.

#555 Re: User Discussion & Help » First Line in Textarea » 2005-12-12 20:59:22

My feeling is that it is a gecko bug, or actualy it could be a side-effect of EnterParagraphs plugin (usually loaded automatically in Xinha when running on Gecko).

If you submit a bug report about this, I will look more closely and see about cleaning it up client-side.

#556 Re: User Discussion & Help » First Line in Textarea » 2005-12-12 08:30:13

It's the way Gecko does it.  Just clean it up server side.

#557 Re: User Discussion & Help » Integrate ImageManager into TableOperations (or any other plugin) » 2005-12-12 08:28:27

I see.  No.  Not currently, that is not possible.  Patches are welcome though, seems like a good idea.

#558 Re: User Discussion & Help » Xinha secretly loading plugins? » 2005-12-11 04:01:00

You're probably missing FullScreen and EnterParagraphs.

#559 Re: User Discussion & Help » ray » 2005-12-11 03:59:31

GetHtml provides a speedier means of taking the HTML from Xinha and putting it back into your editor before you submit the form or switch to "source" mode.  The built in method works by traversing the DOM of the html being edited, which is a fairly slow operation, but easy to read/understand, maintain and modify, while GetHtml works with a bunch of regular expressions and such, which is fast, but more difficult to code.

#560 Re: User Discussion & Help » Integrate ImageManager into TableOperations (or any other plugin) » 2005-12-09 20:21:17

I think it's simply people don't understand the question.  Try re-explaining it.

#561 Re: User Discussion & Help » Howto to enable and disable xinha editor object via javascript? » 2005-12-09 20:19:27

In xinha_init, comment out the startEditors line.

Then to start the individual editors, after running xinha_init, you can do

 

xinha_editors.yourEditorIdHere.generate();

for each one.

#562 Re: User Discussion & Help » Changing Case (Upper to Lower, etc.)? » 2005-12-09 07:46:16

Plugins are welcome :-)

That said.  Why are you using Xinha to edit text that cannot contain HTML, that's pretty crazy.

#563 Re: User Discussion & Help » Image Manager for Different Servers » 2005-12-09 07:44:45

Cannot be done.  Not without you modifying the ImageManager to do it.

#564 Re: User Discussion & Help » Howto to enable and disable xinha editor object via javascript? » 2005-12-09 07:44:08

activateEditor just switches on the designMode functions. 

There is no reason you can't initialize your xinha editors one at a time as and when they are first displayed, you'll have to learn some Javascript to do it though.  Just read through the initialization code in the newbie guide and go from there.

I don't know of any way of trapping visible/invisible events in the DOM.

#565 Re: User Discussion & Help » Howto to enable and disable xinha editor object via javascript? » 2005-12-06 21:05:29

Random: are you doing activateEditor and deactivateEditor at the appropriate times?  You must deactivate before changing the visibility and activate after restoring (or if you just leave it deactiveated it will activate when you click in it).

#566 Re: User Discussion & Help » Changing Case (Upper to Lower, etc.)? » 2005-12-06 21:03:28

The CSS directive text-transform is what you should use
  http://www.w3schools.com/css/pr_text_text-transform.asp
in conjunction with Stylist/CSS/DynamicCSS plugins this should do what you want.

#567 Re: User Discussion & Help » Howto to enable and disable xinha editor object via javascript? » 2005-12-05 11:01:36

No, you would have to initialize it on first display.  This is due to a bug in either gecko or IE, I forget which, which means that getting sizes and such is not possible when elements are set to display:none (well, not strictly a bug, because if it's display:none then it has no size!).

No reason you can't initialize your editor(s) on first display instead of onload though - but it's left as an excercise in javascript for you :-)

#568 Re: User Discussion & Help » First Time Installation Problem » 2005-11-30 21:14:58

Your URL works fine for me in Firefox 1.0.6.

should the xinha directory be w/in your httpdocs folder

Inside, the browser loads files from it.

#569 Re: User Discussion & Help » First Time Installation Problem » 2005-11-29 22:40:49

If you can post a URL to your install we can have a look.

#570 Re: User Discussion & Help » Xinha corrupts backslashes » 2005-11-28 22:33:59

When I am developing in PHP, I do it in my own framework.  The first thing my framework does, on every request, is clean_magic_quotes().  Reason is simple, I don't want PHP silently ("magically") changing my data by adding slashes to it, or you get into situations like these where you don't know what is escaped and whats not and wether you need to strip or add or ....

This is just one of the reasons that magic_quotes_gpc is probably going to be removed for PHP 6 :-)

#572 Re: User Discussion & Help » How to set editor smaller? » 2005-11-28 11:12:31

I don't remember writing in a specific minimum (and a quick search of the code reveals nothing), but there will be a practical minimum, particularly a minimum width dictated by the toolbar, height not so much.  I doubt you'd get it much smaller than 100x100, that's pretty small right there.

You could try leaving height & width to the defaults ('auto') and setting the size on the textarea

<textarea style="width:100px;height:100px"></textarea>

#573 Re: User Discussion & Help » Xinha corrupts backslashes » 2005-11-28 05:23:18

Ok, some PHP 101, this code (incomplete of course) shows how one might handle modifying a record of a database table..

<?php
  // ... connect to database etc ...
 
  // First, get rid of magic quotes if they were added in, magic quotes are evil
  if(get_magic_quotes_gpc())
 {
   foreach(array_keys($_REQUEST) as $k)
  {
    if(!is_scalar($_REQUEST[$k])) continue;
    $_REQUEST[$k] = stripslashes($_REQUEST[$k]);
  }
 }

  // Now was the form submitted?
  if(isset($_REQUEST['Submit']))
  { 
     // Yes, lets update the data 
     mysql_query("UPDATE Blah SET FOO = '" . mysql_real_escape_string($_REQUEST['FOO']) 
                     . "' WHERE BlahID = " . ((int) $_REQUEST['BlahID']));
  }

  // We presume we were given BlahID on the request, lets get the value
  $q = mysql_query("SELECT FOO From Blah where BlahID = " . ((int) $_REQUEST['BlahID']));
  $r = mysql_fetch_assoc($q);
  $FOO = $r['FOO'];
  

  // Lets display a form, if FOO was submitted already, lets put that in the value for example sake
  ?>
 <form action="<?php echo $PHP_SELF ?>" method="post">
   <input type="hidden" name="BlahID" value="<?php echo htmlspecialchars($_REQUEST['BlahID']) ?>" />
   <textarea name="FOO"><?php echo htmlspecialchars($FOO) ?></textarea>
   <input type="submit" name="Submit" value="Submit" />
 </form>

See how we stripslashes from the request variables if magic quotes has been turned on (the procedure above is just a trivial example, you should use a better one because REQUEST could contain arrays of values of course), we escape the string value being put into the SQL, and we cast the BlahID to an int to be sure that we don't put in anything nasty from the user.  Then when writing out the form we use htmlspecialchars to "escape" the special characters both for the value="" attribute and inside the textarea, which are both #PCDATA (see HTML specification).


Here is a better function for cleaning up after magic quotes does it's dirty business...

    function clean_magic_quotes()
    {
      set_magic_quotes_runtime(0);
      if(get_magic_quotes_gpc())
      {
        // trigger_error('Magic Quotes GPC is on, cleaning GPC.', E_USER_NOTICE);
        $to_clean = array(&$_GET, &$_POST, &$_REQUEST, &$_COOKIE);
        while(count($to_clean))
        {
          $cleaning =& $to_clean[array_pop($junk = array_keys($to_clean))];
          unset($to_clean[array_pop($junk = array_keys($to_clean))]);
          foreach(array_keys($cleaning) as $k)
          {
            if(is_array($cleaning[$k]))
            {
              $to_clean[] =& $cleaning[$k];
            }
            else
            {
              $cleaning[$k] = stripslashes($cleaning[$k]);
            }
          }
        }
      }
    }

#574 User Discussion & Help » Preliminary Opera Support » 2005-11-28 00:01:37

gogo
Replies: 2

Hi all, a little treat for you this week...

Opera (http://www.opera.com/) has recently (well, a month ago) released a preview of Version 9 of thier browser.  In this version they now have an API for HTML editing.  Mostly it works just like Gecko ("designMode" style).

I've made some preliminary modifications to Xinha to get it to "boot up" in Opera.  If you're interested in playing around with it, or better, helping making it work better in Opera, you can checkout the "opera" branch from the subversion repository, and just hit examples/full_example.html like normal.

It actually works impressivly well for only a couple of modifications, there's lots of bugs for sure, but it is basically working.

Oh yea, for now I'd have Opera identify as Mozilla.

You can download the Version 9 preview of Opera with support for this at http://snapshot.opera.com/

#575 Re: User Discussion & Help » Xinha corrupts backslashes » 2005-11-27 22:06:45

If you are escaping, and still have magic_quotes on, then you're going to be double escaping.  Sounds also like you might not be using htmlspecialchars()/htmlentities() in the appropriate places.

Board footer

Powered by FluxBB