Example #1
0
            }
            include_once "showcart.php";
            function item_name()
            {
                $itemnames = array();
                if ($_SESSION['products']) {
                    foreach ($_SESSION['products'] as $products) {
                        array_push($itemnames, $products['title']);
                    }
                    $itemnames = implode(",", $itemnames);
                    return $itemnames;
                }
            }
            $html = str_replace("{item_number}", "WH-" . date("Ymd-Hmi"), $html);
            $html = str_replace("{item_name}", item_name(), $html);
            $html = str_replace("{product_list}", products_list($_GET['lang']), $html);
            if ($_SESSION['fullprice']) {
                $html = str_replace("{full_price}", $_SESSION['fullprice'], $html);
            } else {
                $html = str_replace("{full_price}", 0, $html);
            }
            break;
    }
    /*-----вывод главной страницы------------*/
} else {
    require_once "action/content_action.php";
    $html = file_get_contents("view/main.tpl");
    if (isset($_GET['post_search'])) {
        $html = str_replace("{content}", post_search(), $html);
    }
    $html = str_replace("{content}", file_get_contents("view/homepage.tpl"), $html);
function product_multi_edit()
{
    global $txp_user;
    $selected = ps('selected');
    if (!$selected) {
        return products_list();
    }
    $method = ps('edit_method');
    $changed = false;
    $ids = array();
    if ($method == 'delete') {
        if (!has_privs('article.delete')) {
            $allowed = array();
            if (has_privs('article.delete.own')) {
                foreach ($selected as $id) {
                    $id = assert_int($id);
                    $author = safe_field('AuthorID', 'textpattern', "ID = {$id}");
                    if ($author == $txp_user) {
                        $allowed[] = $id;
                    }
                }
            }
            $selected = $allowed;
        }
        foreach ($selected as $id) {
            $id = assert_int($id);
            if (safe_delete('textpattern', "ID = {$id}")) {
                $ids[] = $id;
            }
        }
        $changed = join(', ', $ids);
    }
    if ($changed) {
        return products_list(messenger('Product', $changed, $method == 'delete' ? 'deleted' : 'modified'));
    }
    return products_list();
}