php-general Digest 20 Dec 2007 10:25:54 -0000 Issue 5191

2007-12-20 Thread php-general-digest-help

php-general Digest 20 Dec 2007 10:25:54 - Issue 5191

Topics (messages 266123 through 266144):

Re: Change case of HTML tags
266123 by: Daniel Brown
266124 by: Jim Lucas
266125 by: Daniel Brown

Re: About PHP Implements
266126 by: Chris

building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an 
extension)
266127 by: Jochem Maas

Re: Command-line PHP script CPU usage goes sky-high, stays there--why?
266128 by: René Fournier
266140 by: Per Jessen

Re: Using require instead of redirect architecture
266129 by: Robert Cummings

Assign variable to a block of html code
266130 by: php mail
266131 by: Stephen Johnson
266137 by: Xavier de Lapeyre
266141 by: Darren Whitlen
266142 by: Darren Whitlen
266143 by: Peter Ford

Re: a bit OT - Does XMLHTTP work with Digest Authentication?
266132 by: Casey

Profiling PHP App
266133 by: php mail
266135 by: Paul Scott
266136 by: Chris

Re: [PHP-DB] Credit Card Encryption
266134 by: Robert Erbaron

Chisimba Release
266138 by: Paul Scott

about __get,__set Overloading, read-only properties
266139 by: ked

Re: Just to confirm...
266144 by: Richard Heyes

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---
On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote:
 I've been looking through the docs but haven't found an internal function
 that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
 can point me in the right direction?  I'm looking for a routine that will
 convert tags to lower case.  For example, if I have

 HTML
   HEAD
 TITLEThis is the Page Title/TITLE
   /HEAD
   Body
 Here is the Page Text
   /Body
 /HTML

 I want to convert only the tags to lower case.  So HTML becomes html and
 so on; I don't want anything else touched.  This may seem kind of silly but
 I'm working with an XMLDocument object in javascript and when I serialize it
 to string format, for some reason all the tags are made into uppercase.  I'm
 taking the serialized string, posting it back to the server and using it on
 the back end.  I figure that since I can make it so that the serialized
 string is lower case on the front end, perhaps I can convert it on the back.

 Any ideas/pointers?

 thnx,
 Christoph



?
$s = EOD
HTML
 HEAD
   TITLEThis is the Page Title/TITLE
 /HEAD
 Body
   Here is the Page Text
 /Body
/HTML
EOD;

$s = preg_replace('/(.*)/Ue',strtolower('$1'),$s);

echo $s.\n;
?


-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
---End Message---
---BeginMessage---
Daniel Brown wrote:
 On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote:
 I've been looking through the docs but haven't found an internal function
 that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
 can point me in the right direction?  I'm looking for a routine that will
 convert tags to lower case.  For example, if I have

 HTML
   HEAD
 TITLEThis is the Page Title/TITLE
   /HEAD
   Body
 Here is the Page Text
   /Body
 /HTML

 I want to convert only the tags to lower case.  So HTML becomes html and
 so on; I don't want anything else touched.  This may seem kind of silly but
 I'm working with an XMLDocument object in javascript and when I serialize it
 to string format, for some reason all the tags are made into uppercase.  I'm
 taking the serialized string, posting it back to the server and using it on
 the back end.  I figure that since I can make it so that the serialized
 string is lower case on the front end, perhaps I can convert it on the back.

 Any ideas/pointers?

 thnx,
 Christoph

 
 
 ?
 $s = EOD
 HTML
  HEAD
TITLEThis is the Page Title/TITLE
  /HEAD
  Body
Here is the Page Text
  /Body
 /HTML
 EOD;
 
 $s = preg_replace('/(.*)/Ue',strtolower('$1'),$s);

Nice use of the 'e' modifier, but would it not be safer to use this?

$s = preg_replace('/(.*)/U', strtolower($1), $s);

This way the arbitrary html is not executed?

 
 echo $s.\n;
 ?
 
 


-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare
---End Message---
---BeginMessage---
On Dec 19, 2007 6:08 PM, Jim Lucas [EMAIL PROTECTED] wrote:

 Daniel Brown wrote:
  On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote:
  I've been looking through the docs but haven't found an internal function
  that does what I'm looking for.  Perhaps I missed it?  Or 

[PHP] Chisimba Release

2007-12-20 Thread Paul Scott

The next release of the Chisimba PHP5 framework is now available.

Major enhancements included in this release are:

 - Better APC support
 - Improved database performance
 - Bug fixes
 - Better code documentation
 - XML-RPC API for Video conversions module
 - XML-RPC API for the Active Dynamic Mirroring module
 - Context improvements and bug fixes
 
and, of course, new modules to add onto your installation!

Please take a look, download it and give it a test drive! 
 
Chisimba, for those that don't know it already, is a PHP5 framework made
in Africa, for Africa. It is a collaboration between around 16 African
Universities, as well as around 35 active developers from around the
continent.
 
It can be downloaded from AVOIR at:
 

http://cvs2.uwc.ac.za/chisimba_releases/chisimba_framework_1-1-3.zip
http://cvs2.uwc.ac.za/chisimba_releases/chisimba_modules_1-1-3.zip

and the doc wiki can be found at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=wiki

There are server setup instructions, as well as installation
walkthroughs available linking from the main AVOIR site:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_207
 
For those interested in developing a module, or just getting some
additional info please take a look at:
 
http://avoir.uwc.ac.za/avoir/index.php?module=cmsaction=pageid=gen12Srv48Nme23_208

-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] about __get,__set Overloading, read-only properties

2007-12-20 Thread ked
Hi. all , 

I got a article from php 5.0 manual's comments. It's useful, offer readonly
properties for classes. 

(look at the end of this message for  the article )

find out  function __construct(), I want to modify $this-id in it , then I
got a  readonly Exception (defined in __set function).  

Distinctly, a read-only property could not be change via $obj-attribute =
''  ,
 but is could be change via $this-id='',  inside of  class , isn't it ?

 How to modify __set function ?  

thanks for any advises.

regards!
ked


the article is here: 


Eric Lafkoff (22-Feb-2006 02:56)

If you're wondering how to create read-only properties for your class, the
__get() and __set() functions are what you're looking for. You just have to
create the framework and code to implement this functionality. 
Here's a quick example I've written. This code doesn't take advantage of the
type attribute in the properties array, but is there for ideas.
?php
class Test 
{
private $p_arrPublicProperties = array(
id = array(value = 4,type = int,readonly = true),
datetime = array(value = Tue 02/21/2006 20:49:23,type =
string, readonly = true),
data = array(value = foo, type = string, readonly =
false)
);

//ked add!!!
public function __construct()
{
$this-id = 100; //will get  exception
!!
}

private function __get($strProperty) {
//Get a property:
if (isset($this-p_arrPublicProperties[$strProperty])) {
return $this-p_arrPublicProperties[$strProperty][value];
} else {
throw new Exception(Property not defined);
return false;
}
}

private function __set($strProperty, $varValue) {
//Set a property to a value:
if (isset($this-p_arrPublicProperties[$strProperty])) {
//Check if property is read-only:
if ($this-p_arrPublicProperties[$strProperty][readonly]) {
throw new Exception(Property is read-only);
///---note here
return false;
} else {
$this-p_arrPublicProperties[$strProperty][value] = $varValue;
return true;
}
} else {
throw new Exception(Property not defined);
return false;
}
}

   private function __isset($strProperty) {
//Determine if property is set:
return isset($this-p_arrPublicProperties[$strProperty]);
   }
   
   private function __unset($strProperty) {
//Unset (remove) a property:
unset($this-p_arrPublicProperties[$strProperty]);
} 

}
$objTest = new Test();
print $objTest-data . \n;
$objTest-data = bar; //Works.
print $objTest-data;
$objTest-id = 5; //Error: Property is read-only.
?

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



Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?

2007-12-20 Thread Per Jessen
René Fournier wrote:

 I'm really not sure what to try next. ps -aux shows MySQL as hogging
 the CPU, not PHP or Terminal:

When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's
doing. 



/Per Jessen, Zürich

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



[PHP] Re: Assign variable to a block of html code

2007-12-20 Thread Darren Whitlen

php mail wrote:

Hi All,

Is it possible to assign variable to a block of html code ?

Something like this :

$myblokvar = 
table width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdtable width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdimg src=images/bartitle_login.gif alt=Login width=475
height=30 //td
tdnbsp;/td
  /tr
  tr
td class=produktable width=100% border=0 cellpadding=3
cellspacing=2
  tr
td class=katalog
?=$log_info?
/td
  /tr
  /table/td
tdnbsp;/td
  /tr
  tr
td class=produknbsp;/td
tdnbsp;/td
  /tr
/table/td
  /tr
/table
;

Although example above is not working, what I want to achieve is something
like that. Is it possible how can I do that ?

Regards,

Feris



