*/ if (isset($_GET['action'])) { if ($_GET['action'] == 'add') { if (isset($_POST['mode']) && CODOF\Access\CSRF::valid($_POST['CSRF_token'])) { $blk_name = $_POST['blk_name']; //title $blk_region = $_POST['region']; $block_type = $_POST['block_type']; $plugin_name = isset($_POST['plugin_name']) ? $_POST['plugin_name'] : ''; $block_html = $_POST['block_html']; $block_page_visi_type = $_POST['block_page_visi_type']; $pages = $_POST['pages']; if ($block_type == 'html') { $plugin_name = 'html'; } $array = array('module' => $plugin_name, 'theme' => $B->get_current_theme(), 'status' => 0, 'weight' => 0, 'region' => $blk_region, 'content' => $block_html, 'visibility' => (int) $block_page_visi_type, 'pages' => $pages, 'title' => $blk_name); if ($_POST['mode'] == 'add') { $id = DB::table(PREFIX . "codo_blocks")->insertGetId($array); } else { if ($_POST['mode'] == 'edit') { $id = (int) $_POST['bid']; DB::table(PREFIX . "codo_blocks")->where('id', $id)->update($array); } } DB::table(PREFIX . "codo_block_roles")->where('bid', '=', $id)->delete(); $roles = array(); $i = 0; if (isset($_POST['roles'])) { foreach ($_POST['roles'] as $role) { $roles[$i]['bid'] = $id; $roles[$i]['rid'] = $role;