Re: [PHP] If Column Exists

2008-08-17 Thread Luke
There is IF EXISTS for tables, is there the same thing for columns in the
table
like

IF EXISTS column IN TABLE table

? Just an idea

2008/8/13 VamVan <[EMAIL PROTECTED]>

> Interesting. Thanks guys!!
>
> On Wed, Aug 13, 2008 at 1:32 AM, Robin Vickery <[EMAIL PROTECTED]> wrote:
>
> > 2008/8/12 VamVan <[EMAIL PROTECTED]>:
> > > Hello,
> > >
> > > I am working on data migration for one mysql db to another using PHP.
> How
> > do
> > > I check if a particular table has a particular column. If not alter...
> > >
> > > Thanks
> > >
> >
> > Use the information_schema:
> >
> > SELECT COUNT(*) AS column_exists FROM information_schema.COLUMNS WHERE
> > TABLE_SCHEMA='db_name' AND TABLE_NAME='table_name' AND
> > COLUMN_NAME='column_name';
> >
> > -robin
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
Luke Slater


Re: [PHP] Re: SOAP - return a list of items

2008-08-17 Thread Luke
why use soap for this? I just use a javascript array for this kind of
thing...

2008/8/13 Dan Joseph <[EMAIL PROTECTED]>

> Maybe more info will help:
>
> Here is what I have so far for the WSDL...
>
>
>
>
>
>
>
>
>
>
>
>
> type="tns:ArrayOfgetQuoteHistoryResult" />
>
>
>
>
>
> name="getQuoteHistoryResult" nillable="true"
> type="tns:getQuoteHistoryResult" />
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> This validates fine in soapUI, and seems to work fine when the client
> connects to it.
>
> The piece from PHP:
>
>$count = 0;
>
>while ( $data = $this->dbconn->fetchrow( $res ) )
>{
>foreach ( $data as $key => $value )
>{
>$quotes[$count][$key] = $value;
>}
>
>$count++;
>}
>
> return $quotes;
>
> This is the soap response:
>
> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/"; xmlns:ns1="urn:ursquoteservice"
> xmlns:ns2="urn:ursquote" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="
> http://schemas.xmlsoap.org/soap/encoding/";>
>   
>  
> 
>  
>   
> 
>
> It seems like I am just missing something somewhere.
>
> Anyone able to help?
>
> --
> -Dan Joseph
>
> www.canishosting.com - Plans start @ $1.99/month.
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
>



-- 
Luke Slater


[PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor

2008-08-17 Thread AmirBehzad Eslami
Dear list,

I'm looking for a light weight WYSIWYG HTML Editor to allow
users to send private messages to each other in a forum application.

FCKEditor is too complex and very huge for my purposes. I want a
simple editor. What do you recommend?

Thanks in advance
-- 
Kind regards,
-behzad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor

2008-08-17 Thread Ashley Sheridan
I've always found FCKEditor to be pretty handy. There is an option to
set it to a simple mode, giving only the bold, italic, underlined and
link buttons, and this is extendable to include only the buttons you
need. It's an absolute doddle to implement in a web app as well; I've
used it for several projects at work. What sort of functionality were
you looking for?


Ash
www.ashleysheridan.co.uk
--- Begin Message ---
Dear list,

I'm looking for a light weight WYSIWYG HTML Editor to allow
users to send private messages to each other in a forum application.

FCKEditor is too complex and very huge for my purposes. I want a
simple editor. What do you recommend?

Thanks in advance
-- 
Kind regards,
-behzad

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Licensing

2008-08-17 Thread tedd

At 3:34 PM +0100 8/16/08, Richard Heyes wrote:

Hi,

Don't think me a money grabbing bast (well, I guess I am...) but I'd
just like to know if you've got any input on trying to get people to
cough up some readies in return for the mounds of free code I give
away. I've updated my licensing page just now, and hopefully this will
convince more people to buy one:
http://www.phpguru.org/static/license.html

Thanks for any pointers.

--
Richard Heyes


Richard:

No offense, but you asked for pointers.

I can tell you're a programmer and not a marketer.

While your license makes sense to you, the 
typical person will come away with "Okay, if I 
see something I want, I'm not sure what to do. I 
guess that I'll have to read the license again."


Instead, use a two or three tiered licensing scheme, something like this.

General Purpose
Unlimited
Commercial

And briefly describe what each one will Do for 
your customer -- IOW, don't dwell on what it 
doesn't cover and be specific and enthused on 
what it does.


You see, in your current description you jump 
back and forth between what's covered and what's 
not. After reading your write-up I'm still not 
sure I could use your "multiple select Javascript 
/ CSS plugin" if I bought a commercial license or 
not. That's not good.


You want it to be easy for customers to 
understand and purchase your licenses -- remember 
half the population is below average 
intelligence. Considering you're trying to sell 
to programmers, then figure may even be a bit 
higher. So keep it simple.


Also, if I do decide to buy a license -- what's 
£49 is US dollars? How do I pay you? Do you 
accept PayPal, Credit Cards or do I send you a 
goat and two chickens? If you want people to pay 
you, then give them the opportunity and make it 
obvious.


Oh, I just looked at your page again and on my 
*third* read, I finally see that you do offer 
PayPal. Why didn't I catch that the first time? 
Well, I'm a programmer, but the major reason is 
that I expect to see a PayPal logo on a site that 
accepts PayPal. So, use the PayPal logo somewhere 
on your page!


Also, place a few "Buy Now" links here and there 
-- they work. There's been several books written 
on this subject -- the best one I've read is 
"Submit Now" by Andrew Chak -- if you want to 
pick up one and read the specifics of why these 
things work.


One other note, what's with the "richard at php 
dot net"? Instead make it easier for users to 
contact you -- use Enkoder to mask your email 
address -- here's the link:


http://hivelogic.com/enkoder/form

And finally:

http://validator.w3.org/check?uri=http://www.phpguru.org/static/license.html

Many people say it don't matter, but I'm not one of them.  :-)

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to submit form via PHP

