コード例 #1
0
ファイル: view.html.php プロジェクト: vstorm83/propertease
    function display($tpl = null)
    {
        FCP_Admin::make_title('COM_FLEXICONTACT_TOOLBAR_HELP');
        // we need a form for the trace controls
        ?>
	<form action="index.php" method="get" name="adminForm" id="adminForm" >
	<input type="hidden" name="option" value="com_flexicontactplus" />
	<input type="hidden" name="controller" value="menu" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="view" value="help" />
	</form>
	<?php 
        // build the help screen
        $help['name'] = LAFC_COMPONENT_NAME;
        $help['prefix'] = 'COM_FLEXICONTACT';
        $help['current_version'] = FCP_trace::getComponentVersion();
        $help['reference'] = 'flexicontactplus';
        $help['link_version'] = "http://www.lesarbresdesign.info/version-history/flexicontactplus";
        $help['link_doc'] = "http://www.lesarbresdesign.info/extensions/flexicontactplus";
        $help['link_rating'] = "http://extensions.joomla.org/extensions/contacts-and-feedback/contact-forms/20045";
        $this->draw_help($help);
        echo '<p></p>';
        echo FCP_trace::make_trace_controls('menu');
    }
コード例 #2
0
ファイル: data.php プロジェクト: vstorm83/propertease
 static function validate_date($yyyy_mm_dd)
 {
     FCP_trace::trace("  validate_date({$yyyy_mm_dd})");
     if (strlen($yyyy_mm_dd) != 10) {
         return false;
     }
     if ($yyyy_mm_dd[4] != '-' or $yyyy_mm_dd[7] != '-') {
         return false;
     }
     if (!is_numeric(substr($yyyy_mm_dd, 8, 2))) {
         return false;
     }
     if (!is_numeric(substr($yyyy_mm_dd, 5, 2))) {
         return false;
     }
     if (!is_numeric(substr($yyyy_mm_dd, 0, 4))) {
         return false;
     }
     return checkdate(substr($yyyy_mm_dd, 5, 2), substr($yyyy_mm_dd, 8, 2), substr($yyyy_mm_dd, 0, 4));
     // year
 }
コード例 #3
0
 function display_embedded($config_name)
 {
     // get the specified configuration
     $config_name = trim($config_name);
     $config_name = htmlspecialchars_decode($config_name, ENT_QUOTES);
     // convert html entities to characters
     FCP_Common::strip_quotes($config_name);
     // remove all quotes
     jimport('joomla.application.component.model');
     $config_data = $this->config_model->getConfigData($config_name);
     if ($config_data === false) {
         JPlugin::loadLanguage();
         // load the plugin's own language file
         $html = JText::_('PLG_CONTENT_FLEXICONTACTPLUS_NO_CONFIG');
         FCP_trace::trace("PLUGIN: No config data");
         return $html;
     }
     $this->data_model->init_data($config_data);
     $html = FlexicontactplusViewContact::draw_page($config_data, $this->data_model->data);
     return $html;
 }
コード例 #4
0
ファイル: config.php プロジェクト: vstorm83/propertease
 function getConfigData($config_name)
 {
     $langObj = JFactory::getLanguage();
     $language = $langObj->get('tag');
     // get the current site language
     // try to find the named configuration for the current site language
     FCP_trace::trace("Loading config [{$config_name}] for [{$language}]");
     $config_data = $this->getOne($config_name, $language, true);
     // if we didn't find it, try to get the default configuration
     if ($config_data === false) {
         FCP_trace::trace("No config [{$config_name}] for [{$language}], using default");
         $config_data = $this->getOneById(0);
     }
     // if we still didn't find a configuration, something is very wrong and we can't continue
     return $config_data->config_data;
 }
