Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

What does mah_process_tags do anyway? XD


Ah, hehe... Oh, basically I am trying to write a plugin for the 
Textpattern CMS:




processTags() is a core TXP function... Basically, it parses any TXP 
template tags ().


Long story short, I am am modifying the processTags() function so that 
it looks for class methods when parsing template tags, vs. looking for 
regular functions.


Thanks again Casey! I really appreciate your help. :)
Cheers,
Micky

--
Wishlist: 
Switch: 
BCC?: 
My: 

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 10:06 PM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Casey wrote:
>  > Hmmm. I've searched around, and it seems that only a global would work :/
>
>  Thanks for the help Casey! I really appreciate it. :)
>
>  Yah, I think I will use a global for now... Until I can think of an
>  alternative coding approach.
>
>  Have a good one!
>
>
>
>  Cheers,
>  Micky
>
>
What does mah_process_tags do anyway? XD

-- 
-Casey

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

Hmmm. I've searched around, and it seems that only a global would work :/


Thanks for the help Casey! I really appreciate it. :)

Yah, I think I will use a global for now... Until I can think of an 
alternative coding approach.


Have a good one!

Cheers,
Micky


--
Wishlist: 
Switch: 
BCC?: 
My: 

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 9:37 PM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Casey wrote:
>  > preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
>  > Does this work?
>
>  Awww, does not seem to work. :(
>
>  But maybe I need to dink with the code a bit more...
>
>  I would like to avoid setting a global here. :D
>
>  Thanks for the help Casey! I will let you know if I get it working. I
>  may just have to think of a different approach here.
>
>
>
>  Cheers,
>  Micky
>
>

Hmmm. I've searched around, and it seems that only a global would work :/

-- 
-Casey

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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Casey wrote:

preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?


Awww, does not seem to work. :(

But maybe I need to dink with the code a bit more...

I would like to avoid setting a global here. :D

Thanks for the help Casey! I will let you know if I get it working. I 
may just have to think of a different approach here.


Cheers,
Micky


--
Wishlist: 
Switch: 
BCC?: 
My: 

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



Re: [PHP] Re: Quick email address check

2008-03-30 Thread Chris



I have used this to good effect

 function isEmail($email)
 {
 if
 (eregi("^[a-z0-9]+([-_\.]?[a-z0-9])[EMAIL 
PROTECTED]([-_\.]?[a-z0-9])+\.[a-z]{2,4}",$email))
  {
  return TRUE;
  } else {
  return FALSE;
 }
 }//end function



I often have a '+' in my email address (which is perfectly valid) and
it really annoys me when a site refuses to accept it.


Didn't notice this before but that regex ignores valid TLD's too like 
.museum, .travel .. Probably not that common but certainly valid.


http://en.wikipedia.org/wiki/List_of_Internet_top-level_domains

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] LDAP in php

2008-03-30 Thread Chris

[EMAIL PROTECTED] wrote:
As LDAP can have SQL back-end (I saw an example with PostgreSQL) - is it 
a very wild idea to implement (a simple) LDAP server in php?


We have all the address data already in PostgreSQL and a php application 
managing all of it.


I am thinking of simple uses, such as providing LDAP address books to 
Thunderbird/Squirrelmail users.


For instance, is it too wild to think of Apache/php listening on the 
LDAP port (or so), get the request, parse it, get the data from 
PostgreSQL and send it back to the LDAP client?


If ldap can already use a database backend, just use the normal ldap_* 
functions to do all of the work, don't re-invent it all.


http://www.php.net/ldap


--
Postgresql & php tutorials
http://www.designmagick.com/

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



[PHP] LDAP in php

2008-03-30 Thread [EMAIL PROTECTED]
As LDAP can have SQL back-end (I saw an example with PostgreSQL) - is it 
a very wild idea to implement (a simple) LDAP server in php?


We have all the address data already in PostgreSQL and a php application 
managing all of it.


I am thinking of simple uses, such as providing LDAP address books to 
Thunderbird/Squirrelmail users.


For instance, is it too wild to think of Apache/php listening on the 
LDAP port (or so), get the request, parse it, get the data from 
PostgreSQL and send it back to the LDAP client?


Iv

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



Re: [PHP] PHP 5 file_get_contents() problems

2008-03-30 Thread php
Thanks Greg...I am aware of the allow_url_fopen/allow_url_include 
relationship.

Your suggestion to look into curl was implemented and there still seems to 
be something else afoot.

I created a simple set of curl functions which just printed a remote url to 
the browser window. This tested well on an alternate test site which has PHP 
5 running.

However back on the hosting client I'm having problems with, curl throws the 
following error message:
CURLE_COULDNT_RESOLVE_HOST (6)

Couldn't resolve host. The given remote host was not resolved.

A second test script, uses the popular PayPal Instant Payment Notification 
scheme which opens up a socket connection with the paypal server. Even this 
method of remote communition was defeated.

So I'm lead to believe there is some other PHP configuration (or server 
configuration) which is stopping PHP from connecting with remove services.

Chris



""Greg Bowser"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> The actual setting is allow_url_fopen.  allow_url_include controls whether
> or not you can use a remote URL as an include (however, if allow_url_fopen
> is off, then allow_url_include will also be off.)
>
> The short answer to your question is: yes, there is a way. Several ways, 
> in
> fact. You could use curl, or you could use an Http client written in php.
> The latter involves using either the socket_ or the fsocket functions.
>
>
> * http://scripts.incutio.com/httpclient/
>
> On Tue, Mar 18, 2008 at 10:11 AM, Chris <[EMAIL PROTECTED]> wrote:
>
>> I've encountered a situation where under PHP 5 the file_get_contents()
>> function will not work properly (actually not at all) if the php.ini
>> Filesystem configuration parameter, allow_url_include is set to OFF.
>> According to the PHP documentation allow_url_include is intended to
>> limiting PHP from accessing scripts on other servers.
>>
>> I have read posts that suggest setting allow_url_include to ON as
>> a solution. Well that's great if you have the ability to modify your
>> php.ini. But what if you have an account on a shared hosting system
>> and the hosting company will NOT make the requested change?
>>
>> Is there a work around to this or how would one access remote web 
>> services
>> if allow_url_include is OFF. This looks like a huge problem since many
>> services, like PayPal's IPN and Google maps geocoding, rely on
>> communication
>> with their servers.
>>
>> Thanks,
>> Chris
>>
>>
>>
>> --
>> 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: optimilize web page loading

2008-03-30 Thread Zoltán Németh

Robert Cummings írta:

On Sat, 2008-03-29 at 10:16 +0100, Zoltán Németh wrote:

 One last thing though...
even if this were escaped and even if there were fifty variables
embedded, a good bytecode optimizer (not quite the same as a bytecode
cacher) would optimize the bytecode for caching so that the string is
broken up according to what needs to be interpolated and what does not.

could you tell me more about this bytecode optimizer stuff? how does it
work, how much better/faster is it then APC/EAccelerator/etc?


It really depends on what an optimizer optimizes. TurckMMCache had.has
an optimizer. Zend offers an optimizer too. Optimizer can work in a
number of ways. They may be an explicit part of the bytecode cache
mechanism or possibly plugged as one element in a chain of bytecode
processors... parser -> optmizer -> cacher. I'm not exactly sure how it
works for PHP.

The main difference between a cacher and an optimizer though is that
generally speaking a caher only deals with caching the bytecode. No
processing occurs on the produced bytecode. On the other hand an
optimizer may perform alterates on the bytecodes to enhance speed.

For example... by now most people on the list probably know that:

++$i;

Is faster than:

$i++;

An optmizer might see $i++ and determine that the return value is not
used and thus the operation can be changed from $i++ to ++$i. Smilarly,
the optimizer might encounter the following expression:

$foo = 1 << 8

And reduce the constant expression (1 << 8) to (256). So the expression
essentially becomes:

$foo = 256

Similarly if you take the following expression:

$text = "There was an old man from Nantuckit\n"
   ."Who's sole possession was a bucket.\n"
   ."One day with a grin,\n"
   ."While scratching his chin\n"
   ."He thought, \"I think I'll build a rocket.\"\n";

This could be optimized by removing concatenation operations and
producing a single unified string within the bytecode.

These are just basic optimizations obviously. Optimization is not a new
thing, if you've ever used the -O flags when building a C program then
you know that C compilers can also perform optimizations.

Cheers,
Rob.


thanks, I get the concept

greets,
Zoltán Németh


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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread micky
Hi Casey! Many thanks for your help! I greatly appreciate it. :)

