示例#1
0
 public function keys()
 {
     $result = array();
     foreach (iv::get('scripts') as $key => $script) {
         $result[$key] = $script['name'];
     }
     return $result;
 }
示例#2
0
 public static function init()
 {
     if (is_file('cache/system.php')) {
         self::$data = (include 'cache/system.php');
     } else {
         self::$data = self::rebuildCache();
     }
 }
示例#3
0
 public function __construct($p)
 {
     $loader = new Twig_Loader_Filesystem(array($p, 'assets/template/'));
     $this->twig = new Twig_Environment($loader, array());
     $this->twig->addGlobal('base_dir', $p);
     $options = iv::get('template');
     foreach ($options['filter'] as $filter) {
         $this->twig->addFilter(new Twig_SimpleFilter($filter['name'], $filter['callback']));
     }
 }
示例#4
0
 public function checkRights($type)
 {
     /** @var rights_container $rights */
     $rights = iv::get('rights');
     $user = iv::get('user');
     $flags = $rights->flags('forum', $this->id);
     $prop = 'public_' . $type;
     if (!$user || !$this->{$prop} && !$flags[$type]) {
         throw new Exception('Sie haben keinen Zugriff auf dieses Forum!');
     }
 }
示例#5
0
 public function __construct($file)
 {
     $this->file = $file;
     $this->context['js'] = iv::get('js');
     $this->context['css'] = iv::get('css');
     if (isset($_GET['plain'])) {
         $this->format = 'plain';
     }
     if (isset($_GET['json'])) {
         $this->format = 'json';
     }
 }
示例#6
0
 public function markRead()
 {
     if (!($user = iv::get('user'))) {
         return;
     }
     if ($this->last_post < $user->last_read) {
         db()->forum_unread->del("thread = %d AND create_by = %d", $this->id, $user->id);
     } else {
         db()->user_data->updateRow(array('last_read' => $this->last_post), $user->id);
         db()->query("\n\t\t\t\tREPLACE INTO forum_unread (thread, create_by, create_date)\n\t\t\t\tSELECT id, %d, %d FROM forum_thread\n\t\t\t\tWHERE last_post > %d AND last_post < %d", $user->id, time(), $user->last_read, $this->last_post);
     }
 }
示例#7
0
 public function keys()
 {
     $menu = $result = array();
     foreach (iv::get('moduls') as $mod) {
         $menu[$mod['file']] = $mod['name'];
     }
     foreach (glob('moduls/*.php') as $file) {
         $key = substr($file, 7, -4);
         $name = $menu[$key] ?: $key;
         $result[$key] = $name;
     }
     return $result;
 }
示例#8
0
 public function __construct($user, $sysadmin)
 {
     $rights = db()->query("SELECT g.rights FROM user_group_owner go\n\t\t\tJOIN user_groups g on go.`group` = g.id WHERE go.user = %d\n\t\t\tAND go.start_date < %d\n\t\t\tAND ( go.end_date IS NULL OR go.end_date > %d)", $user, time(), time());
     foreach ($rights as $r) {
         if ($r = unserialize($r['rights'])) {
             $this->rights = array_merge_recursive($this->rights, $r);
         }
     }
     foreach (iv::get('rights') as $type => $provider) {
         $class = literal($provider['provider']);
         $this->providers[$type] = new $class($provider['arguments'], $provider['always']);
         $this->providers[$type]->name = literal($provider['caption']);
     }
     $this->sysadmin = $sysadmin;
 }
示例#9
0
 public function listBoards()
 {
     $boards = db()->query("\n\t\t\tSELECT * FROM forum_board\n\t\t\tWHERE parent IS NULL")->objects(null, 'forum_board');
     /** @var rights_container $rights */
     $rights = iv::get('rights');
     foreach ($boards as $i => $board) {
         if (!$board->public_read && !$rights->has('forum', $board->id)) {
             unset($boards[$i]);
             continue;
         }
         $board->subs = $board->getBoards();
         $board->threads = $board->getThreads();
         $board->writable = false;
     }
     $this->context['boards'] = $boards;
     template('forum/boards')->display($this->context);
 }
