Beispiel #1
0
 /** -----------------------------------
 	/**  Compose New Message Form
 	/** -----------------------------------*/
 function compose($id = '', $errors = '')
 {
     if ($id == '') {
         if ($this->allegiance == 'cp' && ee()->input->get_post('msg') !== FALSE && is_numeric(ee()->input->get_post('msg'))) {
             $id = ee()->input->get_post('msg');
             $this->hide_preview = TRUE;
         } elseif ($this->allegiance == 'user' && $this->cur_id != '' && is_numeric($this->cur_id)) {
             $id = $this->cur_id;
             $this->hide_preview = TRUE;
         }
     }
     $template = $this->retrieve_template('message_compose');
     /** --------------------------------
     		/**  Form Declaration and Hidden Form Fields
     		/** --------------------------------*/
     $hidden = array();
     if ($id != '' && ee()->input->get_post('daction') != 'forward' && ee()->input->get_post('daction') != 'reply' && ee()->input->get_post('daction') != 'reply_all') {
         $hidden['message_id'] = $id;
     }
     if (ee()->input->get_post('daction') == 'forward') {
         $hidden['create_attach'] = 'y';
     }
     if (ee()->input->get_post('daction') == 'forward' or ee()->input->get_post('forwarding') !== FALSE) {
         $hidden['forwarding'] = ee()->input->get_post('daction') == 'forward' ? $id : ee()->input->get_post('forwarding');
     }
     if (ee()->input->get_post('daction') == 'reply_all' or ee()->input->get_post('daction') == 'reply' or ee()->input->get_post('replying') !== FALSE) {
         $hidden['replying'] = (ee()->input->get_post('daction') == 'reply' or ee()->input->get_post('daction') == 'reply_all') ? $id : ee()->input->get_post('replying');
     }
     $details = array('action' => $this->_create_path('send_message'), 'id' => 'submit_message', 'enctype' => 'multi', 'secure' => $this->allegiance == 'cp' ? FALSE : TRUE);
     /** -------------------------------------
     		/**  Default Values for Form
     		/** -------------------------------------*/
     $this->single_parts['include']['emoticons'] = $this->emoticons();
     $this->single_parts['include']['hidden_js'] = $this->hidden_js();
     $this->single_parts['image']['search_glass'] = '<img src="' . $this->images_folder . 'search_glass.gif" style="border: 0px" width="12" height="12" alt="' . ee()->lang->line('search_glass') . '" />';
     $this->single_parts['include']['search']['recipients'] = '<a href="#" title="{lang:member_search}" onclick="perform_search(1); return false;">' . $this->single_parts['image']['search_glass'] . '</a>';
     $this->single_parts['include']['search']['cc'] = '<a href="#" title="{lang:member_search}" onclick="perform_search(2); return false;">' . $this->single_parts['image']['search_glass'] . '</a>';
     $this->single_parts['include']['search_js'] = $this->search_js();
     $this->single_parts['include']['text_counter_js'] = $this->text_counter_js();
     $this->conditionals['attachments_allowed'] = $this->attach_allowed;
     $this->conditionals['attachments_exist'] = 'n';
     $this->single_parts['include']['attachments'] = '';
     $this->single_parts['lang']['max_file_size'] = $this->attach_maxsize;
     $this->single_parts['lang']['max_chars'] = $this->max_chars;
     $this->single_parts['input']['tracking_checked'] = "";
     $this->single_parts['input']['sent_copy_checked'] = '';
     $this->single_parts['input']['hide_cc_checked'] = '';
     $this->single_parts['include']['compose_header_js'] = $this->compose_header_js();
     $this->single_parts['include']['dynamic_address_book'] = $this->dynamic_address_book();
     $this->single_parts['include']['submission_error'] = '';
     $this->header_javascript .= $this->compose_header_js();
     /** -------------------------------------
     		/**  Spell Check Related Values
     		/** -------------------------------------*/
     $this->single_parts['include']['spellcheck_js'] = $this->spellcheck_enabled !== TRUE ? '' : $this->spellcheck_js();
     // goes first for enabled check
     $this->single_parts['path']['spellcheck_iframe'] = $this->spellcheck_enabled !== TRUE ? '' : $this->_create_path('spellcheck_iframe');
     $this->conditionals['spellcheck'] = $this->spellcheck_enabled !== TRUE ? 'n' : 'y';
     /** -------------------------------------
     		/**  Create the HTML formatting buttons
     		/** -------------------------------------*/
     $this->single_parts['include']['html_formatting_buttons'] = '';
     if (!class_exists('Html_buttons')) {
         if (include_once APPPATH . 'libraries/Html_buttons.php') {
             $BUTT = new EE_Html_buttons();
             $button_include = $BUTT->create_buttons();
             if ($this->allegiance == 'cp') {
                 $button_include = str_replace('htmlButtonOff', 'htmlButtonA', $button_include);
                 $button_include = str_replace('htmlButtonOn', 'htmlButtonB', $button_include);
             }
             /** -------------------------------
             				/**  Fixes a small problem with single and double quotes
             				/** -------------------------------*/
             $this->single_parts['include']['html_formatting_buttons'] = str_replace("document.getElementById('submit_post').", "document.getElementById('submit_message').", $button_include);
         }
     }
     /** ----------------------------------------
     		/**  Preview, Reply, Forward or New Entry?
     		/** ----------------------------------------*/
     if ($id != '' && is_numeric($id)) {
         if (ee()->input->post('daction') !== FALSE && (ee()->input->get_post('daction') == 'reply' or ee()->input->get_post('daction') == 'reply_all' or ee()->input->get_post('daction') == 'forward')) {
             $data = $this->_message_data($id, '', $this->member_id);
             if (ee()->config->item('enable_censoring') == 'y' && ee()->config->item('censored_words') != '') {
                 ee()->load->library('typography');
                 ee()->typography->initialize();
                 $subject = $data === FALSE ? '' : ee()->typography->filter_censored_words($data['subject']);
                 $body = $data === FALSE ? '' : ee()->typography->filter_censored_words($data['body']);
             } else {
                 $subject = $data === FALSE ? '' : $data['subject'];
                 $body = $data === FALSE ? '' : $data['body'];
             }
             $booger['hidden_fields'] = array('message_id' => $data['id'], 'forward' => 'y');
             $prefix = ee()->input->post('daction') == 'forward' ? 'forward_prefix' : 'reply_prefix';
             $prefix = lang($prefix);
             // Ensure only one prefix
             $prefix = substr($data['subject'], 0, strlen($prefix)) == $prefix ? '' : $prefix;
             $this->single_parts['input']['subject'] = $data === FALSE ? '' : $prefix . $subject;
             $this->single_parts['input']['body'] = '';
             if ($data !== FALSE) {
                 if (ee()->input->post('daction') == 'forward') {
                     $forward_message = NL . NL . NL . ee()->lang->line('forward_header') . NL;
                     $forward_message .= ee()->lang->line('forward_from') . $data['sender'] . NL;
                     $forward_message .= ee()->lang->line('forward_date') . $data['date'] . NL;
                     $forward_message .= ee()->lang->line('forward_subject') . $data['subject'];
                     $this->single_parts['input']['body'] .= $forward_message;
                 }
                 $this->single_parts['input']['body'] .= NL . NL . NL . '[quote]' . NL . $body . NL . '[/quote]';
             }
             $this->single_parts['input']['recipients'] = ($data === FALSE or ee()->input->post('daction') == 'forward') ? '' : $this->convert_recipients($data['sender_id']);
             if ($data === FALSE or ee()->input->post('daction') != 'reply_all') {
                 $this->single_parts['input']['cc'] = '';
             } else {
                 $cc = $this->convert_recipients($data['recipients'] . ',' . $data['cc']);
                 $x = explode(', ', $cc);
                 $y = explode(', ', $this->single_parts['input']['recipients']);
                 // Make sure CC does not contain members in Recipients
                 $cc = array_diff($x, $y);
                 $this->single_parts['input']['cc'] = implode(', ', $cc);
             }
             $this->single_parts['include']['preview_message'] = '';
             if (ee()->input->post('daction') == 'forward' && $data !== FALSE && count($data['attachments']) > 0) {
                 $this->conditionals['attachments_allowed'] = count($data['attachments']) >= $this->max_attachments ? 'n' : 'y';
                 $this->conditionals['attachments_exist'] = 'y';
                 $this->single_parts['include']['attachments'] = $this->_display_attachments($data['attachments']);
                 $hidden['attach'] = implode('|', $data['attach']);
             }
         } else {
             $data = $this->_message_data($id, $this->member_id);
             if (ee()->config->item('enable_censoring') == 'y' && ee()->config->item('censored_words') != '') {
                 ee()->load->library('typography');
                 ee()->typography->initialize();
                 $subject = $data === FALSE ? '' : ee()->typography->filter_censored_words($data['subject']);
                 $body = $data === FALSE ? '' : ee()->typography->filter_censored_words($data['body']);
             } else {
                 $subject = $data === FALSE ? '' : $data['subject'];
                 $body = $data === FALSE ? '' : $data['body'];
             }
             $this->single_parts['input']['subject'] = $subject;
             $this->single_parts['input']['body'] = $body;
             $this->single_parts['input']['recipients'] = $data === FALSE ? '' : $this->convert_recipients($data['recipients']);
             $this->single_parts['input']['cc'] = $data === FALSE ? '' : $this->convert_recipients($data['cc']);
             $this->single_parts['include']['preview_message'] = ($data === FALSE or $this->hide_preview === TRUE) ? '' : $data['preview'];
             $this->single_parts['input']['tracking_checked'] = ($data === FALSE or $data['tracking'] == 'n') ? '' : "checked='checked'";
             $this->single_parts['input']['sent_copy_checked'] = ($data === FALSE or $data['sent_copy'] == 'n') ? '' : "checked='checked'";
             $this->single_parts['input']['hide_cc_checked'] = ($data === FALSE or $data['hide_cc'] == 'n') ? '' : "checked='checked'";
             if ($data !== FALSE && count($data['attachments']) > 0) {
                 $this->conditionals['attachments_allowed'] = count($data['attachments']) >= $this->max_attachments ? 'n' : 'y';
                 $this->conditionals['attachments_exist'] = 'y';
                 $this->single_parts['include']['attachments'] = $this->_display_attachments($data['attachments']);
                 $hidden['attach'] = implode('|', $data['attach']);
             }
         }
     } else {
         $this->single_parts['input']['subject'] = !ee()->input->get_post('subject') ? '' : ee()->input->get_post('subject', TRUE);
         $this->single_parts['input']['body'] = !ee()->input->get_post('body') ? '' : ee()->input->get_post('body', TRUE);
         $this->single_parts['input']['cc'] = '';
         $this->single_parts['input']['recipients'] = !ee()->input->get_post('recipients') ? '' : $this->convert_recipients(ee()->input->get_post('recipients'));
         $this->single_parts['include']['preview_message'] = '';
     }
     $details['hidden_fields'] = $hidden;
     $this->single_parts['form']['form_declaration']['messages'] = ee()->functions->form_declaration($details);
     // --------------------------------------------
     //  If upload path is not specified we
     //  override all attachment related settings
     // --------------------------------------------
     if ($this->upload_path == '') {
         $this->conditionals['attachments_allowed'] = 'n';
         $this->conditionals['attachments_exist'] = 'n';
         $this->single_parts['include']['attachments'] = '';
     }
     /** ---------------------------------------
     		/**  Error Message Displaying, if any
     		/** ---------------------------------------*/
     if (is_array($errors) && count($errors) > 0) {
         $this->single_parts['lang']['error_message'] = implode(BR, $errors);
         $this->single_parts['include']['submission_error'] = $this->_process_template($this->retrieve_template('message_submission_error'));
     }
     /** ----------------------------------------
     		/**  Return the Compose Form Contents
     		/** ----------------------------------------*/
     $this->title = ee()->lang->line('compose_message');
     $this->crumb = ee()->lang->line('compose_message');
     $this->return_data = $this->_process_template($template);
 }