You can use Heredoc quoting for this. (http://uk2.php.net/types.string)

-
?php
$log_info = Your logged;
$myblokvar = html
table width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdtable width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdimg src=images/bartitle_login.gif alt=Login width=475
height=30 //td
tdnbsp;/td
  /tr
  tr
td class=produktable width=100% border=0 cellpadding=3
cellspacing=2
  tr
td class=katalog
$log_info
/td
  /tr
  /table/td
tdnbsp;/td
  /tr
  tr
td class=produknbsp;/td
tdnbsp;/td
  /tr
/table/td
  /tr
/table
html;

echo $myblokvar;
?
-

Darren

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



Re: [PHP] Assign variable to a block of html code

2007-12-20 Thread Darren Whitlen

Xavier de Lapeyre wrote:
You should try the HEREDOC structure. 
See link: http://php.net/heredoc


It should look to something like:

$myblokvar = EOF
table blabla
tr
td
			Welcome $name to this website! 
		/td

/tr
/table
EOF;


Xavier,

You should test this before you send it.. it doesn't even parse!
The closing EOF should not start with the . It should only be the 
identifier (EOF) followed by ; and a new line.


-
$myblokvar = EOF
table blabla
.

EOF;
-

Darren



No need of quotes or php start/end tags when placing a variable.

To use it afterwards simply call the $mylokvar variable.

Hope it helped!

Xavier
Web Developer
Site: www.eds.mu




-Original Message-
From: Stephen Johnson [mailto:[EMAIL PROTECTED] 
Sent: jeudi 20 décembre 2007 07:43

To: php mail; PHP General List
Subject: Re: [PHP] Assign variable to a block of html code

What you have will work, you just need to escape out the double quotes in
the html.  





On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote:


Hi All,

Is it possible to assign variable to a block of html code ?

Something like this :

$myblokvar = 
table width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdtable width=487 border=0 cellspacing=0 cellpadding=0
  tr
tdimg src=images/bartitle_login.gif alt=Login width=475
height=30 //td
tdnbsp;/td
  /tr
  tr
td class=produktable width=100% border=0 cellpadding=3
cellspacing=2
  tr
td class=katalog
?=$log_info?
/td
  /tr
  /table/td
tdnbsp;/td
  /tr
  tr
td class=produknbsp;/td
tdnbsp;/td
  /tr
/table/td
  /tr
/table
;

Although example above is not working, what I want to achieve is something
like that. Is it possible how can I do that ?

Regards,

Feris




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



Re: [PHP] Assign variable to a block of html code

2007-12-20 Thread Peter Ford
You could just swap all the double quotes in the HTML tags for single quotes -
that would work in this instance...

$myblokvar = 
table width='487' border='0' cellspacing='0' cellpadding='0'
...
/table
;


Or perhaps a HereDoc syntax:

$myblokvar = EndOfMyHTMLBlock
table width=487 border=0 cellspacing=0 cellpadding=0
...
/table
EndOfMyHTMLBlock;

Then you don't need to worry about what quotes you use, and if you start putting
stuff like onclick events in you can mix quotes up happily ...


I go to great lengths to avoid escaping quotes - it just looks ugly.
That is, however, a personal foible.

Cheers
Pete


Stephen Johnson wrote:
 What you have will work, you just need to escape out the double quotes in
 the html.  
 
 
 
 
 On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote:
 
 Hi All,

 Is it possible to assign variable to a block of html code ?

 Something like this :

 $myblokvar = 
 table width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdtable width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdimg src=images/bartitle_login.gif alt=Login width=475
 height=30 //td
 tdnbsp;/td
   /tr
   tr
 td class=produktable width=100% border=0 cellpadding=3
 cellspacing=2
   tr
 td class=katalog
 ?=$log_info?
 /td
   /tr
   /table/td
 tdnbsp;/td
   /tr
   tr
 td class=produknbsp;/td
 tdnbsp;/td
   /tr
 /table/td
   /tr
 /table
 ;

 Although example above is not working, what I want to achieve is something
 like that. Is it possible how can I do that ?

 Regards,

 Feris
 

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



Re: [PHP] Just to confirm...

2007-12-20 Thread Richard Heyes

Bah!  You're right, I changed it to just be an easter egg in the
code.  The original (now commented out) was:
?
if(stristr($_SERVER['HTTP_USER_AGENT'],msie)) {
die(No friend of Internet Exploder is a friend of mine.);
}
?

It initially started to try to stop cURL, wget, Lynx, and other
automated clients from grabbing the content from the page.  Again, I
know that headers can be spoofed, but that's a different topic.  I try
to make a joke and Stut shoots me in the ass.  ;-P


I've got to ask, why on earth would you want to do this? Robots and 
things like wget I could understand more, but purposefully cutting out a 
large chunk of your audience?


--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

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



[PHP] Footnote Class

2007-12-20 Thread OOzy Pal
Hello,

I am looking for class the do footnote like:


Then the above is transformed as

Lorem [1] diam nonummy
___
1 FOOTNOTE
-- 
OOzy
Ubuntu-Gutsy (7.10)

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



Re: [PHP] Change case of HTML tags

2007-12-20 Thread Stut

Jim Lucas wrote:

Daniel Brown wrote:

On Dec 19, 2007 4:10 PM, Christoph Boget [EMAIL PROTECTED] wrote:

I've been looking through the docs but haven't found an internal function
that does what I'm looking for.  Perhaps I missed it?  Or perhaps someone
can point me in the right direction?  I'm looking for a routine that will
convert tags to lower case.  For example, if I have

HTML
  HEAD
TITLEThis is the Page Title/TITLE
  /HEAD
  Body
Here is the Page Text
  /Body
/HTML

I want to convert only the tags to lower case.  So HTML becomes html and
so on; I don't want anything else touched.  This may seem kind of silly but
I'm working with an XMLDocument object in javascript and when I serialize it
to string format, for some reason all the tags are made into uppercase.  I'm
taking the serialized string, posting it back to the server and using it on
the back end.  I figure that since I can make it so that the serialized
string is lower case on the front end, perhaps I can convert it on the back.

Any ideas/pointers?

thnx,
Christoph



?
$s = EOD
HTML
 HEAD
   TITLEThis is the Page Title/TITLE
 /HEAD
 Body
   Here is the Page Text
 /Body
/HTML
EOD;

$s = preg_replace('/(.*)/Ue',strtolower('$1'),$s);


Nice use of the 'e' modifier, but would it not be safer to use this?

$s = preg_replace('/(.*)/U', strtolower($1), $s);

This way the arbitrary html is not executed?


You can't do it that way. The strtolower will be executed before 
preg_replace, so you're just converting $1 to lowercase and passing 
that through.


-Stut

--
http://stut.net/

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



[PHP] PHP 4.4.8RC1

2007-12-20 Thread Derick Rethans
Hello!

I packed PHP 4.4.8RC1 today, which you can find here:
http://downloads.php.net/derick/

Please test it carefully, and report any bugs in the bug system, but 
only if you have a short reproducable test case.

If everything goes well, we can release it somewhere in the first week 
of 2008.

regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

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



[PHP] Re: [PHP-DEV] PHP 4.4.8RC1

2007-12-20 Thread Marcus Boerger
Hello Derick,

  to stick with our announced plan, can we release this in 2007?

marcus

Thursday, December 20, 2007, 1:43:18 PM, you wrote:

 Hello!

 I packed PHP 4.4.8RC1 today, which you can find here:
 http://downloads.php.net/derick/

 Please test it carefully, and report any bugs in the bug system, but 
 only if you have a short reproducable test case.

 If everything goes well, we can release it somewhere in the first week 
 of 2008.

 regards,
 Derick

 -- 
 Derick Rethans
 http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org




Best regards,
 Marcus

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



[PHP] Re: [PHP-DEV] PHP 4.4.8RC1

2007-12-20 Thread Derick Rethans
On Thu, 20 Dec 2007, Marcus Boerger wrote:

 Hello Derick,
 
   to stick with our announced plan, can we release this in 2007?

That would be exactly in one week, on the 27th then. I prefer doing it 
just in the new year cause all the sysadms are back to work then. I 
think Jan 3rd is still acceptable :)

regards,
Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org

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



Re: [PHP] Change case of HTML tags

2007-12-20 Thread Christoph



If you're using PHP5, you can use the tidy functions -
http://us2.php.net/tidy. The default settings output html tags in
lower-case. For tidy config settings, see
http://tidy.sourceforge.net/docs/quickref.html


Awesome!  This is exactly what I was looking for.  Thank you very much! :)

thnx,
Christoph

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



Re: [PHP] Which file called the function?

2007-12-20 Thread Christoph Boget
 I believe __FILE__ is resolved at compile time, not run-time which  
 means what you're seeing is expected behavior. I'm not sure how you'd  
 get the name of the file that a function call was made from.
 Could you explain why you need this information in your application,  
 and perhaps someone might offer an alternative solution?

I'm not saying it's not expected behavior.  In fact, that exactly what I
would expect based on what the docs say.  I'm just asking if there is
another way to get the script file name that's calling the function.

I need it primarily for debugging purposes.  I've got a single function
that's called by several files.  And instead of modifying all the files
calling the function to add logging, it would be nice to just modify the
function, adding logging only to it to also include what script called it.
 

I know I can get the information from debug_backtrace but I figured there
might be a better/easier way.

thnx,
Christoph


  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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



Re: [PHP] Which file called the function?

2007-12-20 Thread Stut

Christoph Boget wrote:
I believe __FILE__ is resolved at compile time, not run-time which  
means what you're seeing is expected behavior. I'm not sure how you'd  
get the name of the file that a function call was made from.
Could you explain why you need this information in your application,  
and perhaps someone might offer an alternative solution?


I'm not saying it's not expected behavior.  In fact, that exactly what I
would expect based on what the docs say.  I'm just asking if there is
another way to get the script file name that's calling the function.

I need it primarily for debugging purposes.  I've got a single function
that's called by several files.  And instead of modifying all the files
calling the function to add logging, it would be nice to just modify the
function, adding logging only to it to also include what script called it.
 


I know I can get the information from debug_backtrace but I figured there
might be a better/easier way.


There isn't. The backtrace is the only thing that can get the call stack.

-Stut

--
http://stut.net/

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



Re: [PHP] Which file called the function?

2007-12-20 Thread Jochem Maas
Christoph Boget schreef:
 I believe __FILE__ is resolved at compile time, not run-time which  
 means what you're seeing is expected behavior. I'm not sure how you'd  
 get the name of the file that a function call was made from.
 Could you explain why you need this information in your application,  
 and perhaps someone might offer an alternative solution?
 
 I'm not saying it's not expected behavior.  In fact, that exactly what I
 would expect based on what the docs say.  I'm just asking if there is
 another way to get the script file name that's calling the function.
 
 I need it primarily for debugging purposes.  I've got a single function
 that's called by several files.  And instead of modifying all the files
 calling the function to add logging, it would be nice to just modify the
 function, adding logging only to it to also include what script called it.
  
 
 I know I can get the information from debug_backtrace but I figured there
 might be a better/easier way.

nope, debug_backtrace() is the way to go.

 
 thnx,
 Christoph
 
 
   
 
 Looking for last minute shopping deals?  
 Find them fast with Yahoo! Search.  
 http://tools.search.yahoo.com/newsearch/category.php?category=shopping
 

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