2008-08-17 Thread tedd

At 2:39 PM -0400 8/15/08, Robert Cummings wrote:

On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
 > Your form tag needs an action statement

No it doesn't... without an action statement it will submit to the same
URL in which it was presented.

Cheers,
Rob.


Rob:

There you go again -- I've been submitting forms for over a decade 
and didn't know that.


There's nothing more annoying than someone who's always teaching you 
something. :-)


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Licensing

2008-08-17 Thread Richard Heyes
> No offense, but you asked for pointers.

None taken. I may know how to code a reasonable webpage, but selling
it when it's done is something else... :-)

> I can tell you're a programmer and not a marketer.

Exactly. :-)

> While your license makes sense to you, the typical person will come away
> with "Okay, if I see something I want, I'm not sure what to do. I guess that
> I'll have to read the license again."

I've tried to simplify the first FAQ.

> remember half the population is below average intelligence.

I think I may have met a lot of them... :-)

> And finally:
>
> http://validator.w3.org/check?uri=http://www.phpguru.org/static/license.html
>
> Many people say it don't matter, but I'm not one of them.  :-)

10 Errors, 19 warning(s) - eesh, I'll put it "on the backburner..." :-)

Okay, I've taken your points on board and come up with this:
http://www.phpguru.org/static/license.html Better?

-- 
Richard Heyes
http://www.phpguru.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor

2008-08-17 Thread Eric Butera
On Sun, Aug 17, 2008 at 8:33 AM, AmirBehzad Eslami
<[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I'm looking for a light weight WYSIWYG HTML Editor to allow
> users to send private messages to each other in a forum application.
>
> FCKEditor is too complex and very huge for my purposes. I want a
> simple editor. What do you recommend?
>
> Thanks in advance
> --
> Kind regards,
> -behzad
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Look into the YUI editor for something light weight.  You can serve up
all the JS straight from their cdn.

http://developer.yahoo.com/yui/editor/


In all of my projects I always use FCKEditor.  It is easy to have it
in one spot and symlink that to each individual project.  But that is
very specific to the way I deploy my apps.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] On one of my computers, php can't see an external javascript I included

2008-08-17 Thread googling1000

After I took Chris's advice and go to the .js file directly like
http://locahost/myfunctions.js,
I see the machine that is giving me a hard time says that there's a error in
the javascript code.
But, I took a look and the code seems fine to me.



-- 
View this message in context: 
http://www.nabble.com/On-one-of-my-computers%2C-php-can%27t-see-an-external-javascript-I-included-tp18975937p19022011.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] On one of my computers, php can't see an external javascript I included