コード例 #5
0
ファイル: controller.php プロジェクト: vstorm83/propertease
 function send()
 {
     // code to simulate an error for testing the Ajax error handling
     //	header('Location: http://www._nowhere_.com/');
     //	echo "Failure test";
     //	return;
     // get the config data
     $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . '/models');
     $jinput = JFactory::getApplication()->input;
     $task = $jinput->get('task', '', 'STRING');
     $config_id = $jinput->get('config_id', 0, 'INT');
     $config_model = $this->getModel('config');
     $config_row = $config_model->getOneById($config_id);
     if ($config_row === false) {
         FCP_trace::trace("Config {$config_id} not found");
         $response = array();
         $response['fcp_err_top'] = "Config {$config_id} not found";
         $response_array[] = $response;
         $json_response = json_encode($response_array);
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         echo $json_response;
         return;
     }
     FCP_trace::trace("Controller send() loaded config {$config_id}: " . $config_row->name);
     $config_data = $config_row->config_data;
     // validate the fields
     // if there are any errors, send back the error response
     $data_model = $this->getModel('data');
     $data_model->get_data($config_data);
     $response_array = array();
     $valid = $data_model->validate_all($config_data, $response_array);
     // if validate_all() returns -1 we need to kill the session
     if ($valid === -1) {
         $session = JFactory::getSession();
         $session->destroy();
         $response = array();
         $response['hide'] = 'fcp_top';
         // remove the top text
         $response_array[] = $response;
         $response = array();
         $response['hide'] = 'fcp_bottom';
         // remove the bottom text
         $response_array[] = $response;
         $json_response = json_encode($response_array);
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         FCP_trace::trace(" Sending request to re-start session: " . $json_response);
         echo $json_response;
         return;
     }
     // if there were errors on the form, return the response_array to the browser
     if (!$valid) {
         $response = array();
         $response['fcp_spinner'] = $this->make_error($config_data, JText::_('COM_FLEXICONTACT_MESSAGE_NOT_SENT'));
         $response['e_error'] = 'fcp_spinner';
         $response_array[] = $response;
         $json_response = json_encode($response_array);
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         FCP_trace::trace(" Sending error report: " . $json_response);
         echo $json_response;
         return;
     }
     // if this was a send1 task and there are non-blank file attachments, we need to request the actual files
     if ($task == 'send1') {
         foreach ($config_data->all_fields as $field_index => $field) {
             $field_id = sprintf('field%03d', $field_index);
             if ($field->field_type == LAFC_FIELD_ATTACHMENT and !empty($data_model->data[$field_id])) {
                 $response = array();
                 $response['send_files'] = 'Yes';
                 // request the files
                 $response_array[] = $response;
                 $json_response = json_encode($response_array);
                 $document = JFactory::getDocument();
                 $document->setMimeEncoding('application/json');
                 FCP_trace::trace(" Sending request for files: " . $json_response);
                 echo $json_response;
                 return;
             }
         }
     }
     // all ok, send the emails
     $email_model = $this->getModel('email');
     $email_model->get_files($config_data);
     // get any files that were attached (must do this before init_data())
     $email_model->init_data($config_data);
     // get all other data
     $email_status = $email_model->sendEmail($config_data);
     $email_model->delete_files();
     $email_errors = ob_get_contents();
     // phpmailer has a nasty habit of echo'ing errors
     ob_clean();
     if (strlen($email_errors) > 0) {
         FCP_trace::trace("Phpmailer echoed: [{$email_errors}]");
     }
     if ($config_data->logging) {
         $log_model = $this->getModel('log');
         $email_model->data->config_name = $config_data->name;
         $email_model->data->config_lang = $config_data->language;
         $log_model->store($email_model->data);
         FCP_trace::trace(" Message logged");
     }
     // reset captcha flags in the session
     if ($config_data->recaptcha_theme > 0) {
         $this->_app->setUserState(LAFC_COMPONENT . "_recaptcha_passed", "N");
     }
     if ($config_data->secure_captcha) {
         $this->_app->setUserState(LAFC_COMPONENT . "_secure_captcha_passed", "N");
     }
     // if email sending failed, show a message at the top of the page
     if ($email_status != '1') {
         $failed_message = JText::_('COM_FLEXICONTACT_MESSAGE_FAILED') . ': ' . $email_status . ' ' . $email_errors;
         $response = array();
         $response['fcp_wrapper'] = '<div style="padding:20px">' . $failed_message . '</div>';
         $response_array = array();
         // clear out any other responses
         $response_array[] = $response;
         $response = array();
         $response['hide'] = 'fcp_top';
         // remove the top text
         $response_array[] = $response;
         $response = array();
         $response['hide'] = 'fcp_bottom';
         // remove the bottom text
         $response_array[] = $response;
         $json_response = json_encode($response_array);
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         FCP_trace::trace(" Sending failure report: " . $json_response);
         echo $json_response;
         return;
     }
     // here if the email was sent ok
     // if we have a confirmation link, tell the Javascript to go there
     if ($config_data->confirm_link) {
         $response = array();
         $response['redirect'] = $config_data->confirm_link;
         $response_array = array();
         // clear out any other responses
         $response_array[] = $response;
         $json_response = json_encode($response_array);
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/json');
         FCP_trace::trace(" Redirecting to confirm link:: " . $json_response);
         echo $json_response;
         return;
     }
     // Merge the confirmation page and send it
     $message = $email_model->email_merge($config_data->confirm_text, $config_data);
     $response = array();
     $response_array = array();
     // clear out any other responses
     $response['fcp_wrapper'] = $message;
     $response_array[] = $response;
     $response = array();
     $response['hide'] = 'fcp_top';
     // remove the top text
     $response_array[] = $response;
     $response = array();
     $response['hide'] = 'fcp_bottom';
     // remove the bottom text
     $response_array[] = $response;
     $json_response = json_encode($response_array);
     FCP_trace::trace("Sending confirmation text: {$json_response}");
     $document = JFactory::getDocument();
     $document->setMimeEncoding('application/json');
     echo $json_response;
 }
