Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
diplom (2).docx
Скачиваний:
28
Добавлен:
15.07.2019
Размер:
1.99 Mб
Скачать

Листинг программного кода

Шаблон idex.php

<?php

defined( '_JEXEC' ) or die( 'Restricted access' );

JPlugin::loadLanguage( 'tpl_SG1' );

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >

<head>

<jdoc:include type="head" />

<link rel="stylesheet" href="templates/system/css/system.css" type="text/css" />

<link rel="stylesheet" href="templates/<?php echo $this->template ?>/css/template.css" type="text/css" />

<!--[if lte IE 7]>

<link rel="stylesheet" href="templates/<?php echo $this->template ?>/css/ie6.css" type="text/css" />

<![endif]-->

</head>

<body class="body_bg">

<div class="left_bg">

<div class="right_bg">

<div id="header">

<!-- news_flash start-->

<div class="nf_height">

<table cellpadding="0" cellspacing="0" id="nflash_table">

<tr>

<td>

<div id="news_flash">

<jdoc:include type="modules" style="rounded" name="top" />

</div>

</td>

</tr>

</table>

</div>

<div class="clr"></div>

<!-- news_flash end-->

<table cellspacing="0" cellpadding="0" id="logo">

<tr>

<td>

<a href="index.php"><?php echo $mainframe->getCfg('sitename') ;?></a>

</td>

</tr>

</table>

<div id="top_menu">

<table cellspacing="0" cellpadding="0" style="margin:0 auto">

<tr>

<td>

<jdoc:include type="modules" name="user3" />

</td>

</tr>

</table>

</div>

<div class="clr"></div>

</div>

<div id="content">

<div class="c_l_bg">

<div class="c_r_bg">

<div class="c_top">

<div class="c_b_bg">

<div class="width">

<?php if($this->countModules('left') and JRequest::getCmd('layout') != 'form') : ?>

<div id="leftcolumn">

<jdoc:include type="modules" name="left" style="rounded" />

<?php $sg = 'banner'; include "templates.php"; ?>

</div>

<?php endif; ?>

<?php if($this->countModules('right') and JRequest::getCmd('layout') != 'form') : ?>

<div id="main">

<?php else: ?>

<div id="main_full">

<?php endif; ?>

<div class="nopad">

<jdoc:include type="message" />

<?php if($this->params->get('showComponent')) : ?>

<jdoc:include type="component" />

<?php endif; ?>

</div>

</div>

<?php if($this->countModules('right') and JRequest::getCmd('layout') != 'form') : ?>

<div id="rightcolumn">

<jdoc:include type="modules" name="right" style="rounded" />

</div>

<?php endif; ?>

<div class="clr"></div>

<jdoc:include type="modules" name="debug" />

</div>

</div>

</div>

</div>

</div>

</div>

</div>

<div id="footer">

<p class="copyright"><? $sg = ''; include "templates.php"; ?></p>

</div>

</div>

<jdoc:include type="modules" name="debug" />

</body>

</html>

Файл модуля mod_virtuemart.php

<?php

if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );

/* Основной код */

if( !isset( $mosConfig_absolute_path ) ) {

$mosConfig_absolute_path = $GLOBALS['mosConfig_absolute_path'] = JPATH_SITE;

}

global $mosConfig_absolute_path, $page;

require_once( $mosConfig_absolute_path.'/components/com_virtuemart/virtuemart_parser.php' );

require_once(CLASSPATH.'ps_product_category.php');

$ps_product_category = new ps_product_category();

global $my, $root_label, $mosConfig_allowUserRegistration, $jscook_type, $jscookMenu_style, $jscookTree_style, $VM_LANG, $sess, $mm_action_url;

$category_id = vmRequest::getInt( 'category_id' );

$mod_dir = dirname( __FILE__ );

/* Получение параметров модуля */

$show_login_form = $params->get( 'show_login_form', 'no' );

$show_categories = $params->get( 'show_categories', 'yes' );

$show_listall = $params->get( 'show_listall', 'yes' );

$show_adminlink = $params->get('show_adminlink', 'yes' );

$show_accountlink = $params->get('show_accountlink', 'yes' );

$useGreyBox_accountlink = $params->get('useGreyBox_accountlink', '0' );

$show_minicart = $params->get( 'show_minicart', 'yes' );

$useGreyBox_cartlink = $params->get( 'useGreyBox_cartlink', '0' );

$show_productsearch = $params->get( 'show_productsearch', 'yes' );

$show_product_parameter_search = $params->get( 'show_product_parameter_search', 'no' );

$menutype = $params->get( 'menutype', "links" );

$class_sfx = $params->get( 'class_sfx', '' );

$pretext = $params->get( 'pretext', '' );

$jscookMenu_style = $params->get( 'jscookMenu_style', 'ThemeOffice' );

$jscookTree_style = $params->get( 'jscookTree_style', 'ThemeXP' );

$jscook_type = $params->get( 'jscook_type', 'menu' );

$menu_orientation = $params->get( 'menu_orientation', 'hbr' );

$_REQUEST['root_label'] = $params->get( 'root_label', 'Shop' );

$class_mainlevel = "mainlevel".$class_sfx;

$db = new ps_DB();

// Это "Категории:" по умолчанию. Изменение его в параметры модуля формы

echo $pretext;

// Обновление корзины

$cart = $_SESSION["cart"];

$auth = $_SESSION["auth"];