2008-08-17 Thread Ashley Sheridan
Any chance of putting a link to this .js file online so that we can have
a look at it? Without that, there's very little anyone can do for you.


Ash
www.ashleysheridan.co.uk
--- Begin Message ---

After I took Chris's advice and go to the .js file directly like
http://locahost/myfunctions.js,
I see the machine that is giving me a hard time says that there's a error in
the javascript code.
But, I took a look and the code seems fine to me.



-- 
View this message in context: 
http://www.nabble.com/On-one-of-my-computers%2C-php-can%27t-see-an-external-javascript-I-included-tp18975937p19022011.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor

2008-08-17 Thread mike
On 8/17/08, AmirBehzad Eslami <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I'm looking for a light weight WYSIWYG HTML Editor to allow
> users to send private messages to each other in a forum application.
>
> FCKEditor is too complex and very huge for my purposes. I want a
> simple editor. What do you recommend?

WordPress has tweaked tinymce a lot to maintain  spacing and code
snippets and embedded objects. We've tried both at my job with various
configurations, both have had issues - but we've had the most success
and our users have been happy with WordPress's configuration (which
uses a couple custom javascript things + specific tinymce
configuration)

I've been trying to examine the differences so I can create a reusable
standalone component we can use in all our various apps... but WP has
hooked in a lot of custom code and it's been a bit annoying trying to
split it out into a single reusable javascript file and stuff. Almost
done though. I went overboard and tried to make it more generic by
renaming and cleaning up the functions to not need any WordPress
callbacks and stuff and wound up messing it up, so I have to go back
again and probably re-create it from scratch.. Doh :)

Honestly in a forum setting you can just give them a bbcode howto/link
on the side and let them put in their own bbcode (which can be a
strict subset of HTML) - or even just allow HTML tags and limit what
they can do. Loading up a javascript-based thing even if it's pretty
lightweight is still annoying and I could see that being overkill for
a forum.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] undefine variable

2008-08-17 Thread Michael S. Dunsavage

I'm having a problem running a form script. It used to work before, but
now when I submit the form an error pops up and it won't write to the
database:


This is the error:

[Sun Aug 17 16:46:54 2008] [error] [client 127.0.0.2] PHP Notice:
Undefined variable: selected_state
in /srv/www/htdocs/djtommer/contact.php on line
243


This is the code:
-

foreach($state_list as $key=>$value){
if($selected_state == $key){
$sel = 'selected="selected"';
}
else{
$sel = '';
}
echo "$value";
}
echo '';
?>

--


-- 
Michael S. Dunsavage


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] undefine variable

2008-08-17 Thread Ashley Sheridan
Hi Michael,

It seems that you are trying to use the $selected_state variable in the
code, but it hasn't been declared yet. To test if a variable exists, you
can use the isset() function.

Also, there is a quick way of writing your if/else check on one line.
Here's the changes:

foreach($state_list as $key=>$value)
{
$sel = (isset($selected_state) && $selected_state ==
$key)?'selected="selected"':'';
echo "$value";
}
echo '';
?>

(That's only two lines there inside the loop, just incase my email
client breaks the line because of wordwrap.)

Obviously, if your code worked before, but now is not, it might be that
some other change in your code is causing this error, and that
introducing my change will only mask a larger logic error. You should go
through your code to check where the $selected_state variable is meant
to be declared to make sure it really is.

There is another explanation. If you are not in control of your hosting,
it could be that they changed the error reporting level to show notices
as well, which I believe aren't turned on by default on all hosting
packages.


Ash
www.ashleysheridan.co.uk
--- Begin Message ---

I'm having a problem running a form script. It used to work before, but
now when I submit the form an error pops up and it won't write to the
database:


This is the error:

[Sun Aug 17 16:46:54 2008] [error] [client 127.0.0.2] PHP Notice:
Undefined variable: selected_state
in /srv/www/htdocs/djtommer/contact.php on line
243


This is the code:
-

foreach($state_list as $key=>$value){
if($selected_state == $key){
$sel = 'selected="selected"';
}
else{
$sel = '';
}
echo "$value";
}
echo '';
?>

--


-- 
Michael S. Dunsavage


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Breaking a line in two

2008-08-17 Thread Ron Piggott

Is there a way to add 



midway through a string, following the first available space?

Example:

The cat jumped up high.

