function payment_config($id) { global $tpl, $template, $twig, $mysql, $SYSTEM_FLAGS, $config, $userROW, $lang, $CurrentHandler; $row = $mysql->record('SELECT * FROM ' . prefix . '_eshop_payment WHERE name = ' . db_squote($id) . ' LIMIT 1'); if (isset($_REQUEST['submit'])) { $PARAMS['name'] = $id; $PARAMS['merchantid'] = $_REQUEST['merchantid']; $PARAMS['merchantpass'] = $_REQUEST['merchantpass']; $SQL['name'] = $id; $SQL['options'] = json_encode($PARAMS); if (empty($error_text)) { $vnames = array(); foreach ($SQL as $k => $v) { $vnames[] = $k . ' = ' . db_squote($v); } $mysql->query("REPLACE INTO " . prefix . "_eshop_payment SET " . implode(', ', $vnames) . " "); redirect_eshop('?mod=extra-config&plugin=eshop&action=list_payment'); } } /* foreach ($row as $k => $v) { $tEntry[$k] = $v; } */ $tEntry = array(); $tEntry['name'] = $row['name']; $tEntry['options'] = json_decode($row['options'], true); $payment_config_tpl = dirname(__FILE__) . '/tpl/config.tpl'; $xt = $twig->loadTemplate($payment_config_tpl); $tVars = array('entries' => isset($tEntry) ? $tEntry : ''); $tpath = locatePluginTemplates(array('config/main'), 'eshop', 1); $xg = $twig->loadTemplate($tpath['config/main'] . 'config/' . 'main.tpl'); $tVars = array('entries' => $xt->render($tVars), 'php_self' => $PHP_SELF, 'plugin_url' => admin_url . '/admin.php?mod=extra-config&plugin=eshop', 'skins_url' => skins_url, 'admin_url' => admin_url, 'home' => home, 'current_title' => '—истемы оплаты [' . $id . ']'); print $xg->render($tVars); }
function LoadVariables() { $tpath = locatePluginTemplates(array(':'), 'eshop', pluginGetVariable('eshop', 'localsource')); return parse_ini_file($tpath[':'] . '/variables.ini', true); }
function options() { global $tpl, $mysql, $cron, $twig; $tpath = locatePluginTemplates(array('config/main', 'config/general.from'), 'eshop', 1); $tVars = array(); if (isset($_REQUEST['submit'])) { pluginSetVariable('eshop', 'count', intval($_REQUEST['count'])); pluginSetVariable('eshop', 'count_search', secure_html($_REQUEST['count_search'])); pluginSetVariable('eshop', 'count_stocks', secure_html($_REQUEST['count_stocks'])); pluginSetVariable('eshop', 'views_count', $_REQUEST['views_count']); pluginSetVariable('eshop', 'bidirect_linked_products', $_REQUEST['bidirect_linked_products']); pluginSetVariable('eshop', 'approve_comments', $_REQUEST['approve_comments']); pluginSetVariable('eshop', 'sort_comments', $_REQUEST['sort_comments']); pluginSetVariable('eshop', 'integrate_gsmg', $_REQUEST['integrate_gsmg']); pluginSetVariable('eshop', 'max_image_size', intval($_REQUEST['max_image_size'])); pluginSetVariable('eshop', 'width_thumb', intval($_REQUEST['width_thumb'])); pluginSetVariable('eshop', 'width', intval($_REQUEST['width'])); pluginSetVariable('eshop', 'height', intval($_REQUEST['height'])); pluginSetVariable('eshop', 'ext_image', check_php_str($_REQUEST['ext_image'])); pluginSetVariable('eshop', 'pre_width', intval($_REQUEST['pre_width'])); pluginSetVariable('eshop', 'catz_max_image_size', intval($_REQUEST['catz_max_image_size'])); pluginSetVariable('eshop', 'catz_width_thumb', intval($_REQUEST['catz_width_thumb'])); pluginSetVariable('eshop', 'catz_width', intval($_REQUEST['catz_width'])); pluginSetVariable('eshop', 'catz_height', intval($_REQUEST['catz_height'])); pluginSetVariable('eshop', 'catz_ext_image', check_php_str($_REQUEST['catz_ext_image'])); pluginSetVariable('eshop', 'email_notify_orders', $_REQUEST['email_notify_orders']); pluginSetVariable('eshop', 'email_notify_comments', $_REQUEST['email_notify_comments']); pluginSetVariable('eshop', 'email_notify_back', $_REQUEST['email_notify_back']); pluginSetVariable('eshop', 'description_delivery', $_REQUEST['description_delivery']); pluginSetVariable('eshop', 'description_order', $_REQUEST['description_order']); pluginSetVariable('eshop', 'description_phones', $_REQUEST['description_phones']); pluginsSaveConfig(); redirect_eshop('?mod=extra-config&plugin=eshop&action=options'); } $views_cnt = intval(pluginGetVariable('eshop', 'views_count')); if ($views_cnt == 2) { $cron_row = $cron->getConfig(); foreach ($cron_row as $key => $value) { if ($value['plugin'] == 'eshop' && $value['handler'] == 'eshop_views') { $cron_min = $value['min']; $cron_hour = $value['hour']; $cron_day = $value['day']; $cron_month = $value['month']; } } if (!isset($cron_min)) { $cron_min = '0,15,30,45'; } if (!isset($cron_hour)) { $cron_hour = '*'; } if (!isset($cron_day)) { $cron_day = '*'; } if (!isset($cron_month)) { $cron_month = '*'; } $cron->unregisterTask('eshop', 'eshop_views'); $cron->registerTask('eshop', 'eshop_views', $cron_min, $cron_hour, $cron_day, $cron_month, '*'); } else { $cron->unregisterTask('eshop', 'eshop_views'); } $count = pluginGetVariable('eshop', 'count'); $count_search = pluginGetVariable('eshop', 'count_search'); $count_stocks = pluginGetVariable('eshop', 'count_stocks'); $views_count = pluginGetVariable('eshop', 'views_count'); $views_count = '<option value="0" ' . ($views_count == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($views_count == 1 ? 'selected' : '') . '>Да</option><option value="2" ' . ($views_count == 2 ? 'selected' : '') . '>Отложенное</option>'; $bidirect_linked_products = pluginGetVariable('eshop', 'bidirect_linked_products'); $bidirect_linked_products = '<option value="0" ' . ($bidirect_linked_products == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($bidirect_linked_products == 1 ? 'selected' : '') . '>Да</option>'; $approve_comments = pluginGetVariable('eshop', 'approve_comments'); $approve_comments = '<option value="0" ' . ($approve_comments == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($approve_comments == 1 ? 'selected' : '') . '>Да</option>'; $sort_comments = pluginGetVariable('eshop', 'sort_comments'); $sort_comments = '<option value="0" ' . ($sort_comments == 0 ? 'selected' : '') . '>Новые снизу</option><option value="1" ' . ($sort_comments == 1 ? 'selected' : '') . '>Новые сверху</option>'; $integrate_gsmg = pluginGetVariable('eshop', 'integrate_gsmg'); $integrate_gsmg = '<option value="0" ' . ($integrate_gsmg == 0 ? 'selected' : '') . '>Нет</option><option value="1" ' . ($integrate_gsmg == 1 ? 'selected' : '') . '>Да</option>'; $max_image_size = pluginGetVariable('eshop', 'max_image_size'); $width_thumb = pluginGetVariable('eshop', 'width_thumb'); $width = pluginGetVariable('eshop', 'width'); $height = pluginGetVariable('eshop', 'height'); $ext_image = pluginGetVariable('eshop', 'ext_image'); $pre_width = pluginGetVariable('eshop', 'pre_width'); $catz_max_image_size = pluginGetVariable('eshop', 'catz_max_image_size'); $catz_width_thumb = pluginGetVariable('eshop', 'catz_width_thumb'); $catz_width = pluginGetVariable('eshop', 'catz_width'); $catz_height = pluginGetVariable('eshop', 'catz_height'); $catz_ext_image = pluginGetVariable('eshop', 'catz_ext_image'); $email_notify_orders = pluginGetVariable('eshop', 'email_notify_orders'); $email_notify_comments = pluginGetVariable('eshop', 'email_notify_comments'); $email_notify_back = pluginGetVariable('eshop', 'email_notify_back'); $description_delivery = pluginGetVariable('eshop', 'description_delivery'); $description_order = pluginGetVariable('eshop', 'description_order'); $description_phones = pluginGetVariable('eshop', 'description_phones'); $tEntry = array('count' => $count, 'count_search' => $count_search, 'count_stocks' => $count_stocks, 'views_count' => $views_count, 'bidirect_linked_products' => $bidirect_linked_products, 'approve_comments' => $approve_comments, 'sort_comments' => $sort_comments, 'integrate_gsmg' => $integrate_gsmg, 'max_image_size' => $max_image_size, 'width_thumb' => $width_thumb, 'width' => $width, 'height' => $height, 'ext_image' => $ext_image, 'pre_width' => $pre_width, 'catz_max_image_size' => $catz_max_image_size, 'catz_width_thumb' => $catz_width_thumb, 'catz_width' => $catz_width, 'catz_height' => $catz_height, 'catz_ext_image' => $catz_ext_image, 'email_notify_orders' => $email_notify_orders, 'email_notify_comments' => $email_notify_comments, 'email_notify_back' => $email_notify_back, 'description_delivery' => $description_delivery, 'description_order' => $description_order, 'description_phones' => $description_phones); $xt = $twig->loadTemplate($tpath['config/general.from'] . 'config/' . 'general.from.tpl'); $tVars = array('entries' => isset($tEntry) ? $tEntry : ''); $xg = $twig->loadTemplate($tpath['config/main'] . 'config/' . 'main.tpl'); $tVars = array('entries' => $xt->render($tVars), 'php_self' => $PHP_SELF, 'plugin_url' => admin_url . '/admin.php?mod=extra-config&plugin=eshop', 'skins_url' => skins_url, 'admin_url' => admin_url, 'home' => home, 'current_title' => 'Настройки'); print $xg->render($tVars); }
function plugin_ebasket_notify($params) { global $mysql, $twig, $userROW, $template; // Выводим шаблон $tpath = locatePluginTemplates(array('ebasket/notify'), 'eshop', pluginGetVariable('eshop', 'localsource')); $basket_link = checkLinkAvailable('eshop', 'ebasket_list') ? generateLink('eshop', 'ebasket_list', array()) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'ebasket_list'), array()); // Готовим переменные $tVars = array('basket_link' => $basket_link); $xt = $twig->loadTemplate($tpath['ebasket/notify'] . 'ebasket/' . 'notify.tpl'); return $xt->render($tVars); }
function plugin_m_eshop_catz_tree($overrideTemplateName) { global $config, $twig; $eshop_dir = get_plugcfg_dir('eshop'); generate_catz_cache(); if (file_exists($eshop_dir . '/cache_catz.php')) { $tVars = unserialize(file_get_contents($eshop_dir . '/cache_catz.php')); if ($overrideTemplateName) { $templateName = 'block/' . $overrideTemplateName; } else { $templateName = 'block/block_cats_tree'; } $tpath = locatePluginTemplates(array($templateName), 'eshop', pluginGetVariable('eshop', 'localsource')); $xt = $twig->loadTemplate($tpath[$templateName] . $templateName . '.tpl'); $output = $xt->render($tVars); } else { $output = ''; } return $output; }
function breadcrumbs() { global $lang, $catz, $catmap, $template, $CurrentHandler, $config, $SYSTEM_FLAGS, $tpl, $systemAccessURL, $twig; $tpath = locatePluginTemplates(array('breadcrumbs'), 'breadcrumbs', pluginGetVariable('breadcrumbs', 'template_source')); $location = array(); $location_last = ''; # processing 404 page if ($SYSTEM_FLAGS['info']['title']['group'] == $lang['404.title']) { $link = str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']); $location[] = array('url' => $config['home_url'], 'title' => $lang['bc:mainpage'], 'link' => $link); $location_last = $lang['404.title']; } else { if ($CurrentHandler) { $params = $CurrentHandler['params']; $pluginName = $CurrentHandler['pluginName']; } # generate main page with or without link $main_page = $systemAccessURL != '/' ? str_replace(array('{home_url}', '{home_title}'), array($config['home_url'], $lang['bc:mainpage']), $lang['bc:page_404']) : $lang['bc:mainpage']; $location[] = array('url' => $systemAccessURL != '/' ? $config['home_url'] : '', 'title' => $systemAccessURL != '/' ? $lang['bc:mainpage'] : $lang['bc:mainpage'], 'link' => $main_page); $location_last = $main_page; # if category if ($CurrentHandler['handlerName'] == 'by.category') { $location_last = GetCategories($catz[$params['category']]['id'], true); # show full path [if requested] if ($catz[$params['category']]['parent'] != 0 && !pluginGetVariable('breadcrumbs', 'block_full_path')) { $id = $catz[$params['category']]['parent']; do { $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($id, false)); $id = $catz[$catmap[$id]]['parent']; } while ($id != 0); $location = array_merge($location, array_reverse($location_tmp)); } } elseif ($params['year']) { # if we have only year then $year = plain text, if we have month then $year = link $year = !$params['month'] ? $params['year'] : str_replace(array('{year_url}', '{year}'), array(generateLink('news', 'by.year', array('year' => $params['year'])), $params['year']), $lang['bc:by.year']); $month_p = LangDate("F", mktime(0, 0, 0, $params['month'], 7, 0)); # if we have only year and month then $month = plain text, if we have day then $month = link $month = !$params['day'] ? $month_p : str_replace(array('{month_url}', '{month_p}'), array(generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), $month_p), $lang['bc:by.month']); $day = $params['day']; $location_last = $year; if ($params['month']) { $location[] = array('url' => !$params['month'] ? '' : generateLink('news', 'by.year', array('year' => $params['year'])), 'title' => !$params['month'] ? $params['year'] : $params['year'], 'link' => $year); $location_last = $month; } if ($params['day']) { $location[] = array('url' => !$params['day'] ? '' : generateLink('news', 'by.month', array('year' => $params['year'], 'month' => $params['month'])), 'title' => !$params['day'] ? $month_p : $month_p, 'link' => $month); $location_last = $day; } # plugin, static, etc. } elseif ($pluginName != 'news') { if ($pluginName == "static") { $location_last = $SYSTEM_FLAGS['info']['title']['item']; } elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'edit' || $pluginName == 'search') { $location_last = $SYSTEM_FLAGS['info']['title']['group']; } elseif ($pluginName == 'uprofile' && $CurrentHandler['handlerName'] == 'show') { $location_last = $SYSTEM_FLAGS['info']['title']['group'] . ' ' . $SYSTEM_FLAGS['info']['title']['item']; } elseif ($pluginName == 'core' && in_array($CurrentHandler['handlerName'], array('registration', 'lostpassword', 'login'))) { $location_last = $SYSTEM_FLAGS['info']['title']['group']; } elseif ($params['plugin'] || $pluginName) { # if plugin provide put some info if ($SYSTEM_FLAGS['info']['breadcrumbs']) { # plugin name becomes link $count = count($SYSTEM_FLAGS['info']['breadcrumbs']) - 1; # all items except last become links for ($i = 0; $i < $count; $i++) { $link = str_replace(array('{plugin_url}', '{plugin}'), array($SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text']), $lang['bc:plugin']); $location[] = array('url' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['link'], 'title' => $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text'], 'link' => $link); } # last item becomes plain text $location_last = $SYSTEM_FLAGS['info']['breadcrumbs'][$i]['text']; } else { $link = str_replace(array('{plugin_url}', '{plugin}'), array(generatePluginLink($params['plugin'], '', array(), array(), false, true), $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin']), $lang['bc:plugin']); $location[] = array('url' => generatePluginLink($params['plugin'], '', array(), array(), false, true), 'title' => $SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin'] ? $SYSTEM_FLAGS['info']['title']['group'] : $params['plugin'], 'link' => $link); if ($SYSTEM_FLAGS['info']['title']['group'] != $lang['loc_plugin']) { $location_last = $SYSTEM_FLAGS['info']['title']['group']; } else { $location_last = $params['plugin']; } } } # full news } elseif ($CurrentHandler['pluginName'] == 'news' && $CurrentHandler['handlerName'] == 'news') { $catids = $SYSTEM_FLAGS['news']['db.categories']; $location_last = $SYSTEM_FLAGS['info']['title']['item']; if (count($catids) != 1 || pluginGetVariable('breadcrumbs', 'block_full_path')) { if ($CurrentHandler['params']['category'] != 'none') { foreach ($catids as $cid) { foreach ($catz as $cc) { if ($cc['id'] == $cid) { $location[] = array('url' => generateLink('news', 'by.category', array('category' => $cc['alt'], 'catid' => $cc['id'])), 'title' => $cc['name'], 'link' => GetCategories($cc['id'], false)); } } } } } else { $id = $catz[$params['category']]['parent']; $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $catz[$params['category']]['alt'], 'catid' => $catz[$params['category']]['id'])), 'title' => $catz[$params['category']]['name'], 'link' => GetCategories($catz[$params['category']]['id'], false)); while ($id != 0) { foreach ($catz as $cc) { if ($cc['id'] == $id) { $location_tmp[] = array('url' => generateLink('news', 'by.category', array('category' => $cc['alt'], 'catid' => $cc['id'])), 'title' => $cc['name'], 'link' => GetCategories($cc['id'], false)); $id = $catz[$cc['alt']]['parent']; } } } $location = array_merge($location, array_reverse($location_tmp)); } } } $tVars = array('location' => $location, 'location_last' => $location_last, 'separator' => $separator); $xt = $twig->loadTemplate($tpath['breadcrumbs'] . 'breadcrumbs.tpl'); $template['vars']['breadcrumbs'] = $xt->render($tVars); }
function social_config() { global $tpl, $mysql, $lang, $twig; $tpath = locatePluginTemplates(array('config/main', 'config/social'), 'guestbook', 1); if (isset($_REQUEST['submit'])) { pluginSetVariable('guestbook', 'vk_client_id', secure_html($_REQUEST['vk_client_id'])); pluginSetVariable('guestbook', 'vk_client_secret', secure_html($_REQUEST['vk_client_secret'])); pluginSetVariable('guestbook', 'facebook_client_id', secure_html($_REQUEST['facebook_client_id'])); pluginSetVariable('guestbook', 'facebook_client_secret', secure_html($_REQUEST['facebook_client_secret'])); pluginSetVariable('guestbook', 'google_client_id', secure_html($_REQUEST['google_client_id'])); pluginSetVariable('guestbook', 'google_client_secret', secure_html($_REQUEST['google_client_secret'])); pluginSetVariable('guestbook', 'instagram_client_id', secure_html($_REQUEST['instagram_client_id'])); pluginSetVariable('guestbook', 'instagram_client_secret', secure_html($_REQUEST['instagram_client_secret'])); pluginsSaveConfig(); msg(array("text" => $lang['gbconfig']['msgo_settings_saved'])); } $vk_client_id = pluginGetVariable('guestbook', 'vk_client_id'); $vk_client_secret = pluginGetVariable('guestbook', 'vk_client_secret'); $facebook_client_id = pluginGetVariable('guestbook', 'facebook_client_id'); $facebook_client_secret = pluginGetVariable('guestbook', 'facebook_client_secret'); $google_client_id = pluginGetVariable('guestbook', 'google_client_id'); $google_client_secret = pluginGetVariable('guestbook', 'google_client_secret'); $instagram_client_id = pluginGetVariable('guestbook', 'instagram_client_id'); $instagram_client_secret = pluginGetVariable('guestbook', 'instagram_client_secret'); $xt = $twig->loadTemplate($tpath['config/social'] . 'config/social.tpl'); $tVars = array('skins_url' => skins_url, 'home' => home, 'tpl_home' => admin_url, 'vk_client_id' => $vk_client_id, 'vk_client_secret' => $vk_client_secret, 'facebook_client_id' => $facebook_client_id, 'facebook_client_secret' => $facebook_client_secret, 'google_client_id' => $google_client_id, 'google_client_secret' => $google_client_secret, 'instagram_client_id' => $instagram_client_id, 'instagram_client_secret' => $instagram_client_secret); $xg = $twig->loadTemplate($tpath['config/main'] . 'config/main.tpl'); $tVars = array('entries' => $xt->render($tVars)); print $xg->render($tVars); }
function main_prd($params) { global $tpl, $template, $twig, $SYSTEM_FLAGS, $config, $userROW, $mysql, $twigLoader; $results = array(); $params = arrayCharsetConvert(1, $params); $number = $params['number']; $mode = $params['mode']; $cat = $params['cat']; $overrideTemplateName = $params['template']; $prd_per_page = $number; $page = $params['page']; switch ($params['action']) { // **** ADD NEW ITEM INTO compare **** case 'show': $conditions = array(); if (isset($cat) && !empty($cat)) { array_push($conditions, "c.id IN (" . $cat . ") "); } array_push($conditions, "p.active = 1"); if ($number < 1 || $number > 100) { $number = 5; } switch ($mode) { case 'view': $orderby = " ORDER BY p.view DESC "; break; case 'last': $orderby = " ORDER BY p.editdate DESC "; break; case 'stocked': array_push($conditions, "p.stocked = 1"); $orderby = " ORDER BY p.editdate DESC "; break; case 'featured': array_push($conditions, "p.featured = 1"); $orderby = " ORDER BY p.editdate DESC "; break; case 'rnd': $cacheDisabled = true; $orderby = " ORDER BY RAND() DESC "; break; default: $mode = 'last'; $orderby = " ORDER BY p.editdate DESC "; break; } $fSort = " " . $orderby; $sqlQPart = "FROM " . prefix . "_eshop_products p LEFT JOIN " . prefix . "_eshop_products_categories pc ON p.id = pc.product_id LEFT JOIN " . prefix . "_eshop_categories c ON pc.category_id = c.id " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort; $sqlQCount = "SELECT COUNT(p.id) " . $sqlQPart; $sqlQ = "SELECT p.id AS id, p.url as url, p.code AS code, p.name AS name, p.annotation AS annotation, p.body AS body, p.active AS active, p.featured AS featured, p.stocked AS stocked, p.position AS position, p.meta_title AS meta_title, p.meta_keywords AS meta_keywords, p.meta_description AS meta_description, p.date AS date, p.editdate AS editdate, p.views AS views, c.id AS cid, c.url as curl, c.name AS category " . $sqlQPart; $entries = array(); $pageNo = intval($page) ? $page : 0; if ($pageNo < 1) { $pageNo = 1; } if (!$start_from) { $start_from = ($pageNo - 1) * $prd_per_page; } $count = $mysql->result($sqlQCount); $countPages = ceil($count / $prd_per_page); $cmp_array = array(); foreach ($SYSTEM_FLAGS["eshop"]["compare"]["entries"] as $cmp_row) { $cmp_array[] = $cmp_row['linked_fld']; } foreach ($mysql->select($sqlQ . ' LIMIT ' . $start_from . ', ' . $prd_per_page) as $row) { $fulllink = checkLinkAvailable('eshop', 'show') ? generateLink('eshop', 'show', array('alt' => $row['url'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'show'), array('alt' => $row['url'])); $catlink = checkLinkAvailable('eshop', '') ? generateLink('eshop', '', array('alt' => $row['curl'])) : generateLink('core', 'plugin', array('plugin' => 'eshop'), array('alt' => $row['curl'])); $cmp_flag = in_array($row['id'], $cmp_array); $entries[$row['id']] = array('id' => $row['id'], 'code' => $row['code'], 'name' => $row['name'], 'annotation' => $row['annotation'], 'body' => $row['body'], 'active' => $row['active'], 'featured' => $row['featured'], 'meta_title' => $row['meta_title'], 'meta_keywords' => $row['meta_keywords'], 'meta_description' => $row['meta_description'], 'fulllink' => $fulllink, 'date' => empty($row['date']) ? '' : $row['date'], 'editdate' => empty($row['editdate']) ? '' : $row['editdate'], 'views' => $row['views'], 'cat_name' => $row['category'], 'cid' => $row['cid'], 'catlink' => $catlink, 'compare' => $cmp_flag, 'home' => home, 'tpl_url' => home . '/templates/' . $config['theme']); } $entries_array_ids = array_keys($entries); if (isset($entries_array_ids) && !empty($entries_array_ids)) { $entries_string_ids = implode(',', $entries_array_ids); foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_images i WHERE i.product_id IN (' . $entries_string_ids . ') ORDER BY i.position, i.id') as $irow) { $entries[$irow['product_id']]['images'][] = $irow; } foreach ($mysql->select('SELECT * FROM ' . prefix . '_eshop_variants v WHERE v.product_id IN (' . $entries_string_ids . ') ORDER BY v.position, v.id') as $vrow) { $entries[$vrow['product_id']]['variants'][] = $vrow; } } $tVars = array('info' => isset($info) ? $info : '', 'entries' => isset($entries) ? $entries : '', 'tpl_url' => home . '/templates/' . $config['theme'], 'tpl_home' => admin_url); if ($overrideTemplateName) { $templateName = 'block/' . $overrideTemplateName; } else { $templateName = 'block/main_block_eshop'; } // Determine paths for all template files $tpath = locatePluginTemplates(array($templateName), 'eshop', pluginGetVariable('eshop', 'localsource')); // Preload template configuration variables @templateLoadVariables(); $tVars['mode'] = $mode; $tVars['number'] = $number; $tVars['tpl_url'] = tpl_url; $tVars['home'] = home; $tVars['pagesss'] = generateLP(array('current' => $pageNo, 'count' => $countPages, 'url' => '#', 'tpl' => $templateName . '_pages')); $xt = $twig->loadTemplate($tpath[$templateName] . $templateName . '.tpl'); if (empty($row)) { $results = array('prd_main' => 2, 'prd_main_text' => iconv('Windows-1251', 'UTF-8', 'Нет продукции!'), 'prd_main_pages_text' => iconv('Windows-1251', 'UTF-8', '')); } else { $results = array('prd_main' => 100, 'prd_main_text' => iconv('Windows-1251', 'UTF-8', $xt->render($tVars)), 'prd_main_pages_text' => iconv('Windows-1251', 'UTF-8', $tVars['pagesss'])); } break; } return array('status' => 1, 'errorCode' => 0, 'data' => $results); }
function ebasket_add_fast_order($linked_ds, $linked_id, $title, $price, $count, $type, $order, $xfld = array()) { global $mysql, $userROW, $twig, $template, $ip; $SQL['name'] = $order['name']; $SQL['email'] = $order['email']; $SQL['phone'] = $order['phone']; $SQL['address'] = $order['address']; $SQL['comment'] = ""; $SQL['dt'] = time() + $config['date_adjust'] * 60; $SQL['ip'] = $ip; $SQL['type'] = $type; $SQL['paid'] = 0; $SQL['total_price'] = round($price * $count, 2); if (isset($userROW)) { $SQL['author_id'] = $userROW['id']; } $SQL['uniqid'] = substr(str_shuffle(MD5(microtime())), 0, 10); $vnames = array(); foreach ($SQL as $k => $v) { $vnames[] = $k . ' = ' . db_squote($v); } $mysql->query('INSERT INTO ' . prefix . '_eshop_orders SET ' . implode(', ', $vnames) . ' '); $qid = $mysql->lastid('eshop_orders'); $mysql->query("INSERT INTO " . prefix . "_eshop_order_basket (`order_id`, `linked_id`, `title`, `count`, `price`, `linked_fld`) VALUES (" . db_squote($qid) . ", " . db_squote($linked_id) . ", " . db_squote($title) . ", " . db_squote($count) . ", " . db_squote($price) . ", " . db_squote(serialize($xfld)) . " )"); // mail notify $filter = array(); if ($qid) { $filter[] = '(order_id = ' . db_squote($qid) . ')'; } foreach ($mysql->select("select * from " . prefix . "_eshop_order_basket where " . join(" or ", $filter), 1) as $rec) { $total += round($rec['price'] * $rec['count'], 2); $rec['sum'] = sprintf('%9.2f', round($rec['price'] * $rec['count'], 2)); $rec['xfields'] = unserialize($rec['linked_fld']); unset($rec['linked_fld']); $basket[] = $rec; } $notify_tpath = locatePluginTemplates(array('mail/lfeedback'), 'eshop', pluginGetVariable('eshop', 'localsource')); $notify_xt = $twig->loadTemplate($notify_tpath['mail/lfeedback'] . 'mail/' . 'lfeedback.tpl'); $pVars = array('recs' => count($basket), 'entries' => $basket, 'total' => sprintf('%9.2f', $total), 'vnames' => $SQL); $mailBody = $notify_xt->render($pVars); $mailSubject = "Новый заказ с сайта"; $mailTo = pluginGetVariable('eshop', 'email_notify_orders'); $mail_from = pluginGetVariable('eshop', 'email_notify_back'); if ($mail_from == "") { $mail_from = false; } if ($mailTo != "") { sendEmailMessage($mailTo, $mailSubject, $mailBody, $filename = false, $mail_from, $ctype = 'text/html'); } return array('status' => 1, 'errorCode' => 0, 'data' => 'Item added into ebasket', 'update' => ''); }
function guestbook_block($params) { global $CurrentHandler, $twig, $config; $count = $params['count'] > 0 ? intval($params['count']) : 10; $tVars = array('entries' => _guestbook_records('DESC', 0, $count)); $tpath = locatePluginTemplates(array('guestbook.block'), 'guestbook', pluginGetVariable('guestbook', 'localsource')); $xt = $twig->loadTemplate($tpath['guestbook.block'] . 'guestbook.block.tpl'); return $xt->render($tVars); }