コード例 #6
0
ファイル: import.php プロジェクト: vstorm83/propertease
    function import(&$return_message)
    {
        if (FCP_trace::tracing()) {
            $count_imported_rows = $this->count_imported_rows();
            FCP_trace::trace("Log import deleting {$count_imported_rows} rows");
            $free_log_info = $this->free_log_info();
            FCP_trace::trace(" Free log info: " . print_r($free_log_info, true));
        }
        // delete any rows previously imported
        $query = "DELETE FROM `#__flexicontact_plus_log` WHERE `imported` = 1";
        $result = $this->ladb_execute($query);
        if ($result === false) {
            $return_message = $this->ladb_error_text();
            return false;
        }
        // if Free FlexiContact is still installed, we can get the component parameters
        // and then get the optional field names
        $component_params = JComponentHelper::getParams("com_flexicontact");
        $params = $component_params->toObject();
        $promptname1 = 'Field1';
        $promptname2 = 'Field2';
        $promptname3 = 'Field3';
        $promptname4 = 'Field4';
        $promptname5 = 'Field5';
        $list_prompt = 'List Choice';
        if (isset($params->field_prompt1)) {
            FCP_trace::trace("Found free component parameters");
            $promptname1 = $params->field_prompt1;
            $promptname2 = $params->field_prompt2;
            $promptname3 = $params->field_prompt3;
            $promptname4 = $params->field_prompt4;
            $promptname5 = $params->field_prompt5;
            if (isset($params->list_prompt)) {
                // versions < 5.10 only
                $list_prompt = $params->list_prompt;
            }
        }
        $query = "SELECT * FROM `#__flexicontact_log` ";
        $rows = $this->ladb_loadObjectList($query);
        if ($rows === false) {
            $return_message = $this->ladb_error_text;
            return false;
        }
        $count = 0;
        foreach ($rows as $row) {
            $other_data = '';
            if (isset($row->list_choice) and $row->list_choice != '') {
                $other_data .= $list_prompt . ': ' . $row->list_choice . "\n";
            }
            if ($row->field1 != '') {
                $other_data .= $promptname1 . ': ' . $row->field1 . "\n";
            }
            if ($row->field2 != '') {
                $other_data .= $promptname2 . ': ' . $row->field2 . "\n";
            }
            if ($row->field3 != '') {
                $other_data .= $promptname3 . ': ' . $row->field3 . "\n";
            }
            if ($row->field4 != '') {
                $other_data .= $promptname4 . ': ' . $row->field4 . "\n";
            }
            if ($row->field5 != '') {
                $other_data .= $promptname5 . ': ' . $row->field5 . "\n";
            }
            $other_data .= $row->message;
            $query = 'INSERT INTO `#__flexicontact_plus_log` 
			(`datetime`, `name`, `email`, `admin_email`, `subject`, `message`, `status_main`, `status_copy`, 
				`ip`, `browser_id`, `browser_string`, `imported`) 
			VALUES (' . $this->_db->Quote($row->datetime) . ',' . $this->_db->Quote($row->name) . ',' . $this->_db->Quote($row->email) . ',' . '"",' . $this->_db->Quote($row->subject) . ',' . $this->_db->Quote($other_data) . ',' . $this->_db->Quote($row->status_main) . ',' . $this->_db->Quote($row->status_copy) . ',' . $this->_db->Quote($row->ip) . ',' . $this->_db->Quote($row->browser_id) . ',' . $this->_db->Quote($row->browser_string) . ',' . '1)';
            // set imported to 1
            FCP_trace::trace(" IMPORTING ROW: " . $row->id . " DATE: " . $row->datetime . " NAME: " . $row->name . " EMAIL: " . $row->email);
            $result = $this->ladb_execute($query);
            if ($result === false) {
                $return_message = $this->ladb_error_text;
                return false;
            }
            $count++;
        }
        FCP_trace::trace("Imported {$count} rows");
        $return_message = JText::sprintf('COM_FLEXICONTACT_IMPORTED_ROWS', $count);
        return true;
    }
