Beispiel #1
0
    /** -----------------------------------
        /**  Edit Signature Form
        /** -----------------------------------*/
    function edit_signature()
    {
        global $IN, $DB, $DSP, $SESS, $LANG, $PREFS;
        if (FALSE === ($id = $this->auth_id())) {
            return $DSP->no_access_message();
        }
        $title = $LANG->line('edit_signature');
        /** -------------------------------------
        		/**  Create the HTML formatting buttons
        		/** -------------------------------------*/
        $buttons = '';
        if (!class_exists('Html_buttons')) {
            if (include_once PATH_LIB . 'html_buttons' . EXT) {
                $BUTT = new Html_buttons();
                $BUTT->allow_img = $PREFS->ini('sig_allow_img_hotlink') == 'y' ? TRUE : FALSE;
                $buttons = $BUTT->create_buttons();
                $buttons = str_replace(LD . 'lang:close_tags' . RD, $LANG->line('close_tags'), $buttons);
            }
        }
        $query = $DB->query("SELECT signature, sig_img_filename, sig_img_width, sig_img_height FROM exp_members WHERE member_id = '{$id}'");
        $max_kb = ($PREFS->ini('sig_img_max_kb') == '' or $PREFS->ini('sig_img_max_kb') == 0) ? 50 : $PREFS->ini('sig_img_max_kb');
        $max_w = ($PREFS->ini('sig_img_max_width') == '' or $PREFS->ini('sig_img_max_width') == 0) ? 100 : $PREFS->ini('sig_img_max_width');
        $max_h = ($PREFS->ini('sig_img_max_height') == '' or $PREFS->ini('sig_img_max_height') == 0) ? 100 : $PREFS->ini('sig_img_max_height');
        $max_size = str_replace('%x', $max_w, $LANG->line('max_image_size'));
        $max_size = str_replace('%y', $max_h, $max_size);
        $max_size .= ' - ' . $max_kb . 'KB';
        $r = "<form method=\"post\" action=\"" . BASE . AMP . 'C=myaccount' . AMP . 'M=update_signature' . "\" enctype=\"multipart/form-data\" name=\"submit_post\" id=\"submit_post\" >\n";
        $r .= $DSP->input_hidden('id', $id);
        if ($IN->GBL('U')) {
            $r .= $DSP->qdiv('successBox', $DSP->qdiv('success', NBS . $LANG->line('signature_updated')));
        }
        $r .= $DSP->table('tableBorder', '0', '10', '100%') . $DSP->tr() . $DSP->td('tableHeading', '', '2');
        $r .= $title;
        $r .= $DSP->td_c() . $DSP->tr_c();
        $buttons2 = '
			<select name="size" class="select" onchange="selectinsert(this, \'size\')" >
			<option value="0">' . $LANG->line('size') . '</option>
			<option value="1">' . $LANG->line('small') . '</option>
			<option value="3">' . $LANG->line('medium') . '</option>
			<option value="4">' . $LANG->line('large') . '</option>
			<option value="5">' . $LANG->line('very_large') . '</option>
			<option value="6">' . $LANG->line('largest') . '</option>
			</select>
			
			<select name="color" class="select" onchange="selectinsert(this, \'color\')">
			<option value="0">' . $LANG->line('color') . '</option>
			<option value="blue">' . $LANG->line('blue') . '</option>
			<option value="green">' . $LANG->line('green') . '</option>
			<option value="red">' . $LANG->line('red') . '</option>
			<option value="purple">' . $LANG->line('purple') . '</option>
			<option value="orange">' . $LANG->line('orange') . '</option>
			<option value="yellow">' . $LANG->line('yellow') . '</option>
			<option value="brown">' . $LANG->line('brown') . '</option>
			<option value="pink">' . $LANG->line('pink') . '</option>
			<option value="gray">' . $LANG->line('grey') . '</option>
			</select>
        ';
        $r .= $DSP->tr();
        $r .= $DSP->td('tableCellTwo', '18%');
        $r .= $DSP->qdiv('defaultRight', $DSP->qdiv('buttonMode', $LANG->line('guided') . "&nbsp;<input type='radio' name='mode' value='guided' onclick='setmode(this.value)' />&nbsp;" . $LANG->line('normal') . "&nbsp;<input type='radio' name='mode' value='normal' onclick='setmode(this.value)' checked='checked'/>"));
        $r .= $DSP->td_c();
        $r .= $DSP->td('tableCellTwo', '82%');
        $r .= $buttons;
        $r .= $DSP->td_c();
        $r .= $DSP->tr_c();
        $r .= $DSP->tr();
        $r .= $DSP->td('tableCellTwo', '18%');
        $r .= $DSP->qdiv('defaultRight', $DSP->qdiv('buttonMode', $LANG->line('font_formatting')));
        $r .= $DSP->td_c();
        $r .= $DSP->td('tableCellTwo', '82%');
        $r .= $buttons2;
        $r .= $DSP->td_c();
        $r .= $DSP->tr_c();
        $r .= $DSP->tr();
        $r .= $DSP->td('tableCellTwo', '18%', '', '', 'top');
        $r .= $DSP->qdiv('defaultRight', $DSP->qdiv('defaultBold', $LANG->line('signature')));
        $r .= $DSP->td_c();
        $r .= $DSP->td('tableCellTwo', '83%');
        $r .= $DSP->input_textarea('body', $query->row['signature'], '8', 'textarea', '100%');
        $r .= $DSP->td_c();
        $r .= $DSP->tr_c();
        if ($PREFS->ini('sig_allow_img_upload') == 'y') {
            $r .= $DSP->tr();
            $r .= $DSP->td('tableCellTwo', '18%');
            $r .= $DSP->qdiv('defaultRight', $DSP->qdiv('defaultBold', $LANG->line('signature_image')));
            $r .= $DSP->td_c();
            $r .= $DSP->td('tableCellTwo', '82%');
            if ($query->row['sig_img_filename'] == '') {
                $r .= $LANG->line('no_image_exists');
            } else {
                $r .= '<img src="' . $PREFS->ini('sig_img_url', TRUE) . $query->row['sig_img_filename'] . '" border="0" width="' . $query->row['sig_img_width'] . '" height="' . $query->row['sig_img_height'] . '" title="' . $LANG->line('signature_image') . '" />';
            }
            $r .= $DSP->td_c();
            $r .= $DSP->tr_c();
            $r .= $DSP->tr();
            $r .= $DSP->td('tableCellTwo', '18%', '', '', 'top');
            $r .= $DSP->qdiv('defaultRight', $DSP->qdiv('defaultBold', $LANG->line('upload_image')));
            $r .= $DSP->td_c();
            $r .= $DSP->td('tableCellTwo', '82%');
            $r .= $DSP->qdiv('itemWrapper', "<input type=\"file\" name=\"userfile\" size=\"20\" />");
            $r .= $DSP->qdiv('itemWrapper', $DSP->qdiv('buttonMode', $max_size));
            $r .= $DSP->qdiv('itemWrapper', $DSP->qdiv('buttonMode', $LANG->line('allowed_image_types')));
            $r .= $DSP->td_c();
            $r .= $DSP->tr_c();
        }
        $r .= $DSP->tr();
        $r .= $DSP->td('tableCellTwo', '', '2');
        $r .= $DSP->div('buttonWrapper');
        $r .= $DSP->input_submit($LANG->line('update_signature'));
        if ($query->row['sig_img_filename'] != '') {
            $r .= NBS . NBS . $DSP->input_submit($LANG->line('remove_image'), 'remove');
        }
        $r .= $DSP->div_c();
        $r .= $DSP->td_c();
        $r .= $DSP->tr_c();
        $r .= $DSP->table_c();
        $r .= $DSP->form_close();
        return $this->account_wrapper($title, $title, $r);
    }
