public static function formBlock($module) { $form = form::factory('module', 'id=' . $module->getModulId(), 'index.php'); $form->setSave(false); $form->addFormAttribute('class', ''); $form->setSuccessMessage(null); $input = $module->OutputFilter($form->get('input'), $module->getSql()); $form->addRawField($input); $form->addHiddenField('structure_id', $module->getStructureId()); if ($module->getId()) { $form->setMode('edit'); $online = $module->get('online'); } else { $form->setMode('add'); $online = 1; $form->delButton('save-back'); } $form->addHiddenField('modul', $module->getModulId()); $form->addHiddenField('sort', $module->getSort()); $field = $form->addRadioField('online', $online); $field->fieldName(lang::get('block_status')); $field->add(1, lang::get('online')); $field->add(0, lang::get('offline')); $form->addHiddenField('id', $module->getId()); $form->addParam('structure_id', type::super('structure_id', 'int')); return $form; }
public static function saveFile($file, $form) { if (!is_uploaded_file($file['tmp_name'])) { return $form; } $fileName = mediaUtils::fixFileName($file['name']); $fileDir = dir::media($fileName); $extension = substr(strrchr($fileName, '.'), 1); // z.B. jpg $badExtensions = dyn::get('addons')['badExtensions']; // Wenn die Datei eine "verbotene" Datei ist if (in_array($extension, $badExtensions)) { $form->setSave(false); $form->setErrorMessage(sprintf(lang::get('media_error_bad_extension'), $file['name'])); return $form; } if ($form->isEditMode()) { $media = new media(type::super('id', 'int', 0)); } // Wenn Datei nicht Existiert // Oder man möchte sie überspeichern if ($form->isEditMode() && $media->get('filename') != $fileName || !$form->isEditMode() && file_exists($fileDir)) { $form->setSave(false); $form->setErrorMessage(sprintf(lang::get('media_error_already_exist'), $file['name'])); return $form; } if (!move_uploaded_file($file['tmp_name'], $fileDir)) { $form->setSave(false); $form->setErrorMessage(sprintf(lang::get('media_error_move'), $file['name'])); return $form; } $form->addPost('filename', $fileName); $form->addPost('size', filesize($fileDir)); return $form; }
public function getStructureId() { if ($this->isNew) { return type::super('structure_id', 'int'); } else { return $this->get('structure_id'); } }
public function getSaveValue() { $name = $this->getName(); $value = type::super($name); if (is_array($value)) { $value = '|' . implode('|', $value) . '|'; } return $value; }
public function getSaveValue() { $name = $this->getName(); $value = type::super($name); if (is_null($value)) { return ''; } return implode(',', $value); }
public static function fe($id = '', $params = []) { if ($id == '') { type::super('page_id', 'int', dyn::get('start_page')); } $url = extension::get('URL_REWRITE', ['id' => $id, 'params' => $params]); if (!extension::has('URL_REWRITE')) { $url = 'index.php?page_id=' . $id; foreach ($params as $name => $value) { $url .= '&' . $name . '=' . $value; } } return $url; }
public static function getButtons() { $page = type::super('page', 'string', 'dashboard'); $action = type::super('action', 'string'); $activeA = $action == 'add' ? 'class="active"' : ''; $activeG = $action == 'games' ? 'class="active"' : ''; $activeR = ''; $activeS = $action == 'settings' ? 'class="active"' : ''; $buttons = ['add' => '<li ' . $activeA . '><a href="?page=' . $page . '&action=add">' . self::svg('add') . '</a></li>', 'games' => '<li ' . $activeG . '><a href="?page=' . $page . '&action=games">' . self::svg('game') . '</a></li>', 'refresh' => '<li ' . $activeR . '><a>' . self::svg('refresh') . '</a></li>', 'settings' => '<li ' . $activeS . '><a href="?page=' . $page . '&action=settings">' . self::svg('settings') . '</a></li>']; $return = ''; if (isset(self::$nav[$page])) { $btn = self::$nav[$page]['buttons']; if (is_array($btn) && count($btn) >= 1) { $return .= '<nav>'; $return .= '<ul>'; foreach ($btn as $var) { $return .= $buttons[$var]; } $return .= '</ul>'; $return .= '</nav>'; } } return $return; }
<?php $pid = type::super('pid', 'int', 0); $while_id = $pid; if (ajax::is()) { $sort = type::post('array', 'array'); $sql = sql::factory(); $sql->setTable('media_cat'); foreach ($sort as $s => $id) { $sql->setWhere('id=' . $id); $sql->addPost('sort', $s + 1); $sql->update(); } ajax::addReturn(message::success(lang::get('save_sorting'), true)); } while ($while_id) { $sql = sql::factory(); $sql->query('SELECT name, pid FROM ' . sql::table('media_cat') . ' WHERE id=' . $while_id)->result(); if ($pid != $while_id) { $breadcrumb[] = '<li><a href="' . url::backend('media', ['pid' => $while_id, 'subpage' => 'category']) . '">' . $sql->get('name') . '</a></li>'; } else { $breadcrumb[] = '<li class="active">' . $sql->get('name') . '</li>'; } $while_id = $sql->get('pid'); } $breadcrumb[] = '<li><a href="' . url::backend('media', ['subpage' => 'category']) . '">' . lang::get('start') . '</a></li>'; echo '<ul class="breadcrumb">' . implode('', array_reverse($breadcrumb)) . '</ul>'; if ($action == 'delete' && dyn::get('user')->hasPerm('media[category][delete]')) { $error = []; $sql = sql::factory(); $sql->query('SELECT id FROM ' . sql::table('media_cat') . ' WHERE `pid` = ' . $id)->result();
userPerm::add('media[category][edit]', lang::get('media[category][edit]')); userPerm::add('media[category][delete]', lang::get('media[category][delete]')); if (dyn::get('user')->hasPerm('media[edit]') || dyn::get('user')->hasPerm('media[delete]') || dyn::get('user')->hasPerm('media[category][edit]') || dyn::get('user')->hasPerm('media[category][delete]')) { backend::addNavi(lang::get('media'), url::backend('media'), 'picture-o', 2, function () { return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'media.php'); }); } form::addClassMethod('addMediaField', function ($name, $value) { return $this->addField($name, $value, 'formMedia'); }); form::addClassMethod('addMediaListField', function ($name, $value) { return $this->addField($name, $value, 'formMediaList'); }); $page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); $action = type::super('action', 'string'); pageArea::addType('varsMedia'); pageArea::addType('varsMedialist'); if (addonConfig::isActive('metainfos')) { metainfosPage::addType('DYN_MEDIA'); metainfosPage::addType('DYN_MEDIA_LIST'); if ($page == 'meta') { backend::addSubNavi(lang::get('media'), url::backend('meta', ['subpage' => 'media']), 'circle', -1, function () { return dir::addon('mediamanager', 'page' . DIRECTORY_SEPARATOR . 'meta.media.php'); }); } if ($page == 'media' && $subpage == 'files' && in_array($action, ['add', 'edit'])) { extension::add('FORM_BEFORE_ACTION', function ($form) { $form = metainfos::getMetaInfos($form, 'media'); }); }
</a> </div> <?php } ?> <div class="clearfix"></div> </div> <div class="panel-body"> <select class="form-control" id="media-select-category-ajax" name="catId"> <option value="0"><?php echo lang::get('no_category'); ?> </option> <?php echo mediaUtils::getTreeStructure(0, 0, ' ', $catId); ?> </select> <div id="load"> <?php echo $table->show(); ?> </div> </div> </div> </div> </div> <?php if (!type::super('layout', 'string', false)) { exit; }
echo pageAreaHtml::formOut($form); } else { echo pageAreaHtml::selectBlock($structure_id, $sql->num() + 1); } ?> </div> </div> </div> </div> <?php //Wenn action } else { if (ajax::is() && dyn::get('user')->hasPerm('page[edit]')) { $post = type::super('array'); $sort = json_decode($post, true); pageMisc::sortStructure($sort, 0); echo message::success(lang::get('save_sorting'), true); } if (in_array($action, ['edit', 'add']) && dyn::get('user')->hasPerm('page[edit]')) { $form = form::factory('structure', 'id=' . $id, 'index.php'); $field = $form->addTextField('name', $form->get('name')); $field->fieldName(lang::get('name')); $field->autofocus(); $template = template::factory(dyn::get('template')); $field = $form->addElement('template', $template->getTemplates('template', $form->get('template'))); $field->fieldName(lang::get('template')); $field = $form->addRadioField('online', $form->get('online')); $field->fieldName(lang::get('status')); $field->add(1, lang::get('online'));
include dir::functions('convert.php'); lang::setDefault(); lang::setLang(rp::get('lang')); $DB = rp::get('DB'); sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']); unset($DB); date_default_timezone_set(rp::get('timezone', 'Europe/Berlin')); new userLogin(); rp::add('user', new user(userLogin::getUser())); cache::setCache(rp::get('cache')); addonConfig::loadAllConfig(); addonConfig::includeAllLangFiles(); addonConfig::includeAllLibs(); $page = type::super('page', 'string', 'dashboard'); $action = type::super('action', 'string'); $id = type::super('id', 'int'); $success = type::get('success', 'string'); $error = type::get('error', 'string'); if (!is_null($error)) { echo message::danger($error); } elseif (!is_null($success)) { echo message::success($success); } layout::addNav(lang::get('dashboard'), 'dashboard', 'home', ['refresh'], true); layout::addNav(lang::get('settings'), 'settings', 'settings', [], false); layout::addNav(lang::get('server'), 'server', 'list', ['add'], true); layout::addNav(lang::get('addons'), 'addons', 'alt', [], true); layout::addNav(lang::get('user'), 'user', 'users', ['add'], true); foreach (addonConfig::includeAllConfig() as $file) { include $file; }
$field->fieldName(lang::get('category')); $field = $form->addRawField('<input type="file" name="file" />'); $field->fieldName(lang::get('select_file')); if ($action == 'edit') { $form->addHiddenField('id', $id); } if ($form->isSubmit()) { type::addSession('media_cat', $form->get('category')); $file = type::files('file'); if (!is_uploaded_file($file['tmp_name']) && !$form->isEditMode()) { $form->setErrorMessage(lang::get('please_load_file')); $form->setSave(false); } else { $form = mediaUtils::saveFile($file, $form); } $category = type::super('category', 'int'); $form->addPost('category', $category); } ?> <div class="row"> <div class="col-lg-12"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title"><?php echo lang::get('media_edit'); ?> </h3> </div> <div class="panel-body"> <?php echo $form->show();
public function getSaveValue() { $name = $this->getName(); $value = type::super($name . '_id'); return $value; }
<?php error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); include '..' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'dir.php'; new dir(); include_once dir::classes('autoload.php'); autoload::register(); autoload::addDir(dir::classes('utils')); autoload::addDir('lib' . DIRECTORY_SEPARATOR . 'classes'); include dir::functions('html_stuff.php'); include dir::functions('url_stuff.php'); new dyn(); lang::setDefault(); lang::setLang(dyn::get('lang')); lang::loadLang('lib' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . lang::getLang() . '.json'); $page = type::super('page', 'string', 'licence'); ob_start(); include "layout/index.php"; $out = ob_get_contents(); ob_get_clean(); echo $out;
<?php $secondpage = type::super('secondpage', 'string'); if (!is_null($secondpage) && dyn::get('user')->hasPerm('page[content]')) { if (!is_null(type::post('save-back')) || !is_null(type::post('save'))) { slot::saveBlock(); echo message::success(lang::get('structure_content_save'), true); } if ($secondpage == 'show') { $sql = sql::factory(); $sql->query(' SELECT s.*, m.output FROM ' . sql::table('slots') . ' AS s LEFT JOIN ' . sql::table('module') . ' AS m ON m.id = s.modul WHERE s.id=' . $id)->result(); $pageArea = new pageArea($sql); $form = form::factory('module', 'id=' . $sql->get('modul'), 'index.php'); $form->setSave(false); $form->addFormAttribute('class', ''); $form->setSuccessMessage(null); $input = $pageArea->OutputFilter($form->get('input'), $sql); $form->addRawField($input); $form->addHiddenField('secondpage', $secondpage); $form->addHiddenField('id', $id); ?> <div class="row"> <div class="col-lg-12">
/** * Standarteinstellungen fürs Backend * * @return this */ public function loadBackend() { $page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); $this->addParam('page', $page); $this->addParam('subpage', $subpage); return $this; }
<?php ob_end_clean(); foreach (addonConfig::includeAllConfig() as $file) { if (file_exists($file)) { require_once $file; } } $page = type::super('page_id', 'int', dyn::get('start_page')); $page = extension::get('SET_PAGE_ID', $page); dyn::add('page_id', $page); if (page::isValid($page)) { $page = new page($page); } else { header('HTTP/1.0 404 Not Found'); $page = new page(dyn::get('error_page')); } echo $page->getTemplate();
<?php userPerm::add('metainfos[edit]', lang::get('metainfos[edit]')); userPerm::add('metainfos[delete]', lang::get('metainfos[delete]')); if (dyn::get('user')->hasPerm('metainfos[edit]') || dyn::get('user')->hasPerm('metainfos[delete]')) { backend::addAddonNavi(lang::get('metainfos'), url::backend('meta'), 'code', -1, function () { return dir::addon('metainfos', 'page' . DIRECTORY_SEPARATOR . 'meta.php'); }); } $page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); $action = type::super('action', 'string'); $structure_id = type::super('structure_id', 'string'); if ($page == 'structure' && $subpage == 'pages' && is_null($structure_id) && $action == 'edit') { extension::add('FORM_BEFORE_ACTION', function ($form) { $form = metainfos::getMetaInfos($form, 'structure'); }); }
<?php if (type::get('checkversion', 'int', 0) == 1) { $cacheFile = cache::getFileName(0, 'dynaoVersion'); cache::exist($cacheFile, 0); echo message::success(lang::get('connection_again'), true); } if (ajax::is()) { if (type::super('text')) { $mail = mail('*****@*****.**', 'Neue Idee', type::super('text'), 'From: ' . dyn::get('user')->get('firstname') . ' ' . dyn::get('user')->get('name') . '<' . dyn::get('user')->get('email') . '>'); if ($mail) { ajax::addReturn(message::success(lang::get('idea_send'))); } else { ajax::addReturn(message::danger(lang::get('idea_error'))); } } else { ajax::addReturn(message::danger(lang::get('idea_empty'))); } } $versionCheck = dyn::checkDynVersion(); if ($versionCheck === lang::get('version_fail_connect')) { $message = lang::get('version_fail_connect'); $message .= '<br /><a href="' . url::backend('dashboard', ['subpage' => 'overview', 'checkversion' => 1]) . '">' . lang::get('try_again') . '</a>'; echo message::danger($message, true); } elseif ($versionCheck) { echo message::danger($versionCheck, true); } $stats = []; $sql = sql::factory(); $numPages = $sql->num('SELECT * FROM ' . sql::table('structure')); $sql = sql::factory();
<?php if (dyn::get('user')->hasPerm('media[edit]') || dyn::get('user')->hasPerm('media[delete]')) { backend::addSubnavi(lang::get('media_manage'), url::backend('media', ['subpage' => 'files'])); } if (dyn::get('user')->hasPerm('media[category][edit]') || dyn::get('user')->hasPerm('media[category][delete]')) { backend::addSubnavi(lang::get('media_manage_cat'), url::backend('media', ['subpage' => 'category'])); } $action = type::super('action', 'string', ''); $id = type::super('id', 'int', 0); $subpage = type::super('subpage', 'string'); layout::addCSS('addons/mediamanager/layout/css/mediamanager.css'); if ($subpage == 'popup') { backend::addSubnavi('Popup', url::backend('media', ['subpage' => 'popup'])); } include_once backend::getSubnaviInclude('mediamanager');
<?php $action = type::super('action', 'string'); $id = type::super('id', 'int', 0); $subpage = type::super('subpage', 'string', 'pages'); $structure_id = type::super('structure_id', 'int'); if ($subpage == 'popup') { backend::addSubnavi('Popup', url::backend('structure', ['subpage' => 'popup'])); } if (dyn::get('user')->hasPerm('page[edit]') || dyn::get('user')->hasPerm('page[delete]') || dyn::get('user')->hasPerm('page[content]')) { backend::addSubnavi(lang::get('pages'), url::backend('structure', ['subpage' => 'pages'])); backend::addSubnavi(lang::get('blocks'), url::backend('structure', ['subpage' => 'blocks'])); } if (dyn::get('user')->hasPerm('page[module]')) { backend::addSubnavi(lang::get('modules'), url::backend('structure', ['subpage' => 'module'])); } include_once backend::getSubnaviInclude();
public static function setGets() { $page = type::super('page', 'string'); $subpage = type::super('subpage', 'string'); self::$getVars = [$page, $subpage]; }
<?php $action = type::super('action', 'string'); $addon = type::super('addon', 'string'); backend::addSubnavi(lang::get('overview'), url::backend('addons', ['subpage' => 'overview']), 'eye', 0); include_once backend::getSubnaviInclude();
<?php $catId = type::super('catId', 'int', 0); if (!$catId) { $catId = type::session('media_cat', 'int', $catId); } if (!$catId) { $sql = sql::factory(); $sql->query('SELECT id FROM ' . sql::table('media_cat') . ' ORDER BY id LIMIT 1')->result(); $catId = $sql->get('id'); } type::addSession('media_cat', $catId); $table = table::factory(['class' => ['media-table']]); $table->setSql('SELECT * FROM ' . sql::table('media') . ' WHERE `category` = ' . $catId); $table->addRow()->addCell()->addCell(lang::get('title'))->addCell(lang::get('file_type'))->addCell(lang::get('action')); $table->addCollsLayout('50,*,100,250'); $table->addSection('tbody'); if ($table->numSql()) { while ($table->isNext()) { $media = new media($table->getSql()); $select = '<button data-id="' . $table->get('id') . '" data-name="' . $table->get('filename') . '" data-loading-text="' . lang::get('selected') . '" class="btn btn-sm btn-warning dyn-media-select">' . lang::get('select') . '</button>'; if ($media->isImage()) { $icon = '<img src="' . $media->getPath() . '" />'; } else { $icon = '<i class="fa fa-file"></i>'; } $table->addRow()->addCell($icon)->addCell($media->get('title'))->addCell($media->getExtension())->addCell('<span class="btn-group">' . $select . '</span>'); $table->next(); } } else { $table->addRow()->addCell(lang::get('no_entries'), ['colspan' => 4]);