Re: [PHP] Which file called the function?

2007-12-20 Thread Daniel Brown
On Dec 20, 2007 9:47 AM, Christoph Boget [EMAIL PROTECTED] wrote:
[snip!]
 I need it primarily for debugging purposes.  I've got a single function
 that's called by several files.  And instead of modifying all the files
 calling the function to add logging, it would be nice to just modify the
 function, adding logging only to it to also include what script called it.


 I know I can get the information from debug_backtrace but I figured there
 might be a better/easier way.

You probably want http://www.xdebug.org/.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Which file called the function?

2007-12-20 Thread Nilesh Ashra

On 20 Dec 2007, at 14:37, Christoph Boget wrote:


Let's say I have the following 3 files

global.php
?
 function myFunc() { echo __FILE__; }
?

one.php
?
 include( 'global.php' );
 echo 'You are in file: ';
 myFunc();
?

two.php
?
 include( 'global.php' );
 echo 'You are in file: ';
 myFunc();
?

In each case, what is echoed out for __FILE__ is global.php.  Apart  
from
analyzing the debug_backtrace array, is there any way that myFunc()  
would

display one.php and two.php respectively?

thnx,
Christoph


Hi Christoph,

I believe __FILE__ is resolved at compile time, not run-time which  
means what you're seeing is expected behavior. I'm not sure how you'd  
get the name of the file that a function call was made from.


Could you explain why you need this information in your application,  
and perhaps someone might offer an alternative solution?


Regards,

Nilesh

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



[PHP] Which file called the function?

2007-12-20 Thread Christoph Boget
Let's say I have the following 3 files

global.php
?
  function myFunc() { echo __FILE__; }
?

one.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?

two.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?

In each case, what is echoed out for __FILE__ is global.php.  Apart from
analyzing the debug_backtrace array, is there any way that myFunc() would
display one.php and two.php respectively?

thnx,
Christoph


Re: [PHP] Re: php sockets

2007-12-20 Thread vixle
well i mean even if we would not consider that particular piece of code as 
an example of the code that i have issues with im still rather interesting 
if theres some different between the socket model used by say, c++(winsock 
in my case) and the sockets used in php
because when made a simple c++ script (winsock based) which just echoes what 
its gotten from a client i still get a problem which looks like this: when 
php client connects to the serv, the server then gets into an endnless loop 
loading the cpu almost up to max . Although i get a message from it in the 
php script (which server was supposed to send when the client connects) but 
the server itself doesnt work correctly for some reason, and thats what im 
curious about. Again, when i rewrote the whole functionality of the client 
in c++ it worked just as it was supposed to, while being written in 
php(client part) it all messes up.
Nathan Nobbe [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 figured id top-post on this one, since the original message was so long..
 i recommend debugging with a tool like wireshark.  that way you can
 see whats in the packets going over the wire and hopefully it will lead
 to a solution.

 -nathan

 

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



Re: [PHP] Assign variable to a block of html code

2007-12-20 Thread Daniel Brown
On Dec 19, 2007 10:38 PM, php mail [EMAIL PROTECTED] wrote:
 Hi All,

 Is it possible to assign variable to a block of html code ?

 Something like this :

 $myblokvar = 
 table width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdtable width=487 border=0 cellspacing=0 cellpadding=0
[snp]
 /table/td
   /tr
 /table
 ;

 Although example above is not working, what I want to achieve is something
 like that. Is it possible how can I do that ?

If you absolutely want to do it that way, then escape your quotes
in the HTML.  When you're using quotes to encapsulate a variable, any
quotes contained within the value will cause a parse error.  One
alternative is to use single-quotes for variable containment, and
double-quotes throughout, or vice-versa.  These two methods will work:

$variable = This is how you \escape\ quotes.;
$variable = 'Using single quotes gives you the literal value,
which means you can't do newlines and such.\n';

However, your best bet is going to be using HEREDOC:

$html =EOL

Always be sure to use the three left carats as shown in the line
above.  You can call EOL anything you want in the world, as long as it
doesn't interfere with an existing part of your code within the same
scope.  You can also use $variables within a HEREDOC, but things like
newlines WILL NOT work.\n

Also note that, when using HEREDOC syntax, you don't end the
EOL with a semicolon.  And when you're done with your HEREDOC
block, be sure to end it as the first thing on the line.  You can't
have any spaces, tabs, or other characters before it.  And be sure to
place your semicolon after it, as well, like so:
EOL;

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Change case of HTML tags

2007-12-20 Thread Arvids Godjuks
In preg_replace case need's to be done like this:

$s = preg_replace('/(\.*\)/Uem', 'strtolower($1)', $s);


[PHP] Re: Which file called the function?

2007-12-20 Thread Shawn McKenzie
This should work:

global.php
?
  function myFunc($file) { echo $file; }
?

one.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc(__FILE__);
?

two.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc(__FILE__);
?
Christoph Boget wrote:
 Let's say I have the following 3 files
 
 global.php
 ?
   function myFunc() { echo __FILE__; }
 ?
 
 one.php
 ?
   include( 'global.php' );
   echo 'You are in file: ';
   myFunc();
 ?
 
 two.php
 ?
   include( 'global.php' );
   echo 'You are in file: ';
   myFunc();
 ?
 
 In each case, what is echoed out for __FILE__ is global.php.  Apart from
 analyzing the debug_backtrace array, is there any way that myFunc() would
 display one.php and two.php respectively?
 
 thnx,
 Christoph
 

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



[PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Arvids Godjuks
Hi!
I'm looking for fast HTML parser, witch can give me a tree of tags with
their attributes.
Maybe some one know a good HTML to BBCode parser, because that's exactly
what i need. tried looking Google, doesn't helped much, still need to make a
HTML to BBCode parser myself.


Re: [PHP] Just to confirm...

2007-12-20 Thread Daniel Brown
On Dec 20, 2007 5:25 AM, Richard Heyes [EMAIL PROTECTED] wrote:
  Bah!  You're right, I changed it to just be an easter egg in the
  code.  The original (now commented out) was:
  ?
  if(stristr($_SERVER['HTTP_USER_AGENT'],msie)) {
  die(No friend of Internet Exploder is a friend of mine.);
  }
  ?
 
  It initially started to try to stop cURL, wget, Lynx, and other
  automated clients from grabbing the content from the page.  Again, I
  know that headers can be spoofed, but that's a different topic.  I try
  to make a joke and Stut shoots me in the ass.  ;-P

 I've got to ask, why on earth would you want to do this? Robots and
 things like wget I could understand more, but purposefully cutting out a
 large chunk of your audience?

Yes, because the browser discrimination block was on a page that
was only used by myself, the pre-wife, and a friend of mine, and he
insisted on using Windows Internet Explorer to surf the Internet,
then complained that he always had spyware and junk on his system,
which was coming through the BHOs.  Once he could no longer access the
page, he got the idea.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Daniel Brown
On Dec 20, 2007 10:30 AM, Arvids Godjuks [EMAIL PROTECTED] wrote:
 Hi!
 I'm looking for fast HTML parser, witch can give me a tree of tags with
 their attributes.
 Maybe some one know a good HTML to BBCode parser, because that's exactly
 what i need. tried looking Google, doesn't helped much, still need to make a
 HTML to BBCode parser myself.


I'm not sure if the PECL BBCode module will help you or not (I'm
not sure if it reverses the code), but it may.

http://pecl.php.net/package/bbcode

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



[PHP] MySQL to blame? (was Re: [PHP] Command-line PHP script CPU usage goes sky-high, stays there--why?)

2007-12-20 Thread M5


On 20-Dec-07, at 1:17 AM, Per Jessen wrote:


René Fournier wrote:


I'm really not sure what to try next. ps -aux shows MySQL as hogging
the CPU, not PHP or Terminal:


When this happens, do a 'SHOW PROCESSLIST' in mysql to see what it's
doing.


I have, and I can't see anything unusual. There are a few scripts  
that loop with very slow overhead (with sufficient sleep(), etc.)  
plus a few outside HTTP requests. Nothing unusual.


Incidentally, yesterday, when MySQL went to 80-90% again after a  
week, I let it stay there while I poked around MySQL (doing the  
above) and the OS to see if there are some magical limit that I might  
be breaking. So it the server ran with MySQL at 80-90% CPU for about  
eight hours. Everything still worked fine, scripts ran, the database  
was available. That's the thing about this problem--it's not a show- 
stopper, it's just really strange. And I can't figure its source.


After not finding anything, I decided restart the script. So I stop  
the [seemingly offending] script and wait for CPU load to return to  
normal. It doesn't. MySQL remains at 80-90%. Even with all the other  
processes turned off that call MySQL and Web Server off, MySQL  
remains at 80-90%. Yet SHOW PROCESSES lists no processes, just the  
show processlist command I issue. With the load still high, I  
attempted to Stop MySQL via the Adminstrator control panel. I  
waited a few minutes. It doesn't shutdown. Finally--and I really hate  
doing this, because it sees dangerous to data (is it?)--I issue a  
kill -9 command to its process. Then it starts fine, I start the  
script in question, and everything is back to normal.


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



Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Arvids Godjuks
I saw it, it only converts BBCode to HTML.
BBCode to HTML isn't a problem - a child can do that with str_replace and a
little help of preg_replace for links and images. The trick is that i need a
HTML to BBCode parser.


2007/12/20, Daniel Brown [EMAIL PROTECTED]:

 On Dec 20, 2007 10:30 AM, Arvids Godjuks [EMAIL PROTECTED] wrote:
  Hi!
  I'm looking for fast HTML parser, witch can give me a tree of tags with
  their attributes.
  Maybe some one know a good HTML to BBCode parser, because that's exactly
  what i need. tried looking Google, doesn't helped much, still need to
 make a
  HTML to BBCode parser myself.
 

I'm not sure if the PECL BBCode module will help you or not (I'm
 not sure if it reverses the code), but it may.

