$new_name = uniqid() . str_replace(array(".", "_", " "), array("", "-", ""), $new_name) . "." . $file_ext; $produs_attash[] = $new_name; move_uploaded_file($produs_imagini['tmp_name'][$n], FOLDER_pPBUC_CONTENT . $new_name); } } if (CONTENT::get("content_attachment") != '') { $produs_attash = CONTENT::get("content_attachment") . "," . implode(",", $produs_attash); } else { $produs_attash = implode(",", $produs_attash); } // create text $produs_text = array("caracteristici" => $produs_caracteristici, "descriere" => $produs_descriere); // create produs $produs = array("content_title" => $produs_denumire, "content_text" => json_encode($produs_text), "content_slug" => $produs_slug, "content_attachment" => $produs_attash); // update 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'] = '';
// get current content CONTENT::get_content($_GET['id']); // if page doesn't exist if (empty(CONTENT::get())) { redirect(LINKS::get("admin_pages")); } EVENTS::add_action("edit_page_page_text", function () { if (isset($_POST['btn_submit'])) { // filter $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; /*