示例#10
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');
示例#11
0
        require $file;
    }
}
spl_autoload_register('ivAutoloader');
// Magic Quotes entfernen
if (get_magic_quotes_gpc()) {
    function strip_quotes(&$value)
    {
        $value = stripslashes($value);
    }
    $gpc = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
    array_walk_recursive($gpc, 'strip_quotes');
}
// Funktion
require 'inc/functions.php';
try {
    // Datenbankverbindung herstellen
    require 'inc/database.config.php';
} catch (Exception $e) {
    // Datenbankzugangsdaten sollen nicht als Stacktrace ausgegeben werden
    die('Could not connect to database');
}
// Objekte initialisieren
iv::init();
iv::put('db', $db);
iv::put('conf', $conf = new data_options('base_conf', iv::get('options')));
iv::put('session', $session = new session_iv('IVSESSID'));
// Sitzung beenden
if (isset($_GET['logout'])) {
    $session->logout();
}
示例#12
0
<?php

// rebuild cache on every pageload
iv::rebuildCache();
示例#13
0
 public function getOptions()
 {
     return iv::get($this->info['ref']);
 }
示例#14
0
 public function install($writer)
 {
     // Write files to disc and clean db
     $files = db()->query("SELECT path, content FROM update_file WHERE package = '%s' AND content IS NOT NULL", $this->id);
     foreach ($files as $file) {
         $writer->put($file['path'], base64_decode($file['content']));
     }
     // Remove files from db
     db()->query("UPDATE update_file SET content = NULL WHERE package = '%s'", $this->id);
     db()->query("OPTIMIZE TABLE `update_file` ");
     // Ensure stuff, you know
     $packageInfo = json_decode(file_get_contents($this->packageFileName()), true);
     if (isset($packageInfo['directories'])) {
         foreach ($packageInfo['directories'] as $dir => $mod) {
             $writer->dir($dir, $mod);
         }
     }
     if (class_exists('iv')) {
         iv::rebuildCache();
     }
     db()->update_package->insert(array('id' => $this->id, 'version' => $this->version, 'source' => $this->server), 'REPLACE');
 }