http://pecl.php.net/package/bbcode

 --
 Daniel P. Brown
 [Phone Numbers Go Here!]
 [They're Hidden From View!]

 If at first you don't succeed, stick to what you know best so that you
 can make enough money to pay someone else to do it for you.



[PHP] Is there any Open Source Mailing List Manager that works good

2007-12-20 Thread srihari naidu
Hi,
 I am searching for a good open source php mailing list manager for some 
days. can any one suggest me one please.
   
  Thanks in advance.
   
  Regards,
  Sri.

   
-
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Re: [PHP] Is there any Open Source Mailing List Manager that works good

2007-12-20 Thread Stut

srihari naidu wrote:

 I am searching for a good open source php mailing list manager for some 
days. can any one suggest me one please.


Why PHP? Mailman is way better than anything out there in PHP.

I've used PHPList (phplist.com) before, and it didn't suck too much, but 
I'd still take Mailman over it any day of the week and twice on 
Christmas day!


-Stut

--
http://stut.net/

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



[PHP] Best way to allow users to post youtube video links ?

2007-12-20 Thread Don Don
I want to allow people to be able to post links to videos on youtube.  I've 
implemented it in a certain way by allowing them to copy the embed tag into a 
textarea and then submit the form.  I pick up the form data, validate and 
display on the site.

Is there any better way to do this or php plugins out there ?

Cheers

Don.

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

Re: [PHP] Is there any Open Source Mailing List Manager that works good

2007-12-20 Thread Don Don
phplist.  its awesome, opensource and will support all your needs.

srihari naidu [EMAIL PROTECTED] wrote: Hi,
 I am searching for a good open source php mailing list manager for some 
days. can any one suggest me one please.
   
  Thanks in advance.
   
  Regards,
  Sri.

   
-
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

   
-
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.

Re: [PHP] Re: php sockets

2007-12-20 Thread Jim Lucas
vixle wrote:
 well i mean even if we would not consider that particular piece of code as 
 an example of the code that i have issues with im still rather interesting 
 if theres some different between the socket model used by say, c++(winsock 
 in my case) and the sockets used in php
 because when made a simple c++ script (winsock based) which just echoes what 
 its gotten from a client i still get a problem which looks like this: when 
 php client connects to the serv, the server then gets into an endnless loop 
 loading the cpu almost up to max . Although i get a message from it in the 
 php script (which server was supposed to send when the client connects) but 
 the server itself doesnt work correctly for some reason, and thats what im 
 curious about. Again, when i rewrote the whole functionality of the client 
 in c++ it worked just as it was supposed to, while being written in 
 php(client part) it all messes up.
 Nathan Nobbe [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
 figured id top-post on this one, since the original message was so long..
 i recommend debugging with a tool like wireshark.  that way you can
 see whats in the packets going over the wire and hopefully it will lead
 to a solution.

 -nathan


 

well, since it is the php version, and this is a php list, why don't you show 
us your complete PHP
source code instead of you C++ source.

-- 
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Opinion about the using $GLOBALS directly

2007-12-20 Thread Sancar Saran
Hello All,

Thanks for joining the conversation. It seems there where no real technical 
dead end for using $GLOBALS directly. 
Using $GLOBALS directly very similar to coding standarts. It just up to you.

Also I try explain my enviroment a liddle bit.

First of all my function declarationgs gonna like this

// Set Shorcut Variables
$arrConf   = $GLOBALS['_LIVE']['_CONF'];
$arrStat   = $GLOBALS['_LIVE']['_STAT'];
$arrDomSet = $GLOBALS['_LIVE']['_DOMN'][$GLOBALS['_LIVE']['_STAT']['curDom']]
['settings'];
$arrLang   = $GLOBALS['_LIVE']['_LANG'][$arrStat['language']];
$rootDir   = $arrConf['rootDir'];
$webDir= $arrConf['webDir'];
$arrDb = $arrConf['_DB'];
$arrDbg= $GLOBALS['_LIVE']['_DEBG'];


It grows and grows. And  some times in small functions, function declarations 
become larger than the function actual code.

Most of those GLOBALS usage are read only (like configuration variables, or 
stored language keys) or need to update anywhere in the system.

And unde one condition it may become problem.

If 3rd party users develop some code under my enviroment and if there where 
some change about GLOBALS['name'] or PHP core developers may change GLOBALS 
to GLB (or someting like that) there may problem to update 3rd party code.

To prevent this, putting some variable translation functions for 3rd party 
developers was good idea.

Other than this for my point of view it was very useful.

Thank you very much all of you.

Sancar

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



Re: [PHP] Best way to allow users to post youtube video links ?

2007-12-20 Thread TG

Just a thought.. it might be better to control the output a little more.  I 
assume if you're letting them submit the embed code that you're turning 
around and just displaying what they posted.

It might be easier for the user and more secure if you have them submit 
either the full youtube URL:
http://www.youtube.com/watch?v=Tq8Yw19bn7Q

and/or you can have people just submit the video ID:
Tq8Yw19bn7Q

Either way, that's all you need to create your own embed tag without 
trusting that they're not going to submit something bad with their embed.

There are things to facilitate YouTube link posting in various systems 
including Joomla and many subcomponents, phpBB, probably most other forum 
software.  If you're using something like that, you might search around.

-TG

- Original Message -
From: Don Don [EMAIL PROTECTED]
To: PHP List php-general@lists.php.net
Date: Thu, 20 Dec 2007 08:20:16 -0800 (PST)
Subject: [PHP] Best way to allow users to post youtube video links ?

 I want to allow people to be able to post links to videos on youtube.  I've 
 implemented it in a certain way by allowing them to copy the embed tag 
 into a textarea and then submit the form.  I pick up the form data, 
 validate and display on the site.
 
 Is there any better way to do this or php plugins out there ?
 
 Cheers
 
 Don.
 

 -
 Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it 
 now.
 

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



[PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread afan pasalic
The hosting company I have one account (and several Add Domains)
upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
start getting the error message:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 122880 bytes) in...
on domains they use Gallery2 or are CMS (Joomla or Drupal) based.

I contacted Tech. Support (Live Chat) and he told me I have to edit
memory limit in php.ini (for each domain).

I asked him why it started so suddenly, did upgrade caused the problem
and I got as an answer: Your scripts have begun to use more memory.
That would be the only reason for this error.
It doesn't make a sense to me and sounds like let's blame something
else type of answer.

I'm going to edit php.ini though what if client doesn't have a clue
what's php.ini or how to do it?

I would like to hear your opinion what caused the problem.
I'll edit php.ini, I'm not going to make a big deal of it, though, I
just want to know why it happened.

Thanks for help.

-afan

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



[PHP] PGCon 2008 - call for papers

2007-12-20 Thread Dan Langille

Hello folks,

PGCon 2008 will be held 22-23 May 2008, in Ottawa at the University of
Ottawa.  It will be preceded by two days of tutorials on 20-21 May 2008.

We are now requesting proposals for presentations.

If you are doing something interesting with PostgreSQL, please submit
a proposal.  You might be one of the backend hackers or work on a
PostgreSQL related project and want to share your know-how with
others. You might be developing an interesting system using
PostgreSQL as the foundation. Perhaps you migrated from another
database to PostgreSQL and would like to share details.  These, and
other stories are welcome. Both users and developers are encouraged
to share their experiences.

Here are a few ideas to jump start your proposal process:

 - novel, unique or complex ways in which PostgreSQL are used
 - migration of production systems to PostgreSQL
 - data warehousing with PostgreSQL
 - tuning PostgreSQL for different work loads
 - replicating data on top of PostgreSQL

Both users and developers are encouraged to share their experiences.

The schedule is:

 19 Dec 2007 Proposal acceptance begins
 19 Jan 2008 Proposal acceptance ends
 19 Feb 2008 Confirmation of accepted proposals
 19 Apr 2008 Final papers/slides must arrive no later than this date

See also http://www.pgcon.org/2008/papers.php

Instructions for submitting a proposal to PGCon 2008 are available
from: http://www.pgcon.org/2008/submissions.php

--
Dan Langille - http://www.langille.org/
BSDCan - The Technical BSD Conference: http://www.bsdcan.org/
PGCon  - The PostgreSQL Conference:http://www.pgcon.org/

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



Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread Stephen Johnson
It sounds to me like the allowed memory size went back to the default
after they upgraded php.

I usually have to update some of my config files after an upgrade.  Nothing
seems strange to me here... But maybe I am missing something.


 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?

Your clients shouldn't have a clue about the php.ini file, nor should they
ever have to worry about it.  However, I assume you mean the clients of the
hosting company, which would be you.  It is my opinion that you, as a PHP
developer, have a responsibility to understand what the php.ini file is,
what it does, and how to change it if necessary and you should have this
knowledge before you begin writing code that would be used by anyone but
yourself.



--
Stephen Johnson c | eh
The Lone Coder

http://www.thelonecoder.com
continuing the struggle against bad code

http://www.thumbnailresume.com
--




 From: afan pasalic [EMAIL PROTECTED]
 Date: Thu, 20 Dec 2007 12:37:07 -0500
 To: php-general php-general@lists.php.net
 Subject: [PHP] Why I sart getting Fatal error: Allowed memory size... after
 php upgrade?
 
 The hosting company I have one account (and several Add Domains)
 upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
 start getting the error message:
 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 122880 bytes) in...
 on domains they use Gallery2 or are CMS (Joomla or Drupal) based.
 
 I contacted Tech. Support (Live Chat) and he told me I have to edit
 memory limit in php.ini (for each domain).
 
 I asked him why it started so suddenly, did upgrade caused the problem
 and I got as an answer: Your scripts have begun to use more memory.
 That would be the only reason for this error.
 It doesn't make a sense to me and sounds like let's blame something
 else type of answer.
 
 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?
 
 I would like to hear your opinion what caused the problem.
 I'll edit php.ini, I'm not going to make a big deal of it, though, I
 just want to know why it happened.
 
 Thanks for help.
 
 -afan
 
 -- 
 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] Which file called the function?

2007-12-20 Thread Richard Lynch


