Your IP : 216.73.216.231


Current Path : /home/digilove/public_html/modules/mod_marketplacemenus/tmpl/
Upload File :
Current File : /home/digilove/public_html/modules/mod_marketplacemenus/tmpl/default.php

<?php
/**
 * Marketplace Menus module
 *
 * PHP version 7.0
 *
 * @category   Module
 * @package    Joomla
 * @author     WebKul software private limited <support@webkul.com>
 * @copyright  2010 WebKul software private limited
 * @license    http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @version    GIT:5.2
 * @filesource http://store.webkul.com
 * @link       Technical Support:  webkul.uvdesk.com
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.methods');

if (!class_exists('MarketplaceHelper')) {
    include JPATH_ADMINISTRATOR.DIRECTORY_SEPARATOR.
    'components'.DIRECTORY_SEPARATOR.'com_marketplace'.
    DIRECTORY_SEPARATOR.'helpers'.DIRECTORY_SEPARATOR.'marketplace.php';
}
if (MarketplaceHelper::isCurlInstalled()) {
    if (!class_exists('wk_Facebook')) {
        include dirname(__FILE__).'/../facebookv2/src/facebook.php';
    }
}
?>
<!-- Including Font awesome and sweetalert -->
<link
    rel="stylesheet"
    href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"
>
<link
    rel="stylesheet"
    type="text/css"
    href="//cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css"
>
<script
    type="text/javascript"
    src="//cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"
></script>
<style type="text/css">
    .wklogin-form i,
    .mp_menu i {
        font-size: 20px !important;
        padding: 10px;
    }
    
    .wk_mpmenu * {
        font-size: 15px!important;
    }
    
    .ajaximage {
        overflow: hidden;
        width: 100%;
        position: absolute;
        z-index: 999;
        display: none;
        background-color: #FFF;
        opacity: 0.5;
    }
    
    .ajaximage img {
        display: block;
        margin: 0 auto;
        margin-top: 100px;
    }
</style>

<?php
$document = JFactory::getDocument();
$conf = JFactory::getConfig();
$document = JFactory::getDocument();
$db = JFactory::getDBO();
$app = JFactory::getApplication();
$adminemail = $app->getCfg('mailfrom');
$jInput= $app->input;
$option = $jInput->get('option', '');
$layout = $jInput->get('layout', '');
$id = $jInput->get('id', '');
$view = $jInput->get('view', '');
$Itemid = $jInput->get('Itemid', '');
$seller_id = $jInput->get('seller_id', '');
$virtuemart_category_id = $jInput->get('virtuemart_category_id', '');
$virtuemart_product_id = $jInput->get('virtuemart_product_id', '');
$wk_log = $jInput->get('wk_log', 0);
if (isset($virtuemart_product_id)) {
    if (is_array($virtuemart_product_id)) {
        $virtuemart_product_id = $virtuemart_product_id[0];
    }
}

$inputCookie  = $jInput->cookie;
if (!$wk_log) {
    // If login with facebook
    $checkpoint = $inputCookie->get(
        'checkpoint',
        null,
        0,
        $app->get('cookie_path', '/'),
        $app->get('cookie_domain'),
        $app->isSSLConnection()
    );
}
// FB accesstoken form JS login hit Response
$key = $inputCookie->get(
    'accessToken',
    null,
    0,
    $app->get('cookie_path', '/'),
    $app->get('cookie_domain'),
    $app->isSSLConnection()
);
/***************    faceboook      ******************************************/
$refresh=0;
if (isset($checkpoint)) {
    if ($checkpoint && $appid && $secretkey ) {
        $facebook = new wk_Facebook(
            array(
                'appId'  => $appid,
                'secret' => $secretkey,
                'cookie' => false,
            )
        );
        // request user data from FB
        $req_perms = "user_likes,public_profile,publish_stream,".
            "offline_access,user_status,email,read_stream";
        
        $session = $facebook->getUser();
        // Login url if User is not logged in
        $loginUrl = $facebook->getLoginUrl(
            array(
                'graph'=> 1,
                'fbconnect' => 1,
                'req_perms' => $req_perms
            )
        );
        $user_info = null;

        if (!$session && $key==null) {
            // if data not found try again to login
            echo "<script type='text/javascript'>top.location.href = '".
            $loginUrl."';</script>";
            $app->close();
        } else {
            try {
                // set accesstoken that is received in js to php FB Object.
                $facebook->setAccessToken($key);
                // request email seprately
                $fbemail = $facebook->api('/me?fields=email&access_token='.$key);
                // get user other info
                $user_info = $facebook->api('/me');
            } catch (FacebookApiException $e){
                // if data not found try again to login
                echo "<script type='text/javascript'>top.location.href = '".
                $loginUrl."';</script>";
                $app->close();
            }
        }

        $wk_user_name = $user_info['name'];
        $wk_email = $fbemail["email"];
        $user_fb_data = array(
            "name" => $wk_user_name,
            "email" => $wk_email
        );
        
        $modMpMenuHelper =new ModMpMenuHelper();
        $modMpMenuHelper->checkAndStoreUser($user_fb_data);
        $refresh=1;
    }
}
/*********************faceboook************************/

