Пример #1
0
/**
 * Default Action of TPL_ACT_RENDER
 *
 * @return bool
 */
function tpl_content_core()
{
    global $ACT;
    global $TEXT;
    global $PRE;
    global $SUF;
    global $SUM;
    global $IDX;
    global $INPUT;
    switch ($ACT) {
        case 'show':
            html_show();
            break;
            /** @noinspection PhpMissingBreakStatementInspection */
        /** @noinspection PhpMissingBreakStatementInspection */
        case 'locked':
            html_locked();
        case 'edit':
        case 'recover':
            html_edit();
            break;
        case 'preview':
            html_edit();
            html_show($TEXT);
            break;
        case 'draft':
            html_draft();
            break;
        case 'search':
            html_search();
            break;
        case 'revisions':
            html_revisions($INPUT->int('first'));
            break;
        case 'diff':
            html_diff();
            break;
        case 'recent':
            html_recent($INPUT->extract('first')->int('first'), $INPUT->str('show_changes'));
            break;
        case 'index':
            html_index($IDX);
            #FIXME can this be pulled from globals? is it sanitized correctly?
            break;
        case 'backlink':
            html_backlinks();
            break;
        case 'conflict':
            html_conflict(con($PRE, $TEXT, $SUF), $SUM);
            html_diff(con($PRE, $TEXT, $SUF), false);
            break;
        case 'login':
            html_login();
            break;
        case 'register':
            html_register();
            break;
        case 'resendpwd':
            html_resendpwd();
            break;
        case 'denied':
            print p_locale_xhtml('denied');
            break;
        case 'profile':
            html_updateprofile();
            break;
        case 'admin':
            tpl_admin();
            break;
        case 'subscribe':
            tpl_subscribe();
            break;
        case 'media':
            tpl_media();
            break;
        default:
            $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
            if ($evt->advise_before()) {
                msg("Failed to handle command: " . hsc($ACT), -1);
            }
            $evt->advise_after();
            unset($evt);
            return false;
    }
    return true;
}
function front_end_catalog_wcells($rows, $params, $page_num, $prod_count, $prod_in_page, $ratings, $voted, $categories, $category_list, $params1, $cat_rows, $cat_id, $child_ids, $params7, $categor, $par, $cels_or_list, $ident)
{
    ob_start();
    global $ident;
    $frontpage_id = get_option('page_for_posts');
    $pos = strrpos(get_permalink(), "?");
    $permalink_for_sp_cat = "";
    if ('page' == get_option('show_on_front') && '' != get_option('page_for_posts') && is_home()) {
        if ($pos) {
            $permalink_for_sp_cat = get_permalink($frontpage_id);
        } else {
            $permalink_for_sp_cat = get_permalink($frontpage_id) . "?s_p_c_t=1342";
        }
    } else {
        if (is_home()) {
            $pos1 = strrpos(site_url() . '/index.php', "?");
            if ($pos1) {
                $permalink_for_sp_cat = site_url() . '/index.php';
            } else {
                $permalink_for_sp_cat = site_url() . '/index.php' . "?s_p_c_t=1342";
            }
        } else {
            if ($pos) {
                $permalink_for_sp_cat = get_permalink();
            } else {
                $permalink_for_sp_cat = get_permalink() . "?s_p_c_t=1342";
            }
        }
    }
    $prod_iterator = 0;
    if ($params['enable_rating']) {
        ?>
        <style type="text/css">

            .star-rating {
                background: url(<?php 
        echo plugins_url('', __FILE__) . '/Front_images/star' . $params['wcells_rating_star'] . '.png';
        ?>
) top left repeat-x !important;
            }

            .star-rating li a:hover {
                background: url(<?php 
        echo plugins_url('', __FILE__) . '/Front_images/star' . $params['wcells_rating_star'] . '.png';
        ?>
) left bottom !important;
            }

            .star-rating li.current-rating {
                background: url(<?php 
        echo plugins_url('', __FILE__) . '/Front_images/star' . $params['wcells_rating_star'] . '.png';
        ?>
) left center !important;
            }

            .star-rating1 {
                background: url(<?php 
        echo plugins_url('', __FILE__) . '/Front_images/star' . $params['wcells_rating_star'] . '.png';
        ?>
) top left repeat-x !important;
            }

            .star-rating1 li.current-rating {
                background: url(<?php 
        echo plugins_url('', __FILE__) . '/Front_images/star' . $params['wcells_rating_star'] . '.png';
        ?>
) left center !important;
            }

        </style>
        <style>
            #spanman p {
                margin: 0;
            }
        </style>
    <?php 
    }
    html_categories($rows, $params, $page_num, $prod_count, $prod_in_page, $ratings, $voted, $categories, $category_list, $params1, $cat_rows, $cat_id, $child_ids, $params7, $categor, $par, $cels_or_list, $ident, "wcells_");
    global $post;
    $page_id = $post->ID;
    $frontpage_id = get_option('page_for_posts');
    if (!$params["choose_category"] and $params1['categories'] > 0 or !$params["search_by_name"]) {
        echo '<script>
      document.getElementById("cat_form_page_nav1").style.display = "none";
      </script>';
    }
    $prod_name = html_search($rows, $params, $page_num, $prod_count, $prod_in_page, $ratings, $voted, $categories, $category_list, $params1, $cat_rows, $cat_id, $child_ids, $params7, $categor, $par, $cels_or_list, $ident, "wcells_");
    if (isset($_POST['subcat_id_' . $cels_or_list . '_' . $ident . '']) && $_POST['subcat_id_' . $cels_or_list . '_' . $ident . ''] != "") {
        $subcat_id = $_POST['subcat_id_' . $cels_or_list . '_' . $ident . ''];
    } else {
        if ($cat_id == 'ALL_CAT') {
            $cat_id = 0;
        }
        $subcat_id = $cat_id;
    }
    if (count($rows)) {
        echo '<table border="0" cellspacing="0" cellpadding="0" id="productCartFullcube" style="padding-bottom: 30px;border-width:' . $params['wcells_border_width'] . 'px;border-color:' . $params['wcells_border_color'] . ';border-style:' . $params['wcells_border_style'] . ';border-bottom:none; border-right:none;' . ($params['wcells_text_color'] != '' ? 'color:' . $params['wcells_text_color'] . ';' : '') . ($params['wcells_background_color'] != '' ? 'background-color:' . $params['wcells_background_color'] . ';' : '') . '">';
    }
    if ($params7['show_prod'] == 1) {
        $urll = site_url();
        $perm = get_permalink();
        foreach ($rows as $row) {
            $link = $permalink_for_sp_cat . '&ident=' . $ident . '&product_id=' . $row->id . '&cat_id_' . $cels_or_list . '_' . $ident . '=' . $subcat_id . '&page_num_' . $cels_or_list . '_' . $ident . '=' . $page_num . '&prod_name_' . $cels_or_list . '_' . $ident . '=' . $prod_name . '&back=1';
            $imgurl = explode(";;;", $row->image_url);
            $array = explode(" ", esc_html(stripslashes($row->name)));
            $array2 = str_replace("{$array['0']}", "", esc_html(stripslashes($row->name)));
            echo '<tr style="border-bottom:1px solid white !important;background-color:' . $params['wcells_cell_background_color'] . '">';
            if (!($row->image_url != "" and $row->image_url != "******0")) {
                $imgurl[0] = plugins_url("Front_images/noimage.jpg", __FILE__);
                echo '<td style="text-align:center;vertical-align:middle;padding: 10px !important;border-width:' . $params['wcells_border_width'] . 'px;border-color:' . $params['wcells_border_color'] . ';border-style:' . $params['wcells_border_style'] . ';border-top:none; border-left:none;"><img  style="width:' . $params['single_cell_picture_width'] . 'px;height:' . $params['single_cell_picture_height'] . 'px;border: #CCC solid 1px;" src="' . $imgurl[0] . '" /></td>';
            } else {
                $image_and_atach = explode('******', $imgurl[0]);
                $image = $image_and_atach[0];
                if (isset($image_and_atach[1])) {
                    $atach = $image_and_atach[1];
                } else {
                    $atach = '';
                }
                if ($atach) {
                    $array_with_sizes = wp_get_attachment_image_src($atach, 'thumbnail');
                    $attach_url = $array_with_sizes[0];
                } else {
                    $attach_url = $image;
                }
                echo '<td style="text-align:center;vertical-align:middle;padding: 10px !important;border-width:' . $params['wcells_border_width'] . 'px;border-color:' . $params['wcells_border_color'] . ';border-style:' . $params['wcells_border_style'] . ';border-top:none; border-left:none;"><a href="' . $image . '" target="_blank"><img  style="max-width:' . $params['single_cell_picture_width'] . 'px;max-height:' . $params['single_cell_picture_height'] . 'px;border: #CCC solid 1px;" src="' . $attach_url . '" /></a></td>';
            }
            echo '<td style="vertical-align:top;padding: 0px 4px 2px 4px;border-width:' . $params['wcells_border_width'] . 'px;border-color:' . $params['wcells_border_color'] . ';border-style:' . $params['wcells_border_style'] . ';border-top:none; border-left:none;"><a href="' . $link . '" style="word-break: break-word;' . ($params['wcells_hyperlink_color'] != '' ? 'color:' . $params['wcells_hyperlink_color'] . ';' : '') . 'font-size:' . $params['single_cell_title_size'] . 'px !important;color:' . $params['single_cell_title_color'] . ';"><b>' . esc_html(stripslashes($row->name)) . '</b></a>';
            if ($params['price'] and $row->cost != 0 and $row->cost != '') {
                echo '<div style="color:' . $params['wcells_price_color'] . ';float:right;font-size:' . $params['wcells_price_size'] . 'px;"><strong>' . ($params['currency_symbol_position'] == 0 ? $params['currency_symbol'] : '') . ' ' . $row->cost . ' ' . ($params['currency_symbol_position'] == 1 ? $params['currency_symbol'] : '') . '</strong></div>';
            }
            if ($params['enable_rating']) {
                $id = $row->id;
                $rating = $ratings[$id] * 25;
                if ($voted[$id] == 0) {
                    if ($ratings[$id] == 0) {
                        $title = __('Not rated Yet.', 'sp_catalog');
                    } else {
                        $title = $ratings[$id];
                    }
                    echo "<div id='voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "' style='height:30px;'>\n\n\t\t\t<ul class='star-rating'>\n\n\t\t\t\t<li class='current-rating' id='current-rating' style=\"width:" . $rating . "px\"></li>\n\n\t\t\t\t<li><a href=\"#\" onclick=\"vote(1," . $row->id . ",'voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "','" . __('Rated.', 'sp_catalog') . "','" . admin_url('admin-ajax.php?action=catalogstarerate') . "'); return false;\"\t\ttitle='" . $title . "' class='one-star'>1</a></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"vote(2," . $row->id . ",'voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "','" . __('Rated.', 'sp_catalog') . "','" . admin_url('admin-ajax.php?action=catalogstarerate') . "'); return false;\"   \ttitle='" . $title . "' class='two-stars'>2</a></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"vote(3," . $row->id . ",'voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "','" . __('Rated.', 'sp_catalog') . "','" . admin_url('admin-ajax.php?action=catalogstarerate') . "'); return false;\"  \t title='" . $title . "' class='three-stars'>3</a></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"vote(4," . $row->id . ",'voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "','" . __('Rated.', 'sp_catalog') . "','" . admin_url('admin-ajax.php?action=catalogstarerate') . "'); return false;\"    \ttitle='" . $title . "' class='four-stars'>4</a></li>\n\t\t\t\t<li><a href=\"#\" onclick=\"vote(5," . $row->id . ",'voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "','" . __('Rated.', 'sp_catalog') . "','" . admin_url('admin-ajax.php?action=catalogstarerate') . "'); return false;\"\t\ttitle='" . $title . "' class='five-stars'>5</a></li>\n\n\t\t\t</ul>\n\n\t\t\t</div>";
                } else {
                    if ($ratings[$id] == 0) {
                        $title = __('Not rated Yet.', 'sp_catalog');
                    } else {
                        $title = __('Rating', 'sp_catalog') . ' ' . $ratings[$id] . '&nbsp;&nbsp;&nbsp;&nbsp;&#013;' . __('You have already rated this product.', 'sp_catalog');
                    }
                    echo "<div id='voting" . $row->id . "_" . $cels_or_list . "_" . $ident . "' style='height:30px;'>\n\n\t\t\t<ul class='star-rating1'>\n\n\t\t\t<li class='current-rating' id='current-rating' style=\"width:" . $rating . "px\"></li>\n\n\t\t\t<li><a  title='" . $title . "' class='one-star'>1</a></li>\n\n\t\t\t<li><a  title='" . $title . "' class='two-stars'>2</a></li>\n\n\t\t\t<li><a title='" . $title . "' class='three-stars'>3</a></li>\n\n\t\t\t<li><a title='" . $title . "' class='four-stars'>4</a></li>\n\n\t\t\t<li><a title='" . $title . "' class='five-stars'>5</a></li>\n\n\t\t\t</ul>\n\n\t\t\t</div>";
                }
            }
            $categories_id = explode(',', $row->category_id);
            if ($row->category_id > 0 and $params['cell_show_category']) {
                echo '<div style="padding-left:7px;background-color:' . $params['single_cell_background_color_1'] . ';font-size:' . $params['single_cell_font_1_size'] . 'px !important;"><span style="color:' . $params['single_cell_text_color_2'] . ' !important;" id="cat_' . $row->id . '">' . __('Category:', 'sp_catalog') . ':';
                foreach ($categories as $key => $categ) {
                    if (in_array($key, $categories_id)) {
                        echo $categ . '<br>';
                    }
                }
                echo '</span></div>';
            } else {
                echo '<span id="cat_' . $row->id . '"></span>';
            }
            echo '<table>';
            if ($params['list_show_parameters']) {
                $par_data = explode("par_", $row->param);
                for ($j = 0; $j < count($par_data); $j++) {
                    if ($par_data[$j] != '') {
                        $par1_data = explode("@@:@@", $par_data[$j]);
                        $par_values = explode("\t", $par1_data[1]);
                        $countOfPar = 0;
                        for ($k = 0; $k < count($par_values); $k++) {
                            if ($par_values[$k] != "") {
                                $countOfPar++;
                            }
                        }
                        if ($j % 2 != 0) {
                            if ($countOfPar != 0) {
                                echo '<tr class="spidercatalogparamslist" >';
                                echo '<td style="background-color:' . $params['single_cell_background_color_2'] . ';" ><span style="color:' . $params['single_cell_text_color_1'] . ';font-size:' . $params['single_cell_font_2_size'] . 'px !important;"><b>' . $par1_data[0] . ':&nbsp;&nbsp;&nbsp;</b></span>';
                                for ($k = 0; $k < count($par_values); $k++) {
                                    if ($par_values[$k] != "") {
                                        echo '<span style="color:' . $params['single_cell_text_color_2'] . ' !important;font-size:' . $params['single_cell_font_1_size'] . 'px !important;">' . $par_values[$k] . '</span>';
                                    }
                                }
                                echo '</td>';
                            }
                        }
                        if ($j % 2 == 0) {
                            if ($countOfPar != 0) {
                                echo '';
                                echo '<td style="background-color:' . $params['single_cell_background_color_2'] . ';"><span style="color:' . $params['single_cell_text_color_1'] . ';font-size:' . $params['single_cell_font_2_size'] . 'px !important;"><b>' . $par1_data[0] . ':&nbsp;&nbsp;&nbsp;</b></span>';
                                for ($k = 0; $k < count($par_values); $k++) {
                                    if ($par_values[$k] != "") {
                                        echo '<span style="color:' . $params['single_cell_text_color_2'] . ' !important;font-size:' . $params['single_cell_font_1_size'] . 'px !important;">' . $par_values[$k] . '</span>';
                                    }
                                }
                                echo '</td></tr>';
                            }
                        }
                    }
                }
            }
            echo '</table>';
            $description = explode('<!--more-->', stripslashes($row->description));
            echo '<div id="spanman" style="color:' . $params['single_cell_text_color_2'] . ' !important;padding-left:7px;background-color:' . $params['single_cell_background_color_1'] . ';font-size:' . $params['single_cell_font_1_size'] . 'px !important;" id="prodDescription">' . htmlspecialchars_decode($description[0]) . ' </div>';
            echo '<div  style="background-color:' . $params['wcells_more_background_color'] . ';width:70px;float:right;margin-bottom: 3px;;padding-left: 16px;position:relative;"><a style="color:' . $params['wcells_more_font_color'] . ';font-size:12pt;" href="' . $link . '">' . __('More', 'sp_catalog') . '</a></div>';
            echo '</td>';
            echo '</tr>';
        }
    }
    if (count($rows)) {
        echo '</table>';
    }
    ?>
    <script>
        function submit_catal(page_link) {
            if (document.getElementById('cat_form_page_nav')) {
                document.getElementById('cat_form_page_nav').setAttribute('action', page_link);
                document.getElementById('cat_form_page_nav').submit();
            }
            else {
                window.location.href = page_link;
            }
        }
    </script>

    <div id="spidercatalognavigation" style="text-align:center;">

        <?php 
    $url = "";
    if ($cat_id != 0) {
        $url = '&cat_id_' . $cels_or_list . '_' . $ident . '=' . $subcat_id;
    }
    if ($prod_name != "") {
        $url .= '&prod_name_' . $cels_or_list . '_' . $ident . '=' . $prod_name;
    }
    if ($params7['show_prod'] == 1) {
        if ($prod_count > $prod_in_page and $prod_in_page > 0) {
            $r = ceil($prod_count / $prod_in_page);
            $navstyle = ($params['text_size_small'] != '' ? 'font-size:' . $params['text_size_small'] . 'px !important;' : 'font-size:12px !important;') . ($params['text_color'] != '' ? 'color:' . $params['text_color'] . ' !important;' : '');
            $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '= ';
            if ($page_num > 5) {
                $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '=1';
                echo "\n\n&nbsp;&nbsp;<a href=\"javascript:submit_catal('{$link}')\" style=\"{$navstyle}\">" . __('First', 'sp_catalog') . "</a>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;...&nbsp";
            }
            if ($page_num > 1) {
                $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '=' . ($page_num - 1);
                echo "&nbsp;&nbsp;<a href=\"javascript:submit_catal('{$link}')\" style=\"{$navstyle}\">" . __('Prev', 'sp_catalog') . "</a>&nbsp;&nbsp;";
            }
            for ($i = $page_num - 4; $i < $page_num + 5; $i++) {
                if ($i <= $r and $i >= 1) {
                    $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '=' . $i;
                    if ($i == $page_num) {
                        echo "<span style='font-weight:bold !important; color:#000000 !important; " . ($params['text_size_small'] != '' ? 'font-size:' . ($params['text_size_small'] + 4) . 'px !important;' : 'font-size:16px !important;') . "' >&nbsp;{$i}&nbsp;</span>";
                    } else {
                        echo "<a href=\"javascript:submit_catal('{$link}')\" style=\"{$navstyle}\">&nbsp;{$i}&nbsp;</a>";
                    }
                }
            }
            if ($page_num < $r) {
                $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '=' . ($page_num + 1);
                echo "&nbsp;&nbsp;<a href=\"javascript:submit_catal('{$link}')\" style=\"{$navstyle}\">" . __('Next', 'sp_catalog') . "</a>&nbsp;&nbsp;";
            }
            if ($r - $page_num > 4) {
                $link = $permalink_for_sp_cat . $url . '&page_num_' . $cels_or_list . '_' . $ident . '=' . $r;
                echo "&nbsp;...&nbsp;&nbsp;&nbsp;<a href=\"javascript:submit_catal('{$link}')\" style=\"{$navstyle}\">" . __('Last', 'sp_catalog') . "</a>";
            }
        }
    }
    ?>