Beispiel #2
0
    /** ----------------------------------------
    /**  Signature Edit Form
    /** ----------------------------------------*/
	
	function edit_signature()
	{
		global $DB, $SESS, $LANG, $PREFS, $FNS;
	
		/** -------------------------------------
		/**  Are signatures allowed?
		/** -------------------------------------*/
		
		if ($PREFS->ini('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(PATH_LIB.'html_buttons'.EXT))
			{
				$BUTT = new Html_buttons();
				$BUTT->allow_img = ($PREFS->ini('sig_allow_img_hotlink') == 'y') ? TRUE : FALSE;
				
				
				$buttons = $BUTT->create_buttons();
			}
		}
				
		$query = $DB->query("SELECT signature, sig_img_filename, sig_img_width, sig_img_height FROM exp_members WHERE member_id = '".$SESS->userdata('member_id')."'");
				
		$template = $this->_load_element('signature_form');
		
		if ($PREFS->ini('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 $PREFS->ini('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 = ($PREFS->ini('sig_img_max_kb') == '' OR $PREFS->ini('sig_img_max_kb') == 0) ? 50 : $PREFS->ini('sig_img_max_kb');
		$max_w  = ($PREFS->ini('sig_img_max_width') == '' OR $PREFS->ini('sig_img_max_width') == 0) ? 100 : $PREFS->ini('sig_img_max_width');
		$max_h  = ($PREFS->ini('sig_img_max_height') == '' OR $PREFS->ini('sig_img_max_height') == 0) ? 100 : $PREFS->ini('sig_img_max_height');
		$max_size = str_replace('%x', $max_w, $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'		=> $FNS->form_declaration($data),								
										'path:signature_image'		=> 	$PREFS->ini('sig_img_url', TRUE).$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'					=> ($PREFS->ini('sig_maxlength') == 0) ? 10000 : $PREFS->ini('sig_maxlength'),
										'include:html_formatting_buttons' => $buttons,
									 )
								);
	}
 /** -----------------------------------
     /**  Compose New Message Form
     /** -----------------------------------*/
 function compose($id = '', $errors = '')
 {
     global $LANG, $DB, $PREFS, $IN, $FNS;
     if ($id == '') {
         if ($this->allegiance == 'cp' && $IN->GBL('msg') !== FALSE && is_numeric($IN->GBL('msg'))) {
             $id = $IN->GBL('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 != '' && $IN->GBL('daction') != 'forward' && $IN->GBL('daction') != 'reply' && $IN->GBL('daction') != 'reply_all') {
         $hidden['message_id'] = $id;
     }
     if ($IN->GBL('daction') == 'forward') {
         $hidden['create_attach'] = 'y';
     }
     if ($IN->GBL('daction') == 'forward' or $IN->GBL('forwarding') !== FALSE) {
         $hidden['forwarding'] = $IN->GBL('daction') == 'forward' ? $id : $IN->GBL('forwarding');
     }
     if ($IN->GBL('daction') == 'reply_all' or $IN->GBL('daction') == 'reply' or $IN->GBL('replying') !== FALSE) {
         $hidden['replying'] = ($IN->GBL('daction') == 'reply' or $IN->GBL('daction') == 'reply_all') ? $id : $IN->GBL('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="' . $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 PATH_LIB . 'html_buttons' . EXT) {
             $BUTT = new 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 ($IN->GBL('daction') !== FALSE && ($IN->GBL('daction', 'POST') == 'reply' or $IN->GBL('daction', 'POST') == 'reply_all' or $IN->GBL('daction', 'POST') == 'forward')) {
             $data = $this->_message_data($id, '', $this->member_id);
             if ($PREFS->ini('enable_censoring') == 'y' && $PREFS->ini('censored_words') != '') {
                 if (!class_exists('Typography')) {
                     require PATH_CORE . 'core.typography' . EXT;
                 }
                 $TYPE = new Typography(0);
                 $subject = $data === FALSE ? '' : $TYPE->filter_censored_words($data['subject']);
                 $body = $data === FALSE ? '' : $TYPE->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 = $IN->GBL('daction', 'POST') == 'forward' ? 'forward_prefix' : 'reply_prefix';
             $prefix = substr($data['subject'], 0, strlen($LANG->line($prefix))) == $LANG->line($prefix) ? '' : '{lang:' . $prefix . '}';
             $this->single_parts['input']['subject'] = $data === FALSE ? '' : $prefix . $subject;
             $this->single_parts['input']['body'] = $data === FALSE ? '' : NL . NL . NL . '[quote]' . NL . $body . NL . '[/quote]';
             $this->single_parts['input']['recipients'] = ($data === FALSE or $IN->GBL('daction', 'POST') == 'forward') ? '' : $this->convert_recipients($data['sender_id']);
             if ($data === FALSE or $IN->GBL('daction', 'POST') != '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 ($IN->GBL('daction', 'POST') == 'forward' && $data !== FALSE && sizeof($data['attachments']) > 0) {
                 $this->conditionals['attachments_allowed'] = sizeof($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 ($PREFS->ini('enable_censoring') == 'y' && $PREFS->ini('censored_words') != '') {
                 if (!class_exists('Typography')) {
                     require PATH_CORE . 'core.typography' . EXT;
                 }
                 $TYPE = new Typography(0);
                 $subject = $data === FALSE ? '' : $TYPE->filter_censored_words($data['subject']);
                 $body = $data === FALSE ? '' : $TYPE->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 && sizeof($data['attachments']) > 0) {
                 $this->conditionals['attachments_allowed'] = sizeof($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'] = !$IN->GBL('subject') ? '' : $IN->GBL('subject');
         $this->single_parts['input']['body'] = !$IN->GBL('body') ? '' : $IN->GBL('body');
         $this->single_parts['input']['cc'] = '';
         $this->single_parts['input']['recipients'] = !$IN->GBL('recipients') ? '' : $this->convert_recipients($IN->GBL('recipients'));
         $this->single_parts['include']['preview_message'] = '';
     }
     $details['hidden_fields'] = $hidden;
     $this->single_parts['form']['form_declaration']['messages'] = $FNS->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) && sizeof($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 = $LANG->line('compose_message');
     $this->crumb = $LANG->line('compose_message');
     $this->return_data = $this->_process_template($template);
 }