[PHP] LAMP appliance

2012-05-31 Thread Jordi Massaguer Pla

Hi,

I've created a first version of LAMP appliance with SUSEStudio that  
includes phpmyadmin, webalizer and a bunch of php modules.


I am contacting you because I would love to hear some feedback from  
php developers. A part from phpmyadmin and webalizer, what other tools  
do you think should be part of the appliance?


I believe using an appliance can make life easier specially for new  
php developers, so they don't have to configure anything but start  
programming.


You can try the appliance here by clicking on testdrive. Testdrive  
will start a new instance of it on your web browser.


http://susestudio.com/a/61bKK8/lamp-server-32bit

You can also download it as livecd, preload iso, vmware, hyperv, disc  
image or upload it to your amazon account.


Looking forward to your feedback.

Thanks in advance,

jordi

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



[PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread Voß , Marko
Hello,

I need to perform uploading of large files using the HTTP_Request class:

http://pear.php.net/manual/package.http.http-request.php

I am *not* using this one:

http://php.net/manual/en/class.httprequest.php


The HTTP_Request class support the following functions:

setBody() and addFile()

The addFile()-function however simulates a form field and the server 
application does not read the incoming file from such a field. I have to put 
the file content as a stream through the body.

Adding the file content using the setBody()-function will of course cause an 
out of memory error:

$fp = fopen($filename, 'r');
$request-setBody(fread($fp, $filesize($filename)));
$fclose($fp);
$response = $request-sendRequest();


How am I supposed to do that with this class? Are there any alternatives, which 
do not force me to add new PHP dependancies/libraries to the project? I am 
writing a library and do not want to force the users to add dependancies to 
their projects in order to use this library.

I am currently using PHP 5.3.0.


Thank you and best regards,
Marko


---

Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische 
Information mbH. 
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
101892. 
Geschäftsführerin: Sabine Brünger-Weilandt. 
Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.



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



Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers

2012-05-31 Thread Gates, Jeff
From: Matijn Woudt tijn...@gmail.commailto:tijn...@gmail.com
Date: Wednesday, May 23, 2012 3:59 PM
To: a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk 
a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk
Cc: Jeff Gates gat...@si.edumailto:gat...@si.edu, 
php-general@lists.php.netmailto:php-general@lists.php.net 
php-general@lists.php.netmailto:php-general@lists.php.net
Subject: Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers



On Wed, May 23, 2012 at 9:35 PM, Ashley Sheridan 
a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk wrote:
On Wed, 2012-05-23 at 20:54 +0200, Matijn Woudt wrote:

On Tue, May 22, 2012 at 8:15 PM, Gates, Jeff 
gat...@si.edumailto:gat...@si.edu wrote:
 Can anyone tell me what differences I might encounter by working with PHP on 
 a Unix server verses working with PHP on a Windows server. We use Windows 
 production servers here but many of us would like to get more LAMP 
 environments.

 So, I'm wondering if I can use the hive mind here to get a sense of the pros 
 and cons of each platform.

 Thanks.

 Jeff

Apart from all other suggestions, one of the most common errors are
because of different php.ini settings. If you can keep those settings
(mostly) equal, there will not be that many errors.

- Matijn



I would say that's not limited to the distinction between Windows and Linux but 
any server. I've seen what appears to be an identical setup (same version of 
PHP, MySQL, etc) fail only because of a small setting in the php.ini file, just 
because the default was slightly different on the second system; both were 
running Linux.


Yes, ofcourse, that comment was meant for any two systems.

- Matijn

Well, let me also add a related question: what types of problems might I 
encounter if I was trying to set up a Drupal or Wordpress instance on a Windows 
server running PHP as opposed to a Unix server?

Jeff

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



Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers

2012-05-31 Thread Matijn Woudt
On Thu, May 31, 2012 at 3:29 PM, Gates, Jeff gat...@si.edu wrote:
 From: Matijn Woudt tijn...@gmail.commailto:tijn...@gmail.com
 Date: Wednesday, May 23, 2012 3:59 PM
 To: a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk 
 a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk
 Cc: Jeff Gates gat...@si.edumailto:gat...@si.edu, 
 php-general@lists.php.netmailto:php-general@lists.php.net 
 php-general@lists.php.netmailto:php-general@lists.php.net
 Subject: Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers



 On Wed, May 23, 2012 at 9:35 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk wrote:
 On Wed, 2012-05-23 at 20:54 +0200, Matijn Woudt wrote:

 On Tue, May 22, 2012 at 8:15 PM, Gates, Jeff 
 gat...@si.edumailto:gat...@si.edu wrote:
 Can anyone tell me what differences I might encounter by working with PHP on 
 a Unix server verses working with PHP on a Windows server. We use Windows 
 production servers here but many of us would like to get more LAMP 
 environments.

 So, I'm wondering if I can use the hive mind here to get a sense of the pros 
 and cons of each platform.

 Thanks.

 Jeff

 Apart from all other suggestions, one of the most common errors are
 because of different php.ini settings. If you can keep those settings
 (mostly) equal, there will not be that many errors.

 - Matijn



 I would say that's not limited to the distinction between Windows and Linux 
 but any server. I've seen what appears to be an identical setup (same version 
 of PHP, MySQL, etc) fail only because of a small setting in the php.ini file, 
 just because the default was slightly different on the second system; both 
 were running Linux.


 Yes, ofcourse, that comment was meant for any two systems.

 - Matijn

 Well, let me also add a related question: what types of problems might I 
 encounter if I was trying to set up a Drupal or Wordpress instance on a 
 Windows server running PHP as opposed to a Unix server?

 Jeff

You might need to change a few basic configuration options (paths,
database, etc) inside Drupal/Wordpress/.., but otherwise those are
perfectly compatible on Windows  Linux.

- Matijn

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



[PHP] Dynamically Populating Multi-Dimensional Arrays

2012-05-31 Thread Mackintosh, Mike
Hi All,

 

