%PDF- %PDF-
Direktori : /home/nailstv/public_html/de.nails.tv/admin_back/ |
Current File : /home/nailstv/public_html/de.nails.tv/admin_back/menupontok.php |
<?php require_once '../config/config.php'; $page = new Page('admin', true); $page->assign('content', menupontok()); $page->display('admin/page.tpl.html'); //////////////////////////////////////////////////////////////////////////////// function menupontok() { $c = new Content(); $v = new Inputvalidator; $db = Registry::get('db'); $table = 'menupont'; if(isset($_GET['delete'])) $db->delete($_GET['delete'], $table); if(isset($_GET['edit'])) $c->assign('edit', $db->select($_GET['edit'], $table)); if(!empty($_POST['torol'])) $db->deleteMultiple($_POST['torol'], $table); if($_POST && empty($_POST['torol'])) { $rec = validate($_POST, $v); if($v->isError) { $c->assign('error', $v->printError()); $c->assign('edit', $rec); $_GET['add'] = 1; } else { if(empty($_POST['id'])) { $rec['id'] = $db->GenID('_' . $table . '_id'); $rec['old_cim']=$rec['cim']; $rec['old_szoveg']=$rec['szoveg']; $rec['old_title']=$rec['title']; $rec['old_description']=$rec['description']; $rec['old_keywords']=$rec['keywords']; $db->insert($rec, $table); } else { $rec['id'] = $_POST['id']; $db->update($rec, $table); } header("Location: " . $_SERVER['PHP_SELF']); die; } } if(!isset($_GET['add'])) { menupontList($c, $db, $table); } return $c->fetch('admin/menupontok.tpl.html'); } function menupontList($c, $db, $table) { $sql = "SELECT m.id, m.cim FROM menupont m WHERE m.storno = 'f' ORDER BY m.cim"; $r = $db->Execute($sql); $menupontok = $r->GetArray(); $c->assign('menupontok', $menupontok); $c->assign('table', $table); } function validate($rec, $v) { $msg = array('Címet kötelező megadni!'); $rec['cim'] = $v->v($rec['cim'], 'required, stripHtml', $msg); return $rec; } ?>