示例#1
0
/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak($published, &$row, &$cparams, $page = 0, $params)
{
    global $database;
    // load mambot params info
    /*$query = "SELECT id FROM #__mambots WHERE element = 'mosemailcloak' AND folder = 'content'";
    	$database->setQuery( $query );
    	$id 	= $database->loadResult();
    	$mambot = new mosMambot( $database );
    	$mambot->load( $id );*/
    $mambots =& mosMambotHandler::getInstance();
    $mambot = $mambots->getBot('mosemailcloack', 'content');
    $params =& new mosParameters(isset($mambot->params) ? $mambot->params : '');
    $mode = $params->def('mode', 1);
    //$search 	= "([[:alnum:]_\.\-]+)(\@[[:alnum:]\.\-]+\.+)([[:alnum:]\.\-]+)";
    $search = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-\\?\\=\\%]+)";
    $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)";
    // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*>)" . $search . "</a>";
    if (is_callable(array($row, 'getText'))) {
        $localtext = $row->getText();
    } else {
        $localtext = $row->text;
    }
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5] . $regs[6] . $regs[7];
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a>
    // extra handling for inclusion of title and target attributes either side of href attribute
    $searchlink = "(<a [[:alnum:] _\"\\'=\\@\\.\\-]*href=[\"\\']mailto:" . $search . "[\"\\'][[:alnum:] _\"\\'=\\@\\.\\-]*)>" . $search_text . "</a>";
    while (eregi($searchlink, $localtext, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5];
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    // search for plain text email@amail.com
    while (eregi($search, $localtext, $regs)) {
        $mail = $regs[0];
        $replacement = mosHTML::emailCloaking($mail, $mode);
        // replace the found address with the js cloacked email
        $localtext = str_replace($regs[0], $replacement, $localtext);
    }
    if (is_callable(array($row, 'saveText'))) {
        $row->saveText($localtext);
    } else {
        $row->text = $localtext;
    }
}
示例#2
0
 function view()
 {
     $database = mamboDatabase::getInstance();
     $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();
     $count = count($list);
     if ($count == 0) {
         $params =& new mosParameters('');
         $params->def('back_button', mamboCore::get('mosConfig_back_button'));
         HTML_contact::nocontact($params);
         return;
     }
     if ($this->contact_id == 0) {
         $this->contact_id = $list[0]->id;
     }
     foreach ($list as $cont) {
         if ($cont->id == $this->contact_id) {
             $contact =& $cont;
             break;
         }
     }
     if (!isset($contact)) {
         echo T_('You are not authorized to view this resource.');
         return;
     }
     // 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();
     $mambot = new mosMambot($database);
     $mambot->load($id);
     $params2 =& $this->makeParams($mambot->params);
     if ($contact->email_to and $params->get('email')) {
         // email cloacking
         $contact->email = mosHTML::emailCloaking($contact->email_to, $params2->get('mode'));
     }
     // loads current template for the pop-up window
     $pop = mosGetParam($_REQUEST, 'pop', 0);
     if ($pop) {
         $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
     $this->groupMarking($params);
     // params from menu item
     $menuhandler = mosMenuHandler::getInstance();
     $menu =& $menuhandler->getMenuByID($this->Itemid);
     $menu_params =& new mosParameters($menu->params);
     $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);
 }