I was working on a project and needed to dynamically populate a
multi-dimensional array based on the size of an array. The script does
exactly what I want it to do, but I can't imagine that it's done in the
best way. I used an eval to construct the array based on the number of
values passed to the index array. When attempting to do the same with
Variable Variables, the addition of brackets caused the PHP Parser to
die.

 

Does anyone have any suggestions or alternatives to achieving the same
results?

 

Thanks,

 

Mike

 

Array:

 

$array = array(

  array('name' = 'Person1', 'username' = 'username1',
'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person2', 'username' = 'username2',
'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person3', 'username' = 'username3',
'join_date' = 12233445996, 'state' = 'NY'),

  array('name' = 'Person4', 'username' = 'username4',
'join_date' = 12233445996, 'state' = 'NJ'),

  array('name' = 'Person5', 'username' = 'username5',
'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person6', 'username' = 'username6',
'join_date' = 12233445566, 'state' = 'NY'),

  array('name' = 'Person7', 'username' = 'username7',
'join_date' = 12233445776, 'state' = 'NY'),

  array('name' = 'Person8', 'username' = 'username8',
'join_date' = 12233445566, 'state' = 'NY'),

  array('name' = 'Person9', 'username' = 'username9',
'join_date' = 12233445996, 'state' = 'NJ'),

);

 

 

Function:

 

function createIndex($array, $index){

   $index_array = array();

 

   foreach($array as $result){

 

  if(is_array($index)){

 $key = '$index_array';

 for($i=0;$i=sizeof($index)-1;$i++){

   $key .= ['{$result[$index[$i]]}'];

 }

 $key .= []; 

 eval($key = \$result;);

  }

  else{

 $index_array[$result[$index]] = $result; 

  }

   }

   

   return $index_array;

}

 

 

Calling Function:

 

print_r(create_index($array, array('state', 'join_date')));

 

 

Output:

 

Array

