Beispiel #1
0
 public function index()
 {
     $pack = $this->package;
     $self = MODUL_SELF . '&edit=' . $pack['id'];
     $cond = db()->format("package = '%s'", $pack['id']);
     $rcf = new data_controller('update_file', $self . '#tabs-2-hash');
     $rcf->add('path', 'Datei-Pfad');
     $rcf->add('version', 'Version');
     $rcf->edit = $rcf->create = false;
     $rcf->condition = $cond;
     $rcf->prefix = 'file_';
     $rcf->pk = 'path';
     $plink = MODUL_SELF . '&action=add_files&edit=' . $pack['id'];
     $addbtn = '<p align="center"><input type="button" class="btn btn-primary" ' . 'value="Dateien hinzufügen" onclick="popup( \'' . $plink . '\', 800 )"></p>';
     if ($rcf->run()) {
         throw new redirect($self . '#tabs-2-hash');
     }
     $rcs = new data_controller('update_share', $self . '#tabs-3-hash');
     $rcs->add('comment', 'Kommentar', 1, 1, 1, 1);
     $rcs->add('pattern', 'Freigabe', 1, 1, 1, 1);
     $rcs->condition = $cond;
     $rcs->auto['create'] = array('package' => $pack['id']);
     $rcs->prefix = 'share_';
     if ($rcs->run()) {
         throw new redirect($self . '#tabs-3-hash');
     }
     $depend = array_keys($GLOBALS['packages']);
     $rcd = new data_controller('update_dependency', $self . '#tabs-4-hash');
     $rcd->add('required', 'Benötigtes Paket', 1, 1, 1, 1, 'select', $depend);
     $rcd->add('version', 'Version', 1, 1, 1, 1);
     $rcd->condition = $cond;
     $rcd->auto['create'] = array('package' => $pack['id']);
     $rcd->prefix = 'depend_';
     if ($rcd->run()) {
         throw new redirect($self . '#tabs-4-hash');
     }
     $tabs = new widget_tabs('update_files', $self);
     $tabs->add('Infos', template('iv.packages.info')->render($pack));
     $tabs->add('Dateien', $rcf->get_list(25) . $addbtn);
     $tabs->add('Freigaben', $rcs->get_form() . $rcs->get_list());
     $tabs->add('Abhängigkeiten', $rcd->get_form() . $rcd->get_list());
     $this->view->box($tabs, 'Paket bearbeiten', '600px');
 }
Beispiel #2
0
        $passform->password('pass_new', 'Neues Passwort');
        $passform->password('pass_rep', 'Passwort Wiederholung');
        $tabs->add('Password', $msg . $passform);
    }
    if ($modulrights['rights']) {
        $i++;
        if (isset($_POST['type'])) {
            $type = 4 * $_POST['type']['sysadmin'] + 2 * $_POST['type']['backend'] + $_POST['type']['frontend'];
            db()->id_update('user_data', array('type' => $type), $_GET['edit']);
            throw new redirect($uri . '#tabs-' . $i . '-hash');
        }
        $typeform = new form_renderer($uri . '#tabs-' . $i . '-hash');
        $typeform->checkbox('type[frontend]', 'Frontend', $edituser['type'] & 1);
        $typeform->checkbox('type[backend]', 'Backend', $edituser['type'] & 2);
        $typeform->checkbox('type[sysadmin]', 'Sysadmin', $edituser['type'] & 4);
        $tabs->add('Type', $typeform);
        $i++;
        $rc_groups = new data_controller('user_group_owner', $uri . '#tabs-' . $i . '-hash');
        $rc_groups->add('group', 'Gruppe', 1, 1, 1, 1, 'select', db()->select('user_groups')->relate());
        $rc_groups->add('start_date', 'Start Datum', 1, 1, 1, 0, 'date');
        $rc_groups->add('end_date', 'End Datum', 1, 1, 1, 0, 'date');
        $rc_groups->auto['create'] = array('user' => $edituser['id']);
        $rc_groups->condition = 'user = '******'id'];
        $rc_groups->pk = $rc_groups->prefix = 'group';
        if ($rc_groups->run()) {
            throw new redirect($uri . '#tabs-' . $i . '-hash');
        }
        $tabs->add('Rechte', $rc_groups->get_list() . '<h4>Gruppe hinzufügen</h4>' . $rc_groups->get_form());
    }
    $grid[1]->box($form . $tabs, 'User bearbeiten');
}
<?php