$user = JFactory::getUser();
$userid = $user->id;
$config=new JConfig();
$adminemail = $config->mailfrom;

$return= base64_encode(JUri::current());
if (!$user->get('guest') == 1) {
    $query=$db->getQuery(true);
    $query->select($db->quoteName('is_seller'))
        ->from($db->quoteName('#__marketplace_sellerprofile'))
        ->where(
            $db->quoteName('seller_id')."=".
            $db->quote($db->escape($userid))
        );
    $db->setQuery($query);
    try {
        $result = $db->loadResult();
    } catch (Exception $e) {
        $app->enqueueMessage($e->getMessage(), 'error');
    }

    if ($result) { ?>
        <div class="mp_menu">
        <?php
        if ($show_myprofile == '1') {
        ?>
            <div>
            <?php
            $Itemids = MarketplaceHelper::getMpMenuItem("profile");
            ?>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=profile&Itemid=".
                                $Itemids->id,
                                false
                            );
                ?>">
                    <span><i class="fa fa-user"></i></span><span><?php
                        echo $Itemids->title;
                    ?>
                </a>
            </div>
        <?php
        }

        if ($show_addproduct == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("addproduct");
            ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=addproduct&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-plus-square"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_products == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("products");
            ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=products&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-gift"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_dashboard == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("dashboard");
        ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=dashboard&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-dashboard"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_orderhistory == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("orderhistory");
        ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=orderhistory&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-history"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_sellerlist == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("sellerlist");
        ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=sellerlist&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-user-plus"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_payments == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("mypayments");
        ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=mypayments&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-money"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_profilepreview == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("sellerprofile");
        ?>
            <div>
                <a href="<?php
                            echo JRoute::_(
                                "index.php?option=com_marketplace&".
                                "view=sellerprofile&Itemid=".
                                $Itemids->id,
                                false
                            )
                        ?>"><span><i class="fa fa-eye"></i></span><span><?php
                            echo $Itemids->title;
                        ?>
                    </span>
                </a>
            </div>
        <?php
        }
        if ($show_asktoadmin == '1') {
            $Itemids = MarketplaceHelper::getMpMenuItem("asktoadmin");
        ?>
            <div>
                 <a class="mpmenu-ask" href="<?php
                    if ($view!="asktoadmin") {
                        $data_link =  JRoute::_(
                            "index.php?option=com_marketplace&".
                            "view=asktoadmin&Itemid=".
                            $Itemids->id,
                            false
                        );
                    } else {
                        $data_link ="javascript:void(0);";
                        $document->addScriptDeclaration(
                            'jQuery(document).ready(function(){
                                jQuery(".mpmenu-ask").click(function(){
                                    jQuery(".ask_button").trigger("click");
                                });
                            });'
                        );
                    }
                    echo $data_link;
                ?>"><span><i class="fa fa-question-circle"></i></span><span><?php
                echo JText::_('ASKTOADMIN');
                ?></span>
                </a>
            </div>
        <?php
        }
        /*Trigger to add tab and its data*/
        JPluginHelper::importPlugin('system');
        $dispatcher =JDispatcher::getInstance();
        $addonData=$dispatcher->trigger('onMarketplaceMenuRender');
        /*Trigger to add tab and its data*/
        if (count($addonData)) {
            foreach ($addonData as $addonData) {
                    echo "<div>".$addonData."</div>";
            }
        }
        ?>
    </div>
    <br><a class="logout-button btn btn-primary"
        href="<?php
                echo JRoute::_(
                    "index.php?option=com_marketplace&view=dashboard".
                    "&task=logout&wk_log=1 ",
                    false
                );
        ?>"><?php echo JText::_("LOGOUT") ?></a>
        <?php
    } else {
        if ($showBecomeASeller==1) {
            $Itemids = MarketplaceHelper::getMpMenuItem("mpregistration");
        }
        
        ?>
        <div style="margin:0 auto;">
        <?php
        echo JText::_('HI_TXT').JFactory::getUser()->name;
        ?>
        <br>
        <a class="logout-button btn btn-primary" href="<?php echo JRoute::_("index.php?option=com_marketplace&view=dashboard&task=logout&wk_log=1 ", false);?>">Logout</a>
        <?php
        $userParams = JComponentHelper::getParams('com_users');
        $checkseller = MarketplaceHelper::checkSeller($userid);
        ?>
        <ul style="margin-top: 10px">
            <?php
            if ($showBecomeASeller==1
                && $userParams->get("allowUserRegistration", 0)
                && $checkseller==null
                && !in_array(8, $user->groups)
            ) {
            ?>
            <li>
                <a href="<?php
                            echo JRoute::_(
                                'index.php?option=com_marketplace&view=mpregistration&Itemid='
                                .$Itemids->id,
                                false
                            ) ?>">
                    <?php echo JText::_('COM_MARKETPLACE_WANT_TO_BECOME_A_SELLER');?>
                </a>
            </li>
            <?php
            }
            if ($show_customer) {
                $Itemids2 = MarketplaceHelper::getMpMenuItem("customer");
            ?>
            <li>
                <a href="<?php
                            echo JRoute::_(
                                'index.php?option=com_marketplace&view=customer&Itemid='
                                .$Itemids2->id,
                                false
                            ) ?>">
                    <?php echo JText::_('COM_MARKETPLACE_BUYER_VIEW');?>
                </a>
            </li>
            <?php
            }
            ?>
        </ul>
    </div>
    <?php
    }
} else {
    ?>
    <form action="<?php echo JRoute::_(htmlspecialchars(JUri::getInstance()->toString()), false, $params->get('usesecure')); ?>" method="post" id="login-form" class="wklogin-form">
    <?php if ($params->get('pretext')) : ?>
        <div class="pretext">
            <p>
                <?php echo $params->get('pretext'); ?>
            </p>
        </div>
    <?php endif; ?>
        <fieldset class="userdata">
            <p id="form-login-username">
                <div class="input-prepend">
                    <label for="modlgn-username">
                        <?php echo JText::_('USERNAM') ?>
                    </label>
                    <span class="add-on">
                        <i
                            class="fa fa-user"
                            style="width:5px;margin-right:9px;padding:1px;"></i>
                    </span>
                    <input id="modlgn-username" type="text" name="username" placeholder="<?php
                        echo JText::_('SELL_LOGIN');
                    ?>" class="input-small"
                    tabindex="0"
                    size="18"/>
                </div>
            </p>
            <p id="form-login-password">
                <div class="input-prepend">
                    <label for="modlgn-passwd">
                        <?php echo JText::_('MPPASSWORD') ?>
                    </label>
                    <span class="add-on"><i class="fa fa-unlock-alt" style="width:5px;margin-right:9px;padding:1px;" ></i></span>
                    <input id="modlgn-passwd" type="password" name="password" placeholder="<?php echo JText::_('SELL_PASD'); ?>" class="input-small" size="18" />
                </div>
            </p>
            <?php if (JPluginHelper::isEnabled('system', 'remember')) :
            ?>
            <p id="form-login-remember">
                <input id="modlgn-remember" type="checkbox" name="remember" class="inputbox" value="yes" />
                <label for="modlgn-remember" style="display:inline">
                    <?php echo JText::_('MPREMEMBER') ?>
                </label>
            </p>
            <?php endif; ?>
                <div style="width:100%;">
                    <div style="width:80px;height:26px;display:inline-block;right:4px;margin-bottom:10px;">
                        <input style="width:100% !important;" type="submit" name="Submit" class="btn btn-primary" value="<?php echo JText::_('MPLOG_IN') ?>" />
                    </div>
            <?php
            if ($fb_setting->get('wk_fbloginselect')) {
            ?>
            <div class="wkfblogin" style="width:80px;display:inline-block;margin-left:10px" onclick="loggedin();"><img border="0" src="<?php echo JURI::root().'/modules/mod_marketplacemenus/login_facebook.png'; ?>" width="100%" style="cursor:pointer; height:28px!important;" /></div>
            <?php
            }
            ?>
            </div>
            <input type="hidden" name="option" value="com_users" />
            <input type="hidden" name="task" value="user.login" />
            <input type="hidden" name="return" value="<?php echo $return; ?>" />
            <?php echo JHtml::_('form.token'); ?>
        </fieldset>
        <ul>
        <?php
        if ($showBecomeASeller==1) {
            $Itemids = MarketplaceHelper::getMpMenuItem("mpregistration");
        ?>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_marketplace&view=mpregistration&Itemid='.$Itemids->id, false)?>">
                    <?php echo JText::_('COM_MARKETPLACE_WANT_TO_BECOME_A_SELLER'); ?>
                </a>
            </li>
        <?php
        }
        ?>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_users&view=reset', false); ?>">
                    <?php echo JText::_('MPFORGET_PASSWORD'); ?>
                </a>
            </li>
            <li>
                <a href="<?php echo JRoute::_('index.php?option=com_users&view=remind', false); ?>">
                    <?php echo JText::_('MPFORGET_USERNAME'); ?>
                </a>
            </li>
        </ul>
    </form>
<?php }
?>
<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
jQuery(document).on('ready', function(e) {

    if (window.location.hash == '#_=_') {
        window.location.hash = '';
        history.pushState('', document.title, window.location.pathname);
        e.preventDefault();
    }
    jQuery('<div class="ajaximage"><img src="<?php echo JURI::root()."components/com_marketplace/"?>images/ajaxspinner1.gif"/></div>').prependTo('body');
    var high = jQuery(document).height();
    jQuery('.ajaximage').css('height', high + "px");

});
<?php if ($fb_setting->get('wk_fbloginselect')) { ?>
window.fbAsyncInit = function() {

    FB.init({
        appId: "<?php echo $appid; ?>",
        channelUrl: "<?php juri::current();?>",
        status: true,
        xfbml: true
    });
}(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {
        return;
    }
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
jQuery('.logout-button').on('click', function() {
    FB.logout(function(response) {});
});

    <?php
}
if (!strlen(trim($secretkey)) || !strlen(trim($appid))) {
    $return='false';
}
?>
function loggedin() {
    if ("<?php echo $return?>" == 'false') {
        return false;
    }
    FB.login(function(resp) {
        var url = "<?php echo JRoute::_(JURI::current(), false);?>";
        if (resp.status === 'connected') {
            createCookie("checkpoint", "1", 0);
            createCookie("accessToken", resp.authResponse.accessToken, 0);
            window.location.href = url;
        }
    }, {
        scope: 'email',
        return_scopes: false

    });
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(";");
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == " ") c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function createCookie(name, value, e) {
    var expires = "; expires=" + e;
    var path = "",
        sef = '<?php $conf->get("sef"); ?>';
    if (sef == 0)
        document.cookie = name + "=" + value + expires + ";";
    else
        document.cookie = name + "=" + value + expires + ";path=/;";
}
</script>
<?php

?>

<script type="text/javascript">
function fbLoad(){
    createCookie("checkpoint", null, "Thu, 01 Jan 1970 00:00:01 GMT");
    createCookie("accessToken", null, "Thu, 01 Jan 1970 00:00:01 GMT");
    location.reload();
}
if (<?php echo $refresh ?>) {
    fbLoad();
}
jQuery(document).ready(function() {
    jQuery('#askbtn').on('click', function(e) {
        if (jQuery('.ask_sub').val().trim() == '') {
            jQuery('.ask_sub').css('border', '1px solid red');
        } else if (jQuery('.ask_msg').val().trim() == '') {
            jQuery('.ask_msg').css('border', '1px solid red');
        } else {
            jQuery('.ask_sub').css('border', '1px solid green');
            jQuery('.ask_msg').css('border', '1px solid green');
            jQuery('#ask-data').addClass('mail-procss');
            var subject = jQuery('.ask_sub').val();
            var message = jQuery('.ask_msg').val();
            if ("<?php echo $view;?>" != 'asktoadmin') {
                jQuery.ajax({
                    url: '<?php
                        echo JRoute::_(
                            "index.php?option=com_marketplace&view=asktoadmin&task=ask_to_admin",
                            false
                        ) ?> ',
                    beforeSend: function() {
                        jQuery('body').css({
                            'overflow': 'hidden'
                        });
                        jQuery(document).scrollTop(0);
                        jQuery('.ajaximage').show();
                    },
                    complete: function() {
                        jQuery('.ajaximage').hide();
                    },
                    data: {
                        subject: subject,
                        message: message
                    },
                    type: 'post',
                    dataType: 'html',
                    success: function(d) {
                        jQuery('#ask-data').removeClass('mail-procss');
                        if (d == '1') {
                            jQuery('.field').css("display", "none");
                            jQuery('.head_bar').css('display', 'none');
                            jQuery('#resetbtn').trigger('click');
                            jQuery('#light').css('display', 'none');
                            jQuery('#fade').css('display', 'none');
                            jQuery('.field').css("display", "block");
                            jQuery('.head_bar').css('display', 'block');
                            jQuery('#resetbtn').trigger('click');
                            swal({
                                title: "<?php echo JText::_('Success');?>",
                                text: '<?php echo JText::_('MAIL_SEND'); ?>',
                                timer: 5000,
                                type: "success",
                                showConfirmButton: false
                            });
                            jQuery('body').css({
                                'overflow': 'auto'
                            });
                        } else {
                            jQuery('.field').css("display", "none");
                            jQuery('.head_bar').css('display', 'none');
                            jQuery('#resetbtn').trigger('click');
                            jQuery('#light').css('display', 'none');
                            jQuery('#fade').css('display', 'none');
                            jQuery('.field').css("display", "block");
                            jQuery('.head_bar').css('display', 'block');
                            jQuery('#resetbtn').trigger('click');
                            swal({
                                title: "<?php echo JText::_('Failed');?>",
                                text: d,
                                timer: 5000,
                                type: "error",
                                showConfirmButton: false
                            });
                            jQuery('body').css({
                                'overflow': 'auto'
                            });
                        }
                    }
                });
            }
        }
        jQuery('#resetbtn').on('click', function() {
            jQuery('.wtd').css("border-color", "#ccc");
        });
    }); 
    jQuery('.cls').on('click', function() {
        jQuery('#light').css('display', 'none');
        jQuery('#fade').css('display', 'none');
    });
});
</script>