コード例 #7
0
ファイル: view.html.php プロジェクト: vstorm83/propertease
    static function draw_page($config_data, $data)
    {
        // load our css
        FCP_Common::load_assets($config_data);
        // Are we going to show Captcha or not?
        $user = JFactory::getUser();
        if ($config_data->show_captcha == 0) {
            if ($user->guest) {
                $config_data->show_captcha = 1;
            } else {
                $config_data->show_captcha = 0;
            }
        }
        // display the input form
        $html = "\n" . '<div id="fcp_wrapper" class="fcp_wrapper">';
        $html .= "\n" . '<span id="fcp_err_top"></span>';
        // start the form - we don't care about the action url because we never submit the form
        $html .= "\n" . '<form name="fcp_form" id="fcp_form" class="fcp_form" action="#" method="post" >';
        $html .= "\n" . '<input type="hidden" name="config_id" id="config_id" value="' . $config_data->id . '" />';
        $html .= "\n" . JHTML::_('form.token');
        // display the user defined fields
        $div_open = false;
        $fieldset_open = false;
        foreach ($config_data->all_fields as $field_index => $field) {
            $field->id = sprintf('field%03d', $field_index);
            $field->div_id = sprintf('fcp_div%03d', $field_index);
            $field->error_id = sprintf('fcp_err%03d', $field_index);
            // if the line div is open and we are about to draw a field that is not a horizontal checkbox, close the div
            if ($div_open and $field->field_type != LAFC_FIELD_CHECKBOX_H) {
                $html .= "\n" . '</div>';
                $div_open = false;
            }
            // fixed texts will leave the line div open
            if ($field->field_type == LAFC_FIELD_FIXED_TEXT) {
                $div_open = true;
            }
            // is it a fieldset?
            if ($field->field_type == LAFC_FIELD_FIELDSET_START) {
                if ($fieldset_open) {
                    // if a fieldset was already open
                    $html .= "\n" . '</fieldset>';
                }
                // close it
                $fieldset_open = true;
            }
            if ($field->field_type == LAFC_FIELD_FIELDSET_END) {
                $fieldset_open = false;
            }
            $html .= self::draw_field($field, $data, $config_data);
        }
        if ($div_open) {
            $html .= "\n" . '</div>';
            $div_open = false;
        }
        // the "send me a copy" checkbox
        if ($config_data->show_copy == LAFC_COPYME_CHECKBOX) {
            $html .= "\n" . '<div class="fcp_line fcp_copy_me fcp_checkbox fcp_checkbox_l">';
            $html .= "\n" . '<input type="checkbox" class="fcp_lcb" name="show_copy" id="show_copy" value="1" />';
            $html .= "\n" . '<label for="show_copy" class="fcp_lcb">' . JText::_('COM_FLEXICONTACT_COPY_ME') . '</label>';
            $html .= "\n" . '</div>';
        }
        // the agreement required checkbox
        $send_button_state = '';
        if ($config_data->agreement_prompt != '') {
            $send_button_state = 'disabled="disabled"';
            $onclick = ' onclick="if(this.checked==true){form.fcp_send_button.disabled=false;}else{form.fcp_send_button.disabled=true;}"';
            $checkbox = '<input type="checkbox" class="fcp_lcb" name="agreement_check" id="agreement_check" value="1" ' . $onclick . '/>';
            if ($config_data->agreement_name != '' and $config_data->agreement_link != '') {
                $popup = 'onclick="window.open(' . "'" . $config_data->agreement_link . "', 'fcagreement', 'width=640,height=480,scrollbars=1,location=0,menubar=0,resizable=1'); return false;" . '"';
                $link_text = $config_data->agreement_prompt . ' ' . JHTML::link($config_data->agreement_link, $config_data->agreement_name, 'target="_blank" ' . $popup);
            } else {
                $link_text = $config_data->agreement_prompt;
            }
            $html .= "\n" . '<div class="fcp_line fcp_agreement fcp_checkbox fcp_checkbox_l">';
            $html .= "\n" . $checkbox;
            $html .= "\n" . '<label for="agreement_check" class="fcp_lcb">' . $link_text . '</label>';
            $html .= "\n" . '</div>';
        }
        // the magic word
        if ($config_data->show_captcha == 1 and $config_data->magic_word != '') {
            $html .= "\n" . '<div class="fcp_line fcp_magic">';
            $html .= "\n" . '<label><span class="fcp_mandatory">' . $config_data->magic_word_prompt . '</span></label>';
            $html .= "\n" . '<input type="text" name="fcp_magic" id="fcp_magic" value="" />';
            $html .= "\n" . '<span id="fcp_err_magic"></span>';
            $html .= "\n" . '</div>';
        }
        // the image captcha
        if ($config_data->show_captcha == 1 and $config_data->num_images > 0) {
            require_once LAFC_HELPER_PATH . '/flexi_captcha.php';
            $html .= "\n" . '<div class="fcp_line fcp_image_outer" id="fcp_image_outer" >';
            $html .= Flexi_captcha::show_image_captcha($config_data);
            $html .= "\n" . '</div>';
        }
        // the SecureImage captcha
        if ($config_data->show_captcha == 1 and $config_data->secure_captcha > 0) {
            require_once LAFC_HELPER_PATH . '/secure_captcha.php';
            $html .= Secure_captcha::show_secure_captcha($config_data);
        }
        // reCAPTCHA
        if ($config_data->show_captcha == 1 and $config_data->recaptcha_theme > 0) {
            switch ($config_data->recaptcha_theme) {
                case RECAPTCHA_RED:
                    $theme_name = 'red';
                    break;
                case RECAPTCHA_WHITE:
                    $theme_name = 'white';
                    break;
                case RECAPTCHA_BLACKGLASS:
                    $theme_name = 'blackglass';
                    break;
                case RECAPTCHA_CLEAN:
                    $theme_name = 'clean';
                    break;
            }
            $html .= '<script type="text/javascript">var RecaptchaOptions = {theme:' . "'" . $theme_name . "'" . '};</script>';
            require_once LAFC_HELPER_PATH . '/recaptchalib.php';
            $uri = JURI::getInstance();
            $ssl = strtolower($uri->getScheme()) == 'https';
            $html .= "\n" . '<div class="fcp_line fcp_recaptcha">';
            $html .= "\n" . '<label>&nbsp;</label>';
            $html .= "\n" . recaptcha_get_html($config_data->recaptcha_public_key, null, $ssl, $config_data->recaptcha_language);
            $html .= "\n" . '<span id="fcp_err_recap"></span>';
            $html .= "\n" . '</div>';
        }
        // the send button
        $js = "if (!window.jQuery) alert('" . JText::_('COM_FLEXICONTACT_JQUERY_NOT') . "');";
        if ($config_data->send_text == '') {
            $send_text = JText::_('COM_FLEXICONTACT_SEND_BUTTON');
        } else {
            $send_text = $config_data->send_text;
        }
        $html .= "\n" . '<div class="fcp_line fcp_sendrow">';
        $html .= "\n" . '<input type="submit" class="button" id="fcp_send_button" name="fcp_send_button" ' . $send_button_state . ' 
		value="' . $send_text . '" onclick="' . $js . '" />';
        $html .= "\n" . '<div id="fcp_spinner" style="display:inline-block"></div>';
        $html .= "\n" . '<div id="fcp_smsg" style="display:inline-block"></div>';
        $html .= "\n</div>";
        // fcp_sendrow
        // if a fieldset is left open at the end of the user defined fields, we close it here
        if ($fieldset_open) {
            $html .= "\n" . '</fieldset>';
            $fieldset_open = false;
        }
        $html .= "\n</form>";
        // form
        $html .= "\n" . '<div style="clear:both"></div>';
        $html .= "\n</div>";
        // fcp_wrapper
        if (FCP_trace::tracing()) {
            FCP_trace::trace("Generated Html:\n---------------\n" . $html);
        }
        return $html;
    }