On Thu, December 20, 2007 8:37 am, Christoph Boget wrote:
 Let's say I have the following 3 files

 global.php
 ?
   function myFunc() { echo __FILE__; }
 ?

 one.php
 ?
   include( 'global.php' );
   echo 'You are in file: ';
   myFunc();
 ?

 two.php
 ?
   include( 'global.php' );
   echo 'You are in file: ';
   myFunc();
 ?

 In each case, what is echoed out for __FILE__ is global.php.  Apart
 from
 analyzing the debug_backtrace array, is there any way that myFunc()
 would
 display one.php and two.php respectively?

$_SERVER['PHP_SELF'] and other bits in $_SERVER have the main PHP
filename in them.

__FILE__ will always be exactly the file that it's in.

In between, I think you are stuck with the debug_backtrace.

NOTE:
If it's for error logging or error reporting, note that trigger_error
automatically passes in the file/line to the error handler.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Frank Arensmeier


20 dec 2007 kl. 00.55 skrev Jochem Maas:


hi guys,

well having tried for countless hours to build php on leopard I  
pretty much gave up.

that's too bad...

apparently it's pretty much impossible unless your name is Marc  
Liyanage (entropy.ch) ...


the problem lies with the fact that you need 64bit libs and the  
some (most notably iconv)
of the libs included with Leopard are borked in respect to the  
'universal build' stuff (which
I gather means you actually have a number of different  
[architecture related] executables bundled
into a single file ... I probably have that all wrong, to be honest  
it's a little over my head.


Marc L. offers a tarball with a working php5.2.5 (just untar and  
move the php5 dir to /usr/local):

 http://www2.entropy.ch/download/php5-5.2.5.leopard.release1.tar.gz

his build does work but it doesn't include one extension that I  
rely on for some of my projects,

namely interbase.

I figured I'd try using Marc' configure line (as given by /usr/ 
local/php5/bin/php-config against the
source of php5.2.5 that I downloaded and add the relevant configure  
option (--with-interbase[=DIR])
... in the hope I at least get a couple of usable extensions so  
that I could copy the ibase extension

over into the working php5.2.5 installation ... no joy.


what error(s) did you get?

I figure I'm screwed - I have a painfully expensive dev machine I  
can't blooming use. oh well,

at least it is the nicest looking paper weight I've got.


that's something, isn't it??

I'm still wondering whether it's possible to build just the  
interbase extension ... anyone know

how to do that? or have any tips?
is interbase available via PEAR or PECL? How desperately are you  
trying to get thinks working? I mean, are you working on a project  
right now with a tight deadline? I really would like to help with the  
install (since I would like to update to Leopard in the near future  
as well, it might be a good opportunity to learn a few things), but  
right now I don't feel that I have the time...




rgds,
Jochem

--
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] Profiling PHP App

2007-12-20 Thread Richard Lynch
On Wed, December 19, 2007 10:21 pm, php mail wrote:

 Is there any tool to profiling PHP app ?

Compile PHP --with-debug and then use:
valgrind --tool=callgrind php -q yourscript.php

You get a nifty fabulous listing of where X% of your time is being
spent and a really cool diagram of your function calls.

Rasmus routinely shows this off in his talks regarding PHP performance.

It can be a pain to find/install valgrind/callgrind, but it's well
worth it!

There are GUI tools to examine the data, such as KCachegrind.

I cannot recommend these tools enough!

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread afan pasalic

Richard Lynch wrote:
 On Thu, December 20, 2007 11:37 am, afan pasalic wrote:
 The hosting company I have one account (and several Add Domains)
 upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
 start getting the error message:
 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 122880 bytes) in...
 on domains they use Gallery2 or are CMS (Joomla or Drupal) based.

 I contacted Tech. Support (Live Chat) and he told me I have to edit
 memory limit in php.ini (for each domain).

 I asked him why it started so suddenly, did upgrade caused the problem
 and I got as an answer: Your scripts have begun to use more memory.
 That would be the only reason for this error.
 It doesn't make a sense to me and sounds like let's blame something
 else type of answer.

 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?

 I would like to hear your opinion what caused the problem.
 I'll edit php.ini, I'm not going to make a big deal of it, though, I
 just want to know why it happened.
 
 PHP 5 uses more RAM than PHP 4, both to start up, and on a
 script-for-script basis.
 
 It has more features, more OO complexity, and uses more RAM, plain and
 simple.
 
 The PHP Dev Team increased the default/recommended memory limit from 8
 M to 16 M with the release of PHP 5.
 
 I think they even documented this change, but you'll have to dig that
 out for yourself.
 
 Your hosting company probably kept the old php.ini without realizing
 that they needed to read the docs and change it.
 
 ymmv
 

Ok. Now is clear. I'll contact them as soon as possible.

Thanks Richard for your help.

-afan

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



Re: [PHP] Using require instead of redirect architecture

2007-12-20 Thread Richard Lynch
On Wed, December 19, 2007 1:37 pm, Robert Erbaron wrote:
 Problems:
 - hitting back on p2.php shows the dreaded The page you are trying to
 view contains POST...

If you dread seeing this, then play pinball with the user...

 -- OK and Cancel both generated unsatisfactory results

Unsatisfactory in what way?

 - hitting refresh on p2.php runs the validation again, which means the
 validation code now has to be that much more complicated to trap for a
 second attempt, blah blah blah.

Do you care that it's a second attempt?

It's either valid input or it's not.

If you really do care, then put an md5 token as a hidden input in the
form, and store it in the db (or session) and mark it used after the
first attempt.

If that token is used then you know it's the 2nd (or more) attempt.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Richard Lynch
./configure --with-interbase

should build the interbase extension, as well as a PHP binary that you
don't want.

Then just copy the interbase.so thingie over, and Bob's your uncle.

You might need some stuff from Marc's configure line to convince it to
compile the extension in 64-bit mode, but don't try to re-compile all
the other extensions you don't need.

On Wed, December 19, 2007 5:55 pm, Jochem Maas wrote:
 hi guys,

 well having tried for countless hours to build php on leopard I pretty
 much gave up.
 apparently it's pretty much impossible unless your name is Marc
 Liyanage (entropy.ch) ...

 the problem lies with the fact that you need 64bit libs and the some
 (most notably iconv)
 of the libs included with Leopard are borked in respect to the
 'universal build' stuff (which
 I gather means you actually have a number of different [architecture
 related] executables bundled
 into a single file ... I probably have that all wrong, to be honest
 it's a little over my head.

 Marc L. offers a tarball with a working php5.2.5 (just untar and move
 the php5 dir to /usr/local):
http://www2.entropy.ch/download/php5-5.2.5.leopard.release1.tar.gz

 his build does work but it doesn't include one extension that I rely
 on for some of my projects,
 namely interbase.

 I figured I'd try using Marc' configure line (as given by
 /usr/local/php5/bin/php-config against the
 source of php5.2.5 that I downloaded and add the relevant configure
 option (--with-interbase[=DIR])
 ... in the hope I at least get a couple of usable extensions so that I
 could copy the ibase extension
 over into the working php5.2.5 installation ... no joy.

 I figure I'm screwed - I have a painfully expensive dev machine I
 can't blooming use. oh well,
 at least it is the nicest looking paper weight I've got.

 I'm still wondering whether it's possible to build just the interbase
 extension ... anyone know
 how to do that? or have any tips?

 rgds,
 Jochem

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




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Ham marked as Spam with BAYES_99 - PhpMailer to old?

2007-12-20 Thread Merlin Morgenstern

Richard Lynch schrieb:

On Tue, December 18, 2007 8:41 am, Merlin Morgenstern wrote:

I am running a small community page with PHP. Members can select
notification e-mails on comments etc.

Since today those e-mails - or basically all e-mails from the system -
get taged as spam with a score of 3.5 that totally results to
BAYES_99.

How come? I am using PHP-Mailer 1.73. I am wondering if this will go
away if I upgrade to 2.0. However I would rather not like to do that
as a .0 release makes me a bit worried.

Does anybody have an idea on how to eleminate that BAYES_99 score?
Those
mails are absolutly no spam. They contain a link to the commment page
but that should not be the problem. At least it was not a problem for
the last years.

Any ideas?


Bayes usually refers to the Bayseian (sp?) algorithm where the system
learns what is junk based on users' marking things as spam.

So if you add a bunch of people to your list that don't expect to be
on it, and they all mark your email as spam, whammo, all your emails
are marked as spam.

Or so I understand it...

Or possibly mis-understand it. :-v



That sounds logical. However those e-mails are opt-in. So it is very 
unlikely that this has happend. I also checked red lists etc.


I believe that I did not configure the server well and the php sending 
function so that the header is missing important settings or so. After 
all the Bayes_99 is the only spam trigger.


Unfortunatelly I can only find postings on the net where people talk 
about how to tweak their spamassasin filtering. Nobody who sends e-mails 
seams to have a problem. Is that only me? (and of course the spamers :-) ).


I tried to send it directly from unix command: mail -s This is a test 
[EMAIL PROTECTED]


That one gets flaged with bayes_50 (spam score 0). After all most of the 
e-mails I receive in my private account are even bayes_00 (-2.x).


Do you believe it is the IP-Adress? I could not find it anywhere on the 
red lists. All looks clean.


Any ideas?

Thank you for any hints,

Merlin

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



Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread afan pasalic

Stephen Johnson wrote:
 It sounds to me like the allowed memory size went back to the default
 after they upgraded php.
 
 I usually have to update some of my config files after an upgrade.  Nothing
 seems strange to me here... But maybe I am missing something.
 
 
 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?
 
 Your clients shouldn't have a clue about the php.ini file, nor should they
 ever have to worry about it.  However, I assume you mean the clients of the
 hosting company, which would be you.  It is my opinion that you, as a PHP
 developer, have a responsibility to understand what the php.ini file is,
 what it does, and how to change it if necessary and you should have this
 knowledge before you begin writing code that would be used by anyone but
 yourself.

Yes, I use the service of the hosting company and I'm the client. :)
Also, I have (some) knowledge of what php.ini is and what I
can/have/dare to change. And it's not first time I had conflict with
limited memory and every time I knew what caused and how to fix it.
Also, the app is not written by me, it's Gallery2
(http://www.gallery2.org/) and they can't do wrong code :)

Though, what if some guy signed up for an account, installed Gallery
or Joomla or Drupal through Fantastico and - got his message? of course,
support will help him (do it for him) to edit php.ini, but it shouldn't
happen at the first time, right?

And, as I said, I don't want to make a big deal for hosting company
because they are good and this is first time something came up. Just
want to know why happened, what caused the error.

-afan

 
 
 
 --
 Stephen Johnson c | eh
 The Lone Coder
 
 http://www.thelonecoder.com
 continuing the struggle against bad code
 
 http://www.thumbnailresume.com
 --
 
 
 
 
 From: afan pasalic [EMAIL PROTECTED]
 Date: Thu, 20 Dec 2007 12:37:07 -0500
 To: php-general php-general@lists.php.net
 Subject: [PHP] Why I sart getting Fatal error: Allowed memory size... after
 php upgrade?

 The hosting company I have one account (and several Add Domains)
 upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
 start getting the error message:
 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 122880 bytes) in...
 on domains they use Gallery2 or are CMS (Joomla or Drupal) based.

 I contacted Tech. Support (Live Chat) and he told me I have to edit
 memory limit in php.ini (for each domain).

 I asked him why it started so suddenly, did upgrade caused the problem
 and I got as an answer: Your scripts have begun to use more memory.
 That would be the only reason for this error.
 It doesn't make a sense to me and sounds like let's blame something
 else type of answer.

 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?

 I would like to hear your opinion what caused the problem.
 I'll edit php.ini, I'm not going to make a big deal of it, though, I
 just want to know why it happened.

 Thanks for help.

 -afan

 -- 
 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] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Daniel Brown
