示例#1
0
function nc_include_quickbar_updates()
{
    require_once nc_Core::get_object()->get_variable("INCLUDE_FOLDER") . "quickbar.inc.php";
    $quickbar = nc_quickbar_in_template_header('', false, true);
    $quickbar['view_link'] = html_entity_decode($quickbar['view_link']);
    $quickbar['edit_link'] = html_entity_decode($quickbar['edit_link']);
    $quickbar = json_encode($quickbar);
    return "<script type='text/javascript'>\n        parent.nc_ls_quickbar = {$quickbar};\n    </script>";
}
示例#2
0
文件: index.php 项目: Blu2z/implsk
 // metatag noindex
 if ($nc_core->subdivision->get_current("DisallowIndexing") == 1) {
     $template_header = nc_insert_in_head($template_header, "<meta name='robots' content='noindex' />");
 }
 if ($nc_core->get_variable("admin_mode") || $nc_core->get_variable("inside_admin")) {
     // reversive direction!
     $template_header = nc_insert_in_head($template_header, "<script type='text/javascript' src='" . $nc_core->get_variable("ADMIN_PATH") . "js/package.js'></script>\r\n");
     $template_header = nc_insert_in_head($template_header, nc_js(true), true);
 }
 $quick_mode = false;
 if ($nc_core->get_variable("AUTHORIZATION_TYPE") != 'http') {
     if ($nc_core->get_settings('QuickBar') && !isset($_GET['rand'])) {
         $cookie_domain = $nc_core->modules->get_vars('auth', 'COOKIES_WITH_SUBDOMAIN') ? str_replace("www.", "", $nc_core->get_variable("HTTP_HOST")) : NULL;
         if ($nc_core->input->fetch_cookie('QUICK_BAR_CLOSED') == 0 || $nc_core->input->fetch_cookie('QUICK_BAR_CLOSED') == -1) {
             require_once $nc_core->get_variable("INCLUDE_FOLDER") . "quickbar.inc.php";
             $template_header = nc_quickbar_in_template_header($template_header, $File_Mode);
             $quick_mode = true;
             setcookie("QUICK_BAR_CLOSED", -1, time() + $nc_core->get_variable("ADMIN_AUTHTIME"), "/", $cookie_domain);
         } else {
             setcookie("QUICK_BAR_CLOSED", 1, time() + $nc_core->get_variable("ADMIN_AUTHTIME"), "/", $cookie_domain);
         }
     }
 }
 if ($nc_core->template->get_current("CustomSettings") && $nc_core->subdivision->get_current('Template_ID') == $template) {
     require_once $nc_core->ADMIN_FOLDER . "array_to_form.inc.php";
     $nc_a2f = new nc_a2f($nc_core->template->get_current("CustomSettings"));
     $nc_a2f->set_value($nc_core->subdivision->get_current("TemplateSettings"));
     $template_settings = $nc_a2f->get_values_as_array();
 }
 if ($nc_core->template->get_current("CustomSettings") && $nc_core->subdivision->get_current('Template_ID') != $template) {
     require_once $nc_core->ADMIN_FOLDER . "array_to_form.inc.php";
示例#3
0
function InheritTemplateEnv($template)
{
    global $nc_core, $db, $AUTH_USER_ID, $templatePreview;
    $template += 0;
    $table_name = 'Template';
    ### essence
    $template_env = $db->get_row("SELECT * FROM `Template` WHERE `Template_ID` = '" . intval($template) . "'", ARRAY_A);
    $template_env = ConvertSystemVars($template_env, "Template");
    // Блок для предпросмотра макетов дизайна
    $magic_gpc = get_magic_quotes_gpc();
    if ($template_env["Template_ID"] == $templatePreview && !empty($_SESSION["PreviewTemplate"][$templatePreview])) {
        foreach ($_SESSION["PreviewTemplate"][$templatePreview] as $key => $value) {
            $template_env[$key] = $magic_gpc ? stripslashes($value) : $value;
        }
    }
    $parent_template = $template_env["Parent_Template_ID"];
    while ($parent_template) {
        $parent_template_env = $db->get_row("SELECT * FROM `Template` WHERE `Template_ID` = '" . intval($parent_template) . "'", ARRAY_A);
        // Если мы вызываем предпросмотр для макета, а он используется в качестве родительского.
        if ($parent_template_env["Template_ID"] == $templatePreview && !empty($_SESSION["PreviewTemplate"][$templatePreview])) {
            foreach ($_SESSION["PreviewTemplate"][$templatePreview] as $key => $value) {
                $parent_template_env[$key] = $magic_gpc ? stripslashes($value) : $value;
            }
        }
        $parent_template = $template_env["Parent_Template_ID"];
        if (!$template_env["Header"]) {
            $template_env["Header"] = $parent_template_env["Header"];
        } else {
            if ($parent_template_env["Header"]) {
                $template_env["Header"] = str_replace("%Header", $parent_template_env["Header"], $template_env["Header"]);
            }
        }
        if (!$template_env["Footer"]) {
            $template_env["Footer"] = $parent_template_env["Footer"];
        } else {
            if ($parent_template_env["Footer"]) {
                $template_env["Footer"] = str_replace("%Footer", $parent_template_env["Footer"], $template_env["Footer"]);
            }
        }
        $template_env["Settings"] = $parent_template_env["Settings"] . $template_env["Settings"];
        $parent_template_env = ConvertSystemVars($parent_template_env, "Template");
        $template_env = InheritSystemFields("Template", $parent_template_env, $template_env);
        $parent_template = $parent_template_env["Parent_Template_ID"];
    }
    // load system table fields
    $table_fields = $nc_core->get_system_table_fields($table_name);
    // count
    $counted_fileds = count($table_fields);
    for ($i = 0; $i < $counted_fileds; $i++) {
        $template_env["Header"] = str_replace("%" . $table_fields[$i]['name'], $template_env[$table_fields[$i]['name']], $template_env["Header"]);
        $template_env["Footer"] = str_replace("%" . $table_fields[$i]['name'], $template_env[$table_fields[$i]['name']], $template_env["Footer"]);
    }
    // add system CSS styles in admin mode
    if ($nc_core->admin_mode && !$nc_core->inside_admin && $template_env["Header"]) {
        // addon css
        $template_admin_css = "<link type='text/css' rel='stylesheet' href='" . $nc_core->ADMIN_TEMPLATE . "css/admin_pages.css'/>";
        // pattern and replacement for preg_replace()
        switch (true) {
            case nc_preg_match("/\\<\\s*?\\/head\\s*?\\>/im", $template_env["Header"]):
                $preg_pattern = "/(\\<\\s*?\\/head\\s*?\\>){1}/im";
                $preg_replacement = $template_admin_css . "\n\$1";
                break;
            case nc_preg_match("/\\<\\s*?html\\s*?\\>/im", $template_env["Header"]):
                $preg_pattern = "/(\\<\\s*?html\\s*?\\>){1}/im";
                $preg_replacement = "\$1\n<head>" . $template_admin_css . "</head>";
                break;
            default:
                $preg_pattern = "/(\\A)/im";
                $preg_replacement = $template_admin_css . "\n\$1";
        }
        $template_env["Header"] = nc_preg_replace($preg_pattern, $preg_replacement, $template_env["Header"]);
    }
    if ($AUTH_USER_ID && $nc_core->get_settings('QuickBar')) {
        $cookie_domain = $nc_core->modules->get_vars('auth', 'COOKIES_WITH_SUBDOMAIN') ? str_replace("www.", "", $nc_core->HTTP_HOST) : NULL;
        if ($nc_core->input->fetch_cookie('QUICK_BAR_CLOSED') == 0 || $nc_core->input->fetch_cookie('QUICK_BAR_CLOSED') == -1) {
            require_once $nc_core->INCLUDE_FOLDER . "quickbar.inc.php";
            $template_env["Header"] = nc_quickbar_in_template_header($template_env["Header"]);
            setcookie("QUICK_BAR_CLOSED", -1, time() + $nc_core->ADMIN_AUTHTIME, "/", $cookie_domain);
        } else {
            // refresh cookie expiration
            setcookie("QUICK_BAR_CLOSED", 1, time() + $nc_core->ADMIN_AUTHTIME, "/", $cookie_domain);
        }
    }
    return $template_env;
}