This is 23 characters long.  I want  added after the 12th character,
following the first space:

The cat jumped up high.

would be the desired output.

Ron



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Breaking a line in two

2008-08-17 Thread Ashley Sheridan
Hi Ron,

This should do the trick:

', $pos, 0);
?>


Ash
www.ashleysheridan.co.uk
--- Begin Message ---

Is there a way to add 



midway through a string, following the first available space?

Example:

The cat jumped up high.

This is 23 characters long.  I want  added after the 12th character,
following the first space:

The cat jumped up high.

would be the desired output.

Ron



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Breaking a line in two

2008-08-17 Thread Lupus Michaelis

Ron Piggott a écrit :


This is 23 characters long.  I want  added after the 12th character,
following the first space:


  I guess you want to use wordwrap  and 
nl2br .


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Breaking a line in two

2008-08-17 Thread Warren Vail
You might want to consider wordwrap(), which will count out to the length
you specify.
If the next character is not a blank, it will back up to the first available
blank and insert the break character you choose at that point (inplace of
the blank), "" is a valid option, and it will continue doing this until
the line is broken up into as many lines as it takes that are never longer
than the number specified.  If you want to divide it in half divide strlen()
by two.

Wordwrap would work like you specify, if you use 15 as the max length,
except that it would not leave the blank at the end of the line (can't
imagine why you'd want that).  Also since you goal is to limit the size of a
line, not sure why you'd want have it add to the length looking for the
blank, suppose the word at character position 10 (in your case) was
"supercallifragilisticexprealidoceous", do you really want your line to be
46 characters long because a long word was placed at the break point?

Hth,

Warren Vail

> -Original Message-
> From: Ron Piggott [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, August 17, 2008 3:11 PM
> To: PHP General
> Subject: [PHP] Breaking a line in two
> 
> 
> Is there a way to add 
> 
> 
> 
> midway through a string, following the first available space?
> 
> Example:
> 
> The cat jumped up high.
> 
> This is 23 characters long.  I want  added after the 12th 
> character, following the first space:
> 
> The cat jumped up high.
> 
> would be the desired output.
> 
> Ron
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Negative Look Ahead Regex - Code Mistake or Bug?

2008-08-17 Thread Cameron B. Prince
Hello,

I¹ve run into a problem with a regex and need help determining if this is my
mistake or a bug. The regex is for inserting a SID into every link in the
buffer before it¹s flushed, but only when each link doesn¹t already have a
SID.

An example of the code is here:

$buffer = 
preg_replace('/"http\:\/\/www\.domain\.com([\/\w\.-]*)(?!\?PHPSESSID\=2u0cca
ffoh6jaeapkke35qpp87;?)/',
'"http://www.domain.com$1?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;', $buffer);

The code works correctly in most cases except when a SID already exists and
there is a path after the .com such as:

http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;

When this URL is processed by the regex, it becomes:

http://www.domain.com/path1/path2.ph?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;p?
PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;


So the problem is the regex not only falsely matches, it's inserting the SID
in between 2nd and 3rd letters of the extension.

You can see the code in action here:

http://kottmann.com/test.php

The full source for the test code is also available when viewing the source
of this page.

I've tested this on PHP v5.1.6 and PHP v5.2.6.

TIA,
Cameron








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?

2008-08-17 Thread Ashley Sheridan
Hi Cameron,

As far as I can tell, you have an error in your syntax. You're using a -
(hyphen) character in the first match, but Regex uses this to define a
range of characters. It seems that if you don't escape it, the whole
thing behaves a little strangely. For example, using your URL as the
source string:

http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;

This regular expression
/^(http:\/\/www\.domain\.com([\/\.\-\_\w]*))/
matches
[!MATCH!]?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;


and this
/^(http:\/\/www\.domain\.com([\/\.-\_\w]*))/
matches the whole URL

The only difference is the hyphen has been escaped in the first
expression.

I'm not sure if this will help any, but it's definitely something I
noticed in the regex.



Ash
www.ashleysheridan.co.uk
--- Begin Message ---
Hello,

I¹ve run into a problem with a regex and need help determining if this is my
mistake or a bug. The regex is for inserting a SID into every link in the
buffer before it¹s flushed, but only when each link doesn¹t already have a
SID.

An example of the code is here:

$buffer = 
preg_replace('/"http\:\/\/www\.domain\.com([\/\w\.-]*)(?!\?PHPSESSID\=2u0cca
ffoh6jaeapkke35qpp87;?)/',
'"http://www.domain.com$1?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;', $buffer);