コード例 #8
0
 static function get_css_list()
 {
     $files = glob(LAFC_SITE_ASSETS_PATH . '/*.css');
     if (empty($files)) {
         FCP_trace::trace("get_css_list(): No CSS files found");
         return false;
     }
     $css_files = array();
     foreach ($files as $file) {
         // Get the first line for the description
         $handle = fopen($file, 'r');
         $line = fgets($handle);
         fclose($handle);
         // Only keep the file name and drop the path
         $file = str_replace(LAFC_SITE_ASSETS_PATH . '/', '', $file);
         if (strpos($line, '/*') !== false) {
             $line = str_replace('/*', '', $line);
             $line = str_replace('*/', '', $line);
             $line = " [" . trim($line) . "]";
         } else {
             $line = '';
         }
         $css_files[$file] = str_replace(LAFC_SITE_ASSETS_PATH . '/', '', $file) . $line;
     }
     return $css_files;
 }
コード例 #9
0
 function trace_off()
 {
     FCP_trace::delete_trace_file();
     $this->setRedirect(LAFC_COMPONENT_LINK . '&controller=menu&task=help');
 }
コード例 #10
0
<?php

/********************************************************************
Product		: FlexicontactPlus
Date		: 24 July 2014
Copyright	: Les Arbres Design 2010-2014
Contact		: http://www.lesarbresdesign.info
Licence		: GNU General Public License
*********************************************************************/
defined('_JEXEC') or die('Restricted Access');
// Pull in the helper file
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/flexi_common_helper.php';
require_once JPATH_COMPONENT_ADMINISTRATOR . '/helpers/db_helper.php';
if (file_exists(JPATH_ROOT . '/demo_mode.txt')) {
    // used on our demo site
    define("LAFC_DEMO_MODE", "1");
}
require_once LAFC_HELPER_PATH . '/trace_helper.php';
FCP_trace::trace_entry_point(true);
if (FCP_trace::tracing()) {
    ini_set("display_errors", "1");
}
require_once JPATH_COMPONENT . '/controller.php';
$controller = new FlexicontactplusController();
$jinput = JFactory::getApplication()->input;
$task = $jinput->get('task', '', 'STRING');
$controller->execute($task);
$controller->redirect();
コード例 #11
0
ファイル: view.html.php プロジェクト: vstorm83/propertease
    function display($tpl = null)
    {
        FCP_Admin::make_title('COM_FLEXICONTACT_CONFIG_CSS_NAME');
        JToolBarHelper::apply('apply_css');
        JToolBarHelper::save('save_css');
        JToolBarHelper::cancel();
        $css_files = FCP_Admin::get_css_list();
        if ($css_files == false) {
            $app = JFactory::getApplication();
            $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_CSS', LAFC_SITE_ASSETS_PATH), 'error');
            return;
        }
        $fail = false;
        $path = LAFC_SITE_ASSETS_PATH . '/';
        $css_file_name = $this->config_data->config_data->css_file;
        // set the css name to be used by the view. Assume that the specified one is ok
        // Check the current CSS file
        if (!file_exists($path . $css_file_name)) {
            $app = JFactory::getApplication();
            $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_MISSING') . ' (' . $path . $css_file_name . ')', 'error');
            FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " missing");
            $fail = true;
        } else {
            if (!is_readable($path . $css_file_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_READABLE') . ' (' . $path . $css_file_name . ')', 'error');
                FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not readable");
                $fail = true;
            }
            if (!is_writable($path . $css_file_name)) {
                $app = JFactory::getApplication();
                $app->enqueueMessage(JText::_('COM_FLEXICONTACT_CSS_NOT_WRITEABLE') . ' (' . $path . $css_file_name . ')', 'error');
                FCP_trace::trace("Config_CSS View: " . $path . $css_file_name . " not writeable");
                $fail = true;
            }
        }
        // Do we have a problem with the selected CSS file? If so, try the default
        if ($fail) {
            if ($css_file_name !== LAFC_FRONT_CSS_NAME) {
                $fail = false;
                $css_file_name = LAFC_FRONT_CSS_NAME;
                FCP_trace::trace("-------------------->: Attempting to use default CSS file");
                if (!file_exists($path . $css_file_name)) {
                    FCP_trace::trace("-------------------->: " . $path . $css_file_name . " missing");
                    $fail = true;
                } else {
                    if (!is_readable($path . $css_file_name)) {
                        FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not readable");
                        $fail = true;
                    }
                    if (!is_writable($path . $css_file_name)) {
                        FCP_trace::trace("-------------------->: " . $path . $css_file_name . " not writeable");
                        $fail = true;
                    }
                }
            }
        }
        // If we still have a problem, find the first valid css file in the files list
        if ($fail) {
            foreach ($css_files as $key => $value) {
                $css_file_name = $key;
                $fail = false;
                if (!file_exists($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail and !is_readable($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail and !is_writable($path . $css_file_name)) {
                    $fail = true;
                }
                if (!$fail) {
                    // Found a functioning css file
                    break;
                }
            }
        }
        // Still got a problem?
        if ($fail) {
            $app = JFactory::getApplication();
            $app->redirect(LAFC_COMPONENT_LINK . '&task=display', JText::sprintf('COM_FLEXICONTACT_NO_VALID_CSS', LAFC_SITE_ASSETS_PATH), 'error');
            return;
        }
        $css_contents = @file_get_contents($path . $css_file_name);
        ?>
	<form action="index.php" method="post" name="adminForm" id="adminForm" >
	<input type="hidden" name="option" value="<?php 
        echo LAFC_COMPONENT;
        ?>
" />
	<input type="hidden" name="controller" value="menu" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="view" value="config_css" />
	
	<?php 
        echo '<table>';
        echo '<tr><td>' . FCP_Common::make_list('css_file_name', $css_file_name, $css_files, 0, 'onchange="submitform( );"') . '</td></tr>';
        echo '<tr><td class="css_file_path">' . JText::_('COM_FLEXICONTACT_CSS_FILE'), ': (' . $path . $css_file_name . ')';
        echo '<tr><td>';
        echo '<textarea name="css_contents" rows="25" cols="125" style="width:auto;">' . $css_contents . '</textarea>';
        echo '</td><td valign="top">';
        echo FCP_Admin::make_info('www.w3schools.com/css', 'http://www.w3schools.com/css/default.asp');
        echo '</td></tr></table>';
        ?>
	</form>
	<?php 
    }
コード例 #12
0
ファイル: email.php プロジェクト: vstorm83/propertease
 function sendEmail($config_data)
 {
     if (FCP_trace::tracing()) {
         FCP_trace::trace("=====> Send Email() - Config Data: " . print_r($config_data, true));
         FCP_trace::trace("=====> Send Email() - Email Model Data: " . print_r($this->data, true));
     }
     // build the message to be sent to the site admin
     $body = $this->email_merge($config_data->admin_template, $config_data);
     jimport('joomla.mail.helper');
     $clean_body = JMailHelper::cleanBody($body);
     $clean_subject = JMailHelper::cleanSubject($this->data->subject);
     // build the Joomla mail object
     $mail = JFactory::getMailer();
     if ($config_data->email_html) {
         $mail->IsHTML(true);
     } else {
         $clean_body = $this->html2text($clean_body);
     }
     if ($config_data->email_from == '') {
         // v7.01
         $email_from = $this->data->from_email;
     } else {
         $email_from = $config_data->email_from;
     }
     // use FlexiContact Global Configuration
     if ($config_data->email_from_name == '') {
         // v7.01
         $email_from_name = $this->data->from_name;
     } else {
         $email_from_name = $config_data->email_from_name;
     }
     // use FlexiContact Global Configuration
     // 8.00: don't try to send an email with a blank from name or address
     // this could happen if those fields are non-mandatory on the email form
     $app = JFactory::getApplication();
     if (empty($email_from)) {
         $email_from = $app->getCfg('mailfrom');
     }
     // use Joomla Global Configuration
     if (empty($email_from_name)) {
         $email_from_name = $app->getCfg('fromname');
     }
     // use Joomla Global Configuration
     $mail->setSender(array($email_from, $email_from_name));
     $mail->addRecipient($config_data->email_to);
     $this->data->admin_email = $config_data->email_to;
     // store it for the log model
     if (!empty($config_data->email_cc)) {
         $addresses = explode(',', $config_data->email_cc);
         foreach ($addresses as $address) {
             $mail->addCC($address);
         }
     }
     if (!empty($config_data->email_bcc)) {
         $addresses = explode(',', $config_data->email_bcc);
         foreach ($addresses as $address) {
             $mail->addBCC($address);
         }
     }
     if (!empty($this->data->from_email)) {
         $mail->addReplyTo(array($this->data->from_email, $this->data->from_name));
     }
     $mail->setSubject($clean_subject);
     $mail->setBody($clean_body);
     // add any file attachments
     foreach ($this->files as $attachment) {
         FCP_trace::trace("Attaching file {$attachment}");
         $mime_type = self::getMimeType($attachment);
         $mail->addAttachment($attachment, '', 'base64', $mime_type);
         $this->data->attached_file = 1;
         // store it for the log model
     }
     if (FCP_trace::tracing()) {
         FCP_trace::trace("=====> Sending admin email: " . print_r($mail, true));
     }
     if (defined('LAFC_DEMO_MODE')) {
         $ret_main = true;
     } else {
         FCP_trace::trace("****> Calling mail->Send()");
         $ret_main = $mail->Send();
         FCP_trace::trace("****> Back from mail->Send()");
     }
     if ($ret_main === true) {
         $this->data->status_main = '1';
         FCP_trace::trace("=====> Admin email sent ok");
     } else {
         $this->data->status_main = $mail->ErrorInfo;
         FCP_trace::trace("=====> Admin email send failed: " . $mail->ErrorInfo);
     }
     // if we should send the user a copy, send it separately
     // don't even attempt it if the from_email address is blank
     if (!empty($this->data->from_email) and ($config_data->show_copy == LAFC_COPYME_ALWAYS or $this->data->show_copy == 1)) {
         $body = $this->email_merge($config_data->user_template, $config_data);
         $clean_body = JMailHelper::cleanBody($body);
         $mail = JFactory::getMailer();
         if ($config_data->email_html) {
             $mail->IsHTML(true);
         } else {
             $clean_body = $this->html2text($clean_body);
         }
         if ($config_data->email_from == '') {
             // v7.01
             $email_from = $app->getCfg('mailfrom');
         } else {
             $email_from = $config_data->email_from;
         }
         // use FlexiContact Global Configuration
         if ($config_data->email_from_name == '') {
             // v7.01
             $email_from_name = $app->getCfg('fromname');
         } else {
             $email_from_name = $config_data->email_from_name;
         }
         // use FlexiContact Global Configuration
         $mail->setSender(array($email_from, $email_from_name));
         $mail->addRecipient($this->data->from_email);
         $mail->setSubject($clean_subject);
         $mail->setBody($clean_body);
         if (FCP_trace::tracing()) {
             FCP_trace::trace("=====> Sending user email: " . print_r($mail, true));
         }
         if (defined('LAFC_DEMO_MODE')) {
             $ret_copy = true;
         } else {
             $ret_copy = $mail->Send();
         }
         if ($ret_copy === true) {
             $this->data->status_copy = '1';
             FCP_trace::trace("=====> User email sent ok");
         } else {
             $this->data->status_copy = $mail->ErrorInfo;
             FCP_trace::trace("=====> User email send failed: " . $mail->ErrorInfo);
         }
     } else {
         $this->data->status_copy = '0';
     }
     // copy not requested or no email address provided
     FCP_trace::trace("=====> SendEmail function returning: " . $this->data->status_main);
     return $this->data->status_main;
     // both statuses are logged, but the main status decides what happens next
 }
コード例 #13
0
ファイル: log.php プロジェクト: vstorm83/propertease
 function export_csv()
 {
     FCP_trace::trace('export_csv()');
     // get the filter states and order states
     $filter_date = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_date', 'filter_date', LAFC_LOG_LAST_28_DAYS, 'int');
     $filter_config = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_config', 'filter_config', 'all', 'string');
     $filter_order = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_order', 'filter_order', 'datetime');
     $filter_order_Dir = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.filter_order_Dir', 'filter_order_Dir', 'desc');
     $search = $this->_app->getUserStateFromRequest(LAFC_COMPONENT . '.search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // build the query
     $query_count = "Select count(*) ";
     $query_cols = "Select *  ";
     $query_from = "From #__flexicontact_plus_log ";
     // where
     $query_where = "Where 1 ";
     if ($search != '') {
         $search = $this->_db->Quote('%' . $this->_db->escape($search, true) . '%', false);
         // Joomla 1.7 and aboves
         $query_where .= " and lower(name) Like {$search}\n\t\t\t\t\t\t\tor lower(email) Like {$search}\n\t\t\t\t\t\t\tor lower(subject) Like {$search}\n\t\t\t\t\t\t\tor lower(message) Like {$search} ";
     } else {
         if ($filter_config !== 'all') {
             $query_where .= " And config_name = '{$filter_config}' ";
         }
     }
     switch ($filter_date) {
         case LAFC_LOG_ALL:
             break;
         case LAFC_LOG_LAST_7_DAYS:
             $query_where .= "and datetime >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)";
             break;
         case LAFC_LOG_LAST_28_DAYS:
             $query_where .= "and datetime >= DATE_SUB(CURRENT_DATE(), INTERVAL 28 DAY)";
             break;
         case LAFC_LOG_LAST_12_MONTHS:
             $query_where .= "and datetime >= DATE_SUB(CURRENT_DATE(), INTERVAL 12 MONTH)";
     }
     // order by
     switch ($filter_order) {
         case 'name':
         case 'email':
         case 'subject':
             break;
         default:
             $filter_order = 'datetime';
     }
     if (strcasecmp($filter_order_Dir, 'ASC') != 0) {
         // validate 'asc' or 'desc'
         $filter_order_Dir = 'DESC';
     }
     $query_order = " Order by " . $filter_order . ' ' . $filter_order_Dir;
     // get the data, within the limits required
     $main_query = $query_cols . $query_from . $query_where . $query_order;
     $log_list = $this->ladb_loadObjectList($main_query);
     if ($log_list === false) {
         $this->_app->enqueueMessage($this->ladb_error_text, 'error');
         return false;
     }
     $count = count($log_list);
     $delim = "\t";
     // Headings
     $output = JText::_('COM_FLEXICONTACT_DATE_TIME') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_NAME') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_EMAIL') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_V_EMAIL_TO') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_CONFIG_NAME') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_LANGUAGE') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_SUBJECT') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_MESSAGE') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_STATUS') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_STATUS_COPY') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_IP_ADDRESS') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_BROWSER') . $delim;
     $output .= JText::_('COM_FLEXICONTACT_BROWSER_ID') . "\n";
     // Data
     for ($i = 0; $i < $count; $i++) {
         $row = $log_list[$i];
         $output .= '"' . $row->datetime . '"' . $delim;
         $output .= '"' . $row->name . '"' . $delim;
         $output .= '"' . $row->email . '"' . $delim;
         $output .= '"' . $row->admin_email . '"' . $delim;
         $output .= '"' . $row->config_name . '"' . $delim;
         $output .= '"' . $row->config_lang . '"' . $delim;
         $output .= '"' . $row->subject . '"' . $delim;
         $output .= '"' . $row->message . '"' . $delim;
         $output .= '"' . $row->status_main . '"' . $delim;
         $output .= '"' . $row->status_copy . '"' . $delim;
         $output .= '"' . $row->ip . '"' . $delim;
         $output .= '"' . $row->browser_string . '"' . $delim;
         $output .= '"' . $row->browser_id . '"' . "\r\n";
     }
     // All ready so now save it to the client
     $output_length = strlen($output);
     while (@ob_end_clean()) {
     }
     // clean all output buffers - on some servers it is very important to clean all of them!
     Header("Content-Description: File Transfer");
     Header("Content-Transfer-Encoding: binary\n");
     Header("Content-Type: text/plain; charset=utf-8");
     Header("Content-Disposition: attachment; filename=log.txt");
     header("Content-Length: " . strlen($output));
     header("Content-Range: bytes 0-" . $output_length . '/' . $output_length);
     Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     Header("Pragma: no-cache");
     Header("Expires: 0");
     @flush();
     echo $output;
     flush();
     exit;
 }
