Beispiel #1
0
<?php

$todo = isset($_GET['todo']) ? $_GET['todo'] : null;
switch ($todo) {
    case 'delete':
        $exampleCat = new ExampleCategories($_GET['id']);
        if ($exampleCat->id) {
            $players = ExamplePlayers::getAllFromCat($_GET['id']);
            foreach ($players as $player) {
                $player->delete();
            }
            $exampleCat->delete();
            Messages::addNotice('Category successfully deleted');
        } else {
            Messages::addError('Delete Failed');
        }
        break;
    case 'up':
        $c = new ExampleCategories($_GET['id']);
        $c->moveUp();
        break;
    case 'down':
        $c = new ExampleCategories($_GET['id']);
        $c->moveDown();
        break;
}
$ec = new ExampleCategories();
$smarty->assign('c_list', $ec->getAll(' ORDER BY `display_order` ASC'));
Beispiel #2
0
         Messages::addError('Background image missing.');
         $error_nr++;
     }
 }
 if ($error_nr > 0) {
     $_SESSION['post'] = $_POST;
     jump("index.php?page=examples&action=add_edit" . $append);
 }
 $_POST['c_url'] = preg_replace('/[^a-zA-Z0-9.]+/', '-', $_POST['c_url']);
 if (isset($_GET['id']) && $_GET['id'] != '') {
     //edit
     $c = new ExampleCategories($_GET['id']);
     Messages::addNotice('Category edited!');
 } else {
     //add
     $c = new ExampleCategories();
     Messages::addNotice('Category added!');
 }
 $c->title = $_POST['c_title'];
 $c->url = $_POST['c_url'];
 $c->seo_title = $_POST['c_seo_title'];
 $c->height = $_POST['height'];
 $c->seo_description = $_POST['c_seo_description'];
 $c->seo_keywords = $_POST['c_seo_keywords'];
 $c->short_description = $_POST['c_sdesc'];
 $c->description = $_POST['c_desc'];
 $c->more_description = $_POST['c_mdesc'];
 $c->save('display_order');
 if (!empty($_FILES['background']['name'])) {
     $finfo = getimagesize($_FILES['background']['tmp_name']);
     if (!isset($finfo['mime'])) {