示例#15
0
 iv::put('rights', $rights = new rights_container($user->id, $user->type & 4));
 iv::put('profil', $profil = new data_options('user_details', $profilInfo, array('user' => $user->id)));
 $view = new view('admin');
 $modul = $_GET['modul'];
 if (!preg_match('/^[-\\w]+(\\.[-\\w]+)*$/', $modul) || !is_file('moduls/' . $modul . '.php') || !$rights->has('modul', $modul)) {
     $modul = 'iv.nav';
 }
 define('MODUL_SELF', IV_SELF . 'modul=' . $modul);
 // Start Output Buffer
 ob_start();
 $assignment = array_map('intval', $db->base_menu_point->get('user = %d', $user->id)->relate('category', 'modul'));
 $menu = array(array('name' => 'Allgemein', 'children' => array()));
 foreach ($db->base_menu_category->get('user = %d', $user->id) as $cat) {
     $menu[$cat['id']] = array('name' => $cat['name'], 'children' => array());
 }
 foreach (iv::get('moduls') as $point) {
     if ($rights->has('modul', $point['file'])) {
         if (isset($assignment[$point['file']])) {
             $cat = $assignment[$point['file']];
             if ($cat) {
                 $menu[$cat]['children'][] = $point;
             }
         } else {
             $menu[0]['children'][] = $point;
         }
     }
 }
 try {
     $modulrights = $rights->flags('modul', $modul);
     $view->assign('menu', $menu);
     include 'moduls/' . $modul . '.php';
示例#16
0
 private function addReply($text)
 {
     $user = iv::get('user');
     db()->comments->insert(array('thread' => $this->id, 'text' => $text, 'user' => $user->id, 'date' => time()));
 }
示例#17
0
            $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();
    $grid[0]->box($rc->get_list(), 'Kategorien');
    $grid[0]->box($rc->get_form(), 'Kategorie ändern');
    $grid[1]->box($form, 'Menü Verwalten');
} else {
    $cat = isset($menu[$_GET['category']]) ? $menu[$_GET['category']] : $menu[0];
    $view->content(template('iv.nav.list')->render($cat));
}
示例#18
0
        $view->content($grid = new widget_grid(6, 6));
        $grid[0]->box(template('iv.content.layertree')->render(array('tree' => $root, 'self' => $self, 'create' => $rc_layer->get_create(), 'current' => intval($_GET['layeredit']), 'panelgroups' => db()->query("SELECT DISTINCT `group` FROM content_panel")->values(), 'startpage' => $conf->page->startpage)), 'Layerliste');
        //		if( !empty( $_GET['layeredit'])) {
        //			$edit = $rc_layer->get_edit($_GET['layeredit']);
        //			$grid[1]->box($edit, 'Layer bearbeiten');
        //		}
        $panelform = $rc_panel->get_form();
        $panelform->id = 'panelform';
        $liste = $rc_panel->get_list();
        $liste->list->id = 'panellist';
        $liste->list->unshift(new list_column_format(' ', '<div class="btn btn-small handle" data-panel="%d"><span class="icon-move"></span></div>', 'id'));
        $grid[1]->box($liste, 'Panelliste');
        $grid[1]->box($panelform, 'Panel ' . (empty($_GET['paneledit']) ? 'erstellen' : 'bearbeiten'));
    }
} else {
    $scripts = iv::get('scripts');
    if (!($panel = db()->id_get('content_panel', $_GET['content']))) {
        throw new Exception('Das angeforderte Panel wurde nicht gefunden!');
    } elseif (!$rights->has('script', $panel['script'])) {
        throw new Exception('Sie besitzen keine berechtigung auf dieses Panel zuzugreifen.');
    } elseif (!($script = $scripts[$panel['script']])) {
        throw new Exception('Das angeforderte Script wurde nicht gefunden!');
    } elseif (empty($script['editor'])) {
        throw new Exception('Für dieses Panel bestehen keine Möglichkeiten zur Inhaltsbearbeitung.');
    } else {
        define('LAYER_SELF', MODUL_SELF . '&layeredit=' . $panel['layer']);
        define('EDITOR_SELF', MODUL_SELF . '&content=' . $panel['id']);
        $panelvars = $pvgl = db()->select('content_variable', "panel = {$panel['id']}")->relate('value', 'name');
        include 'scripts/' . $script['editor'] . '.php';
        foreach ($panelvars as $key => $var) {
            if ($pvgl[$key] != $var) {
示例#19
0
            $path = strtolower(array_shift($arguments));
            $page = $db->query("SELECT id FROM content_layer WHERE name = '%s'", $path)->value() ?: $conf->page->startpage;
        }
        $layer = db()->id_get('content_layer', $page);
        if ($layer['link']) {
            throw new redirect($layer['link']);
        }
        // Acces rights prüfen
        // Page self setzen
        if ($path == strtolower($layer['name'])) {
            define('PAGE_SELF', $_SERVER['REDIRECT_URL'] . '?');
        } else {
            define('PAGE_SELF', IV_SELF . 'page=' . $layer['id'] . '&');
        }
        $template = $layer['template'] ? 'layer/' . $layer['template'] : 'layer/index';
        $renderer = new cms_renderer($layer, iv::get('scripts'));
        $view = new view($template);
        foreach ($renderer->getLayer($user) as $key => $value) {
            $view->assign($key, $value);
        }
        $view->assign('options', $conf);
        $view->display();
    } else {
        $interface = $_GET['interface'];
        if (!preg_match('/^[-\\w]+(\\.[-\\w]+)*$/', $interface) || !is_file('interfaces/' . $interface . '.php')) {
            throw new Exception('Interface not found!');
        }
        include 'interfaces/' . $interface . '.php';
    }
} catch (redirect $e) {
    header('Location: ' . $e->getMessage());