>>  preg_replace_callback($f, 'mah_processTags($arg1)', $text);
> preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
> Does this work?

Ah, interesting... Thanks for the example code... I am at work now, but
will try that as soon as I get home later tonight. Your code examp looks
very promising -- I will let you know how it goes.

A billion thanks!

Cheers,
Micky




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



Re: [PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Casey
On Sun, Mar 30, 2008 at 1:17 AM, Micky Hulse <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  This is probably simple to answer for most of ya'll, but...
>
>  preg_replace_callback($f, 'mah_processTags', $text);
>
>  Besides the matches, how would I pass function args/param to
>  mah_processTags()?
>
>  For example, I would like to do something like this:
>
>  preg_replace_callback($f, 'mah_processTags($arg1)', $text);
preg_replace_callback($f, 'mah_processTags(\'$0\', $arg1)', $text);
Does this work?

>  function mah_processTags($matches, $arg1) { ... }
>
>  Is this even possible? I just want to pass-in $arg1 along with the
>  matches. :)
>
>  Possible?
>
>  Many thanks in advance!!!
>  Cheers,
>  Micky
>
>  --
>  Wishlist: 
>  Switch: 
>  BCC?: 
>  My: 
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
-Casey

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



Re: [PHP] APC & FastCGI != upload progress ?

