Source for file contact.php
Documentation is available at contact.php
* @copyright Refer to copyright.php
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Mambo Foundation Inc see README.php
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// load the html drawing class
require_once( $mainframe->getPath( 'front_html' ) );
require_once( $mainframe->getPath( 'class' ) );
global $mosConfig_usecaptcha;
if ($mosConfig_usecaptcha ==
'1') {
if(isset
($_SESSION['code']) &&
($_SESSION['code'] !=
"") &&
($_SESSION['code'] ==
$spamstop)) {
$captcha_success =
1; // success
$captcha_success =
2; // fail
if ($captcha_success !=
'2') {
$contact->load($this->con_id);
echo
"<script>alert (\"".
T_('Please make sure the form is complete and valid.').
"\"); window.history.go(-1);</script>";
$prefix =
sprintf( T_('This is an enquiry e-mail via %s from:'), mamboCore::get('mosConfig_live_site') );
$text =
$prefix .
"\n".
$name.
' <'.
$email .
'>' .
"\n\n".
$text;
mosMail( $email, $name , $contact->email_to, mamboCore::get('mosConfig_fromname') .
': '.
$subject, $text );
$copy_text =
sprintf( T_('The following is a copy of the message you sent to %s via %s '), $contact->name, mamboCore::get('mosConfig_sitename') );
$copy_text =
$copy_text .
"\n\n".
$text .
'';
$copy_subject =
sprintf(T_('Copy of: %s'),$subject);
alert( "
<?php echo
T_('Thank you for your e-mail ').
$name; ?>" );
document.location.href='
<?php echo
sefRelToAbs( 'index.php?option='.
$this->manager->option .
'&Itemid='.
$this->Itemid ); ?>';
echo
"<SCRIPT> alert('Incorrect Security Code'); window.history.go(-1);</SCRIPT>";
* Check field contains an email address:
* Returns false if text is not an email address
return preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+.[A-Z]{2,4}$/i", $email );
* Check single-line inputs:
* Returns true if text contains newline character
* Check multi-line inputs:
* Returns true if text contains newline followed by
* email-header specific string
return preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i", $text);
$count =
count($categories);
if ($count ==
0 OR ($count ==
1 AND $categories[0]->numlinks ==
1)) {
// No or one category that qualifies
$this->contact_id =
$count ==
1 ?
$categories[0]->minimum :
0;
$currentcat =
& new stdClass();
$menu =
& $menuhandler->getMenuByID($this->Itemid);
$params =
& $this->makeParams ($menu->params, $menu->name);
$currentcat->header =
$params->get( 'header' );
$path =
mamboCore::get('mosConfig_live_site').
'/images/stories/';
$currentcat->descrip =
'';
$params->set( 'type', 'category' );
// url links info for category
foreach ($categories as $category) {
if ($category->id ==
$this->catid) {
$currentcat =
& $category;
$currentcat->descrip =
$currentcat->description;
$currentcat->img =
$path .
$currentcat->image;
$currentcat->align =
$currentcat->image_position;
if ( @$currentcat->name <>
'' ) $currentcat->header .=
' - '.
$currentcat->name;
$params->set( 'type', 'section' );
if ( $params->get( 'description' ) ) $currentcat->descrip =
$params->get( 'description_text' );
if ( $params->get( 'image' ) <> -
1 ) {
$currentcat->img =
$path .
$params->get( 'image' );
$currentcat->align =
$params->get( 'image_align' );
// used to show table rows in alternating colours
$tabclass =
array( 'sectiontableentry1', 'sectiontableentry2' );
HTML_contact::displaylist( $categories, $rows, $this->catid, $currentcat, $params, $tabclass );
$params->def( 'page_title', 1 );
$params->def( 'header', $name );
$params->def( 'pageclass_sfx', '' );
$params->def( 'headings', 1 );
$params->def( 'back_button', mamboCore::get('mosConfig_back_button') );
$params->def( 'description_text', T_('The Contact list for this Website.') );
$params->def( 'image', -
1 );
$params->def( 'image_align', 'right' );
$params->def( 'other_cat_section', 1 );
// Category List Display control
$params->def( 'other_cat', 1 );
$params->def( 'cat_description', 1 );
$params->def( 'cat_items', 1 );
$params->def( 'headings', 1 );
$params->def( 'position', '1' );
$params->def( 'email', '0' );
$params->def( 'phone', '1' );
$params->def( 'fax', '1' );
$params->def( 'telephone', '1' );
$query =
"SELECT a.*, a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text"
.
"\n FROM #__contact_details AS a"
.
"\n LEFT JOIN #__categories AS cc ON cc.id = a.catid"
.
"\n WHERE a.published = '1'"
.
"\n AND cc.published = '1'"
.
"\n AND a.access <=".
$this->user->gid
.
"\n AND cc.access <=".
$this->user->gid
.
"\n ORDER BY a.default_con DESC, a.ordering ASC"
$database->setQuery( $query );
$list =
$database->loadObjectList();
$params->def( 'back_button', mamboCore::get( 'mosConfig_back_button' ) );
foreach ($list as $cont) {
echo
T_('You are not authorized to view this resource.');
// creates dropdown select list
$contact->select =
mosHTML::selectList( $list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $this->contact_id );
// Adds parameter handling
$params =
& $this->makeParams ( $contact->params );
// load mambot params info
$query =
"SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
$database->setQuery( $query );
$id =
$database->loadResult();
$params2 =
& $this->makeParams ( $mambot->params );
if ( $contact->email_to AND $params->get( 'email' )) {
// loads current template for the pop-up window
$params->set( 'popup', 1 );
$params->set( 'back_button', 0 );
if ( $params->get( 'email_description' ) ) $params->set( 'email_description', $params->get( 'email_description_text' ) );
else $params->set( 'email_description', '' );
// needed to control the display of the Address marker
$temp =
$params->get( 'street_address' )
.
$params->get( 'suburb' )
.
$params->get( 'state' )
.
$params->get( 'country' )
.
$params->get( 'postcode' )
$params->set( 'address_check', $temp );
// determines whether to use Text, Images or nothing to highlight the different info groups
$menu =
& $menuhandler->getMenuByID($this->Itemid);
$menu_params->def( 'page_title', 1 );
$menu_params->def( 'header', $menu->name );
$menu_params->def( 'pageclass_sfx', '' );
HTML_contact::viewcontact( $contact, $params, $count, $list, $menu_params );
$params->set( 'page_title', 0 );
$params->def( 'pageclass_sfx', '' );
$params->def( 'back_button', mamboCore::get( 'mosConfig_back_button' ) );
$params->def( 'print', !mamboCore::get( 'mosConfig_hidePrint' ) );
$params->def( 'name', '1' );
$params->def( 'email', '0' );
$params->def( 'street_address', '1' );
$params->def( 'suburb', '1' );
$params->def( 'state', '1' );
$params->def( 'country', '1' );
$params->def( 'postcode', '1' );
$params->def( 'telephone', '1' );
$params->def( 'fax', '1' );
$params->def( 'misc', '1' );
$params->def( 'image', '1' );
$params->def( 'email_description', '1' );
$params->def( 'email_description_text', T_('Send an Email to this Contact:') );
$params->def( 'email_form', '1' );
$params->def( 'email_copy', '1' );
// global pront|pdf|email
$params->def( 'icons', mamboCore::get( 'mosConfig_icons' ) );
$params->def( 'contact_icons', 0 );
$params->def( 'icon_address', '' );
$params->def( 'icon_email', '' );
$params->def( 'icon_telephone', '' );
$params->def( 'icon_fax', '' );
$params->def( 'icon_misc', '' );
$params->def( 'drop_down', '0' );
$params->def( 'vcard', '1' );
switch ( $params->get( 'contact_icons' ) ) {
$params->set( 'marker_address', T_('Address: ') );
$params->set( 'marker_email', T_('Email: ') );
$params->set( 'marker_telephone', T_('Telephone: ') );
$params->set( 'marker_fax', T_('Fax: ') );
$params->set( 'marker_misc', T_('Information: ') );
$params->set( 'column_width', '100px' );
$params->set( 'marker_address', '' );
$params->set( 'marker_email', '' );
$params->set( 'marker_telephone', '' );
$params->set( 'marker_fax', '' );
$params->set( 'marker_misc', '' );
$params->set( 'column_width', '0px' );
$image1 =
$mainframe->ImageCheck( 'con_address.png', '/images/M_images/', $params->get( 'icon_address' ) );
$image2 =
$mainframe->ImageCheck( 'emailButton.png', '/images/M_images/', $params->get( 'icon_email' ) );
$image3 =
$mainframe->ImageCheck( 'con_tel.png', '/images/M_images/', $params->get( 'icon_telephone' ) );
$image4 =
$mainframe->ImageCheck( 'con_fax.png', '/images/M_images/', $params->get( 'icon_fax' ) );
$image5 =
$mainframe->ImageCheck( 'con_info.png', '/images/M_images/', $params->get( 'icon_misc' ) );
$params->set( 'marker_address', $image1 );
$params->set( 'marker_email', $image2 );
$params->set( 'marker_telephone', $image3 );
$params->set( 'marker_fax', $image4 );
$params->set( 'marker_misc', $image5 );
$params->set( 'column_width', '40px' );
if (!$params->get('vcard')) {
echo
"<script>alert (\"".
T_('There are no vCards available for download.').
"\"); window.history.go(-1);</script>";
$name =
explode(' ', $contact->name);
if (isset
($name[$last])) {
$v->setPhoneNumber( $contact->telephone, 'PREF;WORK;VOICE' );
$v->setPhoneNumber( $contact->fax, 'WORK;FAX' );
$v->setName( $surname, $firstname, $middlename, '' );
$v->setAddress( '', '', $contact->address, $contact->suburb, $contact->state, $contact->postcode, $contact->country, 'WORK;POSTAL' );
$v->setEmail( $contact->email_to );
$v->setNote( $contact->misc );
$v->setURL( mamboCore::get('mosConfig_live_site'), 'WORK' );
$v->setTitle( $contact->con_position );
$v->setFilename( $filename );
$output =
$v->getVCard( mamboCore::get('mosConfig_sitename') );
$filename =
$v->getFileName();
header( 'Content-Disposition: attachment; filename='.
$filename );
header( 'Connection: close' );
header( 'Content-Type: text/x-vCard; name='.
$filename );
//mosRedirect('index.php');
$alternatives =
array ();
Documentation generated on Mon, 05 May 2008 16:18:13 +0400 by phpDocumentor 1.4.0