コード例 #1
0
 function process_registration()
 {
     $dir = new directory_service();
     $dir->search_by_attribute('ds_username', $this->event->get_value('contact_username'), array('ds_email'));
     $to = $dir->get_first_value('ds_email');
     $dates = explode(',', $this->event->get_value('dates'));
     $date_strings = array();
     foreach ($dates as $date) {
         $date_strings[] = prettify_mysql_datetime(trim($date), 'l, d F Y');
     }
     $subject = 'Event Registration: ' . $_POST["name"] . ' for ' . $this->event->get_value('name');
     $body = 'Name: ' . $_POST["name"] . "\n";
     /*$body.="Department: ".$_POST["department"]."\n";
     		$body.="Campus Address: ".$_POST["address"]."\n";
     		$body.="Campus Postal Address: ".$_POST["postal_address"]."\n";
     		$body.="Work Phone: ".$_POST["phone"]."\n";*/
     $body .= "E-mail Address: " . $_POST["email"] . "\n\n";
     $body .= 'Class: ' . $this->event->get_value('name') . "\n\n";
     $body .= 'Dates:' . "\n" . implode("\n", $date_strings) . "\n\n";
     $body .= 'Time: ' . prettify_mysql_datetime($this->event->get_value('datetime'), 'g:i a') . "\n\n";
     $body .= 'Location: ' . $this->event->get_value('location') . "\n\n";
     // separated out so we don't repeat the content twice when we write back into the DB
     $other_info = 'Other Information: ' . "\n" . strip_tags($this->event->get_value('content')) . "\n\n";
     // to person who should get registration
     mail($to, $subject, $body . $other_info, "From: " . strip_tags($_POST["email"]));
     // to person who filled out email
     mail(strip_tags($_POST["email"]), $subject, $body . $other_info, "From: " . strip_tags($to));
     $values = array('registration' => 'full', 'show_hide' => 'hide', 'content' => $this->event->get_value('content') . '<h3>Registration Information</h3>' . nl2br(htmlspecialchars($body, ENT_QUOTES)));
     reason_update_entity($this->event->id(), $this->event->get_value('last_edited_by'), $values, true);
     $this->show_registration_thanks();
 }
コード例 #2
0
 function process_registration()
 {
     $dir = new directory_service();
     $dir->search_by_attribute('ds_username', $this->event->get_value('contact_username'), array('ds_email'));
     $to = $dir->get_first_value('ds_email');
     $subject = 'Event Registration: ' . $_POST["name"] . ' for ' . $this->event->get_value('name');
     $body = 'Name: ' . $_POST["name"] . "\n";
     $body .= "E-mail Address: " . $_POST["email"] . "\n\n";
     $body .= 'Class: ' . $this->event->get_value('name') . "\n\n";
     $body .= 'Date & Time: ' . prettify_mysql_datetime($this->event->get_value('datetime'), 'm/d/Y \\a\\t g:i a') . "\n\n";
     $body .= 'Location: ' . $this->event->get_value('location') . "\n\n";
     // to person who should get registration
     mail($to, $subject, $body, "From: " . strip_tags($_POST["email"]));
     // to person who filled out email
     mail(strip_tags($_POST["email"]), $subject, $body, "From: " . strip_tags($to));
     $this->show_registration_thanks();
 }
コード例 #3
0
 function send_confirmation_emails()
 {
     $slot_entity = get_entity_by_id($this->request_array['slot_id']);
     $dir = new directory_service();
     $dir->search_by_attribute('ds_username', $this->event->get_value('contact_username'), array('ds_email', 'ds_fullname', 'ds_phone'));
     $to = $dir->get_first_value('ds_email');
     $subject = 'Event Registration: ' . $this->get_value('name') . ' for ' . $this->event->get_value('name');
     $body = $this->get_value('name') . ' has registered for ' . $this->event->get_value('name') . "\n\n";
     $body .= 'Name: ' . $this->get_value('name') . "\n";
     $body .= "E-mail Address: " . $this->get_value('email') . "\n";
     $body .= 'Date: ' . prettify_mysql_datetime($this->request_array['date'], 'm/d/Y') . "\n";
     if ($this->include_time_in_email) {
         $time = $this->event->get_value('datetime');
         $time_parts = explode(' ', $time);
         if ($time_parts[1] != '00:00:00') {
             $body .= 'Time: ' . prettify_mysql_datetime($time, 'g:i a') . "\n";
         }
     }
     $location = $this->event->get_value('location');
     if (!empty($location)) {
         $body .= 'Location: ' . $location . "\n";
     }
     $slot = $slot_entity['name'];
     $body .= 'Slot: ' . $slot . "\n\n";
     // to person who should get registration
     mail($to, $subject, $body, "From: " . strip_tags($this->get_value('email')));
     // to person who filled out email
     mail(strip_tags($this->get_value('email')), $subject, $body, "From: " . strip_tags($to));
 }
