* @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()" />
/** * 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; }
/** * 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; }
/** * 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: '******'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; }
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())) { $fileArr[] = array('filename' => $file->data(), 'copy_policy' => $file->attributes('copy')); } else { $vmLogger->err(sprintf($VM_LANG->_('VM_UPDATE_ERR_FILE_MISSING'), $file)); $result = false; } } if ($result === false) { return $result; } if (!empty($xml->queries[0]->query) && is_object($xml->queries[0]->query)) { foreach ($xml->queries[0]->query as $query) { $queryArr[] = $query->data(); } } // 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'] = ''; } } } $returnArr['toversion'] = $toversion; $returnArr['forversion'] = $forversion; $returnArr['description'] = $description; $returnArr['releasedate'] = $releasedate; $returnArr['fileArr'] =& $fileArr; $returnArr['queryArr'] =& $queryArr; return $returnArr; }
$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
<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>
/** * 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 $username = $database->getEscaped(trim($_SESSION['auth']['user_name'])); if (!empty($username)) { $database->setQuery('SELECT username, password FROM `#__users` WHERE `username` = \'' . $username . '\';'); $database->loadObject($user); if (is_object($user)) { // a last security check using the transmitted md5 hash and the rebuilt hash $check = md5($user->username . $user->password . $mosConfig_secret); if ($check === $checkValArr[1]) { // Log the user in with his username $mainframe->login($user->username, $user->password); } } } } } session_write_close(); // Prevent the martID from being displayed in the URL if (!empty($_GET['martID'])) { $query_string = substr_replace(vmGet($_SERVER, 'QUERY_STRING'), '', strpos(vmGet($_SERVER, 'QUERY_STRING'), '&martID')); $url = vmIsHttpsMode() ? SECUREURL : URL; vmRedirect($this->url($url . "index.php?{$query_string}&cartReset=N&redirected=1", true, false, true)); } } } } }
/** * 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; }
/** * 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 .= ','; } $i++; } $config .= " );\n"; } elseif ($key == 'VM_MODULES_FORCE_HTTPS') { $config .= "\n/* Shop Modules that run with https only*/\nglobal \$VM_MODULES_FORCE_HTTPS;\n"; $config .= "\$VM_MODULES_FORCE_HTTPS = array( "; $i = 0; if (empty($d['conf_VM_MODULES_FORCE_HTTPS'])) { $d['conf_VM_MODULES_FORCE_HTTPS'] = array(); } foreach ($d['conf_VM_MODULES_FORCE_HTTPS'] as $https_module) { $config .= "'" . $db->getEscaped($https_module) . "'"; if ($i + 1 < sizeof($d['conf_VM_MODULES_FORCE_HTTPS'])) { $config .= ','; } $i++; } $config .= " );\n"; } elseif ($key == 'VM_CHECKOUT_MODULES') { $config .= "\n// Checkout Steps and their order\nglobal \$VM_CHECKOUT_MODULES;\n"; $config .= "\$VM_CHECKOUT_MODULES = array( "; $i = 0; $max = 0; foreach ($d['VM_CHECKOUT_MODULES'] as $step) { $max = (int) $step['order'] > $max ? (int) $step['order'] : $max; if ($step['name'] == 'CHECK_OUT_GET_FINAL_CONFIRMATION') { $step['order'] = max($max, $step['order']); // In case someone wants the final confirmation not as last step (so we force it to be the last step) } $enabled = !empty($step['enabled']) || $step['name'] == 'CHECK_OUT_GET_PAYMENT_METHOD' || $step['name'] == 'CHECK_OUT_GET_FINAL_CONFIRMATION'; $config .= "'" . $step['name'] . "'=>array('order'=>" . (int) $step['order'] . ",'enabled'=>" . (int) $enabled . ")"; if ($i + 1 < sizeof($d['VM_CHECKOUT_MODULES'])) { $config .= ",\n"; } $i++; } $config .= " );\n"; } elseif ($key == 'PSHOP_OFFLINE_MESSAGE' || $key == 'VM_ONCHECKOUT_LEGALINFO_SHORTTEXT') { $config_val = str_replace("'", "\\'", vmGet($d, $value)); $config .= "define('" . $key . "', '" . $config_val . "');\n"; } else { $config_val = vmGet($d, $value); $config_val = str_replace("'", "\\'", $config_val); $config_val = str_replace("\\\\", "\\\\\\\\", $config_val); $config .= "define('" . $key . "', '" . $config_val . "');\n"; } } $config .= "?>"; file_put_contents(ADMINPATH . "virtuemart.cfg.php", $config); if (!empty($_REQUEST['ajax_request'])) { $vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false)); } else { vmRedirect($_SERVER['PHP_SELF'] . "?page=admin.show_cfg&option=com_virtuemart", $VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS')); } return true; } }
/** * 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; }
* @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();
/** * This allows us to print the user fields on * the various sections of the shop * * @param array $rowFields An array returned from ps_database::loadObjectlist * @param array $skipFields A one-dimensional array holding the names of fields that should NOT be displayed * @param ps_DB $db A ps_DB object holding ovalues for the fields * @param boolean $startform If true, print the starting <form...> tag */ function listUserFields($rowFields, $skipFields = array(), $db = null, $startForm = true) { global $mm_action_url, $ps_html, $VM_LANG, $my, $default, $mainframe, $vm_mainframe, $vendor_country_3_code, $mosConfig_live_site, $mosConfig_absolute_path, $page; $dbf = new ps_DB(); if ($db === null) { $db = new ps_DB(); } $default['country'] = $vendor_country_3_code; $missing = vmGet($_REQUEST, 'missing', ''); // collect all required fields $required_fields = array(); foreach ($rowFields as $field) { if ($field->required == 1) { $required_fields[$field->name] = $field->type; } $allfields[$field->name] = $field->name; } foreach ($skipFields as $skip) { unset($required_fields[$skip]); } // Form validation function if (!vmIsAdminMode()) { ps_userfield::printJS_formvalidation($required_fields, $rowFields); } else { echo vmCommonHTML::scriptTag('', 'function submitregistration() { return true }'); } if (file_exists($mosConfig_absolute_path . '/includes/js/mambojavascript.js')) { $vm_mainframe->addScript('includes/js/mambojavascript.js'); } if ($startForm) { echo '<form action="' . $mm_action_url . basename($_SERVER['PHP_SELF']) . '" method="post" name="adminForm">'; } echo ' <div style="width:90%;">'; if (!empty($required_fields)) { echo '<div style="padding:5px;text-align:center;"><strong>(* = ' . $VM_LANG->_('CMN_REQUIRED') . ')</strong></div>'; } $delimiter = 0; foreach ($rowFields as $field) { if (!isset($default[$field->name])) { $default[$field->name] = $field->default; } $readonly = $field->readonly ? ' readonly="readonly"' : ''; if (in_array($field->name, $skipFields)) { continue; } // Title handling. $key = $field->title; if ($key[0] == '_') { $key = substr($key, 1, strlen($key) - 1); } if ($VM_LANG->exists($key)) { $field->title = $VM_LANG->_($key); } if ($field->name == 'agreed') { $field->title = '<script type="text/javascript">//<![CDATA[ document.write(\'<label for="agreed_field">' . str_replace("'", "\\'", $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS')) . '</label><a href="javascript:void window.open(\\\'' . $mosConfig_live_site . '/index2.php?option=com_virtuemart&page=shop.tos&pop=1\\\', \\\'win2\\\', \\\'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no\\\');">\'); document.write(\' (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')</a>\'); //]]></script> <noscript> <label for="agreed_field">' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '</label> <a target="_blank" href="' . $mosConfig_live_site . '/index.php?option=com_virtuemart&page=shop.tos" title="' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '"> (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ') </a></noscript>'; } if ($field->name == 'username' && VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') { echo '<div class="formLabel"> <input type="checkbox" id="register_account" name="register_account" value="1" class="inputbox" onchange="showFields( this.checked, new Array(\'username\', \'password\', \'password2\') );if( this.checked ) { document.adminForm.remember.value=\'yes\'; } else { document.adminForm.remember.value=\'yes\'; }" checked="checked" /> </div> <div class="formField"> <label for="register_account">' . $VM_LANG->_('VM_REGISTER_ACCOUNT') . '</label> </div> '; } elseif ($field->name == 'username') { echo '<input type="hidden" id="register_account" name="register_account" value="1" />'; } // a delimiter marks the beginning of a new fieldset and // the end of a previous fieldset if ($field->type == 'delimiter') { if ($delimiter > 0) { echo "</fieldset>\n"; } if (VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' && $field->title == $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_INFO_LBL') && $page == 'checkout.index') { continue; } echo '<fieldset> <legend class="sectiontableheader">' . $field->title . '</legend> '; $delimiter++; continue; } echo '<div id="' . $field->name . '_div" class="formLabel '; if (stristr($missing, $field->name)) { echo 'missing'; } echo '">'; echo '<label for="' . $field->name . '_field">' . $field->title . '</label>'; if (isset($required_fields[$field->name])) { echo '<strong>* </strong>'; } echo ' </div> <div class="formField" id="' . $field->name . '_input">' . "\n"; /** * 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]; $month = $date_array[1]; $day = $date_array[2]; } ps_html::list_days('birthday_selector_day', vmRequest::getInt('birthday_selector_day', @$day)); ps_html::list_month('birthday_selector_month', vmRequest::getInt('birthday_selector_month', @$month)); ps_html::list_year('birthday_selector_year', $year, $year - 100, $year); break; case 'captcha': if (file_exists($mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php')) { include $mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php'; // Note that this package name must be used on the validation side too! If both are not equal, validation will fail $packageName = 'securityVMRegistrationCheck'; echo insertSecurityImage($packageName); echo getSecurityImageText($packageName); } else { if (file_exists($mosConfig_absolute_path . '/plugins/system/securityimages.php')) { echo "<script type=\"text/javascript\" src=\"" . JURI::root() . "/components/com_securityimages/js/securityImages.js\"></script>"; echo "<img id='captchaSecurityImages' name='captchaSecurityImages' src=\"" . JURI::root() . "/index.php?option=com_securityimages&task=displayCaptcha\" />"; echo "<a href=\"javascript:askNewSecurityImages('captchaSecurityImages');\">"; echo "<img src=\"" . JURI::root() . "/components/com_securityimages/buttons/reload.gif\" id=\"securityImagesContactCaptchaReload\" name=\"securityImagesContactCaptchaReload\" border=\"0\">"; echo "</a>"; echo "<input type=\"text\" name=\"securityVMRegistrationCheck_try\" />"; } } break; // Begin of a fallthrough // Begin of a fallthrough case 'multicheckbox': case 'select': case 'multiselect': case 'radio': $k = $db->f($field->name); $dbf->setQuery("SELECT fieldtitle,fieldvalue FROM #__{vm}_userfield_values" . "\n WHERE fieldid = " . $field->fieldid . "\n ORDER BY ordering"); $Values = $dbf->loadObjectList(); $multi = ""; $rowFieldValues['lst_' . $field->name] = ''; if ($field->type == 'multiselect') { $multi = "multiple='multiple'"; } if (count($Values) > 0) { if ($field->type == 'radio') { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::radioListTable($Values, $field->name, 'class="inputbox" size="1" ', 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required); } else { $ks = explode("|*|", $k); $k = array(); foreach ($ks as $kv) { $k[]->fieldvalue = $kv; } if ($field->type == 'multicheckbox') { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::checkboxListTable($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required); } else { $rowFieldValues['lst_' . $field->name] = vmCommonHTML::selectList($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k); } } } // no break! still a fallthrough echo $rowFieldValues['lst_' . $field->name]; break; } break; } if ($field->description != '') { echo vmToolTip($field->description); } echo '<br /></div> <br style="clear:both;" />'; } if ($delimiter > 0) { echo "</fieldset>\n"; } echo '</div>'; if (VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') { echo '<script type="text/javascript"> function showFields( show, fields ) { if( fields ) { for (i=0; i<fields.length;i++) { if( show ) { document.getElementById( fields[i] + \'_div\' ).style.display = \'\'; document.getElementById( fields[i] + \'_input\' ).style.display = \'\'; } else { document.getElementById( fields[i] + \'_div\' ).style.display = \'none\'; document.getElementById( fields[i] + \'_input\' ).style.display = \'none\'; } } } } try { showFields( document.getElementById( \'register_account\').checked, new Array(\'username\', \'password\', \'password2\') ); } catch(e){} </script>'; } }
/** * 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}"; $alt = $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL'); $bar->customHref($href, 'new', $alt); } $bar->divider(); } elseif ($page == "admin.country_form") { if (!empty($_REQUEST['country_id'])) { $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}"; $alt = $VM_LANG->_('PHPSHOP_ADD_STATE'); $bar->customHref($href, 'new', $alt); $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}"; $alt = $VM_LANG->_('PHPSHOP_LIST_STATES'); $bar->customHref($href, 'new', $alt); $bar->divider(); } } $bar->save('save', $VM_LANG->_('CMN_SAVE')); //$bar->apply( 'apply', $VM_LANG->_('E_APPLY') ); $bar->cancel(); }
$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 !
" /> <?php if (@VM_SHOW_REMEMBER_ME_BOX == '1') { ?> <br /> <input type="checkbox" name="remember" id="remember_login" value="yes" checked="checked" /> <label for="remember_login"><?php echo $VM_LANG->_('REMEMBER_ME'); ?> </label> <?php } else { ?> <input type="hidden" name="remember" value="yes" /> <?php } ?> <input type="hidden" name="op2" value="login" /> <input type="hidden" name="lang" value="<?php echo vmIsJoomla() ? $mosConfig_lang : $GLOBALS['mosConfig_locale']; ?> " /> <input type="hidden" name="return" value="<?php echo $return_url; ?> " /> <input type="hidden" name="<?php echo $validate; ?> " value="1" /> </form>
/** * Sets the page title * * @param string $title */ function setPageTitle($title) { global $mainframe; $title = strip_tags(str_replace(' ', ' ', $title)); $title = trim($title); if (defined('_VM_IS_BACKEND')) { echo vmCommonHTML::scriptTag('', "//<![CDATA[\n\t\t\tvar vm_page_title=\"" . str_replace('"', '\\"', $title) . "\";\n\t\t\ttry{ parent.document.title = vm_page_title; } catch(e) { document.title =vm_page_title; } \n\t\t\t//]]>\n\t\t\t"); } elseif (vmIsJoomla('1.5')) { $document =& JFactory::getDocument(); $document->setTitle($title); } else { $mainframe->setPageTitle($title); } }
MENU_virtuemart::LISTS_MENU_NEW(); } // For (Un)Publishing Items if (in_array($page, $allowsListPublish)) { MENU_virtuemart::LISTS_MENU_PUBLISH('changePublishState'); } // Delete Items if (!empty($allowsListDeletion[$page])) { vmMenuBar::divider(); vmMenuBar::spacer(); MENU_virtuemart::LISTS_MENU_DELETE($allowsListDeletion[$page]); } vmMenuBar::endTable(); } elseif ($page == "zone.assign_zones") { vmMenuBar::startTable(); vmMenuBar::custom('save', $page, $vmIcons['save_icon'], $vmIcons['save_icon2'], 'Save Zone Assignments', true, "adminForm", 'zoneassign'); vmMenuBar::endTable(); } elseif ($page == "product.product_move") { vmMenuBar::startTable(); vmMenuBar::custom('save', 'product.product_list', $vmIcons['save_icon'], $vmIcons['save_icon2'], 'Move Products', false, "adminForm", 'productMove'); vmMenuBar::spacer(); vmMenuBar::customHref($sess->url($_SERVER['PHP_SELF'] . '?page=product.product_list'), $vmIcons['cancel_icon'], $vmIcons['cancel_icon2'], $VM_LANG->_('CMN_CANCEL')); vmMenuBar::spacer(); vmMenuBar::endTable(); } if (vmIsJoomla(1.5) && $vmLayout != 'extended' && (defined('_VM_IS_BACKEND') && stristr($_SERVER['PHP_SELF'], 'index3.php') || !defined('_VM_IS_BACKEND') && stristr($_SERVER['PHP_SELF'], 'index2.php'))) { $bar =& JToolBar::getInstance('toolbar'); echo $bar->render(); echo '<br class="clr" />'; } }
/** * Function from an old Mambo phpgacl integration function * @deprecated (but necessary, sigh!) * @static * @param string $table * @param string $fields * @param string $groupby * @param int $root_id * @param string $root_name * @param boolean $inclusive * @return array */ function getChildGroups($table, $fields, $groupby = null, $root_id = null, $root_name = null, $inclusive = true) { global $database, $_VERSION; $root = new stdClass(); $root->lft = 0; $root->rgt = 0; if (vmIsJoomla('1.5')) { $fields = str_replace('group_id', 'id', $fields); } if ($root_id) { } else { if ($root_name) { $database->setQuery("SELECT `lft`, `rgt` FROM `{$table}` WHERE `name`='{$root_name}'"); if (vmIsJoomla('1.5') && !defined('_JLEGACY')) { $root = $database->loadObject(); } else { $database->loadObject($root); } } } $where = ''; if ($root->lft + $root->rgt != 0) { if ($inclusive) { $where = "WHERE g1.lft BETWEEN {$root->lft} AND {$root->rgt}"; } else { $where = "WHERE g1.lft BETWEEN {$root->lft}+1 AND {$root->rgt}-1"; } } $database->setQuery("SELECT {$fields}" . "\nFROM {$table} AS g1" . "\nINNER JOIN {$table} AS g2 ON g1.lft BETWEEN g2.lft AND g2.rgt" . "\n{$where}" . ($groupby ? "\nGROUP BY {$groupby}" : "") . "\nORDER BY g1.lft"); $result = $database->loadObjectList(); return is_array($result) ? $result : array(); }
echo $mainframe->getHead(); } ?> <div id="vmMenu"> <div id="content-box2"> <div id="content-pad"> <div class="sidemenu-box"> <div class="sidemenu-pad"> <center> <?php if (!defined('_VM_IS_BACKEND')) { echo '<a href="index.php" title="' . $VM_LANG->_('VM_ADMIN_BACKTOJOOMLA') . '" class="vmicon vmicon-16-back" style="font-weight:bold;">' . $VM_LANG->_('BACK') . '</a> <br /><br />'; } else { if ($vmLayout == 'standard') { $tmpl = vmIsJoomla('1.5', '>=') ? 'component' : ''; ?> [ <strong><?php echo $VM_LANG->_('VM_ADMIN_SIMPLE_LAYOUT'); ?> </strong> | <a href="<?php echo vmGet($_SERVER, 'PHP_SELF') . '?' . (!empty($_SERVER['QUERY_STRING']) ? vmGet($_SERVER, 'QUERY_STRING') : 'option=com_virtuemart&page=' . $page) . '&tmpl=' . $tmpl; ?> &vmLayout=extended"><?php echo $VM_LANG->_('VM_ADMIN_EXTENDED_LAYOUT'); ?> </a> ]<br /> <?php } else { ?>
/** * this function parses all the text through all content plugins * * @param string $text * @param string $type */ function ParseContentByPlugins($text, $type = 'content') { global $_MAMBOTS; if (VM_CONTENT_PLUGINS_ENABLE == '1') { if (vmIsJoomla('1.0')) { $_MAMBOTS->loadBotGroup($type); $row = new stdClass(); $row->text = $text; $params = new mosParameters(''); $_MAMBOTS->trigger('onPrepareContent', array(&$row, &$params, 0), true); $text = $row->text; } elseif (vmIsJoomla('1.5')) { $params =& $GLOBALS['mainframe']->getParams('com_content'); $dispatcher =& JDispatcher::getInstance(); JPluginHelper::importPlugin($type); $row = new stdClass(); $row->text = $text; $results = $dispatcher->trigger('onPrepareContent', array(&$row, &$params, 0)); $text = $row->text; } } return $text; }
/** * Returns a formatted date * * @param int $time TimeStamp format * @param String $dateformat strftime Format String * @return String */ function vmFormatDate($time = 0, $dateformat = '') { global $vendor_date_format; if (empty($time)) { $time = time(); } if (vmIsJoomla('1.5')) { if (empty($dateformat)) { return JHTML::_('date', $time, $vendor_date_format); } else { return JHTML::_('date', $time, $dateformat); } } else { if (empty($dateformat)) { return strftime($vendor_date_format, $time); } else { return strftime($dateformat, $time); } } }
/** * 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, $product_id, $page, $limitstart, $mosConfig_editor, $vmIcons; $bar =& JToolBar::getInstance('toolbar'); $product_id = vmGet($_REQUEST, 'product_id', 0); $no_menu = vmGet($_REQUEST, 'no_menu', 0); $is_iframe = vmGet($_REQUEST, 'is_iframe', 0); $product_parent_id = vmGet($_REQUEST, 'product_parent_id', 0); $script = ''; $clone_product = vmRequest::getInt('clone_product', 0); 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 .= '<script type="text/javascript"> function submitbutton(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 .= "\n\t\t\t\n // define some private variables\n var dialog, showBtn;\n\n // the second argument is true to indicate file upload.\n YAHOO.util.Connect.setForm(form, true);\n \n var showDialog = function( content ) {\n \tExt.MessageBox.show( { \n \t\ttitle: '" . $VM_LANG->_('PEAR_LOG_NOTICE') . "',\n \t\tmsg: content,\n \t\tautoCreate: true,\n width:400,\n height:180,\n modal: false,\n resizable: false,\n buttons: Ext.MessageBox.OK,\n shadow:true,\n animEl:Ext.get( 'vm-toolbar' )\n });\n setTimeout('Ext.MessageBox.hide()', 3000);\n };\n \n // return a public interface\n var callback = {\n \tsuccess: function(o) {\n \t\t//Ext.DomHelper.insertHtml( document.body, o.responseText );\n \t\tshowDialog( o.responseText );\n \t},\n \tfailure: function(o) {\n \t\tExt.DomHelper.append( document.body, { tag: 'div', id: 'vmLogResult', html: 'Save action failed: ' + o.statusText } );\n \t\tshowDialog( o.responseText );\n \t},\n upload : function(o){\n //Ext.DomHelper.insertHtml( 'beforeEnd', document.body, o.responseText );\n \t\tshowDialog( o.responseText );\n }\n };\n \n \tvar cObj = YAHOO.util.Connect.asyncRequest('POST', '{$_SERVER['PHP_SELF']}', callback);\n\t\n\t\t\t\n"; } else { $script .= "\n\t\t\tsubmitform( pressbutton );\n"; } $script .= "\t\t}\n\t\t</script>"; $bar->appendButton('Custom', $script); vmMenuBar::startTable(); if ($page == "product.product_form" && !empty($product_id) && $clone_product != 1) { 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'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); } 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'); vmMenuBar::customHref($href, $vmIcons['back_icon'], $vmIcons['back_icon2'], $alt); vmMenuBar::spacer(); // 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'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); } // 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'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); // 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'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); /*** 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}"; $alt = " " . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_NEW_ITEM_LBL'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); } vmMenuBar::divider(); } elseif ($page == "admin.country_form") { if (!empty($_REQUEST['country_id'])) { $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_form&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}"; $alt = " " . $VM_LANG->_('PHPSHOP_ADD_STATE'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); $href = $_SERVER['PHP_SELF'] . "?option=com_virtuemart&page=admin.country_state_list&country_id=" . intval($_REQUEST['country_id']) . "&limitstart={$limitstart}&no_menu={$no_menu}"; $alt = " " . $VM_LANG->_('PHPSHOP_LIST_STATES'); vmMenuBar::customHref($href, $vmIcons['new_icon'], $vmIcons['new_icon2'], $alt); vmMenuBar::spacer(); vmMenuBar::divider(); } } vmMenuBar::spacer(); vmMenuBar::save('save', $VM_LANG->_('CMN_SAVE')); if ($no_menu == 0) { vmMenuBar::spacer(); vmMenuBar::apply('apply', $VM_LANG->_('E_APPLY')); } if ((strstr(@$_SERVER['HTTP_REFERER'], $page) || strstr(@$_SERVER['HTTP_REFERER'], $_SERVER['PHP_SELF'])) && $no_menu && !$is_iframe) { // offer a back button vmMenuBar::spacer(); vmMenuBar::back(); } vmMenuBar::spacer(); vmMenuBar::cancel(); vmMenuBar::spacer(); vmMenuBar::endTable(); }
if (!defined('_VALID_MOS') && !defined('_JEXEC')) { die('Direct Access to ' . basename(__FILE__) . ' is not allowed.'); } /** * VirtueMart dTree menu * @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html * @ dTree mos menu created by Winfred van Kuijk <*****@*****.**> * @ modified by soeren * @ Uses dTree Javascript: http://www.destroydrop.com/javascripts/tree/ * @ version $Id: mod_dtreemenu.php * * This file is included by the virtuemart module if the module parameter * MenuType is set to treemenu **/ global $root_label, $sess, $db, $mosConfig_live_site, $mm_action_url; if (vmIsJoomla('1.5')) { $js_src = $mosConfig_live_site . '/modules/mod_virtuemart'; } else { $js_src = $mosConfig_live_site . '/modules'; } $Itemid = vmRequest::getInt('Itemid'); if (@get_class($db) != 'ps_DB') { $db = new ps_DB(); } require_once CLASSPATH . "ps_product_category.php"; $ps_product_category = new ps_product_category(); /********************************************************* ************* CATEGORY TREE ****************************** */ /* dTree API, default value * change to fit your needs **/
} else { $lostPwUrl = JRoute::_( 'index.php?option=com_user&view=reset' ); } } else { $lostPwUrl = sefRelToAbs( basename($_SERVER['PHP_SELF']).'?option=com_registration&task=lostPassword' ); } ?> <form action="index.php" method="post" name="login" style="margin-left:20px;"> <label for="username_login" style="vertical-align:top"><?php echo $VM_LANG->_('USERNAME') ?>:</label> <input type="text" id="username_login" name="username" class="inputbox" size="20" /> <br /> <br /> <label for="passwd_login" style="vertical-align:top"><?php echo $VM_LANG->_('PASSWORD') ?>:</label> <input type="password" id="passwd_login" name="passwd" class="inputbox" size="20" /><br /> (<a title="<?php echo $VM_LANG->_('LOST_PASSWORD'); ?>" href="<?php echo $lostPwUrl; ?>"><?php echo $VM_LANG->_('LOST_PASSWORD'); ?></a>) <br /> <br /> <input type="submit" name="Submit" class="button" value="<?php echo $VM_LANG->_('BUTTON_LOGIN') ?>" /> <?php if( @VM_SHOW_REMEMBER_ME_BOX == '1' ) : ?> <br /> <input type="checkbox" name="remember" id="remember_login" value="yes" checked="checked" /> <label for="remember_login"><?php echo $VM_LANG->_('REMEMBER_ME') ?></label> <?php else : ?> <input type="hidden" name="remember" value="yes" /> <?php endif; ?> <input type="hidden" name="option" value="com_user" /> <input type="hidden" name="task" value="login" /> <input type="hidden" name="lang" value="<?php echo vmIsJoomla() ? $mosConfig_lang : $GLOBALS['mosConfig_locale'] ?>" /> <input type="hidden" name="return" value="<?php echo $return_url ?>" /> <input type="hidden" name="<?php echo $validate; ?>" value="1" /> </form>