|
From: Verdon V. <ve...@us...> - 2008-06-24 11:23:54
|
Update of /cvsroot/phpwebsite-comm/modules/rolodex/class In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32013/class Modified Files: RDX_Feature.php RDX_Forms.php RDX_Location.php RDX_Member.php Rolodex.php Log Message: 0.9.0 updates Index: RDX_Feature.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Feature.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RDX_Feature.php 16 Jun 2008 18:21:32 -0000 1.3 --- RDX_Feature.php 24 Jun 2008 11:23:27 -0000 1.4 *************** *** 269,273 **** function featureLinks() { ! if (Current_User::allow('rolodex', 'settings')) { $vars['feature'] = $this->id; --- 269,273 ---- function featureLinks() { ! $links = array(); if (Current_User::allow('rolodex', 'settings')) { $vars['feature'] = $this->id; Index: RDX_Forms.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Forms.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** RDX_Forms.php 17 Jun 2008 13:27:32 -0000 1.12 --- RDX_Forms.php 24 Jun 2008 11:23:27 -0000 1.13 *************** *** 68,71 **** --- 68,78 ---- break; + case 'message_member': + if (empty($this->rolodex->member)) { + $this->rolodex->loadMember(); + } + $this->contactMember(); + break; + case 'edit_location': if (empty($this->rolodex->location)) { *************** *** 151,163 **** } /* init the pager */ $pager = new DBPager('rolodex_member', 'Rolodex_Member'); $pager->setModule('rolodex'); - $pager->db->addColumn('demographics.*'); $pager->db->addColumn('rolodex_member.*'); $pager->db->addWhere('rolodex_member.user_id', 'demographics.user_id'); - /* approved yes/no */ if (isset($approved)) { --- 158,212 ---- } + /* check for custom fields to include */ + if (PHPWS_Settings::get('rolodex', 'custom1_name') && PHPWS_Settings::get('rolodex', 'custom1_list')) { + $ptags['CUSTOM1_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom1_name')); + } else { + $ptags['CUSTOM1_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom2_name') && PHPWS_Settings::get('rolodex', 'custom2_list')) { + $ptags['CUSTOM2_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom2_name')); + } else { + $ptags['CUSTOM2_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom3_name') && PHPWS_Settings::get('rolodex', 'custom3_list')) { + $ptags['CUSTOM3_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom3_name')); + } else { + $ptags['CUSTOM3_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom4_name') && PHPWS_Settings::get('rolodex', 'custom4_list')) { + $ptags['CUSTOM4_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom4_name')); + } else { + $ptags['CUSTOM4_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom5_name') && PHPWS_Settings::get('rolodex', 'custom5_list') && Current_User::allow('rolodex', 'view_privates')) { + $ptags['CUSTOM5_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom5_name')); + } else { + $ptags['CUSTOM5_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom6_name') && PHPWS_Settings::get('rolodex', 'custom6_list') && Current_User::allow('rolodex', 'view_privates')) { + $ptags['CUSTOM6_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom6_name')); + } else { + $ptags['CUSTOM6_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom7_name') && PHPWS_Settings::get('rolodex', 'custom7_list') && Current_User::allow('rolodex', 'view_privates')) { + $ptags['CUSTOM7_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom7_name')); + } else { + $ptags['CUSTOM7_SORT'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom8_name') && PHPWS_Settings::get('rolodex', 'custom8_list') && Current_User::allow('rolodex', 'view_privates')) { + $ptags['CUSTOM8_HEADER'] = PHPWS_Text::parseOutput(PHPWS_Settings::get('rolodex', 'custom8_name')); + } else { + $ptags['CUSTOM8_SORT'] = null; + } + + /* init the pager */ $pager = new DBPager('rolodex_member', 'Rolodex_Member'); $pager->setModule('rolodex'); $pager->db->addColumn('rolodex_member.*'); + $pager->db->addColumn('demographics.*'); $pager->db->addWhere('rolodex_member.user_id', 'demographics.user_id'); /* approved yes/no */ if (isset($approved)) { *************** *** 257,261 **** $pager->addToggle('class="toggle1"'); // $pager->setSearch('last_name','title'); // the alias doesn't work here so we do the below ! $pager->setSearch('demographics.business_name', 'demographics.first_name', 'demographics.last_name'); /* debug stuff */ --- 306,310 ---- $pager->addToggle('class="toggle1"'); // $pager->setSearch('last_name','title'); // the alias doesn't work here so we do the below ! $pager->setSearch('demographics.business_name', 'demographics.first_name', 'demographics.last_name', 'rolodex_member.description'); /* debug stuff */ *************** *** 406,409 **** --- 455,460 ---- $form->addHidden('module', 'rolodex'); $form->addHidden('uop', 'adv_search'); + // $form->addHidden('uop', 'adv_search'); + $form->addText('pager_c_search'); $form->addSubmit(dgettext('rolodex', 'Go')); *************** *** 418,421 **** --- 469,474 ---- $tpl['CATEGORY_LABEL'] = dgettext('rolodex', 'Category(s)'); $tpl['CRITERIA_LABEL'] = dgettext('rolodex', 'Criteria'); + $tpl['SEARCH_LABEL'] = dgettext('rolodex', 'Search'); + $tpl['TIP'] = dgettext('rolodex', 'Select one or more of the available options below to filter a list of members. It is possible to get too specific. If your search returns an empty list, try selecting fewer criteria.'); $this->rolodex->title = sprintf(dgettext('rolodex', '%s Advanced Search'), PHPWS_Settings::get('rolodex', 'module_title')); *************** *** 472,475 **** --- 525,532 ---- $form->setLabel('comments_anon_enforce', dgettext('rolodex', 'Force anonymous comments enabled, on all profiles')); + $form->addRadio('contact_type', array(0, 1)); + $form->setLabel('contact_type', array(dgettext('rolodex', 'Email link'), dgettext('rolodex', 'Web form'))); + $form->setMatch('contact_type', PHPWS_Settings::get('rolodex', 'contact_type')); + $form->addRadio('privacy_contact', array(0, 1, 2)); $form->setLabel('privacy_contact', array(dgettext('rolodex', 'Public'), dgettext('rolodex', 'Members only'), dgettext('rolodex', 'Restricted users'))); *************** *** 508,511 **** --- 565,612 ---- $form->setLabel('expiry_interval', dgettext('rolodex', 'Default expiry interval (in days), if expiry is enabled')); + $form->addCheckbox('use_captcha', 1); + $form->setMatch('use_captcha', PHPWS_Settings::get('rolodex', 'use_captcha')); + $form->setLabel('use_captcha', dgettext('rolodex', 'Use graphical confirmation on contact form (CAPTCHA)')); + + $form->addRadio('list_address', array(0, 1, 2)); + $form->setLabel('list_address', array(dgettext('rolodex', 'None'), dgettext('rolodex', 'Business'), dgettext('rolodex', 'Home'))); + $form->setMatch('list_address', PHPWS_Settings::get('rolodex', 'list_address')); + + $form->addRadio('browse_address', array(0, 1, 2)); + $form->setLabel('browse_address', array(dgettext('rolodex', 'None'), dgettext('rolodex', 'Business'), dgettext('rolodex', 'Home'))); + $form->setMatch('browse_address', PHPWS_Settings::get('rolodex', 'browse_address')); + + $form->addCheckbox('list_phone', 1); + $form->setMatch('list_phone', PHPWS_Settings::get('rolodex', 'list_phone')); + $form->setLabel('list_phone', dgettext('rolodex', 'List')); + + $form->addCheckbox('browse_phone', 1); + $form->setMatch('browse_phone', PHPWS_Settings::get('rolodex', 'browse_phone')); + $form->setLabel('browse_phone', dgettext('rolodex', 'Browse')); + + $form->addCheckbox('list_categories', 1); + $form->setMatch('list_categories', PHPWS_Settings::get('rolodex', 'list_categories')); + $form->setLabel('list_categories', dgettext('rolodex', 'List')); + + $form->addCheckbox('browse_categories', 1); + $form->setMatch('browse_categories', PHPWS_Settings::get('rolodex', 'browse_categories')); + $form->setLabel('browse_categories', dgettext('rolodex', 'Browse')); + + $form->addCheckbox('list_locations', 1); + $form->setMatch('list_locations', PHPWS_Settings::get('rolodex', 'list_locations')); + $form->setLabel('list_locations', dgettext('rolodex', 'List')); + + $form->addCheckbox('browse_locations', 1); + $form->setMatch('browse_locations', PHPWS_Settings::get('rolodex', 'browse_locations')); + $form->setLabel('browse_locations', dgettext('rolodex', 'Browse')); + + $form->addCheckbox('list_features', 1); + $form->setMatch('list_features', PHPWS_Settings::get('rolodex', 'list_features')); + $form->setLabel('list_features', dgettext('rolodex', 'List')); + + $form->addCheckbox('browse_features', 1); + $form->setMatch('browse_features', PHPWS_Settings::get('rolodex', 'browse_features')); + $form->setLabel('browse_features', dgettext('rolodex', 'Browse')); + $form->addTextField('max_img_width', PHPWS_Settings::get('rolodex', 'max_img_width')); $form->setLabel('max_img_width', dgettext('rolodex', 'Maximum image width (50-600)')); *************** *** 576,579 **** --- 677,704 ---- $form->setSize('custom8_name', 30); + $form->addCheckbox('custom1_list', 1); + $form->setMatch('custom1_list', PHPWS_Settings::get('rolodex', 'custom1_list')); + + $form->addCheckbox('custom2_list', 1); + $form->setMatch('custom2_list', PHPWS_Settings::get('rolodex', 'custom2_list')); + + $form->addCheckbox('custom3_list', 1); + $form->setMatch('custom3_list', PHPWS_Settings::get('rolodex', 'custom3_list')); + + $form->addCheckbox('custom4_list', 1); + $form->setMatch('custom4_list', PHPWS_Settings::get('rolodex', 'custom4_list')); + + $form->addCheckbox('custom5_list', 1); + $form->setMatch('custom5_list', PHPWS_Settings::get('rolodex', 'custom5_list')); + + $form->addCheckbox('custom6_list', 1); + $form->setMatch('custom6_list', PHPWS_Settings::get('rolodex', 'custom6_list')); + + $form->addCheckbox('custom7_list', 1); + $form->setMatch('custom7_list', PHPWS_Settings::get('rolodex', 'custom7_list')); + + $form->addCheckbox('custom8_list', 1); + $form->setMatch('custom8_list', PHPWS_Settings::get('rolodex', 'custom8_list')); + *************** *** 583,586 **** --- 708,712 ---- $tpl['SETTINGS_GROUP_LABEL'] = dgettext('rolodex', 'General Settings'); $tpl['SORTBY_TITLE'] = dgettext('rolodex', 'Default sort lists by'); + $tpl['CONTACT_TYPE_TITLE'] = dgettext('rolodex', 'Contact link type'); $tpl['PRIVACY_CONTACT_TITLE'] = dgettext('rolodex', 'Contact link'); $tpl['PRIVACY_WEB_TITLE'] = dgettext('rolodex', 'Website link'); *************** *** 590,598 **** --- 716,733 ---- $tpl['PRIVACY_EXPORT_TITLE'] = dgettext('rolodex', 'CSV Export'); $tpl['PRIVACY_USE_SEARCH_TITLE'] = dgettext('rolodex', 'Register records in search module'); + $tpl['LIST_SETTINGS_TIP'] = dgettext('rolodex', 'The following settings respect the privacy settings above and do not over-ride them.'); + $tpl['LIST_ADDRESS_TITLE'] = dgettext('rolodex', 'Address to display on list views'); + $tpl['BROWSE_ADDRESS_TITLE'] = dgettext('rolodex', 'Address to display on browse views'); + $tpl['LIST_PHONE_TITLE'] = dgettext('rolodex', 'Display phone numbers'); + $tpl['LIST_CATEGORIES_TITLE'] = dgettext('rolodex', 'Display categories'); + $tpl['LIST_LOCATIONS_TITLE'] = dgettext('rolodex', 'Display locations'); + $tpl['LIST_FEATURES_TITLE'] = dgettext('rolodex', 'Display features'); $tpl['COMMENTS_GROUP_LABEL'] = dgettext('rolodex', 'Comments Settings'); $tpl['PRIVACY_GROUP_LABEL'] = dgettext('rolodex', 'Privacy Settings'); + $tpl['LIST_GROUP_LABEL'] = dgettext('rolodex', 'List Settings'); $tpl['IMAGE_GROUP_LABEL'] = dgettext('rolodex', 'Image Settings'); $tpl['FIELDS_GROUP_LABEL'] = dgettext('rolodex', 'Custom Fields'); $tpl['FIELDS_NOTE'] = dgettext('rolodex', 'You may use up to 8 custom fields. To add a field to your member profile template, enter a title for it here. Fields 1-4 follow whatever other security/privacy settings are in place. Fields 5-8 are only visible to Rolodex admins. Leave these fields empty if you do not wish to add custom fields to your profiles.'); + $tpl['FIELDS_LIST_LABEL'] = dgettext('rolodex', 'Select checkbox to also include field in browse view'); $this->rolodex->title = dgettext('rolodex', 'Settings'); *************** *** 988,991 **** --- 1123,1183 ---- + function contactMember() + { + $form = new PHPWS_Form; + $form->addHidden('module', 'rolodex'); + $form->addHidden('uop', 'send_message'); + $form->addHidden('user_id', $this->rolodex->member->user_id); + + $form->addText('name', $_POST['name']); + $form->setLabel('name', dgettext('rolodex', 'Your name')); + $form->setSize('name', 40); + + $form->addText('email', $_POST['email']); + $form->setLabel('email', dgettext('rolodex', 'Your email')); + $form->setSize('email', 40); + + $form->addText('subject', $_POST['subject']); + $form->setLabel('subject', dgettext('rolodex', 'Subject')); + $form->setSize('subject', 40); + + $form->addTextArea('message', $_POST['message']); + $form->setRows('message', '15'); + $form->setCols('message', '50'); + $form->setLabel('message', dgettext('rolodex', 'Message')); + + $form->addText('confirm_phrase'); + $form->setLabel('confirm_phrase', dgettext('rolodex', 'Confirm text')); + + if (PHPWS_Settings::get('rolodex', 'use_captcha') && extension_loaded('gd')) { + $result = $this->confirmGraphic(); + if (PEAR::isError($result)) { + PHPWS_Error::log($result); + } else { + $form->addTplTag('CONFIRM_INSTRUCTIONS', dgettext('rolodex', 'Please type the word seen in the image.')); + $form->addText('confirm_graphic'); + $form->setLabel('confirm_graphic', dgettext('rolodex', 'Confirm Graphic')); + $form->addTplTag('GRAPHIC', $result); + } + } + + $form->addSubmit('submit', dgettext('rolodex', 'Send Message')); + + $tpl = $form->getTemplate(); + $tpl['FORM_LABEL'] = dgettext('rolodex', 'Compose message'); + $tpl['FORM_INSTRUCTION'] = dgettext('rolodex', 'All fields are required.'); + $tpl['LINKS'] = implode(' | ', Rolodex::navLinks()); + + $this->rolodex->content = PHPWS_Template::process($tpl, 'rolodex', 'message_member.tpl'); + } + + + function confirmGraphic() + { + PHPWS_Core::initCoreClass('Captcha.php'); + return Captcha::get(); + } + + function utilities() { Index: RDX_Location.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Location.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RDX_Location.php 16 Jun 2008 18:21:33 -0000 1.3 --- RDX_Location.php 24 Jun 2008 11:23:27 -0000 1.4 *************** *** 268,272 **** function locationLinks() { ! if (Current_User::allow('rolodex', 'settings')) { $vars['location'] = $this->id; --- 268,272 ---- function locationLinks() { ! $links = array(); if (Current_User::allow('rolodex', 'settings')) { $vars['location'] = $this->id; Index: Rolodex.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/Rolodex.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Rolodex.php 17 Jun 2008 13:27:34 -0000 1.11 --- Rolodex.php 24 Jun 2008 11:23:27 -0000 1.12 *************** *** 431,434 **** --- 431,454 ---- break; + case 'message_member': + $this->loadForm('message_member'); + $this->title = sprintf(dgettext('rolodex', 'Send a message to %s'), $this->member->getDisplay_name()); + break; + + case 'send_message': + if ($this->checkMessage()) { + if (PHPWS_Error::logIfError($this->sendMail())) { + $this->forwardMessage(dgettext('rolodex', 'Message sent succesfully.')); + PHPWS_Core::reroute('index.php?module=rolodex&id=' . $this->member->user_id); + } else { + $this->forwardMessage(dgettext('rolodex', 'There was a problem sending the message.')); + PHPWS_Core::reroute('index.php?module=rolodex&id=' . $this->member->user_id); + } + } else { + $this->loadForm('message_member'); + $this->title = sprintf(dgettext('rolodex', 'Send a message to %s'), $this->member->getDisplay_name()); + } + break; + case 'post_member': if (Current_User::getId() !== $_POST['user_id']) { *************** *** 673,676 **** --- 693,697 ---- } + PHPWS_Settings::set('rolodex', 'contact_type', $_POST['contact_type']); PHPWS_Settings::set('rolodex', 'privacy_contact', $_POST['privacy_contact']); PHPWS_Settings::set('rolodex', 'privacy_web', $_POST['privacy_web']); *************** *** 681,684 **** --- 702,741 ---- PHPWS_Settings::set('rolodex', 'privacy_use_search', $_POST['privacy_use_search']); + PHPWS_Settings::set('rolodex', 'list_address', $_POST['list_address']); + PHPWS_Settings::set('rolodex', 'browse_address', $_POST['browse_address']); + + isset($_POST['list_phone']) ? + PHPWS_Settings::set('rolodex', 'list_phone', 1) : + PHPWS_Settings::set('rolodex', 'list_phone', 0); + + isset($_POST['browse_phone']) ? + PHPWS_Settings::set('rolodex', 'browse_phone', 1) : + PHPWS_Settings::set('rolodex', 'browse_phone', 0); + + isset($_POST['list_categories']) ? + PHPWS_Settings::set('rolodex', 'list_categories', 1) : + PHPWS_Settings::set('rolodex', 'list_categories', 0); + + isset($_POST['browse_categories']) ? + PHPWS_Settings::set('rolodex', 'browse_categories', 1) : + PHPWS_Settings::set('rolodex', 'browse_categories', 0); + + isset($_POST['list_locations']) ? + PHPWS_Settings::set('rolodex', 'list_locations', 1) : + PHPWS_Settings::set('rolodex', 'list_locations', 0); + + isset($_POST['browse_locations']) ? + PHPWS_Settings::set('rolodex', 'browse_locations', 1) : + PHPWS_Settings::set('rolodex', 'browse_locations', 0); + + isset($_POST['list_features']) ? + PHPWS_Settings::set('rolodex', 'list_features', 1) : + PHPWS_Settings::set('rolodex', 'list_features', 0); + + isset($_POST['browse_features']) ? + PHPWS_Settings::set('rolodex', 'browse_features', 1) : + PHPWS_Settings::set('rolodex', 'browse_features', 0); + + isset($_POST['enable_expiry']) ? PHPWS_Settings::set('rolodex', 'enable_expiry', 1) : *************** *** 691,694 **** --- 748,755 ---- } + isset($_POST['use_captcha']) ? + PHPWS_Settings::set('rolodex', 'use_captcha', 1) : + PHPWS_Settings::set('rolodex', 'use_captcha', 0); + if ( !empty($_POST['max_img_width']) ) { $max_img_width = (int)$_POST['max_img_width']; *************** *** 775,778 **** --- 836,871 ---- } + isset($_POST['custom1_list']) ? + PHPWS_Settings::set('rolodex', 'custom1_list', 1) : + PHPWS_Settings::set('rolodex', 'custom1_list', 0); + + isset($_POST['custom2_list']) ? + PHPWS_Settings::set('rolodex', 'custom2_list', 1) : + PHPWS_Settings::set('rolodex', 'custom2_list', 0); + + isset($_POST['custom3_list']) ? + PHPWS_Settings::set('rolodex', 'custom3_list', 1) : + PHPWS_Settings::set('rolodex', 'custom3_list', 0); + + isset($_POST['custom4_list']) ? + PHPWS_Settings::set('rolodex', 'custom4_list', 1) : + PHPWS_Settings::set('rolodex', 'custom4_list', 0); + + isset($_POST['custom5_list']) ? + PHPWS_Settings::set('rolodex', 'custom5_list', 1) : + PHPWS_Settings::set('rolodex', 'custom5_list', 0); + + isset($_POST['custom6_list']) ? + PHPWS_Settings::set('rolodex', 'custom6_list', 1) : + PHPWS_Settings::set('rolodex', 'custom6_list', 0); + + isset($_POST['custom7_list']) ? + PHPWS_Settings::set('rolodex', 'custom7_list', 1) : + PHPWS_Settings::set('rolodex', 'custom7_list', 0); + + isset($_POST['custom8_list']) ? + PHPWS_Settings::set('rolodex', 'custom8_list', 1) : + PHPWS_Settings::set('rolodex', 'custom8_list', 0); + if (isset($errors)) { *************** *** 1092,1095 **** --- 1185,1253 ---- + function checkMessage() + { + $this->loadMember(); + + if (!empty($_POST['name'])) { + $_POST['name'] = strip_tags($_POST['name']); + } else { + $errors[] = dgettext('rolodex', 'Please provide your name.'); + } + + if (!empty($_POST['email'])) { + if (PHPWS_Text::isValidInput($_POST['email'], 'email')) { + $_POST['email'] = $_POST['email']; + } else { + $errors[] = dgettext('rolodex', 'Your email address is improperly formatted.'); + } + } else { + $errors[] = dgettext('rolodex', 'Please provide your email address.'); + } + + if (!empty($_POST['subject'])) { + $_POST['subject'] = strip_tags($_POST['subject']); + } else { + $errors[] = dgettext('rolodex', 'Please provide a subject.'); + } + + if (!empty($_POST['message'])) { + $_POST['message'] = strip_tags($_POST['message']); + } else { + $errors[] = dgettext('rolodex', 'Please provide a message.'); + } + + if (isset($errors)) { + $this->message = implode('<br />', $errors); + return false; + } else { + return true; + } + } + + + function sendMail() + { + $this->loadMember(); + + $url = PHPWS_Core::getHomeHttp(); + $from = $_POST['name']; + $sender = $_POST['email']; + $sendto = $this->member->getDisplay_email(); + $subject = $_POST['subject']; + $message = sprintf(dgettext('rolodex', 'This message from %s was sent via %s.'), $from, $url) . "\n\n"; + $message .= $_POST['message']; + + PHPWS_Core::initCoreClass('Mail.php'); + $mail = new PHPWS_Mail; + $mail->addSendTo($sendto); + $mail->setSubject($subject); + $mail->setFrom(sprintf('%s<%s>', $from, $sender)); + $mail->setMessageBody($message); + + return $mail->send(); + + } + + function resetExpired($interval) { *************** *** 1271,1281 **** $template['IMAGE'] = $this->category->getIcon(); ! $links[] = PHPWS_Text::moduleLink(dgettext('rolodex', 'Browse members'), 'rolodex', array('uop'=>'list')); ! $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')); ! if($links) ! $template['CATEGORY_LINKS'] = implode(' | ', $links); $members = $this->getCatMembers(true); --- 1429,1433 ---- $template['IMAGE'] = $this->category->getIcon(); ! $template['CATEGORY_LINKS'] = implode(' | ', Rolodex::navLinks()); $members = $this->getCatMembers(true); Index: RDX_Member.php =================================================================== RCS file: /cvsroot/phpwebsite-comm/modules/rolodex/class/RDX_Member.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RDX_Member.php 17 Jun 2008 13:27:34 -0000 1.10 --- RDX_Member.php 24 Jun 2008 11:23:27 -0000 1.11 *************** *** 104,123 **** { if ($print) { ! if ($nolink) { ! $cat_result = Categories::catList($this->key_id); ! if (empty($cat_result)) { ! $link[] = null; ! } else { ! foreach ($cat_result as $cat){ ! if (!$cat->id) { ! continue; ! } $link[] = $cat->getTitle(); } } - $result = $link; - } else { - $result = Categories::getSimpleLinks($this->key_id, true); } } else { $db = new PHPWS_DB('category_items'); --- 104,123 ---- { if ($print) { ! $cat_result = Categories::catList($this->key_id); ! if (empty($cat_result)) { ! $link[] = null; ! } else { ! foreach ($cat_result as $cat){ ! if (!$cat->id) { ! continue; ! } ! if ($nolink) { $link[] = $cat->getTitle(); + } else { + $link[] = PHPWS_Text::moduleLink($cat->getTitle(), "rolodex", array('uop'=>'view_category', 'category'=>$cat->getId())); } } } + $result = $link; } else { $db = new PHPWS_DB('category_items'); *************** *** 488,494 **** } if ($icon) { ! return sprintf('<a class="email" href="mailto:%s"><img src="images/mod/rolodex/email.png" alt="%s" title="%s" /></a>', $this->contact_email, dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')); } else { ! return '<a href="mailto:' . $this->contact_email . '" />' . $this->getDisplay_name() . '</a>'; } } else { --- 488,502 ---- } if ($icon) { ! if (PHPWS_Settings::get('rolodex', 'contact_type')) { ! return PHPWS_Text::moduleLink(sprintf('<img src="images/mod/rolodex/email.png" alt="%s" title="%s" />', dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')), "rolodex", array('uop'=>'message_member', 'id'=>$this->user_id)); ! } else { ! return sprintf('<a class="email" href="mailto:%s"><img src="images/mod/rolodex/email.png" alt="%s" title="%s" /></a>', $this->contact_email, dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')); ! } } else { ! if (PHPWS_Settings::get('rolodex', 'contact_type')) { ! return PHPWS_Text::moduleLink($this->getDisplay_name(), "rolodex", array('uop'=>'message_member', 'id'=>$this->user_id)); ! } else { ! return '<a href="mailto:' . $this->contact_email . '" />' . $this->getDisplay_name() . '</a>'; ! } } } else { *************** *** 511,517 **** if ($print) { if ($icon) { ! return sprintf('<a class="email" href="mailto:%s"><img src="images/mod/rolodex/email.png" alt="%s" title="%s" /></a>', $email, dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')); } else { ! return '<a href="mailto:' . $email . '" />' . $this->getDisplay_name() . '</a>'; } } else { --- 519,533 ---- if ($print) { if ($icon) { ! if (PHPWS_Settings::get('rolodex', 'contact_type')) { ! return PHPWS_Text::moduleLink(sprintf('<img src="images/mod/rolodex/email.png" alt="%s" title="%s" />', dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')), "rolodex", array('uop'=>'message_member', 'id'=>$this->user_id)); ! } else { ! return sprintf('<a class="email" href="mailto:%s"><img src="images/mod/rolodex/email.png" alt="%s" title="%s" /></a>', $email, dgettext('rolodex', 'Email'), dgettext('rolodex', 'Email')); ! } } else { ! if (PHPWS_Settings::get('rolodex', 'contact_type')) { ! return PHPWS_Text::moduleLink($this->getDisplay_name(), "rolodex", array('uop'=>'message_member', 'id'=>$this->user_id)); ! } else { ! return '<a href="mailto:' . $email . '" />' . $this->getDisplay_name() . '</a>'; ! } } } else { *************** *** 1071,1074 **** --- 1087,1091 ---- function memberLinks() { + $links = array(); if ($this->editLink()) { $links[] = $this->editLink(); *************** *** 1139,1150 **** if ($this->isDataVisible('privacy_phone')) { ! $tpl['DAY_PHONE'] = $this->getDay_phone(true); ! $tpl['DAY_PHONE_LABEL'] = dgettext('rolodex', 'Day phone'); ! $tpl['DAY_PHONE_EXT'] = $this->getDay_phone_ext(true); ! $tpl['DAY_PHONE_EXT_LABEL'] = dgettext('rolodex', 'Ext'); ! $tpl['FAX_NUMBER'] = $this->getFax_number(true); ! $tpl['FAX_NUMBER_LABEL'] = dgettext('rolodex', 'Fax'); ! $tpl['TOLLFREE_PHONE'] = $this->getTollfree_phone(true); ! $tpl['TOLLFREE_PHONE_LABEL'] = dgettext('rolodex', 'Tollfree'); } --- 1156,1175 ---- if ($this->isDataVisible('privacy_phone')) { ! if ($this->getDay_phone()) { ! $tpl['DAY_PHONE_LABEL'] = dgettext('rolodex', 'Day phone'); ! $tpl['DAY_PHONE'] = $this->getDay_phone(true); ! } ! if ($this->getDay_phone_ext()) { ! $tpl['DAY_PHONE_EXT'] = $this->getDay_phone_ext(true); ! $tpl['DAY_PHONE_EXT_LABEL'] = dgettext('rolodex', 'Ext'); ! } ! if ($this->getFax_number()) { ! $tpl['FAX_NUMBER'] = $this->getFax_number(true); ! $tpl['FAX_NUMBER_LABEL'] = dgettext('rolodex', 'Fax'); ! } ! if ($this->getTollfree_phone()) { ! $tpl['TOLLFREE_PHONE'] = $this->getTollfree_phone(true); ! $tpl['TOLLFREE_PHONE_LABEL'] = dgettext('rolodex', 'Tollfree'); ! } } *************** *** 1305,1308 **** --- 1330,1476 ---- $tpl['WEBSITE_LINK'] = $this->getWebsite(true, true); } + if (PHPWS_Settings::get('rolodex', 'browse_address') == 1) { + if ($this->isDataVisible('privacy_business')) { + $tpl['ADDRESS_1'] = $this->getBusiness_address_1(true); + $tpl['ADDRESS_2'] = $this->getBusiness_address_2(true); + $tpl['CITY'] = $this->getBusiness_city(true); + $tpl['STATE'] = $this->getBusiness_state(true); + $tpl['COUNTRY'] = $this->getBusiness_country(true); + $tpl['ZIP_CODE'] = $this->getBusiness_zip_code(true); + if ($this->getBusiness_address_1() || $this->getBusiness_address_2() || $this->getBusiness_city() || $this->getBusiness_state() || $this->getBusiness_country() || $this->getBusiness_zip_code()) { + $tpl['LABEL'] = dgettext('rolodex', 'Business address'); + } + $tpl['GOOGLE_MAP'] = $this->getGoogleMap('business'); + } + } elseif (PHPWS_Settings::get('rolodex', 'browse_address') == 2) { + if ($this->isDataVisible('privacy_home')) { + $tpl['ADDRESS_1'] = $this->getMailing_address_1(true); + $tpl['ADDRESS_2'] = $this->getMailing_address_2(true); + $tpl['CITY'] = $this->getMailing_city(true); + $tpl['STATE'] = $this->getMailing_state(true); + $tpl['COUNTRY'] = $this->getMailing_country(true); + $tpl['ZIP_CODE'] = $this->getMailing_zip_code(true); + if ($this->getMailing_address_1() || $this->getMailing_address_2() || $this->getMailing_city() || $this->getMailing_state() || $this->getMailing_country() || $this->getMailing_zip_code()) { + $tpl['LABEL'] = dgettext('rolodex', 'Home address'); + } + $tpl['GOOGLE_MAP'] = $this->getGoogleMap('mailing'); + } + } + + if (PHPWS_Settings::get('rolodex', 'browse_phone')) { + if ($this->isDataVisible('privacy_phone')) { + if ($this->getDay_phone()) { + $tpl['LIST_DAY_PHONE_LABEL'] = dgettext('rolodex', 'Day phone'); + $tpl['LIST_DAY_PHONE'] = $this->getDay_phone(true); + } + if ($this->getDay_phone_ext()) { + $tpl['LIST_DAY_PHONE_EXT'] = $this->getDay_phone_ext(true); + $tpl['LIST_DAY_PHONE_EXT_LABEL'] = dgettext('rolodex', 'Ext'); + } + if ($this->getFax_number()) { + $tpl['LIST_FAX_NUMBER'] = $this->getFax_number(true); + $tpl['LIST_FAX_NUMBER_LABEL'] = dgettext('rolodex', 'Fax'); + } + if ($this->getTollfree_phone()) { + $tpl['LIST_TOLLFREE_PHONE'] = $this->getTollfree_phone(true); + $tpl['LIST_TOLLFREE_PHONE_LABEL'] = dgettext('rolodex', 'Tollfree'); + } + } + } + + if (PHPWS_Settings::get('rolodex', 'browse_categories')) { + if ($this->get_categories(true)) { + $tpl['CATEGORY_LINKS'] = implode(', ', $this->get_categories(true)); + $tpl['CATEGORY_LINKS_LABEL'] = dgettext('rolodex', 'Category(s)'); + } + } + + if (PHPWS_Settings::get('rolodex', 'browse_locations')) { + if ($this->get_locations(true)) { + $tpl['LOCATION_LINKS'] = implode(', ', $this->get_locations(true)); + $tpl['LOCATION_LINKS_LABEL'] = dgettext('rolodex', 'Location(s)'); + } + } + + if (PHPWS_Settings::get('rolodex', 'browse_features')) { + if ($this->get_features(true)) { + $tpl['FEATURE_LINKS'] = implode(', ', $this->get_features(true)); + $tpl['FEATURE_LINKS_LABEL'] = dgettext('rolodex', 'Feature(s)'); + } + } + + if (PHPWS_Settings::get('rolodex', 'custom1_name') && PHPWS_Settings::get('rolodex', 'custom1_list')) { + if ($this->getCustom1()) { + $tpl['CUSTOM1'] = $this->getCustom1(true); + } else { + $tpl['CUSTOM1'] = ''; + } + } else { + $tpl['CUSTOM1'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom2_name') && PHPWS_Settings::get('rolodex', 'custom2_list')) { + if ($this->getCustom2()) { + $tpl['CUSTOM2'] = $this->getCustom2(true); + } else { + $tpl['CUSTOM2'] = ''; + } + } else { + $tpl['CUSTOM2'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom3_name') && PHPWS_Settings::get('rolodex', 'custom3_list')) { + if ($this->getCustom3()) { + $tpl['CUSTOM3'] = $this->getCustom3(true); + } else { + $tpl['CUSTOM3'] = ''; + } + } else { + $tpl['CUSTOM3'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom4_name') && PHPWS_Settings::get('rolodex', 'custom4_list')) { + if ($this->getCustom4()) { + $tpl['CUSTOM4'] = $this->getCustom4(true); + } else { + $tpl['CUSTOM4'] = ''; + } + } else { + $tpl['CUSTOM4'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom5_name') && PHPWS_Settings::get('rolodex', 'custom5_list') && Current_User::allow('rolodex', 'view_privates')) { + if ($this->getCustom5()) { + $tpl['CUSTOM5'] = $this->getCustom5(true); + } else { + $tpl['CUSTOM5'] = ''; + } + } else { + $tpl['CUSTOM5'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom6_name') && PHPWS_Settings::get('rolodex', 'custom6_list') && Current_User::allow('rolodex', 'view_privates')) { + if ($this->getCustom6()) { + $tpl['CUSTOM6'] = $this->getCustom6(true); + } else { + $tpl['CUSTOM6'] = ''; + } + } else { + $tpl['CUSTOM6'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom7_name') && PHPWS_Settings::get('rolodex', 'custom7_list') && Current_User::allow('rolodex', 'view_privates')) { + if ($this->getCustom7()) { + $tpl['CUSTOM7'] = $this->getCustom7(true); + } else { + $tpl['CUSTOM7'] = ''; + } + } else { + $tpl['CUSTOM7'] = null; + } + if (PHPWS_Settings::get('rolodex', 'custom8_name') && PHPWS_Settings::get('rolodex', 'custom8_list') && Current_User::allow('rolodex', 'view_privates')) { + if ($this->getCustom8()) { + $tpl['CUSTOM8'] = $this->getCustom8(true); + } else { + $tpl['CUSTOM8'] = ''; + } + } else { + $tpl['CUSTOM8'] = null; + } + if($links) $tpl['ACTION'] = implode(' | ', $links); *************** *** 1336,1344 **** function viewTpl() { ! $template['MEMBER_TITLE'] = $this->viewLink(); ! $template['MEMBER_DESCRIPTION'] = $this->getDescription(true); ! $template['MEMBER_LINKS'] = $this->editLink(); ! return $template; } --- 1504,1590 ---- function viewTpl() { ! $tpl['MEMBER_TITLE'] = $this->viewLink(); ! $tpl['MEMBER_DESCRIPTION'] = $this->getListDescription(300); ! $tpl['MEMBER_LINKS'] = $this->editLink(); ! $tpl['THUMBNAIL'] = $this->getThumbnail(true, true); ! if (PHPWS_Settings::get('rolodex', 'list_address') == 1) { ! if ($this->isDataVisible('privacy_business')) { ! $tpl['ADDRESS_1'] = $this->getBusiness_address_1(true); ! $tpl['ADDRESS_2'] = $this->getBusiness_address_2(true); ! $tpl['CITY'] = $this->getBusiness_city(true); ! $tpl['STATE'] = $this->getBusiness_state(true); ! $tpl['COUNTRY'] = $this->getBusiness_country(true); ! $tpl['ZIP_CODE'] = $this->getBusiness_zip_code(true); ! if ($this->getBusiness_address_1() || $this->getBusiness_address_2() || $this->getBusiness_city() || $this->getBusiness_state() || $this->getBusiness_country() || $this->getBusiness_zip_code()) { ! $tpl['LABEL'] = dgettext('rolodex', 'Business address'); ! } ! $tpl['GOOGLE_MAP'] = $this->getGoogleMap('business'); ! } ! } elseif (PHPWS_Settings::get('rolodex', 'list_address') == 2) { ! if ($this->isDataVisible('privacy_home')) { ! $tpl['ADDRESS_1'] = $this->getMailing_address_1(true); ! $tpl['ADDRESS_2'] = $this->getMailing_address_2(true); ! $tpl['CITY'] = $this->getMailing_city(true); ! $tpl['STATE'] = $this->getMailing_state(true); ! $tpl['COUNTRY'] = $this->getMailing_country(true); ! $tpl['ZIP_CODE'] = $this->getMailing_zip_code(true); ! if ($this->getMailing_address_1() || $this->getMailing_address_2() || $this->getMailing_city() || $this->getMailing_state() || $this->getMailing_country() || $this->getMailing_zip_code()) { ! $tpl['LABEL'] = dgettext('rolodex', 'Home address'); ! } ! $tpl['GOOGLE_MAP'] = $this->getGoogleMap('mailing'); ! } ! } ! ! if (PHPWS_Settings::get('rolodex', 'list_phone')) { ! if ($this->isDataVisible('privacy_phone')) { ! if ($this->getDay_phone()) { ! $tpl['LIST_DAY_PHONE_LABEL'] = dgettext('rolodex', 'Day phone'); ! $tpl['LIST_DAY_PHONE'] = $this->getDay_phone(true); ! } ! if ($this->getDay_phone_ext()) { ! $tpl['LIST_DAY_PHONE_EXT'] = $this->getDay_phone_ext(true); ! $tpl['LIST_DAY_PHONE_EXT_LABEL'] = dgettext('rolodex', 'Ext'); ! } ! if ($this->getFax_number()) { ! $tpl['LIST_FAX_NUMBER'] = $this->getFax_number(true); ! $tpl['LIST_FAX_NUMBER_LABEL'] = dgettext('rolodex', 'Fax'); ! } ! if ($this->getTollfree_phone()) { ! $tpl['LIST_TOLLFREE_PHONE'] = $this->getTollfree_phone(true); ! $tpl['LIST_TOLLFREE_PHONE_LABEL'] = dgettext('rolodex', 'Tollfree'); ! } ! } ! } ! ! if (PHPWS_Settings::get('rolodex', 'list_categories')) { ! if ($this->get_categories(true)) { ! $tpl['CATEGORY_LINKS'] = implode(', ', $this->get_categories(true)); ! $tpl['CATEGORY_LINKS_LABEL'] = dgettext('rolodex', 'Category(s)'); ! } ! } ! ! if (PHPWS_Settings::get('rolodex', 'list_locations')) { ! if ($this->get_locations(true)) { ! $tpl['LOCATION_LINKS'] = implode(', ', $this->get_locations(true)); ! $tpl['LOCATION_LINKS_LABEL'] = dgettext('rolodex', 'Location(s)'); ! } ! } ! ! if (PHPWS_Settings::get('rolodex', 'list_features')) { ! if ($this->get_features(true)) { ! $tpl['FEATURE_LINKS'] = implode(', ', $this->get_features(true)); ! $tpl['FEATURE_LINKS_LABEL'] = dgettext('rolodex', 'Feature(s)'); ! } ! } ! ! if ($this->isDataVisible('privacy_contact')) { ! $tpl['CONTACT_EMAIL_LINK'] = $this->getDisplay_email(true, true); ! } ! if ($this->isDataVisible('privacy_web')) { ! $tpl['WEBSITE_LINK'] = $this->getWebsite(true, true); ! } ! ! return $tpl; } |