2008-03-30 Thread steve
Hmmm... I am working on a PHP daemon for comet style connections...
I'll keep that idea in mind. I guess that using Flash is best solution
at the moment.. at least the only one I have working...

I'm guessing that FastCGI is buffering the upload until complete. PHP
docs might want to document that.

FastCGI is also breaking Apache's deflate module, but that is another issue...

-s

On Wed, Mar 26, 2008 at 6:35 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
>
> steve wrote:
>  > We can get upload progress to work with the APC extension for PHP
>  > 5.2.x only on machines that are not using FastCGI. (Apache2.2 if it
>  > matters).
>  >
>  >  Does anyone have a suggestion where to look?
>  >
>  >  Will it even be possible?
>  >
>  >  Thanks in advance,
>  >  -s
>  >
>
>  I built a work around.  It requires you to run a PHP daemon.  It handles
>  the uploads and passes the information off how ever you want.  To a DB,
>  to the filesystem.  Your choice.  From that information, you can create
>  a progress meter.
>
>  I haven't fleshed out all the bugs, but it seems to work like I want it
>  too at least.
>
>  Jim Lucas
>

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



Re: [PHP] new lines in textareas?

2008-03-30 Thread jeffry s
On Mon, Mar 31, 2008 at 12:40 AM, Paul Scott <[EMAIL PROTECTED]> wrote:

>
> On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
> > At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
> > >Hi all,
> > >I have a php script which produces text which is to be displayed
> > >in a textarea.  I have the wrap for the text area set to 'hard'.  I
> > >need to have newlines inserted in the text.
> > > "\n" and "" don't work.  They just get quoted literally in
> > >the text.  I suspect I need to use htmlspecialchars , but don't know
> > >what special character to feed it.
> > >
>
> Only getting to this now, but doesn't nl2br() do what you 
> want?