Beispiel #2
0
	/** ----------------------------------------
	/**  Signature Edit Form
	/** ----------------------------------------*/

	function edit_signature()
	{
		/** -------------------------------------
		/**  Are signatures allowed?
		/** -------------------------------------*/

		if ($this->EE->config->item('allow_signatures') == 'n')
		{
			return $this->_trigger_error('edit_signature', 'signatures_not_allowed');
		}

		/** -------------------------------------
		/**  Create the HTML formatting buttons
		/** -------------------------------------*/
		$buttons = '';
		if ( ! class_exists('Html_buttons'))
		{
			if (include_once(APPPATH.'libraries/Html_buttons'.EXT))
			{
				$BUTT = new EE_Html_buttons();
				$BUTT->allow_img = ($this->EE->config->item('sig_allow_img_hotlink') == 'y') ? TRUE : FALSE;


				$buttons = $BUTT->create_buttons();
			}
		}

		$query = $this->EE->db->query("SELECT signature, sig_img_filename, sig_img_width, sig_img_height FROM exp_members WHERE member_id = '".$this->EE->session->userdata('member_id')."'");

		$template = $this->_load_element('signature_form');

		if ($this->EE->config->item('sig_allow_img_upload') == 'y')
		{
			$template = $this->_allow_if('upload_allowed', $template);
			$template = $this->_deny_if('upload_not_allowed', $template);
		}
		else
		{
			$template = $this->_allow_if('upload_not_allowed', $template);
			$template = $this->_deny_if('upload_allowed', $template);
		}
		if ($query->row('sig_img_filename')  == '' OR $this->EE->config->item('sig_allow_img_upload') == 'n')
		{
			$template = $this->_deny_if('image', $template);
			$template = $this->_allow_if('no_image', $template);
		}
		else
		{
			$template = $this->_allow_if('image', $template);
			$template = $this->_deny_if('no_image', $template);
		}


		$max_kb = ($this->EE->config->item('sig_img_max_kb') == '' OR $this->EE->config->item('sig_img_max_kb') == 0) ? 50 : $this->EE->config->item('sig_img_max_kb');
		$max_w  = ($this->EE->config->item('sig_img_max_width') == '' OR $this->EE->config->item('sig_img_max_width') == 0) ? 100 : $this->EE->config->item('sig_img_max_width');
		$max_h  = ($this->EE->config->item('sig_img_max_height') == '' OR $this->EE->config->item('sig_img_max_height') == 0) ? 100 : $this->EE->config->item('sig_img_max_height');
		$max_size = str_replace('%x', $max_w, $this->EE->lang->line('max_image_size'));
		$max_size = str_replace('%y', $max_h, $max_size);
		$max_size .= ' - '.$max_kb.'KB';

		$data = array(
						'action' 		=> $this->_member_path('update_signature'),
						'enctype'		=> 'multi',
						'id'			=> 'submit_post'
					);

		return $this->_var_swap($template,
								array(
										'form_declaration'		=> $this->EE->functions->form_declaration($data),
										'path:signature_image'		=> 	$this->EE->config->slash_item('sig_img_url').$query->row('sig_img_filename') ,
										'signature_image_width'		=> 	$query->row('sig_img_width') ,
										'signature_image_height'	=> 	$query->row('sig_img_height') ,
										'signature'					=>	$query->row('signature') ,
										'lang:max_image_size'		=>  $max_size,
										'maxchars'					=> ($this->EE->config->item('sig_maxlength') == 0) ? 10000 : $this->EE->config->item('sig_maxlength'),
										'include:html_formatting_buttons' => $buttons,
									 )
								);
	}