本文整理汇总了PHP中vmIsJoomla函数的典型用法代码示例。如果您正苦于以下问题:PHP vmIsJoomla函数的具体用法?PHP vmIsJoomla怎么用?PHP vmIsJoomla使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vmIsJoomla函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mm_showMyFileName
* @subpackage themes
* @copyright Copyright (C) 2007-2009 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName( __FILE__ );
if ( $set == 0 ) { // This is the enquiry form!
$validate = vmIsJoomla( '1.5' ) ? JUtility::getHash( $mainframe->getCfg( 'db' ) ) : mosHash( $mainframe->getCfg( 'db' ) );
?>
<br />
<a class="button" href="<?php echo $product_link ?>"><?php echo $VM_LANG->_('VM_RETURN_TO_PRODUCT') ?></a>
<br /><br />
<form action="<?php echo $mm_action_url ?>index.php" method="post" name="emailForm" id="emailForm">
<label for="contact_name"><?php echo $VM_LANG->_('NAME_PROMPT') ?></label>
<br /><input type="text" name="name" id="contact_name" size="80" class="inputbox" value="<?php echo $name ?>"><br /><br />
<label for="contact_mail"><?php echo $VM_LANG->_('EMAIL_PROMPT') ?></label>
<br /><input type="text" id="contact_mail" name="email" size="80" label="Your email" class="inputbox" value="<?php echo $email ?>"><br /><br />
<label for="contact_text"><?php echo $VM_LANG->_('MESSAGE_PROMPT') ?></label><br />
<textarea rows="10" cols="60" name="text" id="contact_text" class="inputbox"><?php echo utf8_decode($subject) ?></textarea><br />
<input type="button" name="send" value="<?php echo $VM_LANG->_('SEND_BUTTON') ?>" class="button" onclick="validateEnquiryForm()" />
示例2: handleProductSnapShot
/**
* Main Function to display Product Snapshots
*
* @param mosContent $row
* @param JParams $params
* @param int $page
* @param boolean $published
* @return boolean
*/
function handleProductSnapShot(&$row, &$params, $page = 0, $published = true)
{
global $mosConfig_absolute_path, $mosConfig_live_site, $database;
// load default parameters
if (vmIsJoomla('1.5', '>=')) {
$db = JFactory::getDBO();
$plugin =& JPluginHelper::getPlugin('content', 'vmproductsnapshots');
$parameters = $plugin->params;
} else {
$query = "SELECT id,params FROM #__mambots WHERE element = 'vmproductsnapshots' AND folder = 'content'";
$database->setQuery($query);
$mambot = $database->loadResult();
$parameters = $mambot->params;
}
$bot_params = new vmParameters($parameters);
$param_defaults = array('id' => '0', 'enabled' => '1', 'showname' => 'y', 'showimage' => 'y', 'showdesc' => 'n', 'showprice' => 'y', 'quantity' => '1', 'showaddtocart' => 'y', 'displaylist' => 'v', 'displayeach' => 'h', 'width' => '100', 'border' => '0', 'style' => '', 'align' => '');
// get settings from admin mambot parameters
foreach ($param_defaults as $key => $value) {
$param_defaults[$key] = $bot_params->get($key, $value);
}
$enabled = $param_defaults['enabled'];
if (!$published || !$enabled) {
$row->text = preg_replace("/{product_snapshot:.+?}/", '', $row->text);
return true;
}
$vm_productsnap_entrytext = $row->text;
$vm_productsnap_matches = array();
if (preg_match_all("/{product_snapshot:.+?}/", $vm_productsnap_entrytext, $vm_productsnap_matches, PREG_PATTERN_ORDER) > 0) {
foreach ($vm_productsnap_matches[0] as $vm_productsnap_match) {
$vm_productsnap_match = str_replace("{product_snapshot:", "", $vm_productsnap_match);
$vm_productsnap_match = str_replace("}", "", $vm_productsnap_match);
// Get Bot Parameters
$vm_productsnap_params = get_prodsnap_params($vm_productsnap_match, $param_defaults);
// Get the html
$showsnapshot = return_snapshot($vm_productsnap_params);
$vm_productsnap_entrytext = preg_replace("/{product_snapshot:.+?}/", $showsnapshot, $vm_productsnap_entrytext, 1);
}
$row->text = $vm_productsnap_entrytext;
}
return;
}
示例3: saveRegistration
/**
* The function from com_registration!
* Registers a user into Mambo/Joomla
*
* @return boolean True when the registration process was successful, False when not
*/
function saveRegistration()
{
global $database, $acl, $vmLogger, $mosConfig_useractivation, $mosConfig_allowUserRegistration, $mosConfig_live_site;
if ($mosConfig_allowUserRegistration == '0') {
mosNotAuth();
return false;
}
$row = new mosUser($database);
if (!$row->bind($_POST, 'usertype')) {
$error = vmHtmlEntityDecode($row->getError());
$vmLogger->err($error);
echo "<script type=\"text/javascript\"> alert('" . $error . "');</script>\n";
return false;
}
mosMakeHtmlSafe($row);
$usergroup = 'Registered';
$row->id = 0;
$row->usertype = $usergroup;
$row->gid = $acl->get_group_id($usergroup, 'ARO');
if ($mosConfig_useractivation == '1') {
$row->activation = md5(vmGenRandomPassword());
$row->block = '1';
}
if (!$row->check()) {
$error = vmHtmlEntityDecode($row->getError());
$vmLogger->err($error);
echo "<script type=\"text/javascript\"> alert('" . $error . "');</script>\n";
return false;
}
$pwd = $row->password;
$row->password = md5($row->password);
$row->registerDate = date('Y-m-d H:i:s');
if (!$row->store()) {
$error = vmHtmlEntityDecode($row->getError());
$vmLogger->err($error);
echo "<script type=\"text/javascript\"> alert('" . $error . "');</script>\n";
return false;
}
$row->checkin();
$name = $row->name;
$email = $row->email;
$username = $row->username;
$component = vmIsJoomla(1.5) ? 'com_user' : 'com_registration';
$activation_link = $mosConfig_live_site . "/index.php?option={$component}&task=activate&activation=" . $row->activation;
// Send the registration email
$this->_sendMail($name, $email, $username, $pwd, $activation_link);
return true;
}
示例4: ppex_userLogin
/**
* Logins the user into Virtuemart and Joomla if Possible
* Used incase the $payerID is associated with a non account register
* in Virtuemart. Otherwise the authentication plugin for Virtuemart PayPal
* will login via Joomla.
*
* @param string $payerID
* @return bool
*/
function ppex_userLogin(&$auth)
{
global $mainframe, $vmLogger;
if (!isset($_SESSION['ppex_userdata']['payer_id'])) {
$vmLogger->debug('Error: Cannot login without a payer id');
return false;
}
$vmLogger->debug('Trying to Login...');
$username = ps_paypal_api::ppex_getUsername($_SESSION['ppex_userdata']['payer_id']);
$vmLogger->debug('Retrieved Username: ' . $username);
//If we have a username then try to login with it. Otherwise, login only in Virtuemart
if ($username !== false) {
if (vmIsJoomla('1.5')) {
$vmLogger->debug('Using Joomla Login');
if ($mainframe->login(array('username' => $username, 'password' => $_SESSION['ppex_userdata']['payer_id']))) {
$auth['user_id'] = ps_paypal_api::ppex_getUserID($username);
$auth['username'] = $username;
$_SESSION['auth'] = $auth;
return true;
}
} else {
$vmLogger->debug('Joomla is not 1.5 - Trying to login to just Virtuemart');
$auth['user_id'] = ps_paypal_api::ppex_getUserID($username);
$auth['username'] = $username;
$_SESSION['auth'] = $auth;
return true;
}
} else {
$vmLogger->debug('No Username Found - Trying to use Virtuemart Login');
return ps_paypal_api::ppex_userLoginVirtuemart($auth);
}
return false;
}
示例5: jimport
function &getPatchContents($updatepackage)
{
global $vmLogger, $mosConfig_absolute_path, $VM_LANG;
$extractdir = vmUpdate::getPackageDir($updatepackage);
$update_manifest = $extractdir . '/update.xml';
$result = true;
if (!file_exists($update_manifest)) {
if (vmIsJoomla('1.5', '>=')) {
jimport('joomla.filesystem.archive');
if (!JArchive::extract($updatepackage, $extractdir)) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir);
$result = false;
return $result;
}
} else {
$file_info = pathinfo($updatepackage);
switch ($file_info['extension']) {
case 'gz':
require_once ADMINPATH . 'Tar.php';
$package_archive = new Archive_Tar($updatepackage, "gz");
$result = $package_archive->extract($extractdir . '/');
if (!$result) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir);
$result = false;
return $result;
}
break;
case 'zip':
// Extract functions
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclzip.lib.php';
require_once $mosConfig_absolute_path . '/administrator/includes/pcl/pclerror.lib.php';
$zipfile = new PclZip($updatepackage);
$ret = $zipfile->extract(PCLZIP_OPT_PATH, $extractdir);
if ($ret == 0) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_EXTRACT_FAILED') . " " . $extractdir . ' (' . $zipfile->errorName(true) . ')');
return false;
}
break;
default:
$vmLogger->err('An invalid patch package extension was detected. Allowed Types: tar.gz and zip');
return false;
}
}
}
$fileArr = array();
$queryArr = array();
$result = true;
// Can we use the PHP5 SimpleXML Extension ?
if (function_exists('simplexml_load_file')) {
$xml = @simplexml_load_file($update_manifest);
if ($xml === false) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_PARSE_FAILED'));
return false;
}
$toversion = (string) $xml->toversion;
$forversion = (string) $xml->forversion;
$description = (string) $xml->description;
$releasedate = (string) $xml->releasedate;
foreach ($xml->files->file as $file) {
if (file_exists($extractdir . '/' . $file)) {
$fileArr[] = array('filename' => (string) $file, 'copy_policy' => (string) @$file['copy']);
} else {
$vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_FILE_MISSING'), $file));
$result = false;
}
}
if ($result === false) {
return $result;
}
if (!empty($xml->queries->query)) {
foreach ($xml->queries->query as $query) {
$queryArr[] = (string) $query;
}
}
// RickG - Look for an install file
$installfile = (string) $xml->vminstallfile;
if ($installfile) {
if (file_exists($extractdir . DS . $installfile)) {
$returnArr['installfile'] = $extractdir . DS . $installfile;
} else {
$returnArr['installfile'] = '';
}
}
} else {
// Use the SimpleXML Equivalent
require_once CLASSPATH . 'simplexml.php';
$xml = new vmSimpleXML();
$result = $xml->loadFile($update_manifest);
if ($result === false) {
$vmLogger->err($VM_LANG->_('VM_UPDATE_ERR_PARSE_FAILED'));
return false;
}
$result = true;
$xml = $xml->document;
$toversion = $xml->toversion[0]->data();
$forversion = $xml->forversion[0]->data();
$description = $xml->description[0]->data();
$releasedate = $xml->releasedate[0]->data();
foreach ($xml->files[0]->file as $file) {
if (file_exists($extractdir . '/' . $file->data())) {
//.........这里部分代码省略.........
示例6: stristr
$tl_link = " <a href=\"javascript:void window.open(" . "'{$tl_url}', 'win2', 'status=yes,toolbar=yes,scrollbars=yes," . "titlebar=yes,menubar=yes,resizable=yes,width=640,height=480," . "directories=no,location=no');\">";
$tl_link .= "Track</a>";
$listObj->addCell($tl_link);
}
if (!$display_void_label) {
$listObj->addCell("");
} else {
$vl_url = $sess->url($_SERVER['PHP_SELF'] . "?page=order.label_void&order_id=" . $db->f("order_id") . "&no_menu=1");
$vl_url = stristr($_SERVER['PHP_SELF'], "index2.php") ? str_replace("index2.php", "index3.php", $vl_url) : str_replace("index.php", "index2.php", $vl_url);
$vl_link = " <a href=\"javascript:void window.open(" . "'{$vl_url}', 'win2', 'status=yes,toolbar=yes,scrollbars=yes," . "titlebar=yes,menubar=yes,resizable=yes,width=640,height=480," . "directories=no,location=no');\">";
$vl_link .= "Void</a>";
$listObj->addCell($vl_link);
}
// Print view URL
$details_url = $_SERVER['PHP_SELF'] . "?page=order.order_printdetails&order_id=" . $db->f("order_id") . "&no_menu=1&pop=1";
if (vmIsJoomla('1.5', '>=')) {
$details_url .= "&tmpl=component";
}
$details_url = $sess->url($details_url);
$details_url = defined('_VM_IS_BACKEND') ? str_replace("index2.php", "index3.php", $details_url) : str_replace("index.php", "index2.php", $details_url);
// Print View Icon
$details_link = " <a href=\"javascript:void window.open('{$details_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\">";
$details_link .= "<img src=\"{$mosConfig_live_site}/images/M_images/printButton.png\" align=\"center\" height=\"16\" width=\"16\" border=\"0\" /></a>";
$listObj->addCell($details_link);
// Creation Date
$listObj->addCell(vmFormatDate($db->f("cdate"), "%d-%b-%y %H:%M"));
// Last Modified Date
$listObj->addCell(vmFormatDate($db->f("mdate"), "%d-%b-%y %H:%M"));
// Order Status Drop Down List
$listObj->addCell($ps_order_status->getOrderStatusList($db->f("order_status"), "onchange=\"document.adminForm{$i}.order_status.selectedIndex = this.selectedIndex;document.adminForm{$i}.changed.value='1'\""));
// Notify Customer checkbox
示例7: elseif
<input type="hidden" name="remember" value="yes" />
<?php
}
?>
<input type="hidden" value="login" name="op2" />
<input type="hidden" value="<?php
echo $return;
?>
" name="return" />
<br/>
<input type="submit" value="<?php
echo $VM_LANG->_('BUTTON_LOGIN');
?>
" class="button" name="Login" />
<?php
if (vmIsJoomla(1.5)) {
$validate = JUtility::getToken();
} elseif (function_exists('josspoofvalue')) {
$validate = josSpoofValue(1);
} else {
// used for spoof hardening
$validate = vmSpoofValue(1);
}
?>
<input type="hidden" name="<?php
echo $validate;
?>
" value="1" />
</form>
</td>
</tr>
示例8: prepare_SSL_Session
/**
* This is a solution for the Shared SSL problem
* We have to copy some cookies from the Main Mambo site domain into
* the shared SSL domain (only when necessary!)
*
* The function is called on each page load.
*/
function prepare_SSL_Session()
{
global $mainframe, $my, $database, $mosConfig_secret, $page, $VM_MODULES_FORCE_HTTPS;
if (vmIsAdminMode() && vmIsJoomla('1.0')) {
return;
}
$ssl_redirect = vmGet($_GET, "ssl_redirect", 0);
$redirected = vmGet($_GET, "redirected", 0);
$martID = vmGet($_GET, 'martID', '');
$ssl_domain = "";
if (!empty($VM_MODULES_FORCE_HTTPS)) {
$pagearr = explode('.', $page);
$module = $pagearr[0];
// When NOT in https mode, but the called page is part of a shop module that is
// forced to use https, we prepare the redirection to https here
if (array_search($module, $VM_MODULES_FORCE_HTTPS) !== false && !vmIsHttpsMode() && $this->check_Shared_SSL($ssl_domain)) {
$ssl_redirect = 1;
}
}
// Generally redirect to HTTP (from HTTPS) when it is not necessary? (speed up the pageload)
if (VM_GENERALLY_PREVENT_HTTPS == '1' && vmIsHttpsMode() && $redirected != 1 && $ssl_redirect == 0 && !vmIsAdminMode() && URL != SECUREURL && @$_REQUEST['option'] == 'com_virtuemart') {
$pagearr = explode('.', $page);
$module = $pagearr[0];
// When it is not necessary to stay in https mode, we leave it here
if (array_search($module, $VM_MODULES_FORCE_HTTPS) === false) {
if ($this->check_Shared_SSL($ssl_domain)) {
$this->saveSessionAndRedirect(false);
}
$query_string = vmGet($_SERVER, 'QUERY_STRING');
if (!empty($query_string) && empty($_POST)) {
vmRedirect($this->url(URL . basename($_SERVER['PHP_SELF']) . '?' . vmGet($_SERVER, 'QUERY_STRING') . '&redirected=1', true, false, true));
}
}
}
/**
* This is the first part of the Function:
* We check if the function must be called at all
* Usually this is only called once: Before we go to the checkout.
* The variable ssl_redirect=1 is appended to the URL, just for this function knows
* is must be active! This has nothing to do with SSL / Shared SSL or whatever
*/
if ($ssl_redirect == 1) {
$_SERVER['QUERY_STRING'] = str_replace('&ssl_redirect=1', '', vmGet($_SERVER, 'QUERY_STRING'));
// check_Shared_SSL compares the normal http domain name
// and the https Domain Name. If both do not match, we move on
// else we leave this function.
if ($this->check_Shared_SSL($ssl_domain) && !vmIsHttpsMode() && $redirected == 0) {
$this->saveSessionAndRedirect(true);
} elseif (!vmIsHttpsMode() && $redirected == 0) {
vmRedirect($this->url(SECUREURL . basename($_SERVER['PHP_SELF']) . "?" . vmGet($_SERVER, 'QUERY_STRING') . '&redirected=1', true, false, true));
}
}
/**
* This is part two of the function
* If the redirect (see 4/5 lines above) was successful
* and the Store uses Shared SSL, we have the variable martID
* So let's copy the Session contents ton the new domain and start the session again
* othwerwise: do nothing.
*/
if (!empty($martID)) {
if ($this->check_Shared_SSL($ssl_domain)) {
// We now need to copy the Session Data to the SSL Domain
if ($martID) {
require_once ADMINPATH . 'install.copy.php';
$sessionFile = IMAGEPATH . md5($martID) . '.sess';
// Read the contents of the session file
$session_data = file_get_contents($sessionFile);
// Delete it for security and disk space reasons
unlink($sessionFile);
// Read the session data into $_SESSION
// From now on, we can use all the data in $_SESSION
session_decode($session_data);
$check = base64_decode($martID);
$checkValArr = explode("|", $check);
if (defined('_JEXEC')) {
//TODO
} elseif (class_exists('mambocore')) {
//TODO
} elseif ($GLOBALS['_VERSION']->RELEASE == '1.0' && (int) $GLOBALS['_VERSION']->DEV_LEVEL >= 13) {
if (!empty($GLOBALS['real_mosConfig_live_site']) && empty($_REQUEST['real_mosConfig_live_site'])) {
$GLOBALS['mosConfig_live_site'] = $GLOBALS['real_mosConfig_live_site'];
}
if (!empty($checkValArr[2])) {
// Joomla! >= 1.0.13 can be cheated to log in a user who has previsously logged in and checked the "Remember me" box
setcookie(mosmainframe::remCookieName_User(), $checkValArr[2], false, '/');
// there's no need to call "$mainframe->login"
}
} else {
// Check if the user was logged in in the http domain
// and is not yet logged in at the Shared SSL domain
if (isset($checkValArr[1]) && !$my->id) {
// user should expect to be logged in,
// we can use the values from $_SESSION['auth'] now
//.........这里部分代码省略.........
示例9: creditcard_lists
/**
* Build a Credit Card list for each CreditCard Payment Method
* Uses JavsScript from mambojavascript: changeDynaList()
*
* @param ps_DB $db_cc
* @return string
*/
function creditcard_lists(&$db_cc)
{
global $mainframe;
if (vmIsJoomla('1.5')) {
$document = JFactory::getDocument();
$document->addScript('includes/js/joomla.javascript.js');
}
$db = new ps_DB();
$db_cc->next_record();
// Build the Credit Card lists for each CreditCard Payment Method
$script = "<script language=\"javascript\" type=\"text/javascript\">\n";
$script .= "<!--\n";
$script .= "var originalOrder = '1';\n";
$script .= "var originalPos = '" . $db_cc->f("payment_method_name") . "';\n";
$script .= "var orders = new Array();\t// array in the format [key,value,text]\n";
$i = 0;
$db_cc->reset();
while ($db_cc->next_record()) {
$accepted_creditcards = explode(",", $db_cc->f("accepted_creditcards"));
$cards = array();
foreach ($accepted_creditcards as $value) {
if (!empty($value)) {
$q = 'SELECT creditcard_code,creditcard_name FROM #__{vm}_creditcard WHERE creditcard_id=' . (int) $value;
$db->query($q);
$db->next_record();
$cards[$db->f('creditcard_code')] = shopMakeHtmlSafe($db->f('creditcard_name'));
}
}
foreach ($cards as $code => $name) {
$script .= "orders[" . $i++ . "] = new Array( '" . addslashes($db_cc->f("payment_method_name")) . "','{$code}','{$name}' );\n";
}
}
$script .= "function changeCreditCardList() { \n";
$script .= "var selected_payment = null;\n for (var i=0; i<document.adminForm.payment_method_id.length; i++)\n if (document.adminForm.payment_method_id[i].checked)\n selected_payment = document.adminForm.payment_method_id[i].id;\n";
$script .= "changeDynaList('creditcard_code',orders,selected_payment, originalPos, originalOrder);\n";
$script .= "}\n";
$script .= "//-->\n";
$script .= "</script>\n";
$script .= '<noscript>' . ps_html::selectList('creditcard_code', key($cards), $cards) . '</noscript>';
return $script;
}
示例10: writeconfig
/**
* writes the virtuemart.cfg.php
* @author soeren
* @static
* @param array $d
* @return boolean
*/
function writeconfig(&$d)
{
global $my, $db, $vmLogger, $VM_LANG, $mosConfig_live_site;
$group_id = intval($d['conf_VM_PRICE_ACCESS_LEVEL']);
// TODO: (J! 1.5) Is there a better way to handle this difference between Joomla versions?
if (vmIsJoomla(1.5)) {
$db->query('SELECT name FROM #__core_acl_aro_groups WHERE id=\'' . $group_id . '\'');
} else {
$db->query('SELECT name FROM #__core_acl_aro_groups WHERE group_id=\'' . $group_id . '\'');
}
$db->next_record();
$d['conf_VM_PRICE_ACCESS_LEVEL'] = $db->f('name');
if (!is_writable(ADMINPATH . "virtuemart.cfg.php")) {
$vmLogger->err($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false) . ' (' . ADMINPATH . "virtuemart.cfg.php)");
return false;
}
if ($_POST['myname'] != "Jabba Binks") {
return false;
} else {
if (empty($d['VM_CHECKOUT_MODULES']['CHECK_OUT_GET_SHIPPING_ADDR']['enabled'])) {
$d['conf_NO_SHIPTO'] = '1';
} else {
$d['conf_NO_SHIPTO'] = '';
}
if (empty($d['conf_SHIPPING']) || empty($d['VM_CHECKOUT_MODULES']['CHECK_OUT_GET_SHIPPING_METHOD']['enabled'])) {
$d['VM_CHECKOUT_MODULES']['CHECK_OUT_GET_SHIPPING_METHOD']['enabled'] = '';
$d['conf_NO_SHIPPING'] = '1';
}
$d['conf_PSHOP_OFFLINE_MESSAGE'] = vmGet($d, 'conf_PSHOP_OFFLINE_MESSAGE', '', VMREQUEST_ALLOWHTML);
/** Prevent this config setting from being changed by no-backenders **/
if (!defined('_PHSHOP_ADMIN') && !stristr($my->usertype, "admin")) {
$d['conf_PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS'] = PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS;
}
$my_config_array = array("PSHOP_IS_OFFLINE" => "conf_PSHOP_IS_OFFLINE", "PSHOP_OFFLINE_MESSAGE" => "conf_PSHOP_OFFLINE_MESSAGE", "USE_AS_CATALOGUE" => "conf_USE_AS_CATALOGUE", "VM_TABLEPREFIX" => "conf_VM_TABLEPREFIX", "VM_PRICE_SHOW_PACKAGING_PRICELABEL" => "conf_VM_PRICE_SHOW_PACKAGING_PRICELABEL", "VM_PRICE_SHOW_INCLUDINGTAX" => "conf_VM_PRICE_SHOW_INCLUDINGTAX", "VM_PRICE_ACCESS_LEVEL" => "conf_VM_PRICE_ACCESS_LEVEL", "VM_REGISTRATION_TYPE" => "conf_VM_REGISTRATION_TYPE", "VM_BROWSE_ORDERBY_FIELD" => "conf_VM_BROWSE_ORDERBY_FIELD", "VM_GENERALLY_PREVENT_HTTPS" => "conf_VM_GENERALLY_PREVENT_HTTPS", "VM_ALLOW_EXTENDED_CLASSES" => "conf_VM_ALLOW_EXTENDED_CLASSES", "VM_SHOW_REMEMBER_ME_BOX" => "conf_VM_SHOW_REMEMBER_ME_BOX", "VM_REVIEWS_MINIMUM_COMMENT_LENGTH" => "conf_VM_REVIEWS_MINIMUM_COMMENT_LENGTH", "VM_REVIEWS_MAXIMUM_COMMENT_LENGTH" => "conf_VM_REVIEWS_MAXIMUM_COMMENT_LENGTH", "VM_SHOW_PRINTICON" => "conf_VM_SHOW_PRINTICON", "VM_SHOW_EMAILFRIEND" => "conf_VM_SHOW_EMAILFRIEND", "PSHOP_PDF_BUTTON_ENABLE" => "conf_PSHOP_PDF_BUTTON_ENABLE", "VM_REVIEWS_AUTOPUBLISH" => "conf_VM_REVIEWS_AUTOPUBLISH", "VM_PROXY_URL" => "conf_VM_PROXY_URL", "VM_PROXY_PORT" => "conf_VM_PROXY_PORT", "VM_PROXY_USER" => "conf_VM_PROXY_USER", "VM_PROXY_PASS" => "conf_VM_PROXY_PASS", "VM_ONCHECKOUT_SHOW_LEGALINFO" => "conf_VM_ONCHECKOUT_SHOW_LEGALINFO", "VM_ONCHECKOUT_LEGALINFO_SHORTTEXT" => "conf_VM_ONCHECKOUT_LEGALINFO_SHORTTEXT", "VM_ONCHECKOUT_LEGALINFO_LINK" => "conf_VM_ONCHECKOUT_LEGALINFO_LINK", "ENABLE_DOWNLOADS" => "conf_ENABLE_DOWNLOADS", "DOWNLOAD_MAX" => "conf_DOWNLOAD_MAX", "DOWNLOAD_EXPIRE" => "conf_DOWNLOAD_EXPIRE", "ENABLE_DOWNLOAD_STATUS" => "conf_ENABLE_DOWNLOAD_STATUS", "DISABLE_DOWNLOAD_STATUS" => "conf_DISABLE_DOWNLOAD_STATUS", "DOWNLOADROOT" => "conf_DOWNLOADROOT", "VM_DOWNLOADABLE_PRODUCTS_KEEP_STOCKLEVEL" => "conf_VM_DOWNLOADABLE_PRODUCTS_KEEP_STOCKLEVEL", "_SHOW_PRICES" => "conf__SHOW_PRICES", "ORDER_MAIL_HTML" => "conf_ORDER_MAIL_HTML", "HOMEPAGE" => "conf_HOMEPAGE", "CATEGORY_TEMPLATE" => "conf_CATEGORY_TEMPLATE", "FLYPAGE" => "conf_FLYPAGE", "PRODUCTS_PER_ROW" => "conf_PRODUCTS_PER_ROW", "ERRORPAGE" => "conf_ERRORPAGE", "NO_IMAGE" => "conf_NO_IMAGE", "DEBUG" => "conf_DEBUG", "SHOWVERSION" => "conf_SHOWVERSION", "TAX_VIRTUAL" => "conf_TAX_VIRTUAL", "TAX_MODE" => "conf_TAX_MODE", "MULTIPLE_TAXRATES_ENABLE" => "conf_MULTIPLE_TAXRATES_ENABLE", "PAYMENT_DISCOUNT_BEFORE" => "conf_PAYMENT_DISCOUNT_BEFORE", "PAYMENT_DISCOUNT_VAT_ID" => "conf_PAYMENT_DISCOUNT_VAT_ID", "PSHOP_ALLOW_REVIEWS" => "conf_PSHOP_ALLOW_REVIEWS", "PSHOP_AGREE_TO_TOS_ONORDER" => "conf_PSHOP_AGREE_TO_TOS_ONORDER", "SHOW_CHECKOUT_BAR" => "conf_SHOW_CHECKOUT_BAR", "CHECK_STOCK" => "conf_CHECK_STOCK", "ENCODE_KEY" => "conf_ENCODE_KEY", "NO_SHIPPING" => "conf_NO_SHIPPING", "NO_SHIPTO" => "conf_NO_SHIPTO", "AFFILIATE_ENABLE" => "conf_AFFILIATE_ENABLE", "PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS" => "conf_PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS", "PSHOP_IMG_RESIZE_ENABLE" => "conf_PSHOP_IMG_RESIZE_ENABLE", "PSHOP_IMG_WIDTH" => "conf_PSHOP_IMG_WIDTH", "PSHOP_IMG_HEIGHT" => "conf_PSHOP_IMG_HEIGHT", "PSHOP_COUPONS_ENABLE" => "conf_PSHOP_COUPONS_ENABLE", "PSHOP_SHOW_PRODUCTS_IN_CATEGORY" => "conf_PSHOP_SHOW_PRODUCTS_IN_CATEGORY", "PSHOP_SHOW_TOP_PAGENAV" => "conf_PSHOP_SHOW_TOP_PAGENAV", "PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS" => "conf_PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS", "VM_CURRENCY_CONVERTER_MODULE" => "conf__VM_CURRENCY_CONVERTER_MODULE", "VM_CONTENT_PLUGINS_ENABLE" => "conf_VM_CONTENT_PLUGINS_ENABLE", "VM_ENABLE_COOKIE_CHECK" => "conf_VM_ENABLE_COOKIE_CHECK", 'VM_FEED_ENABLED' => 'conf_VM_FEED_ENABLED', 'VM_FEED_CACHE' => 'conf_VM_FEED_CACHE', 'VM_FEED_CACHETIME' => 'conf_VM_FEED_CACHETIME', 'VM_FEED_TITLE' => 'conf_VM_FEED_TITLE', 'VM_FEED_TITLE_CATEGORIES' => 'conf_VM_FEED_TITLE_CATEGORIES', 'VM_FEED_SHOW_IMAGES' => 'conf_VM_FEED_SHOW_IMAGES', 'VM_FEED_SHOW_PRICES' => 'conf_VM_FEED_SHOW_PRICES', 'VM_FEED_SHOW_DESCRIPTION' => 'conf_VM_FEED_SHOW_DESCRIPTION', 'VM_FEED_DESCRIPTION_TYPE' => 'conf_VM_FEED_DESCRIPTION_TYPE', 'VM_FEED_LIMITTEXT' => 'conf_VM_FEED_LIMITTEXT', 'VM_FEED_MAX_TEXT_LENGTH' => 'conf_VM_FEED_MAX_TEXT_LENGTH', 'VM_STORE_CREDITCARD_DATA' => 'conf_VM_STORE_CREDITCARD_DATA', 'VM_ENCRYPT_FUNCTION' => 'conf_ENCRYPT_FUNCTION', 'VM_COMPONENT_NAME' => 'option', "VM_LOGFILE_ENABLED" => "conf_VM_LOGFILE_ENABLED", "VM_LOGFILE_NAME" => "conf_VM_LOGFILE_NAME", "VM_LOGFILE_LEVEL" => "conf_VM_LOGFILE_LEVEL", "VM_DEBUG_IP_ENABLED" => "conf_VM_DEBUG_IP_ENABLED", "VM_DEBUG_IP_ADDRESS" => "conf_VM_DEBUG_IP_ADDRESS", "VM_LOGFILE_FORMAT" => "conf_VM_LOGFILE_FORMAT", "VM_BROWSE_ORDERBY_FIELDS" => "conf_VM_BROWSE_ORDERBY_FIELDS", "VM_MODULES_FORCE_HTTPS" => "conf_VM_MODULES_FORCE_HTTPS", "VM_CHECKOUT_MODULES" => "VM_CHECKOUT_MODULES", "PSHOP_SHIPPING_MODULE" => "conf_SHIPPING");
if (!vmisJoomla('1.5')) {
$url = '$mosConfig_live_site.$app';
} else {
$url = "'" . $db->getEscaped(vmGet($d, 'conf_URL', $mosConfig_live_site)) . "'";
}
$config = "<?php\r\nif( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );\r\n/**\r\n* The configuration file for VirtueMart\r\n*\r\n* @package VirtueMart\r\n* @subpackage core\r\n* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php\r\n* VirtueMart is free software. This version may have been modified pursuant\r\n* to the GNU General Public License, and as distributed it includes or\r\n* is derivative of works licensed under the GNU General Public License or\r\n* other free or open source software licenses.\r\n* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.\r\n*\r\n* http://virtuemart.net\r\n*/\r\n\r\nglobal \$mosConfig_absolute_path,\$mosConfig_live_site;\r\nif( !class_exists( 'jconfig' )) {\r\n\t\$global_lang = \$GLOBALS['mosConfig_lang'];\r\n\r\n\t@include( dirname( __FILE__ ).'/../../../configuration.php' );\r\n\r\n\t\$GLOBALS['mosConfig_lang'] = \$mosConfig_lang = \$global_lang;\r\n}\r\n// Check for trailing slash\r\nif( \$mosConfig_live_site[strlen( \$mosConfig_live_site)-1] == '/' ) {\r\n\t\$app = '';\r\n}\r\nelse {\r\n\t\$app = '/';\r\n}\r\n// these path and url definitions here are based on the Joomla! Configuration\r\ndefine( 'URL', {$url} );\r\ndefine( 'SECUREURL', '" . $db->getEscaped($d['conf_SECUREURL']) . "' );\r\n\r\nif ( (!empty(\$_SERVER['HTTPS']) && \$_SERVER['HTTPS'] != 'off') || \$_SERVER['SERVER_PORT'] == '443' ) {\r\n\tdefine( 'IMAGEURL', SECUREURL .'components/com_virtuemart/shop_image/' );\r\n\tdefine( 'VM_THEMEURL', SECUREURL.'components/com_virtuemart/themes/" . $db->getEscaped($d['conf_THEME']) . "/' );\r\n} else {\r\n\tdefine( 'IMAGEURL', URL .'components/com_virtuemart/shop_image/' );\r\n\tdefine( 'VM_THEMEURL', URL.'components/com_virtuemart/themes/" . $db->getEscaped($d['conf_THEME']) . "/' );\r\n}\r\ndefine( 'VM_THEMEPATH', \$mosConfig_absolute_path.'/components/com_virtuemart/themes/" . $db->getEscaped($d['conf_THEME']) . "/' );\r\n\r\ndefine( 'COMPONENTURL', URL .'administrator/components/com_virtuemart/' );\r\ndefine( 'ADMINPATH', \$mosConfig_absolute_path.'/administrator/components/com_virtuemart/' );\r\ndefine( 'CLASSPATH', ADMINPATH.'classes/' );\r\ndefine( 'PAGEPATH', ADMINPATH.'html/' );\r\ndefine( 'IMAGEPATH', \$mosConfig_absolute_path.'/components/com_virtuemart/shop_image/' );\n\n";
// LOOP THROUGH ALL CONFIGURATION VARIABLES
while (list($key, $value) = each($my_config_array)) {
if ($key == 'ENCODE_KEY') {
$encode_key = vmGet($d, $value);
$config .= "define('ENCODE_KEY', '" . str_replace('\'', "\\'", $encode_key) . "');\n";
if ($encode_key != ENCODE_KEY) {
// The ENCODE KEY has been changed! Now we need to re-encode the credit card information and transaction keys
$db->query('UPDATE #__{vm}_order_payment SET order_payment_number = ' . VM_ENCRYPT_FUNCTION . '(' . VM_DECRYPT_FUNCTION . '(order_payment_number,\'' . $db->getEscaped(ENCODE_KEY) . '\'), \'' . $db->getEscaped($encode_key) . '\')');
$db->query('UPDATE #__{vm}_payment_method SET payment_passkey = ' . VM_ENCRYPT_FUNCTION . '(' . VM_DECRYPT_FUNCTION . '(payment_passkey,\'' . $db->getEscaped(ENCODE_KEY) . '\'), \'' . $db->getEscaped($encode_key) . '\')');
}
} elseif ($key == 'VM_ENCRYPT_FUNCTION') {
if (!defined('VM_ENCRYPT_FUNCTION')) {
define('VM_ENCRYPT_FUNCTION', 'ENCODE');
}
if (empty($d[$value])) {
$d[$value] = 'ENCODE';
}
if ($d[$value] != VM_ENCRYPT_FUNCTION) {
$encode_key = vmGet($d, 'conf_ENCODE_KEY');
$reencode_key = $encode_key != ENCODE_KEY ? $encode_key : ENCODE_KEY;
if ($d[$value] == 'ENCODE') {
$decryptor = 'DECODE';
} elseif ($d[$value] == 'AES_ENCRYPT') {
$decryptor = 'AES_DECRYPT';
} else {
$d[$value] = VM_ENCRYPT_FUNCTION;
}
// The Encryption Function has been changed. We need to decode and re-encrypt now!
$db->query("UPDATE #__{vm}_order_payment SET order_payment_number = " . $d[$value] . '(' . VM_DECRYPT_FUNCTION . "(order_payment_number,'" . $db->getEscaped($reencode_key) . "'), '" . $db->getEscaped($reencode_key) . "')");
$db->query('UPDATE #__{vm}_payment_method SET payment_passkey = ' . $d[$value] . '(' . VM_DECRYPT_FUNCTION . '(payment_passkey,\'' . $db->getEscaped($reencode_key) . '\'), \'' . $db->getEscaped($reencode_key) . '\')');
}
$config .= "define('{$key}', '" . $d[$value] . "');\n";
} elseif ($key == "PSHOP_SHIPPING_MODULE") {
$config .= "\n/* Shipping Methods Definition */\nglobal \$PSHOP_SHIPPING_MODULES;\n";
$i = 0;
if (empty($d['conf_SHIPPING'])) {
$d['conf_SHIPPING'] = array('no_shipping');
}
foreach ($d['conf_SHIPPING'] as $shipping_module) {
$config .= "\$PSHOP_SHIPPING_MODULES[{$i}] = \"{$shipping_module}\";\n";
$i++;
}
} elseif ($key == "VM_BROWSE_ORDERBY_FIELDS") {
$config .= "\n/* OrderByFields */\nglobal \$VM_BROWSE_ORDERBY_FIELDS;\n";
$config .= "\$VM_BROWSE_ORDERBY_FIELDS = array( ";
$i = 0;
if (empty($d['conf_VM_BROWSE_ORDERBY_FIELDS'])) {
$d['conf_VM_BROWSE_ORDERBY_FIELDS'] = array();
}
foreach ($d['conf_VM_BROWSE_ORDERBY_FIELDS'] as $orderbyfield) {
$config .= "'{$orderbyfield}'";
if ($i + 1 < sizeof($d['conf_VM_BROWSE_ORDERBY_FIELDS'])) {
$config .= ',';
//.........这里部分代码省略.........
示例11: saveUser
/**
* Function to save User Information
* into Joomla
*/
function saveUser(&$d)
{
global $database, $my, $_VERSION, $VM_LANG;
global $mosConfig_live_site, $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_sitename;
$aro_id = 'aro_id';
$group_id = 'group_id';
// Column names have changed since J! 1.5
if (vmIsJoomla('1.5', '>=')) {
$aro_id = 'id';
$group_id = 'id';
}
$row = new mosUser($database);
if (!$row->bind($_POST)) {
echo "<script type=\"text/javascript\">alert('" . vmHtmlEntityDecode($row->getError()) . "');</script>\n";
}
$isNew = !$row->id;
$pwd = '';
// MD5 hash convert passwords
if ($isNew) {
// new user stuff
if ($row->password == '') {
$pwd = vmGenRandomPassword();
$row->password = md5($pwd);
} else {
$pwd = $row->password;
$row->password = md5($row->password);
}
$row->registerDate = date('Y-m-d H:i:s');
} else {
// existing user stuff
if ($row->password == '') {
// password set to null if empty
$row->password = null;
} else {
if (!empty($_POST['password'])) {
if ($row->password != @$_POST['password2']) {
$d['error'] = vmHtmlEntityDecode($VM_LANG->_('REGWARN_VPASS2', false));
return false;
}
}
$row->password = md5($row->password);
}
}
// save usertype to usetype column
$query = "SELECT name" . "\n FROM #__core_acl_aro_groups" . "\n WHERE `{$group_id}` = {$row->gid}";
$database->setQuery($query);
$usertype = $database->loadResult();
$row->usertype = $usertype;
// save params
$params = vmGet($_POST, 'params', '');
if (is_array($params)) {
$txt = array();
foreach ($params as $k => $v) {
$txt[] = "{$k}={$v}";
}
$row->params = implode("\n", $txt);
}
if (!$row->check()) {
echo "<script type=\"text/javascript\"> alert('" . vmHtmlEntityDecode($row->getError()) . "');</script>\n";
return false;
}
if (!$row->store()) {
echo "<script type=\"text/javascript\"> alert('" . vmHtmlEntityDecode($row->getError()) . "');</script>\n";
return false;
}
if ($isNew) {
$newUserId = $row->id;
} else {
$newUserId = false;
}
$row->checkin();
$_SESSION['session_user_params'] = $row->params;
// update the ACL
if (!$isNew) {
$query = "SELECT `{$aro_id}`" . "\n FROM #__core_acl_aro" . "\n WHERE value = '{$row->id}'";
$database->setQuery($query);
$aro_id = $database->loadResult();
$query = "UPDATE #__core_acl_groups_aro_map" . "\n SET group_id = {$row->gid}" . "\n WHERE aro_id = {$aro_id}";
$database->setQuery($query);
$database->query() or die($database->stderr());
}
// for new users, email username and password
if ($isNew) {
// Send the notification emails
$name = $row->name;
$email = $row->email;
$username = $row->username;
$password = $pwd;
$this->_sendMail($name, $email, $username, $password);
}
return $newUserId;
}
示例12: vmTheme
* @version $Id: theme.php 2286 2010-02-01 15:28:00Z soeren_nb $
* @package VirtueMart
* @subpackage themes
* @copyright Copyright (C) 2006-2010 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
global $mainframe;
// include the stylesheet for this template
if (vmIsJoomla('1.0') && mosGetParam($_REQUEST, 'option') != VM_COMPONENT_NAME) {
// This can only be a call from a module or mambot
// In Joomla 1.0 it is not possible to add a JS or CSS into the HEAD from a module or content mambot,
// using addcustomheadtag, that's why we just print the tags here
echo vmCommonHTML::scriptTag(VM_THEMEURL . 'theme.js');
echo vmCommonHTML::linkTag(VM_THEMEURL . 'theme.css');
} else {
$vm_mainframe->addStyleSheet(VM_THEMEURL . 'theme.css');
$vm_mainframe->addScript(VM_THEMEURL . 'theme.js');
}
class vmTheme extends vmTemplate
{
function vmTheme()
{
parent::vmTemplate();
vmCommonHTML::loadMooTools();
示例13: listUserFields
//.........这里部分代码省略.........
/**
* This is the most important part of this file
* Here we print the field & its contents!
*/
switch ($field->name) {
case 'title':
$ps_html->list_user_title($db->sf('title'), "id=\"title_field\"");
break;
case 'country':
if (in_array('state', $allfields)) {
$onchange = "onchange=\"changeStateList();\"";
} else {
$onchange = "";
}
$ps_html->list_country("country", $db->sf('country'), "id=\"country_field\" {$onchange}");
break;
case 'state':
echo $ps_html->dynamic_state_lists("country", "state", $db->sf('country'), $db->sf('state'));
echo "<noscript>\n";
$ps_html->list_states("state", $db->sf('state'), "", "id=\"state_field\"");
echo "</noscript>\n";
break;
case 'agreed':
echo '<input type="checkbox" id="agreed_field" name="agreed" value="1" class="inputbox" />';
break;
case 'password':
case 'password2':
echo '<input type="password" id="' . $field->name . '_field" name="' . $field->name . '" size="30" class="inputbox" />' . "\n";
break;
default:
switch ($field->type) {
case 'date':
echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/calendar.js');
if (vmIsJoomla('1.5', '>=')) {
// in Joomla 1.5, the name of calendar lang file is changed...
echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en-GB.js');
} else {
echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en.js');
}
echo vmCommonHTML::linkTag($mosConfig_live_site . '/includes/js/calendar/calendar-mos.css');
$maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
echo '<input name="reset" type="reset" class="button" onclick="return showCalendar(\'' . $field->name . '_field\', \'y-mm-dd\');" value="..." />';
break;
case 'text':
case 'emailaddress':
case 'webaddress':
case 'euvatid':
$maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
break;
case 'textarea':
echo '<textarea name="' . $field->name . '" id="' . $field->name . '_field" cols="' . $field->cols . '" rows="' . $field->rows . '" ' . $readonly . '>' . $db->sf($field->name) . '</textarea>';
break;
case 'editorta':
editorArea($field->name, $db->sf($field->name), $field->name, '300', '150', $field->cols, $field->rows);
break;
case 'checkbox':
echo '<input type="checkbox" name="' . $field->name . '" id="' . $field->name . '_field" value="1" ' . ($db->sf($field->name) ? 'checked="checked"' : '') . '/>';
break;
case 'age_verification':
$year = vmRequest::getInt('birthday_selector_year', date('Y'));
if ($db->f($field->name)) {
$birthday = $db->f($field->name);
$date_array = explode('-', $birthday);
$year = $date_array[0];
示例14: FORMS_MENU_SAVE_CANCEL
/**
* The function to handle all default page situations
* not responsible for lists!
*/
function FORMS_MENU_SAVE_CANCEL()
{
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $VM_LANG, $page, $limitstart, $vmIcons;
$no_menu = (int) $_REQUEST['no_menu'];
$bar =& vmToolBar::getInstance('virtuemart');
$is_iframe = vmGet($_REQUEST, 'is_iframe', 0);
$product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0);
$product_id = vmGet($_REQUEST, 'product_id');
$script = '';
if (is_array($product_id)) {
$product_id = "";
}
// These editor arrays tell the toolbar to load correct "getEditorContents" script parts
// This is necessary for WYSIWYG Editors like TinyMCE / mosCE / FCKEditor
$editor1_array = array('product.product_form' => 'product_desc', 'shopper.shopper_group_form' => 'shopper_group_desc', 'product.product_category_form' => 'category_description', 'manufacturer.manufacturer_form' => 'mf_desc', 'store.store_form' => 'vendor_store_desc', 'product.product_type_parameter_form' => 'parameter_description', 'product.product_type_form' => 'product_type_description', 'vendor.vendor_form' => 'vendor_store_desc');
$editor2_array = array('store.store_form' => 'vendor_terms_of_service', 'vendor.vendor_form' => 'vendor_terms_of_service');
$editor1 = isset($editor1_array[$page]) ? $editor1_array[$page] : '';
$editor2 = isset($editor2_array[$page]) ? $editor2_array[$page] : '';
if ($no_menu) {
vmCommonHTML::loadExtJS();
}
$script .= '
var submitbutton = function(pressbutton){
var form = document.adminForm;
if (pressbutton == \'cancel\') {
submitform( pressbutton );
return;
}
';
if ($editor1 != '') {
if (vmIsJoomla(1.5)) {
jimport('joomla.html.editor');
$editor_type = $GLOBALS['mainframe']->getCfg('editor');
if ($editor_type != 'none') {
$editor = JEditor::getInstance();
$script .= $editor->getContent($editor1);
}
} else {
ob_start();
getEditorContents('editor1', $editor1);
$script .= ob_get_contents();
ob_end_clean();
}
}
if ($editor2 != '') {
if (vmIsJoomla(1.5)) {
jimport('joomla.html.editor');
$editor_type = $GLOBALS['mainframe']->getCfg('editor');
if ($editor_type != 'none') {
$editor = JEditor::getInstance();
$script .= $editor->getContent($editor2);
}
} else {
ob_start();
getEditorContents('editor2', $editor2);
$script .= ob_get_contents();
ob_end_clean();
}
}
if ($no_menu) {
$admin = defined('_VM_IS_BACKEND') ? '/administrator' : '';
$script .= "\r\n // define some private variables\r\n var dialog, showBtn;\r\n\r\n var showDialog = function( content ) {\r\n \tExt.Msg.show( { \r\n \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\r\n \t\tmsg: content,\r\n \t\tautoCreate: true,\r\n width:400,\r\n height:180,\r\n modal: false,\r\n resizable: false,\r\n buttons: Ext.Msg.OK,\r\n shadow:true,\r\n animEl:Ext.get( 'vm-toolbar' )\r\n });\r\n " . (DEBUG ? "" : "setTimeout('Ext.Msg.hide()', 3000);") . "\r\n };\r\n \r\n // return a public interface\r\n var onSuccess = function(o,c) {\r\n\t\tshowDialog( o.responseText );\r\n\t};\r\n var onFailure = function(o) {\r\n\t\tExt.Msg.alert( 'Error!', 'Save action failed: ' + o.statusText );\r\n\t};\r\n\tvar onCallback=function(o,s,r) {\r\n\t\t//if( s ) alert( 'Success' );\r\n\t\t//else alert( 'Failure' );\r\n\t}\r\n\t\r\n \tExt.Ajax.request( { method: 'POST',\r\n \t\t\t\t\t\turl: '{$_SERVER['PHP_SELF']}',\r\n \t\t\t\t\t\tsuccess: onSuccess,\r\n \t\t\t\t\t\tfailure: onFailure,\r\n \t\t\t\t\t\tcallback: onCallback,\r\n \t\t\t\t\t\tisUpload: true,\r\n \t\t\t\t\t\tform: document.adminForm,\r\n \t\t\t\t\t\tparams: { no_html:1 }\r\n \t\t\t\t\t\t}\r\n \t\t\t\t\t);\r\n\t";
} else {
$script .= "\n\t\t\tsubmitform( pressbutton );\n";
}
$script .= "\t\t}\n";
$bar->buttons .= $script;
if ($page == "product.product_form" && !empty($product_id)) {
if (empty($product_parent_id)) {
// add new attribute
$href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_attribute_form&product_id=" . $product_id . "&limitstart=" . $limitstart . "&no_menu={$no_menu}";
$alt = $VM_LANG->_('PHPSHOP_ATTRIBUTE_FORM_MNU');
$bar->customHref($href, 'new', $alt);
} else {
// back to parent product
$href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
$alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_RETURN_LBL');
$bar->customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt);
// new child product
$href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_parent_id}&limitstart=" . $limitstart . "&no_menu={$no_menu}";
$alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ADD_ANOTHER_ITEM_MNU');
$bar->customHref($href, 'new', $alt);
}
// Go to Price list
$href = $_SERVER['PHP_SELF'] . "?page=product.product_price_list&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&return_args=&option=com_virtuemart&no_menu={$no_menu}";
$alt = $VM_LANG->_('PHPSHOP_PRICE_LIST_MNU');
$bar->customHref($href, 'new', $alt);
// add product type
$href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_product_type_form&product_id={$product_id}&product_parent_id={$product_parent_id}&limitstart={$limitstart}&no_menu={$no_menu}";
$alt = $VM_LANG->_('PHPSHOP_PRODUCT_PRODUCT_TYPE_FORM_MNU');
$bar->customHref($href, 'new', $alt);
/*** Adding an item is only pssible, if the product has attributes ***/
if (ps_product::product_has_attributes($product_id)) {
// Add Item
$href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=product.product_form&product_parent_id={$product_id}&limitstart={$limitstart}&no_menu={$no_menu}";
//.........这里部分代码省略.........
示例15: implode
$where_clause[] = "((`#__{vm}_product`.`product_id`=`#__{vm}_product_price`.`product_id` AND `#__{vm}_shopper_group`.`shopper_group_id`=`#__{vm}_product_price`.`shopper_group_id`) OR `#__{vm}_product_price`.`product_id` IS NULL) ";
$where_clause[] = '`#__{vm}_shopper_group`.`default` = 1';
}
if (empty($keyword)) {
// when someone is searching, we also show child products (product_parent_id != 0), but that's not the case here
$where_clause[] = "`product_parent_id`=0 ";
}
if (!$perm->check("admin,storeadmin")) {
$where_clause[] = "`product_publish`='Y' ";
$where_clause[] = "`category_publish`='Y' ";
if (CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
$where_clause[] = 'product_in_stock > 0';
}
}
$q = implode("\n", $join_array) . ' WHERE ' . implode("\n AND ", $where_clause);
$count .= $q;
$q .= "\n GROUP BY `#__{vm}_product`.`product_sku` ";
$q .= "\n ORDER BY {$orderbyField} {$DescOrderBy}";
// Joomla! 1.5 supports listing "All" items, which means $limit == 0
if (vmIsJoomla(1.5) && $limit == 0) {
$list .= $q;
} else {
$list .= $q . " LIMIT {$limitstart}, " . $limit;
}
//echo $list;
// Store current GET parameters for usage on the product details page navigation
$_SESSION['last_browse_parameters'] = array('category_id' => $category_id, 'manufacturer_id' => $manufacturer_id, 'keyword' => $keyword, 'keyword1' => $keyword1, 'keyword2' => $keyword2, 'featured' => $featured, 'discounted' => $discounted);
if (!empty($product_type_id)) {
$_SESSION['last_browse_parameters']['product_type_id'] = $product_type_id;
}
// BACK TO shop.browse.php !