if( $show_categories == "yes" ) {

if ( $menutype == 'links' ) {

/* MENUTPYE LINK LIST */

echo $ps_product_category->get_category_tree( $category_id, $class_mainlevel );

}

elseif( $menutype == "transmenu" ) {

/* transmenu скрипт для отображения выпадающего меню */

include_once( $mod_dir.'/vm_transmenu.php' );

}

elseif( $menutype == "dtree" ) {

/* dtree скрипт для отображения структурированных категорий */

include_once( $mod_dir.'/vm_dtree.php' );

}

elseif( $menutype == "jscook" ) {

/* JSCook скрипт для отображения структурированных категорий */

include_once( $mod_dir.'/vm_JSCook.php' );

}

elseif( $menutype == "tigratree" ) {

/* TigraTree скрипт для отображения структурированных категорий */

include_once( $mod_dir . '/vm_tigratree.php' );

}

}

?>

<table cellpadding="1" cellspacing="1" border="0" width="100%">

<?php

// ссылка на список всей продукции

if ( $show_listall == 'yes' ) { ?>

<tr>

<td colspan="2"><br />

<a href="<?php $sess->purl($mm_action_url."index.php?page=shop.browse&category=") ?>">

<?php echo $VM_LANG->_('PHPSHOP_LIST_ALL_PRODUCTS') ?>

</a>

</td>

</tr>

<?php

}

// Поле поиск продукта

if ( $show_productsearch == 'yes' ) { ?>

<!--BEGIN Search Box -->

<tr>

<td colspan="2">

<hr />

<label for="shop_search_field"><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_SEARCH_LBL') ?></label>

<form action="<?php echo $mm_action_url."index.php" ?>" method="get">

<input id="shop_search_field" title="<?php echo $VM_LANG->_('PHPSHOP_SEARCH_TITLE') ?>" class="inputbox" type="text" size="12" name="keyword" />

<input class="button" type="submit" name="Search" value="<?php echo $VM_LANG->_('PHPSHOP_SEARCH_TITLE') ?>" />

<input type="hidden" name="Itemid" value="<?php echo intval(@$_REQUEST['Itemid']) ?>" />

<input type="hidden" name="option" value="com_virtuemart" />

<input type="hidden" name="page" value="shop.browse" />

</form>

<br />

<a href="<?php echo $sess->url($mm_action_url."index.php?option=com_virtuemart&page=shop.search") ?>">

<?php echo $VM_LANG->_('PHPSHOP_ADVANCED_SEARCH') ?>

</a><?php /** Changed Product Type - Begin */

if ( $show_product_parameter_search == 'yes' ) { ?>

<br />

<a href="<?php echo $sess->url($mm_action_url."index.php?option=com_virtuemart&page=shop.parameter_search") ?>" title="<?php echo $VM_LANG->_('PHPSHOP_PARAMETER_SEARCH') ?>">

<?php echo $VM_LANG->_('PHPSHOP_PARAMETER_SEARCH') ?>

</a>

<?php } /** изменен тип продукта */ ?>

<hr />

</td>

</tr>

<!-- End Search Box -->

<?php

}

$perm = new ps_perm;

// Отображение ссылки отдела администрации

if ($perm->check("admin,storeadmin")

&& ((!stristr($my->usertype, "admin") ^ PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS == '' )

|| stristr($my->usertype, "admin")

)

&& $show_adminlink == 'yes'

) { ?>

<tr>

<td colspan="2">

<a class="<?php echo $class_mainlevel ?>" href="<?php $sess->purl(SECUREURL . "index2.php?page=store.index&pshop_mode=admin") ?>">

<?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD'); ?>

</a>

</td>

</tr>

<?php

}

// Отображение ссылки счета

if ($perm->is_registered_customer($auth["user_id"]) && $show_accountlink == 'yes') {

?>

<tr>

<td colspan="2">

<?php

$class_att = 'class="'. $class_mainlevel .'"';

$href = $sess->url(SECUREURL."index.php?page=account.index", true);

$href2 = $sess->url(SECUREURL."index2.php?page=account.index", true);

$text = $VM_LANG->_('PHPSHOP_ACCOUNT_TITLE');

if( $useGreyBox_accountlink ) {

echo vmCommonHTML::getGreyboxPopUpLink( $href2, $text, '', $text, $class_att, 500, 600, $href );

}

else {

echo vmCommonHTML::hyperlink( $href, $text, '', $text, $class_att );

}

?>

</td>

</tr><?php

}

// Просмотр формы, если пользователь автризован

if ( $show_login_form == "yes" ) {

if ($my->id) {

if( vmIsJoomla('1.5') ) {

// выход из адреса

$action = $mm_action_url . 'index.php?option=com_user&task=logout';

// возвращение выхода из адреса

$uri = JFactory::getURI();

$url = $uri->toString(array('path', 'query', 'fragment'));

$return = base64_encode( $url );

} else {

// выход из адреса

$action = $mm_action_url . 'index.php?option=logout';

// возвращение выхода из адреса

$return = $mm_action_url . 'index.php';

}

?>

<tr>

<td colspan="2" valign="top">

<div align="left" style="margin: 0px; padding: 0px;">

<form action="<?php echo $action ?>" method="post" name="login" id="login">

<input type="submit" name="Submit" class="button" value="<?php echo $VM_LANG->_('BUTTON_LOGOUT') ?>" /><br /><hr />

<input type="hidden" name="op2" value="logout" />

<input type="hidden" name="return" value="<?php echo $return ?>" />

<input type="hidden" name="lang" value="english" />

<input type="hidden" name="message" value="0" />

</form>

</div>

</td>

</tr>

<?php

}

else

{

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]