</div>
</div>
    <script type="text/javascript">
        var SpiderCatOFOnLoad = window.onload;
        window.onload = SpiderCatAddToOnload;
    </script>

    <?php 
    $ident++;
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Пример #3
0
function tpl_content_core()
{
    global $ACT;
    global $TEXT;
    global $PRE;
    global $SUF;
    global $SUM;
    global $IDX;
    switch ($ACT) {
        case 'show':
            html_show();
            break;
        case 'locked':
            html_locked();
        case 'edit':
        case 'recover':
            html_edit();
            break;
        case 'preview':
            html_edit();
            html_show($TEXT);
            break;
        case 'draft':
            html_draft();
            break;
        case 'search':
            html_search();
            break;
        case 'revisions':
            $first = isset($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_revisions($first);
            break;
        case 'diff':
            html_diff();
            break;
        case 'recent':
            if (is_array($_REQUEST['first'])) {
                $_REQUEST['first'] = array_keys($_REQUEST['first']);
                $_REQUEST['first'] = $_REQUEST['first'][0];
            }
            $first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_recent($first);
            break;
        case 'index':
            html_index($IDX);
            #FIXME can this be pulled from globals? is it sanitized correctly?
            break;
        case 'backlink':
            html_backlinks();
            break;
        case 'conflict':
            html_conflict(con($PRE, $TEXT, $SUF), $SUM);
            html_diff(con($PRE, $TEXT, $SUF), false);
            break;
        case 'login':
            html_login();
            break;
        case 'register':
            html_register();
            break;
        case 'resendpwd':
            html_resendpwd();
            break;
        case 'denied':
            print p_locale_xhtml('denied');
            break;
        case 'profile':
            html_updateprofile();
            break;
        case 'admin':
            tpl_admin();
            break;
        case 'subscribe':
            tpl_subscribe();
            break;
        default:
            $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
            if ($evt->advise_before()) {
                msg("Failed to handle command: " . hsc($ACT), -1);
            }
            $evt->advise_after();
            unset($evt);
            return false;
    }
    return true;
}
Пример #4
0
function newlang($langname, $file)
{
    global $lang;
    print "Writing new Language {$langname} using {$file}\n\n";
    if (!($fh = fopen($file, 'r'))) {
        die("Cannot read {$file}");
    }
    while (false !== ($line = fgets($fh))) {
        // get content from lang file
        if (preg_match('/(.*?)=(.*)/', $line, $result)) {
            //list($name, $value) = $m;
            $name = trim($result[1]);
            $value = trim($result[2]);
            $lang[$name] = $value;
        }
    }
    // Include our language name
    $lang['lang'] = $langname;
    // delete previous version of lang templates
    if (is_dir("html/" . $langname)) {
        remove_directory("html/" . $langname);
    }
    remove_directory("./lang/{$langname}");
    copy_directory("./lang/html", "./lang/{$langname}");
    /*### TAKE OUT FOR PRODUCTION!!!
      if ($pref['sql_table'] == "atmail404new")
      system("find /usr/local/atmail/webmail/lang/$lang -name \".svn\" | sed \"s/^/rm -rf /g\" | sh");
      ### TAKE OUT FOR PRODUCTION!!!
      */
    html_search("./lang/{$langname}/");
    //html_search("./lang/$langname/calendar/");
    html_search("./lang/{$langname}/help/");
    html_search("./lang/{$langname}/javascript/");
    //html_search("./lang/$langname/javascript/htmleditor/");
    html_search("./lang/{$langname}/msg/");
    html_search("./lang/{$langname}/simple/");
    //html_search("./lang/$langname/simple/heading/");
    if (is_dir("./lang/{$langname}/xhtml/")) {
        html_search("./lang/{$langname}/xhtml/");
    }
    html_search("./lang/{$langname}/xp/");
    //html_search("./lang/$langname/xp/heading/");
    if (file_exists("./lang/{$langname}/xp/calendar/readpost.html")) {
        html_search("./lang/{$langname}/xp/calendar/");
    }
    if (file_exists("./lang/{$langname}/xp/css")) {
        html_search("./lang/{$langname}/xp/css/");
    }
    if (file_exists("./lang/{$langname}/calendar")) {
        html_search("./lang/{$langname}/calendar");
    }
    //html_search("./lang/$langname/xul/");
    //html_search("./lang/$langname/xul/css/");
    sleep(1);
    copy_directory("./lang/{$langname}", "./html/{$langname}");
    remove_directory("./lang/{$langname}");
    print "New language installed to ./html/{$langname}/\n";
    if (!is_dir("imgs/menubar-{$langname}") && !is_dir("lang/languages/{$langname}/menubar-{$langname}")) {
        print "\nImage Translation\n-----------------\n\n - The imgs/menubar-{$langname} directory does not exist. To complete the translation of @Mail\n you are required to modify the text for the menubar images.\n  ";
        $value = enterinfo("\nIcons for {$langname} could not be found.\nCopy English template to imgs/menubar-{$langname} ?", "Y");
        if (strtolower($value) == 'y') {
            copy_directory("imgs/menubar-english", "imgs/menubar-{$langname}");
        }
    }
    if (is_dir("lang/languages/{$langname}/menubar-{$langname}")) {
        $value = enterinfo("\nMove image template from:\nlang/languages/{$langname}/menubar-{$langname} to imgs/menubar-{$langname} ?", "Y");
        if (strtolower($value) == 'y') {
            $time = time();
            print "Creating images ...\n\n";
            copy_directory("imgs/menubar-{$langname}", "/tmp/menubar-{$langname}-{$time}");
            remove_directory("imgs/menubar-{$langname}");
            copy_directory("lang/languages/{$langname}/menubar-{$langname}", "imgs/menubar-{$langname}");
            remove_directory("lang/languages/{$langname}/menubar-{$langname}");
        }
    }
}