php-general Digest 22 Sep 2009 13:45:13 -0000 Issue 6352

2009-09-22 Thread php-general-digest-help

php-general Digest 22 Sep 2009 13:45:13 - Issue 6352

Topics (messages 298248 through 298256):

Re: Extract links from strings
298248 by: Jim Lucas
298249 by: Jim Lucas

Re: Validation XHTML code and repairing broken one
298250 by: Manuel Lemos
298255 by: Michael A. Peters

using a USB device (flash) in the Virtualbox
298251 by: chamba kasonde
298253 by: Ashley Sheridan
298256 by: Robert Cummings

Question: Wai-aria?
298252 by: Parham Doustdar
298254 by: Fernando Castillo Aparicio

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
Jônatas Zechim wrote:
 Hi there, i've the following strings:
 
 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';
 
 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].
 
 Zechim
 
 

Something like this should work for you.

plaintext?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
print_r($m);
}
}

?

---End Message---
---BeginMessage---
Jim Lucas wrote:
 Jônatas Zechim wrote:
 Hi there, i've the following strings:

 $string1 = 'Lorem ipsum dolor http://site.com sit amet';
 $string2 = 'Lorem ipsum dolor http://www.site.com/ sit amet';
 $string3 = 'Lorem ipsum dolor http://www.site.net sit amet';

 How can I extract the URL from these strings?
 They can be [http:// + url] or [www. + url].

 Zechim


 
 Something like this should work for you.
 
 plaintext?php
 
 $urls[] = 'Lorem ipsum dolor http://site.com sit amet';
 $urls[] = 'Lorem ipsum dolor https://www.site.com/ sit amet';
 $urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
 $urls[] = 'Lorem ipsum dolor www site2.net sit amet';
 
 foreach ( $urls AS $url ) {
   if ( preg_match('%((https?://|www\.)[^\s]+)%', $url, $m) ) {
   print_r($m);
   }
 }
 
 ?
 

Actually, try this.  It seems to work a little better.

plaintext?php

$urls[] = 'Lorem ipsum dolor http://site.com sit amet';
$urls[] = 'Lorem ipsum dolor https://www.site.com/ or http://www.site2.com/';
$urls[] = 'Lorem ipsum dolor www.site1.net sit amet';
$urls[] = 'Lorem ipsum dolor www site2.net sit amet';

foreach ( $urls AS $url ) {
if ( preg_match_all('%(https?://[^\s]+|www\.[^\s]+)%',
$url,
$m,
(PREG_SET_ORDER ^ PREG_OFFSET_CAPTURE)
) ) {
print_r($m);
}
}

?

---End Message---
---BeginMessage---
Hello,

on 09/17/2009 06:33 AM Dušan Novaković said the following:
 I have few questions about validation XHTML and repairing if it's
 broken. The problem is that I have some, for example HTML code (simple
 web page) and want to load that page to DOMDocument and than make
 something of it. That part works perfect, but if there is unclosed tag
 or something like that when I try to load that page I get an error
 because now that code is not valid. So my question would be, is there
 some way that I could build some script in php that would run thought
 that page and check if it's valid or not, and if it's not than try to
 repair it. Something that you have in all tools, for example Eclipse,
 NetBeans, etc. If anyone have any idea, please help me, because I'm
 stuck in here :-(

You may want to try this HTML parser package. It is tolerating to
malformed HTML documents. It returns a stream of document elements, such
as tags, data, character entities, etc.. that you can pass back to the
class and regenerate a well-formed document. It comes even with filter
class that validates the document against a DTD and adds missing closed
tags and such.

http://www.phpclasses.org/secure-html-filter

-- 

Regards,
Manuel Lemos

Find and post PHP jobs
http://www.phpclasses.org/jobs/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
---End Message---
---BeginMessage---

Al wrote:





Hello,

I have few questions about validation XHTML and repairing if it's
broken. The problem is that I have some, for example HTML code (simple
web page) and want to load that page to DOMDocument and than make
something of it. That part works perfect, but if there is unclosed tag
or something like that when I try to load that page I get an error
because now that code is not 

php-general Digest 23 Sep 2009 03:27:41 -0000 Issue 6353

2009-09-22 Thread php-general-digest-help

php-general Digest 23 Sep 2009 03:27:41 - Issue 6353

Topics (messages 298257 through 298267):

session.gc_maxlifetime
298257 by: Tom Worster
298258 by: Ralph Deffke
298259 by: Ralph Deffke
298260 by: Tom Worster
298261 by: Ralph Deffke

Misusing The URLENCODE/DECODE() Functions
298262 by: Nitsan Bin-Nun

Basic of Basics
298263 by: Todd Dunning
298264 by: Robert Cummings
298265 by: Todd Dunning
298266 by: Robert Cummings

Testing Broken Pipe Recovery?
298267 by: Dee Ayy

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
i'm not 100% sure what the manual means when it says...

session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will
be seen as 'garbage' and cleaned up. Garbage collection occurs during
session start.

what event exactly does the after which here refer to?

i'd like to think that it means that a session is eligible for gc no sooner
than session.gc_maxlifetime seconds after the most recent access (read or
write) to that session. but it seems dangerously presumptuous to assume that
this is the case.

what do you take it to mean?


---End Message---
---BeginMessage---
Hi Tom,

i did find this in the bug reports, its pretty new and should be an answer.

http://news.php.net/php.doc.bugs/2653

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?




---End Message---
---BeginMessage---
I forgot to mention, that this doesn't mean, you can not read data after
this timeout or that a session does ALWAYS die after this timeout. I would
assume, that the server has to have a reason to run garbage clean up. If the
server is not running a clean up, I would expect the session would excist
longer for access.

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?




---End Message---
---BeginMessage---
thank you, Ralph!

i'm going to be bold and assume that tom at punkave dot com is right despite
that the report was discarded.

i got a complaint from a client about some users reporting being logged out
with rather short periods of inactivity. but session.gc_maxlifetime is set
to 6 hours so i don't think that's the source of the problem.


On 9/22/09 4:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote:

 Hi Tom,
 
 i did find this in the bug reports, its pretty new and should be an answer.
 
 http://news.php.net/php.doc.bugs/2653
 
 ralph_def...@yahoo.de
 
 
 Tom Worster f...@thefsb.org wrote in message
 news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...
 
 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
 will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.
 
 what event exactly does the after which here refer to?
 
 i'd like to think that it means that a session is eligible for gc no
 sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
 that
 this is the case.
 
 what do you take it to mean?
 
 
 
 


---End Message---
---BeginMessage---
Hi Tom,

in sometimes 2001 I did have incidences with those things, and as I remember
over the past years there where some trouble with operating systems and
stuff. This part is very deep inside the os. I would expect that this is

[PHP] Question: Wai-aria?

2009-09-22 Thread Parham Doustdar
Hello there,
I have asked on the mailing lists that have blind users and no one seems to 
know about this technology (that is ironically created to help us blind folks). 
I was wondering if anyone here has the experience of implementing Wai-aria. 
Since my question is rather about Wai-aria than PHP and is off-topic, I'm first 
of all sorry to be posting it here (it is rather an act of desperation). 
Secondly, I ask people who have the time to help me to please contact me 
off-list at parham90 at gmail dot com.
Thanks.
-- 
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
GoogleTalk: parha...@gmail.com
Twitter: PD90
email: parham90 at GMail dot com

Re: [PHP] using a USB device (flash) in the Virtualbox

2009-09-22 Thread Ashley Sheridan
On Mon, 2009-09-21 at 22:50 -0700, chamba kasonde wrote:
 Hi!
 I am a new user of this feature and tool and would like to transfer data and 
 info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
 platform.
 My first version of Virtualbox was 2._ _ _ which said it did not support that 
 feature.
 Therefore, I upgraded to 3._ _ _ which supports it but the flash does not 
 show nor appear in the XP window.
 How do I get to use my flash on both parallel running systems?
 
 
   
Totally the wrong list for that sort of question. It's not even remotely
related to PHP...

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Question: Wai-aria?

2009-09-22 Thread Fernando Castillo Aparicio
Ups! By mistake I didn't reply to all. Resending. Sorry.





De: Parham Doustdar parha...@gmail.com
Para: php-general@lists.php.net
Enviado: martes, 22 de septiembre, 2009 9:41:44
Asunto: [PHP] Question: Wai-aria?

Hello there,
I
have asked on the mailing lists that have blind users and no one seems
to know about this technology (that is ironically created to help us
blind folks). I was wondering if anyone here has the experience of
implementing Wai-aria. Since my question is rather about Wai-aria than
PHP and is off-topic, I'm first of all sorry to be posting it here (it
is rather an act of desperation). Secondly, I ask people who have the
time to help me to please contact me off-list at parham90 at gmail dot
com.
Thanks.
-- 
---
Contact info:
Skype: parham-d
MSN: fire_lizard16 at hotmail dot com
GoogleTalk: parha...@gmail.com
Twitter: PD90
email: parham90 at GMail dot com


Have you tried the contact section for WAI at w3.org? 
http://www.w3.org/WAI/contacts

They have a WAI Interest Group mailing list (w3c-wai-ig-requ...@w3.org, 
suscribe as subject), and I believe that would be the best place to look for 
help.

Good luck.



  

Re: [PHP] Re: Validation XHTML code and repairing broken one

2009-09-22 Thread Michael A. Peters

Al wrote:





Hello,

I have few questions about validation XHTML and repairing if it's
broken. The problem is that I have some, for example HTML code (simple
web page) and want to load that page to DOMDocument and than make
something of it. That part works perfect, but if there is unclosed tag
or something like that when I try to load that page I get an error
because now that code is not valid. So my question would be, is there
some way that I could build some script in php that would run thought
that page and check if it's valid or not, and if it's not than try to
repair it. Something that you have in all tools, for example Eclipse,
NetBeans, etc. If anyone have any idea, please help me, because I'm
stuck in here :-(

Regards,
Dusan



I spent some time on this issue because I have several applications 
where users enter text that must be later displayed as valid XHTML on a 
webpage.


I've found Tidy [a PHP extension] is the best and simplest solution.


I agree - you can pass it through tidy and then import it into a DOM or 
whatever it is you need x(ht)ml for.


It works well for me.

You can also use HTML Purifier to remove tags you do not want to allow, 
and HTML Purifier can pass it through tidy for you.


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



Re: [PHP] using a USB device (flash) in the Virtualbox

2009-09-22 Thread Robert Cummings



Ashley Sheridan wrote:

On Mon, 2009-09-21 at 22:50 -0700, chamba kasonde wrote:

Hi!
I am a new user of this feature and tool and would like to transfer data and 
info to and from Windows Xp in the Virtualbox running on a Linux Ubuntu 
platform.
My first version of Virtualbox was 2._ _ _ which said it did not support that 
feature.
Therefore, I upgraded to 3._ _ _ which supports it but the flash does not show 
nor appear in the XP window.
How do I get to use my flash on both parallel running systems?


  

Totally the wrong list for that sort of question. It's not even remotely
related to PHP...


You want to skip the OSE version and get the version that has USB 
support built in. The open source edition does not have USB support due 
to licensing (or somesuch) issues.


Alternatively you can set up a shared folder so that a folder on your 
Ubuntu host can be mapped to a drive in the Windows XP guest. The latter 
is more convenient for sharing your uh.. PHP data amongst multiple guests.


Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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



[PHP] session.gc_maxlifetime

2009-09-22 Thread Tom Worster
i'm not 100% sure what the manual means when it says...

session.gc_maxlifetime integer
session.gc_maxlifetime specifies the number of seconds after which data will
be seen as 'garbage' and cleaned up. Garbage collection occurs during
session start.

what event exactly does the after which here refer to?

i'd like to think that it means that a session is eligible for gc no sooner
than session.gc_maxlifetime seconds after the most recent access (read or
write) to that session. but it seems dangerously presumptuous to assume that
this is the case.

what do you take it to mean?



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



[PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
Hi Tom,

i did find this in the bug reports, its pretty new and should be an answer.

http://news.php.net/php.doc.bugs/2653

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?





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



[PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
I forgot to mention, that this doesn't mean, you can not read data after
this timeout or that a session does ALWAYS die after this timeout. I would
assume, that the server has to have a reason to run garbage clean up. If the
server is not running a clean up, I would expect the session would excist
longer for access.

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...

 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.

 what event exactly does the after which here refer to?

 i'd like to think that it means that a session is eligible for gc no
sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
that
 this is the case.

 what do you take it to mean?





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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Tom Worster
thank you, Ralph!

i'm going to be bold and assume that tom at punkave dot com is right despite
that the report was discarded.

i got a complaint from a client about some users reporting being logged out
with rather short periods of inactivity. but session.gc_maxlifetime is set
to 6 hours so i don't think that's the source of the problem.


On 9/22/09 4:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote:

 Hi Tom,
 
 i did find this in the bug reports, its pretty new and should be an answer.
 
 http://news.php.net/php.doc.bugs/2653
 
 ralph_def...@yahoo.de
 
 
 Tom Worster f...@thefsb.org wrote in message
 news:c6de9eee.12c8d%...@thefsb.org...
 i'm not 100% sure what the manual means when it says...
 
 session.gc_maxlifetime integer
 session.gc_maxlifetime specifies the number of seconds after which data
 will
 be seen as 'garbage' and cleaned up. Garbage collection occurs during
 session start.
 
 what event exactly does the after which here refer to?
 
 i'd like to think that it means that a session is eligible for gc no
 sooner
 than session.gc_maxlifetime seconds after the most recent access (read or
 write) to that session. but it seems dangerously presumptuous to assume
 that
 this is the case.
 
 what do you take it to mean?
 
 
 
 



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



Re: [PHP] Re: session.gc_maxlifetime

2009-09-22 Thread Ralph Deffke
Hi Tom,

in sometimes 2001 I did have incidences with those things, and as I remember
over the past years there where some trouble with operating systems and
stuff. This part is very deep inside the os. I would expect that this is
still to consider. I also would check, if this occurs on very busy/low
memory server.

If I would programm the garbage collection clean up part, and if the server
is about to run out of memory, I would kill sessions being longer time idle
even when they are not yet as old as it is set in the gc_maxlifetime. This
would be far better then shutting down the whole server just because there a
100 of idle sessions waiting to get used again.

as u mention a maxlivetime of 6h I would bet, that this is the problem. I
would not trust such a long lifetime at all.

If sessions have to be active such a long time, I would see only cooky based
solutions

let me know, what u did investigate on this.

ralph_def...@yahoo.de


Tom Worster f...@thefsb.org wrote in message
news:c6deae55.12cae%...@thefsb.org...
 thank you, Ralph!

 i'm going to be bold and assume that tom at punkave dot com is right
despite
 that the report was discarded.

 i got a complaint from a client about some users reporting being logged
out
 with rather short periods of inactivity. but session.gc_maxlifetime is set
 to 6 hours so i don't think that's the source of the problem.


 On 9/22/09 4:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote:

  Hi Tom,
 
  i did find this in the bug reports, its pretty new and should be an
answer.
 
  http://news.php.net/php.doc.bugs/2653
 
  ralph_def...@yahoo.de
 
 
  Tom Worster f...@thefsb.org wrote in message
  news:c6de9eee.12c8d%...@thefsb.org...
  i'm not 100% sure what the manual means when it says...
 
  session.gc_maxlifetime integer
  session.gc_maxlifetime specifies the number of seconds after which data
  will
  be seen as 'garbage' and cleaned up. Garbage collection occurs during
  session start.
 
  what event exactly does the after which here refer to?
 
  i'd like to think that it means that a session is eligible for gc no
  sooner
  than session.gc_maxlifetime seconds after the most recent access (read
or
  write) to that session. but it seems dangerously presumptuous to assume
  that
  this is the case.
 
  what do you take it to mean?
 
 
 
 





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