[PHP] Re: execute methods dynamically
Sorry my fault. It's working of course. Am Sun, 20 Mar 2005 18:47:20 +0100 schrieb Rainer Hahnekamp: > Hello everybody, > > I want to write a method in version 4 that executes a method of an object. > As parameter the classname and the methodname is passed: > > function executeMethod($classname, $methodname) { > $object = new $classname(); > $object->$methodname(); > } > > This does not work. What am I doing wrong? > > Greetings, > -Rainer Hahnekamp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute methods dynamically
Hello everybody, I want to write a method in version 4 that executes a method of an object. As parameter the classname and the methodname is passed: function executeMethod($classname, $methodname) { $object = new $classname(); $object->$methodname(); } This does not work. What am I doing wrong? Greetings, -Rainer Hahnekamp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expedia.com
Red Wingate wrote: Allmost, after having a quick look at the source i tell you they do it like that: ... loading stuff here ... . page loading here done? JS: document.getElementByid('loading').display='none'; take a look for yourself :-) The idea is great IMHO. But what if someone has javascript disabled? Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PEAR::DB is great but is sooooo SLOW !
Greg wrote: Hello, I've just performed a few tests when using PEAR::DB and the results weren't good at all. If I compare a script using PEAR::DB with a script using standard functions (and which supports mysql, pgsql and sqlite databases), the script using PEAR::DB is 10 times slower than the other. In one of my projects, it slows down execution time to 0,7 sec per page ! Conclusion : if you want to use PEAR::DB package, you'll probably will have to use cache systems for scripts that may be request often. Am I the only one annoying by this loss of performance ? Because this is a huge loss in that case ! Greg Remember, PEAR::DB also uses the standard functions, so I can't understand, why it should be much slower. Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 5 Documentation
Fidencio Monroy wrote: Does PHP 5 documentation exist? I have not found it in php.net. can someone send link please? Tnx There is only one documentation with version numbers for each function. http://www.php.net/docs.php Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Recommend an IDE for Windows
Chris Lott wrote: I already use and am happy with a variety of text editors (vim, emacs, ultraedit, jedit, Homesite) depending on my needs, but I would like recommendations for a PHP specific IDE that will run on Windows XP. Specifically I am looking for something that can help with debugging, provides efficient code browsing (functions, objects, etc) across multiple files in a project, easy browsing through proper mappings to a development server/local server, and hooks to PHP reference/help/website. Needless to say, standard features like syntax highlighting, block formatting, etc. are a requirement. I've been looking at Zend Studio and Nusphere PHPEd as primary candidates. However, I have a short window to buy something (fiscal year issues) so any comments on these two editors (separately or in comparison to one another) or other tools I should be looking at would be greatly appreciated! c -- Chris Lott http://www.phpedit.net - It's still free, but the license model will change soon AFAIK. Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OR
Aidan Lister schrieb: if (cond || cond2) OR if (cond OR cond2) What do you use, and why? It doesn't matter except you combine it because || has a higher priority as OR. Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Auth
Anton Krall schrieb: Guys. Im doing a small php auth system and I was wondering, how can avoid having to do a form to pass the user and pw to the php scripts and just use the popup auth windows on IE and NS? do you remember the names of the vars that get passed thru that popup or how can I invoke it? Thx! This is called "Basic Auth" and google should give you some infos. Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Print out all the files in a directory
Pooya Eslami schrieb: Hi, I want to write a simple script that looks for all the files with a common name and show them, like all the .mp3 files or all the .doc files. How do I go about it? Thank you, -Pooya Look in the manual at php.net, especially: http://php.net/opendir http://php.net/readdir http://php.net/closedir Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: timestamp to readabe date and time ?
Damian Brown schrieb: I need to output a date and time that shows more clearly than just outputting the timestamp what is the correct way to go about it ? I have looked at getdate(), but I haven't fathomed it out yet ! -- www.phpexpert.org/truefaith.htm "True Faith is not just when you believe in God and yourself, it is when others begin to believe in you as well" - Damian John Paul Brown 2004 It is from an MySQL database with the field types DATETIME, DATE or TIME? When you can use the mysql function DATE_FORMAT() Example: SELECT *,DATE_FORMAT(mydate,'%d.%m.%y - %H:%i') AS mydate FROM foo (mydate is the name of the column) Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php 5 install
Andy B schrieb: anybody know how to put that in english?? i have no clude what it says... - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, April 10, 2004 5:13 PM Subject: Re: [PHP] php 5 install Hallo und guten Tag, herzlichen Dank für Ihre Mail. Zeit zu leben und Zeit zum Schreiben machen gerade Osterpause, weshalb Emails nur sehr sporadisch gelesen werden. Aber keine Sorge - keine Mail geht verloren :-) Der nächste Newsletter für Zeit zu leben erscheinen zum 19.4.04, der für Zeit zum Schreiben zum 1.5.04. Ab dem 19.4.04 sind wir dann auch wieder regulär für Sie da - Ihre Anfragen werden spätestens dann beantwortet. Wundervolle Frühlingstage und ein schönes Osterfest wünschen Ihnen Tania Konnerth & Ralf Senftleben -- Alles für ein aktives Leben - http://www.zeitzuleben.de Lust zum Schreiben? http://www.zeitzumschreiben.de Okay, I try it: Hello and a good day, thanks for your mail. "Zeit zu leben" (Time To Life) and "Zeit zum Schreiben" (Time To Write) have an easter break at the moment, so emails will be read only sporadically. But don't worry - no mail will be lost. The next newsletter for "Zeit zu leben" will be released at 19.04.04 and for "Zeit zum Schreiben" at 01.05.04. After 19.04.04 we will be back for you regularly - Your requests will be answered then at the latest. Wonderful spring-days and a beautiful Easter wish you Tania Konnerth & Ralf Senftleben Hope it is not too bad :) Seems like an auto-reply... Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query strings coming from the same page going back to the same page
Andy B schrieb: was wondering if this would work or do i need different code: 12)){ $query="SELECT Type, StartDate, EndDate, Name, County, Notes FROM $EventsTable ORDER BY StartDate DESC"; } else { $query="SELECT Type, StartDate, EndDate, Name, County, Notes FROM $EventsTable WHERE StartingMonth='{$_GET['month']}' ORDER BY StartDate DESC";} mysql_pconnect($host, $mysqluser, $mysqlpwd)||die(mysql_error()); $result=mysql_query($query) or die(mysql_error()); ?> then i would have a link on the same page this code came from: Jan the link is supposed to reload the same page it came from and be bart of the query above... the thing im not sure of is if that will work or not or do i need something else...(new to self referrencing pages)... Probably it is better to use Jan Then it is not in dependency to the filename. And btw. you should check with is_numeric() if the value from $_GET['month'] is really a number or you will have an security hole in you script. Rainer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] finding location of document
Have a look on http://us2.php.net/manual/en/function.parse-url.php So long Rainer Bendig crossx.net | wbbreference.de -Original Message- From: rogue [mailto:[EMAIL PROTECTED] Sent: Sunday, November 09, 2003 12:06 AM To: [EMAIL PROTECTED] Subject: [PHP] finding location of document Hi there, I am trying to figure this out and can't find the right combination to get what I want in a certain situation. Suppose I am running a script from an URL like: http://127.0.0.1/~myname/foo/bar.php on this page I want to redirect to another page and send a full http string like: $redirect = "http://"; . $_SERVER['HTTP_HOST'] . "/foo/hello.php"; In this case, $_SERVER['HTTP_HOST'] is 127.0.0.1 How can I get the ~/myname/ Thanks rogue BTW. Please copy me directly on any replies as I am on the digest. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I find double values in an associative array
Hello group, Can anybody tell me how I easily compare values in an associative array? I would like to find double values I have for instance an array like: $foo['key1'] = 'abc'; $foo['key2'] = 'def'; $foo['key3'] = 'abc'; $foo['key4'] = 'ghi'; and I want to get the value 'abc' ... Please send me an email ([EMAIL PROTECTED]) because my newsgroups doesn't always work properly! Thanx, Rainer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Tricky array question
Hi Andy, What Niklas wrote is true, at this moment it works fine, but. when I write code, I always ask myself which factors are constant and still will work in, let's say, about 3 years from now. The fact is that you cannot know which kind of useragents (read browsertypes) there will be in future. What you DO know is that w3c is setting up rules on which future useragents will rely on. If you follow these rules you won't be surprised in future! Look at www.w3c.org -> XHTML. My suggestion: in your html-doc -> etc.. etc.. in mycode.php -> Rainer. "Andy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello Rainer, > > what kind of disadvantages do I take with me, if my form does not validate? > Is this a problem because of the spiders, > or the functionality? > > It works fine so far on all browsers I know. > > Can you please give more details? > > Thanx Andy > > > "Rainer" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi Andy, > > > > I was just reading your message, do I see that you send an array with a > > form? > > Like ? > > I just wanted you to know that using brackets [] is not allowed in the > > html-name attribute! Your html-page will not validate :( > > > > The sollution is sending al your vars as simple vars (no array) and > collect > > them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables. > > > > Maybe this will also be a sollution for your problem... just take a look > > from another point of view :) > > > > Cheers, > > Rainer. > > > > > > "Andy" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hi there, > > > > > > I have a tricky array question. > > > > > > My app is passing via post a array variable called glacier. Now I am > > > checking for the content > > > of this array. Because there are more of those arrays, I am getting all > > the > > > names out of a db. > > > > > > How is it possible to get the value and keep the name of the array > > dynamic? > > > > > > e.g: > > > Array name passed by post is: $glacier > // > > > contains e.g. $glacier[0] = testname > > > Array with category names coming out of db is: $category // contains > > e.g. > > > $category[0] = glacier > > > > > > echo $categories[0]; // returns glacier > > > echo $glacier[0]; // returns testname > > > > > > I tryed $categories[0][0] but it returns only the first letter of > glacier > > > (g) > > > > > > Any ideas?? > > > > > > Thanx, Andy > > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Tricky array question
Hi Andy, I was just reading your message, do I see that you send an array with a form? Like ? I just wanted you to know that using brackets [] is not allowed in the html-name attribute! Your html-page will not validate :( The sollution is sending al your vars as simple vars (no array) and collect them with HTTP_GET_VARS[] or HTTP_POST_VARS[], php-variables. Maybe this will also be a sollution for your problem... just take a look from another point of view :) Cheers, Rainer. "Andy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi there, > > I have a tricky array question. > > My app is passing via post a array variable called glacier. Now I am > checking for the content > of this array. Because there are more of those arrays, I am getting all the > names out of a db. > > How is it possible to get the value and keep the name of the array dynamic? > > e.g: > Array name passed by post is: $glacier // > contains e.g. $glacier[0] = testname > Array with category names coming out of db is: $category // contains e.g. > $category[0] = glacier > > echo $categories[0]; // returns glacier > echo $glacier[0]; // returns testname > > I tryed $categories[0][0] but it returns only the first letter of glacier > (g) > > Any ideas?? > > Thanx, Andy > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HTTP Error 405 using POST method
In your example I see that you forgot after your ... maybe that's the problem! "Scott Adams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi. I'm learning PHP3 on an IIS 4.0 box and I started by trying out this > simple HTML form. The form lets the user input his/her name, email address, > and select whether he/she likes oranges or apples and sends the data to a > .php file that displays what the user input on the HTML form. The form > method is POST. When I submit the data I type, I receive an HTTP Error 405 > message with the following text: > > HTTP Error 405 > 405 Method Not Allowed > > The method specified in the Request Line is not allowed for the resource > identified by the request. Please ensure that you have the proper MIME type > set up for the resource you are requesting. > > Please contact the server's administrator if this problem persists. > > > Here is the HTML page with the form I am using: > > > > Request for more information > > Would you like more information about our company? > > > Your name: > > > Your email address: > > > I prefer: > > Apples > Oranges > > > > > > > > > What am I doing wrong? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compare values in an array
Can anybody tell me how I easily compare values in an associative array? I have for instance an array like: $foo['key1'] = 'abc'; $foo['key2'] = 'def'; $foo['key3'] = 'abc'; $foo['key4'] = 'ghi'; and I want to get the value 'abc' ... Please send me an email ([EMAIL PROTECTED]) because my newsgroups doesn't always work properly! Thanx, Rainer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Get Operating System
"Philip Olson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You may want to use the predefined constant PHP_OS as described here : Thanks Philip, that was exactly I was looking for, so I tried to reinvent the wheel :-) (RYFM). Nevertheless it's strange that the getenv function does not return any Value for OSTYPE. I gues that this is a special shell variable the server does not know anything about. Regards, -- Rainer Rosenberger __ NetAktiv, Beratung & Realisierung Dr. Rainer Rosenberger, Fürholzer Weg 6b, D-85375 Neufahrn Fon:+49 8165 66506, Fax:+49 8165 66507, Mobil:+49 172 7789381 mailto:[EMAIL PROTECTED] http://www.NetAktiv.de/ __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: return value from recursive function
Hi, your call to abc_recurse returns the return value of the FIRST call. You forgot to pass the result back to the calling funtions (below corrected code). Regards -- Rainer Rosenberger __ NetAktiv, Beratung & Realisierung Dr. Rainer Rosenberger, Fürholzer Weg 6b, D-85375 Neufahrn Fon:+49 8165 66506, Fax:+49 8165 66507, Mobil:+49 172 7789381 mailto:[EMAIL PROTECTED] http://www.NetAktiv.de/ __ "Jaskirat" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > How to get return value from a recursive function .. here is the test code > which I was trying > > function abc_recurse() > { > static $i = 1; > echo $i; > $i++; > if ($i == 4) return ("xyz"); > abc_recurse(); > > } > > $returnvalue = abc_recurse(); > echo $returnvalue; > > ?> > Its printing "123" where as I was expecting "123xyz" > what is happening to $returnvalue > > TIA > Jaski > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Get Operating System
I tried to detect the Web-Servers operating system. Under Windows it's easy to read the environment variable "OS" (or one of the relatet Server Varaibles). Under Linux I found the following very strange behaviour: system("echo \$OSTYPE") correctly returns "linux-gnu" whereas getenv("OSTYPE") returns nothing Any idea why the simple getenv-solution does not work. Any simpler solution than calling the shell "echo"? Regards -- Rainer Rosenberger ______ NetAktiv, Beratung & Realisierung Dr. Rainer Rosenberger, Fürholzer Weg 6b, D-85375 Neufahrn Fon:+49 8165 66506, Fax:+49 8165 66507, Mobil:+49 172 7789381 mailto:[EMAIL PROTECTED] http://www.NetAktiv.de/ __ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Can i get the full HTTP-Header without patching PHP?
Hi, is there a way to get the full HTTP Header without patching PHP? I use a debugger coded in PHP a lot. Now i need to debug some intershop enfinity pages. However, enfinity uses a lot of fields with the same names. So my debugger overwrites the variables and i get only the last one. As i cant change the code (wouldn't work anymore then) i cant debug without having access to the full http header. (i can make arrays for duplicate variables for myself then) Same problem with some kind of e-cash system. It validates itself by putting a signature into the header. However, PHP cant validate the header as i have no chance to get the original header. (And i cant rebuild the original header of course) If there is no way without patching to get these informations are there any plans to integrate a function for getting the header in future versions of php? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
rjs Wed Mar 21 12:55:35 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page) and PDF_close_pdi_page will lose one parameter. These changes are done for the phpwrapper now. This has no impact on PDFlib V3.x. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.77 php4/ext/pdf/pdf.c:1.78 --- php4/ext/pdf/pdf.c:1.77 Fri Mar 9 18:21:38 2001 +++ php4/ext/pdf/pdf.c Wed Mar 21 12:55:34 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.77 2001/03/10 02:21:38 hirokawa Exp $ */ +/* $Id: pdf.c,v 1.78 2001/03/21 20:55:34 rjs Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -185,6 +185,7 @@ PHP_FE(pdf_open_pdi, NULL) PHP_FE(pdf_close_pdi, NULL) PHP_FE(pdf_open_pdi_page, NULL) + PHP_FE(pdf_place_pdi_page, NULL) PHP_FE(pdf_close_pdi_page, NULL) PHP_FE(pdf_get_pdi_parameter, NULL) PHP_FE(pdf_get_pdi_value, NULL) @@ -293,7 +294,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.77 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.78 $" ); php_info_print_table_end(); } @@ -2684,24 +2685,50 @@ RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET); } -/* {{{ proto void pdf_close_pdi_page(int pdf, int doc, int page); +/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double +sx, double sy) + * Place a PDF page with the lower left corner at (x, y), and scale it. */ +PHP_FUNCTION(pdf_place_pdi_page) { + zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6; + PDF *pdf; + + if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, +&arg4, &arg5, &arg6) == FAILURE) { + WRONG_PARAM_COUNT; + } + + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); + + convert_to_long_ex(arg2); + convert_to_double_ex(arg3); + convert_to_double_ex(arg4); + convert_to_double_ex(arg5); + convert_to_double_ex(arg6); + + PDF_place_pdi_page(pdf, + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET, + (float) Z_DVAL_PP(arg3), + (float) Z_DVAL_PP(arg4), + (float) Z_DVAL_PP(arg5), + (float) Z_DVAL_PP(arg6)); + + RETURN_TRUE; +} + +/* {{{ proto void pdf_close_pdi_page(int pdf, int page); * Close the page handle, and free all page-related resources. */ PHP_FUNCTION(pdf_close_pdi_page) { - zval **arg1, **arg2, **arg3; + zval **arg1, **arg2; PDF *pdf; - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == +FAILURE) { WRONG_PARAM_COUNT; } ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_long_ex(arg2); - convert_to_long_ex(arg3); PDF_close_pdi_page(pdf, - Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET, - Z_LVAL_PP(arg3)-PDFLIB_IMAGE_OFFSET); + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET); RETURN_TRUE; } @@ -2854,7 +2881,7 @@ PHP_FUNCTION(pdf_setcolor) { zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7; PDF *pdf; - int c1; + double c1; if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) { WRONG_PARAM_COUNT; @@ -2870,11 +2897,11 @@ convert_to_double_ex(arg7); if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) { - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; + c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) { - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; + c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; } else { - c1 = (float) Z_DVAL_PP(arg4); + c1 = Z_DVAL_PP(arg4); } PDF_setcolor(pdf, Index: php4/ext/pdf/php_pdf.h diff -u php4/ext/pdf/php_pdf.h:1.15 php4/ext/pdf/php_pdf.h:1.16 --- php4/ext/pdf/php_pdf.h:1.15 Thu Mar 1 11:51:54 2001 +++ php4/ext/pdf/php_pdf.h Wed Mar 21 12:55:34 2001 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: php_pdf.h,v 1.15 2001/03/01 19:51:54 rjs Exp $ */ +/* $Id: php_pdf.h,v 1.16 2001/03/21 20:55:34 rjs Exp $ */ #ifndef PHP_PDF_H #define PHP_PDF_H @@ -151,6 +151,7 @@ PHP_FUNCTION(pdf_open_pdi); PHP_FUNCTION(pdf_close_pdi); PHP_FUNCTION(pdf_open_pdi_page); +PHP_FUNCTION(pdf_place_pdi_page); PHP_FUNCTION(pdf_close_pdi_page); PHP_FUNCTION(pdf_get_p
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
rjs Mon Mar 5 08:18:50 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: fixed bug in PDF_getbuffer (happend only on Windows) When using PDFlib V4.0 the pdf_set(grey/rgbcolor) functions are replaced by the PDFlib V4.0 function pdf_setcolor Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.74 php4/ext/pdf/pdf.c:1.75 --- php4/ext/pdf/pdf.c:1.74 Thu Mar 1 11:51:53 2001 +++ php4/ext/pdf/pdf.c Mon Mar 5 08:18:50 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.74 2001/03/01 19:51:53 rjs Exp $ */ +/* $Id: pdf.c,v 1.75 2001/03/05 16:18:50 rjs Exp $ */ /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. @@ -293,7 +293,7 @@ #else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.74 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.75 $" ); php_info_print_table_end(); } @@ -1498,7 +1498,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "fill", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray_fill(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1517,7 +1521,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "stroke", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray_stroke(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1536,7 +1544,11 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_double_ex(arg2); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "both", "gray", (float) Z_DVAL_PP(arg2), 0, 0, 0); +#else PDF_setgray(pdf, (float) Z_DVAL_PP(arg2)); +#endif RETURN_TRUE; } /* }}} */ @@ -1557,7 +1569,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "fill", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor_fill(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -1578,7 +1594,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "stroke", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor_stroke(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -1599,7 +1619,11 @@ convert_to_double_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); +#if (PDFLIB_MAJORVERSION >= 4) + PDF_setcolor(pdf, "both", "rgb", (float) Z_DVAL_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4), 0); +#else PDF_setrgbcolor(pdf, (float) Z_DVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); +#endif RETURN_TRUE; } /* }}} */ @@ -2179,11 +2203,7 @@ if (argc == 2) { convert_to_string_ex(arg2); -#ifdef VIRTUAL_DIR - virtual_filepath(Z_STRVAL_PP(arg2), &filename); -#else filename = Z_STRVAL_PP(arg2); -#endif pdf_file = PDF_open_file(pdf, filename); } else { /* open in memory */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/pdf pdf.c php_pdf.h
rjs Thu Mar 1 11:51:54 2001 EDT Modified files: /php4/ext/pdf pdf.c php_pdf.h Log: - integrated new functions vor PDFlib V4.0 (beta1) - all functions accepting strings now support binary strings, by calling the appropriate PDF*2() functions. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.73 php4/ext/pdf/pdf.c:1.74 --- php4/ext/pdf/pdf.c:1.73 Sun Feb 25 22:07:11 2001 +++ php4/ext/pdf/pdf.c Thu Mar 1 11:51:53 2001 @@ -17,7 +17,8 @@ +--+ */ -/* $Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp $ */ +/* $Id: pdf.c,v 1.74 2001/03/01 19:51:53 rjs Exp $ */ +/* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -57,6 +58,9 @@ */ #define PDFLIB_IMAGE_OFFSET1 #define PDFLIB_FONT_OFFSET 1 +#define PDFLIB_PDI_OFFSET 1 +#define PDFLIB_PATTERN_OFFSET 1 +#define PDFLIB_SPOT_OFFSET 1 function_entry pdf_functions[] = { /* sorry for sorting this stuff like the pdflib manual, @@ -109,12 +113,6 @@ PHP_FE(pdf_closepath_fill_stroke, NULL) PHP_FE(pdf_clip, NULL) PHP_FE(pdf_endpath, NULL) - PHP_FE(pdf_setgray_fill, NULL) - PHP_FE(pdf_setgray_stroke, NULL) - PHP_FE(pdf_setgray, NULL) - PHP_FE(pdf_setrgbcolor_fill, NULL) - PHP_FE(pdf_setrgbcolor_stroke, NULL) - PHP_FE(pdf_setrgbcolor, NULL) PHP_FE(pdf_open_image_file, NULL) /* new parameters: [char *stringpram, int intparam] */ PHP_FE(pdf_open_ccitt, NULL)/* new function */ PHP_FE(pdf_open_image, NULL)/* new function */ @@ -174,6 +172,33 @@ #if HAVE_LIBGD13 PHP_FE(pdf_open_memory_image, NULL) #endif + /* depreciatet after V4.0 of PDFlib */ + PHP_FE(pdf_setgray_fill, NULL) + PHP_FE(pdf_setgray_stroke, NULL) + PHP_FE(pdf_setgray, NULL) + PHP_FE(pdf_setrgbcolor_fill, NULL) + PHP_FE(pdf_setrgbcolor_stroke, NULL) + PHP_FE(pdf_setrgbcolor, NULL) + +#if (PDFLIB_MAJORVERSION >= 4) +/* support for new functions in PDFlib V4.0 */ + PHP_FE(pdf_open_pdi, NULL) + PHP_FE(pdf_close_pdi, NULL) + PHP_FE(pdf_open_pdi_page, NULL) + PHP_FE(pdf_close_pdi_page, NULL) + PHP_FE(pdf_get_pdi_parameter, NULL) + PHP_FE(pdf_get_pdi_value, NULL) + PHP_FE(pdf_begin_pattern, NULL) + PHP_FE(pdf_end_pattern, NULL) + PHP_FE(pdf_begin_template, NULL) + PHP_FE(pdf_end_template, NULL) + PHP_FE(pdf_setcolor, NULL) + PHP_FE(pdf_makespotcolor, NULL) + PHP_FE(pdf_arcn, NULL) + PHP_FE(pdf_add_thumbnail, NULL) + PHP_FE(pdf_initgraphics, NULL) + PHP_FE(pdf_setmatrix, NULL) +#endif /* PDFlib >= V4 */ {NULL, NULL, NULL} }; @@ -263,14 +288,22 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); +#if (PDFLIB_MAJORVERSION >= 4) + php_info_print_table_row(2, "PDFlib GmbH Version", PDFLIB_VERSIONSTRING ); +#else php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "Revision", "$Revision: 1.73 $" ); +#endif + php_info_print_table_row(2, "Revision", "$Revision: 1.74 $" ); php_info_print_table_end(); } PHP_MINIT_FUNCTION(pdf) { + if ((PDF_get_majorversion() != PDFLIB_MAJORVERSION) || + (PDF_get_minorversion() != PDFLIB_MINORVERSION)) { + php_error(E_ERROR,"PDFlib error: Version mismatch in wrapper code"); + } le_pdf = zend_register_list_destructors_ex(_free_pdf_doc, NULL, "pdf object", module_number); /* this does something like setlocale("C", ...) in PDFlib 3.x */ @@ -469,7 +502,7 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); - PDF_show(pdf, Z_STRVAL_PP(arg2)); + PDF_show2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); RETURN_TRUE; } /* }}} */ @@ -490,7 +523,7 @@ convert_to_string_ex(arg2); convert_to_double_ex(arg3); convert_to_double_ex(arg4); - PDF_show_xy(pdf, Z_STRVAL_PP(arg2), (float) Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); + PDF_show_xy2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), (float) +Z_DVAL_PP(arg3), (float) Z_DVAL_PP(arg4)); RETURN_TRUE; } /* }}} */ @@ -803,7 +836,7 @@ ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); convert_to_string_ex(arg2); - PDF_continue_text(pdf, Z_STRVAL_PP(arg2)); + PDF_continue_text2(pdf, Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2)); RETURN_TRUE; } /* }}} */ @@ -843,7 +876,12 @@ convert_to_double_ex(arg4); size = Z_DVAL_PP(arg4); } - width = (double) PDF_stringwidth(pdf, Z_STRVAL_PP(arg2), font-PDFLIB_FONT_OFFSET, size)
[PHP-CVS] cvs: php4 /ext/pdf pdf.c
rjs Wed Feb 21 15:30:20 2001 EDT Modified files: /php4/ext/pdf pdf.c Log: When using pdf_get_buffer() and doing a correct cleanup by calling pdf_delete() this always resulted in a coredump (after everything was finished, so only visible in the logfile). So it seems to be neccesary to copy the contents of the result of get_buffer, to avoid this coredump. Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.71 php4/ext/pdf/pdf.c:1.72 --- php4/ext/pdf/pdf.c:1.71 Thu Feb 15 06:48:57 2001 +++ php4/ext/pdf/pdf.c Wed Feb 21 15:30:20 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.71 2001/02/15 14:48:57 thies Exp $ */ +/* $Id: pdf.c,v 1.72 2001/02/21 23:30:20 rjs Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -264,7 +264,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "Revision", "$Revision: 1.71 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.72 $" ); php_info_print_table_end(); } @@ -2176,7 +2176,7 @@ buffer = PDF_get_buffer(pdf, &size); - RETURN_STRINGL((char *)buffer, size, 0); + RETURN_STRINGL((char *)buffer, size, 1); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /ext/pdf Makefile.in config.m4 pdf.c
rjs Mon Feb 12 09:50:39 2001 EDT Modified files: /php4/ext/pdf Makefile.in config.m4 pdf.c Log: added module support (for dl()) for PDFlib the PDF files now tell that they are generated by the PHP binding. Index: php4/ext/pdf/Makefile.in diff -u php4/ext/pdf/Makefile.in:1.6 php4/ext/pdf/Makefile.in:1.7 --- php4/ext/pdf/Makefile.in:1.6Mon May 1 15:38:31 2000 +++ php4/ext/pdf/Makefile.inMon Feb 12 09:50:37 2001 @@ -1,5 +1,8 @@ LTLIBRARY_NAME= libpdf.la LTLIBRARY_SOURCES = pdf.c +LTLIBRARY_SHARED_NAME= libpdf_php.la +PDFLIB_SHARED_LIBBADD= -lpdf +LTLIBRARY_SHARED_LIBADD = $(PDFLIB_SHARED_LIBBADD) include $(top_srcdir)/build/dynlib.mk Index: php4/ext/pdf/config.m4 diff -u php4/ext/pdf/config.m4:1.13 php4/ext/pdf/config.m4:1.14 --- php4/ext/pdf/config.m4:1.13 Sun Mar 26 11:47:25 2000 +++ php4/ext/pdf/config.m4 Mon Feb 12 09:50:38 2001 @@ -1,18 +1,19 @@ -dnl $Id: config.m4,v 1.13 2000/03/26 19:47:25 sas Exp $ +dnl $Id: config.m4,v 1.14 2001/02/12 17:50:38 rjs Exp $ AC_MSG_CHECKING(whether to include Pdflib 3.x support) -AC_ARG_WITH(pdflib, -[ --with-pdflib[=DIR] Include pdflib 3.x support. - DIR is the pdflib install directory, - defaults to /usr/local.], -[ -echo $withval - case "$withval" in + +PHP_ARG_WITH(pdflib,whether to include pdflib support, +[ --with-pdflib[=DIR] Include pdflib 3.x support. DIR is the pdflib + base install directory, defaults to /usr/local + Set DIR to "shared" to build as dl, or "shared,DIR" + to build as dl and still specify DIR.]) + + case "$PHP_PDFLIB" in no) AC_MSG_RESULT(no) ;; yes) AC_MSG_RESULT(yes) - PHP_EXTENSION(pdf) + PHP_EXTENSION(pdf, $ext_shared) old_LDFLAGS=$LDFLAGS old_LIBS=$LIBS LIBS="$LIBS -ltiff -ljpeg -lpng -lz" @@ -20,7 +21,8 @@ [AC_MSG_ERROR(pdflib extension requires at least pdflib 3.x. You may also need libtiff and libjpeg. If so, use the options --with-tiff-dir= and --with-jpeg-dir=)]) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS - AC_ADD_LIBRARY(pdf) + PHP_SUBST(PDFLIB_SHARED_LIBADD) + AC_ADD_LIBRARY(pdf, PDFLIB_SHARED_LIBADD) AC_ADD_LIBRARY(tiff) AC_ADD_LIBRARY(png) AC_ADD_LIBRARY(jpeg) @@ -30,7 +32,7 @@ test -f $withval/include/pdflib.h && PDFLIB_INCLUDE="$withval/include" if test -n "$PDFLIB_INCLUDE" ; then AC_MSG_RESULT(yes) -PHP_EXTENSION(pdf) +PHP_EXTENSION(pdf, $ext_shared) old_withval=$withval if test $HAVE_ZLIB; then @@ -113,12 +115,10 @@ AC_CHECK_LIB(pdf, PDF_show_boxed, [AC_DEFINE(HAVE_PDFLIB,1,[ ]) PDFLIB_LIBS="$PDFLIB_LIBS -L$withval/lib -lpdf"], [AC_MSG_ERROR(pdflib extension requires pdflib 3.x.)]) LIBS=$old_LIBS -AC_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib) + PHP_SUBST(PDFLIB_SHARED_LIBADD) +AC_ADD_LIBRARY_WITH_PATH(pdf, $withval/lib, PDFLIB_SHARED_LIBADD) AC_ADD_INCLUDE($PDFLIB_INCLUDE) else AC_MSG_RESULT(no) fi ;; esac -],[ - AC_MSG_RESULT(no) -]) Index: php4/ext/pdf/pdf.c diff -u php4/ext/pdf/pdf.c:1.69 php4/ext/pdf/pdf.c:1.70 --- php4/ext/pdf/pdf.c:1.69 Wed Jan 31 23:07:09 2001 +++ php4/ext/pdf/pdf.c Mon Feb 12 09:50:38 2001 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: pdf.c,v 1.69 2001/02/01 07:07:09 steinm Exp $ */ +/* $Id: pdf.c,v 1.70 2001/02/12 17:50:38 rjs Exp $ */ /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997-1999 Thomas Merz. 2000-2001 PDFlib GmbH */ @@ -29,9 +29,9 @@ #include "ext/standard/head.h" #include "ext/standard/info.h" #include "ext/standard/file.h" -#include "ext/gd/php_gd.h" #if HAVE_LIBGD13 +#include "ext/gd/php_gd.h" #include "gd.h" #endif @@ -193,25 +193,14 @@ ZEND_GET_MODULE(pdf) #endif -static void _free_pdf_image(zend_rsrc_list_entry *rsrc) -{ - int *pdf_image = (int *)rsrc->ptr; - if(pdf_image) efree(pdf_image); -} - static void _free_pdf_doc(zend_rsrc_list_entry *rsrc) { - PDF *pdf = (PDF *)rsrc->ptr; /* RJS: TODO: + PDF *pdf = (PDF *)rsrc->ptr; check whether pdf-Pointer is still valid, before pdf_delete() + remove php-resource */ - PDF_delete(pdf); -} - -static void _free_outline(zend_rsrc_list_entry *rsrc) -{ - int *outline = (int *)rsrc->ptr; - if(outline) efree(outline); + /* PDF_delete(pdf); +*/ } static void custom_errorhandler(PDF *p, int type, const char *shortmsg) @@ -275,7 +264,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "PDF Support", "enabled" ); php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); - php_info_print_table_row(2, "Revisi