php-general Digest 7 Sep 2009 17:00:17 -0000 Issue 6327
Topics (messages 297751 through 297762):
Re: Displaying image paths with spaces
297751 by: Ashley Sheridan
need sample of code for Fast-CGI with php
297752 by: loki
Re: Write Japanese text into an existing PDF [SOLVED]
297753 by: Dave M G
Taking body of an email and storing it in MySQL database
297754 by: Dave M G
297755 by: Richard Heyes
297756 by: Dave M G
297757 by: Jason
297761 by: Paul M Foster
Return XML attribute in DOM
297758 by: Matthew Croud
297759 by: Ashley Sheridan
297760 by: Matthew Croud
Encrypt then decrypt yields extra dots at end
297762 by: Kelly Jones
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
On Sun, 2009-09-06 at 23:40 -0500, Skip Evans wrote:
> Hey all,
>
> I have a CMS system that uses the FCKeditor to allow users to
> create directories in which to store images. FCK allows users
> to create directories with spaces in them, and it's pretty
> deep in the JavaScript code so modifying that is not a simple
> option, so at this point I'm trying to work from the
> assumption that the users will continue to be allowed to
> create directory names with spaces.
>
> All that said, the CMS outputs data in two ways. I'll start
> with the second method because it works and then move on to
> the problem.
>
> What the user has created in the FCKeditor is a path to an
> image that appears like this:
>
> src="/clients/client_118/images//Event%20images/Show%20ads/catspaw1compressed.jpg"
>
> Notice the '%20' codes for the spaces in the directory names
> like 'Event images' and 'Show ads'.
>
> The first way the code is displayed is with an AJAX call. It's
> read on the PHP side, echo'd back out to the JavaScript code
> and inserted into an ID with an innerHTML assignment. This
> method works.
>
> The first way the code is loaded is pure PHP. It's read from
> the database just as it appears above and then echo'd back to
> the browser. However, in the browser it appears like this:
>
> /clients/client_118/images//Event\ images/Show\
> ads/catspaw1compressed.jpg
>
> And of course the browser can't display the image with those
> '\ ' combinations.
>
> So my task is to get it to display the image properly on the
> pure PHP side the same way it does via the AJAX call.
>
> I should also say that the code the image path resides in
> contains a text, etc, so it's a block of content, containing
> both text and image paths.
>
> Is there a way to read and echo this on the PHP side and
> preserve a properly displayable path like the AJAX call, but
> that also won't interfere with the rest of the HTML and text
> code contained within the block of content?
>
> I'm stumped on this one, so any help would be greatly,
> wonderfully, blissfully even....... appreciated.
>
> Thanks,
> Skip
> --
> ====================================
> Skip Evans
> Big Sky Penguin, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://bigskypenguin.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> -- Kurt Vonnegut
>
How are you outputting those URLs? PHP won't just automatically converty
'%20' to a '\ '.
What is the raw URL format you're getting from FCKEditor?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
hello,
if someone have sample of code (C#, C++, delphi, etc.) to call php from an
custom application (custom web server for exemple) throught fast-cgi ?
thanks you by advance
--
stephane
Http://www.arkadia.com/fra/location-vacances/
http://www.arkadia.com/fra/immobilier/vente/france/provence-alpes-cote-d-azur/alpes-maritimes/nice/
http://www.arkadia.com/fra/location-vacances/france/provence-alpes-cote-d-azur/alpes-maritimes/nice/
--- End Message ---
--- Begin Message ---
Tedd,
Thank you for responding.
> I used the PDFB library to create this:
> http://chir.ag/projects/pdfb/
> While I've never used Japanese text, I think as long as you have a font
> for it, it should work.
With these scripts, I've successfully created a script that writes text
on top of a PDF document. Haven't tried Japanese fonts yet, but it looks
possible.
Thank you for the tip.
--
Dave M G
--- End Message ---
--- Begin Message ---
PHP List,
I am working on a project now where I need to check a POP3 mail account,
download any mails there, and store the body and headers of each
individual mail as plain text in a MySQL database.
I have downloaded the POP3 class which seems to be the standard class
everyone uses for POP3 mail checking:
http://www.phpclasses.org/browse/package/2.html
I think I understand how to create an instance of the class and use it
to check the email. The part where you log into the account isn't that
complicated.
But after that it becomes a little strange. It seems that emails are not
mere text files, but have to be assembled line by line?
I thought each email, and their headers, would be something I could just
access, download, and pass along to MySQL. But it seems more complicated
than that.
Has anyone done something like this before?
If someone could let me know how it is that I can create a body of text
for each email (including the headers) so that I can then store it in
the database, that would be awesome.
Any advice would be much appreciated.
--
Dave M G
--- End Message ---
--- Begin Message ---
Hi,
> ...
Sounds like you may have a MIME (an HTML email or one with attachments
etc) email to decode. What you can do is use the PEAR class
Mail_mimeDecode ( http://pear.php.net/package/Mail_mimeDecode ). Pass
it the entire email (headers and all) and it will try to decode it for
you.
--
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org
--- End Message ---
--- Begin Message ---
Richard,
Thank you for responding.
> Sounds like you may have a MIME (an HTML email or one with attachments
> etc) email to decode.
No, the mails should be in plain text format.
I probably didn't describe my issue properly because I don't understand
it fully.
If I can assume all the mails I am receiving are in plain text format -
which they should be because it is within a controlled environment - can
I use PHP to pull out each email from the POP server essentially as a
text file?
I need to find out the sender and subject line, but other than that, the
rest of it (including headers) I just want to store in MySQL.
--
Dave M G
--- End Message ---
--- Begin Message ---
>-----Original Message-----
>From: Dave M G [mailto:[email protected]]
>Sent: 07 September 2009 14:26
>To: Richard Heyes
>Cc: [email protected]
>Subject: Re: [PHP] Taking body of an email and storing it in MySQL database
>
>Richard,
>
>Thank you for responding.
>
>> Sounds like you may have a MIME (an HTML email or one with attachments
>> etc) email to decode.
>
>No, the mails should be in plain text format.
>
I probably didn't describe my issue properly because I don't understand
it fully.
>
>If I can assume all the mails I am receiving are in plain text format -
>which they should be because it is within a controlled environment - can
>I use PHP to pull out each email from the POP server essentially as a
>text file?
>
>I need to find out the sender and subject line, but other than that, the
>rest of it (including headers) I just want to store in MySQL.
Dave,
Take a look on phpclasses.net, they have classes which connect via POP3 and
give you arrays of messages back.
HTH
J
--- End Message ---
--- Begin Message ---
On Mon, Sep 07, 2009 at 07:47:00PM +0900, Dave M G wrote:
> PHP List,
>
> I am working on a project now where I need to check a POP3 mail account,
> download any mails there, and store the body and headers of each
> individual mail as plain text in a MySQL database.
>
> I have downloaded the POP3 class which seems to be the standard class
> everyone uses for POP3 mail checking:
> http://www.phpclasses.org/browse/package/2.html
>
> I think I understand how to create an instance of the class and use it
> to check the email. The part where you log into the account isn't that
> complicated.
>
> But after that it becomes a little strange. It seems that emails are not
> mere text files, but have to be assembled line by line?
>
> I thought each email, and their headers, would be something I could just
> access, download, and pass along to MySQL. But it seems more complicated
> than that.
>
> Has anyone done something like this before?
>
> If someone could let me know how it is that I can create a body of text
> for each email (including the headers) so that I can then store it in
> the database, that would be awesome.
I don't know what your class is doing, but yes, emails are very simple
in structure. Everything above the first bare newline (nothing else on
that line) is header, and everything below it is body. Even mime-encoded
attachments are just part of the body and can be stored as plain text.
Your class may be parsing the emails and assigning various parts of them
to various class members. But emails are downloaded as a stream of bits,
sequentially, top to bottom. Somewhere in the class is a routine which
is sucking up that bit stream. At that point, you can capture it without
other parsing.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
I'm at my wits end here, so close to the finishing line!
Is there a method to return an attribute value of an XML node using
DOM, I can check to see if an attribute exists using hasAttributes()
But I can't retrieve the value.
I'm so desperate i've started to eat dirt.
Many thanks,
Matt
--- End Message ---
--- Begin Message ---
On Mon, 2009-09-07 at 16:37 +0100, Matthew Croud wrote:
>
> I'm at my wits end here, so close to the finishing line!
>
> Is there a method to return an attribute value of an XML node using
> DOM, I can check to see if an attribute exists using hasAttributes()
> But I can't retrieve the value.
>
> I'm so desperate i've started to eat dirt.
>
> Many thanks,
> Matt
Doesn't the DOM have the getAttribute() method?
Thanks,
Ash
http://www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
Doesn't the DOM have the getAttribute() method?
Thanks,
Ash
http://www.ashleysheridan.co.uk
It's not in my reference, though I see it in the PHP manual now.
This is what I have:
_____________________________
$dom = new DomDocument();
$dom -> load("items.xml");
$topics = $dom -> getElementsByTagName("item");
echo("<ul>");
foreach ($topics as $node )
{
echo("<li>". $node -> hasAttributes() ."</li>");
}
echo("</ul>");
______________________________
I'm replacing hasAttributes() with getAttribute() but its throwing me
an error, I'm probably using it incorrectly.
I think I'm drowning in the deep end =/
Could you advise Gamesmaster ?
--- End Message ---
--- Begin Message ---
I thought this code:
$enc=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123","encrypt_me",MCRYPT_ENCRYPT);
$dec=mcrypt_ecb(MCRYPT_RIJNDAEL_256,"salt123",$enc,MCRYPT_DECRYPT);
echo $dec;
would yield "encrypt_me". The actual result is
"encrypt_me......................" (bunch of extra dots).
Why, and how do I fix it?
Does it have something to do w/ the warning I get:
Warning: mcrypt_ecb() [function.mcrypt-ecb]: Attempt to use an empty
IV, which is NOT recommend
I assumed that was a security warning, not a functionality warnings?
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
--- End Message ---