public function displayMultiple($map, $values) { if (empty($this->values)) { $this->load(); } if (empty($values)) { $values = array(); } else { if (is_string($values)) { $values = explode(',', $values); } } $shopConfig = hikaserial::config(false); hikaserial::loadJslib('otree'); if (substr($map, -2) == '[]') { $map = substr($map, 0, -2); } $id = str_replace(array('[', ']'), array('_', ''), $map); $ret = '<div class="nameboxes" id="' . $id . '" onclick="window.oNameboxes[\'' . $id . '\'].focus(\'' . $id . '_text\');">'; if (!empty($values)) { foreach ($values as $key) { if (isset($this->values[$key])) { $name = $this->values[$key]->text; } else { $name = JText::sprintf('UNKNOWN_PACK_X', $key); } $ret .= '<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 .= '<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 .= '<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>'; $data = array(); foreach ($this->values as $key => $value) { if (empty($key)) { continue; } $data[$key] = $value->text; } $namebox_options = array('mode' => 'list', 'img_dir' => HIKASHOP_IMAGES, 'map' => $map, 'min' => $shopConfig->get('namebox_search_min_length', 3), 'multiple' => true); $ret .= '<div style="clear:both;float:none;"></div></div> <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($data) . ', ' . json_encode($namebox_options) . ' );'; if (!empty($values)) { $ret .= ' try{ window.oNameboxes[\'' . $id . '\'].content.block(' . json_encode($values) . '); }catch(e){}'; } $ret .= ' </script>'; return $ret; }
public function refresh() { $app = JFactory::getApplication(); $orderClass = hikaserial::get('class.order'); $orderId = hikaserial::getCID('order_id'); if (empty($orderId)) { $app->redirect(hikaserial::completeLink('dashboard')); } $orderClass->refresh($orderId); $app->redirect(hikaserial::completeLink('shop.order&task=edit&cid[]=' . $orderId, false, true)); }
public function remove() { JRequest::checkToken() || die('Invalid Token'); $cids = JRequest::getVar('cid', array(), '', 'array'); $serialClass = hikaserial::get('class.serial'); $num = $serialClass->delete($cids); if ($num) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', count($cids)), 'message'); } return parent::listing(); }
public function listing() { hikaserial::setTitle(JText::_(self::name), self::icon, self::ctrl); $buttons = array(array('name' => JText::_('ADD_NEW_SERIAL'), 'url' => hikaserial::completeLink('serial&task=edit'), 'icon' => 'icon-48-add-serials'), array('name' => JText::_('HIKA_SERIALS'), 'url' => hikaserial::completeLink('serial'), 'icon' => 'icon-48-serials'), array('name' => JText::_('HIKA_PACKS'), 'url' => hikaserial::completeLink('pack'), 'icon' => 'icon-48-pack'), array('name' => JText::_('PLUGINS'), 'url' => hikaserial::completeLink('plugins'), 'icon' => 'icon-48-plugin'), array('name' => JText::_('HIKA_CONFIGURATION'), 'url' => hikaserial::completeLink('config'), 'icon' => 'icon-48-config'), array('name' => JText::_('IMPORT'), 'url' => hikaserial::completeLink('import'), 'icon' => 'icon-48-import'), array('name' => JText::_('UPDATE_ABOUT'), 'url' => hikaserial::completeLink('update'), 'icon' => 'icon-48-install'), array('name' => JText::_('HIKA_HELP'), 'url' => hikaserial::completeLink('documentation'), 'icon' => 'icon-48-help_header')); $this->assignRef('buttons', $buttons); if (HIKASHOP_J16 && JFactory::getUser()->authorise('core.admin', 'com_hikamarket')) { $this->toolbar[] = array('name' => 'preferences', 'component' => 'com_hikaserial'); } $this->toolbar[] = array('name' => 'pophelp', 'target' => 'welcome'); $toggleClass = hikaserial::get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); }
public function customTool(&$bar, $toolname, $tool) { switch (strtolower($toolname)) { case 'shopdashboard': $bar->appendButton('Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikaserial::completeLink('shop.dashboard')); return true; case 'dashboard': $bar->appendButton('Link', HIKASERIAL_LNAME, JText::_('HIKASERIAL_CPANEL'), hikaserial::completeLink('dashboard')); return true; } return false; }
public function create($string) { $string = str_replace('&', '&', preg_replace('#(index\\.php\\??)#i', '', $string)); $query = array(); $allValues = explode('&', $string); foreach ($allValues as $oneValue) { list($var, $val) = explode('=', $oneValue); $query[$var] = $val; } $segments = array(); if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (class_exists('hikaserial') || (include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikaserial' . DS . 'helpers' . DS . 'helper.php')) { $shopConfig = hikaserial::config(false); if ($shopConfig->get('activate_sef', 1)) { } } if (isset($query['ctrl'])) { $segments[] = $query['ctrl']; unset($query['ctrl']); if (isset($query['task'])) { $segments[] = $query['task']; unset($query['task']); } } elseif (isset($query['view'])) { $segments[] = $query['view']; unset($query['view']); if (isset($query['layout'])) { $segments[] = $query['layout']; unset($query['layout']); } } if (isset($query['cid']) && isset($query['name'])) { if (is_numeric($query['name'])) { $query['name'] = $query['name'] . '-'; } $segments[] = $query['cid'] . ':' . $query['name']; unset($query['cid']); unset($query['name']); } unset($query['option']); if (isset($query['Itemid'])) { unset($query['Itemid']); } if (!empty($query)) { foreach ($query as $name => $value) { $segments[] = $name . ':' . $value; } } return implode('/', $segments); }
public function display($tpl = null, $title = '', $menu_style = '') { $this->assignRef('title', $title); $this->assignRef('menu_style', $menu_style); $fct = $this->getLayout(); if (method_exists($this, $fct)) { $this->{$fct}(); } $menus = array(array('name' => JText::_('SYSTEM'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-config', 'url' => hikaserial::completeLink('config'), 'children' => array(array('name' => JText::_('HIKA_CONFIGURATION'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-settings', 'url' => hikaserial::completeLink('config')), array('name' => JText::_('PLUGINS'), 'check' => 'ctrl=plugins', 'icon' => 'icon-16-plugin', 'url' => hikaserial::completeLink('plugins')), array('name' => JText::_('VIEWS'), 'check' => 'ctrl=views', 'icon' => 'icon-16-views', 'url' => hikaserial::completeLink('shop.view&component=' . HIKASERIAL_COMPONENT)))), array('name' => JText::_('HIKA_SERIALS'), 'check' => 'ctrl=serial', 'acl' => 'serial', 'icon' => 'icon-16-serial', 'url' => hikaserial::completeLink('serial'), 'children' => array(array('name' => JText::_('HIKA_PACKS'), 'check' => 'ctrl=pack', 'icon' => 'icon-16-pack', 'url' => hikaserial::completeLink('pack')), array('name' => JText::_('HIKA_SERIALS'), 'check' => 'ctrl=serial', 'icon' => 'icon-16-serial', 'url' => hikaserial::completeLink('serial')), array('name' => JText::_('IMPORT'), 'check' => 'ctrl=import', 'icon' => 'icon-16-import', 'url' => hikaserial::completeLink('import')))), array('name' => JText::_('HIKA_HELP'), 'check' => 'ctrl=documentation', 'icon' => 'icon-16-help', 'url' => hikaserial::completeLink('documentation'), 'children' => array(array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'icon' => 'icon-16-help', 'url' => hikaserial::completeLink('documentation')), array('name' => JText::_('UPDATE_ABOUT'), 'check' => 'ctrl=update', 'icon' => 'icon-16-update', 'url' => hikaserial::completeLink('update')), array('name' => JText::_('FORUM'), 'check' => 'support/forum.html', 'icon' => 'icon-16-info', 'url' => HIKASERIAL_URL . 'support/forum.html')))); $this->checkActive($menus); $this->assignRef('menus', $menus); parent::display(null); }
public function onAfterSerialConsume(&$serial) { $user = hikaserial::loadUser(true); $cms_id = $user->user_cms_id; $ids = array(); parent::listPlugins('groupconsumer', $ids, false); foreach ($ids as $id) { parent::pluginParams($id); if ($this->plugin_params->pack_id == $serial->serial_pack_id) { $this->updateGroup($cms_id, $this->plugin_params->group_id); } } }
private function showIframe($url) { $config = hikaserial::config(); $shopConfig = hikaserial::config(false); $menu_style = $shopConfig->get('menu_style', 'title_bottom'); if (HIKASHOP_J30) { $menu_style = 'content_top'; } if ($menu_style == 'content_top') { echo hikaserial::getMenu(); } echo '<div id="hikaserial_div"><iframe allowtransparency="true" scrolling="auto" height="450px" frameborder="0" width="100%" name="hikaserial_frame" id="hikaserial_frame" ' . 'src="' . $url . '&level=' . $config->get('level') . '&component=' . HIKASERIAL_LNAME . '&version=' . $config->get('version') . '"></iframe></div>'; }
public function processView(&$view) { if (empty($view->menus)) { return; } $currentuser = JFactory::getUser(); if (HIKASHOP_J16 && !$currentuser->authorise('core.manage', 'com_hikaserial')) { return; } $market = array('name' => HIKASERIAL_NAME, 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-serial', 'url' => hikaserial::completeLink('dashboard'), 'children' => array(array('name' => JText::_('HIKA_CONFIGURATION'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-settings', 'url' => hikaserial::completeLink('config'), 'display' => !HIKASHOP_J16 || $currentuser->authorise('core.admin', 'com_hikaserial')), array('name' => JText::_('PLUGINS'), 'check' => 'ctrl=plugins', 'icon' => 'icon-16-plugin', 'url' => hikaserial::completeLink('plugins')), array('name' => JText::_('VIEWS'), 'check' => 'ctrl=views', 'icon' => 'icon-16-views', 'url' => hikaserial::completeLink('shop.view&component=' . HIKASERIAL_COMPONENT)), array('name' => ''), array('name' => JText::_('HIKA_PACKS'), 'check' => 'ctrl=pack', 'icon' => 'icon-16-pack', 'url' => hikaserial::completeLink('pack')), array('name' => JText::_('HIKA_SERIALS'), 'check' => 'ctrl=serial', 'icon' => 'icon-16-serial', 'url' => hikaserial::completeLink('serial')), array('name' => JText::_('IMPORT'), 'check' => 'ctrl=import', 'icon' => 'icon-16-import', 'url' => hikaserial::completeLink('import')), array('name' => ''), array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'icon' => 'icon-16-help', 'url' => hikaserial::completeLink('documentation')), array('name' => JText::_('UPDATE_ABOUT'), 'check' => 'ctrl=update', 'icon' => 'icon-16-update', 'url' => hikaserial::completeLink('update')), array('name' => JText::_('FORUM'), 'check' => 'support/forum.html', 'icon' => 'icon-16-info', 'url' => HIKASERIAL_URL . 'support/forum.html'))); $newMenus = array(&$market); $this->checkActive($newMenus, 0, HIKASERIAL_COMPONENT); $last = array_pop($view->menus); array_push($view->menus, $market, $last); }
public function delete($elements) { $status = parent::delete($elements); if ($status) { $app = JFactory::getApplication(); $orderClass = hikaserial::get('helper.order'); $orderClass->pkey = 'consumer_id'; $orderClass->table = 'consumer'; $orderClass->groupMap = 'consumer_type'; $orderClass->orderingMap = 'consumer_ordering'; $orderClass->groupVal = $app->getUserStateFromRequest(HIKASERIAL_COMPONENT . '.consumer_plugin_type', 'consumer_plugin_type', ''); $orderClass->reOrder(); } return $status; }
public function fetchButton($type = 'Popup', $name = '', $text = '', $url = '', $width = 640, $height = 480, $top = 0, $left = 0, $onClose = '', $title = '', $footer = '') { if (empty($title) && empty($footer)) { return parent::fetchButton($type, $name, $text, $url, $width, $height, $top, $left, $onClose); } JHtml::_('behavior.modal'); $text = JText::_($text); $class = $this->fetchIconClass($name); $doTask = $url; //$this->_getCommand($name, $url, $width, $height, $top, $left); $id = 'modal-toolbar-' . $name; $popup = hikaserial::get('shop.helper.popup'); $params = array('width' => $width, 'height' => $height, 'type' => 'link', 'footer' => $footer); $html = $popup->displayMootools('<span class="' . $class . '"></span>' . $text, $title, $doTask, $id, $params); return $html; }
function listing() { hikaserial::setTitle(JText::_(self::name), self::icon, self::ctrl); $bar = JToolBar::getInstance('toolbar'); $bar->appendButton('Link', HIKASERIAL_LNAME, JText::_('HIKASHOP_CPANEL'), hikaserial::completeLink('dashboard')); $config = hikaserial::config(); $level = $config->get('level'); $url = HIKASERIAL_HELPURL . 'documentation&level=' . $level; $shopConfig = hikaserial::config(false); $menu_style = $shopConfig->get('menu_style', 'title_bottom'); if (HIKASHOP_J30) { $menu_style = 'content_top'; } if ($menu_style == 'content_top') { echo hikaserial::getMenu(); } echo '<div id="hikaserial_div"><iframe allowtransparency="true" scrolling="auto" height="450px" frameborder="0" width="100%" name="hikaserial_frame" id="hikaserial_frame" src="' . $url . '"></iframe></div>'; }
private function importTextarea() { $content = JRequest::getVar('textareaimport_content', '', '', 'string', JREQUEST_ALLOWRAW); $this->helper->pack_id = JRequest::getInt('textareaimport_pack'); $productClass = hikaserial::get('class.product'); $importAsCsv = JRequest::getInt('textareaimport_as_csv', 0); if ($importAsCsv == 0) { if ($this->helper->pack_id == 0) { return false; } $ret = $this->helper->handleTextContent($content); $productClass->refreshQuantities(); return $ret; } $ret = $this->helper->handleCsvContent($content); $productClass->refreshQuantities(); return $ret; }
public function useselection() { if (!hikaserial::initMarket()) { return false; } if (!hikamarket::loginVendor()) { return false; } $marketConfig = hikamarket::config(); if (!$marketConfig->get('frontend_edition', 0)) { return false; } if (!hikamarket::acl('product_edit_plugin_hikaserial')) { return hikamarket::deny('vendor', JText::sprintf('HIKAM_ACTION_DENY', JText::sprintf('HIKAM_ACT_PLUGIN', HIKASERIAL_NAME))); } JRequest::setVar('layout', 'useselection'); return parent::display(); }
public function shop_form($params = null) { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $config = hikaserial::config(); $this->assignRef('config', $config); $data = null; $product_id = 0; if (!empty($params)) { $product_id = (int) $params->get('product_id'); } if ($product_id > 0) { $query = 'SELECT a.*, b.* FROM ' . hikaserial::table('product_pack') . ' as a INNER JOIN ' . hikaserial::table('pack') . ' as b ON a.pack_id = b.pack_id WHERE a.product_id = ' . $product_id; $db->setQuery($query); $data = $db->loadObjectList(); } $this->assignRef('data', $data); $this->assignRef('product_id', $product_id); }
public function display($map, $values, $allBtn = false, $min = false) { hikaserial::loadJslib('otree'); if (empty($this->groups)) { $this->load(); } $map = str_replace('"', '', $map); $id = str_replace(array('[', ']', ' '), array('_', '', '_'), $map); $cpt = count($this->groups) - 1; $ret = '<div id="' . $id . '_otree" class="oTree"></div><input type="hidden" value="' . $values . '" name="' . $map . '" id="' . $id . '"/> <script type="text/javascript"> var data_' . $id . ' = ' . $this->getData($values, $allBtn, $min) . '; ' . $id . ' = new window.oTree("' . $id . '",{rootImg:"' . HIKASHOP_IMAGES . 'otree/", showLoading:false, useSelection:false, checkbox:true},null,data_' . $id . ',true); ' . $id . '.callbackCheck = function(treeObj, id, value) { var node = treeObj.get(id), d = document, e = d.getElementById("' . $id . '"); if(node.state == 5) { if(value === true) { treeObj.chks("*",false); e.value = "all"; } else if(value === false) { treeObj.chks(false,false,true); e.value = "none"; } } else { var v = treeObj.getChk(); node = treeObj.get(0); if(v === false || v.length == 0) { e.value = "none"; treeObj.chk(1,0,false,false); } else if( v.length > ' . $cpt . ') { e.value = "all"; treeObj.chk(1,1,false,false); } else { e.value = v.join(","); treeObj.config.tricheckbox = true; treeObj.chk(1,2,false,false); treeObj.config.tricheckbox = false; } } }; </script>'; return $ret; }
public function configurationLine($id = 0, $conf = null) { if (empty($this->toggleHelper)) { $this->toggleHelper = hikaserial::get('helper.toggle'); } switch ($id) { case 'pack': if (empty($this->packs)) { $db = JFactory::getDBO(); $db->setQuery('SELECT * FROM ' . hikaserial::table('pack')); $this->packs = $db->loadObjectList('pack_id'); } $ret = array(); if (!empty($conf->plugin_params->pack_id) && isset($this->packs[(int) $conf->plugin_params->pack_id])) { return '<a href="' . hikaserial::completeLink('pack&task=edit&cid=' . (int) $conf->plugin_params->pack_id) . '">' . $this->packs[(int) $conf->plugin_params->pack_id]->pack_name . '</a>'; } } return null; }
public function show($params = null, $viewName = 'email-notification') { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $config = hikaserial::config(); $this->assignRef('config', $config); $data = null; $order_id = 0; if (!empty($params)) { $order_id = (int) $params->get('order_id'); } $display_serial_statuses = $config->get('display_serial_statuses', ''); if (empty($display_serial_statuses)) { $display_serial_statuses = array($config->get('used_serial_status', 'used')); } else { $display_serial_statuses = explode(',', $display_serial_statuses); } foreach ($display_serial_statuses as &$s) { $s = $db->Quote($s); } unset($s); if ($order_id > 0) { $query = 'SELECT a.*, b.*, c.* FROM ' . hikaserial::table('serial') . ' as a ' . 'INNER JOIN ' . hikaserial::table('pack') . ' as b ON a.serial_pack_id = b.pack_id ' . 'LEFT JOIN ' . hikaserial::table('shop.order_product') . ' as c ON a.serial_order_product_id = c.order_product_id ' . 'WHERE a.serial_status IN (' . implode(',', $display_serial_statuses) . ') AND a.serial_order_id = ' . $order_id; $db->setQuery($query); $data = $db->loadObjectList(); } JPluginHelper::importPlugin('hikaserial'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onDisplaySerials', array(&$data, $viewName)); if (!empty($data)) { foreach ($data as &$serial) { if (!isset($serial->serial_text_data)) { $serial->serial_text_data = $serial->serial_data; $serial->serial_data = str_replace(array("\r\n", "\r", "\n"), '<br/>', $serial->serial_data); } unset($serial); } } $this->assignRef('data', $data); $this->assignRef('order_id', $order_id); }
public function onBeforeSerialConsume(&$serial, $user_id, &$do, &$extra_data) { $user = hikaserial::loadUser(true); $ids = array(); parent::listPlugins('groupfilterconsumer', $ids, false); if (!$do) { return; } foreach ($ids as $id) { parent::pluginParams($id); if (in_array($serial->serial_pack_id, $this->plugin_params->packs_id)) { if (empty($user) || empty($user->user_cms_id)) { $do = false; } if (!empty($this->plugin_params->groups)) { $valid_groups = explode(',', trim($this->plugin_params->groups, ',')); foreach ($valid_groups as &$g) { $g = (int) $g; } unset($g); if (!HIKASHOP_J16) { $joomla_user = clone JFactory::getUser($user->user_cms_id); $userGroups = array($joomla_user->gid); } else { jimport('joomla.access.access'); $userGroups = JAccess::getGroupsByUser($user->user_cms_id, true); } $f = false; foreach ($userGroups as $g) { if (in_array($g, $valid_groups)) { $f = true; break; } } if (!$f) { $do = false; } } } } }
public function coupon() { $app = JFactory::getApplication(); global $Itemid; $url_itemid = ''; if (!empty($Itemid)) { $url_itemid = '&Itemid=' . $Itemid; } $this->assignRef('url_itemid', $url_itemid); $config = hikaserial::config(); $this->assignRef('config', $config); $shopConfig = hikaserial::config(false); $this->assignRef('shopConfig', $shopConfig); $cart = $this->params->view->initCart(); if (isset($cart->coupon)) { $this->assignRef('coupon', $cart->coupon); } $this->assignRef('step', $this->params->view->step); $cartHelper = hikaserial::get('shop.helper.cart'); $this->assignRef('cartHelper', $cartHelper); }
public function onDisplaySerials(&$data, $viewName) { if ($viewName == 'back-serial-form') { return; } $n = 'plg.seriesgen'; $l = strlen($n) + 1; $packs = array(); foreach ($data as &$serial) { if (substr($serial->pack_generator, 0, $l) != $n . '-') { continue; } $id = (int) substr($serial->pack_generator, $l); $packs[$id] = $id; } unset($serial); if (!empty($packs)) { $this->db->setQuery('SELECT * FROM ' . hikaserial::table('generator') . ' WHERE generator_type = \'seriesgen\' AND generator_id IN (' . implode(',', $packs) . ')'); $confs = $this->db->loadObjectList('generator_id'); foreach ($confs as &$conf) { if (!empty($conf->generator_params)) { $conf->generator_params = unserialize($conf->generator_params); } unset($conf); } } foreach ($data as &$serial) { if (substr($serial->pack_generator, 0, $l) != $n . '-') { continue; } $id = (int) substr($serial->pack_generator, $l); if (!isset($confs[$id]) || empty($confs[$id]->generator_params->format)) { continue; } $format = $confs[$id]->generator_params->format; $serial->serial_data = sprintf($format, (int) $serial->serial_data); } unset($serial); return; }
public function fetchButton($type = 'Pophelp', $namekey = '', $id = 'pophelp') { $doc = JFactory::getDocument(); $config = hikaserial::config(); $level = $config->get('level'); $url = HIKASERIAL_HELPURL . $namekey . '&level=' . $level; $js = ' function displayDoc(){ var d = document, init = false, b = d.getElementById("iframedoc"); if(!b) return true; if(typeof(b.openHelp) == "undefined") { b.openHelp = true; init = true; } if(b.openHelp) { b.innerHTML = \'<iframe src="' . $url . '" width="100%" height="100%" style="border:0px" border="no" scrolling="auto"></iframe>\'; b.setStyle("display","block"); } try { if(typeof(b.fxEffect) == "undefined") { b.fxEffect = b.effects({duration: 1500, transition: Fx.Transitions.Quart.easeOut}); } if(b.openHelp){ if(init) { b.height = 0; b.style.height = 0; } b.fxEffect.stop(); b.fxEffect.start({height: 300}); }else{ b.fxEffect.stop(); b.fxEffect.start({height: 0}).chain(function() { b.innerHTML = ""; b.setStyle("display", "none"); }); } } catch(err) { if(typeof(b.vslide) == "undefined") { b.vslide = new Fx.Slide("iframedoc"); } if(b.openHelp){ if(init) { b.vslide.hide(); } b.vslide.slideIn(); }else{ b.vslide.slideOut().chain(function() { b.innerHTML = ""; b.setStyle("display", "none"); }); } } b.openHelp = !b.openHelp; return false; }'; $doc->addScriptDeclaration($js); if (!HIKASHOP_J30) { return '<a href="' . $url . '" target="_blank" onclick="return displayDoc();" class="toolbar"><span class="icon-32-help" title="' . JText::_('HIKA_HELP', true) . '"></span>' . JText::_('HIKA_HELP') . '</a>'; } return '<button class="btn btn-small" onclick="return displayDoc();"><i class="icon-help"></i> ' . JText::_('HIKA_HELP') . '</button>'; }
public function beforeMailSend(&$mail, &$mailer) { $orderEmails = array('order_creation_notification' => 1, 'order_notification' => 1, 'order_status_notification' => 1); $mail_name = $mail->mail_name; if (isset($mail->hikamarket) && !empty($mail->hikamarket)) { $mail_name = 'market.' . $mail_name; } if (!isset($orderEmails[$mail_name])) { return; } if (empty($mail->data->order_id) || (int) $mail->data->order_id == 0) { return; } $config = hikaserial::config(); $display_serial_statuses = $config->get('display_serial_statuses', ''); if (empty($display_serial_statuses)) { $display_serial_statuses = array($config->get('used_serial_status', 'used')); } else { $display_serial_statuses = explode(',', $display_serial_statuses); } $statuses = array(); foreach ($display_serial_statuses as $s) { $statuses[] = $this->db->Quote($s); } $serials = array(); if (!empty($mail->data->order_id)) { $query = 'SELECT s.*, p.*, op.product_id ' . ' FROM ' . hikaserial::table('serial') . ' AS s ' . ' INNER JOIN ' . hikaserial::table('pack') . ' AS p ON s.serial_pack_id = p.pack_id ' . ' LEFT JOIN ' . hikaserial::table('shop.order_product') . ' AS op ON op.order_product_id = s.serial_order_product_id AND op.order_id = s.serial_order_id ' . ' WHERE s.serial_status IN (' . implode(',', $statuses) . ') AND s.serial_order_id = ' . (int) $mail->data->order_id . ' ' . ' ORDER BY s.serial_id'; $this->db->setQuery($query); $serials = $this->db->loadObjectList(); } if (!empty($serials)) { JPluginHelper::importPlugin('hikaserial'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeSerialMailSend', array(&$mail, &$mailer, &$serials, $mail->data)); } }
private function sendCustomEmail($serials, &$order) { $send_serials = array(); $custom_field_value = ''; list($type, $custom_field) = explode('.', $this->plugin_params->custom_field, 2); if (!in_array($type, array('order', 'item'))) { return false; } if ($type == 'order') { foreach ($serials as $k => $serial) { if (is_string($this->plugin_params->packs) && strpos(',' . $this->plugin_params->packs . ',', ',' . $serial->serial_pack_id . ',') === false) { continue; } if (is_array($this->plugin_params->packs) && !in_array($serial->serial_pack_id, $this->plugin_params->packs)) { continue; } $send_serials[] = $serial; } if (!empty($order->{$custom_field})) { $custom_field_value = $order->{$custom_field}; } } if ($type == 'item') { $send_serials[] = $serials; foreach ($order->products as $k => $product) { if ((int) $product->order_product_id == (int) $serials->serial_order_product_id) { if (!empty($product->{$custom_field})) { $custom_field_value = $product->{$custom_field}; } break; } } } $custom_field_value = trim($custom_field_value); if (empty($custom_field_value)) { return false; } if (!preg_match('/^([a-z0-9_\'&\\.\\-\\+=])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+$/i', $custom_field_value)) { return false; } $data = new stdClass(); $data->serials = $send_serials; $data->dest_email = $custom_field_value; $data->order =& $order; $mailClass = hikaserial::get('class.mail'); $mail = $mailClass->load('mailtocustomfield', $data); if (empty($mail)) { return false; } if (!empty($this->plugin_params->call_attachserial)) { $attachserialPlugin = hikaserial::import('hikaserial', 'attachserial'); $attachserialPlugin->onBeforeSerialMailSend($mail, $mail->mailer, $send_serials, $order); } $mail->subject = JText::sprintf($mail->subject, HIKASERIAL_LIVE); $shopConfig =& hikaserial::config(false); if (empty($mail->from_email)) { $mail->from_email = $shopConfig->get('from_email'); $mail->from_name = $shopConfig->get('from_name'); } if (empty($mail->reply_email)) { $mail->reply_email = $shopConfig->get('from_email'); $mail->reply_name = $shopConfig->get('from_name'); } if (empty($mail->dst_email)) { $mail->dst_email = $custom_field_value; } if (empty($mail->dst_name)) { $mail->dst_name = $custom_field_value; } $mailClass->sendMail($mail); return true; }
private function givePoints($user_id, $points, $data = null, $mode = null) { if ($points === 0) { return true; } $points_mode = @$this->plugin_params->mode; if ($mode !== null) { $points_mode = $mode; } if ($points_mode == 'aup') { if ($this->getAUP(true)) { $aupid = AlphaUserPointsHelper::getAnyUserReferreID($user_id); AlphaUserPointsHelper::newpoints('plgaup_orderValidation', $aupid, '', $data, $points); return true; } return false; } if ($points_mode == 'hks') { if (hikaserial::initShop()) { $app = JFactory::getApplication(); $ret = true; $userClass = hikaserial::get('shop.class.user'); $oldUser = $userClass->get($user_id, 'cms'); if (!isset($oldUser->user_points) && !in_array('user_points', array_keys(get_object_vars($oldUser)))) { return false; } if (empty($oldUser->user_points)) { $oldUser->user_points = 0; } $user = new stdClass(); $user->user_id = $oldUser->user_id; $user->user_points = (int) $oldUser->user_points + $points; if ($user->user_points < 0) { $app->enqueueMessage(JText::_('CANT_HAVE_NEGATIVE_POINTS'), 'error'); $points = -$oldUser->user_points; $user->user_points = 0; $ret = false; } else { $app->enqueueMessage(JText::sprintf('HIKAPOINTS_EARN_X_POINTS', $points), 'success'); } $userClass->save($user); return $ret; } return false; } if ($points_mode == 'hkp') { if (hikaserial::initPoints()) { return hikapoints::trigger($user_id, 'hikaserial_points_consumer', $points); } return false; } if (substr($points_mode, 0, 4) == 'hkp.') { if (hikaserial::initPoints()) { $category_id = (int) substr($points_mode, 4); $pointsClass = hikapoints::get('class.points'); return $pointsClass->add($user_id, $category_id, $points); } return false; } return false; }
public function useselection() { $users = JRequest::getVar('cid', array(), '', 'array'); $rows = array(); $data = ''; $elemStruct = array('user_email', 'user_cms_id', 'name', 'username', 'email'); if (!empty($users)) { JArrayHelper::toInteger($users); $db = JFactory::getDBO(); $query = 'SELECT a.*, b.* FROM ' . hikaserial::table('user', 'shop') . ' AS a LEFT JOIN ' . hikaserial::table('users', false) . ' AS b ON a.user_cms_id = b.id WHERE a.user_id IN (' . implode(',', $users) . ')'; $db->setQuery($query); $rows = $db->loadObjectList(); if (!empty($rows)) { $data = array(); foreach ($rows as $v) { $d = '{id:' . $v->user_id; foreach ($elemStruct as $s) { if ($s == 'id') { continue; } $d .= ',' . $s . ':"' . str_replace('"', '\\"', $v->{$s}) . '"'; } $data[] = $d . '}'; } $data = '[' . implode(',', $data) . ']'; } } $this->assignRef('rows', $rows); $this->assignRef('data', $data); $confirm = JRequest::getVar('confirm', true, '', 'boolean'); $this->assignRef('confirm', $confirm); if ($confirm) { $js = 'window.addEvent("domready", function(){window.top.hikaserial.submitBox(' . $data . ');});'; $doc = JFactory::getDocument(); $doc->addScriptDeclaration($js); } }
function generateCoupon($allresults, $i, $user, $send) { $db =& JFactory::getDBO(); $packClass = hikaserial::get('class.pack'); $config = hikaserial::config(); $generator = null; $serials = array(); $order = null; list($pack_id, $serial_status) = explode('|', $allresults[1][$i]); if (empty($serial_status)) { $serial_status = $config->get('used_serial_status', 'used'); } $pack = $packClass->get($pack_id); if (substr($pack->pack_generator, 0, 4) == 'plg.') { $pluginName = substr($pack->pack_generator, 4); if (strpos($pluginName, '-') !== false) { list($pluginName, $pluginId) = explode('-', $pluginName, 2); $pack->{$pluginName} = $pluginId; } $generator = hikaserial::import('hikaserial', $pluginName); } if ($generator != null && method_exists($generator, 'generate')) { if (!$send) { $generator->test = true; } ob_start(); $generator->generate($pack, $order, 1, $serials); ob_get_clean(); } if ($send && !empty($serials)) { $serial = reset($serials); $extra_data = ''; if (is_object($serial)) { if (!empty($serial->extradata)) { $extra_data = serialize($serial->extradata); } $serial = $serial->data; } $data = array('serial_pack_id' => (int) $pack_id, 'serial_data' => $db->Quote($serial), 'serial_status' => $db->Quote($serial_status), 'serial_assign_date' => 'NULL', 'serial_order_id' => 'NULL', 'serial_user_id' => 'NULL', 'serial_order_product_id' => 'NULL', 'serial_extradata' => $db->Quote($extra_data)); $query = 'INSERT IGNORE INTO ' . hikaserial::table('serial') . ' (' . implode(',', array_keys($data)) . ') VALUES (' . implode(',', $data) . ')'; $db->setQuery($query); $db->query(); unset($query); return $serial; } elseif (!empty($serials)) { $serial = reset($serials); if (is_object($serial)) { $serial = $serial->data; } return $serial; } return ''; }
</td> <td><?php echo $this->serialStatusType->get($history->history_new_status); ?> </td> <td><?php if (!empty($history->history_user_id)) { $class = hikaserial::get('shop.class.user'); $user = $class->get($history->history_user_id); echo $user->username . ' / '; } echo $history->history_ip; ?> </td> <td><?php echo hikaserial::getDate($history->history_created, '%Y-%m-%d %H:%M'); ?> </td> <td><?php echo $history->history_data; ?> </td> </tr> <?php } } ?> </tbody> </table> </fieldset> <?php
?> </label></td> <td> <input style="width:100%" type="text" name="data[plugin][plugin_params][image_path]" value="<?php echo @$this->element->plugin_params->image_path; ?> "/> <?php if (!empty($this->element->plugin_params->image_path)) { $file_path = $this->element->plugin_params->image_path; $realfilepath = HIKASERIAL_ROOT . $file_path; if (!JFile::exists($realfilepath)) { $realfilepath = null; } if (empty($realfilepath)) { $shopConfig = hikaserial::config(false); $uploadFolder = ltrim(JPath::clean(html_entity_decode($shopConfig->get('uploadfolder'))), DS); $realfilepath = JPATH_ROOT . DS . rtrim($uploadFolder, DS) . DS . $file_path; if (!JFile::exists($realfilepath)) { $realfilepath = null; } } if (empty($realfilepath)) { $realfilepath = $file_path; if (!JFile::exists($file_path)) { $realfilepath = null; } } $display_filename = '<span class="attachserial_filename">' . $file_path . '</span>'; $extension = strtolower(substr($file_path, strrpos($file_path, '.') + 1)); if (!empty($realfilepath) && !in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))) {