コード例 #1
0
 public function __construct($docid, rsMysql $db = null)
 {
     if (!$db) {
         $db = new rsMysql('tree');
     }
     $this->page = $db->getRow('`id` = ' . intval($docid));
     $this->set_title($this->page['name']);
     $this->set_description($this->page['beschreibung']);
     $this->set_content($this->page['content']);
     $this->set_template($this->page['template']);
     $this->docid = intval($docid);
 }
コード例 #2
0
 protected function build_list_element($dir, rsContainer $Li, $show_ids)
 {
     $Li = $this->subordinate_dir($dir, $Li);
     $filesdb = new rsMysql('files');
     $files = $filesdb->get('SELECT * FROM `' . $filesdb->get_dbtable() . '` WHERE `parentdir` = ' . $dir['id'] . ' ORDER BY `title` ASC');
     if (count($files) > 0) {
         $List = $Li->subordinate('ul');
     }
     foreach ($files as $file) {
         $this->subordinate_file($file, $List);
     }
     if ($dir['offspring'] > 0) {
         $this->list_branch($dir['id'], $Li->subordinate('ul'), $show_ids);
     }
 }
コード例 #3
0
 protected function build_groupcreation(rsContainer $Container)
 {
     if (isset($_GET['k']) && $_GET['k'] == 'groupcreation') {
         if (isset($_POST['name']) && $_POST['name'] != '') {
             $groupsdb = new rsMysql('groups');
             $rightsdb = new rsMysql('rights');
             $groupmembersdb = new rsMysql('groupmember');
             $doctree = new rsTree('tree');
             $docid = $doctree->createChild(98);
             $doctree->update(array('name' => $_POST['name']), '`id` = ' . $docid);
             $mediatree = new rsTree('media');
             $mediaid = $mediatree->createChild(1);
             $mediatree->update(array('name' => $_POST['name']), '`id` = ' . $mediaid);
             $groupsdb->insert(array('name' => $_POST['name'], 'leiter' => intval($_POST['leiter']), 'typ' => $_POST['typ'], 'docid' => $docid, 'mediaid' => $mediaid));
             $docids = $rightsdb->getColumn('docid', '`id` = ' . intval($_POST['leiter'])) . ',' . $docid;
             $mediaids = $rightsdb->getColumn('mediaid', '`id` = ' . intval($_POST['leiter'])) . ',' . $mediaid;
             $rightsdb->update_insert(array('docid' => $docids, 'mediaid' => ',' . $mediaids), array('userid' => intval($_POST['leiter'])), '`userid` = ' . intval($_POST['leiter']));
             $groupmembersdb->update_insert(array('groupid' => $this->groupdata['id'], 'userid' => $userid), '`userid` = ' . $userid . ' AND `groupid` =' . $this->groupdata['id']);
             $Container->subordinate('p', array('class' => 'success'), 'Die Gruppe "' . $_POST['name'] . '" wurde eingerichtet.');
         }
         $Container = $Container->subordinate('form', array('method' => 'post'));
         $Container->subordinate('p', '<div>Gruppenname:</div>')->subordinate('input', array('type' => 'text', 'name' => 'name'));
         $Container->subordinate('p', '<div>Leiter: <span id="foundusername"></span></div>')->subordinate('input', array('type' => 'hidden', 'name' => 'leiter', 'id' => 'inputfounduserid'))->subordinate('div', array('id' => 'getUser'));
         $Typ = $Container->subordinate('p', '<div>Gruppen-Typ:</div>')->subordinate('select', array('name' => 'typ'));
         $Typ->subordinate('option', array('value' => 'klasse'), 'Klasse');
         $Typ->subordinate('option', array('value' => 'kurs'), 'Kurs');
         $Typ->subordinate('option', array('value' => 'ag'), 'AG / Sonstige');
         $Container->subordinate('p', '<div></div>')->subordinate('input', array('type' => 'submit', 'value' => 'Einrichten'))->subordinate('input', array('type' => 'button', 'onClick' => 'document.location.href=\'?i=' . $this->docid . '&j=administration\'', 'value' => 'Abbrechen'));
     } elseif (!isset($_GET['k'])) {
         $this->build_adminpanel('Gruppen', 'group_icon.png', array(array('label' => 'Neue Gruppe gr&uuml;nden', 'action' => 'location.href=\'?i=' . $this->docid . '&j=administration&k=groupcreation\'')), $Container);
     }
 }
コード例 #4
0
 protected function get_file($fileid, $dir = null)
 {
     $filesdb = new rsMysql('files');
     $filedata = $filesdb->getRow('`id` = ' . intval($fileid));
     if (is_array($filedata) && $filedata['id'] == intval($fileid) && $this->check_file_rights($filedata)) {
         $filename = explode('.', $filedata['filename']);
         $filepath = ($dir ? $dir : '') . 'media/' . $filedata['filename'];
         $imagetypes = array('jpg', 'jpeg', 'png', 'gif', 'tif', 'tiff');
         if (in_array(strtolower($filename[1]), $imagetypes)) {
             $imagesize = getimagesize($filepath);
             $content_type = image_type_to_mime_type($imagesize[2]);
         } else {
             $content_type = 'application/' . strtolower($filename[1]);
         }
     } elseif (is_array($filedata) && ($filedata['id'] = intval($fileid))) {
         $filepath = ($dir ? $dir : '') . 'static/images/notallowed.png';
         $filename = array(1 => 'notallowed.png');
         $content_type = 'image/png';
     }
     if (!isset($filepath) || !file_exists($filepath)) {
         $filepath = ($dir ? $dir : '') . 'static/images/notfound.png';
         $filename = array(1 => 'notfound.png');
         $content_type = 'image/png';
     }
     header('Content-Type: ' . $content_type);
     header('Content-Disposition: filename=' . $filedata['title'] . '.' . strtolower($filename[1]));
     header('Content-Length: ' . filesize($filepath));
     readfile($filepath);
     return true;
 }
コード例 #5
0
 public function __construct($dbtable)
 {
     parent::__construct($dbtable);
     $this->NestedSetDB = new NestedSetBaum_MySQL($this->connection, '', TRUE);
     $this->NestedSet = new NestedSetBaum($this->dbtable, 'lft', 'rgt', 'moved', 'id', '', $this->connection, TRUE);
 }
コード例 #6
0
 protected function build_postlist(rsContainer $Container)
 {
     $Container->subordinate('h2', 'G&auml;stebuch-Eintr&auml;ge');
     $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
     $postdb = new rsMysql('guestbook');
     $entries = $postdb->get('SELECT * FROM  `%TABLE` WHERE `valid` = "1" ORDER BY `id` DESC LIMIT ' . $start . ' , ' . ($start + $this->entries_per_page));
     $Postlist = $Container->subordinate('ul', array('class' => 'guestbook list'));
     foreach ($entries as $entry) {
         $PostLi = $Postlist->subordinate('li');
         $PostLi->subordinate('div', array('class' => 'meta'), $entry['name'])->subordinate('br')->subordinate('span', array('class' => 'date'), '(' . date('d.m.Y', $entry['timestamp']) . ')')->parent_subordinate('br')->swallow($this->is_author($entry) ? ' [<a href="?i=' . $this->docid . '&delete=' . $entry['id'] . '">Eintrag l&ouml;schen</a>]' : '');
         $PostLi->subordinate('p', array('class' => 'post text'), $entry['text']);
     }
 }