コード例 #14
0
 static function load_assets($config_data)
 {
     $template = JFactory::getApplication()->getTemplate();
     if (file_exists(JPATH_ROOT . '/templates/' . $template . '/' . LAFC_COMPONENT . '/assets/' . LAFC_FRONT_CSS_NAME)) {
         $css_path = 'templates/' . $template . '/' . LAFC_COMPONENT . '/assets/' . LAFC_FRONT_CSS_NAME;
     } else {
         $css_path = LAFC_SITE_ASSETS_URL . $config_data->css_file . '?102';
     }
     FCP_trace::trace("Loading css: {$css_path}");
     $document = JFactory::getDocument();
     $document->addStyleSheet($css_path);
     // load our Javascript
     // if there are any file attachment fields, add some reference data
     foreach ($config_data->all_fields as $field_index => $field) {
         if ($field->field_type == LAFC_FIELD_ATTACHMENT) {
             $noup = JText::_('COM_FLEXICONTACT_FILE_UPLOAD_NOT_SUPPORTED');
             $js_config_object = "fcp_config = {noup: '" . $noup . "'};";
             $document->addScriptDeclaration($js_config_object);
             break;
             // only do this once
         }
     }
     // for Joomla 2.5 we need to load jQuery explicitly
     if (version_compare(JVERSION, "3.0.0", "<")) {
         $document->addScript('//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js');
         $document->addScript('components/com_flexicontactplus/assets/jquery/jquery-noconflict.js');
         $document->addScript('components/com_flexicontactplus/assets/js/bootstrap.min.js');
     } else {
         JHtml::_('bootstrap.framework');
     }
     if (FCP_trace::tracing()) {
         $document->addScript(LAFC_SITE_ASSETS_URL . 'js/uncompressed-fcp_jquery.js?7');
     } else {
         $document->addScript(LAFC_SITE_ASSETS_URL . 'js/fcp_jquery.js?7');
     }
     $js = "\njQuery(document).ready(fcp_setup);\n";
     $document->addScriptDeclaration($js);
 }
コード例 #15
0
 static function show_image_raw($captcha_info)
 {
     $jinput = JFactory::getApplication()->input;
     $image_number = $jinput->get('n', 0, 'INT');
     $filename = $captcha_info->images[$image_number]['filename'];
     FCP_trace::trace("Serving image: " . $filename);
     $filepath = LAFC_SITE_IMAGES_PATH . '/' . $filename;
     // set the mime type
     switch ($captcha_info->images[$image_number]['type']) {
         case 1:
             $mimetype = 'image/gif';
             break;
         case 2:
             $mimetype = 'image/jpeg';
             break;
         case 3:
             $mimetype = 'image/png';
             break;
         default:
             return;
     }
     while (@ob_end_clean()) {
     }
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     header("Content-Type: {$mimetype}");
     echo readfile($filepath);
     echo self::random_data();
 }