Esempio n. 1
0
function urls()
{
    global $tpl, $mysql, $twig;
    $tpath = locatePluginTemplates(array('config/main', 'config/urls'), 'eshop', 1);
    $url = pluginGetVariable('eshop', 'url');
    if (isset($_REQUEST['submit'])) {
        if ($url != '1' && $_REQUEST['url'] == '1') {
            create_urls();
        } elseif ($_REQUEST['url'] == '0') {
            remove_urls();
        }
        pluginSetVariable('eshop', 'url', intval($_REQUEST['url']));
        pluginsSaveConfig();
        redirect_eshop('?mod=extra-config&plugin=eshop&action=urls');
    }
    $url = '<option value="0" ' . (empty($url) ? 'selected' : '') . '>Нет</option><option value="1" ' . (!empty($url) ? 'selected' : '') . '>Да</option>';
    $xt = $twig->loadTemplate($tpath['config/urls'] . 'config/' . 'urls.tpl');
    $tVars = array('info' => $url);
    $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);
}
Esempio n. 2
0
<?php

// Protect against hack attempts
if (!defined('NGCMS')) {
    die('HAL');
}
include_once dirname(__FILE__) . '/functions.php';
//
// Configuration file for plugin
//
plugins_load_config();
$db_update = array(array('table' => 'eshop_products', 'action' => 'drop'), array('table' => 'eshop_products_comments', 'action' => 'drop'), array('table' => 'eshop_products_likes', 'action' => 'drop'), array('table' => 'eshop_products_view', 'action' => 'drop'), array('table' => 'eshop_features', 'action' => 'drop'), array('table' => 'eshop_options', 'action' => 'drop'), array('table' => 'eshop_related_products', 'action' => 'drop'), array('table' => 'eshop_categories', 'action' => 'drop'), array('table' => 'eshop_products_categories', 'action' => 'drop'), array('table' => 'eshop_categories_features', 'action' => 'drop'), array('table' => 'eshop_brands', 'action' => 'drop'), array('table' => 'eshop_purchases', 'action' => 'drop'), array('table' => 'eshop_orders', 'action' => 'drop'), array('table' => 'eshop_order_basket', 'action' => 'drop'), array('table' => 'eshop_compare', 'action' => 'drop'), array('table' => 'eshop_variants', 'action' => 'drop'), array('table' => 'eshop_images', 'action' => 'drop'), array('table' => 'eshop_currencies', 'action' => 'drop'), array('table' => 'eshop_ebasket', 'action' => 'drop'));
if ($_REQUEST['action'] == 'commit') {
    if (fixdb_plugin_install($plugin, $db_update, 'deinstall')) {
        $img_dir = dirname(dirname(dirname(dirname(__FILE__)))) . '/uploads/eshop/';
        deleteDir($img_dir);
        remove_urls();
        plugin_mark_deinstalled($plugin);
    }
} else {
    generate_install_page($plugin, '”даление плагина', 'deinstall');
}
function deleteDir($path)
{
    if (empty($path)) {
        return false;
    }
    return is_file($path) ? @unlink($path) : array_map(__FUNCTION__, glob($path . '/*')) == @rmdir($path);
}