Пример #1
0
 switch ($_GET['do']) {
     case "general":
         TPL::render("v_settings/settings_general");
         break;
     case "security":
         TPL::render("v_settings/settings_security");
         break;
     case "seo":
         TPL::render("v_settings/settings_seo");
         break;
     case "maintenance":
         if (isset($_POST['save_changes'])) {
             OPTIONS::set("website", "maintenance_mode", $_POST['maintenance_mode']);
             TPL::message("Actualizarile au fost efectuate cu succes.", "success");
         }
         TPL::assign("maintenance_mode", OPTIONS::website("maintenance_mode"));
         TPL::render("v_settings/settings_maintenance");
         break;
     case "backend":
         if (isset($_POST['new_background'])) {
             // change image
             $new_image = replace_cards($_POST['new_background'], array(), true);
             OPTIONS::set('admin', 'background', $new_image, USER::get('id'));
             // return result
             die('ok');
         }
         if (isset($_POST['new_color'])) {
             // change color scheme
             $color_scheme = substr(substr($_POST['new_color'], 5), 0, -1);
             OPTIONS::set('admin', 'color_scheme', $color_scheme, USER::get('id'));
             // return result
Пример #2
0
<?php

if (OPTIONS::website('service_minify') == 1) {
    EVENTS::add_action("before_render", function () {
        if (!URL::routed()) {
            $r = URL::check('^extender/(.*).min.(css|js)$', true);
            if ($r !== false) {
                $path = FOLDER_BASE . "extender/" . $r[1] . "." . $r[2];
                if (file_exists($path)) {
                    // minify
                    $minify = HELPERS::load("minify");
                    $minify->addSource($path);
                    $minify->exec();
                    // redirect to the new file
                    redirect(BASE_URL . $r[0]);
                }
            }
        }
    });
}
<?php

if (OPTIONS::website('service_error_reporting') == 1) {
    //set errors handler
    error_reporting(0);
    function drawline_handle_error($errno, $errstr, $error_file, $error_line)
    {
        echo "<b>Error:</b> [{$errno}] {$errstr} - {$error_file}:{$error_line}";
        die;
    }
    function drawline_handle_fatal()
    {
        $error = error_get_last();
        if ($error !== NULL) {
            print_array($error);
        }
    }
    set_error_handler("drawline_handle_error");
    register_shutdown_function("drawline_handle_fatal");
}
Пример #4
0
 public static function service_thumbs_remove_allow($size)
 {
     // arrange allowed sizes
     if (!is_array($size)) {
         $size = array($size);
     }
     $current = explode(",", OPTIONS::website("service_thumbs_allowed_sizes"));
     foreach ($current as $i => $v) {
         if (in_array($v, $size)) {
             unset($current[$i]);
         }
     }
     $current = implode(",", $current);
     // update
     OPTIONS::set('website', 'service_thumbs_allowed_sizes', $current);
     // return
     return true;
 }
Пример #5
0
function template_url_base()
{
    $link = BASE_URL;
    $link .= str_replace(array(FOLDER_BASE, DS), array("", "/"), FOLDER_TEMPLATES);
    $link .= OPTIONS::website('frontend_template') . "/";
    return $link;
}
Пример #6
0
<?php

if (OPTIONS::website('service_sitemap') == 1) {
}
Пример #7
0
<?php

if (OPTIONS::website('service_thumbs') == 1) {
    $r = URL::check('^content/[any]/[any]-thumb[num]x[num].[alpha]$', true);
    if ($r !== false) {
        $path = FOLDER_CONTENT . $r[1] . DS . $r[2] . "." . $r[5];
        if (file_exists($path)) {
            $allowed_sizes = explode(",", OPTIONS::website("service_thumbs_allowed_sizes"));
            if (in_array($r[3] . "x" . $r[4], $allowed_sizes)) {
                // the new name of the image
                $new_name = FOLDER_CONTENT . $r[1] . DS . $r[2] . "-thumb" . $r[3] . "x" . $r[4] . "." . $r[5];
                // load base image
                $img = HELPERS::load("images")->load($path);
                // resize, save and show
                $img->thumbnail($r[3], $r[4])->save($new_name)->output($new_name);
                // prevent execution
                die;
            }
        }
    }
}
Пример #8
0
 public static function get_page_types()
 {
     $data = object2array(json_decode(OPTIONS::website("page_types")));
     return $data;
 }
Пример #9
0
}
// general assign
TPL::assign("admin_url", ADMIN_URL);
TPL::assign("base_url", BASE_URL);
// run plugins
foreach (DRAWLINE::plugins_list(true) as $plugin) {
    if (file_exists(FOLDER_PLUGINS . $plugin . DS . "index.php")) {
        include_once FOLDER_PLUGINS . $plugin . DS . "index.php";
        EVENTS::do_action("run_plugin_" . $plugin);
    } else {
        LOGS::write("Not found plugin " . $plugin . " on the server.");
    }
}
EVENTS::do_action("before_render");
// start render
if (OPTIONS::website("maintenance_mode") == '1' && !on_admin() && !PERMISSIONS::check("access_admin")) {
    if (TPL::check_template("page_maintenance")) {
        TPL::render("page_maintenance");
        TPL::draw(true);
    } else {
        echo '<h1>This website is in maintenance!</h1>';
    }
} elseif (TPL::render() != "") {
    TPL::draw(true);
} else {
    if (!URL::routed()) {
        show_404();
    }
}
EVENTS::do_action("after_render");
//print_array(LOGS::export("html"));