function importFromVM() { @ob_clean(); echo $this->getHtmlPage(); $this->token = hikashop_getFormToken(); $app = JFactory::getApplication(); flush(); if (isset($_GET['import']) && $_GET['import'] == '1') { $time = microtime(true); $this->vmprefix = $app->getUserState($this->sessionParams . 'vmPrefix'); $this->vm_current_lng = $app->getUserState($this->sessionParams . 'language'); $processed = $this->doImport(); if ($processed) { $elasped = microtime(true) - $time; if (!$this->refreshPage) { echo '<p><a' . $this->linkstyle . ' href="' . hikashop_completeLink('import&task=import&importfrom=vm&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>'; } echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>'; } else { echo '<a' . $this->linkstyle . ' href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>'; } } else { echo $this->getStartPage(); } if ($this->refreshPage == true) { echo "<script type=\"text/javascript\">\r\nr = true; \r\n</script>"; } echo '</body></html>'; exit; }
function importFromRedshop() { @ob_clean(); echo $this->getHtmlPage(); $this->token = hikashop_getFormToken(); flush(); if (isset($_GET['import']) && $_GET['import'] == '1') { $time = microtime(true); $processed = $this->doImport(); if ($processed) { $elasped = microtime(true) - $time; if (!$this->refreshPage) { echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=redshop&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>'; } echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>'; } else { echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>'; } } else { echo $this->getStartPage(); } if ($this->refreshPage) { echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>"; } echo '</body></html>'; exit; }
function fetchElement($name, $value, &$node, $control_name) { if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This plugin can not work without the Hikashop Component'; } $id = hikashop_getCID('id'); if (!empty($id)) { $text = '<a title="' . JText::_('Trigger') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=plugins&task=trigger&function=' . $value . '&cid=' . $id . '&' . hikashop_getFormToken() . '=1') . '" >' . JText::_('Trigger') . '</a>'; } return $text; }
function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!function_exists('hikashop_getCID') && !(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This plugin can not work without the Hikashop Component'; } $id = hikashop_getCID('extension_id'); if (!empty($id)) { $text = '<fieldset class="radio"><a id="' . $this->id . '" title="' . JText::_('Trigger') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=plugins&task=trigger&function=' . $this->value . '&cid=' . $id . '&' . hikashop_getFormToken() . '=1') . '" >' . JText::_('Trigger') . '</a></fieldset>'; } return $text; }
function importFromOpenc() { @ob_clean(); echo $this->getHtmlPage(); $this->token = hikashop_getFormToken(); flush(); if (isset($_GET['import']) && $_GET['import'] == '1') { $app = JFactory::getApplication(); $config = JFactory::getConfig(); $this->opencDatabase = $app->getUserState($this->sessionParams . 'dbName'); $this->opencRootPath = $app->getUserState($this->sessionParams . 'rootPath'); $this->opencPrefix = $app->getUserState($this->sessionParams . 'prefix'); if (HIKASHOP_J30) { $this->hikaDatabaseName = $config->get('db'); } else { $this->hikaDatabaseName = $config->getValue('db'); } $this->importcurrencies = $app->getUserState($this->sessionParams . 'importcurrencies'); if (substr($this->opencRootPath, -1) != '/') { $this->opencRootPath = $this->opencRootPath . '/'; } @(include_once $this->opencRootPath . 'admin/config.php'); $time = microtime(true); $processed = $this->doImport(); if ($processed) { $elasped = microtime(true) - $time; if (!$this->refreshPage) { echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=openc&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>'; } echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>'; } else { echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>'; } } else { echo $this->getStartPage(); } if ($this->refreshPage) { echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>"; } echo '</body></html>'; exit; }
foreach ($this->fields as $field) { $fieldname = $field->field_namekey; if (!empty($address->{$fieldname})) { $html = str_replace('{' . $fieldname . '}', $this->fieldsClass->show($field, @$address->{$fieldname}), $html); } } echo str_replace("\n", "<br/>\n", str_replace("\n\n", "\n", preg_replace('#{(?:(?!}).)*}#i', '', $html))); ?> </span> </td> <td class="hikashop_address_listing_item_actions"> <?php global $Itemid; ?> <a href="<?php echo hikashop_completeLink('address&task=delete&address_id=' . $address->address_id . '&' . hikashop_getFormToken() . '=1&Itemid=' . $Itemid); ?> " title="<?php echo JText::_('HIKA_DELETE'); ?> "><img src="<?php echo HIKASHOP_IMAGES; ?> delete.png" alt="<?php echo JText::_('HIKA_DELETE'); ?> " /></a> <?php echo $this->popup->display('<img src="' . HIKASHOP_IMAGES . 'edit.png" alt="' . JText::_('HIKA_EDIT') . '" />', 'HIKA_EDIT', hikashop_completeLink('address&task=edit&address_id=' . $address->address_id . '&Itemid=' . $Itemid, true), 'hikashop_edit_address_popup_' . $address->address_id, 760, 480, '', '', 'link'); ?> </td>
function form() { $dashboard = false; $config =& hikashop_config(); $widget_id = hikashop_getCID('widget_id'); $class = hikashop_get('class.widget'); $db = JFactory::getDBO(); if (!empty($widget_id)) { $element = $class->get($widget_id); $task = 'edit'; } else { $element = new stdClass(); $element->widget_published = 1; $task = 'add'; $element->widget_params = new stdClass(); $element->widget_params->display = 'line'; $element->widget_params->content = 'sales'; $element->widget_params->date_group = '%j %Y'; $element->widget_params->date_type = 'created'; $element->widget_params->periodType = 'proposedPeriod'; $element->widget_params->proposedPeriod = 'thisMonth'; $element->widget_params->format = 'UTF-8'; $element->widget_params->period_compare = 'none'; $element->widget_name = 'New report ' . $widget_id; $element->widget_params->limit = '7'; } $class->loadDatas($element); if (isset($element->widget_params->table)) { $row_id = count($element->widget_params->table); $this->assignRef('row_id', $row_id); foreach ($element->widget_params->table as $row) { $class->loadDatas($row); } } else { $row_id = 0; $this->assignRef('row_id', $row_id); } if ($element->widget_params->display != 'table') { if ($element->widget_params->display != 'listing' && ($element->widget_params->content == 'products' || $element->widget_params->content == 'categories' || $element->widget_params->content == 'discount')) { $element->widget_params->content = 'orders'; } } hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&widget_id=' . $widget_id); $this->toolbar = array(array('name' => 'link', 'icon' => 'archive', 'alt' => JText::_('HIKA_EXPORT'), 'url' => hikashop_completeLink('report&task=csv&cid[]=' . $widget_id) . '&' . hikashop_getFormToken() . '=1', 'display' => hikashop_level(2) && !empty($widget_id) && hikashop_isAllowed($config->get('acl_report_view', 'all'))), '|', array('name' => 'save', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=') && hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'apply', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form')); $this->assignRef('element', $element); $translation = false; $transHelper = hikashop_get('helper.translation'); if ($transHelper && $transHelper->isMulti()) { $translation = true; $transHelper->load('hikashop_widget', @$element->widget_id, $element); $config =& hikashop_config(); $multilang_display = $config->get('multilang_display', 'tabs'); if ($multilang_display == 'popups') { $multilang_display = 'tabs'; } $tabs = hikashop_get('helper.tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('transHelper', $transHelper); } $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggle', $toggle); $this->assignRef('translation', $translation); $currencyClass = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyClass); $periodType = hikashop_get('type.period'); $this->assignRef('periodType', $periodType); $widget_dataType = hikashop_get('type.widget_data'); $this->assignRef('widget_dataType', $widget_dataType); $status = hikashop_get('type.categorysub'); $status->type = 'status'; $this->assignRef('status', $status); $delay = hikashop_get('type.delay'); $this->assignRef('delay', $delay); $region = hikashop_get('type.region'); $this->assignRef('region', $region); if (hikashop_level(2)) { $encoding = hikashop_get('type.charset'); $this->assignRef('encoding', $encoding); } $widgetClass = hikashop_get('class.widget'); $this->assignRef('widgetClass', $widgetClass); $dateGroup = hikashop_get('type.dategroup'); $this->assignRef('dateGroup', $dateGroup); $dateType = hikashop_get('type.datetype'); $this->assignRef('dateType', $dateType); $shippingMethods = hikashop_get('type.plugins'); $shippingMethods->type = 'shipping'; $shippingMethods->manualOnly = true; $this->assignRef('shippingMethods', $shippingMethods); $paymentMethods = hikashop_get('type.plugins'); $paymentMethods->type = 'payment'; $paymentMethods->manualOnly = true; $this->assignRef('paymentMethods', $paymentMethods); $dashboard = JRequest::getVar('dashboard'); $this->assignRef('dashboard', $dashboard); $nameboxType = hikashop_get('type.namebox'); $this->assignRef('nameboxType', $nameboxType); JHTML::_('behavior.modal'); $script = "\r\n\tfunction deleteRow(divName,inputName,rowName){\r\n\t\tvar d = document.getElementById(divName);\r\n\t\tvar olddiv = document.getElementById(inputName);\r\n\t\tif(d && olddiv){\r\n\t\t\td.removeChild(olddiv);\r\n\t\t\tdocument.getElementById(rowName).style.display='none';\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfunction updatePeriodSelection(){\r\n\t\tselectedPeriod = document.getElementById('display_proposed_period').checked;\r\n\t\tdocument.getElementById('period_start').disabled=false;\r\n\t\tdocument.getElementById('period_end').disabled=false;\r\n\t\tdocument.getElementById('delayvalue1').disabled=false;\r\n\t\tdocument.getElementById('delaytype1').disabled=false;\r\n\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=false;\r\n\t\tif(selectedPeriod==true){\r\n\t\t\tdocument.getElementById('period_start').disabled=true;\r\n\t\t\tdocument.getElementById('period_end').disabled=true;\r\n\t\t\tdocument.getElementById('delayvalue1').disabled=true;\r\n\t\t\tdocument.getElementById('delaytype1').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateCompare(){\r\n\t\tselectedCompare = document.getElementById('compare_with_values').checked;\r\n\t\tdocument.getElementById('compares_order_status').disabled=false;\r\n\t\tdocument.getElementById('compares_order_currency_id').disabled=false;\r\n\t\tdocument.getElementById('compares_order_payment_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_shipping_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_discount_code').disabled=false;\r\n\t\tdocument.getElementById('compares_products').disabled=false;\r\n\t\tdocument.getElementById('compares_categories').disabled=false;\r\n\t\tdocument.getElementById('compare_period').disabled=false;\r\n\t\tif(selectedCompare==true){\r\n\t\t\tdocument.getElementById('compare_period').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('compares_order_status').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_currency_id').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_payment_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_shipping_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_discount_code').disabled=true;\r\n\t\t\tdocument.getElementById('compares_products').disabled=true;\r\n\t\t\tdocument.getElementById('compares_categories').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateDisplayType(){\r\n\t\ttheType=false;\r\n\t\tvalues = new Array('gauge', 'column', 'graph', 'line', 'pie', 'area', 'map', 'listing', 'table');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('widget_display_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\tdisplayType = document.getElementById('widget_display_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='pie'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t\t document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='map'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' || theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('map_options').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='gauge' || displayType=='line' || displayType=='area' || displayType=='graph' || displayType=='column'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType==false){\r\n\t\t\t\ttheType='orders';\r\n\t\t\t \ttheType = document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' || theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='table'){\r\n\t\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='none';\r\n\t\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\tdocument.getElementById('widget_limit').style.display='none';\r\n\t\t\tdocument.getElementById('widget_region').style.display='none';\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t}\r\n\t\tif(displayType!='listing'){ return 0; }\r\n\r\n\t\tvalues = new Array('orders', 'products', 'customers', 'partners', 'categories', 'discounts');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!theType){\r\n\t\t\tdocument.getElementById('type_orders').checked=true;\r\n\t\t\ttheType='orders';\r\n\t\t}\r\n\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\tdocument.getElementById('filters').style.display='none';\r\n\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\tdocument.getElementById('product_datas').style.display='none';\r\n\r\n\t\tif(theType=='orders' || theType=='products' || theType=='categories' || theType=='discounts' || theType=='customers' || theType== 'partners'){\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tdocument.getElementById('product_datas').style.display='';\r\n\t\t\tif(theType=='categories'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='none';\r\n\t\t\t\tclicksValue = document.getElementById('data_clicks').checked;\r\n\t\t\t\tif(clicksValue==true){\r\n\t\t\t\t\tdocument.getElementById('data_orders').checked=true;\r\n\t\t\t\t}\r\n\t\t\t}else if(theType=='products'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(theType=='discounts'){\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t}\r\n\t\tif(theType=='products' || theType=='categories' || theType=='discounts'){\r\n\t\t\tdocument.getElementById('products_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='customers'){\r\n\t\t\tdocument.getElementById('customers_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='partners'){\r\n\t\t\tdocument.getElementById('partners_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='orders'){\r\n\t\t\tdocument.getElementById('orders_options').style.display='';\r\n\t\t}\r\n\r\n\t}\r\n\twindow.hikashop.ready( function(){ updateDisplayType(); });\r\n\twindow.hikashop.ready( function(){ updatePeriodSelection(); });\r\n\twindow.hikashop.ready( function(){ updateCompare(); });\r\n\r\n\t\t\t\t"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($script); $js = ''; $params = $element; echo hikashop_getLayout('dashboard', 'widget', $params, $js); }
function onDisplay($name, $asset = '', $author = '') { $extension = JRequest::getCmd('option'); if (!in_array($extension, array('com_content', 'com_tz_portfolio', 'com_k2'))) { return; } if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return true; } if (version_compare(JVERSION, '1.6.0', '<')) { global $mainframe; $params = JComponentHelper::getParams('com_media'); $acl = JFactory::getACL(); switch ($params->get('allowed_media_usergroup')) { case '1': $acl->addACL('com_media', 'upload', 'users', 'publisher'); break; case '2': $acl->addACL('com_media', 'upload', 'users', 'publisher'); $acl->addACL('com_media', 'upload', 'users', 'editor'); break; case '3': $acl->addACL('com_media', 'upload', 'users', 'publisher'); $acl->addACL('com_media', 'upload', 'users', 'editor'); $acl->addACL('com_media', 'upload', 'users', 'author'); break; case '4': $acl->addACL('com_media', 'upload', 'users', 'publisher'); $acl->addACL('com_media', 'upload', 'users', 'editor'); $acl->addACL('com_media', 'upload', 'users', 'author'); $acl->addACL('com_media', 'upload', 'users', 'registered'); break; } $user = JFactory::getUser(); if (!$user->authorize('com_media', 'popup')) { return; } $doc = JFactory::getDocument(); $template = $mainframe->getTemplate(); $pluginsClass = hikashop_get('class.plugins'); $plugin = $pluginsClass->getByName('editors-xtd', 'hikashopproduct'); $link = 'index.php?option=com_hikashop&ctrl=plugins&task=trigger&function=productDisplay&tmpl=component&cid=' . $plugin->id . '&' . hikashop_getFormToken() . '=1'; JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('PRODUCT')); $button->set('name', 'hikashopproduct'); $button->set('options', "{handler: 'iframe', size: {x: 800, y: 450}}"); $doc = JFactory::getDocument(); if (!HIKASHOP_J30) { JHTML::_('behavior.mootools'); } else { JHTML::_('behavior.framework'); } $img_name = 'hikashopproduct.png'; $path = '../plugins/editors-xtd/' . $img_name; $doc->addStyleDeclaration('.button2-left .hikashopproduct {background: url(' . $path . ') 100% 0 no-repeat; }'); return $button; } else { $app = JFactory::getApplication(); $params = JComponentHelper::getParams('com_media'); $user = JFactory::getUser(); if ($asset == '') { $asset = $extension; } if ($user->authorise('core.edit', $asset) || $user->authorise('core.create', $asset) || count($user->getAuthorisedCategories($asset, 'core.create')) > 0 || $user->authorise('core.edit.own', $asset) && $author == $user->id || count($user->getAuthorisedCategories($extension, 'core.edit')) > 0 || count($user->getAuthorisedCategories($extension, 'core.edit.own')) > 0 && $author == $user->id) { $pluginsClass = hikashop_get('class.plugins'); $plugin = $pluginsClass->getByName('editors-xtd', 'hikashopproduct'); $link = 'index.php?option=com_hikashop&ctrl=plugins&task=trigger&function=productDisplay&editor_name=' . urlencode($name) . '&tmpl=component&cid=' . $plugin->extension_id . '&' . hikashop_getFormToken() . '=1'; JHtml::_('behavior.modal'); $button = new JObject(); $button->set('modal', true); $button->set('link', $link); $button->set('text', JText::_('PRODUCT')); $button->set('class', 'btn'); $button->set('name', 'hikashopproduct'); $button->set('options', "{handler: 'iframe', size: {x: 800, y: 450}}"); $doc = JFactory::getDocument(); if (!HIKASHOP_J30) { JHTML::_('behavior.mootools'); } else { JHTML::_('behavior.framework'); } $img_name = 'hikashopproduct.png'; $path = '../plugins/editors-xtd/hikashopproduct/' . $img_name; $doc->addStyleDeclaration('.button2-left .hikashopproduct {background: url(' . $path . ') 100% 0 no-repeat; }'); return $button; } else { return false; } } }
function displayErrors($id) { static $displayed = false; if (!$displayed) { $displayed = true; $app = JFactory::getApplication(); $app->enqueueMessage(JText::_('MENU_WITHOUT_ASSOCIATED_MODULE')); $app->enqueueMessage(JText::_('ASSOCIATED_MODULE_NEEDED')); $app->enqueueMessage(JText::sprintf('ADD_MODULE_AUTO', hikashop_completeLink('menus&task=add_module&cid=' . $id . '&' . hikashop_getFormToken() . '=1'))); } }
</td> <td> <?php echo $row->file_name; ?> </td> <td width="1%" align="right"> <?php echo (int) @$row->download_number . ' / '; if (!is_numeric($row->file_limit) || $row->file_limit > 0) { echo $row->file_limit; } else { echo JText::_('UNLIMITED'); } if (@$row->download_number) { echo ' <a href="' . hikashop_completeLink('file&task=resetdownload&file_id=' . $row->file_id . '&' . hikashop_getFormToken() . '=1&return=' . urlencode(base64_encode(hikashop_completeLink('product&task=edit&cid=' . @$this->element->product_id, false, true)))) . '"><img src="' . HIKASHOP_IMAGES . 'delete.png" alt="' . JText::_('HIKA_DELETE') . '" /></a>'; } ?> </td> <td width="1%" align="center"> <input type="checkbox" disabled="disabled" <?php echo !empty($row->file_free_download) ? 'checked="checked"' : ''; ?> /> </td> <td width="1%" align="center"> <a href="#" onclick="return deleteRow('file_div_<?php echo $row->file_id . '_' . $id; ?> ','file[<?php echo $row->file_id;
function loadJS() { static $done = false; if ($done) { return true; } $done = true; $current_url = hikashop_currentURL(); $baseUrl = hikashop_completelink('vote&task=save&' . hikashop_getFormToken() . '=1'); $ajaxUrl = hikashop_completelink('vote&task=save', true, true); if (strpos($baseUrl, '?') !== false) { $baseUrl .= '&'; } else { $baseUrl .= '?'; } $config = hikashop_config(); $email_comment = $config->get('email_comment', 0); if ($config->get('enable_status_vote', 0) == 'both') { $vote_comment = 1; } else { $vote_comment = 0; } $note_comment = $config->get('register_note_comment', 0); if ($config->get('access_vote', 0) == 'buyed' || $config->get('access_vote', 0) == 'registered') { $hikashop_vote_con_req = 1; } else { $hikashop_vote_con_req = 0; } $js = ' function trim(myString){ myString = myString.replace(/(^\\s|&)+/g,\'\').replace(/\\s+$/g,\'\').replace(/\\n/g,\'<br \\/>\'); return myString; } function hikashop_vote_useful(hikashop_vote_id,val){ var hikashop_vote_user_id = ""; if(document.getElementById("hikashop_vote_user_id")) hikashop_vote_user_id = document.getElementById("hikashop_vote_user_id").value; var hikashop_vote_note_comment = ' . $note_comment . '; if((hikashop_vote_note_comment == 1 && hikashop_vote_user_id != "") || hikashop_vote_note_comment == 0){ data = "hikashop_vote_type=useful"; data += "&value=" + encodeURIComponent(val); data += "&hikashop_vote_id=" + encodeURIComponent(hikashop_vote_id); data += "&hikashop_vote_user_id=" + encodeURIComponent(hikashop_vote_user_id); window.Oby.xRequest("' . $ajaxUrl . '", {mode: "POST", data: data}, function(xhr) { var el = document.getElementById(hikashop_vote_id); if(xhr.responseText == "1"){el.innerHTML = " ' . JText::_('THANK_FOR_VOTE', true) . '";} else if(xhr.responseText == "3"){el.innerHTML = " ' . JText::_('ALREADY_VOTE_USEFUL', true) . '";} else{el.innerHTML = " ' . JText::_('VOTE_ERROR', true) . '";} }); setTimeout("document.location=\'' . $current_url . '\'",2250); } else{ document.getElementById(hikashop_vote_id).innerHTML = " ' . JText::_('ONLY_REGISTERED_CAN_VOTE', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_id\').innerHTML = \'\'",2250); } } function hikashop_send_vote(hikashop_vote, from){ var re = new RegExp(\'id_(.*?)_hikashop\'); var m = re.exec(from); if(m != null){ var hikashop_vote_ref_id = ""; for (i = 1; i < m.length; i++) { hikashop_vote_ref_id = hikashop_vote_ref_id + m[i] + "\\n"; } }else{ var hikashop_vote_ref_id = document.getElementById("hikashop_vote_ref_id").value; } document.getElementById("hikashop_vote_ok_"+parseInt(hikashop_vote_ref_id)).value = "1"; var hikashop_vote_vote_comment = ' . $vote_comment . '; var hikashop_vote_con_req = ' . $hikashop_vote_con_req . '; var hikashop_vote_user_id = document.getElementById("hikashop_vote_user_id_"+parseInt(hikashop_vote_ref_id)).value; var vote_type = document.getElementById("vote_type_"+parseInt(hikashop_vote_ref_id)).value; var div_vote_status = "hikashop_vote_status_"+parseInt(hikashop_vote_ref_id); if((hikashop_vote_con_req == 1 && hikashop_vote_user_id != "") || hikashop_vote_con_req == 0){ if(hikashop_vote_vote_comment == 1){//User must enter a comment to note a product if(from =="hikashop_vote_rating_id"){ document.getElementById("hikashop_vote_status_form").innerHTML = " ' . JText::_('LET_COMMENT_TO_VALID_VOTE', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); }else{ var el = document.getElementById(div_vote_status); el.innerHTML = " ' . JText::_('LET_COMMENT_TO_VALID_VOTE', true) . '"; setTimeout(function(){el.innerHTML = "";},2250); } } else{// Only vote - sending request to saveFrontend() function, and analysing the result, status(thanks, bought, error) if(from =="hikashop_vote_rating_id"){ var el = document.getElementById("hikashop_vote_status_form"); }else{ var el = document.getElementById(div_vote_status); } data = "vote_type=" + encodeURIComponent(vote_type); data += "&hikashop_vote_type=vote"; data += "&hikashop_vote=" + encodeURIComponent(hikashop_vote); data += "&hikashop_vote_user_id=" + encodeURIComponent(hikashop_vote_user_id); data += "&hikashop_vote_ref_id=" + encodeURIComponent(hikashop_vote_ref_id); window.Oby.xRequest("' . $ajaxUrl . '", {mode: "POST", data: data}, function(xhr) { if(xhr.responseText == "1"){ el.innerHTML = " ' . JText::_('VOTE_UPDATED', true) . '"; setTimeout(function(){el.innerHTML = "";},2250); resetVotes(); } else if(xhr.responseText == "2"){el.innerHTML = " ' . JText::_('THANK_FOR_VOTE', true) . '"; } else if(xhr.responseText == "3"){el.innerHTML = " ' . JText::_('MUST_HAVE_BUY_TO_VOTE', true) . '";} else{el.innerHTML = " ' . JText::_('VOTE_ERROR', true) . '";} }); } } else{ //The user must be registered to vote if(from =="hikashop_vote_rating_id"){ document.getElementById("hikashop_vote_status_form").innerHTML = " ' . JText::_('ONLY_REGISTERED_CAN_VOTE', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); }else{ var el = document.getElementById(div_vote_status); el.innerHTML = " ' . JText::_('ONLY_REGISTERED_CAN_VOTE', true) . '"; setTimeout(function(){el.innerHTML = "";},2250); } } } function hikashop_send_comment(){ //Action on submit comment var hikashop_vote_ref_id = document.getElementById("hikashop_vote_ref_id").value; var hikashop_vote_comment = encodeURIComponent(trim(document.getElementById("hikashop_vote_comment").value)); var vote_type = document.getElementById("vote_type_"+parseInt(hikashop_vote_ref_id)).value; var hikashop_vote_ok = document.getElementById("hikashop_vote_ok_"+parseInt(hikashop_vote_ref_id)).value; var hikashop_vote_vote_comment = ' . $vote_comment . '; var hikashop_vote_con_req = ' . $hikashop_vote_con_req . '; var email_comment_bool = ' . $email_comment . '; var hikashop_vote_user_id = document.getElementById("hikashop_vote_user_id_"+parseInt(hikashop_vote_ref_id)).value; var pseudo_comment = document.getElementById("pseudo_comment").value; var email_comment = document.getElementById("email_comment").value; var reg = new RegExp(\'^[a-z0-9]+([_|\\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\\.|-]{1}[a-z0-9]+)*[\\.]{1}[a-z]{2,6}$\', \'i\'); // TEST EMAIL ADDRESS var verif_mail = reg.test(email_comment); if (hikashop_vote_user_id != ""){verif_mail = true;} if((hikashop_vote_con_req == 1 && hikashop_vote_user_id != "") || hikashop_vote_con_req == 0){ //if connection not required if(pseudo_comment == "" || (email_comment_bool == 1 && verif_mail == false)){ //if not connected if(pseudo_comment == ""){ document.getElementById("hikashop_vote_status_form").innerHTML = "' . JText::_('PSEUDO_REQUIRED', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); }else{ document.getElementById("hikashop_vote_status_form").innerHTML = "' . JText::_('EMAIL_INVALID', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); } }else{ if(hikashop_vote_vote_comment == 1){ // Save comment & vote. var hikashop_vote = document.getElementById("hikashop_vote_rating_id").value; if(hikashop_vote_comment == "" || hikashop_vote_ok == 0){ // Just show a message document.getElementById("hikashop_vote_status_form").innerHTML = "' . JText::_('VOTE_AND_COMMENT_PLEASE', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); }else{ var data = window.Oby.getFormData("hikashop_comment_form"); var regEx = /ctrl=(.*?)&/; data = data.replace(regEx,""); var regEx = /task=(.*?)&/; data = data.replace(regEx,""); var regEx = /limitstart=(.*?)&/; data = data.replace(regEx,""); data += "&hikashop_vote_type=both"; regEx = /hikashop_vote_ref_id/; if(!regEx.test(data)){ data += "&vote_type=" + encodeURIComponent(vote_type); data += "&email_comment=" + encodeURIComponent(email_comment); data += "&pseudo_comment=" + encodeURIComponent(pseudo_comment); data += "&hikashop_vote_user_id=" + encodeURIComponent(hikashop_vote_user_id); data += "&hikashop_vote_ref_id=" + encodeURIComponent(hikashop_vote_ref_id); data += "&hikashop_vote_comment=" + encodeURIComponent(hikashop_vote_comment); } data += "&hikashop_vote=" + encodeURIComponent(hikashop_vote); window.Oby.xRequest("' . $ajaxUrl . '", {mode: "POST", data: data}, function(xhr) { var el = document.getElementById("hikashop_vote_status_form"); if(xhr.responseText == "1"){el.innerHTML = " ' . JText::_('THANKS_FOR_PARTICIPATION', true) . '";document.getElementById("hikashop_vote_comment").value="";} else if(xhr.responseText == "3"){el.innerHTML = " ' . JText::_('MUST_HAVE_BUY_TO_VOTE', true) . '";} else if(xhr.responseText == "2"){el.innerHTML = " ' . JText::_('REACH_LIMIT_OF_COMMENT', true) . '";} else{el.innerHTML = " ' . JText::_('VOTE_ERROR', true) . '";} }); setTimeout("document.location=\'' . $current_url . '\'",2250); } }else if(hikashop_vote_comment != ""){ var data = window.Oby.getFormData("hikashop_comment_form"); var regEx = /ctrl=(.*?)&/; data = data.replace(regEx,""); var regEx = /task=(.*?)&/; data = data.replace(regEx,""); var regEx = /limitstart=(.*?)&/; data = data.replace(regEx,""); data += "&hikashop_vote_type=comment"; regEx = /hikashop_vote_ref_id/; if(!regEx.test(data)){ data += "&vote_type=" + encodeURIComponent(vote_type); data += "&email_comment=" + encodeURIComponent(email_comment); data += "&pseudo_comment=" + encodeURIComponent(pseudo_comment); data += "&hikashop_vote_user_id=" + encodeURIComponent(hikashop_vote_user_id); data += "&hikashop_vote_ref_id=" + encodeURIComponent(hikashop_vote_ref_id); data += "&hikashop_vote_comment=" + encodeURIComponent(hikashop_vote_comment); } window.Oby.xRequest("' . $ajaxUrl . '", {mode: "POST", data: data}, function(xhr) { var el = document.getElementById("hikashop_vote_status_form"); if(xhr.responseText == "1"){el.innerHTML = " ' . JText::_('THANKS_FOR_COMMENT', true) . '";document.getElementById("hikashop_vote_comment").value="";} else if(xhr.responseText == "3"){el.innerHTML = " ' . JText::_('MUST_HAVE_BUY_TO_VOTE', true) . '";} else if(xhr.responseText == "2"){el.innerHTML = " ' . JText::_('REACH_LIMIT_OF_COMMENT', true) . '";} else{el.innerHTML = " ' . JText::_('VOTE_ERROR', true) . '";} }); setTimeout("document.location=\'' . $current_url . '\'",2250); }else{ document.getElementById("hikashop_vote_status_form").innerHTML = " ' . JText::_('PLEASE_COMMENT', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); } } }else{ document.getElementById("hikashop_vote_status_form").innerHTML = " ' . JText::_('ONLY_REGISTERED_CAN_COMMENT', true) . '"; setTimeout("document.getElementById(\'hikashop_vote_status_form\').innerHTML = \'\'",2250); } } '; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration("\n<!--\n" . $js . "\n//-->\n"); if (!HIKASHOP_J30) { JHTML::_('behavior.mootools'); } else { JHTML::_('behavior.framework'); } }
window.productMgr.deleteVariants = function(el, id) { var w = window, d = document, o = w.Oby, ve = window.productMgr.variantEdition, data = ''; if(ve.checked.length == 0) return false; var msg = '<?php echo str_replace('\'', '\\\'', JText::_('PLEASE_CONFIRM_DELETION_X_VARIANTS')); ?> '; if(!confirm(msg.replace('{NUM}', ve.checked.length))) return false; for(var i = ve.checked.length - 1; i >= 0; i--) { if(data.length > 0) data += '&'; data += 'cid[]=' + ve.checked[i]; } o.xRequest('<?php echo hikashop_completeLink('product&task=variants&subtask=delete&product_id=' . $this->product->product_id . '&' . hikashop_getFormToken() . '=1', true, false, true); ?> ', {mode: 'POST', data: data}, function(x,p) { window.productMgr.refreshVariantList(); } ); return false; }; </script> <?php } else { ?> <script type="text/javascript"> if(window.productMgr.variantEdition)
?> _address_buttons"> <?php if ($nb_addresses > 1) { ?> <a onclick="if(!confirm('<?php echo JText::_('HIKASHOP_CONFIRM_DELETE_ADDRESS', true); ?> ')){return false;}else{return true;}" title="<?php echo JText::_('HIKA_DELETE'); ?> " class="hikashop_checkout_<?php echo $this->type; ?> _address_delete" href="<?php echo hikashop_completeLink('checkout&step=' . $this->step . '&redirect=checkout&task=deleteaddress&address_id=' . $address->address_id . '&' . hikashop_getFormToken() . '=1' . $this->url_itemid); ?> "><img alt="<?php echo JText::_('HIKA_DELETE'); ?> " src="<?php echo HIKASHOP_IMAGES; ?> delete.png" border="0" /></a> <?php } ?> <a id="hikashop_checkout_<?php echo $this->type; ?> _address_edit_<?php
private function processOptions(&$options, $mode = 'image') { $t = hikashop_getFormToken(); if (!empty($options['uploader'])) { $params = ''; if (!empty($options['vars'])) { $options['formData'] = $options['vars']; $options['formData'][$t] = 1; foreach ($options['vars'] as $k => $v) { $params .= '&' . urlencode($k) . '=' . urlencode($v); } } if (!empty($options['upload'])) { if (empty($options['upload_base_url'])) { $options['uploadUrls'] = array(0 => hikashop_completeLink('upload&task=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&' . $t . '=1', true), 1 => hikashop_completeLink('upload&task=upload&upload=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1], true, false, true)); } else { $options['uploadUrls'] = array(0 => JRoute::_($options['upload_base_url'] . '&task=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&' . $t . '=1&tmpl=component'), 1 => str_replace('&', '&', JRoute::_($options['upload_base_url'] . '&task=upload&upload=' . $mode . '&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . '&tmpl=component'))); } } if (!empty($options['gallery']) && $mode == 'image') { if (empty($options['upload_base_url'])) { $options['browseUrl'] = hikashop_completeLink('upload&task=galleryimage&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params, true); } else { $options['browseUrl'] = JRoute::_($options['upload_base_url'] . '&task=galleryimage&uploader=' . $options['uploader'][0] . '&field=' . $options['uploader'][1] . $params . '&tmpl=component'); } } } if (empty($options['classes'])) { $options['classes'] = array('mainDiv' => 'hikashop_main_' . $mode . '_div'); } if (!isset($options['classes']['mainDiv'])) { $options['classes']['mainDiv'] = ''; } if (!isset($options['classes']['firstImg'])) { $options['classes']['firstImg'] = 'hikashop_upload_imagethumb_main'; } if (!isset($options['classes']['otherImg'])) { $options['classes']['otherImg'] = 'hikashop_upload_imagethumb_small'; } if (!isset($options['classes']['contentClass'])) { $options['classes']['contentClass'] = ''; } if (empty($options['classes']['btn_upload'])) { $options['classes']['btn_upload'] = 'hika_upload_btn'; } if (empty($options['classes']['btn_add'])) { $options['classes']['btn_add'] = 'hika_add_btn'; } $maxSize = min(hikashop_bytes(ini_get('upload_max_filesize')), hikashop_bytes(ini_get('post_max_size'))); if (empty($options['maxSize'])) { $options['maxSize'] = $maxSize; } else { $size = (int) $options['maxSize']; if ('' . $size != $options['maxSize']) { $size = hikashop_bytes($options['maxSize']); } $options['maxSize'] = min($size, $maxSize); } if (empty($options['uploadUrls'])) { $options['uploadUrls'] = null; } if (empty($options['browseUrl'])) { $options['browseUrl'] = null; } if (empty($options['text'])) { $options['text'] = ''; } if (!empty($options['formData']) && !is_string($options['formData'])) { $options['formData'] = json_encode($options['formData']); } else { $options['formData'] = '{\'' . $t . '\':1}'; } }
function cell() { $url = 'massaction&task=process'; $url .= '&' . hikashop_getFormToken() . '=1'; if (isset($_POST['hikashop'])) { $hikashop = JRequest::getVar('hikashop', ''); $this->params = new stdClass(); $this->params->data = $hikashop['data']; $this->params->table = $hikashop['table']; $this->params->tab_id = $hikashop['tabid']; $this->params->column = $hikashop['column']; if (isset($hikashop['values']) && isset($_POST['data']['values'])) { foreach ($hikashop['values'] as $key => $value) { $values[$key] = $value; } foreach ($_POST['data']['values'] as $key => $value) { $values[$key] = $value; } } else { if (isset($hikashop['values'])) { $values = $hikashop['values']; } else { if (isset($_POST['data']['values'])) { $values = $_POST['data']['values']; } } } $this->params->values = $values; $this->params->action[$this->params->table][$this->params->column] = new stdClass(); $this->params->action[$this->params->table][$this->params->column] = $this->params->column; $this->params->types[$this->params->column] = new stdClass(); $this->params->types[$this->params->column]->type = $hikashop['type']; if (isset($hikashop['dataid'])) { if (!isset($this->dispatcher)) { JPluginHelper::importPlugin('hikashop'); $this->dispatcher = JDispatcher::getInstance(); } $reload = array(); $this->dispatcher->trigger('onReloadPageMassActionAfterEdition', array(&$reload)); $this->assignRef('reload', $reload); $this->params->data_id = $hikashop['dataid']; if (is_array($hikashop['ids'])) { $this->params->ids = $hikashop['ids']; } else { $this->params->ids[] = $hikashop['ids']; } $rows = array(); if (isset($reload[$this->params->table][$this->params->column])) { echo '<script type="text/javascript"> url = \'' . hikashop_completeLink($url, false, true) . '\'; url += \'&cid=\' + document.getElementById(\'cidformmassaction\').value; window.location = url; </script>'; return; } foreach ($this->params->ids as $id) { if (isset($this->params->values[$id])) { $row = $this->_loadResults($this->params->data, $this->params->data_id, $this->params->table, $this->params->column, $hikashop['type'], $id, $this->params->values[$id]); if (is_array($row)) { $rows = $row; break; } else { $rows[] = $row; } } } $table_id = $this->params->table . '_id'; $this->params->ids = array(); echo '<script type="text/javascript">'; foreach ($rows as $row) { foreach ($this->params->values as $id_replaced => $id) { if ($id == $row->{$table_id}) { echo 'modifyLinesData(\'' . $id_replaced . '\',\'' . $this->params->data_id . '\',\'' . $this->params->table . '\',\'' . $row->{$table_id} . '\',\'' . $this->params->tab_id . '\');'; } } $this->params->ids[] = $row->{$table_id}; } echo '</script>'; $currency = hikashop_get('class.currency'); $this->assignRef('currency', $currency); $table = $this->params->table; $this->params->elements = array(); if ($table == $this->params->data) { foreach ($rows as $row) { $this->params->elements[] = $row; } } else { $this->params->elements[0] = new stdClass(); $this->params->elements[0]->{$table} = $rows; } $massaction = hikashop_get('class.massaction'); $this->params = $massaction->sortResult($this->params->table, $this->params); $this->loadFields($this->params); } else { } } }
function process_data_save() { if (isset($_GET['step'])) { $step = JRequest::getInt('step'); $url = 'index.php?option=com_hikashop&ctrl=update&task=process_data_save&' . hikashop_getFormToken() . '=1&step=' . $step; $redirect = 'index.php?option=com_hikashop&ctrl=product&task=add'; $error = false; $app = JFactory::getApplication(); $urlsrc = "http://www.hikashop.com/sampledata/dataexample.zip"; //server URL $destination = '../tmp/dataexample.zip'; //HIKASHOP_ROOT.'tmp\dataexample.zip'; $path = pathinfo(realpath($destination), PATHINFO_DIRNAME); switch ($step) { case 1: //Download zip if (!function_exists('curl_init')) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('CURL_ERROR', $url), 'error'); $error = true; } else { $getContent = false; $curl = curl_init(); curl_setopt($curl, CURLOPT_TIMEOUT, 50); curl_setopt($curl, CURLOPT_URL, $urlsrc); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); $rawdata = curl_exec($curl); $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($httpcode != 200) { $getContent = true; } curl_close($curl); if (file_exists($destination)) { @unlink($destination); } $fhandle = fopen($destination, "x"); try { fwrite($fhandle, $rawdata); fclose($fhandle); } catch (Exception $e) { echo 'fail : ' . $e->getMessage(); $getContent = true; } if ($getContent) { if (!file_put_contents($destination, file_get_contents($urlsrc))) { $app->enqueueMessage(JText::sprintf('WIZZARD_DATA_ERROR', 'downloading', $url), 'error'); $error = true; } } } break; case 2: //Unzip if (HIKASHOP_J30) { jimport('joomla.archive.archive'); } else { jimport('joomla.filesystem.archive'); } $archiveClass = new JArchive(); $zip = $archiveClass->getAdapter('zip'); if (!$zip->extract($destination, $path)) { $app->enqueueMessage(JText::sprintf('WIZZARD_DATA_ERROR', 'unzipping', $url), 'error'); $error = true; } break; case 3: //Copy $config = hikashop_config(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $uploadSecudeFolder = str_replace('/', '\\', $config->get('uploadsecurefolder', 'media/com_hikashop/upload/safe/')); $src = $path . '\\dataexample\\upload\\safe\\'; $dst = HIKASHOP_ROOT . $uploadSecudeFolder; $files = scandir($src, 1); foreach ($files as $f) { if ($f != '..' && $f != '.' && !file_exists($dst . $f)) { if (is_dir($src . $f)) { $ret = JFolder::create($dst . $f); } else { $ret = JFile::copy($src . $f, $dst . $f, '', true); //Overwrite } if (!$ret) { $app->enqueueMessage(JText::sprintf('WIZZARD_DATA_ERROR_COPY', $f, $url), 'error'); } } } $uploadFolder = str_replace('/', '\\', $config->get('uploadfolder', 'images/com_hikashop/upload/')); $src = $path . '\\dataexample\\upload\\'; $dst = HIKASHOP_ROOT . $uploadFolder; $files = scandir($src, 1); foreach ($files as $f) { if ($f != '..' && $f != '.' && !file_exists($dst . $f)) { if (is_dir($src . $f)) { $ret = JFolder::create($dst . $f); } else { $ret = JFile::copy($src . $f, $dst . $f, '', true); //Overwrite } if (!$ret) { $app->enqueueMessage(JText::sprintf('WIZZARD_DATA_ERROR_COPY', $f, $url), 'error'); } } } break; case 4: //exec script $fh = fopen('../tmp/dataexample/script.sql', 'r+') or die("Can't open file /tmp/dataexample/script.sql"); $data = explode("\r\n", fread($fh, filesize('../tmp/dataexample/script.sql'))); $db = JFactory::getDBO(); foreach ($data as $d) { if (!empty($d)) { $db->setQuery($d); try { $db->query(); } catch (Exception $e) { echo 'Fail query : ' . $e->getMessage(); $error = true; $getContent = true; } } } $paypalEmail = $app->getUserState('WIZARD_DATA_SAMPLE_PAYPAL'); if (!empty($paypalEmail)) { $db->setQuery("UPDATE `#__hikashop_payment` SET `payment_published` = '0'"); $db->query(); $db->setQuery("UPDATE `#__hikashop_payment` SET `payment_published` = '1' WHERE `payment_id` = '1'"); $db->query(); } else { $db->setQuery("UPDATE `#__hikashop_payment` SET `payment_published` = '1'"); $db->query(); } $categoryClass = hikashop_get('class.category'); $query = 'SELECT category_namekey,category_left,category_right,category_depth,category_id,category_parent_id FROM `#__hikashop_category` ORDER BY category_left ASC'; $db->setQuery($query); $categories = $db->loadObjectList(); $root = null; $categoryClass->categories = array(); foreach ($categories as $cat) { $categoryClass->categories[$cat->category_parent_id][] = $cat; if (empty($cat->category_parent_id)) { $root = $cat; } } $categoryClass->rebuildTree($root, 0, 1); break; case 5: //Delete everything (try catch ?) jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); if (!JFolder::delete($path . '\\dataexample\\') or !JFile::delete($path . '\\dataexample.zip')) { $app->enqueueMessage(JText::sprintf('WIZZARD_DATA_ERROR', 'deleting', $url), 'error'); $error = true; } break; default: $error = true; break; } $step++; if (!$error) { $redirect = 'index.php?option=com_hikashop&ctrl=update&task=process_data_save&' . hikashop_getFormToken() . '=1&step=' . $step; } if ($step > 5) { $app->enqueueMessage(JText::_('WIZARD_DATA_END')); } $app->redirect($redirect); } }
function __construct() { $this->token = '&' . hikashop_getFormToken() . '=1'; }
echo ' checked="checked"'; } ?> onclick="submitbutton('setdefault');"/> </td> <td> <span> <?php $addressClass = hikashop_get('class.address'); echo $addressClass->displayAddress($this->fields['address'], $address, 'order'); ?> </span> </td> <td> <a href="<?php echo hikashop_completeLink('user&task=deleteaddress&address_id=' . $address->address_id . '&' . hikashop_getFormToken() . '=1'); ?> "><img src="<?php echo HIKASHOP_IMAGES; ?> delete.png"/></a> <?php echo $this->popup->display('<img src="' . HIKASHOP_IMAGES . 'edit.png" alt="' . JText::_('HIKA_EDIT') . '"/>', 'HIKA_EDIT', hikashop_completeLink('user&task=editaddress&user_id=' . $this->user->user_id . '&address_id=' . $address->address_id, true), 'aedit_address_' . $address->address_id . '_link', 760, 480, '', '', 'link'); ?> </td> </tr> <?php } ?> </table> </div>
if (empty($this->coupon)) { echo JText::_('HIKASHOP_ENTER_COUPON'); ?> <input id="hikashop_checkout_coupon_input" type="text" name="coupon" value="" /> <?php echo $this->cart->displayButton(JText::_('ADD'), 'refresh', $this->params, hikashop_completeLink('checkout'), '', ' onclick="return hikashopCheckCoupon(\'hikashop_checkout_coupon_input\');"'); } else { echo JText::sprintf('HIKASHOP_COUPON_LABEL', @$this->coupon->discount_code); global $Itemid; $url_itemid = ''; if (!empty($Itemid)) { $url_itemid = '&Itemid=' . $Itemid; } ?> <a href="<?php echo hikashop_completeLink('checkout&task=step&step=' . ($this->step + 1) . '&previous=' . $this->step . '&removecoupon=1' . '&' . hikashop_getFormToken() . '=1' . $url_itemid); ?> " title="<?php echo JText::_('REMOVE_COUPON'); ?> " > <img src="<?php echo HIKASHOP_IMAGES . 'delete2.png'; ?> " alt="<?php echo JText::_('REMOVE_COUPON'); ?> " /> </a> <?php }
* @copyright (C) 2010-2016 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); $name = $this->type . '_address'; $uniq_id = 'hikashop_address_' . $this->type . '_' . $this->address_id; $pfid = ''; if (!empty($this->fieldset_id)) { $pfid = '&fid=' . $this->fieldset_id; } else { $this->fieldset_id = $uniq_id; } $show_url = 'address&task=show&subtask=' . $this->type . '&cid=' . $this->address_id . $pfid; $save_url = 'address&task=save&subtask=' . $this->type . '&cid=' . $this->address_id . $pfid; $update_url = 'address&task=edit&subtask=' . $this->type . '&cid=' . $this->address_id . $pfid; $delete_url = 'address&task=delete&subtask=' . $this->type . '&cid=' . $this->address_id . '&' . hikashop_getFormToken() . '=1'; ?> <div id="<?php echo $uniq_id; ?> "> <?php if (!isset($this->edit) || $this->edit !== true) { ?> <div class="hika_edit"> <a href="<?php echo hikashop_completeLink($update_url, true); ?> " id="<?php echo $uniq_id; ?>
if (empty($Itemid)) { $urlItemid = JRequest::getInt('Itemid'); if ($urlItemid) { $Itemid = $urlItemid; } } $view = JRequest::getCmd('view'); if (!empty($view) && !JRequest::getCmd('ctrl')) { JRequest::setVar('ctrl', $view); $layout = JRequest::getCmd('layout'); if (!empty($layout)) { JRequest::setVar('task', $layout); } } if (HIKASHOP_J30) { $token = hikashop_getFormToken(); $isToken = JRequest::getVar($token, ''); if (!empty($isToken) && !JRequest::checkToken('request')) { $app = JFactory::getApplication(); $app->input->request->set($token, 1); } } $session = JFactory::getSession(); if (is_null($session->get('registry'))) { jimport('joomla.registry.registry'); $session->set('registry', new JRegistry('session')); } $taskGroup = JRequest::getCmd('ctrl', 'category'); $className = ucfirst($taskGroup) . 'Controller'; if (!class_exists($className) && (!file_exists(HIKASHOP_CONTROLLER . $taskGroup . '.php') || !@(include HIKASHOP_CONTROLLER . $taskGroup . '.php'))) { return JError::raiseError(404, 'Page not found : ' . $taskGroup);
public function display($map, $value, $mode = hikashopNameboxType::NAMEBOX_MULTIPLE, $type = '', $options = array()) { if (empty($type)) { $type = $this->type; } if (empty($type)) { return ''; } $this->load($type); if (!isset($this->types[$type])) { return ''; } $typeConfig = $this->types[$type]; $config = hikashop_config(); $nameboxClass = $this->getClass($typeConfig['class']); if (empty($nameboxClass)) { return ''; } hikashop_loadJslib('otree'); if ($mode == hikashopNameboxType::NAMEBOX_MULTIPLE && isset($options['sort']) && $options['sort'] == true) { hikashop_loadJslib('jquery'); } $id = rtrim(str_replace(array('"', "'", '\\', '[]', '[', ']', '.'), array('', '', '', '', '_', '', '_'), $map), '_'); if (empty($id)) { $id = !empty($options['id']) ? $options['id'] : 'nb_' . uniqid(); } $key = ''; $default_text = !empty($options['default_text']) ? $options['default_text'] : 'HIKA_NONE'; $name = '<em>' . JText::_($default_text) . '</em>'; $cleanText = '<em>' . str_replace("'", "\\'", JText::_($default_text)) . '</em>'; $fullLoad = true; list($elements, $values) = $nameboxClass->getNameboxData($typeConfig, $fullLoad, $mode, $value, null, $options); $displayFormat = ''; if (!empty($typeConfig['displayFormat'])) { $displayFormat = $typeConfig['displayFormat']; } if (!empty($options['displayFormat'])) { $displayFormat = $options['displayFormat']; } $style = ''; if (!empty($options['style'])) { $style = ' style="' . is_array($options['style']) ? implode(' ', $options['style']) : $options['style'] . '"'; } if (!empty($typeConfig['mode']) && $typeConfig['mode'] == 'list' && empty($typeConfig['options']['olist']['table']) && !is_string(reset($elements))) { $n = $typeConfig['name']; foreach ($elements as &$element) { if (!empty($displayFormat)) { $element = $this->getDisplayValue($element, $typeConfig, $options); } else { $element = $element->{$n}; } } unset($element); } $ret = '<div class="nameboxes" id="' . $id . '" onclick="window.oNameboxes[\'' . $id . '\'].focus(\'' . $id . '_text\');"' . $style . '>'; if ($mode == hikashopNameboxType::NAMEBOX_SINGLE) { if (!empty($values)) { $key = $value; $v = $values; if (is_array($values)) { $v = $values[$key]; } $name = $this->getDisplayValue($v, $typeConfig, $options); } $delete = isset($options['delete']) && $options['delete'] == true; $ret .= ' <div class="namebox" id="' . $id . '_namebox"> <input type="hidden" name="' . $map . '" id="' . $id . '_valuehidden" value="' . $key . '"/><span id="' . $id . '_valuetext">' . $name . '</span> ' . (!$delete ? '<a class="editbutton" href="#" onclick="return false;"><span>-</span></a>' : '<a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].clean(this,\'' . $cleanText . '\');return false;"><span>X</span></a>') . ' </div> <div class="nametext"> <input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/> <span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">xxxxxx</span> </div>'; } else { if (substr($map, -2) === '[]') { $map = substr($map, 0, -2); } if (!empty($values)) { $n = $typeConfig['name']; foreach ($values as $key => $name) { $obj = null; if (is_object($name)) { $obj = $name; if (!empty($displayFormat)) { $name = $this->getDisplayValue($obj, $typeConfig, $options); } else { $name = $name->{$n}; } } $ret .= "\r\n" . '<div class="namebox" id="' . $id . '-' . $key . '">' . '<input type="hidden" name="' . $map . '[]" value="' . $key . '"/>' . $name . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'' . $key . '\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>'; } } $ret .= "\r\n" . '<div class="namebox" style="display:none;" id="' . $id . 'tpl">' . '<input type="hidden" name="{map}" value="{key}"/>{name}' . ' <a class="closebutton" href="#" onclick="window.oNameboxes[\'' . $id . '\'].unset(this,\'{key}\');window.oNamebox.cancelEvent();return false;"><span>X</span></a>' . '</div>'; $ret .= "\r\n" . '<div class="nametext">' . '<input id="' . $id . '_text" type="text" style="width:50px;min-width:60px" onfocus="window.oNameboxes[\'' . $id . '\'].focus(this);" onkeyup="window.oNameboxes[\'' . $id . '\'].search(this);" onchange="window.oNameboxes[\'' . $id . '\'].search(this);"/>' . '<span style="position:absolute;top:0px;left:-2000px;visibility:hidden" id="' . $id . '_span">span</span>' . '</div>'; if (!empty($options['force_data'])) { $ret .= '<input type="hidden" name="' . $map . '[]" value=""/>'; } } if (isset($options['add']) && $options['add'] == true) { $ret .= '<div id="' . $id . '_add" style="display:none;float:right"><a href="#" onclick="return window.oNameboxes[\'' . $id . '\'].create(this);"><img src="' . HIKASHOP_IMAGES . 'plus.png" style="vertical-align:middle;margin:0px;padding:0px;" alt="+"/></a></div>'; $ret .= '<div id="' . $id . '_loading" style="display:none;float:right"><img src="' . HIKASHOP_IMAGES . 'spinner.gif" style="vertical-align:middle;margin:0px;padding:0px;" alt="loading..."/></div>'; } $ret .= "\r\n\t" . '<div style="clear:both;float:none;"></div></div>'; $namebox_options = array('mode' => $typeConfig['mode'], 'img_dir' => HIKASHOP_IMAGES, 'map' => $map, 'min' => $config->get('namebox_search_min_length', 3)); if ($mode == hikashopNameboxType::NAMEBOX_MULTIPLE && isset($options['sort']) && $options['sort'] == true) { $namebox_options['sort'] = true; } if (isset($options['add']) && $options['add'] == true && !empty($typeConfig['options']['add_url'])) { $namebox_options['add'] = true; $url = '' . $typeConfig['options']['add_url']; if (!empty($typeConfig['url_params'])) { foreach ($typeConfig['url_params'] as $k) { $p = ''; if (isset($options['url_params'][$k])) { $p = $options['url_params'][$k]; } $url = str_replace('{' . $k . '}', $p, $url); } } $url .= '&' . hikashop_getFormToken() . '=1'; if (substr($url, 0, 10) == 'index.php?') { $namebox_options['add_url'] = str_replace('&', '&', JRoute::_($url)); } else { $namebox_options['add_url'] = hikashop_completeLink($url, false, false, true); } } if ($mode == hikashopNameboxType::NAMEBOX_SINGLE) { $namebox_options['multiple'] = false; $namebox_options['default_text'] = '<em>' . JText::_($default_text) . '</em>'; } if (isset($typeConfig['options'])) { foreach ($typeConfig['options'] as $k => $v) { if (isset($namebox_options[$k])) { continue; } $namebox_options[$k] = $v; } } if (isset($namebox_options['olist']['table'])) { foreach ($namebox_options['olist']['table'] as $k => $v) { $namebox_options['olist']['table'][$k] = JText::_($v); } } if (!$fullLoad) { $url = '' . $typeConfig['url']; if (!empty($typeConfig['url_params'])) { foreach ($typeConfig['url_params'] as $k) { $p = ''; if (isset($options['url_params'][$k])) { $p = $options['url_params'][$k]; } $url = str_replace('{' . $k . '}', $p, $url); } } if (strpos($url, '{displayFormat}') !== false) { $url = str_replace('{displayFormat}', $this->getDisplayFormatId($type, $displayFormat), $url); } $url .= '&search=HIKASEARCH'; if (empty($typeConfig['mode']) || $typeConfig['mode'] == 'list') { if (empty($namebox_options['olist'])) { $namebox_options['olist'] = array(); } $namebox_options['olist']['gradientLoad'] = true; $url .= '&start=HIKASTART'; $namebox_options['url_pagination'] = 'HIKASTART'; } if (substr($url, 0, 10) == 'index.php?') { $namebox_options['url'] = str_replace('&', '&', JRoute::_($url)); } else { $namebox_options['url'] = hikashop_completeLink($url, false, false, true); } $namebox_options['url_keyword'] = 'HIKASEARCH'; } if (isset($namebox_options['tree_url'])) { if (strpos($namebox_options['tree_url'], '{displayFormat}') !== false) { $namebox_options['tree_url'] = str_replace('{displayFormat}', $this->getDisplayFormatId($type, $displayFormat), $namebox_options['tree_url']); } if (substr($namebox_options['tree_url'], 0, 10) == 'index.php?') { $namebox_options['tree_url'] = str_replace('&', '&', JRoute::_($namebox_options['tree_url'])); } else { $namebox_options['tree_url'] = hikashop_completeLink($namebox_options['tree_url'], false, false, true); } } if (!empty($typeConfig['mode']) && $typeConfig['mode'] == 'tree') { $ret .= ' <div class="namebox-popup"> <div id="' . $id . '_otree" style="display:none;" class="oTree namebox-popup-content"></div> </div> <script type="text/javascript"> new window.oNamebox( \'' . $id . '\', ' . json_encode($elements) . ', ' . json_encode($namebox_options) . ' ); </script>'; } else { $ret .= ' <div class="namebox-popup"> <div id="' . $id . '_olist" style="display:none;" class="oList namebox-popup-content"></div> </div> <script type="text/javascript"> new window.oNamebox( \'' . $id . '\', ' . json_encode($elements) . ', ' . json_encode($namebox_options) . ' );'; if (!empty($values) && $mode == hikashopNameboxType::NAMEBOX_MULTIPLE) { $b = array(); foreach ($values as $key => $name) { $b[] = $key; } $ret .= ' try{ window.oNameboxes[\'' . $id . '\'].content.block(' . json_encode($b) . '); }catch(e){}'; } $ret .= ' </script>'; } return $ret; }
}; window.hikashop.openBox('hikashop_editproduct_popup', el.getAttribute('href')); return false; } window.orderMgr.delProduct = function(el, id) { if(confirm("<?php echo JText::_('HIKA_CONFIRM_DELETE_ORDER_PRODUCT'); ?> ")) { var w = window, o = w.Oby; el.parentNode.innerHTML = '<img src="<?php echo HIKASHOP_IMAGES; ?> loading.gif" alt="loading..."/>'; o.xRequest('<?php echo hikashop_completeLink('order&task=product_remove&order_id=' . $this->order->order_id . '&order_product_id=HKPRODID', true, false, true); ?> '.replace('HKPRODID',id), {mode:'POST', data:'<?php echo hikashop_getFormToken(); ?> =1', update: 'hikashop_order_products'}, function() { window.orderMgr.updateAdditional(); window.orderMgr.updateHistory(); o.fireAjax('hikashop.order_update', {el: 'product', type: 'del', obj: id}); }); } return false; } //--> </script>
echo $k; ?> "> <td><?php echo $i; ?> </td> <td> <?php echo $this->popup->display('<img style="vertical-align:middle;" alt="' . JText::_('HIKA_EDIT') . '" src="' . HIKASHOP_IMAGES . 'edit.png"/>', 'HIKA_EDIT', hikashop_completeLink('entry&task=edit&entry_id=' . $entry->entry_id, true), 'hikashop_edit_entry' . $entry->entry_id, 760, 480, '', '', 'link'); ?> <a onclick="return confirm('<?php echo JText::_('VALIDDELETEITEMS', true); ?> ');" href="<?php echo hikashop_completeLink('order&task=deleteentry&entry_id=' . $entry->entry_id . '&' . hikashop_getFormToken() . '=1'); ?> "> <img src="<?php echo HIKASHOP_IMAGES; ?> delete.png"/> </a> </td> <?php if (!empty($this->fields['entry'])) { foreach ($this->fields['entry'] as $field) { $namekey = $field->field_namekey; echo '<td>' . $entry->{$namekey} . '</td>'; } }