On Dec 20, 2007 2:30 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 ./configure --with-interbase

 should build the interbase extension, as well as a PHP binary that you
 don't want.

 Then just copy the interbase.so thingie over, and Bob's your uncle.

I don't know who Bob is, but it should also be mentioned that you
need to run 'make', but NOT 'make install'.  Richard didn't insinuate
that you would, but I'm just directly stating it.

-- 
Daniel P. Brown
[Phone Numbers Go Here!]
[They're Hidden From View!]

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.

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



Re: [PHP] Opinion about the using $GLOBALS directly

2007-12-20 Thread Richard Lynch
On Wed, December 19, 2007 11:22 am, Stut wrote:
 well, if you have a long and complex function declaration which
 begins
 with global $whatever, and then all over the function $whatever is
 used,
 some dozens of lines later when looking for something in the code
 you
 might not have any idea that $whatever is global... however if you
 used
 $GLOBALS['whatever'] everywhere it would be trivial.

 Indeed.

I don't really care how long the function is.

$connection is a global in the scripts.

It's the only global there is.

It's a global in any function that needs it.

If I can't remember that from day to day, then I need to find a nurse
to take care of me...

[shrug]

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Which file called the function?

2007-12-20 Thread George Pitcher
 On Thu, December 20, 2007 8:37 am, Christoph Boget wrote:
  Let's say I have the following 3 files
 
  global.php
  ?
function myFunc() { echo __FILE__; }
  ?
 
  one.php
  ?
include( 'global.php' );
echo 'You are in file: ';
myFunc();
  ?
 
  two.php
  ?
include( 'global.php' );
echo 'You are in file: ';
myFunc();
  ?
 
  In each case, what is echoed out for __FILE__ is global.php.  Apart
  from
  analyzing the debug_backtrace array, is there any way that myFunc()
  would
  display one.php and two.php respectively?

 $_SERVER['PHP_SELF'] and other bits in $_SERVER have the main PHP
 filename in them.

 __FILE__ will always be exactly the file that it's in.

 In between, I think you are stuck with the debug_backtrace.

 NOTE:
 If it's for error logging or error reporting, note that trigger_error
 automatically passes in the file/line to the error handler.

I'm far from being an expert, and often see more efficient ways of doing
things (more efficient tham my own methods). Howevr, I've just been dealing
with a similar problem.

I have a functions file with over 400 functions (and that may be too many -
but it works). I've been adding some error reporting in to my PEAR::DB
queries, but wanted to know which page triggered the function. I went
theough my php pages and gane each one a $pg variable at the start
containing the bare name of the file, eg 'home' rather than 'home.php'. I
then went to each function containing either a DB query (ore one which calls
another DB-related function. I did a global search and replace for the
function name 'func(' replaced by 'func($pg,'. I use Dreamweaver so this was
fairly straightforward.

It worked for me, but now someone is about to show me a quicker, cleaner
way, aren't they?

Cheers, and seasonal greetings from Oxford/Edinburgh

George

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



Re: [PHP] HTML parser (maybe even HTML to BBCode)

2007-12-20 Thread Richard Lynch
On Thu, December 20, 2007 9:30 am, Arvids Godjuks wrote:
 Hi!
 I'm looking for fast HTML parser, witch can give me a tree of tags
 with
 their attributes.
 Maybe some one know a good HTML to BBCode parser, because that's
 exactly
 what i need. tried looking Google, doesn't helped much, still need to
 make a
 HTML to BBCode parser myself.


http://php.net/dom
will give you the tree.

You are on your own trying to convert to BBCode.


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread Richard Lynch
On Thu, December 20, 2007 11:37 am, afan pasalic wrote:
 The hosting company I have one account (and several Add Domains)
 upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
 start getting the error message:
 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 122880 bytes) in...
 on domains they use Gallery2 or are CMS (Joomla or Drupal) based.

 I contacted Tech. Support (Live Chat) and he told me I have to edit
 memory limit in php.ini (for each domain).

 I asked him why it started so suddenly, did upgrade caused the problem
 and I got as an answer: Your scripts have begun to use more memory.
 That would be the only reason for this error.
 It doesn't make a sense to me and sounds like let's blame something
 else type of answer.

 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?

 I would like to hear your opinion what caused the problem.
 I'll edit php.ini, I'm not going to make a big deal of it, though, I
 just want to know why it happened.

PHP 5 uses more RAM than PHP 4, both to start up, and on a
script-for-script basis.

It has more features, more OO complexity, and uses more RAM, plain and
simple.

The PHP Dev Team increased the default/recommended memory limit from 8
M to 16 M with the release of PHP 5.

I think they even documented this change, but you'll have to dig that
out for yourself.

Your hosting company probably kept the old php.ini without realizing
that they needed to read the docs and change it.

ymmv

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] [SOLVED] Why I sart getting Fatal error: Allowed memory size... after php upgrade?

2007-12-20 Thread afan pasalic

Richard Lynch wrote:
 On Thu, December 20, 2007 11:37 am, afan pasalic wrote:
 The hosting company I have one account (and several Add Domains)
 upgraded php on the server from 4.4.7 to 5.2.5. After the upgrade I
 start getting the error message:
 Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
 allocate 122880 bytes) in...
 on domains they use Gallery2 or are CMS (Joomla or Drupal) based.

 I contacted Tech. Support (Live Chat) and he told me I have to edit
 memory limit in php.ini (for each domain).

 I asked him why it started so suddenly, did upgrade caused the problem
 and I got as an answer: Your scripts have begun to use more memory.
 That would be the only reason for this error.
 It doesn't make a sense to me and sounds like let's blame something
 else type of answer.

 I'm going to edit php.ini though what if client doesn't have a clue
 what's php.ini or how to do it?

 I would like to hear your opinion what caused the problem.
 I'll edit php.ini, I'm not going to make a big deal of it, though, I
 just want to know why it happened.
 
 PHP 5 uses more RAM than PHP 4, both to start up, and on a
 script-for-script basis.
 
 It has more features, more OO complexity, and uses more RAM, plain and
 simple.
 
 The PHP Dev Team increased the default/recommended memory limit from 8
 M to 16 M with the release of PHP 5.
 
 I think they even documented this change, but you'll have to dig that
 out for yourself.
 
 Your hosting company probably kept the old php.ini without realizing
 that they needed to read the docs and change it.
 
 ymmv
 

just talked to tech. support.
actually, they didn't upgrade the server I was on the moved me
completely to other server that use php5. they moved all my files -
original php.ini as well. :)
I'm going to to add domain in Addon Domains and then copy that php.ini
on other Addon Domains.

Thanks for help.

-afan

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



[PHP] Re: Best way to allow users to post youtube video links ?

