// // Отображение блока нотификации при добавлении продукта в корзину 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); } twigRegisterFunction('eshop', 'compare', plugin_eshop_compare); twigRegisterFunction('eshop', 'notify', plugin_ebasket_notify); twigRegisterFunction('eshop', 'total', plugin_ebasket_total); if (class_exists('p_uprofileFilter')) { class uOrderFilter extends p_uprofileFilter { function editProfileForm($userID, $SQLrow, &$tvars) { global $mysql, $twig, $userROW, $template; $conditions = array(); if ($userID) { array_push($conditions, "author_id = " . db_squote($userID)); } $fSort = " ORDER BY id DESC"; $sqlQPart = "FROM " . prefix . "_eshop_orders " . (count($conditions) ? "WHERE " . implode(" AND ", $conditions) : '') . $fSort; $sqlQ = "SELECT * " . $sqlQPart; foreach ($mysql->select($sqlQ) as $row) { $order_link = checkLinkAvailable('eshop', 'order') ? generateLink('eshop', 'order', array(), array('id' => $row['id'], 'uniqid' => $row['uniqid'])) : generateLink('core', 'plugin', array('plugin' => 'eshop', 'handler' => 'order'), array(), array('id' => $row['id'], 'uniqid' => $row['uniqid']));
$xt = $twig->loadTemplate($tpath[$templateName] . $templateName . '.tpl'); $output = $xt->render($tVars); } else { $output = ''; } return $output; } // // Twig блоки для вывода продукции на главную // Параметры: // * number - число записей для вывода // * mode - режим вывода // * template - шаблон // * cacheExpire - время кеша (в секундах) function plugin_block_eshop_showTwig($params) { global $CurrentHandler, $config; return plugin_block_eshop($params['number'], $params['mode'], $params['cat'], $params['template'], isset($params['cacheExpire']) ? $params['cacheExpire'] : 0); } // // Twig блок для вывода дерева категорий // Параметры: // * template - шаблон function plugin_m_eshop_catz_tree_showTwig($params) { global $CurrentHandler, $config; return plugin_m_eshop_catz_tree($params['template']); } twigRegisterFunction('eshop', 'show', plugin_block_eshop_showTwig); twigRegisterFunction('eshop', 'show_catz_tree', plugin_m_eshop_catz_tree_showTwig);
$fname .= '.jpg'; } $ftmp = $_FILES['newavatar']['tmp_name']; $mysql->query("INSERT INTO " . prefix . "_images (name, orig_name, description, folder, date, owner_id, category) VALUES (" . db_squote($fname) . ", " . db_squote($fname) . ", " . db_squote($profile) . ", '', unix_timestamp(now()), '1', '0')"); $rowID = $mysql->record("select LAST_INSERT_ID() as id"); if (copy($ftmp, $config['images_dir'] . $fname)) { $sz = $imanage->get_size($config['images_dir'] . $fname); $mysql->query("update " . prefix . "_images set width=" . db_squote($sz['1']) . ", height=" . db_squote($sz['2']) . " where id = " . db_squote($rowID['id']) . " "); } } } $adapter->logout(); echo "<script>window.opener.document.getElementById('" . $provider . "_li').className += 'active'; " . "window.opener.document.getElementById('" . $provider . "_id').value = " . $rowID['id'] . "; self.close();</script>\n"; } } } /** * Add to $_FILES from external url */ function addToFiles($key, $url) { $tempName = tempnam(ini_get('upload_tmp_dir'), 'upload_'); $originalName = basename(parse_url($url, PHP_URL_PATH)); $imgRawData = file_get_contents($url); file_put_contents($tempName, $imgRawData); $info = getimagesize($tempName); $_FILES[$key] = array('name' => $originalName, 'type' => $info['mime'], 'tmp_name' => $tempName, 'error' => 0, 'size' => strlen($imgRawData)); //return $_FILES[$key]; } twigRegisterFunction('guestbook', 'show', guestbook_block);