Exemple #1
0
    function cloack_email($mail_address) {
        $cfg=BidsHelperTools::getConfig();

        if ($cfg->bid_opt_enable_antispam_bot) {
            if ($cfg->bid_opt_choose_antispam_bot == "recaptcha") {
                require(JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'recaptcha' . DS . 'recaptchalib.php');
                $mail = recaptcha_mailhide_url("01WxCXdKklKdG2JpOlMY15jw==", "2198178B23BFFB00CBAEA6370CE7A0B2", $mail_address);
                return "<a href=\"$mail.\" onclick=\"window.open('$mail', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0, menubar=0,resizable=0,width=500,height=300');	return false;\" title=\"Reveal this e-mail address\">" . JText::_("COM_BIDS_SHOW_EMAIL") . "</a>";
            } elseif ($cfg->bid_opt_choose_antispam_bot == "joomla") {

                // Discutable if use Content Mail Plugin or ... just JHTML_('email.cloac' it does the same .. just global configuration is in question
                $plugin = JPluginHelper::getPlugin('content', 'emailcloak');
                $pluginParams = new JParameter($plugin->params);
                require_once (JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'emailcloak.php');
                plgContentEmailCloak($mail_address, $pluginParams);
                return $mail_address;
            } elseif ($cfg->bid_opt_choose_antispam_bot == "smarty") {
                $smarty = new JTheFactorySmarty();
                require_once(SMARTY_DIR . "plugins/function.mailto.php");
                return BidsSmarty::smarty_rbids_print_encoded(array("address" => $mail_address, "encode" => "hex"), $smarty);
            }
        } else {
            return $mail_address;
        }
    }
    function showAd($row, $cat_name, $option, $currency, $font, $state_color, $detail_color, $find, $map)
    {
        //Cloak the email address
        global $mainframe;
        $plugin =& JPluginHelper::getPlugin('content', 'emailcloak');
        $pluginParams = new JParameter($plugin->params);
        require_once JPATH_SITE . DS . 'plugins' . DS . 'content' . DS . 'emailcloak.php';
        $row2 = new stdClass();
        $row2->text = $row->contact_email;
        plgContentEmailCloak($row2, $pluginParams);
        $row->contact_email = $row2->text;
        //End cloaking
        $postlink = 'index.php?option=' . $option . '&id=' . $row->id . '&task=viewad';
        $link = 'index.php?option=' . $option . '&cat_name=' . $cat_name . '&task=view';
        JHTML::stylesheet("aardvertiser.css", "components/com_aardvertiser/");
        ?>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="components/com_aardvertiser/js/fancybox/jquery.fancybox-1.3.0.pack.js"></script>
<link rel="stylesheet" href="components/com_aardvertiser/js/fancybox/jquery.fancybox-1.3.0.css" type="text/css" media="screen">
<SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function postit(){ //check postcode format is valid
        test = document.postcode.userpost.value; size = test.length
        test = test.toUpperCase(); //Change to uppercase
        while (test.slice(0,1) == " ") //Strip leading spaces
        {test = test.substr(1,size-1);size = test.length
        }
        while(test.slice(size-1,size)== " ") //Strip trailing spaces
        {test = test.substr(0,size-1);size = test.length
        }
        document.postcode.userpost.value = test; //write back to form field
        if (size < 6 || size > 8){ //Code length rule
            alert(test + " is not a valid postcode - wrong length");
            document.postcode.userpost.focus();
            return false;
        }
        if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
            alert(test + " is not a valid postcode - cannot start with a number");
            document.postcode.userpost.focus();
            return false;
        }
        if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
            alert(test + " is not a valid postcode - alpha character in wrong position");
            document.postcode.userpost.focus();
            return false;
        }
        if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
            alert(test + " is not a valid postcode - number in wrong position");
            document.postcode.userpost.focus();
            return false;
        }
        if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
            alert(test + " is not a valid postcode - number in wrong position");
            document.postcode.userpost.focus();
            return false;
        }
        if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
            alert(test + " is not a valid postcode - no space or space in wrong position");
            document.postcode.userpost.focus();
            return false;
        }
        count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
        if (count1 != count2){//only one space rule
            alert(test + " is not a valid postcode - only one space allowed");
            document.postcode.userpost.focus();
            return false;
        }
        return true;
    }
    //  End -->