$rc = new data_controller('user_profil', MODUL_SELF);
$rc->add('id', 'Id', 1, 0, 0, 0);
$rc->add('name', 'Name', 1, 1, 1, 1);
$rc->add('caption', 'Beschriftung', 1, 1, 1, 1);
$rc->add('value', 'Standardwert', 0, 1, 1, 0);
$rc->add('type', 'Typ', 0, 1, 1, 1, 'select', array('text' => 'Einzeiliger Text', 'textarea' => 'Mehrzeiliger Text', 'checkbox' => 'Checkbox', 'select' => 'Auswahlfeld'));
$rc->add('options', 'Auswahlmöglichkeiten', 0, 1, 1, 0, 'textarea');
if (!empty($_GET['delete'])) {
    $field = $db->user_profil->row($_GET['delete'])->assoc();
    $db->user_details->del("category = 'profil' AND name = '%s'", $field['name']);
}
if (!empty($_GET['update'])) {
    $field = $db->user_profil->row($_GET['update'])->assoc();
    $db->user_details->update(array('name' => $_POST['name']), "category = 'profil' AND name = '%s'", $field['name']);
}
if ($rc->run()) {
    throw new redirect(MODUL_SELF);
}
$grid = $view->grid();
$grid[0]->box($rc->get_list(), 'Felder verwalten');
$grid[1]->box($rc->get_form(), 'Feld ' . (empty($_GET['edit']) ? 'erstellen' : 'bearbeiten'));
Beispiel #4
0
     } else {
         $root->children[] = $layer;
     }
 }
 if ($layerchanges) {
     // cool datastructure stuff: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
     recalcTree($root);
     $query = array();
     foreach ($layerlist as $layer) {
         $query[] = db()->format("(%d, %d, %d)", $layer->id, $layer->left, $layer->right);
     }
     db()->query("INSERT INTO content_layer (id, lft, rgt ) VALUES " . implode(',', $query) . " ON DUPLICATE KEY UPDATE lft=VALUES(lft), rgt=VALUES(rgt);");
     throw new redirect($self);
 }
 $rc_panel = new data_controller('content_panel', $self, 'panel');
 $rc_panel->add('id', 'ID', 0, 0, 0, 0, 'text');
 $rc_panel->add('name', 'Name', 1, 1, 1, 1, 'text');
 $rc_panel->add('group', 'Panelgroup', 1, 1, 1, 1, 'text');
 $rc_panel->add('status', 'Status', 1, 1, 1, 0, 'select', iv::get('panelstatus'));
 $rc_panel->add('layer', 'Layer', 0, 0, 1, 0, 'select', $layers);
 $rc_panel->add('script', 'Script', 1, 1, 0, 1, 'select', $scripts);
 $rc_panel->add('template', 'Template', 1, 1, 1, 0, 'select', $panel_templates);
 $rc_panel->add('prio', 'Priorität', 1, 1, 1, 0, 'text');
 $rc_panel->option('assets/small/brush.png', 'content', 'Inhalt bearbeiten');
 $rc_panel->condition = $_GET['layeredit'] ? 'layer = ' . intval($_GET['layeredit']) : 'layer is null';
 $rc_panel->auto['create'] = array('layer' => $_GET['layeredit']);
 if ($rc_panel->run()) {
     throw new redirect($self);
 }
 if (!empty($_GET['editform'])) {
     $view->content($rc_layer->get_edit($_GET['editform']));
Beispiel #5
0
 public function index()
 {
     global $conf;
     $categoryId = intval($_GET['category']);
     $self = MODUL_SELF . '&category=' . $categoryId;
     // upload files
     if (isset($_FILES['file']) && isset($_POST['category'])) {
         $file = $_FILES['file'];
         $category = intval($_POST['category']);
         if (!$file['name'] && !$file['tmp_name']) {
             $this->view->error('Es muss eine Datei für den Upload ausgewählt werden!');
         } elseif (!$category) {
             $this->view->error('Es muss eine Kategorie für den Upload ausgewählt werden!');
         } else {
             // May be restricted by modul rights later
             $types = array('png', 'jpg', 'jpeg', 'gif');
             $fileClass = new upload_attachment($file);
             $fileClass->restrictFileSize(1024 * 1024 * 2)->restrictType($types);
             $fileClass->attach('media', $category);
             $fileClass->save(self::UPLOAD_DIR . 'upload_' . uniqid());
             $this->view->success('Upload erfolgreich!');
         }
     }
     // move files
     if (isset($_GET['move']) && $categoryId) {
         upload_list::move($_GET['move'], $categoryId);
         throw new redirect($self);
     }
     // delete file hook
     if (isset($_GET['deleteImg'])) {
         $img = db()->t('content_upload')->row((int) $_GET['deleteImg'])->assoc();
         upload_list::delete($img['id']);
         $writer = new writer_fs();
         $writer->delete($img['path']);
         $this->view->success('Datei erfolgreich gelöscht!');
     }
     // category data controller
     $rc = new data_controller('content_upload_category', $self);
     $rc->add('id', 'ID', 1, 0, 0, 0);
     $rc->add('name', 'Name');
     // edit category form
     if ($_GET['edit']) {
         $this->view->content($rc->get_edit($_GET['edit']));
         $this->view->format = 'plain';
         return;
     }
     // delete hook
     if (isset($_GET['delete'])) {
         $list = new upload_list('media');
         if ($list->get($_GET['delete'])->num_rows()) {
             $this->view->error('Die Kategorie kann nicht gelöscht werden, da sie noch Dateien enthält!');
             $run = false;
         } else {
             $run = true;
         }
     } else {
         $run = true;
     }
     // run category actions
     if ($run && $rc->run()) {
         throw new redirect($self);
     }
     // upload form
     $uploadForm = new form_renderer($self, 'Hochladen');
     $uploadForm->select('category', 'Kategorie', array(0 => "Bitte Wählen") + db()->t('content_upload_category')->get(1)->relate(), $categoryId);
     $uploadForm->upload('file', 'Datei');
     $error = false;
     $data = array();
     // filter files by category
     if ($_GET['category'] > 0) {
         $list = new upload_list('media');
         $data = $list->get($categoryId);
         if (!$data->num_rows()) {
             $error = 'Keine Ergebnisse!';
         }
     } else {
         $error = "Keine Ergebnisse!";
     }
     // render the page
     $this->view->content(template('iv.media')->render(array('categories' => db()->t('content_upload_category')->all(), 'modul_self' => MODUL_SELF, 'current' => $categoryId, 'images' => $data, 'url' => trim($conf->page->url, '/'), 'error' => $error, 'category' => $categoryId, 'uploadForm' => $uploadForm, 'createForm' => $rc->get_create())));
 }
Beispiel #6
0
            recalcTree($child);
            $child->right = ++$counter;
        }
    }
}
$boards = db()->select('forum_board')->relate();
$boards[0] = 'System Root';
if (!empty($_REQUEST['parent'])) {
    // do not allow cyclic references
    $board = $_GET['update'] ?: $_GET['move'];
    if (db()->query("SELECT 1 FROM forum_board node JOIN forum_board sub\n\t\t\tON node.lft < sub.lft AND node.rgt > sub.rgt\n\t\t\tWHERE node.id = %d AND sub.id = %d", $board, $_REQUEST['parent'])->value()) {
        throw new Exception('You can not do that!');
    }
}
$rc = new data_controller('forum_board', MODUL_SELF);
$rc->add('name', 'Name', 1, 1, 1, 1);
$rc->add('description', 'Description', 1, 1, 1, 0);
$rc->add('parent', 'Parent', 0, 1, 1, 0, 'select', $boards);
$rc->add('public_read', 'Lesen (Jeder)', 0, 1, 1, 0, 'checkbox');
$rc->add('public_write', 'Schreiben (Jeder)', 0, 1, 1, 0, 'checkbox');
$rc->add('public_reply', 'Antworten (Jeder)', 0, 1, 1, 0, 'checkbox');
$changes = $rc->run();
if (!empty($_GET['move'])) {
    db()->id_update('forum_board', array('parent' => $_GET['parent']), $_GET['move']);
    $changes = db()->affected_rows;
}
$list = db()->select('forum_board')->objects('id');
$root = new stdClass();
foreach ($list as $board) {
    if ($board->parent) {
        $list[$board->parent]->children[] = $board;
Beispiel #7
0
         if ($category == -1) {
             $delete[] = $db->format("'%s'", $file);
         } else {
             $insert[] = $db->format("( %d, '%s', %s )", $user->id, $file, intval($category) ?: 'NULL');
         }
     }
     if (count($insert)) {
         $db->query("REPLACE INTO base_menu_point ( user, modul, category )\n\t\t\t\t\tVALUES " . implode(',', $insert));
     }
     if (count($delete)) {
         $db->query("DELETE FROM base_menu_point\n\t\t\t\t\tWHERE user = %d AND modul IN (" . implode(',', $delete) . ")", $user->id);
     }
     throw new redirect($self);
 }
 $rc = new data_controller('base_menu_category', $self);
 $rc->add('name', 'Name', 1, 1, 1, 1);
 $rc->auto['create'] = array('user' => $user->id);
 $rc->condition = $db->format('user = %d', $user->id);
 if ($rc->run()) {
     throw new redirect($self);
 }
 $possible = $db->base_menu_category->all()->relate();
 $possible[-1] = 'Allgemein';
 $possible[0] = 'Versteckt';
 $form = new form($self);
 foreach (iv::get('moduls') as $mod) {
     if ($rights->has('modul', $mod['file'])) {
         $form->select('points[' . $mod['file'] . ']', $mod['name'], $possible, isset($assignment[$mod['file']]) ? $assignment[$mod['file']] : -1);
     }
 }
 $grid = $view->grid();