/**
* Mambot that Cloaks all emails in content from spambots via javascript
*/
function botMosEmailCloak($published, &$row, &$params, $page = 0)
{
    global $database, $_MAMBOTS;
    // check whether mambot has been unpublished
    if (!$published) {
        return true;
    }
    // simple performance check to determine whether bot should process further
    if (strpos($row->text, '@') === false) {
        return true;
    }
    // simple check to allow disabling of bot
    $regex = '{emailcloak=off}';
    if (strpos($row->text, $regex) !== false) {
        $row->text = str_replace($regex, '', $row->text);
        return true;
    }
    // check if param query has previously been processed
    if (!isset($_MAMBOTS->_content_mambot_params['mosemailcloak'])) {
        // load mambot params info
        $query = "SELECT params" . "\n FROM #__mambots" . "\n WHERE element = 'mosemailcloak'" . "\n AND folder = 'content'";
        $database->setQuery($query);
        $database->loadObject($mambot);
        // save query to class variable
        $_MAMBOTS->_content_mambot_params['mosemailcloak'] = $mambot;
    }
    // pull query data from class variable
    $mambot = $_MAMBOTS->_content_mambot_params['mosemailcloak'];
    $botParams = new mosParameters($mambot->params);
    $mode = $botParams->def('mode', 1);
    // any@email.address.com
    $search_email = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-]+)";
    // any@email.address.com?subject=anyText
    $search_email_msg = "([[:alnum:]_\\.\\-]+)(\\@[[:alnum:]\\.\\-]+\\.+)([[:alnum:]\\.\\-]+)([[:alnum:][:space:][:punct:]][^\"<>]+)";
    // anyText
    $search_text = "([[:alnum:][:space:][:punct:]][^<>]+)";
    // search for derivativs of link code <a href="mailto:email@amail.com">email@amail.com</a>
    $pattern = botMosEmailCloak_searchPattern($search_email, $search_email);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5] . $regs[6] . $regs[7];
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com">anytext</a>
    $pattern = botMosEmailCloak_searchPattern($search_email, $search_text);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4];
        $mail_text = $regs[5];
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com?subject=Text&body=Text">email@amail.com</a>
    $pattern = botMosEmailCloak_searchPattern($search_email_msg, $search_email);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4] . $regs[5];
        $mail_text = $regs[6] . $regs[7] . $regs[8];
        //needed for handling of Body parameter
        $mail = str_replace('&amp;', '&', $mail);
        // check to see if mail text is different from mail addy
        if ($mail_text) {
            $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text);
        } else {
            $replacement = mosHTML::emailCloaking($mail, $mode);
        }
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for derivativs of link code <a href="mailto:email@amail.com?subject=Text&body=Text">anytext</a>
    $pattern = botMosEmailCloak_searchPattern($search_email_msg, $search_text);
    while (eregi($pattern, $row->text, $regs)) {
        $mail = $regs[2] . $regs[3] . $regs[4] . $regs[5];
        $mail_text = $regs[6];
        //needed for handling of Body parameter
        $mail = str_replace('&amp;', '&', $mail);
        $replacement = mosHTML::emailCloaking($mail, $mode, $mail_text, 0);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
    // search for plain text email@amail.com
    while (eregi($search_email, $row->text, $regs)) {
        $mail = $regs[0];
        $replacement = mosHTML::emailCloaking($mail, $mode);
        // replace the found address with the js cloacked email
        $row->text = str_replace($regs[0], $replacement, $row->text);
    }
}
示例#4
0
    /**
     * Display Table of items
     */
    function showTable(&$params, &$rows, $catid, $tabclass)
    {
        global $mosConfig_live_site, $Itemid;
        ?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
		<?php 
        if ($params->get('headings')) {
            ?>
			<tr>
				<td height="20" class="sectiontableheader<?php 
            echo $params->get('pageclass_sfx');
            ?>
">
				<?php 
            echo T_('Name');
            ?>
				</td>
				<?php 
            if ($params->get('position')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Position');
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('email')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Email');
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('telephone')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Phone');
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('fax')) {
                ?>
					<td height="20" class="sectiontableheader<?php 
                echo $params->get('pageclass_sfx');
                ?>
">
					<?php 
                echo T_('Fax');
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%"></td>
			</tr>
			<?php 
        }
        $k = 0;
        foreach ($rows as $row) {
            $link = 'index.php?option=com_contact&amp;task=view&amp;contact_id=' . $row->id . '&amp;Itemid=' . $Itemid;
            ?>
			<tr>
				<td width="25%" height="20" class="<?php 
            echo $tabclass[$k];
            ?>
">
				<a href="<?php 
            echo sefRelToAbs($link);
            ?>
" class="category<?php 
            echo $params->get('pageclass_sfx');
            ?>
">
				<?php 
            echo $row->name;
            ?>
				</a>
				</td>
				<?php 
            if ($params->get('position')) {
                ?>
					<td width="25%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->con_position;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('email')) {
                if ($row->email_to) {
                    $row->email_to = mosHTML::emailCloaking($row->email_to, 1);
                }
                ?>
					<td width="20%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->email_to;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('telephone')) {
                ?>
					<td width="15%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->telephone;
                ?>
					</td>
					<?php 
            }
            ?>
				<?php 
            if ($params->get('fax')) {
                ?>
					<td width="15%" class="<?php 
                echo $tabclass[$k];
                ?>
">
					<?php 
                echo $row->fax;
                ?>
					</td>
					<?php 
            }
            ?>
				<td width="100%"></td>
			</tr>
			<?php 
            $k = 1 - $k;
        }
        ?>
		</table>
		<?php 
    }
示例#5
0
function contactpage($contact_id)
{
    global $mainframe, $database, $my, $Itemid;
    $query = "SELECT a.id AS value, CONCAT_WS( ' - ', a.name, a.con_position ) AS text, a.catid, cc.access AS cat_access" . "\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 <= " . (int) $my->gid . "\n ORDER BY a.default_con DESC, a.ordering ASC";
    $database->setQuery($query);
    $checks = $database->loadObjectList();
    $count = count($checks);
    if ($count) {
        if ($contact_id < 1) {
            $contact_id = $checks[0]->value;
        }
        $query = "SELECT a.*, cc.access AS cat_access" . "\n FROM #__contact_details AS a" . "\n LEFT JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.published = 1" . "\n AND a.id = " . (int) $contact_id . "\n AND a.access <= " . (int) $my->gid;
        $database->SetQuery($query);
        $contacts = $database->LoadObjectList();
        if (!$contacts) {
            echo _NOT_AUTH;
            return;
        }
        $contact = $contacts[0];
        /*
         * check whether category access level allows access
         */
        if ($contact->cat_access > $my->gid) {
            mosNotAuth();
            return;
        }
        $list = array();
        foreach ($checks as $check) {
            if ($check->catid == $contact->catid) {
                $list[] = $check;
            }
        }
        // creates dropdown select list
        $contact->select = mosHTML::selectList($list, 'contact_id', 'class="inputbox" onchange="ViewCrossReference(this);"', 'value', 'text', $contact_id);
        // Adds parameter handling
        $params = new mosParameters($contact->params);
        $params->set('page_title', 0);
        $params->def('pageclass_sfx', '');
        $params->def('back_button', $mainframe->getCfg('back_button'));
        $params->def('print', !$mainframe->getCfg('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', _EMAIL_DESCRIPTION);
        $params->def('email_form', 1);
        $params->def('email_copy', 0);
        // global pront|pdf|email
        $params->def('icons', $mainframe->getCfg('icons'));
        // contact only 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', 0);
        if ($contact->email_to && $params->get('email')) {
            // email cloacking
            $contact->email = mosHTML::emailCloaking($contact->email_to);
        }
        // loads current template for the pop-up window
        $pop = intval(mosGetParam($_REQUEST, 'pop', 0));
        if ($pop) {
            $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
        switch ($params->get('contact_icons')) {
            case 1:
                // text
                $params->set('marker_address', _CONTACT_ADDRESS);
                $params->set('marker_email', _CONTACT_EMAIL);
                $params->set('marker_telephone', _CONTACT_TELEPHONE);
                $params->set('marker_fax', _CONTACT_FAX);
                $params->set('marker_misc', _CONTACT_MISC);
                $params->set('column_width', '100');
                break;
            case 2:
                // none
                $params->set('marker_address', '');
                $params->set('marker_email', '');
                $params->set('marker_telephone', '');
                $params->set('marker_fax', '');
                $params->set('marker_misc', '');
                $params->set('column_width', '0');
                break;
            default:
                // icons
                $image1 = mosAdminMenus::ImageCheck('con_address.png', '/images/M_images/', $params->get('icon_address'), '/images/M_images/', _CONTACT_ADDRESS, _CONTACT_ADDRESS);
                $image2 = mosAdminMenus::ImageCheck('emailButton.png', '/images/M_images/', $params->get('icon_email'), '/images/M_images/', _CONTACT_EMAIL, _CONTACT_EMAIL);
                $image3 = mosAdminMenus::ImageCheck('con_tel.png', '/images/M_images/', $params->get('icon_telephone'), '/images/M_images/', _CONTACT_TELEPHONE, _CONTACT_TELEPHONE);
                $image4 = mosAdminMenus::ImageCheck('con_fax.png', '/images/M_images/', $params->get('icon_fax'), '/images/M_images/', _CONTACT_FAX, _CONTACT_FAX);
                $image5 = mosAdminMenus::ImageCheck('con_info.png', '/images/M_images/', $params->get('icon_misc'), '/images/M_images/', _CONTACT_MISC, _CONTACT_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', '40');
                break;
        }
        // params from menu item
        $menu = $mainframe->get('menu');
        $menu_params = new mosParameters($menu->params);
        $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);
    } else {
        $params = new mosParameters('');
        $params->def('back_button', $mainframe->getCfg('back_button'));
        HTML_contact::nocontact($params);
    }
}