</script>
<script language="javascript">
    $(document).ready(function() {


        /* JQUERY fancybox */

        $("a#image1").fancybox({
            'cyclic'		:	true,
            'overlayOpacity'		:	0.6,
            'overlayColor'		:	'#666',
            'transitionIn'	: 'elastic',
            'transitionOut'	: 'elastic',
            'titlePosition' : 'inside'

        });
        $("a#image2").fancybox({
            'cyclic'		:	true,
            'overlayOpacity'		:	0.6,
            'overlayColor'		:	'#666',
            'transitionIn'	: 'elastic',
            'transitionOut'	: 'elastic',
            'titlePosition' : 'inside'

        });

    });
</script>

<div class="gen-1">
    <div class="detailtab aard-ad-1">
        <div align="left" class="aard-ad-1-1">
            <div class="contentheading">
                <b><?php 
        echo $row->ad_name;
        ?>
</b> - <?php 
        echo $row->ad_state;
        ?>
            </div>
        </div>
        <div align="right" class="aard-ad-1-2">
            Category:  <a href="<?php 
        echo $link;
        ?>
" class="gen-2"><?php 
        echo $row->cat_name;
        ?>
</a>
        </div>
        <div class="gen-6"></div>
    </div>
    <div class="aard-ad-2">
        <div class="aard-ad-2-1">
                    <?php 
        echo $row->ad_desc;
        ?>
        </div>
        <div class="aard-ad-2-2">
            <div class="gen-6">
                <center>
                    <b><font color="<?php 
        echo $state_color;
        ?>
" size="5%"><?php 
        echo $row->ad_state;
        ?>
</font></b>
                </center>
            </div>
        </div>

        <div class="aard-ad-2-22">
            <div class="gen-66">
                <center>
                    <a id="image1" rel="gall" href="<?php 
        if ($row->ad_img1 == "") {
            echo "components/com_aardvertiser/images/noimage.png";
        } else {
            echo "components/com_aardvertiser/images/users/" . $row->user_id . "/" . $row->ad_img1;
        }
        ?>
">
                        <img alt="<?php 
        echo $row->ad_name;
        ?>
" src="<?php 
        if ($row->ad_img1small == "") {
            echo "components/com_aardvertiser/images/noimage.png";
        } else {
            echo "components/com_aardvertiser/images/users/" . $row->user_id . "/" . $row->ad_img1small;
        }
        ?>
" style="border:dashed 1px; height:100px; width:150px;" />
                    </a><a id="image2" rel="gall" href="<?php 
        if ($row->ad_img2 == "") {
            echo "components/com_aardvertiser/images/noimage.png";
        } else {
            echo "components/com_aardvertiser/images/users/" . $row->user_id . "/" . $row->ad_img2;
        }
        ?>
">
                        <img alt="<?php 
        echo $row->ad_name;
        ?>
" src="<?php 
        if ($row->ad_img2small == "") {
            echo "components/com_aardvertiser/images/noimage.png";
        } else {
            echo "components/com_aardvertiser/images/users/" . $row->user_id . "/" . $row->ad_img2small;
        }
        ?>
" style="border:dashed 1px; height:100px; width:150px;" />
                    </a>
                </center>
            </div>
        </div>

        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Item Location:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $row->ad_location;
        ?>
</font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Postcode:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $row->ad_post;
        ?>
</font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Delivery Options:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $row->ad_delivery;
        ?>
</font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Item Asking Price:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $currency . $row->ad_price;
        ?>
</font>
        </div>
        <div class="aard-ad-2-11">
            <div align="left"></div>
        </div>
        <div class="aard-ad-2-12"></div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Contact's Name:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $row->contact_name;
        ?>