well, i don't think nl2br() is  a solution here because nl2br() only replace
the '\n' with
 html tags which is displayed inside the textarea. the textarea will
display a new
line with '\n'..

$str = "hello\nworld";
will display

hello
world

in text area. but

$st = 'hello\nworld'.

will be display as

hello\nworld

just like what TG trying to say..


Re: [PHP] Google Pagerank script

2008-03-30 Thread kingzones
This is fully working Script...
http://v1.magicbeandip.com/mbd-file/PageRankXor32.zip
Good Luck!!!

On Sun, Mar 30, 2008 at 11:56 AM, Joey <[EMAIL PROTECTED]> wrote:
> Hello All,
>
>
>
>  Does anyone have a link to source code for a pagerank script?
>
>  I want to provide this to users.
>
>
>
>  Thanks!
>
>
>
>  Joey
>
>
>
>
>
>
>
>



-- 
http://www.kingzones.org/

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



Re: [PHP] new lines in textareas?

2008-03-30 Thread Paul Scott

On Sun, 2008-03-30 at 12:29 -0400, tedd wrote:
> At 9:26 PM -0700 3/29/08, Mary Anderson wrote:
> >Hi all,
> >I have a php script which produces text which is to be displayed 
> >in a textarea.  I have the wrap for the text area set to 'hard'.  I 
> >need to have newlines inserted in the text.
> > "\n" and "" don't work.  They just get quoted literally in 
> >the text.  I suspect I need to use htmlspecialchars , but don't know 
> >what special character to feed it.
> >

Only getting to this now, but doesn't nl2br() do what you want?

--Paul
-- 
.
| 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

Re: [PHP] new lines in textareas?

2008-03-30 Thread tedd

At 9:26 PM -0700 3/29/08, Mary Anderson wrote:

Hi all,
   I have a php script which produces text which is to be displayed 
in a textarea.  I have the wrap for the text area set to 'hard'.  I 
need to have newlines inserted in the text.
"\n" and "" don't work.  They just get quoted literally in 
the text.  I suspect I need to use htmlspecialchars , but don't know 
what special character to feed it.


Apologies if this should go to an HTML forum.  I checked several 
archives and did not find anything useful.  (They tended to tell me 
to put in \n or !)


Thanks

Mary Anderson


Show the code.

Cheers,

tedd

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

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



Re: [PHP] Google Pagerank script

2008-03-30 Thread tedd

At 2:26 AM -0400 3/30/08, Joey wrote:

Hello All,

Does anyone have a link to source code for a pagerank script?

I want to provide this to users.



Sure, a few years ago I spent a considerable amount of time finding 
the code and here it is:


http://www.webbytedd.com/a/page-rank/index.php

It used to work, but now it doesn't.

Anyone care to tell me why it doesn't work anymore and how to fix it?

Cheers,

tedd


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

[PHP] Planet PHP broken?

2008-03-30 Thread Richard Heyes

Hey,

As the subject says really. Last thing it has seems to be "PEAR on a 
Shared Host" dated the start of the 27th.


--
Richard Heyes
Employ me:
http://www.phpguru.org/cv

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



[PHP] E-Library Software

2008-03-30 Thread Ali Reza Sajedi

Hello,

I am looking for an open source php based E-Library sofware.

Could anybody help?

Regards

Ali

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



[PHP] Re: Google Pagerank script

2008-03-30 Thread Colin Guthrie
Joey wrote:
> Does anyone have a link to source code for a pagerank script?
> 
> I want to provide this to users.

Here's one:

$res = mysql_query('SELECT * FROM pages ORDER BY rank');


You should probably be a little more specific! Do you mean a script that
can access Google's webservices to find out the pagerank for a given URL?

Col


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



[PHP] Re: auto generated PDF