2007-12-20 Thread Dan
Don Don [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I want to allow people to be able to post links to videos on youtube.  I've 
implemented it in a certain way by allowing them to copy the embed tag 
into a textarea and then submit the form.  I pick up the form data, 
validate and display on the site.


Is there any better way to do this or php plugins out there ?

Cheers

Don.



The way I've seen this done is people just ask for the youtube id, which is 
the string at the end of the url like a94cw29rv or whatever.  Then you know 
the rest of the url anyway and you don't have to do any other validation or 
filtering besides only letting alphanumeric through.


- Dan 


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



RE: [PHP] Which file called the function?

2007-12-20 Thread Robert Cummings
On Thu, 2007-12-20 at 19:54 +, George Pitcher wrote:
  On Thu, December 20, 2007 8:37 am, Christoph Boget wrote:
   Let's say I have the following 3 files
  
   global.php
   ?
 function myFunc() { echo __FILE__; }
   ?
  
   one.php
   ?
 include( 'global.php' );
 echo 'You are in file: ';
 myFunc();
   ?
  
   two.php
   ?
 include( 'global.php' );
 echo 'You are in file: ';
 myFunc();
   ?
  
   In each case, what is echoed out for __FILE__ is global.php.  Apart
   from
   analyzing the debug_backtrace array, is there any way that myFunc()
   would
   display one.php and two.php respectively?
 
  $_SERVER['PHP_SELF'] and other bits in $_SERVER have the main PHP
  filename in them.
 
  __FILE__ will always be exactly the file that it's in.
 
  In between, I think you are stuck with the debug_backtrace.
 
  NOTE:
  If it's for error logging or error reporting, note that trigger_error
  automatically passes in the file/line to the error handler.
 
 I'm far from being an expert, and often see more efficient ways of doing
 things (more efficient tham my own methods). Howevr, I've just been dealing
 with a similar problem.
 
 I have a functions file with over 400 functions (and that may be too many -
 but it works). I've been adding some error reporting in to my PEAR::DB
 queries, but wanted to know which page triggered the function. I went
 theough my php pages and gane each one a $pg variable at the start
 containing the bare name of the file, eg 'home' rather than 'home.php'. I
 then went to each function containing either a DB query (ore one which calls
 another DB-related function. I did a global search and replace for the
 function name 'func(' replaced by 'func($pg,'. I use Dreamweaver so this was
 fairly straightforward.
 
 It worked for me, but now someone is about to show me a quicker, cleaner
 way, aren't they?

Yes, I am.

?php
function checkpoint()
{
$trace  = debug_backtrace();

$caller = isset( $trace[0] ) ? $trace[0] : array();
$owner  = isset( $trace[1] ) ? $trace[1] : array();

$file
= isset( $caller['file'] )
? $caller['file']
: null;

$class
= isset( $owner['class'] )
? $owner['class']
: null;

$function
= isset( $owner['function'] )
? $owner['function']
: null;

$line
= isset( $caller['line'] )
? $caller['line']
: null;

$type
= isset( $owner['type'] )
? $owner['type']
: null;

list( $timeSub, $time ) = explode( ' ', microtime() );
$timeSub = ereg_replace( '^[^.]\.', '', $timeSub );
$timeSub = substr( str_pad( $timeSub, 6, '0' ), 0, 6 );

echo 'Checkpoint '
.'['.date( 'Y-m-d H:i:s', $time ).'.'.$timeSub.']: '
.($file === null
? ''
: $file.' ')
.($line === null
? ''
: sprintf( '{%05d} ', $line ))
.($class === null
? ''
: $class.$type)
.($function === null
? ''
: $function.'()')
.$this-nl;
}

?

I often use the above function when debugging code. It prints detailed
information about where it was called. I have something similar in my
error handler but it's not as concise for error related reasons.

It doesn't strike me as an issue that it's a heavy function since it's
used in a debugging context or when an error is present. In which case,
it shouldn't be called in production at least not often :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Jochem Maas
Frank Arensmeier schreef:
 
 20 dec 2007 kl. 00.55 skrev Jochem Maas:
 
 hi guys,

 well having tried for countless hours to build php on leopard I pretty
 much gave up.
 that's too bad...

'give up' is too strong - but deadlines and frustration has caused me to put
it aside right now.

 

...


 I figured I'd try using Marc' configure line (as given by
 /usr/local/php5/bin/php-config against the
 source of php5.2.5 that I downloaded and add the relevant configure
 option (--with-interbase[=DIR])
 ... in the hope I at least get a couple of usable extensions so that I
 could copy the ibase extension
 over into the working php5.2.5 installation ... no joy.

 what error(s) did you get?

configure failed to find the interbase lib/headers (which it does find if
I run my own configure line that links against installed libs/headers - although
make then failed due to problems with iconv) if I use Marc's configure line
(which links against his supplied libs - I use --with-interbase=/opt

 I figure I'm screwed - I have a painfully expensive dev machine I
 can't blooming use. oh well,
 at least it is the nicest looking paper weight I've got.

 that's something, isn't it??

very funny :-)

 
 I'm still wondering whether it's possible to build just the interbase
 extension ... anyone know
 how to do that? or have any tips?
 is interbase available via PEAR or PECL?



 How desperately are you trying
 to get thinks working? I mean, are you working on a project right now
 with a tight deadline? I really would like to help with the install
 (since I would like to update to Leopard in the near future as well, it
 might be a good opportunity to learn a few things), but right now I
 don't feel that I have the time...
 

 rgds,
 Jochem

 -- 
 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] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Jochem Maas
Daniel Brown schreef:
 On Dec 20, 2007 2:30 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 ./configure --with-interbase

 should build the interbase extension, as well as a PHP binary that you
 don't want.

 Then just copy the interbase.so thingie over, and Bob's your uncle.
 
 I don't know who Bob is, but it should also be mentioned that you
 need to run 'make', but NOT 'make install'.  Richard didn't insinuate
 that you would, but I'm just directly stating it.

Richard, Dan, thanks for thinking with me on this.

I did try this already. I even tried ./configure --disable-all --with-interbase
in order to try and kill as many dependencies as possible. no joy, configure
runs to the end (but also warns me me system seems to be borked) and make
bombs out completely halfway through.

I'll give it a stab again tomorrow - no doubt there are a million or so
configure variations I have yet to try - I'll get back with some details that
may allow someone to give me a lightbulb moment.

PS - did I mention that I'm way out of my depth with all these make errors
and library linking stuff :)

 

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



Re: [PHP] about __get,__set Overloading, read-only properties

2007-12-20 Thread Jochem Maas
pleae don't reply to an existing thread when posting a new question.

ked schreef:
 Hi. all , 
 
 I got a article from php 5.0 manual's comments. It's useful, offer readonly
 properties for classes. 
 
 (look at the end of this message for  the article )
 
 find out  function __construct(), I want to modify $this-id in it , then I
 got a  readonly Exception (defined in __set function).  
 
 Distinctly, a read-only property could not be change via $obj-attribute =
 ''  ,
  but is could be change via $this-id='',  inside of  class , isn't it ?
 
  How to modify __set function ?  

don't - let __set() be the policeman it's supposed to be.
either create a private function to initialize values or set the values
directly in the array

private function init($k, $v)
{
if (isset($this-p_arrPublicProperties[$k]))
$this-p_arrPublicProperties[$k]['value'] = $v;
}

 
 thanks for any advises.
 
 regards!
 ked
 
 
 the article is here: 
 
 
 Eric Lafkoff (22-Feb-2006 02:56)
 
 If you're wondering how to create read-only properties for your class, the
 __get() and __set() functions are what you're looking for. You just have to
 create the framework and code to implement this functionality. 
 Here's a quick example I've written. This code doesn't take advantage of the
 type attribute in the properties array, but is there for ideas.
 ?php
 class Test 
 {
 private $p_arrPublicProperties = array(
   id = array(value = 4,type = int,readonly = true),
   datetime = array(value = Tue 02/21/2006 20:49:23,type =
 string, readonly = true),
   data = array(value = foo, type = string, readonly =
 false)
 );
 
 //ked add!!!
 public function __construct()
 {
   $this-id = 100; //will get  exception
 !!
 }
 
 private function __get($strProperty) {
 //Get a property:
 if (isset($this-p_arrPublicProperties[$strProperty])) {
 return $this-p_arrPublicProperties[$strProperty][value];
 } else {
 throw new Exception(Property not defined);
 return false;
 }
 }
 
 private function __set($strProperty, $varValue) {
 //Set a property to a value:
 if (isset($this-p_arrPublicProperties[$strProperty])) {
 //Check if property is read-only:
 if ($this-p_arrPublicProperties[$strProperty][readonly]) {
 throw new Exception(Property is read-only);
 ///---note here
 return false;
 } else {
 $this-p_arrPublicProperties[$strProperty][value] = $varValue;
 return true;
 }
 } else {
 throw new Exception(Property not defined);
 return false;
 }
 }
 
private function __isset($strProperty) {
 //Determine if property is set:
 return isset($this-p_arrPublicProperties[$strProperty]);
}

private function __unset($strProperty) {
 //Unset (remove) a property:
 unset($this-p_arrPublicProperties[$strProperty]);
 } 
 
 }
 $objTest = new Test();
 print $objTest-data . \n;
 $objTest-data = bar; //Works.
 print $objTest-data;
 $objTest-id = 5; //Error: Property is read-only.
 ?
 

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



Re: [PHP] building PHP5.2.5 on Mac OS X Leopard (anyone know how to build a just an extension)

2007-12-20 Thread Jochem Maas
I hit send too soon ...

Frank Arensmeier schreef:
 
 20 dec 2007 kl. 00.55 skrev Jochem Maas:

...

 is interbase available via PEAR or PECL? 

alas no. it would be PECL at any rate - and I don't hold much faith in PECL
being able to build anything usable anyway

 How desperately are you trying
 to get thinks working? 

desperate enough to move back to my windows machine ;-)

 I mean, are you working on a project right now
 with a tight deadline? 

I have 2 running projects with ongoing deadlines that I should be working on
instead of trying to get php working on my Mac - customers call daily asking 
when
stuff will be rolled out.

 I really would like to help with the install
 (since I would like to update to Leopard in the near future as well, it
 might be a good opportunity to learn a few things), but right now I
 don't feel that I have the time...

good to know. I'll have another stab at it tomorrow and give details regarding
the configure lines I'm using and the libsI have installed, etc - I did a rm -rf
on everything related to php5 and apache2 in a fit of rage so I can't retrieve
anything useful right this minute.

in the mean time I'd like to ask:

1. do you have Xcode installed?
2. do you use macports for installing stuff like libjpeg?

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



RE: [PHP] about __get,__set Overloading, read-only properties

2007-12-20 Thread ked

 My idea is just  your answer...happy..ing  ^_^ 

You are so warmhearted.  Thanks a lot!  : )