</font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Contact Tel. No:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        ?>

                <style type="text/css">
                    #box11{
                        visibility:visible;
                    }
                    #box22 {
                        visibility:hidden;
                        margin-top:-20px;
                        text-decoration:none;
                    }
                </style>
                <script language="JavaScript">
                    function changeb(){
                        document.getElementById("box11").style.visibility = "hidden";
                        document.getElementById("box22").style.visibility = "visible";
                    }

                </script>
                <div id="box11" onMouseOver="changeb()" >
                    Hover to show
                </div>
                <div id="box22" >
                            <?php 
        echo $row->contact_tel;
        ?>
                </div></font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Contact Email:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2">
                <style type="text/css">
                    #box1{
                        visibility:visible;

                    }
                    #box2 {
                        visibility:hidden;
                        margin-top:-20px;
                        text-decoration:none;
                    }
                </style>
                <script language="JavaScript">
                    function change(){
                        document.getElementById("box1").style.visibility = "hidden";
                        document.getElementById("box2").style.visibility = "visible";
                    }


                </script>

                <div id="box1" onMouseOver="change()" >
                    Hover to show
                </div>
                <div id="box2" >

                            <?php 
        echo $row->contact_email;
        ?>
                </div>
            </font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">Date Submitted:</font></b>
            </div>
        </div>
        <div class="aard-ad-2-4">
            <font color="<?php 
        echo $detail_color;
        ?>
" class="gen-2"><?php 
        echo $row->date_created;
        ?>
</font>
        </div>
        <div class="aard-ad-2-3">
            <div align="left" class="gen-5">
                <b><font color="<?php 
        echo $font;
        ?>
">



                                <?php 
        $id = $row->id;
        $result = mysql_query("SELECT ad_post FROM jos_aard_ads WHERE id ='{$id}'");
        while ($ad = mysql_fetch_array($result)) {
            $adpost = $ad['ad_post'];
        }
        $adsub = substr($adpost, 0, 4);
        //echo '<b>Post Code:</b> ' . $adpost;
        if ($_POST) {
            $userpost = $_POST["userpost"];
            $usersub = substr($userpost, 0, 4);
        } else {
            $usersub = '';
        }
        //ad postcode
        $result = mysql_query("SELECT x, y FROM jos_aard_post WHERE postcode = '{$adsub}' LIMIT 1");
        $row = mysql_fetch_array($result);
        $gridx[0] = $row['x'];
        $gridy[0] = $row['y'];
        //user postcode
        $result = mysql_query("SELECT x, y FROM jos_aard_post WHERE postcode = '{$usersub}' LIMIT 1");
        $row = mysql_fetch_array($result);
        $gridx[1] = $row['x'];
        $gridy[1] = $row['y'];
        //Get Distances x y
        if ($gridx[1] > $gridx[0]) {
            $distancex = $gridx[1] - $gridx[0];
        } else {
            $distancex = $gridx[0] - $gridx[1];
        }
        if ($gridy[1] > $gridy[0]) {
            $distancey = $gridy[1] - $gridy[0];
        } else {
            $distancey = $gridy[0] - $gridy[1];
        }
        echo '';
        if ($usersub == '') {
        } else {
            $dist = sqrt($distancex * $distancex + $distancey * $distancey);
            $out = '<font color="' . $detail_color . '">' . $adpost . ' to ' . $userpost . ' is ' . round($dist / 1000, 1) . 'km approx. </font>';
        }
        if ($map == 1) {
            echo '<a target="_blank" href="components/com_aardvertiser/aardmapv2.php?adpost=' . $adpost . '">Get directions with Google Maps</a>
	
	
	
	      </font></b>
          </div>
        </div>
        <div class="aard-ad-2-4">
         &nbsp;
        </div>
        <div class="gen-4"></div>
      </div>
    </div>
	
	';
        }
        if ($find == 1) {
            ?>
<div align="left" ><b><font color="<?php 
            echo $font;
            ?>
">Distance Finder: </font></b>

                                        <?php 
            if ($_POST) {
                echo $out;
                //if ($map == 0) {
                //     } else {
                //	      echo '<a target="_blank" href="components/com_aardvertiser/aardmapv2.php?userpost='. $userpost . '&adpost=' . $adpost.'">(directions)</a></font>';
                //     }
            } else {
                echo '<form action="' . $postlink . '" method="POST" id="postcode" name="postcode" onsubmit="return postit()">
<font color="' . $detail_color . '"> Enter your Postcode: </font><input type="text" name="userpost" size="10" maxlength="10" />
<input type="submit" value="Submit" />
</form>';
            }
        } else {
            //do nothing
        }
        ?>
                        </div>
                        <br />
                        <div align="left" ><a href="<?php 
        echo $link;
        ?>
">&lt; return to category</a></div>
                        <br />

                                <?php 
        include 'footer.php';
    }