コード例 #4
0
ファイル: email.php プロジェクト: hunter2814/reason_package
 /**
  * Take mixed username/netids and email addresses and resolve into "clean" array of good-looking email addresses
  *
  * By good-looking we mean that they satisfy this regex: /^([^<]+<)?([-.]|\w)+@([-.]|\w)+\.([-.]|\w)+>?$/i
  *
  * This function works as follows: For each address, first treats
  * the address as a netid and tries to find a corresponding
  * address in the directory (if this fails, it assumes that the address
  * was intended as an address rather than a username); second, checks
  * whether the address is valid
  * 
  * If the address is invalid, the webmaster is included in the recipient list and an error is triggered
  *
  * @param mixed $addresses can be any of the following: 1) a valid email address, 2) a username in the directory, 3) a comma-delimited combination of addresses and/or usernames, or 4) an array of addresses and/or usernames.
  * @param string $address_type can be 'mixed', 'email', or 'username'
  * @return string $pretty_addresses Comma separated email addresses
  *
  **/
 function _prettify_addresses($addresses, $address_type = 'mixed')
 {
     if ($address_type != 'mixed' && $address_type != 'email' && $address_type != 'username') {
         trigger_error('$address_type parameter (' . $address_type . ') must be "mixed","email", or "username." Defaulting to "mixed".');
         $address_type = 'mixed';
     }
     if (!is_array($addresses)) {
         $addresses = explode(',', $addresses);
     }
     $pretty_address_array = array();
     foreach ($addresses as $address) {
         $address = trim($address);
         if (!empty($address)) {
             if ($address_type != 'email') {
                 $dir = new directory_service();
                 $result = $dir->search_by_attribute('ds_username', $address, array('ds_email'));
                 $dir_value = $dir->get_first_value('ds_email');
                 if ($address_type == 'username') {
                     if (empty($dir_value)) {
                         trigger_error('Username does not exist in directory service: ' . $address . '. setting address to ' . WEBMASTER_EMAIL_ADDRESS . ' instead.');
                         $address = WEBMASTER_EMAIL_ADDRESS;
                     } else {
                         $address = $dir_value;
                     }
                 } else {
                     $address = !empty($dir_value) ? $dir_value : $address;
                 }
             }
             $num_results = preg_match('/^([^<]+<)?([-.]|\\w)+@([-.]|\\w)+\\.([-.]|\\w)+>?$/i', $address);
             if ($num_results <= 0) {
                 trigger_error('The address ' . $address . ' is invalid - setting address to ' . WEBMASTER_EMAIL_ADDRESS . ' instead.');
                 $pretty_address_array[] = WEBMASTER_EMAIL_ADDRESS;
             } else {
                 $pretty_address_array[] = $address;
             }
         }
     }
     $pretty_addresses = implode(', ', $pretty_address_array);
     return $pretty_addresses;
 }
コード例 #5
0
ファイル: blog.php プロジェクト: hunter2814/reason_package
 function invalid_addresses($addresses)
 {
     $return_value = '';
     if (!is_array($addresses)) {
         $addresses = explode(',', $addresses);
     }
     $bad_addresses = array();
     foreach ($addresses as $address) {
         $address = trim($address);
         if (!empty($address)) {
             $dir = new directory_service();
             $result = $dir->search_by_attribute('ds_username', $address, array('ds_email'));
             $dir_value = $dir->get_first_value('ds_email');
             if (empty($dir_value)) {
                 $num_results = preg_match('/^([-.]|\\w)+@([-.]|\\w)+\\.([-.]|\\w)+$/i', $address);
                 if ($num_results <= 0) {
                     $bad_addresses[] = $address;
                 }
             }
         }
     }
     return $bad_addresses;
 }
コード例 #6
0
ファイル: events.php プロジェクト: natepixel/reason_package
	/**
	 * Get an array of contact information for a given event entity
	 *
	 * Array keys: 'username', 'email', 'fullname', 'phone', 'organization'
	 *
	 * @param object $e event entity
	 * @return array
	 */
	function get_contact_info($e)
	{
		$ret = array();
		$contact = $e->get_value('contact_username');
		if(!empty($contact) )
		{
			$ret['username'] = $contact;
			$dir = new directory_service();
			$dir->search_by_attribute('ds_username', array(trim($contact)), array('ds_email','ds_fullname','ds_phone',));
			$ret['email'] = $dir->get_first_value('ds_email');
			$ret['fullname'] = $dir->get_first_value('ds_fullname');
			$ret['phone'] = $dir->get_first_value('ds_phone');
			$ret['organization'] = $e->get_value('contact_organization');
		}
		return $ret;
	}