The code works correctly in most cases except when a SID already exists and
there is a path after the .com such as:

http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;

When this URL is processed by the regex, it becomes:

http://www.domain.com/path1/path2.ph?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;p?
PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;


So the problem is the regex not only falsely matches, it's inserting the SID
in between 2nd and 3rd letters of the extension.

You can see the code in action here:

http://kottmann.com/test.php

The full source for the test code is also available when viewing the source
of this page.

I've tested this on PHP v5.1.6 and PHP v5.2.6.

TIA,
Cameron








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] undefine variable

2008-08-17 Thread Michael S. Dunsavage
On Sun, 2008-08-17 at 22:26 +0100, Ashley Sheridan wrote:
> Hi Michael,
> 
> It seems that you are trying to use the $selected_state variable in the
> code, but it hasn't been declared yet. To test if a variable exists, you
> can use the isset() function.
> 
> Also, there is a quick way of writing your if/else check on one line.
> Here's the changes:
> 
> foreach($state_list as $key=>$value)
> {
> $sel = (isset($selected_state) && $selected_state ==
> $key)?'selected="selected"':'';
> echo "$value";
> }
> echo '';
> ?>
> 
> (That's only two lines there inside the loop, just incase my email
> client breaks the line because of wordwrap.)
> 
> Obviously, if your code worked before, but now is not, it might be that
> some other change in your code is causing this error, and that
> introducing my change will only mask a larger logic error. You should go
> through your code to check where the $selected_state variable is meant
> to be declared to make sure it really is.
> 
> There is another explanation. If you are not in control of your hosting,
> it could be that they changed the error reporting level to show notices
> as well, which I believe aren't turned on by default on all hosting
> packages.


Heh, actually that wasn't the problem after all. Well php still yells @
me about it, but it does work. In fact someone on this list helped me
before, sorry if I can't remember your name who it was :).   But it
wasn't writing to the DB and I discovered I had to change the
permissions (it was a backup I had restored) and restart mysql.  But you
have a lot of useful information in your list, so I'll be keeping it.
-- 
Michael S. Dunsavage


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?

2008-08-17 Thread Cameron B. Prince
Hi Ash,

> As far as I can tell, you have an error in your syntax. You're using a -
> (hyphen) character in the first match, but Regex uses this to define a
> range of characters. It seems that if you don't escape it, the whole
> thing behaves a little strangely. For example, using your URL as the
> source string:
> 
> http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;
> 
> This regular expression
> /^(http:\/\/www\.domain\.com([\/\.\-\_\w]*))/
> matches
> [!MATCH!]?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;

Thanks for your reply. I updated the code at the URL below adding your
suggestion, but it doesn't seem to make a difference.

http://www.kottmann.com/test.php

Even if there is a problem with the meta characters, I don't understand how
or why the SID would be added in between the .ph and the p in the extension.
It's just totally bizarre to me and is why I'm wondering if it's a bug. (See
links 1 & 8 by viewing source at the link above)

You or anyone have other ideas to try?

Thanks,
Cameron



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] FCKEditor, TinyMCE, ... I need a light weight WYSIWYG HTML Editor

2008-08-17 Thread Warren Vail
A textarea is a simple editor, I am assuming you want something better than
that, or you wouldn't have looked further.

Have you heard the expression (there is no free lunch), it applies here.
Strictly speaking, a textarea is a wysiwyg editor, (what you see is what you
get) you just don't see or get very much, one font, no formatting(other than
what you can do with a carriage return, or a space bar).

These editors can be very complex, but you do have some control in most of
them to manage the complexity that you reveal to your users, and to do that
you will have to know more about it than your users do (again, no free
lunch).  

I like TinyMCE, it allows me to make sure that my users have a simple
interface, and is real easy to setup (relative to developing the whole thing
myself), but most of the ones you cite can probably fill that bill.

Warren Vail

