if (USER::login($_POST['username'], $_POST['password'])) { TPL::message("Perfect! You'll be redirected in 2 seconds..", "success"); redirect(isset($_GET['redirect']) ? urldecode($_GET['redirect']) : LINKS::get("admin_home"), 2); } else { switch (LOGS::get_error()['log_text']) { case "wrong_username": TPL::message("You entered a wrong username.."); break; case "wrong_password": TPL::message("You entered a wrong password.."); break; } } } // set render TPL::render("v_login/login"); break; /* * logout user */ /* * logout user */ case "logout": // sign out user USER::logout(); // redirect redirect(LINKS::get("admin_login")); break; } }
*/ case "templates_list": TPL::assign("templates_list", DRAWLINE::templates_list()); TPL::render('v_design/templates_list'); break; /* * install a template */ /* * install a template */ case "template_install": if (isset($_GET['package'])) { $package = str_replace(array("/", ".."), "", $_GET['package']); if (file_exists(FOLDER_EXTENDER . "templates" . DS . $package . DS . "index.php")) { if (OPTIONS::set("website", "frontend_template", $package)) { TPL::message("The template was changed successfuly.", "success"); } else { TPL::message("We encounted an error. Please try again!"); } } else { TPL::message("I can't find this template on the server."); } } else { redirect(ADMIN_URL); } TPL::assign("templates_list", DRAWLINE::templates_list()); TPL::render('v_design/templates_list'); break; } }
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 die('ok'); } // get backgrounds list ---------------------------------------- $backgrounds = array(); foreach (glob(FOLDER_ADMIN . "template/assets/backgrounds/*.{jpg,png}", GLOB_BRACE) as $bg) { $infos = array("link" => str_replace(array(FOLDER_BASE, DS), array(BASE_URL, "/"), $bg), "img" => basename($bg), "thumb" => str_replace(array(FOLDER_BASE, DS), array(BASE_URL, "/"), $bg)); $infos['current'] = $infos['link'] == admin_get_background(true) ? true : false; $backgrounds[] = $infos; } TPL::assign("backgrounds", $backgrounds); // ------------------------------------------------------------- // set render TPL::render("v_settings/settings_backend"); break; case "email": TPL::render("v_settings/settings_email"); break; case "backup": TPL::render("v_settings/settings_backup"); break; } }
// show success message TPL::message("Changes to this group was applied successfully.", 'success'); // clear post data $_POST = array(); } } // select details about this group $sel = $db->query("SELECT * FROM dl_users_groups WHERE group_id = '" . $group_id . "'"); // if group doesn't exist if ($db->num_rows($sel) == 0) { redirect(ADMIN_URL); } $group_infos = $db->fetch_array($sel); $persmissions_list = array(); if ($group_id != 1) { $group_infos['group_permissions'] = explode(",", $group_infos['group_permissions']); $sel = $db->query("SELECT * FROM dl_users_permissions ORDER BY permission_module ASC"); while ($row = $db->fetch_array($sel)) { $row['permission_activated'] = in_array($row['permission_id'], $group_infos['group_permissions']) ? true : false; $persmissions_list[$row['permission_module']][] = $row; } } TPL::assign("groups_list", $persmissions_list); TPL::assign("group", $group_infos); TPL::render('v_users/groups_edit'); break; default: die("Error 404!"); break; } }
if (CONTENT::set_content($produs, CONTENT::get("content_id"))) { TPL::message("Actualizarile au fost efectuate cu success.", "success"); } else { TPL::message("S-au intampinat niste erori. Va rugam reincercati!"); } // update content CONTENT::get_content(CONTENT::get("content_id")); } CONTENT::$current['content_text'] = object2array(json_decode(CONTENT::$current['content_text'])); if (isset(CONTENT::$current['content_text']['caracteristici'])) { CONTENT::$current['content_text']['caracteristici'] = stripslashes(implode("\r\n", CONTENT::$current['content_text']['caracteristici'])); } else { CONTENT::$current['content_text']['caracteristici'] = ''; } if (!isset(CONTENT::$current['content_text']['descriere'])) { CONTENT::$current['content_text']['descriere'] = ''; } else { CONTENT::$current['content_text']['descriere'] = stripslashes(CONTENT::$current['content_text']['descriere']); } if (CONTENT::$current['content_attachment'] == '') { CONTENT::$current['content_attachment'] = array(); } else { CONTENT::$current['content_attachment'] = explode(",", CONTENT::$current['content_attachment']); } // assign TPL::assign("content", CONTENT::get()); // set render TPL::render(FOLDER_pPBUC . "viewers_admin" . DS . "page_produs_edit"); }); } });
if (isset($_GET['do'])) { switch ($_GET['do']) { case "edit": break; case "add": break; case "delete": break; } } else { if (isset($_POST['new_cat_order']) && is_json($_POST['new_cat_order'])) { $data = object2array(json_decode($_POST['new_cat_order'])); function recurse_update($array, $parent = 0) { global $db; foreach ($array as $pos => $val) { $upd = $db->query(" UPDATE dl_categories \n SET category_parent = '" . $db->real_escape($parent) . "', \n category_sort = '" . $db->real_escape($pos) . "' \n WHERE category_id = '" . $db->real_escape($val['id']) . "'"); if (isset($val['children'])) { recurse_update($val['children'], $val['id']); } } } recurse_update($data); die("ok"); } $categories = CONTENT::get_categories(); // assign data TPL::assign('categories', $categories); // set rander TPL::render('v_categories/categories_list'); }
public static function render($tpl = '') { if ($tpl == '') { return self::$render; } else { // check if tamplate exists if (!self::check_template($tpl)) { // write error to log LOGS::write("Template not found << " . $tpl . " >> in " . self::dir(), "warning", true); } // set render self::$render = $tpl; } }
$page['content_title'] = strip_tags($_POST['page_title']); $page['content_text'] = $_POST['page_content']; $page['content_category'] = $_POST['page_category']; $page['content_slug'] = $_POST['page_slug'] == '' ? slugify($_POST['page_title']) : $_POST['page_slug']; $page['content_visible'] = $_POST['page_visible']; // update content if (CONTENT::set_content($page, $_GET['id']) !== false) { // show success message TPL::message('Continutul a fost actualizat cu succes!', 'success'); } } // assign data TPL::assign("content", CONTENT::get()); TPL::assign('categories', CONTENT::get_categories()); // set render TPL::render('v_pages/page_types/page_text'); }); EVENTS::add_action("before_render", function () { EVENTS::do_action("edit_page_" . CONTENT::get('content_type')); }); break; /* * delete page */ /* * delete page */ case "delete": $page_id = $db->real_escape($_GET['id']); $del = $db->query("DELETE FROM dl_content WHERE content_id = '{$page_id}'"); redirect(LINKS::get("admin_pages"));
function show_404() { // do programmed events EVENTS::do_action("on_error_404"); // change header status header("HTTP/1.0 404 Not Found"); // change title if isn't setted if (TPL::thing("head", "title") == '') { TPL::thing("head", "title", "Error 404 | Page not found"); } // set render and draw if (TPL::check_template("page_404")) { TPL::render("page_404"); TPL::draw(true); } else { echo "<h1>Error 404! Not found</h1>"; } }
} // redirect redirect(LINKS::get("admin_menus_view", $menu_id)); } /* * daca se vrea stergerea unui element */ if (isset($_POST['btn_delete_item'])) { $del = $db->query("DELETE FROM dl_menus_items WHERE item_id = '{$item_id}'"); $upd = $db->query("UPDATE dl_menus_items SET item_parent = '0' WHERE item_parent = '{$item_id}'"); redirect(LINKS::get("admin_menus_view", $menu_id)); } // select all menus $current_menus = $db->query_fetch("SELECT * FROM dl_menus ORDER BY menu_title ASC"); // select current menu infos $menu = $db->query_fetch("SELECT * FROM dl_menus WHERE menu_id = '{$menu_id}'")[0]; $menu['items'] = $db->query_fetch("SELECT * FROM dl_menus_items WHERE item_menu = '{$menu_id}' ORDER BY item_parent, item_sort ASC"); $c_item = $db->query_fetch("SELECT * FROM dl_menus_items WHERE item_id = '{$item_id}' LIMIT 1")[0]; $c_item['item_link'] = generate_link($c_item['item_value']); // generate tree $menu['items'] = generate_tree($menu['items']); //print_array($c_item); // assign data TPL::assign("current_menus", $current_menus); TPL::assign("c_menu", $menu); TPL::assign("c_item", $c_item); // set render TPL::render('v_content/content_menus'); break; } }
<?php TPL::render("index"); TPL::thing('head', 'title', 'Drawline | Draw your success line');
include FOLDER_WEBAPP . "services" . DS . "service_minify.php"; // service SITEMAP include FOLDER_WEBAPP . "services" . DS . "service_sitemap.php"; // service THUMBS include FOLDER_WEBAPP . "services" . DS . "service_thumbs.php"; URL::route("/", function () { TPL::render("pages/page_home"); }); if (CONTENT::is_page()) { TPL::thing("head", "title", CONTENT::$current['content_title']); EVENTS::add_action("view_page_page_text", function () { TPL::assign("content", CONTENT::get()); TPL::render("pages/page_text"); }); EVENTS::add_action("before_render", function () { EVENTS::do_action("view_page_" . CONTENT::get("content_type")); }); URL::routed(true); } if (!URL::routed()) { $request = URL::get_request(); if (substr($request, -1) == '/') { $request = substr($request, 0, -1); } $not_allowed = array("home", "text", "404", "maintenance"); if (TPL::check_template("page_" . $request) && !in_array($request, $not_allowed)) { TPL::render("page_" . $request); URL::routed(true); } } //LOGS::export("html", true);
} // 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"));
* uninstall plugins */ /* * uninstall plugins */ case "plugin_uninstall": $package = $_GET['package']; if (DRAWLINE::plugin_installed($package)) { if (DRAWLINE::uninstall_plugin($package)) { TPL::message("The plugin " . $package . " was succesfully uninstalled!", "success"); } else { if (empty(TPL::get_messages('error'))) { TPL::message("We encounted some errors during the uninstallition of " . $package . ". Please try again!"); } } } else { TPL::message("This plugin is not installed. You can't uninstall an uninstalled plugin :)"); } TPL::assign("plugins", DRAWLINE::plugins_list()); TPL::render('v_extender/extender_plugins'); break; /* * drawline marketplace */ /* * drawline marketplace */ case "marketplace": break; } }