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'); }
function _page($thing, $return = false) { $val = CONTENT::page($thing); if ($return == true) { return $val; } else { echo $val; } }
$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")); break; default: die("Undefined action");
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);
} // if base url is not defined in config file if (!defined("BASE_URL")) { define("BASE_URL", URL::get_base_url()); } /* CONNECT TO DATABASE */ $db = new MYSQLI_DB(CONFIG_DATABASE_HOST, CONFIG_DATABASE_PORT, CONFIG_DATABASE_USERNAME, CONFIG_DATABASE_PASSWORD, CONFIG_DATABASE_DBNAME); if (DEBUG_MODE == true) { $db->sql_debug = true; $db->sql_query_monitor = true; } if ($db->conn === false) { if (DEBUG_MODE == true) { die('Error initializing the database connection.'); } else { die; } } /* INITIALIZATIONS */ URL::init(); USER::init(); LINKS::init(BASE_URL, ADMINISTRATOR_URL_PATH); CONTENT::init(); DRAWLINE::init(); // set cache folder CACHE::config("cache_folder", FOLDER_CACHE); // remove $path variable if (isset($path)) { $path = NULL; unset($path); }