for ($x = $start_page_number; $x <= $end_page_number; $x++) { if ($p == $x) { $results['pagination']['page_number'][$x]['link'] = 0; $results['pagination']['page_number'][$x]['number'] = $x; } else { $results['pagination']['page_number'][$x]['link'] = $x; $results['pagination']['page_number'][$x]['number'] = $x; } } $results['pagination']['current_p'] = $p; if ($totpage == $p) { $results['pagination']['next'] = false; $results['pagination']['last'] = false; } else { $results['pagination']['next'] = $p + 1; } $results['pagination']['firstText'] = mslib_befe::strtoupper($this->pi_getLL('first')); $results['pagination']['first'] = mslib_befe::strtoupper($this->pi_getLL('first')); $results['pagination']['prevText'] = mslib_befe::strtoupper($this->pi_getLL('previous')); $results['pagination']['nextText'] = mslib_befe::strtoupper($this->pi_getLL('next')); $results['pagination']['last'] = mslib_befe::strtoupper($this->pi_getLL('last')); $results['pagination']['lastText'] = mslib_befe::strtoupper($this->pi_getLL('last')); $data['resultSet'] = $results; //$data['sql_dump']=$this->msDebugInfo; $content = json_encode($data); if ($this->ms['MODULES']['CACHE_FRONT_END']) { $Cache_Lite->save($content); } } echo $content; exit;
public function loadLanguages() { $this->linkVars = $GLOBALS['TSFE']->linkVars; $useSysLanguageTitle = trim($this->conf['useSysLanguageTitle']) ? trim($this->conf['useSysLanguageTitle']) : 0; $useIsoLanguageCountryCode = trim($this->conf['useIsoLanguageCountryCode']) ? trim($this->conf['useIsoLanguageCountryCode']) : 0; $useIsoLanguageCountryCode = $useSysLanguageTitle ? 0 : $useIsoLanguageCountryCode; $useSelfLanguageTitle = trim($this->conf['useSelfLanguageTitle']) ? trim($this->conf['useSelfLanguageTitle']) : 0; $useSelfLanguageTitle = $useSysLanguageTitle || $useIsoLanguageCountryCode ? 0 : $useSelfLanguageTitle; $tableA = 'sys_language'; $tableB = 'static_languages'; $languagesUidsList = trim($this->cObj->data['tx_srlanguagemenu_languages']) ? trim($this->cObj->data['tx_srlanguagemenu_languages']) : trim($this->conf['languagesUidsList']); $languages = array(); $languagesLabels = array(); // Set default language $defaultLanguageISOCode = trim($this->conf['defaultLanguageISOCode']) ? mslib_befe::strtoupper(trim($this->conf['defaultLanguageISOCode'])) : 'EN'; $this->ms['MODULES']['COUNTRY_ISO_NR'] = trim($this->conf['defaultCountryISOCode']) ? mslib_befe::strtoupper(trim($this->conf['defaultCountryISOCode'])) : ''; $languages[] = mslib_befe::strtolower($defaultLanguageISOCode) . ($this->ms['MODULES']['COUNTRY_ISO_NR'] ? '_' . $this->ms['MODULES']['COUNTRY_ISO_NR'] : ''); $this->languagesUids[] = '0'; // Get the language codes and labels for the languages set in the plugin list $selectFields = $tableA . '.uid, ' . $tableA . '.title, ' . $tableB . '.*'; $table = $tableA . ' LEFT JOIN ' . $tableB . ' ON ' . $tableA . '.flag=' . $tableB . '.cn_iso_2'; // Ignore IN clause if language list is empty. This means that all languages found in the sys_language table will be used if (!empty($languagesUidsList)) { $whereClause = $tableA . '.uid IN (' . $languagesUidsList . ') '; } else { $whereClause = '1=1 '; } $whereClause .= $this->cObj->enableFields($tableA); $whereClause .= $this->cObj->enableFields($tableB); //$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($selectFields, $table, $whereClause); // If $languagesUidsList is not empty, the languages will be sorted in the order it specifies $languagesUidsArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $languagesUidsList, 1); $index = 0; $str = "select * from sys_language where hidden=0 order by title"; $res = $GLOBALS['TYPO3_DB']->sql_query($str); while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $key++; $languages[$key] = $row['uid']; $languagesLabels[$key]['key'] = $row['uid']; $languagesLabels[$key]['flag'] = $row['flag']; if ($row['flag']) { if ($this->cookie['multishop_admin_language'] == $row['uid']) { $this->cookie['multishop_admin_language'] = $row['flag']; } } $languagesLabels[$key]['value'] = $row['title']; $this->languages[$key]['value'] = $row['title']; $this->languagesUids[$key] = $row['uid']; } }
for ($i = 1; $i <= $end_date; $i++) { $time = strtotime(date($i . '-' . $s . '-' . $select_year)); $dates[strftime("%a. %x", $time)] = $time; } } $col = 0; $col_char = 'A'; $phpexcel->getActiveSheet()->setCellValueByColumnAndRow($col, 5, mslib_befe::strtoupper($this->pi_getLL('day'))); $phpexcel->getActiveSheet()->getColumnDimension($col_char)->setWidth(16); $col_char++; $col++; $phpexcel->getActiveSheet()->setCellValueByColumnAndRow($col, 5, mslib_befe::strtoupper($this->pi_getLL('amount'))); $phpexcel->getActiveSheet()->getColumnDimension($col_char)->setWidth(16); $col_char++; $col++; $phpexcel->getActiveSheet()->setCellValueByColumnAndRow($col, 5, mslib_befe::strtoupper($this->pi_getLL('orders_id'))); $phpexcel->getActiveSheet()->mergeCells('C5:N5'); $row = 6; $col = 0; //echo "<pre>"; //print_r($dates); //die(); foreach ($dates as $key => $value) { $total_price = 0; $current_date = date('d', $value); if ($current_date == '01') { $phpexcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, date('F', $value)); $phpexcel->getActiveSheet()->getStyle('A' . $row)->applyFromArray($header_style); $phpexcel->getActiveSheet()->mergeCells('A' . $row . ':N' . $row); $row++; }
$value = "140x150"; $key = 'PRODUCT_IMAGE_SIZE_' . mslib_befe::strtoupper($width); if (!isset($settings['GLOBAL_MODULES'][$key])) { $str = "INSERT INTO `tx_multishop_configuration` (`id`, `configuration_title`, `configuration_key`, `configuration_value`, `description`, `group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES('', 'Product image size (" . $width . ")', '" . $key . "', '" . $value . "', 'The maximum " . $type . " in pixels for the " . $width . " image folder.', 2, NULL, NULL, now(), NULL, '');"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); } $width = 300; $value = "350x300"; $key = 'PRODUCT_IMAGE_SIZE_' . mslib_befe::strtoupper($width); if (!isset($settings['GLOBAL_MODULES'][$key])) { $str = "INSERT INTO `tx_multishop_configuration` (`id`, `configuration_title`, `configuration_key`, `configuration_value`, `description`, `group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES('', 'Product image size (" . $width . ")', '" . $key . "', '" . $value . "', 'The maximum " . $type . " in pixels for the " . $width . " image folder.', 2, NULL, NULL, now(), NULL, '');"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); } $width = 'enlarged'; $value = "600x400"; $key = 'PRODUCT_IMAGE_SIZE_' . mslib_befe::strtoupper($width); if (!isset($settings['GLOBAL_MODULES'][$key])) { $str = "INSERT INTO `tx_multishop_configuration` (`id`, `configuration_title`, `configuration_key`, `configuration_value`, `description`, `group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES('', 'Product image size (" . $width . ")', '" . $key . "', '" . $value . "', 'The maximum " . $type . " in pixels for the " . $width . " image folder.', 2, NULL, NULL, now(), NULL, '');"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); } // meta $key = 'META_TITLE'; if (!isset($settings['GLOBAL_MODULES'][$key])) { $str = "INSERT INTO `tx_multishop_configuration` (`id`, `configuration_title`, `configuration_key`, `configuration_value`, `description`, `group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES('', 'Meta Title', '" . $key . "', 'Webshop Title', 'The title of the webshop, used for the Meta Tags.', 3, NULL, NULL, now(), NULL, '');"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); } $key = 'META_DESCRIPTION'; if (!isset($settings['GLOBAL_MODULES'][$key])) { $str = "INSERT INTO `tx_multishop_configuration` (`id`, `configuration_title`, `configuration_key`, `configuration_value`, `description`, `group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES('', 'Meta Description', '" . $key . "', 'Description of the webshop.', 'The description of the webshop, used for the Meta Tags.', 3, NULL, NULL, now(), NULL, '');"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); }
public function currencyConverter($from_Currency, $to_Currency, $amount) { // add static so the rate is only requested one time, while processing the PHP script static $currencyArray; // hook $use_google = true; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['currencyConverter'])) { $params = array('currencyArray' => &$currencyArray, 'use_google' => &$use_google, 'from_Currency' => $from_Currency, 'to_Currency' => $to_Currency); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['currencyConverter'] as $funcRef) { \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this); } } // hook eof if ((!is_array($currencyArray) or !isset($currencyArray[$from_Currency][$to_Currency])) && $use_google) { // fetch currency $amount = urlencode($amount); $from_Currency = urlencode($from_Currency); $to_Currency = urlencode($to_Currency); $url = 'http://www.google.com/finance/converter?a=1&from=' . mslib_befe::strtoupper($from_Currency) . '&to=' . mslib_befe::strtoupper($to_Currency); $ch = curl_init(); $timeout = 0; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)"); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $rawdata = curl_exec($ch); curl_close($ch); $pattern = '/<span class=bld>(.*)<\\/span>/isUm'; preg_match_all($pattern, $rawdata, $matches); $rate = ''; if (isset($matches[1][0]) && !empty($matches[1][0])) { $rate = str_replace(' ' . mslib_befe::strtoupper($to_Currency), '', $matches[1][0]); } $currencyArray[$from_Currency][$to_Currency] = $rate; } return round($amount * $currencyArray[$from_Currency][$to_Currency], 3); }
} else { $markerArray['###DELIVERY_COMPANY###'] = ''; } if (!empty($order['delivery_building'])) { $markerArray['###DELIVERY_BUILDING###'] = '<strong>' . $order['delivery_building'] . '</strong><br/>'; } else { $markerArray['###DELIVERY_BUILDING###'] = ''; } $markerArray['###DELIVERY_NAME###'] = $order['delivery_name']; $markerArray['###DELIVERY_BUILDING###'] = $order['delivery_building']; if (strpos($template, '###DELIVERY_BUILDING###') === false && $order['delivery_building'] != '') { $order['delivery_address'] = $order['delivery_building'] . '<br/>' . $order['delivery_address']; } $markerArray['###DELIVERY_ADDRESS###'] = $order['delivery_address']; $markerArray['###DELIVERY_ZIP###'] = $order['delivery_zip']; $markerArray['###DELIVERY_CITY###'] = mslib_befe::strtoupper($order['delivery_city']); $markerArray['###DELIVERY_COUNTRY###'] = ''; if (mslib_befe::strtolower($order['billing_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) { // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP $markerArray['###DELIVERY_COUNTRY###'] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']); } $markerArray['###LABEL_CUSTOMER_ID###'] = $this->pi_getLL('admin_customer_id'); $markerArray['###CUSTOMER_ID###'] = $order['customer_id']; $markerArray['###LABEL_ORDER_ID###'] = $this->pi_getLL('orders_id'); $markerArray['###ORDER_ID###'] = $order['orders_id']; $markerArray['###LABEL_ORDER_DATE###'] = $this->pi_getLL('admin_order_date'); $markerArray['###ORDER_DATE###'] = strftime("%x", $order['crdate']); $markerArray['###LABEL_PACKINGSLIP_PAYMENT_METHOD###'] = ''; $markerArray['###PACKINGSLIP_PAYMENT_METHOD###'] = ''; if ($order['payment_method_label']) { $markerArray['###LABEL_PACKINGSLIP_PAYMENT_METHOD###'] = $this->pi_getLL('payment_method');
while ($row2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry2)) { $enabled_countries[] = $row2; } // load enabled countries to array eof $country_block = ''; if (count($enabled_countries) == 1) { $country_block .= '<input name="country" id="country" type="hidden" value="' . mslib_befe::strtolower($enabled_countries[0]['cn_short_en']) . '" />'; } else { $country_block .= '<div class="account-field col-sm-8" id="input-country"> <label for="country" id="account-country">' . ucfirst($this->pi_getLL('country')) . '<span class="text-danger">*</span></label>'; $default_country = mslib_fe::getCountryByIso($this->ms['MODULES']['COUNTRY_ISO_NR']); if (!$this->post) { $this->post['country'] = $default_country['cn_short_en']; } foreach ($enabled_countries as $country) { $tmpcontent .= '<option value="' . mslib_befe::strtoupper($country['cn_short_en']) . '" ' . (mslib_befe::strtolower($this->post['country']) == mslib_befe::strtolower($country['cn_short_en']) ? 'selected' : '') . '>' . htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $country['cn_short_en'])) . '</option>'; } if ($tmpcontent) { $country_block .= '<select name="country" id="country" class="country" required="required"> <option value="">' . ucfirst($this->pi_getLL('choose_country')) . '</option> ' . $tmpcontent . ' </select>'; } $country_block .= '</div>'; } // $markerArray['###INPUT_COUNTRY_BLOCK###'] = $country_block; // $markerArray['###LABEL_ZIP###'] = ucfirst($this->pi_getLL('zip')) . '<span class="text-danger">*</span>'; $markerArray['###VALUE_ZIP###'] = htmlspecialchars($this->post['zip']); $markerArray['###LABEL_ADDRESS###'] = ucfirst($this->pi_getLL('street_address')) . '<span class="text-danger">*</span>';
function WriteHTML($html) { //HTML parser $html = str_replace("\n", ' ', $html); $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($a as $i => $e) { if ($i % 2 == 0) { //Text if ($this->HREF) { $this->PutLink($this->HREF, $e); } else { $this->Write(5, $e); } } else { //Tag if ($e[0] == '/') { $this->CloseTag(mslib_befe::strtoupper(substr($e, 1))); } else { //Extract attributes $a2 = explode(' ', $e); $tag = mslib_befe::strtoupper(array_shift($a2)); $attr = array(); foreach ($a2 as $v) { if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) { $attr[mslib_befe::strtoupper($a3[1])] = $a3[2]; } } $this->OpenTag($tag, $attr); } } } }
mslib_befe::cacheLite('save', $string, $lifetime, 1, $tmp); } } $this->ms['MODULES'] = $tmp; // make sure the page title always have default delimeter value, when config not yet updated if (!isset($this->ms['MODULES']['PAGE_TITLE_DELIMETER'])) { $this->ms['MODULES']['PAGE_TITLE_DELIMETER'] = ' :: '; } $this->ms = mslib_befe::convertConfiguration($this->ms); //if ($this->ms['MODULES']['CACHE_FRONT_END'] or $this->ms['MODULES']['GLOBAL_MODULES']['CACHE_FRONT_END']) require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop').'res/Cache_Lite-1.7.8/Lite.php'); //if ($this->ADMIN_USER) { // load enabled languages $enabled_countries = array(); if ($this->ms['MODULES']['ENABLED_LANGUAGES']) { // if this setting is defined we must not enable all TYPO3 languages, but only the ones that are defined in this variable $this->ms['MODULES']['ENABLED_LANGUAGES'] = mslib_befe::strtoupper($this->ms['MODULES']['ENABLED_LANGUAGES']); if (strstr($this->ms['MODULES']['ENABLED_LANGUAGES'], " ")) { $this->ms['MODULES']['ENABLED_LANGUAGES'] = str_replace(" ", "", $this->ms['MODULES']['ENABLED_LANGUAGES']); } $enabled_countries = explode(",", $this->ms['MODULES']['ENABLED_LANGUAGES']); } $this->languages = array(); $str = "select sl.flag, sl.uid, sl.title, sli.lg_iso_2 from sys_language sl, static_languages sli where sl.hidden=0 and sl.static_lang_isocode=sli.uid"; $qry = $GLOBALS['TYPO3_DB']->sql_query($str); while (($language = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($qry)) != false) { if (count($enabled_countries) and in_array($language['lg_iso_2'], $enabled_countries) or !count($enabled_countries)) { $this->languages[$language['uid']] = $language; } } // add default language id 0 $this->languages[0]['uid'] = 0;
} $groups = mslib_fe::getUserGroups($this->conf['fe_customer_pid']); $customer_groups_input = ''; $customer_groups_input .= '<select id="groups" class="invoice_select2" name="usergroup">' . "\n"; $customer_groups_input .= '<option value="0">' . $this->pi_getLL('all') . '</option>' . "\n"; if (is_array($groups) and count($groups)) { foreach ($groups as $group) { $customer_groups_input .= '<option value="' . $group['uid'] . '"' . ($this->get['usergroup'] == $group['uid'] ? ' selected="selected"' : '') . '>' . $group['title'] . '</option>' . "\n"; } } $customer_groups_input .= '</select>' . "\n"; $searchCharNav = '<div id="msAdminSearchByCharNav" class="no-mb"><ul class="pagination">'; $chars = array(); $chars = array('0-9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', 'all'); foreach ($chars as $char) { $searchCharNav .= '<li><a href="' . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[searchByChar]=' . $char . '&tx_multishop_pi1[page_section]=admin_customers') . '">' . mslib_befe::strtoupper($char) . '</a></li>'; } $searchCharNav .= '</ul></div>'; $user_countries = mslib_befe::getRecords('', 'fe_users f', '', array(), 'f.country', 'f.country asc'); $fe_user_country = array(); foreach ($user_countries as $user_country) { if (!empty($user_country['country'])) { $cn_localized_name = htmlspecialchars(mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $user_country['country'])); $fe_user_country[$cn_localized_name] = $fe_user_countries[] = '<option value="' . mslib_befe::strtolower($user_country['country']) . '" ' . (mslib_befe::strtolower($this->get['country']) == mslib_befe::strtolower($user_country['country']) ? 'selected' : '') . '>' . $cn_localized_name . '</option>'; } } ksort($fe_user_country); $user_countries_sb = '<select class="invoice_select2" name="country" id="country""><option value="">' . $this->pi_getLL('all') . '</option>' . implode("\n", $fe_user_country) . '</select>'; $formTopSearch = ' <form id="form1" name="form1" method="get" action="index.php"> <div class="panel panel-default no-mb">
} $this->searchMode = 'keyword%'; } elseif ($this->get['tx_multishop_pi1']['keyword']) { // using $_REQUEST cause TYPO3 converts "Command & Conquer" to "Conquer" (the & sign sucks ass) $this->get['tx_multishop_pi1']['keyword'] = trim($this->get['tx_multishop_pi1']['keyword']); $this->get['tx_multishop_pi1']['keyword'] = $GLOBALS['TSFE']->csConvObj->utf8_encode($this->get['tx_multishop_pi1']['keyword'], $GLOBALS['TSFE']->metaCharset); $this->get['tx_multishop_pi1']['keyword'] = $GLOBALS['TSFE']->csConvObj->entities_to_utf8($this->get['tx_multishop_pi1']['keyword'], true); $this->get['tx_multishop_pi1']['keyword'] = mslib_fe::RemoveXSS($this->get['tx_multishop_pi1']['keyword']); $this->searchKeywords[] = $this->get['tx_multishop_pi1']['keyword']; $this->searchMode = '%keyword%'; } $searchCharNav = '<div id="msAdminSearchByCharNav"><div class="btn-group">'; $chars = array(); $chars = array('0-9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', 'all'); foreach ($chars as $char) { $searchCharNav .= '<a href="' . mslib_fe::typolink($this->shop_pid . ',2003', 'tx_multishop_pi1[searchByChar]=' . $char . '&tx_multishop_pi1[page_section]=admin_manufacturers') . '" class="btn btn-default">' . mslib_befe::strtoupper($char) . '</a>'; } $searchCharNav .= '</div></div>'; $limit_search_result_selectbox = '<div class="form-inline"><div class="form-group"><label>' . $this->pi_getLL('limit_number_of_records_to') . ':</label>'; $limit_search_result_selectbox .= '<select name="limit" class="form-control">'; $limits = array(); $limits[] = '10'; $limits[] = '15'; $limits[] = '20'; $limits[] = '25'; $limits[] = '30'; $limits[] = '40'; $limits[] = '50'; $limits[] = '100'; $limits[] = '150'; $limits[] = '200';