Beispiel #8
0
<?php

$rights = iv::get('rights');
$_POST['rights'] = serialize($_POST['r']);
$rc = new data_controller('user_groups', MODUL_SELF);
$rc->add('name', 'Name', 1, 1, 1, 1);
$rc->add('rights', 'Rechte', 0, 0, 1, 0, 'hidden');
if ($rc->run()) {
    throw new redirect(MODUL_SELF . '&edit=' . intval($_GET['update']));
}
$grid = $view->grid();
$grid[0]->box($rc->get_create(), 'Gruppe erstellen');
$grid[0]->box($rc->get_list(), 'Gruppen verwalte');
if (!empty($_GET['edit']) && ($group = db()->id_get('user_groups', $_GET['edit']))) {
    $form = $rc->get_edit($_GET['edit']);
    $form->append($tabs = new tabs());
    $grouprights = (array) unserialize($group['rights']);
    foreach ($rights->providers as $type => $provider) {
        $inputs = array();
        $typerights = $grouprights[$type] ?: array();
        foreach ($provider->keys() as $key => $caption) {
            if (!isset($provider->always[$key])) {
                $inputs[] = $inp = new form_field_boxtree("r[{$type}][{$key}]", $caption, isset($typerights[$key]));
                foreach ($provider->flagNames($key) as $flag => $caption) {
                    $inp->sub("r[{$type}][{$key}][{$flag}]", $caption, isset($typerights[$key][$flag]));
                }
            }
        }
        $tabs->add($provider->name, implode($inputs));
    }
    $grid[1]->box($form, 'Rechte bearbeiten');