(

[NJ] = Array

(

[12233445566] = Array

(

[0] = Array

(

[name] = Person1

[username] = username1

[join_date] = 12233445566

[state] = NJ

)

 

[1] = Array

(

[name] = Person2

[username] = username2

[join_date] = 12233445566

[state] = NJ

)

 

[2] = Array

(

[name] = Person5

[username] = username5

[join_date] = 12233445566

[state] = NJ

)

 

)

 

[12233445996] = Array

(

[0] = Array

(

[name] = Person4

[username] = username4

[join_date] = 12233445996

[state] = NJ

)

 

[1] = Array

(

[name] = Person9

[username] = username9

[join_date] = 12233445996

[state] = NJ

)

 

)

 

)

 

[NY] = Array

(

[12233445996] = Array

(

[0] = Array

(

[name] = Person3

[username] = username3

[join_date] = 12233445996

[state] = NY

)

 

)

 

[12233445566] = Array

(

[0] = Array

(

[name] = Person6

[username] = username6

[join_date] = 12233445566

[state] = NY

)

 

[1] = Array

(

[name] = Person8

[username] = username8

[join_date] = 12233445566

[state] = NY

)

 

)

 

[12233445776] = Array

 

Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers

2012-05-31 Thread Bastien Koert
On Thu, May 31, 2012 at 9:38 AM, Matijn Woudt tijn...@gmail.com wrote:
 On Thu, May 31, 2012 at 3:29 PM, Gates, Jeff gat...@si.edu wrote:
 From: Matijn Woudt tijn...@gmail.commailto:tijn...@gmail.com
 Date: Wednesday, May 23, 2012 3:59 PM
 To: a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk 
 a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk
 Cc: Jeff Gates gat...@si.edumailto:gat...@si.edu, 
 php-general@lists.php.netmailto:php-general@lists.php.net 
 php-general@lists.php.netmailto:php-general@lists.php.net
 Subject: Re: [PHP] Differences between PHP on LAMP and PHP on Windows Servers



 On Wed, May 23, 2012 at 9:35 PM, Ashley Sheridan 
 a...@ashleysheridan.co.ukmailto:a...@ashleysheridan.co.uk wrote:
 On Wed, 2012-05-23 at 20:54 +0200, Matijn Woudt wrote:

 On Tue, May 22, 2012 at 8:15 PM, Gates, Jeff 
 gat...@si.edumailto:gat...@si.edu wrote:
 Can anyone tell me what differences I might encounter by working with PHP 
 on a Unix server verses working with PHP on a Windows server. We use 
 Windows production servers here but many of us would like to get more LAMP 
 environments.

 So, I'm wondering if I can use the hive mind here to get a sense of the 
 pros and cons of each platform.

 Thanks.

 Jeff

 Apart from all other suggestions, one of the most common errors are
 because of different php.ini settings. If you can keep those settings
 (mostly) equal, there will not be that many errors.

 - Matijn



 I would say that's not limited to the distinction between Windows and Linux 
 but any server. I've seen what appears to be an identical setup (same 
 version of PHP, MySQL, etc) fail only because of a small setting in the 
 php.ini file, just because the default was slightly different on the second 
 system; both were running Linux.


 Yes, ofcourse, that comment was meant for any two systems.

 - Matijn

 Well, let me also add a related question: what types of problems might I 
 encounter if I was trying to set up a Drupal or Wordpress instance on a 
 Windows server running PHP as opposed to a Unix server?

 Jeff

 You might need to change a few basic configuration options (paths,
 database, etc) inside Drupal/Wordpress/.., but otherwise those are
 perfectly compatible on Windows  Linux.

 - Matijn

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


Why not install virtualbox or something similar and install a flavor
of linux and use that to do your dev on? It more closely mimics what
will be the operating environment and would lead to less hassles

-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread Jim Lucas

On 05/31/2012 03:28 AM, Voß, Marko wrote:

Hello,

I need to perform uploading of large files using the HTTP_Request class:

http://pear.php.net/manual/package.http.http-request.php

How am I supposed to do that with this class? Are there any alternatives, which 
do not force me to add new PHP dependancies/libraries to the project? I am 
writing a library and do not want to force the users to add dependancies to 
their projects in order to use this library.


You don't want to require additional dependencies yet you require PEAR.

Isn't PEAR an addition dependency?



I am currently using PHP 5.3.0.


Thank you and best regards,
Marko



--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

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



Re: [PHP] Dynamically Populating Multi-Dimensional Arrays

2012-05-31 Thread shiplu
On Thursday, May 31, 2012, Mackintosh, Mike wrote:

 Hi All,



 I was working on a project and needed to dynamically populate a
 multi-dimensional array based on the size of an array. The script does
 exactly what I want it to do, but I can't imagine that it's done in the
 best way. I used an eval to construct the array based on the number of
 values passed to the index array. When attempting to do the same with
 Variable Variables, the addition of brackets caused the PHP Parser to
 die.



 Does anyone have any suggestions or alternatives to achieving the same
 results?



 Thanks,



 Mike



 Array:



 $array = array(

  array('name' = 'Person1', 'username' = 'username1',
 'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person2', 'username' = 'username2',
 'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person3', 'username' = 'username3',
 'join_date' = 12233445996, 'state' = 'NY'),

  array('name' = 'Person4', 'username' = 'username4',
 'join_date' = 12233445996, 'state' = 'NJ'),

  array('name' = 'Person5', 'username' = 'username5',
 'join_date' = 12233445566, 'state' = 'NJ'),

  array('name' = 'Person6', 'username' = 'username6',
 'join_date' = 12233445566, 'state' = 'NY'),

  array('name' = 'Person7', 'username' = 'username7',
 'join_date' = 12233445776, 'state' = 'NY'),

  array('name' = 'Person8', 'username' = 'username8',
 'join_date' = 12233445566, 'state' = 'NY'),

  array('name' = 'Person9', 'username' = 'username9',
 'join_date' = 12233445996, 'state' = 'NJ'),

 );





 Function:



 function createIndex($array, $index){

   $index_array = array();



   foreach($array as $result){



  if(is_array($index)){

 $key = '$index_array';

 for($i=0;$i=sizeof($index)-1;$i++){


You should move this  sizeof($index) part out of the loop. It should look
like this
$len=sizeof($index);
for($i=0;$i$len;$i++)



-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


[PHP] passing /n into query ERROR

2012-05-31 Thread Don Wieland

I have a query below. When I try to run it with PHP it errors:

DATABASE_ERROR: You have an error in your SQL syntax; check the manual  
that corresponds to your MySQL server version for the right syntax to  
use near 'LINES TERMINATED BY '\n'' at line 38 IN


BUT where I copy the echoed query and paste into into my Sequel Pro  
query editor and run it - works perfectly. Can someone shone some  
light on this? Frustrating - to say the least.


Don

$csv = SELECT u.user_id,
u.first_name AS 
u_first_name,
u.last_name AS 
u_last_name,
c.client_id AS 
c_client_id,
c.first_name AS 
c_first_name,
c.middle_name AS 
c_middle_name,
c.last_name AS 
c_last_name,
c.address AS c_address,
c.city AS c_city,
c.state AS c_state,
c.zip AS c_zip,
c.dob AS dob_ymd,
c.phone_home AS 
c_phone_home,
c.phone_cell AS 
c_phone_cell,
c.phone_work AS 
c_phone_work,
c.email AS c_email,
c.other_contacts AS 
c_other_contacts,
count(*) as apt_qty

FROM tl_appt apt

JOIN tl_clients c on 
c.client_id = apt.client_id
JOIN tl_rooms r on 
r.room_id = apt.room_id
JOIN tl_users u on 
u.user_id = apt.user_id

WHERE

apt.time_start between 
'.$sd.' and '.$ed.'
.$where_sql.

GROUP BY u.user_id, 
c.client_id
having count(*) .$aoper. 
.$aqty.

ORDER BY u.first_name, 
u.last_name, c.last_name, c.first_name
INTO OUTFILE 
'/tmp/.$csv_file..csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '\';
LINES TERMINATED BY 
'.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

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



[PHP] [foreach] - is it proper to...

2012-05-31 Thread Tristan
I'm using Zend Studio and it had a suggestion that I do a foreach as such

foreach($entry as $entry){

}

instead of

foreach($entries as $entry){

}

they both seem to work but, from a readability standpoint and just makes
more sense to me to use method 2. Is it bad practice to go with the 1st
method of coding or preferred?

Thanks, T


Re: [PHP] [foreach] - is it proper to...

2012-05-31 Thread Daniel Brown
On Thu, May 31, 2012 at 12:48 PM, Tristan sunnrun...@gmail.com wrote:
 I'm using Zend Studio and it had a suggestion that I do a foreach as such

 foreach($entry as $entry){

 }

 which would be the same as `foreach ($entry)` --- a syntax
option that doesn't exist, but would be ideal.

 foreach($entries as $entry){

 }

I prefer this method as well, as redefining a variable with its
own name, whether in a foreach loop or elsewhere, not only feels
clunky, but could also quite easily cause issues.  Imagine, for
example, that not all versions of PHP support the same-variable
option, be it by bug, deprecation, et cetera.  It would be a pain to
track down the bug in your code.

 they both seem to work but, from a readability standpoint and just makes
 more sense to me to use method 2. Is it bad practice to go with the 1st
 method of coding or preferred?

To be honest, I didn't know Zend was suggesting that, but if you
want my lowly opinion --- use the second (and your preferred) method.
I can't think of an instance in my experience where I found another
programmer's code using the first method either.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] passing /n into query ERROR

2012-05-31 Thread David OBrien
On Thu, May 31, 2012 at 12:46 PM, Don Wieland d...@pointmade.net wrote:

 I have a query below. When I try to run it with PHP it errors:

 DATABASE_ERROR: You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to use
 near 'LINES TERMINATED BY '\n'' at line 38 IN

 BUT where I copy the echoed query and paste into into my Sequel Pro query
 editor and run it - works perfectly. Can someone shone some light on this?
 Frustrating - to say the least.

 Don

 $csv = SELECT u.user_id,
u.first_name AS
 u_first_name,
u.last_name AS
 u_last_name,
c.client_id AS
 c_client_id,
c.first_name AS
 c_first_name,
c.middle_name AS
 c_middle_name,
c.last_name AS
 c_last_name,
c.address AS
 c_address,
c.city AS c_city,
c.state AS c_state,
c.zip AS c_zip,
c.dob AS dob_ymd,
c.phone_home AS
 c_phone_home,
c.phone_cell AS
 c_phone_cell,
c.phone_work AS
 c_phone_work,
c.email AS c_email,
c.other_contacts AS
 c_other_contacts,
count(*) as apt_qty

FROM tl_appt apt

JOIN tl_clients c
 on c.client_id = apt.client_id
JOIN tl_rooms r on
 r.room_id = apt.room_id
JOIN tl_users u on
 u.user_id = apt.user_id

WHERE


  apt.time_start between '.$sd.' and '.$ed.'

  .$where_sql.

GROUP BY u.user_id,
 c.client_id
having count(*)
 .$aoper. .$aqty.

ORDER BY
 u.first_name, u.last_name, c.last_name, c.first_name
INTO OUTFILE
 '/tmp/.$csv_file..csv'
FIELDS TERMINATED
 BY ','
ENCLOSED BY '\';
LINES TERMINATED BY
 '.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

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

 if you DO NOT specify a LINES TERMINATED BY command it defaults to \n


RE: [PHP] passing /n into query ERROR

2012-05-31 Thread Mackintosh, Mike
-Original Message-
From: Don Wieland [mailto:d...@pointmade.net] 
Sent: Thursday, May 31, 2012 12:46 PM
To: php-general@lists.php.net
Subject: [PHP] passing /n into query ERROR

I have a query below. When I try to run it with PHP it errors:

DATABASE_ERROR: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'LINES TERMINATED BY '\n'' at line 38 IN

BUT where I copy the echoed query and paste into into my Sequel Pro
query editor and run it - works perfectly. Can someone shone some light
on this? Frustrating - to say the least.

Don

$csv = SELECT u.user_id,
u.first_name AS
u_first_name,
u.last_name AS
u_last_name,
c.client_id AS
c_client_id,
c.first_name AS
c_first_name,
c.middle_name AS
c_middle_name,
c.last_name AS
c_last_name,
c.address AS
c_address,
c.city AS
c_city,
c.state AS
c_state,
c.zip AS c_zip,
c.dob AS
dob_ymd,
c.phone_home AS
c_phone_home,
c.phone_cell AS
c_phone_cell,
c.phone_work AS
c_phone_work,
c.email AS
c_email,
c.other_contacts
AS c_other_contacts,
count(*) as
apt_qty

FROM tl_appt apt

JOIN tl_clients
c on c.client_id = apt.client_id
JOIN tl_rooms r
on r.room_id = apt.room_id
JOIN tl_users u
on u.user_id = apt.user_id

WHERE


apt.time_start between '.$sd.' and '.$ed.'

.$where_sql.

GROUP BY
u.user_id, c.client_id
having count(*)
.$aoper. .$aqty.

ORDER BY
u.first_name, u.last_name, c.last_name, c.first_name
INTO OUTFILE
'/tmp/.$csv_file..csv'
FIELDS
TERMINATED BY ','
ENCLOSED BY
'\';
LINES TERMINATED
BY '.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

-- 

You might want to fix your syntax:

FIELDS TERMINATED BY ','
ENCLOSED BY '\';

You have a unnecessary ';'


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



Re: [PHP] passing /n into query ERROR

2012-05-31 Thread David OBrien
On Thu, May 31, 2012 at 12:55 PM, David OBrien dgobr...@gmail.com wrote:

 On Thu, May 31, 2012 at 12:46 PM, Don Wieland d...@pointmade.net wrote:

 I have a query below. When I try to run it with PHP it errors:

 DATABASE_ERROR: You have an error in your SQL syntax; check the manual
 that corresponds to your MySQL server version for the right syntax to use
 near 'LINES TERMINATED BY '\n'' at line 38 IN

 BUT where I copy the echoed query and paste into into my Sequel Pro query
 editor and run it - works perfectly. Can someone shone some light on this?
 Frustrating - to say the least.

 Don

 $csv = SELECT u.user_id,
u.first_name AS
 u_first_name,
u.last_name AS
 u_last_name,
c.client_id AS
 c_client_id,
c.first_name AS
 c_first_name,
c.middle_name AS
 c_middle_name,
c.last_name AS
 c_last_name,
c.address AS
 c_address,
c.city AS c_city,
c.state AS c_state,
c.zip AS c_zip,
c.dob AS dob_ymd,
c.phone_home AS
 c_phone_home,
c.phone_cell AS
 c_phone_cell,
c.phone_work AS
 c_phone_work,
c.email AS c_email,
c.other_contacts
 AS c_other_contacts,
count(*) as apt_qty

FROM tl_appt apt

JOIN tl_clients c
 on c.client_id = apt.client_id
JOIN tl_rooms r on
 r.room_id = apt.room_id
JOIN tl_users u on
 u.user_id = apt.user_id

WHERE


  apt.time_start between '.$sd.' and '.$ed.'

  .$where_sql.

GROUP BY
 u.user_id, c.client_id
having count(*)
 .$aoper. .$aqty.

ORDER BY
 u.first_name, u.last_name, c.last_name, c.first_name
INTO OUTFILE
 '/tmp/.$csv_file..csv'
FIELDS TERMINATED
 BY ','
ENCLOSED BY '\';
LINES TERMINATED
 BY '.\\n.';

echo $csv;



$csv_query = $db-db_query($csv);

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

 if you DO NOT specify a LINES TERMINATED BY command it defaults to \n


 Good gracious ... note the extra ; after ENCLOSED BY


Re: [PHP] [foreach] - is it proper to...

2012-05-31 Thread Tristan
Thanks, well that's why I was asking because we just let a guy go for doing
stuff like that among other obvious bad coding issues and terrible logic.
The guy didn't know what he was doing but, I wanted to make sure I wasn't
out of my mind by pointing that out. I am new to Zend Studio so I don't
know if it was picking that up from other bad code in the project and
suggesting for consistency sake or what. I definitely thought it was
weird.

Thanks again.

On Thu, May 31, 2012 at 10:54 AM, Daniel Brown danbr...@php.net wrote:

 On Thu, May 31, 2012 at 12:48 PM, Tristan sunnrun...@gmail.com wrote:
  I'm using Zend Studio and it had a suggestion that I do a foreach as such
 
  foreach($entry as $entry){
 
  }

  which would be the same as `foreach ($entry)` --- a syntax
 option that doesn't exist, but would be ideal.

  foreach($entries as $entry){
 
  }

I prefer this method as well, as redefining a variable with its
 own name, whether in a foreach loop or elsewhere, not only feels
 clunky, but could also quite easily cause issues.  Imagine, for
 example, that not all versions of PHP support the same-variable
 option, be it by bug, deprecation, et cetera.  It would be a pain to
 track down the bug in your code.

  they both seem to work but, from a readability standpoint and just makes
  more sense to me to use method 2. Is it bad practice to go with the 1st
  method of coding or preferred?

 To be honest, I didn't know Zend was suggesting that, but if you
 want my lowly opinion --- use the second (and your preferred) method.
 I can't think of an instance in my experience where I found another
 programmer's code using the first method either.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/



Re: [PHP] [foreach] - is it proper to...

2012-05-31 Thread Tedd Sperling
On May 31, 2012, at 12:48 PM, Tristan wrote:

 I'm using Zend Studio and it had a suggestion that I do a foreach as such
 
 foreach($entry as $entry){
 
 }
 
 instead of
 
 foreach($entries as $entry){
 
 }
 
 they both seem to work but, from a readability standpoint and just makes
 more sense to me to use method 2. Is it bad practice to go with the 1st
 method of coding or preferred?
 
 Thanks, T

Let's look at that.

In the first case you're doing a foreach loop on an array entitled $entry 
(single) using a variable entitled the same name representing the values in 
each element of the array  -- that doesn't make sense even if it works or is 
recommended by Zend Studio. That would be a hell of a bug to find.

In the second case, I find the syntax more correct. You are doing a foreach 
loop on an array entitled $entries (plural) using the values contained in the 
array as $entry (single) -- that makes much more sense to me.

My $0.02

Cheers,

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



RE: [PHP] [foreach] - is it proper to...

2012-05-31 Thread Mackintosh, Mike
-Original Message-
From: Tedd Sperling [mailto:t...@sperling.com] 
Sent: Thursday, May 31, 2012 1:01 PM
To: php-general General
Cc: Tristan
Subject: Re: [PHP] [foreach] - is it proper to...

On May 31, 2012, at 12:48 PM, Tristan wrote:

 I'm using Zend Studio and it had a suggestion that I do a foreach as 
 such
 
 foreach($entry as $entry){
 
 }
 
 instead of
 
 foreach($entries as $entry){
 
 }
 
 they both seem to work but, from a readability standpoint and just 
 makes more sense to me to use method 2. Is it bad practice to go with 
 the 1st method of coding or preferred?
 
 Thanks, T


But don't forget, the first scenario would be bad coding practice; you
are mutating the array $entry. It will become the last value of the
array you are foreach'ing. $entry begins as an array, and ends as a
string. As a result, I'd suggest to stay away from it. 

The second scenario, $ entries remains an array, and $entry a string.
Thanks,

Mike

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



[PHP] cyberweaponry

2012-05-31 Thread Tedd Sperling
Hi gang:

This is a little early for Friday's Open Comment day, but my memory is 
increasingly more short term and by tomorrow I might forget -- so, here goes.

I watched a interview today where an security expert claimed that the Flame 
Virus was written in a scripted language named lua (http://www.lua.org/).

He said that this was unusual because typically such viruses are written in 
languages like Ruby-on-Rails and such.

So, my question to the group -- has PHP produced any viruses? If not, could it? 
If so, can anyone elaborate on the details?

Cheers,

tedd


_
tedd.sperl...@gmail.com
http://sperling.com






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



Re: [PHP] cyberweaponry

2012-05-31 Thread Joseph Moniz
There was the Never Ever No Sanity worm (
http://news.cnet.com/Net-worm-using-Google-to-spread/2100-7349_3-5499725.html
). One variant of it was written in php the other in perl.


- Joseph Moniz


On Thu, May 31, 2012 at 10:21 AM, Tedd Sperling t...@sperling.com wrote:
 Hi gang:

 This is a little early for Friday's Open Comment day, but my memory is 
 increasingly more short term and by tomorrow I might forget -- so, here goes.

 I watched a interview today where an security expert claimed that the Flame 
 Virus was written in a scripted language named lua (http://www.lua.org/).

 He said that this was unusual because typically such viruses are written in 
 languages like Ruby-on-Rails and such.

 So, my question to the group -- has PHP produced any viruses? If not, could 
 it? If so, can anyone elaborate on the details?

 Cheers,

 tedd


 _
 tedd.sperl...@gmail.com
 http://sperling.com






 --
 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] cyberweaponry

2012-05-31 Thread HallMarc Websites
 -Original Message-
 From: Tedd Sperling [mailto:t...@sperling.com]
 Sent: Thursday, May 31, 2012 1:21 PM
 To: php-general General
 Subject: [PHP] cyberweaponry
 
 Hi gang:
 
 This is a little early for Friday's Open Comment day, but my memory is
 increasingly more short term and by tomorrow I might forget -- so, here
 goes.
 
 I watched a interview today where an security expert claimed that the
Flame
 Virus was written in a scripted language named lua (http://www.lua.org/).
 
 He said that this was unusual because typically such viruses are written
in
 languages like Ruby-on-Rails and such.
 
 So, my question to the group -- has PHP produced any viruses? If not,
could
 it? If so, can anyone elaborate on the details?
 
Malware, Trojans and virii OH MY!!! But seriously, I think we may need to
establish a parameter here to avoid mixing of virii with other types of
non-viral malware.
[] 

Computer virus - a self-replicating program that can transmit itself from
computer to computer. 
Other non-viral Malware - spyware, Trojans basically and program written
with malicious intent that does not self-replicate. 

Or are we talking about malware in general?

Marc Hall
I'm broke so can I borrow 2 cents from Tedd?


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



Re: [PHP] cyberweaponry

2012-05-31 Thread Daniel Brown
On Thu, May 31, 2012 at 1:21 PM, Tedd Sperling t...@sperling.com wrote:

 So, my question to the group -- has PHP produced any viruses? If not, could 
 it? If so, can anyone elaborate on the details?

To my own memory, viruses by definition, no.  However, with that
said, there's tons of PHP malware, including self-replicating worms
that target certain vulnerabilities (such as known exploits in
versions of WordPress).  In fact, one of the most common PHP-scripted
attacks on the web is against an individual script, which has been
packaged in with many other PHP applications - including WordPress -
over the years.  The script, known as TimThumb, has an extremely
well-known vulnerability in past versions, which are still in
widespread use today.

The thing is, a PHP virus would be simple to write, so there
likely are a few out there.  However, because a virus needs direct
interaction to spread it, it would be less effective than something
that is set and forget like a worm.

Conversely, there are worms written in PHP that then inject
JavaScript into PHP/HTML files and, usually using an iframe, attempt
to force a malicious file to be downloaded by the user, who may or may
not believe the interaction to be legitimate.  Still, since PHP isn't
a client-side application, and - aside from a precompiled binary to
match the target operating system - requires the PHP parser to be
present and configured, as well as execution of the script to be
initiated by the user or a predictable automated process, it's
unlikely that a PHP virus (again, by definition) would see enough
success to make it worthwhile to the author.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

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



RE: [PHP] cyberweaponry

2012-05-31 Thread HallMarc Websites
 -Original Message-
 From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of
 Daniel Brown
 Sent: Thursday, May 31, 2012 1:52 PM
 To: Tedd Sperling
 Cc: php-general General
 Subject: Re: [PHP] cyberweaponry
 
 On Thu, May 31, 2012 at 1:21 PM, Tedd Sperling t...@sperling.com wrote:
 
  So, my question to the group -- has PHP produced any viruses? If not,
could
 it? If so, can anyone elaborate on the details?
 
 To my own memory, viruses by definition, no.  However, with that said,
 there's tons of PHP malware, including self-replicating worms that target
 certain vulnerabilities (such as known exploits in versions of WordPress).
In
 fact, one of the most common PHP-scripted attacks on the web is against an
 individual script, which has been packaged in with many other PHP
 applications - including WordPress - over the years.  The script, known as
 TimThumb, has an extremely well-known vulnerability in past versions,
which
 are still in widespread use today.
 
Just to be clear, WordPress core never included TimThumb. It was included in
some Premium themes and various plugins (still is in some plugins). A lot of
the vulnerabilities found in TimThumb have been patched however, the main
issue with it has been the loading of files from external websites and then
caching them on the server where the instance of WP resides. Just wanted to
make sure we don't create a panic.
[] 



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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread Bastien Koert
On Thu, May 31, 2012 at 12:24 PM, Jim Lucas li...@cmsws.com wrote:
 On 05/31/2012 03:28 AM, Voß, Marko wrote:

 Hello,

 I need to perform uploading of large files using the HTTP_Request class:

 http://pear.php.net/manual/package.http.http-request.php

 How am I supposed to do that with this class? Are there any alternatives,
 which do not force me to add new PHP dependancies/libraries to the project?
 I am writing a library and do not want to force the users to add
 dependancies to their projects in order to use this library.


 You don't want to require additional dependencies yet you require PEAR.

 Isn't PEAR an addition dependency?



 I am currently using PHP 5.3.0.


 Thank you and best regards,
 Marko



 --
 Jim Lucas

 http://www.cmsws.com/
 http://www.cmsws.com/examples/
 http://www.bendsource.com/


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


If you don't want dependencies, try swfuploader...uses flash but is
more robust for large file uploads,


-- 

Bastien

Cat, the other other white meat

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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread Jim Lucas

On 05/31/2012 11:34 AM, Bastien Koert wrote:

On Thu, May 31, 2012 at 12:24 PM, Jim Lucasli...@cmsws.com  wrote:

On 05/31/2012 03:28 AM, Voß, Marko wrote:


Hello,

I need to perform uploading of large files using the HTTP_Request class:

http://pear.php.net/manual/package.http.http-request.php

How am I supposed to do that with this class? Are there any alternatives,
which do not force me to add new PHP dependancies/libraries to the project?
I am writing a library and do not want to force the users to add
dependancies to their projects in order to use this library.



You don't want to require additional dependencies yet you require PEAR.

Isn't PEAR an addition dependency?




I am currently using PHP 5.3.0.


Thank you and best regards,
Marko




--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/


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



If you don't want dependencies, try swfuploader...uses flash but is
more robust for large file uploads,




From what I read, he is wanting the server to upload a file to a remote 
machine.  Not a client uploading to his server.


--
Jim Lucas

http://www.cmsws.com/
http://www.cmsws.com/examples/
http://www.bendsource.com/

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



Re: [PHP] Re: Function size

2012-05-31 Thread tamouse mailing lists
On Tue, May 29, 2012 at 2:52 AM, Tony Marston
t...@marston-home.demon.co.uk wrote:
 On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote:
  A rule of thumb is no more than 50 lines per
 function, most much less. Back in the day when we didn't have nifty
 gui screens and an 24 line terminals (yay green on black!), if a
 function exceeded one printed page, it was deemed too long and marked
 for refactoring.

 I think the idea of setting an arbitrary limit on the number of lines that a
 function should contain is quite ludicrous and something which I will
 completely ignore. If a function requires a hundred or more lines then so be
 it. The only reason to take a block of code and put it into its own function
 is when that code is likely to be called more than once so that it conforms
 to the DRY principle. If it is only ever used in one place then there is no
 point.


You obviously haven't spent much time maintaining other people's code.
There is a point: if you are unfamiliar with code, wading through
screens and screens of a function to find things like block
beginning/ends makes for difficult time finding places where changes
need to be made.

If you will never have your code maintained by anyone else, or
collaborate with anyone else, feel free to do what you want.




 The problems I have with creating lots of small used-only-once functions is
 as follows:
 - you have to create a meaningful name for each function.

Yes, you do, which is also considered a hallmark of good design.

 - all those functions should be arranged in alphabetical order within their
 containing file - having them in a random sequence makes it difficult to
 find the one you want.

Also correct; this is a key point in making sure your scripts are maintainable.

 - when browsing through the code you have to keep jumping to another
 function, and then returning to where you came from.

 I don't know about you, but I would rather use the scroll wheel on my mouse
 than keep jumping from one position in the file to another.

May I suggest an editor/IDE that lets you navigate to functions directly, then?

 Another problem I have encountered in the past with such an idea is that it
 encourages a stupid programmer to decrease the number of lines of code by
 compressing as many statements as possible into a single line, which then
 makes the code less easy to read and understand. This is much worse than
 having more than 20 lines in a function.

There are counterbalancing things as well. If the only aspect of one's
coding standards are make it fit on one screen then yes, you might
see someone idiotic enough to do that. However, a good set of coding
standards includes things which will prevent this, such as not
stacking code like that.

 Whether a file contains 10 functions of 100 lines each, or 100 functions of
 10 lines each, you still end up with 1000 lines of code. If you do not have
 the mental capacity to deal with a 100-line function then you are in the
 wrong job.

The rules of thumb for coding standards are for maintainability,
primarily, so throwing up strawmen to try to weasel out of an idea is
pretty specious.

If you do not care about how much time it takes to fix defects in
other people's code, then I hope you remain a solitary programmer and
don't expect anyone else to use your code, otherwise, you are in the
wrong job.

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



Re: [PHP] cyberweaponry

2012-05-31 Thread tamouse mailing lists
On Thu, May 31, 2012 at 12:21 PM, Tedd Sperling t...@sperling.com wrote:
 I watched a interview today where an security expert claimed that the Flame 
 Virus was written in a scripted language named lua (http://www.lua.org/).

Is the interview online someplace? (Youtube?)

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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread tamouse mailing lists
On Thu, May 31, 2012 at 5:28 AM, Voß, Marko marko.v...@fiz-karlsruhe.de wrote:
 Hello,

 I need to perform uploading of large files using the HTTP_Request class:

 http://pear.php.net/manual/package.http.http-request.php

 I am *not* using this one:

 http://php.net/manual/en/class.httprequest.php


 The HTTP_Request class support the following functions:

 setBody() and addFile()

 The addFile()-function however simulates a form field and the server 
 application does not read the incoming file from such a field. I have to put 
 the file content as a stream through the body.

 Adding the file content using the setBody()-function will of course cause an 
 out of memory error:

 $fp = fopen($filename, 'r');
 $request-setBody(fread($fp, $filesize($filename)));
 $fclose($fp);
 $response = $request-sendRequest();


 How am I supposed to do that with this class? Are there any alternatives, 
 which do not force me to add new PHP dependancies/libraries to the project? I 
 am writing a library and do not want to force the users to add dependancies 
 to their projects in order to use this library.

 I am currently using PHP 5.3.0.


 Thank you and best regards,
 Marko


 ---

 Fachinformationszentrum Karlsruhe, Gesellschaft für 
 wissenschaftlich-technische Information mbH.
 Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
 101892.
 Geschäftsführerin: Sabine Brünger-Weilandt.
 Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.



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


Does the receiving server only accept uploads via HTTP? Or is there
another protocol you could use? I'm not aware of anyway via HTTP you
can send chunks up; as far as I know, that only works for
server-client transfers.

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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread tamouse mailing lists
On Thu, May 31, 2012 at 5:28 AM, Voß, Marko marko.v...@fiz-karlsruhe.de wrote:
 I need to perform uploading of large files using the HTTP_Request class:
 http://pear.php.net/manual/package.http.http-request.php
 The HTTP_Request class support the following functions:
 setBody() and addFile()

Reading the above, and checking on the documentation, I notice an inconsistency.

I only find the setBody() method in HTTP_Request2, while addFile() is
in HTTP_Request. The correct method for adding files in HTTP_Request2
is addUpload() (which still may not work given the limitations of the
upstream server).

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



Re: [PHP] Uploading large files with HTTP_Request class

2012-05-31 Thread Matijn Woudt
On Thu, May 31, 2012 at 12:28 PM, Voß, Marko
marko.v...@fiz-karlsruhe.de wrote:
 Hello,

 I need to perform uploading of large files using the HTTP_Request class:

 http://pear.php.net/manual/package.http.http-request.php

 I am *not* using this one:

 http://php.net/manual/en/class.httprequest.php


 The HTTP_Request class support the following functions:

 setBody() and addFile()

 The addFile()-function however simulates a form field and the server 
 application does not read the incoming file from such a field. I have to put 
 the file content as a stream through the body.

 Adding the file content using the setBody()-function will of course cause an 
 out of memory error:

 $fp = fopen($filename, 'r');
 $request-setBody(fread($fp, $filesize($filename)));
 $fclose($fp);
 $response = $request-sendRequest();


 How am I supposed to do that with this class? Are there any alternatives, 
 which do not force me to add new PHP dependancies/libraries to the project? I 
 am writing a library and do not want to force the users to add dependancies 
 to their projects in order to use this library.

 I am currently using PHP 5.3.0.


 Thank you and best regards,
 Marko



If you don't want any additional libraries, I would suggest writing
such a request yourself with the use of simple sockets.

- Matijn

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



[PHP] Re: cyberweaponry

2012-05-31 Thread Ross McKay
On Thu, 31 May 2012 13:21:07 -0400, Tedd Sperling wrote:

[...]
I watched a interview today where an security expert claimed that 
the Flame Virus was written in a scripted language named lua 
(http://www.lua.org/).

That's surprising... I'm intrigued, can you supply a link?

He said that this was unusual because typically such viruses are
written in languages like Ruby-on-Rails and such.

Um, really? I very much doubt that. AFAIK, most true viruses are written
in a compiled language, and many trojans as well. RoR websites would
definitely be a vulnerability target though...

So, my question to the group -- has PHP produced any viruses? If not, 
could it? If so, can anyone elaborate on the details?

It's unlikely to be used for viruses per se, even trojans. Mainly, it's
a target of vulnerability hacks due to the low level of entry to
building websites in PHP and some (now deprecated) truly awful features
like register globals. But even professionally written PHP can serve as
a hack target, as seen in the Plesk fiasco earlier this year:

http://arstechnica.com/business/2012/02/plesk-control-panel-bug-left-ftc-sites-and-thousands-more-exposed-to-anon/
( http://preview.tinyurl.com/8xxjcsj )

I've been burned by that one personally when the servers some customers'
sites are hosted on were taken down by a series of failures triggered by
that hack. The host proudly told me that their security was fine and
that it was WordPress that must have been hacked (because the malware
found was in scripts hidden in the various WP folders). They got awful
busy after reading that link though.
--
Ross McKay, Toronto, NSW Australia
A just machine to make big decisions
 Programmed by fellows with compassion and vision
 We'll be clean when their work is done
 We'll be eternally free yes and eternally young
 What a beautiful world this'll be
 What a glorious time to be free... - Donald Fagan

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



[PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

2012-05-31 Thread Govinda
Hi guys

anyone here using HTMLpurifier and CSStidy together?  (like e.g. to allow users 
to create their own external style sheets via form input)

...for example, in the way this post's answer explains how to use HTMLpurifier 
and CSStidy together:

http://stackoverflow.com/questions/3241616/

If so, do you know how to set CSStidy's config options in that context?

I found how to set CSStidy's config options if I was running CSStidy from the 
command line, or on its _own_ from PHP runtime, but I do not know how to set 
the config options from within HTMLpurifier, or even how to hack/override 
either of those libraries to solve my particular issue.  I looked and hacked 
and thought for sure I would find the offending line of code.. but somehow, 
nothing I have tried is stopping one or both of those libraries from forcing 
all my input CSS into lowercase, which I do not want.  The issue is that I need 
the input CSS's case to be left as the user input it (so that for example 
background image paths in that CSS do not break).

more details, attempted fixes, etc.:
http://stackoverflow.com/questions/10843600/

Thanks for any thoughts/tips of any kind
-Govinda
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

2012-05-31 Thread Tommy Pham
On Thu, May 31, 2012 at 10:33 PM, Govinda govinda.webdnat...@gmail.com wrote:
 Hi guys

 anyone here using HTMLpurifier and CSStidy together?  (like e.g. to allow 
 users to create their own external style sheets via form input)

 ...for example, in the way this post's answer explains how to use 
 HTMLpurifier and CSStidy together:

 http://stackoverflow.com/questions/3241616/

 If so, do you know how to set CSStidy's config options in that context?

 I found how to set CSStidy's config options if I was running CSStidy from the 
 command line, or on its _own_ from PHP runtime, but I do not know how to set 
 the config options from within HTMLpurifier, or even how to hack/override 
 either of those libraries to solve my particular issue.  I looked and hacked 
 and thought for sure I would find the offending line of code.. but somehow, 
 nothing I have tried is stopping one or both of those libraries from forcing 
 all my input CSS into lowercase, which I do not want.  The issue is that I 
 need the input CSS's case to be left as the user input it (so that for 
 example background image paths in that CSS do not break).

 more details, attempted fixes, etc.:
 http://stackoverflow.com/questions/10843600/

 Thanks for any thoughts/tips of any kind
 -Govinda

Have you tried http://htmlpurifier.org/phorum/ and did you noticed
Since the project has been suspended, please only contact me if you
intend to continue maintaining it. for CSSTidy?

Regards,
Tommy

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



Re: [PHP] is there a way to stop HTMLPurifier/CSStidy from forcing input CSS into all lowercase?

2012-05-31 Thread Tommy Pham
On Thu, May 31, 2012 at 10:48 PM, Tommy Pham tommy...@gmail.com wrote:
 On Thu, May 31, 2012 at 10:33 PM, Govinda govinda.webdnat...@gmail.com 
 wrote:
 Hi guys

 anyone here using HTMLpurifier and CSStidy together?  (like e.g. to allow 
 users to create their own external style sheets via form input)

 ...for example, in the way this post's answer explains how to use 
 HTMLpurifier and CSStidy together:

 http://stackoverflow.com/questions/3241616/

 If so, do you know how to set CSStidy's config options in that context?

 I found how to set CSStidy's config options if I was running CSStidy from 
 the command line, or on its _own_ from PHP runtime, but I do not know how to 
 set the config options from within HTMLpurifier, or even how to 
 hack/override either of those libraries to solve my particular issue.  I 
 looked and hacked and thought for sure I would find the offending line of 
 code.. but somehow, nothing I have tried is stopping one or both of those 
 libraries from forcing all my input CSS into lowercase, which I do not want. 
  The issue is that I need the input CSS's case to be left as the user input 
 it (so that for example background image paths in that CSS do not break).

You need to get better tools.  I found this with Notepad++ for Windows
searching case within *.php files filter within the root directory
of the extracted zip/tarball:

  
H:\data\Downloads\dev\PHP\htmlpurifier-4.4.0\library\HTMLPurifier\AttrDef\CSS\Font.php
(6 hits)
Line 45: $lowercase_string = strtolower($string);
Line 46: if (isset($system_fonts[$lowercase_string])) {
Line 47: return $lowercase_string;
Line 61: case 0:
Line 77: case 1:
Line 131: case 2:

Haven't looked at the entire file or source code but that looks close
enough to me... ;)


 more details, attempted fixes, etc.:
 http://stackoverflow.com/questions/10843600/

 Thanks for any thoughts/tips of any kind
 -Govinda

 Have you tried http://htmlpurifier.org/phorum/ and did you noticed
 Since the project has been suspended, please only contact me if you
 intend to continue maintaining it. for CSSTidy?

 Regards,
 Tommy

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