2008-03-30 Thread Colin Guthrie
Per Jessen wrote:
> Alain Roger wrote:
> 
>> Concretly, user will buy some products/services online and i would
>> like to send him a PDF invoice via email.
>>
>> is there a PDF module under PEAR or directly under PHP ?
> 
> So far I've seen two approaches to this:  
> 
> 1. LaTeX to PDF
> 2. Openoffice to PDF.
> 
> We use method #2. 


pdflib from PECL
http://pecl.php.net/package/pdflib/

Not pear so not pure PHP.

A pure PHP alternative is:

http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf

HTHs

Col


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



Re: [PHP] new lines in textareas?

2008-03-30 Thread jeffry s
On Sun, Mar 30, 2008 at 2:07 PM, TG <[EMAIL PROTECTED]> wrote:

>
> Is \n included literally because you're using single quotes for the
> variable?
>
> $textdata = 'This is a test\nThis is the second line';
>
> vs...
>
> $textarea = "This is a test\nThis is the second line";
>
> I would guess a lot of the pages you find are talking about what to do
> with
> the text after submitting through the textarea, not re-displaying with
> proper breaks when loading a page containing a text area that should have
> data.
>
> -TG
>
> - Original Message -
> From: Mary Anderson <[EMAIL PROTECTED]>
> To: php-general@lists.php.net
> Date: Sat, 29 Mar 2008 21:26:24 -0700
> Subject: [PHP] new lines in textareas?
>
> > Hi all,
> > I have a php script which produces text which is to be displayed in
> > a textarea.  I have the wrap for the text area set to 'hard'.  I need to
> > have newlines inserted in the text.
> >  "\n" and "" don't work.  They just get quoted literally in the
> > text.  I suspect I need to use htmlspecialchars , but don't know what
> > special character to feed it.
> >
> >  Apologies if this should go to an HTML forum.  I checked several
> > archives and did not find anything useful.  (They tended to tell me to
> > put in \n or !)
> >
> >  Thanks
> >
> > Mary Anderson
>

my client ask me about this problem 2 weeks ago. he want the text to
automatically
go to new line after user type until the end of the line. The only possible
solutions so
far is using wrap='hard' or wrap='soft'
eg: 
but wrap only work on IE & Netscape browser. Not working in firefox.
i guess i want to use javascript to do the text formatting. trigger the
javascript event
every time the user using the onchange event (i never try)..
i is quite complicated & i dont have much time working on it.
so i decided to tell him, it cannot be done :)


Re: [PHP] auto generated PDF

2008-03-30 Thread Per Jessen
Alain Roger wrote:

> Concretly, user will buy some products/services online and i would
> like to send him a PDF invoice via email.
> 
> is there a PDF module under PEAR or directly under PHP ?

So far I've seen two approaches to this:  

1. LaTeX to PDF
2. Openoffice to PDF.

We use method #2. 


/Per Jessen, Zürich


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



[PHP] auto generated PDF

2008-03-30 Thread Alain Roger
Hi,

i want to implement on my web portal electronic invoicing system.
basically data will be stored into PostgreSQL DB.

I would like to know if someone already have experiences with such feature
or where could i find some tutorials or help about this topic.

Concretly, user will buy some products/services online and i would like to
send him a PDF invoice via email.

is there a PDF module under PEAR or directly under PHP ?

thanks a lot,

-- 
Alain

Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008


[PHP] preg_replace_callback(), how to pass function argument/param?

2008-03-30 Thread Micky Hulse

Hi,

This is probably simple to answer for most of ya'll, but...

preg_replace_callback($f, 'mah_processTags', $text);

Besides the matches, how would I pass function args/param to 
mah_processTags()?


For example, I would like to do something like this:

preg_replace_callback($f, 'mah_processTags($arg1)', $text);
function mah_processTags($matches, $arg1) { ... }

Is this even possible? I just want to pass-in $arg1 along with the 
matches. :)


Possible?

Many thanks in advance!!!
Cheers,
Micky

--
Wishlist: 
Switch: 
BCC?: 
My: 

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