|
From: Verdon V. <ve...@us...> - 2008-06-17 13:28:00
|
Update of /cvsroot/phpwebsite-comm/modules/rolodex/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22769/class Modified Files: RDX_Forms.php RDX_Member.php RDX_Mypage.php Rolodex.php Log Message: final tidy up for 0.7 release Index: RDX_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Forms.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RDX_Forms.php 13 Jun 2008 03:51:17 -0000 1.11 --- RDX_Forms.php 17 Jun 2008 13:27:32 -0000 1.12 *************** *** 708,712 **** $form->addTplTag('CURRENT_IMAGE', $member->getImage(true)); $form->addTplTag('CURRENT_THUMB', $member->getThumbnail(true)); ! $form->setLabel('image', dgettext('rolodex', 'Image (removes existing, may need browser refresh to see updated)')); $form->addText('contact_email', $member->contact_email); --- 708,715 ---- $form->addTplTag('CURRENT_IMAGE', $member->getImage(true)); $form->addTplTag('CURRENT_THUMB', $member->getThumbnail(true)); ! $form->setLabel('image', dgettext('rolodex', 'New Image (Clears current image)')); ! ! $form->addCheckbox('clear_image', 1); ! $form->setLabel('clear_image', dgettext('rolodex', 'Check to clear image')); $form->addText('contact_email', $member->contact_email); *************** *** 782,796 **** $form->setLabel('business_zip_code', dgettext('rolodex', 'Postal/Zip code')); - if (PHPWS_Settings::get('comments', 'allow_avatars')) { - if (PHPWS_Settings::get('comments', 'local_avatars')) { - $form->addFile('avatar'); - $form->addTplTag('CURRENT_AVATAR', $member->getAvatar(true)); - } else { - $form->addText('avatar', $member->getAvatar()); - $form->setSize('avatar', 60); - } - $form->setLabel('avatar', dgettext('comments', 'Avatar')); - } - if (PHPWS_Settings::get('rolodex', 'comments_enable')) { if (PHPWS_Settings::get('rolodex', 'comments_enforce')) { --- 785,788 ---- *************** *** 1032,1038 **** $tpl['TITLE'] = dgettext('rolodex', 'Important Information'); $tpl['INFO_1_LABEL'] = dgettext('rolodex', 'About this module:'); ! $tpl['INFO_1'] = dgettext('rolodex', 'This is an early beta release of this module. There is not much documentation yet, but it will come.'); $tpl['INFO_2_LABEL'] = dgettext('rolodex', 'Bugs:'); ! $tpl['INFO_2'] = sprintf(dgettext('rolodex', 'Please report any bugs or observations of this beta release in %s this post at phpwsforums.com %s'), '<a href="http://phpwsforums.com/showthread.php?t=5655" target="new">', '</a>'); $tpl['INFO_3_LABEL'] = null; $tpl['INFO_3'] = null; --- 1024,1030 ---- $tpl['TITLE'] = dgettext('rolodex', 'Important Information'); $tpl['INFO_1_LABEL'] = dgettext('rolodex', 'About this module:'); ! $tpl['INFO_1'] = dgettext('rolodex', 'This is a second beta release of this module. Many features have been added and it is getting close to final release. Please see docs/CHANGELOG for details.'); $tpl['INFO_2_LABEL'] = dgettext('rolodex', 'Bugs:'); ! $tpl['INFO_2'] = sprintf(dgettext('rolodex', 'Please report any bugs or observations of this beta release in %s this post at phpwsforums.com %s'), '<a href="http://phpwsforums.com/showthread.php?t=5927" target="new">', '</a>'); $tpl['INFO_3_LABEL'] = null; $tpl['INFO_3'] = null; Index: Rolodex.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/Rolodex.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Rolodex.php 16 Jun 2008 18:21:33 -0000 1.10 --- Rolodex.php 17 Jun 2008 13:27:34 -0000 1.11 *************** *** 955,1006 **** - PHPWS_Core::initModClass('filecabinet', 'Image.php'); - - /* begin avatar stuff */ - if (empty($_POST['avatar'])) { - $val['avatar'] = null; - } else { - $image_info = @getimagesize($_POST['avatar']); - if (!$image_info) { - $errors[] = dgettext('rolodex', 'Could not access avatar url.'); - } - } - if (PHPWS_Settings::get('comments', 'allow_avatars')) { - if (PHPWS_Settings::get('comments', 'local_avatars')) { - if (isset($_FILES['avatar']) && !empty($_FILES['avatar']['name'])) { - $image = new PHPWS_Image; - $_FILES['avatar']['name'] = $this->member->user_id . '_' . $_FILES['avatar']['name']; - $image->setDirectory('images/comments/'); - $image->setMaxWidth(COMMENT_MAX_AVATAR_WIDTH); - $image->setMaxHeight(COMMENT_MAX_AVATAR_HEIGHT); - if (!$image->importPost('avatar', false, true)) { - if (isset($image->_errors)) { - foreach ($image->_errors as $oError) { - $errors[] = $oError->getMessage(); - } - } - } else { - $result = $image->write(); - if (PEAR::isError($result)) { - PHPWS_Error::log($result); - $errors[] = array(dgettext('rolodex', 'There was a problem saving your avatar image.')); - } else { - $this->member->setAvatar($image->getPath()); - } - } - } - } else { - if ($this->member->testAvatar(trim($_POST['avatar']))) { - $this->member->setAvatar($_POST['avatar']); - } - } - } else { - $this->member->avatar = NULL; - } - /* end avatar stuff */ - - /* begin image stuff */ if (isset($_FILES['image']) && !empty($_FILES['image']['name'])) { $img_array = null; $image = new PHPWS_Image; --- 955,963 ---- /* begin image stuff */ + PHPWS_Core::initModClass('filecabinet', 'Image.php'); if (isset($_FILES['image']) && !empty($_FILES['image']['name'])) { + $current_image = 'images/rolodex/' . $this->member->image['name']; + $current_thumb = 'images/rolodex/' . $this->member->image['thumb_name']; $img_array = null; $image = new PHPWS_Image; *************** *** 1008,1012 **** $image->setMaxWidth(PHPWS_Settings::get('rolodex', 'max_img_width')); $image->setMaxHeight(PHPWS_Settings::get('rolodex', 'max_img_height')); ! if (!$image->importPost('image', false, true)) { if (isset($image->_errors)) { foreach ($image->_errors as $oError) { --- 965,971 ---- $image->setMaxWidth(PHPWS_Settings::get('rolodex', 'max_img_width')); $image->setMaxHeight(PHPWS_Settings::get('rolodex', 'max_img_height')); ! ! $prefix = sprintf('%s_%s_', $this->member->user_id, mktime()); ! if (!$image->importPost('image', false, true, $prefix)) { if (isset($image->_errors)) { foreach ($image->_errors as $oError) { *************** *** 1014,1019 **** } } ! } else { ! $image->file_name = $this->member->user_id . '.' . $image->getExtension(); $result = $image->write(); if (PEAR::isError($result)) { --- 973,977 ---- } } ! } elseif ($image->file_name) { $result = $image->write(); if (PEAR::isError($result)) { *************** *** 1021,1024 **** --- 979,986 ---- $errors[] = array(dgettext('rolodex', 'There was a problem saving your image.')); } else { + if ($current_image != $image->getPath() && is_file($current_image)) { + @unlink($current_image); + @unlink($current_thumb); + } $img_array['name'] = $image->file_name; $img_array['width'] = $image->width; *************** *** 1026,1029 **** --- 988,992 ---- } } + /* make the thumb */ $source = $image->file_directory . $image->file_name; *************** *** 1040,1043 **** --- 1003,1016 ---- $this->member->setImage($img_array); + } elseif (isset($_POST['clear_image'])) { + $current_image = 'images/rolodex/' . $this->member->image['name']; + $current_thumb = 'images/rolodex/' . $this->member->image['thumb_name']; + if (is_file($current_image)) { + @unlink($current_image); + } + if (is_file($current_thumb)) { + @unlink($current_thumb); + } + $this->member->image = null; } /* end image stuff */ Index: RDX_Mypage.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Mypage.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RDX_Mypage.php 16 Jun 2008 18:21:33 -0000 1.6 --- RDX_Mypage.php 17 Jun 2008 13:27:34 -0000 1.7 *************** *** 53,64 **** } - /* - $vars2['uop'] = 'list'; - $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Browse members'), 'rolodex', $vars2); - $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Categories'), "rolodex", array('uop'=>'categories')); - $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Locations'), "rolodex", array('uop'=>'locations')); - $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Features'), "rolodex", array('uop'=>'features')); - $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Advanced'), "rolodex", array('uop'=>'advanced')); - */ $links = array_merge($links, Rolodex::navLinks()); --- 53,56 ---- Index: RDX_Member.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Member.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RDX_Member.php 16 Jun 2008 18:21:33 -0000 1.9 --- RDX_Member.php 17 Jun 2008 13:27:34 -0000 1.10 *************** *** 29,33 **** /* new demographics fields */ - var $avatar = null; var $tollfree_phone = null; var $business_name = null; --- 29,32 ---- *************** *** 183,204 **** - function setAvatar($avatar_url) - { - $this->avatar = $avatar_url; - } - - function getAvatar($print=false) - { - if (empty($this->avatar)) { - return null; - } - if ($print) { - return sprintf('<img src="%s" />', $this->avatar); - } else { - return $this->avatar; - } - } - - function setImage($img_array) { --- 182,185 ---- *************** *** 1820,1838 **** - /** - * Tests an image's url to see if it is the correct file type, - * dimensions, etc. - */ - // Not finished - function testAvatar($url) - { - $test = @getimagesize($url); - if (!$test) { - return false; - } - - return true; - } - } --- 1801,1804 ---- |