> -Original Message-
> From: mike [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, August 17, 2008 12:05 PM
> To: AmirBehzad Eslami
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] FCKEditor, TinyMCE, ... I need a light 
> weight WYSIWYG HTML Editor
> 
> On 8/17/08, AmirBehzad Eslami <[EMAIL PROTECTED]> wrote:
> > Dear list,
> >
> > I'm looking for a light weight WYSIWYG HTML Editor to allow 
> users to 
> > send private messages to each other in a forum application.
> >
> > FCKEditor is too complex and very huge for my purposes. I want a 
> > simple editor. What do you recommend?
> 
> WordPress has tweaked tinymce a lot to maintain  spacing 
> and code snippets and embedded objects. We've tried both at 
> my job with various configurations, both have had issues - 
> but we've had the most success and our users have been happy 
> with WordPress's configuration (which uses a couple custom 
> javascript things + specific tinymce
> configuration)
> 
> I've been trying to examine the differences so I can create a 
> reusable standalone component we can use in all our various 
> apps... but WP has hooked in a lot of custom code and it's 
> been a bit annoying trying to split it out into a single 
> reusable javascript file and stuff. Almost done though. I 
> went overboard and tried to make it more generic by renaming 
> and cleaning up the functions to not need any WordPress 
> callbacks and stuff and wound up messing it up, so I have to 
> go back again and probably re-create it from scratch.. Doh :)
> 
> Honestly in a forum setting you can just give them a bbcode 
> howto/link on the side and let them put in their own bbcode 
> (which can be a strict subset of HTML) - or even just allow 
> HTML tags and limit what they can do. Loading up a 
> javascript-based thing even if it's pretty lightweight is 
> still annoying and I could see that being overkill for a forum.
> 
> --
> PHP General Mailing List (http://www.php.net/) To 
> unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?

2008-08-17 Thread Simcha Younger

Hi


You did not put a question mark in your character class  ([\/\w\.-] and
instead you put it together with the session id.
The expression looks for a sequence without which is not followed by the
next expression --- ?PHPSESSID\=2u0cca.
If it would count the last `p` of `.php` then the next expression would
violate the negative lookahead.
Instead it stops just before it, after the `.ph` which is the longest
expression it could find that fulfills your negative lookahead, and then it
inserts the new sessionid over there.

Try instead 
$buffer =
preg_replace('/"http\:\/\/www\.domain\.com([\/\w\.\-]*\??)(?!PHPSESSID\=2u0c
caffoh6jaeapkke35qpp87;?)/',
'"http://www.domain.com$1?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;', $buffer);

(not tested)



Simcha Younger

-Original Message-
From: Cameron B. Prince [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 18, 2008 12:56 AM
To: php-general@lists.php.net
Subject: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?

Hello,

I¹ve run into a problem with a regex and need help determining if this is my
mistake or a bug. The regex is for inserting a SID into every link in the
buffer before it¹s flushed, but only when each link doesn¹t already have a
SID.

An example of the code is here:

$buffer = 
preg_replace('/"http\:\/\/www\.domain\.com([\/\w\.-]*)(?!\?PHPSESSID\=2u0cca
ffoh6jaeapkke35qpp87;?)/',
'"http://www.domain.com$1?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;', $buffer);

The code works correctly in most cases except when a SID already exists and
there is a path after the .com such as:

http://www.domain.com/path1/path2.php?PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;

When this URL is processed by the regex, it becomes:

http://www.domain.com/path1/path2.ph?PHPSESSID=t9gksvpdcuobsnqt98qloe6lg4;p?
PHPSESSID=2u0ccaffoh6jaeapkke35qpp87;


So the problem is the regex not only falsely matches, it's inserting the SID
in between 2nd and 3rd letters of the extension.

You can see the code in action here:

http://kottmann.com/test.php

The full source for the test code is also available when viewing the source
of this page.

I've tested this on PHP v5.1.6 and PHP v5.2.6.

TIA,
Cameron








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.138 / Virus Database: 270.6.4/1617 - Release Date: 17/08/2008
12:58


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Regarding threads...

2008-08-17 Thread Nagalakshmi Parameswaran

Hello friends,
   hope we all know about threads in java..
   Like that, can we use that in php?...

   Thanks in advance
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Negative Look Ahead Regex - Code Mistake or Bug?

2008-08-17 Thread Lupus Michaelis

Ashley Sheridan a écrit :

Hi Cameron,

As far as I can tell, you have an error in your syntax. You're using a -
(hyphen) character in the first match, but Regex uses this to define a
range of characters.


  That's not valuable if hyphen is the last character of the range set.




--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php