MadeMyDay
Moderators

Posts: 911
|
 |
« Reply #60 on: Oct 12, 2007, 04:58 AM » |
|
Hi Scotty, it was already mentioned in this thread, but once again: Changing of the userimage is not possible if the type of the new image is .jpg. I already tried to add another mime type like this: switch ($_FILES['photo']['type']) { case 'image/jpeg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break;
case 'image/jpg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break; But with no luck... At registration everything is okay. You can also try this at your demo site.
|
|
|
|
|
Logged
|
|
|
|
|
Taff
|
 |
« Reply #61 on: Oct 17, 2007, 08:20 AM » |
|
Is anyone else having issues with dob not being saved to the {prefix}web_user_attributes database correctly? I'm not sure why but when using the default templates and saving a date in the format it states I just get the first bit of the date saved. I looked at the MakeDateForDb function, and it states that the date needs to be in an alternative format to the one being stated in the template (Template says day first, function says month first). Either way it is still only saving the first part of the date to the database i.e. $dateArray[0] Now if I copy the function into a new php file e.g. <?php function MakeDateForDb($date = '11-12-1969')
{ // $date is a string like 01-22-1975. if (strpos($date, '-')) { $dateArray = explode('-', $date); } else if (strpos($date, '/')) { $dateArray = explode('/', $date); } else { return $this->FormatMessage($this->LanguageArray[27]); } $dateArray = explode('-', $date); // $dateArray is somethink like [0]=01, [1]=22, [2]=1975 // make a unix timestamp out of the original date string. $timestamp = mktime(0, 0, 0, $dateArray[0], $dateArray[1], $dateArray[2]); echo $timestamp; } MakeDateForDb(); ?> it seems to output a correct timestamp like -4323600. Any ideas why?
|
|
|
|
|
Logged
|
|
|
|
MadeMyDay
Moderators

Posts: 911
|
 |
« Reply #62 on: Oct 17, 2007, 08:53 AM » |
|
I think you try it with this format : 07/13/1967. This doesn´t work because of an error in the function. Just comment out this line: $dateArray = explode('-', $date); because it overrides the if clauses above.
|
|
|
|
|
Logged
|
|
|
|
MadeMyDay
Moderators

Posts: 911
|
 |
« Reply #63 on: Oct 18, 2007, 08:44 AM » |
|
it was already mentioned in this thread, but once again:
Changing of the userimage is not possible if the type of the new image is .jpg. Solved. Occured only with IE6 which handles jpegs as image/pjpeg  Which surprise that this §"$"§$ Browser doesn´t even handle the file types correctly. Solution: Add this case to the image switch (around line 2850): case 'image/pjpeg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break;
|
|
|
|
|
Logged
|
|
|
|
|
Taff
|
 |
« Reply #64 on: Oct 18, 2007, 09:13 AM » |
|
I think you try it with this format : 07/13/1967. This doesn´t work because of an error in the function. Just comment out this line: $dateArray = explode('-', $date); because it overrides the if clauses above. That was it...It was exploding the array during the if else function and then line 2471 was exploding it again thus returning only a value of the first array... function MakeDateForDb($date) { // $date is a string like 01-22-1975. if (strpos($date, '-')) { $dateArray = explode('-', $date); } else if (strpos($date, '/')) { $dateArray = explode('/', $date); } else { return $this->FormatMessage($this->LanguageArray[27]); } $dateArray = explode('-', $date); // $dateArray is somethink like [0]=01, [1]=22, [2]=1975 // make a unix timestamp out of the original date string. $timestamp = mktime(0, 0, 0, $dateArray[0], $dateArray[1], $dateArray[2]); return $timestamp; }
needs to become function MakeDateForDb($date) { // $date is a string like 01-22-1975. if (strpos($date, '-')) { $dateArray = explode('-', $date); } else if (strpos($date, '/')) { $dateArray = explode('/', $date); } else { return $this->FormatMessage($this->LanguageArray[27]); } // $dateArray is somethink like [0]=01, [1]=22, [2]=1975 // make a unix timestamp out of the original date string. $timestamp = mktime(0, 0, 0, $dateArray[0], $dateArray[1], $dateArray[2]); return $timestamp; } Hence the line around 2471 needs deleting or commenting out. Danke Marc!!! Taff
|
|
|
|
|
Logged
|
|
|
|
|
Soshite
|
 |
« Reply #65 on: Oct 20, 2007, 10:30 AM » |
|
I noticed another bug this morning, dealing with the viewprofile service. It seems that in the Userlist, WLPE properly parses HTML, such as <br />. As an example, Scotty's "signature" on my website's WLPE install. Now, in the viewprofile page, the HTML is not parsed, and it shows the HTML. Maybe this is due to a line of code being in the Userlist function, but not being in the viewprofile function? It's probably an easy fix, but I don't have the time ATM to debug it. If someone could find a fix for this, I'd be very grateful.  (If a user does a normal manual line break (pressing the Enter key), it works fine, btw. It just does this w/ HTML.)
|
|
|
|
|
Logged
|
|
|
|
Guillaume
Moderators

Posts: 711
The future is built today.
|
 |
« Reply #66 on: Oct 29, 2007, 10:58 AM » |
|
Changing of the userimage is not possible if the type of the new image is .jpg. I already tried to add another mime type like this: switch ($_FILES['photo']['type']) { case 'image/jpeg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break;
case 'image/jpg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break; Good thing A little tip  You can do the same thing with fewer line switch ($_FILES['photo']['type']) { case 'image/jpeg': case 'image/jpg': $image = imagecreatefromjpeg($userImage); $ext = '.jpg'; break;
|
|
|
|
|
Logged
|
Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
|
|
|
Guillaume
Moderators

Posts: 711
The future is built today.
|
 |
« Reply #67 on: Oct 29, 2007, 04:02 PM » |
|
Hi all, I found 2 bugs. 1) BUG : The dob is 01-01-1970 by default, I think we should be able not to specify it. SOLUTION : In webloginpe.class.php, approx the line 1773, find this code $modx->setPlaceholder('user.'.$key, strftime('%m-%d-%Y', $value));
and replace it with // CREDIT : Guillaume for not format an empty date $value==0?'':$modx->setPlaceholder('user.'.$key, strftime('%m-%d-%Y', $value));
2)BUG : When you want delete data from your profile you can't : it is impossible to leave blank a field which was not empty. SOLUTION : In webloginpe.class.php, in SaveUserProfile(), approx the line 880, replace the following code foreach ($generalElementsArray as $id => $field) { if ($field == 'photo') { if ($_FILES['photo']['name'] !== '' && !empty($_FILES['photo']['name'])) { $_POST['photo'] = $this->CreateUserImage(); if (!empty($this->Report)) { return; } } } if (isset($_POST[$field]) && ($_POST[$field] !== '')) { if ($field == 'dob') { $_POST['dob'] = $this->MakeDateForDb($_POST['dob']); } // CREDIT: Mike Reid (aka Pixelchutes) for the string escape code. $generalElementsUpdate[] = " `".$field."` = '".$modx->db->escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES)))."'"; } else { unset ($generalElementsArray[$id]); } }
and replace it with // CREDIT: Guillaume to delete data and for code optimisation foreach ($generalElementsArray as $field) { if ($field == 'photo') { if ($_FILES['photo']['name'] !== '' && !empty($_FILES['photo']['name'])) { $_POST['photo'] = $this->CreateUserImage(); if (!empty($this->Report)) { return; } } } if ($field == 'dob' && trim($_POST['dob'])!='') // for not format an empty date else date is 0 (01-01-1970) { $_POST['dob'] = $this->MakeDateForDb($_POST['dob']); } if ($field!='photo' || ($_FILES['photo']['name'] !== '' && !empty($_FILES['photo']['name']))) // for update db with value and blank value (except if the field is 'photo') // CREDIT: Mike Reid (aka Pixelchutes) for the string escape code. $generalElementsUpdate[] = " `".$field."` = '".$modx->db->escape(stripslashes(htmlentities(trim($_POST[$field]), ENT_QUOTES)))."'"; }
|
|
|
|
|
Logged
|
Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
|
|
|
Dr. Scotty Delicious
Moderator

Posts: 1,183
D.F.P.A.
|
 |
« Reply #68 on: Oct 29, 2007, 08:15 PM » |
|
Awesome! Thanks for posting those solutions.
-sD- Dr. Scotty Delicious, DFPA.
|
|
|
|
|
Logged
|
|
|
|
Dimmy
Testers

Posts: 1,898
Я не говорю по-русски 私は日本語を話さない
|
 |
« Reply #69 on: Oct 30, 2007, 07:39 AM » |
|
@Scotty:
any new versions? I am moving to a new server with alll my sites now it runs php 5 so I hope that this wil help.
Dimmy
|
|
|
|
|
Logged
|
|
|
|
Guillaume
Moderators

Posts: 711
The future is built today.
|
 |
« Reply #70 on: Oct 30, 2007, 05:13 PM » |
|
Hi, I think this is a bug. Maybe not... In the snippet call, when you set parameter like this &liHomeId=`57` &loHomeId=`58` we can see the default tpl before to be redirect to the page 57 or 58. If you want to display directely the page 57 or 58 (not to see the default template before), in webloginpe.class.php, find this code in functions LoginHomePage() and LogoutHomePage() : modx->sendRedirect($url,0,'REDIRECT_REFRESH'); and replace by $modx->sendRedirect($url,0,'REDIRECT_HEADER'); // CREDIT: Guillaume to redirect directely
|
|
|
|
|
Logged
|
Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
|
|
|
sottwell
Documentation Team

Posts: 8,837
|
 |
« Reply #71 on: Oct 30, 2007, 11:49 PM » |
|
Ah! Thank you, that's been bugging me a lot! 
|
|
|
|
|
Logged
|
|
|
|
pixelchutes
Coding Team

Posts: 839
|
 |
« Reply #72 on: Oct 31, 2007, 01:52 AM » |
|
Good catch, Guillaume. I previously suggested to Scotty a few locations where 'REDIRECT_HEADER' seems to make more sense than 'REDIRECT_REFRESH', glad to see that others agree! 
|
|
|
|
|
Logged
|
|
|
|
Guillaume
Moderators

Posts: 711
The future is built today.
|
 |
« Reply #73 on: Oct 31, 2007, 06:08 AM » |
|
REDIRECT_HEADER permits to redirect directely to another page but REDIRECT_REFRESH waits the end of all the php script (end of php code) before to redirect. REDIRECT_REFRESH is interesting to refresh (not to redirect) the same page with new parameters or not. REDIRECT_HEADER is to redirect to another page. There has long, I had the same problem for a professional application 
|
|
|
|
|
Logged
|
Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
|
|
|
|
Soshite
|
 |
« Reply #74 on: Oct 31, 2007, 06:32 AM » |
|
Methinks we should have a WLPE v1.3.1 that collects all of these bugfixes together, for the newbies that download the script and don't notice all of these bugfixes, and would comment on things already fixed.
|
|
|
|
|
Logged
|
|
|
|
|