コード例 #7
0
 function send_email($media_work, $status, $netid)
 {
     if ($media_work->get_value('email_notification')) {
         $user = new entity(get_user_id($netid));
         $dir = new directory_service();
         $dir->search_by_attribute('ds_username', $netid, array('ds_email', 'ds_fullname', 'ds_phone'));
         $to = $dir->get_first_value('ds_email');
         $owner = $media_work->get_owner();
         $params = array('site_id' => $owner->id(), 'type_id' => id_of('av'), 'id' => $media_work->id(), 'cur_module' => 'Editor');
         $link = html_entity_decode(carl_construct_link($params, array(''), '/reason/index.php'));
         if ($status == 'success') {
             $subject = '[Reason] Media processing complete: ' . html_entity_decode(strip_tags($media_work->get_value('name')));
             $message = 'Media Work Processed' . "\n\n";
             $message .= 'Name:' . "\n" . html_entity_decode(strip_tags($media_work->get_value('name'))) . "\n\n";
             $message .= 'Site:' . "\n" . html_entity_decode(strip_tags($owner->get_value('name'))) . "\n\n";
             $message .= 'View it at this url: ' . $link . "\n\n";
             $message .= 'Uploaded by:' . "\n" . $user->get_value('name') . "\n\n";
         } else {
             $subject = '[Reason] Media error: ' . html_entity_decode(strip_tags($media_work->get_value('name')));
             $message = 'Media Work Error During Processing' . "\n\n";
             $message .= 'Name:' . "\n" . html_entity_decode(strip_tags($media_work->get_value('name'))) . "\n\n";
             $message .= 'Site:' . "\n" . html_entity_decode(strip_tags($owner->get_value('name'))) . "\n\n";
             $message .= 'Uploaded by:' . "\n" . $user->get_value('name') . "\n\n";
             $message .= 'View it at this url: ' . $link . "\n\n";
             $message .= 'If you continue to get this error after multiple attempts, please contact your Reason Administrator regarding this issue: ' . WEBMASTER_EMAIL_ADDRESS . "\n\n";
         }
         mail($to, $subject, $message);
     }
 }
コード例 #8
0
 function _get_maintainer_info($maintainer)
 {
     // Check to see if it's before or after 7 am, and set the last colleague->ldap sync time appropriately.
     if (carl_date('G') < 7) {
         $ldap_last_sync_time = strtotime('7 am yesterday');
     } else {
         $ldap_last_sync_time = strtotime('7 am today');
     }
     /*	Either of the following conditions will fire the ldap->reason sync:
     			1: the cached info predates the last colleague->ldap sync (presumed to be daily by 7 am.)
     			2: the primary maintainer has been changed since the last ldap->reason sync. */
     if ($this->parent->site_info->get_value('cache_last_updated') <= date('Y-m-d', $ldap_last_sync_time) || $this->parent->site_info->get_value('username_cache') != $this->parent->site_info->get_value('primary_maintainer')) {
         $dir = new directory_service();
         if ($dir->search_by_attribute('ds_username', $maintainer, array('ds_email', 'ds_fullname'))) {
             $email = $dir->get_first_value('ds_email');
             $full_name = $dir->get_first_value('ds_fullname');
             // lets fall back to the maintainer username if a valid full name is not found for the user
             $full_name = !carl_empty_html($full_name) ? $full_name : trim(strip_tags($maintainer));
             $values = array('email_cache' => $email, 'name_cache' => $full_name, 'cache_last_updated' => date('Y-m-d H:i:s'), 'username_cache' => $maintainer);
             $update_vals = array('ldap_cache' => $values);
             reason_include_once('function_libraries/admin_actions.php');
             /* I know this is nonstandard, but it's the only way right now 
             			to update the entity without creating an archive and changing 
             			the last_updated field on all the sites every day... */
             $sqler = new SQLER();
             foreach ($update_vals as $table => $fields) {
                 $sqler->update_one($table, $fields, $this->parent->site_info->id());
             }
         }
     } else {
         $email = $this->parent->site_info->get_value('email_cache');
         $full_name = $this->parent->site_info->get_value('name_cache');
     }
     return array('email' => $email, 'full_name' => $full_name);
 }