I will never post a question to a existing thread .

 -Original Message-
 From: Jochem Maas [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 21, 2007 9:11 AM
 To: ked
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] about __get,__set Overloading, read-only properties
 
 pleae don't reply to an existing thread when posting a new question.
 
 ked schreef:
  Hi. all ,
  
  I got a article from php 5.0 manual's comments. It's useful, offer 
  readonly properties for classes.
  
  (look at the end of this message for  the article )
  
  find out  function __construct(), I want to modify 
 $this-id in it , 
  then I got a  readonly Exception (defined in __set function).
  
  Distinctly, a read-only property could not be change via 
  $obj-attribute = ''  ,  but is could be change via 
 $this-id='',  
  inside of  class , isn't it ?
  
   How to modify __set function ?  
 
 don't - let __set() be the policeman it's supposed to be.
 either create a private function to initialize values or set 
 the values directly in the array
 
 private function init($k, $v)
 {
   if (isset($this-p_arrPublicProperties[$k]))
   $this-p_arrPublicProperties[$k]['value'] = $v; }
 
  
  thanks for any advises.
  
  regards!
  ked
  
  
  the article is here: 
  
 --
  --
  
  Eric Lafkoff (22-Feb-2006 02:56)
  
  If you're wondering how to create read-only properties for 
 your class, 
  the
  __get() and __set() functions are what you're looking for. You just 
  have to create the framework and code to implement this 
 functionality.
  Here's a quick example I've written. This code doesn't take 
 advantage 
  of the type attribute in the properties array, but is 
 there for ideas.
  ?php
  class Test
  {
  private $p_arrPublicProperties = array(
  id = array(value = 4,type = int,readonly = true),
  datetime = array(value = Tue 02/21/2006 
 20:49:23,type = 
  string, readonly = true),
  data = array(value = foo, type = string, 
 readonly =
  false)
  );
  
  //ked add!!!
  public function __construct()
  {
  $this-id = 100; //will get 
  exception !!
  }
  
  private function __get($strProperty) { //Get a property:
  if (isset($this-p_arrPublicProperties[$strProperty])) { return 
  $this-p_arrPublicProperties[$strProperty][value];
  } else {
  throw new Exception(Property not defined); return false; } }
  
  private function __set($strProperty, $varValue) { //Set a 
 property to 
  a value:
  if (isset($this-p_arrPublicProperties[$strProperty])) { //Check if 
  property is read-only:
  if ($this-p_arrPublicProperties[$strProperty][readonly]) { throw 
  new Exception(Property is read-only); 
  ///---note here return 
  false; } else { 
 $this-p_arrPublicProperties[$strProperty][value] = 
  $varValue; return true; } } else { throw new 
 Exception(Property not 
  defined); return false; } }
  
 private function __isset($strProperty) {
  //Determine if property is set:
  return isset($this-p_arrPublicProperties[$strProperty]);
 }
 
 private function __unset($strProperty) {
  //Unset (remove) a property:
  unset($this-p_arrPublicProperties[$strProperty]);
  }
  
  }
  $objTest = new Test();
  print $objTest-data . \n;
  $objTest-data = bar; //Works.
  print $objTest-data;
  $objTest-id = 5; //Error: Property is read-only.
  ?
  
 
 --
 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] Which file called the function?

2007-12-20 Thread Shelley Shyan
Richard is right.

If you want to get where __FILE__ is exactly in, __FILE__ is the option.
Else, use $_SERVER['PHP_SELF']. (And this should be what you expected)


Regards,
Shelley


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christoph Boget
Sent: Thursday, December 20, 2007 10:37 PM
To: PHP General
Subject: [PHP] Which file called the function?

Let's say I have the following 3 files

global.php
?
  function myFunc() { echo __FILE__; }
?

one.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?

two.php
?
  include( 'global.php' );
  echo 'You are in file: ';
  myFunc();
?

In each case, what is echoed out for __FILE__ is global.php.  Apart from 
analyzing the debug_backtrace array, is there any way that myFunc() would 
display one.php and two.php respectively?

thnx,
Christoph

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



RE: [PHP] Assign variable to a block of html code

2007-12-20 Thread Xavier de Lapeyre
Yeps,
Sorry bout that.

Thnks for pointing it out.
Xavier



-Original Message-
From: Darren Whitlen [mailto:[EMAIL PROTECTED] 
Sent: jeudi 20 décembre 2007 13:13
To: php-general@lists.php.net
Subject: Re: [PHP] Assign variable to a block of html code

Xavier de Lapeyre wrote:
 You should try the HEREDOC structure. 
 See link: http://php.net/heredoc
 
 It should look to something like:
 
 $myblokvar = EOF
 table blabla
   tr
   td
   Welcome $name to this website! 
   /td
   /tr
 /table
 EOF;

Xavier,

You should test this before you send it.. it doesn't even parse!
The closing EOF should not start with the . It should only be the 
identifier (EOF) followed by ; and a new line.

-
$myblokvar = EOF
table blabla
.

EOF;
-

Darren

 
 No need of quotes or php start/end tags when placing a variable.
 
 To use it afterwards simply call the $mylokvar variable.
 
 Hope it helped!
 
 Xavier
 Web Developer
 Site: www.eds.mu
 
 
 
 
 -Original Message-
 From: Stephen Johnson [mailto:[EMAIL PROTECTED] 
 Sent: jeudi 20 décembre 2007 07:43
 To: php mail; PHP General List
 Subject: Re: [PHP] Assign variable to a block of html code
 
 What you have will work, you just need to escape out the double quotes in
 the html.  
 
 
 
 
 On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote:
 
 Hi All,

 Is it possible to assign variable to a block of html code ?

 Something like this :

 $myblokvar = 
 table width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdtable width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdimg src=images/bartitle_login.gif alt=Login width=475
 height=30 //td
 tdnbsp;/td
   /tr
   tr
 td class=produktable width=100% border=0 cellpadding=3
 cellspacing=2
   tr
 td class=katalog
 ?=$log_info?
 /td
   /tr
   /table/td
 tdnbsp;/td
   /tr
   tr
 td class=produknbsp;/td
 tdnbsp;/td
   /tr
 /table/td
   /tr
 /table
 ;

 Although example above is not working, what I want to achieve is something
 like that. Is it possible how can I do that ?

 Regards,

 Feris
 

-- 
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] Assign variable to a block of html code

2007-12-20 Thread Xavier de Lapeyre
Quote:

You could just swap all the double quotes in the HTML tags for single quotes -
that would work in this instance...

$myblokvar = 
table width='487' border='0' cellspacing='0' cellpadding='0'
...
/table
;


That's a way too, but it does not preserve the indentation.
The HEREDOC syntax behave much like the pre HTML tag for PHP, and it also 
removed the hassle of placing escape tags!

Xavier de Lapeyre
Web Developer
Enterprise Data Services
24, Dr Roux Street, 
Rose Hill
Office: (230) 465 17 00
Fax: (230) 465 29 00
Site: www.eds.mu





-Original Message-
From: Peter Ford [mailto:[EMAIL PROTECTED] 
Sent: jeudi 20 décembre 2007 13:17
To: php-general@lists.php.net
Subject: Re: [PHP] Assign variable to a block of html code

You could just swap all the double quotes in the HTML tags for single quotes -
that would work in this instance...

$myblokvar = 
table width='487' border='0' cellspacing='0' cellpadding='0'
...
/table
;


Or perhaps a HereDoc syntax:

$myblokvar = EndOfMyHTMLBlock
table width=487 border=0 cellspacing=0 cellpadding=0
...
/table
EndOfMyHTMLBlock;

Then you don't need to worry about what quotes you use, and if you start putting
stuff like onclick events in you can mix quotes up happily ...


I go to great lengths to avoid escaping quotes - it just looks ugly.
That is, however, a personal foible.

Cheers
Pete


Stephen Johnson wrote:
 What you have will work, you just need to escape out the double quotes in
 the html.  
 
 
 
 
 On 12/19/07 7:38 PM, php mail [EMAIL PROTECTED] wrote:
 
 Hi All,

 Is it possible to assign variable to a block of html code ?

 Something like this :

 $myblokvar = 
 table width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdtable width=487 border=0 cellspacing=0 cellpadding=0
   tr
 tdimg src=images/bartitle_login.gif alt=Login width=475
 height=30 //td
 tdnbsp;/td
   /tr
   tr
 td class=produktable width=100% border=0 cellpadding=3
 cellspacing=2
   tr
 td class=katalog
 ?=$log_info?
 /td
   /tr
   /table/td
 tdnbsp;/td
   /tr
   tr
 td class=produknbsp;/td
 tdnbsp;/td
   /tr
 /table/td
   /tr
 /table
 ;

 Although example above is not working, what I want to achieve is something
 like that. Is it possible how can I do that ?

 Regards,

 Feris
 

-- 
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] Just to confirm...

2007-12-20 Thread Xavier de Lapeyre
 ?
 if(stristr($_SERVER['HTTP_USER_AGENT'],msie)) {
 die(No friend of Internet Exploder is a friend of mine.);
 }
 ?

Lol!!! I need to implement that on ALL my sites ... XD!!


Xavier de Lapeyre




-Original Message-
From: Richard Heyes [mailto:[EMAIL PROTECTED] 
Sent: jeudi 20 décembre 2007 14:26
To: Daniel Brown
Cc: Stut; [EMAIL PROTECTED]; Zoltán Németh; PHP General List
Subject: Re: [PHP] Just to confirm...

 Bah!  You're right, I changed it to just be an easter egg in the
 code.  The original (now commented out) was:
 ?
 if(stristr($_SERVER['HTTP_USER_AGENT'],msie)) {
 die(No friend of Internet Exploder is a friend of mine.);
 }
 ?
 
 It initially started to try to stop cURL, wget, Lynx, and other
 automated clients from grabbing the content from the page.  Again, I
 know that headers can be spoofed, but that's a different topic.  I try
 to make a joke and Stut shoots me in the ass.  ;-P

I've got to ask, why on earth would you want to do this? Robots and 
things like wget I could understand more, but purposefully cutting out a 
large chunk of your audience?

-- 
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

** NOW OFFERING FREE ACCOUNTS TO CHARITIES AND NON-PROFITS **

-- 
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] Re: php sockets

2007-12-20 Thread vixle
With any code doing a basic socket functionality, the code that i gave in 
the original post is suppossed to connect to a deamon, and get a message 
from it , instead it makes the deamon go crazy in the sense that it starts 
endless looping and loads the system resources up to max.

Jim Lucas [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 well, since it is the php version, and this is a php list, why don't you 
 show us your complete PHP
 source code instead of you C++ source.

 -- 
 Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

 Twelfth Night, Act II, Scene V
by William Shakespeare 

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